[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <a1a8a96629405ff3b2990f5f8dbd7b57a818571e.1623053078.git.leonro@nvidia.com>
Date: Mon, 7 Jun 2021 11:17:39 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Doug Ledford <dledford@...hat.com>,
Jason Gunthorpe <jgg@...dia.com>
Cc: Greg KH <gregkh@...uxfoundation.org>,
Kees Cook <keescook@...omium.org>,
Nathan Chancellor <nathan@...nel.org>,
Adit Ranadive <aditr@...are.com>,
Ariel Elior <aelior@...vell.com>,
Christian Benvenuti <benve@...co.com>,
clang-built-linux@...glegroups.com,
Dennis Dalessandro <dennis.dalessandro@...nelisnetworks.com>,
Devesh Sharma <devesh.sharma@...adcom.com>,
Gal Pressman <galpress@...zon.com>,
linux-kernel@...r.kernel.org, linux-rdma@...r.kernel.org,
Michal Kalderon <mkalderon@...vell.com>,
Mike Marciniszyn <mike.marciniszyn@...nelisnetworks.com>,
Mustafa Ismail <mustafa.ismail@...el.com>,
Naresh Kumar PBS <nareshkumar.pbs@...adcom.com>,
Nelson Escobar <neescoba@...co.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Potnuri Bharat Teja <bharat@...lsio.com>,
Selvin Xavier <selvin.xavier@...adcom.com>,
Shiraz Saleem <shiraz.saleem@...el.com>,
VMware PV-Drivers <pv-drivers@...are.com>,
Yishai Hadas <yishaih@...dia.com>,
Zhu Yanjun <zyjzyj2000@...il.com>
Subject: [PATCH rdma-next v1 14/15] RDMA/core: Allow port_groups to be used with namespaces
From: Jason Gunthorpe <jgg@...dia.com>
Now that the port_groups data is being destroyed and managed by the core
code this restriction is no longer needed. All the ib_port_attrs are
compatible with the core's sysfs lifecycle.
Signed-off-by: Jason Gunthorpe <jgg@...dia.com>
Signed-off-by: Leon Romanovsky <leonro@...dia.com>
---
drivers/infiniband/core/device.c | 10 ++++------
drivers/infiniband/core/sysfs.c | 17 ++++++-----------
2 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 2cbd77933ea5..92f224a97481 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -1698,13 +1698,11 @@ int ib_device_set_netns_put(struct sk_buff *skb,
}
/*
- * Currently supported only for those providers which support
- * disassociation and don't do port specific sysfs init. Once a
- * port_cleanup infrastructure is implemented, this limitation will be
- * removed.
+ * All the ib_clients, including uverbs, are reset when the namespace is
+ * changed and this cannot be blocked waiting for userspace to do
+ * something, so disassociation is mandatory.
*/
- if (!dev->ops.disassociate_ucontext || dev->ops.port_groups ||
- ib_devices_shared_netns) {
+ if (!dev->ops.disassociate_ucontext || ib_devices_shared_netns) {
ret = -EOPNOTSUPP;
goto ns_err;
}
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index 09a2e1066df0..f42034fcf3d9 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -1236,11 +1236,9 @@ static struct ib_port *setup_port(struct ib_core_device *coredev, int port_num,
ret = sysfs_create_groups(&p->kobj, p->groups_list);
if (ret)
goto err_del;
- if (is_full_dev) {
- ret = sysfs_create_groups(&p->kobj, device->ops.port_groups);
- if (ret)
- goto err_groups;
- }
+ ret = sysfs_create_groups(&p->kobj, device->ops.port_groups);
+ if (ret)
+ goto err_groups;
list_add_tail(&p->kobj.entry, &coredev->port_list);
if (device->port_data && is_full_dev)
@@ -1257,16 +1255,13 @@ static struct ib_port *setup_port(struct ib_core_device *coredev, int port_num,
return ERR_PTR(ret);
}
-static void destroy_port(struct ib_core_device *coredev, struct ib_port *port)
+static void destroy_port(struct ib_port *port)
{
- bool is_full_dev = &port->ibdev->coredev == coredev;
-
if (port->ibdev->port_data &&
port->ibdev->port_data[port->port_num].sysfs == port)
port->ibdev->port_data[port->port_num].sysfs = NULL;
list_del(&port->kobj.entry);
- if (is_full_dev)
- sysfs_remove_groups(&port->kobj, port->ibdev->ops.port_groups);
+ sysfs_remove_groups(&port->kobj, port->ibdev->ops.port_groups);
sysfs_remove_groups(&port->kobj, port->groups_list);
kobject_del(&port->kobj);
kobject_put(&port->kobj);
@@ -1392,7 +1387,7 @@ void ib_free_port_attrs(struct ib_core_device *coredev)
struct ib_port *port = container_of(p, struct ib_port, kobj);
destroy_gid_attrs(port);
- destroy_port(coredev, port);
+ destroy_port(port);
}
kobject_put(coredev->ports_kobj);
--
2.31.1
Powered by blists - more mailing lists