diff options
Diffstat (limited to 'net/mac80211/mesh_sync.c')
-rw-r--r-- | net/mac80211/mesh_sync.c | 44 |
1 files changed, 7 insertions, 37 deletions
diff --git a/net/mac80211/mesh_sync.c b/net/mac80211/mesh_sync.c index 407c8705e10d..9c6ea9cfe1b3 100644 --- a/net/mac80211/mesh_sync.c +++ b/net/mac80211/mesh_sync.c | |||
@@ -116,43 +116,13 @@ static void mesh_sync_offset_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, | |||
116 | goto no_sync; | 116 | goto no_sync; |
117 | } | 117 | } |
118 | 118 | ||
119 | if (rx_status->flag & RX_FLAG_MACTIME_MPDU && rx_status->mactime) { | 119 | if (ieee80211_have_rx_timestamp(rx_status)) |
120 | /* | 120 | /* time when timestamp field was received */ |
121 | * The mactime is defined as the time the first data symbol | 121 | t_r = ieee80211_calculate_rx_timestamp(local, rx_status, |
122 | * of the frame hits the PHY, and the timestamp of the beacon | 122 | 24 + 12 + |
123 | * is defined as "the time that the data symbol containing the | 123 | elems->total_len + |
124 | * first bit of the timestamp is transmitted to the PHY plus | 124 | FCS_LEN, |
125 | * the transmitting STA's delays through its local PHY from the | 125 | 24); |
126 | * MAC-PHY interface to its interface with the WM" (802.11 | ||
127 | * 11.1.2) | ||
128 | * | ||
129 | * T_r, in 13.13.2.2.2, is just defined as "the frame reception | ||
130 | * time" but we unless we interpret that time to be the same | ||
131 | * time of the beacon timestamp, the offset calculation will be | ||
132 | * off. Below we adjust t_r to be "the time at which the first | ||
133 | * symbol of the timestamp element in the beacon is received". | ||
134 | * This correction depends on the rate. | ||
135 | * | ||
136 | * Based on similar code in ibss.c | ||
137 | */ | ||
138 | int rate; | ||
139 | |||
140 | if (rx_status->flag & RX_FLAG_HT) { | ||
141 | /* TODO: | ||
142 | * In principle there could be HT-beacons (Dual Beacon | ||
143 | * HT Operation options), but for now ignore them and | ||
144 | * just use the primary (i.e. non-HT) beacons for | ||
145 | * synchronization. | ||
146 | * */ | ||
147 | goto no_sync; | ||
148 | } else | ||
149 | rate = local->hw.wiphy->bands[rx_status->band]-> | ||
150 | bitrates[rx_status->rate_idx].bitrate; | ||
151 | |||
152 | /* 24 bytes of header * 8 bits/byte * | ||
153 | * 10*(100 Kbps)/Mbps / rate (100 Kbps)*/ | ||
154 | t_r = rx_status->mactime + (24 * 8 * 10 / rate); | ||
155 | } | ||
156 | 126 | ||
157 | /* Timing offset calculation (see 13.13.2.2.2) */ | 127 | /* Timing offset calculation (see 13.13.2.2.2) */ |
158 | t_t = le64_to_cpu(mgmt->u.beacon.timestamp); | 128 | t_t = le64_to_cpu(mgmt->u.beacon.timestamp); |