mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
bnx2x: prevent race in statistics flow
The race may cause access of registers while MAC hw block is in reset state. As a result syslog will show error messages. We can prevent this by using state from local variable. Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
8304859adc
commit
4a025f49d3
1 changed files with 3 additions and 1 deletions
|
@ -1349,12 +1349,14 @@ void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event)
|
||||||
enum bnx2x_stats_state state;
|
enum bnx2x_stats_state state;
|
||||||
if (unlikely(bp->panic))
|
if (unlikely(bp->panic))
|
||||||
return;
|
return;
|
||||||
bnx2x_stats_stm[bp->stats_state][event].action(bp);
|
|
||||||
spin_lock_bh(&bp->stats_lock);
|
spin_lock_bh(&bp->stats_lock);
|
||||||
state = bp->stats_state;
|
state = bp->stats_state;
|
||||||
bp->stats_state = bnx2x_stats_stm[state][event].next_state;
|
bp->stats_state = bnx2x_stats_stm[state][event].next_state;
|
||||||
spin_unlock_bh(&bp->stats_lock);
|
spin_unlock_bh(&bp->stats_lock);
|
||||||
|
|
||||||
|
bnx2x_stats_stm[state][event].action(bp);
|
||||||
|
|
||||||
if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp))
|
if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp))
|
||||||
DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n",
|
DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n",
|
||||||
state, event, bp->stats_state);
|
state, event, bp->stats_state);
|
||||||
|
|
Loading…
Reference in a new issue