[Intel-wired-lan] [next PATCH S90 6/8] i40e: avoid overflow in i40e_ptp_adjfreq()

Bowers, AndrewX andrewx.bowers at intel.com
Mon Apr 23 20:58:05 UTC 2018


> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Alice Michael
> Sent: Friday, April 20, 2018 1:42 AM
> To: Michael, Alice <alice.michael at intel.com>; intel-wired-
> lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [next PATCH S90 6/8] i40e: avoid overflow in
> i40e_ptp_adjfreq()
> 
> From: Jacob Keller <jacob.e.keller at intel.com>
> 
> When operating at 1GbE, the base incval for the PTP clock is so large that
> multiplying it by numbers close to the max_adj can overflow the u64.
> 
> Rather than attempting to limit the max_adj to a value small enough to avoid
> overflow, instead calculate the incvalue adjustment based on the 40GbE
> incvalue, and then multiply that by the scaling factor for the link speed.
> 
> This sacrifices a small amount of precision in the adjustment but we avoid
> erratic behavior of the clock due to the overflow caused if ppb is very near
> the maximum adjustment.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e.h     |  2 +-
>  drivers/net/ethernet/intel/i40e/i40e_ptp.c | 41 ++++++++++++++++++++--
> --------
>  2 files changed, 28 insertions(+), 15 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers at intel.com>




More information about the Intel-wired-lan mailing list