From 1f20d47753e5f18d8953b4405e2ffc06e05c0890 Mon Sep 17 00:00:00 2001 From: "Luis R. Rodriguez" Date: Sun, 6 Apr 2014 21:57:27 +0000 Subject: [PATCH] backports: complete backport of frag size accessors These are just helpers so carry them over, this was added via commit 9e903e0852 through v3.2. The skb frag size was in place for a long time but was changed from __u16 to __u32 via commit a309bb072b through v2.6.23 and since we backport for >= 2.6.25 just leave this as is. This was already only partly backported, this adds the missing helpers. mcgrof@ergon ~/linux-next (git::master)$ git describe --contains 9e903e0852 v3.2-rc1~182^2~85 mcgrof@ergon ~/linux-next (git::master)$ git describe --contains a309bb072b v2.6.23-rc2~35^2~11 commit 9e903e085262ffbf1fc44a17ac06058aca03524a Author: Eric Dumazet Date: Tue Oct 18 21:00:24 2011 +0000 net: add skb frag size accessors To ease skb->truesize sanitization, its better to be able to localize all references to skb frags size. Define accessors : skb_frag_size() to fetch frag size, and skb_frag_size_{set|add|sub}() to manipulate it. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Cc: Eric Dumazet Signed-off-by: Luis R. Rodriguez --- backport/backport-include/linux/skbuff.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/backport/backport-include/linux/skbuff.h b/backport/backport-include/linux/skbuff.h index bc67f452ed83..2f7d57b415be 100644 --- a/backport/backport-include/linux/skbuff.h +++ b/backport/backport-include/linux/skbuff.h @@ -313,6 +313,18 @@ static inline int skb_unclone(struct sk_buff *skb, gfp_t pri) #if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0) +#define skb_frag_size_set LINUX_BACKPORT(skb_frag_size_set) +static inline void skb_frag_size_set(skb_frag_t *frag, unsigned int size) +{ + frag->size = size; +} + +#define skb_frag_size_add LINUX_BACKPORT(skb_frag_size_add) +static inline void skb_frag_size_add(skb_frag_t *frag, int delta) +{ + frag->size += delta; +} + #define __skb_fill_page_desc LINUX_BACKPORT(__skb_fill_page_desc) /** * __skb_fill_page_desc - initialise a paged fragment in an skb -- 2.30.2