diff options
-rw-r--r-- | net/mac80211/mesh_sync.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/net/mac80211/mesh_sync.c b/net/mac80211/mesh_sync.c index 05a256b38e24..d1cf2d553499 100644 --- a/net/mac80211/mesh_sync.c +++ b/net/mac80211/mesh_sync.c | |||
@@ -92,12 +92,20 @@ static void mesh_sync_offset_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, | |||
92 | if (stype != IEEE80211_STYPE_BEACON) | 92 | if (stype != IEEE80211_STYPE_BEACON) |
93 | return; | 93 | return; |
94 | 94 | ||
95 | /* The current tsf is a first approximation for the timestamp | 95 | /* |
96 | * for the received beacon. Further down we try to get a | 96 | * Get time when timestamp field was received. If we don't |
97 | * better value from the rx_status->mactime field if | 97 | * have rx timestamps, then use current tsf as an approximation. |
98 | * available. Also we have to call drv_get_tsf() before | 98 | * drv_get_tsf() must be called before entering the rcu-read |
99 | * entering the rcu-read section.*/ | 99 | * section. |
100 | t_r = drv_get_tsf(local, sdata); | 100 | */ |
101 | if (ieee80211_have_rx_timestamp(rx_status)) | ||
102 | t_r = ieee80211_calculate_rx_timestamp(local, rx_status, | ||
103 | 24 + 12 + | ||
104 | elems->total_len + | ||
105 | FCS_LEN, | ||
106 | 24); | ||
107 | else | ||
108 | t_r = drv_get_tsf(local, sdata); | ||
101 | 109 | ||
102 | rcu_read_lock(); | 110 | rcu_read_lock(); |
103 | sta = sta_info_get(sdata, mgmt->sa); | 111 | sta = sta_info_get(sdata, mgmt->sa); |
@@ -117,14 +125,6 @@ static void mesh_sync_offset_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, | |||
117 | goto no_sync; | 125 | goto no_sync; |
118 | } | 126 | } |
119 | 127 | ||
120 | if (ieee80211_have_rx_timestamp(rx_status)) | ||
121 | /* time when timestamp field was received */ | ||
122 | t_r = ieee80211_calculate_rx_timestamp(local, rx_status, | ||
123 | 24 + 12 + | ||
124 | elems->total_len + | ||
125 | FCS_LEN, | ||
126 | 24); | ||
127 | |||
128 | /* Timing offset calculation (see 13.13.2.2.2) */ | 128 | /* Timing offset calculation (see 13.13.2.2.2) */ |
129 | t_t = le64_to_cpu(mgmt->u.beacon.timestamp); | 129 | t_t = le64_to_cpu(mgmt->u.beacon.timestamp); |
130 | sta->t_offset = t_t - t_r; | 130 | sta->t_offset = t_t - t_r; |