Article View: linux.kernel.netdev
Article #12596Re: [PATCH net-next v2 1/2] net: ethernet: mtk_eth_soc: skip page_pool
From: netdev-bot+sashiko
Date: Sat, 07 Nov 2026 22:00
Date: Sat, 07 Nov 2026 22:00
142 lines
13585 bytes
13585 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The page_pool gate added in mtk_rx_alloc()
(drivers/net/ethernet/mediatek/mtk_eth_soc.c:2827) checks…
- [Low] The commit message gives the reason for the gate as "On NETSYS v2
and later every RX ring gets a page_pool ... The HW-LRO ring already…
--
net: ethernet: mtk_eth_soc: skip page_pool
With this change, mtk_rx_alloc() creates a page_pool for an RX ring only
when ring->frag_size fits in PAGE_SIZE. Rings with larger buffers fall
back to the existing netdev_alloc_frag()/mtk_max_lro_buf_alloc() path.
Link: https://github.com/mediatek/mtk-openwrt-feeds
> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> index ad0fdc4133fb6..29370376f0322 100644
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> @@ -2819,7 +2819,12 @@ static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag)
> if (!ring->data)
> return -ENOMEM;
>
> - if (mtk_page_pool_enabled(eth)) {
> + /* page_pool hands out order-0 pages and the pool is created with
> + * MTK_PP_MAX_BUF_SIZE, so only rings whose buffers fit in a page can
> + * use it. The larger rings (HW-LRO, and 9K jumbo once enabled) take
> + * the netdev_alloc_frag()/mtk_max_lro_buf_alloc() path below.
> + */
[Severity: Low]
Is the HW-LRO part of this comment and of the commit message accurate?
The commit message says:
On NETSYS v2 and later every RX ring gets a page_pool.
...
The HW-LRO ring already needs 12K buffers, and 9K jumbo adds more such
rings; for those the descriptor length is larger than a page, so the
pool cannot back them.
mtk_page_pool_enabled() returns mtk_is_netsys_v2_or_greater(eth). MTK_HWLRO
is set only in mt2701_data, mt7622_data, mt7623_data and mt7629_data, and
all of those are .version = 1. MT7981_CAPS, MT7986_CAPS and MT7988_CAPS
don't include it. So a HW-LRO ring is never allocated on a SoC that has
page_pool enabled.
At this commit, every ring that reaches the new check uses ETH_DATA_LEN,
and mtk_add_mac() limits max_mtu:
eth->netdev[id]->max_mtu = MTK_MAX_RX_LENGTH_2K - MTK_RX_ETH_HLEN;
As a result, ring->frag_size <= PAGE_SIZE is always true here. The patch
doesn't change behavior until the following "add 9K jumbo" patch.
Could the commit message describe this as preparation for jumbo frames?
As written, it could be read as a fix for an existing HW-LRO overrun on
v2+, for example by stable backporters.
The next patch in the series renames mtk_max_lro_buf_alloc() to
mtk_max_buf_alloc() and enables 9K jumbo. After that, this comment still
says mtk_max_lro_buf_alloc() and "9K jumbo once enabled". Should that
patch also update the comment?
> + if (mtk_page_pool_enabled(eth) && ring->frag_size <= PAGE_SIZE) {
[Severity: Medium]
Does this check match what the pool can actually hold? The comment refers
to MTK_PP_MAX_BUF_SIZE, but the condition compares frag_size with
PAGE_SIZE.
The pool uses the page_pool layout:
mtk_create_page_pool() {
...
.offset = MTK_PP_HEADROOM,
.max_len = MTK_PP_MAX_BUF_SIZE,
...
}
#define MTK_PP_MAX_BUF_SIZE (PAGE_SIZE - MTK_PP_PAD)
MTK_PP_PAD is XDP_PACKET_HEADROOM (256) plus the aligned skb_shared_info.
The descriptor length is calculated for the netdev_alloc_frag() layout
instead:
mtk_max_buf_size() {
int buf_size = frag_size - NET_SKB_PAD - NET_IP_ALIGN -
SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
...
}
mtk_rx_alloc() then programs that value for page_pool buffers too:
rxd->rxd2 = RX_DMA_PREP_PLEN0(ring->buf_size);
buf_size is larger than MTK_PP_MAX_BUF_SIZE once frag_size goes above
about PAGE_SIZE - 256 + NET_SKB_PAD + NET_IP_ALIGN (around 3906 with 4K
pages). Those rings still pass the frag_size <= PAGE_SIZE check.
For example, with the "add 9K jumbo" patch applied, consider an MT7988
with 4K pages, CONFIG_MAX_SKB_FRAGS between 42 and 45, and an MTU set
before ifup so that rx_buf_len is 3072:
frag_size = 3200 + 768 = 3968 (passes this check)
buf_size = 3134
MTK_PP_MAX_BUF_SIZE = 4096 - 256 - 768 = 3072
The hardware may then DMA up to page offset 256 + 3134 = 3390, which is
past the start of skb_shared_info at 3328.
In that case PP_FLAG_DMA_SYNC_DEV syncs only max_len bytes for the
device. In mtk_poll_rx(), build_skb(data, PAGE_SIZE) sets up shinfo on top
of the received bytes. For pktlen > 3072, skb_put() would move tail past
skb->end and hit skb_over_panic().
It isn't confirmed whether the MAC actually delivers frames between 3073
and 3134 bytes, since that depends on hardware frame length limits. With
the default CONFIG_MAX_SKB_FRAGS=17, this window isn't reached.
Would ring->buf_size <= MTK_PP_MAX_BUF_SIZE be a better condition here?
It would match the limits mtk_change_mtu() and mtk_xdp_setup() already
check against MTK_PP_MAX_BUF_SIZE.
> struct page_pool *pp;
>
> pp = mtk_create_page_pool(eth, &ring->xdp_q, ring_no,
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/patch-2793186c653124c4c0b3d463bde2ea3a%40loljews.com
Technical Details
Message-ID:
<179408882923.994134.9885831030402062778@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358533-linux-kernel-netdev=dewy.ruReferences:
<patch-79206c12217411fcdbff905b65eecfb2@loljews.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358533-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v2 1/2] net: ethernet: mtk_eth_soc: skip page_pool Date: Sat, 07 Nov 2026 22:00:29 +0000 Organization: Usenet Network Message-ID: <179408882923.994134.9885831030402062778@kernel.org> References: <patch-79206c12217411fcdbff905b65eecfb2@loljews.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="6655"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:1qynwSR6vkugZRjeHtqvgU6+TZE= sha256:fkICZjImnbKQaymnEJ0MDgaqY3atVBDhy1/JanrgknA= sha1:5bSoKDMrU0tJuncqkgY7EkaZrvE= sha256:MkzCeQb2M8OnzONyMfkCBwwYMZ7j2oGSyXznKIbrB6c= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id D16311134BC; Sun, 8 Nov 2026 01:01:03 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.5 X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sXLo_142g38X; Sun, 8 Nov 2026 01:00:52 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-358533-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id BF2CF1134B9; Sun, 8 Nov 2026 01:00:41 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 98F0242DAC; Sat, 7 Nov 2026 22:00:32 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794088832; b=pxlEHN7wLc21On3R4+3nG3Q+C/TC6ILX/MDiGTmeU/ZbKBXbtOimIqRHft+296mTA9kL ddr1I/yoJ+7elFuglzC+j7iMxJlcaBeW5ypmVszXRuv4QiE9UCP8aDc1+Jar7m3DYzrye phozbhJUBoAHqo998TqAN/dKjv5NeIlPQe3GRXQ9bA/s10ypPuugpYffTsg4eHZNc6FIG yp9GDv7o+dzIdoSmoek88JvrJjfa+GJyGhGmecvw6ejoOtCvqjuSw2iaOBH6I7wqQxbWP LVoOAtYMiOK0W33a5o36sJ5goPiqrDsKmLf0AeZUVHv88bdiskoh59ke1P+aSJ8X2UA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794088832; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=R9mxM4jj9umMgpGEnC3ywyFmHTkF33AVyWG7Zk844IE=; b=uLWyy1wk9GLbV0JyjixFqYSJ2C9ZCYvPGcAHD3pgxgeroQNLxheYKH8j2XNEC0mqPg00 EonbPG+INfIejH5lwD+VFgcyaKqrOICGohUTLfQ4RvksrBrXxwCaiNRiBiNIZcjIE/nxa VGH5OZ2UoFxb66UpQbHi3gXZfhYi1Sfarz3yInHc0OqbNoLXxmNp+au/CNI8Xw4kr3Nt+ WR/uc8Kx5UW6g/Z4Z0zORDohvzGD45JlQ+Z+EYnuyL9l0UDaD5hcwBjfP6yKfNEDSbQbZ wga5/vf924yzDHMS1LZ8+yAmZbfXW5xheqD2eM9hV1Jddp9SgXvgVW9sdeKG2/61jGw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BJGDUGFM; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3EE96606A333; Sat, 7 Nov 2026 22:00:32 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BJGDUGFM X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794088831; b=B4IxBm27TeoXHpgM+rU6v+DZnnxoqsGDtUZ+txX5BF/bjGsmXwQstPe3gA9aEgXMOR77 8B3dXXXh1TNNqCvBp9L8Xx5QLeKIFenVeUdLWI7kAsRIL/y3E1xFPAG7j/m3HfqwwefT9 Wl9JmCiIFUadHLS74g2UfVXeXBYPxL/jYmmks2x7J7rUgfLI0USNTHrilUq7j7Vv7jLT7 a3eE5Px7emMCH/X9+L7lOBhQwd9CGwZvRrYJOHEggdtfsKrYjvmxk9gq5N+t7TFG4fs3x W0w6R4qzFDDrzSh9PBv6DsffatneroX5XUfVIGYZ9dtsSsiBb5g20T+Rl5+Ra9n63yg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794088831; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=R9mxM4jj9umMgpGEnC3ywyFmHTkF33AVyWG7Zk844IE=; b=u5YVlEUT2NBcQAIATqk1DdYyabGzlXxDCYAANhKhBm2jWQ/bEWLKpDfto08SKAdbA0Ai gOIDgM8ii0feE0qwXe7cpUOwPO6msfDfqpaxzLkOq0d7mKxsbX5r4Rzem1rjaaTKAWk/2 xe+06qBq6BRIEK0mgrPxU+rtAAURwA8ZU5muBaI7jFXUHmWNefgCxzWeZxq/31Cb22TxN 5oCkTxC2hsNmIvB8nVTlzcCjuW2SWMhkKNznN0ay/V93WwluEirLUhpFUsRV4fYIEPhws u8phIExY0x09T84aLZu2UPOwL/5MVsa8bUDTUs3w58r4irKD4vS5JuPtrrCDgMnfvig== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BJGDUGFM; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 115A6606A326; Sat, 7 Nov 2026 22:00:30 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD9BA1F0089F; Sat, 7 Nov 2026 22:00:29 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794088830; bh=R9mxM4jj9umMgpGEnC3ywyFmHTkF33AVyWG7Zk844IE=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=BJGDUGFMJe2pGxq+tPXY5B/2pUVIbR0qIdoNuJBE36kppS7P4bakHEMXwc1lLnznC 0LtswL9qQkT7s8mpn4zp/XC96TTPeIkBihLgAst9ZtUAPDnuGj7x4OGBRaCtBDf8Jh 4VNO4bm9jGh9fMhJmGMb60bRQdapfG13MwECWc1vBGnbCaFRUJ8wi5U1lw8HC4UURq KoXqNhLU0sTuRW+zFiF6Jw5mD87pFynMF0N0DKxvKW2iRcJn6ofibSSCGOCv7WfFN+ lmgh6PNw80pZYdWLereKkRSya8xC3+RT8p7rOy+4SSOSb0jXJYrw2/eUPOLcClaW5A ltoreifmz8HAQ== X-Cc: netdev@vger.kernel.org, nbd@nbd.name, lorenzo@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, linux@armlinux.org.uk, mason-cw.chang@mediatek.com, frank-w@public-files.de, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-In-Reply-To: <patch-79206c12217411fcdbff905b65eecfb2@loljews.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list