* [PATCH net v3] net: lan966x: Fix the initialization of taprio
@ 2025-11-21 6:14 Horatiu Vultur
2025-11-25 14:09 ` Simon Horman
2025-11-25 15:24 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Horatiu Vultur @ 2025-11-21 6:14 UTC (permalink / raw)
To: UNGLinuxDriver, andrew+netdev, davem, edumazet, kuba, pabeni,
richardcochran
Cc: netdev, linux-kernel, Horatiu Vultur
To initialize the taprio block in lan966x, it is required to configure
the register REVISIT_DLY. The purpose of this register is to set the
delay before revisit the next gate and the value of this register depends
on the system clock. The problem is that the we calculated wrong the value
of the system clock period in picoseconds. The actual system clock is
~165.617754MHZ and this correspond to a period of 6038 pico seconds and
not 15125 as currently set.
Fixes: e462b2717380b4 ("net: lan966x: Add offload support for taprio")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
v2-v3:
- start to use the define
v1->v2:
- add define for system clock and calculate the period in picoseconds
---
drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c b/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c
index b4377b8613c3a..8c40db90ee8f6 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c
@@ -1,11 +1,14 @@
// SPDX-License-Identifier: GPL-2.0+
#include <linux/ptp_classify.h>
+#include <linux/units.h>
#include "lan966x_main.h"
#include "vcap_api.h"
#include "vcap_api_client.h"
+#define LAN9X66_CLOCK_RATE 165617754
+
#define LAN966X_MAX_PTP_ID 512
/* Represents 1ppm adjustment in 2^59 format with 6.037735849ns as reference
@@ -1126,5 +1129,5 @@ void lan966x_ptp_rxtstamp(struct lan966x *lan966x, struct sk_buff *skb,
u32 lan966x_ptp_get_period_ps(void)
{
/* This represents the system clock period in picoseconds */
- return 15125;
+ return PICO / LAN9X66_CLOCK_RATE;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net v3] net: lan966x: Fix the initialization of taprio
2025-11-21 6:14 [PATCH net v3] net: lan966x: Fix the initialization of taprio Horatiu Vultur
@ 2025-11-25 14:09 ` Simon Horman
2025-11-25 15:24 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-11-25 14:09 UTC (permalink / raw)
To: Horatiu Vultur
Cc: UNGLinuxDriver, andrew+netdev, davem, edumazet, kuba, pabeni,
richardcochran, netdev, linux-kernel
On Fri, Nov 21, 2025 at 07:14:11AM +0100, Horatiu Vultur wrote:
> To initialize the taprio block in lan966x, it is required to configure
> the register REVISIT_DLY. The purpose of this register is to set the
> delay before revisit the next gate and the value of this register depends
> on the system clock. The problem is that the we calculated wrong the value
> of the system clock period in picoseconds. The actual system clock is
> ~165.617754MHZ and this correspond to a period of 6038 pico seconds and
> not 15125 as currently set.
>
> Fixes: e462b2717380b4 ("net: lan966x: Add offload support for taprio")
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
>
> ---
> v2-v3:
> - start to use the define
>
> v1->v2:
> - add define for system clock and calculate the period in picoseconds
Thanks, I agree with this analysis.
And believe v3 addresses the review of earlier versions.
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net v3] net: lan966x: Fix the initialization of taprio
2025-11-21 6:14 [PATCH net v3] net: lan966x: Fix the initialization of taprio Horatiu Vultur
2025-11-25 14:09 ` Simon Horman
@ 2025-11-25 15:24 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-11-25 15:24 UTC (permalink / raw)
To: Horatiu Vultur
Cc: UNGLinuxDriver, andrew+netdev, davem, edumazet, kuba, pabeni,
richardcochran, netdev, linux-kernel
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Fri, 21 Nov 2025 07:14:11 +0100 you wrote:
> To initialize the taprio block in lan966x, it is required to configure
> the register REVISIT_DLY. The purpose of this register is to set the
> delay before revisit the next gate and the value of this register depends
> on the system clock. The problem is that the we calculated wrong the value
> of the system clock period in picoseconds. The actual system clock is
> ~165.617754MHZ and this correspond to a period of 6038 pico seconds and
> not 15125 as currently set.
>
> [...]
Here is the summary with links:
- [net,v3] net: lan966x: Fix the initialization of taprio
https://git.kernel.org/netdev/net/c/9780f535f8e0
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] 3+ messages in thread
end of thread, other threads:[~2025-11-25 15:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-21 6:14 [PATCH net v3] net: lan966x: Fix the initialization of taprio Horatiu Vultur
2025-11-25 14:09 ` Simon Horman
2025-11-25 15:24 ` 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;
as well as URLs for NNTP newsgroup(s).