From: Junxian Huang huangjunxian6@hisilicon.com
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8QLD3
----------------------------------------------------------------------
This patch makes 2 changes for check_vf_support():
1. add check of RDMA over UBLink VFs before check_vf_support(), since VFs in this case will never be of RoCE bonding slaves.
2. since RDMA over UBLink VFs won't enter check_vf_support() anymore, the return value is changed to false when the PF doesn't have a corresponding hr_dev so that VFs init can be correctly blocked on those non-main_hr_dev slaves.
Fixes: 67fc10550307 ("RDMA/hns: Add support for RDMA VF over UBL") Signed-off-by: Junxian Huang huangjunxian6@hisilicon.com --- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 4909c9c186cc..2c03f556f8e0 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -7624,9 +7624,8 @@ static bool check_vf_support(struct pci_dev *vf) handle = &hdev->vport[0].roce; hr_dev = handle->priv;
- /* In UB link vf can not find the pf device */ if (!hr_dev) - return true; + return false;
bond_grp = hns_roce_get_bond_grp(get_hr_netdev(hr_dev, 0), pf->bus->number); @@ -7639,6 +7638,7 @@ static bool check_vf_support(struct pci_dev *vf) static int __hns_roce_hw_v2_init_instance(struct hnae3_handle *handle) { struct hns_roce_dev *hr_dev; + struct pci_dev *pdev; int ret;
hr_dev = ib_alloc_device(hns_roce_dev, ib_dev); @@ -7653,7 +7653,9 @@ static int __hns_roce_hw_v2_init_instance(struct hnae3_handle *handle)
hns_roce_hw_v2_get_cfg(hr_dev, handle);
- if (hr_dev->is_vf && !check_vf_support(hr_dev->pci_dev)) { + pdev = hr_dev->pci_dev; + if (pdev->device != HNAE3_DEV_ID_RDMA_OVER_UBL_VF && + hr_dev->is_vf && !check_vf_support(pdev)) { ret = -EOPNOTSUPP; goto error_failed_roce_init; } @@ -7664,7 +7666,7 @@ static int __hns_roce_hw_v2_init_instance(struct hnae3_handle *handle) goto error_failed_roce_init; }
- if (hr_dev->pci_dev->revision == PCI_REVISION_ID_HIP08) { + if (pdev->revision == PCI_REVISION_ID_HIP08) { ret = free_mr_init(hr_dev); if (ret) { dev_err(hr_dev->dev, "failed to init free mr!\n");