[PATCH] headers: Add skb_queue_len_lockless()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This function is copied from the mainline kernel. It was introduced in
commit 86b18aaa2b5b ("skbuff: fix a data race in skb_queue_len()").

This function is now used by ath10k.

Signed-off-by: Hauke Mehrtens <hauke@xxxxxxxxxx>
---
 backport/backport-include/linux/skbuff.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/backport/backport-include/linux/skbuff.h b/backport/backport-include/linux/skbuff.h
index 3286d36c..338f6fdb 100644
--- a/backport/backport-include/linux/skbuff.h
+++ b/backport/backport-include/linux/skbuff.h
@@ -427,4 +427,24 @@ static inline void nf_reset_ct(struct sk_buff *skb)
 	     (skb) = (next_skb), (next_skb) = (skb) ? (skb)->next : NULL)
 #endif
 
+#if LINUX_VERSION_IS_LESS(5,6,0) &&			\
+	!LINUX_VERSION_IN_RANGE(5,4,69, 5,5,0) &&	\
+	!LINUX_VERSION_IN_RANGE(4,19,149, 4,20,0) &&	\
+	!LINUX_VERSION_IN_RANGE(4,14,200, 4,15,0) &&	\
+	!LINUX_VERSION_IN_RANGE(4,9,238, 4,10,0) &&	\
+	!LINUX_VERSION_IN_RANGE(4,4,238, 4,5,0)
+/**
+ *	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.
+ */
+#define skb_queue_len_lockless LINUX_BACKPORT(skb_queue_len_lockless)
+static inline __u32 skb_queue_len_lockless(const struct sk_buff_head *list_)
+{
+	return READ_ONCE(list_->qlen);
+}
+#endif /* < 5.6.0 */
+
 #endif /* __BACKPORT_SKBUFF_H */
-- 
2.30.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux