Re: [PATCH net-next v10 2/8] net: bcmgenet: allow a continuation descriptor without the alignment pad
From: netdev-bot+sashiko
Date: Sat Nov 28 2026 - 06:26:18 EST
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] Concern: after this patch, the length check in bcmgenet_desc_rx()
(drivers/net/ethernet/broadcom/genet/bcmgenet.c), commented "Reject…
--
net: bcmgenet: allow a continuation descriptor without the alignment pad
This patch changes the RX length check in bcmgenet_desc_rx(). Only
descriptors with DMA_SOP now need room for the 64 byte status block plus
the 2 byte alignment pad. Continuation descriptors only need room for the
64 byte status block. The patch prepares for a larger MTU.
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> index 7e78db243442c..67296eb22a5c3 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
[ ... ]
> @@ -2394,8 +2396,12 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
> __func__, p_index, ring->c_index,
> ring->read_ptr, dma_length_status);
>
> + /* Only the first descriptor carries the alignment pad */
> + min_len = dma_flag & DMA_SOP ? GENET_RSB_PAD
> + : sizeof(struct status_64);
> +
> /* Reject lengths that would underflow the SKB build path. */
> - if (unlikely(len > RX_BUF_LENGTH || len < GENET_RSB_PAD)) {
> + if (unlikely(len > RX_BUF_LENGTH || len < min_len)) {
[Severity: Low]
The comment above this check still says it rejects lengths that would
underflow the SKB build path. For a non-SOP descriptor, though, it now
accepts len values of 64 and 65.
Further down in bcmgenet_desc_rx(), the build path always subtracts the
full 66 byte GENET_RSB_PAD:
skb_reserve(skb, GENET_RSB_PAD);
__skb_put(skb, len - GENET_RSB_PAD);
At this commit, only the fragmented drop that comes next keeps such a
descriptor away from that subtraction:
if (unlikely(!(dma_flag & DMA_EOP) || !(dma_flag & DMA_SOP))) {
So nothing can be hit at runtime here. Still, is it intended that the
guard and the build path disagree at this point in the series?
Later in the series, "net: bcmgenet: reassemble jumbo frames from status
block fragments" sends non-SOP descriptors to bcmgenet_add_frag(), which
subtracts sizeof(struct status_64). That commit also raises the non-SOP
minimum to sizeof(struct status_64) + 1, which brings the guard and both
build paths back in line.
The commit message describes a continuation "holding a single byte", which
is a len of 65. A len of 64, with no data bytes, also passes this check.
Would it make sense to use sizeof(struct status_64) + 1 here already, or
to adjust the comment in this patch?
> netif_err(priv, rx_status, dev,
> "invalid packet length %d\n", len);
> BCMGENET_STATS64_INC(stats, length_errors);
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261127-nb-genet-mtu-nn-v2-v10-0-749c7cc45d97%40tipi-net.de