On Tue, Oct 18, 2022 at 11:24:43AM +0300, Leon Romanovsky wrote: > On Sun, Oct 16, 2022 at 02:19:25AM -0400, Zhu Yanjun wrote: > > From: Zhu Yanjun <yanjun.zhu@xxxxxxxxx> > > > > Before mlx5 ib device is registered, the function ib_device_set_netdev > > is not called to map the mlx5 ib device with the related net device. > > > > As such, when the function ib_device_get_by_netdev is called to get ib > > device, NULL is returned. > > > > Other ib devices, such as irdma, rxe and so on, the function > > ib_device_get_by_netdev can get ib device from the related net device. > > Ohh, you opened Pandora box, everything around it looks half-backed. > > mlx4 and mlx5 don't call to ib_device_set_netdev(), because they have > .get_netdev() callback. This callback is not an easy task to eliminate > and many internal attempts failed to eliminate them. > > This caused to very questionable ksmbd_rdma_capable_netdev() > implementation where ksmbd first checked internal ib_dev callback > and tried to use ib_device_get_by_netdev(). And to smc_ib, which > didn't even bother to use ib_device_get_by_netdev(). Oh really? Those APIs were only for driver use, not ULP :( Jason