Message ID | 1479843532-47496-11-git-send-email-dasaratharaman.chandramouli@intel.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
On Tue, Nov 22, 2016 at 02:38:51PM -0500, Dasaratharaman Chandramouli wrote: > 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. Sorry, NAK, the incoming GID has to exactly match what is in IPoIB LLADDR, you can't do this or it breaks how the virtualization stuff is supposed to work with gid aliases. I'm skeptical about the other ipoib patch as well since ipoib should be dealing natively with 32 bit lids, I think you need to fix the path record stuff too instead of opening coding that in ipoib. Jason -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 11/22/2016 1:20 PM, Jason Gunthorpe wrote: > On Tue, Nov 22, 2016 at 02:38:51PM -0500, Dasaratharaman Chandramouli wrote: >> 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. > > Sorry, NAK, the incoming GID has to exactly match what is in IPoIB > LLADDR, you can't do this or it breaks how the virtualization stuff is > supposed to work with gid aliases. > > I'm skeptical about the other ipoib patch as well since ipoib should > be dealing natively with 32 bit lids, I think you need to fix the path > record stuff too instead of opening coding that in ipoib. Thanks for the clarification. Will attempt to keep the incoming GID consistent with the GID assigned to the IPoIB interface. Regarding your comments on path records, we are looking into supporting 32 bit LIDs in the path record response. Will post the revised patches. > > Jason > -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 474c3bf..3e135df 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -328,6 +328,40 @@ static struct net_device *ipoib_get_net_dev_match_addr( 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 {