Commit f1699ad5 authored by Avraham Stern's avatar Avraham Stern Committed by Miri Korenblit
Browse files

wifi: iwlwifi: mld: add debugfs for using ptp clock time for monitor interface



Add a debugfs option to use the ptp clock time for Rx device
timestamps on a monitor interface. This can be useful for e.g.
synchronizing multiple NICs or reporting the timestamp in the
system clock instead of the GP2.

Signed-off-by: default avatarAvraham Stern <avraham.stern@intel.com>
Link: https://patch.msgid.link/20250505215513.fffe6718fbca.I75f034005851a2d0c8ba5b015b9fdcad8a7c550d@changeid


Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
parent c9d81578
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -546,6 +546,9 @@ iwl_mld_add_debugfs_files(struct iwl_mld *mld, struct dentry *debugfs_dir)
#endif
	MLD_DEBUGFS_ADD_FILE(inject_packet, debugfs_dir, 0200);

	debugfs_create_bool("rx_ts_ptp", 0600, debugfs_dir,
			    &mld->monitor.ptp_time);

	/* Create a symlink with mac80211. It will be removed when mac80211
	 * exits (before the opmode exits which removes the target.)
	 */
+2 −0
Original line number Diff line number Diff line
@@ -116,6 +116,7 @@
 * @monitor.ampdu_toggle: the state of the previous packet to track A-MPDU
 * @monitor.cur_aid: current association id tracked by the sniffer
 * @monitor.cur_bssid: current bssid tracked by the sniffer
 * @monitor.ptp_time: set the Rx mactime using the device's PTP clock time
 * @monitor.p80: primary channel position relative to he whole bandwidth, in
 * steps of 80 MHz
 * @fw_id_to_link_sta: maps a fw id of a sta to the corresponding
@@ -201,6 +202,7 @@ struct iwl_mld {
#ifdef CONFIG_IWLWIFI_DEBUGFS
			__le16 cur_aid;
			u8 cur_bssid[ETH_ALEN];
			bool ptp_time;
#endif
		} monitor;
#ifdef CONFIG_PM_SLEEP
+13 −1
Original line number Diff line number Diff line
@@ -1213,8 +1213,20 @@ static void iwl_mld_rx_fill_status(struct iwl_mld *mld, struct sk_buff *skb,
		iwl_mld_rx_eht(mld, skb, phy_data, queue);

#ifdef CONFIG_IWLWIFI_DEBUGFS
	if (unlikely(mld->monitor.on))
	if (unlikely(mld->monitor.on)) {
		iwl_mld_add_rtap_sniffer_config(mld, skb);

		if (mld->monitor.ptp_time) {
			u64 adj_time =
			    iwl_mld_ptp_get_adj_time(mld,
						     phy_data->gp2_on_air_rise *
						     NSEC_PER_USEC);

			rx_status->mactime = div64_u64(adj_time, NSEC_PER_USEC);
			rx_status->flag |= RX_FLAG_MACTIME_IS_RTAP_TS64;
			rx_status->flag &= ~RX_FLAG_MACTIME;
		}
	}
#endif

	if (format != RATE_MCS_MOD_TYPE_CCK && is_sgi)