DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] crypto/scheduler: fix possible duplicated ring names
@ 2018-05-14 10:09 Fan Zhang
  2018-05-16  9:42 ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 2+ messages in thread
From: Fan Zhang @ 2018-05-14 10:09 UTC (permalink / raw)
  To: dev; +Cc: roy.fan.zhang, kirill.rybalchenko, stable, pablo.de.lara.guarch

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

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.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 drivers/crypto/scheduler/scheduler_multicore.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/scheduler/scheduler_multicore.c b/drivers/crypto/scheduler/scheduler_multicore.c
index 644426e93..cd71d18ee 100644
--- a/drivers/crypto/scheduler/scheduler_multicore.c
+++ b/drivers/crypto/scheduler/scheduler_multicore.c
@@ -347,14 +347,18 @@ 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",
+				sched_ctx->wc_pool[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);
 		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);
+		snprintf(r_name, sizeof(r_name),
+				MC_SCHED_DEQ_RING_NAME_PREFIX "%u",
+				sched_ctx->wc_pool[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);
 		if (!mc_ctx->sched_deq_ring[i]) {
-- 
2.13.6

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

* Re: [dpdk-dev] [PATCH] crypto/scheduler: fix possible duplicated ring names
  2018-05-14 10:09 [dpdk-dev] [PATCH] crypto/scheduler: fix possible duplicated ring names Fan Zhang
@ 2018-05-16  9:42 ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 2+ messages in thread
From: De Lara Guarch, Pablo @ 2018-05-16  9:42 UTC (permalink / raw)
  To: Zhang, Roy Fan, dev; +Cc: Rybalchenko, Kirill, stable

Hi Fan,

> -----Original Message-----
> From: Zhang, Roy Fan
> Sent: Monday, May 14, 2018 11:09 AM
> To: dev@dpdk.org
> Cc: Zhang, Roy Fan <roy.fan.zhang@intel.com>; Rybalchenko, Kirill
> <kirill.rybalchenko@intel.com>; stable@dpdk.org; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>
> Subject: [PATCH] crypto/scheduler: fix possible duplicated ring names
> 
> Fixes: 4c07e0552f0a ("crypto/scheduler: add multicore scheduling mode")

Fixes line goes before "Signed-off-by" and after the description of the patch.
Also, CC: stable@dpdk.org should go after Fixes line.

> 
> 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.
> 
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> ---
>  drivers/crypto/scheduler/scheduler_multicore.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/crypto/scheduler/scheduler_multicore.c
> b/drivers/crypto/scheduler/scheduler_multicore.c
> index 644426e93..cd71d18ee 100644
> --- a/drivers/crypto/scheduler/scheduler_multicore.c
> +++ b/drivers/crypto/scheduler/scheduler_multicore.c
> @@ -347,14 +347,18 @@ 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",
> +				sched_ctx->wc_pool[i]);

We could potentially have 2 scheduler sharing same cores, right?
I mean, performance wise, it doesn't make sense, but it should still work.
In this case, it wouldn't work, so we might need a different name.
I'd say using the scheduler id and the index "i" should work.

Thanks,
Pablo

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-14 10:09 [dpdk-dev] [PATCH] crypto/scheduler: fix possible duplicated ring names Fan Zhang
2018-05-16  9:42 ` 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).