Backports Archive mirror
 help / color / mirror / Atom feed
From: Hauke Mehrtens <hauke@hauke-m.de>
To: backports@vger.kernel.org
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Subject: [PATCH] headers: Add skb_queue_len_lockless()
Date: Mon,  3 May 2021 00:25:59 +0200	[thread overview]
Message-ID: <20210502222559.165316-1-hauke@hauke-m.de> (raw)

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>
---
 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

                 reply	other threads:[~2021-05-02 22:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210502222559.165316-1-hauke@hauke-m.de \
    --to=hauke@hauke-m.de \
    --cc=backports@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).