Skip to content

Commit 731797f

Browse files
Guangbin Huangdavem330
authored andcommitted
net: hns3: add limit ets dwrr bandwidth cannot be 0
If ets dwrr bandwidth of tc is set to 0, the hardware will switch to SP mode. In this case, this tc may occupy all the tx bandwidth if it has huge traffic, so it violates the purpose of the user setting. To fix this problem, limit the ets dwrr bandwidth must greater than 0. Fixes: cacde27 ("net: hns3: Add hclge_dcb module for the support of DCB feature") Signed-off-by: Guangbin Huang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b63fcaa commit 731797f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,15 @@ static int hclge_ets_sch_mode_validate(struct hclge_dev *hdev,
137137
*changed = true;
138138
break;
139139
case IEEE_8021QAZ_TSA_ETS:
140+
/* The hardware will switch to sp mode if bandwidth is
141+
* 0, so limit ets bandwidth must be greater than 0.
142+
*/
143+
if (!ets->tc_tx_bw[i]) {
144+
dev_err(&hdev->pdev->dev,
145+
"tc%u ets bw cannot be 0\n", i);
146+
return -EINVAL;
147+
}
148+
140149
if (hdev->tm_info.tc_info[i].tc_sch_mode !=
141150
HCLGE_SCH_MODE_DWRR)
142151
*changed = true;

0 commit comments

Comments
 (0)