Acked-by: Kai Ji <[email protected]<mailto:[email protected]>>
________________________________
From: Ciara Power <[email protected]>
Sent: 05 July 2023 11:30
To: [email protected] <[email protected]>
Cc: [email protected] <[email protected]>; Power, Ciara 
<[email protected]>; Matz, Olivier <[email protected]>; 
[email protected] <[email protected]>
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: [email protected]
Cc: [email protected]

Signed-off-by: Ciara Power <[email protected]>
---
 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

Reply via email to