summaryrefslogtreecommitdiffstats
path: root/VNFs
diff options
context:
space:
mode:
Diffstat (limited to 'VNFs')
-rw-r--r--VNFs/DPPD-PROX/handle_dump.c15
-rw-r--r--VNFs/DPPD-PROX/handle_nsh.c34
-rw-r--r--VNFs/DPPD-PROX/handle_qinq_decap4.c5
-rw-r--r--VNFs/DPPD-PROX/handle_tsc.c4
4 files changed, 58 insertions, 0 deletions
diff --git a/VNFs/DPPD-PROX/handle_dump.c b/VNFs/DPPD-PROX/handle_dump.c
index 29a46fef..8fbc514c 100644
--- a/VNFs/DPPD-PROX/handle_dump.c
+++ b/VNFs/DPPD-PROX/handle_dump.c
@@ -42,7 +42,12 @@ static uint16_t buffer_packets(struct task_dump *task, struct rte_mbuf **mbufs,
return 0;
for (j = 0; j < n_pkts && task->n_mbufs < task->n_pkts; ++j) {
+#if RTE_VERSION >= RTE_VERSION_NUM(20,11,0,0)
+ uint64_t rdtsc = rte_rdtsc();
+ memcpy(&mbufs[j]->dynfield1[0], &rdtsc, sizeof(rdtsc));
+#else
mbufs[j]->udata64 = rte_rdtsc();
+#endif
task->mbufs[task->n_mbufs++] = mbufs[j];
}
@@ -93,10 +98,20 @@ static void stop(struct task_base *tbase)
pcap_dump_handle = pcap_dump_open(handle, task->pcap_file);
if (task->n_mbufs) {
+#if RTE_VERSION >= RTE_VERSION_NUM(20,11,0,0)
+ memcpy(&beg, &task->mbufs[0]->dynfield1[0], sizeof(beg));
+#else
beg = task->mbufs[0]->udata64;
+#endif
}
for (uint32_t j = 0; j < task->n_mbufs; ++j) {
+#if RTE_VERSION >= RTE_VERSION_NUM(20,11,0,0)
+ uint64_t mbufs_beg;
+ memcpy(&mbufs_beg, &task->mbufs[j]->dynfield1[0], sizeof(mbufs_beg));
+ tsc = mbufs_beg - beg;
+#else
tsc = task->mbufs[j]->udata64 - beg;
+#endif
header.len = rte_pktmbuf_pkt_len(task->mbufs[j]);
header.caplen = header.len;
tsc_to_tv(&header.ts, tsc);
diff --git a/VNFs/DPPD-PROX/handle_nsh.c b/VNFs/DPPD-PROX/handle_nsh.c
index ba2d14fb..a1df22fc 100644
--- a/VNFs/DPPD-PROX/handle_nsh.c
+++ b/VNFs/DPPD-PROX/handle_nsh.c
@@ -68,26 +68,43 @@ static inline uint8_t handle_decap_nsh(__attribute__((unused)) struct task_decap
mbuf->data_len = (uint16_t)(mbuf->data_len - hdr_len);
mbuf->data_off += hdr_len;
mbuf->pkt_len = (uint32_t)(mbuf->pkt_len - hdr_len);
+#if RTE_VERSION >= RTE_VERSION_NUM(20,11,0,0)
+ /* save length of header in the dynfield1 of rte_mbuf */
+ mbuf->dynfield1[0] = hdr_len;
+#else
/* save length of header in reserved 16bits of rte_mbuf */
mbuf->udata64 = hdr_len;
+#endif
}
else {
if (mbuf->data_len < VXLAN_GPE_HDR_SZ) {
+#if RTE_VERSION >= RTE_VERSION_NUM(20,11,0,0)
+ mbuf->dynfield1[0] = 0;
+#else
mbuf->udata64 = 0;
+#endif
return 0;
}
/* check the UDP destination port */
udp_hdr = (prox_rte_udp_hdr *)(((unsigned char *)eth_hdr) + sizeof(prox_rte_ether_hdr) + sizeof(prox_rte_ipv4_hdr));
if (udp_hdr->dst_port != VXLAN_GPE_NSH_TYPE) {
+#if RTE_VERSION >= RTE_VERSION_NUM(20,11,0,0)
+ mbuf->dynfield1[0] = 0;
+#else
mbuf->udata64 = 0;
+#endif
return 0;
}
/* check the Next Protocol field in VxLAN-GPE header */
vxlan_gpe_hdr = (prox_rte_vxlan_gpe_hdr *)(((unsigned char *)eth_hdr) + sizeof(prox_rte_ether_hdr) + sizeof(prox_rte_ipv4_hdr) + sizeof(prox_rte_udp_hdr));
if (vxlan_gpe_hdr->proto != VXLAN_GPE_NP) {
+#if RTE_VERSION >= RTE_VERSION_NUM(20,11,0,0)
+ mbuf->dynfield1[0] = 0;
+#else
mbuf->udata64 = 0;
+#endif
return 0;
}
@@ -97,8 +114,13 @@ static inline uint8_t handle_decap_nsh(__attribute__((unused)) struct task_decap
mbuf->data_len = (uint16_t)(mbuf->data_len - hdr_len);
mbuf->data_off += hdr_len;
mbuf->pkt_len = (uint32_t)(mbuf->pkt_len - hdr_len);
+#if RTE_VERSION >= RTE_VERSION_NUM(20,11,0,0)
+ /* save length of header in the dynfield1 of rte_mbuf */
+ mbuf->dynfield1[0] = hdr_len;
+#else
/* save length of header in reserved 16bits of rte_mbuf */
mbuf->udata64 = hdr_len;
+#endif
}
return 0;
@@ -143,14 +165,26 @@ static inline uint8_t handle_encap_nsh(__attribute__((unused)) struct task_encap
if (mbuf == NULL)
return 0;
+#if RTE_VERSION >= RTE_VERSION_NUM(20,11,0,0)
+ if (mbuf->dynfield1[0] == 0)
+#else
if (mbuf->udata64 == 0)
+#endif
return 0;
+#if RTE_VERSION >= RTE_VERSION_NUM(20,11,0,0)
+ /* use header length saved in dynfields1 of rte_mbuf to
+ "encapsulate" transport + NSH header by moving packet pointer */
+ mbuf->data_len = (uint16_t)(mbuf->data_len + mbuf->dynfield1[0]);
+ mbuf->data_off -= mbuf->dynfield1[0];
+ mbuf->pkt_len = (uint32_t)(mbuf->pkt_len + mbuf->dynfield1[0]);
+#else
/* use header length saved in reserved 16bits of rte_mbuf to
"encapsulate" transport + NSH header by moving packet pointer */
mbuf->data_len = (uint16_t)(mbuf->data_len + mbuf->udata64);
mbuf->data_off -= mbuf->udata64;
mbuf->pkt_len = (uint32_t)(mbuf->pkt_len + mbuf->udata64);
+#endif
eth_hdr = rte_pktmbuf_mtod(mbuf, prox_rte_ether_hdr *);
if (eth_hdr->ether_type == ETHER_NSH_TYPE) {
diff --git a/VNFs/DPPD-PROX/handle_qinq_decap4.c b/VNFs/DPPD-PROX/handle_qinq_decap4.c
index 94efbb1f..d74e622e 100644
--- a/VNFs/DPPD-PROX/handle_qinq_decap4.c
+++ b/VNFs/DPPD-PROX/handle_qinq_decap4.c
@@ -183,6 +183,10 @@ __attribute__((cold)) static void handle_error(struct rte_mbuf *mbuf)
svlan = rte_be_to_cpu_16(svlan & 0xFF0F);
cvlan = rte_be_to_cpu_16(cvlan & 0xFF0F);
+#if RTE_VERSION >= RTE_VERSION_NUM(20,11,0,0)
+ plogx_err("Can't convert key %016lx qinq %d|%d (%x|%x) to gre_id, rss=%x flags=%lx, status_err_len=%x, L2Tag=%d type=%d\n",
+ key, svlan, cvlan, svlan, cvlan, mbuf->hash.rss, mbuf->ol_flags, mbuf->dynfield1[0], mbuf->vlan_tci_outer, mbuf->packet_type);
+#else
#if RTE_VERSION >= RTE_VERSION_NUM(2,1,0,0)
plogx_err("Can't convert key %016lx qinq %d|%d (%x|%x) to gre_id, rss=%x flags=%lx, status_err_len=%lx, L2Tag=%d type=%d\n",
key, svlan, cvlan, svlan, cvlan, mbuf->hash.rss, mbuf->ol_flags, mbuf->udata64, mbuf->vlan_tci_outer, mbuf->packet_type);
@@ -195,6 +199,7 @@ __attribute__((cold)) static void handle_error(struct rte_mbuf *mbuf)
key, svlan, cvlan, svlan, cvlan, mbuf->ol_flags, mbuf->reserved);
#endif
#endif
+#endif
#else
plogx_err("Can't convert ip %x to gre_id\n", rte_bswap32(packet->ipv4_hdr.src_addr));
#endif
diff --git a/VNFs/DPPD-PROX/handle_tsc.c b/VNFs/DPPD-PROX/handle_tsc.c
index 245fe7a2..da0afea7 100644
--- a/VNFs/DPPD-PROX/handle_tsc.c
+++ b/VNFs/DPPD-PROX/handle_tsc.c
@@ -31,7 +31,11 @@ static int handle_bulk_tsc(struct task_base *tbase, struct rte_mbuf **mbufs, uin
const uint64_t rx_tsc = rte_rdtsc();
for (uint16_t j = 0; j < n_pkts; ++j)
+#if RTE_VERSION >= RTE_VERSION_NUM(20,11,0,0)
+ memcpy(&mbufs[j]->dynfield1[0], &rx_tsc, sizeof(rx_tsc));
+#else
mbufs[j]->udata64 = rx_tsc;
+#endif
return task->base.tx_pkt(&task->base, mbufs, n_pkts, NULL);
}