summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/intel/e1000e
diff options
context:
space:
mode:
authorJacob Keller <jacob.e.keller@intel.com>2022-07-22 00:29:54 +0300
committerTony Nguyen <anthony.l.nguyen@intel.com>2022-07-28 20:54:47 +0300
commit4488df1401522cd263166ef8799d56661baf83b0 (patch)
treef2cf58b17e1340459d054ff4c1cebabc378782cf /drivers/net/ethernet/intel/e1000e
parent623cd87006983935de6c2ad8e2d50e68f1b7d6e7 (diff)
downloadlinux-4488df1401522cd263166ef8799d56661baf83b0.tar.xz
ice: implement adjfine with mul_u64_u64_div_u64
The PTP frequency adjustment code needs to determine an appropriate adjustment given an input scaled_ppm adjustment. We calculate the adjustment to the register by multiplying the base (nominal) increment value by the scaled_ppm and then dividing by the scaled one million value. For very large adjustments, this might overflow. To avoid this, both the scaled_ppm and divisor values are downshifted. We can avoid that on X86 architectures by using mul_u64_u64_div_u64. This helper function will perform the multiplication and division with 128bit intermediate values. We know that scaled_ppm is never larger than the divisor so this operation will never result in an overflow. This improves the accuracy of the calculations for large adjustment values on X86. It is likely an improvement on other architectures as well because the default implementation of mul_u64_u64_div_u64 is smarter than the original approach taken in the ice code. Additionally, this implementation is easier to read, using fewer local variables and lines of code to implement. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/e1000e')
0 files changed, 0 insertions, 0 deletions