@@ -2061,6 +2061,22 @@ static void bnxt_event_error_report(struct bnxt *bp, u32 data1, u32 data2)
20612061 case ASYNC_EVENT_CMPL_ERROR_REPORT_BASE_EVENT_DATA1_ERROR_TYPE_DOORBELL_DROP_THRESHOLD :
20622062 netdev_warn (bp -> dev , "One or more MMIO doorbells dropped by the device!\n" );
20632063 break ;
2064+ case ASYNC_EVENT_CMPL_ERROR_REPORT_BASE_EVENT_DATA1_ERROR_TYPE_NVM : {
2065+ struct bnxt_hw_health * hw_health = & bp -> hw_health ;
2066+
2067+ hw_health -> nvm_err_address = EVENT_DATA2_NVM_ERR_ADDR (data2 );
2068+ if (EVENT_DATA1_NVM_ERR_TYPE_WRITE (data1 )) {
2069+ hw_health -> synd = BNXT_HW_STATUS_NVM_WRITE_ERR ;
2070+ hw_health -> nvm_write_errors ++ ;
2071+ } else if (EVENT_DATA1_NVM_ERR_TYPE_ERASE (data1 )) {
2072+ hw_health -> synd = BNXT_HW_STATUS_NVM_ERASE_ERR ;
2073+ hw_health -> nvm_erase_errors ++ ;
2074+ } else {
2075+ hw_health -> synd = BNXT_HW_STATUS_NVM_UNKNOWN_ERR ;
2076+ }
2077+ set_bit (BNXT_FW_NVM_ERR_SP_EVENT , & bp -> sp_event );
2078+ break ;
2079+ }
20642080 default :
20652081 netdev_err (bp -> dev , "FW reported unknown error type %u\n" ,
20662082 err_type );
@@ -9300,7 +9316,7 @@ void bnxt_tx_enable(struct bnxt *bp)
93009316 /* Make sure napi polls see @dev_state change */
93019317 synchronize_net ();
93029318 netif_tx_wake_all_queues (bp -> dev );
9303- if (bp -> link_info . link_up )
9319+ if (BNXT_LINK_IS_UP ( bp ) )
93049320 netif_carrier_on (bp -> dev );
93059321}
93069322
@@ -9330,7 +9346,7 @@ static char *bnxt_report_fec(struct bnxt_link_info *link_info)
93309346
93319347void bnxt_report_link (struct bnxt * bp )
93329348{
9333- if (bp -> link_info . link_up ) {
9349+ if (BNXT_LINK_IS_UP ( bp ) ) {
93349350 const char * signal = "" ;
93359351 const char * flow_ctrl ;
93369352 const char * duplex ;
@@ -9416,7 +9432,7 @@ static int bnxt_hwrm_phy_qcaps(struct bnxt *bp)
94169432 if (rc )
94179433 goto hwrm_phy_qcaps_exit ;
94189434
9419- bp -> phy_flags = resp -> flags ;
9435+ bp -> phy_flags = resp -> flags | ( le16_to_cpu ( resp -> flags2 ) << 8 ) ;
94209436 if (resp -> flags & PORT_PHY_QCAPS_RESP_FLAGS_EEE_SUPPORTED ) {
94219437 struct ethtool_eee * eee = & bp -> eee ;
94229438 u16 fw_speeds = le16_to_cpu (resp -> supported_speeds_eee_mode );
@@ -9466,7 +9482,7 @@ int bnxt_update_link(struct bnxt *bp, bool chng_link_state)
94669482 struct bnxt_link_info * link_info = & bp -> link_info ;
94679483 struct hwrm_port_phy_qcfg_output * resp ;
94689484 struct hwrm_port_phy_qcfg_input * req ;
9469- u8 link_up = link_info -> link_up ;
9485+ u8 link_state = link_info -> link_state ;
94709486 bool support_changed = false;
94719487 int rc ;
94729488
@@ -9567,14 +9583,14 @@ int bnxt_update_link(struct bnxt *bp, bool chng_link_state)
95679583 /* TODO: need to add more logic to report VF link */
95689584 if (chng_link_state ) {
95699585 if (link_info -> phy_link_status == BNXT_LINK_LINK )
9570- link_info -> link_up = 1 ;
9586+ link_info -> link_state = BNXT_LINK_STATE_UP ;
95719587 else
9572- link_info -> link_up = 0 ;
9573- if (link_up != link_info -> link_up )
9588+ link_info -> link_state = BNXT_LINK_STATE_DOWN ;
9589+ if (link_state != link_info -> link_state )
95749590 bnxt_report_link (bp );
95759591 } else {
9576- /* alwasy link down if not require to update link state */
9577- link_info -> link_up = 0 ;
9592+ /* always link down if not require to update link state */
9593+ link_info -> link_state = BNXT_LINK_STATE_DOWN ;
95789594 }
95799595 hwrm_req_drop (bp , req );
95809596
@@ -9774,7 +9790,18 @@ static int bnxt_hwrm_shutdown_link(struct bnxt *bp)
97749790 return rc ;
97759791
97769792 req -> flags = cpu_to_le32 (PORT_PHY_CFG_REQ_FLAGS_FORCE_LINK_DWN );
9777- return hwrm_req_send (bp , req );
9793+ rc = hwrm_req_send (bp , req );
9794+ if (!rc ) {
9795+ mutex_lock (& bp -> link_lock );
9796+ /* Device is not obliged link down in certain scenarios, even
9797+ * when forced. Setting the state unknown is consistent with
9798+ * driver startup and will force link state to be reported
9799+ * during subsequent open based on PORT_PHY_QCFG.
9800+ */
9801+ bp -> link_info .link_state = BNXT_LINK_STATE_UNKNOWN ;
9802+ mutex_unlock (& bp -> link_lock );
9803+ }
9804+ return rc ;
97789805}
97799806
97809807static int bnxt_fw_reset_via_optee (struct bnxt * bp )
@@ -10205,7 +10232,7 @@ static int bnxt_update_phy_setting(struct bnxt *bp)
1020510232 /* The last close may have shutdown the link, so need to call
1020610233 * PHY_CFG to bring it back up.
1020710234 */
10208- if (!bp -> link_info . link_up )
10235+ if (!BNXT_LINK_IS_UP ( bp ) )
1020910236 update_link = true;
1021010237
1021110238 if (!bnxt_eee_config_ok (bp ))
@@ -11437,7 +11464,7 @@ static void bnxt_timer(struct timer_list *t)
1143711464 if (bp -> fw_cap & BNXT_FW_CAP_ERROR_RECOVERY )
1143811465 bnxt_fw_health_check (bp );
1143911466
11440- if (bp -> link_info . link_up && bp -> stats_coal_ticks ) {
11467+ if (BNXT_LINK_IS_UP ( bp ) && bp -> stats_coal_ticks ) {
1144111468 set_bit (BNXT_PERIODIC_STATS_SP_EVENT , & bp -> sp_event );
1144211469 bnxt_queue_sp_work (bp );
1144311470 }
@@ -11876,6 +11903,9 @@ static void bnxt_sp_task(struct work_struct *work)
1187611903 if (test_and_clear_bit (BNXT_FW_ECHO_REQUEST_SP_EVENT , & bp -> sp_event ))
1187711904 bnxt_fw_echo_reply (bp );
1187811905
11906+ if (test_and_clear_bit (BNXT_FW_NVM_ERR_SP_EVENT , & bp -> sp_event ))
11907+ bnxt_devlink_health_hw_report (bp );
11908+
1187911909 /* These functions below will clear BNXT_STATE_IN_SP_TASK. They
1188011910 * must be the last functions to be called before exiting.
1188111911 */
@@ -12138,11 +12168,6 @@ int bnxt_fw_init_one(struct bnxt *bp)
1213812168 if (rc )
1213912169 return rc ;
1214012170
12141- /* In case fw capabilities have changed, destroy the unneeded
12142- * reporters and create newly capable ones.
12143- */
12144- bnxt_dl_fw_reporters_destroy (bp , false);
12145- bnxt_dl_fw_reporters_create (bp );
1214612171 bnxt_fw_init_one_p3 (bp );
1214712172 return 0 ;
1214812173}
@@ -12971,7 +12996,7 @@ static void bnxt_remove_one(struct pci_dev *pdev)
1297112996 cancel_delayed_work_sync (& bp -> fw_reset_task );
1297212997 bp -> sp_event = 0 ;
1297312998
12974- bnxt_dl_fw_reporters_destroy (bp , true );
12999+ bnxt_dl_fw_reporters_destroy (bp );
1297513000 bnxt_dl_unregister (bp );
1297613001 bnxt_shutdown_tc (bp );
1297713002
0 commit comments