mac80211: move beacon_loss_count into ifmgd
authorJohannes Berg <johannes.berg@intel.com>
Fri, 16 Oct 2015 15:18:11 +0000 (17:18 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 21 Oct 2015 08:08:21 +0000 (10:08 +0200)
There's little point in keeping (and even sending to userspace)
the beacon_loss_count value per station, since it can only apply
to the AP on a managed-mode connection. Move the value to ifmgd,
advertise it only in managed mode, and remove it from ethtool as
it's available through better interfaces.

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

index 188faab11c24573397b16296af97568afcd206cd..3fbf9c308ec58e854da00d822be93a85e9ead502 100644 (file)
@@ -40,7 +40,7 @@ static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = {
        "rx_duplicates", "rx_fragments", "rx_dropped",
        "tx_packets", "tx_bytes",
        "tx_filtered", "tx_retry_failed", "tx_retries",
-       "beacon_loss", "sta_state", "txrate", "rxrate", "signal",
+       "sta_state", "txrate", "rxrate", "signal",
        "channel", "noise", "ch_time", "ch_time_busy",
        "ch_time_ext_busy", "ch_time_rx", "ch_time_tx"
 };
@@ -90,7 +90,6 @@ static void ieee80211_get_stats(struct net_device *dev,
                data[i++] += sta->tx_filtered_count;    \
                data[i++] += sta->tx_retry_failed;      \
                data[i++] += sta->tx_retry_count;       \
-               data[i++] += sta->beacon_loss_count;    \
        } while (0)
 
        /* For Managed stations, find the single station based on BSSID
index 056d3721148c6a36fe3294d84a28c565844e697c..62f2a97cd2a69632abd74cd936ee2e2e702c41dc 100644 (file)
@@ -503,6 +503,9 @@ struct ieee80211_if_managed {
         */
        unsigned int count_beacon_signal;
 
+       /* Number of times beacon loss was invoked. */
+       unsigned int beacon_loss_count;
+
        /*
         * Last Beacon frame signal strength average (ave_beacon_signal / 16)
         * that triggered a cqm event. 0 indicates that no event has been
index 6158db06a5b57961a1ecdaef532a206b03faa3f1..ded4b976bb48097ef7941c74baf43a15c8772eaa 100644 (file)
@@ -2420,15 +2420,9 @@ static void ieee80211_beacon_connection_loss_work(struct work_struct *work)
                container_of(work, struct ieee80211_sub_if_data,
                             u.mgd.beacon_connection_loss_work);
        struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
-       struct sta_info *sta;
 
-       if (ifmgd->associated) {
-               rcu_read_lock();
-               sta = sta_info_get(sdata, ifmgd->bssid);
-               if (sta)
-                       sta->beacon_loss_count++;
-               rcu_read_unlock();
-       }
+       if (ifmgd->associated)
+               ifmgd->beacon_loss_count++;
 
        if (ifmgd->connection_loss) {
                sdata_info(sdata, "Connection to AP %pM lost\n",
index 7f2c4f2acadfa300de25aeb2648acc2281e730f0..0b8dd1cca6d82fd491bcbc7dc71b845ab7aa856e 100644 (file)
@@ -1871,8 +1871,12 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
                         BIT(NL80211_STA_INFO_STA_FLAGS) |
                         BIT(NL80211_STA_INFO_BSS_PARAM) |
                         BIT(NL80211_STA_INFO_CONNECTED_TIME) |
-                        BIT(NL80211_STA_INFO_RX_DROP_MISC) |
-                        BIT(NL80211_STA_INFO_BEACON_LOSS);
+                        BIT(NL80211_STA_INFO_RX_DROP_MISC);
+
+       if (sdata->vif.type == NL80211_IFTYPE_STATION) {
+               sinfo->beacon_loss_count = sdata->u.mgd.beacon_loss_count;
+               sinfo->filled |= BIT(NL80211_STA_INFO_BEACON_LOSS);
+       }
 
        sinfo->connected_time = ktime_get_seconds() - sta->last_connected;
        sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
@@ -1914,7 +1918,6 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
        }
 
        sinfo->rx_dropped_misc = sta->rx_dropped;
-       sinfo->beacon_loss_count = sta->beacon_loss_count;
 
        if (sdata->vif.type == NL80211_IFTYPE_STATION &&
            !(sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER)) {
index 7bb5781b4ce2e6b5424c6ade9bc6f696a1452ec7..3a401d40c3297393b3b00336aaec1fa59ed9109c 100644 (file)
@@ -508,7 +508,6 @@ struct sta_info {
        enum ieee80211_sta_rx_bandwidth cur_max_bandwidth;
 
        unsigned int lost_packets;
-       unsigned int beacon_loss_count;
 
        enum ieee80211_smps_mode known_smps_mode;
        const struct ieee80211_cipher_scheme *cipher_scheme;