|
@@ -2587,7 +2587,7 @@ static int igb_get_eee(struct net_device *netdev, struct ethtool_eee *edata)
|
|
|
{
|
|
|
struct igb_adapter *adapter = netdev_priv(netdev);
|
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
|
- u32 ipcnfg, eeer, ret_val;
|
|
|
+ u32 ret_val;
|
|
|
u16 phy_data;
|
|
|
|
|
|
if ((hw->mac.type < e1000_i350) ||
|
|
@@ -2596,16 +2596,25 @@ static int igb_get_eee(struct net_device *netdev, struct ethtool_eee *edata)
|
|
|
|
|
|
edata->supported = (SUPPORTED_1000baseT_Full |
|
|
|
SUPPORTED_100baseT_Full);
|
|
|
+ if (!hw->dev_spec._82575.eee_disable)
|
|
|
+ edata->advertised =
|
|
|
+ mmd_eee_adv_to_ethtool_adv_t(adapter->eee_advert);
|
|
|
|
|
|
- ipcnfg = rd32(E1000_IPCNFG);
|
|
|
- eeer = rd32(E1000_EEER);
|
|
|
+ /* The IPCNFG and EEER registers are not supported on I354. */
|
|
|
+ if (hw->mac.type == e1000_i354) {
|
|
|
+ igb_get_eee_status_i354(hw, (bool *)&edata->eee_active);
|
|
|
+ } else {
|
|
|
+ u32 eeer;
|
|
|
+
|
|
|
+ eeer = rd32(E1000_EEER);
|
|
|
|
|
|
- /* EEE status on negotiated link */
|
|
|
- if (ipcnfg & E1000_IPCNFG_EEE_1G_AN)
|
|
|
- edata->advertised = ADVERTISED_1000baseT_Full;
|
|
|
+ /* EEE status on negotiated link */
|
|
|
+ if (eeer & E1000_EEER_EEE_NEG)
|
|
|
+ edata->eee_active = true;
|
|
|
|
|
|
- if (ipcnfg & E1000_IPCNFG_EEE_100M_AN)
|
|
|
- edata->advertised |= ADVERTISED_100baseT_Full;
|
|
|
+ if (eeer & E1000_EEER_TX_LPI_EN)
|
|
|
+ edata->tx_lpi_enabled = true;
|
|
|
+ }
|
|
|
|
|
|
/* EEE Link Partner Advertised */
|
|
|
switch (hw->mac.type) {
|
|
@@ -2616,8 +2625,8 @@ static int igb_get_eee(struct net_device *netdev, struct ethtool_eee *edata)
|
|
|
return -ENODATA;
|
|
|
|
|
|
edata->lp_advertised = mmd_eee_adv_to_ethtool_adv_t(phy_data);
|
|
|
-
|
|
|
break;
|
|
|
+ case e1000_i354:
|
|
|
case e1000_i210:
|
|
|
case e1000_i211:
|
|
|
ret_val = igb_read_xmdio_reg(hw, E1000_EEE_LP_ADV_ADDR_I210,
|
|
@@ -2633,12 +2642,10 @@ static int igb_get_eee(struct net_device *netdev, struct ethtool_eee *edata)
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- if (eeer & E1000_EEER_EEE_NEG)
|
|
|
- edata->eee_active = true;
|
|
|
-
|
|
|
edata->eee_enabled = !hw->dev_spec._82575.eee_disable;
|
|
|
|
|
|
- if (eeer & E1000_EEER_TX_LPI_EN)
|
|
|
+ if ((hw->mac.type == e1000_i354) &&
|
|
|
+ (edata->eee_enabled))
|
|
|
edata->tx_lpi_enabled = true;
|
|
|
|
|
|
/* Report correct negotiated EEE status for devices that
|
|
@@ -2686,9 +2693,10 @@ static int igb_set_eee(struct net_device *netdev,
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
|
|
|
- if (eee_curr.advertised != edata->advertised) {
|
|
|
+ if (edata->advertised &
|
|
|
+ ~(ADVERTISE_100_FULL | ADVERTISE_1000_FULL)) {
|
|
|
dev_err(&adapter->pdev->dev,
|
|
|
- "Setting EEE Advertisement is not supported\n");
|
|
|
+ "EEE Advertisement supports only 100Tx and or 100T full duplex\n");
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
|
|
@@ -2698,9 +2706,14 @@ static int igb_set_eee(struct net_device *netdev,
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
|
|
|
+ adapter->eee_advert = ethtool_adv_to_mmd_eee_adv_t(edata->advertised);
|
|
|
if (hw->dev_spec._82575.eee_disable != !edata->eee_enabled) {
|
|
|
hw->dev_spec._82575.eee_disable = !edata->eee_enabled;
|
|
|
- igb_set_eee_i350(hw);
|
|
|
+ adapter->flags |= IGB_FLAG_EEE;
|
|
|
+ if (hw->mac.type == e1000_i350)
|
|
|
+ igb_set_eee_i350(hw);
|
|
|
+ else
|
|
|
+ igb_set_eee_i354(hw);
|
|
|
|
|
|
/* reset link */
|
|
|
if (netif_running(netdev))
|