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

Roland Dreier rdreier at cisco.com
Thu May 17 15:56:47 PDT 2007


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?



More information about the general mailing list