1
1

usnic: refactor callback invocation

This makes it a little easier to see what's happening with callbacks to
the PML.

Reviewed-by: Jeff Squyres <jsquyres@cisco.com>
Reviewed-by: Reese Faucette <rfaucett@cisco.com>

This commit was SVN r29591.
Этот коммит содержится в:
Dave Goodell 2013-11-04 22:51:48 +00:00
родитель 4c791e21d2
Коммит 71d0d73575
3 изменённых файлов: 21 добавлений и 38 удалений

Просмотреть файл

@ -148,15 +148,7 @@ ompi_btl_usnic_handle_ack(
((frag->sf_base.uf_dst_seg[0].seg_addr.pval != NULL) ||
(frag->sf_base.uf_base.des_flags &
MCA_BTL_DES_SEND_ALWAYS_CALLBACK))) {
#if MSGDEBUG2
opal_output(0, "send completion callback frag=%p, dest=%p\n",
(void*)frag, frag->sf_base.uf_dst_seg[0].seg_addr.pval);
#endif
frag->sf_base.uf_base.des_cbfunc(&module->super,
frag->sf_endpoint, &frag->sf_base.uf_base,
OMPI_SUCCESS);
frag->sf_base.uf_base.des_flags &=
~MCA_BTL_DES_SEND_ALWAYS_CALLBACK;
OMPI_BTL_USNIC_DO_SEND_FRAG_CB(module, frag, "send completion");
}
/* free this segment */

Просмотреть файл

@ -18,6 +18,22 @@
#include "btl_usnic_frag.h"
#include "btl_usnic_endpoint.h"
/* Invoke the descriptor callback for the frag, updating stats and clearing the
* _CALLBACK flag in the process. */
#define OMPI_BTL_USNIC_DO_SEND_FRAG_CB(module, send_frag, comment) \
do { \
MSGDEBUG1_OUT("%s:%d: %s send callback for module=%p frag=%p\n", \
__func__, __LINE__, \
(comment), (void *)(module), (void *)(send_frag)); \
(send_frag)->sf_base.uf_base.des_cbfunc( \
&(module)->super, \
(send_frag)->sf_endpoint, \
&(send_frag)->sf_base.uf_base, \
OMPI_SUCCESS); \
frag->sf_base.uf_base.des_flags &= ~MCA_BTL_DES_SEND_ALWAYS_CALLBACK; \
++((module)->stats.pml_send_callbacks); \
} while (0)
/*
* Reap an ACK send that is complete
*/

Просмотреть файл

@ -962,16 +962,7 @@ usnic_handle_large_send(
(frag->sf_base.uf_base.des_flags &
MCA_BTL_DES_FLAGS_BTL_OWNERSHIP)) {
#if MSGDEBUG1
opal_output(0, "callback for large frag %p, len=%zd\n",
(void *)(uintptr_t)frag->sf_base.uf_base.des_cbfunc,
frag->sf_size);
#endif
frag->sf_base.uf_base.des_cbfunc(&module->super,
frag->sf_endpoint, &frag->sf_base.uf_base,
OMPI_SUCCESS);
++module->stats.pml_send_callbacks;
frag->sf_base.uf_base.des_flags &= ~MCA_BTL_DES_SEND_ALWAYS_CALLBACK;
OMPI_BTL_USNIC_DO_SEND_FRAG_CB(module, frag, "large");
}
}
}
@ -1071,17 +1062,7 @@ ompi_btl_usnic_module_progress_sends(
MCA_BTL_DES_FLAGS_BTL_OWNERSHIP)) ==
(MCA_BTL_DES_SEND_ALWAYS_CALLBACK |
MCA_BTL_DES_FLAGS_BTL_OWNERSHIP)) {
#if MSGDEBUG1
opal_output(0, "callback frag small %p, len=%"PRIu64"\n",
(void*)frag,
(unsigned long)frag->sf_base.uf_src_seg[0].seg_len);
#endif
frag->sf_base.uf_base.des_cbfunc(&module->super,
frag->sf_endpoint, &frag->sf_base.uf_base,
OMPI_SUCCESS);
++module->stats.pml_send_callbacks;
frag->sf_base.uf_base.des_flags &=
~MCA_BTL_DES_SEND_ALWAYS_CALLBACK;
OMPI_BTL_USNIC_DO_SEND_FRAG_CB(module, frag, "small");
}
}
@ -1257,26 +1238,20 @@ usnic_send(
*/
if (descriptor->des_flags & MCA_BTL_DES_FLAGS_BTL_OWNERSHIP) {
if (descriptor->des_flags & MCA_BTL_DES_SEND_ALWAYS_CALLBACK) {
#if MSGDEBUG1
opal_output(0, "immediate callback for frag %p\n", (void *)frag);
#endif
descriptor->des_flags &= ~MCA_BTL_DES_SEND_ALWAYS_CALLBACK;
frag->sf_base.uf_base.des_cbfunc(&module->super,
frag->sf_endpoint, &frag->sf_base.uf_base,
OMPI_SUCCESS);
OMPI_BTL_USNIC_DO_SEND_FRAG_CB(module, frag, "immediate small");
rc = 0;
} else {
#if MSGDEBUG1
opal_output(0, "skipping callback for frag %p\n", (void *)frag);
#endif
rc = 1;
++module->stats.pml_send_callbacks; /* returning "1" is an implicit CB */
}
} else {
descriptor->des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK;
rc = 0;
}
++module->stats.pml_module_sends;
++module->stats.pml_send_callbacks; /* returning "1" is an implicit CB */
return rc;
} else {
/*