From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Dasaratharaman Chandramouli
<dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: [RFC PATCH 09/11] IB/IPoIB: Modify ipoib_get_net_dev_by_params to lookup gid table
Date: Fri, 23 Sep 2016 13:44:32 -0400 [thread overview]
Message-ID: <1474652674-13110-10-git-send-email-ira.weiny@intel.com> (raw)
In-Reply-To: <1474652674-13110-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
From: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
ipoib_get_net_dev_by_params compares incoming gid with local_gid
which is gid at index 0 of the gid table. OPA devices using larger
LIDs may have a different GID format than whats setup in the local_gid
field. Do a search of the gid table in those cases.
Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
drivers/infiniband/ulp/ipoib/ipoib_main.c | 37 +++++++++++++++++++++++++++++--
1 file changed, 35 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 2bcde9822e3a..76da1430b415 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -328,6 +328,40 @@ out:
return result;
}
+/* retuns true if the incoming gid is assigned to the IPoIB
+ * netdev interface
+ *
+ * OPA devices may have the incoming GID in the OPA GID
+ * format which might not necessarily be assigned to the
+ * netdev interface. This necessitates searching the GID
+ * table to match this OPA GID.
+ */
+static bool ipoib_check_gid(struct ipoib_dev_priv *priv,
+ const union ib_gid *gid)
+{
+ bool is_local_gid;
+ struct ib_port_attr attr;
+ union ib_gid port_gid;
+ int i;
+
+ if (!gid)
+ return true;
+
+ is_local_gid = !memcmp(gid, &priv->local_gid, sizeof(*gid));
+
+ if (!rdma_cap_opa_ah(priv->ca, priv->port) || is_local_gid)
+ return is_local_gid;
+
+ if (ib_query_port(priv->ca, priv->port, &attr))
+ return false;
+ for (i = 1; i < attr.gid_tbl_len; i++) {
+ if (ib_query_gid(priv->ca, priv->port, i, &port_gid, NULL))
+ return false;
+ if (!memcmp(gid, &port_gid, sizeof(*gid)))
+ return true;
+ }
+ return false;
+}
/* returns the number of IPoIB netdevs on top a given ipoib device matching a
* pkey_index and address, if one exists.
*
@@ -344,8 +378,7 @@ static int ipoib_match_gid_pkey_addr(struct ipoib_dev_priv *priv,
struct net_device *net_dev = NULL;
int matches = 0;
- if (priv->pkey_index == pkey_index &&
- (!gid || !memcmp(gid, &priv->local_gid, sizeof(*gid)))) {
+ if (priv->pkey_index == pkey_index && ipoib_check_gid(priv, gid)) {
if (!addr) {
net_dev = ipoib_get_master_net_dev(priv->dev);
} else {
--
1.8.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-09-23 17:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-23 17:44 [RFC PATCH 00/11] IB/core: Add 32 bit LID support ira.weiny-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1474652674-13110-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-09-23 17:44 ` [RFC PATCH 01/11] IB/core: Add rdma_cap_opa_ah to expose opa address handles ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2016-09-23 17:44 ` [RFC PATCH 02/11] IB/core: Change port_attr.sm_lid from 16 to 32 bits ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2016-09-23 17:44 ` [RFC PATCH 03/11] IB/sa: Modify SM Address handle to program GRH when using large lids ira.weiny-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1474652674-13110-4-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-09-23 18:32 ` Jason Gunthorpe
[not found] ` <20160923183217.GD13920-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-10-11 19:19 ` Chandramouli, Dasaratharaman
2016-09-23 17:44 ` [RFC PATCH 04/11] IB/core: Change lid size in struct ib_port_attr from 16 to 32 bits ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2016-09-23 17:44 ` [RFC PATCH 05/11] IB/core: Change lid size in struct ib_wc " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2016-09-23 17:44 ` [RFC PATCH 06/11] IB/mad: Ensure DR MADs are correctly specified when using OPA devices ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2016-09-23 17:44 ` [RFC PATCH 07/11] IB/mad: Change slid in RMPP recv from 16 to 32 bits ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2016-09-23 17:44 ` [RFC PATCH 08/11] IB/IPoIB: Retrieve 32 bit LIDs from path records when running on OPA devices ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2016-09-23 17:44 ` ira.weiny-ral2JQCrhuEAvxtiuMwx3w [this message]
2016-09-23 17:44 ` [RFC PATCH 10/11] IB/srpt: Increase lid and sm_lid to 32 bits ira.weiny-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1474652674-13110-11-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-09-23 21:01 ` Bart Van Assche
2016-09-23 17:44 ` [RFC PATCH 11/11] IB/rdmavt: Modify rvt_check_ah() to account for extended LIDs ira.weiny-ral2JQCrhuEAvxtiuMwx3w
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1474652674-13110-10-git-send-email-ira.weiny@intel.com \
--to=ira.weiny-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox