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