aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2008-12-05 20:08:00 +0000
committerGabor Juhos <juhosg@openwrt.org>2008-12-05 20:08:00 +0000
commitfcbd66fef1f3767f22e895d879db0062613c4f7e (patch)
treeeb2c2f5d20c32779e670f02103cff7e9bc4c1ccf
parenta6be4564b7976066e67eed6ed91a123b2e9d519f (diff)
downloadupstream-fcbd66fef1f3767f22e895d879db0062613c4f7e.tar.gz
upstream-fcbd66fef1f3767f22e895d879db0062613c4f7e.tar.bz2
upstream-fcbd66fef1f3767f22e895d879db0062613c4f7e.zip
ag71xx driver: improve poll routine
SVN-Revision: 13525
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h2
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c27
2 files changed, 12 insertions, 17 deletions
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
index cddf3a0729..c4a7044af4 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
@@ -37,7 +37,7 @@
#define ETH_FCS_LEN 4
#define AG71XX_DRV_NAME "ag71xx"
-#define AG71XX_DRV_VERSION "0.5.8"
+#define AG71XX_DRV_VERSION "0.5.9"
#define AG71XX_NAPI_TX 1
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
index 16dc0297c0..5e31438b30 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
@@ -624,6 +624,8 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit)
break;
}
+ ag71xx_wr(ag, AG71XX_REG_RX_STATUS, RX_STATUS_PR);
+
skb = ring->buf[i].skb;
pktlen = ag71xx_desc_pktlen(desc);
pktlen -= ETH_FCS_LEN;
@@ -643,8 +645,6 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit)
ring->buf[i].skb = NULL;
done++;
- ag71xx_wr(ag, AG71XX_REG_RX_STATUS, RX_STATUS_PR);
-
ring->curr++;
if ((ring->curr - ring->dirty) > (AG71XX_RX_RING_SIZE / 4))
ag71xx_ring_rx_refill(ag);
@@ -679,10 +679,16 @@ static int ag71xx_poll(struct napi_struct *napi, int limit)
/* TODO: add OOM handler */
- status = ag71xx_rr(ag, AG71XX_REG_INT_STATUS);
- status &= AG71XX_INT_POLL;
+ status = ag71xx_rr(ag, AG71XX_REG_RX_STATUS);
+ if (unlikely(status & RX_STATUS_OF)) {
+ ag71xx_wr(ag, AG71XX_REG_RX_STATUS, RX_STATUS_OF);
+ dev->stats.rx_fifo_errors++;
+
+ /* restart RX */
+ ag71xx_wr(ag, AG71XX_REG_RX_CTRL, RX_CTRL_RXE);
+ }
- if ((done < limit) && (!status)) {
+ if ((done < limit) && ((status & RX_STATUS_PR) == 0)) {
DBG("%s: disable polling mode, done=%d, status=%x\n",
dev->name, done, status);
@@ -695,17 +701,6 @@ static int ag71xx_poll(struct napi_struct *napi, int limit)
return 0;
}
- if (status & AG71XX_INT_RX_OF) {
- if (netif_msg_rx_err(ag))
- printk(KERN_ALERT "%s: rx owerflow, restarting dma\n",
- dev->name);
-
- /* ack interrupt */
- ag71xx_wr(ag, AG71XX_REG_RX_STATUS, RX_STATUS_OF);
- /* restart RX */
- ag71xx_wr(ag, AG71XX_REG_RX_CTRL, RX_CTRL_RXE);
- }
-
DBG("%s: stay in polling mode, done=%d, status=%x\n",
dev->name, done, status);
return 1;