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 532D82BDD for ; Tue, 6 Dec 2016 13:41:04 +0100 (CET) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP; 06 Dec 2016 04:41:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,310,1477983600"; d="scan'208";a="39312643" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by orsmga005.jf.intel.com with ESMTP; 06 Dec 2016 04:41:01 -0800 Received: from irsmsx155.ger.corp.intel.com (163.33.192.3) by IRSMSX102.ger.corp.intel.com (163.33.3.155) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 6 Dec 2016 12:41:01 +0000 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.43]) by irsmsx155.ger.corp.intel.com ([169.254.14.237]) with mapi id 14.03.0248.002; Tue, 6 Dec 2016 12:41:00 +0000 From: "Ananyev, Konstantin" To: "Richardson, Bruce" CC: =?iso-8859-1?Q?N=E9lio_Laranjeiro?= , "dev@dpdk.org" , Olivier Matz , "Lu, Wenzhuo" , Adrien Mazarguil Thread-Topic: [dpdk-dev] [PATCH] net: introduce big and little endian types Thread-Index: AQHSOpqjJZEmwRN0kU6+9TJvUFcv9KD4oKeAgADKCYCAAX/vkIAAD1IAgAALoxA= Date: Tue, 6 Dec 2016 12:41:00 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772583F0E46DC@irsmsx105.ger.corp.intel.com> References: <2601191342CEEE43887BDE71AB9772583F0E3F68@irsmsx105.ger.corp.intel.com> <20161205120603.GL21794@autoinstall.dev.6wind.com> <2601191342CEEE43887BDE71AB9772583F0E4632@irsmsx105.ger.corp.intel.com> <20161206115502.GA12224@bricha3-MOBL3.ger.corp.intel.com> In-Reply-To: <20161206115502.GA12224@bricha3-MOBL3.ger.corp.intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] net: introduce big and little endian types 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: Tue, 06 Dec 2016 12:41:04 -0000 > -----Original Message----- > From: Richardson, Bruce > Sent: Tuesday, December 6, 2016 11:55 AM > To: Ananyev, Konstantin > Cc: N=E9lio Laranjeiro ; dev@dpdk.org; Olivie= r Matz ; Lu, Wenzhuo > ; Adrien Mazarguil > Subject: Re: [dpdk-dev] [PATCH] net: introduce big and little endian type= s >=20 > On Tue, Dec 06, 2016 at 11:23:42AM +0000, Ananyev, Konstantin wrote: > > Hi Neilo, > > > > > > Hi Neilo, > > > > > > > > > > This commit introduces new rte_{le,be}{16,32,64}_t types and upda= tes > > > > > rte_{le,be,cpu}_to_{le,be,cpu}_*() and network header structures > > > > > accordingly. > > > > > > > > > > Specific big/little endian types avoid uncertainty and conversion= mistakes. > > > > > > > > > > No ABI change since these are simply typedefs to the original typ= es. > > > > > > > > It seems like quite a lot of changes... > > > > Could you probably explain what will be the benefit in return? > > > > Konstantin > > > > > > Hi Konstantin, > > > > > > The benefit is to provide documented byte ordering for data types > > > software is manipulating to determine when network to CPU (or CPU to > > > network) conversion must be performed. > > > > Ok, but is it really worth it? > > User can still make a mistake and forget to call ntoh()/hton() at some = particular place. > > From other side most people do know that network protocols headers are = usually in BE format. > > I would understand the effort, if we'll have some sort of tool that wou= ld do some sort of static code analysis > > based on these special types or so. > > Again, does it mean that we should go and change uint32_t to rte_le_32 = inside all Intel PMDs > > (and might be in some others too) to be consistent? > > Konstantin > > >=20 > I actually quite like this patch as I think it will help make things > clear when the user is possibly doing something wrong. I don't think we > need to globally change all PMDs to use the types, though. Ok, so where do you believe we should draw a line? Why let say inside lib/librte_net people should use these typedefs, but inside drivers/net/ixgbe they don't? =20 >=20 > One thing I'm wondering though, is if we might want to take this > further. For little endian environments, we could define the big endian > types as structs using typedefs, and similarly the le types on be > platforms, so that assigning from the non-native type to the native one > without a transformation function would cause a compiler error. Not sure I understand you here. Could you possibly provide some example? Konstantin