X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_dpdk.c;h=3591eae1d3e30c18e1c907782edc61012bf860aa;hb=7c9d772c992647fcba64a96800c146eb9f1647f8;hp=30a10574e973e3a6a6e9fef3c99b679ee5e0ab88;hpb=109aa67e9a982321af6547b92b5b2b6c8ae2c244;p=collectd.git diff --git a/src/utils_dpdk.c b/src/utils_dpdk.c index 30a10574..3591eae1 100644 --- a/src/utils_dpdk.c +++ b/src/utils_dpdk.c @@ -43,7 +43,11 @@ #include "common.h" #include "utils_dpdk.h" +#if RTE_VERSION <= RTE_VERSION_NUM(18, 5, 0, 0) #define DPDK_DEFAULT_RTE_CONFIG "/var/run/.rte_config" +#else +#define DPDK_DEFAULT_RTE_CONFIG "/var/run/dpdk/rte/config" +#endif #define DPDK_EAL_ARGC 10 // Complete trace should fit into 1024 chars. Trace contain some headers // and text together with traced data from pipe. This is the reason why @@ -184,8 +188,13 @@ int dpdk_helper_eal_config_parse(dpdk_helper_ctx_t *phc, oconfig_item_t *ci) { status = cf_util_get_string_buffer(child, prefix, sizeof(prefix)); if (status == 0) { +#if RTE_VERSION <= RTE_VERSION_NUM(18, 5, 0, 0) snprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN, "/var/run/.%s_config", prefix); +#else + snprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN, + "/var/run/dpdk/%s/config", prefix); +#endif DEBUG("dpdk_common: EAL:File prefix %s", phc->eal_config.file_prefix); } } else if (strcasecmp("LogLevel", child->key) == 0) { @@ -831,7 +840,7 @@ uint128_t str_to_uint128(const char *str, int len) { return lcore_mask; } else { char low_str[DATA_MAX_NAME_LEN]; - char high_str[DATA_MAX_NAME_LEN]; + char high_str[DATA_MAX_NAME_LEN * 2]; memset(high_str, 0, sizeof(high_str)); memset(low_str, 0, sizeof(low_str)); @@ -852,8 +861,12 @@ uint128_t str_to_uint128(const char *str, int len) { return lcore_mask; } -uint8_t dpdk_helper_eth_dev_count() { +uint8_t dpdk_helper_eth_dev_count(void) { +#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",