Commit a56bc45b authored by Parav Pandit's avatar Parav Pandit Committed by Jason Gunthorpe

RDMA/core: Add module param to disable device sharing among net ns

Add module parameter to change a sharing mode of ib_core early in the
boot process. This parameter helps to those systems where modern up
to date rdma tool (iproute2) package may not be available during
kernel upgrade cycle.
Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 5417783e
...@@ -127,6 +127,10 @@ static DEFINE_XARRAY_FLAGS(rdma_nets, XA_FLAGS_ALLOC); ...@@ -127,6 +127,10 @@ static DEFINE_XARRAY_FLAGS(rdma_nets, XA_FLAGS_ALLOC);
*/ */
static DECLARE_RWSEM(rdma_nets_rwsem); static DECLARE_RWSEM(rdma_nets_rwsem);
static bool ib_devices_shared_netns = true;
module_param_named(netns_mode, ib_devices_shared_netns, bool, 0444);
MODULE_PARM_DESC(netns_mode,
"Share device among net namespaces; default=1 (shared)");
/* /*
* xarray has this behavior where it won't iterate over NULL values stored in * xarray has this behavior where it won't iterate over NULL values stored in
* allocated arrays. So we need our own iterator to see all values stored in * allocated arrays. So we need our own iterator to see all values stored in
...@@ -736,6 +740,9 @@ static int add_one_compat_dev(struct ib_device *device, ...@@ -736,6 +740,9 @@ static int add_one_compat_dev(struct ib_device *device,
struct ib_core_device *cdev; struct ib_core_device *cdev;
int ret; int ret;
if (!ib_devices_shared_netns)
return 0;
/* /*
* Create and add compat device in all namespaces other than where it * Create and add compat device in all namespaces other than where it
* is currently bound to. * is currently bound to.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment