dpll: expose fractional frequency offset in ppt
Subsystems (7)
Ivan Vecera
maintainerPATCH 1/1 dpll: expose fractional frequency offset in ppt
Currently, the dpll subsystem exports the fractional frequency offset (FFO) in parts per million (ppm). This granularity is insufficient for high-precision synchronization scenarios which often require parts per trillion (ppt) resolution.
Add a new netlink attribute DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET_PPT to expose the FFO in ppt.
Update the dpll netlink core to expect the driver-provided FFO value to be in ppt. To maintain backward compatibility with existing userspace tools, populate the legacy DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET attribute by dividing the new ppt value by 1,000,000.
Update the zl3073x and mlx5 drivers to provide the FFO value in ppt:
- zl3073x: adjust the fixed-point calculation to produce ppt (10^12) instead of ppm (10^6).
- mlx5: scale the existing ppm value by 1,000,000.
--- Documentation/netlink/specs/dpll.yaml | 11 +++++++++++ drivers/dpll/dpll_netlink.c | 10 +++++++++- drivers/dpll/zl3073x/core.c | 7 +++++-- drivers/net/ethernet/mellanox/mlx5/core/dpll.c | 2 +- include/uapi/linux/dpll.h | 1 + 5 files changed, 27 insertions(+), 4 deletions(-)
Documentation/netlink/specs/dpll.yaml +11 -0
@@ -446,6 +446,16 @@ attribute-sets: doc: | Granularity of phase adjustment, in picoseconds. The value of phase adjustment must be a multiple of this granularity. + - + name: fractional-frequency-offset-ppt + type: sint + doc: | + The FFO (Fractional Frequency Offset) of the pin with respect to + the nominal frequency. + Value = (frequency_measured - frequency_nominal) / frequency_nominal + Value is in PPT (parts per trillion, 10^-12). + Note: This attribute provides higher resolution than the standard + fractional-frequency-offset (which is in PPM). - name: pin-parent-device
@@ -628,6 +638,7 @@ operations: - phase-adjust-max - phase-adjust - fractional-frequency-offset + - fractional-frequency-offset-ppt - esync-frequency - esync-frequency-supported - esync-pulse
drivers/dpll/dpll_netlink.c +9 -1
@@ -389,7 +389,15 @@ static int dpll_msg_add_ffo(struct sk_buff *msg, struct dpll_pin *pin,return 0 ;return ret; } -return nla_put_sint (msg,DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET , ffo); +/* Put the FFO value in PPM to preserve compatibility with older +* programs. +*/ + ret =nla_put_sint (msg,DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET , +div_s64 (ffo,1000000 )); +if (ret) +return -EMSGSIZE ; +return nla_put_sint (msg,DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET_PPT , + ffo); } static int
drivers/dpll/zl3073x/core.c +5 -2
@@ -710,8 +710,11 @@ zl3073x_ref_ffo_update(struct zl3073x_dev *zldev)if (rc)return rc; -/* Convert to ppm -> ffo = (10^6 * value) / 2^32 */ - zldev->ref[i].ffo =mul_s64_u64_shr (value,1000000 ,32 ); +/* Convert to ppt +* ffo = (10^12 * value) / 2^32 +* ffo = ( 5^12 * value) / 2^20 +*/ + zldev->ref[i].ffo =mul_s64_u64_shr (value,244140625 ,20 ); }return 0 ;
drivers/net/ethernet/mellanox/mlx5/core/dpll.c +1 -1
@@ -136,7 +136,7 @@ mlx5_dpll_pin_ffo_get(struct mlx5_dpll_synce_status *synce_status, {if (!synce_status->oper_freq_measure)return -ENODATA ; - *ffo = synce_status->frequency_diff; + *ffo =1000000LL * synce_status->frequency_diff;return 0 ; }
include/uapi/linux/dpll.h +1 -0
@@ -253,6 +253,7 @@ enum dpll_a_pin {DPLL_A_PIN_ESYNC_PULSE ,DPLL_A_PIN_REFERENCE_SYNC ,DPLL_A_PIN_PHASE_ADJUST_GRAN , +DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET_PPT , __DPLL_A_PIN_MAX,DPLL_A_PIN_MAX = (__DPLL_A_PIN_MAX -1 )
Signature · 1 line
2.52.0
Quoted 132 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, January 26, 2026 5:23 PMCurrently, the dpll subsystem exports the fractional frequency offset (FFO) in parts per million (ppm). This granularity is insufficient for high-precision synchronization scenarios which often require parts per trillion (ppt) resolution.
Add a new netlink attribute
DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET_PPTto expose the FFO in ppt.Update the dpll netlink core to expect the driver-provided FFO value to be in ppt. To maintain backward compatibility with existing userspace tools, populate the legacy
DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSETattribute by dividing the new ppt value by 1,000,000.Update the zl3073x and mlx5 drivers to provide the FFO value in ppt:
- zl3073x: adjust the fixed-point calculation to produce ppt (10^12) instead of ppm (10^6).
- mlx5: scale the existing ppm value by 1,000,000.Signed-off-by Ivan Vecera <[email protected]>---
Documentation/netlink/specs/dpll.yaml | 11 +++++++++++ drivers/dpll/dpll_netlink.c | 10 +++++++++- drivers/dpll/zl3073x/core.c | 7 +++++-- drivers/net/ethernet/mellanox/mlx5/core/dpll.c | 2 +- include/uapi/linux/dpll.h | 1 + 5 files changed, 27 insertions(+), 4 deletions(-)Documentation/netlink/specs/dpll.yaml +5
-0@@ -446,6 +446,16 @@ attribute-sets: doc: | Granularity of phase adjustment, in picoseconds. The value of phase adjustment must be a multiple of this granularity. + - + name: fractional-frequency-offset-ppt + type: sint + doc: | + The FFO (Fractional Frequency Offset) of the pin with respectto
Documentation/netlink/specs/dpll.yaml +2
-0+ the nominal frequency. + Value = (frequency_measured - frequency_nominal) /
frequency_nominalDocumentation/netlink/specs/dpll.yaml +2
-0+ Value is in PPT (parts per trillion, 10^-12). + Note: This attribute provides higher resolution than thestandard
Documentation/netlink/specs/dpll.yaml +2
-0+ fractional-frequency-offset (which is in PPM). - name: pin-parent-device@@ -628,6 +638,7 @@ operations: - phase-adjust-max - phase-adjust - fractional-frequency-offset + - fractional-frequency-offset-ppt - esync-frequency - esync-frequency-supported - esync-pulsedrivers/dpll/dpll_netlink.c +9
-1@@ -389,7 +389,15 @@ static int dpll_msg_add_ffo(struct sk_buff *msg,struct dpll_pin *pin, return 0;return ret; } -return nla_put_sint (msg,DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET , ffo); +/* Put the FFO value in PPM to preserve compatibility with older +* programs. +*/ + ret =nla_put_sint (msg,DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET , +div_s64 (ffo,1000000 )); +if (ret) +return -EMSGSIZE ; +return nla_put_sint (msg,DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET_PPT , + ffo); }static int
drivers/dpll/zl3073x/core.c +5
-2@@ -710,8 +710,11 @@ zl3073x_ref_ffo_update(struct zl3073x_dev *zldev)if (rc)return rc; -/* Convert to ppm -> ffo = (10^6 * value) / 2^32 */ - zldev->ref[i].ffo =mul_s64_u64_shr (value,1000000 ,32 ); +/* Convert to ppt +* ffo = (10^12 * value) / 2^32 +* ffo = ( 5^12 * value) / 2^20 +*/ + zldev->ref[i].ffo =mul_s64_u64_shr (value,244140625 ,20 ); }return 0 ;drivers/net/ethernet/mellanox/mlx5/core/dpll.c +1
-1@@ -136,7 +136,7 @@ mlx5_dpll_pin_ffo_get(struct mlx5_dpll_synce_status *synce_status, {if (!synce_status->oper_freq_measure)return -ENODATA ; - *ffo = synce_status->frequency_diff; + *ffo =1000000LL * synce_status->frequency_diff;return 0 ; }include/uapi/linux/dpll.h +1
-1@@ -253,6 +253,7 @@ enum dpll_a_pin {DPLL_A_PIN_ESYNC_PULSE ,DPLL_A_PIN_REFERENCE_SYNC ,DPLL_A_PIN_PHASE_ADJUST_GRAN , +DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET_PPT , __DPLL_A_PIN_MAX,DPLL_A_PIN_MAX = (__DPLL_A_PIN_MAX -1 ) --
Quoted 1 line
2.52.0
LGTM,
Quoted 13 lines · Mon, Jan 26, 2026 at 05:22:51PM +0100, [email protected] wrote:
Currently, the dpll subsystem exports the fractional frequency offset (FFO) in parts per million (ppm). This granularity is insufficient for high-precision synchronization scenarios which often require parts per trillion (ppt) resolution.
Add a new netlink attribute
DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET_PPTto expose the FFO in ppt.Update the dpll netlink core to expect the driver-provided FFO value to be in ppt. To maintain backward compatibility with existing userspace tools, populate the legacy
DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSETattribute by dividing the new ppt value by 1,000,000.
Quoted 6 lines
Update the zl3073x and mlx5 drivers to provide the FFO value in ppt:
- zl3073x: adjust the fixed-point calculation to produce ppt (10^12) instead of ppm (10^6).
- mlx5: scale the existing ppm value by 1,000,000.Signed-off-by Ivan Vecera <[email protected]>
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Mon, 26 Jan 2026 17:22:51 +0100 you wrote:
Currently, the dpll subsystem exports the fractional frequency offset (FFO) in parts per million (ppm). This granularity is insufficient for high-precision synchronization scenarios which often require parts per trillion (ppt) resolution.
Add a new netlink attribute
DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET_PPTto expose the FFO in ppt.[...]
Here is the summary with links:
- [net-next] dpll: expose fractional frequency offset in ppt
https://git.kernel.org/netdev/net-next/c/bc443c253fcd
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html