Lines Matching +full:sync +full:- +full:active
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
7 #include "time-sync.h"
12 skb_queue_head_init(&data->frame_list); in iwl_mvm_init_time_sync()
17 struct ieee80211_mgmt *mgmt = (void *)skb->data; in iwl_mvm_is_skb_match()
21 skb_dialog_token = mgmt->u.action.u.wnm_timing_msr.dialog_token; in iwl_mvm_is_skb_match()
23 skb_dialog_token = mgmt->u.action.u.ftm.dialog_token; in iwl_mvm_is_skb_match()
25 if ((ether_addr_equal(mgmt->sa, addr) || in iwl_mvm_is_skb_match()
26 ether_addr_equal(mgmt->da, addr)) && in iwl_mvm_is_skb_match()
39 * in the queue, they did not get a time sync notification and are in iwl_mvm_time_sync_find_skb()
42 while ((skb = skb_dequeue(&mvm->time_sync.frame_list))) { in iwl_mvm_time_sync_find_skb()
62 struct iwl_time_msmt_notify *notif = (void *)pkt->data; in iwl_mvm_time_sync_msmt_event()
67 iwl_mvm_time_sync_find_skb(mvm, notif->peer_addr, in iwl_mvm_time_sync_msmt_event()
68 le32_to_cpu(notif->dialog_token)); in iwl_mvm_time_sync_msmt_event()
72 IWL_DEBUG_INFO(mvm, "Time sync event but no pending skb\n"); in iwl_mvm_time_sync_msmt_event()
76 ts_10ns = iwl_mvm_get_64_bit(notif->t2_hi, notif->t2_lo); in iwl_mvm_time_sync_msmt_event()
79 shwt->hwtstamp = ktime_set(0, adj_time); in iwl_mvm_time_sync_msmt_event()
81 ts_10ns = iwl_mvm_get_64_bit(notif->t3_hi, notif->t3_lo); in iwl_mvm_time_sync_msmt_event()
84 rx_status->ack_tx_hwtstamp = ktime_set(0, adj_time); in iwl_mvm_time_sync_msmt_event()
87 "Time sync: RX event - report frame t2=%llu t3=%llu\n", in iwl_mvm_time_sync_msmt_event()
88 ktime_to_ns(shwt->hwtstamp), in iwl_mvm_time_sync_msmt_event()
89 ktime_to_ns(rx_status->ack_tx_hwtstamp)); in iwl_mvm_time_sync_msmt_event()
90 ieee80211_rx_napi(mvm->hw, NULL, skb, NULL); in iwl_mvm_time_sync_msmt_event()
97 struct iwl_time_msmt_cfm_notify *notif = (void *)pkt->data; in iwl_mvm_time_sync_msmt_confirm_event()
103 iwl_mvm_time_sync_find_skb(mvm, notif->peer_addr, in iwl_mvm_time_sync_msmt_confirm_event()
104 le32_to_cpu(notif->dialog_token)); in iwl_mvm_time_sync_msmt_confirm_event()
107 IWL_DEBUG_INFO(mvm, "Time sync confirm but no pending skb\n"); in iwl_mvm_time_sync_msmt_confirm_event()
111 ts_10ns = iwl_mvm_get_64_bit(notif->t1_hi, notif->t1_lo); in iwl_mvm_time_sync_msmt_confirm_event()
114 shwt->hwtstamp = ktime_set(0, adj_time); in iwl_mvm_time_sync_msmt_confirm_event()
116 ts_10ns = iwl_mvm_get_64_bit(notif->t4_hi, notif->t4_lo); in iwl_mvm_time_sync_msmt_confirm_event()
122 "Time sync: TX event - report frame t1=%llu t4=%llu\n", in iwl_mvm_time_sync_msmt_confirm_event()
123 ktime_to_ns(shwt->hwtstamp), in iwl_mvm_time_sync_msmt_confirm_event()
125 ieee80211_tx_status_ext(mvm->hw, &status); in iwl_mvm_time_sync_msmt_confirm_event()
133 lockdep_assert_held(&mvm->mutex); in iwl_mvm_time_sync_config()
135 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_time_sync_config()
137 return -EINVAL; in iwl_mvm_time_sync_config()
142 if (mvm->time_sync.active && in iwl_mvm_time_sync_config()
143 !ether_addr_equal(addr, mvm->time_sync.peer_addr)) { in iwl_mvm_time_sync_config()
144 IWL_DEBUG_INFO(mvm, "Time sync: reject config for peer: %pM\n", in iwl_mvm_time_sync_config()
146 return -ENOBUFS; in iwl_mvm_time_sync_config()
151 return -EINVAL; in iwl_mvm_time_sync_config()
162 IWL_ERR(mvm, "Failed to send time sync cfg cmd: %d\n", err); in iwl_mvm_time_sync_config()
164 mvm->time_sync.active = protocols != 0; in iwl_mvm_time_sync_config()
165 ether_addr_copy(mvm->time_sync.peer_addr, addr); in iwl_mvm_time_sync_config()
166 IWL_DEBUG_INFO(mvm, "Time sync: set peer addr=%pM\n", addr); in iwl_mvm_time_sync_config()
169 if (!mvm->time_sync.active) in iwl_mvm_time_sync_config()
170 skb_queue_purge(&mvm->time_sync.frame_list); in iwl_mvm_time_sync_config()