diff options
author | Parav Pandit <parav@mellanox.com> | 2018-06-05 08:40:19 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-06-18 11:09:05 -0600 |
commit | ddb457c6993babbcdd41fca638b870d2a2fc3941 (patch) | |
tree | 94dc8b6561d9e5089de2eb2c393bd5d81da05b26 /net/smc/smc_ib.c | |
parent | 77e786fcbe2ecdac57ced610260ffb1f7cfeed00 (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_ib.c')
-rw-r--r-- | net/smc/smc_ib.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/net/smc/smc_ib.c b/net/smc/smc_ib.c index 0eed7ab9f28b..74f29f814ec1 100644 --- a/net/smc/smc_ib.c +++ b/net/smc/smc_ib.c @@ -16,6 +16,7 @@ #include <linux/workqueue.h> #include <linux/scatterlist.h> #include <rdma/ib_verbs.h> +#include <rdma/ib_cache.h> #include "smc_pnet.h" #include "smc_ib.h" @@ -372,17 +373,21 @@ void smc_ib_buf_unmap_sg(struct smc_ib_device *smcibdev, static int smc_ib_fill_gid_and_mac(struct smc_ib_device *smcibdev, u8 ibport) { - struct ib_gid_attr gattr; - int rc; - - rc = ib_query_gid(smcibdev->ibdev, ibport, 0, - &smcibdev->gid[ibport - 1], &gattr); - if (rc || !gattr.ndev) - return -ENODEV; + const struct ib_gid_attr *gattr; + int rc = 0; - memcpy(smcibdev->mac[ibport - 1], gattr.ndev->dev_addr, ETH_ALEN); - dev_put(gattr.ndev); - return 0; + gattr = rdma_get_gid_attr(smcibdev->ibdev, ibport, 0); + if (IS_ERR(gattr)) + return PTR_ERR(gattr); + if (!gattr->ndev) { + rc = -ENODEV; + goto done; + } + smcibdev->gid[ibport - 1] = gattr->gid; + memcpy(smcibdev->mac[ibport - 1], gattr->ndev->dev_addr, ETH_ALEN); +done: + rdma_put_gid_attr(gattr); + return rc; } /* Create an identifier unique for this instance of SMC-R. |