[dpdk-dev] UDP Checksum

Olivier MATZ olivier.matz at 6wind.com
Thu Nov 6 17:15:00 CET 2014


Hello,

On 11/06/2014 05:05 PM, Alex Markuze wrote:
> I'm seeing "UDP: bad checksum." messages(dmesg) for packets sent by my dpdk
> app to a socket on a remote machine.
> Looking at the packets the scum value is set, its just not what wireshark
> expects.
> 
> When sending I'm setting these fields in the egress packets.
> 
>         pkt->pkt.vlan_macip.f.l2_len = sizeof(struct ether_hdr);
> 
>         pkt->pkt.vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
> 
>         pkt->ol_flags |= (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK);
> //PKT_TX_OFFLOAD_MASK;

I think you need to do:

 pkt->pkt.vlan_macip.f.l2_len = sizeof(struct ether_hdr);
 pkt->pkt.vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
 pkt->ol_flags |= (PKT_TX_IP_CKSUM | PKT_TX_UDP_CKSUM);
 ipv4_hdr->hdr_checksum = 0;
 udp_hdr->dgram_cksum = 0;
 udp_hdr->dgram_cksum = get_ipv4_psd_sum(ipv4_hdr); /* see csumonly.c */


Regards,
Olivier


More information about the dev mailing list