summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX
diff options
context:
space:
mode:
authorDeepak S <deepak.s@linux.intel.com>2018-07-27 16:13:49 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-07-27 16:13:49 +0000
commit974e4b3123b7d926d548d8924b41e8b732e2732f (patch)
treeb3cb268bc4b95d1a617710d3e0346234bcf1dcd1 /VNFs/DPPD-PROX
parent2e924e65c5ac509925bc5a28b724db108fe99111 (diff)
parent3e532aca841cbd004515930496495bea50e9b52a (diff)
Merge "Initial support for DPDK 18.05"
Diffstat (limited to 'VNFs/DPPD-PROX')
-rw-r--r--VNFs/DPPD-PROX/commands.c5
-rw-r--r--VNFs/DPPD-PROX/handle_nsh.c4
-rw-r--r--VNFs/DPPD-PROX/handle_police.c21
-rw-r--r--VNFs/DPPD-PROX/prox_port_cfg.c13
-rw-r--r--VNFs/DPPD-PROX/vxlangpe_nsh.h7
5 files changed, 42 insertions, 8 deletions
diff --git a/VNFs/DPPD-PROX/commands.c b/VNFs/DPPD-PROX/commands.c
index 9f0be145..6c715c25 100644
--- a/VNFs/DPPD-PROX/commands.c
+++ b/VNFs/DPPD-PROX/commands.c
@@ -261,6 +261,7 @@ void cmd_mem_stats(void)
void cmd_mem_layout(void)
{
+#if RTE_VERSION < RTE_VERSION_NUM(18,5,0,0)
const struct rte_memseg* memseg = rte_eal_get_physmem_layout();
plog_info("Memory layout:\n");
@@ -287,6 +288,10 @@ void cmd_mem_layout(void)
memseg[i].addr,
memseg[i].len/memseg[i].hugepage_sz, sz_str);
}
+#else
+ plog_info("Memory layout: command not supported in this DPDK version\n");
+ // TODO DPDK1805
+#endif
}
void cmd_dump(uint8_t lcore_id, uint8_t task_id, uint32_t nb_packets, struct input *input, int rx, int tx)
diff --git a/VNFs/DPPD-PROX/handle_nsh.c b/VNFs/DPPD-PROX/handle_nsh.c
index 65a80c3d..dbd0e655 100644
--- a/VNFs/DPPD-PROX/handle_nsh.c
+++ b/VNFs/DPPD-PROX/handle_nsh.c
@@ -82,7 +82,7 @@ static inline uint8_t handle_decap_nsh(__attribute__((unused)) struct task_decap
/* check the Next Protocol field in VxLAN-GPE header */
vxlan_gpe_hdr = (struct vxlan_gpe_hdr *)(((unsigned char *)eth_hdr) + sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr) + sizeof(struct udp_hdr));
- if (vxlan_gpe_hdr->next_proto != VXLAN_GPE_NP) {
+ if (vxlan_gpe_hdr->proto != VXLAN_GPE_NP) {
mbuf->udata64 = 0;
return 0;
}
@@ -168,7 +168,7 @@ static inline uint8_t handle_encap_nsh(__attribute__((unused)) struct task_encap
/* check the Next Protocol field in VxLAN-GPE header */
vxlan_gpe_hdr = (struct vxlan_gpe_hdr *)(((unsigned char *)eth_hdr) + sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr) + sizeof(struct udp_hdr));
- if (vxlan_gpe_hdr->next_proto != VXLAN_GPE_NP)
+ if (vxlan_gpe_hdr->proto != VXLAN_GPE_NP)
return 0;
/* decrement Service Index in NSH header */
diff --git a/VNFs/DPPD-PROX/handle_police.c b/VNFs/DPPD-PROX/handle_police.c
index 125e8c0a..564cf4b5 100644
--- a/VNFs/DPPD-PROX/handle_police.c
+++ b/VNFs/DPPD-PROX/handle_police.c
@@ -58,8 +58,11 @@ static uint8_t handle_police(struct task_police *task, struct rte_mbuf *mbuf, ui
enum rte_meter_color in_color = e_RTE_METER_GREEN;
enum rte_meter_color out_color;
uint32_t pkt_len = rte_pktmbuf_pkt_len(mbuf) + task->overhead;
+#if RTE_VERSION < RTE_VERSION_NUM(18,5,0,0)
out_color = rte_meter_srtcm_color_aware_check(&task->sr_flows[user], tsc, pkt_len, in_color);
-
+#else
+ out_color = 0; // TODO DPDK1805
+#endif
return task->police_act[in_color][out_color] == ACT_DROP? OUT_DISCARD : 0;
}
@@ -68,7 +71,11 @@ static uint8_t handle_police_tr(struct task_police *task, struct rte_mbuf *mbuf,
enum rte_meter_color in_color = e_RTE_METER_GREEN;
enum rte_meter_color out_color;
uint32_t pkt_len = rte_pktmbuf_pkt_len(mbuf) + task->overhead;
+#if RTE_VERSION < RTE_VERSION_NUM(18,5,0,0)
out_color = rte_meter_trtcm_color_aware_check(&task->tr_flows[user], tsc, pkt_len, in_color);
+#else
+ out_color = 0;// TODO DPDK1805
+#endif
if (task->runtime_flags & TASK_MARK) {
#if RTE_VERSION >= RTE_VERSION_NUM(1,8,0,0)
@@ -191,6 +198,10 @@ static void init_task_police(struct task_base *tbase, struct task_args *targ)
struct task_police *task = (struct task_police *)tbase;
const int socket_id = rte_lcore_to_socket_id(targ->lconf->id);
+#if RTE_VERSION >= RTE_VERSION_NUM(18,5,0,0)
+ plog_warn("mode police might not be supported in this prox/dpdk version\n"); // TODO DPDK1805
+#endif
+
task->overhead = targ->overhead;
task->runtime_flags = targ->runtime_flags;
@@ -216,7 +227,11 @@ static void init_task_police(struct task_base *tbase, struct task_args *targ)
};
for (uint32_t i = 0; i < targ->n_flows; ++i) {
+#if RTE_VERSION < RTE_VERSION_NUM(18,5,0,0)
rte_meter_srtcm_config(&task->sr_flows[i], &params);
+#else
+ // TODO DPDK1805
+#endif
}
}
else {
@@ -235,7 +250,11 @@ static void init_task_police(struct task_base *tbase, struct task_args *targ)
};
for (uint32_t i = 0; i < targ->n_flows; ++i) {
+#if RTE_VERSION < RTE_VERSION_NUM(18,5,0,0)
rte_meter_trtcm_config(&task->tr_flows[i], &params);
+#else
+ // TODO DPDK1805
+#endif
}
}
diff --git a/VNFs/DPPD-PROX/prox_port_cfg.c b/VNFs/DPPD-PROX/prox_port_cfg.c
index cea69a37..d080f5a2 100644
--- a/VNFs/DPPD-PROX/prox_port_cfg.c
+++ b/VNFs/DPPD-PROX/prox_port_cfg.c
@@ -129,6 +129,7 @@ void init_rte_dev(int use_dummy_devices)
uint8_t nb_ports, port_id_max;
int port_id_last;
struct rte_eth_dev_info dev_info;
+ const struct rte_pci_device *pci_dev;
nb_ports = rte_eth_dev_count();
/* get available ports configuration */
@@ -185,13 +186,18 @@ void init_rte_dev(int use_dummy_devices)
port_cfg->max_rx_pkt_len = dev_info.max_rx_pktlen;
port_cfg->min_rx_bufsize = dev_info.min_rx_bufsize;
- if (!dev_info.pci_dev)
+#if RTE_VERSION < RTE_VERSION_NUM(18,5,0,0)
+ pci_dev = dev_info.pci_dev;
+#else
+ pci_dev = RTE_DEV_TO_PCI(dev_info.device);
+#endif
+ if (!pci_dev)
continue;
snprintf(port_cfg->pci_addr, sizeof(port_cfg->pci_addr),
- "%04x:%02x:%02x.%1x", dev_info.pci_dev->addr.domain, dev_info.pci_dev->addr.bus, dev_info.pci_dev->addr.devid, dev_info.pci_dev->addr.function);
+ "%04x:%02x:%02x.%1x", pci_dev->addr.domain, pci_dev->addr.bus, pci_dev->addr.devid, pci_dev->addr.function);
strncpy(port_cfg->driver_name, dev_info.driver_name, sizeof(port_cfg->driver_name));
- plog_info("\tPort %u : driver='%s' tx_queues=%d rx_queues=%d, max_rx_pktlen = %d, min_rx_bufsize = %d\n", port_id, !strcmp(port_cfg->driver_name, "")? "null" : port_cfg->driver_name, port_cfg->max_txq, port_cfg->max_rxq, port_cfg->max_rx_pkt_len, port_cfg->min_rx_bufsize);
+ plog_info("\tPort %u : driver='%s' tx_queues=%d rx_queues=%d\n", port_id, !strcmp(port_cfg->driver_name, "")? "null" : port_cfg->driver_name, port_cfg->max_txq, port_cfg->max_rxq);
if (strncmp(port_cfg->driver_name, "rte_", 4) == 0) {
strncpy(port_cfg->short_name, prox_port_cfg[port_id].driver_name + 4, sizeof(port_cfg->short_name));
@@ -321,6 +327,7 @@ static void init_port(struct prox_port_cfg *port_cfg)
port_cfg->port_conf.rx_adv_conf.rss_conf.rss_hf = ETH_RSS_IPV4|ETH_RSS_NONF_IPV4_UDP;
#endif
}
+
if (port_cfg->tx_conf.txq_flags & ETH_TXQ_FLAGS_NOREFCOUNT)
plog_info("\t\tEnabling No refcnt on port %d\n", port_id);
else
diff --git a/VNFs/DPPD-PROX/vxlangpe_nsh.h b/VNFs/DPPD-PROX/vxlangpe_nsh.h
index 2e7cfc76..5f83650c 100644
--- a/VNFs/DPPD-PROX/vxlangpe_nsh.h
+++ b/VNFs/DPPD-PROX/vxlangpe_nsh.h
@@ -17,6 +17,8 @@
#ifndef _VXLANGPE_NSH_H_
#define _VXLANGPE_NSH_H_
+#include <rte_version.h>
+
struct nsh_hdr {
uint16_t version :2;
uint16_t oa_flag :1;
@@ -33,12 +35,13 @@ struct nsh_hdr {
uint32_t ctx_4;
} __attribute__((__packed__));
+#if RTE_VERSION < RTE_VERSION_NUM(18,5,0,0)
struct vxlan_gpe_hdr {
uint8_t flag_0;
uint8_t flag_1;
uint8_t reserved;
- uint8_t next_proto;
+ uint8_t proto;
uint32_t vni_res;
} __attribute__((__packed__));
-
+#endif
#endif /* _VXLANGPE_NSH_H_ */