From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by dpdk.org (Postfix) with ESMTP id 673622E89 for ; Thu, 6 Nov 2014 17:17:08 +0100 (CET) Received: by mail-lb0-f179.google.com with SMTP id l4so1201371lbv.38 for ; Thu, 06 Nov 2014 08:26:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=7LWE9mFL07zD6UR004Kz31vw4EOEqv6GWxPmg8vXugA=; b=PjpCnBK/SM5asAJ33HVwKAMgBWdxLsnOsC/kxobFJJPA0pfvq8Ht5o5grSWZAJJkrY A4BDffOH1KmqchjS9CEwrujnvMDqO7Jgsox362FcF6h4c+M6Eg/1A95/nxdTpnV4Uj1X 5Rmg/NCl9UWgC6epRUSUq3vHpPExVrAiAwdBQBvQM3vxMdkUHXBTdS7rvxUDEyaRReyX IRIFLMGLe6rcmfB9+5E3LkpKaIP5UW+O1LGm28//GLW7RfEHjoI9dyRJdup49FaSIk0M lWCD05oCvHf5nRU1p8vstMxlDh+sgrNhO4McGnvoHHOcn5U8OJahhXDG1mAlFojBEN38 Ywhg== X-Gm-Message-State: ALoCoQks03C0KGOfH6mBOPSFzfB+MCn5QCO70g0Pk5w+BsCAmAcIzm03HpOf0VsrYY0fg5W1TAAd MIME-Version: 1.0 X-Received: by 10.112.77.74 with SMTP id q10mr5981111lbw.66.1415291196280; Thu, 06 Nov 2014 08:26:36 -0800 (PST) Received: by 10.25.215.157 with HTTP; Thu, 6 Nov 2014 08:26:36 -0800 (PST) In-Reply-To: <2601191342CEEE43887BDE71AB977258213A2E79@IRSMSX105.ger.corp.intel.com> References: <2601191342CEEE43887BDE71AB977258213A2E79@IRSMSX105.ger.corp.intel.com> Date: Thu, 6 Nov 2014 18:26:36 +0200 Message-ID: From: Alex Markuze To: "Ananyev, Konstantin" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] UDP Checksum X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Nov 2014 16:17:08 -0000 I was setting both ip and udp scum fields to 0. PKT_TX_UDP_CKSUM == PKT_TX_L4_MASK = 0x6000. I was not aware of the get_ipv4_psd_sum(ipv4_hdr); And I'm quite frankly surprised the HW doesn't already do this. Farther more I don't remember kernel drivers messing with L3 Headers(bnx2x/mlx4). Is this true for all PMDs that do scum offloads? I will give it a try now. On Thu, Nov 6, 2014 at 6:15 PM, Ananyev, Konstantin < konstantin.ananyev@intel.com> wrote: > > > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Alex Markuze > > Sent: Thursday, November 06, 2014 4:05 PM > > To: dev@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); > > > >