]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/mac80211/sta_info.c
mac80211: Support the new cfg80211 TXQ stats API
[linux.git] / net / mac80211 / sta_info.c
index af0b608ee8ed11bdab91a163e4f8e8036f991185..43f34aa873bcd88d92da1721e57356551c52ddcc 100644 (file)
@@ -3,6 +3,7 @@
  * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
  * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
+ * Copyright (C) 2018 Intel Corporation
  *
  * 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
@@ -357,6 +358,7 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
 
        sta->last_connected = ktime_get_seconds();
        ewma_signal_init(&sta->rx_stats_avg.signal);
+       ewma_avg_signal_init(&sta->status_stats.avg_ack_signal);
        for (i = 0; i < ARRAY_SIZE(sta->rx_stats_avg.chain_signal); i++)
                ewma_signal_init(&sta->rx_stats_avg.chain_signal[i]);
 
@@ -1992,7 +1994,6 @@ static void sta_stats_decode_rate(struct ieee80211_local *local, u16 rate,
                int band = STA_STATS_GET(LEGACY_BAND, rate);
                int rate_idx = STA_STATS_GET(LEGACY_IDX, rate);
 
-               rinfo->flags = 0;
                sband = local->hw.wiphy->bands[band];
                brate = sband->bitrates[rate_idx].bitrate;
                if (rinfo->bw == RATE_INFO_BW_5)
@@ -2051,6 +2052,18 @@ static void sta_set_tidstats(struct sta_info *sta,
                tidstats->filled |= BIT(NL80211_TID_STATS_TX_MSDU_FAILED);
                tidstats->tx_msdu_failed = sta->status_stats.msdu_failed[tid];
        }
+
+       if (local->ops->wake_tx_queue && tid < IEEE80211_NUM_TIDS) {
+               spin_lock_bh(&local->fq.lock);
+               rcu_read_lock();
+
+               tidstats->filled |= BIT(NL80211_TID_STATS_TXQ_STATS);
+               ieee80211_fill_txq_stats(&tidstats->txq_stats,
+                                        to_txq_info(sta->sta.txq[tid]));
+
+               rcu_read_unlock();
+               spin_unlock_bh(&local->fq.lock);
+       }
 }
 
 static inline u64 sta_get_stats_bytes(struct ieee80211_sta_rx_stats *rxstats)
@@ -2288,6 +2301,21 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
                sinfo->filled |= BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT);
                sinfo->expected_throughput = thr;
        }
+
+       if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL)) &&
+           sta->status_stats.ack_signal_filled) {
+               sinfo->ack_signal = sta->status_stats.last_ack_signal;
+               sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL);
+       }
+
+       if (ieee80211_hw_check(&sta->local->hw, REPORTS_TX_ACK_STATUS) &&
+           !(sinfo->filled & BIT_ULL(NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG))) {
+               sinfo->avg_ack_signal =
+                       -(s8)ewma_avg_signal_read(
+                               &sta->status_stats.avg_ack_signal);
+               sinfo->filled |=
+                       BIT_ULL(NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG);
+       }
 }
 
 u32 sta_get_expected_throughput(struct sta_info *sta)