Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tariq Toukan" <tariqt@nvidia.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH net 2/3] net/mlx5e: Sync CQE moderation params with pflags in set_pflag_cqe_based_moder
Date: Thu, 15 Oct 2026 12:48:30 +0000	[thread overview]
Message-ID: <sashiko-outbox-172865@kernel.org> (raw)
In-Reply-To: <20261014124704.1017782-3-tariqt@nvidia.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] net/mlx5e: stale hardware CQ moderation when toggling via priv-flag
- [Medium] net/mlx5e: unhandled toggle_dim failure leaves DIM disabled and channels partially configured
--

commit 7d36de6d06985b57ee8f31a9e94e4235c92121ae
Author: Yael Chemla <ychemla@nvidia.com>
Subject: net/mlx5e: Sync CQE moderation params with pflags in set_pflag_cqe_based_moder

This commit synchronizes the CQE-based moderation parameters with priv-flags 
when they are toggled via set_pflag_cqe_based_moder(). It updates the channel 
parameters so that tools like ethtool -c report the correct state, and resets 
the moderation usecs to the defaults for the new mode.

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> index 3ed59ced0407a..c2bee69c26af7 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> @@ -2193,12 +2193,20 @@ static int set_pflag_cqe_based_moder(struct net_device *netdev, bool enable,
>  		mlx5e_channels_rx_toggle_dim(&priv->channels);

[Severity: Medium]
The return value of mlx5e_channels_rx_toggle_dim() is unconditionally ignored
here.

If re-enabling DIM fails (for instance, if mlx5e_dim_rx_change() fails due
to memory allocation errors in mlx5e_dim_enable()), does this leave the
current channel's DIM completely disabled while skipping the remaining
channels? This could result in a broken state where the priv-flags appear
successfully updated but DIM is silently disabled on some channels.

>  		MLX5E_SET_PFLAG(&new_params, MLX5E_PFLAG_RX_CQE_BASED_MODER,
>  				cq_period_mode);
> +		new_params.rx_moder_use_cqe_mode = enable;
> +		mlx5e_reset_rx_moderation(&new_params.rx_cq_moderation,
> +					  cq_period_mode,
> +					  new_params.rx_dim_enabled);

[Severity: Medium]
Does updating the software state cache here fail to push the updates to the
hardware when DIM is disabled?

When DIM is disabled (e.g., adaptive RX off), mlx5e_channels_rx_toggle_dim()
skips the channels:

mlx5e_channels_rx_toggle_dim() {
    ...
    if (chs->c[i]->rq.dim) {
        ...
    }
}

Since the channels are skipped, no asynchronous hardware update is scheduled
by the DIM work thread. Later, mlx5e_safe_switch_params() is called with
reset=false:

mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, false);

Passing reset=false skips reopening the channels. Because no hardware
modify command is issued, could this leave the actual hardware operating
with stale CQE moderation parameters while the software ethtool -c
configuration reports the new state?

>  	} else {
>  		mlx5e_reset_tx_channels_moderation(&priv->channels, cq_period_mode,
>  						   false, true);
>  		mlx5e_channels_tx_toggle_dim(&priv->channels);

[Severity: Medium]
The return value of mlx5e_channels_tx_toggle_dim() is unconditionally
ignored here as well.

Similar to the RX side, if this fails, could it leave DIM disabled on some
channels and skip applying the new moderation mode to subsequent channels
without reporting an error?

>  		MLX5E_SET_PFLAG(&new_params, MLX5E_PFLAG_TX_CQE_BASED_MODER,
>  				cq_period_mode);
> +		new_params.tx_moder_use_cqe_mode = enable;
> +		mlx5e_reset_tx_moderation(&new_params.tx_cq_moderation,
> +					  cq_period_mode,
> +					  new_params.tx_dim_enabled);
>  	}
>  
>  	/* Update pflags of existing channels without resetting them */

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261014124704.1017782-1-tariqt@nvidia.com?part=2

  reply	other threads:[~2026-10-15 12:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 12:47 [PATCH net 0/3] net/mlx5e: Fix CQE moderation mode reporting and control Tariq Toukan
2026-10-14 12:47 ` [PATCH net 1/3] net/mlx5e: Sync CQE moderation pflags with coalesce params Tariq Toukan
2026-10-15 12:48   ` sashiko-bot
2026-10-14 12:47 ` [PATCH net 2/3] net/mlx5e: Sync CQE moderation params with pflags in set_pflag_cqe_based_moder Tariq Toukan
2026-10-15 12:48   ` sashiko-bot [this message]
2026-10-14 12:47 ` [PATCH net 3/3] net/mlx5e: Expose CQE moderation mode on representors Tariq Toukan
2026-10-15 12:48   ` sashiko-bot
2026-10-14 12:55 ` [PATCH net 0/3] net/mlx5e: Fix CQE moderation mode reporting and control netdev-bot+sinfo

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-172865@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --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