[PATCH net 3/5] bnx2x: prevent race between undi_unload and load flows

Subsystems: networking drivers, the rest

STALE5544d

2 messages, 2 authors, 2011-08-11 · open the first message on its own page

[PATCH net 3/5] bnx2x: prevent race between undi_unload and load flows

From: Dmitry Kravkov <hidden>
Date: 2011-08-09 13:14:20


Signed-off-by: Dmitry Kravkov <redacted>
Signed-off-by: Eilon Greenstein <redacted>
---
 drivers/net/bnx2x/bnx2x_main.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index 1507091..1f5467f 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -5798,6 +5798,12 @@ static int bnx2x_init_hw_common(struct bnx2x *bp)
 
 	DP(BNX2X_MSG_MCP, "starting common init  func %d\n", BP_ABS_FUNC(bp));
 
+	/*
+	 * take the UNDI lock to protect undi_unload flow from accessing
+	 * registers while we're resetting the chip
+	 */
+	bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_UNDI);
+
 	bnx2x_reset_common(bp);
 	REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 0xffffffff);
 
@@ -5808,6 +5814,8 @@ static int bnx2x_init_hw_common(struct bnx2x *bp)
 	}
 	REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET, val);
 
+	bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_UNDI);
+
 	bnx2x_init_block(bp, BLOCK_MISC, PHASE_COMMON);
 
 	if (!CHIP_IS_E1x(bp)) {
-- 
1.7.2.2



Re: [PATCH net 3/5] bnx2x: prevent race between undi_unload and load flows

From: David Miller <davem@davemloft.net>
Date: 2011-08-11 14:26:50

From: "Dmitry Kravkov" <redacted>
Date: Tue, 9 Aug 2011 16:09:52 +0300
Signed-off-by: Dmitry Kravkov <redacted>
Signed-off-by: Eilon Greenstein <redacted>
Applied.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help