Skip to content

Commit f14db07

Browse files
Jijie Shaodavem330
authored andcommitted
net: hns3: fix sending pfc frames after reset issue
To prevent the system from abnormally sending PFC frames after an abnormal reset. The hns3 driver notifies the firmware to disable pfc before reset. Fixes: 35d93a3 ("net: hns3: adjust the process of PF reset") Signed-off-by: Jijie Shao <[email protected]> Signed-off-by: Hao Lan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 89f6bfb commit f14db07

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8053,12 +8053,15 @@ static void hclge_ae_stop(struct hnae3_handle *handle)
80538053
/* If it is not PF reset or FLR, the firmware will disable the MAC,
80548054
* so it only need to stop phy here.
80558055
*/
8056-
if (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state) &&
8057-
hdev->reset_type != HNAE3_FUNC_RESET &&
8058-
hdev->reset_type != HNAE3_FLR_RESET) {
8059-
hclge_mac_stop_phy(hdev);
8060-
hclge_update_link_status(hdev);
8061-
return;
8056+
if (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state)) {
8057+
hclge_pfc_pause_en_cfg(hdev, HCLGE_PFC_TX_RX_DISABLE,
8058+
HCLGE_PFC_DISABLE);
8059+
if (hdev->reset_type != HNAE3_FUNC_RESET &&
8060+
hdev->reset_type != HNAE3_FLR_RESET) {
8061+
hclge_mac_stop_phy(hdev);
8062+
hclge_update_link_status(hdev);
8063+
return;
8064+
}
80628065
}
80638066

80648067
hclge_reset_tqp(handle);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ int hclge_mac_pause_en_cfg(struct hclge_dev *hdev, bool tx, bool rx)
171171
return hclge_cmd_send(&hdev->hw, &desc, 1);
172172
}
173173

174-
static int hclge_pfc_pause_en_cfg(struct hclge_dev *hdev, u8 tx_rx_bitmap,
175-
u8 pfc_bitmap)
174+
int hclge_pfc_pause_en_cfg(struct hclge_dev *hdev, u8 tx_rx_bitmap,
175+
u8 pfc_bitmap)
176176
{
177177
struct hclge_desc desc;
178178
struct hclge_pfc_en_cmd *pfc = (struct hclge_pfc_en_cmd *)desc.data;

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ struct hclge_bp_to_qs_map_cmd {
164164
u32 rsvd1;
165165
};
166166

167+
#define HCLGE_PFC_DISABLE 0
168+
#define HCLGE_PFC_TX_RX_DISABLE 0
169+
167170
struct hclge_pfc_en_cmd {
168171
u8 tx_rx_en_bitmap;
169172
u8 pri_en_bitmap;
@@ -235,6 +238,8 @@ void hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc);
235238
void hclge_tm_pfc_info_update(struct hclge_dev *hdev);
236239
int hclge_tm_dwrr_cfg(struct hclge_dev *hdev);
237240
int hclge_tm_init_hw(struct hclge_dev *hdev, bool init);
241+
int hclge_pfc_pause_en_cfg(struct hclge_dev *hdev, u8 tx_rx_bitmap,
242+
u8 pfc_bitmap);
238243
int hclge_mac_pause_en_cfg(struct hclge_dev *hdev, bool tx, bool rx);
239244
int hclge_pause_addr_cfg(struct hclge_dev *hdev, const u8 *mac_addr);
240245
void hclge_pfc_rx_stats_get(struct hclge_dev *hdev, u64 *stats);

0 commit comments

Comments
 (0)