@@ -144,6 +144,7 @@ static void mca_btl_uct_tl_constructor(mca_btl_uct_tl_t *tl)
144144{
145145 memset ((void * ) ((uintptr_t ) tl + sizeof (tl -> super )), 0 , sizeof (* tl ) - sizeof (tl -> super ));
146146 OBJ_CONSTRUCT (& tl -> tl_lock , opal_mutex_t );
147+ OBJ_CONSTRUCT (& tl -> pending_connection_reqs , opal_fifo_t );
147148}
148149
149150static void mca_btl_uct_tl_destructor (mca_btl_uct_tl_t * tl )
@@ -172,21 +173,22 @@ static void mca_btl_uct_tl_destructor(mca_btl_uct_tl_t *tl)
172173 }
173174
174175 OBJ_DESTRUCT (& tl -> tl_lock );
176+ OBJ_DESTRUCT (& tl -> pending_connection_reqs );
175177}
176178
177179OBJ_CLASS_INSTANCE (mca_btl_uct_tl_t , opal_list_item_t , mca_btl_uct_tl_constructor ,
178180 mca_btl_uct_tl_destructor );
179181
180182static ucs_status_t mca_btl_uct_conn_req_cb (void * arg , void * data , size_t length , unsigned flags )
181183{
182- mca_btl_uct_module_t * module = (mca_btl_uct_module_t * ) arg ;
184+ mca_btl_uct_tl_t * tl = (mca_btl_uct_tl_t * ) arg ;
183185 mca_btl_uct_pending_connection_request_t * request = calloc (1 , length + sizeof (request -> super ));
184186
185187 /* it is not safe to process the connection request from the callback so just save it for
186188 * later processing */
187189 OBJ_CONSTRUCT (request , mca_btl_uct_pending_connection_request_t );
188190 memcpy (& request -> request_data , (void * ) ((intptr_t ) data + 8 ), length );
189- opal_fifo_push_atomic (& module -> pending_connection_reqs , & request -> super );
191+ opal_fifo_push_atomic (& tl -> pending_connection_reqs , & request -> super );
190192
191193 return UCS_OK ;
192194}
@@ -241,20 +243,21 @@ int mca_btl_uct_process_connection_request(mca_btl_uct_module_t *module,
241243 return OPAL_SUCCESS ;
242244}
243245
244- static int mca_btl_uct_setup_connection_tl (mca_btl_uct_module_t * module )
246+ static int mca_btl_uct_setup_connection_tl (mca_btl_uct_tl_t * tl )
245247{
246248 ucs_status_t ucs_status ;
247249
248- if (NULL == module -> conn_tl ) {
250+ if (NULL == tl ) {
249251 return OPAL_ERR_NOT_SUPPORTED ;
250252 }
251253
252- mca_btl_uct_device_context_t * context = mca_btl_uct_module_get_tl_context_specific (module , module -> conn_tl ,
253- /*context_id=*/ 0 );
254+ mca_btl_uct_device_context_t * context =
255+ mca_btl_uct_module_get_tl_context_specific (/*module=*/ NULL , tl ,
256+ /*context_id=*/ 0 );
254257
255258 ucs_status = uct_iface_set_am_handler (context -> uct_iface ,
256- MCA_BTL_UCT_CONNECT_RDMA , mca_btl_uct_conn_req_cb , module ,
257- UCT_CB_FLAG_ASYNC );
259+ MCA_BTL_UCT_CONNECT_RDMA , mca_btl_uct_conn_req_cb ,
260+ tl , UCT_CB_FLAG_ASYNC );
258261 if (UCS_OK != ucs_status ) {
259262 BTL_ERROR (("could not set active message handler for uct tl" ));
260263 }
@@ -383,7 +386,7 @@ mca_btl_uct_device_context_t *mca_btl_uct_context_create(mca_btl_uct_module_t *m
383386 return NULL ;
384387 }
385388
386- if (tl == module -> am_tl ) {
389+ if (module != NULL && tl == module -> am_tl ) {
387390 BTL_VERBOSE (("installing AM handler for tl %p context id %d" , (void * ) tl , context_id ));
388391 uct_iface_set_am_handler (context -> uct_iface , MCA_BTL_UCT_FRAG , mca_btl_uct_am_handler ,
389392 context , MCA_BTL_UCT_CB_FLAG_SYNC );
@@ -524,7 +527,7 @@ static int mca_btl_uct_set_tl_conn(mca_btl_uct_module_t *module, mca_btl_uct_tl_
524527 BTL_VERBOSE (("tl %s is suitable for making connections" , tl -> uct_tl_name ));
525528
526529 module -> conn_tl = tl ;
527- rc = mca_btl_uct_setup_connection_tl (module );
530+ rc = mca_btl_uct_setup_connection_tl (tl );
528531 if (OPAL_SUCCESS != rc ) {
529532 return rc ;
530533 }
0 commit comments