Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: eaujames@ddn.com
Cc: tariqt@nvidia.com, saeedm@nvidia.com, leon@kernel.org,
	dtatulea@nvidia.com, mbloch@nvidia.com, netdev@vger.kernel.org,
	linux-rdma@vger.kernel.org, feliu@nvidia.com,
	davem@davemloft.net, guillaume.courrier@cea.fr, kuba@kernel.org
Subject: Re: [PATCH net] net/mlx5e: guard child PKEY channel stats lookup in rx path
Date: Thu, 26 Nov 2026 18:27:30 +0000	[thread overview]
Message-ID: <179571765003.3135.3532444751948893709@kernel.org> (raw)
In-Reply-To: <awcn1-LpcFgzRKgq@eaujamesFR0130>

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] When the child PKEY priv has no channel_stats entry for the
  parent RQ index, the new fallback in mlx5i_complete_rx_cqe()…

--

net/mlx5e: guard child PKEY channel stats lookup in rx path

This adds a helper, mlx5e_channel_stats_get(), that checks the channel
index against stats_nch. mlx5i_complete_rx_cqe() now uses it to look up
the child PKEY priv's channel_stats[]. If the child has no entry for the
parent's rq->ix, the stats go to the parent's rq->stats instead.

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
> index 1586cb2404c01..5f2347672cf33 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c

[ ... ]

> @@ -2552,7 +2553,8 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq,
>  	}
>  
>  	priv = mlx5i_epriv(netdev);
> -	stats = &priv->channel_stats[rq->ix]->rq;
> +	channel_stats = mlx5e_channel_stats_get(priv, rq->ix);
> +	stats = likely(channel_stats) ? &channel_stats->rq : rq->stats;

[Severity: Medium]

Does this fallback count child PKEY traffic on the parent netdev?

For a parent RQ, rq->stats points into the parent priv:

mlx5e_init_rxq_rq() {
    ...
	rq->stats        = &c->priv->channel_stats[c->ix]->rq;
    ...
}

When the lookup returns NULL, the csum_complete/csum_none updates and the
packets/bytes updates at the end of mlx5i_complete_rx_cqe() all land on
the parent. The skb itself is still delivered to the child:

	skb->dev = netdev;

	stats->packets++;
	stats->bytes += cqe_bcnt;

mlx5i_grp_sw_update_stats() only sums a netdev's own
channel_stats[0..stats_nch). So the parent's rx_packets/rx_bytes would be
too high, and the child's would be missing these packets.

For these indexes, isn't this the same misattribution that b5e23931c45a
("net/mlx5e: IPoIB, Fix child PKEY interface stats on rx path") fixed?

Could this also last beyond the window in mlx5i_pkey_open() between
mlx5_fs_add_rx_underlay_qpn() and mlx5e_open_channels()?

The child's channel count defaults to:

mlx5e_build_nic_params() {
    ...
	params->num_channels = min_t(unsigned int, MLX5E_MAX_NUM_CHANNELS / 2,
				     priv->max_nch);
    ...
}

mlx5i_pkey_ethtool_ops has no set_channels, so the child can't change
this value.

The parent can be raised above 128 channels with ethtool -L as long as no
child exists yet, because mlx5i_set_channels() only refuses when:

	if (ipriv->num_sub_interfaces > 0) {

On hosts where max_nch is above 128, a child could then be created after
the parent was raised. Every child packet that RSS steers to a parent RQ
with rq->ix >= the child's stats_nch would then be counted on the parent
for good, not just during the open race.

The commit message says the fallback "adds no new data race", but it
doesn't mention that the per-netdev RX counters become wrong. Should the
fallback avoid charging the parent's rq->stats? If the current behaviour
is intended, could the commit message describe it?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/awcn1-LpcFgzRKgq%40eaujamesFR0130

      parent reply	other threads:[~2026-11-26 18:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 18:24 [PATCH net] net/mlx5e: guard child PKEY channel stats lookup in rx path Etienne AUJAMES
2026-11-25 18:27 ` netdev-bot+sinfo
2026-11-25 19:17   ` Etienne AUJAMES
2026-11-26 14:41 ` Dragos Tatulea
2026-11-26 18:27 ` netdev-bot+sashiko [this message]

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=179571765003.3135.3532444751948893709@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dtatulea@nvidia.com \
    --cc=eaujames@ddn.com \
    --cc=feliu@nvidia.com \
    --cc=guillaume.courrier@cea.fr \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    /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