Skip to contentSkip to conversation

Fix Tx engine race for good

PATCH Jeff Garzik 2 participants 2 messages Jun 19, 2004 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Review

Quoted 8 lines · Roger Luethi
(quoted diff) +8 -0
+#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

#2 lore raw
Quoted 12 lines · Jeff Garzik

Review

Quoted 8 lines · Roger Luethi
(quoted diff) +8 -0
+#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).

Quoted 2 lines

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