[ofa-general] [PATCH 4/5][v2.0] dapl scm: UD shares EP's which requires serialization

Arlin Davis arlin.r.davis at intel.com
Wed Sep 24 13:44:05 PDT 2008


add locking around the modify_qp state changes to avoid
unnecessary modify_qp calls during multiple resolve
remote AH connection events on a single EP.

Signed-off-by: Arlin Davis <ardavis at ichips.intel.com>
---
 dapl/openib_scm/dapl_ib_cm.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/dapl/openib_scm/dapl_ib_cm.c b/dapl/openib_scm/dapl_ib_cm.c
index 5a6aa97..80a7d5e 100644
--- a/dapl/openib_scm/dapl_ib_cm.c
+++ b/dapl/openib_scm/dapl_ib_cm.c
@@ -470,6 +470,7 @@ dapli_socket_connect_rtu(dp_ib_cm_handle_t	cm_ptr)
 	}
 
 	/* modify QP to RTR and then to RTS with remote info */
+	dapl_os_lock(&ep_ptr->header.lock);
 	if (dapls_modify_qp_state(ep_ptr->qp_handle, 
 				  IBV_QPS_RTR, cm_ptr) != DAT_SUCCESS) {
 		dapl_log(DAPL_DBG_TYPE_ERR, 
@@ -477,6 +478,7 @@ dapli_socket_connect_rtu(dp_ib_cm_handle_t	cm_ptr)
 			 strerror(errno), 
 			 inet_ntoa(((struct sockaddr_in *)
 			   ep_ptr->param.remote_ia_address_ptr)->sin_addr)); 
+		dapl_os_unlock(&ep_ptr->header.lock);
 		goto bail;
 	}
 	if (dapls_modify_qp_state(ep_ptr->qp_handle, 
@@ -486,8 +488,10 @@ dapli_socket_connect_rtu(dp_ib_cm_handle_t	cm_ptr)
 			 strerror(errno), 
 			 inet_ntoa(((struct sockaddr_in *)
 			   ep_ptr->param.remote_ia_address_ptr)->sin_addr)); 
+		dapl_os_unlock(&ep_ptr->header.lock);
 		goto bail;
 	}
+	dapl_os_unlock(&ep_ptr->header.lock);
 	dapl_dbg_log(DAPL_DBG_TYPE_EP," connect_rtu: send RTU\n"); 
 
 	/* complete handshake after final QP state change */
@@ -781,6 +785,7 @@ dapli_socket_accept_usr(DAPL_EP		*ep_ptr,
 #endif
 
 	/* modify QP to RTR and then to RTS with remote info already read */
+	dapl_os_lock(&ep_ptr->header.lock);
 	if (dapls_modify_qp_state(ep_ptr->qp_handle, 
 				  IBV_QPS_RTR, cm_ptr) != DAT_SUCCESS) {
 		dapl_log(DAPL_DBG_TYPE_ERR, 
@@ -788,6 +793,7 @@ dapli_socket_accept_usr(DAPL_EP		*ep_ptr,
 			 strerror(errno), 
 			 inet_ntoa(((struct sockaddr_in *)
 				&cm_ptr->dst.ia_address)->sin_addr)); 
+		dapl_os_unlock(&ep_ptr->header.lock);
 		goto bail;
 	}
 	if (dapls_modify_qp_state(ep_ptr->qp_handle, 
@@ -797,9 +803,11 @@ dapli_socket_accept_usr(DAPL_EP		*ep_ptr,
 			 strerror(errno), 
 			 inet_ntoa(((struct sockaddr_in *)
 				&cm_ptr->dst.ia_address)->sin_addr)); 
+		dapl_os_unlock(&ep_ptr->header.lock);
 		goto bail;
 	}
-	
+	dapl_os_unlock(&ep_ptr->header.lock);
+
 	/* save remote address information */
 	dapl_os_memcpy( &ep_ptr->remote_ia_address, 
 			&cm_ptr->dst.ia_address, 
-- 
1.5.2.5





More information about the general mailing list