From: Jesse Gross Date: Tue, 13 Jul 2010 00:40:38 +0000 (-0700) Subject: gre: Fix headroom calculation. X-Git-Tag: v1.1.0pre1~185 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=21256fabfe5e4eeeebd58c74d6f622133b722708;p=sliver-openvswitch.git gre: Fix headroom calculation. If we need to make a copy we add a little bit extra to the headroom that we think we need in order to avoid future copies. Previously we would always just allocate max(headroom, 64) which is generally enough space. However, if we are using IPsec our expected headroom is large and there is no extra. Instead, it is better to just tack on a few extra bytes so we'll always have a cushion. --- diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c index d4a5c5ec6..41d3c960d 100644 --- a/datapath/vport-gre.c +++ b/datapath/vport-gre.c @@ -558,7 +558,7 @@ static struct sk_buff * check_headroom(struct sk_buff *skb, int headroom) { if (skb_headroom(skb) < headroom || skb_header_cloned(skb)) { - struct sk_buff *nskb = skb_realloc_headroom(skb, max(headroom, 64)); + struct sk_buff *nskb = skb_realloc_headroom(skb, headroom + 16); if (!nskb) { kfree_skb(skb); return ERR_PTR(-ENOMEM);