Commit 74ecc62d authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

bnx2: Refine remote PHY locking.

bnx2_set_remote_link() should be called under bp->phy_lock to protect
against concurrent polling and interrupt calls.  This change is needed
by the next patch which will add one initial poll of the remote PHY
link status.
Signed-off-by: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarBenjamin Li <benli@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ae4f8fca
...@@ -1717,7 +1717,6 @@ bnx2_remote_phy_event(struct bnx2 *bp) ...@@ -1717,7 +1717,6 @@ bnx2_remote_phy_event(struct bnx2 *bp)
break; break;
} }
spin_lock(&bp->phy_lock);
bp->flow_ctrl = 0; bp->flow_ctrl = 0;
if ((bp->autoneg & (AUTONEG_SPEED | AUTONEG_FLOW_CTRL)) != if ((bp->autoneg & (AUTONEG_SPEED | AUTONEG_FLOW_CTRL)) !=
(AUTONEG_SPEED | AUTONEG_FLOW_CTRL)) { (AUTONEG_SPEED | AUTONEG_FLOW_CTRL)) {
...@@ -1739,7 +1738,6 @@ bnx2_remote_phy_event(struct bnx2 *bp) ...@@ -1739,7 +1738,6 @@ bnx2_remote_phy_event(struct bnx2 *bp)
if (old_port != bp->phy_port) if (old_port != bp->phy_port)
bnx2_set_default_link(bp); bnx2_set_default_link(bp);
spin_unlock(&bp->phy_lock);
} }
if (bp->link_up != link_up) if (bp->link_up != link_up)
bnx2_report_link(bp); bnx2_report_link(bp);
...@@ -2447,14 +2445,15 @@ bnx2_phy_event_is_set(struct bnx2 *bp, struct bnx2_napi *bnapi, u32 event) ...@@ -2447,14 +2445,15 @@ bnx2_phy_event_is_set(struct bnx2 *bp, struct bnx2_napi *bnapi, u32 event)
static void static void
bnx2_phy_int(struct bnx2 *bp, struct bnx2_napi *bnapi) bnx2_phy_int(struct bnx2 *bp, struct bnx2_napi *bnapi)
{ {
if (bnx2_phy_event_is_set(bp, bnapi, STATUS_ATTN_BITS_LINK_STATE)) { spin_lock(&bp->phy_lock);
spin_lock(&bp->phy_lock);
if (bnx2_phy_event_is_set(bp, bnapi, STATUS_ATTN_BITS_LINK_STATE))
bnx2_set_link(bp); bnx2_set_link(bp);
spin_unlock(&bp->phy_lock);
}
if (bnx2_phy_event_is_set(bp, bnapi, STATUS_ATTN_BITS_TIMER_ABORT)) if (bnx2_phy_event_is_set(bp, bnapi, STATUS_ATTN_BITS_TIMER_ABORT))
bnx2_set_remote_link(bp); bnx2_set_remote_link(bp);
spin_unlock(&bp->phy_lock);
} }
static inline u16 static inline u16
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment