netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roger Luethi <rl@hellgate.ch>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Andrew Morton <akpm@osdl.org>, netdev@oss.sgi.com
Subject: Re: [6/9][PATCH 2.6] Fix Tx engine race for good
Date: Sun, 20 Jun 2004 00:18:37 +0200	[thread overview]
Message-ID: <20040619221837.GC3313@k3.hellgate.ch> (raw)
In-Reply-To: <40D4AEA4.6050005@pobox.com>

On Sat, 19 Jun 2004 17:22:44 -0400, Jeff Garzik wrote:
> Roger Luethi wrote:
> >+#define RHINE_WAIT_FOR(condition) do {				 \
> >+	int i=1024;							\
> >+	while (!(condition) && --i)					\
> >+		;							\
> >+	if (debug > 1 && i < 512)					\
> >+		printk(KERN_INFO "%s: %4d cycles used @ %s:%d\n",	\
> >+				DRV_NAME, 1024-i, __func__, __LINE__);	\
> >+} while(0)
> 
> empty loops need at least a cpu_relax(), if not a true delay to 
> guarantee the timing you desire.

Sure, I can add a cpu_relax(). FWIW, though, this macro is only used
for one purpose: Waiting for registers to reach a certain value. IOW:
Every evaluation of "condition" causes an I/O operation (inb or readb).

> Also, it would be nice to change the name, since there isn't anything 
> rhine-specific about this macro.

Hmm... It relies on DRV_NAME :-). It's trivial to write a more generic
version if there's interest. I'm just trying to keep the namespace
clean. ... I just checked: drivers/macintosh/via-cuda.c defines a macro
WAIT_FOR that does pretty much the same. Does that already make the
case for a generic function for everyone to use?

Roger

      reply	other threads:[~2004-06-19 22:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20040615174933.GA11294@k3.hellgate.ch>
2004-06-19 21:22 ` [6/9][PATCH 2.6] Fix Tx engine race for good Jeff Garzik
2004-06-19 22:18   ` Roger Luethi [this message]

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=20040619221837.GC3313@k3.hellgate.ch \
    --to=rl@hellgate.ch \
    --cc=akpm@osdl.org \
    --cc=jgarzik@pobox.com \
    --cc=netdev@oss.sgi.com \
    /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).