DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] app/test: fix PMD perf test on devices with no socket ID
@ 2022-10-22  8:31 Olivier Matz
  2022-10-24  7:12 ` [PATCH v2] " Olivier Matz
  0 siblings, 1 reply; 3+ messages in thread
From: Olivier Matz @ 2022-10-22  8:31 UTC (permalink / raw)
  To: dev; +Cc: David Marchand

If the socket ID of a device is unknown, rte_eth_dev_socket_id(portid)
now returns -1 instead of 0 since commit 7dcd73e37965 ("drivers/bus: set
device NUMA node to unknown by default").

This change breaks the pmd_perf test on environment where the device
socket ID is unknown. The test fails with the following error, because
it does not find a lcore on socket -1:

> No avail lcore to run test

Take the new behavior in account in the pmd_perf test: in this
environment, the test can now run on any lcore, and not only those from
socket 0 (this was the old behavior).

Bugzilla ID: 1105
Fixes: 7dcd73e37965 ("drivers/bus: set device NUMA node to unknown by default")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 app/test/test_pmd_perf.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c
index fe765c4173..300c3a8a6f 100644
--- a/app/test/test_pmd_perf.c
+++ b/app/test/test_pmd_perf.c
@@ -265,13 +265,14 @@ init_mbufpool(unsigned nb_mbuf)
 }
 
 static uint16_t
-alloc_lcore(uint16_t socketid)
+alloc_lcore(int socketid)
 {
 	unsigned lcore_id;
 
 	for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
 		if (LCORE_AVAIL != lcore_conf[lcore_id].status ||
-		    lcore_conf[lcore_id].socketid != socketid ||
+		    (socketid != -SOCKET_ID_ANY &&
+		     lcore_conf[lcore_id].socketid != socketid) ||
 		    lcore_id == rte_get_main_lcore())
 			continue;
 		lcore_conf[lcore_id].status = LCORE_USED;
@@ -711,17 +712,18 @@ test_pmd_perf(void)
 	num = 0;
 	RTE_ETH_FOREACH_DEV(portid) {
 		if (socketid == -1) {
-			socketid = rte_eth_dev_socket_id(portid);
-			worker_id = alloc_lcore(socketid);
+			worker_id = alloc_lcore(rte_eth_dev_socket_id(portid));
 			if (worker_id == (uint16_t)-1) {
 				printf("No avail lcore to run test\n");
 				return -1;
 			}
+			socketid = rte_lcore_to_socket_id(worker_id);
 			printf("Performance test runs on lcore %u socket %u\n",
 			       worker_id, socketid);
 		}
 
-		if (socketid != rte_eth_dev_socket_id(portid)) {
+		if (socketid != rte_eth_dev_socket_id(portid) &&
+		    rte_eth_dev_socket_id(portid) != SOCKET_ID_ANY) {
 			printf("Skip port %d\n", portid);
 			continue;
 		}
-- 
2.30.2


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

end of thread, other threads:[~2022-10-24 11:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-22  8:31 [PATCH] app/test: fix PMD perf test on devices with no socket ID Olivier Matz
2022-10-24  7:12 ` [PATCH v2] " Olivier Matz
2022-10-24 11:37   ` David Marchand

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