mac80211: support RX_FLAG_MACTIME_END
Allow drivers to indicate their mactime is at RX completion and adjust for this in mac80211. Also rename the existing RX_FLAG_MACTIME_MPDU to RX_FLAG_MACTIME_START to clarify its intent. Based on similar code by Johannes Berg. Signed-off-by: Thomas Pedersen <thomas@cozybit.com> [fix docs, atheros drivers] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:

committed by
Johannes Berg

parent
2a91c9f781
commit
f4bda337bb
@@ -543,30 +543,11 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
|
||||
if (ether_addr_equal(cbss->bssid, sdata->u.ibss.bssid))
|
||||
goto put_bss;
|
||||
|
||||
if (rx_status->flag & RX_FLAG_MACTIME_MPDU) {
|
||||
/*
|
||||
* For correct IBSS merging we need mactime; since mactime is
|
||||
* defined as the time the first data symbol of the frame hits
|
||||
* the PHY, and the timestamp of the beacon is defined as "the
|
||||
* time that the data symbol containing the first bit of the
|
||||
* timestamp is transmitted to the PHY plus the transmitting
|
||||
* STA's delays through its local PHY from the MAC-PHY
|
||||
* interface to its interface with the WM" (802.11 11.1.2)
|
||||
* - equals the time this bit arrives at the receiver - we have
|
||||
* to take into account the offset between the two.
|
||||
*
|
||||
* E.g. at 1 MBit that means mactime is 192 usec earlier
|
||||
* (=24 bytes * 8 usecs/byte) than the beacon timestamp.
|
||||
*/
|
||||
int rate;
|
||||
|
||||
if (rx_status->flag & RX_FLAG_HT)
|
||||
rate = 65; /* TODO: HT rates */
|
||||
else
|
||||
rate = local->hw.wiphy->bands[band]->
|
||||
bitrates[rx_status->rate_idx].bitrate;
|
||||
|
||||
rx_timestamp = rx_status->mactime + (24 * 8 * 10 / rate);
|
||||
if (ieee80211_have_rx_timestamp(rx_status)) {
|
||||
/* time when timestamp field was received */
|
||||
rx_timestamp =
|
||||
ieee80211_calculate_rx_timestamp(local, rx_status,
|
||||
len + FCS_LEN, 24);
|
||||
} else {
|
||||
/*
|
||||
* second best option: get current TSF
|
||||
|
Reference in New Issue
Block a user