summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--VNFs/DPPD-PROX/handle_gen.c9
-rw-r--r--VNFs/DPPD-PROX/handle_master.c1
-rw-r--r--VNFs/DPPD-PROX/handle_swap.c1
-rw-r--r--VNFs/DPPD-PROX/packet_utils.h2
-rw-r--r--VNFs/DPPD-PROX/prox_args.c2
-rw-r--r--VNFs/DPPD-PROX/prox_compat.h24
-rw-r--r--VNFs/DPPD-PROX/prox_port_cfg.c19
-rw-r--r--VNFs/DPPD-PROX/task_init.h1
8 files changed, 54 insertions, 5 deletions
diff --git a/VNFs/DPPD-PROX/handle_gen.c b/VNFs/DPPD-PROX/handle_gen.c
index 7a004087..adcabd79 100644
--- a/VNFs/DPPD-PROX/handle_gen.c
+++ b/VNFs/DPPD-PROX/handle_gen.c
@@ -614,9 +614,16 @@ static int task_gen_reallocate_templates(struct task_gen *task, uint32_t nb_pkts
}
size_t mem_size = nb_pkts * sizeof(*task->pkt_template);
+ size_t old_mem_size = task->n_pkts * sizeof(*task->pkt_template);
+ if (old_mem_size > mem_size)
+ old_mem_size = mem_size;
+
struct pkt_template *ptr;
+
// re-allocate memory for new pkt_template (this might allocate additional memory or free up some...)
- if ((ptr = rte_realloc_socket(task->pkt_template, mem_size, RTE_CACHE_LINE_SIZE, task->socket_id)) != NULL) {
+ if ((ptr = rte_malloc_socket(NULL, mem_size, RTE_CACHE_LINE_SIZE, task->socket_id)) != NULL) {
+ memcpy(ptr, task->pkt_template, old_mem_size);
+ rte_free(task->pkt_template);
task->pkt_template = ptr;
} else {
plog_err_or_panic(do_panic, "Failed to allocate %lu bytes (in huge pages) for packet template for IMIX\n", mem_size);
diff --git a/VNFs/DPPD-PROX/handle_master.c b/VNFs/DPPD-PROX/handle_master.c
index 8e03526f..1026a179 100644
--- a/VNFs/DPPD-PROX/handle_master.c
+++ b/VNFs/DPPD-PROX/handle_master.c
@@ -24,6 +24,7 @@
#include <rte_hash.h>
#include <rte_hash_crc.h>
#include <rte_ether.h>
+#include <rte_icmp.h>
#include "prox_cfg.h"
#include "prox_globals.h"
diff --git a/VNFs/DPPD-PROX/handle_swap.c b/VNFs/DPPD-PROX/handle_swap.c
index a5abd891..e097bc05 100644
--- a/VNFs/DPPD-PROX/handle_swap.c
+++ b/VNFs/DPPD-PROX/handle_swap.c
@@ -16,6 +16,7 @@
#include <rte_mbuf.h>
#include <rte_udp.h>
+#include <rte_icmp.h>
#include "task_init.h"
#include "task_base.h"
diff --git a/VNFs/DPPD-PROX/packet_utils.h b/VNFs/DPPD-PROX/packet_utils.h
index 381a7687..e1b262dc 100644
--- a/VNFs/DPPD-PROX/packet_utils.h
+++ b/VNFs/DPPD-PROX/packet_utils.h
@@ -16,6 +16,8 @@
#ifndef _PACKET_UTILS_H_
#define _PACKET_UTILS_H_
+#include <rte_cycles.h>
+
#include "prox_compat.h"
#include "arp.h"
#include "quit.h"
diff --git a/VNFs/DPPD-PROX/prox_args.c b/VNFs/DPPD-PROX/prox_args.c
index 43f9d5fb..d89481ab 100644
--- a/VNFs/DPPD-PROX/prox_args.c
+++ b/VNFs/DPPD-PROX/prox_args.c
@@ -2287,7 +2287,7 @@ int prox_setup_rte(const char *prog_name)
}
uint16_t port_id;
for (int i = 0; i < n_deferred_ports; i++) {
- if (rte_eth_dev_get_port_by_name(deferred_port[i].name, &port_id) != 0) {
+ if (prox_rte_eth_dev_get_port_by_name(deferred_port[i].name, &port_id) != 0) {
plog_err("Did not find port name %s used while reading %s\n", deferred_port[i].name, deferred_port[i].is_rx_port ? "rx port" : "tx_port");
return -1;
}
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 <rte_common.h>
#include <rte_table_hash.h>
+#include <rte_ethdev.h>
#include <rte_hash_crc.h>
#include <rte_cryptodev.h>
+
#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
diff --git a/VNFs/DPPD-PROX/prox_port_cfg.c b/VNFs/DPPD-PROX/prox_port_cfg.c
index 89824d69..b8b80a12 100644
--- a/VNFs/DPPD-PROX/prox_port_cfg.c
+++ b/VNFs/DPPD-PROX/prox_port_cfg.c
@@ -215,13 +215,13 @@ void init_rte_dev(int use_dummy_devices)
}
struct prox_port_cfg* port_cfg = &prox_port_cfg[port_id];
if (port_cfg->vdev[0]) {
-#if (RTE_VERSION > RTE_VERSION_NUM(17,5,0,1))
char name[MAX_NAME_SIZE], tap[MAX_NAME_SIZE];
snprintf(tap, MAX_NAME_SIZE, "net_tap%d", port_id);
+#if (RTE_VERSION > RTE_VERSION_NUM(17,5,0,1))
snprintf(name, MAX_NAME_SIZE, "iface=%s", port_cfg->vdev);
rc = rte_vdev_init(tap, name);
#else
- rc = eth_dev_null_create(tap, name, PROX_RTE_ETHER_MIN_LEN, 0);
+ PROX_PANIC(1, "vdev not supported in DPDK < 17.05\n");
#endif
PROX_PANIC(rc != 0, "Unable to create device %s %s\n", "net tap", port_cfg->vdev);
int vdev_port_id = prox_rte_eth_dev_count_avail() - 1;
@@ -289,6 +289,8 @@ void init_rte_dev(int use_dummy_devices)
nb_ports = PROX_MAX_PORTS;
}
+
+#if (RTE_VERSION >= RTE_VERSION_NUM(17,5,0,0))
port_id_max = -1;
uint16_t id;
RTE_ETH_FOREACH_DEV(id) {
@@ -304,18 +306,28 @@ void init_rte_dev(int use_dummy_devices)
port_id_max = id;
}
}
+#else
+ port_id_max = nb_ports - 1;
+#endif
+
port_id_last = prox_last_port_active();
PROX_PANIC(port_id_last > port_id_max,
"\tError: invalid port(s) specified, last port index active: %d (max index is %d)\n",
port_id_last, port_id_max);
/* Assign ports to PROX interfaces & Read max RX/TX queues per port */
+#if (RTE_VERSION >= RTE_VERSION_NUM(17,5,0,0))
for (uint8_t port_id = 0; port_id <= port_id_last; ++port_id) {
+#else
+ for (uint8_t port_id = 0; port_id <= nb_ports; ++port_id) {
+#endif
/* skip ports that are not enabled */
if (!prox_port_cfg[port_id].active) {
continue;
+#if (RTE_VERSION >= RTE_VERSION_NUM(17,5,0,0))
} else if (prox_port_cfg[port_id].available == 0) {
PROX_PANIC(1, "port %u enabled but not available\n", port_id);
+#endif
}
plog_info("\tGetting info for rte dev %u\n", port_id);
rte_eth_dev_info_get(port_id, &dev_info);
@@ -875,6 +887,9 @@ void close_ports_atexit(void)
rte_eth_dev_close(portid);
}
+ if (lcore_cfg == NULL)
+ return;
+
struct lcore_cfg *lconf = NULL;
struct task_args *targ;
while (core_targ_next(&lconf, &targ, 0) == 0) {
diff --git a/VNFs/DPPD-PROX/task_init.h b/VNFs/DPPD-PROX/task_init.h
index 30a15151..33b912e8 100644
--- a/VNFs/DPPD-PROX/task_init.h
+++ b/VNFs/DPPD-PROX/task_init.h
@@ -137,6 +137,7 @@ struct task_args {
uint32_t arp_ndp_retransmit_timeout;
struct ipv6_addr local_ipv6; /* For IPv6 Tunnel, it's the local tunnel endpoint address */
struct ipv6_addr global_ipv6;
+ struct ipv6_addr gateway_ipv6;
struct ipv6_addr router_prefix;
struct rte_ring *rx_rings[MAX_RINGS_PER_TASK];
struct rte_ring *tx_rings[MAX_RINGS_PER_TASK];