[RFC PATCH 1/1] RDMA/core: Fix a problem from rdma link in exclusive mode

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

 



From: Zhu Yanjun <yanjun.zhu@xxxxxxxxx>

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




[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