From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 3D69C1B93E for ; Fri, 11 Jan 2019 12:20:34 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jan 2019 03:20:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,465,1539673200"; d="scan'208";a="126865107" Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by orsmga001.jf.intel.com with ESMTP; 11 Jan 2019 03:20:31 -0800 Received: from irsmsx156.ger.corp.intel.com (10.108.20.68) by IRSMSX154.ger.corp.intel.com (163.33.192.96) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 11 Jan 2019 11:20:30 +0000 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.65]) by IRSMSX156.ger.corp.intel.com ([169.254.3.156]) with mapi id 14.03.0415.000; Fri, 11 Jan 2019 11:20:31 +0000 From: "Van Haaren, Harry" To: Olivier Matz , "Dumitrescu, Cristian" , Stephen Hemminger CC: "dev@dpdk.org" , "Pattan, Reshma" , "thomas@monjalon.net" Thread-Topic: [PATCH v2] mbuf: fix compile by removing struct from function Thread-Index: AQHUqQ87acqYjl1Zg0OLqaFTARglXqWo1bEAgADr+YCAACnbMA== Date: Fri, 11 Jan 2019 11:20:30 +0000 Message-ID: References: <20190110165051.4859-1-harry.van.haaren@intel.com> <20190110180658.23302-1-harry.van.haaren@intel.com> <3EB4FA525960D640B5BDFFD6A3D891268E828A86@IRSMSX108.ger.corp.intel.com> <20190111084441.qi7ufsuqbyhb5bqo@platinum> In-Reply-To: <20190111084441.qi7ufsuqbyhb5bqo@platinum> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDM0MGU4YmMtNzcwNi00NmZhLTk3ODItZmM1MDUxODhiYjBkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoicWpDbWZ3emVFMzVNWko3SjZ1cUlMdGFYV0dxdWJSQ29sdks2aVBsR2gwMWE4WlwvM2tkTDBpSERyXC9KZkpCTGFIIn0= 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 v2] mbuf: fix compile by removing struct from function 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: Fri, 11 Jan 2019 11:20:34 -0000 Converging discussion, +Stephen Hemminger wrote: > I believe this was done so that the compiler doesn't generate > bad code. > > If you reference the mbuf to get the fields then each operation becomes > a load shift and mask operation to get to the bitfield. But if they > are local then this is all done on a single register value. > > Check the generated code. I did :) I see no difference in generated assembly here, system has GCC 7.3.0 with Meson release build and -g for debug symbols. Anyway, as per below the consensus seems to be to just lift the struct as per V1 with a note that the sched field is 8 bytes. I'll send v3 with the comment updated so we can close this ASAP. > -----Original Message----- > From: Olivier Matz [mailto:olivier.matz@6wind.com] > Sent: Friday, January 11, 2019 8:45 AM > To: Dumitrescu, Cristian > Cc: Van Haaren, Harry ; dev@dpdk.org; Pattan, > Reshma ; thomas@monjalon.net > Subject: Re: [PATCH v2] mbuf: fix compile by removing struct from functio= n > > > /** > > > @@ -2395,11 +2393,9 @@ rte_mbuf_sched_set(struct rte_mbuf *m, > > > uint32_t queue_id, > > > uint8_t traffic_class, > > > uint8_t color) > > > { > > > - m->hash.sched =3D (struct rte_mbuf_sched){ > > > - .queue_id =3D queue_id, > > > - .traffic_class =3D traffic_class, > > > - .color =3D color, > > > - }; > > > + m->hash.sched.queue_id =3D queue_id; > > > + m->hash.sched.traffic_class =3D traffic_class; > > > + m->hash.sched.color =3D color; > > > } > > > > > > #ifdef __cplusplus > > > -- > > > 2.17.1 > > > > NAK. > > > > I am fine with V1, but against this V2 due to the reasons previously > discussed and agreed by Olivier [1] regarding performance. We should not > sacrifice performance for the sake of cosmetics criteria that can met som= e > other way. > > > > In order to meet readability requirements from Olivier, I suggest we go > back to V1 and we explicitly mention the size of the mbuf->sched field > inslide the mbuf as 8 bytes: > > > > struct rte_mbuf { > > ... > > struct rte_mbuf_sched sched; /**< Hierarchical scheduler: 8 bytes */ > > ... > > } > > > > Olivier, is this a good compromise? >=20 > Looks good to me, yes. >=20 >=20 > Thanks See above, I'll send v3 with updated comment.