From: Hao Lan <lanhao@huawei•com>
To: <netdev@vger•kernel.org>
Cc: <yisen.zhuang@huawei•com>, <salil.mehta@huawei•com>,
<davem@davemloft•net>, <edumazet@google•com>, <kuba@kernel•org>,
<pabeni@redhat•com>, <lanhao@huawei•com>,
<huangguangbin2@huawei•com>, <simon.horman@corigine•com>,
<shaojijie@huawei•com>, <chenhao418@huawei•com>,
<shenjian15@huawei•com>, <liuyonglong@huawei•com>,
<wangjie125@huawei•com>, <yuanjilin@cdjrlc•com>,
<cai.huoqing@linux•dev>, <xiujianfeng@huawei•com>,
<tanhuazhong@huawei•com>
Subject: [PATCH net 2/4] net: hns3: fix sending pfc frames after reset issue
Date: Fri, 12 May 2023 18:00:12 +0800 [thread overview]
Message-ID: <20230512100014.2522-3-lanhao@huawei.com> (raw)
In-Reply-To: <20230512100014.2522-1-lanhao@huawei.com>
From: Jijie Shao <shaojijie@huawei•com>
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: 35d93a30040c ("net: hns3: adjust the process of PF reset")
Signed-off-by: Jijie Shao <shaojijie@huawei•com>
Signed-off-by: Hao Lan <lanhao@huawei•com>
---
.../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 15 +++++++++------
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 4 ++--
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h | 5 +++++
3 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 4fb5406c1951..2689b108f7df 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -8053,12 +8053,15 @@ static void hclge_ae_stop(struct hnae3_handle *handle)
/* If it is not PF reset or FLR, the firmware will disable the MAC,
* so it only need to stop phy here.
*/
- if (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state) &&
- hdev->reset_type != HNAE3_FUNC_RESET &&
- hdev->reset_type != HNAE3_FLR_RESET) {
- hclge_mac_stop_phy(hdev);
- hclge_update_link_status(hdev);
- return;
+ if (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state)) {
+ hclge_pfc_pause_en_cfg(hdev, HCLGE_PFC_TX_RX_DISABLE,
+ HCLGE_PFC_DISABLE);
+ if (hdev->reset_type != HNAE3_FUNC_RESET &&
+ hdev->reset_type != HNAE3_FLR_RESET) {
+ hclge_mac_stop_phy(hdev);
+ hclge_update_link_status(hdev);
+ return;
+ }
}
hclge_reset_tqp(handle);
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
index 4a33f65190e2..922c0da3660c 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
@@ -171,8 +171,8 @@ int hclge_mac_pause_en_cfg(struct hclge_dev *hdev, bool tx, bool rx)
return hclge_cmd_send(&hdev->hw, &desc, 1);
}
-static int hclge_pfc_pause_en_cfg(struct hclge_dev *hdev, u8 tx_rx_bitmap,
- u8 pfc_bitmap)
+int hclge_pfc_pause_en_cfg(struct hclge_dev *hdev, u8 tx_rx_bitmap,
+ u8 pfc_bitmap)
{
struct hclge_desc desc;
struct hclge_pfc_en_cmd *pfc = (struct hclge_pfc_en_cmd *)desc.data;
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h
index 68f28a98e380..dd6f1fd486cf 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h
@@ -164,6 +164,9 @@ struct hclge_bp_to_qs_map_cmd {
u32 rsvd1;
};
+#define HCLGE_PFC_DISABLE 0
+#define HCLGE_PFC_TX_RX_DISABLE 0
+
struct hclge_pfc_en_cmd {
u8 tx_rx_en_bitmap;
u8 pri_en_bitmap;
@@ -235,6 +238,8 @@ void hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc);
void hclge_tm_pfc_info_update(struct hclge_dev *hdev);
int hclge_tm_dwrr_cfg(struct hclge_dev *hdev);
int hclge_tm_init_hw(struct hclge_dev *hdev, bool init);
+int hclge_pfc_pause_en_cfg(struct hclge_dev *hdev, u8 tx_rx_bitmap,
+ u8 pfc_bitmap);
int hclge_mac_pause_en_cfg(struct hclge_dev *hdev, bool tx, bool rx);
int hclge_pause_addr_cfg(struct hclge_dev *hdev, const u8 *mac_addr);
void hclge_pfc_rx_stats_get(struct hclge_dev *hdev, u64 *stats);
--
2.30.0
next prev parent reply other threads:[~2023-05-12 10:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-12 10:00 [PATCH net 0/4] net: hns3: There are some bugfixes for the HNS3 ethernet driver Hao Lan
2023-05-12 10:00 ` [PATCH net 1/4] net: hns3: fix output information incomplete for dumping tx queue info with debugfs Hao Lan
2023-05-12 10:00 ` Hao Lan [this message]
2023-05-12 10:00 ` [PATCH net 3/4] net: hns3: fix reset delay time to avoid configuration timeout Hao Lan
2023-05-12 10:00 ` [PATCH net 4/4] net: hns3: fix reset timeout when enable full VF Hao Lan
2023-05-13 16:30 ` [PATCH net 0/4] net: hns3: There are some bugfixes for the HNS3 ethernet driver patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230512100014.2522-3-lanhao@huawei.com \
--to=lanhao@huawei$(echo .)com \
--cc=cai.huoqing@linux$(echo .)dev \
--cc=chenhao418@huawei$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=edumazet@google$(echo .)com \
--cc=huangguangbin2@huawei$(echo .)com \
--cc=kuba@kernel$(echo .)org \
--cc=liuyonglong@huawei$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
--cc=salil.mehta@huawei$(echo .)com \
--cc=shaojijie@huawei$(echo .)com \
--cc=shenjian15@huawei$(echo .)com \
--cc=simon.horman@corigine$(echo .)com \
--cc=tanhuazhong@huawei$(echo .)com \
--cc=wangjie125@huawei$(echo .)com \
--cc=xiujianfeng@huawei$(echo .)com \
--cc=yisen.zhuang@huawei$(echo .)com \
--cc=yuanjilin@cdjrlc$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox