Skip to contentSkip to conversation

crypto/scheduler: fix multicore rings re-use

PATCH Superseded Kirill Rybalchenko 4 participants 8 messages May 14, 2018 – May 17, 2018 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 drivers/crypto/scheduler/scheduler_multicore.c | 28 ++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)
drivers/crypto/scheduler/scheduler_multicore.c +20 -8
index b2ce44c..206bf86 100644
@@ -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;
+			}
 		}
 	}
 
Signature · 1 line
2.5.5
Acked-by on v1 1/1
#1 lore raw

Thanks a lot!

Quoted 8 lines

-----Original Message-----
From: Rybalchenko, Kirill
Sent: Monday, May 14, 2018 7:53 AM
To: [email protected]
Cc: [email protected]; Rybalchenko, Kirill <[email protected]>; Zhang, Roy Fan <[email protected]>
Subject: [PATCH] crypto/scheduler: fix multicore rings re-use

Quoted 8 lines

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")
Acked-by on v1 1/1
#2 lore raw
In reply to Kirill Rybalchenko
Quoted 10 lines

-----Original Message-----
From: stable [mailto:[email protected]] On Behalf Of Kirill Rybalchenko
Sent: Monday, May 14, 2018 7:53 AM
To: [email protected]
Cc: [email protected]; Rybalchenko, Kirill <[email protected]>; Zhang, Roy Fan <[email protected]>
Subject: [dpdk-stable] [PATCH] crypto/scheduler: fix multicore rings re-use

Quoted 7 lines

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

Missing Cc: [email protected] in commit message.

#4 lore raw

PATCH v2 1/1 crypto/scheduler: fix multicore rings re-use

In reply to Kirill Rybalchenko

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

v2:
Rebase to head of dpdk-dev master branch

---
 drivers/crypto/scheduler/scheduler_multicore.c | 28 ++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)
drivers/crypto/scheduler/scheduler_multicore.c +20 -8
index 644426e..555c405 100644
@@ -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;
+			}
 		}
 	}
 
Signature · 1 line
2.5.5
Acked-by Acked-by Fan Zhang on v2 1/1
#5 lore raw
Quoted 14 lines

-----Original Message-----
From: stable [mailto:[email protected]] On Behalf Of Kirill Rybalchenko
Sent: Wednesday, May 16, 2018 3:25 PM
To: [email protected]
Cc: [email protected]; Rybalchenko, Kirill <[email protected]>; Zhang, Roy Fan <[email protected]>
Subject: [dpdk-stable] [PATCH v2] 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.

Quoted 5 lines
Fixes 4c07e0552f0a ("crypto/scheduler: add multicore scheduling mode")

v2:
Rebase to head of dpdk-dev master branch

The changelog should go after the three dashes, so it is not a part of the commit when merged.

Quoted 2 lines

You forgot to include the two previous acks (if you send another revision, add them).

Pablo

Tested-by on v2 1/1
#6 lore raw
In reply to Kirill Rybalchenko

Hi,

Quoted 12 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Kirill Rybalchenko
Sent: Wednesday, May 16, 2018 3:25 PM
To: [email protected]
Cc: [email protected]; Rybalchenko, Kirill <[email protected]>; Zhang, Roy Fan <[email protected]>
Subject: [dpdk-dev] [PATCH v2] 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.

Quoted 7 lines
Fixes 4c07e0552f0a ("crypto/scheduler: add multicore scheduling mode")

v2:
Rebase to head of dpdk-dev master branch

#7 lore raw
Quoted 24 lines

-----Original Message-----
From: stable [mailto:[email protected]] On Behalf Of Pattan, Reshma
Sent: Thursday, May 17, 2018 12:24 PM
To: Rybalchenko, Kirill <[email protected]>; [email protected]
Cc: [email protected]; Rybalchenko, Kirill <[email protected]>; Zhang, Roy Fan <[email protected]>
Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v2] crypto/scheduler: fix multicore rings re-use

Hi,

Quoted 11 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Kirill Rybalchenko
Sent: Wednesday, May 16, 2018 3:25 PM
To: [email protected]
Cc: [email protected]; Rybalchenko, Kirill <[email protected]>; Zhang, Roy Fan <[email protected]>
Subject: [dpdk-dev] [PATCH v2] crypto/scheduler: fix multicore rings re-use

Quoted 11 lines
Quoted 3 lines

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.

Quoted 7 lines
Fixes 4c07e0552f0a ("crypto/scheduler: add multicore scheduling

mode")
Cc: [email protected]

v2:
Rebase to head of dpdk-dev master branch

Removed this changelog.

Quoted 4 lines
Quoted 2 lines

Applied to dpdk-next-crypto.
Thanks,

Pablo