[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <de66722b-9832-e9dc-008a-5baece0c7afa@microchip.com>
Date: Fri, 17 Jun 2022 07:27:03 +0000
From: <Claudiu.Beznea@...rochip.com>
To: <o.rempel@...gutronix.de>, <Nicolas.Ferre@...rochip.com>,
<davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<pabeni@...hat.com>
CC: <kernel@...gutronix.de>, <linux-kernel@...r.kernel.org>,
<netdev@...r.kernel.org>
Subject: Re: [PATCH net-next v2 1/1] net: macb: fix negative max_mtu size for
sama5d3
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@...gutronix.de>
Reviewed-by: Claudiu Beznea <claudiu.beznea@...rochip.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
>
Powered by blists - more mailing lists