Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2353345pxb; Mon, 20 Sep 2021 19:51:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7SwWSVP2RRoABwMOHbmJswyGZjVxoMVt1E4owilVU0AV6xoCa1GRNEb2OXy4QaDaJQxxU X-Received: by 2002:a17:907:760d:: with SMTP id jx13mr29768478ejc.194.1632192687548; Mon, 20 Sep 2021 19:51:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192687; cv=none; d=google.com; s=arc-20160816; b=aet2FbnxUOggkZjqa3MmhTxOsFNzLYgcojGswoSAw5sNTr1uPyNrLxhRB5dBbDG8nV JAqxncmuh36+H3aRCCxlET09XKtZJrVQ9oAqjYN2vCI6AXTiqeQ3hbfxFUjn1OQQ7pji uoC8tzYbh1NWbcFsQkXJNZYnAmgETzZgB5RG2QZbrjq5yws5wSWjt8KA3XQ6JteA3+Cq zZ5wa19KeyOo2d9Wu9ft6/Z9cSfd4+vxiu9LO6uLb1rSdtRRqkNm7JtUIo8u9cKrLoq+ c2Qzq0RxY0AWGf4fQyc1KYS0VPKqM1jxJyKFEUa10NYaimZpRAGd7DyibUnGuuF97XCt 6Vmg== 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=b0IYbqYXkfhAIKh/TUiwtHAGxymDOfmszBpjxw1NHhQ=; b=eVY2ZEE0TlTeMfaZdEkeerTIipMpWzUUifHzbosW7/KHM25ecjCE5CSv8nTa6gZG53 MNczG5dt9hKm5FNEQrSW+ky9vCxWOg7Eor24zGxy5YRoB49m3YD2D5/oddNzk1rJGi7V ncI9EvINJp/Evi7j918k1eh9YbmdW92UrBkA69Ekvz+gZz86fUYaUhmahk6r7hLBqnsL Gs/y6zDHWkjdLTHcb++Sv+2zBJpYUZd7txRF7156VtGhjS45w59sLSdYbnHl6llvIKov yqzXLKam/5T7GGmocWYlmRDSj370tBzIPXQi0Z6wU+rUqGiCo2ADXRAZf0pZAYJwyEAk eKpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zqG91Mo6; 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 v13si14345321ede.227.2021.09.20.19.51.04; Mon, 20 Sep 2021 19:51:27 -0700 (PDT) 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=zqG91Mo6; 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 S1383800AbhITSpy (ORCPT + 99 others); Mon, 20 Sep 2021 14:45:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:56452 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382748AbhITSmT (ORCPT ); Mon, 20 Sep 2021 14:42:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3AF6963341; Mon, 20 Sep 2021 17:31:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159111; bh=49JkvU8ayYHHtf+h6HGd2/0r7wwEaHv43nyKbV7q9B4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zqG91Mo6Hj9mnTVqd8sXy5kbFmehHLx2GMfSQWLN1vO0iGQPTZkKZupqVjpBWaSBs Q/QnzaYn03FJ9Rj6GcpTlPJ+DjXw+qQuIpnFoRw7X93NQ73AeggG17A9CMjBdF+FkC 5cXKUsq6Hr0ZYA/krxdwUOW5DQbW0FAn0y5XsinY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aya Levin , Moshe Shemesh , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.14 081/168] net/mlx5e: Fix mutual exclusion between CQE compression and HW TS Date: Mon, 20 Sep 2021 18:43:39 +0200 Message-Id: <20210920163924.302278254@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@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: Aya Levin [ Upstream commit c91c1da72b47fc4c5e353cdd9099ba94ae07d2fa ] Some profiles of the driver don't support a dedicated PTP-RQ, hence can't support HW TS and CQE compression simultaneously. When HW TS is enabled the COE compression is disabled, and should be restored when the HW TS is turned off. Add rx_filter as an input to modifying CQE compression to enforce this restriction. Fixes: 256f79d13c1d ("net/mlx5e: Fix HW TS with CQE compression according to profile") Signed-off-by: Aya Levin Reviewed-by: Moshe Shemesh Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 11 ++++++----- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index b1b51bbba054..3f67efbe12fc 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -940,7 +940,7 @@ void mlx5e_set_rx_mode_work(struct work_struct *work); int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr); int mlx5e_hwstamp_get(struct mlx5e_priv *priv, struct ifreq *ifr); -int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool val); +int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool val, bool rx_filter); int mlx5e_vlan_rx_add_vid(struct net_device *dev, __always_unused __be16 proto, u16 vid); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index bd72572e03d1..1cc279d389d6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -1882,7 +1882,7 @@ static int set_pflag_rx_cqe_based_moder(struct net_device *netdev, bool enable) return set_pflag_cqe_based_moder(netdev, enable, true); } -int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool new_val) +int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool new_val, bool rx_filter) { bool curr_val = MLX5E_GET_PFLAG(&priv->channels.params, MLX5E_PFLAG_RX_CQE_COMPRESS); struct mlx5e_params new_params; @@ -1894,8 +1894,7 @@ int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool new_val if (curr_val == new_val) return 0; - if (new_val && !priv->profile->rx_ptp_support && - priv->tstamp.rx_filter != HWTSTAMP_FILTER_NONE) { + if (new_val && !priv->profile->rx_ptp_support && rx_filter) { netdev_err(priv->netdev, "Profile doesn't support enabling of CQE compression while hardware time-stamping is enabled.\n"); return -EINVAL; @@ -1903,7 +1902,7 @@ int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool new_val new_params = priv->channels.params; MLX5E_SET_PFLAG(&new_params, MLX5E_PFLAG_RX_CQE_COMPRESS, new_val); - if (priv->tstamp.rx_filter != HWTSTAMP_FILTER_NONE) + if (rx_filter) new_params.ptp_rx = new_val; if (new_params.ptp_rx == priv->channels.params.ptp_rx) @@ -1926,12 +1925,14 @@ static int set_pflag_rx_cqe_compress(struct net_device *netdev, { struct mlx5e_priv *priv = netdev_priv(netdev); struct mlx5_core_dev *mdev = priv->mdev; + bool rx_filter; int err; if (!MLX5_CAP_GEN(mdev, cqe_compression)) return -EOPNOTSUPP; - err = mlx5e_modify_rx_cqe_compression_locked(priv, enable); + rx_filter = priv->tstamp.rx_filter != HWTSTAMP_FILTER_NONE; + err = mlx5e_modify_rx_cqe_compression_locked(priv, enable, rx_filter); if (err) return err; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 2d53eaf3b924..fa718e71db2d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -4004,14 +4004,14 @@ static int mlx5e_hwstamp_config_no_ptp_rx(struct mlx5e_priv *priv, bool rx_filte if (!rx_filter) /* Reset CQE compression to Admin default */ - return mlx5e_modify_rx_cqe_compression_locked(priv, rx_cqe_compress_def); + return mlx5e_modify_rx_cqe_compression_locked(priv, rx_cqe_compress_def, false); if (!MLX5E_GET_PFLAG(&priv->channels.params, MLX5E_PFLAG_RX_CQE_COMPRESS)) return 0; /* Disable CQE compression */ netdev_warn(priv->netdev, "Disabling RX cqe compression\n"); - err = mlx5e_modify_rx_cqe_compression_locked(priv, false); + err = mlx5e_modify_rx_cqe_compression_locked(priv, false, true); if (err) netdev_err(priv->netdev, "Failed disabling cqe compression err=%d\n", err); -- 2.30.2