app/testpmd: fix port validation
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: 7d89b26103
("app/testpmd: use ethdev iterator to list devices")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
This commit is contained in:
parent
dcd0c9c32b
commit
1ae1b8c72d
@ -756,11 +756,14 @@ port_offload_cap_display(portid_t port_id)
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user