From patchwork Mon Jun 8 06:33:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cunming Liang X-Patchwork-Id: 5275 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id E83281DB1; Mon, 8 Jun 2015 08:33:24 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 0D8E1DE4 for ; Mon, 8 Jun 2015 08:33:23 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 07 Jun 2015 23:33:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,572,1427785200"; d="scan'208";a="583880100" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 07 Jun 2015 23:33:22 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t586XKMX007873; Mon, 8 Jun 2015 14:33:20 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t586XHIR027809; Mon, 8 Jun 2015 14:33:19 +0800 Received: (from cliang18@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t586XHRk027805; Mon, 8 Jun 2015 14:33:17 +0800 From: Cunming Liang To: dev@dpdk.org Date: Mon, 8 Jun 2015 14:33:14 +0800 Message-Id: <1433745194-27771-1-git-send-email-cunming.liang@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH v1] app/test: fix pmd_perf issue in no NUMA case X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Reported-by: Jayakumar, Muthurajan Signed-off-by: Cunming Liang --- app/test/test_pmd_perf.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) 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);