diff mbox series

[1/1,SRU,B] net: hns3: fix ETS bandwidth validation bug

Message ID 20200310130959.9523-2-taihsiang.ho@canonical.com
State New
Headers show
Series LP:# 1859569 net: hns3: fix ETS bandwidth validation bug | expand

Commit Message

Taihsiang Ho (tai271828) March 10, 2020, 1:09 p.m. UTC
From: Yonglong Liu <liuyonglong@huawei.com>

BugLink: http://bugs.launchpad.net/bugs/1859569

Some device only support 4 TCs, but the driver check the total
bandwidth of 8 TCs, so may cause wrong configurations write to
the hw.

This patch uses hdev->tc_max to instead HNAE3_MAX_TC to fix it.

Fixes: e432abfb99e5 ("net: hns3: add common validation in hclge_dcb")
Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c2d56897819338eb0ba8b93184f7d10329b36653)
Signed-off-by: Taihsiang Ho (tai271828) <taihsiang.ho@canonical.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kleber Sacilotto de Souza March 10, 2020, 2:27 p.m. UTC | #1
On 10.03.20 14:09, Taihsiang Ho (tai271828) wrote:
> From: Yonglong Liu <liuyonglong@huawei.com>
> 
> BugLink: http://bugs.launchpad.net/bugs/1859569
> 
> Some device only support 4 TCs, but the driver check the total
> bandwidth of 8 TCs, so may cause wrong configurations write to
> the hw.
> 
> This patch uses hdev->tc_max to instead HNAE3_MAX_TC to fix it.
> 
> Fixes: e432abfb99e5 ("net: hns3: add common validation in hclge_dcb")
> Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> (cherry picked from commit c2d56897819338eb0ba8b93184f7d10329b36653)
> Signed-off-by: Taihsiang Ho (tai271828) <taihsiang.ho@canonical.com>

Clean cherry-pick, limited to platform driver and good test results.

Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>

> ---
>  drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c
> index af6ef1e70378..16b7e3ad6c2b 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c
> @@ -126,7 +126,7 @@ static int hclge_ets_validate(struct hclge_dev *hdev, struct ieee_ets *ets,
>  	if (ret)
>  		return ret;
>  
> -	for (i = 0; i < HNAE3_MAX_TC; i++) {
> +	for (i = 0; i < hdev->tc_max; i++) {
>  		switch (ets->tc_tsa[i]) {
>  		case IEEE_8021QAZ_TSA_STRICT:
>  			if (hdev->tm_info.tc_info[i].tc_sch_mode !=
>
Po-Hsu Lin March 11, 2020, 8:03 a.m. UTC | #2
Well tested, clean cherry-pick.
Acked-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c
index af6ef1e70378..16b7e3ad6c2b 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c
@@ -126,7 +126,7 @@  static int hclge_ets_validate(struct hclge_dev *hdev, struct ieee_ets *ets,
 	if (ret)
 		return ret;
 
-	for (i = 0; i < HNAE3_MAX_TC; i++) {
+	for (i = 0; i < hdev->tc_max; i++) {
 		switch (ets->tc_tsa[i]) {
 		case IEEE_8021QAZ_TSA_STRICT:
 			if (hdev->tm_info.tc_info[i].tc_sch_mode !=