From: netdev-bot+sashiko@kernel.org
To: daniel.zahka@gmail.com
Cc: alexanderduyck@fb.com, kuba@kernel.org, kernel-team@meta.com,
andrew+netdev@lunn.ch, davem@davemloft.net, pabeni@redhat.com,
ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org,
john.fastabend@gmail.com, sdf@fomichev.me, edumazet@kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org
Subject: Re: [PATCH net-next v2 1/4] eth: mpnic: count packets, bytes, and drops per ring
Date: Tue, 13 Oct 2026 12:05:33 +0000 [thread overview]
Message-ID: <179189313386.434549.472154311742280420@kernel.org> (raw)
In-Reply-To: <20261012-mpnic-counters3-v2-1-8afba81c2d5a@gmail.com>
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 mpnic_clean_rcq()
(drivers/net/ethernet/meta/mpnic/mpnic_txrx.c), an Rx frame the driver…
--
eth: mpnic: count packets, bytes, and drops per ring
This commit adds packet, byte, drop and error counters to each Tx work,
Tx completion and Rx completion ring in the mpnic driver. The counters are
reported through ndo_get_stats64. An RCU-protected base snapshot holds the
totals folded in from rings that have been torn down.
> diff --git a/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c b/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c
> index 5495e9a9aa651..d5185e64f804c 100644
> --- a/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c
> +++ b/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c
[ ... ]
> @@ -594,13 +612,20 @@ static int mpnic_clean_rcq(struct mpnic_napi_vector *nv,
>
> if (likely(!(rcd &
> MPNIC_RCD_META_UNCORRECTABLE_ERR_MASK) &&
> - !state->pkt.add_frag_failed))
> + !state->pkt.add_frag_failed)) {
> + bytes += xdp_get_buff_len(&state->pkt.buff);
> skb = xdp_build_skb_from_buff(&state->pkt.buff);
> + }
>
> - if (likely(skb))
> + if (likely(skb)) {
> napi_gro_receive(&nv->napi, skb);
> - else
> + } else {
> mpnic_put_pkt_buff(&state->pkt, true);
> + if (rcd & MPNIC_RCD_META_UNCORRECTABLE_ERR_MASK)
> + errors++;
> + else
> + dropped++;
> + }
>
> state->pkt.buff.data_hard_start = NULL;
> packets++;
[Severity: Medium]
Is rx_bytes undercounted for frames that are dropped because
state->pkt.add_frag_failed is set?
mpnic_add_rx_frag() sets add_frag_failed when xdp_buff_add_frag() fails.
That happens once nr_frags reaches MAX_SKB_FRAGS and the fragment cannot
be coalesced:
mpnic_add_rx_frag() {
...
if (!xdp_buff_add_frag(buff, page_to_netmem(page), pg_off, len,
truesz)) {
state->payld.pagecnt_bias++;
state->pkt.add_frag_failed = true;
}
}
For such a frame the guarded branch above is skipped, so nothing is added
to bytes. skb stays NULL and the uncorrectable error bit is clear, so
dropped++ runs. packets++ runs unconditionally.
The frame is then counted in rcq.packets through packets - errors, but it
adds nothing to rcq.bytes:
> @@ -619,6 +644,13 @@ static int mpnic_clean_rcq(struct mpnic_napi_vector *nv,
>
> rcq->head = head;
>
> + u64_stats_update_begin(&rcq->stats.syncp);
> + u64_stats_add(&rcq->stats.rcq.packets, packets - errors);
> + u64_stats_add(&rcq->stats.rcq.bytes, bytes);
> + u64_stats_add(&rcq->stats.rcq.dropped, dropped);
> + u64_stats_add(&rcq->stats.rcq.errors, errors);
> + u64_stats_update_end(&rcq->stats.syncp);
mpnic_get_stats64() and mpnic_stats_fold_rings() report these values as
rx_packets and rx_bytes. The rtnl_link_stats64 kernel-doc says rx_packets
includes packets dropped by the driver, and that rx_bytes corresponds to
rx_packets.
The v2 changelog says:
- count Rx frames dropped by the driver in rx_packets and rx_bytes
That seems true only for the xdp_build_skb_from_buff() failure path.
The same counters are used by mpnic_get_queue_stats_rx(), which is added
later in this series in "eth: mpnic: report per-queue stats". The code
looks the same at the end of the series, apart from the new alloc_failed
counter.
Moving the bytes += line out of the guarded branch might not be enough by
itself. __xdp_buff_add_frag() returns before it adds the rejected
fragment to xdp_frags_size:
} else if (unlikely(nr_frags == MAX_SKB_FRAGS)) {
return false;
} else {
...
sinfo->xdp_frags_size += size;
Would it work to track the lengths reported by the descriptors separately
here? If not, should the changelog be reworded?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261012-mpnic-counters3-v2-0-8afba81c2d5a%40gmail.com
next prev parent reply other threads:[~2026-10-13 12:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 12:04 [PATCH net-next v2 0/4] eth: mpnic: add basic netdev statistics Daniel Zahka
2026-10-12 12:04 ` [PATCH net-next v2 1/4] eth: mpnic: count packets, bytes, and drops per ring Daniel Zahka
2026-10-13 12:05 ` netdev-bot+sashiko [this message]
2026-10-13 12:10 ` Daniel Zahka
2026-10-12 12:04 ` [PATCH net-next v2 2/4] eth: mpnic: report per-queue stats Daniel Zahka
2026-10-13 12:05 ` netdev-bot+sashiko
2026-10-13 13:30 ` Daniel Zahka
2026-10-12 12:04 ` [PATCH net-next v2 3/4] eth: mpnic: count Tx queue stops and wakes Daniel Zahka
2026-10-12 12:04 ` [PATCH net-next v2 4/4] eth: mpnic: count Rx allocation failures Daniel Zahka
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=179189313386.434549.472154311742280420@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=alexanderduyck@fb.com \
--cc=andrew+netdev@lunn.ch \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel.zahka@gmail.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
/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
all inboxes | Powered by JetHome®