[dpdk-dev] [PATCH v2 6/6] examples/tep_termination: block attempts to use owned ports

Stephen Hemminger stephen at networkplumber.org
Mon Mar 16 17:09:23 CET 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/tep_termination/Makefile    | 2 ++
 examples/tep_termination/main.c      | 2 +-
 examples/tep_termination/meson.build | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/examples/tep_termination/Makefile b/examples/tep_termination/Makefile
index 645112498d33..f55331fb24c2 100644
--- a/examples/tep_termination/Makefile
+++ b/examples/tep_termination/Makefile
@@ -26,6 +26,7 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 CFLAGS += -Wno-deprecated-declarations
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
@@ -61,6 +62,7 @@ endif
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -Wno-deprecated-declarations
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 include $(RTE_SDK)/mk/rte.extapp.mk
 endif
diff --git a/examples/tep_termination/main.c b/examples/tep_termination/main.c
index ab956ad7ce96..96c2d934cd09 100644
--- a/examples/tep_termination/main.c
+++ b/examples/tep_termination/main.c
@@ -507,7 +507,7 @@ check_ports_num(unsigned max_nb_ports)
 	}
 
 	for (portid = 0; portid < nb_ports; portid++) {
-		if (!rte_eth_dev_is_valid_port(ports[portid])) {
+		if (rte_eth_dev_is_owned(portid) != 0) {
 			RTE_LOG(INFO, VHOST_PORT,
 				"\nSpecified port ID(%u) is not valid\n",
 				ports[portid]);
diff --git a/examples/tep_termination/meson.build b/examples/tep_termination/meson.build
index f65d689802a3..ddadf1c2aede 100644
--- a/examples/tep_termination/meson.build
+++ b/examples/tep_termination/meson.build
@@ -9,6 +9,7 @@
 if not is_linux
 	build = false
 endif
+allow_experimental_apis = true
 deps += ['hash', 'vhost']
 cflags += '-Wno-deprecated-declarations'
 sources = files(
-- 
2.20.1



More information about the dev mailing list