@@ -9300,7 +9300,7 @@ void bnxt_tx_enable(struct bnxt *bp)
9300
9300
/* Make sure napi polls see @dev_state change */
9301
9301
synchronize_net ();
9302
9302
netif_tx_wake_all_queues (bp -> dev );
9303
- if (bp -> link_info . link_up )
9303
+ if (BNXT_LINK_IS_UP ( bp ) )
9304
9304
netif_carrier_on (bp -> dev );
9305
9305
}
9306
9306
@@ -9330,7 +9330,7 @@ static char *bnxt_report_fec(struct bnxt_link_info *link_info)
9330
9330
9331
9331
void bnxt_report_link (struct bnxt * bp )
9332
9332
{
9333
- if (bp -> link_info . link_up ) {
9333
+ if (BNXT_LINK_IS_UP ( bp ) ) {
9334
9334
const char * signal = "" ;
9335
9335
const char * flow_ctrl ;
9336
9336
const char * duplex ;
@@ -9466,7 +9466,7 @@ int bnxt_update_link(struct bnxt *bp, bool chng_link_state)
9466
9466
struct bnxt_link_info * link_info = & bp -> link_info ;
9467
9467
struct hwrm_port_phy_qcfg_output * resp ;
9468
9468
struct hwrm_port_phy_qcfg_input * req ;
9469
- u8 link_up = link_info -> link_up ;
9469
+ u8 link_state = link_info -> link_state ;
9470
9470
bool support_changed = false;
9471
9471
int rc ;
9472
9472
@@ -9567,14 +9567,14 @@ int bnxt_update_link(struct bnxt *bp, bool chng_link_state)
9567
9567
/* TODO: need to add more logic to report VF link */
9568
9568
if (chng_link_state ) {
9569
9569
if (link_info -> phy_link_status == BNXT_LINK_LINK )
9570
- link_info -> link_up = 1 ;
9570
+ link_info -> link_state = BNXT_LINK_STATE_UP ;
9571
9571
else
9572
- link_info -> link_up = 0 ;
9573
- if (link_up != link_info -> link_up )
9572
+ link_info -> link_state = BNXT_LINK_STATE_DOWN ;
9573
+ if (link_state != link_info -> link_state )
9574
9574
bnxt_report_link (bp );
9575
9575
} else {
9576
- /* alwasy link down if not require to update link state */
9577
- link_info -> link_up = 0 ;
9576
+ /* always link down if not require to update link state */
9577
+ link_info -> link_state = BNXT_LINK_STATE_DOWN ;
9578
9578
}
9579
9579
hwrm_req_drop (bp , req );
9580
9580
@@ -9774,7 +9774,18 @@ static int bnxt_hwrm_shutdown_link(struct bnxt *bp)
9774
9774
return rc ;
9775
9775
9776
9776
req -> flags = cpu_to_le32 (PORT_PHY_CFG_REQ_FLAGS_FORCE_LINK_DWN );
9777
- return hwrm_req_send (bp , req );
9777
+ rc = hwrm_req_send (bp , req );
9778
+ if (!rc ) {
9779
+ mutex_lock (& bp -> link_lock );
9780
+ /* Device is not obliged link down in certain scenarios, even
9781
+ * when forced. Setting the state unknown is consistent with
9782
+ * driver startup and will force link state to be reported
9783
+ * during subsequent open based on PORT_PHY_QCFG.
9784
+ */
9785
+ bp -> link_info .link_state = BNXT_LINK_STATE_UNKNOWN ;
9786
+ mutex_unlock (& bp -> link_lock );
9787
+ }
9788
+ return rc ;
9778
9789
}
9779
9790
9780
9791
static int bnxt_fw_reset_via_optee (struct bnxt * bp )
@@ -10205,7 +10216,7 @@ static int bnxt_update_phy_setting(struct bnxt *bp)
10205
10216
/* The last close may have shutdown the link, so need to call
10206
10217
* PHY_CFG to bring it back up.
10207
10218
*/
10208
- if (!bp -> link_info . link_up )
10219
+ if (!BNXT_LINK_IS_UP ( bp ) )
10209
10220
update_link = true;
10210
10221
10211
10222
if (!bnxt_eee_config_ok (bp ))
@@ -11437,7 +11448,7 @@ static void bnxt_timer(struct timer_list *t)
11437
11448
if (bp -> fw_cap & BNXT_FW_CAP_ERROR_RECOVERY )
11438
11449
bnxt_fw_health_check (bp );
11439
11450
11440
- if (bp -> link_info . link_up && bp -> stats_coal_ticks ) {
11451
+ if (BNXT_LINK_IS_UP ( bp ) && bp -> stats_coal_ticks ) {
11441
11452
set_bit (BNXT_PERIODIC_STATS_SP_EVENT , & bp -> sp_event );
11442
11453
bnxt_queue_sp_work (bp );
11443
11454
}
0 commit comments