summaryrefslogtreecommitdiff
path: root/examples/flow_filtering
diff options
context:
space:
mode:
authorThomas Monjalon <thomas@monjalon.net>2018-04-05 17:33:22 +0200
committerThomas Monjalon <thomas@monjalon.net>2018-04-18 00:48:41 +0200
commitd9a42a69febf453cdb735e77fc0e01463ddf4acc (patch)
tree02965fc7b153216e78ba1135d440d2085e46c1c0 /examples/flow_filtering
parenta9dbe180222680edf8c49e86791f972549ce5be3 (diff)
downloaddpdk-d9a42a69febf453cdb735e77fc0e01463ddf4acc.zip
dpdk-d9a42a69febf453cdb735e77fc0e01463ddf4acc.tar.gz
dpdk-d9a42a69febf453cdb735e77fc0e01463ddf4acc.tar.xz
ethdev: deprecate port count function
Some DPDK applications wrongly assume these requirements: - no hotplug, i.e. ports are never detached - all allocated ports are available to the application Such application iterates over ports by its own mean. The most common pattern is to request the port count and assume ports with index in the range [0..count[ can be used. In order to fix this common mistake in all external applications, the function rte_eth_dev_count is deprecated, while introducing the new functions rte_eth_dev_count_avail and rte_eth_dev_count_total. Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Diffstat (limited to 'examples/flow_filtering')
-rw-r--r--examples/flow_filtering/Makefile3
-rw-r--r--examples/flow_filtering/main.c4
-rw-r--r--examples/flow_filtering/meson.build1
3 files changed, 6 insertions, 2 deletions
diff --git a/examples/flow_filtering/Makefile b/examples/flow_filtering/Makefile
index 01bb4cd..f41b368 100644
--- a/examples/flow_filtering/Makefile
+++ b/examples/flow_filtering/Makefile
@@ -50,6 +50,8 @@ CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
@@ -75,6 +77,7 @@ RTE_TARGET ?= x86_64-native-linuxapp-gcc
include $(RTE_SDK)/mk/rte.vars.mk
+CFLAGS += -DALLOW_EXPERIMENTAL_API
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c
index 0bb81a8..db03c9c 100644
--- a/examples/flow_filtering/main.c
+++ b/examples/flow_filtering/main.c
@@ -232,7 +232,7 @@ int
main(int argc, char **argv)
{
int ret;
- uint8_t nr_ports;
+ uint16_t nr_ports;
struct rte_flow_error error;
ret = rte_eal_init(argc, argv);
@@ -243,7 +243,7 @@ main(int argc, char **argv)
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
- nr_ports = rte_eth_dev_count();
+ nr_ports = rte_eth_dev_count_avail();
if (nr_ports == 0)
rte_exit(EXIT_FAILURE, ":: no Ethernet ports found\n");
port_id = 0;
diff --git a/examples/flow_filtering/meson.build b/examples/flow_filtering/meson.build
index 407795c..9494933 100644
--- a/examples/flow_filtering/meson.build
+++ b/examples/flow_filtering/meson.build
@@ -9,3 +9,4 @@
sources = files(
'main.c',
)
+allow_experimental_apis = true