From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 9920BA046B for ; Mon, 24 Jun 2019 14:01:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BB9741BF0A; Mon, 24 Jun 2019 14:01:57 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 2B69B1BE8D; Mon, 24 Jun 2019 14:01:54 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jun 2019 05:01:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,412,1557212400"; d="scan'208";a="169437526" Received: from irsmsx110.ger.corp.intel.com ([163.33.3.25]) by FMSMGA003.fm.intel.com with ESMTP; 24 Jun 2019 05:01:53 -0700 Received: from irsmsx112.ger.corp.intel.com (10.108.20.5) by irsmsx110.ger.corp.intel.com (163.33.3.25) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 24 Jun 2019 13:01:52 +0100 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.143]) by irsmsx112.ger.corp.intel.com ([10.108.20.5]) with mapi id 14.03.0439.000; Mon, 24 Jun 2019 13:01:52 +0100 From: "Ananyev, Konstantin" To: Ivan Malov , Olivier Matz CC: "dev@dpdk.org" , "Kulasek, TomaszX" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] net: fix the way how L4 checksum choice is tested Thread-Index: AQHVFkS05fsTOuKkj0m2RBehv7AAr6aq2QhggAADIJA= Date: Mon, 24 Jun 2019 12:01:50 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725801689E3F36@IRSMSX104.ger.corp.intel.com> References: <20190529173337.31157-1-ivan.malov@oktetlabs.ru> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTgzMmE4NTAtMmQzOC00Njk5LWE0ZTMtNzhiYzQ5MDk1NjUyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiVU9GYmp1NlpPTmI0VWlBZHZsTXIzUkRlbXNWS1wveEIzV25jQmppd3BcL1NTNVNDcU5nR3lTRjMwUUIzU0dRUHlSIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 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 the way how L4 checksum choice is tested 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Ananyev, Konstantin > Sent: Monday, June 24, 2019 12:52 PM > To: 'Ivan Malov' ; Olivier Matz > Cc: dev@dpdk.org; Kulasek, TomaszX ; stable@dp= dk.org > Subject: RE: [dpdk-dev] [PATCH] net: fix the way how L4 checksum choice i= s tested >=20 >=20 > > The API to prepare checksum offloads mistreats L4 > > checksum type enum values as self-contained flags. > > > > Turning these flag checks into enum checks causes > > warnings by GCC about possibly uninitialised IPv4 > > header pointer. The issue was found to show up in > > the case of GCC versions 4.8.5 and 5.4.0, however, > > it might be the case for a wider variety of other > > versions. As GCC version 7.4.0 is not susceptible > > to the said false positive assessment, this patch > > maintains a compiler barrier for earlier versions. > > > > Fixes: 4fb7e803eb1a ("ethdev: add Tx preparation") > > Cc: Tomasz Kulasek > > Cc: stable@dpdk.org > > > > Signed-off-by: Ivan Malov > > --- > > lib/librte_net/rte_net.h | 16 ++++++++++++++-- > > 1 file changed, 14 insertions(+), 2 deletions(-) > > > > diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h > > index 7088584..fb09431 100644 > > --- a/lib/librte_net/rte_net.h > > +++ b/lib/librte_net/rte_net.h > > @@ -151,7 +151,19 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *= m, > > ipv4_hdr->hdr_checksum =3D 0; > > } > > >=20 > As I remember, saw something similar before... > Probably the eaiser way to overcome it, is just to always initialize ipv4= _hdr above, > something like: >=20 > +ipv4_hdr =3D NULL; > if (ol_flags & PKT_TX_IPV4) { > ipv4_hdr =3D rte_pktmbuf_mtod_offset(m, struct rte_ipv4_h= dr *, > inner_l3_offset); >=20 > if (ol_flags & PKT_TX_IP_CKSUM) > ipv4_hdr->hdr_checksum =3D 0; > } As another possible option always initialisze both, and then use either on= e or another, depending on flags: ipv4_hdr =3D rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, inner_l3_off= set); ipv6_hdr =3D rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, inner_l3_off= set); .... >=20 >=20 > > - if ((ol_flags & PKT_TX_UDP_CKSUM) =3D=3D PKT_TX_UDP_CKSUM) { > > +#ifdef GCC_VERSION > > +#if GCC_VERSION < 70400 > > + /* > > + * Earlier versions of GCC suspect access to possibly > > + * uninitialised ipv4_hdr in the code below, although > > + * the said variable is properly initialised above. > > + * Use compiler barrier to cope with the problem. > > + */ > > + rte_compiler_barrier(); > > +#endif > > +#endif > > + > > + if ((ol_flags & PKT_TX_L4_MASK) =3D=3D PKT_TX_UDP_CKSUM) { > > if (ol_flags & PKT_TX_IPV4) { > > udp_hdr =3D (struct rte_udp_hdr *)((char *)ipv4_hdr + > > m->l3_len); > > @@ -167,7 +179,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m= , > > udp_hdr->dgram_cksum =3D rte_ipv6_phdr_cksum(ipv6_hdr, > > ol_flags); > > } > > - } else if ((ol_flags & PKT_TX_TCP_CKSUM) || > > + } else if ((ol_flags & PKT_TX_L4_MASK) =3D=3D PKT_TX_TCP_CKSUM || > > (ol_flags & PKT_TX_TCP_SEG)) { > > if (ol_flags & PKT_TX_IPV4) { > > /* non-TSO tcp or TSO */ > > -- > > 1.8.3.1