4343
4444/* Open MPI includes */
4545#include "opal/mca/event/event.h"
46- #include "ompi /class/ompi_free_list .h"
47- #include "ompi /mca/btl/btl.h"
48- #include "ompi /mca/btl/base/base.h"
49- #include "ompi /mca/mpool/mpool.h"
46+ #include "opal /class/opal_free_list .h"
47+ #include "opal /mca/btl/btl.h"
48+ #include "opal /mca/btl/base/base.h"
49+ #include "opal /mca/mpool/mpool.h"
5050#include "opal/class/opal_hash_table.h"
51+ #include "opal/util/fd.h"
5152
5253#define MCA_BTL_TCP_STATISTICS 0
5354BEGIN_C_DECLS
5455
5556#if (HAVE_PTHREAD_H == 1 )
56- #define MCA_BTL_TCP_USES_PROGRESS_THREAD 1
57+ #define MCA_BTL_TCP_SUPPORT_PROGRESS_THREAD 1
5758#else
58- #define MCA_BTL_TCP_USES_PROGRESS_THREAD 0
59+ #define MCA_BTL_TCP_SUPPORT_PROGRESS_THREAD 0
5960#endif /* (HAVE_PTHREAD_H == 1) */
6061
6162extern opal_event_base_t * mca_btl_tcp_event_base ;
@@ -80,10 +81,11 @@ extern opal_event_base_t* mca_btl_tcp_event_base;
8081 } \
8182 } while (0)
8283
83- #if MCA_BTL_TCP_USES_PROGRESS_THREAD
84+ #if MCA_BTL_TCP_SUPPORT_PROGRESS_THREAD
8485extern opal_list_t mca_btl_tcp_ready_frag_pending_queue ;
8586extern opal_mutex_t mca_btl_tcp_ready_frag_mutex ;
8687extern int mca_btl_tcp_pipe_to_progress [2 ];
88+ extern int mca_btl_tcp_progress_thread_trigger ;
8789
8890#define MCA_BTL_TCP_CRITICAL_SECTION_ENTER (name ) \
8991 opal_mutex_atomic_lock((name))
@@ -109,9 +111,14 @@ extern int mca_btl_tcp_pipe_to_progress[2];
109111 } while (0)
110112#define MCA_BTL_TCP_ACTIVATE_EVENT (event , value ) \
111113 do { \
112- opal_event_t* _event = (opal_event_t*)(event); \
113- opal_fd_write( mca_btl_tcp_pipe_to_progress[1], sizeof(opal_event_t*), \
114- &_event); \
114+ if(0 < mca_btl_tcp_progress_thread_trigger) { \
115+ opal_event_t* _event = (opal_event_t*)(event); \
116+ opal_fd_write( mca_btl_tcp_pipe_to_progress[1], sizeof(opal_event_t*), \
117+ &_event); \
118+ } \
119+ else { \
120+ opal_event_add(event, (value)); \
121+ } \
115122 } while (0)
116123#else
117124#define MCA_BTL_TCP_CRITICAL_SECTION_ENTER (name )
@@ -124,7 +131,7 @@ extern int mca_btl_tcp_pipe_to_progress[2];
124131 do { \
125132 opal_event_add(event, (value)); \
126133 } while (0)
127- #endif /* MCA_BTL_TCP_USES_PROGRESS_THREAD */
134+ #endif /* MCA_BTL_TCP_SUPPORT_PROGRESS_THREAD */
128135
129136/**
130137 * TCP BTL component.
@@ -143,6 +150,7 @@ struct mca_btl_tcp_component_t {
143150 int tcp_endpoint_cache ; /**< amount of cache on each endpoint */
144151 opal_proc_table_t tcp_procs ; /**< hash table of tcp proc structures */
145152 opal_mutex_t tcp_lock ; /**< lock for accessing module state */
153+ opal_list_t tcp_events ;
146154
147155 opal_event_t tcp_recv_event ; /**< recv event for IPv4 listen socket */
148156 int tcp_listen_sd ; /**< IPv4 listen socket for incoming connection requests */
@@ -169,7 +177,9 @@ struct mca_btl_tcp_component_t {
169177 opal_free_list_t tcp_frag_max ;
170178 opal_free_list_t tcp_frag_user ;
171179
172- #if MCA_BTL_TCP_USES_PROGRESS_THREAD
180+ int tcp_enable_progress_thread ; /** Support for tcp progress thread flag */
181+
182+ #if MCA_BTL_TCP_SUPPORT_PROGRESS_THREAD
173183 opal_event_t tcp_recv_thread_async_event ;
174184 opal_mutex_t tcp_frag_eager_mutex ;
175185 opal_mutex_t tcp_frag_max_mutex ;
0 commit comments