Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Zhu Yanjun <yanjun.zhu@linux.dev>
To: 陈逸凡 <neverhook430@gmail.com>, linux-rdma@vger.kernel.org
Subject: Re: Questions about RDMA subsystem shared mode for RoCE device with MLNX_OFED driver
Date: Mon, 22 Jan 2024 07:37:37 +0800	[thread overview]
Message-ID: <ad08f992-7636-44e6-914b-f467fd7ceb61@linux.dev> (raw)
In-Reply-To: <6edfa3cc-6ec1-49d0-817b-59239c1e669c@linux.dev>



在 2024/1/21 16:51, Zhu Yanjun 写道:
> 在 2024/1/19 20:31, 陈逸凡 写道:
>> Questions:
>> 1. Is RDMA shared mode supported for RoCE/iWARP devices? To be more
>> clearly, ibdev ant netdev required to be in the same net namespace or
>> not?
> 
> RoCE/RXE + the following commits can support ibdev in the net namespace.
> 
> https://patchwork.kernel.org/project/linux-rdma/cover/20230508075636.352138-1-yanjun.zhu@intel.com/
> 
> Current implementation of RXE does not support net namespace. We need 
> the above commits to support net namespace.
> 
> IMO, the current implementation of iWARP does not support net namespace, 
> too.

Sorry. I misunderstand what you mean in your mail. Please ignore this mail.

Zhu Yanjun

> 
> Zhu Yanjun
> 
>> 2. If the answer for first question is ‘YES’, but my test failed with
>> MLNX_OFED driver, it does check whether user can access the netdev of
>> the target gid attr, which means they(user and the netdev) should be
>> at the same namespace. Meanwhile the upstream code dose not have the
>> corresponding codes.
>>
>>
>> MLNX_OFED impl,form mlnx-ofa_kernel-23.10,compared to the upstream 
>> codes
>> ---
>> @@ -1722,6 +1739,9 @@ static int ib_resolve_eth_dmac(struct ib_device 
>> *device,
>>   {
>>          int ret = 0;
>>
>> +       if (!rdma_check_gid_user_access(ah_attr->grh.sgid_attr))
>> +               return -ENODEV;
>> +
>>          if (rdma_is_multicast_addr((struct in6_addr 
>> *)ah_attr->grh.dgid.raw)) {
>>                  if (ipv6_addr_v4mapped((struct in6_addr
>> *)ah_attr->grh.dgid.raw)) {
>>                          __be32 addr = 0;
>> ---
>>
>> Its definition:
>> ---
>> /**
>>   * rdma_check_gid_user_access - Check if user process can access
>>   * this GID entry or not.
>>   * @attr: Pointer to GID entry attribute
>>   *
>>   * rdma_check_gid_user_access() returns true if user process can access
>>   * this GID attribute otherwise returns false. This API should be called
>>   * from the userspace process context.
>>   */
>> bool rdma_check_gid_user_access(const struct ib_gid_attr *attr)
>> {
>> bool allow;
>> /*
>>   * For IB and iWarp, there is no netdevice associate with GID entry,
>>   * For RoCE consider the netdevice's net ns to validate against the
>>   * calling process.
>>   */
>> rcu_read_lock();
>> if (!attr->ndev ||
>>      (attr->ndev &&
>>       net_eq(dev_net(attr->ndev), current->nsproxy->net_ns)))
>> allow = true;
>> else
>> allow = false;
>> rcu_read_unlock();
>> return allow;
>> }
>> ---
>>
>> I think rdma_check_gid_user_access should be ignored while RDMA
>> subsystem configured as shared mode, It should works with exclusive
>> mode. Am i missing anything? Please tell me the background about why
>> MLNX_OFED driver perform the check if anyone knows.
>>
>> Thanks!
> 

  reply	other threads:[~2024-01-21 23:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-19 12:31 Questions about RDMA subsystem shared mode for RoCE device with MLNX_OFED driver 陈逸凡
2024-01-21  8:51 ` Zhu Yanjun
2024-01-21 23:37   ` Zhu Yanjun [this message]
2024-01-22 10:03 ` Leon Romanovsky

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=ad08f992-7636-44e6-914b-f467fd7ceb61@linux.dev \
    --to=yanjun.zhu@linux.dev \
    --cc=linux-rdma@vger.kernel.org \
    --cc=neverhook430@gmail.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