1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /*
3 * Copyright (C) 2022 Intel Corporation
4 * Copyright (C) 2026 Intel Corporation
5 */
6 #ifndef __TIME_SYNC_H__
7 #define __TIME_SYNC_H__
8
9 #include "mvm.h"
10 #include <linux/ieee80211.h>
11
12 void iwl_mvm_init_time_sync(struct iwl_time_sync_data *data);
13 void iwl_mvm_time_sync_msmt_event(struct iwl_mvm *mvm,
14 struct iwl_rx_cmd_buffer *rxb);
15 void iwl_mvm_time_sync_msmt_confirm_event(struct iwl_mvm *mvm,
16 struct iwl_rx_cmd_buffer *rxb);
17 int iwl_mvm_time_sync_config(struct iwl_mvm *mvm, const u8 *addr,
18 u32 protocols);
19
20 static inline
iwl_mvm_time_sync_frame(struct iwl_mvm * mvm,struct sk_buff * skb,u8 * addr)21 bool iwl_mvm_time_sync_frame(struct iwl_mvm *mvm, struct sk_buff *skb, u8 *addr)
22 {
23 if (!mvm->time_sync.active)
24 return false;
25
26 if (ether_addr_equal(mvm->time_sync.peer_addr, addr) &&
27 (ieee80211_is_timing_measurement(skb) || ieee80211_is_ftm(skb))) {
28 skb_queue_tail(&mvm->time_sync.frame_list, skb);
29 return true;
30 }
31
32 return false;
33 }
34 #endif
35