On Wed, 19 Jan 2005 15:18:53 -0800
Stephen Hemminger <shemminger@xxxxxxxx> wrote:
> Wondering, why not just have the drivers have a way to lock dev->queue_lock
> in the interrupt handler, and change the xmit to do spin_lock_irqsave?
> Any driver that assumes it is being called with irq's enabled in transmit
> is probably already busted anyway.
Yes, that's an idea.
Effectively, LLTX is working around the fact that dev->xmit_lock is
BH disabling instead of IRQ disabling. And there is no fundamental
reason for that.
Usually we strive for BH disabling locks in order to decrease the
amount of hard IRQ disabling time in the kernel. But here, as soon
as we call into ->hard_start_xmit(), the driver typically turns hard
IRQs off anyways.
There are other things using this though, such as multicast list
If we change dev->xmit_lock to be an IRQ disabling lock, then drivers
can use it in place of their private tx_lock.
We would still need something special for loopback, which wants and
needs no locking at all.
Also, changing dev->xmit_lock to be IRQ disabling is not %100 trivial.
We'd need to verify the side-effects this has on gems like the
spin_unlock_wait(&dev->xmit_lock) in the Tulip winbond power management
code. There is another fun case in the 6pack hamradio driver where it
is doing IRQ disabling when taking dev->xmit_lock.
Originally, dev->xmit_lock was added so that drivers that were SMP dumb
could stay that way. Thus preserving the guarentee that there would be
only one active call into the dev->hard_start_xmit method across the
entire system. I don't think any of that is relevant any longer. All
of our network drivers are pretty clean in this regard.