netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net PATCH] net: ravb: Fix max TX frame size for RZ/V2M
@ 2025-01-09 11:37 Paul Barker
  2025-01-09 12:45 ` Niklas Söderlund
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Paul Barker @ 2025-01-09 11:37 UTC (permalink / raw)
  To: Niklas Söderlund, Andrew Lunn, David S. Miller, Eric Dumazet,
	Paolo Abeni
  Cc: Paul Barker, Simon Horman, Sergey Shtylyov, netdev,
	linux-renesas-soc, linux-kernel

When tx_max_frame_size was added to struct ravb_hw_info, no value was
set in ravb_rzv2m_hw_info so the default value of zero was used.

The maximum MTU is set by subtracting from tx_max_frame_size to allow
space for headers and frame checksums. As ndev->max_mtu is unsigned,
this subtraction wraps around leading to a ridiculously large positive
value that is obviously incorrect.

Before tx_max_frame_size was introduced, the maximum MTU was based on
rx_max_frame_size. So, we can restore the correct maximum MTU by copying
the rx_max_frame_size value into tx_max_frame_size for RZ/V2M.

Fixes: 1d63864299ca ("net: ravb: Fix maximum TX frame size for GbEth devices")
Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index ac0f093f647a..bc395294a32d 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2763,6 +2763,7 @@ static const struct ravb_hw_info ravb_rzv2m_hw_info = {
 	.net_features = NETIF_F_RXCSUM,
 	.stats_len = ARRAY_SIZE(ravb_gstrings_stats),
 	.tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
+	.tx_max_frame_size = SZ_2K,
 	.rx_max_frame_size = SZ_2K,
 	.rx_buffer_size = SZ_2K +
 			  SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),

base-commit: 2d2d4f60ed266a8f340a721102d035252606980b
-- 
2.39.5


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

* Re: [net PATCH] net: ravb: Fix max TX frame size for RZ/V2M
  2025-01-09 11:37 [net PATCH] net: ravb: Fix max TX frame size for RZ/V2M Paul Barker
@ 2025-01-09 12:45 ` Niklas Söderlund
  2025-01-09 16:31 ` Simon Horman
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Niklas Söderlund @ 2025-01-09 12:45 UTC (permalink / raw)
  To: Paul Barker
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
	Simon Horman, Sergey Shtylyov, netdev, linux-renesas-soc,
	linux-kernel

Hi Paul,

Nice catch.

On 2025-01-09 11:37:06 +0000, Paul Barker wrote:
> When tx_max_frame_size was added to struct ravb_hw_info, no value was
> set in ravb_rzv2m_hw_info so the default value of zero was used.
> 
> The maximum MTU is set by subtracting from tx_max_frame_size to allow
> space for headers and frame checksums. As ndev->max_mtu is unsigned,
> this subtraction wraps around leading to a ridiculously large positive
> value that is obviously incorrect.
> 
> Before tx_max_frame_size was introduced, the maximum MTU was based on
> rx_max_frame_size. So, we can restore the correct maximum MTU by copying
> the rx_max_frame_size value into tx_max_frame_size for RZ/V2M.
> 
> Fixes: 1d63864299ca ("net: ravb: Fix maximum TX frame size for GbEth devices")
> Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
>  drivers/net/ethernet/renesas/ravb_main.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index ac0f093f647a..bc395294a32d 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -2763,6 +2763,7 @@ static const struct ravb_hw_info ravb_rzv2m_hw_info = {
>  	.net_features = NETIF_F_RXCSUM,
>  	.stats_len = ARRAY_SIZE(ravb_gstrings_stats),
>  	.tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
> +	.tx_max_frame_size = SZ_2K,
>  	.rx_max_frame_size = SZ_2K,
>  	.rx_buffer_size = SZ_2K +
>  			  SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
> 
> base-commit: 2d2d4f60ed266a8f340a721102d035252606980b
> -- 
> 2.39.5
> 

-- 
Kind Regards,
Niklas Söderlund

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

* Re: [net PATCH] net: ravb: Fix max TX frame size for RZ/V2M
  2025-01-09 11:37 [net PATCH] net: ravb: Fix max TX frame size for RZ/V2M Paul Barker
  2025-01-09 12:45 ` Niklas Söderlund
@ 2025-01-09 16:31 ` Simon Horman
  2025-01-09 18:37 ` Sergey Shtylyov
  2025-01-11  2:20 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2025-01-09 16:31 UTC (permalink / raw)
  To: Paul Barker
  Cc: Niklas Söderlund, Andrew Lunn, David S. Miller, Eric Dumazet,
	Paolo Abeni, Sergey Shtylyov, netdev, linux-renesas-soc,
	linux-kernel

On Thu, Jan 09, 2025 at 11:37:06AM +0000, Paul Barker wrote:
> When tx_max_frame_size was added to struct ravb_hw_info, no value was
> set in ravb_rzv2m_hw_info so the default value of zero was used.
> 
> The maximum MTU is set by subtracting from tx_max_frame_size to allow
> space for headers and frame checksums. As ndev->max_mtu is unsigned,
> this subtraction wraps around leading to a ridiculously large positive
> value that is obviously incorrect.
> 
> Before tx_max_frame_size was introduced, the maximum MTU was based on
> rx_max_frame_size. So, we can restore the correct maximum MTU by copying
> the rx_max_frame_size value into tx_max_frame_size for RZ/V2M.
> 
> Fixes: 1d63864299ca ("net: ravb: Fix maximum TX frame size for GbEth devices")
> Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>

Reviewed-by: Simon Horman <horms@kernel.org>

...

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

* Re: [net PATCH] net: ravb: Fix max TX frame size for RZ/V2M
  2025-01-09 11:37 [net PATCH] net: ravb: Fix max TX frame size for RZ/V2M Paul Barker
  2025-01-09 12:45 ` Niklas Söderlund
  2025-01-09 16:31 ` Simon Horman
@ 2025-01-09 18:37 ` Sergey Shtylyov
  2025-01-11  2:20 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Sergey Shtylyov @ 2025-01-09 18:37 UTC (permalink / raw)
  To: Paul Barker, Niklas Söderlund, Andrew Lunn, David S. Miller,
	Eric Dumazet, Paolo Abeni
  Cc: Simon Horman, netdev, linux-renesas-soc, linux-kernel

On 1/9/25 2:37 PM, Paul Barker wrote:

> When tx_max_frame_size was added to struct ravb_hw_info, no value was
> set in ravb_rzv2m_hw_info so the default value of zero was used.
> 
> The maximum MTU is set by subtracting from tx_max_frame_size to allow
> space for headers and frame checksums. As ndev->max_mtu is unsigned,
> this subtraction wraps around leading to a ridiculously large positive
> value that is obviously incorrect.
> 
> Before tx_max_frame_size was introduced, the maximum MTU was based on
> rx_max_frame_size. So, we can restore the correct maximum MTU by copying
> the rx_max_frame_size value into tx_max_frame_size for RZ/V2M.

   Seems to be reviewers' fault as well?

> Fixes: 1d63864299ca ("net: ravb: Fix maximum TX frame size for GbEth devices")
> Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>

Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>

MBR, Sergey


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

* Re: [net PATCH] net: ravb: Fix max TX frame size for RZ/V2M
  2025-01-09 11:37 [net PATCH] net: ravb: Fix max TX frame size for RZ/V2M Paul Barker
                   ` (2 preceding siblings ...)
  2025-01-09 18:37 ` Sergey Shtylyov
@ 2025-01-11  2:20 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-01-11  2:20 UTC (permalink / raw)
  To: Paul Barker
  Cc: niklas.soderlund, andrew+netdev, davem, edumazet, pabeni, horms,
	s.shtylyov, netdev, linux-renesas-soc, linux-kernel

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu,  9 Jan 2025 11:37:06 +0000 you wrote:
> When tx_max_frame_size was added to struct ravb_hw_info, no value was
> set in ravb_rzv2m_hw_info so the default value of zero was used.
> 
> The maximum MTU is set by subtracting from tx_max_frame_size to allow
> space for headers and frame checksums. As ndev->max_mtu is unsigned,
> this subtraction wraps around leading to a ridiculously large positive
> value that is obviously incorrect.
> 
> [...]

Here is the summary with links:
  - [net] net: ravb: Fix max TX frame size for RZ/V2M
    https://git.kernel.org/netdev/net/c/e7e441a4100e

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] 5+ messages in thread

end of thread, other threads:[~2025-01-11  2:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-09 11:37 [net PATCH] net: ravb: Fix max TX frame size for RZ/V2M Paul Barker
2025-01-09 12:45 ` Niklas Söderlund
2025-01-09 16:31 ` Simon Horman
2025-01-09 18:37 ` Sergey Shtylyov
2025-01-11  2: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;
as well as URLs for NNTP newsgroup(s).