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 <rasland@mellanox.com>
Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
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;
}
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;
}