[ofa-general] Re: [PATCH 2/2] IB/mlx4: pass more data from user to kernel

Eli Cohen eli at dev.mellanox.co.il
Fri May 18 05:26:14 PDT 2007


On 5/18/07, Roland Dreier <rdreier at cisco.com> wrote:
>
> This looks a little busted:
>
> >  struct mlx4_ib_create_qp {
> >      __u64   buf_addr;
> >      __u64   db_addr;
> > +    __u64   rq_size;
> > +    __u64   sq_size;
> > +    __u8    rcv_wqe_shift;
> > +    __u8    log_wqe_bb;
> >  };
>
> the structure ends up not aligned to a multiple of 8 bytes, so it ends
> up having a size of 36 bytes on 32-bit setups and 40 bytes on 64-bit
> setups, which might mess up 32-bit userspace on 64-bit kernels.
>
> Also I don't understand why you made rq_size and sq_size 64 bits
> anyway?  It seems they could never be more than 16 bits, although to
> be safe perhaps 32 bits is best.  So I'll fix this up to look like
> this (with names that seem more self-documenting to me):
>
> struct mlx4_ib_create_qp {
>        __u64   buf_addr;
>        __u64   db_addr;
>        __u32   rq_wqe_count;
>        __u32   rq_wqe_shift;
>        __u32   sq_wqebb_count;
>        __u32   sq_wqebb_shift;
> };
>
> am I missing some hidden reason to make those fields 64 bits?


Well, I was just not sure why the casting to ulntptr_t was needed and
decided to use 64 bit varaiables which obviously are an overkill.

_______________________________________________
> general mailing list
> general at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
>
> To unsubscribe, please visit
> http://openib.org/mailman/listinfo/openib-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20070518/d8408511/attachment.html>


More information about the general mailing list