Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: Shenwei Wang <shenwei.wang@nxp.com>
To: Wei Fang <wei.fang@nxp.com>, Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>
Cc: Shenwei Wang <shenwei.wang@nxp.com>,
	Clark Wang <xiaoning.wang@nxp.com>,
	Stanislav Fomichev <sdf@fomichev.me>,
	imx@lists.linux.dev, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-imx@nxp.com
Subject: [PATCH v7 net-next 3/6] net: fec: update MAX_FL based on the current MTU
Date: Wed, 10 Sep 2025 13:52:08 -0500	[thread overview]
Message-ID: <20250910185211.721341-4-shenwei.wang@nxp.com> (raw)
In-Reply-To: <20250910185211.721341-1-shenwei.wang@nxp.com>

Configure the MAX_FL (Maximum Frame Length) register according to the
current MTU value, which ensures that packets exceeding the configured MTU
trigger an RX error.

Reviewed-by: Wei Fang <wei.fang@nxp.com>
Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
---
 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 5fb9afdafec4..c37ac84ab956 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1149,7 +1149,7 @@ fec_restart(struct net_device *ndev)
 	u32 rcntl = FEC_RCR_MII;

 	if (OPT_ARCH_HAS_MAX_FL)
-		rcntl |= fep->max_buf_size << 16;
+		rcntl |= (fep->netdev->mtu + ETH_HLEN + ETH_FCS_LEN) << 16;

 	if (fep->bufdesc_ex)
 		fec_ptp_save_state(fep);
--
2.43.0


  parent reply	other threads:[~2025-09-10 18:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-10 18:52 [PATCH v7 net-next 0/6] net: fec: add the Jumbo frame support Shenwei Wang
2025-09-10 18:52 ` [PATCH v7 net-next 1/6] net: fec: use a member variable for maximum buffer size Shenwei Wang
2025-09-10 18:52 ` [PATCH v7 net-next 2/6] net: fec: add pagepool_order to support variable page size Shenwei Wang
2025-09-10 18:52 ` Shenwei Wang [this message]
2025-09-10 18:52 ` [PATCH v7 net-next 4/6] net: fec: add rx_frame_size to support configurable RX length Shenwei Wang
2025-09-10 18:52 ` [PATCH v7 net-next 5/6] net: fec: add change_mtu to support dynamic buffer allocation Shenwei Wang
2025-09-10 18:52 ` [PATCH v7 net-next 6/6] net: fec: enable the Jumbo frame support for i.MX8QM Shenwei Wang
2025-09-14 21:30 ` [PATCH v7 net-next 0/6] net: fec: add the Jumbo frame support 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=20250910185211.721341-4-shenwei.wang@nxp.com \
    --to=shenwei.wang@nxp.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=wei.fang@nxp.com \
    --cc=xiaoning.wang@nxp.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