Commit 5b14ed3a authored by Shenwei Wang's avatar Shenwei Wang Committed by Jakub Kicinski
Browse files

net: fec: add rx_frame_size to support configurable RX length



Add a new rx_frame_size member in the fec_enet_private structure to
track the RX buffer size. On the Jumbo frame enabled system, the value
will be recalculated whenever the MTU is updated, allowing the driver
to allocate RX buffer efficiently.

Configure the TRUNC_FL (Frame Truncation Length) based on the smaller
value between max_buf_size and the rx_frame_size to maintain consistent
RX error behavior, regardless of whether Jumbo frames are enabled.

Reviewed-by: default avatarWei Fang <wei.fang@nxp.com>
Signed-off-by: default avatarShenwei Wang <shenwei.wang@nxp.com>
Link: https://patch.msgid.link/20250910185211.721341-5-shenwei.wang@nxp.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 62b5bb7b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -621,6 +621,7 @@ struct fec_enet_private {
	unsigned int total_rx_ring_size;
	unsigned int max_buf_size;
	unsigned int pagepool_order;
	unsigned int rx_frame_size;

	struct	platform_device *pdev;

+2 −1
Original line number Diff line number Diff line
@@ -1194,7 +1194,7 @@ fec_restart(struct net_device *ndev)
		else
			val &= ~FEC_RACC_OPTIONS;
		writel(val, fep->hwp + FEC_RACC);
		writel(fep->max_buf_size, fep->hwp + FEC_FTRL);
		writel(min(fep->rx_frame_size, fep->max_buf_size), fep->hwp + FEC_FTRL);
	}
#endif

@@ -4565,6 +4565,7 @@ fec_probe(struct platform_device *pdev)
	pinctrl_pm_select_sleep_state(&pdev->dev);

	fep->pagepool_order = 0;
	fep->rx_frame_size = FEC_ENET_RX_FRSIZE;
	fep->max_buf_size = PKT_MAXBUF_SIZE;
	ndev->max_mtu = fep->max_buf_size - ETH_HLEN - ETH_FCS_LEN;