net: pass correct parameter to skb_headers_offset_update()
authorPeter Pan(潘卫平) <panweiping3@gmail.com>
Thu, 6 Jun 2013 13:27:21 +0000 (21:27 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 11 Jun 2013 09:48:06 +0000 (02:48 -0700)
Since commit 1a37e412a022(net: Use 16bits for *_headers fields of struct
skbuff), skb->*_header are relative to skb->head,
so copy_skb_header() should not call skb_headers_offset_update() now,
and we should pass correct parameter to skb_headers_offset_update() in
pskb_expand_head() and skb_copy_expand().

Signed-off-by: Weiping Pan <panweiping3@gmail.com>
Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/skbuff.c

index 4a4181e16c1a22fc0be2b220a6652bfa42fe4530..edf37578e21e61aedeefd6052cd5096b25e3a6d4 100644 (file)
@@ -909,18 +909,8 @@ static void skb_headers_offset_update(struct sk_buff *skb, int off)
 
 static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
 {
-#ifndef NET_SKBUFF_DATA_USES_OFFSET
-       /*
-        *      Shift between the two data areas in bytes
-        */
-       unsigned long offset = new->data - old->data;
-#endif
-
        __copy_skb_header(new, old);
 
-#ifndef NET_SKBUFF_DATA_USES_OFFSET
-       skb_headers_offset_update(new, offset);
-#endif
        skb_shinfo(new)->gso_size = skb_shinfo(old)->gso_size;
        skb_shinfo(new)->gso_segs = skb_shinfo(old)->gso_segs;
        skb_shinfo(new)->gso_type = skb_shinfo(old)->gso_type;
@@ -1112,7 +1102,7 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
        skb->end      = skb->head + size;
 #endif
        skb->tail             += off;
-       skb_headers_offset_update(skb, off);
+       skb_headers_offset_update(skb, nhead);
        /* Only adjust this if it actually is csum_start rather than csum */
        if (skb->ip_summed == CHECKSUM_PARTIAL)
                skb->csum_start += nhead;
@@ -1207,9 +1197,8 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
        off                  = newheadroom - oldheadroom;
        if (n->ip_summed == CHECKSUM_PARTIAL)
                n->csum_start += off;
-#ifdef NET_SKBUFF_DATA_USES_OFFSET
+
        skb_headers_offset_update(n, off);
-#endif
 
        return n;
 }