Re: Problem with dev_kfree_skb_any() in 2.6.0

From: Jeff Garzik
Date: Mon Dec 29 2003 - 23:10:45 EST


David S. Miller wrote:
On Sun, 28 Dec 2003 10:17:34 +1100
Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> wrote:


We should probably fix dev_kfree_skb_any() ? Still ugly imho though...

- if (in_irq())
+ if (in_irq() || irqs_disabled())



That's not the right fix, the sungem PM code path TX queue
packet freeing should be instead done outside of IRQ spinlocks.


Not really... pretty much _all_ TX queue packet freeing occurs inside an irq handler and inside the driver spinlock. Further, we don't want to reinvent some sort of "queue skb for freeing" code in every driver.

Look at what a driver really wants from the net stack:

if (you can free the skb now)
free skb
otherwise
queue it to be freed later

The driver _shouldn't_ care about the conditions under which an skb can be freed. That's entirely the net stack's domain (and should be)... heck, the net stack should even be free to change said conditions, without breaking or confusing drivers.

Jeff



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/