All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] rdma: not display the rdma link in other net namespace
  2022-09-26  2:40 [PATCH] rdma: not display the rdma link in other net namespace yanjun.zhu
@ 2022-09-25 10:22 ` Yanjun Zhu
  2022-09-27 10:34 ` Leon Romanovsky
  1 sibling, 0 replies; 18+ messages in thread
From: Yanjun Zhu @ 2022-09-25 10:22 UTC (permalink / raw)
  To: yanjun.zhu, leonro, linux-rdma, jgg

在 2022/9/26 10:40, yanjun.zhu@linux.dev 写道:
> From: Zhu Yanjun <yanjun.zhu@linux.dev>
> 
> When the net devices are moved to another net namespace, the command
> "rdma link" should not dispaly the rdma link about this net device.
> 
> For example, when the net device eno12399 is moved to net namespace net0
> from init_net, the rdma link of eno12399 should not display in init_net.
> 
> Before this change:
> 
> Init_net:
> 
> link roceo12399/1 state DOWN physical_state DISABLED  <---should not display
> link roceo12409/1 state DOWN physical_state DISABLED netdev eno12409
> link rocep202s0f0/1 state DOWN physical_state DISABLED netdev ens7f0
> link rocep202s0f1/1 state ACTIVE physical_state LINK_UP netdev ens7f1
> 
> net0:
> 
> link roceo12399/1 state DOWN physical_state DISABLED netdev eno12399
> link roceo12409/1 state DOWN physical_state DISABLED <---should not display
> link rocep202s0f0/1 state DOWN physical_state DISABLED <---should not display
> link rocep202s0f1/1 state ACTIVE physical_state LINK_UP <---should not display
> 
> After this change
> 
> Init_net:
> 
> link roceo12409/1 state DOWN physical_state DISABLED netdev eno12409
> link rocep202s0f0/1 state DOWN physical_state DISABLED netdev ens7f0
> link rocep202s0f1/1 state ACTIVE physical_state LINK_UP netdev ens7f1
> 
> net0:
> 
> link roceo12399/1 state DOWN physical_state DISABLED netdev eno12399
> 
> Fixes: da990ab40a92 ("rdma: Add link object")
> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>

Hi Leon

This commit is to fix a problem in "rdma link show" of iproute2.
I do not know the maillist of iproute2. So I send the commit here.
If you know the maillist, please let me know.

Thanks and Regards,
Zhu Yanjun

> ---
>   rdma/link.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/rdma/link.c b/rdma/link.c
> index bf24b849..449a7636 100644
> --- a/rdma/link.c
> +++ b/rdma/link.c
> @@ -238,6 +238,9 @@ static int link_parse_cb(const struct nlmsghdr *nlh, void *data)
>   		return MNL_CB_ERROR;
>   	}
>   
> +	if (!tb[RDMA_NLDEV_ATTR_NDEV_NAME] || !tb[RDMA_NLDEV_ATTR_NDEV_INDEX])
> +		return MNL_CB_OK;
> +
>   	idx = mnl_attr_get_u32(tb[RDMA_NLDEV_ATTR_DEV_INDEX]);
>   	port = mnl_attr_get_u32(tb[RDMA_NLDEV_ATTR_PORT_INDEX]);
>   	name = mnl_attr_get_str(tb[RDMA_NLDEV_ATTR_DEV_NAME]);


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH] rdma: not display the rdma link in other net namespace
@ 2022-09-26  2:40 yanjun.zhu
  2022-09-25 10:22 ` Yanjun Zhu
  2022-09-27 10:34 ` Leon Romanovsky
  0 siblings, 2 replies; 18+ messages in thread
From: yanjun.zhu @ 2022-09-26  2:40 UTC (permalink / raw)
  To: leonro, linux-rdma, jgg, yanjun.zhu

From: Zhu Yanjun <yanjun.zhu@linux.dev>

When the net devices are moved to another net namespace, the command
"rdma link" should not dispaly the rdma link about this net device.

For example, when the net device eno12399 is moved to net namespace net0
from init_net, the rdma link of eno12399 should not display in init_net.

Before this change:

Init_net:

link roceo12399/1 state DOWN physical_state DISABLED  <---should not display
link roceo12409/1 state DOWN physical_state DISABLED netdev eno12409
link rocep202s0f0/1 state DOWN physical_state DISABLED netdev ens7f0
link rocep202s0f1/1 state ACTIVE physical_state LINK_UP netdev ens7f1

net0:

link roceo12399/1 state DOWN physical_state DISABLED netdev eno12399
link roceo12409/1 state DOWN physical_state DISABLED <---should not display
link rocep202s0f0/1 state DOWN physical_state DISABLED <---should not display
link rocep202s0f1/1 state ACTIVE physical_state LINK_UP <---should not display

After this change

Init_net:

link roceo12409/1 state DOWN physical_state DISABLED netdev eno12409
link rocep202s0f0/1 state DOWN physical_state DISABLED netdev ens7f0
link rocep202s0f1/1 state ACTIVE physical_state LINK_UP netdev ens7f1

net0:

link roceo12399/1 state DOWN physical_state DISABLED netdev eno12399

Fixes: da990ab40a92 ("rdma: Add link object")
Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
---
 rdma/link.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/rdma/link.c b/rdma/link.c
index bf24b849..449a7636 100644
--- a/rdma/link.c
+++ b/rdma/link.c
@@ -238,6 +238,9 @@ static int link_parse_cb(const struct nlmsghdr *nlh, void *data)
 		return MNL_CB_ERROR;
 	}
 
+	if (!tb[RDMA_NLDEV_ATTR_NDEV_NAME] || !tb[RDMA_NLDEV_ATTR_NDEV_INDEX])
+		return MNL_CB_OK;
+
 	idx = mnl_attr_get_u32(tb[RDMA_NLDEV_ATTR_DEV_INDEX]);
 	port = mnl_attr_get_u32(tb[RDMA_NLDEV_ATTR_PORT_INDEX]);
 	name = mnl_attr_get_str(tb[RDMA_NLDEV_ATTR_DEV_NAME]);
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH] rdma: not display the rdma link in other net namespace
  2022-09-26  2:40 [PATCH] rdma: not display the rdma link in other net namespace yanjun.zhu
  2022-09-25 10:22 ` Yanjun Zhu
@ 2022-09-27 10:34 ` Leon Romanovsky
  2022-09-27 10:58   ` Yanjun Zhu
  1 sibling, 1 reply; 18+ messages in thread
From: Leon Romanovsky @ 2022-09-27 10:34 UTC (permalink / raw)
  To: yanjun.zhu; +Cc: linux-rdma, jgg

On Sun, Sep 25, 2022 at 10:40:33PM -0400, yanjun.zhu@linux.dev wrote:
> From: Zhu Yanjun <yanjun.zhu@linux.dev>
> 
> When the net devices are moved to another net namespace, the command
> "rdma link" should not dispaly the rdma link about this net device.
> 
> For example, when the net device eno12399 is moved to net namespace net0
> from init_net, the rdma link of eno12399 should not display in init_net.
> 
> Before this change:
> 
> Init_net:
> 
> link roceo12399/1 state DOWN physical_state DISABLED  <---should not display
> link roceo12409/1 state DOWN physical_state DISABLED netdev eno12409
> link rocep202s0f0/1 state DOWN physical_state DISABLED netdev ens7f0
> link rocep202s0f1/1 state ACTIVE physical_state LINK_UP netdev ens7f1
> 
> net0:
> 
> link roceo12399/1 state DOWN physical_state DISABLED netdev eno12399
> link roceo12409/1 state DOWN physical_state DISABLED <---should not display
> link rocep202s0f0/1 state DOWN physical_state DISABLED <---should not display
> link rocep202s0f1/1 state ACTIVE physical_state LINK_UP <---should not display
> 
> After this change
> 
> Init_net:
> 
> link roceo12409/1 state DOWN physical_state DISABLED netdev eno12409
> link rocep202s0f0/1 state DOWN physical_state DISABLED netdev ens7f0
> link rocep202s0f1/1 state ACTIVE physical_state LINK_UP netdev ens7f1
> 
> net0:
> 
> link roceo12399/1 state DOWN physical_state DISABLED netdev eno12399
> 
> Fixes: da990ab40a92 ("rdma: Add link object")
> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> ---
>  rdma/link.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/rdma/link.c b/rdma/link.c
> index bf24b849..449a7636 100644
> --- a/rdma/link.c
> +++ b/rdma/link.c
> @@ -238,6 +238,9 @@ static int link_parse_cb(const struct nlmsghdr *nlh, void *data)
>  		return MNL_CB_ERROR;
>  	}
>  
> +	if (!tb[RDMA_NLDEV_ATTR_NDEV_NAME] || !tb[RDMA_NLDEV_ATTR_NDEV_INDEX])
> +		return MNL_CB_OK;
> +

Regarding your question where it should go in addition to RDMA, the answer
is netdev ML. The rdmatool is part of iproute2 and the relevant maintainers
should be CCed.

Regarding the change, I don't think that it is right. User space tool is
a simple viewer of data returned from the kernel. It is not a mistake to
return device without netdev.

Thanks

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rdma: not display the rdma link in other net namespace
  2022-09-27 10:34 ` Leon Romanovsky
@ 2022-09-27 10:58   ` Yanjun Zhu
  2022-09-28  6:04     ` Leon Romanovsky
  2022-10-09 10:20     ` [PATCH] rdma: not display the rdma link in other net namespace yanjun.zhu
  0 siblings, 2 replies; 18+ messages in thread
From: Yanjun Zhu @ 2022-09-27 10:58 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: linux-rdma, jgg


在 2022/9/27 18:34, Leon Romanovsky 写道:
> On Sun, Sep 25, 2022 at 10:40:33PM -0400, yanjun.zhu@linux.dev wrote:
>> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>>
>> When the net devices are moved to another net namespace, the command
>> "rdma link" should not dispaly the rdma link about this net device.
>>
>> For example, when the net device eno12399 is moved to net namespace net0
>> from init_net, the rdma link of eno12399 should not display in init_net.
>>
>> Before this change:
>>
>> Init_net:
>>
>> link roceo12399/1 state DOWN physical_state DISABLED  <---should not display
>> link roceo12409/1 state DOWN physical_state DISABLED netdev eno12409
>> link rocep202s0f0/1 state DOWN physical_state DISABLED netdev ens7f0
>> link rocep202s0f1/1 state ACTIVE physical_state LINK_UP netdev ens7f1
>>
>> net0:
>>
>> link roceo12399/1 state DOWN physical_state DISABLED netdev eno12399
>> link roceo12409/1 state DOWN physical_state DISABLED <---should not display
>> link rocep202s0f0/1 state DOWN physical_state DISABLED <---should not display
>> link rocep202s0f1/1 state ACTIVE physical_state LINK_UP <---should not display
>>
>> After this change
>>
>> Init_net:
>>
>> link roceo12409/1 state DOWN physical_state DISABLED netdev eno12409
>> link rocep202s0f0/1 state DOWN physical_state DISABLED netdev ens7f0
>> link rocep202s0f1/1 state ACTIVE physical_state LINK_UP netdev ens7f1
>>
>> net0:
>>
>> link roceo12399/1 state DOWN physical_state DISABLED netdev eno12399
>>
>> Fixes: da990ab40a92 ("rdma: Add link object")
>> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
>> ---
>>   rdma/link.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/rdma/link.c b/rdma/link.c
>> index bf24b849..449a7636 100644
>> --- a/rdma/link.c
>> +++ b/rdma/link.c
>> @@ -238,6 +238,9 @@ static int link_parse_cb(const struct nlmsghdr *nlh, void *data)
>>   		return MNL_CB_ERROR;
>>   	}
>>   
>> +	if (!tb[RDMA_NLDEV_ATTR_NDEV_NAME] || !tb[RDMA_NLDEV_ATTR_NDEV_INDEX])
>> +		return MNL_CB_OK;
>> +
> Regarding your question where it should go in addition to RDMA, the answer
> is netdev ML. The rdmatool is part of iproute2 and the relevant maintainers
> should be CCed.
Thanks. I will also send it to netdev ML and CC the maintainers.
>
> Regarding the change, I don't think that it is right. User space tool is
> a simple viewer of data returned from the kernel. It is not a mistake to
> return device without netdev.

Normally a rdma link based on RoCEv2 should be with a NIC. This NIC device

will send/recv udp packets. With mellanox/intel NIC device, this net 
device also

do more work than sending/receiving packets.

 From this perspective, a rdma link is dependent on a net device.

In this problem, net device is moved to another net namespace. So it can 
not be

obtained.  And this rdma link can also not work in this net namespace.

So this rdma link should not appear in this net namespace. Or else, it 
would confuse

the user.

In fact, net namespace is a concept in tcp/ip stack. And it does not 
exist in rdma stack.

But rdma link based on RoCEv2 is dependent on network device. So when 
the net device

is moved to another net namespace, this rdma link should also be moved 
to another net namespace.

Zhu Yanjun

>
> Thanks

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rdma: not display the rdma link in other net namespace
  2022-09-27 10:58   ` Yanjun Zhu
@ 2022-09-28  6:04     ` Leon Romanovsky
  2022-09-30  7:25       ` Yanjun Zhu
  2022-10-09 10:20     ` [PATCH] rdma: not display the rdma link in other net namespace yanjun.zhu
  1 sibling, 1 reply; 18+ messages in thread
From: Leon Romanovsky @ 2022-09-28  6:04 UTC (permalink / raw)
  To: Yanjun Zhu; +Cc: Leon Romanovsky, linux-rdma, jgg

On Tue, Sep 27, 2022 at 06:58:50PM +0800, Yanjun Zhu wrote:
> 
> 在 2022/9/27 18:34, Leon Romanovsky 写道:
> > On Sun, Sep 25, 2022 at 10:40:33PM -0400, yanjun.zhu@linux.dev wrote:
> > > From: Zhu Yanjun <yanjun.zhu@linux.dev>
> > > 
> > > When the net devices are moved to another net namespace, the command
> > > "rdma link" should not dispaly the rdma link about this net device.
> > > 
> > > For example, when the net device eno12399 is moved to net namespace net0
> > > from init_net, the rdma link of eno12399 should not display in init_net.
> > > 
> > > Before this change:
> > > 
> > > Init_net:
> > > 
> > > link roceo12399/1 state DOWN physical_state DISABLED  <---should not display
> > > link roceo12409/1 state DOWN physical_state DISABLED netdev eno12409
> > > link rocep202s0f0/1 state DOWN physical_state DISABLED netdev ens7f0
> > > link rocep202s0f1/1 state ACTIVE physical_state LINK_UP netdev ens7f1
> > > 
> > > net0:
> > > 
> > > link roceo12399/1 state DOWN physical_state DISABLED netdev eno12399
> > > link roceo12409/1 state DOWN physical_state DISABLED <---should not display
> > > link rocep202s0f0/1 state DOWN physical_state DISABLED <---should not display
> > > link rocep202s0f1/1 state ACTIVE physical_state LINK_UP <---should not display
> > > 
> > > After this change
> > > 
> > > Init_net:
> > > 
> > > link roceo12409/1 state DOWN physical_state DISABLED netdev eno12409
> > > link rocep202s0f0/1 state DOWN physical_state DISABLED netdev ens7f0
> > > link rocep202s0f1/1 state ACTIVE physical_state LINK_UP netdev ens7f1
> > > 
> > > net0:
> > > 
> > > link roceo12399/1 state DOWN physical_state DISABLED netdev eno12399
> > > 
> > > Fixes: da990ab40a92 ("rdma: Add link object")
> > > Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> > > ---
> > >   rdma/link.c | 3 +++
> > >   1 file changed, 3 insertions(+)
> > > 
> > > diff --git a/rdma/link.c b/rdma/link.c
> > > index bf24b849..449a7636 100644
> > > --- a/rdma/link.c
> > > +++ b/rdma/link.c
> > > @@ -238,6 +238,9 @@ static int link_parse_cb(const struct nlmsghdr *nlh, void *data)
> > >   		return MNL_CB_ERROR;
> > >   	}
> > > +	if (!tb[RDMA_NLDEV_ATTR_NDEV_NAME] || !tb[RDMA_NLDEV_ATTR_NDEV_INDEX])
> > > +		return MNL_CB_OK;
> > > +
> > Regarding your question where it should go in addition to RDMA, the answer
> > is netdev ML. The rdmatool is part of iproute2 and the relevant maintainers
> > should be CCed.
> Thanks. I will also send it to netdev ML and CC the maintainers.
> > 
> > Regarding the change, I don't think that it is right. User space tool is
> > a simple viewer of data returned from the kernel. It is not a mistake to
> > return device without netdev.
> 
> Normally a rdma link based on RoCEv2 should be with a NIC. This NIC device
> 
> will send/recv udp packets. With mellanox/intel NIC device, this net device
> also
> 
> do more work than sending/receiving packets.
> 
> From this perspective, a rdma link is dependent on a net device.
> 
> In this problem, net device is moved to another net namespace. So it can not
> be
> 
> obtained.  And this rdma link can also not work in this net namespace.
> 
> So this rdma link should not appear in this net namespace. Or else, it would
> confuse
> 
> the user.
> 
> In fact, net namespace is a concept in tcp/ip stack. And it does not exist
> in rdma stack.

RDMA has two different net namespace mode: shared and exclusive.

In shared mode, the IB devices are shared across all net namespaces and
"moving" net device into different namespace just "hides" it, but don't
disconnect.

See comments around various usages of ib_devices_shared_netns variable.

Thanks

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rdma: not display the rdma link in other net namespace
  2022-09-28  6:04     ` Leon Romanovsky
@ 2022-09-30  7:25       ` Yanjun Zhu
  2022-10-06 12:53         ` Leon Romanovsky
  0 siblings, 1 reply; 18+ messages in thread
From: Yanjun Zhu @ 2022-09-30  7:25 UTC (permalink / raw)
  To: Leon Romanovsky, Yanjun Zhu; +Cc: Leon Romanovsky, linux-rdma, jgg

在 2022/9/28 14:04, Leon Romanovsky 写道:
> On Tue, Sep 27, 2022 at 06:58:50PM +0800, Yanjun Zhu wrote:
>>
>> 在 2022/9/27 18:34, Leon Romanovsky 写道:
>>> On Sun, Sep 25, 2022 at 10:40:33PM -0400, yanjun.zhu@linux.dev wrote:
>>>> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>>>>
>>>> When the net devices are moved to another net namespace, the command
>>>> "rdma link" should not dispaly the rdma link about this net device.
>>>>
>>>> For example, when the net device eno12399 is moved to net namespace net0
>>>> from init_net, the rdma link of eno12399 should not display in init_net.
>>>>
>>>> Before this change:
>>>>
>>>> Init_net:
>>>>
>>>> link roceo12399/1 state DOWN physical_state DISABLED  <---should not display
>>>> link roceo12409/1 state DOWN physical_state DISABLED netdev eno12409
>>>> link rocep202s0f0/1 state DOWN physical_state DISABLED netdev ens7f0
>>>> link rocep202s0f1/1 state ACTIVE physical_state LINK_UP netdev ens7f1
>>>>
>>>> net0:
>>>>
>>>> link roceo12399/1 state DOWN physical_state DISABLED netdev eno12399
>>>> link roceo12409/1 state DOWN physical_state DISABLED <---should not display
>>>> link rocep202s0f0/1 state DOWN physical_state DISABLED <---should not display
>>>> link rocep202s0f1/1 state ACTIVE physical_state LINK_UP <---should not display
>>>>
>>>> After this change
>>>>
>>>> Init_net:
>>>>
>>>> link roceo12409/1 state DOWN physical_state DISABLED netdev eno12409
>>>> link rocep202s0f0/1 state DOWN physical_state DISABLED netdev ens7f0
>>>> link rocep202s0f1/1 state ACTIVE physical_state LINK_UP netdev ens7f1
>>>>
>>>> net0:
>>>>
>>>> link roceo12399/1 state DOWN physical_state DISABLED netdev eno12399
>>>>
>>>> Fixes: da990ab40a92 ("rdma: Add link object")
>>>> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
>>>> ---
>>>>    rdma/link.c | 3 +++
>>>>    1 file changed, 3 insertions(+)
>>>>
>>>> diff --git a/rdma/link.c b/rdma/link.c
>>>> index bf24b849..449a7636 100644
>>>> --- a/rdma/link.c
>>>> +++ b/rdma/link.c
>>>> @@ -238,6 +238,9 @@ static int link_parse_cb(const struct nlmsghdr *nlh, void *data)
>>>>    		return MNL_CB_ERROR;
>>>>    	}
>>>> +	if (!tb[RDMA_NLDEV_ATTR_NDEV_NAME] || !tb[RDMA_NLDEV_ATTR_NDEV_INDEX])
>>>> +		return MNL_CB_OK;
>>>> +
>>> Regarding your question where it should go in addition to RDMA, the answer
>>> is netdev ML. The rdmatool is part of iproute2 and the relevant maintainers
>>> should be CCed.
>> Thanks. I will also send it to netdev ML and CC the maintainers.
>>>
>>> Regarding the change, I don't think that it is right. User space tool is
>>> a simple viewer of data returned from the kernel. It is not a mistake to
>>> return device without netdev.
>>
>> Normally a rdma link based on RoCEv2 should be with a NIC. This NIC device
>>
>> will send/recv udp packets. With mellanox/intel NIC device, this net device
>> also
>>
>> do more work than sending/receiving packets.
>>
>>  From this perspective, a rdma link is dependent on a net device.
>>
>> In this problem, net device is moved to another net namespace. So it can not
>> be
>>
>> obtained.  And this rdma link can also not work in this net namespace.
>>
>> So this rdma link should not appear in this net namespace. Or else, it would
>> confuse
>>
>> the user.
>>
>> In fact, net namespace is a concept in tcp/ip stack. And it does not exist
>> in rdma stack.
> 
> RDMA has two different net namespace mode: shared and exclusive.

This is different from net namespace in network.

> 
> In shared mode, the IB devices are shared across all net namespaces and
> "moving" net device into different namespace just "hides" it, but don't
> disconnect.

In exclusive mode, the net device also hide. It is the same with shared 
mode.

# rdma system
netns exclusive copy-on-fork on
# rdma link
link roceo12399/1 state DOWN physical_state DISABLED
link roceo12409/1 state DOWN physical_state DISABLED netdev eno12409
link rocep202s0f0/1 state DOWN physical_state DISABLED netdev ens7f0
link rocep202s0f1/1 state ACTIVE physical_state LINK_UP netdev ens7f1

Is it better to append "exclusive" or "shared" in the end of the line?

For example,

Exclusive mode:

# rdma system
netns exclusive copy-on-fork on
# rdma link
link roceo12399/1 state DOWN physical_state DISABLED exclusive

Shared mode:

# rdma system
netns shared copy-on-fork on
# rdma link
link roceo12399/1 state DOWN physical_state DISABLED shared

Thanks and Regards
Zhu Yanjun
> 
> See comments around various usages of ib_devices_shared_netns variable.
> 
> Thanks


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rdma: not display the rdma link in other net namespace
  2022-09-30  7:25       ` Yanjun Zhu
@ 2022-10-06 12:53         ` Leon Romanovsky
  2022-10-06 14:26           ` Yanjun Zhu
  0 siblings, 1 reply; 18+ messages in thread
From: Leon Romanovsky @ 2022-10-06 12:53 UTC (permalink / raw)
  To: Yanjun Zhu; +Cc: Leon Romanovsky, linux-rdma, jgg

On Fri, Sep 30, 2022 at 03:25:00PM +0800, Yanjun Zhu wrote:
> 在 2022/9/28 14:04, Leon Romanovsky 写道:
> > On Tue, Sep 27, 2022 at 06:58:50PM +0800, Yanjun Zhu wrote:
> > > 
> > > 在 2022/9/27 18:34, Leon Romanovsky 写道:
> > > > On Sun, Sep 25, 2022 at 10:40:33PM -0400, yanjun.zhu@linux.dev wrote:
> > > > > From: Zhu Yanjun <yanjun.zhu@linux.dev>

<...>

> Is it better to append "exclusive" or "shared" in the end of the line?

No, exclusive/shared is global property, applied to all links.

Thanks

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rdma: not display the rdma link in other net namespace
  2022-10-06 12:53         ` Leon Romanovsky
@ 2022-10-06 14:26           ` Yanjun Zhu
  2022-10-06 16:21             ` Leon Romanovsky
  0 siblings, 1 reply; 18+ messages in thread
From: Yanjun Zhu @ 2022-10-06 14:26 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: Leon Romanovsky, linux-rdma, jgg


在 2022/10/6 20:53, Leon Romanovsky 写道:
> On Fri, Sep 30, 2022 at 03:25:00PM +0800, Yanjun Zhu wrote:
>> 在 2022/9/28 14:04, Leon Romanovsky 写道:
>>> On Tue, Sep 27, 2022 at 06:58:50PM +0800, Yanjun Zhu wrote:
>>>> 在 2022/9/27 18:34, Leon Romanovsky 写道:
>>>>> On Sun, Sep 25, 2022 at 10:40:33PM -0400, yanjun.zhu@linux.dev wrote:
>>>>>> From: Zhu Yanjun <yanjun.zhu@linux.dev>
> <...>
>
>> Is it better to append "exclusive" or "shared" in the end of the line?
> No, exclusive/shared is global property, applied to all links.

OK.

When running "rdma link show", there is no difference between shared and 
exclusive.

Is it acceptable?


And in exclusive mode, a rdma link that can not be accessed in net 
namespace A still

appears in net namespace A when running "rdma link show" in net namespace A.

The above is different from others in net namespace.

For example, in net namespace, if net device NIC0 is moved to net 
namespace B from net namespace A,

this NIC0 will not appear in net namespace A when running "ip link" 
command in net namespace A.

Is it a problem?


Zhu Yanjun

>
> Thanks

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rdma: not display the rdma link in other net namespace
  2022-10-06 14:26           ` Yanjun Zhu
@ 2022-10-06 16:21             ` Leon Romanovsky
  2022-10-06 16:23               ` Jason Gunthorpe
  0 siblings, 1 reply; 18+ messages in thread
From: Leon Romanovsky @ 2022-10-06 16:21 UTC (permalink / raw)
  To: Yanjun Zhu; +Cc: Leon Romanovsky, linux-rdma, jgg

On Thu, Oct 06, 2022 at 10:26:33PM +0800, Yanjun Zhu wrote:
> 
> 在 2022/10/6 20:53, Leon Romanovsky 写道:
> > On Fri, Sep 30, 2022 at 03:25:00PM +0800, Yanjun Zhu wrote:
> > > 在 2022/9/28 14:04, Leon Romanovsky 写道:
> > > > On Tue, Sep 27, 2022 at 06:58:50PM +0800, Yanjun Zhu wrote:
> > > > > 在 2022/9/27 18:34, Leon Romanovsky 写道:
> > > > > > On Sun, Sep 25, 2022 at 10:40:33PM -0400, yanjun.zhu@linux.dev wrote:
> > > > > > > From: Zhu Yanjun <yanjun.zhu@linux.dev>
> > <...>
> > 
> > > Is it better to append "exclusive" or "shared" in the end of the line?
> > No, exclusive/shared is global property, applied to all links.
> 
> OK.
> 
> When running "rdma link show", there is no difference between shared and
> exclusive.
> 
> Is it acceptable?

exclusive/shared is ib_core module parameter, so or all links are shared
or all links are exclusive. They can't be both at the same time.

> 
> 
> And in exclusive mode, a rdma link that can not be accessed in net namespace
> A still
> 
> appears in net namespace A when running "rdma link show" in net namespace A.
> 
> The above is different from others in net namespace.
> 
> For example, in net namespace, if net device NIC0 is moved to net namespace
> B from net namespace A,
> 
> this NIC0 will not appear in net namespace A when running "ip link" command
> in net namespace A.
> 
> Is it a problem?

rdmatool presents IB devices. It has no logic that decides if that
device is usable/operable or not.

Thanks

> 
> 
> Zhu Yanjun
> 
> > 
> > Thanks

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rdma: not display the rdma link in other net namespace
  2022-10-06 16:21             ` Leon Romanovsky
@ 2022-10-06 16:23               ` Jason Gunthorpe
  2022-10-07  6:21                 ` Leon Romanovsky
  0 siblings, 1 reply; 18+ messages in thread
From: Jason Gunthorpe @ 2022-10-06 16:23 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: Yanjun Zhu, Leon Romanovsky, linux-rdma

On Thu, Oct 06, 2022 at 07:21:39PM +0300, Leon Romanovsky wrote:

> > And in exclusive mode, a rdma link that can not be accessed in net namespace
> > A still
> > 
> > appears in net namespace A when running "rdma link show" in net namespace A.
> > 
> > The above is different from others in net namespace.
> > 
> > For example, in net namespace, if net device NIC0 is moved to net namespace
> > B from net namespace A,
> > 
> > this NIC0 will not appear in net namespace A when running "ip link" command
> > in net namespace A.
> > 
> > Is it a problem?
> 
> rdmatool presents IB devices. It has no logic that decides if that
> device is usable/operable or not.

It should really not report an IB device that is not in the net
namespace..

I'm surprised this hasn't been noticed because it will break verbs.

Jason

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rdma: not display the rdma link in other net namespace
  2022-10-06 16:23               ` Jason Gunthorpe
@ 2022-10-07  6:21                 ` Leon Romanovsky
  2022-10-07  6:56                   ` Yanjun Zhu
  2022-10-11  0:25                   ` [RFC PATCH 1/1] RDMA/core: Fix a problem from rdma link in exclusive mode Zhu Yanjun
  0 siblings, 2 replies; 18+ messages in thread
From: Leon Romanovsky @ 2022-10-07  6:21 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Yanjun Zhu, Leon Romanovsky, linux-rdma

On Thu, Oct 06, 2022 at 01:23:05PM -0300, Jason Gunthorpe wrote:
> On Thu, Oct 06, 2022 at 07:21:39PM +0300, Leon Romanovsky wrote:
> 
> > > And in exclusive mode, a rdma link that can not be accessed in net namespace
> > > A still
> > > 
> > > appears in net namespace A when running "rdma link show" in net namespace A.
> > > 
> > > The above is different from others in net namespace.
> > > 
> > > For example, in net namespace, if net device NIC0 is moved to net namespace
> > > B from net namespace A,
> > > 
> > > this NIC0 will not appear in net namespace A when running "ip link" command
> > > in net namespace A.
> > > 
> > > Is it a problem?
> > 
> > rdmatool presents IB devices. It has no logic that decides if that
> > device is usable/operable or not.
> 
> It should really not report an IB device that is not in the net
> namespace..

It is kernel (nldev.c) job to hide such IB devices and it seems like it
does. For devices with help of ib_enum_all_devs() and for links with
ib_device_get_by_index().

They both checks netns - rdma_dev_access_netns(device, net).

Thanks

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rdma: not display the rdma link in other net namespace
  2022-10-07  6:21                 ` Leon Romanovsky
@ 2022-10-07  6:56                   ` Yanjun Zhu
  2022-10-11  0:25                   ` [RFC PATCH 1/1] RDMA/core: Fix a problem from rdma link in exclusive mode Zhu Yanjun
  1 sibling, 0 replies; 18+ messages in thread
From: Yanjun Zhu @ 2022-10-07  6:56 UTC (permalink / raw)
  To: Leon Romanovsky, Jason Gunthorpe; +Cc: Leon Romanovsky, linux-rdma


在 2022/10/7 14:21, Leon Romanovsky 写道:
> On Thu, Oct 06, 2022 at 01:23:05PM -0300, Jason Gunthorpe wrote:
>> On Thu, Oct 06, 2022 at 07:21:39PM +0300, Leon Romanovsky wrote:
>>
>>>> And in exclusive mode, a rdma link that can not be accessed in net namespace
>>>> A still
>>>>
>>>> appears in net namespace A when running "rdma link show" in net namespace A.
>>>>
>>>> The above is different from others in net namespace.
>>>>
>>>> For example, in net namespace, if net device NIC0 is moved to net namespace
>>>> B from net namespace A,
>>>>
>>>> this NIC0 will not appear in net namespace A when running "ip link" command
>>>> in net namespace A.
>>>>
>>>> Is it a problem?
>>> rdmatool presents IB devices. It has no logic that decides if that
>>> device is usable/operable or not.
>> It should really not report an IB device that is not in the net
>> namespace..
> It is kernel (nldev.c) job to hide such IB devices and it seems like it
> does. For devices with help of ib_enum_all_devs() and for links with
> ib_device_get_by_index().

Thanks, Jason and Leon

I am working on it. I will send the patch out very soon.

Zhu Yanjun

>
> They both checks netns - rdma_dev_access_netns(device, net).
>
> Thanks

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rdma: not display the rdma link in other net namespace
  2022-09-27 10:58   ` Yanjun Zhu
  2022-09-28  6:04     ` Leon Romanovsky
@ 2022-10-09 10:20     ` yanjun.zhu
  2022-10-11  9:49       ` Leon Romanovsky
  1 sibling, 1 reply; 18+ messages in thread
From: yanjun.zhu @ 2022-10-09 10:20 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: Leon Romanovsky, linux-rdma, jgg

September 28, 2022 2:04 PM, "Leon Romanovsky" <leon@kernel.org> wrote:

> On Tue, Sep 27, 2022 at 06:58:50PM +0800, Yanjun Zhu wrote:
> 
>> 在 2022/9/27 18:34, Leon Romanovsky 写道:
>> On Sun, Sep 25, 2022 at 10:40:33PM -0400, yanjun.zhu@linux.dev wrote:
>>> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>>> 
>>> When the net devices are moved to another net namespace, the command
>>> "rdma link" should not dispaly the rdma link about this net device.
>>> 
>>> For example, when the net device eno12399 is moved to net namespace net0
>>> from init_net, the rdma link of eno12399 should not display in init_net.
>>> 
>>> Before this change:
>>> 
>>> Init_net:
>>> 
>>> link roceo12399/1 state DOWN physical_state DISABLED <---should not display
>>> link roceo12409/1 state DOWN physical_state DISABLED netdev eno12409
>>> link rocep202s0f0/1 state DOWN physical_state DISABLED netdev ens7f0
>>> link rocep202s0f1/1 state ACTIVE physical_state LINK_UP netdev ens7f1
>>> 
>>> net0:
>>> 
>>> link roceo12399/1 state DOWN physical_state DISABLED netdev eno12399
>>> link roceo12409/1 state DOWN physical_state DISABLED <---should not display
>>> link rocep202s0f0/1 state DOWN physical_state DISABLED <---should not display
>>> link rocep202s0f1/1 state ACTIVE physical_state LINK_UP <---should not display
>>> 
>>> After this change
>>> 
>>> Init_net:
>>> 
>>> link roceo12409/1 state DOWN physical_state DISABLED netdev eno12409
>>> link rocep202s0f0/1 state DOWN physical_state DISABLED netdev ens7f0
>>> link rocep202s0f1/1 state ACTIVE physical_state LINK_UP netdev ens7f1
>>> 
>>> net0:
>>> 
>>> link roceo12399/1 state DOWN physical_state DISABLED netdev eno12399
>>> 
>>> Fixes: da990ab40a92 ("rdma: Add link object")
>>> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
>>> ---
>>> rdma/link.c | 3 +++
>>> 1 file changed, 3 insertions(+)
>>> 
>>> diff --git a/rdma/link.c b/rdma/link.c
>>> index bf24b849..449a7636 100644
>>> --- a/rdma/link.c
>>> +++ b/rdma/link.c
>>> @@ -238,6 +238,9 @@ static int link_parse_cb(const struct nlmsghdr *nlh, void *data)
>>> return MNL_CB_ERROR;
>>> }
>>> + if (!tb[RDMA_NLDEV_ATTR_NDEV_NAME] || !tb[RDMA_NLDEV_ATTR_NDEV_INDEX])
>>> + return MNL_CB_OK;
>>> +
>> Regarding your question where it should go in addition to RDMA, the answer
>> is netdev ML. The rdmatool is part of iproute2 and the relevant maintainers
>> should be CCed.
>> Thanks. I will also send it to netdev ML and CC the maintainers.
>> 
>> Regarding the change, I don't think that it is right. User space tool is
>> a simple viewer of data returned from the kernel. It is not a mistake to
>> return device without netdev.
>> 
>> Normally a rdma link based on RoCEv2 should be with a NIC. This NIC device
>> 
>> will send/recv udp packets. With mellanox/intel NIC device, this net device
>> also
>> 
>> do more work than sending/receiving packets.
>> 
>> From this perspective, a rdma link is dependent on a net device.
>> 
>> In this problem, net device is moved to another net namespace. So it can not
>> be
>> 
>> obtained.  And this rdma link can also not work in this net namespace.
>> 
>> So this rdma link should not appear in this net namespace. Or else, it would
>> confuse
>> 
>> the user.
>> 
>> In fact, net namespace is a concept in tcp/ip stack. And it does not exist
>> in rdma stack.
> 
> RDMA has two different net namespace mode: shared and exclusive.
> 
> In shared mode, the IB devices are shared across all net namespaces and
> "moving" net device into different namespace just "hides" it, but don't
> disconnect.

Hi, Leon

About RDMA shared and exclusive mode, I am confusing about this scenario:

In shared mode, ib device A is in net namespace A1 while netdev device B is in net namespace B1.
IB device A is dependent on netdev device B. How to make tests in the above scenario?
Both rping and perftest need a IP address to work. But now ip address is in net namespace B1 while
ib device A is in net namespace A1.

In the product environment, does the above scenario exist?

Thanks and Regards,
Zhu Yanjun

> 
> See comments around various usages of ib_devices_shared_netns variable.
> 
> Thanks

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [RFC PATCH 1/1] RDMA/core: Fix a problem from rdma link in exclusive mode
  2022-10-07  6:21                 ` Leon Romanovsky
  2022-10-07  6:56                   ` Yanjun Zhu
@ 2022-10-11  0:25                   ` Zhu Yanjun
  2022-10-11 10:12                     ` Leon Romanovsky
  1 sibling, 1 reply; 18+ messages in thread
From: Zhu Yanjun @ 2022-10-11  0:25 UTC (permalink / raw)
  To: yanjun.zhu, jgg, leo, linux-rdma

From: Zhu Yanjun <yanjun.zhu@linux.dev>

This is not an official commit. In rdma net namespace, the rdma device
is separate from the net device. For example, a rdma device A is in net
namespace A1 while the related net device B is in net namespace B1.

I am curious how to make perftest and rping tests on the above
scenario. The ip address of net device B is in net namespace B1
while the rdma device is in net namespace A1.

From my perspective, the rdma device and related net device should
be in the same net namespace. When a net device is moved from one net
namespace to another net namespace, the rdma device should be in the
same net namespace with the net device.

In this commit, when all the ib devices are parsed in exclusive mode,
if the ib devices and related net devices are not in the same net
namespace, the link information will not be reported to user space.

This commit is a RFC.

Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
---
 drivers/infiniband/core/device.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index d275db195f1a..9cdd313e4603 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -2352,6 +2352,16 @@ int ib_enum_all_devs(nldev_callback nldev_cb, struct sk_buff *skb,
 		if (!rdma_dev_access_netns(dev, sock_net(skb->sk)))
 			continue;
 
+		if (!ib_devices_shared_netns) {
+			int port = rdma_start_port(dev);
+			struct net_device *ndev = NULL;
+
+			ndev = ib_device_get_netdev(dev, port);
+
+			if (ndev && !net_eq(dev_net(ndev), sock_net(skb->sk)))
+				continue;
+		}
+
 		ret = nldev_cb(dev, skb, cb, idx);
 		if (ret)
 			break;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH] rdma: not display the rdma link in other net namespace
  2022-10-09 10:20     ` [PATCH] rdma: not display the rdma link in other net namespace yanjun.zhu
@ 2022-10-11  9:49       ` Leon Romanovsky
  0 siblings, 0 replies; 18+ messages in thread
From: Leon Romanovsky @ 2022-10-11  9:49 UTC (permalink / raw)
  To: yanjun.zhu; +Cc: Leon Romanovsky, linux-rdma, jgg

On Sun, Oct 09, 2022 at 10:20:53AM +0000, yanjun.zhu@linux.dev wrote:
> September 28, 2022 2:04 PM, "Leon Romanovsky" <leon@kernel.org> wrote:
> 
> > On Tue, Sep 27, 2022 at 06:58:50PM +0800, Yanjun Zhu wrote:
> > 
> >> 在 2022/9/27 18:34, Leon Romanovsky 写道:
> >> On Sun, Sep 25, 2022 at 10:40:33PM -0400, yanjun.zhu@linux.dev wrote:
> >>> From: Zhu Yanjun <yanjun.zhu@linux.dev>
> >>> 
> >>> When the net devices are moved to another net namespace, the command
> >>> "rdma link" should not dispaly the rdma link about this net device.
> >>> 
> >>> For example, when the net device eno12399 is moved to net namespace net0
> >>> from init_net, the rdma link of eno12399 should not display in init_net.
> >>> 
> >>> Before this change:
> >>> 
> >>> Init_net:
> >>> 
> >>> link roceo12399/1 state DOWN physical_state DISABLED <---should not display
> >>> link roceo12409/1 state DOWN physical_state DISABLED netdev eno12409
> >>> link rocep202s0f0/1 state DOWN physical_state DISABLED netdev ens7f0
> >>> link rocep202s0f1/1 state ACTIVE physical_state LINK_UP netdev ens7f1
> >>> 
> >>> net0:
> >>> 
> >>> link roceo12399/1 state DOWN physical_state DISABLED netdev eno12399
> >>> link roceo12409/1 state DOWN physical_state DISABLED <---should not display
> >>> link rocep202s0f0/1 state DOWN physical_state DISABLED <---should not display
> >>> link rocep202s0f1/1 state ACTIVE physical_state LINK_UP <---should not display
> >>> 
> >>> After this change
> >>> 
> >>> Init_net:
> >>> 
> >>> link roceo12409/1 state DOWN physical_state DISABLED netdev eno12409
> >>> link rocep202s0f0/1 state DOWN physical_state DISABLED netdev ens7f0
> >>> link rocep202s0f1/1 state ACTIVE physical_state LINK_UP netdev ens7f1
> >>> 
> >>> net0:
> >>> 
> >>> link roceo12399/1 state DOWN physical_state DISABLED netdev eno12399
> >>> 
> >>> Fixes: da990ab40a92 ("rdma: Add link object")
> >>> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> >>> ---
> >>> rdma/link.c | 3 +++
> >>> 1 file changed, 3 insertions(+)
> >>> 
> >>> diff --git a/rdma/link.c b/rdma/link.c
> >>> index bf24b849..449a7636 100644
> >>> --- a/rdma/link.c
> >>> +++ b/rdma/link.c
> >>> @@ -238,6 +238,9 @@ static int link_parse_cb(const struct nlmsghdr *nlh, void *data)
> >>> return MNL_CB_ERROR;
> >>> }
> >>> + if (!tb[RDMA_NLDEV_ATTR_NDEV_NAME] || !tb[RDMA_NLDEV_ATTR_NDEV_INDEX])
> >>> + return MNL_CB_OK;
> >>> +
> >> Regarding your question where it should go in addition to RDMA, the answer
> >> is netdev ML. The rdmatool is part of iproute2 and the relevant maintainers
> >> should be CCed.
> >> Thanks. I will also send it to netdev ML and CC the maintainers.
> >> 
> >> Regarding the change, I don't think that it is right. User space tool is
> >> a simple viewer of data returned from the kernel. It is not a mistake to
> >> return device without netdev.
> >> 
> >> Normally a rdma link based on RoCEv2 should be with a NIC. This NIC device
> >> 
> >> will send/recv udp packets. With mellanox/intel NIC device, this net device
> >> also
> >> 
> >> do more work than sending/receiving packets.
> >> 
> >> From this perspective, a rdma link is dependent on a net device.
> >> 
> >> In this problem, net device is moved to another net namespace. So it can not
> >> be
> >> 
> >> obtained.  And this rdma link can also not work in this net namespace.
> >> 
> >> So this rdma link should not appear in this net namespace. Or else, it would
> >> confuse
> >> 
> >> the user.
> >> 
> >> In fact, net namespace is a concept in tcp/ip stack. And it does not exist
> >> in rdma stack.
> > 
> > RDMA has two different net namespace mode: shared and exclusive.
> > 
> > In shared mode, the IB devices are shared across all net namespaces and
> > "moving" net device into different namespace just "hides" it, but don't
> > disconnect.
> 
> Hi, Leon
> 
> About RDMA shared and exclusive mode, I am confusing about this scenario:
> 
> In shared mode, ib device A is in net namespace A1 while netdev device B is in net namespace B1.
> IB device A is dependent on netdev device B. How to make tests in the above scenario?
> Both rping and perftest need a IP address to work. But now ip address is in net namespace B1 while
> ib device A is in net namespace A1.
> 
> In the product environment, does the above scenario exist?

Yes and no at the same time.

Yes:
The whole net namespace support is needed for containers. In old
versions of rdma-core, libibverbs relied on /sys/class/infiniband/
structure. This is why we need "shared" mode, where IB exists without
relation to netdev.

No:
Like you said, it won't work for RoCE and iWARP.

Thanks

> 
> Thanks and Regards,
> Zhu Yanjun
> 
> > 
> > See comments around various usages of ib_devices_shared_netns variable.
> > 
> > Thanks

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFC PATCH 1/1] RDMA/core: Fix a problem from rdma link in exclusive mode
  2022-10-11  0:25                   ` [RFC PATCH 1/1] RDMA/core: Fix a problem from rdma link in exclusive mode Zhu Yanjun
@ 2022-10-11 10:12                     ` Leon Romanovsky
  2022-10-11 15:08                       ` Yanjun Zhu
  2022-10-13  8:30                       ` yanjun.zhu
  0 siblings, 2 replies; 18+ messages in thread
From: Leon Romanovsky @ 2022-10-11 10:12 UTC (permalink / raw)
  To: Zhu Yanjun; +Cc: yanjun.zhu, jgg, leo, linux-rdma

On Mon, Oct 10, 2022 at 08:25:45PM -0400, Zhu Yanjun wrote:
> From: Zhu Yanjun <yanjun.zhu@linux.dev>
> 
> This is not an official commit. In rdma net namespace, the rdma device
> is separate from the net device. For example, a rdma device A is in net
> namespace A1 while the related net device B is in net namespace B1.
> 
> I am curious how to make perftest and rping tests on the above
> scenario. The ip address of net device B is in net namespace B1
> while the rdma device is in net namespace A1.

Use "exclusive" mode, "shared" is legacy interface for backward
compatibility.

> 
> From my perspective, the rdma device and related net device should
> be in the same net namespace. When a net device is moved from one net
> namespace to another net namespace, the rdma device should be in the
> same net namespace with the net device.
> 
> In this commit, when all the ib devices are parsed in exclusive mode,
> if the ib devices and related net devices are not in the same net
> namespace, the link information will not be reported to user space.
> 
> This commit is a RFC.

Please don't send patches as reply-to.

Thanks

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFC PATCH 1/1] RDMA/core: Fix a problem from rdma link in exclusive mode
  2022-10-11 10:12                     ` Leon Romanovsky
@ 2022-10-11 15:08                       ` Yanjun Zhu
  2022-10-13  8:30                       ` yanjun.zhu
  1 sibling, 0 replies; 18+ messages in thread
From: Yanjun Zhu @ 2022-10-11 15:08 UTC (permalink / raw)
  To: Leon Romanovsky, Zhu Yanjun; +Cc: yanjun.zhu, jgg, leo, linux-rdma

在 2022/10/11 18:12, Leon Romanovsky 写道:
> On Mon, Oct 10, 2022 at 08:25:45PM -0400, Zhu Yanjun wrote:
>> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>>
>> This is not an official commit. In rdma net namespace, the rdma device
>> is separate from the net device. For example, a rdma device A is in net
>> namespace A1 while the related net device B is in net namespace B1.
>>
>> I am curious how to make perftest and rping tests on the above
>> scenario. The ip address of net device B is in net namespace B1
>> while the rdma device is in net namespace A1.
> 
> Use "exclusive" mode, "shared" is legacy interface for backward
> compatibility.

Got it. Thanks.

> 
>>
>>  From my perspective, the rdma device and related net device should
>> be in the same net namespace. When a net device is moved from one net
>> namespace to another net namespace, the rdma device should be in the
>> same net namespace with the net device.
>>
>> In this commit, when all the ib devices are parsed in exclusive mode,
>> if the ib devices and related net devices are not in the same net
>> namespace, the link information will not be reported to user space.
>>
>> This commit is a RFC.
> 
> Please don't send patches as reply-to.

OK. I will send another commit to fix this problem very soon.

Zhu Yanjun

> 
> Thanks


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFC PATCH 1/1] RDMA/core: Fix a problem from rdma link in exclusive mode
  2022-10-11 10:12                     ` Leon Romanovsky
  2022-10-11 15:08                       ` Yanjun Zhu
@ 2022-10-13  8:30                       ` yanjun.zhu
  1 sibling, 0 replies; 18+ messages in thread
From: yanjun.zhu @ 2022-10-13  8:30 UTC (permalink / raw)
  To: Leon Romanovsky, Zhu Yanjun; +Cc: jgg, leo, linux-rdma

October 11, 2022 11:08 PM, "Yanjun Zhu" <yanjun.zhu@linux.dev> wrote:

> 在 2022/10/11 18:12, Leon Romanovsky 写道:
> 
>> On Mon, Oct 10, 2022 at 08:25:45PM -0400, Zhu Yanjun wrote:
>>> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>>> 
>>> This is not an official commit. In rdma net namespace, the rdma device
>>> is separate from the net device. For example, a rdma device A is in net
>>> namespace A1 while the related net device B is in net namespace B1.
>>> 
>>> I am curious how to make perftest and rping tests on the above
>>> scenario. The ip address of net device B is in net namespace B1
>>> while the rdma device is in net namespace A1.
>> 
>> Use "exclusive" mode, "shared" is legacy interface for backward
>> compatibility.
> 
> Got it. Thanks.
> 
>>> From my perspective, the rdma device and related net device should
>>> be in the same net namespace. When a net device is moved from one net
>>> namespace to another net namespace, the rdma device should be in the
>>> same net namespace with the net device.
>>> 
>>> In this commit, when all the ib devices are parsed in exclusive mode,
>>> if the ib devices and related net devices are not in the same net
>>> namespace, the link information will not be reported to user space.
>>> 
>>> This commit is a RFC.
>> 
>> Please don't send patches as reply-to.
> 
> OK. I will send another commit to fix this problem very soon.

Hi, Leon

Per discussion, to the non-legacy ib device, when the net devices are moved from one net namespace to another net namespace, the related  ib devices are also moved to the new net namespace.

To the legacy ib device, shared/exclusive mode still work with them.

Based on the above, 2 patches are implemented. I will send them out very soon.

Thanks and Regards,
Zhu Yanjun

> 
> Zhu Yanjun
> 
>> Thanks

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2022-10-13  8:30 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-26  2:40 [PATCH] rdma: not display the rdma link in other net namespace yanjun.zhu
2022-09-25 10:22 ` Yanjun Zhu
2022-09-27 10:34 ` Leon Romanovsky
2022-09-27 10:58   ` Yanjun Zhu
2022-09-28  6:04     ` Leon Romanovsky
2022-09-30  7:25       ` Yanjun Zhu
2022-10-06 12:53         ` Leon Romanovsky
2022-10-06 14:26           ` Yanjun Zhu
2022-10-06 16:21             ` Leon Romanovsky
2022-10-06 16:23               ` Jason Gunthorpe
2022-10-07  6:21                 ` Leon Romanovsky
2022-10-07  6:56                   ` Yanjun Zhu
2022-10-11  0:25                   ` [RFC PATCH 1/1] RDMA/core: Fix a problem from rdma link in exclusive mode Zhu Yanjun
2022-10-11 10:12                     ` Leon Romanovsky
2022-10-11 15:08                       ` Yanjun Zhu
2022-10-13  8:30                       ` yanjun.zhu
2022-10-09 10:20     ` [PATCH] rdma: not display the rdma link in other net namespace yanjun.zhu
2022-10-11  9:49       ` Leon Romanovsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.