Skip to content

Commit

Permalink
e1000: prevent oops when adapter is being closed and reset simultaneo…
Browse files Browse the repository at this point in the history
…usly

This change is based on a similar change made to e1000e support in
commit bb9e44d ("e1000e: prevent oops when adapter is being closed
and reset simultaneously").  The same issue has also been observed
on the older e1000 cards.

Here, we have increased the RESET_COUNT value to 50 because there are too
many accesses to e1000 nic on stress tests to e1000 nic, it is not enough
to set RESET_COUT 25. Experimentation has shown that it is enough to set
RESET_COUNT 50.

Signed-off-by: yzhu1 <yanjun.zhu@windriver.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
  • Loading branch information
yzhu1 authored and Jeff Kirsher committed Nov 30, 2013
1 parent 42ce412 commit 6a7d64e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/ethernet/intel/e1000/e1000.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ struct e1000_adapter;

#define E1000_MAX_INTR 10

/*
* Count for polling __E1000_RESET condition every 10-20msec.
*/
#define E1000_CHECK_RESET_COUNT 50

/* TX/RX descriptor defines */
#define E1000_DEFAULT_TXD 256
#define E1000_MAX_TXD 256
Expand Down
9 changes: 9 additions & 0 deletions drivers/net/ethernet/intel/e1000/e1000_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1440,6 +1440,10 @@ static int e1000_close(struct net_device *netdev)
{
struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
int count = E1000_CHECK_RESET_COUNT;

while (test_bit(__E1000_RESETTING, &adapter->flags) && count--)
usleep_range(10000, 20000);

WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags));
e1000_down(adapter);
Expand Down Expand Up @@ -4963,6 +4967,11 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake)
netif_device_detach(netdev);

if (netif_running(netdev)) {
int count = E1000_CHECK_RESET_COUNT;

while (test_bit(__E1000_RESETTING, &adapter->flags) && count--)
usleep_range(10000, 20000);

WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags));
e1000_down(adapter);
}
Expand Down

0 comments on commit 6a7d64e

Please sign in to comment.