Skip to content

Commit ae624d4

Browse files
Maxim Mikityanskiygregkh
authored andcommitted
net/mlx5e: Change interrupt moderation channel params also when channels are closed
[ Upstream commit 65ba859 ] struct mlx5e_params contains fields ({rx,tx}_cq_moderation) that depend on two things: whether DIM is enabled and the state of a private flag (MLX5E_PFLAG_{RX,TX}_CQE_BASED_MODER). Whenever the DIM state changes, mlx5e_reset_{rx,tx}_moderation is called to update the fields, however, only if the channels are open. The flow where the channels are closed misses the required update of the fields. This commit moves the calls of mlx5e_reset_{rx,tx}_moderation, so that they run in both flows. Fixes: ebeaf08 ("net/mlx5e: Properly set default values when disabling adaptive moderation") Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com> Reviewed-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 34394a1 commit ae624d4

1 file changed

Lines changed: 14 additions & 15 deletions

File tree

drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -594,24 +594,9 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
594594
tx_moder->pkts = coal->tx_max_coalesced_frames;
595595
new_channels.params.tx_dim_enabled = !!coal->use_adaptive_tx_coalesce;
596596

597-
if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) {
598-
priv->channels.params = new_channels.params;
599-
goto out;
600-
}
601-
/* we are opened */
602-
603597
reset_rx = !!coal->use_adaptive_rx_coalesce != priv->channels.params.rx_dim_enabled;
604598
reset_tx = !!coal->use_adaptive_tx_coalesce != priv->channels.params.tx_dim_enabled;
605599

606-
if (!reset_rx && !reset_tx) {
607-
if (!coal->use_adaptive_rx_coalesce)
608-
mlx5e_set_priv_channels_rx_coalesce(priv, coal);
609-
if (!coal->use_adaptive_tx_coalesce)
610-
mlx5e_set_priv_channels_tx_coalesce(priv, coal);
611-
priv->channels.params = new_channels.params;
612-
goto out;
613-
}
614-
615600
if (reset_rx) {
616601
u8 mode = MLX5E_GET_PFLAG(&new_channels.params,
617602
MLX5E_PFLAG_RX_CQE_BASED_MODER);
@@ -625,6 +610,20 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
625610
mlx5e_reset_tx_moderation(&new_channels.params, mode);
626611
}
627612

613+
if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) {
614+
priv->channels.params = new_channels.params;
615+
goto out;
616+
}
617+
618+
if (!reset_rx && !reset_tx) {
619+
if (!coal->use_adaptive_rx_coalesce)
620+
mlx5e_set_priv_channels_rx_coalesce(priv, coal);
621+
if (!coal->use_adaptive_tx_coalesce)
622+
mlx5e_set_priv_channels_tx_coalesce(priv, coal);
623+
priv->channels.params = new_channels.params;
624+
goto out;
625+
}
626+
628627
err = mlx5e_safe_switch_channels(priv, &new_channels, NULL, NULL);
629628

630629
out:

0 commit comments

Comments
 (0)