aboutsummaryrefslogtreecommitdiffstats
path: root/net/smc
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@mellanox.com>2018-08-15 18:52:58 -0400
committerJason Gunthorpe <jgg@mellanox.com>2018-08-16 16:03:34 -0400
commit92f4e77c85918eab5e5803d7e28ab89a7e6bd3a2 (patch)
tree70ce3b5c8152fc5e92043e6c0d2ef4bc00678408 /net/smc
parent89982f7ccee2fcd8fea7936b81eec6defbf0f131 (diff)
Revert "net/smc: Replace ib_query_gid with rdma_get_gid_attr"
This reverts commit ddb457c6993babbcdd41fca638b870d2a2fc3941. 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>
Diffstat (limited to 'net/smc')
-rw-r--r--net/smc/smc_core.c19
-rw-r--r--net/smc/smc_ib.c24
2 files changed, 20 insertions, 23 deletions
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index d99a75f75e42..15bad268f37d 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -451,7 +451,8 @@ out:
451static int smc_link_determine_gid(struct smc_link_group *lgr) 451static int smc_link_determine_gid(struct smc_link_group *lgr)
452{ 452{
453 struct smc_link *lnk = &lgr->lnk[SMC_SINGLE_LINK]; 453 struct smc_link *lnk = &lgr->lnk[SMC_SINGLE_LINK];
454 const struct ib_gid_attr *gattr; 454 struct ib_gid_attr gattr;
455 union ib_gid gid;
455 int i; 456 int i;
456 457
457 if (!lgr->vlan_id) { 458 if (!lgr->vlan_id) {
@@ -461,18 +462,18 @@ static int smc_link_determine_gid(struct smc_link_group *lgr)
461 462
462 for (i = 0; i < lnk->smcibdev->pattr[lnk->ibport - 1].gid_tbl_len; 463 for (i = 0; i < lnk->smcibdev->pattr[lnk->ibport - 1].gid_tbl_len;
463 i++) { 464 i++) {
464 gattr = rdma_get_gid_attr(lnk->smcibdev->ibdev, lnk->ibport, i); 465 if (ib_query_gid(lnk->smcibdev->ibdev, lnk->ibport, i, &gid,
465 if (IS_ERR(gattr)) 466 &gattr))
466 continue; 467 continue;
467 if (gattr->ndev) { 468 if (gattr.ndev) {
468 if (is_vlan_dev(gattr->ndev) && 469 if (is_vlan_dev(gattr.ndev) &&
469 vlan_dev_vlan_id(gattr->ndev) == lgr->vlan_id) { 470 vlan_dev_vlan_id(gattr.ndev) == lgr->vlan_id) {
470 lnk->gid = gattr->gid; 471 lnk->gid = gid;
471 rdma_put_gid_attr(gattr); 472 dev_put(gattr.ndev);
472 return 0; 473 return 0;
473 } 474 }
475 dev_put(gattr.ndev);
474 } 476 }
475 rdma_put_gid_attr(gattr);
476 } 477 }
477 return -ENODEV; 478 return -ENODEV;
478} 479}
diff --git a/net/smc/smc_ib.c b/net/smc/smc_ib.c
index 74f29f814ec1..117b05f1a494 100644
--- a/net/smc/smc_ib.c
+++ b/net/smc/smc_ib.c
@@ -373,21 +373,17 @@ void smc_ib_buf_unmap_sg(struct smc_ib_device *smcibdev,
373 373
374static int smc_ib_fill_gid_and_mac(struct smc_ib_device *smcibdev, u8 ibport) 374static int smc_ib_fill_gid_and_mac(struct smc_ib_device *smcibdev, u8 ibport)
375{ 375{
376 const struct ib_gid_attr *gattr; 376 struct ib_gid_attr gattr;
377 int rc = 0; 377 int rc;
378 378
379 gattr = rdma_get_gid_attr(smcibdev->ibdev, ibport, 0); 379 rc = ib_query_gid(smcibdev->ibdev, ibport, 0,
380 if (IS_ERR(gattr)) 380 &smcibdev->gid[ibport - 1], &gattr);
381 return PTR_ERR(gattr); 381 if (rc || !gattr.ndev)
382 if (!gattr->ndev) { 382 return -ENODEV;
383 rc = -ENODEV; 383
384 goto done; 384 memcpy(smcibdev->mac[ibport - 1], gattr.ndev->dev_addr, ETH_ALEN);
385 } 385 dev_put(gattr.ndev);
386 smcibdev->gid[ibport - 1] = gattr->gid; 386 return 0;
387 memcpy(smcibdev->mac[ibport - 1], gattr->ndev->dev_addr, ETH_ALEN);
388done:
389 rdma_put_gid_attr(gattr);
390 return rc;
391} 387}
392 388
393/* Create an identifier unique for this instance of SMC-R. 389/* Create an identifier unique for this instance of SMC-R.