linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: Report correct wireless statistics
@ 2007-04-08  5:04 Larry Finger
  2007-04-08  7:48 ` Tomas Winkler
  2007-04-08 15:35 ` Michael Wu
  0 siblings, 2 replies; 20+ messages in thread
From: Larry Finger @ 2007-04-08  5:04 UTC (permalink / raw)
  To: John Linville; +Cc: Michael Buesch, Bcm43xx-dev, linux-wireless

In mac80211 the 'qual' and 'level' values are interchanged. The patch also
places the 'qual' value on a 0 - 100 scale and calculated using the formula
contained in iwlib.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---

John and Michael,

This fix is meant for the wireless-dev and mb git trees.

Larry

 ieee80211_ioctl.c |   16 +++++++++++-----
 ieee80211_sta.c   |    9 +++++++--
 2 files changed, 18 insertions(+), 7 deletions(-)

Index: wireless-mb/net/mac80211/ieee80211_sta.c
===================================================================
--- wireless-mb.orig/net/mac80211/ieee80211_sta.c
+++ wireless-mb/net/mac80211/ieee80211_sta.c
@@ -2822,8 +2822,10 @@ ieee80211_sta_scan_result(struct net_dev
 
 	memset(&iwe, 0, sizeof(iwe));
 	iwe.cmd = IWEVQUAL;
-	iwe.u.qual.qual = bss->signal;
-	iwe.u.qual.level = bss->rssi;
+	iwe.u.qual.level = bss->signal;
+	if (unlikely(local->hw.max_rssi == 0))
+		local->hw.max_rssi = 100;
+	iwe.u.qual.qual = (100 * bss->rssi) / local->hw.max_rssi;
 	iwe.u.qual.noise = bss->noise;
 	iwe.u.qual.updated = local->wstats_flags;
 	current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe,
Index: wireless-mb/net/mac80211/ieee80211_ioctl.c
===================================================================
--- wireless-mb.orig/net/mac80211/ieee80211_ioctl.c
+++ wireless-mb/net/mac80211/ieee80211_ioctl.c
@@ -1593,12 +1593,12 @@ static int ieee80211_ioctl_giwrange(stru
 	range->min_frag = 256;
 	range->max_frag = 2346;
 
-	range->max_qual.qual = local->hw.max_signal;
-	range->max_qual.level = local->hw.max_rssi;
+	range->max_qual.qual = 100;
+	range->max_qual.level = local->hw.max_signal;
 	range->max_qual.noise = local->hw.max_noise;
 	range->max_qual.updated = local->wstats_flags;
 
-	range->avg_qual.qual = local->hw.max_signal/2;
+	range->avg_qual.qual = 50;
 	range->avg_qual.level = 0;
 	range->avg_qual.noise = 0;
 	range->avg_qual.updated = local->wstats_flags;
@@ -3087,8 +3087,10 @@ static struct iw_statistics *ieee80211_g
 		wstats->qual.noise = 0;
 		wstats->qual.updated = IW_QUAL_ALL_INVALID;
 	} else {
-		wstats->qual.level = sta->last_rssi;
-		wstats->qual.qual = sta->last_signal;
+		if (unlikely(local->hw.max_rssi == 0))
+			local->hw.max_rssi = 100;
+		wstats->qual.qual = (100 * sta->last_rssi) / local->hw.max_rssi;
+		wstats->qual.level = sta->last_signal;
 		wstats->qual.noise = sta->last_noise;
 		wstats->qual.updated = local->wstats_flags;
 		sta_info_put(sta);

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2007-04-13 23:21 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-08  5:04 [PATCH] mac80211: Report correct wireless statistics Larry Finger
2007-04-08  7:48 ` Tomas Winkler
2007-04-08 15:35 ` Michael Wu
2007-04-08 22:26   ` Larry Finger
2007-04-08 23:02     ` Michael Wu
2007-04-08 23:32       ` Larry Finger
2007-04-08 23:41         ` Michael Wu
2007-04-09  0:02           ` Larry Finger
2007-04-09  0:31             ` Michael Wu
2007-04-09  3:54               ` Larry Finger
2007-04-09  4:43                 ` Michael Wu
2007-04-09  5:06                   ` Larry Finger
2007-04-09 12:07                   ` Dan Williams
2007-04-09 12:21                     ` Dan Williams
2007-04-09 15:49                     ` Larry Finger
2007-04-09 17:16                       ` Michael Wu
2007-04-09 21:12                         ` Larry Finger
2007-04-09 23:02                           ` Michael Wu
2007-04-10  0:59                             ` Larry Finger
2007-04-13 23:18                               ` Michael Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).