linux/drivers/net/ethernet/amd/xgbe
Gregory Fuchedgi 383d0fb894 amd-xgbe: fix PTP addend overflow causing frozen clock
XGBE_PTP_ACT_CLK_FREQ and XGBE_V2_PTP_ACT_CLK_FREQ were 10x too
large (500MHz/1GHz instead of 50MHz/100MHz), causing the computed
addend to overflow the 32-bit tstamp_addend. In the general case
this would result in the clock advancing at the wrong rate. For v2
(PCI), ptpclk_rate is hardcoded to 125MHz, so the addend formula
(ACT_CLK_FREQ << 32) / ptpclk_rate yields exactly 8 * 2^32, and
when stored to the 32-bit tstamp_addend the value is zero. With
addend = 0 the hardware accumulator never overflows and the PTP
clock is fully stopped. For v1 (platform), ptpclk_rate is read from
ACPI/DT so the exact overflow behavior depends on the
firmware-reported frequency.

Define the constants as NSEC_PER_SEC / SSINC so the relationship is
explicit and cannot drift out of sync.

Fixes: fbd47be098 ("amd-xgbe: add hardware PTP timestamping support")
Tested-by: Gregory Fuchedgi <gfuchedgi@gmail.com>
Signed-off-by: Gregory Fuchedgi <gfuchedgi@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260429-fix-xgbe-ptp-addend-v1-1-fca5b0ca5e62@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-02 10:16:27 -07:00
..
Makefile amd-xgbe: introduce support ethtool selftest 2025-11-06 13:38:11 +01:00
xgbe-common.h amd-xgbe: add TX descriptor cleanup for link-down 2026-03-24 10:48:07 +01:00
xgbe-dcb.c amd-xgbe: Convert to SPDX identifier 2025-04-08 13:26:33 +02:00
xgbe-debugfs.c amd-xgbe: Convert to SPDX identifier 2025-04-08 13:26:33 +02:00
xgbe-desc.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-05-01 15:11:38 -07:00
xgbe-dev.c amd-xgbe: add TX descriptor cleanup for link-down 2026-03-24 10:48:07 +01:00
xgbe-drv.c amd-xgbe: add TX descriptor cleanup for link-down 2026-03-24 10:48:07 +01:00
xgbe-ethtool.c net: xgbe: convert to use .get_rx_ring_count 2026-01-17 18:10:16 -08:00
xgbe-hwtstamp.c amd-xgbe: convert to ndo_hwtstamp callbacks 2025-10-20 17:30:26 -07:00
xgbe-i2c.c amd-xgbe: Use int type to store negative error codes 2025-08-27 18:06:46 -07:00
xgbe-main.c amd-xgbe: fix sleep while atomic on suspend/resume 2026-03-03 17:24:38 -08:00
xgbe-mdio.c amd-xgbe: optimize TX shutdown on link-down 2026-03-24 10:48:07 +01:00
xgbe-pci.c amd-xgbe: add PCI power management for S0i3 support 2026-03-10 19:51:23 -07:00
xgbe-phy-v1.c amd-xgbe: Convert to SPDX identifier 2025-04-08 13:26:33 +02:00
xgbe-phy-v2.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-03-12 12:53:34 -07:00
xgbe-platform.c net: xgbe: use device_get_mac_addr 2026-03-12 13:38:38 -07:00
xgbe-pps.c amd-xgbe: Add PPS periodic output support 2025-09-14 14:29:26 -07:00
xgbe-ptp.c amd-xgbe: Add PPS periodic output support 2025-09-14 14:29:26 -07:00
xgbe-selftest.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
xgbe-smn.h Networking changes for 6.16. 2025-05-28 15:24:36 -07:00
xgbe.h amd-xgbe: fix PTP addend overflow causing frozen clock 2026-05-02 10:16:27 -07:00