netfilter: xt_LOG: don't use xchg() for simple assignment
[pandora-kernel.git] / include / linux / skbuff.h
index 85180bf..d9c4a60 100644 (file)
@@ -617,11 +617,21 @@ static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
 {
        return skb->head + skb->end;
 }
+
+static inline unsigned int skb_end_offset(const struct sk_buff *skb)
+{
+       return skb->end;
+}
 #else
 static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
 {
        return skb->end;
 }
+
+static inline unsigned int skb_end_offset(const struct sk_buff *skb)
+{
+       return skb->end - skb->head;
+}
 #endif
 
 /* Internal */
@@ -1622,6 +1632,22 @@ static inline void skb_orphan(struct sk_buff *skb)
        skb->sk         = NULL;
 }
 
+/**
+ *     skb_orphan_frags - orphan the frags contained in a buffer
+ *     @skb: buffer to orphan frags from
+ *     @gfp_mask: allocation mask for replacement pages
+ *
+ *     For each frag in the SKB which needs a destructor (i.e. has an
+ *     owner) create a copy of that frag and release the original
+ *     page by calling the destructor.
+ */
+static inline int skb_orphan_frags(struct sk_buff *skb, gfp_t gfp_mask)
+{
+       if (likely(!(skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY)))
+               return 0;
+       return skb_copy_ubufs(skb, gfp_mask);
+}
+
 /**
  *     __skb_queue_purge - empty a list
  *     @list: list to empty
@@ -2019,6 +2045,9 @@ static inline void skb_postpull_rcsum(struct sk_buff *skb,
 {
        if (skb->ip_summed == CHECKSUM_COMPLETE)
                skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0));
+       else if (skb->ip_summed == CHECKSUM_PARTIAL &&
+                skb_checksum_start_offset(skb) < 0)
+               skb->ip_summed = CHECKSUM_NONE;
 }
 
 unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len);
@@ -2143,6 +2172,8 @@ extern int               skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
 
 extern struct sk_buff *skb_segment(struct sk_buff *skb, u32 features);
 
+unsigned int skb_gso_transport_seglen(const struct sk_buff *skb);
+
 static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
                                       int len, void *buffer)
 {
@@ -2547,7 +2578,7 @@ static inline bool skb_is_recycleable(const struct sk_buff *skb, int skb_size)
                return false;
 
        skb_size = SKB_DATA_ALIGN(skb_size + NET_SKB_PAD);
-       if (skb_end_pointer(skb) - skb->head < skb_size)
+       if (skb_end_offset(skb) < skb_size)
                return false;
 
        if (skb_shared(skb) || skb_cloned(skb))