From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0084.outbound.protection.outlook.com [104.47.2.84]) by dpdk.org (Postfix) with ESMTP id A09761D7; Thu, 3 May 2018 12:32:12 +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=wt6awOUTCJS4A22izDW2XKXTINfbd6e1fU+H07bTPlA=; b=DyFpQvqZBIB6b2Px9nDw2akYD7Dtdw0IuSVnAdnlkXaK4oATRxdOEDg1eFl2F7fjRTTK5h7laJpc0P5g00P6XDOyc/Vm/rj6nc1bD7pWGUlvCN0AuR97gOXgUoqIvRPb5UOtbHCoBkNXV9hqM42URnV/Pn1TFSI7norfZnmM93U= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR0501MB2665.eurprd05.prod.outlook.com (2603:10a6:3:cb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.715.22; Thu, 3 May 2018 10:32:10 +0000 From: Matan Azrad To: Wenzhuo Lu , Jingjing Wu Cc: dev@dpdk.org, stable@dpdk.org Date: Thu, 3 May 2018 10:31:43 +0000 Message-Id: <1525343508-29487-2-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.9.5 In-Reply-To: <1525343508-29487-1-git-send-email-matan@mellanox.com> References: <1525343508-29487-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: HE1PR08CA0058.eurprd08.prod.outlook.com (2603:10a6:7:2a::29) To HE1PR0501MB2665.eurprd05.prod.outlook.com (2603:10a6:3:cb::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:HE1PR0501MB2665; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2665; 3:GbFfDdykGepBWie7Mt6sAPM/tQAjuSf4fX2p/kaPOX4qdoNKS5gDfrJ3PypRloeBaQespVvpfq8pIn4B6aaR69hDxoRAMQI/npNHDCaup4s7+joMM4FNE1VaMqZ6nkjOFhdel+yAKxaSgAjoH6+yIzIkjEysaUyhGJFIs+3CchG3P1D8+ciU8moc62ju+XRhrZkdmha0/lEIlC5yDAEZDCY0SrZm5ULZmi3JWIFEjaS1eRzqrxlX4jyq9QvEOXC9; 25:8BF5zH0UC/ZDJi3pyROg3YGKHv4Jbo/Pw9HBt6r8rShEfCFH4QqrKVvtjV1MPag3Ub3oc6hlncd/r9Tf3FyNw7MfghLNLeb9mTEWybAvnGLs5Env+j5zNBFDA5Mm1v5GrWLyfMTbdbxW0negAYSQYrpD8u8N8tat3NEhP1hH9HDL3goWGNv0YB0QKdZNAVr66wfoDLzWTRFBwNNWeICwbbNC2Vbvfcba6yyrNqLDtmPKh1pcuFuo+Isv52M0IccfPsJmk1Hz/lgBfZD6TJjWlZFgKiytJ/y7IwBSWBNALxwO6I9dYfPHREmZhL56PXbl9CO5pIIzAvkOhTRJNcO3tQ==; 31:8mKMLorEj8CrmAw5++3SaHe2qSC0nQhABKjCNNClYNu0Dx6hXFJnaayzAK2FAuL6L8fDVitakw5Nk/t+U0oCRBWuB13y1NLeGDDSQYfv67uiyf0esgwoYoFFqgxcFmvcbX1iOcP7NMNOe1WNnSKegWi1MfDaBqa/aAX761TRpVmv/W9YQ0j9H9hDFMFy9Sf15MIor+plEeTqCZCsBgJ45kS358ADmb0q05Oh+8WfoKg= X-MS-TrafficTypeDiagnostic: HE1PR0501MB2665: X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2665; 20:HYrh9/kQcK4aUitisFbJ1l304jOmiDDHEkhxMsQl96mcLJmoe0LtuciVK35G+aUjSXdgOidA72kJpFHL0ujP4L+u1EdrzyqtiZRTSQSLKen1+Ym44N9/0CsZmHFaxTCU7t2y9bO6Y42PVhCnoJgzdMfXOv1DaK23rcdV/EnQShsDzdv5ZKzEJmUSEP1jSJgQogQUjb3JZx4iMQu8n9XbunOdLekA8xhdhboyMqxPSLOySmvrcY2VE6kfPO7Q3WKsDYBpomWRjtaCs76383v44qMfcLKZXRmqzCuHA0QnBX4COs/bOmtk7k0/DTqak2ticvM2Vr4PoNLl5c/vBvgrOCAUTkTxDs6Wklv6rP5cx/Ho10A1T1IL0BTzXXYQzGXrU2YmyIBwsCursHISlRb0F6VCS5fRLsSMYC9ZxiZwEyLWOouBPpZtLU4ODd+JUnWLU2hYcIOSfH2t23zKW4wUZ1je8W1fMfJDflzzarByMKeqJCxtyNeqM72lHZl50k/6; 4:brquhq3XtVNFfq6UuCW8wZNMNls214FcTtXKpm88C7+NxuabheE8mMDFcoZ7KMJScIH7MbBzwEIgkEJSOGXJ7XHAxmiF0wk3ru1+9L1EVWDZ3LV3t6iYJ5x+Bk4QQ8r3GcC4TqijVgz3I9LHlptqxxBfnqjRAGtEejhoGcUBcMYxzRNlxImRJcZDhQB08U/B2zlQxYkPcuyqtZ/o+38FyDf/DPfek4zm7aAwkmkpJ7p26eaO7PVLLuCzvo3iEaMGpUA+tq+M7KXK6lI6aYRHYA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231254)(944501410)(52105095)(93006095)(93001095)(10201501046)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:HE1PR0501MB2665; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0501MB2665; X-Forefront-PRVS: 066153096A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(346002)(376002)(39380400002)(39860400002)(396003)(189003)(199004)(97736004)(47776003)(316002)(52116002)(51416003)(36756003)(7696005)(86362001)(25786009)(16586007)(110136005)(68736007)(5660300001)(2906002)(8676002)(81166006)(81156014)(8936002)(66066001)(53936002)(3846002)(6666003)(26005)(305945005)(33026002)(11346002)(69596002)(186003)(106356001)(386003)(50226002)(486006)(55016002)(105586002)(4326008)(6116002)(7736002)(76176011)(446003)(478600001)(476003)(21086003)(59450400001)(48376002)(50466002)(2616005)(956004)(16526019); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0501MB2665; H:mellanox.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0501MB2665; 23:P2MFJt9tWmwQ3qbQ917YIm6FoZbaQv8CC1lpVRZ?= =?us-ascii?Q?b5Ko+mclu2EyBiFk/DfYSCyaX+vppd5mcAnLtSBJ54/0hSydpA84Kzs/DooV?= =?us-ascii?Q?rUjWLRw8ZJGifof+e41i2VR105xBB+TwwnCWVrTFRqeXxx/488Bv6BvkZxiv?= =?us-ascii?Q?Kvv7cejCVJjP6I/dt7iLstvFSleYwNpQV6rAapaC7k/iCaRxh85VT7TYnWuC?= =?us-ascii?Q?ZCbMLcVgNqfHjkMAlCrvnHJuVcQTPoqr7UvNWIV68Jp5oSl17OkHpZpeiVWY?= =?us-ascii?Q?pye1QgPRmGcbW3IMdEww8ydf/ZkeU4vA3KRjtAjxIdidJ7j0ykd+tfD9Ib7D?= =?us-ascii?Q?Sg5RKy2lTTmHuq5snnvtAxwSwYwMchNfBrRyTUsDrDUwaJ1DU9OMXPkUZqm0?= =?us-ascii?Q?vituhD24aX1kd/aOjofaZxm/15i9frxjTxYfW/k4iW0xApAxITwp9Nnig9eh?= =?us-ascii?Q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nErfWRs0aCWJdZ8MvlGe5aW8h+40687CYFQ6T6hjC0i7JKr2kbmicIGtRc/GGW1DOe8XajwvbiWhsma/7mn9bfi+e13LvhZS0XofucFypGJctw19eJBWTAHpO3+0sTXeDZ8PTTAjoW3/aMrJPUsvcwSBA43vPFT+Oro699I8fOW3dMjnmwb9LpoRF5Qf9FmZjlhEobyNn X-MS-Office365-Filtering-Correlation-Id: 997048ea-1792-4134-57b5-08d5b0e1213c X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2018 10:32:10.6713 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 997048ea-1792-4134-57b5-08d5b0e1213c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0501MB2665 Subject: [dpdk-dev] [PATCH 1/6] app/testpmd: fix valid ports prints 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: Thu, 03 May 2018 10:32:13 -0000 There are several cases of an invalid port data access that causes the printing of all the valid ports, for example, when the user asks to receive a port information of an invalid port. Wrongly, the port with id 0 is printed in all the above described cases, regardless of its validity. Print port 0 only if it is valid as done for the rest of the ports. Fixes: af75078fece3 ("first public release") Fixes: b6ea6408fbc7 ("ethdev: store numa_node per device") Fixes: edab33b1c01d ("app/testpmd: support port hotplug") Cc: stable@dpdk.org Signed-off-by: Matan Azrad --- app/test-pmd/config.c | 36 +++++++++++++++--------------------- app/test-pmd/parameters.c | 12 ++---------- app/test-pmd/testpmd.h | 1 + 3 files changed, 18 insertions(+), 31 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 16fc481..fc1abe0 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -121,15 +121,11 @@ struct rte_eth_stats stats; struct rte_port *port = &ports[port_id]; uint8_t i; - portid_t pid; static const char *nic_stats_border = "########################"; if (port_id_is_invalid(port_id, ENABLED_WARN)) { - printf("Valid port range is [0"); - RTE_ETH_FOREACH_DEV(pid) - printf(", %d", pid); - printf("]\n"); + print_valid_ports(); return; } rte_eth_stats_get(port_id, &stats); @@ -203,13 +199,8 @@ void nic_stats_clear(portid_t port_id) { - portid_t pid; - if (port_id_is_invalid(port_id, ENABLED_WARN)) { - printf("Valid port range is [0"); - RTE_ETH_FOREACH_DEV(pid) - printf(", %d", pid); - printf("]\n"); + print_valid_ports(); return; } rte_eth_stats_reset(port_id); @@ -286,15 +277,11 @@ { struct rte_port *port = &ports[port_id]; uint16_t i; - portid_t pid; static const char *nic_stats_mapping_border = "########################"; if (port_id_is_invalid(port_id, ENABLED_WARN)) { - printf("Valid port range is [0"); - RTE_ETH_FOREACH_DEV(pid) - printf(", %d", pid); - printf("]\n"); + print_valid_ports(); return; } @@ -405,15 +392,11 @@ int vlan_offload; struct rte_mempool * mp; static const char *info_border = "*********************"; - portid_t pid; uint16_t mtu; char name[RTE_ETH_NAME_MAX_LEN]; if (port_id_is_invalid(port_id, ENABLED_WARN)) { - printf("Valid port range is [0"); - RTE_ETH_FOREACH_DEV(pid) - printf(", %d", pid); - printf("]\n"); + print_valid_ports(); return; } port = &ports[port_id]; @@ -774,6 +757,17 @@ return 1; } +void print_valid_ports(void) +{ + portid_t pid; + + printf("The valid ports array is ["); + RTE_ETH_FOREACH_DEV(pid) { + printf(" %d", pid); + } + printf(" ]\n"); +} + static int vlan_id_is_invalid(uint16_t vlan_id) { diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index aea8af8..b64b925 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -375,7 +375,6 @@ }; unsigned long int_fld[_NUM_FLD]; char *str_fld[_NUM_FLD]; - portid_t pid; /* reset from value set at definition */ while ((p = strchr(p0,'(')) != NULL) { @@ -399,10 +398,7 @@ port_id = (portid_t)int_fld[FLD_PORT]; if (port_id_is_invalid(port_id, ENABLED_WARN) || port_id == (portid_t)RTE_PORT_ALL) { - printf("Valid port range is [0"); - RTE_ETH_FOREACH_DEV(pid) - printf(", %d", pid); - printf("]\n"); + print_valid_ports(); return -1; } socket_id = (uint8_t)int_fld[FLD_SOCKET]; @@ -433,7 +429,6 @@ }; unsigned long int_fld[_NUM_FLD]; char *str_fld[_NUM_FLD]; - portid_t pid; #define RX_RING_ONLY 0x1 #define TX_RING_ONLY 0x2 #define RXTX_RING 0x3 @@ -460,10 +455,7 @@ port_id = (portid_t)int_fld[FLD_PORT]; if (port_id_is_invalid(port_id, ENABLED_WARN) || port_id == (portid_t)RTE_PORT_ALL) { - printf("Valid port range is [0"); - RTE_ETH_FOREACH_DEV(pid) - printf(", %d", pid); - printf("]\n"); + print_valid_ports(); return -1; } socket_id = (uint8_t)int_fld[FLD_SOCKET]; diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 1af87b8..8dfd574 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -726,6 +726,7 @@ enum print_warning { DISABLED_WARN }; int port_id_is_invalid(portid_t port_id, enum print_warning warning); +void print_valid_ports(void); int new_socket_id(unsigned int socket_id); queueid_t get_allowed_max_nb_rxq(portid_t *pid); -- 1.9.5