From: Parav Pandit <parav@xxxxxxxxxxxx> 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@xxxxxxxxxxxx> Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx> --- drivers/infiniband/core/device.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 4dc5bb2f5c77..09402ded9548 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -146,6 +146,10 @@ static DEFINE_XARRAY_FLAGS(rdma_nets, XA_FLAGS_TRACK_FREE); */ 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 @@ -681,6 +685,9 @@ static int add_one_compat_dev(struct ib_device *device, struct ib_compat_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. */ -- 2.19.1