mac80211: clean up rate encoding bits in RX status
In preparation for adding support for HE rates, clean up the driver report encoding for rate/bandwidth reporting on RX frames. Much of this patch was done with the following spatch: @@ expression status; @@ -status->flag & (RX_FLAG_HT | RX_FLAG_VHT) +status->enc_flags & (RX_ENC_FLAG_HT | RX_ENC_FLAG_VHT) @@ assignment operator op; expression status; @@ -status->flag op RX_FLAG_SHORTPRE +status->enc_flags op RX_ENC_FLAG_SHORTPRE @@ expression status; @@ -status->flag & RX_FLAG_SHORTPRE +status->enc_flags & RX_ENC_FLAG_SHORTPRE @@ assignment operator op; expression status; @@ -status->flag op RX_FLAG_HT +status->enc_flags op RX_ENC_FLAG_HT @@ expression status; @@ -status->flag & RX_FLAG_HT +status->enc_flags & RX_ENC_FLAG_HT @@ assignment operator op; expression status; @@ -status->flag op RX_FLAG_40MHZ +status->enc_flags op RX_ENC_FLAG_40MHZ @@ expression status; @@ -status->flag & RX_FLAG_40MHZ +status->enc_flags & RX_ENC_FLAG_40MHZ @@ assignment operator op; expression status; @@ -status->flag op RX_FLAG_SHORT_GI +status->enc_flags op RX_ENC_FLAG_SHORT_GI @@ expression status; @@ -status->flag & RX_FLAG_SHORT_GI +status->enc_flags & RX_ENC_FLAG_SHORT_GI @@ assignment operator op; expression status; @@ -status->flag op RX_FLAG_HT_GF +status->enc_flags op RX_ENC_FLAG_HT_GF @@ expression status; @@ -status->flag & RX_FLAG_HT_GF +status->enc_flags & RX_ENC_FLAG_HT_GF @@ assignment operator op; expression status; @@ -status->flag op RX_FLAG_VHT +status->enc_flags op RX_ENC_FLAG_VHT @@ expression status; @@ -status->flag & RX_FLAG_VHT +status->enc_flags & RX_ENC_FLAG_VHT @@ assignment operator op; expression status; @@ -status->flag op RX_FLAG_STBC_MASK +status->enc_flags op RX_ENC_FLAG_STBC_MASK @@ expression status; @@ -status->flag & RX_FLAG_STBC_MASK +status->enc_flags & RX_ENC_FLAG_STBC_MASK @@ assignment operator op; expression status; @@ -status->flag op RX_FLAG_LDPC +status->enc_flags op RX_ENC_FLAG_LDPC @@ expression status; @@ -status->flag & RX_FLAG_LDPC +status->enc_flags & RX_ENC_FLAG_LDPC @@ assignment operator op; expression status; @@ -status->flag op RX_FLAG_10MHZ +status->enc_flags op RX_ENC_FLAG_10MHZ @@ expression status; @@ -status->flag & RX_FLAG_10MHZ +status->enc_flags & RX_ENC_FLAG_10MHZ @@ assignment operator op; expression status; @@ -status->flag op RX_FLAG_5MHZ +status->enc_flags op RX_ENC_FLAG_5MHZ @@ expression status; @@ -status->flag & RX_FLAG_5MHZ +status->enc_flags & RX_ENC_FLAG_5MHZ @@ assignment operator op; expression status; @@ -status->vht_flag op RX_VHT_FLAG_80MHZ +status->enc_flags op RX_ENC_FLAG_80MHZ @@ expression status; @@ -status->vht_flag & RX_VHT_FLAG_80MHZ +status->enc_flags & RX_ENC_FLAG_80MHZ @@ assignment operator op; expression status; @@ -status->vht_flag op RX_VHT_FLAG_160MHZ +status->enc_flags op RX_ENC_FLAG_160MHZ @@ expression status; @@ -status->vht_flag & RX_VHT_FLAG_160MHZ +status->enc_flags & RX_ENC_FLAG_160MHZ @@ assignment operator op; expression status; @@ -status->vht_flag op RX_VHT_FLAG_BF +status->enc_flags op RX_ENC_FLAG_BF @@ expression status; @@ -status->vht_flag & RX_VHT_FLAG_BF +status->enc_flags & RX_ENC_FLAG_BF @@ assignment operator op; expression status, STBC; @@ -status->flag op STBC << RX_FLAG_STBC_SHIFT +status->enc_flags op STBC << RX_ENC_FLAG_STBC_SHIFT @@ assignment operator op; expression status; @@ -status.flag op RX_FLAG_SHORTPRE +status.enc_flags op RX_ENC_FLAG_SHORTPRE @@ expression status; @@ -status.flag & RX_FLAG_SHORTPRE +status.enc_flags & RX_ENC_FLAG_SHORTPRE @@ assignment operator op; expression status; @@ -status.flag op RX_FLAG_HT +status.enc_flags op RX_ENC_FLAG_HT @@ expression status; @@ -status.flag & RX_FLAG_HT +status.enc_flags & RX_ENC_FLAG_HT @@ assignment operator op; expression status; @@ -status.flag op RX_FLAG_40MHZ +status.enc_flags op RX_ENC_FLAG_40MHZ @@ expression status; @@ -status.flag & RX_FLAG_40MHZ +status.enc_flags & RX_ENC_FLAG_40MHZ @@ assignment operator op; expression status; @@ -status.flag op RX_FLAG_SHORT_GI +status.enc_flags op RX_ENC_FLAG_SHORT_GI @@ expression status; @@ -status.flag & RX_FLAG_SHORT_GI +status.enc_flags & RX_ENC_FLAG_SHORT_GI @@ assignment operator op; expression status; @@ -status.flag op RX_FLAG_HT_GF +status.enc_flags op RX_ENC_FLAG_HT_GF @@ expression status; @@ -status.flag & RX_FLAG_HT_GF +status.enc_flags & RX_ENC_FLAG_HT_GF @@ assignment operator op; expression status; @@ -status.flag op RX_FLAG_VHT +status.enc_flags op RX_ENC_FLAG_VHT @@ expression status; @@ -status.flag & RX_FLAG_VHT +status.enc_flags & RX_ENC_FLAG_VHT @@ assignment operator op; expression status; @@ -status.flag op RX_FLAG_STBC_MASK +status.enc_flags op RX_ENC_FLAG_STBC_MASK @@ expression status; @@ -status.flag & RX_FLAG_STBC_MASK +status.enc_flags & RX_ENC_FLAG_STBC_MASK @@ assignment operator op; expression status; @@ -status.flag op RX_FLAG_LDPC +status.enc_flags op RX_ENC_FLAG_LDPC @@ expression status; @@ -status.flag & RX_FLAG_LDPC +status.enc_flags & RX_ENC_FLAG_LDPC @@ assignment operator op; expression status; @@ -status.flag op RX_FLAG_10MHZ +status.enc_flags op RX_ENC_FLAG_10MHZ @@ expression status; @@ -status.flag & RX_FLAG_10MHZ +status.enc_flags & RX_ENC_FLAG_10MHZ @@ assignment operator op; expression status; @@ -status.flag op RX_FLAG_5MHZ +status.enc_flags op RX_ENC_FLAG_5MHZ @@ expression status; @@ -status.flag & RX_FLAG_5MHZ +status.enc_flags & RX_ENC_FLAG_5MHZ @@ assignment operator op; expression status; @@ -status.vht_flag op RX_VHT_FLAG_80MHZ +status.enc_flags op RX_ENC_FLAG_80MHZ @@ expression status; @@ -status.vht_flag & RX_VHT_FLAG_80MHZ +status.enc_flags & RX_ENC_FLAG_80MHZ @@ assignment operator op; expression status; @@ -status.vht_flag op RX_VHT_FLAG_160MHZ +status.enc_flags op RX_ENC_FLAG_160MHZ @@ expression status; @@ -status.vht_flag & RX_VHT_FLAG_160MHZ +status.enc_flags & RX_ENC_FLAG_160MHZ @@ assignment operator op; expression status; @@ -status.vht_flag op RX_VHT_FLAG_BF +status.enc_flags op RX_ENC_FLAG_BF @@ expression status; @@ -status.vht_flag & RX_VHT_FLAG_BF +status.enc_flags & RX_ENC_FLAG_BF @@ assignment operator op; expression status, STBC; @@ -status.flag op STBC << RX_FLAG_STBC_SHIFT +status.enc_flags op STBC << RX_ENC_FLAG_STBC_SHIFT @@ @@ -RX_FLAG_STBC_SHIFT +RX_ENC_FLAG_STBC_SHIFT Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
@@ -494,7 +494,7 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs,
|
||||
|
||||
rxs->rs_status = 0;
|
||||
rxs->rs_flags = 0;
|
||||
rxs->flag = 0;
|
||||
rxs->enc_flags = 0;
|
||||
|
||||
rxs->rs_datalen = rxsp->status2 & AR_DataLen;
|
||||
rxs->rs_tstamp = rxsp->status3;
|
||||
@@ -520,8 +520,8 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs,
|
||||
rxs->rs_isaggr = (rxsp->status11 & AR_RxAggr) ? 1 : 0;
|
||||
rxs->rs_moreaggr = (rxsp->status11 & AR_RxMoreAggr) ? 1 : 0;
|
||||
rxs->rs_antenna = (MS(rxsp->status4, AR_RxAntenna) & 0x7);
|
||||
rxs->flag |= (rxsp->status4 & AR_GI) ? RX_FLAG_SHORT_GI : 0;
|
||||
rxs->flag |= (rxsp->status4 & AR_2040) ? RX_FLAG_40MHZ : 0;
|
||||
rxs->enc_flags |= (rxsp->status4 & AR_GI) ? RX_ENC_FLAG_SHORT_GI : 0;
|
||||
rxs->enc_flags |= (rxsp->status4 & AR_2040) ? RX_ENC_FLAG_40MHZ : 0;
|
||||
|
||||
rxs->evm0 = rxsp->status6;
|
||||
rxs->evm1 = rxsp->status7;
|
||||
|
@@ -181,14 +181,13 @@ int ath9k_cmn_process_rate(struct ath_common *common,
|
||||
sband = hw->wiphy->bands[band];
|
||||
|
||||
if (IS_CHAN_QUARTER_RATE(ah->curchan))
|
||||
rxs->flag |= RX_FLAG_5MHZ;
|
||||
rxs->enc_flags |= RX_ENC_FLAG_5MHZ;
|
||||
else if (IS_CHAN_HALF_RATE(ah->curchan))
|
||||
rxs->flag |= RX_FLAG_10MHZ;
|
||||
rxs->enc_flags |= RX_ENC_FLAG_10MHZ;
|
||||
|
||||
if (rx_stats->rs_rate & 0x80) {
|
||||
/* HT rate */
|
||||
rxs->flag |= RX_FLAG_HT;
|
||||
rxs->flag |= rx_stats->flag;
|
||||
rxs->enc_flags |= RX_ENC_FLAG_HT | rx_stats->enc_flags;
|
||||
rxs->rate_idx = rx_stats->rs_rate & 0x7f;
|
||||
return 0;
|
||||
}
|
||||
@@ -199,7 +198,7 @@ int ath9k_cmn_process_rate(struct ath_common *common,
|
||||
return 0;
|
||||
}
|
||||
if (sband->bitrates[i].hw_value_short == rx_stats->rs_rate) {
|
||||
rxs->flag |= RX_FLAG_SHORTPRE;
|
||||
rxs->enc_flags |= RX_ENC_FLAG_SHORTPRE;
|
||||
rxs->rate_idx = i;
|
||||
return 0;
|
||||
}
|
||||
|
@@ -116,12 +116,12 @@ void ath_debug_rate_stats(struct ath_softc *sc,
|
||||
if (rxs->rate_idx >= ARRAY_SIZE(rstats->ht_stats))
|
||||
goto exit;
|
||||
|
||||
if (rxs->flag & RX_FLAG_40MHZ)
|
||||
if (rxs->enc_flags & RX_ENC_FLAG_40MHZ)
|
||||
rstats->ht_stats[rxs->rate_idx].ht40_cnt++;
|
||||
else
|
||||
rstats->ht_stats[rxs->rate_idx].ht20_cnt++;
|
||||
|
||||
if (rxs->flag & RX_FLAG_SHORT_GI)
|
||||
if (rxs->enc_flags & RX_ENC_FLAG_SHORT_GI)
|
||||
rstats->ht_stats[rxs->rate_idx].sgi_cnt++;
|
||||
else
|
||||
rstats->ht_stats[rxs->rate_idx].lgi_cnt++;
|
||||
@@ -130,7 +130,7 @@ void ath_debug_rate_stats(struct ath_softc *sc,
|
||||
}
|
||||
|
||||
if (IS_CCK_RATE(rs->rs_rate)) {
|
||||
if (rxs->flag & RX_FLAG_SHORTPRE)
|
||||
if (rxs->enc_flags & RX_ENC_FLAG_SHORTPRE)
|
||||
rstats->cck_stats[rxs->rate_idx].cck_sp_cnt++;
|
||||
else
|
||||
rstats->cck_stats[rxs->rate_idx].cck_lp_cnt++;
|
||||
|
@@ -929,11 +929,11 @@ void ath9k_host_rx_init(struct ath9k_htc_priv *priv)
|
||||
static inline void convert_htc_flag(struct ath_rx_status *rx_stats,
|
||||
struct ath_htc_rx_status *rxstatus)
|
||||
{
|
||||
rx_stats->flag = 0;
|
||||
rx_stats->enc_flags = 0;
|
||||
if (rxstatus->rs_flags & ATH9K_RX_2040)
|
||||
rx_stats->flag |= RX_FLAG_40MHZ;
|
||||
rx_stats->enc_flags |= RX_ENC_FLAG_40MHZ;
|
||||
if (rxstatus->rs_flags & ATH9K_RX_GI)
|
||||
rx_stats->flag |= RX_FLAG_SHORT_GI;
|
||||
rx_stats->enc_flags |= RX_ENC_FLAG_SHORT_GI;
|
||||
}
|
||||
|
||||
static void rx_status_htc_to_ath(struct ath_rx_status *rx_stats,
|
||||
|
@@ -535,7 +535,7 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
|
||||
|
||||
rs->rs_status = 0;
|
||||
rs->rs_flags = 0;
|
||||
rs->flag = 0;
|
||||
rs->enc_flags = 0;
|
||||
|
||||
rs->rs_datalen = ads.ds_rxstatus1 & AR_DataLen;
|
||||
rs->rs_tstamp = ads.AR_RcvTimestamp;
|
||||
@@ -577,15 +577,15 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
|
||||
rs->rs_antenna = MS(ads.ds_rxstatus3, AR_RxAntenna);
|
||||
|
||||
/* directly mapped flags for ieee80211_rx_status */
|
||||
rs->flag |=
|
||||
(ads.ds_rxstatus3 & AR_GI) ? RX_FLAG_SHORT_GI : 0;
|
||||
rs->flag |=
|
||||
(ads.ds_rxstatus3 & AR_2040) ? RX_FLAG_40MHZ : 0;
|
||||
rs->enc_flags |=
|
||||
(ads.ds_rxstatus3 & AR_GI) ? RX_ENC_FLAG_SHORT_GI : 0;
|
||||
rs->enc_flags |=
|
||||
(ads.ds_rxstatus3 & AR_2040) ? RX_ENC_FLAG_40MHZ : 0;
|
||||
if (AR_SREV_9280_20_OR_LATER(ah))
|
||||
rs->flag |=
|
||||
rs->enc_flags |=
|
||||
(ads.ds_rxstatus3 & AR_STBC) ?
|
||||
/* we can only Nss=1 STBC */
|
||||
(1 << RX_FLAG_STBC_SHIFT) : 0;
|
||||
(1 << RX_ENC_FLAG_STBC_SHIFT) : 0;
|
||||
|
||||
if (ads.ds_rxstatus8 & AR_PreDelimCRCErr)
|
||||
rs->rs_flags |= ATH9K_RX_DELIM_CRC_PRE;
|
||||
|
@@ -143,7 +143,7 @@ struct ath_rx_status {
|
||||
u32 evm2;
|
||||
u32 evm3;
|
||||
u32 evm4;
|
||||
u32 flag; /* see enum mac80211_rx_flags */
|
||||
u16 enc_flags;
|
||||
};
|
||||
|
||||
struct ath_htc_rx_status {
|
||||
|
@@ -1037,11 +1037,11 @@ static void ath_rx_count_airtime(struct ath_softc *sc,
|
||||
|
||||
rxs = IEEE80211_SKB_RXCB(skb);
|
||||
|
||||
is_sgi = !!(rxs->flag & RX_FLAG_SHORT_GI);
|
||||
is_40 = !!(rxs->flag & RX_FLAG_40MHZ);
|
||||
is_sp = !!(rxs->flag & RX_FLAG_SHORTPRE);
|
||||
is_sgi = !!(rxs->enc_flags & RX_ENC_FLAG_SHORT_GI);
|
||||
is_40 = !!(rxs->enc_flags & RX_ENC_FLAG_40MHZ);
|
||||
is_sp = !!(rxs->enc_flags & RX_ENC_FLAG_SHORTPRE);
|
||||
|
||||
if (!!(rxs->flag & RX_FLAG_HT)) {
|
||||
if (!!(rxs->enc_flags & RX_ENC_FLAG_HT)) {
|
||||
/* MCS rates */
|
||||
|
||||
airtime += ath_pkt_duration(sc, rxs->rate_idx, len,
|
||||
|
Reference in New Issue
Block a user