From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier Matz Subject: Re: [PATCH v6 2/2] mbuf: implement generic format for sched field Date: Thu, 20 Dec 2018 13:41:28 +0100 Message-ID: <20181220124128.itv6qgakvn4qb35r@platinum> References: <20181219153418.52747-1-reshma.pattan@intel.com> <20181219154237.836-1-reshma.pattan@intel.com> <20181219154237.836-2-reshma.pattan@intel.com> <20181220082914.5hluj6nmn6s4rdrj@platinum> <3EB4FA525960D640B5BDFFD6A3D891268E817B4F@IRSMSX108.ger.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "Pattan, Reshma" , "dev@dpdk.org" , "jerin.jacob@caviumnetworks.com" , "Rao, Nikhil" , "thomas@monjalon.net" , "Singh, Jasvinder" To: "Dumitrescu, Cristian" Return-path: Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id 726BA1BC73 for ; Thu, 20 Dec 2018 13:41:33 +0100 (CET) Content-Disposition: inline In-Reply-To: <3EB4FA525960D640B5BDFFD6A3D891268E817B4F@IRSMSX108.ger.corp.intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Cristian, [...] On Thu, Dec 20, 2018 at 11:28:01AM +0000, Dumitrescu, Cristian wrote: > > > + * @param m > > > + * Mbuf to read > > > + * @param queue_id > > > + * Returns the queue id > > > + * @param traffic_class > > > + * Returns the traffic class id > > > + * @param color > > > + * Returns the colour id > > > + */ > > > +static inline void > > > +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; > > > > I don't think there is a need to have an additional local copy. > > > > *queue_id = m->hash.sched.queue_id; > > *traffic_class = m->hash.sched.traffic_class; > > *color = m->hash.sched.color; > > > > With local copy, compiler typically generates a single 8-byte read instruction. Without the local copy, compiler typically generates 3x read instructions. > > The set/get functions are used in some performance critical actions, so this is the reason to make sure we get them right. Ok, that makes sense, thanks for clarification. Regards, Olivier