[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2aecd34f-259f-4660-9df7-3d7a320b51d1@lunn.ch>
Date: Thu, 21 Aug 2025 05:29:06 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Shenwei Wang <shenwei.wang@....com>
Cc: Wei Fang <wei.fang@....com>, Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
Clark Wang <xiaoning.wang@....com>,
Stanislav Fomichev <sdf@...ichev.me>, imx@...ts.linux.dev,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-imx@....com
Subject: Re: [PATCH net-next] net: fec: add the Jumbo frame support
On Wed, Aug 20, 2025 at 05:23:08PM -0500, Shenwei Wang wrote:
> Certain i.MX SoCs, such as i.MX8QM and i.MX8QXP, feature enhanced
> FEC hardware that supports Ethernet Jumbo frames with packet sizes
> up to 16K bytes.
>
> When Jumbo frames are enabled, the TX FIFO may not be large enough
> to hold an entire frame. To accommodate this, the FIFO should be
> configured to operate in cut-through mode, which allows transmission
> to begin once the FIFO reaches a certain threshold.
Please could you break this patch up into smaller parts, doing
refactoring before adding jumbo support.
> fec_restart(struct net_device *ndev)
> {
> struct fec_enet_private *fep = netdev_priv(ndev);
> - u32 rcntl = OPT_FRAME_SIZE | FEC_RCR_MII;
> + u32 rcntl = FEC_RCR_MII;
> u32 ecntl = FEC_ECR_ETHEREN;
>
> + rcntl |= (fep->max_buf_size << 16);
> if (fep->bufdesc_ex)
> fec_ptp_save_state(fep);
>
> @@ -1191,7 +1199,7 @@ fec_restart(struct net_device *ndev)
> else
> val &= ~FEC_RACC_OPTIONS;
> writel(val, fep->hwp + FEC_RACC);
> - writel(PKT_MAXBUF_SIZE, fep->hwp + FEC_FTRL);
> + writel(fep->max_buf_size, fep->hwp + FEC_FTRL);
> }
> #endif
>
> @@ -1278,8 +1286,16 @@ fec_restart(struct net_device *ndev)
> if (fep->quirks & FEC_QUIRK_ENET_MAC) {
> /* enable ENET endian swap */
> ecntl |= FEC_ECR_BYTESWP;
> - /* enable ENET store and forward mode */
> - writel(FEC_TXWMRK_STRFWD, fep->hwp + FEC_X_WMRK);
> +
> + /* When Jumbo Frame is enabled, the FIFO may not be large enough
> + * to hold an entire frame. In this case, configure the interface
> + * to operate in cut-through mode, triggered by the FIFO threshold.
> + * Otherwise, enable the ENET store-and-forward mode.
> + */
> + if (fep->quirks & FEC_QUIRK_JUMBO_FRAME)
> + writel(0xF, fep->hwp + FEC_X_WMRK);
> + else
> + writel(FEC_TXWMRK_STRFWD, fep->hwp + FEC_X_WMRK);
> }
>
> if (fep->bufdesc_ex)
Part of why i ask for this to be broken up is that OPT_FRAME_SIZE has
just disappeared. It has not moved into an if/else, just gone.
#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARM) || \
defined(CONFIG_ARM64)
#define OPT_FRAME_SIZE (PKT_MAXBUF_SIZE << 16)
#else
#define OPT_FRAME_SIZE 0
#endif
and
* 2048 byte skbufs are allocated. However, alignment requirements
* varies between FEC variants. Worst case is 64, so round down by 64.
*/
#define PKT_MAXBUF_SIZE (round_down(2048 - 64, 64))
It is unclear to me where all this alignment code has gone. And does
jumbo have the same alignment issues?
A smaller patch just refactoring this bit of code can have a good
commit message explaining what is going on. Some for other parts of
the code. You want lots if small, obviously correct, well described
patches which are easy to review.
Andrew
---
pw-bot: cr
Powered by blists - more mailing lists