aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ibss.c
diff options
context:
space:
mode:
authorThomas Pedersen <thomas@cozybit.com>2012-11-13 13:46:27 -0500
committerJohannes Berg <johannes.berg@intel.com>2012-11-13 15:43:55 -0500
commitf4bda337bbb6e245e2a07f344990adeb6a70ff35 (patch)
tree6ccf2bc38fb67098df931ce55eb0905959813864 /net/mac80211/ibss.c
parent2a91c9f781de209d420d751e43eb43ffe6934803 (diff)
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>
Diffstat (limited to 'net/mac80211/ibss.c')
-rw-r--r--net/mac80211/ibss.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index c7386b2b767..cc11558d8c1 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -543,30 +543,11 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
543 if (ether_addr_equal(cbss->bssid, sdata->u.ibss.bssid)) 543 if (ether_addr_equal(cbss->bssid, sdata->u.ibss.bssid))
544 goto put_bss; 544 goto put_bss;
545 545
546 if (rx_status->flag & RX_FLAG_MACTIME_MPDU) { 546 if (ieee80211_have_rx_timestamp(rx_status)) {
547 /* 547 /* time when timestamp field was received */
548 * For correct IBSS merging we need mactime; since mactime is 548 rx_timestamp =
549 * defined as the time the first data symbol of the frame hits 549 ieee80211_calculate_rx_timestamp(local, rx_status,
550 * the PHY, and the timestamp of the beacon is defined as "the 550 len + FCS_LEN, 24);
551 * time that the data symbol containing the first bit of the
552 * timestamp is transmitted to the PHY plus the transmitting
553 * STA's delays through its local PHY from the MAC-PHY
554 * interface to its interface with the WM" (802.11 11.1.2)
555 * - equals the time this bit arrives at the receiver - we have
556 * to take into account the offset between the two.
557 *
558 * E.g. at 1 MBit that means mactime is 192 usec earlier
559 * (=24 bytes * 8 usecs/byte) than the beacon timestamp.
560 */
561 int rate;
562
563 if (rx_status->flag & RX_FLAG_HT)
564 rate = 65; /* TODO: HT rates */
565 else
566 rate = local->hw.wiphy->bands[band]->
567 bitrates[rx_status->rate_idx].bitrate;
568
569 rx_timestamp = rx_status->mactime + (24 * 8 * 10 / rate);
570 } else { 551 } else {
571 /* 552 /*
572 * second best option: get current TSF 553 * second best option: get current TSF