Skip to content

Commit

Permalink
mac80211_hwsim: write TSF timestamp correctly to S1G beacon
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Pedersen authored and Johannes Berg committed Sep 28, 2020
1 parent 58ef7c1 commit a3ffee4
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions drivers/net/wireless/mac80211_hwsim.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a3ffee4

Please sign in to comment.