Skip to content

Commit

Permalink
e1000e: Relax condition to trigger reset for ME workaround
Browse files Browse the repository at this point in the history
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: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
  • Loading branch information
Punit Agrawal authored and Jeff Kirsher committed May 29, 2020
1 parent e087d3b commit d601afc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion drivers/net/ethernet/intel/e1000e/e1000.h
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,6 @@ static inline u32 __er32(struct e1000_hw *hw, unsigned long 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);

#define ew32(reg, val) __ew32(hw, E1000_##reg, (val))
Expand Down
12 changes: 5 additions & 7 deletions drivers/net/ethernet/intel/e1000e/netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,12 @@ static bool e1000e_check_me(u16 device_id)
* has bit 24 set while ME is accessing MAC CSR registers, wait if it is set
* 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;

while ((er32(FWSM) & E1000_ICH_FWSM_PCIM2PCI) && --i)
udelay(50);

return i;
}

void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val)
Expand Down Expand Up @@ -646,11 +644,11 @@ static void e1000e_update_rdt_wa(struct e1000_ring *rx_ring, unsigned int i)
{
struct e1000_adapter *adapter = rx_ring->adapter;
struct e1000_hw *hw = &adapter->hw;
s32 ret_val = __ew32_prepare(hw);

__ew32_prepare(hw);
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);

ew32(RCTL, rctl & ~E1000_RCTL_EN);
Expand All @@ -663,11 +661,11 @@ static void e1000e_update_tdt_wa(struct e1000_ring *tx_ring, unsigned int i)
{
struct e1000_adapter *adapter = tx_ring->adapter;
struct e1000_hw *hw = &adapter->hw;
s32 ret_val = __ew32_prepare(hw);

__ew32_prepare(hw);
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);

ew32(TCTL, tctl & ~E1000_TCTL_EN);
Expand Down

0 comments on commit d601afc

Please sign in to comment.