@@ -4488,12 +4488,49 @@ static void bnxt_report_link(struct bnxt *bp)
4488
4488
speed = bnxt_fw_to_ethtool_speed (bp -> link_info .link_speed );
4489
4489
netdev_info (bp -> dev , "NIC Link is Up, %d Mbps %s duplex, Flow control: %s\n" ,
4490
4490
speed , duplex , flow_ctrl );
4491
+ if (bp -> flags & BNXT_FLAG_EEE_CAP )
4492
+ netdev_info (bp -> dev , "EEE is %s\n" ,
4493
+ bp -> eee .eee_active ? "active" :
4494
+ "not active" );
4491
4495
} else {
4492
4496
netif_carrier_off (bp -> dev );
4493
4497
netdev_err (bp -> dev , "NIC Link is Down\n" );
4494
4498
}
4495
4499
}
4496
4500
4501
+ static int bnxt_hwrm_phy_qcaps (struct bnxt * bp )
4502
+ {
4503
+ int rc = 0 ;
4504
+ struct hwrm_port_phy_qcaps_input req = {0 };
4505
+ struct hwrm_port_phy_qcaps_output * resp = bp -> hwrm_cmd_resp_addr ;
4506
+
4507
+ if (bp -> hwrm_spec_code < 0x10201 )
4508
+ return 0 ;
4509
+
4510
+ bnxt_hwrm_cmd_hdr_init (bp , & req , HWRM_PORT_PHY_QCAPS , -1 , -1 );
4511
+
4512
+ mutex_lock (& bp -> hwrm_cmd_lock );
4513
+ rc = _hwrm_send_message (bp , & req , sizeof (req ), HWRM_CMD_TIMEOUT );
4514
+ if (rc )
4515
+ goto hwrm_phy_qcaps_exit ;
4516
+
4517
+ if (resp -> eee_supported & PORT_PHY_QCAPS_RESP_EEE_SUPPORTED ) {
4518
+ struct ethtool_eee * eee = & bp -> eee ;
4519
+ u16 fw_speeds = le16_to_cpu (resp -> supported_speeds_eee_mode );
4520
+
4521
+ bp -> flags |= BNXT_FLAG_EEE_CAP ;
4522
+ eee -> supported = _bnxt_fw_to_ethtool_adv_spds (fw_speeds , 0 );
4523
+ bp -> lpi_tmr_lo = le32_to_cpu (resp -> tx_lpi_timer_low ) &
4524
+ PORT_PHY_QCAPS_RESP_TX_LPI_TIMER_LOW_MASK ;
4525
+ bp -> lpi_tmr_hi = le32_to_cpu (resp -> valid_tx_lpi_timer_high ) &
4526
+ PORT_PHY_QCAPS_RESP_TX_LPI_TIMER_HIGH_MASK ;
4527
+ }
4528
+
4529
+ hwrm_phy_qcaps_exit :
4530
+ mutex_unlock (& bp -> hwrm_cmd_lock );
4531
+ return rc ;
4532
+ }
4533
+
4497
4534
static int bnxt_update_link (struct bnxt * bp , bool chng_link_state )
4498
4535
{
4499
4536
int rc = 0 ;
@@ -4535,8 +4572,44 @@ static int bnxt_update_link(struct bnxt *bp, bool chng_link_state)
4535
4572
link_info -> phy_ver [2 ] = resp -> phy_bld ;
4536
4573
link_info -> media_type = resp -> media_type ;
4537
4574
link_info -> transceiver = resp -> xcvr_pkg_type ;
4538
- link_info -> phy_addr = resp -> eee_config_phy_addr ;
4575
+ link_info -> phy_addr = resp -> eee_config_phy_addr &
4576
+ PORT_PHY_QCFG_RESP_PHY_ADDR_MASK ;
4577
+
4578
+ if (bp -> flags & BNXT_FLAG_EEE_CAP ) {
4579
+ struct ethtool_eee * eee = & bp -> eee ;
4580
+ u16 fw_speeds ;
4581
+
4582
+ eee -> eee_active = 0 ;
4583
+ if (resp -> eee_config_phy_addr &
4584
+ PORT_PHY_QCFG_RESP_EEE_CONFIG_EEE_ACTIVE ) {
4585
+ eee -> eee_active = 1 ;
4586
+ fw_speeds = le16_to_cpu (
4587
+ resp -> link_partner_adv_eee_link_speed_mask );
4588
+ eee -> lp_advertised =
4589
+ _bnxt_fw_to_ethtool_adv_spds (fw_speeds , 0 );
4590
+ }
4591
+
4592
+ /* Pull initial EEE config */
4593
+ if (!chng_link_state ) {
4594
+ if (resp -> eee_config_phy_addr &
4595
+ PORT_PHY_QCFG_RESP_EEE_CONFIG_EEE_ENABLED )
4596
+ eee -> eee_enabled = 1 ;
4539
4597
4598
+ fw_speeds = le16_to_cpu (resp -> adv_eee_link_speed_mask );
4599
+ eee -> advertised =
4600
+ _bnxt_fw_to_ethtool_adv_spds (fw_speeds , 0 );
4601
+
4602
+ if (resp -> eee_config_phy_addr &
4603
+ PORT_PHY_QCFG_RESP_EEE_CONFIG_EEE_TX_LPI ) {
4604
+ __le32 tmr ;
4605
+
4606
+ eee -> tx_lpi_enabled = 1 ;
4607
+ tmr = resp -> xcvr_identifier_type_tx_lpi_timer ;
4608
+ eee -> tx_lpi_timer = le32_to_cpu (tmr ) &
4609
+ PORT_PHY_QCFG_RESP_TX_LPI_TIMER_MASK ;
4610
+ }
4611
+ }
4612
+ }
4540
4613
/* TODO: need to add more logic to report VF link */
4541
4614
if (chng_link_state ) {
4542
4615
if (link_info -> phy_link_status == BNXT_LINK_LINK )
@@ -5825,6 +5898,13 @@ static int bnxt_probe_phy(struct bnxt *bp)
5825
5898
int rc = 0 ;
5826
5899
struct bnxt_link_info * link_info = & bp -> link_info ;
5827
5900
5901
+ rc = bnxt_hwrm_phy_qcaps (bp );
5902
+ if (rc ) {
5903
+ netdev_err (bp -> dev , "Probe phy can't get phy capabilities (rc: %x)\n" ,
5904
+ rc );
5905
+ return rc ;
5906
+ }
5907
+
5828
5908
rc = bnxt_update_link (bp , false);
5829
5909
if (rc ) {
5830
5910
netdev_err (bp -> dev , "Probe phy can't update link (rc: %x)\n" ,
0 commit comments