netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Olof Johansson <olof@lixom.net>
To: Michael Ellerman <michael@ellerman.id.au>
Cc: netdev@vger.kernel.org, pasemi-linux@ozlabs.org,
	jgarzik@pobox.com, linuxppc-dev@ozlabs.org
Subject: Re: [Pasemi-linux] [patch 1/6] pasemi_mac: Move RX/TX section enablement to dma_lib
Date: Wed, 5 Mar 2008 12:21:00 -0600	[thread overview]
Message-ID: <20080305182100.GA8411@lixom.net> (raw)
In-Reply-To: <20080226141420.GA22572@lixom.net>

On Tue, Feb 26, 2008 at 08:14:20AM -0600, Olof Johansson wrote:
> Hi,
> 
> On Tue, Feb 26, 2008 at 10:46:06PM +1100, Michael Ellerman wrote:
> > On Wed, 2008-02-20 at 20:57 -0600, Olof Johansson wrote:
> > > +	i = 1000;
> > > +	pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, 0);
> > > +	while ((i > 0) && (pasemi_read_dma_reg(PAS_DMA_COM_RXSTA) & 1))
> > > +		i--;
> > > +	if (i < 0)
> > > +		printk(KERN_INFO "Warning: Could not disable RX section\n");
> > > +
> > > +	i = 1000;
> > > +	pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, 0);
> > > +	while ((i > 0) && (pasemi_read_dma_reg(PAS_DMA_COM_TXSTA) & 1))
> > > +		i--;
> > 
> > This kind of caught my eye, is it still going to work when the next core
> > is twice as fast?
> 
> Actually, I added the variable right before posting, I used to have an
> infinite loop there while testing the patch. I've never seen it do more
> than a few rounds, so I'm not that worried.
> 
> We already have a similar loop in the channel shutdown code, but it runs
> a bit longer. I might bring that over instead. Thanks for pointing it
> out.

FYI; I've commited in this change, rest of the patch is identical.

diff --git a/arch/powerpc/platforms/pasemi/dma_lib.c b/arch/powerpc/platforms/pasemi/dma_lib.c
index c529d8d..48cb7c9 100644
--- a/arch/powerpc/platforms/pasemi/dma_lib.c
+++ b/arch/powerpc/platforms/pasemi/dma_lib.c
@@ -17,6 +17,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
+#include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/pci.h>
@@ -410,6 +411,7 @@ int pasemi_dma_init(void)
 	struct resource res;
 	struct device_node *dn;
 	int i, intf, err = 0;
+	unsigned long timeout;
 	u32 tmp;
 
 	if (!machine_is(pasemi))
@@ -478,6 +480,34 @@ int pasemi_dma_init(void)
 	for (i = 0; i < MAX_RXCH; i++)
 		__set_bit(i, rxch_free);
 
+	timeout = jiffies + HZ;
+	pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, 0);
+	while (pasemi_read_dma_reg(PAS_DMA_COM_RXSTA) & 1) {
+		if (time_after(jiffies, timeout)) {
+			pr_warning("Warning: Could not disable RX section\n");
+			break;
+		}
+	}
+
+	timeout = jiffies + HZ;
+	pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, 0);
+	while (pasemi_read_dma_reg(PAS_DMA_COM_TXSTA) & 1) {
+		if (time_after(jiffies, timeout)) {
+			pr_warning("Warning: Could not disable TX section\n");
+			break;
+		}
+	}

  reply	other threads:[~2008-03-05 18:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-21  2:57 [patch 0/6] pasemi_mac updates for 2.6.26 Olof Johansson
2008-02-21  2:57 ` [patch 1/6] pasemi_mac: Move RX/TX section enablement to dma_lib Olof Johansson
2008-02-26 11:46   ` Michael Ellerman
2008-02-26 14:14     ` Olof Johansson
2008-03-05 18:21       ` Olof Johansson [this message]
2008-03-06  0:47         ` [Pasemi-linux] " Michael Ellerman
2008-02-21  2:57 ` [patch 2/6] [POWERPC] pasemi: Add flag management functions " Olof Johansson
2008-02-21  2:57 ` [patch 3/6] [POWERPC] pasemi: Add function engine " Olof Johansson
2008-02-21  2:57 ` [patch 4/6] pasemi_mac: jumbo frame support Olof Johansson
2008-02-21  2:57 ` [patch 5/6] pasemi_mac: Enable GSO by default Olof Johansson
2008-02-21  2:57 ` [patch 6/6] pasemi_mac: basic ethtool support Olof Johansson
2008-02-26  9:49 ` [patch 0/6] pasemi_mac updates for 2.6.26 Paul Mackerras
2008-02-26 14:16   ` Olof Johansson
2008-02-26 18:21     ` Jeff Garzik
2008-02-26 18:33       ` Olof Johansson

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=20080305182100.GA8411@lixom.net \
    --to=olof@lixom.net \
    --cc=jgarzik@pobox.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=michael@ellerman.id.au \
    --cc=netdev@vger.kernel.org \
    --cc=pasemi-linux@ozlabs.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).