From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH net-next 01/14] qed: Add CONFIG_QED_SRIOV Date: Tue, 10 May 2016 15:10:53 -0400 (EDT) Message-ID: <20160510.151053.113553471670048412.davem@davemloft.net> References: <20160510.140643.1891656073031893382.davem@davemloft.net> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, Ariel.Elior@qlogic.com To: Yuval.Mintz@qlogic.com Return-path: Received: from shards.monkeyblade.net ([149.20.54.216]:42480 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751262AbcEJTK4 (ORCPT ); Tue, 10 May 2016 15:10:56 -0400 In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: From: Yuval Mintz Date: Tue, 10 May 2016 18:15:08 +0000 >> > I'm not entirely convinced this is true; If we'll not enforce the >> > alignment of this 64-bit field, it's possible there will be >> > differences between 32-bit and 64-bit machines versions of this struct. >> > You have to recall that this is going to be copied via DMA between PF >> > and VF, so they must have the exact same representation of the structure. >> >> Then use properly sized types to fill in all the space in the structure, that's how >> you guarantee layout, not aligned_u64. Also, do not use the packed attribute. >> >> struct foo { >> u32 x; >> u32 y; >> u64 z; >> }; >> >> 'z' will always be 64-bit aligned. > > Perhaps my bit-numeric is a bit weak - why is it so? foo is 64-bit aligned, therefore a properly aligned struct member will be so as well. We absolutely depend upon this for several data structures in the kernel.