2005-06-30 09:50:55 +04:00
|
|
|
#ifndef MCA_BTL_SM_FIFO_H
|
|
|
|
#define MCA_BTL_SM_FIFO_H
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
#include "btl_sm.h"
|
2005-09-12 00:55:22 +04:00
|
|
|
#include "btl_sm_endpoint.h"
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2005-09-12 00:55:22 +04:00
|
|
|
#define MCA_BTL_SM_FIFO_WRITE(endpoint_peer, my_smp_rank,peer_smp_rank,frag,rc) \
|
2005-05-24 02:06:50 +04:00
|
|
|
do { \
|
|
|
|
ompi_fifo_t* fifo; \
|
2005-06-30 09:50:55 +04:00
|
|
|
fifo=&(mca_btl_sm_component.fifo[my_smp_rank][peer_smp_rank]); \
|
2005-05-24 02:06:50 +04:00
|
|
|
\
|
|
|
|
/* thread lock */ \
|
2005-07-04 02:45:48 +04:00
|
|
|
if(opal_using_threads()) \
|
2005-07-04 01:38:51 +04:00
|
|
|
opal_atomic_lock(&fifo->head_lock); \
|
2005-05-24 02:06:50 +04:00
|
|
|
if(OMPI_CB_FREE == fifo->head) { \
|
|
|
|
/* no queues have been allocated - allocate now */ \
|
|
|
|
rc=ompi_fifo_init_same_base_addr( \
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_sm_component.size_of_cb_queue, \
|
|
|
|
mca_btl_sm_component.cb_lazy_free_freq, \
|
2005-05-24 02:06:50 +04:00
|
|
|
/* at this stage we are not doing anything with memory \
|
|
|
|
* locality */ \
|
|
|
|
0,0,0, \
|
2005-06-30 09:50:55 +04:00
|
|
|
fifo, mca_btl_sm_component.sm_mpool); \
|
2005-05-24 02:06:50 +04:00
|
|
|
if( rc != OMPI_SUCCESS ) { \
|
2005-07-04 02:45:48 +04:00
|
|
|
if(opal_using_threads()) \
|
2005-07-04 01:38:51 +04:00
|
|
|
opal_atomic_unlock(&(fifo->head_lock)); \
|
2005-05-24 02:06:50 +04:00
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
/* post fragment */ \
|
|
|
|
rc=ompi_fifo_write_to_head_same_base_addr(frag, fifo, \
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_sm_component.sm_mpool); \
|
2005-05-24 02:06:50 +04:00
|
|
|
if( 0 <= rc ) { \
|
2005-09-12 00:55:22 +04:00
|
|
|
MCA_BTL_SM_SIGNAL_PEER(endpoint_peer); \
|
2005-05-24 02:06:50 +04:00
|
|
|
rc=OMPI_SUCCESS; \
|
|
|
|
} \
|
2005-07-04 02:45:48 +04:00
|
|
|
if(opal_using_threads()) \
|
2005-07-04 01:38:51 +04:00
|
|
|
opal_atomic_unlock(&fifo->head_lock); \
|
2005-05-24 02:06:50 +04:00
|
|
|
} while(0)
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|