diff options
author | Deepak S <deepak.s@linux.intel.com> | 2017-11-07 04:56:51 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-11-07 04:56:51 +0000 |
commit | 516aad7ecf88e968940d384a1f56dca4e42a279b (patch) | |
tree | d6a591d9e8259695ee5a4a8390463ece6957cfec /VNFs | |
parent | f6abc2e6a02557e82ad0d1e5440653bb8884ecc8 (diff) | |
parent | 2f1fa2c37697377aea015e7d82c49b3df2ae9111 (diff) |
Merge "lw_AFTR: IP Checksum required on generated packet."
Diffstat (limited to 'VNFs')
-rw-r--r-- | VNFs/DPPD-PROX/Makefile | 5 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/handle_ipv6_tunnel.c | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/VNFs/DPPD-PROX/Makefile b/VNFs/DPPD-PROX/Makefile index 79bfdef3..87ea3bce 100644 --- a/VNFs/DPPD-PROX/Makefile +++ b/VNFs/DPPD-PROX/Makefile @@ -109,6 +109,11 @@ else CFLAGS += -DPROX_MAX_LOG_LVL=$(log) endif +# When ipv4 packet is de-encalpusled from ipv6 packet, genaerate IP checksum. +ifeq ($(GEN_DECAP_IPV6_TO_IPV4_CKSUM),y) +CFLAGS += -DGEN_DECAP_IPV6_TO_IPV4_CKSUM +endif + # override any use-case/enviroment specific choices regarding crc and # always use the sw implementation ifeq ($(crc),soft) diff --git a/VNFs/DPPD-PROX/handle_ipv6_tunnel.c b/VNFs/DPPD-PROX/handle_ipv6_tunnel.c index a92f9cdc..3361a6a7 100644 --- a/VNFs/DPPD-PROX/handle_ipv6_tunnel.c +++ b/VNFs/DPPD-PROX/handle_ipv6_tunnel.c @@ -377,6 +377,8 @@ static int handle_ipv6_encap_bulk(struct task_base* tbase, struct rte_mbuf** mbu static inline uint8_t handle_ipv6_decap(struct task_ipv6_decap* ptask, struct rte_mbuf* rx_mbuf, __attribute__((unused)) struct ipv6_tun_dest* tun_dest) { struct ether_hdr* peth = rte_pktmbuf_mtod(rx_mbuf, struct ether_hdr *); + struct task_ipv6_tun_base* tun_base = (struct task_ipv6_tun_base*)ptask; + struct ipv4_hdr* pip4 = NULL; if (unlikely(peth->ether_type != ETYPE_IPv6)) { plog_warn("Received non IPv6 packet on ipv6 tunnel port\n"); @@ -400,12 +402,20 @@ static inline uint8_t handle_ipv6_decap(struct task_ipv6_decap* ptask, struct rt // Discard IPv6 encapsulation rte_pktmbuf_adj(rx_mbuf, ipv6_hdr_len); peth = rte_pktmbuf_mtod(rx_mbuf, struct ether_hdr *); + pip4 = (struct ipv4_hdr *)(peth + 1); // Restore Ethernet header ether_addr_copy(&ptask->base.src_mac, &peth->s_addr); ether_addr_copy(&ptask->dst_mac, &peth->d_addr); peth->ether_type = ETYPE_IPv4; +#ifdef GEN_DECAP_IPV6_TO_IPV4_CKSUM + // generate an IP checksum for ipv4 packet + if (tun_base->runtime_flags & TASK_TX_CRC) { + prox_ip_cksum(rx_mbuf, pip4, sizeof(struct ether_hdr), sizeof(struct ipv4_hdr), ptask->base.offload_crc); + } +#endif + return 0; } |