mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-27 17:45:09 +07:00
Merge branch 'smc-ib_query_gid'
Ursula Braun says: ==================== net/smc: ib_query_gid() patches triggered by Parav Pandit here are 2 cleanup patches for usage of ib_query_gid() in the smc-code. Thanks, Ursula v2 changes advised by Parav Pandit: extra check is_vlan_dev() in patch 2/2 "RoCE" spelling added "Reported-by" added "Reviewed-by" added "Fixes" ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
08b49b9405
@ -380,10 +380,14 @@ static int smc_link_determine_gid(struct smc_link_group *lgr)
|
|||||||
if (ib_query_gid(lnk->smcibdev->ibdev, lnk->ibport, i, &gid,
|
if (ib_query_gid(lnk->smcibdev->ibdev, lnk->ibport, i, &gid,
|
||||||
&gattr))
|
&gattr))
|
||||||
continue;
|
continue;
|
||||||
if (gattr.ndev &&
|
if (gattr.ndev) {
|
||||||
(vlan_dev_vlan_id(gattr.ndev) == lgr->vlan_id)) {
|
if (is_vlan_dev(gattr.ndev) &&
|
||||||
lnk->gid = gid;
|
vlan_dev_vlan_id(gattr.ndev) == lgr->vlan_id) {
|
||||||
return 0;
|
lnk->gid = gid;
|
||||||
|
dev_put(gattr.ndev);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
dev_put(gattr.ndev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
@ -369,26 +369,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)
|
static int smc_ib_fill_gid_and_mac(struct smc_ib_device *smcibdev, u8 ibport)
|
||||||
{
|
{
|
||||||
struct net_device *ndev;
|
struct ib_gid_attr gattr;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = ib_query_gid(smcibdev->ibdev, ibport, 0,
|
rc = ib_query_gid(smcibdev->ibdev, ibport, 0,
|
||||||
&smcibdev->gid[ibport - 1], NULL);
|
&smcibdev->gid[ibport - 1], &gattr);
|
||||||
/* the SMC protocol requires specification of the roce MAC address;
|
if (rc || !gattr.ndev)
|
||||||
* if net_device cannot be determined, it can be derived from gid 0
|
return -ENODEV;
|
||||||
*/
|
|
||||||
ndev = smcibdev->ibdev->get_netdev(smcibdev->ibdev, ibport);
|
memcpy(smcibdev->mac[ibport - 1], gattr.ndev->dev_addr, ETH_ALEN);
|
||||||
if (ndev) {
|
dev_put(gattr.ndev);
|
||||||
memcpy(&smcibdev->mac, ndev->dev_addr, ETH_ALEN);
|
return 0;
|
||||||
dev_put(ndev);
|
|
||||||
} else if (!rc) {
|
|
||||||
memcpy(&smcibdev->mac[ibport - 1][0],
|
|
||||||
&smcibdev->gid[ibport - 1].raw[8], 3);
|
|
||||||
memcpy(&smcibdev->mac[ibport - 1][3],
|
|
||||||
&smcibdev->gid[ibport - 1].raw[13], 3);
|
|
||||||
smcibdev->mac[ibport - 1][0] &= ~0x02;
|
|
||||||
}
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create an identifier unique for this instance of SMC-R.
|
/* Create an identifier unique for this instance of SMC-R.
|
||||||
@ -419,6 +410,7 @@ int smc_ib_remember_port_attr(struct smc_ib_device *smcibdev, u8 ibport)
|
|||||||
&smcibdev->pattr[ibport - 1]);
|
&smcibdev->pattr[ibport - 1]);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto out;
|
goto out;
|
||||||
|
/* the SMC protocol requires specification of the RoCE MAC address */
|
||||||
rc = smc_ib_fill_gid_and_mac(smcibdev, ibport);
|
rc = smc_ib_fill_gid_and_mac(smcibdev, ibport);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto out;
|
goto out;
|
||||||
|
Loading…
Reference in New Issue
Block a user