mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-15 17:51:41 -04:00
RDMA/ipoib: Use parent rdma device net namespace
Use the net namespace of the underlying rdma device. After honoring the rdma device's namespace, the ipoib netdev now also runs in the same net namespace of the rdma device. Add an API to read the net namespace of the rdma device so that ULP such as IPoIB can use it to initialize its netdev. Signed-off-by: Parav Pandit <parav@nvidia.com> Signed-off-by: Mark Bloch <mbloch@nvidia.com> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
This commit is contained in:
committed by
Leon Romanovsky
parent
611d08207d
commit
f1208b0557
@@ -2577,6 +2577,8 @@ static struct net_device *ipoib_add_port(const char *format,
|
||||
|
||||
ndev->rtnl_link_ops = ipoib_get_link_ops();
|
||||
|
||||
dev_net_set(ndev, rdma_dev_net(hca));
|
||||
|
||||
result = register_netdev(ndev);
|
||||
if (result) {
|
||||
pr_warn("%s: couldn't register ipoib port %d; error %d\n",
|
||||
|
||||
@@ -4871,6 +4871,11 @@ static inline int ibdev_to_node(struct ib_device *ibdev)
|
||||
bool rdma_dev_access_netns(const struct ib_device *device,
|
||||
const struct net *net);
|
||||
|
||||
static inline struct net *rdma_dev_net(struct ib_device *device)
|
||||
{
|
||||
return read_pnet(&device->coredev.rdma_net);
|
||||
}
|
||||
|
||||
#define IB_ROCE_UDP_ENCAP_VALID_PORT_MIN (0xC000)
|
||||
#define IB_ROCE_UDP_ENCAP_VALID_PORT_MAX (0xFFFF)
|
||||
#define IB_GRH_FLOWLABEL_MASK (0x000FFFFF)
|
||||
|
||||
Reference in New Issue
Block a user