Commit ee32a2e6 authored by Jijie Shao's avatar Jijie Shao Committed by Hao Chen
Browse files

net: hns3: fix delete tc fail issue

mainline inclusion
from mainline-v6.9-rc1
commit 03f92287b251de318f3b93f5c1e0cb6ccc87b011
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/IAN3KC
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=03f92287b251de318f3b93f5c1e0cb6ccc87b011



----------------------------------------------------------------------

When the tc is removed during reset, hns3 driver will return a errcode.
But kernel ignores this errcode, As a result,
the driver status is inconsistent with the kernel status.

This patch retains the deletion status when the deletion fails
and continues to delete after the reset to ensure that
the status of the driver is consistent with that of kernel.

Signed-off-by: default avatarJijie Shao <shaojijie@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarJiantao Xiao <xiaojiantao1@h-partners.com>
parent cf3b556d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -917,6 +917,7 @@ struct hnae3_tc_info {
	u8 max_tc; /* Total number of TCs */
	u8 num_tc; /* Total number of enabled TCs */
	bool mqprio_active;
	bool mqprio_destroy;
	bool dcb_ets_active;
	u64 max_rate[HNAE3_MAX_TC];     /* Unit Bps */
};
+2 −0
Original line number Diff line number Diff line
@@ -809,6 +809,8 @@ static int hclge_setup_tc(struct hnae3_handle *h,
		return ret;
	}

	kinfo->tc_info.mqprio_destroy = !tc;

	ret = hclge_notify_down_uinit(hdev);
	if (ret)
		return ret;
+2 −0
Original line number Diff line number Diff line
@@ -12986,6 +12986,8 @@ static int hclge_reset_ae_dev(struct hnae3_ae_dev *ae_dev)
		return ret;
	}

	hclge_reset_tc_config(hdev);

	ret = hclge_tm_init_hw(hdev, true);
	if (ret) {
		dev_err(&pdev->dev, "tm init hw fail, ret =%d\n", ret);
+16 −0
Original line number Diff line number Diff line
@@ -2420,3 +2420,19 @@ int hclge_mbx_set_vf_multi_tc(struct hclge_vport *vport,
	mutex_unlock(&hdev->vport_lock);
	return ret;
}

void hclge_reset_tc_config(struct hclge_dev *hdev)
{
	struct hclge_vport *vport = &hdev->vport[0];
	struct hnae3_knic_private_info *kinfo;

	kinfo = &vport->nic.kinfo;

	if (!kinfo->tc_info.mqprio_destroy)
		return;

	/* clear tc info, including mqprio_destroy and mqprio_active */
	memset(&kinfo->tc_info, 0, sizeof(kinfo->tc_info));
	hclge_tm_schd_info_update(hdev, 0);
	hclge_comm_rss_indir_init_cfg(hdev->ae_dev, &hdev->rss_cfg);
}
+1 −0
Original line number Diff line number Diff line
@@ -294,4 +294,5 @@ int hclge_tm_set_tc_rate_limit(struct hclge_dev *hdev,
u32 hclge_tm_rate_2_port_rate(u64 rate);
void hclge_tm_vport_tc_info_update(struct hclge_vport *vport);
int hclge_dscp_to_pri_map(struct hclge_dev *hdev);
void hclge_reset_tc_config(struct hclge_dev *hdev);
#endif