Merge tag 'tty-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
[linux-2.6-microblaze.git] / include / linux / skbuff.h
index 91ed669..4174c4b 100644 (file)
@@ -32,7 +32,6 @@
 #include <linux/if_packet.h>
 #include <linux/llist.h>
 #include <net/flow.h>
-#include <net/page_pool.h>
 #if IS_ENABLED(CONFIG_NF_CONNTRACK)
 #include <linux/netfilter/nf_conntrack_common.h>
 #endif
@@ -441,8 +440,6 @@ static inline bool skb_frag_must_loop(struct page *p)
             copied += p_len, p++, p_off = 0,                           \
             p_len = min_t(u32, f_len - copied, PAGE_SIZE))             \
 
-#define HAVE_HW_TIME_STAMP
-
 /**
  * struct skb_shared_hwtstamps - hardware time stamps
  * @hwtstamp:          hardware time stamp transformed into duration
@@ -944,7 +941,7 @@ struct sk_buff {
        __u8                    __mono_tc_offset[0];
        /* public: */
        __u8                    mono_delivery_time:1;   /* See SKB_MONO_DELIVERY_TIME_MASK */
-#ifdef CONFIG_NET_CLS_ACT
+#ifdef CONFIG_NET_XGRESS
        __u8                    tc_at_ingress:1;        /* See TC_AT_INGRESS_MASK */
        __u8                    tc_skip_classify:1;
 #endif
@@ -993,7 +990,7 @@ struct sk_buff {
        __u8                    csum_not_inet:1;
 #endif
 
-#ifdef CONFIG_NET_SCHED
+#if defined(CONFIG_NET_SCHED) || defined(CONFIG_NET_XGRESS)
        __u16                   tc_index;       /* traffic control index */
 #endif
 
@@ -3152,22 +3149,38 @@ static inline int skb_orphan_frags_rx(struct sk_buff *skb, gfp_t gfp_mask)
 }
 
 /**
- *     __skb_queue_purge - empty a list
+ *     __skb_queue_purge_reason - empty a list
  *     @list: list to empty
+ *     @reason: drop reason
  *
  *     Delete all buffers on an &sk_buff list. Each buffer is removed from
  *     the list and one reference dropped. This function does not take the
  *     list lock and the caller must hold the relevant locks to use it.
  */
-static inline void __skb_queue_purge(struct sk_buff_head *list)
+static inline void __skb_queue_purge_reason(struct sk_buff_head *list,
+                                           enum skb_drop_reason reason)
 {
        struct sk_buff *skb;
+
        while ((skb = __skb_dequeue(list)) != NULL)
-               kfree_skb(skb);
+               kfree_skb_reason(skb, reason);
+}
+
+static inline void __skb_queue_purge(struct sk_buff_head *list)
+{
+       __skb_queue_purge_reason(list, SKB_DROP_REASON_QUEUE_PURGE);
+}
+
+void skb_queue_purge_reason(struct sk_buff_head *list,
+                           enum skb_drop_reason reason);
+
+static inline void skb_queue_purge(struct sk_buff_head *list)
+{
+       skb_queue_purge_reason(list, SKB_DROP_REASON_QUEUE_PURGE);
 }
-void skb_queue_purge(struct sk_buff_head *list);
 
 unsigned int skb_rbtree_purge(struct rb_root *root);
+void skb_errqueue_purge(struct sk_buff_head *list);
 
 void *__netdev_alloc_frag_align(unsigned int fragsz, unsigned int align_mask);
 
@@ -3423,13 +3436,15 @@ static inline void skb_frag_ref(struct sk_buff *skb, int f)
        __skb_frag_ref(&skb_shinfo(skb)->frags[f]);
 }
 
+bool napi_pp_put_page(struct page *page, bool napi_safe);
+
 static inline void
 napi_frag_unref(skb_frag_t *frag, bool recycle, bool napi_safe)
 {
        struct page *page = skb_frag_page(frag);
 
 #ifdef CONFIG_PAGE_POOL
-       if (recycle && page_pool_return_skb_page(page, napi_safe))
+       if (recycle && napi_pp_put_page(page, napi_safe))
                return;
 #endif
        put_page(page);
@@ -4023,7 +4038,7 @@ __skb_header_pointer(const struct sk_buff *skb, int offset, int len,
        if (likely(hlen - offset >= len))
                return (void *)data + offset;
 
-       if (!skb || !buffer || unlikely(skb_copy_bits(skb, offset, buffer, len) < 0))
+       if (!skb || unlikely(skb_copy_bits(skb, offset, buffer, len) < 0))
                return NULL;
 
        return buffer;
@@ -4036,6 +4051,14 @@ skb_header_pointer(const struct sk_buff *skb, int offset, int len, void *buffer)
                                    skb_headlen(skb), buffer);
 }
 
+static inline void * __must_check
+skb_pointer_if_linear(const struct sk_buff *skb, int offset, int len)
+{
+       if (likely(skb_headlen(skb) - offset >= len))
+               return skb->data + offset;
+       return NULL;
+}
+
 /**
  *     skb_needs_linearize - check if we need to linearize a given skb
  *                           depending on the given device features.