From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wj0-f176.google.com (mail-wj0-f176.google.com [209.85.210.176]) by dpdk.org (Postfix) with ESMTP id 7D53A2BB3 for ; Tue, 6 Dec 2016 14:14:25 +0100 (CET) Received: by mail-wj0-f176.google.com with SMTP id tk12so25332623wjb.3 for ; Tue, 06 Dec 2016 05:14:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=rgweBHyS8dYnS6xu5pO5dVcqHuExmDtp9y5G36zTyeo=; b=tqwU6Wx9M+6hzWJ3mUv6t7CfohWOaq9ygXqeQVUPz925qFQRImFWURw3LSg2k1K679 IlFwMqZ0jTZMqs24lQo7OvGq/BNGH8BQcBNsq8BVf5J0+C+TjX15xKHtu72jzaSchwua z3+Ip5/VDblBC4jCISAr2Zz1N1+Ry9wg3Ugd/U8v4zViA62OrrYks1gQ59AiOIvSSAQb kM3HJDYl4a9fdJIShz3ooBgK2vuksRS6I72uVkiDdY1iHqFABqsyaSLyQPl0gEFJ/Sgj WOrLKOjqf30ra+cR+OGDoE0qYXUpci0iM5VJGM3rZKzfQROoE/9/ZjyxceqXAh87lmNq CgoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=rgweBHyS8dYnS6xu5pO5dVcqHuExmDtp9y5G36zTyeo=; b=dVQBGWc2zXs89BdotJzOfWpR6it6vSh0TeOXQ8JbqTxokxInnSnaYSh6/n1AEhS41s 73YllkageqL475xKFOuZDBZ5dRfaL4FHNkN30Gh2l21L7hgNlyQ9XMv3vNUfbasxfgvl OiNuK9yZ42C9+aiN/+SqzQC4PuQq+BFpjvvpgNJH1Q+vGCMTsYzVUG187UXh5nPRhlz+ rQe9tnsAvyviVsAjpuqlnPDWWrUnmh83IHrBbHLjkLvCVPmA4PtHeCgTFPX+kCyNj5oN hzNp2jw/h3VS9SlLx1cgfvVy631w89RzLOET5dnKbCBNIF14ZGsEw+yI6U3KNTA5UrdE iHfQ== X-Gm-Message-State: AKaTC01gDtwm7BEt4uXD9cRsQf7LFG673GEgvhSReoCVYbzRLZUzCdnZbtfvJAfNPDo8dQMc X-Received: by 10.194.179.37 with SMTP id dd5mr53527598wjc.215.1481030065062; Tue, 06 Dec 2016 05:14:25 -0800 (PST) Received: from autoinstall.dev.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id ct7sm25789293wjc.2.2016.12.06.05.14.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Dec 2016 05:14:24 -0800 (PST) Date: Tue, 6 Dec 2016 14:14:17 +0100 From: =?iso-8859-1?Q?N=E9lio?= Laranjeiro To: Bruce Richardson Cc: "Ananyev, Konstantin" , "dev@dpdk.org" , Olivier Matz , "Lu, Wenzhuo" , Adrien Mazarguil Message-ID: <20161206131416.GR21794@autoinstall.dev.6wind.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> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20161206115502.GA12224@bricha3-MOBL3.ger.corp.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) 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 13:14:25 -0000 Hi Konstantin, Bruce, On Tue, Dec 06, 2016 at 11:55:02AM +0000, Bruce Richardson wrote: > 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 updates > > > > > 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 types. > > > > > > > > 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 would 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 > > > > 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. I agree, at least APIs should use this, PMDs can do as they want. > 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. > > /Bruce If I understand you correctly, this will break hton like functions which expects an uint*_t not a structure. -- Nélio Laranjeiro 6WIND