[v2,2/6] examples/l2fwd-cat: block attempts to use owned ports
Checks
Commit Message
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@mellanox.com
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@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(+)
@@ -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)
@@ -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_is_owned(portid))
+ return -1;
+
/* Configure the Ethernet device. */
retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf);
if (retval != 0)
@@ -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