mirror of
https://github.com/breeze303/openwrt-ipq.git
synced 2025-12-17 00:21:06 +00:00
qualcommax: NSS: introduce helper functions for NAPI threading
Signed-off-by: Sean Khan <datapronix@protonmail.com>
This commit is contained in:
parent
0996df5b06
commit
55ede04914
@ -0,0 +1,59 @@
|
|||||||
|
--- a/include/linux/netdevice.h
|
||||||
|
+++ b/include/linux/netdevice.h
|
||||||
|
@@ -2711,6 +2711,25 @@ netif_napi_add(struct net_device *dev, s
|
||||||
|
netif_napi_add_weight(dev, napi, poll, NAPI_POLL_WEIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
+
|
||||||
|
+static inline void netif_threaded_napi_add_weight(struct net_device *dev,
|
||||||
|
+ struct napi_struct *napi,
|
||||||
|
+ int (*poll)(struct napi_struct *, int),
|
||||||
|
+ int weight)
|
||||||
|
+{
|
||||||
|
+ netif_napi_add_weight(dev, napi, poll, weight);
|
||||||
|
+ if (num_online_cpus() > 1) {
|
||||||
|
+ dev_set_threaded(dev, true);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static inline void netif_threaded_napi_add(struct net_device *dev,
|
||||||
|
+ struct napi_struct *napi,
|
||||||
|
+ int (*poll)(struct napi_struct *, int))
|
||||||
|
+{
|
||||||
|
+ netif_threaded_napi_add_weight(dev, napi, poll, NAPI_POLL_WEIGHT);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static inline void
|
||||||
|
netif_napi_add_tx_weight(struct net_device *dev,
|
||||||
|
struct napi_struct *napi,
|
||||||
|
@@ -2721,6 +2740,16 @@ netif_napi_add_tx_weight(struct net_devi
|
||||||
|
netif_napi_add_weight(dev, napi, poll, weight);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static inline void
|
||||||
|
+netif_threaded_napi_add_tx_weight(struct net_device *dev,
|
||||||
|
+ struct napi_struct *napi,
|
||||||
|
+ int (*poll)(struct napi_struct *, int),
|
||||||
|
+ int weight)
|
||||||
|
+{
|
||||||
|
+ set_bit(NAPI_STATE_NO_BUSY_POLL, &napi->state);
|
||||||
|
+ netif_threaded_napi_add_weight(dev, napi, poll, weight);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* netif_napi_add_tx() - initialize a NAPI context to be used for Tx only
|
||||||
|
* @dev: network device
|
||||||
|
@@ -2738,6 +2767,13 @@ static inline void netif_napi_add_tx(str
|
||||||
|
netif_napi_add_tx_weight(dev, napi, poll, NAPI_POLL_WEIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static inline void netif_threaded_napi_add_tx(struct net_device *dev,
|
||||||
|
+ struct napi_struct *napi,
|
||||||
|
+ int (*poll)(struct napi_struct *, int))
|
||||||
|
+{
|
||||||
|
+ netif_threaded_napi_add_tx_weight(dev, napi, poll, NAPI_POLL_WEIGHT);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* __netif_napi_del - remove a NAPI context
|
||||||
|
* @napi: NAPI context
|
||||||
Loading…
Reference in New Issue
Block a user