Skip to contentSkip to conversation

orinoco: indicate it is using dBm in wireless_stats and spy

PATCH In review Andrey Borzenkov 2 participants 2 messages Nov 15, 2008 – Nov 19, 2008 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 orinoco: indicate it is using dBm in wireless_stats and spy

Subject: [PATCH] orinoco: indicate it is using dBm in wireless_stats and spy
From: Andrey Borzenkov <[email protected]>

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.

---

 drivers/net/wireless/orinoco.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/orinoco.c +2 -2
index bc4f5a2..5038b76 100644
@@ -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);
 }
#1 lore raw
Quoted 6 lines · Andrey Borzenkov

Subject: [PATCH] orinoco: indicate it is using dBm in wireless_stats and spy
From: Andrey Borzenkov <[email protected]>

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.

Quoted 1 line

(with some hesitation)

Signature · 2 lines
Regards,
Pavel Roskin