linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] orinoco: indicate it is using dBm in wireless_stats and spy
@ 2008-11-15 14:15 Andrey Borzenkov
  2008-11-19 22:12 ` Pavel Roskin
  0 siblings, 1 reply; 2+ messages in thread
From: Andrey Borzenkov @ 2008-11-15 14:15 UTC (permalink / raw)
  To: orinoco-devel; +Cc: linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1950 bytes --]

Subject: [PATCH] orinoco: indicate it is using dBm in wireless_stats and spy
From: Andrey Borzenkov <arvidjaar@mail.ru>

Since WE7 /proc/net/wireless checks whether level and noise  are in dBm
and shows them accordingly. Indicate that we return signal and noice
levels in dBm.

Before:
Inter-| sta-|   Quality        |   Discarded packets               | Missed | WE
 face | tus | link level noise |  nwid  crypt   frag  retry   misc | beacon | 22
  eth1: 0000   65.  219.  165.       0      0    148     41      0        0

After:
Inter-| sta-|   Quality        |   Discarded packets               | Missed | WE
 face | tus | link level noise |  nwid  crypt   frag  retry   misc | beacon | 22
  eth1: 0000   65.  -37.  -91.       0      0      0      0      0        0

While at it, replace raw numbers with appropriate macro.

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>

---

 drivers/net/wireless/orinoco.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index bc4f5a2..5038b76 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -821,7 +821,7 @@ static struct iw_statistics *orinoco_get_wireless_stats(struct net_device *dev)
 			wstats->qual.qual = (int)le16_to_cpu(cq.qual);
 			wstats->qual.level = (int)le16_to_cpu(cq.signal) - 0x95;
 			wstats->qual.noise = (int)le16_to_cpu(cq.noise) - 0x95;
-			wstats->qual.updated = 7;
+			wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
 		}
 	}
 
@@ -1179,7 +1179,7 @@ static inline void orinoco_spy_gather(struct net_device *dev, u_char *mac,
 	wstats.level = level - 0x95;
 	wstats.noise = noise - 0x95;
 	wstats.qual = (level > noise) ? (level - noise) : 0;
-	wstats.updated = 7;
+	wstats.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
 	/* Update spy records */
 	wireless_spy_update(dev, mac, &wstats);
 }

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH] orinoco: indicate it is using dBm in wireless_stats and spy
  2008-11-15 14:15 [PATCH] orinoco: indicate it is using dBm in wireless_stats and spy Andrey Borzenkov
@ 2008-11-19 22:12 ` Pavel Roskin
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Roskin @ 2008-11-19 22:12 UTC (permalink / raw)
  To: Andrey Borzenkov; +Cc: orinoco-devel, linux-wireless

On Sat, 2008-11-15 at 17:15 +0300, Andrey Borzenkov wrote:
> Subject: [PATCH] orinoco: indicate it is using dBm in wireless_stats and spy
> From: Andrey Borzenkov <arvidjaar@mail.ru>
> 
> Since WE7 /proc/net/wireless checks whether level and noise  are in dBm
> and shows them accordingly. Indicate that we return signal and noice
> levels in dBm.

I believe the formula we are using is not exact.  Intersil firmware has
a separate register (HERMES_RID_DBMCOMMSQUALITY_INTERSIL) that provides
the dBm data.  It relates to the data we are using
(HERMES_RID_COMMSQUALITY) in a linear way, but the multiplier is not 1.
I remember I tried to recover the formula but didn't have time to
complete it.  Besides, different brands and version of the firmware do
it differently.

Anyway, we are using the same formula everywhere, yet we are
inconsistent.  In some places the code uses IW_QUAL_DBM, in some places
is doesn't.  It's better to be consistent.  We can improve the formula
later.  The numbers are in the reasonable range.

> Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>

(with some hesitation)
Signed-off-by: Pavel Roskin <proski@gnu.org>

-- 
Regards,
Pavel Roskin

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

end of thread, other threads:[~2008-11-19 22:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-15 14:15 [PATCH] orinoco: indicate it is using dBm in wireless_stats and spy Andrey Borzenkov
2008-11-19 22:12 ` Pavel Roskin

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).