From: Kirill Rybalchenko Date: Wed, 16 May 2018 14:24:31 +0000 (+0100) Subject: crypto/scheduler: fix multicore rings re-use X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=cc32201a8d834a690d76cd281acf553182894d9f;p=dpdk.git crypto/scheduler: fix multicore rings re-use When scheduler mode changed from multicore to roundrobin and back to multicore, scheduler tries to create memory rings with the same name and fails. The fix allows to lookup and re-use previously allocated memory rings. Fixes: 4c07e0552f0a ("crypto/scheduler: add multicore scheduling mode") Cc: stable@dpdk.org Signed-off-by: Kirill Rybalchenko Acked-by: Pablo de Lara Acked-by: Fan Zhang Tested-by: Reshma Pattan --- diff --git a/drivers/crypto/scheduler/scheduler_multicore.c b/drivers/crypto/scheduler/scheduler_multicore.c index 644426e93b..555c405c10 100644 --- a/drivers/crypto/scheduler/scheduler_multicore.c +++ b/drivers/crypto/scheduler/scheduler_multicore.c @@ -348,18 +348,30 @@ scheduler_create_private_ctx(struct rte_cryptodev *dev) char r_name[16]; snprintf(r_name, sizeof(r_name), MC_SCHED_ENQ_RING_NAME_PREFIX "%u", i); - mc_ctx->sched_enq_ring[i] = rte_ring_create(r_name, PER_SLAVE_BUFF_SIZE, - rte_socket_id(), RING_F_SC_DEQ | RING_F_SP_ENQ); + mc_ctx->sched_enq_ring[i] = rte_ring_lookup(r_name); if (!mc_ctx->sched_enq_ring[i]) { - CS_LOG_ERR("Cannot create ring for worker %u", i); - goto exit; + mc_ctx->sched_enq_ring[i] = rte_ring_create(r_name, + PER_SLAVE_BUFF_SIZE, + rte_socket_id(), + RING_F_SC_DEQ | RING_F_SP_ENQ); + if (!mc_ctx->sched_enq_ring[i]) { + CS_LOG_ERR("Cannot create ring for worker %u", + i); + goto exit; + } } snprintf(r_name, sizeof(r_name), MC_SCHED_DEQ_RING_NAME_PREFIX "%u", i); - mc_ctx->sched_deq_ring[i] = rte_ring_create(r_name, PER_SLAVE_BUFF_SIZE, - rte_socket_id(), RING_F_SC_DEQ | RING_F_SP_ENQ); + mc_ctx->sched_deq_ring[i] = rte_ring_lookup(r_name); if (!mc_ctx->sched_deq_ring[i]) { - CS_LOG_ERR("Cannot create ring for worker %u", i); - goto exit; + mc_ctx->sched_deq_ring[i] = rte_ring_create(r_name, + PER_SLAVE_BUFF_SIZE, + rte_socket_id(), + RING_F_SC_DEQ | RING_F_SP_ENQ); + if (!mc_ctx->sched_deq_ring[i]) { + CS_LOG_ERR("Cannot create ring for worker %u", + i); + goto exit; + } } }