[7/7] examples/vhost: block attempts to use owned ports

Message ID 20200312172047.19973-8-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Headers
Series checking for owned ports in portmask |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed

Commit Message

Stephen Hemminger March 12, 2020, 5:20 p.m. UTC
  If a ethdev port is in use for a sub device, then it should not
be allowed in the portmask of application.

Fixes: 5b7ba31148a8 ("ethdev: add port ownership")
Cc: matan@mellanox.com
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/vhost/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index ab649bf147e1..d759581f1904 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -669,7 +669,7 @@  static unsigned check_ports_num(unsigned nb_ports)
 	}
 
 	for (portid = 0; portid < num_ports; portid ++) {
-		if (!rte_eth_dev_is_valid_port(ports[portid])) {
+		if (!rte_eth_dev_is_owned_by(portid, RTE_ETH_DEV_NO_OWNER)) {
 			RTE_LOG(INFO, VHOST_PORT,
 				"\nSpecified port ID(%u) is not valid\n",
 				ports[portid]);