> Another approach would be:
> 
> 1) Determine that we don't care about the callback (ie. it gets
>    reset to NULL) when the skb->dev changes, as would occur for
>    forwarding, and certain kinds of firewalling and classification
>    actions.
> 
> 2) As a result of #1 we can put the callback into the netdev struct,
>    the opaque "ARG" becomes superfluous since the thing you'd pass
>    there (the device pointer) is implicit.

It would be better to still pass it the netdev so that the driver
can figure out what instance of its device it is for.

One problem is to figure out the input netdevice (skb->input_dev
is usually not valid). For TCP/connected UDP it is relatively
easy to figure out based on the routes, but not necessarily
for all kfree_skb calls.  But doing it only for these sockets
is fine I think. For unconnected UDP it could be even disabled.

I also prefer this over a generic free callback because
it will not tempt people to implement their own broken
skb reuse schemes in drivers using this.
 
> 3) Add a "received on cpu" number to sk_buff, and the callback can
>    inspect that.
> 
> If smp_processor_id() is different from skb->recv_cpu, then the
> driver updates the table.

Sounds good too. 

-Andi
 
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to