[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55157B15.3040400@profitbricks.com>
Date: Fri, 27 Mar 2015 16:45:25 +0100
From: Michael Wang <yun.wang@...fitbricks.com>
To: Roland Dreier <roland@...nel.org>,
Sean Hefty <sean.hefty@...el.com>,
Hal Rosenstock <hal.rosenstock@...il.com>,
Ira Weiny <ira.weiny@...el.com>, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-nfs@...r.kernel.org,
netdev@...r.kernel.org
CC: "J. Bruce Fields" <bfields@...ldses.org>,
Trond Myklebust <trond.myklebust@...marydata.com>,
"David S. Miller" <davem@...emloft.net>,
Or Gerlitz <ogerlitz@...lanox.com>,
Moni Shoua <monis@...lanox.com>,
PJ Waskiewicz <pj.waskiewicz@...idfire.com>,
Tatyana Nikolova <Tatyana.E.Nikolova@...el.com>,
Yan Burman <yanb@...lanox.com>,
Jack Morgenstein <jackm@....mellanox.co.il>,
Bart Van Assche <bvanassche@....org>,
Yann Droneaud <ydroneaud@...eya.com>,
Colin Ian King <colin.king@...onical.com>,
Majd Dibbiny <majd@...lanox.com>,
Jiri Kosina <jkosina@...e.cz>,
Matan Barak <matanb@...lanox.com>,
Alex Estrin <alex.estrin@...el.com>,
Doug Ledford <dledford@...hat.com>,
Eric Dumazet <edumazet@...gle.com>,
Erez Shitrit <erezsh@...lanox.com>,
Sagi Grimberg <sagig@...lanox.com>,
Haggai Eran <haggaie@...lanox.com>,
Shachar Raindel <raindel@...lanox.com>,
Mike Marciniszyn <mike.marciniszyn@...el.com>,
Steve Wise <swise@...ngridcomputing.com>,
Tom Tucker <tom@....us>, Chuck Lever <chuck.lever@...cle.com>,
Michael Wang <yun.wang@...fitbricks.com>
Subject: [RFC PATCH 05/11] IB/Verbs: Use management helper has_cm() for cm-check
Introduce helper has_cm() to help us check if an IB device
support Communication Manager.
Cc: Jason Gunthorpe <jgunthorpe@...idianresearch.com>
Cc: Doug Ledford <dledford@...hat.com>
Cc: Ira Weiny <ira.weiny@...el.com>
Cc: Sean Hefty <sean.hefty@...el.com>
Signed-off-by: Michael Wang <yun.wang@...fitbricks.com>
---
drivers/infiniband/core/cm.c | 2 +-
drivers/infiniband/core/cma.c | 10 ++++------
drivers/infiniband/core/ucm.c | 2 +-
include/rdma/ib_verbs.h | 13 +++++++++++++
4 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 2c72e9e..5c1f01b 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -3762,7 +3762,7 @@ static void cm_add_one(struct ib_device *ib_device)
int ret;
u8 i;
- if (!rdma_transport_is_ib(ib_device))
+ if (!has_cm(ib_device))
return;
cm_dev = kzalloc(sizeof(*cm_dev) + sizeof(*port) *
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 280cfe3..276fb76 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -433,7 +433,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
pkey = ntohs(addr->sib_pkey);
list_for_each_entry(cur_dev, &dev_list, list) {
- if (!rdma_transport_is_ib(cur_dev->device))
+ if (!has_cm(cur_dev->device))
continue;
for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) {
@@ -631,7 +631,7 @@ static int cma_modify_qp_rtr(struct rdma_id_private *id_priv,
if (ret)
goto out;
- if (rdma_transport_is_ib(id_priv->cma_dev->device) &&
+ if (has_cm(id_priv->cma_dev->device) &&
rdma_port_ll_is_eth(id_priv->id.device, id_priv->id.port_num)) {
ret = rdma_addr_find_smac_by_sgid(&sgid, qp_attr.smac, NULL);
@@ -1620,8 +1620,7 @@ static void cma_listen_on_dev(struct rdma_id_private *id_priv,
struct rdma_cm_id *id;
int ret;
- if (cma_family(id_priv) == AF_IB &&
- !rdma_transport_is_ib(cma_dev->device))
+ if (cma_family(id_priv) == AF_IB && !has_cm(cma_dev->device))
return;
id = rdma_create_id(cma_listen_handler, id_priv, id_priv->id.ps,
@@ -2022,8 +2021,7 @@ static int cma_bind_loopback(struct rdma_id_private *id_priv)
cma_dev = NULL;
mutex_lock(&lock);
list_for_each_entry(cur_dev, &dev_list, list) {
- if (cma_family(id_priv) == AF_IB &&
- !rdma_transport_is_ib(cur_dev->device))
+ if (cma_family(id_priv) == AF_IB && !has_cm(cur_dev->device))
continue;
if (!cma_dev)
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c
index ddbe0b4..7084181 100644
--- a/drivers/infiniband/core/ucm.c
+++ b/drivers/infiniband/core/ucm.c
@@ -1253,7 +1253,7 @@ static void ib_ucm_add_one(struct ib_device *device)
dev_t base;
struct ib_ucm_device *ucm_dev;
- if (!device->alloc_ucontext || !rdma_transport_is_ib(device))
+ if (!device->alloc_ucontext || !has_cm(device))
return;
ucm_dev = kzalloc(sizeof *ucm_dev, GFP_KERNEL);
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 3d06178..c0a63f8 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1797,6 +1797,19 @@ static inline int has_mad(struct ib_device *device)
}
/**
+ * has_cm - Check if a device support Communication Manager.
+ *
+ * @device: Device to be checked
+ *
+ * Return 0 when a device has none port to support Communication
+ * Manager.
+ */
+static inline int has_cm(struct ib_device *device)
+{
+ return rdma_transport_is_ib(device);
+}
+
+/**
* cap_smi - Check if the port of device has the capability
* Subnet Management Interface.
*
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists