Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Yanjun Zhu <yanjun.zhu@linux.dev>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Leon Romanovsky <leon@kernel.org>,
	Zhu Yanjun <yanjun.zhu@intel.com>,
	linux-rdma@vger.kernel.org
Subject: Re: [PATCH 1/1] RDMA/mlx5: Make mlx5 device work with ib_device_get_by_netdev
Date: Wed, 19 Oct 2022 22:30:31 +0800	[thread overview]
Message-ID: <64d82110-f34e-02d7-5381-a0c2c54b3e2d@linux.dev> (raw)
In-Reply-To: <Y0/luHd1OEZsyGWI@ziepe.ca>


在 2022/10/19 19:55, Jason Gunthorpe 写道:
> On Wed, Oct 19, 2022 at 09:08:14AM +0000, yanjun.zhu@linux.dev wrote:
>> October 18, 2022 4:24 PM, "Leon Romanovsky" <leon@kernel.org> wrote:
>>
>>> On Sun, Oct 16, 2022 at 02:19:25AM -0400, Zhu Yanjun wrote:
>>>
>>>> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>>>>
>>>> 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().
>> Thanks.
>>
>> I read the function ksmbd_rdma_capable_netdev carefully.
>> Mlx5 and mlx4 do not call ib_device_set_netdev to map net device and ib devices.
>> This brings a lot of problems.
> ULPs are not allowed to use these interfaces, they are for driver
> implementations.
>
> It is an error that ksmbd_rdma_capable_netdev() calls it in the first
> place.

Got it.  The following function should complete the same job.

Maybe we can use this function to implement ksmbd_rdma_capable_netdev again.

int ib_enum_all_devs(nldev_callback nldev_cb, struct sk_buff *skb,
                      struct netlink_callback *cb)


Thanks and Regards,

Zhu Yanjun

>
> Jason

      reply	other threads:[~2022-10-19 14:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-16  6:19 [PATCH 1/1] RDMA/mlx5: Make mlx5 device work with ib_device_get_by_netdev Zhu Yanjun
2022-10-18  8:24 ` Leon Romanovsky
2022-10-18 14:19   ` Jason Gunthorpe
2022-10-19  8:56   ` yanjun.zhu
2022-10-19  9:08   ` yanjun.zhu
2022-10-19 11:55     ` Jason Gunthorpe
2022-10-19 14:30       ` Yanjun Zhu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=64d82110-f34e-02d7-5381-a0c2c54b3e2d@linux.dev \
    --to=yanjun.zhu@linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=yanjun.zhu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox