From: Sascha Hauer <s.hauer@pengutronix.de>
To: netdev@vger.kernel.org
Cc: Greg Ungerer <gerg@snapgear.com>,
frederic rodo <fred.rodo@gmail.com>,
Sascha Hauer <s.hauer@pengutronix.de>
Subject: [PATCH] fec: replace flush_dcache_range with dma_sync_single
Date: Tue, 27 Jan 2009 11:40:02 +0100 [thread overview]
Message-ID: <1233052804-31228-8-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1233052804-31228-7-git-send-email-s.hauer@pengutronix.de>
flush_dcache_range is not portable across architectures. Use
dma_sync_single instead. Also, the memory must be synchronised in the
receive path aswell.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/net/fec.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index f36ee43..6a54d1f 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -356,8 +356,8 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Push the data cache so the CPM does not get stale memory
* data.
*/
- flush_dcache_range((unsigned long)skb->data,
- (unsigned long)skb->data + skb->len);
+ dma_sync_single(NULL, bdp->cbd_bufaddr,
+ bdp->cbd_datlen, DMA_TO_DEVICE);
/* Send it on its way. Tell FEC it's ready, interrupt when done,
* it's the last BD of the frame, and to put the CRC on the end.
@@ -630,6 +630,9 @@ while (!((status = bdp->cbd_sc) & BD_ENET_RX_EMPTY)) {
dev->stats.rx_bytes += pkt_len;
data = (__u8*)__va(bdp->cbd_bufaddr);
+ dma_sync_single(NULL, (unsigned long)__pa(data),
+ pkt_len - 4, DMA_FROM_DEVICE);
+
/* This does 16 byte alignment, exactly what we need.
* The packet length includes FCS, but we don't want to
* include that when passing upstream as it messes up
--
1.5.6.5
next prev parent reply other threads:[~2009-01-27 10:42 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-27 10:39 FEC Patches Sascha Hauer
2009-01-27 10:39 ` [PATCH] fec: remove unused #else branches Sascha Hauer
2009-01-27 10:39 ` [PATCH] fec: remove empty functions Sascha Hauer
2009-01-27 10:39 ` [PATCH] fec: use linux/*.h instead of asm/*.h Sascha Hauer
2009-01-27 10:39 ` [PATCH] fec: do not use memcpy on physical addresses Sascha Hauer
2009-01-27 10:40 ` [PATCH] fec: use dma_alloc_coherent for descriptor ring Sascha Hauer
2009-01-27 10:40 ` [PATCH] fec: Fix KS8721BL_ICSR phy register offset Sascha Hauer
2009-01-27 10:40 ` Sascha Hauer [this message]
2009-01-27 10:40 ` [PATCH] fec: Add support for Freescale MX27 Sascha Hauer
2009-01-27 10:40 ` [PATCH] FEC: Turn FEC driver into platform device driver Sascha Hauer
2009-01-28 7:36 ` Greg Ungerer
2009-01-28 7:37 ` FEC Patches Greg Ungerer
2009-01-28 18:53 ` Sascha Hauer
2009-01-28 20:31 ` David Miller
2009-01-29 9:03 ` Sascha Hauer
2009-01-28 23:46 ` Greg Ungerer
-- strict thread matches above, loose matches on Subject: below --
2009-01-29 9:03 FEC patches Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: remove unused #else branches Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: remove empty functions Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: use linux/*.h instead of asm/*.h Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: do not use memcpy on physical addresses Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: use dma_alloc_coherent for descriptor ring Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: Fix KS8721BL_ICSR phy register offset Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: replace flush_dcache_range with dma_sync_single Sascha Hauer
[not found] <1233051848-5994-1-git-send-email-y>
[not found] ` <1233051848-5994-2-git-send-email-y>
[not found] ` <1233051848-5994-3-git-send-email-y>
[not found] ` <1233051848-5994-4-git-send-email-y>
[not found] ` <1233051848-5994-5-git-send-email-y>
[not found] ` <1233051848-5994-6-git-send-email-y>
[not found] ` <1233051848-5994-7-git-send-email-y>
2009-01-27 10:24 ` y
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=1233052804-31228-8-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=fred.rodo@gmail.com \
--cc=gerg@snapgear.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).