mac80211: move averaged values out of rx_stats
authorJohannes Berg <johannes.berg@intel.com>
Thu, 31 Mar 2016 17:02:05 +0000 (20:02 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 6 Apr 2016 11:18:15 +0000 (13:18 +0200)
Move the averaged values out of rx_stats and into rx_stats_avg,
to cleanly split them out. The averaged ones cannot be supported
for parallel RX in a per-CPU fashion, while the other values can
be collected per CPU and then combined/selected when needed.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/mesh_plink.c
net/mac80211/rx.c
net/mac80211/sta_info.c
net/mac80211/sta_info.h

index ecfba8ad29e472ea74b32137b2654cece549f9b1..563bea050383892a752a9c36d8bf008a39afb2ae 100644 (file)
@@ -61,7 +61,7 @@ static bool rssi_threshold_check(struct ieee80211_sub_if_data *sdata,
        s32 rssi_threshold = sdata->u.mesh.mshcfg.rssi_threshold;
        return rssi_threshold == 0 ||
               (sta &&
-               (s8)-ewma_signal_read(&sta->rx_stats.avg_signal) >
+               (s8)-ewma_signal_read(&sta->rx_stats_avg.signal) >
                                                rssi_threshold);
 }
 
index 570ae3d03ae1f3531d1b1db4833a43e04afcb235..d14c66df9e86942bc0b6b1551b6ef66426bcb8e3 100644 (file)
@@ -1455,7 +1455,7 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
        sta->rx_stats.bytes += rx->skb->len;
        if (!(status->flag & RX_FLAG_NO_SIGNAL_VAL)) {
                sta->rx_stats.last_signal = status->signal;
-               ewma_signal_add(&sta->rx_stats.avg_signal, -status->signal);
+               ewma_signal_add(&sta->rx_stats_avg.signal, -status->signal);
        }
 
        if (status->chains) {
@@ -1467,7 +1467,7 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
                                continue;
 
                        sta->rx_stats.chain_signal_last[i] = signal;
-                       ewma_signal_add(&sta->rx_stats.chain_signal_avg[i],
+                       ewma_signal_add(&sta->rx_stats_avg.chain_signal[i],
                                        -signal);
                }
        }
index 01e070c6e713f9be420397a7ebd31ae15ebd592b..4f19505f375704c248f71bc416e0ae3c852fb8d4 100644 (file)
@@ -341,9 +341,9 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
        sta->reserved_tid = IEEE80211_TID_UNRESERVED;
 
        sta->last_connected = ktime_get_seconds();
-       ewma_signal_init(&sta->rx_stats.avg_signal);
-       for (i = 0; i < ARRAY_SIZE(sta->rx_stats.chain_signal_avg); i++)
-               ewma_signal_init(&sta->rx_stats.chain_signal_avg[i]);
+       ewma_signal_init(&sta->rx_stats_avg.signal);
+       for (i = 0; i < ARRAY_SIZE(sta->rx_stats_avg.chain_signal); i++)
+               ewma_signal_init(&sta->rx_stats_avg.chain_signal[i]);
 
        if (local->ops->wake_tx_queue) {
                void *txq_data;
@@ -2056,7 +2056,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
 
                if (!(sinfo->filled & BIT(NL80211_STA_INFO_SIGNAL_AVG))) {
                        sinfo->signal_avg =
-                               -ewma_signal_read(&sta->rx_stats.avg_signal);
+                               -ewma_signal_read(&sta->rx_stats_avg.signal);
                        sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL_AVG);
                }
        }
@@ -2072,7 +2072,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
                        sinfo->chain_signal[i] =
                                sta->rx_stats.chain_signal_last[i];
                        sinfo->chain_signal_avg[i] =
-                               -ewma_signal_read(&sta->rx_stats.chain_signal_avg[i]);
+                               -ewma_signal_read(&sta->rx_stats_avg.chain_signal[i]);
                }
        }
 
index 4e1ed6f2648461f63cd3765e3ea76e5782ebeda8..93dc567e6100a318453c7b69afa2f05f9a1f5abf 100644 (file)
@@ -450,16 +450,18 @@ struct sta_info {
                unsigned long fragments;
                unsigned long dropped;
                int last_signal;
-               struct ewma_signal avg_signal;
                u8 chains;
                s8 chain_signal_last[IEEE80211_MAX_CHAINS];
-               struct ewma_signal chain_signal_avg[IEEE80211_MAX_CHAINS];
                int last_rate_idx;
                u32 last_rate_flag;
                u32 last_rate_vht_flag;
                u8 last_rate_vht_nss;
                u64 msdu[IEEE80211_NUM_TIDS + 1];
        } rx_stats;
+       struct {
+               struct ewma_signal signal;
+               struct ewma_signal chain_signal[IEEE80211_MAX_CHAINS];
+       } rx_stats_avg;
 
        /* Plus 1 for non-QoS frames */
        __le16 last_seq_ctrl[IEEE80211_NUM_TIDS + 1];