From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20061.outbound.protection.outlook.com [40.107.2.61]) by dpdk.org (Postfix) with ESMTP id 7854537A2; Wed, 3 May 2017 15:44:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=L+NXfKbEsKTMDrwb7UsQSoauFPAcloRlJ9PP/08V8+c=; b=N88ZJnT69WWEOTpMnZ9b80k38qy4oV0wMiBpWAslZLLhe/Of1K4dnoZXSnLIQM1i6IyX+YYkMQA9dGpXYme/JBk/sEPQ3ak3CrACNTZlOeNulhIW2t3TIRDY1CaBbMLL+IsiK++UAQSw4JD0t9qvS6kVqVdKrOEzUTKaQlJReGQ= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=mellanox.com; Received: from mellanox.com (82.166.227.17) by HE1PR05MB1514.eurprd05.prod.outlook.com (10.164.49.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1061.12; Wed, 3 May 2017 13:44:35 +0000 From: Shahaf Shuler To: CC: , , Date: Wed, 3 May 2017 16:44:29 +0300 Message-ID: <20170503134429.22723-1-shahafs@mellanox.com> X-Mailer: git-send-email 2.12.0 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [82.166.227.17] X-ClientProxiedBy: HE1PR05CA0028.eurprd05.prod.outlook.com (10.162.181.38) To HE1PR05MB1514.eurprd05.prod.outlook.com (10.164.49.148) X-MS-Office365-Filtering-Correlation-Id: 3400a6f1-3229-4728-3971-08d4922a8987 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(201703131423075)(201703031133081); SRVR:HE1PR05MB1514; X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB1514; 3:VEb2FC+uQl7ucXcGKPjkSxXKbte0a1ijo1VaIPnptUOa6drTNehRnoetj5YvxJW/6XkMS9M3BfopCpF5OWHlV2zVPp0zRmXuZ16kHGEwR9ET/ErNlRenovWKCKS4orwwE4y9VLy8S66bu9GPdYriAYBDkM4OjNC1ZRX2/5lrSwtoeA7jA97uGGnS4n8X3SJ3lfXcNUcfxPjyBh3EZl6sxyXDuyPjk00PMK7nNzDkYE9LJs8cRoFzEkmSaTncBjXdUUBdYqVVfVxLvb51hvEUAe81ytQKAcU6+olymUINoRaoeoYuExrt4jDkKh3rBgs9klwazsnnMTY/y7rSQHgXqQMf4XTqqFq6KoMKr0YZDmI=; 25:R3sCsXEWmIYWh7vvdKtV8TENJUfmToVDxnaEfU4VDz78h0elkxJVgEelilx5yC7VgzDUOliyk2lC6ujoat9XK4GEZXvm6pohTgZptbcmnlL15BUegFhqd2++cgrhQLhGYDncqQAJJdi26Qlzs6ybNwM52cIEquyzzZU5sWtnyux+lM0O57XQDTgBFAatcRU1Xpekc9N5jOxJH8UDp4P9i5fngzQy6x0AEBhBLghpvysXOTXwTkxxJHQkP69PLnH2MXeOh8/F7V1o8gCg1vukLtOR+qs1ZDYnU/urJ1bGz/0PJMN04CgONvqObtxuiPXRO5BpnAF4doPImtAmmaXmf4KoQiXGANbaO/gC2A1IvX67W32IMka5VWUXKtoetLYEsvAtQ3AckySIhfnyUyuo/CGVawwK++xvz89szvJ1ha4ypK6UieFhmjcvuUqth1QraPfSHKJnU+VXg3eu6YORyw== X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB1514; 31:ZmS7n6ehCTXP7QT4AnKldWRNk0AxQQso1973HwtUjp6isc87JBVLAUHD9XnZLiCS/9piu2jilDNHMeWANUDifH/r8xrO6A5tY8NnvhRahNXVTG3rLET6gixDw2hcZv9YKw1vzlAocTf9bJY1TgjfI6S10Sgb6KTcoJlWutxGSPiwPNGbVxobCf13YHW/tfAYWv3j1UWFbF9nMw0aFPWleVQ6LERmWC9YN7rlJSZVhCc=; 20:EygpA4iUGBy3NQuWSE2tagJiB2+9INWJpPIPei9lpcijaawhhHYhP5kEhulMP3wrU6dVkNMi1RSDR0cofaGY2Y4masKdyCF/+vRCVhjibqEfSLUK8zc/eBFZMUTMEMzAHNN4Dklopr/3ZE9oz0eso23SLH32fE0VdaEwoqB1KC0OQMvUH0tosgqq5930Kqhf/tVGoFZcFcI00sSqZFADv2rZKWAokXLi69N06FQl4KpyGVhjhEy42bBqRfKs8w2l19Z/HHvavuwL9/mwZCzvw1unSkqy7RJvjBhGZZgsyb4jNHxFwcjMa/iCctOvdRz0SgB2UlTnEgC0pJx8ai8DeL9cQ47NvHcOBVuKVUmdURlnP/zPxsO5msnObx/9qJPumuawvMlmFmdfBf7nBdCSEOFd24GbKI4mdO1b1uWiFcJOk3zG//Qy6V+w75g2j71m9Htc8NfBBgKqNsAgpSjNz90gZ22IXtL4GqclkK1aO53irLfx7k/eODUBNLqgkjxD X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041248)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123562025)(20161123555025)(20161123564025)(6072148); SRVR:HE1PR05MB1514; BCL:0; PCL:0; RULEID:; SRVR:HE1PR05MB1514; X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB1514; 4:Oy4oYJyVSr0oaM3poS0fR/nUT/gVQ/R26rOYUU2OCavr+mi2sfJFvhapXDl0rm5goae28R9BvBEs7DuTqlZYzfdUlLO6yVH8Xvpv7R4shUIANm3hMYjOXvR82pqZ2sF29/wmIYHbAZAkcV59q1loPGQzsfz1NFQ2XEjzpnuJ+VELrSdEGvamEFO0OgEtp1QikMfMnFJtZ/JWUoyXhEaAC5I8YAu8w45OG3JfG/1cjTGzmykZtdt4lkbsbpOGCjsidS0teBOxLQruRscZPSg07RsjqwmR4OUOiFz35Hz9PY7wlBbJpwwfLdbS4+J9cuXlpEftWf8gGwdRLPNNFZaEjeoYIaIeLBVuXfauGT3Be2+9tyLTOU/d8J+j01KaZmtKFsr5ToR//OWBzTsSzDGrB0yZjORt06JcwOm5CoLPzSAqbRhPMcMVgSUpCpZj+lc5bgeUS/JBHMg8k7AK4IG2hnhbVOR9aLfTgU2YPjJ5a+5BcrmLvkGxb7KAC7+/RGfPgzemNd0+sv2SM7l3vXkutzWgEwr/NPPO7csda5fIU6ukiLPLXkCGECrbfuhkiswb7LZAtieSGLWNjmxhsHRhxzJbUeGW8aswAnBVjkAscyUk3ck/JTGtX3Ct++Nr9hCVYX0ILxXYY+zW2Hd5doKg6sDsEMq05pjGEyAzdDI2bl0nKrcGk+RDQQHSb5F+NLt5PZ8fN+BEVAz4dEFFszlmDNi1h/Ujsk5MN1ow9dunzxorNmwCThPm5WRPEd1RBDMCnFFP+4M+8r4DM9opBO3tZBBgEkJ8je/2SEnxuMHLATzwr0pDURNetaX2rGX5sJqU X-Forefront-PRVS: 029651C7A1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39860400002)(39450400003)(39840400002)(39850400002)(39400400002)(33646002)(50986999)(50466002)(48376002)(25786009)(6116002)(38730400002)(53936002)(2351001)(478600001)(36756003)(5660300001)(42186005)(189998001)(6666003)(4326008)(47776003)(86362001)(305945005)(3846002)(2906002)(8676002)(1076002)(66066001)(5003940100001)(6916009)(7736002)(54906002)(81166006)(110136004)(33026002)(55016002)(50226002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR05MB1514; H:mellanox.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR05MB1514; 23:bL56ChkndxcMUT7JPnNwWXcUsXqusVqypLzv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CcjcFG09yjd0u4dD31uml1U+p8D5FL7L72rCsx5?= =?us-ascii?Q?F5N/sc+cieMFW0R0NrXd7xEqFKDES1RYwP84uex+uk1tA2PiBpZq22A0hvdx?= =?us-ascii?Q?nJvAqF5USaWkSPDlFJ1HuPCjH9KAxkAUqg0MYtNBhgFng=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB1514; 6:31O5O4nSmnfl2GF0JiMmgxtuISWFwCqcAG3CZS+6AGisAPPz9fjFliU/wjmWrC9KKc6drdGwxLNdo5daxyRHhGOYynLsiqEscVF08IF6/F5slImnUeFsdrt/kSG5x6COf9m/wEAIhsFGnfFIxHXya+U54L913e5r9rFl+dRHQ/fZ0BHhTI9rj3oxerWP9gsfv9DPwQva7UZFr8hpnU6aHbToFYSyQo+YieLOjL8hl4ru19AuWNuN1Edt/lB0MePt8cWKFfxFRUOfvYTi1W9Air3jGqtTf5DTLq7ZnEpr0naC+LkpsQWKODczKqqQ4ng0jSz9o8eh+k11ZRdBybcrs4QILOm+Hhk88nZeP/XvS4hSMudmmJ4AFvWNAkU7Dz6i5xIDVEpoDKYqX2uxS6r0b7oQqaXx9BjfQpN4dWP9RazaXIWUmPkZ4LDPav+1ku4N6jeihzCUi6UUhMQe2Kiaw136qmMXjYuT+zfmySZZriiaRcwlNhOo9ZbylLPE1clfAAZzLX5iQs3/5bCvnRT6C+EX1o0J+cm5iJphkFtLZu4=; 5:CXU1j0rnV4S1VWXV1GpsisE825HWEt7TUz/dN1m+4ynpzjdAAMvhTkA2ehJpk5yWTousDNS56R5QlJnwRbpTieoViEWayBLbbUi2iaqbAzPiIaoImh9hPDsDAd6woYMeVr1k1n7lQRI2T9IhuqKKbA==; 24:nu+DJd2xmKKk+RGsdvsTVCnQgQ667lzAzaxlmvsMWqXrB0956evhy8emlGeTfjbhHMIo0dHInuOsVhVMrPXfzcxyVuKl2o12kmPEhUxM9eo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB1514; 7:ZX7S74axj0wXQExGHdQfXFefBufX5RiwULkv2ohqTNKV/TDPIHYzSzzIX0YHFHZlsfrePyfHQawQstJq9VyYRspmDWzYEBgmv/5ejG3W0TVIF7HGOF+ccGeFzonro7KQ3Nqkn0q1ndzZAvzY3AAhD1lhMk95ns2MPVhORFsM7G+MrUPfIOwysdq/xp/bI6FEifG1Qoyryy9cPALPdAi2ljqyVFwjau3Vgg30KRRCCss4RCALhaY4ahf1myuCKlUC0Zzl0T+YvP0qV4/mRyHdAW8oIfDW47KH1TxBDzbkodRnNVW66oJiRKFRDUmtq0AvjgdknIVeWMUU9wZtQnJ3Bw== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2017 13:44:35.1892 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB1514 Subject: [dpdk-dev] [PATCH v2] app/testpmd: support non contiguous socket ids X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 13:44:38 -0000 The test assumes the socket ids are contiguous. This is not necessarily the case on all servers and may cause mempool creation to fail. Fixing it by detecting the list of valid socket ids and use it for the mempool creation. Fixes: 7acf894d07d1 ("app/testpmd: detect numa socket count") CC: stable@dpdk.org Signed-off-by: Shahaf Shuler --- on v2: * fix minor typo on commit message : be->by. --- app/test-pmd/parameters.c | 38 ++++++++++++++++++++++++++++---------- app/test-pmd/testpmd.c | 38 +++++++++++++++++++++++++++++--------- app/test-pmd/testpmd.h | 4 +++- 3 files changed, 60 insertions(+), 20 deletions(-) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 787e1434c..4822a8a8a 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -410,9 +410,14 @@ parse_portnuma_config(const char *q_arg) return -1; } socket_id = (uint8_t)int_fld[FLD_SOCKET]; - if(socket_id >= max_socket) { - printf("Invalid socket id, range is [0, %d]\n", - max_socket - 1); + if (new_socket_id(socket_id)) { + unsigned int i = 0; + + printf("Invalid socket id, options are: "); + for (i = 0; i < num_sockets; i++) { + printf("%u%s", socket_ids[i], + (i == num_sockets - 1) ? "\n" : ","); + } return -1; } port_numa[port_id] = socket_id; @@ -470,9 +475,14 @@ parse_ringnuma_config(const char *q_arg) return -1; } socket_id = (uint8_t)int_fld[FLD_SOCKET]; - if (socket_id >= max_socket) { - printf("Invalid socket id, range is [0, %d]\n", - max_socket - 1); + if (new_socket_id(socket_id)) { + unsigned int i = 0; + + printf("Invalid socket id, options are: "); + for (i = 0; i < num_sockets; i++) { + printf("%u%s", socket_ids[i], + (i == num_sockets - 1) ? "\n" : ","); + } return -1; } ring_flag = (uint8_t)int_fld[FLD_FLAG]; @@ -700,12 +710,20 @@ launch_args_parse(int argc, char** argv) "invalid ring-numa configuration\n"); if (!strcmp(lgopts[opt_idx].name, "socket-num")) { n = atoi(optarg); - if((uint8_t)n < max_socket) + if (!new_socket_id((uint8_t)n)) { socket_num = (uint8_t)n; - else + } else { + unsigned int i = 0; + + printf("socket id options are: "); + for (i = 0; i < num_sockets; i++) { + printf("%u%s", socket_ids[i], + (i == num_sockets - 1) ? + "\n" : ","); + } rte_exit(EXIT_FAILURE, - "The socket number should be < %d\n", - max_socket); + "Invalid socket id"); + } } if (!strcmp(lgopts[opt_idx].name, "mbuf-size")) { n = atoi(optarg); diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index dfe64427d..a556a8aff 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -354,7 +354,8 @@ struct queue_stats_mappings *rx_queue_stats_mappings = rx_queue_stats_mappings_a uint16_t nb_tx_queue_stats_mappings = 0; uint16_t nb_rx_queue_stats_mappings = 0; -unsigned max_socket = 0; +unsigned int num_sockets = 0; +unsigned int socket_ids[RTE_MAX_NUMA_NODES]; #ifdef RTE_LIBRTE_BITRATE /* Bitrate statistics */ @@ -377,6 +378,22 @@ static void eth_event_callback(uint8_t port_id, static int all_ports_started(void); /* + * Helper function to check if socket is allready discovered. + * If yes, return positive value. If not, return zero. + */ +int +new_socket_id(unsigned int socket_id) +{ + unsigned int i; + + for (i = 0; i < num_sockets; i++) { + if (socket_ids[i] == socket_id) + return 0; + } + return 1; +} + +/* * Setup default configuration. */ static void @@ -388,12 +405,14 @@ set_default_fwd_lcores_config(void) nb_lc = 0; for (i = 0; i < RTE_MAX_LCORE; i++) { - sock_num = rte_lcore_to_socket_id(i) + 1; - if (sock_num > max_socket) { - if (sock_num > RTE_MAX_NUMA_NODES) - rte_exit(EXIT_FAILURE, "Total sockets greater than %u\n", RTE_MAX_NUMA_NODES); - max_socket = sock_num; + sock_num = rte_lcore_to_socket_id(i); + if (sock_num > RTE_MAX_NUMA_NODES) { + rte_exit(EXIT_FAILURE, + "Total sockets greater than %u\n", + RTE_MAX_NUMA_NODES); } + if (new_socket_id(sock_num)) + socket_ids[num_sockets++] = sock_num; if (!rte_lcore_is_enabled(i)) continue; if (i == rte_get_master_lcore()) @@ -506,7 +525,7 @@ check_socket_id(const unsigned int socket_id) { static int warning_once = 0; - if (socket_id >= max_socket) { + if (new_socket_id(socket_id)) { if (!warning_once && numa_support) printf("Warning: NUMA should be configured manually by" " using --port-numa-config and" @@ -591,8 +610,9 @@ init_config(void) if (numa_support) { uint8_t i; - for (i = 0; i < max_socket; i++) - mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, i); + for (i = 0; i < num_sockets; i++) + mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, + socket_ids[i]); } else { if (socket_num == UMA_NO_CONFIG) mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, 0); diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 8b3d903ef..8186b6bfd 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -341,7 +341,8 @@ extern lcoreid_t nb_lcores; /**< Number of logical cores probed at init time. */ extern lcoreid_t nb_cfg_lcores; /**< Number of configured logical cores. */ extern lcoreid_t nb_fwd_lcores; /**< Number of forwarding logical cores. */ extern unsigned int fwd_lcores_cpuids[RTE_MAX_LCORE]; -extern unsigned max_socket; +extern unsigned int num_sockets; +extern unsigned int socket_ids[RTE_MAX_NUMA_NODES]; /* * Configuration of Ethernet ports: @@ -636,6 +637,7 @@ enum print_warning { DISABLED_WARN }; int port_id_is_invalid(portid_t port_id, enum print_warning warning); +int new_socket_id(unsigned int socket_id); /* * Work-around of a compilation error with ICC on invocations of the -- 2.12.0