Skip to content

Commit 69b51bb

Browse files
shijujose4davem330
authored andcommitted
net: hns3: fix to stop multiple HNS reset due to the AER changes
The commit bfcb79f ("PCI/ERR: Run error recovery callbacks for all affected devices") affected the non-fatal error recovery logic for the HNS and RDMA devices. This is because each HNS PF under PCIe bus receive callbacks from the AER driver when an error is reported for one of the PF. This causes unwanted PF resets because the HNS decides which PF to reset based on the reset type set. The HNS error handling code sets the reset type based on the hw error type detected. This patch provides fix for the above issue for the recovery of the hw errors in the HNS and RDMA devices. This patch needs backporting to the kernel v5.0+ Fixes: 332fbf5 ("net: hns3: add handling of hw ras errors using new set of commands") Reported-by: Xiaofei Tan <tanxiaofei@huawei.com> Signed-off-by: Shiju Jose <shiju.jose@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 083b78a commit 69b51bb

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

‎drivers/net/ethernet/hisilicon/hns3/hnae3.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ struct hnae3_ae_dev {
194194
const struct hnae3_ae_ops *ops;
195195
struct list_head node;
196196
u32 flag;
197+
u8 override_pci_need_reset; /* fix to stop multiple reset happening */
197198
enum hnae3_dev_type dev_type;
198199
enum hnae3_reset_type reset_type;
199200
void *priv;

‎drivers/net/ethernet/hisilicon/hns3/hns3_enet.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1850,7 +1850,9 @@ static pci_ers_result_t hns3_slot_reset(struct pci_dev *pdev)
18501850

18511851
/* request the reset */
18521852
if (ae_dev->ops->reset_event) {
1853-
ae_dev->ops->reset_event(pdev, NULL);
1853+
if (!ae_dev->override_pci_need_reset)
1854+
ae_dev->ops->reset_event(pdev, NULL);
1855+
18541856
return PCI_ERS_RESULT_RECOVERED;
18551857
}
18561858

‎drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,8 +1317,10 @@ pci_ers_result_t hclge_handle_hw_ras_error(struct hnae3_ae_dev *ae_dev)
13171317
hclge_handle_all_ras_errors(hdev);
13181318
} else {
13191319
if (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state) ||
1320-
hdev->pdev->revision < 0x21)
1320+
hdev->pdev->revision < 0x21) {
1321+
ae_dev->override_pci_need_reset = 1;
13211322
return PCI_ERS_RESULT_RECOVERED;
1323+
}
13221324
}
13231325

13241326
if (status & HCLGE_RAS_REG_ROCEE_ERR_MASK) {
@@ -1327,8 +1329,11 @@ pci_ers_result_t hclge_handle_hw_ras_error(struct hnae3_ae_dev *ae_dev)
13271329
}
13281330

13291331
if (status & HCLGE_RAS_REG_NFE_MASK ||
1330-
status & HCLGE_RAS_REG_ROCEE_ERR_MASK)
1332+
status & HCLGE_RAS_REG_ROCEE_ERR_MASK) {
1333+
ae_dev->override_pci_need_reset = 0;
13311334
return PCI_ERS_RESULT_NEED_RESET;
1335+
}
1336+
ae_dev->override_pci_need_reset = 1;
13321337

13331338
return PCI_ERS_RESULT_RECOVERED;
13341339
}

0 commit comments

Comments
 (0)