* [PATCH net-next v2 1/1] net: macb: fix negative max_mtu size for sama5d3
@ 2022-06-17 7:16 Oleksij Rempel
2022-06-17 7:27 ` Claudiu.Beznea
2022-06-17 10:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Oleksij Rempel @ 2022-06-17 7:16 UTC (permalink / raw)
To: Nicolas Ferre, Claudiu Beznea, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: Oleksij Rempel, kernel, linux-kernel, netdev
JML register on probe will return zero . This register is configured
later on macb_init_hw() which is called on open.
Since we have zero, after header and FCS length subtraction we will get
negative max_mtu size. This issue was affecting DSA drivers with MTU support
(for example KSZ9477).
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
changes v2:
- properly describe fail reason
- simplify max_mtu logic
drivers/net/ethernet/cadence/macb_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index d89098f4ede8..d0ea8dbfa213 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4913,8 +4913,8 @@ static int macb_probe(struct platform_device *pdev)
/* MTU range: 68 - 1500 or 10240 */
dev->min_mtu = GEM_MTU_MIN_SIZE;
- if (bp->caps & MACB_CAPS_JUMBO)
- dev->max_mtu = gem_readl(bp, JML) - ETH_HLEN - ETH_FCS_LEN;
+ if ((bp->caps & MACB_CAPS_JUMBO) && bp->jumbo_max_len)
+ dev->max_mtu = bp->jumbo_max_len - ETH_HLEN - ETH_FCS_LEN;
else
dev->max_mtu = ETH_DATA_LEN;
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v2 1/1] net: macb: fix negative max_mtu size for sama5d3
2022-06-17 7:16 [PATCH net-next v2 1/1] net: macb: fix negative max_mtu size for sama5d3 Oleksij Rempel
@ 2022-06-17 7:27 ` Claudiu.Beznea
2022-06-17 10:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Claudiu.Beznea @ 2022-06-17 7:27 UTC (permalink / raw)
To: o.rempel, Nicolas.Ferre, davem, edumazet, kuba, pabeni
Cc: kernel, linux-kernel, netdev
On 17.06.2022 10:16, Oleksij Rempel wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> JML register on probe will return zero . This register is configured
> later on macb_init_hw() which is called on open.
> Since we have zero, after header and FCS length subtraction we will get
> negative max_mtu size. This issue was affecting DSA drivers with MTU support
> (for example KSZ9477).
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> ---
> changes v2:
> - properly describe fail reason
> - simplify max_mtu logic
>
> drivers/net/ethernet/cadence/macb_main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index d89098f4ede8..d0ea8dbfa213 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -4913,8 +4913,8 @@ static int macb_probe(struct platform_device *pdev)
>
> /* MTU range: 68 - 1500 or 10240 */
> dev->min_mtu = GEM_MTU_MIN_SIZE;
> - if (bp->caps & MACB_CAPS_JUMBO)
> - dev->max_mtu = gem_readl(bp, JML) - ETH_HLEN - ETH_FCS_LEN;
> + if ((bp->caps & MACB_CAPS_JUMBO) && bp->jumbo_max_len)
> + dev->max_mtu = bp->jumbo_max_len - ETH_HLEN - ETH_FCS_LEN;
> else
> dev->max_mtu = ETH_DATA_LEN;
>
> --
> 2.30.2
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v2 1/1] net: macb: fix negative max_mtu size for sama5d3
2022-06-17 7:16 [PATCH net-next v2 1/1] net: macb: fix negative max_mtu size for sama5d3 Oleksij Rempel
2022-06-17 7:27 ` Claudiu.Beznea
@ 2022-06-17 10:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-06-17 10:50 UTC (permalink / raw)
To: Oleksij Rempel
Cc: nicolas.ferre, claudiu.beznea, davem, edumazet, kuba, pabeni,
kernel, linux-kernel, netdev
Hello:
This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:
On Fri, 17 Jun 2022 09:16:07 +0200 you wrote:
> JML register on probe will return zero . This register is configured
> later on macb_init_hw() which is called on open.
> Since we have zero, after header and FCS length subtraction we will get
> negative max_mtu size. This issue was affecting DSA drivers with MTU support
> (for example KSZ9477).
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
>
> [...]
Here is the summary with links:
- [net-next,v2,1/1] net: macb: fix negative max_mtu size for sama5d3
https://git.kernel.org/netdev/net-next/c/46e31db55da8
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-06-17 10:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-17 7:16 [PATCH net-next v2 1/1] net: macb: fix negative max_mtu size for sama5d3 Oleksij Rempel
2022-06-17 7:27 ` Claudiu.Beznea
2022-06-17 10:50 ` 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).