From 21256fabfe5e4eeeebd58c74d6f622133b722708 Mon Sep 17 00:00:00 2001 From: Jesse Gross Date: Mon, 12 Jul 2010 17:40:38 -0700 Subject: [PATCH] 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. --- datapath/vport-gre.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.20.1