From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 7A1BF1B0FB; Wed, 19 Sep 2018 19:51:31 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Sep 2018 10:51:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,394,1531810800"; d="scan'208";a="74335366" Received: from fyigit-mobl.ger.corp.intel.com (HELO [10.237.221.39]) ([10.237.221.39]) by orsmga007.jf.intel.com with ESMTP; 19 Sep 2018 10:50:37 -0700 To: Didier Pallard , dev@dpdk.org Cc: stable@dpdk.org, Konstantin Ananyev , Tomasz Kulasek References: <20180919144208.17064-1-didier.pallard@6wind.com> From: Ferruh Yigit Openpgp: preference=signencrypt Message-ID: Date: Wed, 19 Sep 2018 18:50:37 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180919144208.17064-1-didier.pallard@6wind.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH] net: fix Intel prepare function for IP checksum offload X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Sep 2018 17:51:32 -0000 On 9/19/2018 3:42 PM, Didier Pallard wrote: > Current Intel tx prepare function does not properly handle the > case where only IP checksum is requested, without requesting > any L4 checksum or TSO: IP checksum is not properly reset to 0 > and output packet may contain invalid IP checksum. > > Fixes: 4fb7e803eb1a ("ethdev: add Tx preparation") > Cc: stable@dpdk.org cc'ed developer. > > Signed-off-by: Didier Pallard > --- > lib/librte_net/rte_net.h | 20 ++++++++------------ > 1 file changed, 8 insertions(+), 12 deletions(-) > > diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h > index b6ab6e1d57b2..e59760a0a108 100644 > --- a/lib/librte_net/rte_net.h > +++ b/lib/librte_net/rte_net.h > @@ -122,14 +122,16 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) > (ol_flags & PKT_TX_OUTER_IPV6)) > inner_l3_offset += m->outer_l2_len + m->outer_l3_len; > > - if ((ol_flags & PKT_TX_UDP_CKSUM) == PKT_TX_UDP_CKSUM) { > - if (ol_flags & PKT_TX_IPV4) { > - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, > - inner_l3_offset); > + if (ol_flags & PKT_TX_IPV4) { > + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, > + inner_l3_offset); > > - if (ol_flags & PKT_TX_IP_CKSUM) > - ipv4_hdr->hdr_checksum = 0; > + if (ol_flags & PKT_TX_IP_CKSUM) > + ipv4_hdr->hdr_checksum = 0; > + } > > + if ((ol_flags & PKT_TX_UDP_CKSUM) == PKT_TX_UDP_CKSUM) { > + if (ol_flags & PKT_TX_IPV4) { > udp_hdr = (struct udp_hdr *)((char *)ipv4_hdr + > m->l3_len); > udp_hdr->dgram_cksum = rte_ipv4_phdr_cksum(ipv4_hdr, > @@ -146,12 +148,6 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) > } else if ((ol_flags & PKT_TX_TCP_CKSUM) || > (ol_flags & PKT_TX_TCP_SEG)) { > if (ol_flags & PKT_TX_IPV4) { > - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, > - inner_l3_offset); > - > - if (ol_flags & PKT_TX_IP_CKSUM) > - ipv4_hdr->hdr_checksum = 0; > - > /* non-TSO tcp or TSO */ > tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + > m->l3_len); >