[dpdk-users] HW offloaded calculation of UDP checksum not working

David Aldrich david.aldrich.ntml at gmail.com
Mon Jul 6 13:31:52 CEST 2020


Viewed 3 times
0
I am working with DPDK version 18.11.8 stable on Linux with an Intel X722
NIC.

My app works fine if I calculate IP and UDP checksums in software but I get
a segmentation fault if I calculate in hardware. Here is my code:

local_port_conf.txmode.offloads  = local_port_conf.txmode.offloads |
DEV_TX_OFFLOAD_IPV4_CKSUM  | DEV_TX_OFFLOAD_UDP_CKSUM;

mb->ol_flags |= PKT_TX_IPV4 | PKT_TX_IP_CKSUM | PKT_TX_UDP_CKSUM;
mb->l2_len = sizeof(struct ether_hdr);
mb->l3_len = sizeof(struct ipv4_hdr);
mb->l4_len = sizeof(struct udp_hdr);
p_ip_hdr->hdr_checksum = 0;
p_udp_hdr->dgram_cksum = rte_ipv4_phdr_cksum((const ipv4_hdr*)(mb->l3_len),
mb->ol_flags);

The rte_ipv4_phdr_cksum() call is mysterious, have I understood what to do
correctly?

Understandably, the C++ compiler gaves a warning:

warning: cast to pointer from integer of different size
[-Wint-to-pointer-cast]
         p_udp_hdr->dgram_cksum = rte_ipv4_phdr_cksum((const
ipv4_hdr*)(ptMbuf->l3_len), ptMbuf->ol_flags);

          ^

What is wrong with my code?


More information about the users mailing list