[dpdk-dev] [PATCH v3 2/6] examples/l2fwd-cat: make applicaton aware of port ownership

Stephen Hemminger stephen at networkplumber.org
Thu Apr 2 19:19:49 CEST 2020


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 at mellanox.com
Cc: stable at dpdk.org
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 examples/l2fwd-cat/Makefile    | 2 ++
 examples/l2fwd-cat/l2fwd-cat.c | 3 +++
 examples/l2fwd-cat/meson.build | 1 +
 3 files changed, 6 insertions(+)

diff --git a/examples/l2fwd-cat/Makefile b/examples/l2fwd-cat/Makefile
index b0e53c37e8d8..aa19347c1545 100644
--- a/examples/l2fwd-cat/Makefile
+++ b/examples/l2fwd-cat/Makefile
@@ -20,6 +20,7 @@ static: build/$(APP)-static
 PKGCONF ?= pkg-config
 
 PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
@@ -65,6 +66,7 @@ endif
 
 EXTRA_CFLAGS += -O3 -g -Wfatal-errors
 
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 CFLAGS += -I$(PQOS_INSTALL_PATH)/../include
 
 LDLIBS += -L$(PQOS_INSTALL_PATH)
diff --git a/examples/l2fwd-cat/l2fwd-cat.c b/examples/l2fwd-cat/l2fwd-cat.c
index 6838f288c621..e370efeaf1f8 100644
--- a/examples/l2fwd-cat/l2fwd-cat.c
+++ b/examples/l2fwd-cat/l2fwd-cat.c
@@ -42,6 +42,9 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 	if (!rte_eth_dev_is_valid_port(port))
 		return -1;
 
+	if (rte_eth_dev_owner_get(port, NULL) == 0)
+		return -1;
+
 	/* Configure the Ethernet device. */
 	retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf);
 	if (retval != 0)
diff --git a/examples/l2fwd-cat/meson.build b/examples/l2fwd-cat/meson.build
index 4e2777a03358..5c062c1354e3 100644
--- a/examples/l2fwd-cat/meson.build
+++ b/examples/l2fwd-cat/meson.build
@@ -6,6 +6,7 @@
 # To build this example as a standalone application with an already-installed
 # DPDK instance, use 'make'
 
+allow_experimental_apis = true
 pqos = cc.find_library('pqos', required: false)
 build = pqos.found()
 ext_deps += pqos
-- 
2.20.1



More information about the dev mailing list