Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3036262pxb; Mon, 18 Oct 2021 07:03:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwO6byDwXb1uGoA+rHLitls1pExyDObJ7tL3arlhpjeBRioU4T9AXOdA+9hBMG2UpEtjLaa X-Received: by 2002:a17:906:14c7:: with SMTP id y7mr31998183ejc.123.1634565831816; Mon, 18 Oct 2021 07:03:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634565831; cv=none; d=google.com; s=arc-20160816; b=r72iYGvfLMnucTA0tvYADr3ZzuwEdfGS/IpDHyZ9l+fQ0Bm4MB1yaGvFLQAV7UdacG P/UvdCIioxrJZhVeIkgSIXbXAnd5u9wEV4BE3Dul/uC1kFsF1eWxyQBuilMB3IBwpxYM x2Vn/8NPRa0AZYjRoLbxIhStmo3zDrFsTTtrprukqEPr420ICUNjysdIdil3ywvDEa/D uTW2lAbLuA5paTs+SN83xSqj0xW8KJwpWiDOCBAhz6FsQlYJ3QLaIaPtTXeyat4pP3BD z0Buktth11r43bG2PP2W67LMq7uylpyqPzvFiTcdTKJieZ2bkT2KWeiEhgrbVajvoP3H m8yw== 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=o3WivH3XF5IKz7LLDGk/PVB9vd8eUi7SwOmUYYTsye0=; b=Th8jo17NuoHSBk5Ps63Ob8c3MMgNiV7YnORZx/MIbM9d0kMG1h+ZzaA3SrdVPNccHS AHGQBTUED3TWRob+Txf5KwsrPHbOXsGYrKSCtqgMeTyyoMbaFa7KUDF0a+vvtTjos6Li 5OKP7KTE+iFOamm9YWNaXNwfY15lblclHW+irGLVctOM6qT7FRmjjZb3j0fMjdFzw7an ix/5UozY2HjbGujEuxzyWbyYflL1U10P9dDLoSoouTPphJuOh9aiztnINg6azRrL4lBf w2SZ1TQwpAA+PUqU9WL5yrmn+No1hHNILcSYE9d2Hb19KhWQoJ3bUlDi/xDcxbOXW51r yOuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Yb2s3Z32; 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 sb2si20567275ejb.325.2021.10.18.07.03.25; Mon, 18 Oct 2021 07:03:51 -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=Yb2s3Z32; 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 S234228AbhJROB7 (ORCPT + 99 others); Mon, 18 Oct 2021 10:01:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:37454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234191AbhJRN75 (ORCPT ); Mon, 18 Oct 2021 09:59:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A9CF1603E9; Mon, 18 Oct 2021 13:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634564526; bh=mXKmmQQCAwxfe5g1ACkZxK1Zh9Ex5U2kSAAveCaiuM4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yb2s3Z323ZcXkptS+CKnB5D0tUA8MnCzekZ//A9r0BUmvEklf0cjmfKwgoBNR4v5M FaN/GqLFF/hzw7gHEvVrgEwk3zcCaC6LJpCdq6RL/llJ2G+gk0P3gmZG7KEzJfXdx9 HRogGgoiyC1lCxMqoDC6TSgvMhEsg9WoyYZhGRGc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aya Levin , Tariq Toukan , Moshe Shemesh , Saeed Mahameed Subject: [PATCH 5.14 105/151] net/mlx5e: Mutually exclude RX-FCS and RX-port-timestamp Date: Mon, 18 Oct 2021 15:24:44 +0200 Message-Id: <20211018132344.093391591@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132340.682786018@linuxfoundation.org> References: <20211018132340.682786018@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 commit 0bc73ad46a76ed6ece4dcacb28858e7b38561e1c upstream. Due to current HW arch limitations, RX-FCS (scattering FCS frame field to software) and RX-port-timestamp (improved timestamp accuracy on the receive side) can't work together. RX-port-timestamp is not controlled by the user and it is enabled by default when supported by the HW/FW. This patch sets RX-port-timestamp opposite to RX-FCS configuration. Fixes: 102722fc6832 ("net/mlx5e: Add support for RXFCS feature flag") Signed-off-by: Aya Levin Reviewed-by: Tariq Toukan Reviewed-by: Moshe Shemesh Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 57 ++++++++++++++++++++-- include/linux/mlx5/mlx5_ifc.h | 10 +++ 2 files changed, 60 insertions(+), 7 deletions(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -3724,20 +3724,67 @@ static int set_feature_rx_all(struct net return mlx5_set_port_fcs(mdev, !enable); } +static int mlx5e_set_rx_port_ts(struct mlx5_core_dev *mdev, bool enable) +{ + u32 in[MLX5_ST_SZ_DW(pcmr_reg)] = {}; + bool supported, curr_state; + int err; + + if (!MLX5_CAP_GEN(mdev, ports_check)) + return 0; + + err = mlx5_query_ports_check(mdev, in, sizeof(in)); + if (err) + return err; + + supported = MLX5_GET(pcmr_reg, in, rx_ts_over_crc_cap); + curr_state = MLX5_GET(pcmr_reg, in, rx_ts_over_crc); + + if (!supported || enable == curr_state) + return 0; + + MLX5_SET(pcmr_reg, in, local_port, 1); + MLX5_SET(pcmr_reg, in, rx_ts_over_crc, enable); + + return mlx5_set_ports_check(mdev, in, sizeof(in)); +} + static int set_feature_rx_fcs(struct net_device *netdev, bool enable) { struct mlx5e_priv *priv = netdev_priv(netdev); + struct mlx5e_channels *chs = &priv->channels; + struct mlx5_core_dev *mdev = priv->mdev; int err; mutex_lock(&priv->state_lock); - priv->channels.params.scatter_fcs_en = enable; - err = mlx5e_modify_channels_scatter_fcs(&priv->channels, enable); - if (err) - priv->channels.params.scatter_fcs_en = !enable; + if (enable) { + err = mlx5e_set_rx_port_ts(mdev, false); + if (err) + goto out; + + chs->params.scatter_fcs_en = true; + err = mlx5e_modify_channels_scatter_fcs(chs, true); + if (err) { + chs->params.scatter_fcs_en = false; + mlx5e_set_rx_port_ts(mdev, true); + } + } else { + chs->params.scatter_fcs_en = false; + err = mlx5e_modify_channels_scatter_fcs(chs, false); + if (err) { + chs->params.scatter_fcs_en = true; + goto out; + } + err = mlx5e_set_rx_port_ts(mdev, true); + if (err) { + mlx5_core_warn(mdev, "Failed to set RX port timestamp %d\n", err); + err = 0; + } + } +out: mutex_unlock(&priv->state_lock); - return err; } --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h @@ -9467,16 +9467,22 @@ struct mlx5_ifc_pcmr_reg_bits { u8 reserved_at_0[0x8]; u8 local_port[0x8]; u8 reserved_at_10[0x10]; + u8 entropy_force_cap[0x1]; u8 entropy_calc_cap[0x1]; u8 entropy_gre_calc_cap[0x1]; - u8 reserved_at_23[0x1b]; + u8 reserved_at_23[0xf]; + u8 rx_ts_over_crc_cap[0x1]; + u8 reserved_at_33[0xb]; u8 fcs_cap[0x1]; u8 reserved_at_3f[0x1]; + u8 entropy_force[0x1]; u8 entropy_calc[0x1]; u8 entropy_gre_calc[0x1]; - u8 reserved_at_43[0x1b]; + u8 reserved_at_43[0xf]; + u8 rx_ts_over_crc[0x1]; + u8 reserved_at_53[0xb]; u8 fcs_chk[0x1]; u8 reserved_at_5f[0x1]; };