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 AE30E1B9A4 for ; Thu, 20 Dec 2018 09:32:53 +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 1gZtms-00074X-7f; Thu, 20 Dec 2018 09:34:35 +0100 Received: by droids-corp.org (sSMTP sendmail emulation); Thu, 20 Dec 2018 09:32:51 +0100 Date: Thu, 20 Dec 2018 09:32:51 +0100 From: Olivier Matz To: "Dumitrescu, Cristian" Cc: "Pattan, Reshma" , "dev@dpdk.org" , "jerin.jacob@caviumnetworks.com" , "Rao, Nikhil" , "Singh, Jasvinder" Message-ID: <20181220083251.c3gypusmlvb6fc2n@platinum> References: <1544193116-7058-1-git-send-email-reshma.pattan@intel.com> <20181213180851.4862-1-reshma.pattan@intel.com> <20181213180851.4862-2-reshma.pattan@intel.com> <3EB4FA525960D640B5BDFFD6A3D891268E8153ED@IRSMSX108.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3EB4FA525960D640B5BDFFD6A3D891268E8153ED@IRSMSX108.ger.corp.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH v3 2/2] mbuf: implement generic format for sched field 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, 20 Dec 2018 08:32:53 -0000 Hi Cristian, On Fri, Dec 14, 2018 at 10:52:18PM +0000, Dumitrescu, Cristian wrote: > > --- a/lib/librte_mbuf/rte_mbuf.h > > +++ b/lib/librte_mbuf/rte_mbuf.h > > @@ -34,6 +34,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -575,13 +576,24 @@ struct rte_mbuf { > > */ > > } fdir; /**< Filter identifier if FDIR enabled */ > > struct { > > - uint32_t lo; > > - uint32_t hi; > > + uint32_t queue_id; /**< Queue ID. */ > > + uint8_t traffic_class; > > + /**< Traffic class ID. Traffic class 0 > > + * is the highest priority traffic class. > > + */ > > + uint8_t color; > > + /**< Color. @see enum rte_color.*/ > > + uint16_t reserved; /**< Reserved. */ > > + } sched; /**< Hierarchical scheduler */ > > New idea: let's make this an explicit struct rte_mbuf_sched that we instantiate here: struct rte_mbuf_sched sched; Sorry, I don't really agree here. I think having it inside the mbuf struct helps to estimate the size of the union here, and it would be less consistent with other fields. [...] > > +/** > > + * Get the values of mbuf sched queue_id, traffic_class and color. > > + * @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, > > + enum rte_color *color) > > +{ > > + *queue_id = m->hash.sched.queue_id; > > + *traffic_class = m->hash.sched.traffic_class; > > + *color = (enum rte_color)m->hash.sched.color; > > For performance reasons, let's ask the compiler to read all sched fields in a single operation as opposed to 3: > > struct rte_mbuf_sched sched = m->hash.sched; > *queue_id = sched.queue_id; > *traffic_class = sched.traffic_class; > *color = (enum rte_colo)sched.color; Are you sure it would me more efficient? Thanks, Olivier