Skip to content

Commit 976bd9e

Browse files
committed
mac80211: move beacon_loss_count into ifmgd
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>
1 parent 763aa27 commit 976bd9e

File tree

5 files changed

+12
-14
lines changed

5 files changed

+12
-14
lines changed

net/mac80211/ethtool.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = {
4040
"rx_duplicates", "rx_fragments", "rx_dropped",
4141
"tx_packets", "tx_bytes",
4242
"tx_filtered", "tx_retry_failed", "tx_retries",
43-
"beacon_loss", "sta_state", "txrate", "rxrate", "signal",
43+
"sta_state", "txrate", "rxrate", "signal",
4444
"channel", "noise", "ch_time", "ch_time_busy",
4545
"ch_time_ext_busy", "ch_time_rx", "ch_time_tx"
4646
};
@@ -90,7 +90,6 @@ static void ieee80211_get_stats(struct net_device *dev,
9090
data[i++] += sta->tx_filtered_count; \
9191
data[i++] += sta->tx_retry_failed; \
9292
data[i++] += sta->tx_retry_count; \
93-
data[i++] += sta->beacon_loss_count; \
9493
} while (0)
9594

9695
/* For Managed stations, find the single station based on BSSID

net/mac80211/ieee80211_i.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,9 @@ struct ieee80211_if_managed {
503503
*/
504504
unsigned int count_beacon_signal;
505505

506+
/* Number of times beacon loss was invoked. */
507+
unsigned int beacon_loss_count;
508+
506509
/*
507510
* Last Beacon frame signal strength average (ave_beacon_signal / 16)
508511
* that triggered a cqm event. 0 indicates that no event has been

net/mac80211/mlme.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2420,15 +2420,9 @@ static void ieee80211_beacon_connection_loss_work(struct work_struct *work)
24202420
container_of(work, struct ieee80211_sub_if_data,
24212421
u.mgd.beacon_connection_loss_work);
24222422
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
2423-
struct sta_info *sta;
24242423

2425-
if (ifmgd->associated) {
2426-
rcu_read_lock();
2427-
sta = sta_info_get(sdata, ifmgd->bssid);
2428-
if (sta)
2429-
sta->beacon_loss_count++;
2430-
rcu_read_unlock();
2431-
}
2424+
if (ifmgd->associated)
2425+
ifmgd->beacon_loss_count++;
24322426

24332427
if (ifmgd->connection_loss) {
24342428
sdata_info(sdata, "Connection to AP %pM lost\n",

net/mac80211/sta_info.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,8 +1871,12 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
18711871
BIT(NL80211_STA_INFO_STA_FLAGS) |
18721872
BIT(NL80211_STA_INFO_BSS_PARAM) |
18731873
BIT(NL80211_STA_INFO_CONNECTED_TIME) |
1874-
BIT(NL80211_STA_INFO_RX_DROP_MISC) |
1875-
BIT(NL80211_STA_INFO_BEACON_LOSS);
1874+
BIT(NL80211_STA_INFO_RX_DROP_MISC);
1875+
1876+
if (sdata->vif.type == NL80211_IFTYPE_STATION) {
1877+
sinfo->beacon_loss_count = sdata->u.mgd.beacon_loss_count;
1878+
sinfo->filled |= BIT(NL80211_STA_INFO_BEACON_LOSS);
1879+
}
18761880

18771881
sinfo->connected_time = ktime_get_seconds() - sta->last_connected;
18781882
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)
19141918
}
19151919

19161920
sinfo->rx_dropped_misc = sta->rx_dropped;
1917-
sinfo->beacon_loss_count = sta->beacon_loss_count;
19181921

19191922
if (sdata->vif.type == NL80211_IFTYPE_STATION &&
19201923
!(sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER)) {

net/mac80211/sta_info.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,6 @@ struct sta_info {
508508
enum ieee80211_sta_rx_bandwidth cur_max_bandwidth;
509509

510510
unsigned int lost_packets;
511-
unsigned int beacon_loss_count;
512511

513512
enum ieee80211_smps_mode known_smps_mode;
514513
const struct ieee80211_cipher_scheme *cipher_scheme;

0 commit comments

Comments
 (0)