From bbeee9bd1c845d06518fd8fab590de5490d460a2 Mon Sep 17 00:00:00 2001 From: Xavier Simonart Date: Fri, 29 May 2020 23:15:04 +0200 Subject: Fix compilation issues on old DPDK Also fixed minor issues such as - prevent using vdev on DPDK <= 17.05 as not supported - potential segmentation fault after panic (if panic thrown early in prox initialization) Change-Id: I49a1962e95a4a44dddadd1fdd906e1b3b232465c Signed-off-by: Xavier Simonart --- VNFs/DPPD-PROX/prox_compat.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'VNFs/DPPD-PROX/prox_compat.h') diff --git a/VNFs/DPPD-PROX/prox_compat.h b/VNFs/DPPD-PROX/prox_compat.h index 091c2ccd..404ce9ed 100644 --- a/VNFs/DPPD-PROX/prox_compat.h +++ b/VNFs/DPPD-PROX/prox_compat.h @@ -17,9 +17,12 @@ #define _PROX_COMPAT_H_ #include #include +#include #include #include + #include "hash_utils.h" +#include "log.h" /* This is a copy of the rte_table_hash_params from DPDK 17.11 * * So if DPDK decides to change the structure the modifications * @@ -36,12 +39,19 @@ struct prox_rte_table_params { uint64_t seed; }; -#if RTE_VERSION < RTE_VERSION_NUM(16,4,0,1) +#if RTE_VERSION < RTE_VERSION_NUM(16,4,0,0) typedef uint8_t prox_next_hop_index_type; #else typedef uint32_t prox_next_hop_index_type; #endif +#if RTE_VERSION < RTE_VERSION_NUM(16,7,0,0) +static void rte_mempool_free(struct rte_mempool *mp) +{ + plog_warn("rte_mempool_free not supported in this DPDK - upgrade DPDK to avoid memory leaks\n"); +} +#endif + #if RTE_VERSION < RTE_VERSION_NUM(17,11,0,0) static void *prox_rte_table_create(struct prox_rte_table_params *params, int socket_id, uint32_t entry_size) @@ -70,6 +80,16 @@ static void *prox_rte_table_create(struct prox_rte_table_params *params, int soc } }; +static inline int prox_rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id) +{ +#if RTE_VERSION < RTE_VERSION_NUM(16,7,0,0) + plog_err("Not supported in DPDK version <= 16.04 by lack of rte_eth_dev_get_port_by_name support\n"); + return -1; +#else + return rte_eth_dev_get_port_by_name(name, (uint8_t *)port_id); +#endif +} + #define prox_rte_table_free rte_table_hash_ext_dosig_ops.f_free #define prox_rte_table_add rte_table_hash_ext_dosig_ops.f_add #define prox_rte_table_delete rte_table_hash_ext_dosig_ops.f_delete @@ -109,6 +129,8 @@ static void *prox_rte_table_create(struct prox_rte_table_params *params, int soc } } +#define prox_rte_eth_dev_get_port_by_name rte_eth_dev_get_port_by_name + #define prox_rte_table_free rte_table_hash_ext_ops.f_free #define prox_rte_table_add rte_table_hash_ext_ops.f_add #define prox_rte_table_delete rte_table_hash_ext_ops.f_delete -- cgit 1.2.3-korg