From: Andreas Oberritter <obi@linuxtv.org>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: Jeff Garzik <jgarzik@pobox.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2] 8139too: move wmb before TX DMA start
Date: Wed, 08 Oct 2008 18:14:16 +0200 [thread overview]
Message-ID: <48ECDC58.1020603@linuxtv.org> (raw)
In-Reply-To: <20081008101558.GH7331@solarflare.com>
From: Andreas Oberritter <obi@linuxtv.org>
The write barrier should be used before starting a DMA transfer. This fixes
a problem, where almost all packets received on another machine had garbled
content. Tested with an RTL8100C on a MIPS machine.
Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
---
Added a comment on Ben's request explaining the reason for the barrier.
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 53bd903..3c5fac6 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -1716,13 +1716,18 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev)
}
spin_lock_irqsave(&tp->lock, flags);
+ /*
+ * Writing to TxStatus triggers a DMA transfer of the data
+ * copied to tp->tx_buf[entry] above. Use a memory barrier
+ * to make sure that the device sees the updated data.
+ */
+ wmb();
RTL_W32_F (TxStatus0 + (entry * sizeof (u32)),
tp->tx_flag | max(len, (unsigned int)ETH_ZLEN));
dev->trans_start = jiffies;
tp->cur_tx++;
- wmb();
if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx)
netif_stop_queue (dev);
prev parent reply other threads:[~2008-10-08 16:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-08 7:44 [PATCH] 8139too: move wmb before TX DMA start Andreas Oberritter
2008-10-08 10:16 ` Ben Hutchings
2008-10-08 16:14 ` Andreas Oberritter [this message]
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=48ECDC58.1020603@linuxtv.org \
--to=obi@linuxtv.org \
--cc=bhutchings@solarflare.com \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--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).