summaryrefslogtreecommitdiff
path: root/drivers/infiniband/core/device.c
diff options
context:
space:
mode:
authorParav Pandit <parav@mellanox.com>2019-02-26 13:56:15 +0200
committerJason Gunthorpe <jgg@mellanox.com>2019-03-28 14:52:02 -0300
commit5417783eabb2c66738394149123fbcdd0cca0f51 (patch)
treeb6a226ba48fce948a0ffa3281ee7845fb7e5dab2 /drivers/infiniband/core/device.c
parent4e0f7b9070726a34bbd87a74e407d4cced6d49ab (diff)
RDMA/core: Support core port attributes in non init_net
Now that sysfs compatibility layer for non init_net exists, add core port attributes such as pkey and gid table to non init_net ns. Signed-off-by: Parav Pandit <parav@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/device.c')
-rw-r--r--drivers/infiniband/core/device.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 167e2d46e4cb..0735f8b8167e 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -773,6 +773,9 @@ static int add_one_compat_dev(struct ib_device *device,
ret = device_add(&cdev->dev);
if (ret)
goto add_err;
+ ret = ib_setup_port_attrs(cdev, false);
+ if (ret)
+ goto port_err;
ret = xa_err(xa_store(&device->compat_devs, rnet->id,
cdev, GFP_KERNEL));
@@ -783,6 +786,8 @@ static int add_one_compat_dev(struct ib_device *device,
return 0;
insert_err:
+ ib_free_port_attrs(cdev);
+port_err:
device_del(&cdev->dev);
add_err:
put_device(&cdev->dev);
@@ -801,6 +806,7 @@ static void remove_one_compat_dev(struct ib_device *device, u32 id)
cdev = xa_erase(&device->compat_devs, id);
mutex_unlock(&device->compat_devs_mutex);
if (cdev) {
+ ib_free_port_attrs(cdev);
device_del(&cdev->dev);
put_device(&cdev->dev);
}