Skip to content

Commit d3ad430

Browse files
Yunsheng Lindavem330
authored andcommitted
net: hns3: fix PFC not setting problem for DCB module
The PFC enabling is based on user priority, currently it is based on TC, which may cause PFC not setting correctly when pri to TC mapping is not one to one relation. This patch adds pfc_en in tm_info to fix it. Fixes: cacde27 ("net: hns3: Add hclge_dcb module for the support of DCB feature") Signed-off-by: Yunsheng Lin <[email protected]> Signed-off-by: Peng Li <[email protected]> Signed-off-by: Huazhong Tan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d174ea7 commit d3ad430

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,9 @@ static int hclge_ieee_setpfc(struct hnae3_handle *h, struct ieee_pfc *pfc)
296296
hdev->flag & HCLGE_FLAG_MQPRIO_ENABLE)
297297
return -EINVAL;
298298

299+
if (pfc->pfc_en == hdev->tm_info.pfc_en)
300+
return 0;
301+
299302
prio_tc = hdev->tm_info.prio_tc;
300303
pfc_map = 0;
301304

@@ -308,10 +311,8 @@ static int hclge_ieee_setpfc(struct hnae3_handle *h, struct ieee_pfc *pfc)
308311
}
309312
}
310313

311-
if (pfc_map == hdev->tm_info.hw_pfc_map)
312-
return 0;
313-
314314
hdev->tm_info.hw_pfc_map = pfc_map;
315+
hdev->tm_info.pfc_en = pfc->pfc_en;
315316

316317
return hclge_pause_setup_hw(hdev, false);
317318
}

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ struct hclge_tm_info {
325325
struct hclge_tc_info tc_info[HNAE3_MAX_TC];
326326
enum hclge_fc_mode fc_mode;
327327
u8 hw_pfc_map; /* Allow for packet drop or not on this TC */
328+
u8 pfc_en; /* PFC enabled or not for user priority */
328329
};
329330

330331
struct hclge_comm_stats_str {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,7 @@ static int hclge_pfc_setup_hw(struct hclge_dev *hdev)
12151215
HCLGE_RX_MAC_PAUSE_EN_MSK;
12161216

12171217
return hclge_pfc_pause_en_cfg(hdev, enable_bitmap,
1218-
hdev->tm_info.hw_pfc_map);
1218+
hdev->tm_info.pfc_en);
12191219
}
12201220

12211221
/* Each Tc has a 1024 queue sets to backpress, it divides to

0 commit comments

Comments
 (0)