netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cyril Chemparathy <cyril@ti.com>
To: netdev@vger.kernel.org,
	davinci-linux-open-source@linux.davincidsp.com,
	linux-omap@vger.kernel.org
Cc: michael.williamson@criticallink.com, caglarakyuz@gmail.com,
	bparrot@ti.com, Cyril Chemparathy <cyril@ti.com>
Subject: [PATCH 3/9] net: davinci_cpdma: requeue on early end-of-queue
Date: Mon, 13 Sep 2010 14:07:25 -0400	[thread overview]
Message-ID: <1284401251-8846-4-git-send-email-cyril@ti.com> (raw)
In-Reply-To: <1284401251-8846-1-git-send-email-cyril@ti.com>

When chaining descriptors to the end of a cpdma queue, there is a chance that
the cpdma engine has already traversed the last descriptor and signalled an
end-of-queue.  The original cpdma code detected this condition and requeued
descriptors on submission.

With this patch, an early end-of-queue condition is detected on descriptor
submission as well.  This is necessary on davinci style emac controllers, and
prevents transmit timeouts when sending out a burst of packets.

Signed-off-by: Cyril Chemparathy <cyril@ti.com>
Signed-off-by: Michael Williamson <michael.williamson@criticallink.com>
Signed-off-by: Caglar Akyuz <caglarakyuz@gmail.com>
---
 drivers/net/davinci_cpdma.c |   12 ++++++++++--
 drivers/net/davinci_cpdma.h |    1 +
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/davinci_cpdma.c b/drivers/net/davinci_cpdma.c
index ab7ecd7..abc2b14 100644
--- a/drivers/net/davinci_cpdma.c
+++ b/drivers/net/davinci_cpdma.c
@@ -488,6 +488,7 @@ static void __cpdma_chan_submit(struct cpdma_chan *chan,
 	struct cpdma_desc __iomem	*prev = chan->tail;
 	struct cpdma_desc_pool		*pool = ctlr->pool;
 	dma_addr_t			desc_dma;
+	u32				mode;
 
 	desc_dma = desc_phys(pool, desc);
 
@@ -507,8 +508,10 @@ static void __cpdma_chan_submit(struct cpdma_chan *chan,
 	chan->stats.tail_enqueue++;
 
 	/* next check if EOQ has been triggered already */
-	if (desc_read(prev, hw_mode) & CPDMA_DESC_EOQ &&
-	    chan->state == CPDMA_STATE_ACTIVE) {
+	mode = desc_read(prev, hw_mode);
+	if (((mode & (CPDMA_DESC_EOQ | CPDMA_DESC_OWNER)) == CPDMA_DESC_EOQ) &&
+	    (chan->state == CPDMA_STATE_ACTIVE)) {
+		desc_write(prev, hw_mode, mode & ~CPDMA_DESC_EOQ);
 		chan_write(chan, hdp, desc_dma);
 		chan->stats.misqueued++;
 	}
@@ -618,6 +621,11 @@ static int __cpdma_chan_process(struct cpdma_chan *chan)
 	chan->count--;
 	chan->stats.good_dequeue++;
 
+	if (status & CPDMA_DESC_EOQ) {
+		chan->stats.requeue++;
+		chan_write(chan, hdp, desc_phys(pool, chan->head));
+	}
+
 	spin_unlock_irqrestore(&chan->lock, flags);
 
 	__cpdma_chan_free(chan, desc, outlen, status);
diff --git a/drivers/net/davinci_cpdma.h b/drivers/net/davinci_cpdma.h
index d50ee35..9baacca 100644
--- a/drivers/net/davinci_cpdma.h
+++ b/drivers/net/davinci_cpdma.h
@@ -56,6 +56,7 @@ struct cpdma_chan_stats {
 	u32			empty_dequeue;
 	u32			busy_dequeue;
 	u32			good_dequeue;
+	u32			requeue;
 	u32			teardown_dequeue;
 };
 
-- 
1.7.0.4


  parent reply	other threads:[~2010-09-13 18:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-13 18:07 [PATCH 0/9] post cpdma/mdio refactoring fixes Cyril Chemparathy
     [not found] ` <1284401251-8846-1-git-send-email-cyril-l0cyMroinI0@public.gmane.org>
2010-09-13 18:07   ` [PATCH 1/9] net: davinci_emac: allow forced 100/full via phy_id Cyril Chemparathy
2010-09-13 18:07 ` [PATCH 2/9] davinci: specify phy_id rather than auto-detect Cyril Chemparathy
2010-09-13 18:07 ` Cyril Chemparathy [this message]
2010-09-13 18:07 ` [PATCH 4/9] net: davinci_emac: fix rx error handling Cyril Chemparathy
2010-09-13 18:07 ` [PATCH 5/9] net: davinci_mdio: separate out controller reset Cyril Chemparathy
2010-09-13 18:07 ` [PATCH 6/9] net: davinci_mdio: use calculated bus access times Cyril Chemparathy
2010-09-13 18:07 ` [PATCH 7/9] net: davinci_mdio: work around emac soft-reset during i/o Cyril Chemparathy
2010-09-13 18:07 ` [PATCH 8/9] net: davinci_cpdma: add register dump routines Cyril Chemparathy
2010-09-13 18:07 ` [PATCH 9/9] net: davinci_emac: extended register dumps on tx timeout Cyril Chemparathy
2010-09-14 18:50 ` [PATCH 0/9] post cpdma/mdio refactoring fixes Kevin Hilman

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=1284401251-8846-4-git-send-email-cyril@ti.com \
    --to=cyril@ti.com \
    --cc=bparrot@ti.com \
    --cc=caglarakyuz@gmail.com \
    --cc=davinci-linux-open-source@linux.davincidsp.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=michael.williamson@criticallink.com \
    --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).