From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752648AbdI0Lcr (ORCPT ); Wed, 27 Sep 2017 07:32:47 -0400 Received: from mga11.intel.com ([192.55.52.93]:43583 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751521AbdI0Lcq (ORCPT ); Wed, 27 Sep 2017 07:32:46 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,445,1500966000"; d="scan'208";a="904349160" Date: Wed, 27 Sep 2017 14:32:41 +0300 From: Mika Westerberg To: David Miller Cc: gregkh@linuxfoundation.org, andreas.noever@gmail.com, michael.jamet@intel.com, yehezkel.bernat@intel.com, amir.jer.levy@intel.com, Mario.Limonciello@dell.com, lukas@wunner.de, andriy.shevchenko@linux.intel.com, andrew@lunn.ch, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH v2 02/16] thunderbolt: Add support for XDomain properties Message-ID: <20170927113241.GB4630@lahna.fi.intel.com> References: <20170925110738.68382-1-mika.westerberg@linux.intel.com> <20170925110738.68382-3-mika.westerberg@linux.intel.com> <20170926.213354.305351416790211828.davem@davemloft.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170926.213354.305351416790211828.davem@davemloft.net> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 26, 2017 at 09:33:54PM -0700, David Miller wrote: > From: Mika Westerberg > Date: Mon, 25 Sep 2017 14:07:24 +0300 > > > +struct tb_property_entry { > > + u32 key_hi; > > + u32 key_lo; > > + u16 length; > > + u8 reserved; > > + u8 type; > > + u32 value; > > +} __packed; > > + > > +struct tb_property_rootdir_entry { > > + u32 magic; > > + u32 length; > > + struct tb_property_entry entries[]; > > +} __packed; > > + > > +struct tb_property_dir_entry { > > + u32 uuid[4]; > > + struct tb_property_entry entries[]; > > +} __packed; > > There is no apparent need for __packed here, and __packed should be > avoided unless absolutely necessary as it pessimizes the code > significantly on some architectures. > > Please remove __packed from these datastructures unless you can > prove it is absolutely needed and, in such case, please document > in a comment why that requirement exists. Because from the layout > of these types, everything will be packed in just fine without > __packed. I will thanks. Just for my education, is there some rule which tells when __packed is to be used? For example the above structures are all 32-bit aligned but how about something like: struct foo { u32 value1; u8 value2; }; If the on-wire format requires such structures I assume __packed is needed here? Thanks!