title: DPDK: HW offloaded calculation of UDP checksum not working
body: <p>I am working with DPDK version 18.11.8 stable on Linux with an Intel X722 NIC.</p>
  <p>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:</p>
  <pre><code>local_port_conf.txmode.offloads  = local_port_conf.txmode.offloads | DEV_TX_OFFLOAD_IPV4_CKSUM  | DEV_TX_OFFLOAD_UDP_CKSUM;
  </code></pre>
  <pre><code>mb-&gt;ol_flags |= PKT_TX_IPV4 | PKT_TX_IP_CKSUM | PKT_TX_UDP_CKSUM; 
  mb-&gt;l2_len = sizeof(struct ether_hdr);
  mb-&gt;l3_len = sizeof(struct ipv4_hdr);
  mb-&gt;l4_len = sizeof(struct udp_hdr);        
  p_ip_hdr-&gt;hdr_checksum = 0;
  p_udp_hdr-&gt;dgram_cksum = rte_ipv4_phdr_cksum((const ipv4_hdr*)(mb-&gt;l3_len), mb-&gt;ol_flags);
  </code></pre>
  <p>The rte_ipv4_phdr_cksum() call is mysterious, have I understood what to do correctly?</p>
  <p>Understandably, the C++ compiler gaves a warning:</p>
  <pre><code>warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
           p_udp_hdr-&gt;dgram_cksum = rte_ipv4_phdr_cksum((const ipv4_hdr*)(ptMbuf-&gt;l3_len), ptMbuf-&gt;ol_flags);
                                                                                        ^
  </code></pre>
  <p>What is wrong with my code?</p>