summaryrefslogtreecommitdiff
path: root/net/smc/smc_core.c
diff options
context:
space:
mode:
authorParav Pandit <parav@mellanox.com>2018-06-05 08:40:19 +0300
committerJason Gunthorpe <jgg@mellanox.com>2018-06-18 11:09:05 -0600
commitddb457c6993babbcdd41fca638b870d2a2fc3941 (patch)
tree94dc8b6561d9e5089de2eb2c393bd5d81da05b26 /net/smc/smc_core.c
parent77e786fcbe2ecdac57ced610260ffb1f7cfeed00 (diff)
net/smc: Replace ib_query_gid with rdma_get_gid_attr
Push the copy of the gid_attr into the SMC code. This probably doesn't push it far enough, as it looks like the conn->lgr should potentially hold the reference for its lifetime. Signed-off-by: Parav Pandit <parav@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'net/smc/smc_core.c')
-rw-r--r--net/smc/smc_core.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index add82b0266f3..d99a75f75e42 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -16,6 +16,7 @@
#include <net/tcp.h>
#include <net/sock.h>
#include <rdma/ib_verbs.h>
+#include <rdma/ib_cache.h>
#include "smc.h"
#include "smc_clc.h"
@@ -450,8 +451,7 @@ out:
static int smc_link_determine_gid(struct smc_link_group *lgr)
{
struct smc_link *lnk = &lgr->lnk[SMC_SINGLE_LINK];
- struct ib_gid_attr gattr;
- union ib_gid gid;
+ const struct ib_gid_attr *gattr;
int i;
if (!lgr->vlan_id) {
@@ -461,18 +461,18 @@ static int smc_link_determine_gid(struct smc_link_group *lgr)
for (i = 0; i < lnk->smcibdev->pattr[lnk->ibport - 1].gid_tbl_len;
i++) {
- if (ib_query_gid(lnk->smcibdev->ibdev, lnk->ibport, i, &gid,
- &gattr))
+ gattr = rdma_get_gid_attr(lnk->smcibdev->ibdev, lnk->ibport, i);
+ if (IS_ERR(gattr))
continue;
- if (gattr.ndev) {
- if (is_vlan_dev(gattr.ndev) &&
- vlan_dev_vlan_id(gattr.ndev) == lgr->vlan_id) {
- lnk->gid = gid;
- dev_put(gattr.ndev);
+ if (gattr->ndev) {
+ if (is_vlan_dev(gattr->ndev) &&
+ vlan_dev_vlan_id(gattr->ndev) == lgr->vlan_id) {
+ lnk->gid = gattr->gid;
+ rdma_put_gid_attr(gattr);
return 0;
}
- dev_put(gattr.ndev);
}
+ rdma_put_gid_attr(gattr);
}
return -ENODEV;
}