patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] crypto/scheduler: fix multicore rings re-use
@ 2018-05-14  6:52 Kirill Rybalchenko
  2018-05-14 10:01 ` Zhang, Roy Fan
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Kirill Rybalchenko @ 2018-05-14  6:52 UTC (permalink / raw)
  To: dev; +Cc: stable, kirill.rybalchenko, roy.fan.zhang

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")

Signed-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
---
 drivers/crypto/scheduler/scheduler_multicore.c | 28 ++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/drivers/crypto/scheduler/scheduler_multicore.c b/drivers/crypto/scheduler/scheduler_multicore.c
index b2ce44c..206bf86 100644
--- a/drivers/crypto/scheduler/scheduler_multicore.c
+++ b/drivers/crypto/scheduler/scheduler_multicore.c
@@ -346,18 +346,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);
-			return -1;
+			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);
+				return -1;
+			}
 		}
 		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);
-			return -1;
+			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);
+				return -1;
+			}
 		}
 	}
 
-- 
2.5.5

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-05-17 16:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-14  6:52 [dpdk-stable] [PATCH] crypto/scheduler: fix multicore rings re-use Kirill Rybalchenko
2018-05-14 10:01 ` Zhang, Roy Fan
2018-05-16  8:44 ` De Lara Guarch, Pablo
2018-05-16 12:57 ` [dpdk-stable] [dpdk-dev] " Pattan, Reshma
2018-05-16 14:24 ` [dpdk-stable] [PATCH v2] " Kirill Rybalchenko
2018-05-16 15:43   ` De Lara Guarch, Pablo
2018-05-17 11:24   ` [dpdk-stable] [dpdk-dev] " Pattan, Reshma
2018-05-17 16:15     ` De Lara Guarch, Pablo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).