Subject: Re: netif_tx_disable and lockless TX

From: Roland Dreier <[email-masked]>
Date: Tue, 30 May 2006 21:13:48 -0700

Herbert> However, lockless drivers do not take the xmit_lock so
    Herbert> this method is ineffective.  Such drivers need to do
    Herbert> their own checking inside whatever locks that they do
    Herbert> take.  For example, tg3 could get around this by checking
    Herbert> whether the queue is stopped in its hard_start_xmit
    Herbert> function.

Yes, I had to add this to the IPoIB driver, because calling
netif_stop_queue() when the transmit ring was full was sometimes still
allowing hard_start_xmit to be called again:

	/*
	 * Check if our queue is stopped.  Since we have the LLTX bit
	 * set, we can't rely on netif_stop_queue() preventing our
	 * xmit function from being called with a full queue.
	 */
	if (unlikely(netif_queue_stopped(dev))) {
		spin_unlock_irqrestore(&priv->tx_lock, flags);
		return NETDEV_TX_BUSY;
	}

this bug started a long thread a while back, but I don't remember if
there was any resolution.

    Herbert> I must say though that I'm becoming less and less
    Herbert> impressed by the lockless feature based on the number of
    Herbert> problems that it has caused.  Does anyone have any hard
    Herbert> figures as to its effectiveness (excluding any stats
    Herbert> relating to the loopback interface which can be easily
    Herbert> separated from normal NIC drivers).

I don't have exact figures at hand, but I remember something like a 2 or
3 percent throughput improvement for IPoIB.

 - R.