Skip to contentSkip to conversation

backports: add netif_rx()

PATCH New Johannes Berg 1 participant 1 message Apr 4, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 backports: add netif_rx()

From: Johannes Berg <[email protected]>

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

Change-Id Ie974d61fc51bd6ae44a6a92cee7da674bb179680
---
 backport-include/linux/netdevice.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
backport-include/linux/netdevice.h +17 -0
index 6214a69a3e65..bd31c94bde76 100644
@@ -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 */
Signature · 4 lines
2.35.1

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