summaryrefslogtreecommitdiff
path: root/examples
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
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')
-rw-r--r--examples/bond/main.c2
-rw-r--r--examples/distributor/main.c6
-rw-r--r--examples/ethtool/ethtool-app/main.c2
-rw-r--r--examples/eventdev_pipeline/main.c4
-rw-r--r--examples/eventdev_pipeline/pipeline_worker_tx.c4
-rw-r--r--examples/exception_path/main.c2
-rw-r--r--examples/flow_classify/flow_classify.c4
-rw-r--r--examples/flow_filtering/Makefile3
-rw-r--r--examples/flow_filtering/main.c4
-rw-r--r--examples/flow_filtering/meson.build1
-rw-r--r--examples/ip_fragmentation/main.c4
-rw-r--r--examples/ip_reassembly/main.c2
-rw-r--r--examples/ipv4_multicast/main.c2
-rw-r--r--examples/kni/main.c2
-rw-r--r--examples/l2fwd-cat/l2fwd-cat.c2
-rw-r--r--examples/l2fwd-crypto/main.c2
-rw-r--r--examples/l2fwd-jobstats/main.c2
-rw-r--r--examples/l2fwd-keepalive/main.c2
-rw-r--r--examples/l2fwd/main.c2
-rw-r--r--examples/l3fwd-acl/main.c2
-rw-r--r--examples/l3fwd-power/main.c2
-rw-r--r--examples/l3fwd-vf/main.c2
-rw-r--r--examples/l3fwd/main.c2
-rw-r--r--examples/link_status_interrupt/Makefile3
-rw-r--r--examples/link_status_interrupt/main.c2
-rw-r--r--examples/link_status_interrupt/meson.build1
-rw-r--r--examples/multi_process/client_server_mp/mp_client/Makefile1
-rw-r--r--examples/multi_process/client_server_mp/mp_client/client.c2
-rw-r--r--examples/multi_process/client_server_mp/mp_server/Makefile1
-rw-r--r--examples/multi_process/client_server_mp/mp_server/init.c2
-rw-r--r--examples/multi_process/l2fwd_fork/main.c2
-rw-r--r--examples/multi_process/symmetric_mp/main.c2
-rw-r--r--examples/netmap_compat/bridge/Makefile1
-rw-r--r--examples/netmap_compat/bridge/bridge.c2
-rw-r--r--examples/packet_ordering/main.c4
-rw-r--r--examples/performance-thread/l3fwd-thread/main.c2
-rw-r--r--examples/ptpclient/ptpclient.c2
-rw-r--r--examples/qos_sched/Makefile3
-rw-r--r--examples/qos_sched/init.c2
-rw-r--r--examples/qos_sched/meson.build1
-rw-r--r--examples/quota_watermark/qw/Makefile1
-rw-r--r--examples/quota_watermark/qw/init.c2
-rw-r--r--examples/rxtx_callbacks/main.c2
-rw-r--r--examples/server_node_efd/node/Makefile1
-rw-r--r--examples/server_node_efd/node/node.c2
-rw-r--r--examples/server_node_efd/server/Makefile1
-rw-r--r--examples/server_node_efd/server/init.c2
-rw-r--r--examples/skeleton/basicfwd.c2
-rw-r--r--examples/skeleton/meson.build2
-rw-r--r--examples/tep_termination/main.c2
-rw-r--r--examples/vhost/main.c2
-rw-r--r--examples/vm_power_manager/main.c2
-rw-r--r--examples/vmdq/main.c2
-rw-r--r--examples/vmdq_dcb/main.c2
54 files changed, 69 insertions, 49 deletions
diff --git a/examples/bond/main.c b/examples/bond/main.c
index d4097d0..d8edc64 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -748,7 +748,7 @@ main(int argc, char *argv[])
argc -= ret;
argv += ret;
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
if (nb_ports == 0)
rte_exit(EXIT_FAILURE, "Give at least one port\n");
else if (nb_ports > MAX_PORTS)
diff --git a/examples/distributor/main.c b/examples/distributor/main.c
index 2e6b09d..2c59364 100644
--- a/examples/distributor/main.c
+++ b/examples/distributor/main.c
@@ -193,7 +193,7 @@ struct lcore_params {
static int
lcore_rx(struct lcore_params *p)
{
- const uint16_t nb_ports = rte_eth_dev_count();
+ const uint16_t nb_ports = rte_eth_dev_count_avail();
const int socket_id = rte_socket_id();
uint16_t port;
struct rte_mbuf *bufs[BURST_SIZE*2];
@@ -542,7 +542,7 @@ lcore_worker(struct lcore_params *p)
* for single port, xor_val will be zero so we won't modify the output
* port, otherwise we send traffic from 0 to 1, 2 to 3, and vice versa
*/
- const unsigned xor_val = (rte_eth_dev_count() > 1);
+ const unsigned xor_val = (rte_eth_dev_count_avail() > 1);
struct rte_mbuf *buf[8] __rte_cache_aligned;
for (i = 0; i < 8; i++)
@@ -678,7 +678,7 @@ main(int argc, char *argv[])
"1 lcore for packet TX\n"
"and at least 1 lcore for worker threads\n");
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
if (nb_ports == 0)
rte_exit(EXIT_FAILURE, "Error: no ethernet ports detected\n");
if (nb_ports != 1 && (nb_ports & 1))
diff --git a/examples/ethtool/ethtool-app/main.c b/examples/ethtool/ethtool-app/main.c
index 702feab..c1815bb 100644
--- a/examples/ethtool/ethtool-app/main.c
+++ b/examples/ethtool/ethtool-app/main.c
@@ -251,7 +251,7 @@ int main(int argc, char **argv)
if (cnt_args_parsed < 0)
rte_exit(EXIT_FAILURE, "rte_eal_init(): Failed");
- cnt_ports = rte_eth_dev_count();
+ cnt_ports = rte_eth_dev_count_avail();
printf("Number of NICs: %i\n", cnt_ports);
if (cnt_ports == 0)
rte_exit(EXIT_FAILURE, "No available NIC ports!\n");
diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c
index 48358a7..b698e4c 100644
--- a/examples/eventdev_pipeline/main.c
+++ b/examples/eventdev_pipeline/main.c
@@ -429,7 +429,7 @@ int
main(int argc, char **argv)
{
struct worker_data *worker_data;
- unsigned int num_ports;
+ uint16_t num_ports;
int lcore_id;
int err;
@@ -451,7 +451,7 @@ main(int argc, char **argv)
/* Parse cli options*/
parse_app_args(argc, argv);
- num_ports = rte_eth_dev_count();
+ num_ports = rte_eth_dev_count_avail();
if (num_ports == 0)
rte_panic("No ethernet ports found\n");
diff --git a/examples/eventdev_pipeline/pipeline_worker_tx.c b/examples/eventdev_pipeline/pipeline_worker_tx.c
index fc98128..3dbde92 100644
--- a/examples/eventdev_pipeline/pipeline_worker_tx.c
+++ b/examples/eventdev_pipeline/pipeline_worker_tx.c
@@ -422,7 +422,7 @@ setup_eventdev_worker_tx(struct cons_data *cons_data,
const uint8_t dev_id = 0;
const uint8_t nb_ports = cdata.num_workers;
uint8_t nb_slots = 0;
- uint8_t nb_queues = rte_eth_dev_count();
+ uint8_t nb_queues = rte_eth_dev_count_avail();
/*
* In case where all type queues are not enabled, use queues equal to
@@ -431,7 +431,7 @@ setup_eventdev_worker_tx(struct cons_data *cons_data,
*/
if (!atq) {
nb_queues *= cdata.num_stages;
- nb_queues += rte_eth_dev_count();
+ nb_queues += rte_eth_dev_count_avail();
}
struct rte_event_dev_config config = {
diff --git a/examples/exception_path/main.c b/examples/exception_path/main.c
index 996f493..2b381a5 100644
--- a/examples/exception_path/main.c
+++ b/examples/exception_path/main.c
@@ -559,7 +559,7 @@ main(int argc, char** argv)
}
/* Get number of ports found in scan */
- nb_sys_ports = rte_eth_dev_count();
+ nb_sys_ports = rte_eth_dev_count_avail();
if (nb_sys_ports == 0)
FATAL_ERROR("No supported Ethernet device found");
/* Find highest port set in portmask */
diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c
index d0e537e..3b087ce 100644
--- a/examples/flow_classify/flow_classify.c
+++ b/examples/flow_classify/flow_classify.c
@@ -752,7 +752,7 @@ int
main(int argc, char *argv[])
{
struct rte_mempool *mbuf_pool;
- uint8_t nb_ports;
+ uint16_t nb_ports;
uint16_t portid;
int ret;
int socket_id;
@@ -776,7 +776,7 @@ main(int argc, char *argv[])
rte_exit(EXIT_FAILURE, "Invalid flow_classify parameters\n");
/* Check that there is an even number of ports to send/receive on. */
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
if (nb_ports < 2 || (nb_ports & 1))
rte_exit(EXIT_FAILURE, "Error: number of ports must be even\n");
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
diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index f525c3a..8952ea4 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -843,7 +843,7 @@ main(int argc, char **argv)
struct rte_eth_txconf *txconf;
struct rx_queue *rxq;
int socket, ret;
- unsigned nb_ports;
+ uint16_t nb_ports;
uint16_t queueid = 0;
unsigned lcore_id = 0, rx_lcore_id = 0;
uint32_t n_tx_queue, nb_lcores;
@@ -861,7 +861,7 @@ main(int argc, char **argv)
if (ret < 0)
rte_exit(EXIT_FAILURE, "Invalid arguments");
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
if (nb_ports == 0)
rte_exit(EXIT_FAILURE, "No ports found!\n");
diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c
index ddff358..3e8e79c 100644
--- a/examples/ip_reassembly/main.c
+++ b/examples/ip_reassembly/main.c
@@ -1008,7 +1008,7 @@ main(int argc, char **argv)
if (ret < 0)
rte_exit(EXIT_FAILURE, "Invalid IP reassembly parameters\n");
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
if (nb_ports == 0)
rte_exit(EXIT_FAILURE, "No ports found!\n");
diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c
index 23b266b..ad2072f 100644
--- a/examples/ipv4_multicast/main.c
+++ b/examples/ipv4_multicast/main.c
@@ -674,7 +674,7 @@ main(int argc, char **argv)
if (clone_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot init clone mbuf pool\n");
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
if (nb_ports == 0)
rte_exit(EXIT_FAILURE, "No physical ports!\n");
if (nb_ports > MAX_PORTS)
diff --git a/examples/kni/main.c b/examples/kni/main.c
index 901480a..4b162de 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -926,7 +926,7 @@ main(int argc, char** argv)
}
/* Get number of ports found in scan */
- nb_sys_ports = rte_eth_dev_count();
+ nb_sys_ports = rte_eth_dev_count_avail();
if (nb_sys_ports == 0)
rte_exit(EXIT_FAILURE, "No supported Ethernet device found\n");
diff --git a/examples/l2fwd-cat/l2fwd-cat.c b/examples/l2fwd-cat/l2fwd-cat.c
index ed48780..0e6078a 100644
--- a/examples/l2fwd-cat/l2fwd-cat.c
+++ b/examples/l2fwd-cat/l2fwd-cat.c
@@ -173,7 +173,7 @@ main(int argc, char *argv[])
argv += ret;
/* Check that there is an even number of ports to send/receive on. */
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
if (nb_ports < 2 || (nb_ports & 1))
rte_exit(EXIT_FAILURE, "Error: number of ports must be even\n");
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index b1ad192..4220448 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -2311,7 +2311,7 @@ initialize_ports(struct l2fwd_crypto_options *options)
{
uint16_t last_portid = 0, portid;
unsigned enabled_portcount = 0;
- unsigned nb_ports = rte_eth_dev_count();
+ unsigned nb_ports = rte_eth_dev_count_avail();
if (nb_ports == 0) {
printf("No Ethernet ports - bye\n");
diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c
index 2482248..34553fa 100644
--- a/examples/l2fwd-jobstats/main.c
+++ b/examples/l2fwd-jobstats/main.c
@@ -770,7 +770,7 @@ main(int argc, char **argv)
if (l2fwd_pktmbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
if (nb_ports == 0)
rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c
index e9ad91a..a18b707 100644
--- a/examples/l2fwd-keepalive/main.c
+++ b/examples/l2fwd-keepalive/main.c
@@ -561,7 +561,7 @@ main(int argc, char **argv)
if (l2fwd_pktmbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
if (nb_ports == 0)
rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index f8ca29c..6908435 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -545,7 +545,7 @@ main(int argc, char **argv)
/* convert to number of cycles */
timer_period *= rte_get_timer_hz();
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
if (nb_ports == 0)
rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c
index 2c891b4..33ad467 100644
--- a/examples/l3fwd-acl/main.c
+++ b/examples/l3fwd-acl/main.c
@@ -1891,7 +1891,7 @@ main(int argc, char **argv)
if (ret < 0)
rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n");
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
if (check_port_config() < 0)
rte_exit(EXIT_FAILURE, "check_port_config failed\n");
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index d6a0926..596d645 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -1650,7 +1650,7 @@ main(int argc, char **argv)
if (ret < 0)
rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n");
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
if (check_port_config() < 0)
rte_exit(EXIT_FAILURE, "check_port_config failed\n");
diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c
index dd0e057..aaafb7b 100644
--- a/examples/l3fwd-vf/main.c
+++ b/examples/l3fwd-vf/main.c
@@ -949,7 +949,7 @@ main(int argc, char **argv)
if (ret < 0)
rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n");
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
if (check_port_config() < 0)
rte_exit(EXIT_FAILURE, "check_port_config failed\n");
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index ec1da5c..bf7dbd8 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -826,7 +826,7 @@ main(int argc, char **argv)
if (ret < 0)
rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n");
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
if (check_port_config() < 0)
rte_exit(EXIT_FAILURE, "check_port_config failed\n");
diff --git a/examples/link_status_interrupt/Makefile b/examples/link_status_interrupt/Makefile
index 1606821..d778fcb 100644
--- a/examples/link_status_interrupt/Makefile
+++ b/examples/link_status_interrupt/Makefile
@@ -23,6 +23,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)
@@ -48,6 +50,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/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c
index ad0dd39..f568956 100644
--- a/examples/link_status_interrupt/main.c
+++ b/examples/link_status_interrupt/main.c
@@ -542,7 +542,7 @@ main(int argc, char **argv)
if (lsi_pktmbuf_pool == NULL)
rte_panic("Cannot init mbuf pool\n");
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
if (nb_ports == 0)
rte_panic("No Ethernet port - bye\n");
diff --git a/examples/link_status_interrupt/meson.build b/examples/link_status_interrupt/meson.build
index c34e11e..2b0a250 100644
--- a/examples/link_status_interrupt/meson.build
+++ b/examples/link_status_interrupt/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
sources = files(
'main.c'
)
diff --git a/examples/multi_process/client_server_mp/mp_client/Makefile b/examples/multi_process/client_server_mp/mp_client/Makefile
index 298e1b0..3bfcd75 100644
--- a/examples/multi_process/client_server_mp/mp_client/Makefile
+++ b/examples/multi_process/client_server_mp/mp_client/Makefile
@@ -14,6 +14,7 @@ APP = mp_client
# all source are stored in SRCS-y
SRCS-y := client.c
+CFLAGS += -DALLOW_EXPERIMENTAL_API
CFLAGS += $(WERROR_FLAGS) -O3
CFLAGS += -I$(SRCDIR)/../shared
diff --git a/examples/multi_process/client_server_mp/mp_client/client.c b/examples/multi_process/client_server_mp/mp_client/client.c
index 92955e9..c23dd3f 100644
--- a/examples/multi_process/client_server_mp/mp_client/client.c
+++ b/examples/multi_process/client_server_mp/mp_client/client.c
@@ -220,7 +220,7 @@ main(int argc, char *argv[])
if (parse_app_args(argc, argv) < 0)
rte_exit(EXIT_FAILURE, "Invalid command-line arguments\n");
- if (rte_eth_dev_count() == 0)
+ if (rte_eth_dev_count_avail() == 0)
rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
rx_ring = rte_ring_lookup(get_rx_queue_name(client_id));
diff --git a/examples/multi_process/client_server_mp/mp_server/Makefile b/examples/multi_process/client_server_mp/mp_server/Makefile
index 3e244e2..af7246e 100644
--- a/examples/multi_process/client_server_mp/mp_server/Makefile
+++ b/examples/multi_process/client_server_mp/mp_server/Makefile
@@ -23,6 +23,7 @@ SRCS-y := main.c init.c args.c
INC := $(sort $(wildcard *.h))
+CFLAGS += -DALLOW_EXPERIMENTAL_API
CFLAGS += $(WERROR_FLAGS) -O3
CFLAGS += -I$(SRCDIR)/../shared
diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c
index 1c465cc..30c8e44 100644
--- a/examples/multi_process/client_server_mp/mp_server/init.c
+++ b/examples/multi_process/client_server_mp/mp_server/init.c
@@ -243,7 +243,7 @@ init(int argc, char *argv[])
argv += retval;
/* get total number of ports */
- total_ports = rte_eth_dev_count();
+ total_ports = rte_eth_dev_count_total();
/* set up array for port data */
mz = rte_memzone_reserve(MZ_PORT_INFO, sizeof(*ports),
diff --git a/examples/multi_process/l2fwd_fork/main.c b/examples/multi_process/l2fwd_fork/main.c
index 6b130f2..94318ab 100644
--- a/examples/multi_process/l2fwd_fork/main.c
+++ b/examples/multi_process/l2fwd_fork/main.c
@@ -941,7 +941,7 @@ main(int argc, char **argv)
for (i = 0; i < RTE_MAX_LCORE; i++)
lcore_resource[i].lcore_id = i;
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
if (nb_ports == 0)
rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c
index 75cad0c..16f21a1 100644
--- a/examples/multi_process/symmetric_mp/main.c
+++ b/examples/multi_process/symmetric_mp/main.c
@@ -418,7 +418,7 @@ main(int argc, char **argv)
argv += ret;
/* determine the NIC devices available */
- if (rte_eth_dev_count() == 0)
+ if (rte_eth_dev_count_avail() == 0)
rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
/* parse application arguments (those after the EAL ones) */
diff --git a/examples/netmap_compat/bridge/Makefile b/examples/netmap_compat/bridge/Makefile
index a7c9c14..071c09d 100644
--- a/examples/netmap_compat/bridge/Makefile
+++ b/examples/netmap_compat/bridge/Makefile
@@ -27,6 +27,7 @@ VPATH := $(SRCDIR)/../lib
SRCS-y := bridge.c
SRCS-y += compat_netmap.c
+CFLAGS += -DALLOW_EXPERIMENTAL_API
CFLAGS += -O3 -I$(SRCDIR)/../lib -I$(SRCDIR)/../netmap
CFLAGS += $(WERROR_FLAGS)
diff --git a/examples/netmap_compat/bridge/bridge.c b/examples/netmap_compat/bridge/bridge.c
index 59c5e43..cb1882e 100644
--- a/examples/netmap_compat/bridge/bridge.c
+++ b/examples/netmap_compat/bridge/bridge.c
@@ -236,7 +236,7 @@ int main(int argc, char *argv[])
if (ports.num == 0)
rte_exit(EXIT_FAILURE, "no ports specified\n");
- if (rte_eth_dev_count() < 1)
+ if (rte_eth_dev_count_avail() < 1)
rte_exit(EXIT_FAILURE, "Not enough ethernet ports available\n");
pool = rte_pktmbuf_pool_create("mbuf_pool", MBUF_PER_POOL, 32, 0,
diff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c
index 676cb6f..7ace7d1 100644
--- a/examples/packet_ordering/main.c
+++ b/examples/packet_ordering/main.c
@@ -430,7 +430,7 @@ rx_thread(struct rte_ring *ring_out)
static int
worker_thread(void *args_ptr)
{
- const uint8_t nb_ports = rte_eth_dev_count();
+ const uint16_t nb_ports = rte_eth_dev_count_avail();
uint16_t i, ret = 0;
uint16_t burst_size = 0;
struct worker_thread_args *args;
@@ -644,7 +644,7 @@ main(int argc, char **argv)
"1 lcore for packet TX\n"
"and at least 1 lcore for worker threads\n");
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
if (nb_ports == 0)
rte_exit(EXIT_FAILURE, "Error: no ethernet ports detected\n");
if (nb_ports != 1 && (nb_ports & 1))
diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index 699b99d..f51e6b0 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -3514,7 +3514,7 @@ main(int argc, char **argv)
if (ret < 0)
rte_exit(EXIT_FAILURE, "init_rx_rings failed\n");
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
if (check_port_config() < 0)
rte_exit(EXIT_FAILURE, "check_port_config failed\n");
diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c
index 55be3f7..c44013b 100644
--- a/examples/ptpclient/ptpclient.c
+++ b/examples/ptpclient/ptpclient.c
@@ -727,7 +727,7 @@ main(int argc, char *argv[])
rte_exit(EXIT_FAILURE, "Error with PTP initialization\n");
/* Check that there is an even number of ports to send/receive on. */
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
/* Creates a new mempool in memory to hold the mbufs. */
mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NUM_MBUFS * nb_ports,
diff --git a/examples/qos_sched/Makefile b/examples/qos_sched/Makefile
index 0f0a31f..e6dfbef 100644
--- a/examples/qos_sched/Makefile
+++ b/examples/qos_sched/Makefile
@@ -23,6 +23,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)
@@ -55,6 +57,7 @@ all:
clean:
else
+CFLAGS += -DALLOW_EXPERIMENTAL_API
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
CFLAGS_args.o := -D_GNU_SOURCE
diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c
index 8914f76..c9e4879 100644
--- a/examples/qos_sched/init.c
+++ b/examples/qos_sched/init.c
@@ -298,7 +298,7 @@ int app_init(void)
char ring_name[MAX_NAME_LEN];
char pool_name[MAX_NAME_LEN];
- if (rte_eth_dev_count() == 0)
+ if (rte_eth_dev_count_avail() == 0)
rte_exit(EXIT_FAILURE, "No Ethernet port - bye\n");
/* load configuration profile */
diff --git a/examples/qos_sched/meson.build b/examples/qos_sched/meson.build
index 289b81c..5101652 100644
--- a/examples/qos_sched/meson.build
+++ b/examples/qos_sched/meson.build
@@ -7,6 +7,7 @@
# DPDK instance, use 'make'
deps += ['sched', 'cfgfile']
+allow_experimental_apis = true
sources = files(
'app_thread.c', 'args.c', 'cfg_file.c', 'cmdline.c',
'init.c', 'main.c', 'stats.c'
diff --git a/examples/quota_watermark/qw/Makefile b/examples/quota_watermark/qw/Makefile
index 84299e5..d0a9b3c 100644
--- a/examples/quota_watermark/qw/Makefile
+++ b/examples/quota_watermark/qw/Makefile
@@ -16,6 +16,7 @@ APP = qw
# all source are stored in SRCS-y
SRCS-y := args.c init.c main.c
+CFLAGS += -DALLOW_EXPERIMENTAL_API
CFLAGS += -O3 -DQW_SOFTWARE_FC
CFLAGS += $(WERROR_FLAGS)
diff --git a/examples/quota_watermark/qw/init.c b/examples/quota_watermark/qw/init.c
index d4a6918..00725bc 100644
--- a/examples/quota_watermark/qw/init.c
+++ b/examples/quota_watermark/qw/init.c
@@ -112,7 +112,7 @@ void configure_eth_port(uint16_t port_id)
void
init_dpdk(void)
{
- if (rte_eth_dev_count() < 2)
+ if (rte_eth_dev_count_avail() < 2)
rte_exit(EXIT_FAILURE, "Not enough ethernet port available\n");
}
diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c
index 84b09cf..e63ea28 100644
--- a/examples/rxtx_callbacks/main.c
+++ b/examples/rxtx_callbacks/main.c
@@ -188,7 +188,7 @@ main(int argc, char *argv[])
argc -= ret;
argv += ret;
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
if (nb_ports < 2 || (nb_ports & 1))
rte_exit(EXIT_FAILURE, "Error: number of ports must be even\n");
diff --git a/examples/server_node_efd/node/Makefile b/examples/server_node_efd/node/Makefile
index fffbe35..dc3191a 100644
--- a/examples/server_node_efd/node/Makefile
+++ b/examples/server_node_efd/node/Makefile
@@ -14,6 +14,7 @@ APP = node
# all source are stored in SRCS-y
SRCS-y := node.c
+CFLAGS += -DALLOW_EXPERIMENTAL_API
CFLAGS += $(WERROR_FLAGS) -O3
CFLAGS += -I$(SRCDIR)/../shared
diff --git a/examples/server_node_efd/node/node.c b/examples/server_node_efd/node/node.c
index 84f7bcf..3b97fbd 100644
--- a/examples/server_node_efd/node/node.c
+++ b/examples/server_node_efd/node/node.c
@@ -320,7 +320,7 @@ main(int argc, char *argv[])
if (parse_app_args(argc, argv) < 0)
rte_exit(EXIT_FAILURE, "Invalid command-line arguments\n");
- if (rte_eth_dev_count() == 0)
+ if (rte_eth_dev_count_avail() == 0)
rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
rx_ring = rte_ring_lookup(get_rx_queue_name(node_id));
diff --git a/examples/server_node_efd/server/Makefile b/examples/server_node_efd/server/Makefile
index cbb91eb..d5456f9 100644
--- a/examples/server_node_efd/server/Makefile
+++ b/examples/server_node_efd/server/Makefile
@@ -23,6 +23,7 @@ SRCS-y := main.c init.c args.c
INC := $(sort $(wildcard *.h))
+CFLAGS += -DALLOW_EXPERIMENTAL_API
CFLAGS += $(WERROR_FLAGS) -O3
CFLAGS += -I$(SRCDIR)/../shared
diff --git a/examples/server_node_efd/server/init.c b/examples/server_node_efd/server/init.c
index 07b6882..7dfe2fa 100644
--- a/examples/server_node_efd/server/init.c
+++ b/examples/server_node_efd/server/init.c
@@ -310,7 +310,7 @@ init(int argc, char *argv[])
argv += retval;
/* get total number of ports */
- total_ports = rte_eth_dev_count();
+ total_ports = rte_eth_dev_count_avail();
/* set up array for port data */
mz = rte_memzone_reserve(MZ_SHARED_INFO, sizeof(*info),
diff --git a/examples/skeleton/basicfwd.c b/examples/skeleton/basicfwd.c
index 5ac1dc8..03bc358 100644
--- a/examples/skeleton/basicfwd.c
+++ b/examples/skeleton/basicfwd.c
@@ -173,7 +173,7 @@ main(int argc, char *argv[])
argv += ret;
/* Check that there is an even number of ports to send/receive on. */
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
if (nb_ports < 2 || (nb_ports & 1))
rte_exit(EXIT_FAILURE, "Error: number of ports must be even\n");
diff --git a/examples/skeleton/meson.build b/examples/skeleton/meson.build
index ef46b18..89ddba2 100644
--- a/examples/skeleton/meson.build
+++ b/examples/skeleton/meson.build
@@ -10,3 +10,5 @@ allow_experimental_apis = true
sources = files(
'basicfwd.c'
)
+
+allow_experimental_apis = true
diff --git a/examples/tep_termination/main.c b/examples/tep_termination/main.c
index e868541..8543a98 100644
--- a/examples/tep_termination/main.c
+++ b/examples/tep_termination/main.c
@@ -1156,7 +1156,7 @@ main(int argc, char *argv[])
nb_switching_cores = rte_lcore_count()-1;
/* Get the number of physical ports. */
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
/*
* Update the global var NB_PORTS and global array PORTS
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 7cddac7..84e0d63 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -1448,7 +1448,7 @@ main(int argc, char *argv[])
rte_exit(EXIT_FAILURE,"Not enough cores\n");
/* Get the number of physical ports. */
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
/*
* Update the global var NUM_PORTS and global array PORTS
diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c
index db0ddb0..c9805a4 100644
--- a/examples/vm_power_manager/main.c
+++ b/examples/vm_power_manager/main.c
@@ -278,7 +278,7 @@ main(int argc, char **argv)
if (ret < 0)
rte_exit(EXIT_FAILURE, "Invalid arguments\n");
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NUM_MBUFS * nb_ports,
MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c
index 2f3eb74..52596dd 100644
--- a/examples/vmdq/main.c
+++ b/examples/vmdq/main.c
@@ -580,7 +580,7 @@ main(int argc, char *argv[])
if (rte_lcore_count() > RTE_MAX_LCORE)
rte_exit(EXIT_FAILURE, "Not enough cores\n");
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
/*
* Update the global var NUM_PORTS and global array PORTS
diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c
index 9c68ab0..2626a2f 100644
--- a/examples/vmdq_dcb/main.c
+++ b/examples/vmdq_dcb/main.c
@@ -642,7 +642,7 @@ main(int argc, char *argv[])
" number of cores(1-%d)\n\n", RTE_MAX_LCORE);
}
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count_avail();
/*
* Update the global var NUM_PORTS and global array PORTS