1414 * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
1515 * Copyright (c) 2010-2014 Los Alamos National Security, LLC. All rights
1616 * reserved.
17+ * Copyright (c) 2021 Google, LLC. All rights reserved.
1718 * $COPYRIGHT$
1819 *
1920 * Additional copyrights may follow
@@ -42,18 +43,25 @@ int mca_btl_sm_send (struct mca_btl_base_module_t *btl,
4243 mca_btl_sm_frag_t * frag = (mca_btl_sm_frag_t * ) descriptor ;
4344 const size_t total_size = frag -> segments [0 ].seg_len ;
4445
45- /* in order to work around a long standing ob1 bug (see #3845) we have to always
46- * make the callback. once this is fixed in ob1 we can restore the code below. */
47- frag -> base .des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK ;
46+ if (frag -> base .des_cbfunc ) {
47+ /* in order to work around a long standing ob1 bug (see #3845) we have to always
48+ * make the callback. once this is fixed in ob1 we can restore the code below. */
49+ frag -> base .des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK ;
50+ }
4851
4952 /* header (+ optional inline data) */
5053 frag -> hdr -> len = total_size ;
5154 /* type of message, pt-2-pt, one-sided, etc */
5255 frag -> hdr -> tag = tag ;
5356
57+ /* clear the complete flag if it has been set */
58+ frag -> hdr -> flags &= ~MCA_BTL_SM_FLAG_COMPLETE ;
59+
5460 /* post the relative address of the descriptor into the peer's fifo */
5561 if (opal_list_get_size (& endpoint -> pending_frags ) || !sm_fifo_write_ep (frag -> hdr , endpoint )) {
56- frag -> base .des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK ;
62+ if (frag -> base .des_cbfunc ) {
63+ frag -> base .des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK ;
64+ }
5765 OPAL_THREAD_LOCK (& endpoint -> pending_frags_lock );
5866 opal_list_append (& endpoint -> pending_frags , (opal_list_item_t * ) frag );
5967 if (!endpoint -> waiting ) {
@@ -69,8 +77,9 @@ int mca_btl_sm_send (struct mca_btl_base_module_t *btl,
6977 return OPAL_SUCCESS ;
7078
7179#if 0
72- if ((frag -> hdr -> flags & MCA_BTL_SM_FLAG_SINGLE_COPY ) ||
73- !(frag -> base .des_flags & MCA_BTL_DES_FLAGS_BTL_OWNERSHIP )) {
80+ if (((frag -> hdr -> flags & MCA_BTL_SM_FLAG_SINGLE_COPY ) ||
81+ !(frag -> base .des_flags & MCA_BTL_DES_FLAGS_BTL_OWNERSHIP )) &&
82+ frag -> base .des_cbfunc ) {
7483 frag -> base .des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK ;
7584
7685 return OPAL_SUCCESS ;
0 commit comments