From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id E81C21B91F for ; Fri, 11 Jan 2019 09:44:43 +0100 (CET) Received: from rsa59-2-82-233-193-189.fbx.proxad.net ([82.233.193.189] helo=droids-corp.org) by mail.droids-corp.org with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ghsSX-0004sz-Jf; Fri, 11 Jan 2019 09:46:35 +0100 Received: by droids-corp.org (sSMTP sendmail emulation); Fri, 11 Jan 2019 09:44:41 +0100 Date: Fri, 11 Jan 2019 09:44:41 +0100 From: Olivier Matz To: "Dumitrescu, Cristian" Cc: "Van Haaren, Harry" , "dev@dpdk.org" , "Pattan, Reshma" , "thomas@monjalon.net" Message-ID: <20190111084441.qi7ufsuqbyhb5bqo@platinum> References: <20190110165051.4859-1-harry.van.haaren@intel.com> <20190110180658.23302-1-harry.van.haaren@intel.com> <3EB4FA525960D640B5BDFFD6A3D891268E828A86@IRSMSX108.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3EB4FA525960D640B5BDFFD6A3D891268E828A86@IRSMSX108.ger.corp.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) 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 08:44:44 -0000 Hi, On Thu, Jan 10, 2019 at 06:40:06PM +0000, Dumitrescu, Cristian wrote: > > > > -----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 > > > > Although C compilation works with the struct rte_mbuf_sched > > declared inside the struct rte_mbuf namespace, C++ fails to > > compile. > > > > 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. > > > > Fixes: 5d3f72100904 ("mbuf: implement generic format for sched field") > > > > Signed-off-by: Harry van Haaren > > > > --- > > > > Cc: reshma.pattan@intel.com > > Cc: cristian.dumitrescu@intel.com > > Cc: thomas@monjalon.net > > Cc: olivier.matz@6wind.com > > > > 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(-) > > > > 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 = m->hash.sched; > > - > > - *queue_id = sched.queue_id; > > - *traffic_class = sched.traffic_class; > > - *color = sched.color; > > + *queue_id = m->hash.sched.queue_id; > > + *traffic_class = m->hash.sched.traffic_class; > > + *color = m->hash.sched.color; > > } > > > > /** > > @@ -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 = (struct rte_mbuf_sched){ > > - .queue_id = queue_id, > > - .traffic_class = traffic_class, > > - .color = color, > > - }; > > + m->hash.sched.queue_id = queue_id; > > + m->hash.sched.traffic_class = traffic_class; > > + m->hash.sched.color = 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 some 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? Looks good to me, yes. Thanks