From: Lucas Stach <dev@lynxeye.de>
To: barebox@lists.infradead.org
Subject: [PATCH] net: rtl8169: remove unnecessary cache maintenance
Date: Sun, 4 Jan 2015 22:09:05 +0100 [thread overview]
Message-ID: <1420405745-4408-1-git-send-email-dev@lynxeye.de> (raw)
The buffer descriptors are allocated from coherent memory, so there
is no cache maintenance needed. Only tell the compiler that the descriptors
can be modified by the hardware.
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
drivers/net/rtl8169.c | 24 +++++-------------------
1 file changed, 5 insertions(+), 19 deletions(-)
diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
index 5702900..19f5763 100644
--- a/drivers/net/rtl8169.c
+++ b/drivers/net/rtl8169.c
@@ -50,11 +50,11 @@ struct rtl8169_priv {
struct pci_dev *pci_dev;
int chipset;
- struct bufdesc *tx_desc;
+ volatile struct bufdesc *tx_desc;
void *tx_buf;
unsigned int cur_tx;
- struct bufdesc *rx_desc;
+ volatile struct bufdesc *rx_desc;
void *rx_buf;
unsigned int cur_rx;
@@ -250,10 +250,6 @@ static void rtl8169_init_ring(struct rtl8169_priv *priv)
priv->rx_desc[i].buf_addr =
virt_to_phys(priv->rx_buf + i * PKT_BUF_SIZE);
}
-
- dma_flush_range((unsigned long)priv->rx_desc,
- (unsigned long)priv->rx_desc +
- NUM_RX_DESC * sizeof(struct bufdesc));
}
static void rtl8169_hw_start(struct rtl8169_priv *priv)
@@ -386,14 +382,10 @@ static int rtl8169_eth_send(struct eth_device *edev, void *packet,
((packet_length > ETH_ZLEN) ? packet_length : ETH_ZLEN);
}
- dma_flush_range((unsigned long)&priv->tx_desc[entry],
- (unsigned long)&priv->tx_desc[entry + 1]);
-
RTL_W8(priv, TxPoll, 0x40);
- do {
- dma_inv_range((unsigned long)&priv->tx_desc[entry],
- (unsigned long)&priv->tx_desc[entry + 1]);
- } while (priv->tx_desc[entry].status & BD_STAT_OWN);
+
+ while (priv->tx_desc[entry].status & BD_STAT_OWN)
+ ;
priv->cur_tx++;
@@ -408,9 +400,6 @@ static int rtl8169_eth_rx(struct eth_device *edev)
entry = priv->cur_rx % NUM_RX_DESC;
- dma_inv_range((unsigned long)&priv->rx_desc[entry],
- (unsigned long)&priv->rx_desc[entry + 1]);
-
if ((priv->rx_desc[entry].status & BD_STAT_OWN) == 0) {
if (!(priv->rx_desc[entry].status & BD_STAT_RX_RES)) {
pkt_size = (priv->rx_desc[entry].status & 0x1fff) - 4;
@@ -441,9 +430,6 @@ static int rtl8169_eth_rx(struct eth_device *edev)
priv->rx_desc[entry].buf_addr =
virt_to_phys(priv->rx_buf +
entry * PKT_BUF_SIZE);
-
- dma_flush_range((unsigned long)&priv->rx_desc[entry],
- (unsigned long)&priv->rx_desc[entry + 1]);
} else {
dev_err(&edev->dev, "rx error\n");
}
--
2.1.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2015-01-04 21:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-04 21:09 Lucas Stach [this message]
2015-01-05 11:52 ` Sascha Hauer
2015-01-05 17:19 ` Antony Pavlov
2015-01-05 17:37 ` Lucas Stach
2015-01-06 10:56 ` Antony Pavlov
2015-01-06 11:11 ` Lucas Stach
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=1420405745-4408-1-git-send-email-dev@lynxeye.de \
--to=dev@lynxeye.de \
--cc=barebox@lists.infradead.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