[PATCH 26/30] backports: Add netif_rx_any_context()

Hauke Mehrtens <[email protected]>
Newsgroups org.kernel.vger.backports
Message-ID <[email protected]>
Add the netif_rx_any_context which was added in commit c11171a41338
("net: Add netif_rx_any_context()") in kernel 5.10. This is used by
libertas and mwifiex.

Signed-off-by: Hauke Mehrtens <[email protected]>
---
 backport/backport-include/linux/netdevice.h |  5 +++++
 backport/compat/Makefile                    |  1 +
 backport/compat/backport-5.10.c             | 20 ++++++++++++++++++++
 3 files changed, 26 insertions(+)
 create mode 100644 backport/compat/backport-5.10.c

diff --git a/backport/backport-include/linux/netdevice.h b/backport/backport-include/linux/netdevice.h
index 7646d6e2..411757d2 100644
--- a/backport/backport-include/linux/netdevice.h
+++ b/backport/backport-include/linux/netdevice.h
@@ -400,4 +400,9 @@ static inline bool netif_is_bridge_port(const struct net_device *dev)
 }
 #endif
 
+#if LINUX_VERSION_IS_LESS(5,10,0)
+#define netif_rx_any_context LINUX_BACKPORT(netif_rx_any_context)
+int netif_rx_any_context(struct sk_buff *skb);
+#endif /* < 5.10 */
+
 #endif /* __BACKPORT_NETDEVICE_H */
diff --git a/backport/compat/Makefile b/backport/compat/Makefile
index 8d917622..b67ebc27 100644
--- a/backport/compat/Makefile
+++ b/backport/compat/Makefile
@@ -40,6 +40,7 @@ compat-$(CPTCFG_KERNEL_4_18) += backport-4.18.o
 compat-$(CPTCFG_KERNEL_5_2) += backport-5.2.o backport-genetlink.o
 compat-$(CPTCFG_KERNEL_5_3) += backport-5.3.o
 compat-$(CPTCFG_KERNEL_5_5) += backport-5.5.o
+compat-$(CPTCFG_KERNEL_5_10) += backport-5.10.o
 
 compat-$(CPTCFG_BPAUTO_BUILD_SYSTEM_DATA_VERIFICATION) += verification/verify.o
 compat-$(CPTCFG_BPAUTO_BUILD_SYSTEM_DATA_VERIFICATION) += verification/pkcs7.asn1.o
diff --git a/backport/compat/backport-5.10.c b/backport/compat/backport-5.10.c
new file mode 100644
index 00000000..a83907f4
--- /dev/null
+++ b/backport/compat/backport-5.10.c
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/export.h>
+#include <linux/kernel.h>
+#include <linux/netdevice.h>
+
+int netif_rx_any_context(struct sk_buff *skb)
+{
+	/*
+	 * If invoked from contexts which do not invoke bottom half
+	 * processing either at return from interrupt or when softrqs are
+	 * reenabled, use netif_rx_ni() which invokes bottomhalf processing
+	 * directly.
+	 */
+	if (in_interrupt())
+		return netif_rx(skb);
+	else
+		return netif_rx_ni(skb);
+}
+EXPORT_SYMBOL(netif_rx_any_context);
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.