From: sashiko-bot@kernel.org
To: "Nicolai Buchwitz" <nb@tipi-net.de>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v8 3/7] net: bcmgenet: add basic XDP support (PASS/DROP)
Date: Wed, 29 Apr 2026 21:17:00 +0000 [thread overview]
Message-ID: <20260429211701.55F2FC19425@smtp.kernel.org> (raw)
In-Reply-To: <20260428205846.2625550-4-nb@tipi-net.de>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Hardware checksum offload (CHECKSUM_COMPLETE) is unconditionally applied after XDP execution, causing valid modified packets to be dropped.
- [Medium] The driver advertises NETDEV_XDP_ACT_BASIC without supporting XDP_TX, violating the XDP feature API contract.
--
commit fcb14e148a380096868da445b34bcc00893540bf
Author: Nicolai Buchwitz <nb@tipi-net.de>
net: bcmgenet: add basic XDP support (PASS/DROP)
This commit adds basic XDP support to the bcmgenet driver, allowing XDP
programs to execute in the RX path with support for XDP_PASS and XDP_DROP.
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
[ ... ]
> @@ -2404,30 +2462,34 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
[ ... ]
> + /* Save rx_csum before XDP runs - an XDP program
> + * could overwrite the RSB via bpf_xdp_adjust_head.
> */
> + if (dev->features & NETIF_F_RXCSUM)
> + rx_csum = (__force __be16)(status->rx_csum & 0xffff);
>
> + xdp_init_buff(&xdp, PAGE_SIZE, &ring->xdp_rxq);
> + xdp_prepare_buff(&xdp, page_address(rx_page),
> + GENET_RX_HEADROOM, pkt_len, true);
>
> + xdp_act = bcmgenet_run_xdp(ring, xdp_prog, &xdp, rx_page);
> + if (xdp_act != XDP_PASS)
> + goto next;
>
> + skb = bcmgenet_xdp_build_skb(ring, &xdp);
> + if (unlikely(!skb)) {
> + BCMGENET_STATS64_INC(stats, dropped);
> + page_pool_put_full_page(ring->page_pool,
> + rx_page, true);
> + goto next;
> }
>
> /* Set up checksum offload */
> if (dev->features & NETIF_F_RXCSUM) {
> - rx_csum = (__force __be16)(status->rx_csum & 0xffff);
> if (rx_csum) {
> skb->csum = (__force __wsum)ntohs(rx_csum);
> skb->ip_summed = CHECKSUM_COMPLETE;
> }
If the XDP program modifies the packet payload (e.g., rewriting IPs or
ports), the hardware checksum saved before XDP execution will no longer match
the new payload.
If we unconditionally apply this old checksum and set CHECKSUM_COMPLETE on
the SKB here, will the network stack drop the valid modified packet due to a
hardware checksum failure?
Should the checksum be invalidated when an XDP program is present?
[ ... ]
> @@ -4054,6 +4148,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
> NETIF_F_RXCSUM;
> dev->hw_features |= dev->features;
> dev->vlan_features |= dev->features;
> + dev->xdp_features = NETDEV_XDP_ACT_BASIC;
>
> netdev_sw_irq_coalesce_default_on(dev);
The commit message notes that XDP_TX is not yet supported and returns
XDP_ABORTED.
The UAPI definition for NETDEV_XDP_ACT_BASIC implies support for XDP_PASS,
XDP_DROP, XDP_ABORTED, and XDP_TX. Does advertising this flag without XDP_TX
support break feature detection for userspace applications?
I see from the patch series that XDP_TX support is added in a later commit.
Would it be safer to defer setting NETDEV_XDP_ACT_BASIC until that patch to
avoid breaking userspace assumptions during a bisect?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260428205846.2625550-1-nb@tipi-net.de?part=3
next prev parent reply other threads:[~2026-04-29 21:17 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-28 20:58 [PATCH net-next v8 0/7] net: bcmgenet: add XDP support Nicolai Buchwitz
2026-04-28 20:58 ` [PATCH net-next v8 2/7] net: bcmgenet: register xdp_rxq_info for each RX ring Nicolai Buchwitz
2026-04-28 20:58 ` [PATCH net-next v8 3/7] net: bcmgenet: add basic XDP support (PASS/DROP) Nicolai Buchwitz
2026-04-29 21:17 ` sashiko-bot [this message]
2026-04-29 22:24 ` Nicolai Buchwitz
2026-04-28 20:58 ` [PATCH net-next v8 4/7] net: bcmgenet: add XDP_TX support Nicolai Buchwitz
2026-04-29 21:17 ` sashiko-bot
2026-04-29 22:28 ` Nicolai Buchwitz
2026-04-28 20:58 ` [PATCH net-next v8 5/7] net: bcmgenet: add XDP_REDIRECT and ndo_xdp_xmit support Nicolai Buchwitz
2026-04-29 21:17 ` sashiko-bot
2026-04-29 22:50 ` Nicolai Buchwitz
2026-04-28 20:58 ` [PATCH net-next v8 6/7] net: bcmgenet: add XDP statistics counters Nicolai Buchwitz
2026-04-29 21:17 ` sashiko-bot
2026-04-29 22:39 ` Nicolai Buchwitz
2026-04-28 20:58 ` [PATCH net-next v8 7/7] net: bcmgenet: reject MTU changes incompatible with XDP Nicolai Buchwitz
2026-04-29 21:17 ` sashiko-bot
2026-04-29 22:35 ` 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=20260429211701.55F2FC19425@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=nb@tipi-net.de \
--cc=sashiko@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox