diff mbox series

[1/8] headers: backport napi add functions

Message ID 20221013085351.14516-1-nbd@nbd.name (mailing list archive)
State New, archived
Headers show
Series [1/8] headers: backport napi add functions | expand

Commit Message

Felix Fietkau Oct. 13, 2022, 8:53 a.m. UTC
Deal with the removed weight argument

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 backport/backport-include/linux/netdevice.h | 38 ++++++++++-----------
 1 file changed, 19 insertions(+), 19 deletions(-)
diff mbox series

Patch

diff --git a/backport/backport-include/linux/netdevice.h b/backport/backport-include/linux/netdevice.h
index 9b3291bb7188..c0c6a97945b1 100644
--- a/backport/backport-include/linux/netdevice.h
+++ b/backport/backport-include/linux/netdevice.h
@@ -23,27 +23,27 @@  static inline bool backport_napi_complete(struct napi_struct *n)
 #define napi_complete LINUX_BACKPORT(napi_complete)
 #endif /* < 4.10 */
 
-#if LINUX_VERSION_IS_LESS(4,5,0)
-#define netif_tx_napi_add LINUX_BACKPORT(netif_tx_napi_add)
-/**
- *	netif_tx_napi_add - initialize a napi context
- *	@dev:  network device
- *	@napi: napi context
- *	@poll: polling function
- *	@weight: default weight
- *
- * This variant of netif_napi_add() should be used from drivers using NAPI
- * to exclusively poll a TX queue.
- * This will avoid we add it into napi_hash[], thus polluting this hash table.
- */
-static inline void netif_tx_napi_add(struct net_device *dev,
-				     struct napi_struct *napi,
-				     int (*poll)(struct napi_struct *, int),
-				     int weight)
+#if LINUX_VERSION_IS_LESS(6,1,0)
+static inline void backport_netif_napi_add(struct net_device *dev,
+					   struct napi_struct *napi,
+					   int (*poll)(struct napi_struct *, int))
+{
+	netif_napi_add(dev, napi, poll, NAPI_POLL_WEIGHT);
+}
+#define netif_napi_add LINUX_BACKPORT(netif_napi_add)
+
+static inline void backport_netif_napi_add_tx(struct net_device *dev,
+					      struct napi_struct *napi,
+					      int (*poll)(struct napi_struct *, int))
 {
-	netif_napi_add(dev, napi, poll, weight);
+#if LINUX_VERSION_IS_LESS(4,5,0)
+	netif_napi_add(dev, napi, poll);
+#else
+	netif_tx_napi_add(dev, napi, poll, NAPI_POLL_WEIGHT);
+#endif
 }
-#endif /* < 4.5 */
+#define netif_napi_add_tx LINUX_BACKPORT(netif_napi_add_tx)
+#endif /* < 6.1 */
 
 #ifndef NETIF_F_CSUM_MASK
 #define NETIF_F_CSUM_MASK NETIF_F_ALL_CSUM