* [PATCH net v2] net: sparx5: Fix invalid timestamps
@ 2024-09-17 5:18 Aakash Menon
2024-09-17 6:13 ` Horatiu Vultur
2024-09-22 19:00 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Aakash Menon @ 2024-09-17 5:18 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, lars.povlsen, Steen.Hegelund,
daniel.machon, UNGLinuxDriver, aakash.menon, horms,
horatiu.vultur
Cc: netdev, linux-arm-kernel, linux-kernel
Bit 270-271 are occasionally unexpectedly set by the hardware. This issue
was observed with 10G SFPs causing huge time errors (> 30ms) in PTP. Only
30 bits are needed for the nanosecond part of the timestamp, clear 2 most
significant bits before extracting timestamp from the internal frame
header.
Fixes: 70dfe25cd866 ("net: sparx5: Update extraction/injection for timestamping")
Signed-off-by: Aakash Menon <aakash.menon@protempis.com>
---
v2:
- Wrap patch descriptions at 75 characters wide.
- Use GENMASK(5,0) instead of masking with 0x3F
- Update Fixes tag to be on the same line
- Link to v1 -https://lore.kernel.org/r/20240913193357.21899-1-aakash.menon@protempis.com
drivers/net/ethernet/microchip/sparx5/sparx5_packet.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_packet.c b/drivers/net/ethernet/microchip/sparx5/sparx5_packet.c
index f3f5fb420468..70427643f777 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_packet.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_packet.c
@@ -45,8 +45,12 @@ void sparx5_ifh_parse(u32 *ifh, struct frame_info *info)
fwd = (fwd >> 5);
info->src_port = FIELD_GET(GENMASK(7, 1), fwd);
+ /*
+ * Bit 270-271 are occasionally unexpectedly set by the hardware,
+ * clear bits before extracting timestamp
+ */
info->timestamp =
- ((u64)xtr_hdr[2] << 24) |
+ ((u64)(xtr_hdr[2] & GENMASK(5, 0)) << 24) |
((u64)xtr_hdr[3] << 16) |
((u64)xtr_hdr[4] << 8) |
((u64)xtr_hdr[5] << 0);
--
2.46.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net v2] net: sparx5: Fix invalid timestamps
2024-09-17 5:18 [PATCH net v2] net: sparx5: Fix invalid timestamps Aakash Menon
@ 2024-09-17 6:13 ` Horatiu Vultur
2024-09-22 19:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Horatiu Vultur @ 2024-09-17 6:13 UTC (permalink / raw)
To: Aakash Menon
Cc: davem, edumazet, kuba, pabeni, lars.povlsen, Steen.Hegelund,
daniel.machon, UNGLinuxDriver, aakash.menon, horms, netdev,
linux-arm-kernel, linux-kernel
The 09/16/2024 22:18, Aakash Menon wrote:
>
> Bit 270-271 are occasionally unexpectedly set by the hardware. This issue
> was observed with 10G SFPs causing huge time errors (> 30ms) in PTP. Only
> 30 bits are needed for the nanosecond part of the timestamp, clear 2 most
> significant bits before extracting timestamp from the internal frame
> header.
Thanks for changes. I think it look good.
Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com>
>
> Fixes: 70dfe25cd866 ("net: sparx5: Update extraction/injection for timestamping")
> Signed-off-by: Aakash Menon <aakash.menon@protempis.com>
> ---
> v2:
> - Wrap patch descriptions at 75 characters wide.
> - Use GENMASK(5,0) instead of masking with 0x3F
> - Update Fixes tag to be on the same line
> - Link to v1 -https://lore.kernel.org/r/20240913193357.21899-1-aakash.menon@protempis.com
> drivers/net/ethernet/microchip/sparx5/sparx5_packet.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_packet.c b/drivers/net/ethernet/microchip/sparx5/sparx5_packet.c
> index f3f5fb420468..70427643f777 100644
> --- a/drivers/net/ethernet/microchip/sparx5/sparx5_packet.c
> +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_packet.c
> @@ -45,8 +45,12 @@ void sparx5_ifh_parse(u32 *ifh, struct frame_info *info)
> fwd = (fwd >> 5);
> info->src_port = FIELD_GET(GENMASK(7, 1), fwd);
>
> + /*
> + * Bit 270-271 are occasionally unexpectedly set by the hardware,
> + * clear bits before extracting timestamp
> + */
> info->timestamp =
> - ((u64)xtr_hdr[2] << 24) |
> + ((u64)(xtr_hdr[2] & GENMASK(5, 0)) << 24) |
> ((u64)xtr_hdr[3] << 16) |
> ((u64)xtr_hdr[4] << 8) |
> ((u64)xtr_hdr[5] << 0);
> --
> 2.46.0
>
--
/Horatiu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net v2] net: sparx5: Fix invalid timestamps
2024-09-17 5:18 [PATCH net v2] net: sparx5: Fix invalid timestamps Aakash Menon
2024-09-17 6:13 ` Horatiu Vultur
@ 2024-09-22 19:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-09-22 19:00 UTC (permalink / raw)
To: Aakash Menon
Cc: davem, edumazet, kuba, pabeni, lars.povlsen, Steen.Hegelund,
daniel.machon, UNGLinuxDriver, aakash.menon, horms,
horatiu.vultur, netdev, linux-arm-kernel, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:
On Mon, 16 Sep 2024 22:18:29 -0700 you wrote:
> Bit 270-271 are occasionally unexpectedly set by the hardware. This issue
> was observed with 10G SFPs causing huge time errors (> 30ms) in PTP. Only
> 30 bits are needed for the nanosecond part of the timestamp, clear 2 most
> significant bits before extracting timestamp from the internal frame
> header.
>
> Fixes: 70dfe25cd866 ("net: sparx5: Update extraction/injection for timestamping")
> Signed-off-by: Aakash Menon <aakash.menon@protempis.com>
>
> [...]
Here is the summary with links:
- [net,v2] net: sparx5: Fix invalid timestamps
https://git.kernel.org/netdev/net-next/c/151ac45348af
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:[~2024-09-22 19:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-17 5:18 [PATCH net v2] net: sparx5: Fix invalid timestamps Aakash Menon
2024-09-17 6:13 ` Horatiu Vultur
2024-09-22 19:00 ` 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