Re: [PATCH 0/3] RDMA net namespace

yanjun.zhu
2022-10-24T07:21:03Z

October 24, 2022 12:45 AM, "Leon Romanovsky" <leon@kernel.org> wrote:

> On Sun, Oct 23, 2022 at 09:42:00PM +0800, Yanjun Zhu wrote:
>
>> 在 2022/10/23 21:04, Leon Romanovsky 写道:
>> On Sun, Oct 23, 2022 at 06:04:47PM -0400, Zhu Yanjun wrote:
>>> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>>>
>>> There are shared and exclusive modes in RDMA net namespace. After
>>> discussion with Leon, the above modes are compatible with legacy IB
>>> device.
>>>
>>> To the RoCE and iWARP devices, the ib devices should be in the same net
>>> namespace with the related net devices regardless of in shared or
>>> exclusive mode.
>>>
>>> In the first commit, when the net devices are moved to a new net
>>> namespace, the related ib devices are also moved to the same net
>>> namespace.
>> I think that rdma_dev_net_ops are supposed to handle this.
>>
>> Yes. rdma_dev_net_ops can move ib devices from one net to another net.
>>
>> But these functions are called by a netlink command "rdma dev...".
>
> rdma_dev_net_ops are called when you move netdevice from one netlink to
> another.

To "rdma_dev_net_ops are called when you move netdevice from one netlink to another.",

if I get you correctly, you mean, when moving net device form one net namespace to another, rdma_dev_net_ops
will be called.

in fact, rdma_dev_net_ops will be called when running the 2 commands "ip netns add ..." and "ip netns del ...".

>
> However you raised an interesting question if it is correct behaviour to
> move IB device after moved netdevice.

Now we come back to the original problem, how to make RoCE ib device work when the ib device and net devices are separated in the 2 different net namespaces?

If you know, please let me know.

Currently I keep ib devices and the related net devices in the same net namespace to make ib devices work. So I made these commits to keep ib devices and the related net devices in the same net namespace automatically .

Zhu Yanjun

>
> I don't know an answer for that.
>
> Thanks