stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Aya Levin <ayal@nvidia.com>,
	Tariq Toukan <tariqt@nvidia.com>,
	Moshe Shemesh <moshe@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>
Subject: [PATCH 5.10 073/103] net/mlx5e: Mutually exclude RX-FCS and RX-port-timestamp
Date: Mon, 18 Oct 2021 15:24:49 +0200	[thread overview]
Message-ID: <20211018132337.205366925@linuxfoundation.org> (raw)
In-Reply-To: <20211018132334.702559133@linuxfoundation.org>

From: Aya Levin <ayal@nvidia.com>

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 <ayal@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 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
@@ -3819,20 +3819,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
@@ -9274,16 +9274,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];
 };



  parent reply	other threads:[~2021-10-18 13:45 UTC|newest]

Thread overview: 114+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-18 13:23 [PATCH 5.10 000/103] 5.10.75-rc1 review Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 001/103] ALSA: usb-audio: Add quirk for VF0770 Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 002/103] ALSA: pcm: Workaround for a wrong offset in SYNC_PTR compat ioctl Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 003/103] ALSA: seq: Fix a potential UAF by wrong private_free call order Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 004/103] ALSA: hda/realtek: Enable 4-speaker output for Dell Precision 5560 laptop Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 005/103] ALSA: hda - Enable headphone mic on Dell Latitude laptops with ALC3254 Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 006/103] ALSA: hda/realtek: Complete partial device name to avoid ambiguity Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 007/103] ALSA: hda/realtek: Add quirk for Clevo X170KM-G Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 008/103] ALSA: hda/realtek - ALC236 headset MIC recording issue Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 009/103] ALSA: hda/realtek: Add quirk for TongFang PHxTxX1 Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 010/103] ALSA: hda/realtek: Fix for quirk to enable speaker output on the Lenovo 13s Gen2 Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 011/103] ALSA: hda/realtek: Fix the mic type detection issue for ASUS G551JW Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 012/103] nds32/ftrace: Fix Error: invalid operands (*UND* and *UND* sections) for `^ Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 013/103] s390: fix strrchr() implementation Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 014/103] clk: socfpga: agilex: fix duplicate s2f_user0_clk Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 015/103] csky: dont let sigreturn play with priveleged bits of status register Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 016/103] csky: Fixup regs.sr broken in ptrace Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 017/103] arm64/hugetlb: fix CMA gigantic page order for non-4K PAGE_SIZE Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 018/103] drm/msm: Avoid potential overflow in timeout_to_jiffies() Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 019/103] btrfs: unlock newly allocated extent buffer after error Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 020/103] btrfs: deal with errors when replaying dir entry during log replay Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 021/103] btrfs: deal with errors when adding inode reference " Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 022/103] btrfs: check for error when looking up inode during dir entry replay Greg Kroah-Hartman
2021-10-18 13:23 ` [PATCH 5.10 023/103] btrfs: update refs for any root except tree log roots Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 024/103] btrfs: fix abort logic in btrfs_replace_file_extents Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 025/103] x86/resctrl: Free the ctrlval arrays when domain_setup_mon_state() fails Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 026/103] mei: me: add Ice Lake-N device id Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 027/103] USB: xhci: dbc: fix tty registration race Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 028/103] xhci: guard accesses to ep_state in xhci_endpoint_reset() Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 029/103] xhci: Fix command ring pointer corruption while aborting a command Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 030/103] xhci: Enable trust tx length quirk for Fresco FL11 USB controller Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 031/103] cb710: avoid NULL pointer subtraction Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 032/103] efi/cper: use stack buffer for error record decoding Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 033/103] efi: Change down_interruptible() in virt_efi_reset_system() to down_trylock() Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 034/103] usb: musb: dsps: Fix the probe error path Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 035/103] Input: xpad - add support for another USB ID of Nacon GC-100 Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 036/103] USB: serial: qcserial: add EM9191 QDL support Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 037/103] USB: serial: option: add Quectel EC200S-CN module support Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 038/103] USB: serial: option: add Telit LE910Cx composition 0x1204 Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 039/103] USB: serial: option: add prod. id for Quectel EG91 Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 040/103] misc: fastrpc: Add missing lock before accessing find_vma() Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 041/103] virtio: write back F_VERSION_1 before validate Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 042/103] EDAC/armada-xp: Fix output of uncorrectable error counter Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 043/103] nvmem: Fix shift-out-of-bound (UBSAN) with byte size cells Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 044/103] KVM: PPC: Book3S HV: Fix stack handling in idle_kvm_start_guest() Greg Kroah-Hartman
2021-10-19 10:54   ` Michael Ellerman
2021-10-18 13:24 ` [PATCH 5.10 045/103] KVM: PPC: Book3S HV: Make idle_kvm_start_guest() return 0 if it went to guest Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 046/103] x86/Kconfig: Do not enable AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT automatically Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 047/103] powerpc/xive: Discard disabled interrupts in get_irqchip_state() Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 048/103] iio: adc: aspeed: set driver data when adc probe Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 049/103] drivers: bus: simple-pm-bus: Add support for probing simple bus only devices Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 050/103] driver core: Reject pointless SYNC_STATE_ONLY device links Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 051/103] iio: adc: ad7192: Add IRQ flag Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 052/103] iio: adc: ad7780: Fix " Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 053/103] iio: adc: ad7793: " Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 054/103] iio: adc128s052: Fix the error handling path of adc128_probe() Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 055/103] iio: adc: max1027: Fix wrong shift with 12-bit devices Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 056/103] iio: mtk-auxadc: fix case IIO_CHAN_INFO_PROCESSED Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 057/103] iio: light: opt3001: Fixed timeout error when 0 lux Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 058/103] iio: adc: max1027: Fix the number of max1X31 channels Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 059/103] iio: ssp_sensors: add more range checking in ssp_parse_dataframe() Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 060/103] iio: ssp_sensors: fix error code in ssp_print_mcu_debug() Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 061/103] iio: dac: ti-dac5571: fix an error code in probe() Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 062/103] tee: optee: Fix missing devices unregister during optee_remove Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 063/103] ARM: dts: bcm2711-rpi-4-b: Fix usbs unit address Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 064/103] ARM: dts: bcm2711: fix MDIO #address- and #size-cells Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 065/103] ARM: dts: bcm2711-rpi-4-b: fix sd_io_1v8_reg regulator states Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 066/103] ARM: dts: bcm2711-rpi-4-b: Fix pcie0s unit address formatting Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 067/103] nvme-pci: Fix abort command id Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 068/103] sctp: account stream padding length for reconf chunk Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 069/103] gpio: pca953x: Improve bias setting Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 070/103] net: arc: select CRC32 Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 071/103] net: korina: " Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 072/103] net/mlx5e: Fix memory leak in mlx5_core_destroy_cq() error path Greg Kroah-Hartman
2021-10-18 13:24 ` Greg Kroah-Hartman [this message]
2021-10-18 13:24 ` [PATCH 5.10 074/103] net: stmmac: fix get_hw_feature() on old hardware Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 075/103] net: dsa: microchip: Added the condition for scheduling ksz_mib_read_work Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 076/103] net: encx24j600: check error in devm_regmap_init_encx24j600 Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 077/103] ethernet: s2io: fix setting mac address during resume Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 078/103] vhost-vdpa: Fix the wrong input in config_cb Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 079/103] nfc: fix error handling of nfc_proto_register() Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 080/103] NFC: digital: fix possible memory leak in digital_tg_listen_mdaa() Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 081/103] NFC: digital: fix possible memory leak in digital_in_send_sdd_req() Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 082/103] pata_legacy: fix a couple uninitialized variable bugs Greg Kroah-Hartman
2021-10-18 13:24 ` [PATCH 5.10 083/103] ata: ahci_platform: fix null-ptr-deref in ahci_platform_enable_regulators() Greg Kroah-Hartman
2021-10-18 13:25 ` [PATCH 5.10 084/103] mlxsw: thermal: Fix out-of-bounds memory accesses Greg Kroah-Hartman
2021-10-18 13:25 ` [PATCH 5.10 085/103] platform/mellanox: mlxreg-io: Fix argument base in kstrtou32() call Greg Kroah-Hartman
2021-10-18 13:25 ` [PATCH 5.10 086/103] platform/mellanox: mlxreg-io: Fix read access of n-bytes size attributes Greg Kroah-Hartman
2021-10-18 13:25 ` [PATCH 5.10 087/103] spi: bcm-qspi: clear MSPI spifie interrupt during probe Greg Kroah-Hartman
2021-10-18 13:25 ` [PATCH 5.10 088/103] drm/panel: olimex-lcd-olinuxino: select CRC32 Greg Kroah-Hartman
2021-10-18 13:25 ` [PATCH 5.10 089/103] drm/edid: In connector_bad_edid() cap num_of_ext by num_blocks read Greg Kroah-Hartman
2021-10-18 13:25 ` [PATCH 5.10 090/103] drm/msm: Fix null pointer dereference on pointer edp Greg Kroah-Hartman
2021-10-18 13:25 ` [PATCH 5.10 091/103] drm/msm/mdp5: fix cursor-related warnings Greg Kroah-Hartman
2021-10-18 13:25 ` [PATCH 5.10 092/103] drm/msm/a6xx: Track current ctx by seqno Greg Kroah-Hartman
2021-10-18 13:25 ` [PATCH 5.10 093/103] drm/msm/dsi: Fix an error code in msm_dsi_modeset_init() Greg Kroah-Hartman
2021-10-18 13:25 ` [PATCH 5.10 094/103] drm/msm/dsi: fix off by one in dsi_bus_clk_enable error handling Greg Kroah-Hartman
2021-10-18 13:25 ` [PATCH 5.10 095/103] acpi/arm64: fix next_platform_timer() section mismatch error Greg Kroah-Hartman
2021-10-18 13:25 ` [PATCH 5.10 096/103] platform/x86: intel_scu_ipc: Fix busy loop expiry time Greg Kroah-Hartman
2021-10-18 13:25 ` [PATCH 5.10 097/103] mqprio: Correct stats in mqprio_dump_class_stats() Greg Kroah-Hartman
2021-10-18 13:25 ` [PATCH 5.10 098/103] qed: Fix missing error code in qed_slowpath_start() Greg Kroah-Hartman
2021-10-18 13:25 ` [PATCH 5.10 099/103] r8152: select CRC32 and CRYPTO/CRYPTO_HASH/CRYPTO_SHA256 Greg Kroah-Hartman
2021-10-18 13:25 ` [PATCH 5.10 100/103] nfp: flow_offload: move flow_indr_dev_register from app init to app start Greg Kroah-Hartman
2021-10-18 13:25 ` [PATCH 5.10 101/103] net: mscc: ocelot: warn when a PTP IRQ is raised for an unknown skb Greg Kroah-Hartman
2021-10-18 13:25 ` [PATCH 5.10 102/103] ionic: dont remove netdev->dev_addr when syncing uc list Greg Kroah-Hartman
2021-10-18 13:25 ` [PATCH 5.10 103/103] net: dsa: mv88e6xxx: dont use PHY_DETECT on internal PHYs Greg Kroah-Hartman
2021-10-18 17:50 ` [PATCH 5.10 000/103] 5.10.75-rc1 review Fox Chen
2021-10-18 19:29 ` Pavel Machek
2021-10-18 20:59 ` Shuah Khan
2021-10-18 21:18 ` Florian Fainelli
2021-10-19  6:08 ` Jon Hunter
2021-10-19  6:21 ` Naresh Kamboju
2021-10-19 12:20 ` Sudip Mukherjee
2021-10-19 20:27 ` Guenter Roeck
2021-10-20  2:00 ` Samuel Zou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211018132337.205366925@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=ayal@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=moshe@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=stable@vger.kernel.org \
    --cc=tariqt@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).