]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - include/linux/skbuff.h
x86/mce/amd: Fix kobject lifetime
[linux.git] / include / linux / skbuff.h
index 3d13a4b717e910f653583f957aaded8e6ae63535..ca8806b693882e9ae933d70d0bb6c4cbd3ca81bd 100644 (file)
@@ -1821,6 +1821,18 @@ static inline __u32 skb_queue_len(const struct sk_buff_head *list_)
        return list_->qlen;
 }
 
+/**
+ *     skb_queue_len_lockless  - get queue length
+ *     @list_: list to measure
+ *
+ *     Return the length of an &sk_buff queue.
+ *     This variant can be used in lockless contexts.
+ */
+static inline __u32 skb_queue_len_lockless(const struct sk_buff_head *list_)
+{
+       return READ_ONCE(list_->qlen);
+}
+
 /**
  *     __skb_queue_head_init - initialize non-spinlock portions of sk_buff_head
  *     @list: queue to initialize
@@ -2026,7 +2038,7 @@ static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
 {
        struct sk_buff *next, *prev;
 
-       list->qlen--;
+       WRITE_ONCE(list->qlen, list->qlen - 1);
        next       = skb->next;
        prev       = skb->prev;
        skb->next  = skb->prev = NULL;