Backports Archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: backports@vger.kernel.org
Cc: Johannes Berg <johannes.berg@intel.com>
Subject: [PATCH] backports: add netif_rx()
Date: Mon,  4 Apr 2022 11:41:58 +0200	[thread overview]
Message-ID: <20220404094158.131124-1-johannes@sipsolutions.net> (raw)

From: Johannes Berg <johannes.berg@intel.com>

We need this to auto-detect the context now, since that's
what was done upstream.

Change-Id: Ie974d61fc51bd6ae44a6a92cee7da674bb179680
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 backport-include/linux/netdevice.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/backport-include/linux/netdevice.h b/backport-include/linux/netdevice.h
index 6214a69a3e65..bd31c94bde76 100644
--- a/backport-include/linux/netdevice.h
+++ b/backport-include/linux/netdevice.h
@@ -247,4 +247,21 @@ struct net_device_path_ctx {
 };
 #endif /* NET_DEVICE_PATH_STACK_MAX */
 
+#if LINUX_VERSION_IS_LESS(5,18,0)
+#define netif_rx LINUX_BACKPORT(netif_rx)
+static inline int netif_rx(struct sk_buff *skb)
+{
+	bool need_bh_off = !(hardirq_count() | softirq_count());
+	int ret;
+
+	if (need_bh_off)
+		local_bh_disable();
+	ret = __netif_rx(skb);
+	if (need_bh_off)
+		local_bh_enable();
+
+	return ret;
+}
+#endif /* < 5.18.0 */
+
 #endif /* __BACKPORT_NETDEVICE_H */
-- 
2.35.1

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

                 reply	other threads:[~2022-04-04  9:42 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=20220404094158.131124-1-johannes@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=backports@vger.kernel.org \
    --cc=johannes.berg@intel.com \
    /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).