DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org
Cc: David Marchand <david.marchand@redhat.com>
Subject: [PATCH] app/test: fix PMD perf test on devices with no socket ID
Date: Sat, 22 Oct 2022 10:31:09 +0200	[thread overview]
Message-ID: <20221022083108.3759-1-olivier.matz@6wind.com> (raw)

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


             reply	other threads:[~2022-10-22  8:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-22  8:31 Olivier Matz [this message]
2022-10-24  7:12 ` [PATCH v2] " Olivier Matz
2022-10-24 11:37   ` David Marchand

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=20221022083108.3759-1-olivier.matz@6wind.com \
    --to=olivier.matz@6wind.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@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).