]> git.baikalelectronics.ru Git - kernel.git/commit
xen-netfront: use napi_complete() correctly to prevent Rx stalling
authorDavid Vrabel <david.vrabel@citrix.com>
Tue, 16 Dec 2014 18:59:46 +0000 (18:59 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 16 Dec 2014 20:21:54 +0000 (15:21 -0500)
commit3cda2f2f8f91b8b1628c6a0d2a85ddc50ca3c36c
tree6f43b7a7aec9429a7fb71af7d1d2f1d0bf68a566
parent2fba1397caa547aaeb0a1b30bf31cd7eee1ed42f
xen-netfront: use napi_complete() correctly to prevent Rx stalling

After c7f3160ce88637ad42bab19d9ca5ce32a1b3ebcc (net: less interrupt
masking in NAPI) the napi instance is removed from the per-cpu list
prior to calling the n->poll(), and is only requeued if all of the
budget was used.  This inadvertently broke netfront because netfront
does not use NAPI correctly.

If netfront had not used all of its budget it would do a final check
for any Rx responses and avoid calling napi_complete() if there were
more responses.  It would still return under budget so it would never
be rescheduled.  The final check would also not re-enable the Rx
interrupt.

Additionally, xenvif_poll() would also call napi_complete() /after/
enabling the interrupt.  This resulted in a race between the
napi_complete() and the napi_schedule() in the interrupt handler.  The
use of local_irq_save/restore() avoided by race iff the handler is
running on the same CPU but not if it was running on a different CPU.

Fix both of these by always calling napi_compete() if the budget was
not all used, and then calling napi_schedule() if the final checks
says there's more work.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/xen-netfront.c