summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--VNFs/DPPD-PROX/README9
-rw-r--r--VNFs/DPPD-PROX/expire_cpe.c3
-rw-r--r--VNFs/DPPD-PROX/handle_ipv6_tunnel.c25
-rw-r--r--VNFs/DPPD-PROX/handle_lb_net.c28
-rw-r--r--VNFs/DPPD-PROX/handle_lb_qinq.c5
-rw-r--r--VNFs/DPPD-PROX/handle_master.c2
-rw-r--r--VNFs/DPPD-PROX/handle_qinq_decap4.c14
-rw-r--r--VNFs/DPPD-PROX/handle_qinq_decap6.c6
-rw-r--r--VNFs/DPPD-PROX/handle_qinq_encap4.c54
-rw-r--r--VNFs/DPPD-PROX/handle_qinq_encap6.c16
-rw-r--r--VNFs/DPPD-PROX/hash_utils.c6
-rw-r--r--VNFs/DPPD-PROX/hash_utils.h2
-rw-r--r--VNFs/DPPD-PROX/prox_args.c3
-rw-r--r--VNFs/DPPD-PROX/prox_compat.h119
-rw-r--r--VNFs/DPPD-PROX/prox_port_cfg.c21
-rw-r--r--VNFs/DPPD-PROX/prox_port_cfg.h5
16 files changed, 250 insertions, 68 deletions
diff --git a/VNFs/DPPD-PROX/README b/VNFs/DPPD-PROX/README
index 1cf857d..7527479 100644
--- a/VNFs/DPPD-PROX/README
+++ b/VNFs/DPPD-PROX/README
@@ -24,12 +24,19 @@ finer grained network functions like QoS, Routing, load-balancing...
Compiling and running this application
--------------------------------------
-This application supports DPDK 16.04, 16.11, 16.11.1, 17.02, 17.05 and 17.08.
+This application supports DPDK 16.04, 16.11, 16.11.1, 17.02, 17.05 17.08 and 17.11.
The following commands assume that the following variables have been set:
export RTE_SDK=/path/to/dpdk
export RTE_TARGET=x86_64-native-linuxapp-gcc
+IPSec is only supported in PROX with DPDK 17.02 and DPDK 17.05
+It will only be compiled if CONFIG_RTE_LIBRTE_PMD_AESNI_MB is
+set in DPDK .config. This also requires AESNI_MULTI_BUFFER_LIB_PATH to point to
+the multi-buffer library which can be downloaded from
+<https://github.com/01org/intel-ipsec-mb>.
+See doc/guides/cryptodevs/aesni_mb.rst within dpdk for more details
+
Example: DPDK 17.05 installation
--------------------------------
git clone http://dpdk.org/git/dpdk
diff --git a/VNFs/DPPD-PROX/expire_cpe.c b/VNFs/DPPD-PROX/expire_cpe.c
index 4f2f5cd..92ae362 100644
--- a/VNFs/DPPD-PROX/expire_cpe.c
+++ b/VNFs/DPPD-PROX/expire_cpe.c
@@ -19,6 +19,7 @@
#include "hash_entry_types.h"
#include "hash_utils.h"
#include "expire_cpe.h"
+#include "prox_compat.h"
#define MAX_TSC __UINT64_C(0xFFFFFFFFFFFFFFFF)
@@ -34,7 +35,7 @@ void check_expire_cpe(void* data)
if (entries[i]->tsc < cur_tsc) {
int key_found = 0;
void* entry = 0;
- rte_table_hash_key8_ext_dosig_ops.f_delete(um->cpe_table, key[i], &key_found, entry);
+ prox_rte_table_key8_delete(um->cpe_table, key[i], &key_found, entry);
}
}
diff --git a/VNFs/DPPD-PROX/handle_ipv6_tunnel.c b/VNFs/DPPD-PROX/handle_ipv6_tunnel.c
index 3361a6a..13570b1 100644
--- a/VNFs/DPPD-PROX/handle_ipv6_tunnel.c
+++ b/VNFs/DPPD-PROX/handle_ipv6_tunnel.c
@@ -41,6 +41,7 @@
#include "parse_utils.h"
#include "cfgfile.h"
#include "prox_shared.h"
+#include "prox_compat.h"
#if RTE_VERSION < RTE_VERSION_NUM(1,8,0,0)
#define IPPROTO_IPIP IPPROTO_IPV4
@@ -106,17 +107,21 @@ static void init_lookup_table(struct task_ipv6_tun_base* ptask, struct task_args
int ret = lua_to_ip6_tun_binding(prox_lua(), GLOBAL, targ->tun_bindings, socket_id, &table);
PROX_PANIC(ret, "Failed to read tun_bindings config:\n %s\n", get_lua_to_errors());
- struct rte_table_hash_key8_ext_params table_hash_params = {
- .n_entries = (table->num_binding_entries * 4),
- .n_entries_ext = (table->num_binding_entries * 2) >> 1,
- .f_hash = hash_crc32,
+ static char hash_name[30];
+ sprintf(hash_name, "ipv6_tunnel_hash_table_%03d", targ->lconf->id);
+
+ struct prox_rte_table_params table_hash_params = {
+ .name = hash_name,
+ .key_size = 8,
+ .n_keys = (table->num_binding_entries * 4),
+ .n_buckets = (table->num_binding_entries * 2) >> 1,
+ .f_hash = (rte_table_hash_op_hash)hash_crc32,
.seed = 0,
- .signature_offset = HASH_METADATA_OFFSET(8), // Ignored for dosig tables
.key_offset = HASH_METADATA_OFFSET(0),
+ .key_mask = NULL
};
plogx_info("IPv6 Tunnel allocating lookup table on socket %d\n", socket_id);
- ptask->lookup_table = rte_table_hash_key8_ext_dosig_ops.
- f_create(&table_hash_params, socket_id, sizeof(struct ipv6_tun_dest));
+ ptask->lookup_table = prox_rte_table_create(&table_hash_params, socket_id, sizeof(struct ipv6_tun_dest));
PROX_PANIC(ptask->lookup_table == NULL, "Error creating IPv6 Tunnel lookup table");
for (unsigned idx = 0; idx < table->num_binding_entries; idx++) {
@@ -128,7 +133,7 @@ static void init_lookup_table(struct task_ipv6_tun_base* ptask, struct task_args
rte_memcpy(&data.dst_addr, &entry->endpoint_addr, sizeof(struct ipv6_addr));
rte_memcpy(&data.dst_mac, &entry->next_hop_mac, sizeof(struct ether_addr));
- int ret = rte_table_hash_key8_ext_dosig_ops.f_add(ptask->lookup_table, &key, &data, &key_found, &entry_in_hash);
+ int ret = prox_rte_table_key8_add(ptask->lookup_table, &key, &data, &key_found, &entry_in_hash);
PROX_PANIC(ret, "Error adding entry (%d) to binding lookup table", idx);
PROX_PANIC(key_found, "key_found!!! for idx=%d\n", idx);
@@ -320,7 +325,7 @@ static int handle_ipv6_decap_bulk(struct task_base* tbase, struct rte_mbuf** mbu
// Lookup to verify packets are valid for their respective tunnels (their sending lwB4)
extract_key_decap_bulk(&task->base, mbufs, n_pkts);
- rte_table_hash_key8_ext_dosig_ops.f_lookup(task->base.lookup_table, task->base.fake_packets, pkts_mask, &lookup_hit_mask, (void**)entries);
+ prox_rte_table_key8_lookup(task->base.lookup_table, task->base.fake_packets, pkts_mask, &lookup_hit_mask, (void**)entries);
if (likely(lookup_hit_mask == pkts_mask)) {
for (uint16_t j = 0; j < n_pkts; ++j) {
@@ -353,7 +358,7 @@ static int handle_ipv6_encap_bulk(struct task_base* tbase, struct rte_mbuf** mbu
prefetch_first(mbufs, n_pkts);
extract_key_encap_bulk(&task->base, mbufs, n_pkts);
- rte_table_hash_key8_ext_dosig_ops.f_lookup(task->base.lookup_table, task->base.fake_packets, pkts_mask, &lookup_hit_mask, (void**)entries);
+ prox_rte_table_key8_lookup(task->base.lookup_table, task->base.fake_packets, pkts_mask, &lookup_hit_mask, (void**)entries);
if (likely(lookup_hit_mask == pkts_mask)) {
for (uint16_t j = 0; j < n_pkts; ++j) {
diff --git a/VNFs/DPPD-PROX/handle_lb_net.c b/VNFs/DPPD-PROX/handle_lb_net.c
index 878b815..46a7226 100644
--- a/VNFs/DPPD-PROX/handle_lb_net.c
+++ b/VNFs/DPPD-PROX/handle_lb_net.c
@@ -37,6 +37,7 @@
#include "hash_utils.h"
#include "quit.h"
#include "flow_iter.h"
+#include "prox_compat.h"
#if RTE_VERSION < RTE_VERSION_NUM(1,8,0,0)
#define RTE_CACHE_LINE_SIZE CACHE_LINE_SIZE
@@ -87,18 +88,29 @@ static struct rte_table_hash *setup_gre_to_wt_lookup(struct task_args *targ, uin
}
}
- struct rte_table_hash_ext_params table_hash_params = {
+ static char hash_name[30];
+ sprintf(hash_name, "lb_hash_table_%03d", targ->lconf->id);
+
+ // The key offset in the real packets might depend of the packet type; hence we need to extract the
+ // keys and copy them.
+ // The packets will be parsed runtime and keys will be created and stored in the metadata of fake mbufs.
+ // Then hash functions will be used on the fake mbufs.
+ // Keys are stored in (metadata of) fake mbufs to reduce the memory/cache usage: in this way we use only
+ // 64 cache lines for all keys (we always use the same fake mbufs). If using metadata of real packets/mbufs,
+ // we would use as many cache lines as there are mbufs, which might be very high in if QoS is supported for instance.
+ //
+ struct prox_rte_table_params table_hash_params = {
+ .name = hash_name,
.key_size = 4,
.n_keys = count,
.n_buckets = count,
- .n_buckets_ext = count >> 1,
- .f_hash = hash_crc32,
+ .f_hash = (rte_table_hash_op_hash)hash_crc32,
.seed = 0,
- .signature_offset = HASH_METADATA_OFFSET(0),
.key_offset = HASH_METADATA_OFFSET(0),
+ .key_mask = NULL
};
- ret = rte_table_hash_ext_dosig_ops.f_create(&table_hash_params, socket_id, sizeof(uint8_t));
+ ret = prox_rte_table_create(&table_hash_params, socket_id, sizeof(uint8_t));
for (int i = 0; i < n_workers; ++i) {
struct core_task ct = targ->core_task_set[0].core_task[i];
@@ -113,7 +125,7 @@ static struct rte_table_hash *setup_gre_to_wt_lookup(struct task_args *targ, uin
uint32_t gre_id = it->get_gre_id(it, t);
uint8_t dst = i;
- r = rte_table_hash_ext_dosig_ops.f_add(ret, &gre_id, &dst, &key_found, &entry_in_hash);
+ r = prox_rte_table_add(ret, &gre_id, &dst, &key_found, &entry_in_hash);
if (r) {
plog_err("Failed to add gre_id = %x, dest worker = %u\n", gre_id, i);
}
@@ -274,7 +286,7 @@ static int handle_lb_net_lut_bulk(struct task_base *tbase, struct rte_mbuf **mbu
}
#endif
// keys have been extracted for all packets, now do the lookup
- rte_table_hash_ext_dosig_ops.f_lookup(task->worker_hash_table, task->fake_packets, pkts_mask, &lookup_hit_mask, (void**)wt);
+ prox_rte_table_lookup(task->worker_hash_table, task->fake_packets, pkts_mask, &lookup_hit_mask, (void**)wt);
/* mbufs now contains the packets that have not been dropped */
if (likely(lookup_hit_mask == RTE_LEN2MASK(n_pkts, uint64_t))) {
for (j = 0; j < n_pkts; ++j) {
@@ -398,7 +410,7 @@ static inline int extract_gre_key(struct task_lb_net_lut *task, uint32_t *key, s
}
}
else {
- plog_warn("Invalid protocol: GRE xas expected, got 0x%x\n", ip->next_proto_id);
+ plog_warn("Invalid protocol: GRE was expected, got 0x%x\n", ip->next_proto_id);
return 1;
}
return 0;
diff --git a/VNFs/DPPD-PROX/handle_lb_qinq.c b/VNFs/DPPD-PROX/handle_lb_qinq.c
index d58703c..18ff7df 100644
--- a/VNFs/DPPD-PROX/handle_lb_qinq.c
+++ b/VNFs/DPPD-PROX/handle_lb_qinq.c
@@ -20,6 +20,7 @@
#include <rte_ip.h>
#include <rte_byteorder.h>
#include <rte_version.h>
+#include <rte_hash_crc.h>
#include "prox_malloc.h"
#include "task_base.h"
@@ -279,10 +280,10 @@ static inline uint8_t get_worker(struct task_lb_qinq *task, struct cpe_packet *p
uint64_t qinq_net = packet->qd.qinq;
qinq_net = qinq_net & 0xFF0F0000FF0F0000; // Mask Proto and QoS bits
if (task->bit_mask != 0xff) {
- worker = hash_crc32(&qinq_net,8,0) & task->bit_mask;
+ worker = rte_hash_crc(&qinq_net,8,0) & task->bit_mask;
}
else {
- worker = hash_crc32(&qinq_net,8,0) % task->nb_worker_threads;
+ worker = rte_hash_crc(&qinq_net,8,0) % task->nb_worker_threads;
}
plogx_dbg("Sending packet svlan=%x, cvlan=%x, pseudo_qinq=%lx to worker %d\n", rte_bswap16(0xFF0F & packet->qp.qinq_hdr.svlan.vlan_tci), rte_bswap16(0xFF0F & packet->qp.qinq_hdr.cvlan.vlan_tci), qinq_net, worker);
} else if (((struct task_base *)task)->flags & BASE_FLAG_LUT_QINQ_RSS){
diff --git a/VNFs/DPPD-PROX/handle_master.c b/VNFs/DPPD-PROX/handle_master.c
index 0e039bd..074d7dd 100644
--- a/VNFs/DPPD-PROX/handle_master.c
+++ b/VNFs/DPPD-PROX/handle_master.c
@@ -323,7 +323,7 @@ void init_ctrl_plane(struct task_base *tbase)
static int handle_ctrl_plane_f(struct task_base *tbase, __attribute__((unused)) struct rte_mbuf **mbuf, uint16_t n_pkts)
{
- int ring_id, j, ret = 0;
+ int ring_id = 0, j, ret = 0;
struct rte_mbuf *mbufs[MAX_RING_BURST];
struct task_master *task = (struct task_master *)tbase;
diff --git a/VNFs/DPPD-PROX/handle_qinq_decap4.c b/VNFs/DPPD-PROX/handle_qinq_decap4.c
index f5c8022..c171580 100644
--- a/VNFs/DPPD-PROX/handle_qinq_decap4.c
+++ b/VNFs/DPPD-PROX/handle_qinq_decap4.c
@@ -43,6 +43,7 @@
#include "lconf.h"
#include "prox_cfg.h"
#include "prox_shared.h"
+#include "prox_compat.h"
struct task_qinq_decap4 {
struct task_base base;
@@ -204,8 +205,7 @@ static int add_cpe_entry(struct rte_table_hash *hash, struct cpe_key *key, struc
void* entry_in_hash;
int ret, key_found = 0;
- ret = rte_table_hash_key8_ext_dosig_ops.
- f_add(hash, key, data, &key_found, &entry_in_hash);
+ ret = prox_rte_table_key8_add(hash, key, data, &key_found, &entry_in_hash);
if (unlikely(ret)) {
plogx_err("Failed to add key: ip %x, gre %x\n", key->ip, key->gre_id);
return 1;
@@ -283,8 +283,7 @@ void arp_update_from_msg(struct rte_table_hash * cpe_table, struct arp_msg **msg
for (uint16_t i = 0; i < n_msgs; ++i) {
msgs[i]->data.tsc = rte_rdtsc() + cpe_timeout;
- ret = rte_table_hash_key8_ext_dosig_ops.
- f_add(cpe_table, &msgs[i]->key, &msgs[i]->data, &key_found, &entry_in_hash);
+ ret = prox_rte_table_key8_add(cpe_table, &msgs[i]->key, &msgs[i]->data, &key_found, &entry_in_hash);
if (unlikely(ret)) {
plogx_err("Failed to add key %x, gre %x\n", msgs[i]->key.ip, msgs[i]->key.gre_id);
}
@@ -309,7 +308,7 @@ static void arp_update(struct task_base *tbase, struct rte_mbuf **mbufs, uint16_
uint64_t pkts_mask = RTE_LEN2MASK(n_pkts, uint64_t);
uint64_t lookup_hit_mask = 0;
struct qinq_gre_data* entries[64];
- rte_table_hash_key8_ext_dosig_ops.f_lookup(task->qinq_gre_table, task->fake_packets, pkts_mask, &lookup_hit_mask, (void**)entries);
+ prox_rte_table_key8_lookup(task->qinq_gre_table, task->fake_packets, pkts_mask, &lookup_hit_mask, (void**)entries);
TASK_STATS_ADD_RX(&task->base.aux->stats, n_pkts);
for (uint16_t j = 0; j < n_pkts; ++j) {
@@ -327,8 +326,7 @@ static void arp_update(struct task_base *tbase, struct rte_mbuf **mbufs, uint16_
void* entry_in_hash;
int ret, key_found = 0;
- ret = rte_table_hash_key8_ext_dosig_ops.
- f_add(task->cpe_table, &key, &data, &key_found, &entry_in_hash);
+ ret = prox_rte_table_key8_add(task->cpe_table, &key, &data, &key_found, &entry_in_hash);
if (unlikely(ret)) {
plogx_err("Failed to add key %x, gre %x\n", key.ip, key.gre_id);
@@ -356,7 +354,7 @@ static int handle_qinq_decap4_bulk(struct task_base *tbase, struct rte_mbuf **mb
}
extract_key_bulk(mbufs, n_pkts, task);
- rte_table_hash_key8_ext_dosig_ops.f_lookup(task->qinq_gre_table, task->fake_packets, pkts_mask, &lookup_hit_mask, (void**)entries);
+ prox_rte_table_key8_lookup(task->qinq_gre_table, task->fake_packets, pkts_mask, &lookup_hit_mask, (void**)entries);
if (likely(lookup_hit_mask == pkts_mask)) {
for (uint16_t j = 0; j < n_pkts; ++j) {
diff --git a/VNFs/DPPD-PROX/handle_qinq_decap6.c b/VNFs/DPPD-PROX/handle_qinq_decap6.c
index d876c73..77bacb7 100644
--- a/VNFs/DPPD-PROX/handle_qinq_decap6.c
+++ b/VNFs/DPPD-PROX/handle_qinq_decap6.c
@@ -37,6 +37,7 @@
#include "log.h"
#include "quit.h"
#include "prox_shared.h"
+#include "prox_compat.h"
/* Packets must all be IPv6, always store QinQ tags for lookup (not configurable) */
struct task_qinq_decap6 {
@@ -116,8 +117,7 @@ static inline uint8_t handle_qinq_decap6(struct task_qinq_decap6 *task, struct r
int key_found = 0;
void* entry_in_hash = NULL;
- int ret = rte_table_hash_ext_dosig_ops.
- f_add(task->cpe_table, pip6->src_addr, &entry, &key_found, &entry_in_hash);
+ int ret = prox_rte_table_add(task->cpe_table, pip6->src_addr, &entry, &key_found, &entry_in_hash);
if (unlikely(ret)) {
plogx_err("Failed to add key " IPv6_BYTES_FMT "\n", IPv6_BYTES(pip6->src_addr));
@@ -170,7 +170,7 @@ void update_arp_entries6(void* data)
if (entries[i]->tsc < cur_tsc) {
int key_found = 0;
void* entry = 0;
- rte_table_hash_ext_dosig_ops.f_delete(task->cpe_table, key[i], &key_found, entry);
+ prox_rte_table_delete(task->cpe_table, key[i], &key_found, entry);
}
}
diff --git a/VNFs/DPPD-PROX/handle_qinq_encap4.c b/VNFs/DPPD-PROX/handle_qinq_encap4.c
index 2418195..0b31660 100644
--- a/VNFs/DPPD-PROX/handle_qinq_encap4.c
+++ b/VNFs/DPPD-PROX/handle_qinq_encap4.c
@@ -15,6 +15,7 @@
*/
#include <rte_table_hash.h>
+#include <rte_hash_crc.h>
#include <rte_cycles.h>
#include "mbuf_utils.h"
@@ -40,6 +41,7 @@
#include "cfgfile.h"
#include "toeplitz.h"
#include "prox_shared.h"
+#include "prox_compat.h"
static struct cpe_table_data *read_cpe_table_config(const char *name, uint8_t socket)
{
@@ -106,7 +108,7 @@ static void fill_table(struct task_args *targ, struct rte_table_hash *table)
int key_found;
void* entry_in_hash;
- rte_table_hash_key8_ext_dosig_ops.f_add(table, &key, &data, &key_found, &entry_in_hash);
+ prox_rte_table_key8_add(table, &key, &data, &key_found, &entry_in_hash);
}
}
@@ -186,7 +188,7 @@ static inline void add_key(struct task_args *targ, struct qinq_gre_map *qinq_gre
int key_found = 0;
void* entry_in_hash = NULL;
- rte_table_hash_key8_ext_dosig_ops.f_add(qinq_gre_table, &qinq2, &entry, &key_found, &entry_in_hash);
+ prox_rte_table_key8_add(qinq_gre_table, &qinq2, &entry, &key_found, &entry_in_hash);
plog_dbg("Core %u adding user %u (tag %x svlan %x cvlan %x), rss=%x\n",
targ->lconf->id, qinq_gre_map->entries[i].user, qinq2.svlan.eth_proto,
@@ -199,7 +201,7 @@ static inline void add_key(struct task_args *targ, struct qinq_gre_map *qinq_gre
rte_bswap16(qinq_gre_map->entries[i].cvlan);
int key_found = 0;
void* entry_in_hash = NULL;
- rte_table_hash_key8_ext_dosig_ops.f_add(qinq_gre_table, &ip, &entry, &key_found, &entry_in_hash);
+ prox_rte_table_key8_add(qinq_gre_table, &ip, &entry, &key_found, &entry_in_hash);
plog_dbg("Core %u hash table add: key = %016"PRIx64"\n",
targ->lconf->id, ip);
@@ -219,18 +221,21 @@ void init_qinq_gre_table(struct task_args *targ, struct qinq_gre_map *qinq_gre_m
table_part = 1;
uint32_t n_entries = MAX_GRE / table_part;
-
- struct rte_table_hash_key8_ext_params table_hash_params = {
- .n_entries = n_entries,
- .n_entries_ext = n_entries >> 1,
- .f_hash = hash_crc32,
+ static char hash_name[30];
+ sprintf(hash_name, "qinq_gre_hash_table_%03d", targ->lconf->id);
+
+ struct prox_rte_table_params table_hash_params = {
+ .name = hash_name,
+ .key_size = 8,
+ .n_keys = n_entries,
+ .n_buckets = n_entries,
+ .f_hash = (rte_table_hash_op_hash)hash_crc32,
.seed = 0,
- .signature_offset = HASH_METADATA_OFFSET(8),
.key_offset = HASH_METADATA_OFFSET(0),
+ .key_mask = NULL
};
- qinq_gre_table = rte_table_hash_key8_ext_dosig_ops.
- f_create(&table_hash_params, rte_lcore_to_socket_id(targ->lconf->id), sizeof(struct qinq_gre_data));
+ qinq_gre_table = prox_rte_table_create(&table_hash_params, rte_lcore_to_socket_id(targ->lconf->id), sizeof(struct qinq_gre_data));
// LB configuration known from Network Load Balancer
// Find LB network Load balancer, i.e. ENCAP friend.
@@ -288,7 +293,7 @@ void init_qinq_gre_table(struct task_args *targ, struct qinq_gre_map *qinq_gre_m
uint64_t cvlan = rte_bswap16(qinq_gre_map->entries[i].cvlan & 0xFF0F);
uint64_t svlan = rte_bswap16((qinq_gre_map->entries[i].svlan & 0xFF0F));
uint64_t qinq = rte_bswap64((svlan << 32) | cvlan);
- uint8_t queue = hash_crc32(&qinq, 8, 0) % targ->nb_slave_threads;
+ uint8_t queue = rte_hash_crc(&qinq, 8, 0) % targ->nb_slave_threads;
if (queue == targ->worker_thread_id) {
add_key(targ, qinq_gre_map, qinq_gre_table, i, &count);
}
@@ -325,21 +330,26 @@ void init_cpe4_table(struct task_args *targ)
table_part = 1;
uint32_t n_entries = MAX_GRE / table_part;
- struct rte_table_hash_key8_ext_params table_hash_params = {
- .n_entries = n_entries,
- .n_entries_ext = n_entries >> 1,
- .f_hash = hash_crc32,
+
+ static char hash_name[30];
+ sprintf(hash_name, "cpe4_table_%03d", targ->lconf->id);
+
+ struct prox_rte_table_params table_hash_params = {
+ .name = hash_name,
+ .key_size = 8,
+ .n_keys = n_entries,
+ .n_buckets = n_entries >> 1,
+ .f_hash = (rte_table_hash_op_hash)hash_crc32,
.seed = 0,
- .signature_offset = HASH_METADATA_OFFSET(8),
.key_offset = HASH_METADATA_OFFSET(0),
+ .key_mask = NULL
};
size_t entry_size = sizeof(struct cpe_data);
if (!rte_is_power_of_2(entry_size)) {
entry_size = rte_align32pow2(entry_size);
}
- struct rte_table_hash* phash = rte_table_hash_key8_ext_dosig_ops.
- f_create(&table_hash_params, rte_lcore_to_socket_id(targ->lconf->id), entry_size);
+ struct rte_table_hash* phash = prox_rte_table_create(&table_hash_params, rte_lcore_to_socket_id(targ->lconf->id), entry_size);
PROX_PANIC(NULL == phash, "Unable to allocate memory for IPv4 hash table on core %u\n", targ->lconf->id);
/* for locality, copy the pointer to the port structure where it is needed at packet handling time */
@@ -433,7 +443,7 @@ static int handle_qinq_encap4_bulk_pe(struct task_base *tbase, struct rte_mbuf *
struct ipv4_hdr* ip = (struct ipv4_hdr *)(rte_pktmbuf_mtod(mbufs[j], struct ether_hdr *) + 1);
task->keys[j] = (uint64_t)ip->dst_addr;
}
- rte_table_hash_key8_ext_dosig_ops.f_lookup(task->cpe_table, task->fake_packets, pkts_mask, &lookup_hit_mask, (void**)entries);
+ prox_rte_table_key8_lookup(task->cpe_table, task->fake_packets, pkts_mask, &lookup_hit_mask, (void**)entries);
if (likely(lookup_hit_mask == pkts_mask)) {
for (uint16_t j = 0; j < n_pkts; ++j) {
@@ -477,7 +487,7 @@ int handle_qinq_encap4_bulk(struct task_base *tbase, struct rte_mbuf **mbufs, ui
// From GRE ID and IP address, retrieve QinQ and MAC addresses
extract_key_bulk(task, mbufs, n_pkts);
- rte_table_hash_key8_ext_dosig_ops.f_lookup(task->cpe_table, task->fake_packets, pkts_mask, &lookup_hit_mask, (void**)entries);
+ prox_rte_table_key8_lookup(task->cpe_table, task->fake_packets, pkts_mask, &lookup_hit_mask, (void**)entries);
if (likely(lookup_hit_mask == pkts_mask)) {
for (uint16_t j = 0; j < n_pkts; ++j) {
@@ -570,7 +580,7 @@ static void flow_iter_next(struct flow_iter *iter, struct task_args *targ)
uint64_t cvlan = rte_bswap16(get_qinq_gre_map(targ)->entries[iter->idx].cvlan & 0xFF0F);
uint64_t svlan = rte_bswap16(get_qinq_gre_map(targ)->entries[iter->idx].svlan & 0xFF0F);
uint64_t qinq = rte_bswap64((svlan << 32) | cvlan);
- uint8_t queue = hash_crc32(&qinq, 8, 0) % targ->nb_slave_threads;
+ uint8_t queue = rte_hash_crc(&qinq, 8, 0) % targ->nb_slave_threads;
if (queue == targ->worker_thread_id)
break;
} else if (flag_features & TASK_FEATURE_GRE_ID) {
diff --git a/VNFs/DPPD-PROX/handle_qinq_encap6.c b/VNFs/DPPD-PROX/handle_qinq_encap6.c
index e5b774d..a46f30f 100644
--- a/VNFs/DPPD-PROX/handle_qinq_encap6.c
+++ b/VNFs/DPPD-PROX/handle_qinq_encap6.c
@@ -29,6 +29,7 @@
#include "mpls.h"
#include "hash_utils.h"
#include "quit.h"
+#include "prox_compat.h"
struct task_qinq_encap6 {
struct task_base base;
@@ -67,7 +68,7 @@ static inline uint8_t handle_qinq_encap6(struct rte_mbuf *mbuf, struct task_qinq
uint64_t pkts_mask = RTE_LEN2MASK(1, uint64_t);
uint64_t lookup_hit_mask;
struct cpe_data* entries[64]; // TODO: use bulk size
- rte_table_hash_ext_dosig_ops.f_lookup(task->cpe_table, &mbuf, pkts_mask, &lookup_hit_mask, (void**)entries);
+ prox_rte_table_lookup(task->cpe_table, &mbuf, pkts_mask, &lookup_hit_mask, (void**)entries);
if (lookup_hit_mask == 0x1) {
/* will also overwrite part of the destination addr */
@@ -101,15 +102,17 @@ void init_cpe6_table(struct task_args *targ)
}
uint32_t n_entries = MAX_GRE / table_part;
- struct rte_table_hash_ext_params table_hash_params = {
+ static char hash_name[30];
+ sprintf(hash_name, "cpe6_table_%03d", targ->lconf->id);
+ struct prox_rte_table_params table_hash_params = {
+ .name = hash_name,
.key_size = sizeof(struct ipv6_addr),
.n_keys = n_entries,
.n_buckets = n_entries >> 2,
- .n_buckets_ext = n_entries >> 3,
- .f_hash = hash_crc32,
+ .f_hash = (rte_table_hash_op_hash)hash_crc32,
.seed = 0,
- .signature_offset = HASH_METADATA_OFFSET(0),
.key_offset = HASH_METADATA_OFFSET(0),
+ .key_mask = NULL
};
size_t entry_size = sizeof(struct cpe_data);
@@ -117,8 +120,7 @@ void init_cpe6_table(struct task_args *targ)
entry_size = rte_align32pow2(entry_size);
}
- struct rte_table_hash* phash = rte_table_hash_ext_dosig_ops.
- f_create(&table_hash_params, rte_lcore_to_socket_id(targ->lconf->id), entry_size);
+ struct rte_table_hash* phash = prox_rte_table_create(&table_hash_params, rte_lcore_to_socket_id(targ->lconf->id), entry_size);
PROX_PANIC(phash == NULL, "Unable to allocate memory for IPv6 hash table on core %u\n", targ->lconf->id);
for (uint8_t task_id = 0; task_id < targ->lconf->n_tasks_all; ++task_id) {
diff --git a/VNFs/DPPD-PROX/hash_utils.c b/VNFs/DPPD-PROX/hash_utils.c
index 4ebab94..ad746d5 100644
--- a/VNFs/DPPD-PROX/hash_utils.c
+++ b/VNFs/DPPD-PROX/hash_utils.c
@@ -42,11 +42,15 @@ struct rte_table_hash_key8 {
#endif
/* Input parameters */
uint32_t n_buckets;
+#if RTE_VERSION < RTE_VERSION_NUM(17,11,0,0)
uint32_t n_entries_per_bucket;
+#endif
uint32_t key_size;
uint32_t entry_size;
uint32_t bucket_size;
+#if RTE_VERSION < RTE_VERSION_NUM(17,11,0,0)
uint32_t signature_offset;
+#endif
uint32_t key_offset;
#if RTE_VERSION >= RTE_VERSION_NUM(2,2,0,0)
uint64_t key_mask;
@@ -178,7 +182,7 @@ uint64_t get_bucket_key8(void* table, uint32_t bucket_idx, void** key, void** en
return f->n_buckets;
}
-uint64_t hash_crc32(void* key, uint32_t key_size, uint64_t seed)
+uint64_t hash_crc32(void* key, __attribute__((unused))void *key_mask, uint32_t key_size, uint64_t seed)
{
return rte_hash_crc(key, key_size, seed);
}
diff --git a/VNFs/DPPD-PROX/hash_utils.h b/VNFs/DPPD-PROX/hash_utils.h
index a2536ff..9a09391 100644
--- a/VNFs/DPPD-PROX/hash_utils.h
+++ b/VNFs/DPPD-PROX/hash_utils.h
@@ -32,7 +32,7 @@ struct rte_table_hash;
#endif
/* Wrap crc32 hash function to match that required for rte_table */
-uint64_t hash_crc32(void* key, uint32_t key_size, uint64_t seed);
+uint64_t hash_crc32(void* key, void *key_mask, uint32_t key_size, uint64_t seed);
void print_hash_table_size(const struct rte_table_hash *h);
void print_hash_table(const struct rte_table_hash *h);
diff --git a/VNFs/DPPD-PROX/prox_args.c b/VNFs/DPPD-PROX/prox_args.c
index e6d2f83..fb05380 100644
--- a/VNFs/DPPD-PROX/prox_args.c
+++ b/VNFs/DPPD-PROX/prox_args.c
@@ -35,6 +35,7 @@
#include "defaults.h"
#include "prox_lua.h"
#include "cqm.h"
+#include "prox_compat.h"
#define MAX_RTE_ARGV 64
#define MAX_ARG_LEN 64
@@ -1955,7 +1956,7 @@ int prox_setup_rte(const char *prog_name)
}
if (rte_cfg.no_output) {
- rte_set_log_level(0);
+ rte_log_set_global_level(0);
}
/* init EAL */
plog_info("\tEAL command line:");
diff --git a/VNFs/DPPD-PROX/prox_compat.h b/VNFs/DPPD-PROX/prox_compat.h
new file mode 100644
index 0000000..ee61ee4
--- /dev/null
+++ b/VNFs/DPPD-PROX/prox_compat.h
@@ -0,0 +1,119 @@
+/*
+// Copyright (c) 2010-2017 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+*/
+#include <rte_common.h>
+#include <rte_table_hash.h>
+#include <rte_hash_crc.h>
+#include "hash_utils.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 *
+ * to PROX code should mainly be limited to this file *
+ */
+struct prox_rte_table_params {
+ const char *name;
+ uint32_t key_size;
+ uint32_t key_offset;
+ uint8_t *key_mask;
+ uint32_t n_keys;
+ uint32_t n_buckets;
+ rte_table_hash_op_hash f_hash;
+ uint64_t seed;
+};
+
+#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)
+{
+ if (params->key_size == 8) {
+ struct rte_table_hash_key8_ext_params dpdk17_08_params;
+ dpdk17_08_params.n_entries = params->n_keys;
+ dpdk17_08_params.n_entries_ext = params->n_keys >> 2;
+ dpdk17_08_params.f_hash = (rte_table_hash_op_hash)rte_hash_crc;
+ dpdk17_08_params.seed = params->seed;
+ dpdk17_08_params.signature_offset = HASH_METADATA_OFFSET(8); // Ignored for dosig
+ dpdk17_08_params.key_offset = HASH_METADATA_OFFSET(0);
+ dpdk17_08_params.key_mask = params->key_mask;
+ return rte_table_hash_key8_ext_dosig_ops.f_create(&dpdk17_08_params, socket_id, entry_size);
+ } else {
+ struct rte_table_hash_ext_params dpdk17_08_params;
+ dpdk17_08_params.key_size = params->key_size;
+ dpdk17_08_params.n_keys = params->n_keys;
+ dpdk17_08_params.n_buckets = params->n_buckets;
+ dpdk17_08_params.n_buckets_ext = params->n_buckets >> 1;
+ dpdk17_08_params.seed = params->seed;
+ dpdk17_08_params.f_hash = (rte_table_hash_op_hash)rte_hash_crc;
+ dpdk17_08_params.signature_offset = HASH_METADATA_OFFSET(0);
+ dpdk17_08_params.key_offset = HASH_METADATA_OFFSET(0);
+ return rte_table_hash_ext_dosig_ops.f_create(&dpdk17_08_params, socket_id, entry_size);
+ }
+};
+
+#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
+#define prox_rte_table_add_bulk rte_table_hash_ext_dosig_ops.f_add_bulk
+#define prox_rte_table_delete_bulk rte_table_hash_ext_dosig_ops.f_delete_bulk
+#define prox_rte_table_lookup rte_table_hash_ext_dosig_ops.f_lookup
+#define prox_rte_table_stats rte_table_hash_ext_dosig_ops.f_stats
+
+#define prox_rte_table_key8_free rte_table_hash_key8_ext_dosig_ops.f_free
+#define prox_rte_table_key8_add rte_table_hash_key8_ext_dosig_ops.f_add
+#define prox_rte_table_key8_delete rte_table_hash_key8_ext_dosig_ops.f_delete
+#define prox_rte_table_key8_add_bulk rte_table_hash_key8_ext_dosig_ops.f_add_bulk
+#define prox_rte_table_key8_delete_bulk rte_table_hash_key8_ext_dosig_ops.f_delete_bulk
+#define prox_rte_table_key8_lookup rte_table_hash_key8_ext_dosig_ops.f_lookup
+#define prox_rte_table_key8_stats rte_table_hash_key8_ext_dosig_ops.f_stats
+
+#define rte_log_set_global_level rte_set_log_level
+
+#else
+
+static void *prox_rte_table_create(struct prox_rte_table_params *params, int socket_id, uint32_t entry_size)
+{
+ struct rte_table_hash_params dpdk_17_11_params;
+ dpdk_17_11_params.name = params->name;
+ dpdk_17_11_params.key_size = params->key_size;
+ dpdk_17_11_params.key_offset = params->key_offset;
+ dpdk_17_11_params.key_mask = params->key_mask;
+ dpdk_17_11_params.n_keys = params->n_keys;
+ dpdk_17_11_params.n_buckets = rte_align32pow2(params->n_buckets);
+ dpdk_17_11_params.f_hash = params->f_hash;
+ dpdk_17_11_params.seed = params->seed;
+
+ if (params->key_size == 8) {
+ return rte_table_hash_key8_ext_ops.f_create(&dpdk_17_11_params, socket_id, entry_size);
+ } else {
+ return rte_table_hash_ext_ops.f_create(&dpdk_17_11_params, socket_id, entry_size);
+ }
+}
+
+#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
+#define prox_rte_table_add_bulk rte_table_hash_ext_ops.f_add_bulk
+#define prox_rte_table_delete_bulk rte_table_hash_ext_ops.f_delete_bulk
+#define prox_rte_table_lookup rte_table_hash_ext_ops.f_lookup
+#define prox_rte_table_stats rte_table_hash_ext_ops.f_stats
+
+#define prox_rte_table_key8_free rte_table_hash_key8_ext_ops.f_free
+#define prox_rte_table_key8_add rte_table_hash_key8_ext_ops.f_add
+#define prox_rte_table_key8_delete rte_table_hash_key8_ext_ops.f_delete
+#define prox_rte_table_key8_add_bulk rte_table_hash_key8_ext_ops.f_add_bulk
+#define prox_rte_table_key8_delete_bulk rte_table_hash_key8_ext_ops.f_delete_bulk
+#define prox_rte_table_key8_lookup rte_table_hash_key8_ext_ops.f_lookup
+#define prox_rte_table_key8_stats rte_table_hash_key8_ext_ops.f_stats
+
+#endif
diff --git a/VNFs/DPPD-PROX/prox_port_cfg.c b/VNFs/DPPD-PROX/prox_port_cfg.c
index d9ce82d..bf8dbda 100644
--- a/VNFs/DPPD-PROX/prox_port_cfg.c
+++ b/VNFs/DPPD-PROX/prox_port_cfg.c
@@ -19,9 +19,17 @@
#include <rte_version.h>
#include <rte_eth_ring.h>
#include <rte_mbuf.h>
-#if (RTE_VERSION >= RTE_VERSION_NUM(2,1,0,0)) && (RTE_VERSION <= RTE_VERSION_NUM(17,5,0,1))
+#if (RTE_VERSION >= RTE_VERSION_NUM(17,11,0,0))
+#include <rte_bus_vdev.h>
+#else
+#if (RTE_VERSION > RTE_VERSION_NUM(17,5,0,2))
+#include <rte_dev.h>
+#else
+#if (RTE_VERSION >= RTE_VERSION_NUM(2,1,0,0))
#include <rte_eth_null.h>
#endif
+#endif
+#endif
#include "prox_port_cfg.h"
#include "prox_globals.h"
@@ -55,12 +63,17 @@ int prox_last_port_active(void)
return ret;
}
+#if RTE_VERSION >= RTE_VERSION_NUM(17,11,0,0)
+static int lsc_cb(__attribute__((unused)) uint16_t port_id, enum rte_eth_event_type type, __attribute__((unused)) void *param,
+ __attribute__((unused)) void *ret_param)
+#else
#if RTE_VERSION >= RTE_VERSION_NUM(17,8,0,1)
static int lsc_cb(__attribute__((unused)) uint8_t port_id, enum rte_eth_event_type type, __attribute__((unused)) void *param,
__attribute__((unused)) void *ret_param)
#else
static void lsc_cb(__attribute__((unused)) uint8_t port_id, enum rte_eth_event_type type, __attribute__((unused)) void *param)
#endif
+#endif
{
if (RTE_ETH_EVENT_INTR_LSC != type) {
#if RTE_VERSION >= RTE_VERSION_NUM(17,8,0,1)
@@ -120,13 +133,17 @@ void init_rte_dev(int use_dummy_devices)
PROX_PANIC(use_dummy_devices && nb_ports, "Can't use dummy devices while there are also real ports\n");
if (use_dummy_devices) {
-#if (RTE_VERSION >= RTE_VERSION_NUM(2,1,0,0)) && (RTE_VERSION <= RTE_VERSION_NUM(17,5,0,1))
+#if (RTE_VERSION >= RTE_VERSION_NUM(2,1,0,0))
nb_ports = prox_last_port_active() + 1;
plog_info("Creating %u dummy devices\n", nb_ports);
char port_name[32] = "0dummy_dev";
for (uint32_t i = 0; i < nb_ports; ++i) {
+#if (RTE_VERSION > RTE_VERSION_NUM(17,5,0,1))
+ rte_vdev_init(port_name, "size=ETHER_MIN_LEN,copy=0");
+#else
eth_dev_null_create(port_name, 0, ETHER_MIN_LEN, 0);
+#endif
port_name[0]++;
}
#else
diff --git a/VNFs/DPPD-PROX/prox_port_cfg.h b/VNFs/DPPD-PROX/prox_port_cfg.h
index 370b045..455e2b2 100644
--- a/VNFs/DPPD-PROX/prox_port_cfg.h
+++ b/VNFs/DPPD-PROX/prox_port_cfg.h
@@ -20,6 +20,11 @@
#include <rte_pci.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
+#include <rte_version.h>
+#if RTE_VERSION >= RTE_VERSION_NUM(17,11,0,0)
+#include <rte_bus_pci.h>
+#endif
+#include <rte_pci.h>
#include "prox_globals.h"