[ovs-dev] [PATCH] gre: Improve headroom calculation to reducing copying.

Ben Pfaff blp at nicira.com
Fri Jun 11 15:42:26 PDT 2010


On Fri, Jun 11, 2010 at 03:40:25PM -0700, Jesse Gross wrote:
> The first change is use skb_header_cloned() instead of (skb_cloned()
>  && skb_clone_writable()).  While these are effectively the same
> checks, skb_clone_writable() does not exist until 2.6.23 and relies
> on information not available in earlier kernels and therefore the
> compat version always returns false.  Since GRE only adds data to
> the front of the packet and this is on the transmit path (meaning
> there is no important data in the SKB head) it is safe to use
> skb_header_cloned().  This avoids a copy for locally generated
> TCP packets on the affected kernels.
>
> The second change is to always allocate 64 bytes of headroom when
> a copy needs to be made.  There is no cost to allocating extra
> space once we have decided to make a copy and can avoid another
> copy later if we need to add a VLAN tag.

Looks good.

Should we use max(headroom, 64) just in case some situation calls for
more than 64 bytes of headroom, or do we know that that cannot happen?




More information about the dev mailing list