[realtek] transmit timeout revisited

Sean MacLennan seanm@netwinder.org
Mon, 27 Nov 2000 11:30:08 -0500 (EST)


Charl,

Below is a copy of a message I sent to Jeff Garzik. We are currently
looking into the best solution to the problem. The fix in the message
works, and may tide you over till the correct solution is found.

    Sean

From: Sean MacLennan <seanm@netwinder.org>
To: Jeff Garzik
Subject: 8139too race condition
Date: Wed, 22 Nov 2000 17:19:56 -0500 (EST)
X-Mailer: VM 6.75 under 21.1 (patch 8) "Bryce Canyon" XEmacs Lucid

Jeff,

I have found a race condition in the 8139too driver. Under heavy load
(I was using http_load) I could consistently get the driver to
timeout. The race condition is in start_xmit in the following code:

  if ((atomic_read (&tp->cur_tx) - atomic_read (&tp->dirty_tx)) >= NUM_TX_DESC)
	netif_stop_queue (dev);

What happens is that the if returns true, but by the time the
netif_stop_queue is called, the tx handler has written out the
buffers. This means everything hangs for 6 seconds until the stack
calls the tx_timeout routine.

I am using the following hack. If you have a better solution, let me
know.

 if ((atomic_read (&tp->cur_tx) - atomic_read (&tp->dirty_tx)) >= NUM_TX_DESC) {
	netif_stop_queue (dev);
	 if (atomic_read (&tp->cur_tx) == atomic_read (&tp->dirty_tx) &&
			 netif_queue_stopped(dev))
		netif_wake_queue(dev);
 }

If you have any questions (or the above code got mangled) let me know.

  Sean

--