sta_info.c (4f6b1b3daaf167bf927174224e07efd17ed95984) sta_info.c (0f9c5a61d4b2330b12c59126aa5a9108dbfce555)
1/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
4 * Copyright 2013-2014 Intel Mobile Communications GmbH
5 * Copyright (C) 2015 - 2016 Intel Deutschland GmbH
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 321 unchanged lines hidden (view full) ---

330#endif
331
332 memcpy(sta->addr, addr, ETH_ALEN);
333 memcpy(sta->sta.addr, addr, ETH_ALEN);
334 sta->local = local;
335 sta->sdata = sdata;
336 sta->rx_stats.last_rx = jiffies;
337
1/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
4 * Copyright 2013-2014 Intel Mobile Communications GmbH
5 * Copyright (C) 2015 - 2016 Intel Deutschland GmbH
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 321 unchanged lines hidden (view full) ---

330#endif
331
332 memcpy(sta->addr, addr, ETH_ALEN);
333 memcpy(sta->sta.addr, addr, ETH_ALEN);
334 sta->local = local;
335 sta->sdata = sdata;
336 sta->rx_stats.last_rx = jiffies;
337
338 u64_stats_init(&sta->rx_stats.syncp);
339
338 sta->sta_state = IEEE80211_STA_NONE;
339
340 /* Mark TID as unreserved */
341 sta->reserved_tid = IEEE80211_TID_UNRESERVED;
342
343 sta->last_connected = ktime_get_seconds();
344 ewma_signal_init(&sta->rx_stats_avg.signal);
345 for (i = 0; i < ARRAY_SIZE(sta->rx_stats_avg.chain_signal); i++)

--- 1620 unchanged lines hidden (view full) ---

1966 u16 rate = ACCESS_ONCE(sta->rx_stats.last_rate);
1967
1968 if (rate == STA_STATS_RATE_INVALID)
1969 rinfo->flags = 0;
1970 else
1971 sta_stats_decode_rate(sta->local, rate, rinfo);
1972}
1973
340 sta->sta_state = IEEE80211_STA_NONE;
341
342 /* Mark TID as unreserved */
343 sta->reserved_tid = IEEE80211_TID_UNRESERVED;
344
345 sta->last_connected = ktime_get_seconds();
346 ewma_signal_init(&sta->rx_stats_avg.signal);
347 for (i = 0; i < ARRAY_SIZE(sta->rx_stats_avg.chain_signal); i++)

--- 1620 unchanged lines hidden (view full) ---

1968 u16 rate = ACCESS_ONCE(sta->rx_stats.last_rate);
1969
1970 if (rate == STA_STATS_RATE_INVALID)
1971 rinfo->flags = 0;
1972 else
1973 sta_stats_decode_rate(sta->local, rate, rinfo);
1974}
1975
1976static void sta_set_tidstats(struct sta_info *sta,
1977 struct cfg80211_tid_stats *tidstats,
1978 int tid)
1979{
1980 struct ieee80211_local *local = sta->local;
1981
1982 if (!(tidstats->filled & BIT(NL80211_TID_STATS_RX_MSDU))) {
1983 unsigned int start;
1984
1985 do {
1986 start = u64_stats_fetch_begin(&sta->rx_stats.syncp);
1987 tidstats->rx_msdu = sta->rx_stats.msdu[tid];
1988 } while (u64_stats_fetch_retry(&sta->rx_stats.syncp, start));
1989
1990 tidstats->filled |= BIT(NL80211_TID_STATS_RX_MSDU);
1991 }
1992
1993 if (!(tidstats->filled & BIT(NL80211_TID_STATS_TX_MSDU))) {
1994 tidstats->filled |= BIT(NL80211_TID_STATS_TX_MSDU);
1995 tidstats->tx_msdu = sta->tx_stats.msdu[tid];
1996 }
1997
1998 if (!(tidstats->filled & BIT(NL80211_TID_STATS_TX_MSDU_RETRIES)) &&
1999 ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) {
2000 tidstats->filled |= BIT(NL80211_TID_STATS_TX_MSDU_RETRIES);
2001 tidstats->tx_msdu_retries = sta->status_stats.msdu_retries[tid];
2002 }
2003
2004 if (!(tidstats->filled & BIT(NL80211_TID_STATS_TX_MSDU_FAILED)) &&
2005 ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) {
2006 tidstats->filled |= BIT(NL80211_TID_STATS_TX_MSDU_FAILED);
2007 tidstats->tx_msdu_failed = sta->status_stats.msdu_failed[tid];
2008 }
2009}
2010
1974void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
1975{
1976 struct ieee80211_sub_if_data *sdata = sta->sdata;
1977 struct ieee80211_local *local = sdata->local;
1978 struct rate_control_ref *ref = NULL;
1979 u32 thr = 0;
1980 int i, ac;
1981

--- 38 unchanged lines hidden (view full) ---

2020 sinfo->tx_packets = 0;
2021 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
2022 sinfo->tx_packets += sta->tx_stats.packets[ac];
2023 sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS);
2024 }
2025
2026 if (!(sinfo->filled & (BIT(NL80211_STA_INFO_RX_BYTES64) |
2027 BIT(NL80211_STA_INFO_RX_BYTES)))) {
2011void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
2012{
2013 struct ieee80211_sub_if_data *sdata = sta->sdata;
2014 struct ieee80211_local *local = sdata->local;
2015 struct rate_control_ref *ref = NULL;
2016 u32 thr = 0;
2017 int i, ac;
2018

--- 38 unchanged lines hidden (view full) ---

2057 sinfo->tx_packets = 0;
2058 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
2059 sinfo->tx_packets += sta->tx_stats.packets[ac];
2060 sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS);
2061 }
2062
2063 if (!(sinfo->filled & (BIT(NL80211_STA_INFO_RX_BYTES64) |
2064 BIT(NL80211_STA_INFO_RX_BYTES)))) {
2028 sinfo->rx_bytes = sta->rx_stats.bytes;
2065 unsigned int start;
2066
2067 do {
2068 start = u64_stats_fetch_begin(&sta->rx_stats.syncp);
2069 sinfo->rx_bytes = sta->rx_stats.bytes;
2070 } while (u64_stats_fetch_retry(&sta->rx_stats.syncp, start));
2029 sinfo->filled |= BIT(NL80211_STA_INFO_RX_BYTES64);
2030 }
2031
2032 if (!(sinfo->filled & BIT(NL80211_STA_INFO_RX_PACKETS))) {
2033 sinfo->rx_packets = sta->rx_stats.packets;
2034 sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS);
2035 }
2036

--- 55 unchanged lines hidden (view full) ---

2092 sta_set_rate_info_rx(sta, &sinfo->rxrate);
2093 sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE);
2094 }
2095
2096 sinfo->filled |= BIT(NL80211_STA_INFO_TID_STATS);
2097 for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) {
2098 struct cfg80211_tid_stats *tidstats = &sinfo->pertid[i];
2099
2071 sinfo->filled |= BIT(NL80211_STA_INFO_RX_BYTES64);
2072 }
2073
2074 if (!(sinfo->filled & BIT(NL80211_STA_INFO_RX_PACKETS))) {
2075 sinfo->rx_packets = sta->rx_stats.packets;
2076 sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS);
2077 }
2078

--- 55 unchanged lines hidden (view full) ---

2134 sta_set_rate_info_rx(sta, &sinfo->rxrate);
2135 sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE);
2136 }
2137
2138 sinfo->filled |= BIT(NL80211_STA_INFO_TID_STATS);
2139 for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) {
2140 struct cfg80211_tid_stats *tidstats = &sinfo->pertid[i];
2141
2100 if (!(tidstats->filled & BIT(NL80211_TID_STATS_RX_MSDU))) {
2101 tidstats->filled |= BIT(NL80211_TID_STATS_RX_MSDU);
2102 tidstats->rx_msdu = sta->rx_stats.msdu[i];
2103 }
2104
2105 if (!(tidstats->filled & BIT(NL80211_TID_STATS_TX_MSDU))) {
2106 tidstats->filled |= BIT(NL80211_TID_STATS_TX_MSDU);
2107 tidstats->tx_msdu = sta->tx_stats.msdu[i];
2108 }
2109
2110 if (!(tidstats->filled &
2111 BIT(NL80211_TID_STATS_TX_MSDU_RETRIES)) &&
2112 ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) {
2113 tidstats->filled |=
2114 BIT(NL80211_TID_STATS_TX_MSDU_RETRIES);
2115 tidstats->tx_msdu_retries =
2116 sta->status_stats.msdu_retries[i];
2117 }
2118
2119 if (!(tidstats->filled &
2120 BIT(NL80211_TID_STATS_TX_MSDU_FAILED)) &&
2121 ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) {
2122 tidstats->filled |=
2123 BIT(NL80211_TID_STATS_TX_MSDU_FAILED);
2124 tidstats->tx_msdu_failed =
2125 sta->status_stats.msdu_failed[i];
2126 }
2142 sta_set_tidstats(sta, tidstats, i);
2127 }
2128
2129 if (ieee80211_vif_is_mesh(&sdata->vif)) {
2130#ifdef CONFIG_MAC80211_MESH
2131 sinfo->filled |= BIT(NL80211_STA_INFO_LLID) |
2132 BIT(NL80211_STA_INFO_PLID) |
2133 BIT(NL80211_STA_INFO_PLINK_STATE) |
2134 BIT(NL80211_STA_INFO_LOCAL_PM) |

--- 67 unchanged lines hidden ---
2143 }
2144
2145 if (ieee80211_vif_is_mesh(&sdata->vif)) {
2146#ifdef CONFIG_MAC80211_MESH
2147 sinfo->filled |= BIT(NL80211_STA_INFO_LLID) |
2148 BIT(NL80211_STA_INFO_PLID) |
2149 BIT(NL80211_STA_INFO_PLINK_STATE) |
2150 BIT(NL80211_STA_INFO_LOCAL_PM) |

--- 67 unchanged lines hidden ---