From: Andy Fleming <afleming@freescale.com>
To: davem@davemloft.net, jeff@garzik.org
Cc: netdev@vger.kernel.org, Haruki Dai <Dai.Haruki@freescale.com>,
Dai Haruki <dai.haruki@freescale.com>
Subject: [PATCH v2.6.29 v3 4/5] gianfar: Merge Tx and Rx interrupt for scheduling clean up ring
Date: Wed, 17 Dec 2008 15:42:54 -0600 [thread overview]
Message-ID: <1229550175-15600-4-git-send-email-afleming@freescale.com> (raw)
In-Reply-To: <1229550175-15600-3-git-send-email-afleming@freescale.com>
From: Haruki Dai <Dai.Haruki@freescale.com>
No clean up function is executed in the interrupt context by this patch.
Signed-off-by: Dai Haruki <dai.haruki@freescale.com>
Acked-by: Andy Fleming <afleming@freescale.com>
---
drivers/net/gianfar.c | 59 +++++++++++++++----------------------------------
drivers/net/gianfar.h | 2 +-
2 files changed, 19 insertions(+), 42 deletions(-)
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 4d7c225..939e38c 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1604,29 +1604,19 @@ static int gfar_clean_tx_ring(struct net_device *dev)
return howmany;
}
-/* Interrupt Handler for Transmit complete */
-static irqreturn_t gfar_transmit(int irq, void *dev_id)
+static void gfar_schedule_cleanup(struct net_device *dev)
{
- struct net_device *dev = (struct net_device *) dev_id;
struct gfar_private *priv = netdev_priv(dev);
-
- /* Clear IEVENT */
- gfar_write(&priv->regs->ievent, IEVENT_TX_MASK);
-
- /* Lock priv */
- spin_lock(&priv->txlock);
-
- gfar_clean_tx_ring(dev);
-
- /* If we are coalescing the interrupts, reset the timer */
- /* Otherwise, clear it */
- if (likely(priv->txcoalescing)) {
- gfar_write(&priv->regs->txic, 0);
- gfar_write(&priv->regs->txic, priv->txic);
+ if (netif_rx_schedule_prep(dev, &priv->napi)) {
+ gfar_write(&priv->regs->imask, IMASK_RTX_DISABLED);
+ __netif_rx_schedule(dev, &priv->napi);
}
+}
- spin_unlock(&priv->txlock);
-
+/* Interrupt Handler for Transmit complete */
+static irqreturn_t gfar_transmit(int irq, void *dev_id)
+{
+ gfar_schedule_cleanup((struct net_device *)dev_id);
return IRQ_HANDLED;
}
@@ -1713,28 +1703,7 @@ static inline void count_errors(unsigned short status, struct net_device *dev)
irqreturn_t gfar_receive(int irq, void *dev_id)
{
- struct net_device *dev = (struct net_device *) dev_id;
- struct gfar_private *priv = netdev_priv(dev);
- u32 tempval;
-
- /* support NAPI */
- /* Clear IEVENT, so interrupts aren't called again
- * because of the packets that have already arrived */
- gfar_write(&priv->regs->ievent, IEVENT_RTX_MASK);
-
- if (netif_rx_schedule_prep(dev, &priv->napi)) {
- tempval = gfar_read(&priv->regs->imask);
- tempval &= IMASK_RTX_DISABLED;
- gfar_write(&priv->regs->imask, tempval);
-
- __netif_rx_schedule(dev, &priv->napi);
- } else {
- if (netif_msg_rx_err(priv))
- printk(KERN_DEBUG "%s: receive called twice (%x)[%x]\n",
- dev->name, gfar_read(&priv->regs->ievent),
- gfar_read(&priv->regs->imask));
- }
-
+ gfar_schedule_cleanup((struct net_device *)dev_id);
return IRQ_HANDLED;
}
@@ -1877,6 +1846,10 @@ static int gfar_poll(struct napi_struct *napi, int budget)
int howmany;
unsigned long flags;
+ /* Clear IEVENT, so interrupts aren't called again
+ * because of the packets that have already arrived */
+ gfar_write(&priv->regs->ievent, IEVENT_RTX_MASK);
+
/* 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);
@@ -1899,6 +1872,10 @@ static int gfar_poll(struct napi_struct *napi, int budget)
gfar_write(&priv->regs->rxic, 0);
gfar_write(&priv->regs->rxic, priv->rxic);
}
+ if (likely(priv->txcoalescing)) {
+ gfar_write(&priv->regs->txic, 0);
+ gfar_write(&priv->regs->txic, priv->txic);
+ }
}
return howmany;
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index 06bac34..b1a8334 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -251,7 +251,7 @@ extern const char gfar_driver_version[];
#define IEVENT_FIQ 0x00000004
#define IEVENT_DPE 0x00000002
#define IEVENT_PERR 0x00000001
-#define IEVENT_RX_MASK (IEVENT_RXB0 | IEVENT_RXF0)
+#define IEVENT_RX_MASK (IEVENT_RXB0 | IEVENT_RXF0 | IEVENT_BSY)
#define IEVENT_TX_MASK (IEVENT_TXB | IEVENT_TXF)
#define IEVENT_RTX_MASK (IEVENT_RX_MASK | IEVENT_TX_MASK)
#define IEVENT_ERR_MASK \
--
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 ` Andy Fleming [this message]
2008-12-17 21:42 ` [PATCH v2.6.29 v3 5/5] gianfar: Continue polling until both tx and rx are empty Andy Fleming
2008-12-18 0:54 ` 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-4-git-send-email-afleming@freescale.com \
--to=afleming@freescale.com \
--cc=Dai.Haruki@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).