summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/handle_gre_decap_encap.c
diff options
context:
space:
mode:
authorXavier Simonart <xavier.simonart@intel.com>2019-10-23 12:38:51 +0200
committerXavier Simonart <xavier.simonart@intel.com>2020-01-29 09:56:04 +0000
commitab615dd91dcb355615b1f1f7266d878b70b35b4d (patch)
tree3d846d85dce35a5c4f78154f648bbc1e30313dee /VNFs/DPPD-PROX/handle_gre_decap_encap.c
parentec0cda3ea752559f3d6d40c6dd5be182f33c7644 (diff)
Prepare for DPDK 19.08 support
This commit prepares PROX for supporting changes from DPDK 19.08 Mainly, the "sed" listed below were run. In addition, - some forward definition have been removed, - prox_compat.h has been updated - prox_compat.h has been included where necessary. Hence such a commit is rather easy to review and to reapply on other branches if necessary. sed -i 's/struct ether_hdr/prox_rte_ether_hdr/g' *.h sed -i 's/struct ether_hdr/prox_rte_ether_hdr/g' *.c sed -i 's/struct ether_addr/prox_rte_ether_addr/g' *.c sed -i 's/struct ether_addr/prox_rte_ether_addr/g' *.h sed -i 's/prox_rte_ether_addr_port/struct ether_addr_port/g' *.c sed -i 's/prox_rte_ether_addr_port/struct ether_addr_port/g' *.h sed -i 's/struct vlan_hdr/prox_rte_vlan_hdr/g' *.c sed -i 's/struct vlan_hdr/prox_rte_vlan_hdr/g' *.h sed -i 's/struct ipv4_hdr/prox_rte_ipv4_hdr/g' *.h sed -i 's/struct ipv4_hdr/prox_rte_ipv4_hdr/g' *.c sed -i 's/struct ipv6_hdr/prox_rte_ipv6_hdr/g' *.c sed -i 's/struct ipv6_hdr/prox_rte_ipv6_hdr/g' *.h sed -i 's/struct udp_hdr/prox_rte_udp_hdr/g' *.c sed -i 's/struct udp_hdr/prox_rte_udp_hdr/g' *.h sed -i 's/struct tcp_hdr/prox_rte_tcp_hdr/g' *.c sed -i 's/struct tcp_hdr/prox_rte_tcp_hdr/g' *.h sed -i 's/struct prox_rte_ether_addr_copy/ether_addr_copy/g' *.c sed -i 's/struct prox_rte_ether_addr_copy/ether_addr_copy/g' *.h sed -i 's/struct prox_rte_ether_addr_copy/prox_rte_ether_addr_copy/g' *.c sed -i 's/struct prox_rte_ether_addr_copy/ether_addr_copy/g' *.h sed -i 's/prox_rte_ether_addr_copy/ether_addr_copy/g' *.h sed -i 's/prox_rte_ether_addr_copy/ether_addr_copy/g' *.c sed -i 's/ether_addr_copy/prox_rte_ether_addr_copy/g' *.c sed -i 's/ether_addr_copy/prox_rte_ether_addr_copy/g' *.h sed -i 's/prox_rte_ether_hdr_arp/struct ether_hdr_arp/g' *.h sed -i 's/prox_rte_ether_hdr_arp/struct ether_hdr_arp/g' *.c sed -i 's/struct vxlan_gpe_hdr/prox_rte_vxlan_gpe_hdr/g' *.h sed -i 's/struct vxlan_gpe_hdr/prox_rte_vxlan_gpe_hdr/g' *.c sed -i 's/eth_random_addr/prox_rte_eth_random_addr/g' *.c sed -i 's/eth_random_addr/prox_rte_eth_random_addr/g' *.h sed -i 's/ETHER_CRC_LEN/PROX_RTE_ETHER_CRC_LEN/g' *.c sed -i 's/ETHER_CRC_LEN/PROX_RTE_ETHER_CRC_LEN/g' *.h sed -i 's/ETHER_HDR_LEN/PROX_RTE_ETHER_HDR_LEN/g' *.c sed -i 's/ETHER_HDR_LEN/PROX_RTE_ETHER_HDR_LEN/g' *.h sed -i 's/ETHER_MAX_LEN/PROX_RTE_ETHER_MAX_LEN/g' *.c sed -i 's/ETHER_MAX_LEN/PROX_RTE_ETHER_MAX_LEN/g' *.h sed -i 's/ETHER_MIN_LEN/PROX_RTE_ETHER_MIN_LEN/g' *.c sed -i 's/ETHER_MIN_LEN/PROX_RTE_ETHER_MIN_LEN/g' *.h sed -i 's/TCP_SYN_FLAG/PROX_RTE_TCP_SYN_FLAG/g' *.c sed -i 's/TCP_RST_FLAG/PROX_RTE_TCP_RST_FLAG/g' *.c sed -i 's/TCP_FIN_FLAG/PROX_RTE_TCP_FIN_FLAG/g' *.c sed -i 's/TCP_ACK_FLAG/PROX_RTE_TCP_ACK_FLAG/g' *.c Change-Id: I4dfe8be68e618c94dcaae28754579fbeb571bb00 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/handle_gre_decap_encap.c')
-rw-r--r--VNFs/DPPD-PROX/handle_gre_decap_encap.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/VNFs/DPPD-PROX/handle_gre_decap_encap.c b/VNFs/DPPD-PROX/handle_gre_decap_encap.c
index 02ba4c36..83e430a6 100644
--- a/VNFs/DPPD-PROX/handle_gre_decap_encap.c
+++ b/VNFs/DPPD-PROX/handle_gre_decap_encap.c
@@ -37,7 +37,7 @@
#include "quit.h"
struct cpe_gre_key {
- struct ether_addr clt_mac;
+ prox_rte_ether_addr clt_mac;
uint16_t pad;
} __attribute__((__packed__));
@@ -219,12 +219,12 @@ void handle_gre_decap_bulk(struct task_base *tbase, struct rte_mbuf **mbufs, uin
}
struct gre_packet {
- struct ether_hdr eth;
- struct ipv4_hdr ip;
+ prox_rte_ether_hdr eth;
+ prox_rte_ipv4_hdr ip;
struct gre_hdr gre;
union {
- struct ether_hdr eth2;
- struct ipv4_hdr ip2;
+ prox_rte_ether_hdr eth2;
+ prox_rte_ipv4_hdr ip2;
};
} __attribute__((__packed__));
@@ -232,26 +232,26 @@ struct gre_packet {
GRE remove gre and ipv4 header and retain space for ethernet
header. In case of Eth over GRE remove external eth, gre and ipv4
headers and return pointer to payload */
-static inline struct ether_hdr *gre_decap(struct gre_hdr *pgre, struct rte_mbuf *mbuf)
+static inline prox_rte_ether_hdr *gre_decap(struct gre_hdr *pgre, struct rte_mbuf *mbuf)
{
int16_t hsize = 0;
if (pgre->type == ETYPE_EoGRE) {
- hsize = sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr) + sizeof(struct gre_hdr);
+ hsize = sizeof(prox_rte_ether_hdr) + sizeof(prox_rte_ipv4_hdr) + sizeof(struct gre_hdr);
}
else if (pgre->type == ETYPE_IPv4) {
- /* retain sizeof(struct ether_hdr) */
- hsize = sizeof(struct ipv4_hdr) + sizeof(struct gre_hdr);
+ /* retain sizeof(prox_rte_ether_hdr) */
+ hsize = sizeof(prox_rte_ipv4_hdr) + sizeof(struct gre_hdr);
}
else {
return NULL;
}
- return (struct ether_hdr *)rte_pktmbuf_adj(mbuf, hsize);
+ return (prox_rte_ether_hdr *)rte_pktmbuf_adj(mbuf, hsize);
}
static inline uint8_t handle_gre_decap(struct task_gre_decap *task, struct rte_mbuf *mbuf)
{
- struct ipv4_hdr *pip = (struct ipv4_hdr *)(rte_pktmbuf_mtod(mbuf, struct ether_hdr *) + 1);
+ prox_rte_ipv4_hdr *pip = (prox_rte_ipv4_hdr *)(rte_pktmbuf_mtod(mbuf, prox_rte_ether_hdr *) + 1);
if (pip->next_proto_id != IPPROTO_GRE) {
plog_warn("Invalid packet proto_id = 0x%x expect 0x%x\n",
@@ -265,15 +265,15 @@ static inline uint8_t handle_gre_decap(struct task_gre_decap *task, struct rte_m
data.gre_id = pgre->gre_id;
data.cpe_ip = pip->src_addr;
- struct ether_hdr *peth = gre_decap(pgre, mbuf);
+ prox_rte_ether_hdr *peth = gre_decap(pgre, mbuf);
PROX_PANIC(peth != 0, "Failed to gre_decap");
- pip = (struct ipv4_hdr *)(peth + 1);
+ pip = (prox_rte_ipv4_hdr *)(peth + 1);
/* emulate client MAC for test purposes */
#if 1
if (pgre->type == ETYPE_IPv4) {
- struct ether_hdr eth = {
+ prox_rte_ether_hdr eth = {
.d_addr = {.addr_bytes =
{0x0A, 0x02, 0x0A, 0x0A, 0x00, 0x01}},
.s_addr = {.addr_bytes =
@@ -285,9 +285,9 @@ static inline uint8_t handle_gre_decap(struct task_gre_decap *task, struct rte_m
eth.s_addr.addr_bytes[3] = (hip >> 16) & 0xFF;
eth.s_addr.addr_bytes[4] = (hip >> 8) & 0xFF;
eth.s_addr.addr_bytes[5] = (hip) & 0xFF;
- rte_memcpy(peth, &eth, sizeof(struct ether_hdr));
+ rte_memcpy(peth, &eth, sizeof(prox_rte_ether_hdr));
}
- ether_addr_copy(&peth->s_addr, &key.clt_mac);
+ prox_rte_ether_addr_copy(&peth->s_addr, &key.clt_mac);
#endif
data.tsc = rte_rdtsc() + task->cpe_timeout;
@@ -303,7 +303,7 @@ static inline uint8_t handle_gre_decap(struct task_gre_decap *task, struct rte_m
}
rte_memcpy(&task->cpe_gre_data[hash_index], &data, sizeof(data));
if (task->runtime_flags & TASK_TX_CRC) {
- prox_ip_cksum(mbuf, pip, sizeof(struct ether_hdr), sizeof(struct ipv4_hdr), task->offload_crc);
+ prox_ip_cksum(mbuf, pip, sizeof(prox_rte_ether_hdr), sizeof(prox_rte_ipv4_hdr), task->offload_crc);
}
return 0;
@@ -333,8 +333,8 @@ void handle_gre_encap_bulk(struct task_base *tbase, struct rte_mbuf **mbufs, uin
static inline void handle_gre_encap16(struct task_gre_decap *task, struct rte_mbuf **mbufs, uint16_t n_pkts, uint8_t *out)
{
for (uint8_t i = 0; i < n_pkts; ++i) {
- struct ether_hdr *peth = rte_pktmbuf_mtod(mbufs[i], struct ether_hdr *);
- ether_addr_copy(&peth->d_addr, &task->key[i].clt_mac);
+ prox_rte_ether_hdr *peth = rte_pktmbuf_mtod(mbufs[i], prox_rte_ether_hdr *);
+ prox_rte_ether_addr_copy(&peth->d_addr, &task->key[i].clt_mac);
}
int32_t hash_index[16];
@@ -359,24 +359,24 @@ static inline void handle_gre_encap16(struct task_gre_decap *task, struct rte_mb
}
#ifdef DO_ENC_ETH_OVER_GRE
-#define PKT_PREPEND_LEN (sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr) + sizeof(struct gre_hdr))
+#define PKT_PREPEND_LEN (sizeof(prox_rte_ether_hdr) + sizeof(prox_rte_ipv4_hdr) + sizeof(struct gre_hdr))
#elif DO_ENC_IP_OVER_GRE
-#define PKT_PREPEND_LEN (sizeof(struct ipv4_hdr) + sizeof(struct gre_hdr))
+#define PKT_PREPEND_LEN (sizeof(prox_rte_ipv4_hdr) + sizeof(struct gre_hdr))
#else
static inline uint8_t handle_gre_encap(struct task_gre_decap *task, struct rte_mbuf *mbuf, struct cpe_gre_data *table)
{
- struct ether_hdr *peth = rte_pktmbuf_mtod(mbuf, struct ether_hdr *);
- struct ipv4_hdr *pip = (struct ipv4_hdr *)(peth + 1);
+ prox_rte_ether_hdr *peth = rte_pktmbuf_mtod(mbuf, prox_rte_ether_hdr *);
+ prox_rte_ipv4_hdr *pip = (prox_rte_ipv4_hdr *)(peth + 1);
uint16_t ip_len = rte_be_to_cpu_16(pip->total_length);
struct cpe_gre_key key;
- ether_addr_copy(&peth->d_addr, &key.clt_mac);
+ prox_rte_ether_addr_copy(&peth->d_addr, &key.clt_mac);
#ifdef GRE_TP
/* policing enabled */
if (task->cycles_per_byte) {
- const uint16_t pkt_size = rte_pktmbuf_pkt_len(mbuf) + ETHER_CRC_LEN;
+ const uint16_t pkt_size = rte_pktmbuf_pkt_len(mbuf) + PROX_RTE_ETHER_CRC_LEN;
uint64_t tsc_now = rte_rdtsc();
if (table->tp_tbsize < pkt_size) {
uint64_t cycles_diff = tsc_now - table->tp_tsc;
@@ -399,19 +399,19 @@ static inline uint8_t handle_gre_encap(struct task_gre_decap *task, struct rte_m
/* reuse ethernet header from payload, retain payload (ip) in
case of DO_ENC_IP_OVER_GRE */
- peth = (struct ether_hdr *)rte_pktmbuf_prepend(mbuf, PKT_PREPEND_LEN);
+ peth = (prox_rte_ether_hdr *)rte_pktmbuf_prepend(mbuf, PKT_PREPEND_LEN);
PREFETCH0(peth);
ip_len += PKT_PREPEND_LEN;
- pip = (struct ipv4_hdr *)(peth + 1);
+ pip = (prox_rte_ipv4_hdr *)(peth + 1);
struct gre_hdr *pgre = (struct gre_hdr *)(pip + 1);
- struct ether_hdr eth = {
+ prox_rte_ether_hdr eth = {
.d_addr = {.addr_bytes = {0x0A, 0x0A, 0x0A, 0xC8, 0x00, 0x02}},
.s_addr = {.addr_bytes = {0x0A, 0x0A, 0x0A, 0xC8, 0x00, 0x01}},
.ether_type = ETYPE_IPv4
};
- rte_memcpy(peth, &eth, sizeof(struct ether_hdr));
+ rte_memcpy(peth, &eth, sizeof(prox_rte_ether_hdr));
rte_memcpy(pgre, &gre_hdr_proto, sizeof(struct gre_hdr));
#if DO_ENC_ETH_OVER_GRE
@@ -421,13 +421,13 @@ static inline uint8_t handle_gre_encap(struct task_gre_decap *task, struct rte_m
#endif
pgre->gre_id = table->gre_id;
- rte_memcpy(pip, &tunnel_ip_proto, sizeof(struct ipv4_hdr));
+ rte_memcpy(pip, &tunnel_ip_proto, sizeof(prox_rte_ipv4_hdr));
pip->src_addr = 0x02010a0a; //emulate port ip
pip->dst_addr = table->cpe_ip;
pip->total_length = rte_cpu_to_be_16(ip_len);
if (task->runtime_flags & TASK_TX_CRC) {
- prox_ip_cksum(mbuf, pip, sizeof(struct ether_hdr), sizeof(struct ipv4_hdr), task->offload_crc);
+ prox_ip_cksum(mbuf, pip, sizeof(prox_rte_ether_hdr), sizeof(prox_rte_ipv4_hdr), task->offload_crc);
}
return 0;