diff options
author | Eric Dumazet <edumazet@google.com> | 2016-11-15 10:15:13 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-11-16 13:40:58 -0500 |
commit | 364b6055738b4c752c30ccaaf25c624e69d76195 (patch) | |
tree | 4992c104a968cc42db4e45151426388845903ad3 /net/core | |
parent | 21cb84c48ca0619181106f0f44f3802a989de024 (diff) |
net: busy-poll: return busypolling status to drivers
NAPI drivers use napi_complete_done() or napi_complete() when
they drained RX ring and right before re-enabling device interrupts.
In busy polling, we can avoid interrupts being delivered since
we are polling RX ring in a controlled loop.
Drivers can chose to use napi_complete_done() return value
to reduce interrupts overhead while busy polling is active.
This is optional, legacy drivers should work fine even
if not updated.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Cc: Adam Belay <abelay@google.com>
Cc: Tariq Toukan <tariqt@mellanox.com>
Cc: Yuval Mintz <Yuval.Mintz@cavium.com>
Cc: Ariel Elior <ariel.elior@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/dev.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 369dcc8efc01..edba9efeb2e9 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -4898,7 +4898,7 @@ void __napi_schedule_irqoff(struct napi_struct *n) } EXPORT_SYMBOL(__napi_schedule_irqoff); -void __napi_complete(struct napi_struct *n) +bool __napi_complete(struct napi_struct *n) { BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); @@ -4906,15 +4906,16 @@ void __napi_complete(struct napi_struct *n) * napi_complete_done(). */ if (unlikely(test_bit(NAPI_STATE_IN_BUSY_POLL, &n->state))) - return; + return false; list_del_init(&n->poll_list); smp_mb__before_atomic(); clear_bit(NAPI_STATE_SCHED, &n->state); + return true; } EXPORT_SYMBOL(__napi_complete); -void napi_complete_done(struct napi_struct *n, int work_done) +bool napi_complete_done(struct napi_struct *n, int work_done) { unsigned long flags; @@ -4926,7 +4927,7 @@ void napi_complete_done(struct napi_struct *n, int work_done) */ if (unlikely(n->state & (NAPIF_STATE_NPSVC | NAPIF_STATE_IN_BUSY_POLL))) - return; + return false; if (n->gro_list) { unsigned long timeout = 0; @@ -4948,6 +4949,7 @@ void napi_complete_done(struct napi_struct *n, int work_done) __napi_complete(n); local_irq_restore(flags); } + return true; } EXPORT_SYMBOL(napi_complete_done); |