Skip to content

Commit 151ac45

Browse files
aakashmenondavem330
authored andcommitted
net: sparx5: Fix invalid timestamps
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: 70dfe25 ("net: sparx5: Update extraction/injection for timestamping") Signed-off-by: Aakash Menon <[email protected]> Reviewed-by: Horatiu Vultur <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9410645 commit 151ac45

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/net/ethernet/microchip/sparx5/sparx5_packet.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,12 @@ void sparx5_ifh_parse(u32 *ifh, struct frame_info *info)
4545
fwd = (fwd >> 5);
4646
info->src_port = FIELD_GET(GENMASK(7, 1), fwd);
4747

48+
/*
49+
* Bit 270-271 are occasionally unexpectedly set by the hardware,
50+
* clear bits before extracting timestamp
51+
*/
4852
info->timestamp =
49-
((u64)xtr_hdr[2] << 24) |
53+
((u64)(xtr_hdr[2] & GENMASK(5, 0)) << 24) |
5054
((u64)xtr_hdr[3] << 16) |
5155
((u64)xtr_hdr[4] << 8) |
5256
((u64)xtr_hdr[5] << 0);

0 commit comments

Comments
 (0)