[dpdk-dev,v1] app/test: fix pmd_perf issue in no NUMA case

Message ID 1433745194-27771-1-git-send-email-cunming.liang@intel.com (mailing list archive)
State Changes Requested, archived
Headers

Commit Message

Cunming Liang June 8, 2015, 6:33 a.m. UTC
  Reported-by: Jayakumar, Muthurajan <muthurajan.jayakumar@intel.com>
Signed-off-by: Cunming Liang <cunming.liang@intel.com>
---
 app/test/test_pmd_perf.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
  

Comments

Thomas Monjalon June 22, 2015, 9:01 p.m. UTC | #1
2015-06-08 14:33, Cunming Liang:
> Reported-by: Jayakumar, Muthurajan <muthurajan.jayakumar@intel.com>
> Signed-off-by: Cunming Liang <cunming.liang@intel.com>

Please explain exactly what you try to fix.
Is it still needed since this patch?
	http://dpdk.org/browse/dpdk/commit/?id=94ef2964148a4540

> +	socket_id = rte_eth_dev_socket_id(port_id);
> +	if (socket_id < 0)
> +		/* enforce using socket 0 when no NUMA support */
> +		socket_id = 0;
  

Patch

diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c
index 1fd6843..6f218f7 100644
--- a/app/test/test_pmd_perf.c
+++ b/app/test/test_pmd_perf.c
@@ -321,6 +321,19 @@  alloc_lcore(uint16_t socketid)
 	return (uint16_t)-1;
 }
 
+static int
+get_socket_id(uint8_t port_id)
+{
+	int socket_id;
+
+	socket_id = rte_eth_dev_socket_id(port_id);
+	if (socket_id < 0)
+		/* enforce using socket 0 when no NUMA support */
+		socket_id = 0;
+
+	return socket_id;
+}
+
 volatile uint64_t stop;
 uint64_t count;
 uint64_t drop;
@@ -727,7 +740,7 @@  test_pmd_perf(void)
 	num = 0;
 	for (portid = 0; portid < nb_ports; portid++) {
 		if (socketid == -1) {
-			socketid = rte_eth_dev_socket_id(portid);
+			socketid = get_socket_id(portid);
 			slave_id = alloc_lcore(socketid);
 			if (slave_id == (uint16_t)-1) {
 				printf("No avail lcore to run test\n");
@@ -737,7 +750,7 @@  test_pmd_perf(void)
 			       slave_id, socketid);
 		}
 
-		if (socketid != rte_eth_dev_socket_id(portid)) {
+		if (socketid != get_socket_id(portid)) {
 			printf("Skip port %d\n", portid);
 			continue;
 		}
@@ -818,7 +831,7 @@  test_pmd_perf(void)
 
 	/* port tear down */
 	for (portid = 0; portid < nb_ports; portid++) {
-		if (socketid != rte_eth_dev_socket_id(portid))
+		if (socketid != get_socket_id(portid))
 			continue;
 
 		rte_eth_dev_stop(portid);