[ofa-general] [PATCH ofed-1.2 libcxgb3] in-line fixes for cxgb3

Steve Wise swise at opengridcomputing.com
Thu Apr 5 13:15:59 PDT 2007


Vlad,

Please pull from 

git://git.openfabrics.org/~swise/libcxgb3 ofed_1_2


This commit fixes up all known inline issues with mvapich2 and cxgb3.
Also needed is a change to mvapich2 with is coming soon from the
mvapich2 folks.  Both need to be pulled into the ofed kit together.


Thanks,

Steve.


---


commit e889105a95381ae41c0c83716ad8097ed25c8aae
Author: Steve Wise <swise at opengridcomputing.com>
Date:   Thu Apr 5 11:40:41 2007 -0500

    More inline fixes.
    
    - Round up the flit count based on the inline data size.
    - Limit the max inline to 64B.
    - fixed union access errors.
    
    Signed-off-by: Steve Wise <swise at opengridcomputing.com>

diff --git a/src/cxio_wr.h b/src/cxio_wr.h
index e8bafe0..7893259 100644
--- a/src/cxio_wr.h
+++ b/src/cxio_wr.h
@@ -41,6 +41,7 @@ #define T3_MAX_NUM_CQ (1<<15)
 #define T3_MAX_NUM_PD (1<<15)
 #define T3_MAX_NUM_STAG (1<<15)
 #define T3_MAX_SGE      4
+#define T3_MAX_INLINE  64
 
 #define Q_EMPTY(rptr,wptr) ((rptr)==(wptr))
 #define Q_FULL(rptr,wptr,size_log2)  ( (((wptr)-(rptr))>>(size_log2)) && \
diff --git a/src/qp.c b/src/qp.c
index b77fb34..f6098d2 100644
--- a/src/qp.c
+++ b/src/qp.c
@@ -42,6 +42,8 @@ #include <string.h>
 #include "iwch.h"
 #include <stdio.h>
 
+#define ROUNDUP8(a) (((a) + 7) & ~7)
+
 static inline int iwch_build_rdma_send(union t3_wr *wqe, struct ibv_send_wr *wr,
 				       uint8_t *flit_cnt)
 {
@@ -79,15 +81,15 @@ #endif
 		datap = (uint8_t *)&wqe->send.sgl[0];
 		wqe->send.num_sgle = 0;	/* indicates in-line data */
 		for (i = 0; i < wr->num_sge; i++) {
-			if ((wqe->send.plen + wr->sg_list[i].length) > 96) {
+			if ((wqe->send.plen + wr->sg_list[i].length) > 
+			    T3_MAX_INLINE)
 				return -1;
-			}
 			wqe->send.plen += wr->sg_list[i].length;
 			memcpy(datap, (void *)wr->sg_list[i].addr, 
 			       wr->sg_list[i].length);
 			datap += wr->sg_list[i].length;
 		}
-		*flit_cnt = 4 + (wqe->send.plen >> 3) + 1;
+		*flit_cnt = 4 + (ROUNDUP8(wqe->send.plen) >> 3);
 		wqe->send.plen = htonl(wqe->send.plen);
 	} else {
 		wqe->send.plen = 0;
@@ -132,21 +134,21 @@ static inline int iwch_build_rdma_write(
 		datap = (uint8_t *)&wqe->write.sgl[0];
 		wqe->write.num_sgle = 0;	/* indicates in-line data */
 		for (i = 0; i < wr->num_sge; i++) {
-			if ((wqe->write.plen + wr->sg_list[i].length) > 88) {
+			if ((wqe->write.plen + wr->sg_list[i].length) >
+			    T3_MAX_INLINE)
 				return -1;
-			}
 			wqe->write.plen += wr->sg_list[i].length;
 			memcpy(datap, (void *)wr->sg_list[i].addr, 
 			       wr->sg_list[i].length);
 			datap += wr->sg_list[i].length;
 		}
-		*flit_cnt = 5 + (wqe->write.plen >> 3) + 1;
+		*flit_cnt = 5 + (ROUNDUP8(wqe->write.plen) >> 3);
 		wqe->write.plen = htonl(wqe->write.plen);
 	} else {
 		wqe->write.plen = 0;
 		for (i = 0; i < wr->num_sge; i++) {
-			if ((wqe->send.plen + wr->sg_list[i].length) < 
-			    wqe->send.plen) {
+			if ((wqe->write.plen + wr->sg_list[i].length) < 
+			    wqe->write.plen) {
 				return -1;
 			}
 			wqe->write.plen += wr->sg_list[i].length;





More information about the general mailing list