public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: <Claudiu.Beznea@microchip.com>
To: <o.rempel@pengutronix.de>, <Nicolas.Ferre@microchip.com>,
	<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>
Cc: <kernel@pengutronix.de>, <linux-kernel@vger.kernel.org>,
	<netdev@vger.kernel.org>
Subject: Re: [PATCH net-next v2 1/1] net: macb: fix negative max_mtu size for sama5d3
Date: Fri, 17 Jun 2022 07:27:03 +0000	[thread overview]
Message-ID: <de66722b-9832-e9dc-008a-5baece0c7afa@microchip.com> (raw)
In-Reply-To: <20220617071607.3782772-1-o.rempel@pengutronix.de>

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
> 


  reply	other threads:[~2022-06-17  7:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2022-06-17 10:50 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=de66722b-9832-e9dc-008a-5baece0c7afa@microchip.com \
    --to=claudiu.beznea@microchip.com \
    --cc=Nicolas.Ferre@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox