[dpdk-stable] [PATCH v3 5/6] examples/l3fwd-power: make applicaton aware of port ownership

Stephen Hemminger stephen at networkplumber.org
Thu Apr 2 19:19:52 CEST 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..186d6ac8e271 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_owner_get(portid, NULL) == 0) {
+			printf("port %u is already in use\n", portid);
+			return -1;
+		}
 	}
 	return 0;
 }
-- 
2.20.1



More information about the stable mailing list