[v2,4/6] examples/l3fwd-acl: 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/l3fwd-acl/Makefile | 3 +++
examples/l3fwd-acl/main.c | 4 ++++
examples/l3fwd-acl/meson.build | 1 +
3 files changed, 8 insertions(+)
@@ -20,7 +20,9 @@ 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)
@@ -51,6 +53,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
# workaround for a gcc bug with noreturn attribute
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
@@ -1470,6 +1470,10 @@ check_port_config(void)
printf("port %u is not present on the board\n", portid);
return -1;
}
+ if (rte_eth_dev_is_owned(portid)) {
+ printf("port %u is already in use\n", portid);
+ return -1;
+ }
}
return 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
deps += ['acl', 'lpm', 'hash']
sources = files(
'main.c'