From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id F0880137D for ; Thu, 10 Jan 2019 19:40:20 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2019 10:40:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,462,1539673200"; d="scan'208";a="125058557" Received: from irsmsx107.ger.corp.intel.com ([163.33.3.99]) by orsmga002.jf.intel.com with ESMTP; 10 Jan 2019 10:40:08 -0800 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.205]) by IRSMSX107.ger.corp.intel.com ([169.254.10.127]) with mapi id 14.03.0415.000; Thu, 10 Jan 2019 18:40:07 +0000 From: "Dumitrescu, Cristian" To: "Van Haaren, Harry" , "dev@dpdk.org" CC: "Pattan, Reshma" , "thomas@monjalon.net" , "olivier.matz@6wind.com" Thread-Topic: [PATCH v2] mbuf: fix compile by removing struct from function Thread-Index: AQHUqQ87tsKauyCgT0CNs8RMdxu5RKWo0uJA Date: Thu, 10 Jan 2019 18:40:06 +0000 Message-ID: <3EB4FA525960D640B5BDFFD6A3D891268E828A86@IRSMSX108.ger.corp.intel.com> References: <20190110165051.4859-1-harry.van.haaren@intel.com> <20190110180658.23302-1-harry.van.haaren@intel.com> In-Reply-To: <20190110180658.23302-1-harry.van.haaren@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzAyOTNjOWMtNmI2My00ZTM1LWI5MDktYjZmMmFhNzgxYTc4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiV0ZkSTBkREdcL2srNWZnUEhuenZqNFcrZWU0UmdHd2JXcGNDUXBrQkJjVjMyUVJmcGRYSUtoNTN5cVdYN1phZVkifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [163.33.239.182] 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: Thu, 10 Jan 2019 18:40:21 -0000 > -----Original Message----- > From: Van Haaren, Harry > Sent: Thursday, January 10, 2019 6:07 PM > To: dev@dpdk.org > Cc: Van Haaren, Harry ; Pattan, Reshma > ; Dumitrescu, Cristian > ; thomas@monjalon.net; > olivier.matz@6wind.com > Subject: [PATCH v2] mbuf: fix compile by removing struct from function >=20 > Although C compilation works with the struct rte_mbuf_sched > declared inside the struct rte_mbuf namespace, C++ fails to > compile. >=20 > This fix removes the temporary struct rte_mbuf_sched, instead > reading from the mbuf directly for each struct member. As the > struct is now not used directly, the C++ compiler doesn't need > to know about the struct, resolving the issue. >=20 > Fixes: 5d3f72100904 ("mbuf: implement generic format for sched field") >=20 > Signed-off-by: Harry van Haaren >=20 > --- >=20 > Cc: reshma.pattan@intel.com > Cc: cristian.dumitrescu@intel.com > Cc: thomas@monjalon.net > Cc: olivier.matz@6wind.com >=20 > See mailing list for v1 discussion, perhaps this solution is more > readable due to leaving sched struct in-line in the mbuf struct. > --- > lib/librte_mbuf/rte_mbuf.h | 16 ++++++---------- > 1 file changed, 6 insertions(+), 10 deletions(-) >=20 > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h > index bc562dc8a..1b260efd5 100644 > --- a/lib/librte_mbuf/rte_mbuf.h > +++ b/lib/librte_mbuf/rte_mbuf.h > @@ -2344,11 +2344,9 @@ rte_mbuf_sched_get(const struct rte_mbuf *m, > uint32_t *queue_id, > uint8_t *traffic_class, > uint8_t *color) > { > - struct rte_mbuf_sched sched =3D m->hash.sched; > - > - *queue_id =3D sched.queue_id; > - *traffic_class =3D sched.traffic_class; > - *color =3D sched.color; > + *queue_id =3D m->hash.sched.queue_id; > + *traffic_class =3D m->hash.sched.traffic_class; > + *color =3D m->hash.sched.color; > } >=20 > /** > @@ -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; > } >=20 > #ifdef __cplusplus > -- > 2.17.1 NAK. I am fine with V1, but against this V2 due to the reasons previously discus= sed and agreed by Olivier [1] regarding performance. We should not sacrific= e performance for the sake of cosmetics criteria that can met some other wa= y. In order to meet readability requirements from Olivier, I suggest we go bac= k 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? Regards, Cristian [1] https://mails.dpdk.org/archives/dev/2018-December/121806.html