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 <[EMAIL PROTECTED]>
---
 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


_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to