@@ -9089,7 +9089,7 @@ static void bnxt_try_map_fw_health_reg(struct bnxt *bp)
9089
9089
BNXT_FW_HEALTH_WIN_BASE +
9090
9090
BNXT_GRC_REG_CHIP_NUM );
9091
9091
}
9092
- if (!BNXT_CHIP_P5 (bp ))
9092
+ if (!BNXT_CHIP_P5_PLUS (bp ))
9093
9093
return ;
9094
9094
9095
9095
status_loc = BNXT_GRC_REG_STATUS_P5 |
@@ -13037,6 +13037,16 @@ static void bnxt_rx_ring_reset(struct bnxt *bp)
13037
13037
bnxt_rtnl_unlock_sp (bp );
13038
13038
}
13039
13039
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
+
13040
13050
static void bnxt_fw_reset_close (struct bnxt * bp )
13041
13051
{
13042
13052
bnxt_ulp_stop (bp );
@@ -13050,12 +13060,7 @@ static void bnxt_fw_reset_close(struct bnxt *bp)
13050
13060
pci_read_config_word (bp -> pdev , PCI_SUBSYSTEM_ID , & val );
13051
13061
if (val == 0xffff )
13052
13062
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 );
13059
13064
}
13060
13065
__bnxt_close_nic (bp , true, false);
13061
13066
bnxt_vf_reps_free (bp );
@@ -15373,6 +15378,7 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
15373
15378
{
15374
15379
struct net_device * netdev = pci_get_drvdata (pdev );
15375
15380
struct bnxt * bp = netdev_priv (netdev );
15381
+ bool abort = false;
15376
15382
15377
15383
netdev_info (netdev , "PCI I/O error detected\n" );
15378
15384
@@ -15381,16 +15387,27 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
15381
15387
15382
15388
bnxt_ulp_stop (bp );
15383
15389
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 ) {
15385
15396
rtnl_unlock ();
15386
15397
return PCI_ERS_RESULT_DISCONNECT ;
15387
15398
}
15388
15399
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 ) {
15390
15405
set_bit (BNXT_STATE_PCI_CHANNEL_IO_FROZEN , & bp -> state );
15406
+ bnxt_fw_fatal_close (bp );
15407
+ }
15391
15408
15392
15409
if (netif_running (netdev ))
15393
- bnxt_close ( netdev );
15410
+ __bnxt_close_nic ( bp , true, true );
15394
15411
15395
15412
if (pci_is_enabled (pdev ))
15396
15413
pci_disable_device (pdev );
@@ -15474,6 +15491,7 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
15474
15491
}
15475
15492
15476
15493
reset_exit :
15494
+ clear_bit (BNXT_STATE_IN_FW_RESET , & bp -> state );
15477
15495
bnxt_clear_reservations (bp , true);
15478
15496
rtnl_unlock ();
15479
15497
0 commit comments