]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: enetc: correct the value of ENETC_RXB_TRUESIZE
authorWei Fang <wei.fang@nxp.com>
Thu, 16 Oct 2025 08:01:31 +0000 (16:01 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Oct 2025 13:01:21 +0000 (14:01 +0100)
[ Upstream commit e59bc32df2e989f034623a580e30a2a72af33b3f ]

The ENETC RX ring uses the page halves flipping mechanism, each page is
split into two halves for the RX ring to use. And ENETC_RXB_TRUESIZE is
defined to 2048 to indicate the size of half a page. However, the page
size is configurable, for ARM64 platform, PAGE_SIZE is default to 4K,
but it could be configured to 16K or 64K.

When PAGE_SIZE is set to 16K or 64K, ENETC_RXB_TRUESIZE is not correct,
and the RX ring will always use the first half of the page. This is not
consistent with the description in the relevant kernel doc and commit
messages.

This issue is invisible in most cases, but if users want to increase
PAGE_SIZE to receive a Jumbo frame with a single buffer for some use
cases, it will not work as expected, because the buffer size of each
RX BD is fixed to 2048 bytes.

Based on the above two points, we expect to correct ENETC_RXB_TRUESIZE
to (PAGE_SIZE >> 1), as described in the comment.

Fixes: d4fd0404c1c9 ("enetc: Introduce basic PF and VF ENETC ethernet drivers")
Signed-off-by: Wei Fang <wei.fang@nxp.com>
Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Link: https://patch.msgid.link/20251016080131.3127122-1-wei.fang@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/freescale/enetc/enetc.h

index 725c3d1cbb1982cbac50d7b7b920f998f3446e82..f58cca219a1e76e9bfad4a72b08de1b436570ec6 100644 (file)
@@ -28,7 +28,7 @@ struct enetc_tx_swbd {
 };
 
 #define ENETC_RX_MAXFRM_SIZE   ENETC_MAC_MAXFRM_SIZE
-#define ENETC_RXB_TRUESIZE     2048 /* PAGE_SIZE >> 1 */
+#define ENETC_RXB_TRUESIZE     (PAGE_SIZE >> 1)
 #define ENETC_RXB_PAD          NET_SKB_PAD /* add extra space if needed */
 #define ENETC_RXB_DMA_SIZE     \
        (SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - ENETC_RXB_PAD)