Re: [PATCH] rdma: not display the rdma link in other net namespace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



在 2022/9/26 10:40, yanjun.zhu@xxxxxxxxx 写道:
From: Zhu Yanjun <yanjun.zhu@xxxxxxxxx>

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@xxxxxxxxx>

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]);




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux