[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210405055000.215792-4-leon@kernel.org>
Date: Mon, 5 Apr 2021 08:49:55 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Doug Ledford <dledford@...hat.com>,
Jason Gunthorpe <jgg@...dia.com>
Cc: Parav Pandit <parav@...dia.com>,
"David S. Miller" <davem@...emloft.net>,
Dennis Dalessandro <dennis.dalessandro@...nelisnetworks.com>,
Jakub Kicinski <kuba@...nel.org>,
Karsten Graul <kgraul@...ux.ibm.com>,
linux-kernel@...r.kernel.org, linux-rdma@...r.kernel.org,
linux-s390@...r.kernel.org,
Mike Marciniszyn <mike.marciniszyn@...nelisnetworks.com>,
netdev@...r.kernel.org, rds-devel@....oracle.com,
Santosh Shilimkar <santosh.shilimkar@...cle.com>
Subject: [PATCH rdma-next 3/8] IB/cm: Skip device which doesn't support IB CM
From: Parav Pandit <parav@...dia.com>
There are at least 3 types of RDMA devices which do not support IB CM.
They are
(1) A (eswitch) switchdev RDMA device,
(2) iWARP device and
(3) RDMA device without a RoCE capability
Hence, avoid IB CM initialization for such devices.
This saves 8Kbytes of memory for eswitch device consist of 512 ports and
also avoids unnecessary initialization for all above 3 types of devices.
Signed-off-by: Parav Pandit <parav@...dia.com>
Signed-off-by: Leon Romanovsky <leonro@...dia.com>
---
drivers/infiniband/core/cm.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 8a7791ebae69..5025f2c1347b 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -87,6 +87,7 @@ struct cm_id_private;
struct cm_work;
static int cm_add_one(struct ib_device *device);
static void cm_remove_one(struct ib_device *device, void *client_data);
+static bool cm_supported(struct ib_device *device);
static void cm_process_work(struct cm_id_private *cm_id_priv,
struct cm_work *work);
static int cm_send_sidr_rep_locked(struct cm_id_private *cm_id_priv,
@@ -103,7 +104,8 @@ static int cm_send_rej_locked(struct cm_id_private *cm_id_priv,
static struct ib_client cm_client = {
.name = "cm",
.add = cm_add_one,
- .remove = cm_remove_one
+ .remove = cm_remove_one,
+ .is_supported = cm_supported,
};
static struct ib_cm {
@@ -4371,6 +4373,17 @@ static void cm_remove_port_fs(struct cm_port *port)
}
+static bool cm_supported(struct ib_device *device)
+{
+ u32 i;
+
+ rdma_for_each_port(device, i) {
+ if (rdma_cap_ib_cm(device, i))
+ return true;
+ }
+ return false;
+}
+
static int cm_add_one(struct ib_device *ib_device)
{
struct cm_device *cm_dev;
--
2.30.2
Powered by blists - more mailing lists