Unverified Commit f4801a05 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!3535 Bugfixes for RDMA/hns

Merge Pull Request from: @stinft 
 
The first two patches resolve bond-related issues, and the last patch resolves environment exceptions caused by concurrent reset of multiple streams.
Junxian Huang (2):
   Revert "RDMA/hns: Add cap_flag check for check_vf_support()"
   RDMA/hns: Fix init check of VFs on RoCE bonding slaves
wenglianfa (1):
   RDMA/hns: Fix Use-After-Free of rsv_qp

1. https://gitee.com/openeuler/kernel/issues/I8N7BG
2. https://gitee.com/openeuler/kernel/issues/I8QLD3
 
 
Link:https://gitee.com/openeuler/kernel/pulls/3535

 

Reviewed-by: default avatarChengchang Tang <tangchengchang@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents 055844c7 ec799ad0
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -3339,6 +3339,9 @@ static int hns_roce_v2_init(struct hns_roce_dev *hr_dev)

static void hns_roce_v2_exit(struct hns_roce_dev *hr_dev)
{
	if (hr_dev->pci_dev->revision == PCI_REVISION_ID_HIP08)
		free_mr_exit(hr_dev);

	hns_roce_function_clear(hr_dev);

	if (!hr_dev->is_vf)
@@ -7621,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);
@@ -7636,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);
@@ -7650,8 +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->caps.flags & HNS_ROCE_CAP_FLAG_BOND &&
	    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;
	}
@@ -7662,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");
@@ -7699,9 +7703,6 @@ static void __hns_roce_hw_v2_uninit_instance(struct hnae3_handle *handle,
	hr_dev->state = HNS_ROCE_DEVICE_STATE_UNINIT;
	hns_roce_handle_device_err(hr_dev);

	if (hr_dev->pci_dev->revision == PCI_REVISION_ID_HIP08)
		free_mr_exit(hr_dev);

	hns_roce_exit(hr_dev, bond_cleanup);
	kfree(hr_dev->priv);
	ib_dealloc_device(&hr_dev->ib_dev);