linux-stable/drivers/net/ethernet/microchip
Sven Van Asbroeck 57030a0b62 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: 23f0703c12 ("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>
2020-12-16 09:00:09 -08:00
..
enc28j60.c netdev: pass the stuck queue to the timeout handler 2019-12-12 21:38:57 -08:00
enc28j60_hw.h
encx24j600-regmap.c drivers/net/ethernet: clean up mis-targeted comments 2020-09-25 16:29:00 -07:00
encx24j600.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-05-15 13:48:59 -07:00
encx24j600_hw.h
Kconfig ethernet: select CONFIG_CRC32 as needed 2020-12-04 14:42:21 -08:00
lan743x_ethtool.c lan743x: fix for potential NULL pointer dereference with bare card 2020-11-03 17:34:42 -08:00
lan743x_ethtool.h lan743x: Add support for ethtool get_drvinfo 2018-07-23 14:09:18 -07:00
lan743x_main.c lan743x: fix rx_napi_poll/interrupt ping-pong 2020-12-16 09:00:09 -08:00
lan743x_main.h lan743x: replace polling loop by wait_event_timeout() 2020-11-24 16:14:04 -08:00
lan743x_ptp.c lan743x: Added fixed link and RGMII support 2020-06-01 11:51:17 -07:00
lan743x_ptp.h Support LAN743x PTP periodic output on any GPIO 2019-11-11 12:46:56 -08:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00