[v3,5/6] examples/l3fwd-power: make applicaton aware of port ownership
diff mbox series

Message ID 20200402171953.13356-6-stephen@networkplumber.org
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • checking for owned ports in portmask
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch warning coding style issues

Commit Message

Stephen Hemminger April 2, 2020, 5:19 p.m. UTC
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@mellanox.com
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/l3fwd-power/main.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch
diff mbox series

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;
 }