aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2021-05-02 16:43:29 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2021-05-04 00:07:06 +0200
commitaf75673fe969d61b6c5a4b8e5025b069e1c3088d (patch)
tree2e14207daeb017c44f8c2ce99f5aaf22d450c1c8
parent4519ca6dbb4beb132d479d2f1d74937e2c1c36e6 (diff)
downloadbackports-af75673fe969d61b6c5a4b8e5025b069e1c3088d.tar.gz
headers: Add skb_queue_len_lockless()
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@hauke-m.de>
-rw-r--r--backport/backport-include/linux/skbuff.h20
1 files changed, 20 insertions, 0 deletions
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 */