netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [6/9][PATCH 2.6] Fix Tx engine race for good
       [not found] <20040615174933.GA11294@k3.hellgate.ch>
@ 2004-06-19 21:22 ` Jeff Garzik
  2004-06-19 22:18   ` Roger Luethi
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Garzik @ 2004-06-19 21:22 UTC (permalink / raw)
  To: Roger Luethi; +Cc: Andrew Morton, netdev

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.

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

	Jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [6/9][PATCH 2.6] Fix Tx engine race for good
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Roger Luethi @ 2004-06-19 22:18 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Andrew Morton, netdev

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-06-19 22:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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 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).