app/test: fix PMD perf test on devices with no socket ID
PATCH 1/1 app/test: fix PMD perf test on devices with no socket ID
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:
Quoted 1 line
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
--- app/test/test_pmd_perf.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
app/test/test_pmd_perf.c +7 -5
@@ -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 ; }
Signature · 1 line
2.30.2
PATCH v2 1/1 app/test: fix PMD perf test on devices with no socket ID
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:
Quoted 1 line
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
---
v2:
* fix typo (-SOCKET_ID_ANY instead of SOCKET_ID_ANY)
app/test/test_pmd_perf.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
app/test/test_pmd_perf.c +7 -5
@@ -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 ; }
Signature · 1 line
2.30.2
Quoted 11 lines · Olivier Matz
If the socket ID of a device is unknown,
rte_eth_dev_socket_id(portid)now returns -1 instead of 0 since commit7dcd73e37965("drivers/bus: set device NUMA node to unknown by default").This change breaks the
pmd_perftest 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:Quoted 1 line
No avail lcore to run test
Quoted 8 lines
Take the new behavior in account in the
pmd_perftest: 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 <[email protected]>
From the bugzilla comments:
Applied, thanks.
Signature · 1 line
David Marchand