DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ciara Power <ciara.power@intel.com>
To: dev@dpdk.org
Cc: gakhil@marvell.com, Ciara Power <ciara.power@intel.com>,
	bruce.richardson@intel.com, olivier.matz@6wind.com,
	stable@dpdk.org, Kai Ji <kai.ji@intel.com>
Subject: [PATCH v2] app/crypto-perf: fix socket ID default value
Date: Thu,  6 Jul 2023 10:51:51 +0000	[thread overview]
Message-ID: <20230706105151.1215328-1-ciara.power@intel.com> (raw)
In-Reply-To: <20230705103047.1127985-1-ciara.power@intel.com>

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


  parent reply	other threads:[~2023-07-06 10:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-05 10:30 [PATCH] " Ciara Power
2023-07-05 13:08 ` Ji, Kai
2023-07-05 18:07 ` [EXT] " Akhil Goyal
2023-07-06 10:51 ` Ciara Power [this message]
2023-07-06 18:13   ` [EXT] [PATCH v2] " Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230706105151.1215328-1-ciara.power@intel.com \
    --to=ciara.power@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=kai.ji@intel.com \
    --cc=olivier.matz@6wind.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).