Lines Matching +full:non +full:- +full:standard
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright 2011-2012, Pavel Zubarev <[email protected]>
4 * Copyright 2011-2012, Marco Porsch <[email protected]-chemnitz.de>
5 * Copyright 2011-2012, cozybit Inc.
11 #include "driver-ops.h"
13 /* This is not in the standard. It represents a tolerable tsf drift below
18 /* This is not in the standard. It is a margin added to the
24 /* This is not in the standard. It represents the maximum Toffset jump above
37 * mesh_peer_tbtt_adjusting - check if an mp is currently adjusting its TBTT
46 (cfg->meshconf_cap & IEEE80211_MESHCONF_CAPAB_TBTT_ADJUSTING); in mesh_peer_tbtt_adjusting()
51 struct ieee80211_local *local = sdata->local; in mesh_sync_adjust_tsf()
52 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; in mesh_sync_adjust_tsf()
53 /* sdata->vif.bss_conf.beacon_int in 1024us units, 0.04% */ in mesh_sync_adjust_tsf()
54 u64 beacon_int_fraction = sdata->vif.bss_conf.beacon_int * 1024 / 2500; in mesh_sync_adjust_tsf()
58 spin_lock_bh(&ifmsh->sync_offset_lock); in mesh_sync_adjust_tsf()
59 if (ifmsh->sync_offset_clockdrift_max < beacon_int_fraction) { in mesh_sync_adjust_tsf()
61 (long long) ifmsh->sync_offset_clockdrift_max); in mesh_sync_adjust_tsf()
62 tsfdelta = -ifmsh->sync_offset_clockdrift_max; in mesh_sync_adjust_tsf()
63 ifmsh->sync_offset_clockdrift_max = 0; in mesh_sync_adjust_tsf()
66 (long long) ifmsh->sync_offset_clockdrift_max, in mesh_sync_adjust_tsf()
68 tsfdelta = -beacon_int_fraction; in mesh_sync_adjust_tsf()
69 ifmsh->sync_offset_clockdrift_max -= beacon_int_fraction; in mesh_sync_adjust_tsf()
71 spin_unlock_bh(&ifmsh->sync_offset_lock); in mesh_sync_adjust_tsf()
73 if (local->ops->offset_tsf) { in mesh_sync_adjust_tsf()
77 if (tsf != -1ULL) in mesh_sync_adjust_tsf()
88 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; in mesh_sync_offset_rx_bcn_presp()
89 struct ieee80211_local *local = sdata->local; in mesh_sync_offset_rx_bcn_presp()
93 WARN_ON(ifmsh->mesh_sp_id != IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET); in mesh_sync_offset_rx_bcn_presp()
95 /* standard mentions only beacons */ in mesh_sync_offset_rx_bcn_presp()
102 * drv_get_tsf() must be called before entering the rcu-read in mesh_sync_offset_rx_bcn_presp()
112 sta = sta_info_get(sdata, mgmt->sa); in mesh_sync_offset_rx_bcn_presp()
119 * dot11MeshNbrOffsetMaxNeighbor non-peer non-MBSS neighbors in mesh_sync_offset_rx_bcn_presp()
124 sta->sta.addr); in mesh_sync_offset_rx_bcn_presp()
129 t_t = le64_to_cpu(mgmt->u.beacon.timestamp); in mesh_sync_offset_rx_bcn_presp()
130 sta->mesh->t_offset = t_t - t_r; in mesh_sync_offset_rx_bcn_presp()
133 s64 t_clockdrift = sta->mesh->t_offset_setpoint - sta->mesh->t_offset; in mesh_sync_offset_rx_bcn_presp()
136 sta->sta.addr, (long long) sta->mesh->t_offset, in mesh_sync_offset_rx_bcn_presp()
137 (long long) sta->mesh->t_offset_setpoint, in mesh_sync_offset_rx_bcn_presp()
141 t_clockdrift < -TOFFSET_MAXIMUM_ADJUSTMENT) { in mesh_sync_offset_rx_bcn_presp()
144 sta->sta.addr, in mesh_sync_offset_rx_bcn_presp()
150 spin_lock_bh(&ifmsh->sync_offset_lock); in mesh_sync_offset_rx_bcn_presp()
151 if (t_clockdrift > ifmsh->sync_offset_clockdrift_max) in mesh_sync_offset_rx_bcn_presp()
152 ifmsh->sync_offset_clockdrift_max = t_clockdrift; in mesh_sync_offset_rx_bcn_presp()
153 spin_unlock_bh(&ifmsh->sync_offset_lock); in mesh_sync_offset_rx_bcn_presp()
155 sta->mesh->t_offset_setpoint = sta->mesh->t_offset - TOFFSET_SET_MARGIN; in mesh_sync_offset_rx_bcn_presp()
159 sta->sta.addr, in mesh_sync_offset_rx_bcn_presp()
160 (long long) sta->mesh->t_offset); in mesh_sync_offset_rx_bcn_presp()
170 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; in mesh_sync_offset_adjust_tsf()
172 WARN_ON(ifmsh->mesh_sp_id != IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET); in mesh_sync_offset_adjust_tsf()
175 spin_lock_bh(&ifmsh->sync_offset_lock); in mesh_sync_offset_adjust_tsf()
177 if (ifmsh->sync_offset_clockdrift_max > TOFFSET_MINIMUM_ADJUSTMENT) { in mesh_sync_offset_adjust_tsf()
185 ifmsh->sync_offset_clockdrift_max); in mesh_sync_offset_adjust_tsf()
186 set_bit(MESH_WORK_DRIFT_ADJUST, &ifmsh->wrkq_flags); in mesh_sync_offset_adjust_tsf()
190 (long long)ifmsh->sync_offset_clockdrift_max); in mesh_sync_offset_adjust_tsf()
191 ifmsh->sync_offset_clockdrift_max = 0; in mesh_sync_offset_adjust_tsf()
193 spin_unlock_bh(&ifmsh->sync_offset_lock); in mesh_sync_offset_adjust_tsf()