[PATCH 53/74] backports: add napi_schedule()

Johannes Berg <[email protected]> Fri, 24 May 2024 19:08:05 +0200
Newsgroups org.kernel.vger.backports
Message-ID <20240524190907.7a4b3ef2a400.I78f3e2b2279ed65ee357cf5f22cf5b339cc7e6a5@changeid>
From: Gregory Greenman <[email protected]>

napi_schedule() was introduced in v6.7 by the commit
0a779003213b ("netdev: make napi_schedule return bool on NAPI successful schedule")

Adjust backports accordingly.

Signed-off-by: Gregory Greenman <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
---
 backport/backport-include/linux/netdevice.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/backport/backport-include/linux/netdevice.h b/backport/backport-include/linux/netdevice.h
index 96d47811f7d9..319a1a4eff05 100644
--- a/backport/backport-include/linux/netdevice.h
+++ b/backport/backport-include/linux/netdevice.h
@@ -176,4 +176,17 @@ struct net_device_path_ctx {
 };
 #endif /* NET_DEVICE_PATH_STACK_MAX */
 
+#if LINUX_VERSION_IS_LESS(6,7,0)
+static inline bool LINUX_BACKPORT(napi_schedule)(struct napi_struct *n)
+{
+	if (napi_schedule_prep(n)) {
+		__napi_schedule(n);
+		return true;
+	}
+
+	return false;
+}
+#define napi_schedule LINUX_BACKPORT(napi_schedule)
+#endif /* < 6.7.0 */
+
 #endif /* __BACKPORT_NETDEVICE_H */
-- 
2.45.1