From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 886A05F4D; Thu, 20 Sep 2018 16:54:03 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Sep 2018 07:54:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,398,1531810800"; d="scan'208";a="234545460" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by orsmga004.jf.intel.com with ESMTP; 20 Sep 2018 07:53:57 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.54]) by IRSMSX104.ger.corp.intel.com ([169.254.5.213]) with mapi id 14.03.0319.002; Thu, 20 Sep 2018 15:53:56 +0100 From: "Ananyev, Konstantin" To: Didier Pallard , "dev@dpdk.org" CC: "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] net: fix Intel prepare function for IP checksum offload Thread-Index: AQHUUCcKJOWiwHrnEEqzqFwNABeeVKT5QwLQ Date: Thu, 20 Sep 2018 14:53:56 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258EA959288@irsmsx105.ger.corp.intel.com> References: <20180919144208.17064-1-didier.pallard@6wind.com> In-Reply-To: <20180919144208.17064-1-didier.pallard@6wind.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDhiZTY2Y2ItMTA5YS00YWU2LTliMTYtNzdlOTYyODU3OWRiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiTEI5WDRCcFp1bElxVVNUN1RhMjIzK0xJb3RQR2ZtM2xCbjl3RGdMZ1l5bTJaV2R3TVhBNE1wRjN3eUp2RmtXWiJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [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: Thu, 20 Sep 2018 14:54:04 -0000 >=20 > 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. >=20 > Fixes: 4fb7e803eb1a ("ethdev: add Tx preparation") > Cc: stable@dpdk.org >=20 > Signed-off-by: Didier Pallard > --- > lib/librte_net/rte_net.h | 20 ++++++++------------ > 1 file changed, 8 insertions(+), 12 deletions(-) >=20 > 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 +=3D m->outer_l2_len + m->outer_l3_len; >=20 > - if ((ol_flags & PKT_TX_UDP_CKSUM) =3D=3D PKT_TX_UDP_CKSUM) { > - if (ol_flags & PKT_TX_IPV4) { > - ipv4_hdr =3D rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, > - inner_l3_offset); > + if (ol_flags & PKT_TX_IPV4) { > + ipv4_hdr =3D rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, > + inner_l3_offset); >=20 > - if (ol_flags & PKT_TX_IP_CKSUM) > - ipv4_hdr->hdr_checksum =3D 0; > + if (ol_flags & PKT_TX_IP_CKSUM) > + ipv4_hdr->hdr_checksum =3D 0; > + } >=20 > + if ((ol_flags & PKT_TX_UDP_CKSUM) =3D=3D PKT_TX_UDP_CKSUM) { > + if (ol_flags & PKT_TX_IPV4) { > udp_hdr =3D (struct udp_hdr *)((char *)ipv4_hdr + > m->l3_len); > udp_hdr->dgram_cksum =3D 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 =3D rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, > - inner_l3_offset); > - > - if (ol_flags & PKT_TX_IP_CKSUM) > - ipv4_hdr->hdr_checksum =3D 0; > - > /* non-TSO tcp or TSO */ > tcp_hdr =3D (struct tcp_hdr *)((char *)ipv4_hdr + > m->l3_len); > -- Acked-by: Konstantin Ananyev > 2.11.0