[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<PAXPR04MB851064BB30B2D5A39AE49CCE8896A@PAXPR04MB8510.eurprd04.prod.outlook.com>
Date: Wed, 21 Jan 2026 01:57:38 +0000
From: Wei Fang <wei.fang@....com>
To: Clemens Gruber <mail@...mensgruber.at>, "netdev@...r.kernel.org"
<netdev@...r.kernel.org>
CC: Shenwei Wang <shenwei.wang@....com>, Jakub Kicinski <kuba@...nel.org>,
"imx@...ts.linux.dev" <imx@...ts.linux.dev>, "stable@...nel.org"
<stable@...nel.org>
Subject: RE: [PATCH] net: fec: account for VLAN header in MAX_FL calculation
> Commit 62b5bb7be7bc ("net: fec: update MAX_FL based on the current MTU")
> changed the MAX_FL (maximum frame length) calculation without accounting
> for VLAN-tagged frames, leading to RX errors / dropped frames.
>
> Add VLAN_HLEN to the MAX_FL calculation.
>
> Fixes: 62b5bb7be7bc ("net: fec: update MAX_FL based on the current MTU")
>
> Signed-off-by: Clemens Gruber <mail@...mensgruber.at>
> Cc: stable@...nel.org
> ---
> drivers/net/ethernet/freescale/fec_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index e2b75d1970ae..f8f88c592323 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1151,7 +1151,7 @@ fec_restart(struct net_device *ndev)
> u32 rcntl = FEC_RCR_MII;
>
> if (OPT_ARCH_HAS_MAX_FL)
> - rcntl |= (fep->netdev->mtu + ETH_HLEN + ETH_FCS_LEN) <<
> 16;
> + rcntl |= (fep->netdev->mtu + ETH_HLEN + ETH_FCS_LEN +
> VLAN_HLEN) << 16;
The line is more than 80 characters after the change, so you can use
VLAN_ETH_HLEN instead of (ETH_HLEN + VLAN_HLEN).
Additionally, I believe the code in other places also needs to be modified
accordingly. See below.
fec_restart():
if ((fep->quirks & FEC_QUIRK_JUMBO_FRAME) &&
(ndev->mtu > (PKT_MAXBUF_SIZE - ETH_HLEN - ETH_FCS_LEN)))
writel(0xF, fep->hwp + FEC_X_WMRK);
fec_change_mtu():
order = get_order(new_mtu + ETH_HLEN + ETH_FCS_LEN
+ FEC_DRV_RESERVE_SPACE);
fec_probe():
ndev->max_mtu = fep->max_buf_size - ETH_HLEN - ETH_FCS_LEN;
Powered by blists - more mailing lists