Commit a85e1d55974646a442d95911e3f7d7a891ea9ac5
Committed by
John W. Linville
1 parent
84381b4ed5
Exists in
master
and in
6 other branches
cfg80211: Return beacon loss count in station
If station info contains a beacon loss count, return it to userspace. Signed-off-by: Paul Stewart <pstew@chromium.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Showing 6 changed files with 24 additions and 2 deletions Side-by-side Diff
include/linux/nl80211.h
... | ... | @@ -1655,6 +1655,7 @@ |
1655 | 1655 | * containing info as possible, see &enum nl80211_sta_bss_param |
1656 | 1656 | * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected |
1657 | 1657 | * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update. |
1658 | + * @NL80211_STA_INFO_BEACON_LOSS: count of times beacon loss was detected (u32) | |
1658 | 1659 | * @__NL80211_STA_INFO_AFTER_LAST: internal |
1659 | 1660 | * @NL80211_STA_INFO_MAX: highest possible station info attribute |
1660 | 1661 | */ |
... | ... | @@ -1677,6 +1678,7 @@ |
1677 | 1678 | NL80211_STA_INFO_BSS_PARAM, |
1678 | 1679 | NL80211_STA_INFO_CONNECTED_TIME, |
1679 | 1680 | NL80211_STA_INFO_STA_FLAGS, |
1681 | + NL80211_STA_INFO_BEACON_LOSS, | |
1680 | 1682 | |
1681 | 1683 | /* keep last */ |
1682 | 1684 | __NL80211_STA_INFO_AFTER_LAST, |
include/net/cfg80211.h
... | ... | @@ -505,6 +505,7 @@ |
505 | 505 | * @STATION_INFO_CONNECTED_TIME: @connected_time filled |
506 | 506 | * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled |
507 | 507 | * @STATION_INFO_STA_FLAGS: @sta_flags filled |
508 | + * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled | |
508 | 509 | */ |
509 | 510 | enum station_info_flags { |
510 | 511 | STATION_INFO_INACTIVE_TIME = 1<<0, |
... | ... | @@ -525,7 +526,8 @@ |
525 | 526 | STATION_INFO_BSS_PARAM = 1<<15, |
526 | 527 | STATION_INFO_CONNECTED_TIME = 1<<16, |
527 | 528 | STATION_INFO_ASSOC_REQ_IES = 1<<17, |
528 | - STATION_INFO_STA_FLAGS = 1<<18 | |
529 | + STATION_INFO_STA_FLAGS = 1<<18, | |
530 | + STATION_INFO_BEACON_LOSS_COUNT = 1<<19 | |
529 | 531 | }; |
530 | 532 | |
531 | 533 | /** |
... | ... | @@ -623,6 +625,7 @@ |
623 | 625 | * the cfg80211_new_sta() calls to notify user space of the IEs. |
624 | 626 | * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. |
625 | 627 | * @sta_flags: station flags mask & values |
628 | + * @beacon_loss_count: Number of times beacon loss event has triggered. | |
626 | 629 | */ |
627 | 630 | struct station_info { |
628 | 631 | u32 filled; |
... | ... | @@ -649,6 +652,8 @@ |
649 | 652 | |
650 | 653 | const u8 *assoc_req_ies; |
651 | 654 | size_t assoc_req_ies_len; |
655 | + | |
656 | + u32 beacon_loss_count; | |
652 | 657 | |
653 | 658 | /* |
654 | 659 | * Note: Add a new enum station_info_flags value for each new field and |
net/mac80211/cfg.c
... | ... | @@ -355,7 +355,8 @@ |
355 | 355 | STATION_INFO_RX_DROP_MISC | |
356 | 356 | STATION_INFO_BSS_PARAM | |
357 | 357 | STATION_INFO_CONNECTED_TIME | |
358 | - STATION_INFO_STA_FLAGS; | |
358 | + STATION_INFO_STA_FLAGS | | |
359 | + STATION_INFO_BEACON_LOSS_COUNT; | |
359 | 360 | |
360 | 361 | do_posix_clock_monotonic_gettime(&uptime); |
361 | 362 | sinfo->connected_time = uptime.tv_sec - sta->last_connected; |
... | ... | @@ -368,6 +369,7 @@ |
368 | 369 | sinfo->tx_retries = sta->tx_retry_count; |
369 | 370 | sinfo->tx_failed = sta->tx_retry_failed; |
370 | 371 | sinfo->rx_dropped_misc = sta->rx_dropped; |
372 | + sinfo->beacon_loss_count = sta->beacon_loss_count; | |
371 | 373 | |
372 | 374 | if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) || |
373 | 375 | (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) { |
net/mac80211/mlme.c
... | ... | @@ -1381,6 +1381,14 @@ |
1381 | 1381 | struct ieee80211_sub_if_data *sdata = |
1382 | 1382 | container_of(work, struct ieee80211_sub_if_data, |
1383 | 1383 | u.mgd.beacon_connection_loss_work); |
1384 | + struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | |
1385 | + struct sta_info *sta; | |
1386 | + | |
1387 | + if (ifmgd->associated) { | |
1388 | + sta = sta_info_get(sdata, ifmgd->bssid); | |
1389 | + if (sta) | |
1390 | + sta->beacon_loss_count++; | |
1391 | + } | |
1384 | 1392 | |
1385 | 1393 | if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) |
1386 | 1394 | __ieee80211_connection_loss(sdata); |
net/mac80211/sta_info.h
... | ... | @@ -275,6 +275,7 @@ |
275 | 275 | * EAP frames before association |
276 | 276 | * @sta: station information we share with the driver |
277 | 277 | * @sta_state: duplicates information about station state (for debug) |
278 | + * @beacon_loss_count: number of times beacon loss has triggered | |
278 | 279 | */ |
279 | 280 | struct sta_info { |
280 | 281 | /* General information, mostly static */ |
... | ... | @@ -367,6 +368,7 @@ |
367 | 368 | #endif |
368 | 369 | |
369 | 370 | unsigned int lost_packets; |
371 | + unsigned int beacon_loss_count; | |
370 | 372 | |
371 | 373 | /* should be right in front of sta to be in the same cache line */ |
372 | 374 | bool dummy; |
net/wireless/nl80211.c
... | ... | @@ -2390,6 +2390,9 @@ |
2390 | 2390 | if (sinfo->filled & STATION_INFO_TX_FAILED) |
2391 | 2391 | NLA_PUT_U32(msg, NL80211_STA_INFO_TX_FAILED, |
2392 | 2392 | sinfo->tx_failed); |
2393 | + if (sinfo->filled & STATION_INFO_BEACON_LOSS_COUNT) | |
2394 | + NLA_PUT_U32(msg, NL80211_STA_INFO_BEACON_LOSS, | |
2395 | + sinfo->beacon_loss_count); | |
2393 | 2396 | if (sinfo->filled & STATION_INFO_BSS_PARAM) { |
2394 | 2397 | bss_param = nla_nest_start(msg, NL80211_STA_INFO_BSS_PARAM); |
2395 | 2398 | if (!bss_param) |