From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matan Azrad Subject: [PATCH 1/2] app/testpmd: fix port validation Date: Tue, 30 Jan 2018 14:13:39 +0000 Message-ID: <1517321620-14198-1-git-send-email-matan@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain Cc: dev@dpdk.org, stable@dpdk.org To: Wenzhuo Lu Return-path: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" rte_eth_dev_is_valid_port() API validates each valid port from ethdev point of view and may validate ports which should not be used by the application. Testpmd should use only the ports available through the RTE_ETH_FOREACH_DEV iterator. Replace rte_eth_dev_is_valid_port() usage by RTE_ETH_FOREACH_DEV iterator usage for testpmd ports validation. Fixes: 7d89b2610353 ("app/testpmd: use ethdev iterator to list devices") Cc: stable@dpdk.org Signed-off-by: Matan Azrad --- app/test-pmd/config.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 957b820..8c920a2 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -756,11 +756,14 @@ struct rss_type_info { int port_id_is_invalid(portid_t port_id, enum print_warning warning) { + uint16_t pid; + if (port_id == (portid_t)RTE_PORT_ALL) return 0; - if (rte_eth_dev_is_valid_port(port_id)) - return 0; + RTE_ETH_FOREACH_DEV(pid) + if (port_id == pid) + return 0; if (warning == ENABLED_WARN) printf("Invalid port %d\n", port_id); -- 1.8.3.1