sgi = (info3 >> 7) & 1;
status->rate_idx = mcs;
- status->enc_flags |= RX_ENC_FLAG_HT;
+ status->encoding = RX_ENC_HT;
if (sgi)
status->enc_flags |= RX_ENC_FLAG_SHORT_GI;
if (bw)
- status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ status->bw = RATE_INFO_BW_40;
break;
case HTT_RX_VHT:
case HTT_RX_VHT_WITH_TXBF:
break;
/* 40MHZ */
case 1:
- status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ status->bw = RATE_INFO_BW_40;
break;
/* 80MHZ */
case 2:
- status->enc_flags |= RX_ENC_FLAG_80MHZ;
+ status->bw = RATE_INFO_BW_80;
break;
case 3:
- status->enc_flags |= RX_ENC_FLAG_160MHZ;
+ status->bw = RATE_INFO_BW_160;
break;
}
- status->enc_flags |= RX_ENC_FLAG_VHT;
+ status->encoding = RX_ENC_VHT;
break;
default:
break;
status->freq = 0;
status->rate_idx = 0;
status->vht_nss = 0;
- status->enc_flags &= ~(RX_ENC_FLAG_HT |
- RX_ENC_FLAG_VHT |
- RX_ENC_FLAG_SHORT_GI |
- RX_ENC_FLAG_40MHZ |
- RX_ENC_FLAG_80MHZ);
+ status->encoding = RX_ENC_LEGACY;
+ status->bw = RATE_INFO_BW_20;
status->flag &= ~RX_FLAG_MACTIME_END;
status->flag |= RX_FLAG_NO_SIGNAL_VAL;
is_multicast_ether_addr(ieee80211_get_DA(hdr)) ?
"mcast" : "ucast",
(__le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4,
- (status->enc_flags & (RX_ENC_FLAG_HT | RX_ENC_FLAG_VHT)) == 0 ?
- "legacy" : "",
- status->enc_flags & RX_ENC_FLAG_HT ? "ht" : "",
- status->enc_flags & RX_ENC_FLAG_VHT ? "vht" : "",
- status->enc_flags & RX_ENC_FLAG_40MHZ ? "40" : "",
- status->enc_flags & RX_ENC_FLAG_80MHZ ? "80" : "",
- status->enc_flags & RX_ENC_FLAG_160MHZ ? "160" : "",
+ (status->encoding == RX_ENC_LEGACY) ? "legacy" : "",
+ (status->encoding == RX_ENC_HT) ? "ht" : "",
+ (status->encoding == RX_ENC_VHT) ? "vht" : "",
+ (status->bw == RATE_INFO_BW_40) ? "40" : "",
+ (status->bw == RATE_INFO_BW_80) ? "80" : "",
+ (status->bw == RATE_INFO_BW_160) ? "160" : "",
status->enc_flags & RX_ENC_FLAG_SHORT_GI ? "sgi " : "",
status->rate_idx,
status->vht_nss,
rxs->flag |= ath5k_rx_decrypted(ah, skb, rs);
switch (ah->ah_bwmode) {
case AR5K_BWMODE_5MHZ:
- rxs->enc_flags |= RX_ENC_FLAG_5MHZ;
+ rxs->bw = RATE_INFO_BW_5;
break;
case AR5K_BWMODE_10MHZ:
- rxs->enc_flags |= RX_ENC_FLAG_10MHZ;
+ rxs->bw = RATE_INFO_BW_10;
break;
default:
break;
rxs->rs_status = 0;
rxs->rs_flags = 0;
rxs->enc_flags = 0;
+ rxs->bw = RATE_INFO_BW_20;
rxs->rs_datalen = rxsp->status2 & AR_DataLen;
rxs->rs_tstamp = rxsp->status3;
sband = hw->wiphy->bands[band];
if (IS_CHAN_QUARTER_RATE(ah->curchan))
- rxs->enc_flags |= RX_ENC_FLAG_5MHZ;
+ rxs->bw = RATE_INFO_BW_5;
else if (IS_CHAN_HALF_RATE(ah->curchan))
- rxs->enc_flags |= RX_ENC_FLAG_10MHZ;
+ rxs->bw = RATE_INFO_BW_10;
if (rx_stats->rs_rate & 0x80) {
/* HT rate */
- rxs->enc_flags |= RX_ENC_FLAG_HT | rx_stats->enc_flags;
+ rxs->encoding = RX_ENC_HT;
+ rxs->enc_flags |= rx_stats->enc_flags;
+ rxs->bw = rx_stats->bw;
rxs->rate_idx = rx_stats->rs_rate & 0x7f;
return 0;
}
if (rxs->rate_idx >= ARRAY_SIZE(rstats->ht_stats))
goto exit;
- if (rxs->enc_flags & RX_ENC_FLAG_40MHZ)
+ if ((rxs->bw == RATE_INFO_BW_40))
rstats->ht_stats[rxs->rate_idx].ht40_cnt++;
else
rstats->ht_stats[rxs->rate_idx].ht20_cnt++;
struct ath_htc_rx_status *rxstatus)
{
rx_stats->enc_flags = 0;
+ rx_stats->bw = RATE_INFO_BW_20;
if (rxstatus->rs_flags & ATH9K_RX_2040)
- rx_stats->enc_flags |= RX_ENC_FLAG_40MHZ;
+ rx_stats->bw = RATE_INFO_BW_40;
if (rxstatus->rs_flags & ATH9K_RX_GI)
rx_stats->enc_flags |= RX_ENC_FLAG_SHORT_GI;
}
rs->rs_status = 0;
rs->rs_flags = 0;
rs->enc_flags = 0;
+ rs->bw = RATE_INFO_BW_20;
rs->rs_datalen = ads.ds_rxstatus1 & AR_DataLen;
rs->rs_tstamp = ads.AR_RcvTimestamp;
#ifndef MAC_H
#define MAC_H
+#include <net/cfg80211.h>
#define set11nTries(_series, _index) \
(SM((_series)[_index].Tries, AR_XmitDataTries##_index))
u32 evm3;
u32 evm4;
u16 enc_flags;
+ enum rate_info_bw bw;
};
struct ath_htc_rx_status {
rxs = IEEE80211_SKB_RXCB(skb);
is_sgi = !!(rxs->enc_flags & RX_ENC_FLAG_SHORT_GI);
- is_40 = !!(rxs->enc_flags & RX_ENC_FLAG_40MHZ);
+ is_40 = !!(rxs->bw == RATE_INFO_BW_40);
is_sp = !!(rxs->enc_flags & RX_ENC_FLAG_SHORTPRE);
- if (!!(rxs->enc_flags & RX_ENC_FLAG_HT)) {
+ if (!!(rxs->encoding == RX_ENC_HT)) {
/* MCS rates */
airtime += ath_pkt_duration(sc, rxs->rate_idx, len,
case AR9170_RX_STATUS_MODULATION_HT:
if (head->plcp[3] & 0x80)
- status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ status->bw = RATE_INFO_BW_40;
if (head->plcp[6] & 0x80)
status->enc_flags |= RX_ENC_FLAG_SHORT_GI;
status->rate_idx = clamp(0, 75, head->plcp[3] & 0x7f);
- status->enc_flags |= RX_ENC_FLAG_HT;
+ status->encoding = RX_ENC_HT;
break;
default:
rspec = brcms_c_compute_rspec(rxh, plcp);
if (is_mcs_rate(rspec)) {
rx_status->rate_idx = rspec & RSPEC_RATE_MASK;
- rx_status->enc_flags |= RX_ENC_FLAG_HT;
+ rx_status->encoding = RX_ENC_HT;
if (rspec_is40mhz(rspec))
- rx_status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ rx_status->bw = RATE_INFO_BW_40;
} else {
switch (rspec2rate(rspec)) {
case BRCM_RATE_1M:
/* Set up the HT phy flags */
if (rate_n_flags & RATE_MCS_HT_MSK)
- rx_status.enc_flags |= RX_ENC_FLAG_HT;
+ rx_status.encoding = RX_ENC_HT;
if (rate_n_flags & RATE_MCS_HT40_MSK)
rx_status.enc_flags |= RX_ENC_FLAG_40MHZ;
if (rate_n_flags & RATE_MCS_SGI_MSK)
/* Set up the HT phy flags */
if (rate_n_flags & RATE_MCS_HT_MSK)
- rx_status.enc_flags |= RX_ENC_FLAG_HT;
+ rx_status.encoding = RX_ENC_HT;
if (rate_n_flags & RATE_MCS_HT40_MSK)
rx_status.enc_flags |= RX_ENC_FLAG_40MHZ;
if (rate_n_flags & RATE_MCS_SGI_MSK)
case RATE_MCS_CHAN_WIDTH_20:
break;
case RATE_MCS_CHAN_WIDTH_40:
- rx_status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ rx_status->bw = RATE_INFO_BW_40;
break;
case RATE_MCS_CHAN_WIDTH_80:
- rx_status->enc_flags |= RX_ENC_FLAG_80MHZ;
+ rx_status->bw = RATE_INFO_BW_80;
break;
case RATE_MCS_CHAN_WIDTH_160:
- rx_status->enc_flags |= RX_ENC_FLAG_160MHZ;
+ rx_status->bw = RATE_INFO_BW_160;
break;
}
if (rate_n_flags & RATE_MCS_SGI_MSK)
if (rate_n_flags & RATE_MCS_HT_MSK) {
u8 stbc = (rate_n_flags & RATE_MCS_HT_STBC_MSK) >>
RATE_MCS_STBC_POS;
- rx_status->enc_flags |= RX_ENC_FLAG_HT;
+ rx_status->encoding = RX_ENC_HT;
rx_status->rate_idx = rate_n_flags & RATE_HT_MCS_INDEX_MSK;
rx_status->enc_flags |= stbc << RX_ENC_FLAG_STBC_SHIFT;
} else if (rate_n_flags & RATE_MCS_VHT_MSK) {
((rate_n_flags & RATE_VHT_MCS_NSS_MSK) >>
RATE_VHT_MCS_NSS_POS) + 1;
rx_status->rate_idx = rate_n_flags & RATE_VHT_MCS_RATE_CODE_MSK;
- rx_status->enc_flags |= RX_ENC_FLAG_VHT;
+ rx_status->encoding = RX_ENC_VHT;
rx_status->enc_flags |= stbc << RX_ENC_FLAG_STBC_SHIFT;
if (rate_n_flags & RATE_MCS_BF_MSK)
rx_status->enc_flags |= RX_ENC_FLAG_BF;
case RATE_MCS_CHAN_WIDTH_20:
break;
case RATE_MCS_CHAN_WIDTH_40:
- rx_status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ rx_status->bw = RATE_INFO_BW_40;
break;
case RATE_MCS_CHAN_WIDTH_80:
- rx_status->enc_flags |= RX_ENC_FLAG_80MHZ;
+ rx_status->bw = RATE_INFO_BW_80;
break;
case RATE_MCS_CHAN_WIDTH_160:
- rx_status->enc_flags |= RX_ENC_FLAG_160MHZ;
+ rx_status->bw = RATE_INFO_BW_160;
break;
}
if (rate_n_flags & RATE_MCS_SGI_MSK)
if (rate_n_flags & RATE_MCS_HT_MSK) {
u8 stbc = (rate_n_flags & RATE_MCS_HT_STBC_MSK) >>
RATE_MCS_STBC_POS;
- rx_status->enc_flags |= RX_ENC_FLAG_HT;
+ rx_status->encoding = RX_ENC_HT;
rx_status->rate_idx = rate_n_flags & RATE_HT_MCS_INDEX_MSK;
rx_status->enc_flags |= stbc << RX_ENC_FLAG_STBC_SHIFT;
} else if (rate_n_flags & RATE_MCS_VHT_MSK) {
((rate_n_flags & RATE_VHT_MCS_NSS_MSK) >>
RATE_VHT_MCS_NSS_POS) + 1;
rx_status->rate_idx = rate_n_flags & RATE_VHT_MCS_RATE_CODE_MSK;
- rx_status->enc_flags |= RX_ENC_FLAG_VHT;
+ rx_status->encoding = RX_ENC_VHT;
rx_status->enc_flags |= stbc << RX_ENC_FLAG_STBC_SHIFT;
if (rate_n_flags & RATE_MCS_BF_MSK)
rx_status->enc_flags |= RX_ENC_FLAG_BF;
ieee80211_rate_get_vht_mcs(&info->control.rates[0]);
rx_status.vht_nss =
ieee80211_rate_get_vht_nss(&info->control.rates[0]);
- rx_status.enc_flags |= RX_ENC_FLAG_VHT;
+ rx_status.encoding = RX_ENC_VHT;
} else {
rx_status.rate_idx = info->control.rates[0].idx;
if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS)
- rx_status.enc_flags |= RX_ENC_FLAG_HT;
+ rx_status.encoding = RX_ENC_HT;
}
if (info->control.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
rx_status.enc_flags |= RX_ENC_FLAG_40MHZ;
*noise = -rxd->noise_floor;
if (rxd->rate & MWL8K_AP_RATE_INFO_MCS_FORMAT) {
- status->enc_flags |= RX_ENC_FLAG_HT;
+ status->encoding = RX_ENC_HT;
if (rxd->rate & MWL8K_AP_RATE_INFO_40MHZ)
- status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ status->bw = RATE_INFO_BW_40;
status->rate_idx = MWL8K_AP_RATE_INFO_RATEID(rxd->rate);
} else {
int i;
if (rxd->channel > 14) {
status->band = NL80211_BAND_5GHZ;
- if (!(status->enc_flags & RX_ENC_FLAG_HT))
+ if (!(status->encoding == RX_ENC_HT))
status->rate_idx -= 5;
} else {
status->band = NL80211_BAND_2GHZ;
if (rate_info & MWL8K_STA_RATE_INFO_SHORTPRE)
status->enc_flags |= RX_ENC_FLAG_SHORTPRE;
if (rate_info & MWL8K_STA_RATE_INFO_40MHZ)
- status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ status->bw = RATE_INFO_BW_40;
if (rate_info & MWL8K_STA_RATE_INFO_SHORTGI)
status->enc_flags |= RX_ENC_FLAG_SHORT_GI;
if (rate_info & MWL8K_STA_RATE_INFO_MCS_FORMAT)
- status->enc_flags |= RX_ENC_FLAG_HT;
+ status->encoding = RX_ENC_HT;
if (rxd->channel > 14) {
status->band = NL80211_BAND_5GHZ;
- if (!(status->enc_flags & RX_ENC_FLAG_HT))
+ if (!(status->encoding == RX_ENC_HT))
status->rate_idx -= 5;
} else {
status->band = NL80211_BAND_2GHZ;
status->enc_flags |= RX_ENC_FLAG_HT_GF;
/* fall through */
case MT_PHY_TYPE_HT:
- status->enc_flags |= RX_ENC_FLAG_HT;
+ status->encoding = RX_ENC_HT;
status->rate_idx = idx;
break;
default:
status->enc_flags |= 1 << RX_ENC_FLAG_STBC_SHIFT;
if (rate & MT_RXWI_RATE_BW)
- status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ status->bw = RATE_INFO_BW_40;
}
static void
rxdesc->enc_flags |= RX_ENC_FLAG_SHORT_GI;
if (rt2x00_get_field32(word, RXWI_W1_BW))
- rxdesc->enc_flags |= RX_ENC_FLAG_40MHZ;
+ rxdesc->bw = RATE_INFO_BW_40;
/*
* Detect RX rate, always use MCS as signal type.
rate_idx = rt2x00lib_rxdone_read_signal(rt2x00dev, &rxdesc);
if (rxdesc.rate_mode == RATE_MODE_HT_MIX ||
rxdesc.rate_mode == RATE_MODE_HT_GREENFIELD)
- rxdesc.enc_flags |= RX_ENC_FLAG_HT;
+ rxdesc.encoding = RX_ENC_HT;
/*
* Check if this is a beacon, and more frames have been
rx_status->signal = rxdesc.rssi;
rx_status->flag = rxdesc.flags;
rx_status->enc_flags = rxdesc.enc_flags;
+ rx_status->encoding = rxdesc.encoding;
+ rx_status->bw = rxdesc.bw;
rx_status->antenna = rt2x00dev->link.ant.active.rx;
ieee80211_rx_ni(rt2x00dev->hw, entry->skb);
int dev_flags;
u16 rate_mode;
u16 enc_flags;
+ enum mac80211_rx_encoding encoding;
+ enum rate_info_bw bw;
u8 cipher;
u8 cipher_status;
if (rx_desc->crc32)
rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
if (rx_desc->bw)
- rx_status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ rx_status->bw = RATE_INFO_BW_40;
if (rx_desc->rxht) {
- rx_status->enc_flags |= RX_ENC_FLAG_HT;
+ rx_status->encoding = RX_ENC_HT;
rx_status->rate_idx = rx_desc->rxmcs - DESC_RATE_MCS0;
} else {
rx_status->rate_idx = rx_desc->rxmcs;
if (rx_desc->crc32)
rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
if (rx_desc->bw)
- rx_status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ rx_status->bw = RATE_INFO_BW_40;
if (rx_desc->rxmcs >= DESC_RATE_MCS0) {
- rx_status->enc_flags |= RX_ENC_FLAG_HT;
+ rx_status->encoding = RX_ENC_HT;
rx_status->rate_idx = rx_desc->rxmcs - DESC_RATE_MCS0;
} else {
rx_status->rate_idx = rx_desc->rxmcs;
rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
if (status->rx_is40Mhzpacket)
- rx_status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ rx_status->bw = RATE_INFO_BW_40;
if (status->is_ht)
- rx_status->enc_flags |= RX_ENC_FLAG_HT;
+ rx_status->encoding = RX_ENC_HT;
rx_status->flag |= RX_FLAG_MACTIME_START;
rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
if (stats->rx_is40Mhzpacket)
- rx_status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ rx_status->bw = RATE_INFO_BW_40;
if (stats->is_ht)
- rx_status->enc_flags |= RX_ENC_FLAG_HT;
+ rx_status->encoding = RX_ENC_HT;
rx_status->flag |= RX_FLAG_MACTIME_START;
if (!GET_RX_DESC_SWDEC(pdesc))
rx_status->flag |= RX_FLAG_DECRYPTED;
if (GET_RX_DESC_BW(pdesc))
- rx_status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ rx_status->bw = RATE_INFO_BW_40;
if (GET_RX_DESC_RX_HT(pdesc))
- rx_status->enc_flags |= RX_ENC_FLAG_HT;
+ rx_status->encoding = RX_ENC_HT;
rx_status->flag |= RX_FLAG_MACTIME_START;
if (stats->decrypted)
rx_status->flag |= RX_FLAG_DECRYPTED;
if (!GET_RX_DESC_SWDEC(rxdesc))
rx_status->flag |= RX_FLAG_DECRYPTED;
if (GET_RX_DESC_BW(rxdesc))
- rx_status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ rx_status->bw = RATE_INFO_BW_40;
if (GET_RX_DESC_RX_HT(rxdesc))
- rx_status->enc_flags |= RX_ENC_FLAG_HT;
+ rx_status->encoding = RX_ENC_HT;
/* Data rate */
rx_status->rate_idx = rtlwifi_rate_mapping(hw, stats.is_ht,
false, stats.rate);
if (!GET_RX_DESC_SWDEC(pdesc))
rx_status->flag |= RX_FLAG_DECRYPTED;
if (GET_RX_DESC_BW(pdesc))
- rx_status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ rx_status->bw = RATE_INFO_BW_40;
if (GET_RX_DESC_RXHT(pdesc))
- rx_status->enc_flags |= RX_ENC_FLAG_HT;
+ rx_status->encoding = RX_ENC_HT;
rx_status->flag |= RX_FLAG_MACTIME_START;
if (stats->decrypted)
rx_status->flag |= RX_FLAG_DECRYPTED;
rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
if (status->rx_is40Mhzpacket)
- rx_status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ rx_status->bw = RATE_INFO_BW_40;
if (status->is_ht)
- rx_status->enc_flags |= RX_ENC_FLAG_HT;
+ rx_status->encoding = RX_ENC_HT;
rx_status->flag |= RX_FLAG_MACTIME_START;
rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
if (stats->rx_is40Mhzpacket)
- rx_status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ rx_status->bw = RATE_INFO_BW_40;
if (stats->is_ht)
- rx_status->enc_flags |= RX_ENC_FLAG_HT;
+ rx_status->encoding = RX_ENC_HT;
rx_status->flag |= RX_FLAG_MACTIME_START;
rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
if (status->rx_is40Mhzpacket)
- rx_status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ rx_status->bw = RATE_INFO_BW_40;
if (status->is_ht)
- rx_status->enc_flags |= RX_ENC_FLAG_HT;
+ rx_status->encoding = RX_ENC_HT;
rx_status->flag |= RX_FLAG_MACTIME_START;
rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
if (status->rx_is40Mhzpacket)
- rx_status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ rx_status->bw = RATE_INFO_BW_40;
if (status->is_ht)
- rx_status->enc_flags |= RX_ENC_FLAG_HT;
+ rx_status->encoding = RX_ENC_HT;
rx_status->flag |= RX_FLAG_MACTIME_START;
rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
if (status->rx_packet_bw == HT_CHANNEL_WIDTH_20_40)
- rx_status->enc_flags |= RX_ENC_FLAG_40MHZ;
+ rx_status->bw = RATE_INFO_BW_40;
else if (status->rx_packet_bw == HT_CHANNEL_WIDTH_80)
- rx_status->enc_flags |= RX_ENC_FLAG_80MHZ;
+ rx_status->bw = RATE_INFO_BW_80;
if (status->is_ht)
- rx_status->enc_flags |= RX_ENC_FLAG_HT;
+ rx_status->encoding = RX_ENC_HT;
if (status->is_vht)
- rx_status->enc_flags |= RX_ENC_FLAG_VHT;
+ rx_status->encoding = RX_ENC_VHT;
if (status->is_short_gi)
rx_status->enc_flags |= RX_ENC_FLAG_SHORT_GI;
hdr->band);
if (arg->rx_rate >= 14) {
- hdr->enc_flags |= RX_ENC_FLAG_HT;
+ hdr->encoding = RX_ENC_HT;
hdr->rate_idx = arg->rx_rate - 14;
} else if (arg->rx_rate >= 4) {
hdr->rate_idx = arg->rx_rate - 2;
/* 11n support */
if (desc->rate <= wl->hw_min_ht_rate)
- status->enc_flags |= RX_ENC_FLAG_HT;
+ status->encoding = RX_ENC_HT;
/*
* Read the signal level and antenna diversity indication.
* enum mac80211_rx_encoding_flags - MCS & bandwidth flags
*
* @RX_ENC_FLAG_SHORTPRE: Short preamble was used for this frame
- * @RX_ENC_FLAG_HT: HT MCS was used and rate_idx is MCS index
- * @RX_ENC_FLAG_VHT: VHT MCS was used and rate_index is MCS index
* @RX_ENC_FLAG_40MHZ: HT40 (40 MHz) was used
* @RX_ENC_FLAG_SHORT_GI: Short guard interval was used
* @RX_ENC_FLAG_HT_GF: This frame was received in a HT-greenfield transmission,
* to hw.radiotap_mcs_details to advertise that fact
* @RX_ENC_FLAG_LDPC: LDPC was used
* @RX_ENC_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
- * @RX_ENC_FLAG_10MHZ: 10 MHz (half channel) was used
- * @RX_ENC_FLAG_5MHZ: 5 MHz (quarter channel) was used
- * @RX_ENC_FLAG_80MHZ: 80 MHz was used
- * @RX_ENC_FLAG_160MHZ: 160 MHz was used
* @RX_ENC_FLAG_BF: packet was beamformed
*/
enum mac80211_rx_encoding_flags {
RX_ENC_FLAG_SHORTPRE = BIT(0),
- RX_ENC_FLAG_HT = BIT(1),
- RX_ENC_FLAG_40MHZ = BIT(2),
- RX_ENC_FLAG_SHORT_GI = BIT(3),
- RX_ENC_FLAG_HT_GF = BIT(4),
- RX_ENC_FLAG_VHT = BIT(5),
- RX_ENC_FLAG_STBC_MASK = BIT(6) | BIT(7),
- RX_ENC_FLAG_LDPC = BIT(8),
- RX_ENC_FLAG_10MHZ = BIT(9),
- RX_ENC_FLAG_5MHZ = BIT(10),
- RX_ENC_FLAG_80MHZ = BIT(11),
- RX_ENC_FLAG_160MHZ = BIT(12),
- RX_ENC_FLAG_BF = BIT(13),
+ RX_ENC_FLAG_40MHZ = BIT(1),
+ RX_ENC_FLAG_SHORT_GI = BIT(2),
+ RX_ENC_FLAG_HT_GF = BIT(3),
+ RX_ENC_FLAG_STBC_MASK = BIT(4) | BIT(5),
+ RX_ENC_FLAG_LDPC = BIT(6),
+ RX_ENC_FLAG_BF = BIT(7),
};
-#define RX_ENC_FLAG_STBC_SHIFT 6
+#define RX_ENC_FLAG_STBC_SHIFT 4
+
+enum mac80211_rx_encoding {
+ RX_ENC_LEGACY = 0,
+ RX_ENC_HT,
+ RX_ENC_VHT,
+};
/**
* struct ieee80211_rx_status - receive status
* HT or VHT is used (%RX_FLAG_HT/%RX_FLAG_VHT)
* @vht_nss: number of streams (VHT only)
* @flag: %RX_FLAG_\*
+ * @encoding: &enum mac80211_rx_encoding
+ * @bw: &enum rate_info_bw
* @enc_flags: uses bits from &enum mac80211_rx_encoding_flags
* @rx_flags: internal RX flags for mac80211
* @ampdu_reference: A-MPDU reference number, must be a different value for
u32 device_timestamp;
u32 ampdu_reference;
u32 flag;
- u16 enc_flags;
u16 freq;
+ u8 enc_flags;
+ u8 encoding:2, bw:3;
u8 rate_idx;
u8 vht_nss;
u8 rx_flags;
prev_rates = sta->sta.supp_rates[band];
/* make sure mandatory rates are always added */
scan_width = NL80211_BSS_CHAN_WIDTH_20;
- if (rx_status->enc_flags & RX_ENC_FLAG_5MHZ)
+ if (rx_status->bw == RATE_INFO_BW_5)
scan_width = NL80211_BSS_CHAN_WIDTH_5;
- if (rx_status->enc_flags & RX_ENC_FLAG_10MHZ)
+ else if (rx_status->bw == RATE_INFO_BW_10)
scan_width = NL80211_BSS_CHAN_WIDTH_10;
sta->sta.supp_rates[band] = supp_rates |
status->flag & RX_FLAG_MACTIME_END);
if (status->flag & (RX_FLAG_MACTIME_START | RX_FLAG_MACTIME_END))
return true;
- /* can't handle HT/VHT preamble yet */
+ /* can't handle non-legacy preamble yet */
if (status->flag & RX_FLAG_MACTIME_PLCP_START &&
- !(status->enc_flags & (RX_ENC_FLAG_HT | RX_ENC_FLAG_VHT)))
+ status->encoding != RX_ENC_LEGACY)
return true;
return false;
}
/* padding for RX_FLAGS if necessary */
len = ALIGN(len, 2);
- if (status->enc_flags & RX_ENC_FLAG_HT) /* HT info */
+ if (status->encoding == RX_ENC_HT) /* HT info */
len += 3;
if (status->flag & RX_FLAG_AMPDU_DETAILS) {
len += 8;
}
- if (status->enc_flags & RX_ENC_FLAG_VHT) {
+ if (status->encoding == RX_ENC_VHT) {
len = ALIGN(len, 2);
len += 12;
}
pos++;
/* IEEE80211_RADIOTAP_RATE */
- if (!rate || status->enc_flags & (RX_ENC_FLAG_HT | RX_ENC_FLAG_VHT)) {
+ if (!rate || status->encoding != RX_ENC_LEGACY) {
/*
* Without rate information don't add it. If we have,
* MCS information is a separate field in radiotap,
} else {
int shift = 0;
rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_RATE);
- if (status->enc_flags & RX_ENC_FLAG_10MHZ)
+ if (status->bw == RATE_INFO_BW_10)
shift = 1;
- else if (status->enc_flags & RX_ENC_FLAG_5MHZ)
+ else if (status->bw == RATE_INFO_BW_5)
shift = 2;
*pos = DIV_ROUND_UP(rate->bitrate, 5 * (1 << shift));
}
/* IEEE80211_RADIOTAP_CHANNEL */
put_unaligned_le16(status->freq, pos);
pos += 2;
- if (status->enc_flags & RX_ENC_FLAG_10MHZ)
+ if (status->bw == RATE_INFO_BW_10)
channel_flags |= IEEE80211_CHAN_HALF;
- else if (status->enc_flags & RX_ENC_FLAG_5MHZ)
+ else if (status->bw == RATE_INFO_BW_5)
channel_flags |= IEEE80211_CHAN_QUARTER;
if (status->band == NL80211_BAND_5GHZ)
channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ;
- else if (status->enc_flags & (RX_ENC_FLAG_HT | RX_ENC_FLAG_VHT))
+ else if (status->encoding != RX_ENC_LEGACY)
channel_flags |= IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ;
else if (rate && rate->flags & IEEE80211_RATE_ERP_G)
channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ;
put_unaligned_le16(rx_flags, pos);
pos += 2;
- if (status->enc_flags & RX_ENC_FLAG_HT) {
+ if (status->encoding == RX_ENC_HT) {
unsigned int stbc;
rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_MCS);
*pos = 0;
if (status->enc_flags & RX_ENC_FLAG_SHORT_GI)
*pos |= IEEE80211_RADIOTAP_MCS_SGI;
- if (status->enc_flags & RX_ENC_FLAG_40MHZ)
+ if (status->bw == RATE_INFO_BW_40)
*pos |= IEEE80211_RADIOTAP_MCS_BW_40;
if (status->enc_flags & RX_ENC_FLAG_HT_GF)
*pos |= IEEE80211_RADIOTAP_MCS_FMT_GF;
*pos++ = 0;
}
- if (status->enc_flags & RX_ENC_FLAG_VHT) {
+ if (status->encoding == RX_ENC_VHT) {
u16 known = local->hw.radiotap_vht_details;
rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_VHT);
*pos |= IEEE80211_RADIOTAP_VHT_FLAG_BEAMFORMED;
pos++;
/* bandwidth */
- if (status->enc_flags & RX_ENC_FLAG_80MHZ)
+ switch (status->bw) {
+ case RATE_INFO_BW_80:
*pos++ = 4;
- else if (status->enc_flags & RX_ENC_FLAG_160MHZ)
+ break;
+ case RATE_INFO_BW_160:
*pos++ = 11;
- else if (status->enc_flags & RX_ENC_FLAG_40MHZ)
+ break;
+ case RATE_INFO_BW_40:
*pos++ = 1;
- else /* 20 MHz */
+ break;
+ default:
*pos++ = 0;
+ }
/* MCS/NSS */
*pos = (status->rate_idx << 4) | status->vht_nss;
pos += 4;
status = IEEE80211_SKB_RXCB((rx->skb));
sband = rx->local->hw.wiphy->bands[status->band];
- if (!(status->enc_flags & RX_ENC_FLAG_HT) &&
- !(status->enc_flags & RX_ENC_FLAG_VHT))
+ if (!(status->encoding == RX_ENC_HT) &&
+ !(status->encoding == RX_ENC_VHT))
rate = &sband->bitrates[status->rate_idx];
ieee80211_rx_cooked_monitor(rx, rate);
return false;
if (!rx->sta) {
int rate_idx;
- if (status->enc_flags & (RX_ENC_FLAG_HT | RX_ENC_FLAG_VHT))
+ if (status->encoding != RX_ENC_LEGACY)
rate_idx = 0; /* TODO: HT/VHT rates */
else
rate_idx = status->rate_idx;
return false;
if (!rx->sta) {
int rate_idx;
- if (status->enc_flags & RX_ENC_FLAG_HT)
+ if (status->encoding != RX_ENC_LEGACY)
rate_idx = 0; /* TODO: HT rates */
else
rate_idx = status->rate_idx;
* we probably can't have a valid rate here anyway.
*/
- if (status->enc_flags & RX_ENC_FLAG_HT) {
+ switch (status->encoding) {
+ case RX_ENC_HT:
/*
* rate_idx is MCS index, which can be [0-76]
* as documented on:
status->rate_idx,
status->rate_idx))
goto drop;
- } else if (status->enc_flags & RX_ENC_FLAG_VHT) {
+ break;
+ case RX_ENC_VHT:
if (WARN_ONCE(status->rate_idx > 9 ||
!status->vht_nss ||
status->vht_nss > 8,
"Rate marked as a VHT rate but data is invalid: MCS: %d, NSS: %d\n",
status->rate_idx, status->vht_nss))
goto drop;
- } else {
+ break;
+ default:
+ WARN_ON_ONCE(1);
+ /* fall through */
+ case RX_ENC_LEGACY:
if (WARN_ON(status->rate_idx >= sband->n_bitrates))
goto drop;
rate = &sband->bitrates[status->rate_idx];
bss_meta.signal = (rx_status->signal * 100) / local->hw.max_signal;
bss_meta.scan_width = NL80211_BSS_CHAN_WIDTH_20;
- if (rx_status->enc_flags & RX_ENC_FLAG_5MHZ)
+ if (rx_status->bw == RATE_INFO_BW_5)
bss_meta.scan_width = NL80211_BSS_CHAN_WIDTH_5;
- if (rx_status->enc_flags & RX_ENC_FLAG_10MHZ)
+ else if (rx_status->bw == RATE_INFO_BW_10)
bss_meta.scan_width = NL80211_BSS_CHAN_WIDTH_10;
bss_meta.chan = channel;
if (beacon) {
struct ieee80211_supported_band *sband =
local->hw.wiphy->bands[rx_status->band];
- if (!(rx_status->enc_flags & RX_ENC_FLAG_HT) &&
- !(rx_status->enc_flags & RX_ENC_FLAG_VHT))
+ if (!(rx_status->encoding == RX_ENC_HT) &&
+ !(rx_status->encoding == RX_ENC_VHT))
bss->beacon_rate =
&sband->bitrates[rx_status->rate_idx];
}
/*
* Copyright 2002-2005, Devicescape Software, Inc.
* Copyright 2013-2014 Intel Mobile Communications GmbH
- * Copyright(c) 2015-2016 Intel Deutschland GmbH
+ * Copyright(c) 2015-2017 Intel Deutschland GmbH
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
{
u16 r = s->rate_idx;
- if (s->enc_flags & RX_ENC_FLAG_80MHZ)
- r |= RATE_INFO_BW_80 << STA_STATS_RATE_BW_SHIFT;
- else if (s->enc_flags & RX_ENC_FLAG_160MHZ)
- r |= RATE_INFO_BW_160 << STA_STATS_RATE_BW_SHIFT;
- else if (s->enc_flags & RX_ENC_FLAG_40MHZ)
- r |= RATE_INFO_BW_40 << STA_STATS_RATE_BW_SHIFT;
- else if (s->enc_flags & RX_ENC_FLAG_10MHZ)
- r |= RATE_INFO_BW_10 << STA_STATS_RATE_BW_SHIFT;
- else if (s->enc_flags & RX_ENC_FLAG_5MHZ)
- r |= RATE_INFO_BW_5 << STA_STATS_RATE_BW_SHIFT;
- else
- r |= RATE_INFO_BW_20 << STA_STATS_RATE_BW_SHIFT;
+ r |= s->bw << STA_STATS_RATE_BW_SHIFT;
if (s->enc_flags & RX_ENC_FLAG_SHORT_GI)
r |= STA_STATS_RATE_SGI;
- if (s->enc_flags & RX_ENC_FLAG_VHT)
+ switch (s->encoding) {
+ case RX_ENC_VHT:
r |= STA_STATS_RATE_TYPE_VHT | (s->vht_nss << 4);
- else if (s->enc_flags & RX_ENC_FLAG_HT)
+ break;
+ case RX_ENC_HT:
r |= STA_STATS_RATE_TYPE_HT;
- else
+ break;
+ default:
+ WARN_ON(1);
+ /* fall through */
+ case RX_ENC_LEGACY:
r |= STA_STATS_RATE_TYPE_LEGACY | (s->band << 4);
+ break;
+ }
return r;
}
* Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
* Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
* Copyright 2013-2014 Intel Mobile Communications GmbH
- * Copyright (C) 2015-2016 Intel Deutschland GmbH
+ * Copyright (C) 2015-2017 Intel Deutschland GmbH
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
memset(&ri, 0, sizeof(ri));
/* Fill cfg80211 rate info */
- if (status->enc_flags & RX_ENC_FLAG_HT) {
+ switch (status->encoding) {
+ case RX_ENC_HT:
ri.mcs = status->rate_idx;
ri.flags |= RATE_INFO_FLAGS_MCS;
- if (status->enc_flags & RX_ENC_FLAG_40MHZ)
- ri.bw = RATE_INFO_BW_40;
- else
- ri.bw = RATE_INFO_BW_20;
+ ri.bw = status->bw;
if (status->enc_flags & RX_ENC_FLAG_SHORT_GI)
ri.flags |= RATE_INFO_FLAGS_SHORT_GI;
- } else if (status->enc_flags & RX_ENC_FLAG_VHT) {
+ break;
+ case RX_ENC_VHT:
ri.flags |= RATE_INFO_FLAGS_VHT_MCS;
ri.mcs = status->rate_idx;
ri.nss = status->vht_nss;
- if (status->enc_flags & RX_ENC_FLAG_40MHZ)
- ri.bw = RATE_INFO_BW_40;
- else if (status->enc_flags & RX_ENC_FLAG_80MHZ)
- ri.bw = RATE_INFO_BW_80;
- else if (status->enc_flags & RX_ENC_FLAG_160MHZ)
- ri.bw = RATE_INFO_BW_160;
- else
- ri.bw = RATE_INFO_BW_20;
+ ri.bw = status->bw;
if (status->enc_flags & RX_ENC_FLAG_SHORT_GI)
ri.flags |= RATE_INFO_FLAGS_SHORT_GI;
- } else {
+ break;
+ default:
+ WARN_ON(1);
+ /* fall through */
+ case RX_ENC_LEGACY: {
struct ieee80211_supported_band *sband;
int shift = 0;
int bitrate;
- if (status->enc_flags & RX_ENC_FLAG_10MHZ) {
+ ri.bw = status->bw;
+
+ switch (status->bw) {
+ case RATE_INFO_BW_10:
shift = 1;
- ri.bw = RATE_INFO_BW_10;
- } else if (status->enc_flags & RX_ENC_FLAG_5MHZ) {
+ break;
+ case RATE_INFO_BW_5:
shift = 2;
- ri.bw = RATE_INFO_BW_5;
- } else {
- ri.bw = RATE_INFO_BW_20;
+ break;
}
sband = local->hw.wiphy->bands[status->band];
ts += 192;
}
}
+ break;
+ }
}
rate = cfg80211_calculate_bitrate(&ri);