sta_info.c (fb803becb1180d3f940a634f073981e0b72d7030) sta_info.c (a17d93ff3a950fefaea40e4a4bf3669b9137c533)
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

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

1967 } else if (rate & STA_STATS_RATE_HT) {
1968 rinfo->flags = RATE_INFO_FLAGS_MCS;
1969 rinfo->mcs = rate & 0xff;
1970 } else if (rate & STA_STATS_RATE_LEGACY) {
1971 struct ieee80211_supported_band *sband;
1972 u16 brate;
1973 unsigned int shift;
1974
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

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

1967 } else if (rate & STA_STATS_RATE_HT) {
1968 rinfo->flags = RATE_INFO_FLAGS_MCS;
1969 rinfo->mcs = rate & 0xff;
1970 } else if (rate & STA_STATS_RATE_LEGACY) {
1971 struct ieee80211_supported_band *sband;
1972 u16 brate;
1973 unsigned int shift;
1974
1975 rinfo->flags = 0;
1975 sband = local->hw.wiphy->bands[(rate >> 4) & 0xf];
1976 brate = sband->bitrates[rate & 0xf].bitrate;
1977 if (rinfo->bw == RATE_INFO_BW_5)
1978 shift = 2;
1979 else if (rinfo->bw == RATE_INFO_BW_10)
1980 shift = 1;
1981 else
1982 shift = 0;
1983 rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift);
1984 }
1985
1986 if (rate & STA_STATS_RATE_SGI)
1987 rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI;
1988}
1989
1976 sband = local->hw.wiphy->bands[(rate >> 4) & 0xf];
1977 brate = sband->bitrates[rate & 0xf].bitrate;
1978 if (rinfo->bw == RATE_INFO_BW_5)
1979 shift = 2;
1980 else if (rinfo->bw == RATE_INFO_BW_10)
1981 shift = 1;
1982 else
1983 shift = 0;
1984 rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift);
1985 }
1986
1987 if (rate & STA_STATS_RATE_SGI)
1988 rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI;
1989}
1990
1990static void sta_set_rate_info_rx(struct sta_info *sta, struct rate_info *rinfo)
1991static int sta_set_rate_info_rx(struct sta_info *sta, struct rate_info *rinfo)
1991{
1992 u16 rate = ACCESS_ONCE(sta_get_last_rx_stats(sta)->last_rate);
1993
1994 if (rate == STA_STATS_RATE_INVALID)
1992{
1993 u16 rate = ACCESS_ONCE(sta_get_last_rx_stats(sta)->last_rate);
1994
1995 if (rate == STA_STATS_RATE_INVALID)
1995 rinfo->flags = 0;
1996 else
1997 sta_stats_decode_rate(sta->local, rate, rinfo);
1996 return -EINVAL;
1997
1998 sta_stats_decode_rate(sta->local, rate, rinfo);
1999 return 0;
1998}
1999
2000static void sta_set_tidstats(struct sta_info *sta,
2001 struct cfg80211_tid_stats *tidstats,
2002 int tid)
2003{
2004 struct ieee80211_local *local = sta->local;
2005

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

2044
2045 return value;
2046}
2047
2048void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
2049{
2050 struct ieee80211_sub_if_data *sdata = sta->sdata;
2051 struct ieee80211_local *local = sdata->local;
2000}
2001
2002static void sta_set_tidstats(struct sta_info *sta,
2003 struct cfg80211_tid_stats *tidstats,
2004 int tid)
2005{
2006 struct ieee80211_local *local = sta->local;
2007

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

2046
2047 return value;
2048}
2049
2050void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
2051{
2052 struct ieee80211_sub_if_data *sdata = sta->sdata;
2053 struct ieee80211_local *local = sdata->local;
2054 struct rate_control_ref *ref = NULL;
2052 u32 thr = 0;
2053 int i, ac, cpu;
2054 struct ieee80211_sta_rx_stats *last_rxstats;
2055
2056 last_rxstats = sta_get_last_rx_stats(sta);
2057
2055 u32 thr = 0;
2056 int i, ac, cpu;
2057 struct ieee80211_sta_rx_stats *last_rxstats;
2058
2059 last_rxstats = sta_get_last_rx_stats(sta);
2060
2061 if (test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
2062 ref = local->rate_ctrl;
2063
2058 sinfo->generation = sdata->local->sta_generation;
2059
2060 /* do before driver, so beacon filtering drivers have a
2061 * chance to e.g. just add the number of filtered beacons
2062 * (or just modify the value entirely, of course)
2063 */
2064 if (sdata->vif.type == NL80211_IFTYPE_STATION)
2065 sinfo->rx_beacon = sdata->u.mgd.count_beacon_signal;

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

2190
2191 if (!(sinfo->filled & BIT(NL80211_STA_INFO_TX_BITRATE))) {
2192 sta_set_rate_info_tx(sta, &sta->tx_stats.last_rate,
2193 &sinfo->txrate);
2194 sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
2195 }
2196
2197 if (!(sinfo->filled & BIT(NL80211_STA_INFO_RX_BITRATE))) {
2064 sinfo->generation = sdata->local->sta_generation;
2065
2066 /* do before driver, so beacon filtering drivers have a
2067 * chance to e.g. just add the number of filtered beacons
2068 * (or just modify the value entirely, of course)
2069 */
2070 if (sdata->vif.type == NL80211_IFTYPE_STATION)
2071 sinfo->rx_beacon = sdata->u.mgd.count_beacon_signal;

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

2196
2197 if (!(sinfo->filled & BIT(NL80211_STA_INFO_TX_BITRATE))) {
2198 sta_set_rate_info_tx(sta, &sta->tx_stats.last_rate,
2199 &sinfo->txrate);
2200 sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
2201 }
2202
2203 if (!(sinfo->filled & BIT(NL80211_STA_INFO_RX_BITRATE))) {
2198 sta_set_rate_info_rx(sta, &sinfo->rxrate);
2199 sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE);
2204 if (sta_set_rate_info_rx(sta, &sinfo->rxrate) == 0)
2205 sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE);
2200 }
2201
2202 sinfo->filled |= BIT(NL80211_STA_INFO_TID_STATS);
2203 for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) {
2204 struct cfg80211_tid_stats *tidstats = &sinfo->pertid[i];
2205
2206 sta_set_tidstats(sta, tidstats, i);
2207 }

--- 91 unchanged lines hidden ---
2206 }
2207
2208 sinfo->filled |= BIT(NL80211_STA_INFO_TID_STATS);
2209 for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) {
2210 struct cfg80211_tid_stats *tidstats = &sinfo->pertid[i];
2211
2212 sta_set_tidstats(sta, tidstats, i);
2213 }

--- 91 unchanged lines hidden ---