net/mlx5: Dynamic cyclecounter shift calculation for PTP free running clock
authorRahul Rameshbabu <rrameshbabu@nvidia.com>
Mon, 21 Aug 2023 23:05:54 +0000 (16:05 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 25 Aug 2023 00:14:39 +0000 (17:14 -0700)
commit84a58e60038fa0366006977dba85eae16b2e3d78
tree2354a2d5be711d9a887d8dad7d02f4f4600b0021
parentb5cc3833f13ace75e26e3f7b51cd7b6da5e9cf17
net/mlx5: Dynamic cyclecounter shift calculation for PTP free running clock

Use a dynamic calculation to determine the shift value for the internal
timer cyclecounter that will lead to the highest precision frequency
adjustments. Previously used a constant for the shift value assuming all
devices supported by the driver had a nominal frequency of 1GHz. However,
there are devices that operate at different frequencies. The previous shift
value constant would break the PHC functionality for those devices.

Reported-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Closes: https://lore.kernel.org/netdev/20230815151507.3028503-1-vadfed@meta.com/
Fixes: 6a4010927562 ("net/mlx5: Update cyclecounter shift value to improve ptp free running mode precision")
Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Tested-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Acked-by: Saeed Mahameed <saeedm@nvidia.com>
Link: https://lore.kernel.org/r/20230821230554.236210-1-rrameshbabu@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c