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: ma...@mellanox.com
Cc: sta...@dpdk.org
Signed-off-by: Stephen Hemminger <step...@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

Reply via email to