Subject: Re: [RFC] about "net: orphan frags on receive" insanity

From: "Michael S. Tsirkin" <[email-masked]>
Date: Wed, 26 Jun 2013 12:56:42 +0300

On Wed, Jun 26, 2013 at 01:23:59AM -0700, Eric Dumazet wrote:
> Michael
> 
> Following commit added 400 bytes into __netif_receive_skb_core()
> 
> Could we revert it, and fix the problem into the callers instead ?
> 
> Thanks
> 
> 
> 
> commit 1080e512d44d4f67b8beb8edf25a1bbcb1066dc7
> Author: Michael S. Tsirkin <[email-masked]>
> Date:   Fri Jul 20 09:23:17 2012 +0000
> 
>     net: orphan frags on receive
>     
>     zero copy packets are normally sent to the outside
>     network, but bridging, tun etc might loop them
>     back to host networking stack. If this happens
>     destructors will never be called, so orphan
>     the frags immediately on receive.
>     
>     Signed-off-by: Michael S. Tsirkin <[email-masked]>
>     Signed-off-by: David S. Miller <[email-masked]>

Please don't just revert it.

Packets can cross e.g. the bridge and end up on the external
interface, in which case that NIC guarantees that
they will get transmitted eventually, so it's safe
to transmit from guest memory, or they can end up
in the host stack where they can stay indefinitely,
in this case we need to orphan frags so guest networking
can keep going.

What do you suggest exactly?

Also, I'll have to look at the generated binary - when I
coded this up, compiler seemed to only put a
conditional branch on the fast path, this shouldn't
be all that expensive.

-- 
MST