On Sat, Jul 21, 2012 at 05:15:26AM +0000, Hefty, Sean wrote:
> > struct c4iw_create_raw_qp_req {
> >          struct ibv_create_qp ibv_req;
> >          __u32 port;
> >          __u32 vlan_pri;
> >          __u32 nfids;
> > };
> 
> struct ibv_create_qp contains a u64, which will force the size of
> the structure to 64-bit.  You should to add an additional 32-bits of
> padding.

Specifically, the padding Sean is talking about is here:

struct c4iw_create_raw_qp_req {
        struct ibv_create_qp ibv_req;
        __u32 port;
        __u32 vlan_pri;
        __u32 nfids;
        __u32 _rsvd0;  // <<<---- pad
};

And similarly in your driver's header. Things are setup so that
device_data does not have to be a multple of 8 bytes long, but it is
guarenteed to be 8 byte aligned.

However as long as you include ibv_req in your struct you have to be a
multiple of 8 bytes long so, you may want to construct your
driver_data the same way that userspace does. Remove the ibv_req from
the struct and cast from driver_data. This avoids this sort of
problem completely.

Also, always ensure structs you are passing between kernel and user
space have no implicit padding at all.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to