From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30072.outbound.protection.outlook.com [40.107.3.72]) by dpdk.org (Postfix) with ESMTP id 0AD562B9A; Sun, 7 May 2017 15:05:57 +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=/1DplUk7nN6sy1uPx/dyAIXQS0+wWbTv/AebDVI8Y5A=; b=uOhbI4b/lKKECRJyy8Q+q32GEsCcUvz0TMjRdgZVW3K3R9HhlwKzSZawp3kyq4cEVbi7jejOpDwt8sCTeVxn3+VhGKAETdRtGPFfDjxL9ScBf9gZBZD1hE3dsEa0q9RPWd+7jNB33dDW0aS+Z+naxtxJ5zERpsCIkB1FOQ0bUoI= 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 VI1PR05MB1520.eurprd05.prod.outlook.com (10.164.85.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1075.11; Sun, 7 May 2017 13:05:52 +0000 From: Shahaf Shuler To: CC: , , Date: Sun, 7 May 2017 16:05:46 +0300 Message-ID: <20170507130546.94558-1-shahafs@mellanox.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170503134429.22723-1-shahafs@mellanox.com> References: <20170503134429.22723-1-shahafs@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [82.166.227.17] X-ClientProxiedBy: HE1PR09CA0076.eurprd09.prod.outlook.com (10.174.50.148) To VI1PR05MB1520.eurprd05.prod.outlook.com (10.164.85.150) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4ad17d91-a8b3-4080-0137-08d49549caf2 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(201703131423075)(201703031133081); SRVR:VI1PR05MB1520; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB1520; 3:mS+VrhaZjLumPlARLggZxO1oIyxSdqxUJsuD6lFbHWmV4CttShNi2OxNhNNW873sO7DqobynshsvavnuERuFs8HsR3+lTetLfZnwfR+hX8Mxsq3oWzimDpuroFWsnkdFTXgFUFMqjwZ5aBwdQrHiqyGjDzoRD5DTLlUP6Zs3hNzc1HF2MfGzrnM2m4r+e2mYYsG/5/37hzLPa5KnI6NM3s7Morswv/mTk7AthiOqUHuQALtIvoCr/XEKyjXVth7sQRA8afENEcOU95xBIUWsCHbZ9jnBmB4ad4xx1JqzPL1xfzz/c/WUkPh9w9f7jMZRIe4OCtmLT31tF3W5AtRUwk60dhwZBlGUboJAysuWW7E=; 25:hhgOKRvvzTDhYYWx8sowXo+qRdtrK4oYuZxO+AxQN4BoPRVMLzFz68x23D4gfxkfA2AYgAi6dxBkoI9uS+8qq9z8adMMmO61ncPanHZxjUNlvSDw0luOilOrxyWVV2AEk8IGglKmAoJxnw0iuLAQqhxDl8A/KjJKN1ImvfhZYvgneH7f0Zks/7Y9JT7BlFbWO5NqeA3jPM36Pl+Y2g/T8jsaq0UKU1me60zHZ0O4ZcDIzaOAzJlSNteILBlCQLfFnPiKNAM26hCtpyMHe9WTm9g7MmStnTgzT5nywtMaYKPXHRr1CvgTUa0zd8M92umiH6YsBLiNr0DgzamUO4yke3pzA+AimOlzIniUvr+W0qhQNCLZ7cTw/NKAPrHYMBTgaQNOg0GZ/yZcb5VUqLhk1tMCV1LrimztYPkhG7PZfO8g0QZYNDL+x3EYhqqzEPkrsLswRpNYc9YDHOEM2HHT/H71jAh+xbXlQQ93urZ89w8= X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB1520; 31:/dt6jtJHnYXA3Pehics3iyx6/IjiVTgQTcS7GtMddba75Q424rhhK1VXkDkPcxhpZ/UaxSl9QtwkcYErZg7cVEB2jvcGt+JFxusGOPqPVSeH2qN3yqwOb0x1BLb2GAIp/bgrjA+q0d/xOfHhsbcE3oLGMx5wD0sZDum3B1cyDwPiBlkDaW0BTE+g3bnZmhEfhmfCcRtWisMD1T0EC10MUzkoqshV9b0jfZynx/eQKqL7h+P/5PudHHdQpXM/Kimj; 20:KUPz5An1dnfHdT0OnnOS7XXoOBNn9+ZZqzmqhma8rnLxrd2Yt6EuVnq7YzV/AxrgOpThYUWgLX/8XtVvXTLrgEvaR+fclpldWOx+6Ixx5j72O3uyEya9Hbdv1QUzxZk+E42vu2TpuganZvByW4UqdB0s3PVV+8NxS4Zb8RZ+k67+i7nUEj5aEDbQvHHabN+QZtI930qRE2Qe1TbWkb5eo7bw7WNp6snrEUbTP1UOOfmxprC2fiNTERH+0o3QJRRR1K0q7CNfZqfHxjkx23+xEoo3AoD6wOOs9Ie9LwFJqzX29cAMhXxbxms2352ss6Zjq4lsOXVqbFTLobDTp9Vd/x58kAzgNqukBxVZxmJ/UM6BEH78usv1WHuZRC4HOsKHHLkn2jbdn+nTd6KaXgkhQcogGc7x2Jffoaqx5xMHJbT8qWi9isdWnbJMlo4zBEcJobfPQnTVo4VF/RDmqilXFsqAs87+tIB7fesn3SOt9NfVJBxUPA3KJk2ZSvFXodaT 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)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041248)(20161123562025)(20161123564025)(20161123555025)(20161123560025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148); SRVR:VI1PR05MB1520; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB1520; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB1520; 4:AEnlJ2KSwTm93jHmZwjvlO3zmahEihq8r69QXoy7TzvVhQVQsSU+u1U7vv/YwopB+ce6t8FrFd6WeaU/HoI4RrCQhxxdI26t8Y8qDneqpwzA9Zzc8+jfOgmeJgoJhnTJrl5WyV8trxK4IukZ7keQWMMZSWwQTA7Z3V8AfEaOeqXABHYcoSa3m3WbcnSrT6jeq64SIABd5qelOShE7vLP3Msn8zonU3rOGiQcBfBwqVFlN9gGM3/RIy8D7y7nPK5WDbY+KIrpDhiM5W+kH4e/Gtt0KbzN+QwCQMxDLpWPGvRmT+T0cN5kuXsJpxPwuOBl8PlRsHqn0ukWlB7cVILzCIZ6FX+EzXvAhaTInxVZU7jiWUfwPVqPJqvxrMiR4I06AiI2alyXQEjwMAyiZCok/s4z8AT3jBqRwRv1mWWTsffUT59yj0rn2K0n/FMHAu3yPhl9/2EQyykjwsNwqAx7f6rCXSIUa9yw08F0kFwAw9o2QgCVWAXhrzQQPltAQLs+X+g1fDgKYHDiAfMFPftZjl5ZNw0QIMhB07pwP+X5Xg4LXDjm5W+WKdMhOwGFZgN0K1pnzdY6XefrsZx9AxwV6SE/ZBCnR/qwxaMqTAIkZzOPz/zEASE8RPH0NIVWTe2boqPKeiUDbPRp9HnPu4bE9XlAGfDX5zo5dvAiSxvcehfi88Ijmb8eVilnzPKpshdtQIjj9lUq21ovhn20l51cvOSQKWlQVuVdCguXgvEBWZe198LW0vq3amB3PZM84zCvlMxNZSbBBIfHyn2I+8R3f1AFPL7b0tdYpXCHar9IeRf2yehyn4/+RsQ+0ZDprNdL X-Forefront-PRVS: 03008837BD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39410400002)(39400400002)(39850400002)(39860400002)(39450400003)(39840400002)(4326008)(55016002)(54906002)(2950100002)(305945005)(48376002)(42186005)(47776003)(6916009)(33026002)(66066001)(50466002)(86362001)(50226002)(81166006)(8676002)(3846002)(6116002)(1076002)(5660300001)(6666003)(189998001)(2906002)(76176999)(33646002)(50986999)(7736002)(5003940100001)(478600001)(36756003)(110136004)(38730400002)(2351001)(53936002)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB1520; H:mellanox.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR05MB1520; 23:XIqEivT/V5PxPaO2SJ7cgGsBAPdAtkkcrxzIPGLCH?= =?us-ascii?Q?bfKE55uUGAGUkB11LxiUbQOlxv+X/WBcYnnCJ51R6J0oADzJCs3kNHamIdev?= =?us-ascii?Q?k2kqkVtrkd1hlGomdx8E1ZPWgELUMNAFdRW0fHY4QZb512DreD4157z3Man3?= =?us-ascii?Q?yghdIDKyioSN+JtLzfoYvjkAJuJD3m+s1qtZsnnEHtg/lPExSGbIAE988mpS?= =?us-ascii?Q?lpRDyqvHjx8p1RDTNV50VcMVdfbYQDfOgkpkng86KnMkyZWHeBZtjSqlhevT?= =?us-ascii?Q?mS08x7LFX7TJyD1YWi34sfN/pBe0pvBBqWAi8V11uBbAPgjyXSxEy5mItApB?= =?us-ascii?Q?teLIIe9yX1ufOuP7AFWTpDLtTZ4gBc3L+FLOYtHCR3bH/Jb+eSicEkhV98wC?= =?us-ascii?Q?nTja80t/jklobrQdV9vwqGTIcXfss02gDrjXw3wsRXGNtDbyhYL5kvn+/Zga?= =?us-ascii?Q?g5sZl/hRpGt7MS230gFfQhj2xuKaRgHO76i8ikGUvZiHDxG6YSqhbIoelWCy?= =?us-ascii?Q?2TzXp5855zuO58ZWWNmeY71AseCLc2g53pI4hMDga/fwIqpmJcuU+BA+7UPz?= =?us-ascii?Q?DmL8TXkDIGqZUqC9dx70A6uNAlETCy7b5tLrEu3E3jaqVvshJmeVFdWJjJXl?= =?us-ascii?Q?xTe/JMYqQCjLjdsT6kzYZkmIUsrRlN/P2hD9Uqmvkc7SQ+ty/KRcn/VsPC4Q?= =?us-ascii?Q?dDNWas+RNMglWCg6t9rr5MLLnnw4GsAZzOf8axybQ3gbuGFaIgdwCVX+3YQX?= =?us-ascii?Q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VEygPja5R2GIEaUTPWZfsAPiFyznOKTiF5I1NX4nZ/3cmTl++A9rmftx7zHCTsJYDugaXQfA6qYOy5W9W4jvDTzeWCfgrWAaWRtVLzY5K0cZHjIr3bGT8w==; 24:wcdjSVbsI9NiuKx0Lp+V1nOrgbXK/EZ6B57O8IsEZ7/HPNelQ5e3svbBCedIpIO8HXnH3VLKmerCBnIf3+CHkPZYLu1CrzDxDjuj3QECW+0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB1520; 7:Q7P1cCt7um5OPnstY0TunstaOhfXlKh59BLmW7PBRAWD6x65QihV3d/HK7q2MqVENFuK4RoSCz0febIAc8nIZQp03HrHsVoQzBIKG6pMERpmF/5VdzGfYGa6XOXTGDur1x8Y2iXBY8YpV9DRxiIJf2aL1OpNek9m2EQzhHIzmDVHQHUxAyh15NSRyQgcF3lkFL86xqLgonp0T1bsfMoWua9Mr3z5g3cPBfOH+hd3aCTBN36ufLszeY1tMvKAkIKzOFBb1WBYwN9rmhQ+g2L1NhcP5U0Ou2BWDs1RWRtLbKf6/IpZSD7Q0k67U/hznhJlORVfWQPY2lJSGtIR1EXUuw== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2017 13:05:52.6112 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB1520 Subject: [dpdk-dev] [PATCH v3] 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: Sun, 07 May 2017 13:05:57 -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 v3: * create a function to print invalid socket id error. on v2: * fix minor typo on commit message : be->by. --- app/test-pmd/parameters.c | 31 +++++++++++++++++++++---------- app/test-pmd/testpmd.c | 38 +++++++++++++++++++++++++++++--------- app/test-pmd/testpmd.h | 4 +++- 3 files changed, 53 insertions(+), 20 deletions(-) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 787e1434c..0781e19c3 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -365,6 +365,18 @@ parse_queue_stats_mapping_config(const char *q_arg, int is_rx) return 0; } +static void +print_invalid_socket_id_error(void) +{ + 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" : ","); + } +} + static int parse_portnuma_config(const char *q_arg) { @@ -410,9 +422,8 @@ 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)) { + print_invalid_socket_id_error(); return -1; } port_numa[port_id] = socket_id; @@ -470,9 +481,8 @@ 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)) { + print_invalid_socket_id_error(); return -1; } ring_flag = (uint8_t)int_fld[FLD_FLAG]; @@ -700,12 +710,13 @@ 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 { + print_invalid_socket_id_error(); 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