e1000e: PCIm function state support
Subsystems (2)
PATCH 1/1 e1000e: PCIm function state support
Due to commit: 5d8682588605 ("[misc] mei: me: allow runtime
pm for platform with D0i3")
When disconnecting the cable and reconnecting it the NIC enters DMoff state. This caused wring link indication and duplex mismatch. This bug is decribed in:
https://bugzilla.redhat.com/show_bug.cgi?id=1689436
Checking PCIm function state and performing PHY reset after a timeout in watchdog task solves this issue.
--- drivers/net/ethernet/intel/e1000e/defines.h | 3 +++ drivers/net/ethernet/intel/e1000e/netdev.c | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/e1000e/defines.h +3 -0
@@ -222,6 +222,9 @@#define E1000_STATUS_PHYRA 0x00000400/* PHY Reset Asserted */ #define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000/* Master Req status */ +/* PCIm function state */ +#define E1000_STATUS_PCIM_STATE 0x40000000 +#define HALF_DUPLEX 1#define FULL_DUPLEX 2
drivers/net/ethernet/intel/e1000e/netdev.c +17 -1
@@ -5173,8 +5173,9 @@ static void e1000_watchdog_task(struct work_struct *work)struct e1000_mac_info *mac = &adapter->hw.mac;struct e1000_phy_info *phy = &adapter->hw.phy;struct e1000_ring *tx_ring = adapter->tx_ring; +u32 dmoff_exit_timeout =100 , tries =0 ;struct e1000_hw *hw = &adapter->hw; -u32 link, tctl; +u32 link, tctl, pcim_state;if (test_bit (__E1000_DOWN, &adapter->state))return ;
@@ -5199,6 +5200,21 @@ static void e1000_watchdog_task(struct work_struct *work)/* Cancel scheduled suspend requests. */ pm_runtime_resume (netdev->dev.parent); +/* Checking if MAC is in DMoff state*/ + pcim_state =er32 (STATUS ); +while (pcim_state &E1000_STATUS_PCIM_STATE ) { +if (tries++ == dmoff_exit_timeout) { +e_dbg ("Error in exiting dmoff\n" ); +break ; + } +usleep_range (10000 ,20000 ); + pcim_state =er32 (STATUS ); + +/* Checking if MAC exited DMoff state */ +if (!(pcim_state &E1000_STATUS_PCIM_STATE )) +e1000_phy_hw_reset (&adapter->hw); + } +/* update snapshot of PHY registers on LSC */ e1000_phy_read_status (adapter); mac->ops.get_link_up_info(&adapter->hw,
Signature · 1 line
2.11.0
Neftin
PATCH 1/1 e1000e: PCIm function state support
Quoted 58 lines · Vitaly Lifshits
Due to commit:
5d8682588605("[misc] mei: me: allow runtime
pm for platform with D0i3")
When disconnecting the cable and reconnecting it the NIC enters DMoff state. This caused wring link indication and duplex mismatch. This bug is decribed in:
https://bugzilla.redhat.com/show_bug.cgi?id=1689436Checking PCIm function state and performing PHY reset after a timeout in watchdog task solves this issue.
Signed-off-by Vitaly Lifshits <[email protected]>--- drivers/net/ethernet/intel/e1000e/defines.h | 3 +++ drivers/net/ethernet/intel/e1000e/netdev.c | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-)drivers/net/ethernet/intel/e1000e/defines.h +3
-0@@ -222,6 +222,9 @@#define E1000_STATUS_PHYRA 0x00000400/* PHY Reset Asserted */ #define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000/* Master Req status */ +/* PCIm function state */ +#define E1000_STATUS_PCIM_STATE 0x40000000 +#define HALF_DUPLEX 1#define FULL_DUPLEX 2drivers/net/ethernet/intel/e1000e/netdev.c +10
-1@@ -5173,8 +5173,9 @@ static void e1000_watchdog_task(struct work_struct *work)struct e1000_mac_info *mac = &adapter->hw.mac;struct e1000_phy_info *phy = &adapter->hw.phy;struct e1000_ring *tx_ring = adapter->tx_ring; +u32 dmoff_exit_timeout =100 , tries =0 ;struct e1000_hw *hw = &adapter->hw; -u32 link, tctl; +u32 link, tctl, pcim_state;if (test_bit (__E1000_DOWN, &adapter->state))return ;@@ -5199,6 +5200,21 @@ static void e1000_watchdog_task(struct work_struct *work)/* Cancel scheduled suspend requests. */ pm_runtime_resume (netdev->dev.parent); +/* Checking if MAC is in DMoff state*/ + pcim_state =er32 (STATUS ); +while (pcim_state &E1000_STATUS_PCIM_STATE ) { +if (tries++ == dmoff_exit_timeout) { +e_dbg ("Error in exiting dmoff\n" ); +break ; + } +usleep_range (10000 ,20000 );
drivers/net/ethernet/intel/e1000e/netdev.c static void e1000_watchdog_task(struct work_struct *work) · line 5220
Quoted 10 lines
drivers/net/ethernet/intel/e1000e/netdev.c +7
-0+ pcim_state =er32 (STATUS ); + +/* Checking if MAC exited DMoff state */ +if (!(pcim_state &E1000_STATUS_PCIM_STATE )) +e1000_phy_hw_reset (&adapter->hw); + } +/* update snapshot of PHY registers on LSC */ e1000_phy_read_status (adapter); mac->ops.get_link_up_info(&adapter->hw,
Thanks Vitalik