From 6f7193eb7af4a76239332988ac2803eb2ce361d9 Mon Sep 17 00:00:00 2001 From: Kevin Laatz Date: Mon, 25 Jun 2018 17:14:34 +0100 Subject: [PATCH] dpdk: fix deprecation warning This fixes a warning produced by a change introduced in the latest DPDK relase caused by a deprecation notice. Signed-off-by: Kevin Laatz --- src/dpdkevents.c | 4 ++++ src/utils_dpdk.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/dpdkevents.c b/src/dpdkevents.c index 064dce16..9fc42b33 100644 --- a/src/dpdkevents.c +++ b/src/dpdkevents.c @@ -420,7 +420,11 @@ static int dpdk_helper_link_status_get(dpdk_helper_ctx_t *phc) { dpdk_events_ctx_t *ec = DPDK_EVENTS_CTX_GET(phc); /* get Link Status values from DPDK */ +#if RTE_VERSION < RTE_VERSION_NUM(18, 05, 0, 0) uint8_t nb_ports = rte_eth_dev_count(); +#else + uint8_t nb_ports = rte_eth_dev_count_avail(); +#endif if (nb_ports == 0) { DPDK_CHILD_LOG("dpdkevent-helper: No DPDK ports available. " "Check bound devices to DPDK driver.\n"); diff --git a/src/utils_dpdk.c b/src/utils_dpdk.c index 30a10574..07ec8aee 100644 --- a/src/utils_dpdk.c +++ b/src/utils_dpdk.c @@ -853,7 +853,11 @@ uint128_t str_to_uint128(const char *str, int len) { } uint8_t dpdk_helper_eth_dev_count() { +#if RTE_VERSION < RTE_VERSION_NUM(18, 05, 0, 0) uint8_t ports = rte_eth_dev_count(); +#else + uint8_t ports = rte_eth_dev_count_avail(); +#endif if (ports == 0) { ERROR( "%s:%d: No DPDK ports available. Check bound devices to DPDK driver.\n", -- 2.11.0