From c3bbf69356701be3287181b1dcfca5cf2721c1df Mon Sep 17 00:00:00 2001 From: Gleb Natapov Date: Mon, 7 Jan 2008 10:19:07 +0000 Subject: [PATCH] Set send_flags correctly in btl_openib_put. Otherwise we may reuse flags from previous use of the buffer and they may be incorrect. This commit was SVN r17058. --- ompi/mca/btl/openib/btl_openib.c | 1 + ompi/mca/btl/openib/btl_openib_endpoint.c | 6 +----- ompi/mca/btl/openib/btl_openib_endpoint.h | 6 ++++++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ompi/mca/btl/openib/btl_openib.c b/ompi/mca/btl/openib/btl_openib.c index 83e4e770b4..eb89322fb5 100644 --- a/ompi/mca/btl/openib/btl_openib.c +++ b/ompi/mca/btl/openib/btl_openib.c @@ -1156,6 +1156,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; + frag->sr_desc.send_flags = ib_send_flags(descriptor->des_src->seg_len, ep); if(ibv_post_send(ep->qps[qp].qp->lcl_qp, &frag->sr_desc, &bad_wr)) return OMPI_ERROR; diff --git a/ompi/mca/btl/openib/btl_openib_endpoint.c b/ompi/mca/btl/openib/btl_openib_endpoint.c index 432409e7a3..52e9e79025 100644 --- a/ompi/mca/btl/openib/btl_openib_endpoint.c +++ b/ompi/mca/btl/openib/btl_openib_endpoint.c @@ -60,11 +60,7 @@ static int post_send(mca_btl_openib_endpoint_t *ep, sg->length = seg->seg_len + sizeof(mca_btl_openib_header_t) + (rdma ? sizeof(mca_btl_openib_footer_t) : 0) + frag->coalesced_length; - if(sg->length <= openib_btl->ib_inline_max) { - sr_desc->send_flags = IBV_SEND_SIGNALED | IBV_SEND_INLINE; - } else { - sr_desc->send_flags = IBV_SEND_SIGNALED; - } + sr_desc->send_flags = ib_send_flags(sg->length, ep); if(ep->nbo) BTL_OPENIB_HEADER_HTON(*frag->hdr); diff --git a/ompi/mca/btl/openib/btl_openib_endpoint.h b/ompi/mca/btl/openib/btl_openib_endpoint.h index 3565a79ecc..7860af633b 100644 --- a/ompi/mca/btl/openib/btl_openib_endpoint.h +++ b/ompi/mca/btl/openib/btl_openib_endpoint.h @@ -381,6 +381,12 @@ static inline int check_endpoint_state(mca_btl_openib_endpoint_t *ep, return rc; } +static inline __opal_attribute_always_inline__ int +ib_send_flags(uint32_t size, mca_btl_openib_endpoint_t *ep) +{ + return IBV_SEND_SIGNALED | + ((size <= ep->endpoint_btl->ib_inline_max) ? IBV_SEND_INLINE : 0); +} END_C_DECLS #endif