]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
wifi: iwlwifi: mvm: select ptp cross timestamp from multiple reads
authorAvraham Stern <avraham.stern@intel.com>
Mon, 20 Mar 2023 10:33:08 +0000 (12:33 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 22 Mar 2023 12:16:35 +0000 (13:16 +0100)
commite86103394474b0c15eca4bb9ed678f6e9ab5d004
tree44b6a24281726ba6a802e7e126a2cd82c07a693a
parenta2f49f7d52a9e7d0dce8f090541a28192b7abd59
wifi: iwlwifi: mvm: select ptp cross timestamp from multiple reads

iwl_mvm_get_sync_time() reads the gp2 from the device and then
reads the system clock. Since the two reads are not done atomically,
unexpected delays may happen between the two reads (e.g. context
switch) which make it inaccurate.
In order to improve the accuracy of the cross timestamp, call
iwl_mvm_get_sync_time() multiple times in a loop and take the
result in which the difference between the two clock is the smallest.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230320122330.d9e6f8f8998a.I569939ec4ddf0c6c64c112e7d0c30583f5509d9a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/ptp.c