gre: Fix headroom calculation.
authorJesse Gross <jesse@nicira.com>
Tue, 13 Jul 2010 00:40:38 +0000 (17:40 -0700)
committerJesse Gross <jesse@nicira.com>
Tue, 13 Jul 2010 21:18:10 +0000 (14:18 -0700)
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.

datapath/vport-gre.c

index d4a5c5ec66fc3f4f5efb69bd0d88c67db6a1863c..41d3c960d3bac2f51dc1cc05117303716f48a079 100644 (file)
@@ -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);