This commit calculates the correct pseudo header for the UDP fragmentation offload by adding UDP_SEG flag.
Signed-off-by: Zhichao Zeng <zhichaox.z...@intel.com> --- lib/net/rte_ip.h | 4 ++-- lib/net/rte_net.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h index a310e9d498..8073c8e889 100644 --- a/lib/net/rte_ip.h +++ b/lib/net/rte_ip.h @@ -345,7 +345,7 @@ rte_ipv4_phdr_cksum(const struct rte_ipv4_hdr *ipv4_hdr, uint64_t ol_flags) psd_hdr.dst_addr = ipv4_hdr->dst_addr; psd_hdr.zero = 0; psd_hdr.proto = ipv4_hdr->next_proto_id; - if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) { + if (ol_flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG)) { psd_hdr.len = 0; } else { l3_len = rte_be_to_cpu_16(ipv4_hdr->total_length); @@ -596,7 +596,7 @@ rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr *ipv6_hdr, uint64_t ol_flags) } psd_hdr; psd_hdr.proto = (uint32_t)(ipv6_hdr->proto << 24); - if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) { + if (ol_flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG)) { psd_hdr.len = 0; } else { psd_hdr.len = ipv6_hdr->payload_len; diff --git a/lib/net/rte_net.h b/lib/net/rte_net.h index 56611fc8f9..ef3ff4c6fd 100644 --- a/lib/net/rte_net.h +++ b/lib/net/rte_net.h @@ -121,7 +121,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) * no offloads are requested. */ if (!(ol_flags & (RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_L4_MASK | RTE_MBUF_F_TX_TCP_SEG | - RTE_MBUF_F_TX_OUTER_IP_CKSUM))) + RTE_MBUF_F_TX_UDP_SEG | RTE_MBUF_F_TX_OUTER_IP_CKSUM))) return 0; if (ol_flags & (RTE_MBUF_F_TX_OUTER_IPV4 | RTE_MBUF_F_TX_OUTER_IPV6)) { @@ -154,7 +154,8 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) ipv4_hdr->hdr_checksum = 0; } - if ((ol_flags & RTE_MBUF_F_TX_L4_MASK) == RTE_MBUF_F_TX_UDP_CKSUM) { + if ((ol_flags & RTE_MBUF_F_TX_L4_MASK) == RTE_MBUF_F_TX_UDP_CKSUM || + (ol_flags & RTE_MBUF_F_TX_UDP_SEG)) { if (ol_flags & RTE_MBUF_F_TX_IPV4) { udp_hdr = (struct rte_udp_hdr *)((char *)ipv4_hdr + m->l3_len); -- 2.25.1