summaryrefslogtreecommitdiff
path: root/target/linux/ar71xx/files/drivers/net/ag71xx
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2008-12-07 09:46:41 +0000
committerGabor Juhos <juhosg@openwrt.org>2008-12-07 09:46:41 +0000
commitc33682316ecb98071d196c61762162143f8248b3 (patch)
tree7469ec3126cdec7367ed87d517718dbe8750e94c /target/linux/ar71xx/files/drivers/net/ag71xx
parent398ff859daa5943995a4f8d0cd95920069a42455 (diff)
downloadmtk-20170518-c33682316ecb98071d196c61762162143f8248b3.zip
mtk-20170518-c33682316ecb98071d196c61762162143f8248b3.tar.gz
mtk-20170518-c33682316ecb98071d196c61762162143f8248b3.tar.bz2
ag71xx driver: NAPI poll cleanup
SVN-Revision: 13538
Diffstat (limited to 'target/linux/ar71xx/files/drivers/net/ag71xx')
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h2
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c22
2 files changed, 16 insertions, 8 deletions
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
index d5f7743..80c8e18 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
@@ -38,7 +38,7 @@
#define ETH_FCS_LEN 4
#define AG71XX_DRV_NAME "ag71xx"
-#define AG71XX_DRV_VERSION "0.5.11"
+#define AG71XX_DRV_VERSION "0.5.12"
#define AG71XX_NAPI_WEIGHT 64
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 7818969..aa4730c 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
@@ -687,9 +687,16 @@ static int ag71xx_poll(struct napi_struct *napi, int limit)
ag71xx_wr(ag, AG71XX_REG_RX_CTRL, RX_CTRL_RXE);
}
- if ((done < limit) && ((status & RX_STATUS_PR) == 0)) {
- DBG("%s: disable polling mode, done=%d, status=%x\n",
- dev->name, done, status);
+ if (done < limit) {
+ if (status & RX_STATUS_PR)
+ goto more;
+
+ status = ag71xx_rr(ag, AG71XX_REG_TX_STATUS);
+ if (status & TX_STATUS_PS)
+ goto more;
+
+ DBG("%s: disable polling mode, done=%d, limit=%d\n",
+ dev->name, done, limit);
netif_rx_complete(dev, napi);
@@ -697,12 +704,13 @@ static int ag71xx_poll(struct napi_struct *napi, int limit)
spin_lock_irqsave(&ag->lock, flags);
ag71xx_int_enable(ag, AG71XX_INT_POLL);
spin_unlock_irqrestore(&ag->lock, flags);
- return 0;
+ return done;
}
- DBG("%s: stay in polling mode, done=%d, status=%x\n",
- dev->name, done, status);
- return 1;
+ more:
+ DBG("%s: stay in polling mode, done=%d, limit=%d\n",
+ dev->name, done, limit);
+ return done;
}
static irqreturn_t ag71xx_interrupt(int irq, void *dev_id)