Raise napi tx manually without softirq/irq context. In some cases, we hope to trigger TX Napi from the user's context. Because it is not triggered from softirq or IRQ, softirq will not be executed from IRQ Exit. Napi_tx_raise() here will call softirqd. For example, in the implementation of AF_XDP ZERCOPY TX, we want TX Napi to process packets in the XSK TX queue. But Virtio-Net does not support to generate a interrupt from hw manually. So We hope to trigger TX NAPI from the user's context. Signed-off-by: Xuan Zhuo <xuanzhuo@xxxxxxxxxxxxxxxxx> --- include/linux/netdevice.h | 7 +++++++ net/core/dev.c | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index d5ef4c1fedd2..a3f8664fadd5 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -519,6 +519,13 @@ static inline bool napi_complete(struct napi_struct *n) return napi_complete_done(n, 0); } +/** + * napi_tx_raise - raise tx napi + * + * Raise napi tx manually without softirq/irq context. + */ +void napi_tx_raise(void); + int dev_set_threaded(struct net_device *dev, bool threaded); /** diff --git a/net/core/dev.c b/net/core/dev.c index bb42150a38ec..ec19eff89c56 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -6092,6 +6092,17 @@ bool napi_complete_done(struct napi_struct *n, int work_done) } EXPORT_SYMBOL(napi_complete_done); +/** + * napi_tx_raise - raise tx napi + * + * Raise napi tx manually without softirq/irq context. + */ +void napi_tx_raise(void) +{ + raise_softirq(NET_TX_SOFTIRQ); +} +EXPORT_SYMBOL(napi_tx_raise); + /* must be called under rcu_read_lock(), as we dont take a reference */ static struct napi_struct *napi_by_id(unsigned int napi_id) { -- 2.32.0.3.g01195cf9f