From bb03e07ec40800f9de8d06605f5833b5d050aaf8 Mon Sep 17 00:00:00 2001 From: Gleb Natapov Date: Tue, 29 Jan 2008 14:35:33 +0000 Subject: [PATCH] Move eager RDMA channels accounting into completion callback. Otherwise it can go wrong with XRC as endpoint may be not yet connected at the time eager rdma channel is created. This commit was SVN r17302. --- ompi/mca/btl/openib/btl_openib_endpoint.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ompi/mca/btl/openib/btl_openib_endpoint.c b/ompi/mca/btl/openib/btl_openib_endpoint.c index 335873a72a..e5cfafeae0 100644 --- a/ompi/mca/btl/openib/btl_openib_endpoint.c +++ b/ompi/mca/btl/openib/btl_openib_endpoint.c @@ -735,6 +735,12 @@ static void mca_btl_openib_endpoint_eager_rdma_connect_cb( struct mca_btl_base_descriptor_t* descriptor, int status) { + mca_btl_openib_hca_t *hca = endpoint->endpoint_btl->hca; + mca_btl_openib_module_t* openib_btl = + (mca_btl_openib_module_t*)btl; + OPAL_THREAD_ADD32(&hca->non_eager_rdma_endpoints, -1); + assert(hca->non_eager_rdma_endpoints >= 0); + OPAL_THREAD_ADD32(&openib_btl->eager_rdma_channels, 1); MCA_BTL_IB_FRAG_RETURN(descriptor); } @@ -874,9 +880,6 @@ void mca_btl_openib_endpoint_connect_eager_rdma( p = &hca->eager_rdma_buffers[hca->eager_rdma_buffers_count]; } while(!opal_atomic_cmpset_ptr(p, NULL, endpoint)); - OPAL_THREAD_ADD32(&hca->non_eager_rdma_endpoints, -1); - assert(hca->non_eager_rdma_endpoints >= 0); - OPAL_THREAD_ADD32(&openib_btl->eager_rdma_channels, 1); /* from this point progress function starts to poll new buffer */ OPAL_THREAD_ADD32(&hca->eager_rdma_buffers_count, 1); return;