Commit ba3549f4 authored by Haiqing Fang's avatar Haiqing Fang Committed by mufengyan
Browse files

HNS3: Solve the problem that the tc qdisc configuration in the hardware...

HNS3: Solve the problem that the tc qdisc configuration in the hardware registration cannot be cleared

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I99GLS


CVE: NA

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

Users can run the tc qdisc command to configure the number of
used tc and the maximum rate of each tc. In the original software
implementation logic, the software configures the maximum rate
to the register based on the number of used tc. The software does
not configure the rate for unused tc.
For example, the user configures four used tc and the corresponding
maximum rates through tc qdisc command. Then, the user configures
two used tc and the corresponding maximum rates. At this time, the
software configures only tc0 and tc1, not configure tc2 and tc3. The
user's first configuration of tc2 and tc3 still remains in the
register.
Therefore, as long as the number of used tc by the user configuration
is reduced, it will result in residual configuration in the register.
Using tc qdisc command to delete the configuration, uninstalling the
driver and loading it again essentially changes the number of used tc
to 1, so the above problem also exists.
This patch modifies the operation of only configuring the used tc register,
and will configure all tc registers supported by the software. For used
tc, configure user-specified parameters in registers; for unused tc,
restore the initial configuration.

Signed-off-by: default avatarHaiqing Fang <fanghaiqing@huawei.com>
parent 1a292d7b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1697,7 +1697,7 @@ int hclge_tm_set_tc_rate_limit(struct hclge_dev *hdev,
	int ret;
	int i;

	for (i = 0; i < tc_info->num_tc; i++) {
	for (i = 0; i < hdev->tc_max; i++) {
		/* mac speed unit is Mbps, tc max_rate is Bps */
		speed = hclge_tm_rate_2_port_rate(tc_info->max_rate[i]);
		if (!speed)