Thread (5 messages) 5 messages, 2 authors, 5d ago

[PATCH net 1/3] net/mlx5e: Sync CQE moderation pflags with coalesce params

flat view
COOLING5d REVIEWED: 1 (1M)

From: Tariq Toukan <tariqt@nvidia.com>
Date: 2026-10-14 12:48:28
Also in: linux-rdma, lkml
Subsystem: mellanox ethernet driver (mlx5e), mellanox mlx5 core vpi driver, networking drivers, the rest · Maintainers: Saeed Mahameed, Tariq Toukan, Mark Bloch, Leon Romanovsky, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

1 review trailer.

From: Yael Chemla <redacted>

mlx5e_params keeps two representations of CQE moderation: the private
flags (MLX5E_PFLAG_RX_CQE_BASED_MODER, MLX5E_PFLAG_TX_CQE_BASED_MODER)
and the fields rx_moder_use_cqe_mode / tx_moder_use_cqe_mode, which are
used by ethtool get/set coalesce. Both are used by the driver (ethtool
get/set coalesce, channel open, moderation apply). When they disagree,
CQE moderation reported value is wrong.

Such an issue can be seen on channel attach or reopen:
mlx5e_build_nic_params() runs and sets rx_moder_use_cqe_mode and
tx_moder_use_cqe_mode from device capability but did not set the
corresponding pflags. So after attach/reopen, pflags could remain zero
while the fields reflected hardware configuration.

Fix by syncing pflags in build_nic_params from the capability-derived
fields.

Reproducer:

    ethtool --show-priv-flags eth2 | grep rx_cqe_moder
      rx_cqe_moder       : off
    ethtool --coalesce eth2 adaptive-tx off
    ethtool --show-priv-flags eth2 | grep rx_cqe_moder
      rx_cqe_moder       : on

Fixes: 445a25f6e1a2 ("net/mlx5e: Support updating coalescing configuration without resetting channels")
Signed-off-by: Yael Chemla <redacted>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 4c6060d54fbe..9fcea0395137 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -5407,6 +5407,10 @@ void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, u16
 				 MLX5_CAP_GEN(mdev, cq_period_mode_modify);
 	params->rx_moder_use_cqe_mode = !!MLX5_CAP_GEN(mdev, cq_period_start_from_cqe);
 	params->tx_moder_use_cqe_mode = false;
+	MLX5E_SET_PFLAG(params, MLX5E_PFLAG_RX_CQE_BASED_MODER,
+			params->rx_moder_use_cqe_mode);
+	MLX5E_SET_PFLAG(params, MLX5E_PFLAG_TX_CQE_BASED_MODER,
+			params->tx_moder_use_cqe_mode);
 	mlx5e_reset_rx_moderation(&params->rx_cq_moderation, params->rx_moder_use_cqe_mode,
 				  params->rx_dim_enabled);
 	mlx5e_reset_tx_moderation(&params->tx_cq_moderation, params->tx_moder_use_cqe_mode,
-- 
2.44.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help