{
struct ath11k_base *ab = ar->ab;
struct ath11k_per_peer_tx_stats *peer_stats = &ar->cached_stats;
+ enum hal_tx_rate_stats_pkt_type pkt_type;
+ enum hal_tx_rate_stats_sgi sgi;
+ enum hal_tx_rate_stats_bw bw;
struct ath11k_peer *peer;
struct ath11k_sta *arsta;
struct ieee80211_sta *sta;
u16 rate;
u8 rate_idx;
int ret;
+ u8 mcs;
rcu_read_lock();
spin_lock_bh(&ab->base_lock);
arsta = (struct ath11k_sta *)sta->drv_priv;
memset(&arsta->txrate, 0, sizeof(arsta->txrate));
-
- if (ts->pkt_type == HAL_TX_RATE_STATS_PKT_TYPE_11A ||
- ts->pkt_type == HAL_TX_RATE_STATS_PKT_TYPE_11B) {
- ret = ath11k_mac_hw_ratecode_to_legacy_rate(ts->mcs,
- ts->pkt_type,
+ pkt_type = FIELD_GET(HAL_TX_RATE_STATS_INFO0_PKT_TYPE,
+ ts->rate_stats);
+ mcs = FIELD_GET(HAL_TX_RATE_STATS_INFO0_MCS,
+ ts->rate_stats);
+ sgi = FIELD_GET(HAL_TX_RATE_STATS_INFO0_SGI,
+ ts->rate_stats);
+ bw = FIELD_GET(HAL_TX_RATE_STATS_INFO0_BW, ts->rate_stats);
+
+ if (pkt_type == HAL_TX_RATE_STATS_PKT_TYPE_11A ||
+ pkt_type == HAL_TX_RATE_STATS_PKT_TYPE_11B) {
+ ret = ath11k_mac_hw_ratecode_to_legacy_rate(mcs,
+ pkt_type,
&rate_idx,
&rate);
- if (ret < 0) {
- spin_unlock_bh(&ab->base_lock);
- rcu_read_unlock();
- return;
- }
+ if (ret < 0)
+ goto err_out;
arsta->txrate.legacy = rate;
- } else if (ts->pkt_type == HAL_TX_RATE_STATS_PKT_TYPE_11N) {
- if (ts->mcs > 7) {
- ath11k_warn(ab, "Invalid HT mcs index %d\n", ts->mcs);
- spin_unlock_bh(&ab->base_lock);
- rcu_read_unlock();
- return;
+ } else if (pkt_type == HAL_TX_RATE_STATS_PKT_TYPE_11N) {
+ if (mcs > 7) {
+ ath11k_warn(ab, "Invalid HT mcs index %d\n", mcs);
+ goto err_out;
}
- arsta->txrate.mcs = ts->mcs + 8 * (arsta->last_txrate.nss - 1);
+ arsta->txrate.mcs = mcs + 8 * (arsta->last_txrate.nss - 1);
arsta->txrate.flags = RATE_INFO_FLAGS_MCS;
- if (ts->sgi)
+ if (sgi)
arsta->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI;
- } else if (ts->pkt_type == HAL_TX_RATE_STATS_PKT_TYPE_11AC) {
- if (ts->mcs > 9) {
- ath11k_warn(ab, "Invalid VHT mcs index %d\n", ts->mcs);
- spin_unlock_bh(&ab->base_lock);
- rcu_read_unlock();
- return;
+ } else if (pkt_type == HAL_TX_RATE_STATS_PKT_TYPE_11AC) {
+ if (mcs > 9) {
+ ath11k_warn(ab, "Invalid VHT mcs index %d\n", mcs);
+ goto err_out;
}
- arsta->txrate.mcs = ts->mcs;
+ arsta->txrate.mcs = mcs;
arsta->txrate.flags = RATE_INFO_FLAGS_VHT_MCS;
- if (ts->sgi)
+ if (sgi)
arsta->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI;
- } else {
- /*TODO: update HE rates */
+ } else if (pkt_type == HAL_TX_RATE_STATS_PKT_TYPE_11AX) {
+ /* TODO */
}
arsta->txrate.nss = arsta->last_txrate.nss;
- arsta->txrate.bw = ath11k_mac_bw_to_mac80211_bw(ts->bw);
+ arsta->txrate.bw = ath11k_mac_bw_to_mac80211_bw(bw);
ath11k_accumulate_per_peer_tx_stats(arsta, peer_stats, rate_idx);
+err_out:
spin_unlock_bh(&ab->base_lock);
rcu_read_unlock();
}
if (!(desc->rate_stats.info0 & HAL_TX_RATE_STATS_INFO0_VALID))
return;
- ts->flags |= HAL_TX_STATUS_FLAGS_RATE_STATS_VALID;
- ts->tsf = desc->rate_stats.tsf;
- ts->bw = FIELD_GET(HAL_TX_RATE_STATS_INFO0_BW, desc->rate_stats.info0);
- ts->pkt_type = FIELD_GET(HAL_TX_RATE_STATS_INFO0_PKT_TYPE,
- desc->rate_stats.info0);
- if (desc->rate_stats.info0 & HAL_TX_RATE_STATS_INFO0_STBC)
- ts->flags |= HAL_TX_STATUS_FLAGS_RATE_STBC;
- if (desc->rate_stats.info0 & HAL_TX_RATE_STATS_INFO0_LDPC)
- ts->flags |= HAL_TX_STATUS_FLAGS_RATE_LDPC;
- if (desc->rate_stats.info0 & HAL_TX_RATE_STATS_INFO0_OFDMA_TX)
- ts->flags |= HAL_TX_STATUS_FLAGS_OFDMA;
-
- ts->sgi = FIELD_GET(HAL_TX_RATE_STATS_INFO0_SGI,
- desc->rate_stats.info0);
- ts->mcs = FIELD_GET(HAL_TX_RATE_STATS_INFO0_MCS,
- desc->rate_stats.info0);
- ts->num_tones_in_ru = FIELD_GET(HAL_TX_RATE_STATS_INFO0_TONES_IN_RU,
- desc->rate_stats.info0);
+ ts->rate_stats = desc->rate_stats.info0;
}
void ath11k_hal_tx_set_dscp_tid_map(struct ath11k_base *ab, int id)