igc: Add initial EEE support
Subsystems (2)
PATCH v3 1/1 igc: Add initial EEE support
IEEE802.3az-2010 Energy Efficient Ethernet has been approved as standard (September 2010) and the driver can enable and disable it via ethtool.
Disable the feature by default on parts which support it. Add enable/disable eee options.
tx-lpi, tx-timer and advertise not supported yet.
v1-v2:
Rid of inverted logic and replace eee_disable boolean with eee_enable in device specification.
Address community comments.
v2-v3:
Remove pointless ret_val from _set_eee method
Minor comment fix
--- drivers/net/ethernet/intel/igc/igc.h | 4 ++ drivers/net/ethernet/intel/igc/igc_defines.h | 10 +++ drivers/net/ethernet/intel/igc/igc_ethtool.c | 97 ++++++++++++++++++++++++++++ drivers/net/ethernet/intel/igc/igc_hw.h | 1 + drivers/net/ethernet/intel/igc/igc_i225.c | 57 ++++++++++++++++ drivers/net/ethernet/intel/igc/igc_i225.h | 2 + drivers/net/ethernet/intel/igc/igc_main.c | 16 +++++ drivers/net/ethernet/intel/igc/igc_regs.h | 5 ++ 8 files changed, 192 insertions(+)
drivers/net/ethernet/intel/igc/igc.h +4 -0
@@ -117,6 +117,9 @@ struct igc_ring {struct igc_adapter {struct net_device *netdev; +struct ethtool_eee eee; +u16 eee_advert; +unsigned long state;unsigned int flags;unsigned int num_q_vectors;
@@ -256,6 +259,7 @@ extern char igc_driver_version[];#define IGC_FLAG_MEDIA_RESET BIT(10)#define IGC_FLAG_MAS_ENABLE BIT(12)#define IGC_FLAG_HAS_MSIX BIT(13) +#define IGC_FLAG_EEE BIT(14)#define IGC_FLAG_VLAN_PROMISC BIT(15)#define IGC_FLAG_RX_LEGACY BIT(16)#define IGC_FLAG_TSN_QBV_ENABLED BIT(17)
drivers/net/ethernet/intel/igc/igc_defines.h +10 -0
@@ -512,4 +512,14 @@/* Maximum size of the MTA register table in all supported adapters */ #define MAX_MTA_REG 128 +/* EEE defines */ +#define IGC_IPCNFG_EEE_2_5G_AN 0x00000010/* IPCNFG EEE Ena 2.5G AN */ +#define IGC_IPCNFG_EEE_1G_AN 0x00000008/* IPCNFG EEE Ena 1G AN */ +#define IGC_IPCNFG_EEE_100M_AN 0x00000004/* IPCNFG EEE Ena 100M AN */ +#define IGC_EEER_EEE_NEG 0x20000000/* EEE capability nego */ +#define IGC_EEER_TX_LPI_EN 0x00010000/* EEER Tx LPI Enable */ +#define IGC_EEER_RX_LPI_EN 0x00020000/* EEER Rx LPI Enable */ +#define IGC_EEER_LPI_FC 0x00040000/* EEER Ena on Flow Cntrl */ +#define IGC_EEE_SU_LPI_CLK_STP 0x00800000/* EEE LPI Clock Stop */ +#endif /* _IGC_DEFINES_H_ */
drivers/net/ethernet/intel/igc/igc_ethtool.c +97 -0
115 lines not on this page · raw message
drivers/net/ethernet/intel/igc/igc_hw.h +1 -0
@@ -191,6 +191,7 @@ struct igc_fc_info {struct igc_dev_spec_base {bool clear_semaphore_once; +bool eee_enable; };struct igc_hw {
drivers/net/ethernet/intel/igc/igc_i225.c +57 -0
60 lines not on this page · raw message
drivers/net/ethernet/intel/igc/igc_i225.h +2 -0
@@ -9,5 +9,7 @@ void igc_release_swfw_sync_i225(struct igc_hw *hw, u16 mask);s32 igc_init_nvm_params_i225 (struct igc_hw *hw);bool igc_get_flash_presence_i225 (struct igc_hw *hw); +s32 igc_set_eee_i225 (struct igc_hw *hw,bool adv2p5G,bool adv1G, +bool adv100M);#endif
drivers/net/ethernet/intel/igc/igc_main.c +16 -0
@@ -105,6 +105,9 @@ void igc_reset(struct igc_adapter *adapter)if (hw->mac.ops.init_hw (hw))netdev_err (dev,"Error on hardware initialization" ); +/* Re-establish EEE setting */ +igc_set_eee_i225 (hw, true, true, true); +if (!netif_running (adapter->netdev))igc_power_down_link (adapter);
@@ -4259,6 +4262,15 @@ static void igc_watchdog_task(struct work_struct *work) (ctrl &IGC_CTRL_RFCE ) ?"RX" : (ctrl & IGC_CTRL_TFCE) ? "TX" : "None"); +/* disable EEE if enabled */ +if ((adapter->flags &IGC_FLAG_EEE ) && + adapter->link_duplex ==HALF_DUPLEX ) { +netdev_info (netdev, +"EEE Disabled: unsupported at half duplex. Re-enable using ethtool when at full duplex\n" ); + adapter->hw.dev_spec._base.eee_enable = false; + adapter->flags &= ~IGC_FLAG_EEE ; + } +/* check if SmartSpeed worked */ igc_check_downshift (hw);if (phy->speed_downgraded)
@@ -5190,6 +5202,10 @@ static int igc_probe(struct pci_dev *pdev,netdev_info (netdev,"MAC: %pM" , netdev->dev_addr);dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NEVER_SKIP ); +/* Disable EEE for internal PHY devices */ + hw->dev_spec._base.eee_enable = false; + adapter->flags &= ~IGC_FLAG_EEE ; +igc_set_eee_i225 (hw, false, false, false);pm_runtime_put_noidle (&pdev->dev);
drivers/net/ethernet/intel/igc/igc_regs.h +5 -0
@@ -249,6 +249,11 @@/* Wake Up packet memory */ #define IGC_WUPM_REG (_i) (0x05A00 + ((_i) * 4)) +/* Energy Efficient Ethernet "EEE" registers */ +#define IGC_EEER 0x0E30/* Energy Efficient Ethernet "EEE"*/ +#define IGC_IPCNFG 0x0E38/* Internal PHY Configuration */ +#define IGC_EEE_SU 0x0E34/* EEE Setup */ +/* forward declaration */ struct igc_hw ;u32 igc_rd32 (struct igc_hw *hw,u32 reg);
Signature · 1 line
2.11.0
PATCH v3 1/1 igc: Add initial EEE support
Quoted 12 lines
IEEE802.3az-2010 Energy Efficient Ethernet has been approved as standard (September 2010) and the driver can enable and disable it via ethtool.
Disable the feature by default on parts which support it. Add enable/disable eee options.
tx-lpi, tx-timer and advertise not supported yet.v1-v2:
Rid of inverted logic and replaceeee_disableboolean witheee_enablein device specification.
Address community comments.
Quoted 5 lines
v2-v3:
Remove pointlessret_valfrom_set_eeemethod
Minor comment fixSigned-off-by Sasha Neftin <[email protected]>