diff mbox series

[23/75] backports: add netif_rx()

Message ID 20240627234808.1253337-24-hauke@hauke-m.de (mailing list archive)
State New, archived
Headers show
Series backports: Update to kernel 6.1.95 | expand

Commit Message

Hauke Mehrtens June 27, 2024, 11:47 p.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

This got changed upstream to detect the context to get rid
of netif_rx_ni(), so just copy the new upstream version
with the detection.

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

Patch

diff --git a/backport/backport-include/linux/netdevice.h b/backport/backport-include/linux/netdevice.h
index 06d94fd7..2523cfed 100644
--- a/backport/backport-include/linux/netdevice.h
+++ b/backport/backport-include/linux/netdevice.h
@@ -183,4 +183,21 @@  struct net_device_path_ctx {
 };
 #endif /* NET_DEVICE_PATH_STACK_MAX */
 
+#if LINUX_VERSION_IS_LESS(5,18,0)
+static inline int LINUX_BACKPORT(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;
+}
+#define netif_rx LINUX_BACKPORT(netif_rx)
+#endif /* < 5.18.0 */
+
 #endif /* __BACKPORT_NETDEVICE_H */