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

Roland Dreier roland at topspin.com
Mon May 16 10:25:26 PDT 2005


    Michael> Roland, roundup_pow_of_two assumes that it gets a non-0
    Michael> parameter, while I think its legal to have one of
    Michael> max_recv_wr / max_send_wr equal 0.  Is that right?

Yes, good point.  I forgot about the possibility of zero-length work queues.

    Michael> Lets keep lines <= 80, please?

I'm willing to go a little over 80 columns to save vertical space --
this line was a 95-character monster so I did fix it up, but to me
it's not worth breaking up a line just because it's 84 characters or
so.

Anyway here's what I checked in:

--- infiniband/hw/mthca/mthca_qp.c	(revision 2347)
+++ infiniband/hw/mthca/mthca_qp.c	(working copy)
@@ -1211,8 +1211,10 @@ static int mthca_set_qp_size(struct mthc
 			     struct mthca_qp *qp)
 {
 	if (mthca_is_memfree(dev)) {
-		qp->rq.max = roundup_pow_of_two(cap->max_recv_wr);
-		qp->sq.max = roundup_pow_of_two(cap->max_send_wr);
+		qp->rq.max = cap->max_recv_wr ?
+			roundup_pow_of_two(cap->max_recv_wr) : 0;
+		qp->sq.max = cap->max_send_wr ?
+			roundup_pow_of_two(cap->max_send_wr) : 0;
 	} else {
 		qp->rq.max = cap->max_recv_wr;
 		qp->sq.max = cap->max_send_wr;
@@ -1221,7 +1223,8 @@ static int mthca_set_qp_size(struct mthc
 	qp->rq.max_gs = cap->max_recv_sge;
 	qp->sq.max_gs = max_t(int, cap->max_send_sge,
 			      ALIGN(cap->max_inline_data + MTHCA_INLINE_HEADER_SIZE,
-				    MTHCA_INLINE_CHUNK_SIZE) / sizeof (struct mthca_data_seg));
+				    MTHCA_INLINE_CHUNK_SIZE) /
+			      sizeof (struct mthca_data_seg));
 
 	/*
 	 * For MLX transport we need 2 extra S/G entries:



More information about the general mailing list