From 30b8d5c63792151ff3d979ab02a170458bcf39b9 Mon Sep 17 00:00:00 2001 From: Denis Kirjanov <dkirjanov@suse.com> Date: Feb 08 2024 13:46:56 +0000 Subject: net/mlx5: Don't call timecounter cyc2time directly from 1PPS flow (git-fixes). --- diff --git a/patches.suse/net-mlx5-Don-t-call-timecounter-cyc2time-directly-fr.patch b/patches.suse/net-mlx5-Don-t-call-timecounter-cyc2time-directly-fr.patch new file mode 100644 index 0000000..75433c4 --- /dev/null +++ b/patches.suse/net-mlx5-Don-t-call-timecounter-cyc2time-directly-fr.patch @@ -0,0 +1,38 @@ +From a56fb69210657cdf0b92f7213a9563632d92ca14 Mon Sep 17 00:00:00 2001 +From: Eran Ben Elisha <eranbe@mellanox.com> +Date: Tue, 16 Jun 2020 12:07:10 +0300 +Subject: [PATCH] net/mlx5: Don't call timecounter cyc2time directly from 1PPS + flow +Git-commit: 0d2ffdc8d4002a62de31ff7aa3bef28c843c3cbe +Patch-mainline: v5.10 +References: git-fixes + +Before calling timecounter_cyc2time(), clock->lock must be taken. +Use mlx5_timecounter_cyc2time instead which guarantees a safe access. + +Fixes: afc98a0b46d8 ("net/mlx5: Update ptp_clock_event foreach PPS event") +Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com> +Signed-off-by: Denis Kirjanov <denis.kirjanov@suse.com> +--- + drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +index 09c1c57dbfcd..bcfb6e59702e 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +@@ -505,8 +505,9 @@ void mlx5_pps_event(struct mlx5_core_dev *mdev, + switch (clock->ptp_info.pin_config[pin].func) { + case PTP_PF_EXTTS: + ptp_event.index = pin; +- ptp_event.timestamp = timecounter_cyc2time(&clock->tc, +- be64_to_cpu(eqe->data.pps.time_stamp)); ++ ptp_event.timestamp = ++ mlx5_timecounter_cyc2time(clock, ++ be64_to_cpu(eqe->data.pps.time_stamp)); + if (clock->pps_info.enabled) { + ptp_event.type = PTP_CLOCK_PPSUSR; + ptp_event.pps_times.ts_real = +-- +2.16.4 + diff --git a/series.conf b/series.conf index c489793..dde43c1 100644 --- a/series.conf +++ b/series.conf @@ -58979,6 +58979,7 @@ patches.suse/gve-Enable-Link-Speed-Reporting-in-the-driver.patch patches.suse/net-ethernet-mlx4-Avoid-assigning-a-value-to-ring_co.patch patches.suse/net-stmmac-use-netif_tx_start-stop_all_queues-functi.patch + patches.suse/net-mlx5-Don-t-call-timecounter-cyc2time-directly-fr.patch patches.suse/Revert-ibmvnic-remove-never-executed-if-statement.patch patches.suse/net-ena-Change-license-into-format-to-SPDX-in-all-fi.patch patches.suse/net-ena-Change-log-message-to-netif-dev-function.patch