@@ -648,9 +648,10 @@ static int init_one_port(opal_list_t *btl_list, mca_btl_openib_device_t *device,
648
648
sizeof (mca_btl_openib_module ));
649
649
ib_selected = OBJ_NEW (mca_btl_base_selected_module_t );
650
650
ib_selected -> btl_module = (mca_btl_base_module_t * ) openib_btl ;
651
- openib_btl -> device = device ;
652
651
openib_btl -> port_num = (uint8_t ) port_num ;
653
652
openib_btl -> allowed = false;
653
+ openib_btl -> device = NULL ;
654
+ openib_btl -> device_name = strdup (ibv_get_device_name (device -> ib_dev ));
654
655
OBJ_CONSTRUCT (& openib_btl -> ib_lock , opal_mutex_t );
655
656
opal_list_append (btl_list , (opal_list_item_t * ) ib_selected );
656
657
opal_pointer_array_add (device -> device_btls , (void * ) openib_btl );
@@ -784,6 +785,7 @@ static int init_one_port(opal_list_t *btl_list, mca_btl_openib_device_t *device,
784
785
ib_selected = OBJ_NEW (mca_btl_base_selected_module_t );
785
786
ib_selected -> btl_module = (mca_btl_base_module_t * ) openib_btl ;
786
787
openib_btl -> device = device ;
788
+ openib_btl -> device_name = NULL ;
787
789
openib_btl -> port_num = (uint8_t ) port_num ;
788
790
openib_btl -> pkey_index = pkey_index ;
789
791
openib_btl -> lid = lid ;
@@ -904,6 +906,7 @@ static int init_one_port(opal_list_t *btl_list, mca_btl_openib_device_t *device,
904
906
opal_list_append (btl_list , (opal_list_item_t * ) ib_selected );
905
907
opal_pointer_array_add (device -> device_btls , (void * ) openib_btl );
906
908
++ device -> btls ;
909
+ ++ device -> allowed_btls ;
907
910
++ mca_btl_openib_component .ib_num_btls ;
908
911
++ mca_btl_openib_component .ib_allowed_btls ;
909
912
if (-1 != mca_btl_openib_component .ib_max_btls &&
@@ -1933,7 +1936,7 @@ static int init_one_device(opal_list_t *btl_list, struct ibv_device* ib_dev)
1933
1936
if (ib_port_attr .active_mtu < device -> mtu ){
1934
1937
device -> mtu = ib_port_attr .active_mtu ;
1935
1938
}
1936
- if (mca_btl_openib_component .apm_ports && device -> btls > 0 ) {
1939
+ if (mca_btl_openib_component .apm_ports && device -> allowed_btls > 0 ) {
1937
1940
init_apm_port (device , i , ib_port_attr .lid );
1938
1941
break ;
1939
1942
}
@@ -1969,7 +1972,7 @@ static int init_one_device(opal_list_t *btl_list, struct ibv_device* ib_dev)
1969
1972
1970
1973
/* If we made a BTL, check APM status and return. Otherwise, fall
1971
1974
through and destroy everything */
1972
- if (device -> btls > 0 ) {
1975
+ if (device -> allowed_btls > 0 ) {
1973
1976
/* if apm was enabled it should be > 1 */
1974
1977
if (1 == mca_btl_openib_component .apm_ports ) {
1975
1978
opal_show_help ("help-mpi-btl-openib.txt" ,
@@ -2290,6 +2293,11 @@ static int init_one_device(opal_list_t *btl_list, struct ibv_device* ib_dev)
2290
2293
good :
2291
2294
mca_btl_openib_component .devices_count ++ ;
2292
2295
return OPAL_SUCCESS ;
2296
+ } else if (device -> btls > 0 ) {
2297
+ /* no port is allowed to be used by btl/openib,
2298
+ * so release the device right away */
2299
+ OBJ_RELEASE (device );
2300
+ return OPAL_SUCCESS ;
2293
2301
}
2294
2302
2295
2303
error :
0 commit comments