summaryrefslogtreecommitdiff
path: root/backport/backport-include/linux/netdevice.h
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2015-11-22 18:16:42 +0100
committerHauke Mehrtens <hauke@hauke-m.de>2015-11-24 00:06:43 +0100
commit50ad56a5154a159f316fab54563bc3852e6f7ce7 (patch)
tree2613dcaaad2685fc5c5d22ccec4d7a48a4fe45ae /backport/backport-include/linux/netdevice.h
parentc7367f27831ba247b8b5cfb89fac690c1fdd476a (diff)
header: add netif_tx_napi_add()
Older kernel versions do not support to only set NAPI for TX queues, so call the normal NAPI function and do it also for the used RX part. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'backport/backport-include/linux/netdevice.h')
-rw-r--r--backport/backport-include/linux/netdevice.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/backport/backport-include/linux/netdevice.h b/backport/backport-include/linux/netdevice.h
index 86d5ea75..bbe17a12 100644
--- a/backport/backport-include/linux/netdevice.h
+++ b/backport/backport-include/linux/netdevice.h
@@ -300,4 +300,26 @@ static inline void napi_complete_done(struct napi_struct *n, int work_done)
}
#endif /* < 3.19 */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,4,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)
+{
+ netif_napi_add(dev, napi, poll, weight);
+}
+#endif /* < 4.4 */
+
#endif /* __BACKPORT_NETDEVICE_H */