Skip to content

Commit ed05ee1

Browse files
authored
Merge pull request #9695 from wzamazon/btl_am_rdma_handle_btl_send_return_1
btl/base_am_rdma: fix handling of btl_send returning 1
2 parents b821e8e + 7b177ce commit ed05ee1

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

opal/mca/btl/base/btl_base_am_rdma.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ static inline int mca_btl_base_am_rdma_advance(mca_btl_base_module_t *btl,
372372
mca_btl_base_rdma_context_t *context,
373373
bool send_descriptor)
374374
{
375+
int ret;
375376
const size_t remaining = context->total_size - context->sent;
376377

377378
if (0 == remaining) {
@@ -409,7 +410,12 @@ static inline int mca_btl_base_am_rdma_advance(mca_btl_base_module_t *btl,
409410
}
410411

411412
if (send_descriptor) {
412-
return btl->btl_send(btl, endpoint, descriptor, mca_btl_base_rdma_tag(hdr->type));
413+
assert(0 != (descriptor->des_flags && MCA_BTL_DES_SEND_ALWAYS_CALLBACK));
414+
ret = btl->btl_send(btl, endpoint, descriptor, mca_btl_base_rdma_tag(hdr->type));
415+
if (ret == 1) {
416+
ret = OPAL_SUCCESS;
417+
}
418+
return ret;
413419
}
414420

415421
/* queue for later to avoid btl_send in callback */
@@ -614,7 +620,14 @@ static int mca_btl_base_am_rdma_respond(mca_btl_base_module_t *btl,
614620

615621
send_descriptor->des_cbfunc = NULL;
616622

623+
/* There is no callback for the response descriptor, therefore it is
624+
* safe to treat 0 and 1 return codes the same
625+
*/
617626
int ret = btl->btl_send(btl, endpoint, send_descriptor, mca_btl_base_rdma_resp_tag());
627+
if (ret == 1) {
628+
ret = OPAL_SUCCESS;
629+
}
630+
618631
if (OPAL_UNLIKELY(OPAL_SUCCESS != ret)) {
619632
*descriptor = send_descriptor;
620633
}
@@ -787,11 +800,12 @@ static int mca_btl_base_am_rdma_progress(void)
787800
mca_btl_base_rdma_context_t *context = \
788801
(mca_btl_base_rdma_context_t *) \
789802
descriptor->descriptor->des_context; \
803+
assert(0 != (descriptor->descriptor->des_flags && MCA_BTL_DES_SEND_ALWAYS_CALLBACK)); \
790804
int ret = descriptor->btl->btl_send(descriptor->btl, \
791805
descriptor->endpoint, \
792806
descriptor->descriptor, \
793807
mca_btl_base_rdma_tag(context->type)); \
794-
if (OPAL_SUCCESS == ret) { \
808+
if (OPAL_SUCCESS == ret || 1 == ret) { \
795809
opal_list_remove_item(&default_module.queued_initiator_descriptors, \
796810
&descriptor->super); \
797811
} \

0 commit comments

Comments
 (0)