[dpdk-dev] [PATCH 5/7] examples/l3fwd-power: block attempts to use owned ports

Stephen Hemminger stephen at networkplumber.org
Thu Mar 12 18:20:45 CET 2020


If a ethdev port is in use for a sub device, then it should not
be allowed in the portmask of l3fwd.

Fixes: 5b7ba31148a8 ("ethdev: add port ownership")
Cc: matan at mellanox.com
Cc: stable at dpdk.org
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 examples/l3fwd-power/main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index c7fe0ec03495..3a8a7277cb0a 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -1396,6 +1396,10 @@ check_port_config(void)
 								portid);
 			return -1;
 		}
+		if (!rte_eth_dev_is_owned_by(portid, RTE_ETH_DEV_NO_OWNER)) {
+			printf("port %u is already in use\n", portid);
+			return -1;
+		}
 	}
 	return 0;
 }
-- 
2.20.1



More information about the dev mailing list