Skip to content

Commit 34394a1

Browse files
Maxim Mikityanskiygregkh
authored andcommitted
net/mlx5e: Don't change interrupt moderation params when DIM is enabled
[ Upstream commit 019f93b ] When mlx5e_ethtool_set_coalesce doesn't change DIM state (enabled/disabled), it calls mlx5e_set_priv_channels_coalesce unconditionally, which in turn invokes a firmware command to set interrupt moderation parameters. It shouldn't happen while DIM manages those parameters dynamically (it might even be happening at the same time). This patch fixes it by splitting mlx5e_set_priv_channels_coalesce into two functions (for RX and TX) and calling them only when DIM is disabled (for RX and TX respectively). Fixes: cb3c7fd ("net/mlx5e: Support adaptive RX coalescing") 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 96fb207 commit 34394a1

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ static int mlx5e_get_coalesce(struct net_device *netdev,
522522
#define MLX5E_MAX_COAL_FRAMES MLX5_MAX_CQ_COUNT
523523

524524
static void
525-
mlx5e_set_priv_channels_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesce *coal)
525+
mlx5e_set_priv_channels_tx_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesce *coal)
526526
{
527527
struct mlx5_core_dev *mdev = priv->mdev;
528528
int tc;
@@ -537,6 +537,17 @@ mlx5e_set_priv_channels_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesc
537537
coal->tx_coalesce_usecs,
538538
coal->tx_max_coalesced_frames);
539539
}
540+
}
541+
}
542+
543+
static void
544+
mlx5e_set_priv_channels_rx_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesce *coal)
545+
{
546+
struct mlx5_core_dev *mdev = priv->mdev;
547+
int i;
548+
549+
for (i = 0; i < priv->channels.num; ++i) {
550+
struct mlx5e_channel *c = priv->channels.c[i];
540551

541552
mlx5_core_modify_cq_moderation(mdev, &c->rq.cq.mcq,
542553
coal->rx_coalesce_usecs,
@@ -593,7 +604,10 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
593604
reset_tx = !!coal->use_adaptive_tx_coalesce != priv->channels.params.tx_dim_enabled;
594605

595606
if (!reset_rx && !reset_tx) {
596-
mlx5e_set_priv_channels_coalesce(priv, coal);
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);
597611
priv->channels.params = new_channels.params;
598612
goto out;
599613
}

0 commit comments

Comments
 (0)