diff options
author | Thomas Pedersen <thomas@adapt-ip.com> | 2020-09-21 19:28:17 -0700 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2020-09-28 14:10:13 +0200 |
commit | a3ffee47354fca71c24223af2b20ef69a1b0ff5b (patch) | |
tree | a827ac501a63dc4e7a24b9181d7c9d9b7070d423 | |
parent | 58ef7c1b555e0e605da24b76cb2821dd3fcd6bc6 (diff) | |
download | linux-a3ffee47354fca71c24223af2b20ef69a1b0ff5b.tar.bz2 |
mac80211_hwsim: write TSF timestamp correctly to S1G beacon
S1G beacons are different from normal management beacons, so write
the timestamp to the correct location there.
Signed-off-by: Thomas Pedersen <thomas@adapt-ip.com>
Link: https://lore.kernel.org/r/20200922022818.15855-17-thomas@adapt-ip.com
[rewrite commit message that was not useful after patch reordering]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | drivers/net/wireless/mac80211_hwsim.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index d3d0fb85d667..cb624b2bebf1 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -1687,9 +1687,19 @@ static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac, mgmt = (struct ieee80211_mgmt *) skb->data; /* fake header transmission time */ data->abs_bcn_ts = mac80211_hwsim_get_tsf_raw(); - mgmt->u.beacon.timestamp = cpu_to_le64(data->abs_bcn_ts + - data->tsf_offset + - 24 * 8 * 10 / txrate->bitrate); + if (ieee80211_is_s1g_beacon(mgmt->frame_control)) { + struct ieee80211_ext *ext = (void *) mgmt; + + ext->u.s1g_beacon.timestamp = cpu_to_le32(data->abs_bcn_ts + + data->tsf_offset + + 10 * 8 * 10 / + txrate->bitrate); + } else { + mgmt->u.beacon.timestamp = cpu_to_le64(data->abs_bcn_ts + + data->tsf_offset + + 24 * 8 * 10 / + txrate->bitrate); + } mac80211_hwsim_tx_frame(hw, skb, rcu_dereference(vif->chanctx_conf)->def.chan); |