DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] app/crypto-perf: fix socket ID default value
@ 2023-07-05 10:30 Ciara Power
  2023-07-05 13:08 ` Ji, Kai
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ciara Power @ 2023-07-05 10:30 UTC (permalink / raw)
  To: dev; +Cc: gakhil, Ciara Power, olivier.matz, stable

Due to recent changes to the default device socket ID,
before being used as an index for session mempool list,
the socket ID should be set to 0 if unknown (-1).

Fixes: 7dcd73e37965 ("drivers/bus: set device NUMA node to unknown by default")
Cc: olivier.matz@6wind.com
Cc: stable@dpdk.org

Signed-off-by: Ciara Power <ciara.power@intel.com>
---
 app/test-crypto-perf/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index af5bd0d23b..b74e7ba118 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -651,6 +651,11 @@ main(int argc, char **argv)
 		cdev_id = enabled_cdevs[cdev_index];
 
 		uint8_t socket_id = rte_cryptodev_socket_id(cdev_id);
+		/* range check the socket_id, negative values become big
+		 * positive ones due to use of unsigned value
+		 */
+		if (socket_id >= RTE_MAX_NUMA_NODES)
+			socket_id = 0;
 
 		ctx[i] = cperf_testmap[opts.test].constructor(
 				session_pool_socket[socket_id].sess_mp,
-- 
2.25.1


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

* Re: [PATCH] app/crypto-perf: fix socket ID default value
  2023-07-05 10:30 [PATCH] app/crypto-perf: fix socket ID default value Ciara Power
@ 2023-07-05 13:08 ` Ji, Kai
  2023-07-05 18:07 ` [EXT] " Akhil Goyal
  2023-07-06 10:51 ` [PATCH v2] " Ciara Power
  2 siblings, 0 replies; 5+ messages in thread
From: Ji, Kai @ 2023-07-05 13:08 UTC (permalink / raw)
  To: Power, Ciara, dev; +Cc: gakhil, Matz, Olivier, stable

[-- Attachment #1: Type: text/plain, Size: 1617 bytes --]

Acked-by: Kai Ji <kai.ji@intel.com<mailto:kai.ji@intel.com>>
________________________________
From: Ciara Power <ciara.power@intel.com>
Sent: 05 July 2023 11:30
To: dev@dpdk.org <dev@dpdk.org>
Cc: gakhil@marvell.com <gakhil@marvell.com>; Power, Ciara <ciara.power@intel.com>; Matz, Olivier <olivier.matz@6wind.com>; stable@dpdk.org <stable@dpdk.org>
Subject: [PATCH] app/crypto-perf: fix socket ID default value

Due to recent changes to the default device socket ID,
before being used as an index for session mempool list,
the socket ID should be set to 0 if unknown (-1).

Fixes: 7dcd73e37965 ("drivers/bus: set device NUMA node to unknown by default")
Cc: olivier.matz@6wind.com
Cc: stable@dpdk.org

Signed-off-by: Ciara Power <ciara.power@intel.com>
---
 app/test-crypto-perf/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index af5bd0d23b..b74e7ba118 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -651,6 +651,11 @@ main(int argc, char **argv)
                 cdev_id = enabled_cdevs[cdev_index];

                 uint8_t socket_id = rte_cryptodev_socket_id(cdev_id);
+               /* range check the socket_id, negative values become big
+                * positive ones due to use of unsigned value
+                */
+               if (socket_id >= RTE_MAX_NUMA_NODES)
+                       socket_id = 0;

                 ctx[i] = cperf_testmap[opts.test].constructor(
                                 session_pool_socket[socket_id].sess_mp,
--
2.25.1


[-- Attachment #2: Type: text/html, Size: 3440 bytes --]

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

* RE: [EXT] [PATCH] app/crypto-perf: fix socket ID default value
  2023-07-05 10:30 [PATCH] app/crypto-perf: fix socket ID default value Ciara Power
  2023-07-05 13:08 ` Ji, Kai
@ 2023-07-05 18:07 ` Akhil Goyal
  2023-07-06 10:51 ` [PATCH v2] " Ciara Power
  2 siblings, 0 replies; 5+ messages in thread
From: Akhil Goyal @ 2023-07-05 18:07 UTC (permalink / raw)
  To: Ciara Power, dev; +Cc: olivier.matz, stable

> Due to recent changes to the default device socket ID,
> before being used as an index for session mempool list,
> the socket ID should be set to 0 if unknown (-1).
> 
> Fixes: 7dcd73e37965 ("drivers/bus: set device NUMA node to unknown by
> default")
> Cc: olivier.matz@6wind.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ciara Power <ciara.power@intel.com>
> ---
>  app/test-crypto-perf/main.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
> index af5bd0d23b..b74e7ba118 100644
> --- a/app/test-crypto-perf/main.c
> +++ b/app/test-crypto-perf/main.c
> @@ -651,6 +651,11 @@ main(int argc, char **argv)
>  		cdev_id = enabled_cdevs[cdev_index];
> 
>  		uint8_t socket_id = rte_cryptodev_socket_id(cdev_id);
> +		/* range check the socket_id, negative values become big
> +		 * positive ones due to use of unsigned value
> +		 */
> +		if (socket_id >= RTE_MAX_NUMA_NODES)
> +			socket_id = 0;

Shouldn't we make this as
int socket_id = rte_cryptodev_socket_id(cdev_id);
if (socket_id == SOCKET_ID_ANY)
	socket_id = 0;	/* Use the first socket if SOCKET_ID_ANY is returned. */

Since rte_cryptodev_socket_id returns signed value,
the application should not typecast it to unsigned value and then check for max value.
Same comment for the ipsec-secgw patch.


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

* [PATCH v2] app/crypto-perf: fix socket ID default value
  2023-07-05 10:30 [PATCH] app/crypto-perf: fix socket ID default value Ciara Power
  2023-07-05 13:08 ` Ji, Kai
  2023-07-05 18:07 ` [EXT] " Akhil Goyal
@ 2023-07-06 10:51 ` Ciara Power
  2023-07-06 18:13   ` [EXT] " Akhil Goyal
  2 siblings, 1 reply; 5+ messages in thread
From: Ciara Power @ 2023-07-06 10:51 UTC (permalink / raw)
  To: dev; +Cc: gakhil, Ciara Power, bruce.richardson, olivier.matz, stable, Kai Ji

Due to recent changes to the default device socket ID,
before being used as an index for session mempool list,
the socket ID should be set to 0 if unknown (-1).

Fixes: 7dcd73e37965 ("drivers/bus: set device NUMA node to unknown by default")
Fixes: 64c469b9e7d8 ("app/crypto-perf: check range of socket id")
Cc: bruce.richardson@intel.com
Cc: olivier.matz@6wind.com
Cc: stable@dpdk.org

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Kai Ji <kai.ji@intel.com>
---
v2: check if socket ID equals SOCKET_ID_ANY
---
 app/test-crypto-perf/main.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index af5bd0d23b..bc1f0f9659 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -193,11 +193,10 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
 #endif
 
 		struct rte_cryptodev_info cdev_info;
-		uint8_t socket_id = rte_cryptodev_socket_id(cdev_id);
-		/* range check the socket_id - negative values become big
-		 * positive ones due to use of unsigned value
-		 */
-		if (socket_id >= RTE_MAX_NUMA_NODES)
+		int socket_id = rte_cryptodev_socket_id(cdev_id);
+
+		/* Use the first socket if SOCKET_ID_ANY is returned. */
+		if (socket_id == SOCKET_ID_ANY)
 			socket_id = 0;
 
 		rte_cryptodev_info_get(cdev_id, &cdev_info);
@@ -650,7 +649,11 @@ main(int argc, char **argv)
 
 		cdev_id = enabled_cdevs[cdev_index];
 
-		uint8_t socket_id = rte_cryptodev_socket_id(cdev_id);
+		int socket_id = rte_cryptodev_socket_id(cdev_id);
+
+		/* Use the first socket if SOCKET_ID_ANY is returned. */
+		if (socket_id == SOCKET_ID_ANY)
+			socket_id = 0;
 
 		ctx[i] = cperf_testmap[opts.test].constructor(
 				session_pool_socket[socket_id].sess_mp,
-- 
2.25.1


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

* RE: [EXT] [PATCH v2] app/crypto-perf: fix socket ID default value
  2023-07-06 10:51 ` [PATCH v2] " Ciara Power
@ 2023-07-06 18:13   ` Akhil Goyal
  0 siblings, 0 replies; 5+ messages in thread
From: Akhil Goyal @ 2023-07-06 18:13 UTC (permalink / raw)
  To: Ciara Power, dev; +Cc: bruce.richardson, olivier.matz, stable, Kai Ji

> Due to recent changes to the default device socket ID,
> before being used as an index for session mempool list,
> the socket ID should be set to 0 if unknown (-1).
> 
> Fixes: 7dcd73e37965 ("drivers/bus: set device NUMA node to unknown by
> default")
> Fixes: 64c469b9e7d8 ("app/crypto-perf: check range of socket id")
> Cc: bruce.richardson@intel.com
> Cc: olivier.matz@6wind.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ciara Power <ciara.power@intel.com>
> Acked-by: Kai Ji <kai.ji@intel.com>
> ---
Acked-by: Akhil Goyal <gakhil@marvell.com>

Applied to dpdk-next-crypto
Thanks.

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

end of thread, other threads:[~2023-07-06 18:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-05 10:30 [PATCH] app/crypto-perf: fix socket ID default value Ciara Power
2023-07-05 13:08 ` Ji, Kai
2023-07-05 18:07 ` [EXT] " Akhil Goyal
2023-07-06 10:51 ` [PATCH v2] " Ciara Power
2023-07-06 18:13   ` [EXT] " Akhil Goyal

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