From: "Michael Chan" <mchan@broadcom.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: benli@broadcom.com, andy@greyhouse.net
Subject: [PATCH 1/6][BNX2]: Refine remote PHY locking.
Date: Wed, 30 Apr 2008 15:50:29 -0700 [thread overview]
Message-ID: <1209595829.7941.60.camel@dell> (raw)
[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: Michael Chan <mchan@broadcom.com>
Signed-off-by: Benjamin Li <benli@broadcom.com>
---
drivers/net/bnx2.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 15853be..284dda2 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -1715,7 +1715,6 @@ bnx2_remote_phy_event(struct bnx2 *bp)
break;
}
- spin_lock(&bp->phy_lock);
bp->flow_ctrl = 0;
if ((bp->autoneg & (AUTONEG_SPEED | AUTONEG_FLOW_CTRL)) !=
(AUTONEG_SPEED | AUTONEG_FLOW_CTRL)) {
@@ -1737,7 +1736,6 @@ bnx2_remote_phy_event(struct bnx2 *bp)
if (old_port != bp->phy_port)
bnx2_set_default_link(bp);
- spin_unlock(&bp->phy_lock);
}
if (bp->link_up != link_up)
bnx2_report_link(bp);
@@ -2445,14 +2443,15 @@ bnx2_phy_event_is_set(struct bnx2 *bp, struct bnx2_napi *bnapi, u32 event)
static void
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);
- spin_unlock(&bp->phy_lock);
- }
if (bnx2_phy_event_is_set(bp, bnapi, STATUS_ATTN_BITS_TIMER_ABORT))
bnx2_set_remote_link(bp);
+ spin_unlock(&bp->phy_lock);
+
}
static inline u16
--
1.5.5.GIT
next reply other threads:[~2008-04-30 21:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-30 22:50 Michael Chan [this message]
2008-05-02 23:58 ` [PATCH 1/6][BNX2]: Refine remote PHY locking David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1209595829.7941.60.camel@dell \
--to=mchan@broadcom.com \
--cc=andy@greyhouse.net \
--cc=benli@broadcom.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).