From: Andy Fleming <afleming@freescale.com>
To: davem@davemloft.net, jeff@garzik.org
Cc: netdev@vger.kernel.org, Andy Fleming <afleming@freescale.com>
Subject: [PATCH v2.6.29 v3 5/5] gianfar: Continue polling until both tx and rx are empty
Date: Wed, 17 Dec 2008 15:42:55 -0600 [thread overview]
Message-ID: <1229550175-15600-5-git-send-email-afleming@freescale.com> (raw)
In-Reply-To: <1229550175-15600-4-git-send-email-afleming@freescale.com>
gfar_poll would declare polling done once the rx queue was empty,
but the tx queue could still have packets left.
Stolen mostly from the e1000 driver.
Signed-off-by: Andy Fleming <afleming@freescale.com>
---
drivers/net/gianfar.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 939e38c..144f941 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1843,7 +1843,8 @@ static int gfar_poll(struct napi_struct *napi, int budget)
{
struct gfar_private *priv = container_of(napi, struct gfar_private, napi);
struct net_device *dev = priv->dev;
- int howmany;
+ int tx_cleaned = 0;
+ int rx_cleaned = 0;
unsigned long flags;
/* Clear IEVENT, so interrupts aren't called again
@@ -1852,13 +1853,16 @@ static int gfar_poll(struct napi_struct *napi, int budget)
/* If we fail to get the lock, don't bother with the TX BDs */
if (spin_trylock_irqsave(&priv->txlock, flags)) {
- gfar_clean_tx_ring(dev);
+ tx_cleaned = gfar_clean_tx_ring(dev);
spin_unlock_irqrestore(&priv->txlock, flags);
}
- howmany = gfar_clean_rx_ring(dev, budget);
+ rx_cleaned = gfar_clean_rx_ring(dev, budget);
- if (howmany < budget) {
+ if (tx_cleaned)
+ return budget;
+
+ if (rx_cleaned < budget) {
netif_rx_complete(dev, napi);
/* Clear the halt bit in RSTAT */
@@ -1878,7 +1882,7 @@ static int gfar_poll(struct napi_struct *napi, int budget)
}
}
- return howmany;
+ return rx_cleaned;
}
#ifdef CONFIG_NET_POLL_CONTROLLER
--
1.5.4.GIT
next prev parent reply other threads:[~2008-12-17 21:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-17 21:42 [PATCH v2.6.29 v3 1/5] gianfar: Fix packet drop when out of memory Andy Fleming
2008-12-17 21:42 ` [PATCH v2.6.29 v3 2/5] gianfar: Add Scatter Gather support Andy Fleming
2008-12-17 21:42 ` [PATCH v2.6.29 v3 3/5] gianfar: Use interface name in interrupt name to distinguish the source Andy Fleming
2008-12-17 21:42 ` [PATCH v2.6.29 v3 4/5] gianfar: Merge Tx and Rx interrupt for scheduling clean up ring Andy Fleming
2008-12-17 21:42 ` Andy Fleming [this message]
2008-12-18 0:54 ` [PATCH v2.6.29 v3 5/5] gianfar: Continue polling until both tx and rx are empty David Miller
2008-12-18 2:40 ` Fleming Andy-AFLEMING
2008-12-18 2:44 ` David Miller
2008-12-18 0:53 ` [PATCH v2.6.29 v3 4/5] gianfar: Merge Tx and Rx interrupt for scheduling clean up ring David Miller
2008-12-18 0:53 ` [PATCH v2.6.29 v3 3/5] gianfar: Use interface name in interrupt name to distinguish the source David Miller
2008-12-18 0:52 ` [PATCH v2.6.29 v3 2/5] gianfar: Add Scatter Gather support David Miller
2008-12-18 0:52 ` [PATCH v2.6.29 v3 1/5] gianfar: Fix packet drop when out of memory David Miller
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=1229550175-15600-5-git-send-email-afleming@freescale.com \
--to=afleming@freescale.com \
--cc=davem@davemloft.net \
--cc=jeff@garzik.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).