RE: [PATCH 2/9] ocrdma: Driver for Emulex OneConnect RDMA adapter

2012-03-23 Thread David Laight
struct { u64 fielda u32 field; }; In this case: On 64 bit: the u64 is aligned to 8 and the u32 is aligned to 4. So the structure is aligned to 8. A pad is inserted at the end of the struct to bring it out. On 32 bit, the u64 is aligned to 4, so the struct is aligned to

RE: [PATCH 2/9] ocrdma: Driver for Emulex OneConnect RDMA adapter

2012-03-23 Thread Parav.Pandit
-Original Message- From: Jason Gunthorpe [mailto:jguntho...@obsidianresearch.com] Sent: Friday, March 23, 2012 4:14 AM To: Pandit, Parav Cc: david.lai...@aculab.com; rol...@purestorage.com; linux- r...@vger.kernel.org; net...@vger.kernel.org Subject: Re: [PATCH 2/9] ocrdma: Driver

Re: [PATCH 2/9] ocrdma: Driver for Emulex OneConnect RDMA adapter

2012-03-23 Thread Jason Gunthorpe
On Fri, Mar 23, 2012 at 07:03:37AM -0700, parav.pan...@emulex.com wrote: David is saying you will get a 12 byte struct and fieldb will be unaligned. Since 12 is aligned to 4 no padding is added. So I decided to experiment above example before implementing in driver. However I find

RE: [PATCH 2/9] ocrdma: Driver for Emulex OneConnect RDMA adapter

2012-03-23 Thread Parav.Pandit
...@vger.kernel.org Subject: Re: [PATCH 2/9] ocrdma: Driver for Emulex OneConnect RDMA adapter On Fri, Mar 23, 2012 at 07:03:37AM -0700, parav.pan...@emulex.com wrote: David is saying you will get a 12 byte struct and fieldb will be unaligned. Since 12 is aligned to 4 no padding is added

RE: [PATCH 2/9] ocrdma: Driver for Emulex OneConnect RDMA adapter

2012-03-22 Thread Parav.Pandit
-Original Message- From: David Laight [mailto:david.lai...@aculab.com] Sent: Wednesday, March 21, 2012 10:02 PM To: Roland Dreier; Pandit, Parav Cc: linux-rdma@vger.kernel.org; net...@vger.kernel.org Subject: RE: [PATCH 2/9] ocrdma: Driver for Emulex OneConnect RDMA adapter

Re: [PATCH 2/9] ocrdma: Driver for Emulex OneConnect RDMA adapter

2012-03-22 Thread Jason Gunthorpe
On Thu, Mar 22, 2012 at 01:52:30PM -0700, parav.pan...@emulex.com wrote: This can be used to force 32bit alignment in amd64 code in order to match definitions in 32bit userspace. For new things it would make sense to force 64bit alignment of 64bit fields for 32bit code. o.k. so I'll

RE: [PATCH 2/9] ocrdma: Driver for Emulex OneConnect RDMA adapter

2012-03-22 Thread Parav.Pandit
-Original Message- From: Jason Gunthorpe [mailto:jguntho...@obsidianresearch.com] Sent: Friday, March 23, 2012 2:28 AM To: Pandit, Parav Cc: david.lai...@aculab.com; rol...@purestorage.com; linux- r...@vger.kernel.org; net...@vger.kernel.org Subject: Re: [PATCH 2/9] ocrdma: Driver

RE: [PATCH 2/9] ocrdma: Driver for Emulex OneConnect RDMA adapter

2012-03-22 Thread Parav.Pandit
...@vger.kernel.org; net...@vger.kernel.org Subject: RE: [PATCH 2/9] ocrdma: Driver for Emulex OneConnect RDMA adapter -Original Message- From: Jason Gunthorpe [mailto:jguntho...@obsidianresearch.com] Sent: Friday, March 23, 2012 2:28 AM To: Pandit, Parav Cc: david.lai...@aculab.com; rol

Re: [PATCH 2/9] ocrdma: Driver for Emulex OneConnect RDMA adapter

2012-03-22 Thread Jason Gunthorpe
On Thu, Mar 22, 2012 at 02:20:28PM -0700, parav.pan...@emulex.com wrote: I got a question here lately. aligned directive will ensure that it will fall on boundary. Say aligned(4) ensures that structure is aligned to 4 byte boundary. Compiler can (at least theoretically) still have 4 byte

Re: [PATCH 2/9] ocrdma: Driver for Emulex OneConnect RDMA adapter

2012-03-22 Thread Roland Dreier
On Thu, Mar 22, 2012 at 3:44 PM, Jason Gunthorpe jguntho...@obsidianresearch.com wrote: For hardware facing structures I'd combine this with a static assert to verify structure size at compile time. So.. 1) Avoid using attributes unless the structure has unaligned members. 2) Avoid creating

Re: [PATCH 2/9] ocrdma: Driver for Emulex OneConnect RDMA adapter

2012-03-21 Thread Roland Dreier
On Tue, Mar 20, 2012 at 3:39 PM, parav.pan...@emulex.com wrote: From: Parav Pandit parav.pan...@emulex.com - Header file for userspace library and kernel driver interface. +struct ocrdma_alloc_ucontext_resp { +       u32 dev_id; +       u32 wqe_size; +       u32 max_inline_data; +      

RE: [PATCH 2/9] ocrdma: Driver for Emulex OneConnect RDMA adapter

2012-03-21 Thread David Laight
- Header file for userspace library and kernel driver interface. +struct ocrdma_alloc_ucontext_resp { +       u32 dev_id; +       u32 wqe_size; +       u32 max_inline_data; +       u32 dpp_wqe_size; +       u64 ah_tbl_page; +       u32 ah_tbl_len; +       u32 rsvd; +      

RE: [PATCH 2/9] ocrdma: Driver for Emulex OneConnect RDMA adapter

2012-03-21 Thread Hefty, Sean
+struct ocrdma_alloc_ucontext_resp { + u32 dev_id; + u32 wqe_size; + u32 max_inline_data; + u32 dpp_wqe_size; + u64 ah_tbl_page; + u32 ah_tbl_len; + u32 rsvd; + u8 fw_ver[32]; + u32 rqe_size; + u64 rsvd1; +} __packed; Is there some reason to