From: sashiko-bot@kernel.org
To: "Nicolai Buchwitz" <nb@tipi-net.de>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v7 6/7] net: bcmgenet: add XDP statistics counters
Date: Thu, 16 Apr 2026 20:08:49 +0000 [thread overview]
Message-ID: <20260416200849.A7891C2BCAF@smtp.kernel.org> (raw)
In-Reply-To: <20260416054743.1289191-7-nb@tipi-net.de>
Sashiko AI review found 3 potential issue(s):
- [Medium] Data race and lost increments on global XDP statistics
- [Medium] Missing statistics increment on frame conversion failure
- [Low] Integer overflow of fast-path software statistics
--
commit 7b7f282ba7f7296a985c1fcb93f530101e6a4b26
Author: Nicolai Buchwitz <nb@tipi-net.de>
net: bcmgenet: add XDP statistics counters
This commit adds XDP statistics counters to the bcmgenet driver. It exposes
xdp_pass, xdp_drop, xdp_tx, xdp_tx_err, xdp_redirect, and xdp_redirect_err
via ethtool statistics.
> 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
[ ... ]
> @@ -2428,6 +2435,7 @@ static unsigned int bcmgenet_run_xdp(struct bcmgenet_rx_ring *ring,
>
> switch (act) {
> case XDP_PASS:
> + priv->mib.xdp_pass++;
Is it possible for multiple RX queues to execute this concurrently?
Since priv->mib is global to the device, it seems concurrent NAPI contexts
executing on different CPUs could cause data races and lost increments. Should
these counters be tracked per-queue and aggregated, similar to the existing
tx_rings and rx_rings stats64 counters?
> return XDP_PASS;
> case XDP_TX:
> /* Prepend a zeroed TSB (Transmit Status Block). The GENET
[ ... ]
> xdp->data -= sizeof(struct status_64);
> xdp->data_meta -= sizeof(struct status_64);
> memset(xdp->data, 0, sizeof(struct status_64));
>
> xdpf = xdp_convert_buff_to_frame(xdp);
> if (unlikely(!xdpf)) {
> page_pool_put_full_page(ring->page_pool, rx_page,
> true);
Does this code miss a stat increment when xdp_convert_buff_to_frame fails?
It returns XDP_DROP here without incrementing xdp_tx_err or xdp_drop, unlike
the other failure paths in this same block.
> return XDP_DROP;
> }
[ ... ]
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
[ ... ]
> @@ -156,6 +156,12 @@ struct bcmgenet_mib_counters {
> u32 tx_dma_failed;
> u32 tx_realloc_tsb;
> u32 tx_realloc_tsb_failed;
> + u32 xdp_pass;
> + u32 xdp_drop;
> + u32 xdp_tx;
> + u32 xdp_tx_err;
> + u32 xdp_redirect;
> + u32 xdp_redirect_err;
> };
Since these are fast-path software counters for XDP, can they wrap around
quickly on 32-bit types? Would using 64-bit types like u64_stats_t be safer
to avoid silent wrap-arounds for long-term statistics?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260416054743.1289191-1-nb@tipi-net.de?part=6
next prev parent reply other threads:[~2026-04-16 20:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 5:47 [PATCH net-next v7 0/7] net: bcmgenet: add XDP support Nicolai Buchwitz
2026-04-16 5:47 ` [PATCH net-next v7 1/7] net: bcmgenet: convert RX path to page_pool Nicolai Buchwitz
2026-04-16 5:47 ` [PATCH net-next v7 2/7] net: bcmgenet: register xdp_rxq_info for each RX ring Nicolai Buchwitz
2026-04-16 5:47 ` [PATCH net-next v7 3/7] net: bcmgenet: add basic XDP support (PASS/DROP) Nicolai Buchwitz
2026-04-25 1:26 ` sashiko-bot
2026-04-16 5:47 ` [PATCH net-next v7 4/7] net: bcmgenet: add XDP_TX support Nicolai Buchwitz
2026-04-16 18:54 ` sashiko-bot
2026-04-16 5:47 ` [PATCH net-next v7 5/7] net: bcmgenet: add XDP_REDIRECT and ndo_xdp_xmit support Nicolai Buchwitz
2026-04-16 19:46 ` sashiko-bot
2026-04-16 5:47 ` [PATCH net-next v7 6/7] net: bcmgenet: add XDP statistics counters Nicolai Buchwitz
2026-04-16 20:08 ` sashiko-bot [this message]
2026-04-16 5:47 ` [PATCH net-next v7 7/7] net: bcmgenet: reject MTU changes incompatible with XDP Nicolai Buchwitz
2026-04-16 20:47 ` sashiko-bot
2026-04-16 8:06 ` [PATCH net-next v7 0/7] net: bcmgenet: add XDP support Paolo Abeni
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=20260416200849.A7891C2BCAF@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 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.