e1000e: Introduce private flag to disable K1
Subsystems (2)
PATCH v3 1/1 e1000e: Introduce private flag to disable K1
The K1 state reduces power consumption on ICH family network controllers during idle periods, similarly to L1 state on PCI Express NICs. Therefore, it is recommended and enabled by default.
However, on some systems it has been observed to have adverse side effects, such as packet loss. It has been established through debug that the problem may be due to firmware misconfiguration of specific systems, interoperability with certain link partners, or marginal electrical conditions of specific units.
These problems typically cannot be fixed in the field, and generic workarounds to resolve the side effects on all systems, while keeping K1 enabled, were found infeasible.
Therefore, add the option for users to globally disable K1 idle state on the adapter.
Additionally, disable K1 by default for MTL and later platforms, due to issues reported with the current configuration.
---
v3: Removed disabling K1 in watchdog_task and change the private flag setting
v2: Add a missing semaphore acquiring and disable K1 on MTL by default
--- drivers/net/ethernet/intel/e1000e/e1000.h | 1 + drivers/net/ethernet/intel/e1000e/ethtool.c | 45 ++++++++++++++++++--- drivers/net/ethernet/intel/e1000e/ich8lan.c | 41 ++++++++++--------- drivers/net/ethernet/intel/e1000e/ich8lan.h | 2 + drivers/net/ethernet/intel/e1000e/netdev.c | 3 ++ 5 files changed, 69 insertions(+), 23 deletions(-)
drivers/net/ethernet/intel/e1000e/e1000.h +1 -0
@@ -461,6 +461,7 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca);#define FLAG2_CHECK_RX_HWTSTAMP BIT(13)#define FLAG2_CHECK_SYSTIM_OVERFLOW BIT(14)#define FLAG2_ENABLE_S0IX_FLOWS BIT(15) +#define FLAG2_DISABLE_K1 BIT(16)#define E1000_RX_DESC_PS (R , i) \ (&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
drivers/net/ethernet/intel/e1000e/ethtool.c +40 -5
72 lines not on this page · raw message
drivers/net/ethernet/intel/e1000e/ich8lan.c +23 -18
85 lines not on this page · raw message
drivers/net/ethernet/intel/e1000e/ich8lan.h +2 -0
@@ -310,4 +310,6 @@ s32 e1000_read_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 *data);s32 e1000_write_emi_reg_locked (struct e1000_hw *hw,u16 addr,u16 data);s32 e1000_set_eee_pchlan (struct e1000_hw *hw);s32 e1000_enable_ulp_lpt_lp (struct e1000_hw *hw,bool to_sx); +s32 e1000_reconfigure_k1_params (struct e1000_hw *hw); +#endif /* _E1000E_ICH8LAN_H_ */
drivers/net/ethernet/intel/e1000e/netdev.c +3 -0
@@ -7675,6 +7675,9 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)/* init PTP hardware clock */ e1000e_ptp_init (adapter); +if (hw->mac.type >= e1000_pch_mtp) + adapter->flags2 |=FLAG2_DISABLE_K1 ; +/* reset the hardware with the new settings */ e1000e_reset (adapter);
Signature · 1 line
2.34.1
Quoted 246 lines · Vitaly
The K1 state reduces power consumption on ICH family network controllers during idle periods, similarly to L1 state on PCI Express NICs. Therefore, it is recommended and enabled by default.
However, on some systems it has been observed to have adverse side effects, such as packet loss. It has been established through debug that the problem may be due to firmware misconfiguration of specific systems, interoperability with certain link partners, or marginal electrical conditions of specific units.These problems typically cannot be fixed in the field, and generic workarounds to resolve the side effects on all systems, while keeping K1 enabled, were found infeasible.
Therefore, add the option for users to globally disable K1 idle state on the adapter.Additionally, disable K1 by default for MTL and later platforms, due to issues reported with the current configuration.
Signed-off-by Vitaly Lifshits <[email protected]>---
v3: Removed disabling K1 inwatchdog_taskand change the private flag setting
v2: Add a missing semaphore acquiring and disable K1 on MTL by default--- drivers/net/ethernet/intel/e1000e/e1000.h | 1 + drivers/net/ethernet/intel/e1000e/ethtool.c | 45 ++++++++++++++++++--- drivers/net/ethernet/intel/e1000e/ich8lan.c | 41 ++++++++++--------- drivers/net/ethernet/intel/e1000e/ich8lan.h | 2 + drivers/net/ethernet/intel/e1000e/netdev.c | 3 ++ 5 files changed, 69 insertions(+), 23 deletions(-)drivers/net/ethernet/intel/e1000e/e1000.h +1
-0@@ -461,6 +461,7 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca);#define FLAG2_CHECK_RX_HWTSTAMP BIT(13)#define FLAG2_CHECK_SYSTIM_OVERFLOW BIT(14)#define FLAG2_ENABLE_S0IX_FLOWS BIT(15) +#define FLAG2_DISABLE_K1 BIT(16)#define E1000_RX_DESC_PS (R , i) \ (&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))drivers/net/ethernet/intel/e1000e/ethtool.c +40
-5@@ -26,6 +26,8 @@ struct e1000_stats {static const char e1000e_priv_flags_strings[][ETH_GSTRING_LEN ] = { #define E1000E_PRIV_FLAGS_S0IX_ENABLED BIT(0)"s0ix-enabled" , +#define E1000E_PRIV_FLAGS_DISABLE_K1 BIT(1) +"disable-k1" , };#define E1000E_PRIV_FLAGS_STR_LEN ARRAY_SIZE(e1000e_priv_flags_strings)@@ -2297,26 +2299,59 @@ static u32 e1000e_get_priv_flags(struct net_device *netdev)if (adapter->flags2 &FLAG2_ENABLE_S0IX_FLOWS ) priv_flags |=E1000E_PRIV_FLAGS_S0IX_ENABLED ; +if (adapter->flags2 &FLAG2_DISABLE_K1 ) + priv_flags |=E1000E_PRIV_FLAGS_DISABLE_K1 ; +return priv_flags; }static int e1000e_set_priv_flags (struct net_device *netdev,u32 priv_flags) {struct e1000_adapter *adapter =netdev_priv (netdev); +struct e1000_hw *hw = &adapter->hw;unsigned int flags2 = adapter->flags2; +unsigned int changed; - flags2 &= ~FLAG2_ENABLE_S0IX_FLOWS ; -if (priv_flags &E1000E_PRIV_FLAGS_S0IX_ENABLED ) { -struct e1000_hw *hw = &adapter->hw; + flags2 &= ~(FLAG2_ENABLE_S0IX_FLOWS |FLAG2_DISABLE_K1 ); -if (hw->mac.type < e1000_pch_cnp) +if (priv_flags &E1000E_PRIV_FLAGS_S0IX_ENABLED ) { +if (hw->mac.type < e1000_pch_cnp) { +e_err ("S0ix is not supported on this device\n" );return -EINVAL ; + } + flags2 |=FLAG2_ENABLE_S0IX_FLOWS ; } -if (flags2 != adapter->flags2) +if (priv_flags &E1000E_PRIV_FLAGS_DISABLE_K1 ) { +if (hw->mac.type < e1000_ich8lan) { +e_err ("Disabling K1 is not supported on this device\n" ); +return -EINVAL ; + } + + flags2 |=FLAG2_DISABLE_K1 ; + } + + changed = adapter->flags2 ^ flags2; +if (changed) adapter->flags2 = flags2; +if (changed &FLAG2_DISABLE_K1 ) { +/* reset the hardware to apply the changes */ +while (test_and_set_bit (__E1000_RESETTING, + &adapter->state)) +usleep_range (1000 ,2000 ); + +if (netif_running (adapter->netdev)) { +e1000e_down (adapter, true); +e1000e_up (adapter); + }else { +e1000e_reset (adapter); + } + +clear_bit (__E1000_RESETTING, &adapter->state); + } +return 0 ; }drivers/net/ethernet/intel/e1000e/ich8lan.c +23
-18@@ -286,21 +286,26 @@ static void e1000_toggle_lanphypc_pch_lpt(struct e1000_hw *hw) }/** -* e1000_reconfigure_k1_exit_timeout - reconfigure K1 exit timeout to -* align to MTP and later platform requirements. +* e1000_reconfigure_k1_params - reconfigure Kumeran K1 parameters. * @hw: pointer to the HW structure * +* By default K1 is enabled after MAC reset, so this function only +* disables it. +* * Context: PHY semaphore must be held by caller. * Return: 0 on success, negative on failure */ -static s32 e1000_reconfigure_k1_exit_timeout (struct e1000_hw *hw) +s32 e1000_reconfigure_k1_params (struct e1000_hw *hw) {u16 phy_timeout;u32 fextnvm12;s32 ret_val; -if (hw->mac.type < e1000_pch_mtp) +if (hw->mac.type < e1000_pch_mtp) { +if (hw->adapter->flags2 &FLAG2_DISABLE_K1 ) +return e1000_configure_k1_ich8lan (hw, false);return 0 ; + }/* Change Kumeran K1 power down state from P0s to P1 */ fextnvm12 =er32 (FEXTNVM12 );@@ -310,6 +315,8 @@ static s32 e1000_reconfigure_k1_exit_timeout(struct e1000_hw *hw)/* Wait for the interface the settle */ usleep_range (1000 ,1100 ); +if (hw->adapter->flags2 &FLAG2_DISABLE_K1 ) +return e1000_configure_k1_ich8lan (hw, false);/* Change K1 exit timeout */ ret_val = e1e_rphy_locked(hw, I217_PHY_TIMEOUTS_REG,@@ -373,8 +380,8 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw)/* At this point the PHY might be inaccessible so don't * propagate the failure */ -if (e1000_reconfigure_k1_exit_timeout (hw)) -e_dbg ("Failed to reconfigure K1 exit timeout\n" ); +if (e1000_reconfigure_k1_params (hw)) +e_dbg ("Failed to reconfigure K1 parameters\n" ); fallthrough;case e1000_pch_lpt:@@ -473,10 +480,10 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw)if (hw->mac.type >= e1000_pch_mtp) { ret_val = hw->phy.ops.acquire (hw);if (ret_val) { -e_err ("Failed to reconfigure K1 exit timeout\n" ); +e_err ("Failed to reconfigure K1 parameters\n" ); goto out; } - ret_val =e1000_reconfigure_k1_exit_timeout (hw); + ret_val =e1000_reconfigure_k1_params (hw); hw->phy.ops.release (hw); } }@@ -4948,17 +4955,15 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw)u16 i;e1000_initialize_hw_bits_ich8lan (hw); -if (hw->mac.type >= e1000_pch_mtp) { - ret_val = hw->phy.ops.acquire (hw); -if (ret_val) -return ret_val; + ret_val = hw->phy.ops.acquire (hw); +if (ret_val) +return ret_val; - ret_val =e1000_reconfigure_k1_exit_timeout (hw); - hw->phy.ops.release (hw); -if (ret_val) { -e_dbg ("Error failed to reconfigure K1 exit timeout\n" ); -return ret_val; - } + ret_val =e1000_reconfigure_k1_params (hw); + hw->phy.ops.release (hw); +if (ret_val) { +e_dbg ("Error failed to reconfigure K1 parameters\n" ); +return ret_val; }/* Initialize identification LED */ drivers/net/ethernet/intel/e1000e/ich8lan.h +2
-0@@ -310,4 +310,6 @@ s32 e1000_read_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 *data);s32 e1000_write_emi_reg_locked (struct e1000_hw *hw,u16 addr,u16 data);s32 e1000_set_eee_pchlan (struct e1000_hw *hw);s32 e1000_enable_ulp_lpt_lp (struct e1000_hw *hw,bool to_sx); +s32 e1000_reconfigure_k1_params (struct e1000_hw *hw); +#endif /* _E1000E_ICH8LAN_H_ */ drivers/net/ethernet/intel/e1000e/netdev.c +3
-1@@ -7675,6 +7675,9 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)/* init PTP hardware clock */ e1000e_ptp_init (adapter); +if (hw->mac.type >= e1000_pch_mtp) + adapter->flags2 |=FLAG2_DISABLE_K1 ; +/* reset the hardware with the new settings */ e1000e_reset (adapter); --
Quoted 2 lines
2.34.1
---------------------------------------------------------------------
Intel Israel (74) Limited
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
Quoted 48 lines · On Mon, 8 Sep 2025 11:05:52 +0300 Vitaly Lifshits <[email protected]>…
The K1 state reduces power consumption on ICH family network controllers during idle periods, similarly to L1 state on PCI Express NICs. Therefore, it is recommended and enabled by default.
However, on some systems it has been observed to have adverse side effects, such as packet loss. It has been established through debug that the problem may be due to firmware misconfiguration of specific systems, interoperability with certain link partners, or marginal electrical conditions of specific units.These problems typically cannot be fixed in the field, and generic workarounds to resolve the side effects on all systems, while keeping K1 enabled, were found infeasible.
Therefore, add the option for users to globally disable K1 idle state on the adapter.Additionally, disable K1 by default for MTL and later platforms, due to issues reported with the current configuration.
Signed-off-by Vitaly Lifshits <[email protected]>---
v3: Removed disabling K1 inwatchdog_taskand change the private flag setting
v2: Add a missing semaphore acquiring and disable K1 on MTL by default--- drivers/net/ethernet/intel/e1000e/e1000.h | 1 + drivers/net/ethernet/intel/e1000e/ethtool.c | 45 ++++++++++++++++++--- drivers/net/ethernet/intel/e1000e/ich8lan.c | 41 ++++++++++--------- drivers/net/ethernet/intel/e1000e/ich8lan.h | 2 + drivers/net/ethernet/intel/e1000e/netdev.c | 3 ++ 5 files changed, 69 insertions(+), 23 deletions(-)[snip]
drivers/net/ethernet/intel/e1000e/ich8lan.c +1
-2@@ -286,21 +286,26 @@ static void e1000_toggle_lanphypc_pch_lpt(struct e1000_hw *hw) }/** -* e1000_reconfigure_k1_exit_timeout - reconfigure K1 exit timeout to -* align to MTP and later platform requirements. +* e1000_reconfigure_k1_params - reconfigure Kumeran K1 parameters.
drivers/net/ethernet/intel/e1000e/ich8lan.c static void e1000_toggle_lanphypc_pch_lpt(struct e1000_hw *hw) · line 298
Quoted 10 lines
drivers/net/ethernet/intel/e1000e/ich8lan.c +4
-1* @hw: pointer to the HW structure * +* By default K1 is enabled after MAC reset, so this function only +* disables it. +* * Context: PHY semaphore must be held by caller. * Return: 0 on success, negative on failure */ -static s32 e1000_reconfigure_k1_exit_timeout (struct e1000_hw *hw) +s32 e1000_reconfigure_k1_params (struct e1000_hw *hw)
I believe this function is no longer used outside this compilation unit in the v3. So this could be left 'static' now.
Quoted 19 lines
drivers/net/ethernet/intel/e1000e/ich8lan.c +4
-1{u16 phy_timeout;u32 fextnvm12;s32 ret_val; -if (hw->mac.type < e1000_pch_mtp) +if (hw->mac.type < e1000_pch_mtp) { +if (hw->adapter->flags2 &FLAG2_DISABLE_K1 ) +return e1000_configure_k1_ich8lan (hw, false);return 0 ; + }/* Change Kumeran K1 power down state from P0s to P1 */ fextnvm12 =er32 (FEXTNVM12 );drivers/net/ethernet/intel/e1000e/ich8lan.h +0
-0
drivers/net/ethernet/intel/e1000e/ich8lan.h s32 e1000_read_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 *data); · line 314
Quoted 5 lines
drivers/net/ethernet/intel/e1000e/ich8lan.h +2
-0@@ -310,4 +310,6 @@ s32 e1000_read_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 *data);s32 e1000_write_emi_reg_locked (struct e1000_hw *hw,u16 addr,u16 data);s32 e1000_set_eee_pchlan (struct e1000_hw *hw);s32 e1000_enable_ulp_lpt_lp (struct e1000_hw *hw,bool to_sx); +s32 e1000_reconfigure_k1_params (struct e1000_hw *hw); +
And this hunk can be removed.
drivers/net/ethernet/intel/e1000e/ich8lan.h s32 e1000_read_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 *data); · line 315
Quoted 1 line
drivers/net/ethernet/intel/e1000e/ich8lan.h +0
-0#endif /* _E1000E_ICH8LAN_H_ */
I also tested against regression on my affected machine and this indeed fixes the issues. (I did not get to test the ethtool flag functionality.)
Once the above minor issue is resolved, you can add: