From: Stan Smith Date: Wed, 3 Mar 2010 23:43:04 +0000 (+0000) Subject: [DAPL] fix typos & whitespace alignment. Support ib CM descriptor as a list of descri... X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=15bdea5369ca716cd29a9edca03054e23f5a05a0;p=~shefty%2Frdma-win.git [DAPL] fix typos & whitespace alignment. Support ib CM descriptor as a list of descriptors, align with common code. git-svn-id: svn://openib.tc.cornell.edu/gen1@2718 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/branches/WOF2-2/ulp/dapl2/dapl/common/dapl_cr_util.c b/branches/WOF2-2/ulp/dapl2/dapl/common/dapl_cr_util.c index 39b61add..5970fa0f 100644 --- a/branches/WOF2-2/ulp/dapl2/dapl/common/dapl_cr_util.c +++ b/branches/WOF2-2/ulp/dapl2/dapl/common/dapl_cr_util.c @@ -81,7 +81,7 @@ DAPL_CR *dapls_cr_alloc(DAPL_IA * ia_ptr) /* * dapls_cr_free * - * Free the passed in EP structure. + * Free the passed in CR structure. * * Input: * entry point pointer diff --git a/branches/WOF2-2/ulp/dapl2/dapl/ibal/dapl_ibal_cm.c b/branches/WOF2-2/ulp/dapl2/dapl/ibal/dapl_ibal_cm.c index aa962cae..a35b1188 100644 --- a/branches/WOF2-2/ulp/dapl2/dapl/ibal/dapl_ibal_cm.c +++ b/branches/WOF2-2/ulp/dapl2/dapl/ibal/dapl_ibal_cm.c @@ -94,7 +94,7 @@ void dapli_print_private_data( char *prefix, const uint8_t *pd, int len ) if ( !pd || len <= 0 ) return; - dapl_log ( DAPL_DBG_TYPE_CM, "--> %s: private_data:\n ",prefix); + dapl_log ( DAPL_DBG_TYPE_CM, "--> %s: private_data(len %d)\n ",prefix,len); if (len > IB_MAX_REP_PDATA_SIZE) { @@ -107,7 +107,7 @@ void dapli_print_private_data( char *prefix, const uint8_t *pd, int len ) for ( i = 0 ; i < len; i++ ) { dapl_log ( DAPL_DBG_TYPE_CM, "%2x ", pd[i]); - if ( ((i+1) % 20) == 0 ) + if ( ((i+1) % 5) == 0 ) dapl_log ( DAPL_DBG_TYPE_CM, "\n "); } dapl_log ( DAPL_DBG_TYPE_CM, "\n"); @@ -126,8 +126,10 @@ dp_ib_cm_handle_t ibal_cm_alloc(void) (void)dapl_os_memzero(cm_ptr, sizeof(*cm_ptr)); cm_ptr->ref_count = 1; - if (dapl_os_lock_init(&cm_ptr->lock)) + if (dapl_os_lock_init(&cm_ptr->lock)) { + dapl_os_free(cm_ptr, sizeof(*cm_ptr)); return NULL; + } dapl_llist_init_entry((DAPL_LLIST_ENTRY *)&cm_ptr->list_entry); @@ -142,7 +144,6 @@ static void ibal_cm_dealloc(dp_ib_cm_handle_t cm_ptr) dapl_os_free(cm_ptr, sizeof(*cm_ptr)); } -/* dapl_ep_link_cm() */ void dapls_cm_acquire(dp_ib_cm_handle_t cm_ptr) { dapl_os_lock(&cm_ptr->lock); @@ -150,7 +151,6 @@ void dapls_cm_acquire(dp_ib_cm_handle_t cm_ptr) dapl_os_unlock(&cm_ptr->lock); } -/* dapl_ep_unlink_cm() */ void dapls_cm_release(dp_ib_cm_handle_t cm_ptr) { dapl_os_lock(&cm_ptr->lock); @@ -404,7 +404,7 @@ dapli_ib_cm_rep_cb ( dapl_os_assert(cm_ptr->ib_cm.h_qp == p_cm_rep_rec->h_cm_rep.h_qp); dapl_dbg_log (DAPL_DBG_TYPE_CM, - "--> DiCRpcb: EP = %lx local_max_rdma_read_in %d\n", + "--> DiCRpcb: EP %lx local_max_rdma_read_in %d\n", ep_ptr, p_cm_rep_rec->resp_res); p_ca = (dapl_ibal_ca_t *) @@ -654,20 +654,6 @@ dapli_ib_cm_req_cb ( IN ib_cm_req_rec_t *p_cm_req_rec ) #endif /* NO_NAME_SERVICE */ -#if defined(DAPL_DBG) - { - char ipa[20]; - - //rval = ((struct sockaddr_in *) (&dest_ia_addr))->sin_addr.s_addr; - - dapl_dbg_log (DAPL_DBG_TYPE_CM|DAPL_DBG_TYPE_CALLBACK, - "%s: query SA for RemoteAddr: %s\n", - __FUNCTION__, - dapli_get_ip_addr_str( (DAT_SOCK_ADDR6*) - &dest_ia_addr, ipa) ); - } -#endif - /* preserve CR cm handle data */ dapl_os_memcpy( (void*)&cm_ptr->ib_cm, (void*)&p_cm_req_rec->h_cm_req, @@ -678,6 +664,20 @@ dapli_ib_cm_req_cb ( IN ib_cm_req_rec_t *p_cm_req_rec ) (void*)&dest_ia_addr, sizeof(dest_ia_addr)); +#if defined(DAPL_DBG) + { + char ipa[20]; + + //rval = ((struct sockaddr_in *) (&dest_ia_addr))->sin_addr.s_addr; + + dapl_dbg_log (DAPL_DBG_TYPE_CM|DAPL_DBG_TYPE_CALLBACK, + "%s: query SA (CM %lx)->dst_ip_addr: %s\n", + __FUNCTION__,cm_ptr, + dapli_get_ip_addr_str( + (DAT_SOCK_ADDR6*) &cm_ptr->dst_ip_addr, ipa) ); + } +#endif + /* FIXME - Vu * We have NOT used/saved the primary and alternative path record * ie. p_cm_req_rec->p_primary_path and p_cm_req_rec->p_alt_path @@ -694,7 +694,7 @@ dapli_ib_cm_req_cb ( IN ib_cm_req_rec_t *p_cm_req_rec ) dapls_cr_callback ( cm_ptr, IB_CME_CONNECTION_REQUEST_PENDING, (void * __ptr64) p_cm_req_rec->p_req_pdata, - IB_REQ_PDATA_SIZE, + IB_REQ_PDATA_SIZE, (void * __ptr64) sp_ptr ); } @@ -704,7 +704,7 @@ dapli_ib_cm_mra_cb ( IN ib_cm_mra_rec_t *p_cm_mra_rec ) { UNUSED_PARAM( p_cm_mra_rec ); - dapl_dbg_log (DAPL_DBG_TYPE_CM | DAPL_DBG_TYPE_CALLBACK, + dapl_dbg_log (DAPL_DBG_TYPE_CM | DAPL_DBG_TYPE_CALLBACK, "--> DiCMcb: CM callback MRA\n"); } @@ -712,7 +712,7 @@ static void dapli_ib_cm_rtu_cb ( IN ib_cm_rtu_rec_t *p_cm_rtu_rec ) { - DAPL_EP *ep_ptr; + DAPL_EP *ep_ptr; dp_ib_cm_handle_t cm_ptr; dapl_os_assert (p_cm_rtu_rec != NULL); @@ -735,7 +735,8 @@ dapli_ib_cm_rtu_cb ( dapl_os_assert(cm_ptr->ib_cm.h_qp == p_cm_rtu_rec->h_qp); dapl_dbg_log (DAPL_DBG_TYPE_CM | DAPL_DBG_TYPE_CALLBACK, - "--> DiCRucb: EP %lx QP %lx\n", ep_ptr, ep_ptr->qp_handle); + "--> DiCRucb: EP %lx QP %lx CR %lx\n", + ep_ptr, ep_ptr->qp_handle, ep_ptr->cr_ptr); if (ep_ptr->cr_ptr) { @@ -743,6 +744,7 @@ dapli_ib_cm_rtu_cb ( sp_ptr = ((DAPL_CR *) ep_ptr->cr_ptr)->sp_ptr; + /* passive connection side */ dapls_cr_callback ( cm_ptr, IB_CME_CONNECTED, (void * __ptr64) p_cm_rtu_rec->p_rtu_pdata, @@ -784,18 +786,21 @@ dapls_ib_cm_remote_addr ( { DAPL_HEADER *header; - void *vp; + dp_ib_cm_handle_t cm; char ipa[20]; + char *rtype; header = (DAPL_HEADER *)dat_handle; if (header->magic == DAPL_MAGIC_EP) { - vp = &((DAPL_EP *) dat_handle)->remote_ia_address; + cm = dapl_get_cm_from_ep((DAPL_EP *)dat_handle); + rtype = "EP"; } else if (header->magic == DAPL_MAGIC_CR) { - vp = &((DAPL_CR *) dat_handle)->remote_ia_address; + cm = ((DAPL_CR *) dat_handle)->ib_cm_handle; + rtype = "CR"; } else { @@ -805,10 +810,10 @@ dapls_ib_cm_remote_addr ( return DAT_INVALID_HANDLE; } - dapl_os_memcpy( remote_address, vp, sizeof(DAT_SOCK_ADDR6) ); + dapl_os_memcpy( remote_address, &cm->dst_ip_addr, sizeof(DAT_SOCK_ADDR6) ); - dapl_dbg_log ( DAPL_DBG_TYPE_CM, "%s: returns %s\n", - __FUNCTION__, + dapl_dbg_log ( DAPL_DBG_TYPE_CM, "%s: returns %s remote Addrs %s\n", + __FUNCTION__, rtype, dapli_get_ip_addr_str((DAT_SOCK_ADDR6*)remote_address,ipa) ); return DAT_SUCCESS; @@ -1097,8 +1102,8 @@ dapls_ib_disconnect ( IN DAPL_EP *ep_ptr, IN DAT_CLOSE_FLAGS disconnect_flags ) { ib_api_status_t ib_status = IB_SUCCESS; - ib_cm_dreq_t cm_dreq; - dp_ib_cm_handle_t cm_ptr; + ib_cm_dreq_t cm_dreq; + dp_ib_cm_handle_t cm_ptr; dapl_os_assert(ep_ptr); @@ -1524,16 +1529,11 @@ dapls_ib_accept_connection ( /* EP-CM, save/release CR CM object, use EP CM object already linked */ cm_ptr = dapl_get_cm_from_ep(ep_ptr); if (!cm_ptr) { - dapl_dbg_log ( DAPL_DBG_TYPE_ERR, + dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsIBAC: CM linking to EP %p not available\n", ep_ptr); - return (DAT_INVALID_STATE); + return (DAT_INVALID_STATE); } - /* get h_al and connection ID from CR CM object, h_qp already set */ - cm_ptr->ib_cm.cid = cr_ptr->ib_cm_handle->ib_cm.cid; - cm_ptr->ib_cm.h_al = cr_ptr->ib_cm_handle->ib_cm.h_al; - dapls_cm_release(cr_ptr->ib_cm_handle); - cr_ptr->ib_cm_handle = NULL; /* set remote IP addr fields. IP addr data is deduced from Connection * Request record (gid/lib) and stashed away for use here. DAPL 1.1 @@ -1541,14 +1541,14 @@ dapls_ib_accept_connection ( * in 2.0? */ dapl_os_memcpy( (void*)&ep_ptr->remote_ia_address, - (void*)&cm_ptr->dst_ip_addr, + (void*)&cr_ptr->ib_cm_handle->dst_ip_addr, sizeof(DAT_SOCK_ADDR6) ); dapl_os_memcpy( (void*)&cr_ptr->remote_ia_address, (void*)&ep_ptr->remote_ia_address, sizeof(DAT_SOCK_ADDR6) ); -#if defined(DAPL_DBG) && 0 +#if defined(DAPL_DBG) { char ipa[20]; @@ -1556,11 +1556,21 @@ dapls_ib_accept_connection ( "%s: EP(%lx) RemoteAddr: %s\n", __FUNCTION__, ep_ptr, dapli_get_ip_addr_str( - (DAT_SOCK_ADDR6*)&ep_ptr->remote_ia_address, ipa)); + (DAT_SOCK_ADDR6*)&ep_ptr->remote_ia_address, ipa) ); } #endif - ep_ptr->qp_state = IB_QPS_INIT; + dapl_os_memcpy( (void*)&cm_ptr->dst_ip_addr, + (void*)&cr_ptr->ib_cm_handle->dst_ip_addr, + sizeof(DAT_SOCK_ADDR6) ); + + /* get h_al and connection ID from CR CM object, h_qp already set */ + cm_ptr->ib_cm.cid = cr_ptr->ib_cm_handle->ib_cm.cid; + cm_ptr->ib_cm.h_al = cr_ptr->ib_cm_handle->ib_cm.h_al; + dapls_cm_release(cr_ptr->ib_cm_handle); + + cr_ptr->ib_cm_handle = cm_ptr; /* for dapli_get_sp_ep() upcall */ + ep_ptr->cr_ptr = cr_ptr; dapl_os_memzero ( (void*)&cm_rep, sizeof (ib_cm_rep_t) ); @@ -1634,10 +1644,6 @@ dapls_ib_accept_connection ( dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsIBAC: EP %lx QP %lx CR reply failed '%s'\n", ep_ptr, ep_ptr->qp_handle, ib_get_err_str(ib_status) ); - - /* errors not perculated back to CR callback which allocated the - * memory, free it here on error. - */ } return ( dapl_ib_status_convert ( ib_status ) ); diff --git a/branches/WOF2-2/ulp/dapl2/dapl/ibal/dapl_ibal_qp.c b/branches/WOF2-2/ulp/dapl2/dapl/ibal/dapl_ibal_qp.c index c759bc68..eff6d114 100644 --- a/branches/WOF2-2/ulp/dapl2/dapl/ibal/dapl_ibal_qp.c +++ b/branches/WOF2-2/ulp/dapl2/dapl/ibal/dapl_ibal_qp.c @@ -134,8 +134,8 @@ dapls_ib_qp_alloc ( ib_cq_handle_t cq_send; dapl_ibal_ca_t *p_ca; dapl_ibal_port_t *p_active_port; - ib_qp_attr_t qp_attr; - dp_ib_cm_handle_t cm_ptr; + ib_qp_attr_t qp_attr; + dp_ib_cm_handle_t cm_ptr; attr = &ep_ptr->param.ep_attr; @@ -251,7 +251,7 @@ dapls_ib_qp_alloc ( return (DAT_INSUFFICIENT_RESOURCES); } cm_ptr->ib_cm.h_qp = ep_ptr->qp_handle; - cm_ptr->ep = ep_ptr; + cm_ptr->ep = ep_ptr; dapl_ep_link_cm(ep_ptr, cm_ptr); dapl_dbg_log (DAPL_DBG_TYPE_EP, "--> DsQA: EP=%p, tEVD=%p, rEVD=%p QP=%p\n",