public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v2] net: lan966x: Improve the CPU TX bitrate.
@ 2022-03-10  8:40 Horatiu Vultur
  2022-03-10 14:36 ` Andrew Lunn
  2022-03-11 11:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Horatiu Vultur @ 2022-03-10  8:40 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: UNGLinuxDriver, davem, kuba, david.laight, andrew, Horatiu Vultur

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>
---
v1->v2
- check for TX FIFO status before calling readx_poll_timeout_atomic
---
 drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
index 81c01665d01e..e1bcb28039dc 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
@@ -185,6 +185,9 @@ static int lan966x_port_inj_ready(struct lan966x *lan966x, u8 grp)
 {
 	u32 val;
 
+	if (lan_rd(lan966x, QS_INJ_STATUS) & QS_INJ_STATUS_FIFO_RDY_SET(BIT(grp)))
+		return 0;
+
 	return readx_poll_timeout_atomic(lan966x_port_inj_status, lan966x, val,
 					 QS_INJ_STATUS_FIFO_RDY_GET(val) & BIT(grp),
 					 READL_SLEEP_US, READL_TIMEOUT_US);
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v2] net: lan966x: Improve the CPU TX bitrate.
  2022-03-10  8:40 [PATCH net-next v2] net: lan966x: Improve the CPU TX bitrate Horatiu Vultur
@ 2022-03-10 14:36 ` Andrew Lunn
  2022-03-11 11:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2022-03-10 14:36 UTC (permalink / raw)
  To: Horatiu Vultur
  Cc: netdev, linux-kernel, UNGLinuxDriver, davem, kuba, david.laight

On Thu, Mar 10, 2022 at 09:40:05AM +0100, Horatiu Vultur wrote:
> 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>

    Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v2] net: lan966x: Improve the CPU TX bitrate.
  2022-03-10  8:40 [PATCH net-next v2] net: lan966x: Improve the CPU TX bitrate Horatiu Vultur
  2022-03-10 14:36 ` Andrew Lunn
@ 2022-03-11 11:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-11 11:20 UTC (permalink / raw)
  To: Horatiu Vultur
  Cc: netdev, linux-kernel, UNGLinuxDriver, davem, kuba, david.laight,
	andrew

Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Thu, 10 Mar 2022 09:40:05 +0100 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net-next,v2] net: lan966x: Improve the CPU TX bitrate.
    https://git.kernel.org/netdev/net-next/c/fb9eb027fbc9

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-11 11:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-10  8:40 [PATCH net-next v2] net: lan966x: Improve the CPU TX bitrate Horatiu Vultur
2022-03-10 14:36 ` Andrew Lunn
2022-03-11 11:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox