net: hns3: There are some bugfixes for the HNS3 ethernet driver
Subsystems (4)
PATCH 2/4 net: hns3: fix sending pfc frames after reset issue
In reply to Hao LanFrom: Jijie Shao <[email protected]>
To prevent the system from abnormally sending PFC frames after an abnormal reset. The hns3 driver notifies the firmware to disable pfc before reset.
--- .../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(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +9 -6
@@ -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);
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +2 -2
@@ -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;
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h +5 -0
@@ -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);
Signature · 1 line
2.30.0
PATCH 3/4 net: hns3: fix reset delay time to avoid configuration timeout
In reply to Hao LanFrom: Jie Wang <[email protected]>
Currently the hns3 vf function reset delays 5000ms before vf rebuild process. In product applications, this delay is too long for application configurations and causes configuration timeout.
According to the tests, 500ms delay is enough for reset process except PF FLR. So this patch modifies delay to 500ms in these scenarios.
--- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +4 -1
@@ -1436,7 +1436,10 @@ static int hclgevf_reset_wait(struct hclgevf_dev *hdev)* might happen in case reset assertion was made by PF. Yes, this also * means we might end up waiting bit more even for VF reset. */ -msleep (5000 ); +if (hdev->reset_type ==HNAE3_VF_FULL_RESET ) +msleep (5000 ); +else +msleep (500 );return 0 ; }
Signature · 1 line
2.30.0
PATCH 4/4 net: hns3: fix reset timeout when enable full VF
In reply to Hao LanFrom: Jijie Shao <[email protected]>
The timeout of the cmdq reset command has been increased to resolve the reset timeout issue in the full VF scenario. The timeout of other cmdq commands remains unchanged.
--- .../hns3/hns3_common/hclge_comm_cmd.c | 25 ++++++++++++++++--- .../hns3/hns3_common/hclge_comm_cmd.h | 8 +++++- 2 files changed, 28 insertions(+), 5 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_cmd.c +21 -4
@@ -331,9 +331,25 @@ static int hclge_comm_cmd_csq_done(struct hclge_comm_hw *hw)return head == hw->cmq.csq.next_to_use; } -static void hclge_comm_wait_for_resp (struct hclge_comm_hw *hw, +static u32 hclge_get_cmdq_tx_timeout (u16 opcode,u32 tx_timeout) +{ +static const struct hclge_cmdq_tx_timeout_map cmdq_tx_timeout_map[] = { + {HCLGE_OPC_CFG_RST_TRIGGER ,HCLGE_COMM_CMDQ_TX_TIMEOUT_500MS }, + }; +u32 i; + +for (i =0 ; i <ARRAY_SIZE (cmdq_tx_timeout_map); i++) +if (cmdq_tx_timeout_map[i].opcode == opcode) +return cmdq_tx_timeout_map[i].tx_timeout; + +return tx_timeout; +} + +static void hclge_comm_wait_for_resp (struct hclge_comm_hw *hw,u16 opcode,bool *is_completed) { +u32 cmdq_tx_timeout =hclge_get_cmdq_tx_timeout (opcode, + hw->cmq.tx_timeout);u32 timeout =0 ; do {
@@ -343,7 +359,7 @@ static void hclge_comm_wait_for_resp(struct hclge_comm_hw *hw, }udelay (1 ); timeout++; - }while (timeout < hw->cmq.tx_timeout); + }while (timeout < cmdq_tx_timeout); }static int hclge_comm_cmd_convert_err_code (u16 desc_ret)
@@ -407,7 +423,8 @@ static int hclge_comm_cmd_check_result(struct hclge_comm_hw *hw,* if multi descriptors to be sent, use the first one to check */ if (HCLGE_COMM_SEND_SYNC (le16_to_cpu (desc->flag))) -hclge_comm_wait_for_resp (hw, &is_completed); +hclge_comm_wait_for_resp (hw,le16_to_cpu (desc->opcode), + &is_completed);if (!is_completed) ret = -EBADE ;
@@ -529,7 +546,7 @@ int hclge_comm_cmd_queue_init(struct pci_dev *pdev, struct hclge_comm_hw *hw) cmdq->crq.desc_num =HCLGE_COMM_NIC_CMQ_DESC_NUM ;/* Setup Tx write back timeout */ - cmdq->tx_timeout =HCLGE_COMM_CMDQ_TX_TIMEOUT ; + cmdq->tx_timeout =HCLGE_COMM_CMDQ_TX_TIMEOUT_DEFAULT ;/* Setup queue rings */ ret =hclge_comm_alloc_cmd_queue (hw,HCLGE_COMM_TYPE_CSQ );
drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_cmd.h +7 -1
@@ -54,7 +54,8 @@#define HCLGE_COMM_NIC_SW_RST_RDY BIT(HCLGE_COMM_NIC_SW_RST_RDY_B)#define HCLGE_COMM_NIC_CMQ_DESC_NUM_S 3#define HCLGE_COMM_NIC_CMQ_DESC_NUM 1024 -#define HCLGE_COMM_CMDQ_TX_TIMEOUT 30000 +#define HCLGE_COMM_CMDQ_TX_TIMEOUT_DEFAULT 30000 +#define HCLGE_COMM_CMDQ_TX_TIMEOUT_500MS 500000enum hclge_opcode_type {/* Generic commands */
@@ -360,6 +361,11 @@ struct hclge_comm_caps_bit_map {u16 local_bit; }; +struct hclge_cmdq_tx_timeout_map { +u32 opcode; +u32 tx_timeout; +}; +struct hclge_comm_firmware_compat_cmd {__le32 compat;u8 rsv[20 ];
Signature · 1 line
2.30.0
cover net: hns3: There are some bugfixes for the HNS3 ethernet driver
There are some bugfixes for the HNS3 ethernet driver. Patch#1 fix output information incomplete for dumping tx queue info
with debugfs.
Patch#2 fix sending pfc frames after reset issue. Patch#3 fix reset delay time to avoid configuration timeout. Patch#4 fix reset timeout when enable full VF.
Jie Wang (2):
net: hns3: fix output information incomplete for dumping tx queue info
with debugfs
net: hns3: fix reset delay time to avoid configuration timeout
Jijie Shao (2):
net: hns3: fix sending pfc frames after reset issue
net: hns3: fix reset timeout when enable full VF
.../hns3/hns3_common/hclge_comm_cmd.c | 25 ++++++++++++++++--- .../hns3/hns3_common/hclge_comm_cmd.h | 8 +++++- .../ethernet/hisilicon/hns3/hns3_debugfs.c | 2 +- .../ethernet/hisilicon/hns3/hns3_debugfs.h | 1 + .../hisilicon/hns3/hns3pf/hclge_main.c | 15 ++++++----- .../ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 4 +-- .../ethernet/hisilicon/hns3/hns3pf/hclge_tm.h | 5 ++++ .../hisilicon/hns3/hns3vf/hclgevf_main.c | 5 +++- 8 files changed, 50 insertions(+), 15 deletions(-)
Signature · 1 line
2.30.0
PATCH 1/4 net: hns3: fix output information incomplete for dumping tx queue info with debugfs
From: Jie Wang <[email protected]>
In function hns3_dump_tx_queue_info, The print buffer is not enough when the tx BD number is configured to 32760. As a result several BD information wouldn't be displayed.
So fix it by increasing the tx queue print buffer length.
--- drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c +1 -1
@@ -130,7 +130,7 @@ static struct hns3_dbg_cmd_info hns3_dbg_cmd[] = { .name = "tx_bd_queue", .cmd = HNAE3_DBG_CMD_TX_BD, .dentry = HNS3_DBG_DENTRY_TX_BD, - .buf_len = HNS3_DBG_READ_LEN_4MB, + .buf_len = HNS3_DBG_READ_LEN_5MB, .init = hns3_dbg_bd_file_init, }, {
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.h +1 -0
@@ -10,6 +10,7 @@#define HNS3_DBG_READ_LEN_128KB 0x20000#define HNS3_DBG_READ_LEN_1MB 0x100000#define HNS3_DBG_READ_LEN_4MB 0x400000 +#define HNS3_DBG_READ_LEN_5MB 0x500000#define HNS3_DBG_WRITE_LEN 1024#define HNS3_DBG_DATA_STR_LEN 32
Signature · 1 line
2.30.0
This series was applied to netdev/net.git (main) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:
Quoted 8 lines · On Fri, 12 May 2023 18:00:10 +0800 you wrote:
There are some bugfixes for the HNS3 ethernet driver. Patch#1 fix output information incomplete for dumping tx queue info
with debugfs.
Patch#2 fix sending pfc frames after reset issue. Patch#3 fix reset delay time to avoid configuration timeout. Patch#4 fix reset timeout when enable full VF.[...]
Here is the summary with links:
- [net,1/4] net: hns3: fix output information incomplete for dumping tx queue info with debugfs
https://git.kernel.org/netdev/net/c/89f6bfb07118 - [net,2/4] net: hns3: fix sending pfc frames after reset issue https://git.kernel.org/netdev/net/c/f14db0706472 - [net,3/4] net: hns3: fix reset delay time to avoid configuration timeout https://git.kernel.org/netdev/net/c/814d0c786068 - [net,4/4] net: hns3: fix reset timeout when enable full VF https://git.kernel.org/netdev/net/c/6b45d5ff8c2c
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html