mac80211: add assoc-at support
authorBen Greear <greearb@candelatech.com>
Fri, 9 Aug 2019 18:00:01 +0000 (11:00 -0700)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 21 Aug 2019 08:58:10 +0000 (10:58 +0200)
Report timestamp for when sta becomes associated.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Link: https://lore.kernel.org/r/20190809180001.26393-2-greearb@candelatech.com
[fix ktime_get_boot_ns() to ktime_get_boottime_ns(), assoc_at type to u64]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/sta_info.c
net/mac80211/sta_info.h

index fb6614f57cbce1fc73831d8a303c634a379e1688..df553070206c90e27de5b9f19e09724d1386ed5b 100644 (file)
@@ -1961,6 +1961,7 @@ int sta_info_move_state(struct sta_info *sta,
        case IEEE80211_STA_ASSOC:
                if (sta->sta_state == IEEE80211_STA_AUTH) {
                        set_bit(WLAN_STA_ASSOC, &sta->_flags);
+                       sta->assoc_at = ktime_get_boottime_ns();
                        ieee80211_recalc_min_chandef(sta->sdata);
                        if (!sta->sta.support_p2p_ps)
                                ieee80211_recalc_p2p_go_ps_allowed(sta->sdata);
@@ -2190,6 +2191,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
                         BIT_ULL(NL80211_STA_INFO_STA_FLAGS) |
                         BIT_ULL(NL80211_STA_INFO_BSS_PARAM) |
                         BIT_ULL(NL80211_STA_INFO_CONNECTED_TIME) |
+                        BIT_ULL(NL80211_STA_INFO_ASSOC_AT_BOOTTIME) |
                         BIT_ULL(NL80211_STA_INFO_RX_DROP_MISC);
 
        if (sdata->vif.type == NL80211_IFTYPE_STATION) {
@@ -2198,6 +2200,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
        }
 
        sinfo->connected_time = ktime_get_seconds() - sta->last_connected;
+       sinfo->assoc_at = sta->assoc_at;
        sinfo->inactive_time =
                jiffies_to_msecs(jiffies - ieee80211_sta_last_active(sta));
 
index 3260d4234920e65e744cc84028366d34dd524398..369c2dddce528358351ec25bf9a5c8952e116fa8 100644 (file)
@@ -466,6 +466,7 @@ struct ieee80211_sta_rx_stats {
  *     the station when it leaves powersave or polls for frames
  * @driver_buffered_tids: bitmap of TIDs the driver has data buffered on
  * @txq_buffered_tids: bitmap of TIDs that mac80211 has txq data buffered on
+ * @assoc_at: clock boottime (in ns) of last association
  * @last_connected: time (in seconds) when a station got connected
  * @last_seq_ctrl: last received seq/frag number from this STA (per TID
  *     plus one for non-QoS frames)
@@ -562,6 +563,7 @@ struct sta_info {
        unsigned long driver_buffered_tids;
        unsigned long txq_buffered_tids;
 
+       u64 assoc_at;
        long last_connected;
 
        /* Updated from RX path only, no locking requirements */