Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp887898pxb; Wed, 3 Mar 2021 19:48:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJzBdDHGZXA7+s1SNge07k3h3YMa7tsW0zIrTAKiNJVl/jLVMO+X7gjyRv+r7TDWlN5D/4YQ X-Received: by 2002:a17:906:cd05:: with SMTP id oz5mr2035876ejb.345.1614829707106; Wed, 03 Mar 2021 19:48:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614829707; cv=none; d=google.com; s=arc-20160816; b=nJTs44Y7YFDkig4v2m60gaLf3OCXkCBXnyfsHncbBA4MKhF+wtQu74/BVYYAOudUOS aYzvDD04uXYR+afUolj+whxSQkDB/moKvKNk6eawuA7+wXotwidrqb90gNspRwl4L8TI a/2itqIVl2zun1ewtk0lkdt/Q7Jgdf1ZWV1ydl1eIaieZxdBXyqoc5tad1RVa+ddtNql H4YclJGYwEg8m4nTB059Lrm91hLBQcnPMnGFqjwaw3AduUFpZeinPLIx1AzKAkmf5Hr/ e8pTs0qJ5hJxrEj3uMe7si8aP2tZ/+qm62v5zc++SofJiC9h3uZfxxjxTEWyP7JAvIUf lakA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xWjRo0j+qUgbYjRIgEvLWaWFjvSDEqPvoh5UNpoM6L0=; b=qv5hsli9c0ZcGaJERd8nsASooqBdYbeZSnv6JRKRh6523AzpDrXK6ssttGWsKMX2QK hWautq+ArvFpec8Lm70n5DeBGM50GNkVTLkgQ4bKF9BMsf40kpU9w1s12X90IOOIxfdm bGOYQqBpPdXRN1U+RiFl0gUMa4hKm8xkomBCZhN33Y+L9dGM1zXtwOqrwnTLwdy2aOP9 QdF/K2m9xiXhj1aC1osHvpyvuoZ4Rk+TmExuIv2XplwBwBperrJMa4RoSTSieBZOe5AO mVrlZ6kIuBRWtXhhmyRvNZJCBOmNRmVJBdft3U87PjpI6MOtlDCEcDrwodihXax9NqWC 0ESg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="L4/X/FRh"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l13si1736584edn.284.2021.03.03.19.48.04; Wed, 03 Mar 2021 19:48:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="L4/X/FRh"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380142AbhCBBse (ORCPT + 99 others); Mon, 1 Mar 2021 20:48:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:46228 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235045AbhCAT0l (ORCPT ); Mon, 1 Mar 2021 14:26:41 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 963BF65006; Mon, 1 Mar 2021 17:09:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614618566; bh=RsxIiG5MEdXPhq0Kn0zDOwy1CiIYJXFtWCmklzWmEZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L4/X/FRh++CU0JyIMFK/po5nSgPGc4OuUG8KIbKPgsyU0QgVl2K6gasRXDg/0DAmU VEwIdavNjp1re/HOx/WkbHuvPEB+EBgoxj5zI6n0bKZ24dqjIxwepZ+A9his42+wga jIQHKMg7rwiJDJdx1i5MqaPpWzMIewJuD1AdZ5/0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Mikityanskiy , Tariq Toukan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.10 103/663] net/mlx5e: Dont change interrupt moderation params when DIM is enabled Date: Mon, 1 Mar 2021 17:05:51 +0100 Message-Id: <20210301161146.830770638@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161141.760350206@linuxfoundation.org> References: <20210301161141.760350206@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maxim Mikityanskiy [ Upstream commit 019f93bc4ba3a0dcb77f448ee77fc4c9c1b89565 ] 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: cb3c7fd4f839 ("net/mlx5e: Support adaptive RX coalescing") Signed-off-by: Maxim Mikityanskiy Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index e596f050c4316..eab058ef6e9ff 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -522,7 +522,7 @@ static int mlx5e_get_coalesce(struct net_device *netdev, #define MLX5E_MAX_COAL_FRAMES MLX5_MAX_CQ_COUNT static void -mlx5e_set_priv_channels_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesce *coal) +mlx5e_set_priv_channels_tx_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesce *coal) { struct mlx5_core_dev *mdev = priv->mdev; int tc; @@ -537,6 +537,17 @@ mlx5e_set_priv_channels_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesc coal->tx_coalesce_usecs, coal->tx_max_coalesced_frames); } + } +} + +static void +mlx5e_set_priv_channels_rx_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesce *coal) +{ + struct mlx5_core_dev *mdev = priv->mdev; + int i; + + for (i = 0; i < priv->channels.num; ++i) { + struct mlx5e_channel *c = priv->channels.c[i]; mlx5_core_modify_cq_moderation(mdev, &c->rq.cq.mcq, coal->rx_coalesce_usecs, @@ -593,7 +604,10 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv, reset_tx = !!coal->use_adaptive_tx_coalesce != priv->channels.params.tx_dim_enabled; if (!reset_rx && !reset_tx) { - mlx5e_set_priv_channels_coalesce(priv, coal); + if (!coal->use_adaptive_rx_coalesce) + mlx5e_set_priv_channels_rx_coalesce(priv, coal); + if (!coal->use_adaptive_tx_coalesce) + mlx5e_set_priv_channels_tx_coalesce(priv, coal); priv->channels.params = new_channels.params; goto out; } -- 2.27.0