crypto/scheduler: fix possible duplicated ring names
authorFan Zhang <roy.fan.zhang@intel.com>
Wed, 16 May 2018 13:10:32 +0000 (14:10 +0100)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Tue, 22 May 2018 14:36:11 +0000 (16:36 +0200)
This patch fixes the possible duplicated ring names in multi-core
scheduler. Originally two or more multi-core schedulers may have
same worker ring names thus will cause initialization error.

Fixes: 4c07e0552f0a ("crypto/scheduler: add multicore scheduling mode")
Cc: stable@dpdk.org
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
drivers/crypto/scheduler/scheduler_multicore.c

index 555c405..b4c29d7 100644 (file)
@@ -347,7 +347,8 @@ scheduler_create_private_ctx(struct rte_cryptodev *dev)
        for (i = 0; i < sched_ctx->nb_wc; i++) {
                char r_name[16];
 
-               snprintf(r_name, sizeof(r_name), MC_SCHED_ENQ_RING_NAME_PREFIX "%u", i);
+               snprintf(r_name, sizeof(r_name), MC_SCHED_ENQ_RING_NAME_PREFIX
+                               "%u_%u", dev->data->dev_id, i);
                mc_ctx->sched_enq_ring[i] = rte_ring_lookup(r_name);
                if (!mc_ctx->sched_enq_ring[i]) {
                        mc_ctx->sched_enq_ring[i] = rte_ring_create(r_name,
@@ -360,7 +361,8 @@ scheduler_create_private_ctx(struct rte_cryptodev *dev)
                                goto exit;
                        }
                }
-               snprintf(r_name, sizeof(r_name), MC_SCHED_DEQ_RING_NAME_PREFIX "%u", i);
+               snprintf(r_name, sizeof(r_name), MC_SCHED_DEQ_RING_NAME_PREFIX
+                               "%u_%u", dev->data->dev_id, i);
                mc_ctx->sched_deq_ring[i] = rte_ring_lookup(r_name);
                if (!mc_ctx->sched_deq_ring[i]) {
                        mc_ctx->sched_deq_ring[i] = rte_ring_create(r_name,