mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/2] wifi: iwlwifi: Fix GP2 to nanoseconds overflow on 32-bit
@ 2026-10-12  5:05 Zhan Xusheng
  2026-10-12  5:05 ` [PATCH v3 1/2] wifi: iwlwifi: mvm: " Zhan Xusheng
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Zhan Xusheng @ 2026-10-12  5:05 UTC (permalink / raw)
  To: Miri Korenblit
  Cc: Johannes Berg, Benjamin Berg, Emmanuel Grumbach, Avraham Stern,
	linux-wireless, linux-kernel, Zhan Xusheng

From: Zhan Xusheng <zhanxusheng@xiaomi.com>

Both drivers multiply a u32 GP2 microsecond timestamp by NSEC_PER_USEC
without widening first.  On 32-bit the product truncates for any GP2
value above 4.295 s, and the truncated value is fed back into the
wraparound detector, which records a false GP2 wraparound and adds
about 71.6 minutes to every later PHC timestamp, cumulatively.

Six sites, three per driver:

  mvm/ptp.c   scale_update_gp2 in iwl_mvm_ptp_get_adj_time()
  mvm/ptp.c   gp2 in iwl_mvm_ptp_adjfine()
  mvm/rxmq.c  gp2_on_air_rise in iwl_mvm_rx_he()
  mld/ptp.c   scale_update_gp2 in iwl_mld_ptp_get_adj_time()
  mld/ptp.c   gp2 in iwl_mld_ptp_adjfine()
  mld/rx.c    gp2_on_air_rise in iwl_mld_rx_fill_status()

iwl_mvm_ptp_gettime() holds its GP2 read in a u64 and
iwl_mld_phc_get_crosstimestamp() casts, so those two are already right.

Changes since v2:

 - mvm: added scale_update_gp2 and the adjfine() site.  v2 only
   covered mvm/rxmq.c.
 - mld: added the iwl_mld_rx_fill_status() site.  v2 only covered
   mld/ptp.c while claiming parity with the mvm fix.  Reported by the
   netdev Sashiko review bot.
 - mld: iwl_mld_ptp_get_crosstimestamp() in the v2 changelog does not
   exist; the function is iwl_mld_phc_get_crosstimestamp().
 - both: state the wraparound consequence with the numbers.

No Cc: stable.  The affected intersection is 32-bit plus iwlwifi plus
PTP, so that call belongs to the maintainers.

v2: https://patch.msgid.link/20261001050103.860584-1-zhanxusheng@xiaomi.com

Zhan Xusheng (2):
  wifi: iwlwifi: mvm: Fix GP2 to nanoseconds overflow on 32-bit
  wifi: iwlwifi: mld: Fix GP2 to nanoseconds overflow on 32-bit

 drivers/net/wireless/intel/iwlwifi/mld/ptp.c  | 5 +++--
 drivers/net/wireless/intel/iwlwifi/mld/rx.c   | 2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/ptp.c  | 5 +++--
 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 4 +++-
 4 files changed, 10 insertions(+), 6 deletions(-)


base-commit: d6d3455d8751854e0d1820f14184682e23ac4475
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-05  2:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-12  5:05 [PATCH v3 0/2] wifi: iwlwifi: Fix GP2 to nanoseconds overflow on 32-bit Zhan Xusheng
2026-10-12  5:05 ` [PATCH v3 1/2] wifi: iwlwifi: mvm: " Zhan Xusheng
2026-10-12  5:05 ` [PATCH v3 2/2] wifi: iwlwifi: mld: " Zhan Xusheng
2026-11-05  2:09 ` [PATCH v3 0/2] wifi: iwlwifi: " Zhan Xusheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®