Skip to content

Commit c60b1f4

Browse files
authored
e1000: Do not perform reset in reset_task if we are already down (sonic-net#148)
Signed-off-by: Guohan Lu <[email protected]>
1 parent c6aeedd commit c60b1f4

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
From 49ee3c2ab5234757bfb56a0b3a3cb422f427e3a3 Mon Sep 17 00:00:00 2001
2+
From: Alexander Duyck <[email protected]>
3+
Date: Fri, 17 Apr 2020 09:35:31 -0700
4+
Subject: [PATCH] e1000: Do not perform reset in reset_task if we are already
5+
down
6+
7+
We are seeing a deadlock in e1000 down when NAPI is being disabled. Looking
8+
over the kernel function trace of the system it appears that the interface
9+
is being closed and then a reset is hitting which deadlocks the interface
10+
as the NAPI interface is already disabled.
11+
12+
To prevent this from happening I am disabling the reset task when
13+
__E1000_DOWN is already set. In addition code has been added so that we set
14+
the __E1000_DOWN while holding the __E1000_RESET flag in e1000_close in
15+
order to guarantee that the reset task will not run after we have started
16+
the close call.
17+
18+
Signed-off-by: Alexander Duyck <[email protected]>
19+
Tested-by: Maxim Zhukov <[email protected]>
20+
Signed-off-by: Jeff Kirsher <[email protected]>
21+
---
22+
drivers/net/ethernet/intel/e1000/e1000_main.c | 18 ++++++++++++++----
23+
1 file changed, 14 insertions(+), 4 deletions(-)
24+
25+
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
26+
index 05bc6e216bca..d9fa4600f745 100644
27+
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
28+
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
29+
@@ -542,8 +542,13 @@ void e1000_reinit_locked(struct e1000_adapter *adapter)
30+
WARN_ON(in_interrupt());
31+
while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))
32+
msleep(1);
33+
- e1000_down(adapter);
34+
- e1000_up(adapter);
35+
+
36+
+ /* only run the task if not already down */
37+
+ if (!test_bit(__E1000_DOWN, &adapter->flags)) {
38+
+ e1000_down(adapter);
39+
+ e1000_up(adapter);
40+
+ }
41+
+
42+
clear_bit(__E1000_RESETTING, &adapter->flags);
43+
}
44+
45+
@@ -1433,10 +1438,15 @@ int e1000_close(struct net_device *netdev)
46+
struct e1000_hw *hw = &adapter->hw;
47+
int count = E1000_CHECK_RESET_COUNT;
48+
49+
- while (test_bit(__E1000_RESETTING, &adapter->flags) && count--)
50+
+ while (test_and_set_bit(__E1000_RESETTING, &adapter->flags) && count--)
51+
usleep_range(10000, 20000);
52+
53+
- WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags));
54+
+ WARN_ON(count < 0);
55+
+
56+
+ /* signal that we're down so that the reset task will no longer run */
57+
+ set_bit(__E1000_DOWN, &adapter->flags);
58+
+ clear_bit(__E1000_RESETTING, &adapter->flags);
59+
+
60+
e1000_down(adapter);
61+
e1000_power_down_phy(adapter);
62+
e1000_free_irq(adapter);
63+
--
64+
2.17.1
65+

patch/series

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ driver-support-optoe-EOF_fix.patch
3030
driver-support-optoe-chunk-offset-fix.patch
3131
driver-support-optoe-QSFP_DD.patch
3232
driver-net-tg3-add-param-short-preamble-and-reset.patch
33+
e1000-Do-not-perform-reset-in-reset_task-if-we-are-a.patch
3334
# (Marvel)
3435
# 0042-Marvell-a385-Micron-4G-flash-support.patch
3536
# 0042-armhf-additional-configs.patch

0 commit comments

Comments
 (0)