]> git.baikalelectronics.ru Git - kernel.git/commit
lan743x: fix rx_napi_poll/interrupt ping-pong
authorSven Van Asbroeck <thesven73@gmail.com>
Tue, 15 Dec 2020 16:19:54 +0000 (11:19 -0500)
committerJakub Kicinski <kuba@kernel.org>
Wed, 16 Dec 2020 17:00:09 +0000 (09:00 -0800)
commit9386763a62285ba00f51293a97289138a0f742c2
treec0be35d73256d0d5a9af9fba0fe2a5b2b3f2be8a
parent37b135fb2dafd69d2175fcfd0bf2e4d9a5baa40d
lan743x: fix rx_napi_poll/interrupt ping-pong

Even if there is more rx data waiting on the chip, the rx napi poll fn
will never run more than once - it will always read a few buffers, then
bail out and re-arm interrupts. Which results in ping-pong between napi
and interrupt.

This defeats the purpose of napi, and is bad for performance.

Fix by making the rx napi poll behave identically to other ethernet
drivers:
1. initialize rx napi polling with an arbitrary budget (64).
2. in the polling fn, return full weight if rx queue is not depleted,
   this tells the napi core to "keep polling".
3. update the rx tail ("ring the doorbell") once for every 8 processed
   rx ring buffers.

Thanks to Jakub Kicinski, Eric Dumazet and Andrew Lunn for their expert
opinions and suggestions.

Tested with 20 seconds of full bandwidth receive (iperf3):
        rx irqs      softirqs(NET_RX)
        -----------------------------
before  23827        33620
after   129          4081

Tested-by: Sven Van Asbroeck <thesven73@gmail.com> # lan7430
Fixes: 308800c59cf17 ("lan743x: Add main source files for new lan743x driver")
Signed-off-by: Sven Van Asbroeck <thesven73@gmail.com>
Link: https://lore.kernel.org/r/20201215161954.5950-1-TheSven73@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/microchip/lan743x_main.c