Commit e22c770b authored by Punit Agrawal's avatar Punit Agrawal Committed by Khalid Elmously

e1000e: Relax condition to trigger reset for ME workaround

BugLink: https://bugs.launchpad.net/bugs/1884564

commit d601afca upstream.

It's an error if the value of the RX/TX tail descriptor does not match
what was written. The error condition is true regardless the duration
of the interference from ME. But the driver only performs the reset if
E1000_ICH_FWSM_PCIM2PCI_COUNT (2000) iterations of 50us delay have
transpired. The extra condition can lead to inconsistency between the
state of hardware as expected by the driver.

Fix this by dropping the check for number of delay iterations.

While at it, also make __ew32_prepare() static as it's not used
anywhere else.

CC: stable <stable@vger.kernel.org>
Signed-off-by: default avatarPunit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: default avatarAlexander Duyck <alexander.h.duyck@linux.intel.com>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 68220817
...@@ -585,7 +585,6 @@ static inline u32 __er32(struct e1000_hw *hw, unsigned long reg) ...@@ -585,7 +585,6 @@ static inline u32 __er32(struct e1000_hw *hw, unsigned long reg)
#define er32(reg) __er32(hw, E1000_##reg) #define er32(reg) __er32(hw, E1000_##reg)
s32 __ew32_prepare(struct e1000_hw *hw);
void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val); void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val);
#define ew32(reg, val) __ew32(hw, E1000_##reg, (val)) #define ew32(reg, val) __ew32(hw, E1000_##reg, (val))
......
...@@ -136,14 +136,12 @@ static const struct e1000_reg_info e1000_reg_info_tbl[] = { ...@@ -136,14 +136,12 @@ static const struct e1000_reg_info e1000_reg_info_tbl[] = {
* has bit 24 set while ME is accessing MAC CSR registers, wait if it is set * has bit 24 set while ME is accessing MAC CSR registers, wait if it is set
* and try again a number of times. * and try again a number of times.
**/ **/
s32 __ew32_prepare(struct e1000_hw *hw) static void __ew32_prepare(struct e1000_hw *hw)
{ {
s32 i = E1000_ICH_FWSM_PCIM2PCI_COUNT; s32 i = E1000_ICH_FWSM_PCIM2PCI_COUNT;
while ((er32(FWSM) & E1000_ICH_FWSM_PCIM2PCI) && --i) while ((er32(FWSM) & E1000_ICH_FWSM_PCIM2PCI) && --i)
udelay(50); udelay(50);
return i;
} }
void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val) void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val)
...@@ -624,11 +622,11 @@ static void e1000e_update_rdt_wa(struct e1000_ring *rx_ring, unsigned int i) ...@@ -624,11 +622,11 @@ static void e1000e_update_rdt_wa(struct e1000_ring *rx_ring, unsigned int i)
{ {
struct e1000_adapter *adapter = rx_ring->adapter; struct e1000_adapter *adapter = rx_ring->adapter;
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
s32 ret_val = __ew32_prepare(hw);
__ew32_prepare(hw);
writel(i, rx_ring->tail); writel(i, rx_ring->tail);
if (unlikely(!ret_val && (i != readl(rx_ring->tail)))) { if (unlikely(i != readl(rx_ring->tail))) {
u32 rctl = er32(RCTL); u32 rctl = er32(RCTL);
ew32(RCTL, rctl & ~E1000_RCTL_EN); ew32(RCTL, rctl & ~E1000_RCTL_EN);
...@@ -641,11 +639,11 @@ static void e1000e_update_tdt_wa(struct e1000_ring *tx_ring, unsigned int i) ...@@ -641,11 +639,11 @@ static void e1000e_update_tdt_wa(struct e1000_ring *tx_ring, unsigned int i)
{ {
struct e1000_adapter *adapter = tx_ring->adapter; struct e1000_adapter *adapter = tx_ring->adapter;
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
s32 ret_val = __ew32_prepare(hw);
__ew32_prepare(hw);
writel(i, tx_ring->tail); writel(i, tx_ring->tail);
if (unlikely(!ret_val && (i != readl(tx_ring->tail)))) { if (unlikely(i != readl(tx_ring->tail))) {
u32 tctl = er32(TCTL); u32 tctl = er32(TCTL);
ew32(TCTL, tctl & ~E1000_TCTL_EN); ew32(TCTL, tctl & ~E1000_TCTL_EN);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment