diff options
23 files changed, 108 insertions, 83 deletions
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index cdd19232960c..2fd5bab2e22a 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -1349,7 +1349,7 @@ ath5k_receive_frame(struct ath5k_hw *ah, struct sk_buff *skb, | |||
1349 | * right now, so it's not too bad... | 1349 | * right now, so it's not too bad... |
1350 | */ | 1350 | */ |
1351 | rxs->mactime = ath5k_extend_tsf(ah, rs->rs_tstamp); | 1351 | rxs->mactime = ath5k_extend_tsf(ah, rs->rs_tstamp); |
1352 | rxs->flag |= RX_FLAG_MACTIME_MPDU; | 1352 | rxs->flag |= RX_FLAG_MACTIME_START; |
1353 | 1353 | ||
1354 | rxs->freq = ah->curchan->center_freq; | 1354 | rxs->freq = ah->curchan->center_freq; |
1355 | rxs->band = ah->curchan->band; | 1355 | rxs->band = ah->curchan->band; |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c index 06cdcb772d78..e4ec98332988 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | |||
@@ -1082,7 +1082,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, | |||
1082 | rx_status->freq = hw->conf.channel->center_freq; | 1082 | rx_status->freq = hw->conf.channel->center_freq; |
1083 | rx_status->signal = rxbuf->rxstatus.rs_rssi + ATH_DEFAULT_NOISE_FLOOR; | 1083 | rx_status->signal = rxbuf->rxstatus.rs_rssi + ATH_DEFAULT_NOISE_FLOOR; |
1084 | rx_status->antenna = rxbuf->rxstatus.rs_antenna; | 1084 | rx_status->antenna = rxbuf->rxstatus.rs_antenna; |
1085 | rx_status->flag |= RX_FLAG_MACTIME_MPDU; | 1085 | rx_status->flag |= RX_FLAG_MACTIME_START; |
1086 | 1086 | ||
1087 | return true; | 1087 | return true; |
1088 | 1088 | ||
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index a04028bce28b..6aafbb77c498 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -976,7 +976,7 @@ static int ath9k_rx_skb_preprocess(struct ath_common *common, | |||
976 | rx_status->freq = hw->conf.channel->center_freq; | 976 | rx_status->freq = hw->conf.channel->center_freq; |
977 | rx_status->signal = ah->noise + rx_stats->rs_rssi; | 977 | rx_status->signal = ah->noise + rx_stats->rs_rssi; |
978 | rx_status->antenna = rx_stats->rs_antenna; | 978 | rx_status->antenna = rx_stats->rs_antenna; |
979 | rx_status->flag |= RX_FLAG_MACTIME_MPDU; | 979 | rx_status->flag |= RX_FLAG_MACTIME_START; |
980 | if (rx_stats->rs_moreaggr) | 980 | if (rx_stats->rs_moreaggr) |
981 | rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL; | 981 | rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL; |
982 | 982 | ||
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index 136510edf3cf..8cb206a89083 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c | |||
@@ -796,7 +796,7 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) | |||
796 | status.mactime += mactime; | 796 | status.mactime += mactime; |
797 | if (low_mactime_now <= mactime) | 797 | if (low_mactime_now <= mactime) |
798 | status.mactime -= 0x10000; | 798 | status.mactime -= 0x10000; |
799 | status.flag |= RX_FLAG_MACTIME_MPDU; | 799 | status.flag |= RX_FLAG_MACTIME_START; |
800 | } | 800 | } |
801 | 801 | ||
802 | chanid = (chanstat & B43_RX_CHAN_ID) >> B43_RX_CHAN_ID_SHIFT; | 802 | chanid = (chanstat & B43_RX_CHAN_ID) >> B43_RX_CHAN_ID_SHIFT; |
diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c index b8ffea6f5c64..849a28c80302 100644 --- a/drivers/net/wireless/b43legacy/xmit.c +++ b/drivers/net/wireless/b43legacy/xmit.c | |||
@@ -557,7 +557,7 @@ void b43legacy_rx(struct b43legacy_wldev *dev, | |||
557 | status.mactime += mactime; | 557 | status.mactime += mactime; |
558 | if (low_mactime_now <= mactime) | 558 | if (low_mactime_now <= mactime) |
559 | status.mactime -= 0x10000; | 559 | status.mactime -= 0x10000; |
560 | status.flag |= RX_FLAG_MACTIME_MPDU; | 560 | status.flag |= RX_FLAG_MACTIME_START; |
561 | } | 561 | } |
562 | 562 | ||
563 | chanid = (chanstat & B43legacy_RX_CHAN_ID) >> | 563 | chanid = (chanstat & B43legacy_RX_CHAN_ID) >> |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c index 565c15abbed5..02363f8afd77 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c | |||
@@ -7508,7 +7508,7 @@ prep_mac80211_status(struct brcms_c_info *wlc, struct d11rxhdr *rxh, | |||
7508 | 7508 | ||
7509 | /* fill in TSF and flag its presence */ | 7509 | /* fill in TSF and flag its presence */ |
7510 | rx_status->mactime = brcms_c_recover_tsf64(wlc, rxh); | 7510 | rx_status->mactime = brcms_c_recover_tsf64(wlc, rxh); |
7511 | rx_status->flag |= RX_FLAG_MACTIME_MPDU; | 7511 | rx_status->flag |= RX_FLAG_MACTIME_START; |
7512 | 7512 | ||
7513 | channel = BRCMS_CHAN_CHANNEL(rxh->RxChan); | 7513 | channel = BRCMS_CHAN_CHANNEL(rxh->RxChan); |
7514 | 7514 | ||
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c index eac4dc8bc879..ef68b7239955 100644 --- a/drivers/net/wireless/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/iwlegacy/4965-mac.c | |||
@@ -686,7 +686,7 @@ il4965_hdl_rx(struct il_priv *il, struct il_rx_buf *rxb) | |||
686 | 686 | ||
687 | /* TSF isn't reliable. In order to allow smooth user experience, | 687 | /* TSF isn't reliable. In order to allow smooth user experience, |
688 | * this W/A doesn't propagate it to the mac80211 */ | 688 | * this W/A doesn't propagate it to the mac80211 */ |
689 | /*rx_status.flag |= RX_FLAG_MACTIME_MPDU; */ | 689 | /*rx_status.flag |= RX_FLAG_MACTIME_START; */ |
690 | 690 | ||
691 | il->ucode_beacon_time = le32_to_cpu(phy_res->beacon_time_stamp); | 691 | il->ucode_beacon_time = le32_to_cpu(phy_res->beacon_time_stamp); |
692 | 692 | ||
diff --git a/drivers/net/wireless/iwlwifi/dvm/rx.c b/drivers/net/wireless/iwlwifi/dvm/rx.c index 5a9c325804f6..ad50fb915831 100644 --- a/drivers/net/wireless/iwlwifi/dvm/rx.c +++ b/drivers/net/wireless/iwlwifi/dvm/rx.c | |||
@@ -951,7 +951,7 @@ static int iwlagn_rx_reply_rx(struct iwl_priv *priv, | |||
951 | 951 | ||
952 | /* TSF isn't reliable. In order to allow smooth user experience, | 952 | /* TSF isn't reliable. In order to allow smooth user experience, |
953 | * this W/A doesn't propagate it to the mac80211 */ | 953 | * this W/A doesn't propagate it to the mac80211 */ |
954 | /*rx_status.flag |= RX_FLAG_MACTIME_MPDU;*/ | 954 | /*rx_status.flag |= RX_FLAG_MACTIME_START;*/ |
955 | 955 | ||
956 | priv->ucode_beacon_time = le32_to_cpu(phy_res->beacon_time_stamp); | 956 | priv->ucode_beacon_time = le32_to_cpu(phy_res->beacon_time_stamp); |
957 | 957 | ||
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index a8ec7086ad09..ce522aa93af7 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -699,7 +699,7 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw, | |||
699 | struct ieee80211_rate *txrate = ieee80211_get_tx_rate(hw, info); | 699 | struct ieee80211_rate *txrate = ieee80211_get_tx_rate(hw, info); |
700 | 700 | ||
701 | memset(&rx_status, 0, sizeof(rx_status)); | 701 | memset(&rx_status, 0, sizeof(rx_status)); |
702 | rx_status.flag |= RX_FLAG_MACTIME_MPDU; | 702 | rx_status.flag |= RX_FLAG_MACTIME_START; |
703 | rx_status.freq = chan->center_freq; | 703 | rx_status.freq = chan->center_freq; |
704 | rx_status.band = chan->band; | 704 | rx_status.band = chan->band; |
705 | rx_status.rate_idx = info->control.rates[0].idx; | 705 | rx_status.rate_idx = info->control.rates[0].idx; |
diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c index 5861e13a6fd8..8ae982bd7cf3 100644 --- a/drivers/net/wireless/p54/txrx.c +++ b/drivers/net/wireless/p54/txrx.c | |||
@@ -369,7 +369,7 @@ static int p54_rx_data(struct p54_common *priv, struct sk_buff *skb) | |||
369 | rx_status->mactime = ((u64)priv->tsf_high32) << 32 | tsf32; | 369 | rx_status->mactime = ((u64)priv->tsf_high32) << 32 | tsf32; |
370 | priv->tsf_low32 = tsf32; | 370 | priv->tsf_low32 = tsf32; |
371 | 371 | ||
372 | rx_status->flag |= RX_FLAG_MACTIME_MPDU; | 372 | rx_status->flag |= RX_FLAG_MACTIME_START; |
373 | 373 | ||
374 | if (hdr->flags & cpu_to_le16(P54_HDR_FLAG_DATA_ALIGN)) | 374 | if (hdr->flags & cpu_to_le16(P54_HDR_FLAG_DATA_ALIGN)) |
375 | header_len += hdr->align[0]; | 375 | header_len += hdr->align[0]; |
diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c index 021d83e1b1d3..b4218a5f2066 100644 --- a/drivers/net/wireless/rtl818x/rtl8180/dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c | |||
@@ -150,7 +150,7 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev) | |||
150 | rx_status.freq = dev->conf.channel->center_freq; | 150 | rx_status.freq = dev->conf.channel->center_freq; |
151 | rx_status.band = dev->conf.channel->band; | 151 | rx_status.band = dev->conf.channel->band; |
152 | rx_status.mactime = le64_to_cpu(entry->tsft); | 152 | rx_status.mactime = le64_to_cpu(entry->tsft); |
153 | rx_status.flag |= RX_FLAG_MACTIME_MPDU; | 153 | rx_status.flag |= RX_FLAG_MACTIME_START; |
154 | if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR) | 154 | if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR) |
155 | rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; | 155 | rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; |
156 | 156 | ||
diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c index 7811b6315973..52e6bebcf089 100644 --- a/drivers/net/wireless/rtl818x/rtl8187/dev.c +++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c | |||
@@ -381,7 +381,7 @@ static void rtl8187_rx_cb(struct urb *urb) | |||
381 | rx_status.rate_idx = rate; | 381 | rx_status.rate_idx = rate; |
382 | rx_status.freq = dev->conf.channel->center_freq; | 382 | rx_status.freq = dev->conf.channel->center_freq; |
383 | rx_status.band = dev->conf.channel->band; | 383 | rx_status.band = dev->conf.channel->band; |
384 | rx_status.flag |= RX_FLAG_MACTIME_MPDU; | 384 | rx_status.flag |= RX_FLAG_MACTIME_START; |
385 | if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR) | 385 | if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR) |
386 | rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; | 386 | rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; |
387 | memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); | 387 | memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c index 390d6d4fcaa0..a8fecd7638f6 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c | |||
@@ -567,7 +567,7 @@ bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw, | |||
567 | if (GET_RX_DESC_RXHT(pdesc)) | 567 | if (GET_RX_DESC_RXHT(pdesc)) |
568 | rx_status->flag |= RX_FLAG_HT; | 568 | rx_status->flag |= RX_FLAG_HT; |
569 | 569 | ||
570 | rx_status->flag |= RX_FLAG_MACTIME_MPDU; | 570 | rx_status->flag |= RX_FLAG_MACTIME_START; |
571 | 571 | ||
572 | if (stats->decrypted) | 572 | if (stats->decrypted) |
573 | rx_status->flag |= RX_FLAG_DECRYPTED; | 573 | rx_status->flag |= RX_FLAG_DECRYPTED; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c index 6e66f04c363f..b6222eedb835 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | |||
@@ -334,7 +334,7 @@ bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw, | |||
334 | rx_status->flag |= RX_FLAG_40MHZ; | 334 | rx_status->flag |= RX_FLAG_40MHZ; |
335 | if (GET_RX_DESC_RX_HT(pdesc)) | 335 | if (GET_RX_DESC_RX_HT(pdesc)) |
336 | rx_status->flag |= RX_FLAG_HT; | 336 | rx_status->flag |= RX_FLAG_HT; |
337 | rx_status->flag |= RX_FLAG_MACTIME_MPDU; | 337 | rx_status->flag |= RX_FLAG_MACTIME_START; |
338 | if (stats->decrypted) | 338 | if (stats->decrypted) |
339 | rx_status->flag |= RX_FLAG_DECRYPTED; | 339 | rx_status->flag |= RX_FLAG_DECRYPTED; |
340 | rx_status->rate_idx = rtlwifi_rate_mapping(hw, | 340 | rx_status->rate_idx = rtlwifi_rate_mapping(hw, |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c index 4686f340b9d6..3baaf21abed4 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c | |||
@@ -514,7 +514,7 @@ bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats, | |||
514 | rx_status->flag |= RX_FLAG_40MHZ; | 514 | rx_status->flag |= RX_FLAG_40MHZ; |
515 | if (GET_RX_DESC_RXHT(pdesc)) | 515 | if (GET_RX_DESC_RXHT(pdesc)) |
516 | rx_status->flag |= RX_FLAG_HT; | 516 | rx_status->flag |= RX_FLAG_HT; |
517 | rx_status->flag |= RX_FLAG_MACTIME_MPDU; | 517 | rx_status->flag |= RX_FLAG_MACTIME_START; |
518 | if (stats->decrypted) | 518 | if (stats->decrypted) |
519 | rx_status->flag |= RX_FLAG_DECRYPTED; | 519 | rx_status->flag |= RX_FLAG_DECRYPTED; |
520 | rx_status->rate_idx = rtlwifi_rate_mapping(hw, | 520 | rx_status->rate_idx = rtlwifi_rate_mapping(hw, |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c index e3cf4c02122a..26d027cb5069 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c | |||
@@ -554,7 +554,7 @@ bool rtl92se_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats, | |||
554 | if (stats->is_ht) | 554 | if (stats->is_ht) |
555 | rx_status->flag |= RX_FLAG_HT; | 555 | rx_status->flag |= RX_FLAG_HT; |
556 | 556 | ||
557 | rx_status->flag |= RX_FLAG_MACTIME_MPDU; | 557 | rx_status->flag |= RX_FLAG_MACTIME_START; |
558 | 558 | ||
559 | /* hw will set stats->decrypted true, if it finds the | 559 | /* hw will set stats->decrypted true, if it finds the |
560 | * frame is open data frame or mgmt frame, | 560 | * frame is open data frame or mgmt frame, |
diff --git a/drivers/net/wireless/ti/wl1251/rx.c b/drivers/net/wireless/ti/wl1251/rx.c index 6af35265c900..23289d49dd31 100644 --- a/drivers/net/wireless/ti/wl1251/rx.c +++ b/drivers/net/wireless/ti/wl1251/rx.c | |||
@@ -81,7 +81,7 @@ static void wl1251_rx_status(struct wl1251 *wl, | |||
81 | status->freq = ieee80211_channel_to_frequency(desc->channel, | 81 | status->freq = ieee80211_channel_to_frequency(desc->channel, |
82 | status->band); | 82 | status->band); |
83 | 83 | ||
84 | status->flag |= RX_FLAG_MACTIME_MPDU; | 84 | status->flag |= RX_FLAG_MACTIME_START; |
85 | 85 | ||
86 | if (desc->flags & RX_DESC_ENCRYPTION_MASK) { | 86 | if (desc->flags & RX_DESC_ENCRYPTION_MASK) { |
87 | status->flag |= RX_FLAG_IV_STRIPPED | RX_FLAG_MMIC_STRIPPED; | 87 | status->flag |= RX_FLAG_IV_STRIPPED | RX_FLAG_MMIC_STRIPPED; |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index a789dd1d4c10..b484a6569eac 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -711,10 +711,13 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) | |||
711 | * the frame. | 711 | * the frame. |
712 | * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on | 712 | * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on |
713 | * the frame. | 713 | * the frame. |
714 | * @RX_FLAG_MACTIME_MPDU: The timestamp passed in the RX status (@mactime | 714 | * @RX_FLAG_MACTIME_START: The timestamp passed in the RX status (@mactime |
715 | * field) is valid and contains the time the first symbol of the MPDU | 715 | * field) is valid and contains the time the first symbol of the MPDU |
716 | * was received. This is useful in monitor mode and for proper IBSS | 716 | * was received. This is useful in monitor mode and for proper IBSS |
717 | * merging. | 717 | * merging. |
718 | * @RX_FLAG_MACTIME_END: The timestamp passed in the RX status (@mactime | ||
719 | * field) is valid and contains the time the last symbol of the MPDU | ||
720 | * (including FCS) was received. | ||
718 | * @RX_FLAG_SHORTPRE: Short preamble was used for this frame | 721 | * @RX_FLAG_SHORTPRE: Short preamble was used for this frame |
719 | * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index | 722 | * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index |
720 | * @RX_FLAG_40MHZ: HT40 (40 MHz) was used | 723 | * @RX_FLAG_40MHZ: HT40 (40 MHz) was used |
@@ -745,7 +748,7 @@ enum mac80211_rx_flags { | |||
745 | RX_FLAG_IV_STRIPPED = BIT(4), | 748 | RX_FLAG_IV_STRIPPED = BIT(4), |
746 | RX_FLAG_FAILED_FCS_CRC = BIT(5), | 749 | RX_FLAG_FAILED_FCS_CRC = BIT(5), |
747 | RX_FLAG_FAILED_PLCP_CRC = BIT(6), | 750 | RX_FLAG_FAILED_PLCP_CRC = BIT(6), |
748 | RX_FLAG_MACTIME_MPDU = BIT(7), | 751 | RX_FLAG_MACTIME_START = BIT(7), |
749 | RX_FLAG_SHORTPRE = BIT(8), | 752 | RX_FLAG_SHORTPRE = BIT(8), |
750 | RX_FLAG_HT = BIT(9), | 753 | RX_FLAG_HT = BIT(9), |
751 | RX_FLAG_40MHZ = BIT(10), | 754 | RX_FLAG_40MHZ = BIT(10), |
@@ -759,6 +762,7 @@ enum mac80211_rx_flags { | |||
759 | RX_FLAG_AMPDU_IS_LAST = BIT(18), | 762 | RX_FLAG_AMPDU_IS_LAST = BIT(18), |
760 | RX_FLAG_AMPDU_DELIM_CRC_ERROR = BIT(19), | 763 | RX_FLAG_AMPDU_DELIM_CRC_ERROR = BIT(19), |
761 | RX_FLAG_AMPDU_DELIM_CRC_KNOWN = BIT(20), | 764 | RX_FLAG_AMPDU_DELIM_CRC_KNOWN = BIT(20), |
765 | RX_FLAG_MACTIME_END = BIT(21), | ||
762 | }; | 766 | }; |
763 | 767 | ||
764 | /** | 768 | /** |
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index c7386b2b767e..cc11558d8c1a 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 |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index e1fb97cc9a41..bff82a8e62f3 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -1259,7 +1259,18 @@ static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) | |||
1259 | is_broadcast_ether_addr(raddr); | 1259 | is_broadcast_ether_addr(raddr); |
1260 | } | 1260 | } |
1261 | 1261 | ||
1262 | static inline bool | ||
1263 | ieee80211_have_rx_timestamp(struct ieee80211_rx_status *status) | ||
1264 | { | ||
1265 | WARN_ON_ONCE(status->flag & RX_FLAG_MACTIME_START && | ||
1266 | status->flag & RX_FLAG_MACTIME_END); | ||
1267 | return status->flag & (RX_FLAG_MACTIME_START | RX_FLAG_MACTIME_END); | ||
1268 | } | ||
1262 | 1269 | ||
1270 | u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local, | ||
1271 | struct ieee80211_rx_status *status, | ||
1272 | unsigned int mpdu_len, | ||
1273 | unsigned int mpdu_offset); | ||
1263 | int ieee80211_hw_config(struct ieee80211_local *local, u32 changed); | 1274 | int ieee80211_hw_config(struct ieee80211_local *local, u32 changed); |
1264 | void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx); | 1275 | void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx); |
1265 | void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, | 1276 | void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, |
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); |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 6ad330341b71..e3daee8fdf7a 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -81,7 +81,7 @@ ieee80211_rx_radiotap_len(struct ieee80211_local *local, | |||
81 | /* always present fields */ | 81 | /* always present fields */ |
82 | len = sizeof(struct ieee80211_radiotap_header) + 9; | 82 | len = sizeof(struct ieee80211_radiotap_header) + 9; |
83 | 83 | ||
84 | if (status->flag & RX_FLAG_MACTIME_MPDU) | 84 | if (ieee80211_have_rx_timestamp(status)) |
85 | len += 8; | 85 | len += 8; |
86 | if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) | 86 | if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) |
87 | len += 1; | 87 | len += 1; |
@@ -117,6 +117,11 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, | |||
117 | struct ieee80211_radiotap_header *rthdr; | 117 | struct ieee80211_radiotap_header *rthdr; |
118 | unsigned char *pos; | 118 | unsigned char *pos; |
119 | u16 rx_flags = 0; | 119 | u16 rx_flags = 0; |
120 | int mpdulen; | ||
121 | |||
122 | mpdulen = skb->len; | ||
123 | if (!(has_fcs && (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS))) | ||
124 | mpdulen += FCS_LEN; | ||
120 | 125 | ||
121 | rthdr = (struct ieee80211_radiotap_header *)skb_push(skb, rtap_len); | 126 | rthdr = (struct ieee80211_radiotap_header *)skb_push(skb, rtap_len); |
122 | memset(rthdr, 0, rtap_len); | 127 | memset(rthdr, 0, rtap_len); |
@@ -134,8 +139,11 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, | |||
134 | /* the order of the following fields is important */ | 139 | /* the order of the following fields is important */ |
135 | 140 | ||
136 | /* IEEE80211_RADIOTAP_TSFT */ | 141 | /* IEEE80211_RADIOTAP_TSFT */ |
137 | if (status->flag & RX_FLAG_MACTIME_MPDU) { | 142 | if (ieee80211_have_rx_timestamp(status)) { |
138 | put_unaligned_le64(status->mactime, pos); | 143 | put_unaligned_le64( |
144 | ieee80211_calculate_rx_timestamp(local, status, | ||
145 | mpdulen, 0), | ||
146 | pos); | ||
139 | rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_TSFT); | 147 | rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_TSFT); |
140 | pos += 8; | 148 | pos += 8; |
141 | } | 149 | } |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 4e4f58513673..5bad758abfb3 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -2013,3 +2013,54 @@ u8 ieee80211_mcs_to_chains(const struct ieee80211_mcs_info *mcs) | |||
2013 | return 2; | 2013 | return 2; |
2014 | return 1; | 2014 | return 1; |
2015 | } | 2015 | } |
2016 | |||
2017 | /** | ||
2018 | * ieee80211_calculate_rx_timestamp - calculate timestamp in frame | ||
2019 | * @local: mac80211 hw info struct | ||
2020 | * @status: RX status | ||
2021 | * @mpdu_len: total MPDU length (including FCS) | ||
2022 | * @mpdu_offset: offset into MPDU to calculate timestamp at | ||
2023 | * | ||
2024 | * This function calculates the RX timestamp at the given MPDU offset, taking | ||
2025 | * into account what the RX timestamp was. An offset of 0 will just normalize | ||
2026 | * the timestamp to TSF at beginning of MPDU reception. | ||
2027 | */ | ||
2028 | u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local, | ||
2029 | struct ieee80211_rx_status *status, | ||
2030 | unsigned int mpdu_len, | ||
2031 | unsigned int mpdu_offset) | ||
2032 | { | ||
2033 | u64 ts = status->mactime; | ||
2034 | struct rate_info ri; | ||
2035 | u16 rate; | ||
2036 | |||
2037 | if (WARN_ON(!ieee80211_have_rx_timestamp(status))) | ||
2038 | return 0; | ||
2039 | |||
2040 | memset(&ri, 0, sizeof(ri)); | ||
2041 | |||
2042 | /* Fill cfg80211 rate info */ | ||
2043 | if (status->flag & RX_FLAG_HT) { | ||
2044 | ri.mcs = status->rate_idx; | ||
2045 | ri.flags |= RATE_INFO_FLAGS_MCS; | ||
2046 | if (status->flag & RX_FLAG_40MHZ) | ||
2047 | ri.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; | ||
2048 | if (status->flag & RX_FLAG_SHORT_GI) | ||
2049 | ri.flags |= RATE_INFO_FLAGS_SHORT_GI; | ||
2050 | } else { | ||
2051 | struct ieee80211_supported_band *sband; | ||
2052 | |||
2053 | sband = local->hw.wiphy->bands[status->band]; | ||
2054 | ri.legacy = sband->bitrates[status->rate_idx].bitrate; | ||
2055 | } | ||
2056 | |||
2057 | rate = cfg80211_calculate_bitrate(&ri); | ||
2058 | |||
2059 | /* rewind from end of MPDU */ | ||
2060 | if (status->flag & RX_FLAG_MACTIME_END) | ||
2061 | ts -= mpdu_len * 8 * 10 / rate; | ||
2062 | |||
2063 | ts += mpdu_offset * 8 * 10 / rate; | ||
2064 | |||
2065 | return ts; | ||
2066 | } | ||