From: Stephen Hemminger <shemminger@linux-foundation.org>
To: David Miller <davem@davemloft.net>, Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@vger.kernel.org
Subject: [PATCH 2/7] sky2: status ring race fix
Date: Mon, 05 Nov 2007 15:52:09 -0800 [thread overview]
Message-ID: <20071105235340.034607403@linux-foundation.org> (raw)
In-Reply-To: 20071105235207.799504040@linux-foundation.org
[-- Attachment #1: sky2-status-check.patch --]
[-- Type: text/plain, Size: 1525 bytes --]
The D-Link PCI-X board (and maybe others) can lie about status
ring entries. It seems it will update the register for last status
index before completing the DMA for the ring entry. To avoid reading
stale data, zap the old entry and check.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/drivers/net/sky2.c 2007-11-05 15:01:44.000000000 -0800
+++ b/drivers/net/sky2.c 2007-11-05 15:04:55.000000000 -0800
@@ -2247,20 +2247,26 @@ static int sky2_status_intr(struct sky2_
do {
struct sky2_port *sky2;
struct sky2_status_le *le = hw->st_le + hw->st_idx;
- unsigned port = le->css & CSS_LINK_BIT;
+ unsigned port;
struct net_device *dev;
struct sk_buff *skb;
u32 status;
u16 length;
+ u8 opcode = le->opcode;
+
+ if (!(opcode & HW_OWNER))
+ break;
hw->st_idx = RING_NEXT(hw->st_idx, STATUS_RING_SIZE);
+ port = le->css & CSS_LINK_BIT;
dev = hw->dev[port];
sky2 = netdev_priv(dev);
length = le16_to_cpu(le->length);
status = le32_to_cpu(le->status);
- switch (le->opcode & ~HW_OWNER) {
+ le->opcode = 0;
+ switch (opcode & ~HW_OWNER) {
case OP_RXSTAT:
++rx[port];
skb = sky2_receive(dev, length, status);
@@ -2353,7 +2359,7 @@ static int sky2_status_intr(struct sky2_
default:
if (net_ratelimit())
printk(KERN_WARNING PFX
- "unknown status opcode 0x%x\n", le->opcode);
+ "unknown status opcode 0x%x\n", opcode);
}
} while (hw->st_idx != idx);
--
Stephen Hemminger <shemminger@linux-foundation.org>
next prev parent reply other threads:[~2007-11-05 23:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-05 23:52 [PATCH 0/7] sky2: update for 2.6.24-rc2 Stephen Hemminger
2007-11-05 23:52 ` [PATCH 1/7] sky2: enable PCI config writes Stephen Hemminger
2007-11-06 17:41 ` Jeff Garzik
2007-11-05 23:52 ` Stephen Hemminger [this message]
2007-11-05 23:52 ` [PATCH 3/7] sky2: longer PHY delay Stephen Hemminger
2007-11-05 23:52 ` [PATCH 4/7] sky2: dont change LED after autoneg Stephen Hemminger
2007-11-05 23:52 ` [PATCH 5/7] sky2: remove unneeded mask update Stephen Hemminger
2007-11-05 23:52 ` [PATCH 6/7] sky2: handle advanced error recovery config issues Stephen Hemminger
2007-11-05 23:52 ` [PATCH 7/7] sky2: version 1.20 Stephen Hemminger
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=20071105235340.034607403@linux-foundation.org \
--to=shemminger@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=jgarzik@pobox.com \
--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).