mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
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. Signed-off-by: Ivan Vecera <ivecera@redhat.com> Reviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Link: https://patch.msgid.link/20260126162253.27890-1-ivecera@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
b3827c91cc
commit
bc443c253f
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user