From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 70F541BB12 for ; Thu, 20 Dec 2018 12:19:57 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Dec 2018 03:19:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,376,1539673200"; d="scan'208";a="119930213" Received: from irsmsx107.ger.corp.intel.com ([163.33.3.99]) by FMSMGA003.fm.intel.com with ESMTP; 20 Dec 2018 03:19:54 -0800 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.26]) by IRSMSX107.ger.corp.intel.com ([169.254.10.125]) with mapi id 14.03.0415.000; Thu, 20 Dec 2018 11:19:54 +0000 From: "Dumitrescu, Cristian" To: Olivier Matz CC: "Pattan, Reshma" , "dev@dpdk.org" , "jerin.jacob@caviumnetworks.com" , "Rao, Nikhil" , "Singh, Jasvinder" Thread-Topic: [dpdk-dev] [PATCH v3 2/2] mbuf: implement generic format for sched field Thread-Index: AQHUkw70vlcSH0uzkkSdhupd250NIaV+1uWAgAiALYCAACxpsA== Date: Thu, 20 Dec 2018 11:19:53 +0000 Message-ID: <3EB4FA525960D640B5BDFFD6A3D891268E817B36@IRSMSX108.ger.corp.intel.com> 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> <20181220083251.c3gypusmlvb6fc2n@platinum> In-Reply-To: <20181220083251.c3gypusmlvb6fc2n@platinum> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNjBiMmI0MGYtY2QxNC00NTFjLTk5ZDYtZTI0Mzk1NTZiMTE0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiQ2NacXhKS0NwTnp5TXZ2WDNJU2oxaDJJVHp3ZFBvQUNmeldNWE9kN1FlM2tTRUZwWEowY1N2Y084QVNyV0VNTyJ9 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 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 11:19:58 -0000 Hi Olivier, Thanks for your comments. > -----Original Message----- > From: Olivier Matz [mailto:olivier.matz@6wind.com] > Sent: Thursday, December 20, 2018 8:33 AM > To: Dumitrescu, Cristian > Cc: Pattan, Reshma ; dev@dpdk.org; > jerin.jacob@caviumnetworks.com; Rao, Nikhil ; Singh= , > Jasvinder > Subject: Re: [dpdk-dev] [PATCH v3 2/2] mbuf: implement generic format for > sched field >=20 > Hi Cristian, >=20 > 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; >=20 > 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. >=20 All I need is a name for this structure that I can use in some other parts = of the code, i.e. for the set/get functions below. I am not sure if we can declare and also instantiate this structure within = the mbuf structure to fit bot my need and your preference. Basically, I am = not sure if syntax like this is legal in C language; if it is, it would fit= both purposes: struct rte_mbuf { ... struct rte_mbuf_sched { ... } sched; ... }; Would this syntax limit the scope of struct rte_mbuf_sched just to within t= he struct rte_mbuf? >=20 > [...] >=20 > > > +/** > > > + * 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 =3D m->hash.sched.queue_id; > > > + *traffic_class =3D m->hash.sched.traffic_class; > > > + *color =3D (enum rte_color)m->hash.sched.color; > > > > For performance reasons, let's ask the compiler to read all sched field= s in a > single operation as opposed to 3: > > > > struct rte_mbuf_sched sched =3D m->hash.sched; > > *queue_id =3D sched.queue_id; > > *traffic_class =3D sched.traffic_class; > > *color =3D (enum rte_colo)sched.color; >=20 > Are you sure it would me more efficient? Yes, this is one of the reasons: this structure is 8-byte in size and this = function is used in performance critical actions, so we need to read this s= tructure in a single 8-byte read operation (my proposal) as opposed to comp= iler generating 3 separate read operations. Makes sense? Same for the rte_mbuf_sched_set() function.=20 >=20 >=20 > Thanks, > Olivier Regards, Cristian