Revert "net/smc: Replace ib_query_gid with rdma_get_gid_attr"

This reverts commit ddb457c699.

The include rdma/ib_cache.h is kept, and we have to add a memset
to the compat wrapper to avoid compiler warnings in gcc-7

This revert is done to avoid extensive merge conflicts with SMC
changes in netdev during the 4.19 merge window.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
Jason Gunthorpe 2018-08-15 16:52:58 -06:00
parent 89982f7cce
commit 92f4e77c85
3 changed files with 21 additions and 23 deletions

View File

@ -143,6 +143,7 @@ static inline __deprecated int ib_query_gid(struct ib_device *device,
{
const struct ib_gid_attr *attr;
memset(attr_out, 0, sizeof(*attr_out));
attr = rdma_get_gid_attr(device, port_num, index);
if (IS_ERR(attr))
return PTR_ERR(attr);

View File

@ -451,7 +451,8 @@ static int smc_vlan_by_tcpsk(struct socket *clcsock, unsigned short *vlan_id)
static int smc_link_determine_gid(struct smc_link_group *lgr)
{
struct smc_link *lnk = &lgr->lnk[SMC_SINGLE_LINK];
const struct ib_gid_attr *gattr;
struct ib_gid_attr gattr;
union ib_gid gid;
int i;
if (!lgr->vlan_id) {
@ -461,18 +462,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++) {
gattr = rdma_get_gid_attr(lnk->smcibdev->ibdev, lnk->ibport, i);
if (IS_ERR(gattr))
if (ib_query_gid(lnk->smcibdev->ibdev, lnk->ibport, i, &gid,
&gattr))
continue;
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);
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);
return 0;
}
dev_put(gattr.ndev);
}
rdma_put_gid_attr(gattr);
}
return -ENODEV;
}

View File

@ -373,21 +373,17 @@ 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)
{
const struct ib_gid_attr *gattr;
int rc = 0;
struct ib_gid_attr gattr;
int rc;
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;
rc = ib_query_gid(smcibdev->ibdev, ibport, 0,
&smcibdev->gid[ibport - 1], &gattr);
if (rc || !gattr.ndev)
return -ENODEV;
memcpy(smcibdev->mac[ibport - 1], gattr.ndev->dev_addr, ETH_ALEN);
dev_put(gattr.ndev);
return 0;
}
/* Create an identifier unique for this instance of SMC-R.