@@ -9165,7 +9165,7 @@ static void bnxt_try_map_fw_health_reg(struct bnxt *bp)
91659165 BNXT_FW_HEALTH_WIN_BASE +
91669166 BNXT_GRC_REG_CHIP_NUM );
91679167 }
9168- if (!BNXT_CHIP_P5 (bp ))
9168+ if (!BNXT_CHIP_P5_PLUS (bp ))
91699169 return ;
91709170
91719171 status_loc = BNXT_GRC_REG_STATUS_P5 |
@@ -13267,6 +13267,16 @@ static void bnxt_rx_ring_reset(struct bnxt *bp)
1326713267 bnxt_rtnl_unlock_sp (bp );
1326813268}
1326913269
13270+ static void bnxt_fw_fatal_close (struct bnxt * bp )
13271+ {
13272+ bnxt_tx_disable (bp );
13273+ bnxt_disable_napi (bp );
13274+ bnxt_disable_int_sync (bp );
13275+ bnxt_free_irq (bp );
13276+ bnxt_clear_int_mode (bp );
13277+ pci_disable_device (bp -> pdev );
13278+ }
13279+
1327013280static void bnxt_fw_reset_close (struct bnxt * bp )
1327113281{
1327213282 bnxt_ulp_stop (bp );
@@ -13280,12 +13290,7 @@ static void bnxt_fw_reset_close(struct bnxt *bp)
1328013290 pci_read_config_word (bp -> pdev , PCI_SUBSYSTEM_ID , & val );
1328113291 if (val == 0xffff )
1328213292 bp -> fw_reset_min_dsecs = 0 ;
13283- bnxt_tx_disable (bp );
13284- bnxt_disable_napi (bp );
13285- bnxt_disable_int_sync (bp );
13286- bnxt_free_irq (bp );
13287- bnxt_clear_int_mode (bp );
13288- pci_disable_device (bp -> pdev );
13293+ bnxt_fw_fatal_close (bp );
1328913294 }
1329013295 __bnxt_close_nic (bp , true, false);
1329113296 bnxt_vf_reps_free (bp );
@@ -15623,6 +15628,7 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
1562315628{
1562415629 struct net_device * netdev = pci_get_drvdata (pdev );
1562515630 struct bnxt * bp = netdev_priv (netdev );
15631+ bool abort = false;
1562615632
1562715633 netdev_info (netdev , "PCI I/O error detected\n" );
1562815634
@@ -15631,16 +15637,27 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
1563115637
1563215638 bnxt_ulp_stop (bp );
1563315639
15634- if (state == pci_channel_io_perm_failure ) {
15640+ if (test_and_set_bit (BNXT_STATE_IN_FW_RESET , & bp -> state )) {
15641+ netdev_err (bp -> dev , "Firmware reset already in progress\n" );
15642+ abort = true;
15643+ }
15644+
15645+ if (abort || state == pci_channel_io_perm_failure ) {
1563515646 rtnl_unlock ();
1563615647 return PCI_ERS_RESULT_DISCONNECT ;
1563715648 }
1563815649
15639- if (state == pci_channel_io_frozen )
15650+ /* Link is not reliable anymore if state is pci_channel_io_frozen
15651+ * so we disable bus master to prevent any potential bad DMAs before
15652+ * freeing kernel memory.
15653+ */
15654+ if (state == pci_channel_io_frozen ) {
1564015655 set_bit (BNXT_STATE_PCI_CHANNEL_IO_FROZEN , & bp -> state );
15656+ bnxt_fw_fatal_close (bp );
15657+ }
1564115658
1564215659 if (netif_running (netdev ))
15643- bnxt_close ( netdev );
15660+ __bnxt_close_nic ( bp , true, true );
1564415661
1564515662 if (pci_is_enabled (pdev ))
1564615663 pci_disable_device (pdev );
@@ -15728,6 +15745,7 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
1572815745 }
1572915746
1573015747reset_exit :
15748+ clear_bit (BNXT_STATE_IN_FW_RESET , & bp -> state );
1573115749 bnxt_clear_reservations (bp , true);
1573215750 rtnl_unlock ();
1573315751
0 commit comments