From: Nicolai Buchwitz <nb@tipi-net.de>
To: netdev-bot+sashiko@kernel.org
Cc: opendmb@gmail.com, florian.fainelli@broadcom.com,
bcm-kernel-feedback-list@broadcom.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, dave.stevenson@raspberrypi.com,
justin.chen@broadcom.com, pierremarinleclercq88@gmail.com,
f.fainelli@gmail.com
Subject: Re: [PATCH net-next v3 5/8] net: bcmgenet: derive the receive buffer length from the MTU
Date: Thu, 08 Oct 2026 12:07:36 +0200 [thread overview]
Message-ID: <adbf20dcce3c19e4731a0ad0bace8fd1@tipi-net.de> (raw)
In-Reply-To: <179145241305.434549.6513642342117691943@kernel.org>
On 8.10.2026 11:40, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider.
>
> Critical: 0 · High: 0 · Medium: 1 · Low: 0
>
> 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] In bcmgenet_set_mtu_regs()
> (drivers/net/ethernet/broadcom/genet/bcmgenet.c), UMAC_MAX_FRAME_LEN…
>
> --
>
> net: bcmgenet: derive the receive buffer length from the MTU
>
> This commit computes the RBUF packet ready threshold from the MTU and
> derives the receive buffer length from it, replacing the fixed 2048
> byte
> RX_BUF_LENGTH. UMAC_MAX_FRAME_LEN and the TDMA flow period are now also
> derived from the MTU, and the TBUF threshold is programmed at its
> maximum.
>
>> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
>> b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
>> index 83ffc4a2a2a72..4a4b0c46f8986 100644
>> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
>> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
>
> [ ... ]
>
>> @@ -2630,6 +2648,44 @@ static void bcmgenet_link_intr_enable(struct
>> bcmgenet_priv *priv)
>
> [ ... ]
>
>> +/* Program the MTU dependent registers. Call with the MAC disabled.
>> */
>> +static void bcmgenet_set_mtu_regs(struct bcmgenet_priv *priv,
>> unsigned int mtu)
>> +{
>> + u32 thld = bcmgenet_pkt_rdy_thld(mtu);
>> +
>> + bcmgenet_umac_writel(priv, ENET_MAX_FRAME_LEN(mtu),
>> UMAC_MAX_FRAME_LEN);
>
> [Severity: Medium]
>
> Will this drop standard size frames once the MTU is lowered?
>
> Before this patch, UMAC_MAX_FRAME_LEN was always 1536. Now it is
> ENET_MAX_FRAME_LEN(mtu), which is mtu + 36, and nothing keeps it from
> going lower.
>
> The commit message says:
>
> The MTU is still fixed at ETH_DATA_LEN
>
> Only the upper bound is fixed, though. bcmgenet does not override
> min_mtu, so ether_setup() still allows any MTU from 68 up to 1500:
>
> net/ethernet/eth.c:ether_setup() {
> ...
> dev->min_mtu = ETH_MIN_MTU;
> dev->max_mtu = ETH_DATA_LEN;
> ...
> }
>
> This commit has no ndo_change_mtu, so __netif_set_mtu() only updates
> dev->mtu. The next open or full resume then writes the smaller value:
>
> init_umac()
> bcmgenet_set_mtu_regs(priv, priv->dev->mtu)
> bcmgenet_umac_writel(priv, ENET_MAX_FRAME_LEN(mtu),
> UMAC_MAX_FRAME_LEN)
>
> Take an MTU below about 1482, for example 1400 for a tunnel overlay, or
> 1280. Full size 1514/1518 byte frames from LAN peers would then be over
> the MAC limit. They would get DMA_RX_LG and be dropped in
> bcmgenet_desc_rx():
>
> if (dma_flag & DMA_RX_LG)
> u64_stats_inc(&stats->length_errors);
> ...
> page_pool_put_full_page(ring->page_pool, rx_page,
> true);
>
> Before this patch, the MAC accepted these frames whatever the MTU was.
> Full size UDP, broadcast, multicast or forwarded traffic that used to
> be
> received would now be lost.
>
> This still happens at the end of the series. The later commit "net:
> bcmgenet: allow the MTU to be changed" adds bcmgenet_change_mtu(),
> which
> applies the smaller limit straight away on a running interface.
>
> That later commit does fix two related cases here. One is the stale,
> too-small limit left after raising the MTU on a running interface. The
> other is the WoL fast resume mismatch between TDMA_FLOW_PERIOD and
> UMAC_MAX_FRAME_LEN.
>
> Would it work to program max(mtu, ETH_DATA_LEN) into
> UMAC_MAX_FRAME_LEN,
> and to update the commit message to match?
Sure. Will do in v4
---
pw-bot: cr
next prev parent reply other threads:[~2026-10-08 10:07 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 8:51 [PATCH net-next v3 0/8] net: bcmgenet: support larger MTUs Nicolai Buchwitz
2026-10-07 8:51 ` [PATCH net-next v3 1/8] net: bcmgenet: ring the doorbell when the last frame of a batch is dropped Nicolai Buchwitz
2026-10-07 8:51 ` [PATCH net-next v3 2/8] net: bcmgenet: let the caller decide whether to start the PHY Nicolai Buchwitz
2026-10-07 8:51 ` [PATCH net-next v3 3/8] net: bcmgenet: allow a continuation descriptor without the alignment pad Nicolai Buchwitz
2026-10-07 8:51 ` [PATCH net-next v3 4/8] net: bcmgenet: rename ENET_MAX_MTU_SIZE to ENET_MAX_FRAME_LEN Nicolai Buchwitz
2026-10-07 8:51 ` [PATCH net-next v3 5/8] net: bcmgenet: derive the receive buffer length from the MTU Nicolai Buchwitz
2026-10-08 9:40 ` netdev-bot+sashiko
2026-10-08 10:07 ` Nicolai Buchwitz [this message]
2026-10-07 8:51 ` [PATCH net-next v3 6/8] net: bcmgenet: pad transmit frames out of the packet ready window Nicolai Buchwitz
2026-10-08 9:40 ` netdev-bot+sashiko
2026-10-08 10:03 ` Nicolai Buchwitz
2026-10-07 8:51 ` [PATCH net-next v3 7/8] net: bcmgenet: allow the MTU to be changed Nicolai Buchwitz
2026-10-08 9:40 ` netdev-bot+sashiko
2026-10-08 10:17 ` Nicolai Buchwitz
2026-10-07 8:51 ` [PATCH net-next v3 8/8] net: bcmgenet: reassemble jumbo frames from status block fragments Nicolai Buchwitz
2026-10-07 8:56 ` [PATCH net-next v3 0/8] net: bcmgenet: support larger MTUs netdev-bot+sinfo
2026-10-08 8:02 ` Nicolai Buchwitz
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=adbf20dcce3c19e4731a0ad0bace8fd1@tipi-net.de \
--to=nb@tipi-net.de \
--cc=andrew+netdev@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=dave.stevenson@raspberrypi.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=f.fainelli@gmail.com \
--cc=florian.fainelli@broadcom.com \
--cc=justin.chen@broadcom.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=opendmb@gmail.com \
--cc=pabeni@redhat.com \
--cc=pierremarinleclercq88@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.