From: Raslan Darawsheh Date: Sun, 11 Nov 2018 15:31:37 +0000 (+0000) Subject: app/testpmd: fix L4 length for UDP checksum X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=2b5651c026d8d1a687a8f7a210b1b8f13f906911;p=dpdk.git app/testpmd: fix L4 length for UDP checksum testpmd only sets the L4 len in case of TCP packets. some PMD's like tap rely on mbuf meta data to calculate csum This will set the L4 len for UDP packets same as TCP Fixes: 160c3dc9458c ("app/testpmd: introduce IP parsing functions in csum fwd engine") CC: stable@dpdk.org Signed-off-by: Raslan Darawsheh Signed-off-by: Ophir Munk Reviewed-by: Ferruh Yigit --- diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index dce4b9be7f..ffeee20511 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -111,7 +111,9 @@ parse_ipv4(struct ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) if (info->l4_proto == IPPROTO_TCP) { tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + info->l3_len); info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2; - } else + } else if (info->l4_proto == IPPROTO_UDP) + info->l4_len = sizeof(struct udp_hdr); + else info->l4_len = 0; } @@ -128,7 +130,9 @@ parse_ipv6(struct ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) if (info->l4_proto == IPPROTO_TCP) { tcp_hdr = (struct tcp_hdr *)((char *)ipv6_hdr + info->l3_len); info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2; - } else + } else if (info->l4_proto == IPPROTO_UDP) + info->l4_len = sizeof(struct udp_hdr); + else info->l4_len = 0; }