net: lan966x: Improve the CPU TX bitrate.
authorHoratiu Vultur <horatiu.vultur@microchip.com>
Thu, 10 Mar 2022 08:40:05 +0000 (09:40 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 11 Mar 2022 11:13:09 +0000 (11:13 +0000)
commitfb9eb027fbc90e21cbda18379d85f8603e1f28b9
treee9fd4748874137768d7c52dabc2d13014b908c98
parent89ff05d5953bfd838c5ab27d38154f0f119c97fd
net: lan966x: Improve the CPU TX bitrate.

When doing manual injection of the frame, it is required to check if the
TX FIFO is ready to accept the next word of the frame. For this we are
using 'readx_poll_timeout_atomic', the only problem is that before it
actually checks the status, is determining the time when to finish polling
the status. Which seems to be an expensive operation.
Therefore check the status of the TX FIFO before calling
'readx_poll_timeout_atomic'.
Doing this will improve the TX bitrate by ~70%. Because 99% the FIFO is
ready by that time. The measurements were done using iperf3.

Before:
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.03  sec  55.2 MBytes  46.2 Mbits/sec    0 sender
[  5]   0.00-10.04  sec  53.8 MBytes  45.0 Mbits/sec      receiver

After:
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.10  sec  95.0 MBytes  78.9 Mbits/sec    0 sender
[  5]   0.00-10.11  sec  95.0 MBytes  78.8 Mbits/sec      receiver

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/microchip/lan966x/lan966x_main.c