summaryrefslogtreecommitdiff
path: root/include/linux/skbuff.h
diff options
context:
space:
mode:
authorBogdan Hamciuc <bogdan.hamciuc@freescale.com>2013-02-05 12:52:33 (GMT)
committerEmil Medve <Emilian.Medve@Freescale.com>2013-03-21 18:42:12 (GMT)
commit9126496b944c60065992c6d7b9677ce2a3582dd8 (patch)
treea5c86bcf3267f5d257469275c28a3074687137ba /include/linux/skbuff.h
parentede9248699f79f15aae5eaae224de7c688fab4a0 (diff)
downloadlinux-fsl-qoriq-9126496b944c60065992c6d7b9677ce2a3582dd8.tar.xz
dpaa_eth,temp: Temporarily revert skb recycling removal
Partially reverting commit acb600def2110b1310466c0e485c0d26299898ae, in that we leave the skb recycling functions around until we rebase our code onto the new 3.8 kernel base. 1. We'll first move this capability back into our driver. 2. At a later stage, we'll remove this capability in this particular form from the driver altogether, as we integrate the new net APIs. Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@freescale.com>
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r--include/linux/skbuff.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 320e976..e401875 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -602,6 +602,9 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
return __alloc_skb(size, priority, SKB_ALLOC_FCLONE, NUMA_NO_NODE);
}
+extern void skb_recycle(struct sk_buff *skb);
+extern bool skb_recycle_check(struct sk_buff *skb, int skb_size);
+
extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
extern int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask);
extern struct sk_buff *skb_clone(struct sk_buff *skb,
@@ -2738,6 +2741,27 @@ static inline void skb_checksum_none_assert(const struct sk_buff *skb)
bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
+static inline bool skb_is_recycleable(const struct sk_buff *skb, int skb_size)
+{
+ if (irqs_disabled())
+ return false;
+
+ if (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY)
+ return false;
+
+ if (skb_is_nonlinear(skb) || skb->fclone != SKB_FCLONE_UNAVAILABLE)
+ return false;
+
+ skb_size = SKB_DATA_ALIGN(skb_size + NET_SKB_PAD);
+ if (skb_end_offset(skb) < skb_size)
+ return false;
+
+ if (skb_shared(skb) || skb_cloned(skb))
+ return false;
+
+ return true;
+}
+
/**
* skb_head_is_locked - Determine if the skb->head is locked down
* @skb: skb to check