@@ -52,47 +52,54 @@ static void uct_ib_mlx5dv_check_direct_nic(struct ibv_context *ctx,
5252 uct_ib_mlx5_md_t * md ,
5353 const uct_ib_md_config_t * md_config )
5454{
55- #if HAVE_DIRECT_NIC
55+ #if HAVE_DECL_MLX5DV_GET_DATA_DIRECT_SYSFS_PATH
5656 char sys_path [PATH_MAX ];
5757 char dev_name [64 ];
5858 int ret ;
59+ ucs_sys_device_t sys_dev_dnic ;
5960 ucs_status_t status ;
6061
6162 if (!md_config -> ext .direct_nic ) {
63+ ucs_debug ("%s: direct NIC is disabled by configuration" ,
64+ uct_ib_device_name (& md -> super .dev ));
6265 goto out ;
6366 }
6467
6568 ret = mlx5dv_get_data_direct_sysfs_path (ctx , sys_path , sizeof (sys_path ));
6669 if (ret != 0 ) {
6770 ucs_debug ("%s: mlx5dv_get_data_direct_sysfs_path() failed: ret=%d" ,
6871 uct_ib_device_name (& md -> super .dev ), ret );
69- goto out ;
72+ goto out_not_supported ;
7073 }
7174
7275 /* Create a DMA specific device from topology perspective */
7376 snprintf (dev_name , sizeof (dev_name ), "%s_direct" ,
7477 uct_ib_device_name (& md -> super .dev ));
75- md -> direct_nic_sys_dev = ucs_topo_get_sysfs_dev (dev_name , sys_path , 0 );
78+ sys_dev_dnic = ucs_topo_get_sysfs_dev (dev_name , sys_path , 0 );
7679
77- status = ucs_topo_sys_device_set_sys_dev_aux (dev -> sys_dev ,
78- md -> direct_nic_sys_dev );
80+ status = ucs_topo_sys_device_set_sys_dev_aux (dev -> sys_dev , sys_dev_dnic );
7981 if (status != UCS_OK ) {
80- ucs_debug ("ucs_topo_sys_device_set_sys_dev_aux failed: %s" ,
81- ucs_status_string (status ));
82- goto out ;
82+ goto out_not_supported ;
8383 }
8484
8585 ucs_debug ("%s: Direct NIC is supported sys_path='%s%s' "
8686 "sys_dev=%u sys_dev_aux=%u" ,
8787 uct_ib_device_name (& md -> super .dev ),
8888 (sys_path [0 ] != 0 ) ? "/sys" : "" , sys_path , dev -> sys_dev ,
89- md -> direct_nic_sys_dev );
89+ sys_dev_dnic );
90+ md -> direct_nic_sys_dev = sys_dev_dnic ;
9091 return ;
92+
93+ out_not_supported :
94+ ucs_debug ("%s: direct NIC is requested but not supported" ,
95+ uct_ib_device_name (& md -> super .dev ));
9196out :
97+ #else
98+ ucs_debug ("%s: direct NIC is disabled because declaration of "
99+ "mlx5dv_get_data_direct_sysfs_path was not found" ,
100+ uct_ib_device_name (& md -> super .dev ));
92101#endif
93102 md -> direct_nic_sys_dev = UCS_SYS_DEVICE_ID_UNKNOWN ;
94- ucs_debug ("%s: Direct NIC support disabled" ,
95- uct_ib_device_name (& md -> super .dev ));
96103}
97104
98105#if HAVE_DEVX
@@ -769,7 +776,7 @@ uct_ib_mlx5_direct_nic_reg_mr(uct_ib_mlx5_md_t *md, void *address,
769776 const uct_md_mem_reg_params_t * params ,
770777 uint64_t access_flags )
771778{
772- #if HAVE_DIRECT_NIC
779+ #if HAVE_DECL_MLX5DV_REG_DMABUF_MR
773780 int dmabuf_fd ;
774781 size_t dmabuf_offset ;
775782 struct ibv_mr * mr ;
0 commit comments