^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright 2011-2012, Pavel Zubarev <pavel.zubarev@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright 2011-2012, Marco Porsch <marco.porsch@s2005.tu-chemnitz.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright 2011-2012, cozybit Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include "ieee80211_i.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include "mesh.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include "driver-ops.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) /* This is not in the standard. It represents a tolerable tsf drift below
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * which we do no TSF adjustment.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define TOFFSET_MINIMUM_ADJUSTMENT 10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) /* This is not in the standard. It is a margin added to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * Toffset setpoint to mitigate TSF overcorrection
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * introduced by TSF adjustment latency.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define TOFFSET_SET_MARGIN 20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) /* This is not in the standard. It represents the maximum Toffset jump above
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * which we'll invalidate the Toffset setpoint and choose a new setpoint. This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * could be, for instance, in case a neighbor is restarted and its TSF counter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * reset.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define TOFFSET_MAXIMUM_ADJUSTMENT 800 /* 0.8 ms */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct sync_method {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) u8 method;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct ieee80211_mesh_sync_ops ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * mesh_peer_tbtt_adjusting - check if an mp is currently adjusting its TBTT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * @ie: information elements of a management frame from the mesh peer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) static bool mesh_peer_tbtt_adjusting(struct ieee802_11_elems *ie)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) return (ie->mesh_config->meshconf_cap &
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) IEEE80211_MESHCONF_CAPAB_TBTT_ADJUSTING) != 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) void mesh_sync_adjust_tsf(struct ieee80211_sub_if_data *sdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) struct ieee80211_local *local = sdata->local;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) /* sdata->vif.bss_conf.beacon_int in 1024us units, 0.04% */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) u64 beacon_int_fraction = sdata->vif.bss_conf.beacon_int * 1024 / 2500;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) u64 tsf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) u64 tsfdelta;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) spin_lock_bh(&ifmsh->sync_offset_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) if (ifmsh->sync_offset_clockdrift_max < beacon_int_fraction) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) msync_dbg(sdata, "TSF : max clockdrift=%lld; adjusting\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) (long long) ifmsh->sync_offset_clockdrift_max);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) tsfdelta = -ifmsh->sync_offset_clockdrift_max;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) ifmsh->sync_offset_clockdrift_max = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) msync_dbg(sdata, "TSF : max clockdrift=%lld; adjusting by %llu\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) (long long) ifmsh->sync_offset_clockdrift_max,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) (unsigned long long) beacon_int_fraction);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) tsfdelta = -beacon_int_fraction;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) ifmsh->sync_offset_clockdrift_max -= beacon_int_fraction;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) spin_unlock_bh(&ifmsh->sync_offset_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) if (local->ops->offset_tsf) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) drv_offset_tsf(local, sdata, tsfdelta);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) tsf = drv_get_tsf(local, sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) if (tsf != -1ULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) drv_set_tsf(local, sdata, tsf + tsfdelta);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) static void mesh_sync_offset_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) u16 stype,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) struct ieee80211_mgmt *mgmt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) struct ieee802_11_elems *elems,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) struct ieee80211_rx_status *rx_status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) struct ieee80211_local *local = sdata->local;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) struct sta_info *sta;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) u64 t_t, t_r;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) WARN_ON(ifmsh->mesh_sp_id != IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) /* standard mentions only beacons */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) if (stype != IEEE80211_STYPE_BEACON)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) * Get time when timestamp field was received. If we don't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) * have rx timestamps, then use current tsf as an approximation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) * drv_get_tsf() must be called before entering the rcu-read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) * section.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) if (ieee80211_have_rx_timestamp(rx_status))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) t_r = ieee80211_calculate_rx_timestamp(local, rx_status,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 24 + 12 +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) elems->total_len +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) FCS_LEN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 24);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) t_r = drv_get_tsf(local, sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) rcu_read_lock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) sta = sta_info_get(sdata, mgmt->sa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) if (!sta)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) goto no_sync;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) /* check offset sync conditions (13.13.2.2.1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) * TODO also sync to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) * dot11MeshNbrOffsetMaxNeighbor non-peer non-MBSS neighbors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) if (elems->mesh_config && mesh_peer_tbtt_adjusting(elems)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) msync_dbg(sdata, "STA %pM : is adjusting TBTT\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) sta->sta.addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) goto no_sync;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) /* Timing offset calculation (see 13.13.2.2.2) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) t_t = le64_to_cpu(mgmt->u.beacon.timestamp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) sta->mesh->t_offset = t_t - t_r;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) s64 t_clockdrift = sta->mesh->t_offset_setpoint - sta->mesh->t_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) msync_dbg(sdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) "STA %pM : t_offset=%lld, t_offset_setpoint=%lld, t_clockdrift=%lld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) sta->sta.addr, (long long) sta->mesh->t_offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) (long long) sta->mesh->t_offset_setpoint,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) (long long) t_clockdrift);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) if (t_clockdrift > TOFFSET_MAXIMUM_ADJUSTMENT ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) t_clockdrift < -TOFFSET_MAXIMUM_ADJUSTMENT) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) msync_dbg(sdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) "STA %pM : t_clockdrift=%lld too large, setpoint reset\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) sta->sta.addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) (long long) t_clockdrift);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) clear_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) goto no_sync;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) spin_lock_bh(&ifmsh->sync_offset_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) if (t_clockdrift > ifmsh->sync_offset_clockdrift_max)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) ifmsh->sync_offset_clockdrift_max = t_clockdrift;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) spin_unlock_bh(&ifmsh->sync_offset_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) sta->mesh->t_offset_setpoint = sta->mesh->t_offset - TOFFSET_SET_MARGIN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) set_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) msync_dbg(sdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) "STA %pM : offset was invalid, t_offset=%lld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) sta->sta.addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) (long long) sta->mesh->t_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) no_sync:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) rcu_read_unlock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) static void mesh_sync_offset_adjust_tsf(struct ieee80211_sub_if_data *sdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) struct beacon_data *beacon)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) WARN_ON(ifmsh->mesh_sp_id != IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) WARN_ON(!rcu_read_lock_held());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) spin_lock_bh(&ifmsh->sync_offset_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) if (ifmsh->sync_offset_clockdrift_max > TOFFSET_MINIMUM_ADJUSTMENT) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) /* Since ajusting the tsf here would
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) * require a possibly blocking call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) * to the driver tsf setter, we punt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) * the tsf adjustment to the mesh tasklet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) msync_dbg(sdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) "TSF : kicking off TSF adjustment with clockdrift_max=%lld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) ifmsh->sync_offset_clockdrift_max);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) set_bit(MESH_WORK_DRIFT_ADJUST, &ifmsh->wrkq_flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) msync_dbg(sdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) "TSF : max clockdrift=%lld; too small to adjust\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) (long long)ifmsh->sync_offset_clockdrift_max);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) ifmsh->sync_offset_clockdrift_max = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) spin_unlock_bh(&ifmsh->sync_offset_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) static const struct sync_method sync_methods[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) .method = IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) .ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) .rx_bcn_presp = &mesh_sync_offset_rx_bcn_presp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) .adjust_tsf = &mesh_sync_offset_adjust_tsf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) const struct ieee80211_mesh_sync_ops *ieee80211_mesh_sync_ops_get(u8 method)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) for (i = 0 ; i < ARRAY_SIZE(sync_methods); ++i) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) if (sync_methods[i].method == method)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) return &sync_methods[i].ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) }