summaryrefslogtreecommitdiff
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorParav Pandit <parav@mellanox.com>2019-02-26 14:01:45 +0200
committerJason Gunthorpe <jgg@mellanox.com>2019-03-28 14:52:02 -0300
commita56bc45b27b92954d99c811cb047e789b6cc5a81 (patch)
treea7b5a6460d73c0479b96b36076d12828496a1ad9 /drivers/infiniband
parent5417783eabb2c66738394149123fbcdd0cca0f51 (diff)
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: 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')
-rw-r--r--drivers/infiniband/core/device.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 0735f8b8167e..ebc0b0e58eca 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -127,6 +127,10 @@ static DEFINE_XARRAY_FLAGS(rdma_nets, XA_FLAGS_ALLOC);
*/
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
* 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,
struct ib_core_device *cdev;
int ret;
+ if (!ib_devices_shared_netns)
+ return 0;
+
/*
* Create and add compat device in all namespaces other than where it
* is currently bound to.