BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Daniel Zahka" <daniel.zahka@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next 2/4] eth: mpnic: report per-queue stats
Date: Sat, 10 Oct 2026 11:35:34 +0000	[thread overview]
Message-ID: <sashiko-outbox-166469@kernel.org> (raw)
In-Reply-To: <20261009-mpnic-counters3-v1-2-7dc7644cc500@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] eth: mpnic: missing drops and errors in queue stats reporting
--

commit cda12cc259f9eb77d108f5cb4427efce257c6e0b
Author: Daniel Zahka <daniel.zahka@gmail.com>

eth: mpnic: report per-queue stats

This commit exposes the per-ring packet and byte counters through the
queue stats API. It also reports counters for deactivated rings through
the base stats callback.

> diff --git a/drivers/net/ethernet/meta/mpnic/mpnic_netdev.c b/drivers/net/ethernet/meta/mpnic/mpnic_netdev.c
> index 5164475a0f943..c2f4a326a8f0f 100644
> --- a/drivers/net/ethernet/meta/mpnic/mpnic_netdev.c
> +++ b/drivers/net/ethernet/meta/mpnic/mpnic_netdev.c
[ ... ]
> +static void mpnic_get_queue_stats_rx(struct net_device *dev, int idx,
> +				     struct netdev_queue_stats_rx *rx)
> +{
> +	struct mpnic_net *mpn = netdev_priv(dev);
> +	struct mpnic_ring *rxr = mpn->rx[idx];
> +	struct mpnic_queue_stats *stats;
> +	unsigned int start;
> +	u64 bytes, packets;
> +
> +	if (!rxr)
> +		return;
> +
> +	stats = &rxr->stats;
> +	do {
> +		start = u64_stats_fetch_begin(&stats->syncp);
> +		bytes = u64_stats_read(&stats->rcq.bytes);
> +		packets = u64_stats_read(&stats->rcq.packets);
> +	} while (u64_stats_fetch_retry(&stats->syncp, start));
> +
> +	rx->bytes = bytes;
> +	rx->packets = packets;

[Severity: Medium]
Should this also read stats->rcq.dropped and stats->rcq.errors from the
queue stats and assign them to rx->hw_drops or similar fields? The
driver collects these internal stats, but they appear to be missing from
the queue stats API reporting here.

> +}
> +
> +static void mpnic_get_queue_stats_tx(struct net_device *dev, int idx,
> +				     struct netdev_queue_stats_tx *tx)
> +{
> +	struct mpnic_net *mpn = netdev_priv(dev);
> +	struct mpnic_ring *txr = mpn->tx[idx];
> +	struct mpnic_queue_stats *stats;
> +	struct mpnic_q_triad *qt;
> +	unsigned int start;
> +	u64 bytes, packets;
> +
> +	if (!txr)
> +		return;
> +
> +	qt = container_of(txr, struct mpnic_q_triad, sub0);
> +
> +	stats = &qt->cmpl.stats;
> +	do {
> +		start = u64_stats_fetch_begin(&stats->syncp);
> +		bytes = u64_stats_read(&stats->tcq.bytes);
> +		packets = u64_stats_read(&stats->tcq.packets);
> +	} while (u64_stats_fetch_retry(&stats->syncp, start));
> +
> +	tx->bytes = bytes;
> +	tx->packets = packets;

[Severity: Medium]
Does this miss assigning stats->twq.dropped from the transmission queue
stats to tx->hw_drops or tx->hw_drop_errors?

> +}
> +
> +static void mpnic_get_base_stats(struct net_device *dev,
> +				 struct netdev_queue_stats_rx *rx,
> +				 struct netdev_queue_stats_tx *tx)
> +{
> +	struct mpnic_net *mpn = netdev_priv(dev);
> +	struct mpnic_base_stats *base;
> +
> +	base = netdev_lock_dereference(mpn->stats.base, dev);
> +
> +	tx->bytes = base->tx.bytes;
> +	tx->packets = base->tx.packets;
> +
> +	rx->bytes = base->rx.bytes;
> +	rx->packets = base->rx.packets;

[Severity: Medium]
Since the deactivated rings collect drop and error counts internally,
should this also map base->tx.dropped, base->rx.dropped, and
base->rx.errors to the corresponding rx and tx struct fields?

> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261009-mpnic-counters3-v1-0-7dc7644cc500@gmail.com?part=2

  reply	other threads:[~2026-10-10 11:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09 11:35 [PATCH net-next 0/4] eth: mpnic: add basic netdev statistics Daniel Zahka
2026-10-09 11:35 ` [PATCH net-next 1/4] eth: mpnic: count packets, bytes, and drops per ring Daniel Zahka
2026-10-10 11:35   ` sashiko-bot
2026-10-10 11:52   ` netdev-bot+sashiko
2026-10-12 11:48     ` Daniel Zahka
2026-10-09 11:35 ` [PATCH net-next 2/4] eth: mpnic: report per-queue stats Daniel Zahka
2026-10-10 11:35   ` sashiko-bot [this message]
2026-10-09 11:35 ` [PATCH net-next 3/4] eth: mpnic: count Tx queue stops and wakes Daniel Zahka
2026-10-09 11:35 ` [PATCH net-next 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=sashiko-outbox-166469@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel.zahka@gmail.com \
    --cc=sashiko-reviews@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