diff --git a/ompi/mca/btl/openib/btl_openib.c b/ompi/mca/btl/openib/btl_openib.c index aa4ea3c087..831f8765c7 100644 --- a/ompi/mca/btl/openib/btl_openib.c +++ b/ompi/mca/btl/openib/btl_openib.c @@ -929,8 +929,8 @@ int mca_btl_openib_put( mca_btl_base_module_t* btl, qp = mca_btl_openib_component.rdma_qp; /* check for a send wqe */ - if (OPAL_THREAD_ADD32(&endpoint->qps[qp].sd_wqe,-1) < 0) { - OPAL_THREAD_ADD32(&endpoint->qps[qp].sd_wqe,1); + if (qp_get_wqe(endpoint, qp) < 0) { + qp_put_wqe(endpoint, qp); OPAL_THREAD_LOCK(&endpoint->endpoint_lock); opal_list_append(&endpoint->pending_put_frags, (opal_list_item_t*)frag); OPAL_THREAD_UNLOCK(&endpoint->endpoint_lock); @@ -956,7 +956,7 @@ int mca_btl_openib_put( mca_btl_base_module_t* btl, /* Setting opcode on a frag constructor isn't enough since prepare_src * may return send_frag instead of put_frag */ frag->sr_desc.opcode = IBV_WR_RDMA_WRITE; - if(ibv_post_send(endpoint->qps[qp].lcl_qp, &frag->sr_desc, &bad_wr)) + if(ibv_post_send(endpoint->qps[qp].qp->lcl_qp, &frag->sr_desc, &bad_wr)) return OMPI_ERROR; return OMPI_SUCCESS; @@ -983,8 +983,8 @@ int mca_btl_openib_get( mca_btl_base_module_t* btl, qp = mca_btl_openib_component.rdma_qp; /* check for a send wqe */ - if (OPAL_THREAD_ADD32(&endpoint->qps[qp].sd_wqe,-1) < 0) { - OPAL_THREAD_ADD32(&endpoint->qps[qp].sd_wqe,1); + if (qp_get_wqe(endpoint, qp) < 0) { + qp_put_wqe(endpoint, qp); OPAL_THREAD_LOCK(&endpoint->endpoint_lock); opal_list_append(&endpoint->pending_get_frags, (opal_list_item_t*)frag); OPAL_THREAD_UNLOCK(&endpoint->endpoint_lock); @@ -993,7 +993,7 @@ int mca_btl_openib_get( mca_btl_base_module_t* btl, /* check for a get token */ if(OPAL_THREAD_ADD32(&endpoint->get_tokens,-1) < 0) { - OPAL_THREAD_ADD32(&endpoint->qps[qp].sd_wqe,1); + qp_put_wqe(endpoint, qp); OPAL_THREAD_ADD32(&endpoint->get_tokens,1); OPAL_THREAD_LOCK(&endpoint->endpoint_lock); opal_list_append(&endpoint->pending_get_frags, (opal_list_item_t*)frag); @@ -1017,7 +1017,7 @@ int mca_btl_openib_get( mca_btl_base_module_t* btl, to_com_frag(frag)->endpoint = endpoint; descriptor->order = qp; - if(ibv_post_send(endpoint->qps[qp].lcl_qp, &frag->sr_desc, &bad_wr)) + if(ibv_post_send(endpoint->qps[qp].qp->lcl_qp, &frag->sr_desc, &bad_wr)) return OMPI_ERROR; return OMPI_SUCCESS; diff --git a/ompi/mca/btl/openib/btl_openib_component.c b/ompi/mca/btl/openib/btl_openib_component.c index b842795b44..e15fc0a6b8 100644 --- a/ompi/mca/btl/openib/btl_openib_component.c +++ b/ompi/mca/btl/openib/btl_openib_component.c @@ -1259,7 +1259,7 @@ static void progress_pending_eager_rdma(mca_btl_base_endpoint_t *ep) * channel */ OPAL_THREAD_LOCK(&ep->endpoint_lock); for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) { - while(ep->qps[qp].sd_wqe > 0 && ep->eager_rdma_remote.tokens > 0) { + while(ep->qps[qp].qp->sd_wqe > 0 && ep->eager_rdma_remote.tokens > 0) { frag = opal_list_remove_first(&ep->qps[qp].pending_frags[0]); if(NULL == frag) break; @@ -1271,6 +1271,25 @@ static void progress_pending_eager_rdma(mca_btl_base_endpoint_t *ep) OPAL_THREAD_UNLOCK(&ep->endpoint_lock); } +static void progress_pending_frags_wqe(mca_btl_openib_qp_t *qp) +{ + int i; + opal_list_item_t *frag; + + OPAL_THREAD_LOCK(&qp->lock); + for(i = 0; i < 2; i++) { + while(qp->sd_wqe > 0) { + mca_btl_base_endpoint_t *ep; + frag = opal_list_remove_first(&qp->pending_frags[i]); + if(NULL == frag) + break; + ep = to_com_frag(frag)->endpoint; + mca_btl_openib_endpoint_post_send(ep, to_send_frag(frag)); + } + } + OPAL_THREAD_UNLOCK(&qp->lock); +} + static inline int get_enpoint_credits(mca_btl_base_endpoint_t *ep, const int qp) { @@ -1279,20 +1298,17 @@ get_enpoint_credits(mca_btl_base_endpoint_t *ep, const int qp) static void progress_pending_frags_pp(mca_btl_base_endpoint_t *ep, const int qp) { - int i, rc; + int i; opal_list_item_t *frag; OPAL_THREAD_LOCK(&ep->endpoint_lock); for(i = 0; i < 2; i++) { - while(ep->qps[qp].sd_wqe > 0 && (get_enpoint_credits(ep, qp) + - (1 - i) * ep->eager_rdma_remote.tokens) > 0) - { + while((get_enpoint_credits(ep, qp) + + (1 - i) * ep->eager_rdma_remote.tokens) > 0) { frag = opal_list_remove_first(&ep->qps[qp].pending_frags[i]); if(NULL == frag) break; - rc = mca_btl_openib_endpoint_post_send(ep, to_send_frag(frag)); - if(rc != OMPI_SUCCESS) - break; + mca_btl_openib_endpoint_post_send(ep, to_send_frag(frag)); } } OPAL_THREAD_UNLOCK(&ep->endpoint_lock); @@ -1304,7 +1320,7 @@ static void btl_openib_frag_progress_pending_put_get( opal_list_item_t *frag; size_t i, len = opal_list_get_size(&endpoint->pending_get_frags); - for(i = 0; i < len && endpoint->qps[qp].sd_wqe > 0 && + for(i = 0; i < len && endpoint->qps[qp].qp->sd_wqe > 0 && endpoint->get_tokens > 0; i++) { OPAL_THREAD_LOCK(&endpoint->endpoint_lock); frag = opal_list_remove_first(&(endpoint->pending_get_frags)); @@ -1317,7 +1333,7 @@ static void btl_openib_frag_progress_pending_put_get( } len = opal_list_get_size(&endpoint->pending_put_frags); - for(i = 0; i < len && endpoint->qps[qp].sd_wqe > 0; i++) { + for(i = 0; i < len && endpoint->qps[qp].qp->sd_wqe > 0; i++) { OPAL_THREAD_LOCK(&endpoint->endpoint_lock); frag = opal_list_remove_first(&(endpoint->pending_put_frags)); OPAL_THREAD_UNLOCK(&endpoint->endpoint_lock); @@ -1535,7 +1551,7 @@ static int btl_openib_module_progress(mca_btl_openib_hca_t* hca) des->des_cbfunc(&openib_btl->super, endpoint, des, OMPI_SUCCESS); /* return send wqe */ - OPAL_THREAD_ADD32(&endpoint->qps[qp].sd_wqe, 1); + qp_put_wqe(endpoint, qp); if(IBV_WC_SEND == wc.opcode && BTL_OPENIB_QP_TYPE_SRQ(qp)) { OPAL_THREAD_ADD32(&openib_btl->qps[qp].u.srq_qp.sd_credits, @@ -1544,7 +1560,7 @@ static int btl_openib_module_progress(mca_btl_openib_hca_t* hca) progress_pending_frags_srq(openib_btl, qp); } /* new wqe or/and get token available. Try to progress pending frags */ - progress_pending_frags_pp(endpoint, qp); + progress_pending_frags_wqe(endpoint->qps[qp].qp); btl_openib_frag_progress_pending_put_get(openib_btl, endpoint, qp); count++; diff --git a/ompi/mca/btl/openib/btl_openib_endpoint.c b/ompi/mca/btl/openib/btl_openib_endpoint.c index 0ff6b03d9b..4149bdcc70 100644 --- a/ompi/mca/btl/openib/btl_openib_endpoint.c +++ b/ompi/mca/btl/openib/btl_openib_endpoint.c @@ -104,19 +104,21 @@ static int post_send(mca_btl_openib_endpoint_t *ep, assert(sg->addr == (uint64_t)frag->hdr); - return ibv_post_send(ep->qps[qp].lcl_qp, sr_desc, &bad_wr); + return ibv_post_send(ep->qps[qp].qp->lcl_qp, sr_desc, &bad_wr); } -static inline int acruire_wqe(mca_btl_openib_endpoint_t *endpoint, +static inline int acruire_wqe(mca_btl_openib_endpoint_t *ep, mca_btl_openib_send_frag_t *frag) { int qp = to_base_frag(frag)->base.order; int prio = !(to_base_frag(frag)->base.des_flags & MCA_BTL_DES_FLAGS_PRIORITY); - if(OPAL_THREAD_ADD32(&endpoint->qps[qp].sd_wqe, -1) < 0) { - OPAL_THREAD_ADD32(&endpoint->qps[qp].sd_wqe, 1); - opal_list_append(&endpoint->qps[qp].pending_frags[prio], + if(qp_get_wqe(ep, qp) < 0) { + qp_put_wqe(ep, qp); + OPAL_THREAD_LOCK(&ep->qps[qp].qp->lock); + opal_list_append(&ep->qps[qp].qp->pending_frags[prio], (opal_list_item_t *)frag); + OPAL_THREAD_UNLOCK(&ep->qps[qp].qp->lock); return OMPI_ERR_OUT_OF_RESOURCE; } @@ -193,7 +195,7 @@ int mca_btl_openib_endpoint_post_send(mca_btl_openib_endpoint_t *endpoint, } if(!do_rdma && acquire_send_credit(endpoint, frag) != OMPI_SUCCESS) { - OPAL_THREAD_ADD32(&endpoint->qps[qp].sd_wqe, 1); + qp_put_wqe(endpoint, qp); return OMPI_ERR_OUT_OF_RESOURCE; } @@ -231,7 +233,7 @@ int mca_btl_openib_endpoint_post_send(mca_btl_openib_endpoint_t *endpoint, BTL_OPENIB_CREDITS(hdr->credits)); } - OPAL_THREAD_ADD32(&endpoint->qps[qp].sd_wqe, 1); + qp_put_wqe(endpoint, qp); if(do_rdma) { OPAL_THREAD_ADD32(&endpoint->eager_rdma_remote.tokens, 1); @@ -260,46 +262,76 @@ OBJ_CLASS_INSTANCE(mca_btl_openib_endpoint_t, * Initialize state of the endpoint instance. * */ -static void mca_btl_openib_endpoint_construct_qp(mca_btl_base_endpoint_t *endpoint, int qp) +static mca_btl_openib_qp_t *endpoint_alloc_qp(void) { - - endpoint->qps[qp].lcl_qp = NULL; - endpoint->qps[qp].rd_credit_send_lock = 0; - /* setup rem_info */ - endpoint->rem_info.rem_qps[qp].rem_qp_num = 0; - endpoint->rem_info.rem_qps[qp].rem_psn = 0; + mca_btl_openib_qp_t *qp = calloc(1, sizeof(mca_btl_openib_qp_t)); + if(!qp) { + BTL_ERROR(("Failed to allocate memory for qp")); + return NULL; + } - OBJ_CONSTRUCT(&endpoint->qps[qp].pending_frags[0], opal_list_t); - OBJ_CONSTRUCT(&endpoint->qps[qp].pending_frags[1], opal_list_t); - if(BTL_OPENIB_QP_TYPE_PP(qp)) { - /* local credits are set here such that on initial posting - * of the receive buffers we end up with zero credits to return - * to our peer. The peer initializes his sd_credits to reflect this - * below. Note that this may be a problem for iWARP as the sender - * now has credits even if the receive buffers are not yet posted - */ - endpoint->qps[qp].u.pp_qp.rd_credits = - -mca_btl_openib_component.qp_infos[qp].rd_num; - - endpoint->qps[qp].u.pp_qp.rd_posted = 0; - endpoint->qps[qp].u.pp_qp.cm_sent = 0; - endpoint->qps[qp].u.pp_qp.cm_return = - -mca_btl_openib_component.qp_infos[qp].u.pp_qp.rd_rsv; - endpoint->qps[qp].u.pp_qp.cm_received = - mca_btl_openib_component.qp_infos[qp].u.pp_qp.rd_rsv; + OBJ_CONSTRUCT(&qp->pending_frags[0], opal_list_t); + OBJ_CONSTRUCT(&qp->pending_frags[1], opal_list_t); + OBJ_CONSTRUCT(&qp->lock, opal_mutex_t); - /* initialize the local view of credits */ - endpoint->qps[qp].u.pp_qp.sd_credits = - mca_btl_openib_component.qp_infos[qp].rd_num; - - /* number of available send wqes */ - endpoint->qps[qp].sd_wqe = mca_btl_openib_component.qp_infos[qp].rd_num; - - } else { - /* number of available send wqes */ - endpoint->qps[qp].sd_wqe = mca_btl_openib_component.qp_infos[qp].u.srq_qp.sd_max; - } - + return qp; +} + +static void +endpoint_init_qp_pp(mca_btl_openib_endpoint_qp_t *ep_qp, const int qp) +{ + mca_btl_openib_qp_info_t *qp_info = &mca_btl_openib_component.qp_infos[qp]; + ep_qp->qp = endpoint_alloc_qp(); + ep_qp->qp->users++; + + /* local credits are set here such that on initial posting + * of the receive buffers we end up with zero credits to return + * to our peer. The peer initializes his sd_credits to reflect this + * below. Note that this may be a problem for iWARP as the sender + * now has credits even if the receive buffers are not yet posted + */ + ep_qp->u.pp_qp.rd_credits = -qp_info->rd_num; + + ep_qp->u.pp_qp.rd_posted = 0; + ep_qp->u.pp_qp.cm_sent = 0; + ep_qp->u.pp_qp.cm_return = -qp_info->u.pp_qp.rd_rsv; + ep_qp->u.pp_qp.cm_received = qp_info->u.pp_qp.rd_rsv; + + /* initialize the local view of credits */ + ep_qp->u.pp_qp.sd_credits = qp_info->rd_num; + + /* number of available send WQEs */ + ep_qp->qp->sd_wqe = qp_info->rd_num; +} + +static void +endpoint_init_qp_srq(mca_btl_openib_endpoint_qp_t *ep_qp, const int qp) +{ + ep_qp->qp = endpoint_alloc_qp(); + ep_qp->qp->users++; + + /* number of available send WQEs */ + ep_qp->qp->sd_wqe = mca_btl_openib_component.qp_infos[qp].u.srq_qp.sd_max; +} + +static void endpoint_init_qp(mca_btl_openib_endpoint_qp_t *ep_qp, const int qp) +{ + ep_qp->rd_credit_send_lock = 0; + ep_qp->credit_frag = NULL; + + OBJ_CONSTRUCT(&ep_qp->pending_frags[0], opal_list_t); + OBJ_CONSTRUCT(&ep_qp->pending_frags[1], opal_list_t); + switch(BTL_OPENIB_QP_TYPE(qp)) { + case MCA_BTL_OPENIB_PP_QP: + endpoint_init_qp_pp(ep_qp, qp); + break; + case MCA_BTL_OPENIB_SRQ_QP: + endpoint_init_qp_srq(ep_qp, qp); + break; + default: + BTL_ERROR(("Wrong QP type")); + break; + } } static void mca_btl_openib_endpoint_construct(mca_btl_base_endpoint_t* endpoint) @@ -308,20 +340,13 @@ static void mca_btl_openib_endpoint_construct(mca_btl_base_endpoint_t* endpoint) int qp; /* setup qp structures */ - if( mca_btl_openib_component.num_qps > 0 ) { - endpoint->qps = - (mca_btl_openib_endpoint_qp_t*) - malloc(sizeof(mca_btl_openib_endpoint_qp_t) * - mca_btl_openib_component.num_qps); - memset(endpoint->qps, 0, sizeof(mca_btl_openib_endpoint_qp_t) * - mca_btl_openib_component.num_qps); - endpoint->rem_info.rem_qps = - (mca_btl_openib_rem_qp_info_t*) - malloc(sizeof(mca_btl_openib_rem_qp_info_t) * - mca_btl_openib_component.num_qps); - memset(endpoint->rem_info.rem_qps, 0, - sizeof(mca_btl_openib_rem_qp_info_t) * - mca_btl_openib_component.num_qps); + if( mca_btl_openib_component.num_qps > 0 ) { + endpoint->qps = (mca_btl_openib_endpoint_qp_t*) + calloc(mca_btl_openib_component.num_qps, + sizeof(mca_btl_openib_endpoint_qp_t)); + endpoint->rem_info.rem_qps = (mca_btl_openib_rem_qp_info_t*) + calloc(mca_btl_openib_component.num_qps, + sizeof(mca_btl_openib_rem_qp_info_t)); } endpoint->endpoint_btl = 0; @@ -353,7 +378,10 @@ static void mca_btl_openib_endpoint_construct(mca_btl_base_endpoint_t* endpoint) endpoint->eager_rdma_local.credits = 0; for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) { - mca_btl_openib_endpoint_construct_qp(endpoint, qp); + endpoint_init_qp(&endpoint->qps[qp], qp); + /* setup rem_info */ + endpoint->rem_info.rem_qps[qp].rem_qp_num = 0; + endpoint->rem_info.rem_qps[qp].rem_psn = 0; } } @@ -394,9 +422,13 @@ static void mca_btl_openib_endpoint_destruct(mca_btl_base_endpoint_t* endpoint) MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS(&endpoint->qps[qp].pending_frags[1]); OBJ_DESTRUCT(&endpoint->qps[qp].pending_frags[0]); OBJ_DESTRUCT(&endpoint->qps[qp].pending_frags[1]); - if(ibv_destroy_qp(endpoint->qps[qp].lcl_qp)) { + OBJ_DESTRUCT(&endpoint->qps[qp].qp->pending_frags[0]); + OBJ_DESTRUCT(&endpoint->qps[qp].qp->pending_frags[1]); + if(ibv_destroy_qp(endpoint->qps[qp].qp->lcl_qp)) { BTL_ERROR(("Failed to destroy QP:%d\n", qp)); } + if(--endpoint->qps[qp].qp->users == 0) + free(endpoint->qps[qp].qp); } /* free the qps */ free(endpoint->qps); @@ -548,7 +580,7 @@ static void mca_btl_openib_endpoint_credits( /* we don't acquire a WQE for credit message - so decrement. * Note: doing it for QP used for credit management */ - OPAL_THREAD_ADD32(&ep->qps[des->order].sd_wqe, -1); + qp_get_wqe(ep, des->order); if(check_send_credits(ep, qp) || check_eager_rdma_credits(ep)) mca_btl_openib_endpoint_send_credits(ep, qp); diff --git a/ompi/mca/btl/openib/btl_openib_endpoint.h b/ompi/mca/btl/openib/btl_openib_endpoint.h index 2032dd4b7c..96bfbdeeb6 100644 --- a/ompi/mca/btl/openib/btl_openib_endpoint.h +++ b/ompi/mca/btl/openib/btl_openib_endpoint.h @@ -111,23 +111,27 @@ struct mca_btl_openib_endpoint_srq_qp_t { int32_t dummy; }; typedef struct mca_btl_openib_endpoint_srq_qp_t mca_btl_openib_endpoint_srq_qp_t; - -struct mca_btl_openib_endpoint_qp_t { - struct ibv_qp* lcl_qp; /* Local QP (Low and High) */ - uint32_t lcl_psn; +typedef struct mca_btl_openib_qp_t { + struct ibv_qp *lcl_qp; + uint32_t lcl_psn; int32_t sd_wqe; /**< number of available send wqe entries */ opal_list_t pending_frags[2]; /**< put fragments here if there is no wqe - available or, in case of PP QP, if there is - no credit available */ + available */ + int users; + opal_mutex_t lock; +} mca_btl_openib_qp_t; + +typedef struct mca_btl_openib_endpoint_qp_t { + mca_btl_openib_qp_t *qp; + opal_list_t pending_frags[2]; /**< put fragment here if there is no credits + available */ int32_t rd_credit_send_lock; /**< Lock credit send fragment */ mca_btl_openib_send_control_frag_t *credit_frag; union { mca_btl_openib_endpoint_srq_qp_t srq_qp; mca_btl_openib_endpoint_pp_qp_t pp_qp; } u; - -}; typedef struct mca_btl_openib_endpoint_qp_t mca_btl_openib_endpoint_qp_t; - +} mca_btl_openib_endpoint_qp_t; /** * An abstraction that represents a connection to a endpoint process. @@ -162,7 +166,7 @@ struct mca_btl_base_endpoint_t { * for this endpotint */ - mca_btl_openib_endpoint_qp_t * qps; + mca_btl_openib_endpoint_qp_t *qps; opal_list_t pending_get_frags; /**< list of pending rget ops */ opal_list_t pending_put_frags; /**< list of pending rput ops */ @@ -197,6 +201,16 @@ typedef mca_btl_base_endpoint_t mca_btl_openib_endpoint_t; OBJ_CLASS_DECLARATION(mca_btl_openib_endpoint_t); +static inline int32_t qp_get_wqe(mca_btl_openib_endpoint_t *ep, const int qp) +{ + return OPAL_THREAD_ADD32(&ep->qps[qp].qp->sd_wqe, -1); +} + +static inline int32_t qp_put_wqe(mca_btl_openib_endpoint_t *ep, const int qp) +{ + return OPAL_THREAD_ADD32(&ep->qps[qp].qp->sd_wqe, 1); +} + int mca_btl_openib_endpoint_send(mca_btl_base_endpoint_t*, mca_btl_openib_send_frag_t*); int mca_btl_openib_endpoint_post_send(mca_btl_openib_endpoint_t*, @@ -222,8 +236,8 @@ static inline int post_recvs(mca_btl_base_endpoint_t *ep, const int qp, OMPI_FREE_LIST_WAIT(free_list, item, rc); to_base_frag(item)->base.order = qp; to_com_frag(item)->endpoint = ep; - if((rc = ibv_post_recv(ep->qps[qp].lcl_qp, &to_recv_frag(item)->rd_desc, - &bad_wr))) { + if((rc = ibv_post_recv(ep->qps[qp].qp->lcl_qp, + &to_recv_frag(item)->rd_desc, &bad_wr))) { BTL_ERROR(("error posting receive on qp %d (%d from %d)\n", qp, i, num_post)); return OMPI_ERROR; diff --git a/ompi/mca/btl/openib/connect/btl_openib_connect_oob.c b/ompi/mca/btl/openib/connect/btl_openib_connect_oob.c index 51fc4425d5..e6ba58df91 100644 --- a/ompi/mca/btl/openib/connect/btl_openib_connect_oob.c +++ b/ompi/mca/btl/openib/connect/btl_openib_connect_oob.c @@ -194,7 +194,7 @@ static int qp_connect_all(mca_btl_openib_endpoint_t *endpoint) for (i = 0; i < mca_btl_openib_component.num_qps; i++) { struct ibv_qp_attr attr; - struct ibv_qp* qp = endpoint->qps[i].lcl_qp; + struct ibv_qp* qp = endpoint->qps[i].qp->lcl_qp; enum ibv_mtu mtu = (openib_btl->hca->mtu < endpoint->rem_info.rem_mtu) ? openib_btl->hca->mtu : endpoint->rem_info.rem_mtu; @@ -242,7 +242,7 @@ static int qp_connect_all(mca_btl_openib_endpoint_t *endpoint) * it to zero helps to catch bugs */ attr.rnr_retry = BTL_OPENIB_QP_TYPE_PP(i) ? 0 : mca_btl_openib_component.ib_rnr_retry; - attr.sq_psn = endpoint->qps[i].lcl_psn; + attr.sq_psn = endpoint->qps[i].qp->lcl_psn; attr.max_rd_atomic = mca_btl_openib_component.ib_max_rdma_dst_ops; if (ibv_modify_qp(qp, &attr, IBV_QP_STATE | @@ -356,7 +356,7 @@ static int qp_create_one(mca_btl_base_endpoint_t* endpoint, int prio, int qp, BTL_ERROR(("error creating qp errno says %s", strerror(errno))); return OMPI_ERROR; } - endpoint->qps[qp].lcl_qp = my_qp; + endpoint->qps[qp].qp->lcl_qp = my_qp; openib_btl->ib_inline_max = init_attr.cap.max_inline_data; attr.qp_state = IBV_QPS_INIT; @@ -364,7 +364,7 @@ static int qp_create_one(mca_btl_base_endpoint_t* endpoint, int prio, int qp, attr.port_num = openib_btl->port_num; attr.qp_access_flags = IBV_ACCESS_REMOTE_WRITE | IBV_ACCESS_REMOTE_READ; - if (ibv_modify_qp(endpoint->qps[qp].lcl_qp, + if (ibv_modify_qp(endpoint->qps[qp].qp->lcl_qp, &attr, IBV_QP_STATE | IBV_QP_PKEY_INDEX | @@ -375,7 +375,7 @@ static int qp_create_one(mca_btl_base_endpoint_t* endpoint, int prio, int qp, } /* Setup meta data on the endpoint */ - endpoint->qps[qp].lcl_psn = lrand48() & 0xffffff; + endpoint->qps[qp].qp->lcl_psn = lrand48() & 0xffffff; endpoint->qps[qp].credit_frag = NULL; openib_btl->hca->cq_users[prio]++; @@ -435,14 +435,14 @@ static int send_connect_data(mca_btl_base_endpoint_t* endpoint, /* stuff all the QP info into the buffer */ for (qp = 0; qp < mca_btl_openib_component.num_qps; qp++) { BTL_VERBOSE(("packing %d of %d\n", 1, ORTE_UINT32)); - rc = orte_dss.pack(buffer, &endpoint->qps[qp].lcl_qp->qp_num, + rc = orte_dss.pack(buffer, &endpoint->qps[qp].qp->lcl_qp->qp_num, 1, ORTE_UINT32); if (ORTE_SUCCESS != rc) { ORTE_ERROR_LOG(rc); return rc; } BTL_VERBOSE(("packing %d of %d\n", 1, ORTE_UINT32)); - rc = orte_dss.pack(buffer, &endpoint->qps[qp].lcl_psn, 1, + rc = orte_dss.pack(buffer, &endpoint->qps[qp].qp->lcl_psn, 1, ORTE_UINT32); if (ORTE_SUCCESS != rc) { ORTE_ERROR_LOG(rc); @@ -618,9 +618,9 @@ static void rml_recv_cb(int status, orte_process_name_t* process_name, instance the reply belongs to */ for (i = 0; i < ib_proc->proc_endpoint_count; i++) { ib_endpoint = ib_proc->proc_endpoints[i]; - if (ib_endpoint->qps[0].lcl_qp != NULL && + if (ib_endpoint->qps[0].qp->lcl_qp != NULL && lcl_lid == ib_endpoint->endpoint_btl->lid && - lcl_qp == ib_endpoint->qps[0].lcl_qp->qp_num && + lcl_qp == ib_endpoint->qps[0].qp->lcl_qp->qp_num && rem_info.rem_subnet_id == ib_endpoint->subnet_id) { found = true; break;