ice: track and warn when PHC update is late
authorJacob Keller <jacob.e.keller@intel.com>
Wed, 27 Jul 2022 23:16:00 +0000 (16:16 -0700)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Tue, 16 Aug 2022 16:04:38 +0000 (09:04 -0700)
commitcd25507a31e18321644833eab0e739cc74eba3b5
treeb91d8706d99d83270b1857fdccda67b6ec80d4f5
parentf020481be540cfed4747b966e5c603299856f291
ice: track and warn when PHC update is late

The ice driver requires a cached copy of the PHC time in order to perform
timestamp extension on Tx and Rx hardware timestamp values. This cached PHC
time must always be updated at least once every 2 seconds. Otherwise, the
math used to perform the extension would produce invalid results.

The updates are supposed to occur periodically in the PTP kthread work
item, which is scheduled to run every half second. Thus, we do not expect
an update to be delayed for so long. However, there are error conditions
which can cause the update to be delayed.

Track this situation by using jiffies to determine approximately how long
ago the last update occurred. Add a new statistic and a dev_warn when we
have failed to update the cached PHC time. This makes the error case more
obvious.

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>
drivers/net/ethernet/intel/ice/ice_ethtool.c
drivers/net/ethernet/intel/ice/ice_ptp.c
drivers/net/ethernet/intel/ice/ice_ptp.h