[openib-general] Re: [PATCH 1/2] (fixed) mthca: max_inline_data support

Grant Grundler iod00d at hp.com
Tue May 17 12:24:49 PDT 2005


On Tue, May 17, 2005 at 10:08:58AM -0700, Roland Dreier wrote:
>     Michael> Another problem is that fls may return 32 and you end up
>     Michael> with 1 << 32 which AFAIK has undefined behaviour in C.

AFAIK, this is only true for ILP32 C compilers.
LP64 C compiler must allow >32 values.

...
>  - R.
> 
> --- infiniband/hw/mthca/mthca_qp.c	(revision 2360)
> +++ infiniband/hw/mthca/mthca_qp.c	(working copy)
> @@ -1210,6 +1210,11 @@ static int mthca_alloc_qp_common(struct 
>  static int mthca_set_qp_size(struct mthca_dev *dev, struct ib_qp_cap *cap,
>  			     struct mthca_qp *qp)
>  {
> +	/* Sanity check QP size before proceeding */
> +	if (cap->max_send_wr  > 65536 || cap->max_recv_wr  > 65536 ||
> +	    cap->max_send_sge > 64    || cap->max_recv_sge > 64)
> +		return -EINVAL;

This doesn't seem right if it's going to work for both 32 and
64-bit binaries. sizeof(long) should be in there somewhere.
Unless the above is a generic "safe" limit.

I'm looking at mthca_alloc_wqe_buf() and not quite
knowing what the real limits are here.


grant



More information about the general mailing list