public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net/mlx5: Support PTM on ARM architecture
@ 2026-03-16 13:36 Tariq Toukan
  2026-03-16 13:36 ` [PATCH net-next 1/2] net/mlx5: Move crosststamp setup into helper function Tariq Toukan
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Tariq Toukan @ 2026-03-16 13:36 UTC (permalink / raw)
  To: Eric Dumazet, Jakub Kicinski, Paolo Abeni, Andrew Lunn,
	David S. Miller
  Cc: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Mark Bloch,
	Richard Cochran, netdev, linux-rdma, linux-kernel, Gal Pressman,
	Moshe Shemesh, Dragos Tatulea, Carolina Jubran, Shahar Shitrit

Hi,

This series by Carolina refactors mlx5 crosststamp initialization and
enables cross-timestamp support on ARM.

Regards,
Tariq

Carolina Jubran (2):
  net/mlx5: Move crosststamp setup into helper function
  net/mlx5: Support cross-timestamping on ARM architectures

 .../ethernet/mellanox/mlx5/core/lib/clock.c   | 40 ++++++++++++-------
 1 file changed, 26 insertions(+), 14 deletions(-)


base-commit: 5446b8691eb8278f10deca92048fad84ffd1e4d5
-- 
2.44.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next 1/2] net/mlx5: Move crosststamp setup into helper function
  2026-03-16 13:36 [PATCH net-next 0/2] net/mlx5: Support PTM on ARM architecture Tariq Toukan
@ 2026-03-16 13:36 ` Tariq Toukan
  2026-03-16 13:36 ` [PATCH net-next 2/2] net/mlx5: Support cross-timestamping on ARM architectures Tariq Toukan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Tariq Toukan @ 2026-03-16 13:36 UTC (permalink / raw)
  To: Eric Dumazet, Jakub Kicinski, Paolo Abeni, Andrew Lunn,
	David S. Miller
  Cc: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Mark Bloch,
	Richard Cochran, netdev, linux-rdma, linux-kernel, Gal Pressman,
	Moshe Shemesh, Dragos Tatulea, Carolina Jubran, Shahar Shitrit

From: Carolina Jubran <cjubran@nvidia.com>

Move the crosststamp registration logic into a dedicated helper,
mlx5_init_crosststamp().

This prepares the code for a follow-up patch around PTM handling.

Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
Reviewed-by: Shahar Shitrit <shshitrit@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 .../ethernet/mellanox/mlx5/core/lib/clock.c   | 28 +++++++++++++------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
index bd4e042077af..3322814819ea 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
@@ -1301,6 +1301,24 @@ static void mlx5_init_timer_max_freq_adjustment(struct mlx5_core_dev *mdev)
 			min(S32_MAX, 1 << log_max_freq_adjustment);
 }
 
+static void mlx5_init_crosststamp(struct mlx5_core_dev *mdev,
+				  bool expose_cycles, struct mlx5_clock *clock)
+{
+#if defined(CONFIG_X86)
+	if (!boot_cpu_has(X86_FEATURE_ART))
+		return;
+
+	if (!MLX5_CAP_MCAM_REG3(mdev, mtptm) ||
+	    !MLX5_CAP_MCAM_REG3(mdev, mtctr))
+		return;
+
+	clock->ptp_info.getcrosststamp = mlx5_ptp_getcrosststamp;
+	if (expose_cycles)
+		clock->ptp_info.getcrosscycles = mlx5_ptp_getcrosscycles;
+
+#endif /* CONFIG_X86 */
+}
+
 static void mlx5_init_timer_clock(struct mlx5_core_dev *mdev)
 {
 	struct mlx5_clock *clock = mdev->clock;
@@ -1315,15 +1333,7 @@ static void mlx5_init_timer_clock(struct mlx5_core_dev *mdev)
 	expose_cycles = !MLX5_CAP_GEN(mdev, disciplined_fr_counter) ||
 			!mlx5_real_time_mode(mdev);
 
-#ifdef CONFIG_X86
-	if (MLX5_CAP_MCAM_REG3(mdev, mtptm) &&
-	    MLX5_CAP_MCAM_REG3(mdev, mtctr) && boot_cpu_has(X86_FEATURE_ART)) {
-		clock->ptp_info.getcrosststamp = mlx5_ptp_getcrosststamp;
-		if (expose_cycles)
-			clock->ptp_info.getcrosscycles =
-				mlx5_ptp_getcrosscycles;
-	}
-#endif /* CONFIG_X86 */
+	mlx5_init_crosststamp(mdev, expose_cycles, clock);
 
 	if (expose_cycles)
 		clock->ptp_info.getcyclesx64 = mlx5_ptp_getcyclesx;
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 2/2] net/mlx5: Support cross-timestamping on ARM architectures
  2026-03-16 13:36 [PATCH net-next 0/2] net/mlx5: Support PTM on ARM architecture Tariq Toukan
  2026-03-16 13:36 ` [PATCH net-next 1/2] net/mlx5: Move crosststamp setup into helper function Tariq Toukan
@ 2026-03-16 13:36 ` Tariq Toukan
  2026-03-18 15:27 ` [PATCH net-next 0/2] net/mlx5: Support PTM on ARM architecture Simon Horman
  2026-03-19  2:30 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Tariq Toukan @ 2026-03-16 13:36 UTC (permalink / raw)
  To: Eric Dumazet, Jakub Kicinski, Paolo Abeni, Andrew Lunn,
	David S. Miller
  Cc: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Mark Bloch,
	Richard Cochran, netdev, linux-rdma, linux-kernel, Gal Pressman,
	Moshe Shemesh, Dragos Tatulea, Carolina Jubran, Shahar Shitrit

From: Carolina Jubran <cjubran@nvidia.com>

Extend cross-timestamp support for ARM systems that implement the ARM
architected timer.

Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
Reviewed-by: Shahar Shitrit <shshitrit@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 .../net/ethernet/mellanox/mlx5/core/lib/clock.c  | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
index 3322814819ea..d785f1b4f2e1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
@@ -38,10 +38,10 @@
 #include "lib/eq.h"
 #include "en.h"
 #include "clock.h"
-#ifdef CONFIG_X86
+#if defined(CONFIG_X86) || defined(CONFIG_ARM_ARCH_TIMER)
 #include <linux/timekeeping.h>
 #include <linux/cpufeature.h>
-#endif /* CONFIG_X86 */
+#endif /* CONFIG_X86 || CONFIG_ARM_ARCH_TIMER */
 
 #define MLX5_RT_CLOCK_IDENTITY_SIZE MLX5_FLD_SZ_BYTES(mrtcq_reg, rt_clock_identity)
 
@@ -229,7 +229,7 @@ static int mlx5_set_mtutc(struct mlx5_core_dev *dev, u32 *mtutc, u32 size)
 				    MLX5_REG_MTUTC, 0, 1);
 }
 
-#ifdef CONFIG_X86
+#if defined(CONFIG_X86) || defined(CONFIG_ARM_ARCH_TIMER)
 static bool mlx5_is_ptm_source_time_available(struct mlx5_core_dev *dev)
 {
 	u32 out[MLX5_ST_SZ_DW(mtptm_reg)] = {0};
@@ -275,7 +275,8 @@ static int mlx5_mtctr_read(struct mlx5_core_dev *mdev,
 	host = MLX5_GET64(mtctr_reg, out, first_clock_timestamp);
 	*sys_counterval = (struct system_counterval_t) {
 			.cycles = host,
-			.cs_id = CSID_X86_ART,
+			.cs_id = IS_ENABLED(CONFIG_X86) ? CSID_X86_ART :
+							  CSID_ARM_ARCH_COUNTER,
 			.use_nsecs = true,
 	};
 	*device = MLX5_GET64(mtctr_reg, out, second_clock_timestamp);
@@ -373,7 +374,7 @@ static int mlx5_ptp_getcrosscycles(struct ptp_clock_info *ptp,
 	mlx5_clock_unlock(clock);
 	return err;
 }
-#endif /* CONFIG_X86 */
+#endif /* CONFIG_X86 || CONFIG_ARM_ARCH_TIMER */
 
 static u64 mlx5_read_time(struct mlx5_core_dev *dev,
 			  struct ptp_system_timestamp *sts,
@@ -1307,7 +1308,8 @@ static void mlx5_init_crosststamp(struct mlx5_core_dev *mdev,
 #if defined(CONFIG_X86)
 	if (!boot_cpu_has(X86_FEATURE_ART))
 		return;
-
+#endif /* CONFIG_X86 */
+#if defined(CONFIG_X86) || defined(CONFIG_ARM_ARCH_TIMER)
 	if (!MLX5_CAP_MCAM_REG3(mdev, mtptm) ||
 	    !MLX5_CAP_MCAM_REG3(mdev, mtctr))
 		return;
@@ -1316,7 +1318,7 @@ static void mlx5_init_crosststamp(struct mlx5_core_dev *mdev,
 	if (expose_cycles)
 		clock->ptp_info.getcrosscycles = mlx5_ptp_getcrosscycles;
 
-#endif /* CONFIG_X86 */
+#endif /* CONFIG_X86 || CONFIG_ARM_ARCH_TIMER */
 }
 
 static void mlx5_init_timer_clock(struct mlx5_core_dev *mdev)
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 0/2] net/mlx5: Support PTM on ARM architecture
  2026-03-16 13:36 [PATCH net-next 0/2] net/mlx5: Support PTM on ARM architecture Tariq Toukan
  2026-03-16 13:36 ` [PATCH net-next 1/2] net/mlx5: Move crosststamp setup into helper function Tariq Toukan
  2026-03-16 13:36 ` [PATCH net-next 2/2] net/mlx5: Support cross-timestamping on ARM architectures Tariq Toukan
@ 2026-03-18 15:27 ` Simon Horman
  2026-03-19  2:30 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2026-03-18 15:27 UTC (permalink / raw)
  To: Tariq Toukan
  Cc: Eric Dumazet, Jakub Kicinski, Paolo Abeni, Andrew Lunn,
	David S. Miller, Saeed Mahameed, Leon Romanovsky, Mark Bloch,
	Richard Cochran, netdev, linux-rdma, linux-kernel, Gal Pressman,
	Moshe Shemesh, Dragos Tatulea, Carolina Jubran, Shahar Shitrit

On Mon, Mar 16, 2026 at 03:36:05PM +0200, Tariq Toukan wrote:
> Hi,
> 
> This series by Carolina refactors mlx5 crosststamp initialization and
> enables cross-timestamp support on ARM.
> 
> Regards,
> Tariq
> 
> Carolina Jubran (2):
>   net/mlx5: Move crosststamp setup into helper function
>   net/mlx5: Support cross-timestamping on ARM architectures

For the series:

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 0/2] net/mlx5: Support PTM on ARM architecture
  2026-03-16 13:36 [PATCH net-next 0/2] net/mlx5: Support PTM on ARM architecture Tariq Toukan
                   ` (2 preceding siblings ...)
  2026-03-18 15:27 ` [PATCH net-next 0/2] net/mlx5: Support PTM on ARM architecture Simon Horman
@ 2026-03-19  2:30 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-19  2:30 UTC (permalink / raw)
  To: Tariq Toukan
  Cc: edumazet, kuba, pabeni, andrew+netdev, davem, saeedm, leon,
	mbloch, richardcochran, netdev, linux-rdma, linux-kernel, gal,
	moshe, dtatulea, cjubran, shshitrit

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 16 Mar 2026 15:36:05 +0200 you wrote:
> Hi,
> 
> This series by Carolina refactors mlx5 crosststamp initialization and
> enables cross-timestamp support on ARM.
> 
> Regards,
> Tariq
> 
> [...]

Here is the summary with links:
  - [net-next,1/2] net/mlx5: Move crosststamp setup into helper function
    https://git.kernel.org/netdev/net-next/c/f87ca3b905e2
  - [net-next,2/2] net/mlx5: Support cross-timestamping on ARM architectures
    https://git.kernel.org/netdev/net-next/c/96aca5efec8a

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-03-19  2:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-16 13:36 [PATCH net-next 0/2] net/mlx5: Support PTM on ARM architecture Tariq Toukan
2026-03-16 13:36 ` [PATCH net-next 1/2] net/mlx5: Move crosststamp setup into helper function Tariq Toukan
2026-03-16 13:36 ` [PATCH net-next 2/2] net/mlx5: Support cross-timestamping on ARM architectures Tariq Toukan
2026-03-18 15:27 ` [PATCH net-next 0/2] net/mlx5: Support PTM on ARM architecture Simon Horman
2026-03-19  2:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox