@@ -9089,7 +9089,7 @@ static void bnxt_try_map_fw_health_reg(struct bnxt *bp)
90899089 BNXT_FW_HEALTH_WIN_BASE +
90909090 BNXT_GRC_REG_CHIP_NUM );
90919091 }
9092- if (!BNXT_CHIP_P5 (bp ))
9092+ if (!BNXT_CHIP_P5_PLUS (bp ))
90939093 return ;
90949094
90959095 status_loc = BNXT_GRC_REG_STATUS_P5 |
@@ -13037,6 +13037,16 @@ static void bnxt_rx_ring_reset(struct bnxt *bp)
1303713037 bnxt_rtnl_unlock_sp (bp );
1303813038}
1303913039
13040+ static void bnxt_fw_fatal_close (struct bnxt * bp )
13041+ {
13042+ bnxt_tx_disable (bp );
13043+ bnxt_disable_napi (bp );
13044+ bnxt_disable_int_sync (bp );
13045+ bnxt_free_irq (bp );
13046+ bnxt_clear_int_mode (bp );
13047+ pci_disable_device (bp -> pdev );
13048+ }
13049+
1304013050static void bnxt_fw_reset_close (struct bnxt * bp )
1304113051{
1304213052 bnxt_ulp_stop (bp );
@@ -13050,12 +13060,7 @@ static void bnxt_fw_reset_close(struct bnxt *bp)
1305013060 pci_read_config_word (bp -> pdev , PCI_SUBSYSTEM_ID , & val );
1305113061 if (val == 0xffff )
1305213062 bp -> fw_reset_min_dsecs = 0 ;
13053- bnxt_tx_disable (bp );
13054- bnxt_disable_napi (bp );
13055- bnxt_disable_int_sync (bp );
13056- bnxt_free_irq (bp );
13057- bnxt_clear_int_mode (bp );
13058- pci_disable_device (bp -> pdev );
13063+ bnxt_fw_fatal_close (bp );
1305913064 }
1306013065 __bnxt_close_nic (bp , true, false);
1306113066 bnxt_vf_reps_free (bp );
@@ -15373,6 +15378,7 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
1537315378{
1537415379 struct net_device * netdev = pci_get_drvdata (pdev );
1537515380 struct bnxt * bp = netdev_priv (netdev );
15381+ bool abort = false;
1537615382
1537715383 netdev_info (netdev , "PCI I/O error detected\n" );
1537815384
@@ -15381,16 +15387,27 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
1538115387
1538215388 bnxt_ulp_stop (bp );
1538315389
15384- if (state == pci_channel_io_perm_failure ) {
15390+ if (test_and_set_bit (BNXT_STATE_IN_FW_RESET , & bp -> state )) {
15391+ netdev_err (bp -> dev , "Firmware reset already in progress\n" );
15392+ abort = true;
15393+ }
15394+
15395+ if (abort || state == pci_channel_io_perm_failure ) {
1538515396 rtnl_unlock ();
1538615397 return PCI_ERS_RESULT_DISCONNECT ;
1538715398 }
1538815399
15389- if (state == pci_channel_io_frozen )
15400+ /* Link is not reliable anymore if state is pci_channel_io_frozen
15401+ * so we disable bus master to prevent any potential bad DMAs before
15402+ * freeing kernel memory.
15403+ */
15404+ if (state == pci_channel_io_frozen ) {
1539015405 set_bit (BNXT_STATE_PCI_CHANNEL_IO_FROZEN , & bp -> state );
15406+ bnxt_fw_fatal_close (bp );
15407+ }
1539115408
1539215409 if (netif_running (netdev ))
15393- bnxt_close ( netdev );
15410+ __bnxt_close_nic ( bp , true, true );
1539415411
1539515412 if (pci_is_enabled (pdev ))
1539615413 pci_disable_device (pdev );
@@ -15474,6 +15491,7 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
1547415491 }
1547515492
1547615493reset_exit :
15494+ clear_bit (BNXT_STATE_IN_FW_RESET , & bp -> state );
1547715495 bnxt_clear_reservations (bp , true);
1547815496 rtnl_unlock ();
1547915497
0 commit comments