@@ -8523,11 +8523,14 @@ static int bnxt_hwrm_shutdown_link(struct bnxt *bp)
8523
8523
return hwrm_send_message (bp , & req , sizeof (req ), HWRM_CMD_TIMEOUT );
8524
8524
}
8525
8525
8526
+ static int bnxt_fw_init_one (struct bnxt * bp );
8527
+
8526
8528
static int bnxt_hwrm_if_change (struct bnxt * bp , bool up )
8527
8529
{
8528
8530
struct hwrm_func_drv_if_change_output * resp = bp -> hwrm_cmd_resp_addr ;
8529
8531
struct hwrm_func_drv_if_change_input req = {0 };
8530
- bool resc_reinit = false;
8532
+ bool resc_reinit = false, fw_reset = false;
8533
+ u32 flags = 0 ;
8531
8534
int rc ;
8532
8535
8533
8536
if (!(bp -> fw_cap & BNXT_FW_CAP_IF_CHANGE ))
@@ -8538,26 +8541,53 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up)
8538
8541
req .flags = cpu_to_le32 (FUNC_DRV_IF_CHANGE_REQ_FLAGS_UP );
8539
8542
mutex_lock (& bp -> hwrm_cmd_lock );
8540
8543
rc = _hwrm_send_message (bp , & req , sizeof (req ), HWRM_CMD_TIMEOUT );
8541
- if (!rc && (resp -> flags &
8542
- cpu_to_le32 (FUNC_DRV_IF_CHANGE_RESP_FLAGS_RESC_CHANGE )))
8543
- resc_reinit = true;
8544
+ if (!rc )
8545
+ flags = le32_to_cpu (resp -> flags );
8544
8546
mutex_unlock (& bp -> hwrm_cmd_lock );
8547
+ if (rc )
8548
+ return rc ;
8545
8549
8546
- if (up && resc_reinit && BNXT_NEW_RM ( bp )) {
8547
- struct bnxt_hw_resc * hw_resc = & bp -> hw_resc ;
8550
+ if (! up )
8551
+ return 0 ;
8548
8552
8549
- rc = bnxt_hwrm_func_resc_qcaps (bp , true);
8550
- hw_resc -> resv_cp_rings = 0 ;
8551
- hw_resc -> resv_stat_ctxs = 0 ;
8552
- hw_resc -> resv_irqs = 0 ;
8553
- hw_resc -> resv_tx_rings = 0 ;
8554
- hw_resc -> resv_rx_rings = 0 ;
8555
- hw_resc -> resv_hw_ring_grps = 0 ;
8556
- hw_resc -> resv_vnics = 0 ;
8557
- bp -> tx_nr_rings = 0 ;
8558
- bp -> rx_nr_rings = 0 ;
8553
+ if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_RESC_CHANGE )
8554
+ resc_reinit = true;
8555
+ if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_HOT_FW_RESET_DONE )
8556
+ fw_reset = true;
8557
+
8558
+ if (resc_reinit || fw_reset ) {
8559
+ if (fw_reset ) {
8560
+ rc = bnxt_fw_init_one (bp );
8561
+ if (rc ) {
8562
+ set_bit (BNXT_STATE_ABORT_ERR , & bp -> state );
8563
+ return rc ;
8564
+ }
8565
+ bnxt_clear_int_mode (bp );
8566
+ rc = bnxt_init_int_mode (bp );
8567
+ if (rc ) {
8568
+ netdev_err (bp -> dev , "init int mode failed\n" );
8569
+ return rc ;
8570
+ }
8571
+ set_bit (BNXT_STATE_FW_RESET_DET , & bp -> state );
8572
+ }
8573
+ if (BNXT_NEW_RM (bp )) {
8574
+ struct bnxt_hw_resc * hw_resc = & bp -> hw_resc ;
8575
+
8576
+ rc = bnxt_hwrm_func_resc_qcaps (bp , true);
8577
+ hw_resc -> resv_cp_rings = 0 ;
8578
+ hw_resc -> resv_stat_ctxs = 0 ;
8579
+ hw_resc -> resv_irqs = 0 ;
8580
+ hw_resc -> resv_tx_rings = 0 ;
8581
+ hw_resc -> resv_rx_rings = 0 ;
8582
+ hw_resc -> resv_hw_ring_grps = 0 ;
8583
+ hw_resc -> resv_vnics = 0 ;
8584
+ if (!fw_reset ) {
8585
+ bp -> tx_nr_rings = 0 ;
8586
+ bp -> rx_nr_rings = 0 ;
8587
+ }
8588
+ }
8559
8589
}
8560
- return rc ;
8590
+ return 0 ;
8561
8591
}
8562
8592
8563
8593
static int bnxt_hwrm_port_led_qcaps (struct bnxt * bp )
@@ -8977,12 +9007,28 @@ static int bnxt_open(struct net_device *dev)
8977
9007
struct bnxt * bp = netdev_priv (dev );
8978
9008
int rc ;
8979
9009
8980
- bnxt_hwrm_if_change (bp , true);
8981
- rc = __bnxt_open_nic (bp , true, true);
9010
+ if (test_bit (BNXT_STATE_ABORT_ERR , & bp -> state )) {
9011
+ netdev_err (bp -> dev , "A previous firmware reset did not complete, aborting\n" );
9012
+ return - ENODEV ;
9013
+ }
9014
+
9015
+ rc = bnxt_hwrm_if_change (bp , true);
8982
9016
if (rc )
9017
+ return rc ;
9018
+ rc = __bnxt_open_nic (bp , true, true);
9019
+ if (rc ) {
8983
9020
bnxt_hwrm_if_change (bp , false);
9021
+ } else {
9022
+ if (test_and_clear_bit (BNXT_STATE_FW_RESET_DET , & bp -> state ) &&
9023
+ BNXT_PF (bp )) {
9024
+ struct bnxt_pf_info * pf = & bp -> pf ;
9025
+ int n = pf -> active_vfs ;
8984
9026
8985
- bnxt_hwmon_open (bp );
9027
+ if (n )
9028
+ bnxt_cfg_hw_sriov (bp , & n );
9029
+ }
9030
+ bnxt_hwmon_open (bp );
9031
+ }
8986
9032
8987
9033
return rc ;
8988
9034
}
@@ -10075,6 +10121,27 @@ static void bnxt_fw_init_one_p3(struct bnxt *bp)
10075
10121
bnxt_hwrm_coal_params_qcaps (bp );
10076
10122
}
10077
10123
10124
+ static int bnxt_fw_init_one (struct bnxt * bp )
10125
+ {
10126
+ int rc ;
10127
+
10128
+ rc = bnxt_fw_init_one_p1 (bp );
10129
+ if (rc ) {
10130
+ netdev_err (bp -> dev , "Firmware init phase 1 failed\n" );
10131
+ return rc ;
10132
+ }
10133
+ rc = bnxt_fw_init_one_p2 (bp );
10134
+ if (rc ) {
10135
+ netdev_err (bp -> dev , "Firmware init phase 2 failed\n" );
10136
+ return rc ;
10137
+ }
10138
+ rc = bnxt_approve_mac (bp , bp -> dev -> dev_addr , false);
10139
+ if (rc )
10140
+ return rc ;
10141
+ bnxt_fw_init_one_p3 (bp );
10142
+ return 0 ;
10143
+ }
10144
+
10078
10145
static int bnxt_init_board (struct pci_dev * pdev , struct net_device * dev )
10079
10146
{
10080
10147
int rc ;
0 commit comments