[dpdk-dev] UDP Checksum
Ananyev, Konstantin
konstantin.ananyev at intel.com
Thu Nov 6 17:15:24 CET 2014
> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Alex Markuze
> Sent: Thursday, November 06, 2014 4:05 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] UDP Checksum
>
> Hi,
> 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'm working with a 82599 VF.
>
>
> Any thoughts? I'm not sure what else to check.
As I remember, you have to setup IPV4 header checksum to 0 and
calculate and setup pseudo-header checksum for UDP.
From app/test-pmd/csumonly.c:
...
if (pkt_ol_flags & (PKT_RX_IPV4_HDR | PKT_RX_TUNNEL_IPV4_HDR)) {
/* Do not support ipv4 option field */
l3_len = sizeof(struct ipv4_hdr) ;
...
/* Do not delete, this is required by HW*/
ipv4_hdr->hdr_checksum = 0;
...
if (l4_proto == IPPROTO_UDP) {
udp_hdr = (struct udp_hdr*) (rte_pktmbuf_mtod(mb,
unsigned char *) + l2_len + l3_len);
if (tx_ol_flags & 0x2) {
/* HW Offload */
ol_flags |= PKT_TX_UDP_CKSUM;
if (ipv4_tunnel)
udp_hdr->dgram_cksum = 0;
else
/* Pseudo header sum need be set properly */
udp_hdr->dgram_cksum =
get_ipv4_psd_sum(ipv4_hdr);
More information about the dev
mailing list