[ewg] [PATCH] DAPL v2.0: scm, ucm: fix compatibility issue and set minimum protocol support

Davis, Arlin R arlin.r.davis at intel.com
Sun Aug 28 19:25:33 PDT 2011


allow latest version to work with previous version. provide
compatibility back to OFED 1.5, dapl-2.0.23. if rdma_atomic_in
is not exchanged, default back to original settings set by
consumer. maintain compatibility moving forward from v6.

Signed-off-by: Arlin Davis <arlin.r.davis at intel.com>
---
 dapl/openib_common/dapl_ib_common.h |    1 +
 dapl/openib_scm/cm.c                |   16 ++++++++++------
 dapl/openib_ucm/cm.c                |   14 +++++++++-----
 3 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/dapl/openib_common/dapl_ib_common.h b/dapl/openib_common/dapl_ib_common.h
index 8993a24..a0dd772 100644
--- a/dapl/openib_common/dapl_ib_common.h
+++ b/dapl/openib_common/dapl_ib_common.h
@@ -59,6 +59,7 @@ typedef ib_hca_handle_t		dapl_ibal_ca_t;
 
 /* QP info to exchange, wire protocol version for these CM's */
 #define DCM_VER 7
+#define DCM_VER_MIN 6 /* backward compatibility limit */
 
 /* CM private data areas, same for all operations */
 #define        DCM_MAX_PDATA_SIZE      118
diff --git a/dapl/openib_scm/cm.c b/dapl/openib_scm/cm.c
index 1145f17..305f85b 100644
--- a/dapl/openib_scm/cm.c
+++ b/dapl/openib_scm/cm.c
@@ -712,7 +712,7 @@ static void dapli_socket_connect_rtu(dp_ib_cm_handle_t cm_ptr)
 	dapl_dbg_log(DAPL_DBG_TYPE_EP, " connect_rtu: recv peer QP data\n");
 
 	len = recv(cm_ptr->socket, (char *)&cm_ptr->msg, exp, 0);
-	if (len != exp || ntohs(cm_ptr->msg.ver) != DCM_VER) {
+	if (len != exp || ntohs(cm_ptr->msg.ver) < DCM_VER_MIN) {
 		int err = dapl_socket_errno();
 		dapl_log(DAPL_DBG_TYPE_WARN,
 			 " CONN_RTU read: sk %d ERR 0x%x, rcnt=%d, v=%d -> %s PORT L-%x R-%x PID L-%x R-%x\n",
@@ -807,8 +807,10 @@ static void dapli_socket_connect_rtu(dp_ib_cm_handle_t cm_ptr)
 	}
 
 	/* rdma_out, initiator, cannot exceed remote rdma_in max */
-	ep_ptr->param.ep_attr.max_rdma_read_out = 
-		DAPL_MIN(ep_ptr->param.ep_attr.max_rdma_read_out, cm_ptr->msg.rd_in);
+	if (ntohs(cm_ptr->msg.ver) >= 7)
+		ep_ptr->param.ep_attr.max_rdma_read_out =
+				DAPL_MIN(ep_ptr->param.ep_attr.max_rdma_read_out,
+					 cm_ptr->msg.rd_in);
 
 	/* modify QP to RTR and then to RTS with remote info */
 	dapl_os_lock(&ep_ptr->header.lock);
@@ -1089,7 +1091,7 @@ static void dapli_socket_accept_data(ib_cm_srvc_handle_t acm_ptr)
 
 	/* read in DST QP info, IA address. check for private data */
 	len = recv(acm_ptr->socket, (char *)&acm_ptr->msg, exp, 0);
-	if (len != exp || ntohs(acm_ptr->msg.ver) != DCM_VER) {
+	if (len != exp || ntohs(acm_ptr->msg.ver) < DCM_VER_MIN) {
 		int err = dapl_socket_errno();
 		dapl_log(DAPL_DBG_TYPE_ERR,
 			 " ACCEPT read: ERR 0x%x %s, rcnt=%d, ver=%d\n",
@@ -1209,8 +1211,10 @@ dapli_socket_accept_usr(DAPL_EP * ep_ptr,
 	}
 #endif
 	/* rdma_out, initiator, cannot exceed remote rdma_in max */
-	ep_ptr->param.ep_attr.max_rdma_read_out = 
-		DAPL_MIN(ep_ptr->param.ep_attr.max_rdma_read_out, cm_ptr->msg.rd_in);
+	if (ntohs(cm_ptr->msg.ver) >= 7)
+		ep_ptr->param.ep_attr.max_rdma_read_out =
+				DAPL_MIN(ep_ptr->param.ep_attr.max_rdma_read_out,
+					 cm_ptr->msg.rd_in);
 
 	/* modify QP to RTR and then to RTS with remote info already read */
 	dapl_os_lock(&ep_ptr->header.lock);
diff --git a/dapl/openib_ucm/cm.c b/dapl/openib_ucm/cm.c
index ec6a774..2d2063e 100644
--- a/dapl/openib_ucm/cm.c
+++ b/dapl/openib_ucm/cm.c
@@ -554,7 +554,7 @@ retry:
 			     (void*)wc[i].wr_id, wc[i].src_qp);
 
 		/* validate CM message, version */
-		if (ntohs(msg->ver) != DCM_VER) {
+		if (ntohs(msg->ver) < DCM_VER_MIN) {
 			dapl_log(DAPL_DBG_TYPE_WARN,
 				 " ucm_recv: UNKNOWN msg %p, ver %d\n", 
 				 msg, msg->ver);
@@ -1092,8 +1092,10 @@ static void ucm_connect_rtu(dp_ib_cm_handle_t cm, ib_cm_msg_t *msg)
 	dapl_os_unlock(&cm->lock);
 
         /* rdma_out, initiator, cannot exceed remote rdma_in max */
-        cm->ep->param.ep_attr.max_rdma_read_out =
-                DAPL_MIN(cm->ep->param.ep_attr.max_rdma_read_out, cm->msg.rd_in);
+	if (ntohs(cm->msg.ver) >= 7)
+		cm->ep->param.ep_attr.max_rdma_read_out =
+				DAPL_MIN(cm->ep->param.ep_attr.max_rdma_read_out,
+					 cm->msg.rd_in);
 
 	/* modify QP to RTR and then to RTS with remote info */
 	dapl_os_lock(&cm->ep->header.lock);
@@ -1526,8 +1528,10 @@ dapli_accept_usr(DAPL_EP *ep, DAPL_CR *cr, DAT_COUNT p_size, DAT_PVOID p_data)
 #endif
 
         /* rdma_out, initiator, cannot exceed remote rdma_in max */
-        ep->param.ep_attr.max_rdma_read_out =
-                DAPL_MIN(ep->param.ep_attr.max_rdma_read_out, cm->msg.rd_in);
+	if (ntohs(cm->msg.ver) >= 7)
+		ep->param.ep_attr.max_rdma_read_out =
+				DAPL_MIN(ep->param.ep_attr.max_rdma_read_out,
+					 cm->msg.rd_in);
 
 	/* modify QP to RTR and then to RTS with remote info already read */
 	dapl_os_lock(&ep->header.lock);
-- 
1.7.3





More information about the ewg mailing list