Skip to content

Commit b41caad

Browse files
committed
Merge branch 'hns3-fixes'
Hao Lan says: ==================== net: hns3: fix some bug for hns3 There are some bugfixes for the HNS3 ethernet driver. patch#1 fix miss checking for rx packet. patch#2 fixes VF promisc mode not update when mac table full bug, and patch#3 fixes a nterrupts not initialization in VF FLR bug. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 843eb67 + 6b45d5f commit b41caad

File tree

8 files changed

+50
-15
lines changed

8 files changed

+50
-15
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_cmd.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,25 @@ static int hclge_comm_cmd_csq_done(struct hclge_comm_hw *hw)
331331
return head == hw->cmq.csq.next_to_use;
332332
}
333333

334-
static void hclge_comm_wait_for_resp(struct hclge_comm_hw *hw,
334+
static u32 hclge_get_cmdq_tx_timeout(u16 opcode, u32 tx_timeout)
335+
{
336+
static const struct hclge_cmdq_tx_timeout_map cmdq_tx_timeout_map[] = {
337+
{HCLGE_OPC_CFG_RST_TRIGGER, HCLGE_COMM_CMDQ_TX_TIMEOUT_500MS},
338+
};
339+
u32 i;
340+
341+
for (i = 0; i < ARRAY_SIZE(cmdq_tx_timeout_map); i++)
342+
if (cmdq_tx_timeout_map[i].opcode == opcode)
343+
return cmdq_tx_timeout_map[i].tx_timeout;
344+
345+
return tx_timeout;
346+
}
347+
348+
static void hclge_comm_wait_for_resp(struct hclge_comm_hw *hw, u16 opcode,
335349
bool *is_completed)
336350
{
351+
u32 cmdq_tx_timeout = hclge_get_cmdq_tx_timeout(opcode,
352+
hw->cmq.tx_timeout);
337353
u32 timeout = 0;
338354

339355
do {
@@ -343,7 +359,7 @@ static void hclge_comm_wait_for_resp(struct hclge_comm_hw *hw,
343359
}
344360
udelay(1);
345361
timeout++;
346-
} while (timeout < hw->cmq.tx_timeout);
362+
} while (timeout < cmdq_tx_timeout);
347363
}
348364

349365
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,
407423
* if multi descriptors to be sent, use the first one to check
408424
*/
409425
if (HCLGE_COMM_SEND_SYNC(le16_to_cpu(desc->flag)))
410-
hclge_comm_wait_for_resp(hw, &is_completed);
426+
hclge_comm_wait_for_resp(hw, le16_to_cpu(desc->opcode),
427+
&is_completed);
411428

412429
if (!is_completed)
413430
ret = -EBADE;
@@ -529,7 +546,7 @@ int hclge_comm_cmd_queue_init(struct pci_dev *pdev, struct hclge_comm_hw *hw)
529546
cmdq->crq.desc_num = HCLGE_COMM_NIC_CMQ_DESC_NUM;
530547

531548
/* Setup Tx write back timeout */
532-
cmdq->tx_timeout = HCLGE_COMM_CMDQ_TX_TIMEOUT;
549+
cmdq->tx_timeout = HCLGE_COMM_CMDQ_TX_TIMEOUT_DEFAULT;
533550

534551
/* Setup queue rings */
535552
ret = hclge_comm_alloc_cmd_queue(hw, HCLGE_COMM_TYPE_CSQ);

drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_cmd.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
#define HCLGE_COMM_NIC_SW_RST_RDY BIT(HCLGE_COMM_NIC_SW_RST_RDY_B)
5555
#define HCLGE_COMM_NIC_CMQ_DESC_NUM_S 3
5656
#define HCLGE_COMM_NIC_CMQ_DESC_NUM 1024
57-
#define HCLGE_COMM_CMDQ_TX_TIMEOUT 30000
57+
#define HCLGE_COMM_CMDQ_TX_TIMEOUT_DEFAULT 30000
58+
#define HCLGE_COMM_CMDQ_TX_TIMEOUT_500MS 500000
5859

5960
enum hclge_opcode_type {
6061
/* Generic commands */
@@ -360,6 +361,11 @@ struct hclge_comm_caps_bit_map {
360361
u16 local_bit;
361362
};
362363

364+
struct hclge_cmdq_tx_timeout_map {
365+
u32 opcode;
366+
u32 tx_timeout;
367+
};
368+
363369
struct hclge_comm_firmware_compat_cmd {
364370
__le32 compat;
365371
u8 rsv[20];

drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static struct hns3_dbg_cmd_info hns3_dbg_cmd[] = {
130130
.name = "tx_bd_queue",
131131
.cmd = HNAE3_DBG_CMD_TX_BD,
132132
.dentry = HNS3_DBG_DENTRY_TX_BD,
133-
.buf_len = HNS3_DBG_READ_LEN_4MB,
133+
.buf_len = HNS3_DBG_READ_LEN_5MB,
134134
.init = hns3_dbg_bd_file_init,
135135
},
136136
{

drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define HNS3_DBG_READ_LEN_128KB 0x20000
1111
#define HNS3_DBG_READ_LEN_1MB 0x100000
1212
#define HNS3_DBG_READ_LEN_4MB 0x400000
13+
#define HNS3_DBG_READ_LEN_5MB 0x500000
1314
#define HNS3_DBG_WRITE_LEN 1024
1415

1516
#define HNS3_DBG_DATA_STR_LEN 32

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);

drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,10 @@ static int hclgevf_reset_wait(struct hclgevf_dev *hdev)
14361436
* might happen in case reset assertion was made by PF. Yes, this also
14371437
* means we might end up waiting bit more even for VF reset.
14381438
*/
1439-
msleep(5000);
1439+
if (hdev->reset_type == HNAE3_VF_FULL_RESET)
1440+
msleep(5000);
1441+
else
1442+
msleep(500);
14401443

14411444
return 0;
14421445
}

0 commit comments

Comments
 (0)