aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Greear <greearb@candelatech.com>2016-12-14 14:30:38 -0500
committerJohannes Berg <johannes.berg@intel.com>2016-12-15 04:54:48 -0500
commita17d93ff3a950fefaea40e4a4bf3669b9137c533 (patch)
treecde48d7c029ceae44522406acf55e76866682fc5
parentd8da0b5d64d58f7775a94bcf12dda50f13a76f22 (diff)
mac80211: fix legacy and invalid rx-rate report
This fixes obtaining the rate info via sta_set_sinfo when the rx rate is invalid (for instance, on IBSS interface that has received no frames from one of its peers). Also initialize rinfo->flags for legacy rates, to not rely on the whole sinfo being initialized to zero. Signed-off-by: Ben Greear <greearb@candelatech.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--net/mac80211/sta_info.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 1711bae4abf2..b6cfcf038c11 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -1972,6 +1972,7 @@ static void sta_stats_decode_rate(struct ieee80211_local *local, u16 rate,
1972 u16 brate; 1972 u16 brate;
1973 unsigned int shift; 1973 unsigned int shift;
1974 1974
1975 rinfo->flags = 0;
1975 sband = local->hw.wiphy->bands[(rate >> 4) & 0xf]; 1976 sband = local->hw.wiphy->bands[(rate >> 4) & 0xf];
1976 brate = sband->bitrates[rate & 0xf].bitrate; 1977 brate = sband->bitrates[rate & 0xf].bitrate;
1977 if (rinfo->bw == RATE_INFO_BW_5) 1978 if (rinfo->bw == RATE_INFO_BW_5)
@@ -1987,14 +1988,15 @@ static void sta_stats_decode_rate(struct ieee80211_local *local, u16 rate,
1987 rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; 1988 rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI;
1988} 1989}
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{
1992 u16 rate = ACCESS_ONCE(sta_get_last_rx_stats(sta)->last_rate); 1993 u16 rate = ACCESS_ONCE(sta_get_last_rx_stats(sta)->last_rate);
1993 1994
1994 if (rate == STA_STATS_RATE_INVALID) 1995 if (rate == STA_STATS_RATE_INVALID)
1995 rinfo->flags = 0; 1996 return -EINVAL;
1996 else 1997
1997 sta_stats_decode_rate(sta->local, rate, rinfo); 1998 sta_stats_decode_rate(sta->local, rate, rinfo);
1999 return 0;
1998} 2000}
1999 2001
2000static void sta_set_tidstats(struct sta_info *sta, 2002static void sta_set_tidstats(struct sta_info *sta,
@@ -2199,8 +2201,8 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
2199 } 2201 }
2200 2202
2201 if (!(sinfo->filled & BIT(NL80211_STA_INFO_RX_BITRATE))) { 2203 if (!(sinfo->filled & BIT(NL80211_STA_INFO_RX_BITRATE))) {
2202 sta_set_rate_info_rx(sta, &sinfo->rxrate); 2204 if (sta_set_rate_info_rx(sta, &sinfo->rxrate) == 0)
2203 sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE); 2205 sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE);
2204 } 2206 }
2205 2207
2206 sinfo->filled |= BIT(NL80211_STA_INFO_TID_STATS); 2208 sinfo->filled |= BIT(NL80211_STA_INFO_TID_STATS);