diff options
author | Larry Finger <Larry.Finger@lwfinger.net> | 2006-07-14 16:42:17 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-07-27 18:19:25 -0400 |
commit | 27be44ff8ee29e945adad226cc360c9278239d17 (patch) | |
tree | d04c723c2866b062b54c156f6de3ab5f535b667c /drivers/net/wireless/bcm43xx | |
parent | 58e5528ee464d38040b9489e10033c9387a10d56 (diff) |
[PATCH] bcm43xx: improved statistics
This minor patch for wireless-2.6 (softmac) adjusts the parameters of
the wireless statistics to improve the display of programs such as the
"Wireless Network Information" applet of KDE. Thanks to Dan Williams
and Jean Tourrilhes for valuable help in setting up the return of
info in dBm.
Signed-Off-By: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/bcm43xx')
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_wx.c | 28 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_xmit.c | 5 |
2 files changed, 17 insertions, 16 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c index 8ffd760dc830..1d3a3aaf96ec 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c | |||
@@ -47,9 +47,8 @@ | |||
47 | #define BCM43xx_WX_VERSION 18 | 47 | #define BCM43xx_WX_VERSION 18 |
48 | 48 | ||
49 | #define MAX_WX_STRING 80 | 49 | #define MAX_WX_STRING 80 |
50 | /* FIXME: the next line is a guess as to what the maximum value of RX power | 50 | /* FIXME: the next line is a guess as to what the maximum RSSI value might be */ |
51 | (in dBm) might be */ | 51 | #define RX_RSSI_MAX 60 |
52 | #define RX_POWER_MAX -10 | ||
53 | 52 | ||
54 | 53 | ||
55 | static int bcm43xx_wx_get_name(struct net_device *net_dev, | 54 | static int bcm43xx_wx_get_name(struct net_device *net_dev, |
@@ -230,9 +229,8 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev, | |||
230 | range->throughput = 27 * 1000 * 1000; | 229 | range->throughput = 27 * 1000 * 1000; |
231 | 230 | ||
232 | range->max_qual.qual = 100; | 231 | range->max_qual.qual = 100; |
233 | /* TODO: Real max RSSI */ | 232 | range->max_qual.level = 152; /* set floor at -104 dBm (152 - 256) */ |
234 | range->max_qual.level = 0; | 233 | range->max_qual.noise = 152; |
235 | range->max_qual.noise = 0; | ||
236 | range->max_qual.updated = IW_QUAL_ALL_UPDATED; | 234 | range->max_qual.updated = IW_QUAL_ALL_UPDATED; |
237 | 235 | ||
238 | range->avg_qual.qual = 50; | 236 | range->avg_qual.qual = 50; |
@@ -845,6 +843,7 @@ static struct iw_statistics *bcm43xx_get_wireless_stats(struct net_device *net_d | |||
845 | struct iw_statistics *wstats; | 843 | struct iw_statistics *wstats; |
846 | struct ieee80211_network *network = NULL; | 844 | struct ieee80211_network *network = NULL; |
847 | static int tmp_level = 0; | 845 | static int tmp_level = 0; |
846 | static int tmp_qual = 0; | ||
848 | unsigned long flags; | 847 | unsigned long flags; |
849 | 848 | ||
850 | wstats = &bcm->stats.wstats; | 849 | wstats = &bcm->stats.wstats; |
@@ -863,25 +862,28 @@ static struct iw_statistics *bcm43xx_get_wireless_stats(struct net_device *net_d | |||
863 | wstats->qual.level = 0; | 862 | wstats->qual.level = 0; |
864 | wstats->qual.noise = 0; | 863 | wstats->qual.noise = 0; |
865 | wstats->qual.updated = 7; | 864 | wstats->qual.updated = 7; |
866 | wstats->qual.updated |= IW_QUAL_ALL_UPDATED; | 865 | wstats->qual.updated |= IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; |
867 | return wstats; | 866 | return wstats; |
868 | } | 867 | } |
869 | /* fill in the real statistics when iface associated */ | 868 | /* fill in the real statistics when iface associated */ |
870 | spin_lock_irqsave(&mac->ieee->lock, flags); | 869 | spin_lock_irqsave(&mac->ieee->lock, flags); |
871 | list_for_each_entry(network, &mac->ieee->network_list, list) { | 870 | list_for_each_entry(network, &mac->ieee->network_list, list) { |
872 | if (!memcmp(mac->associnfo.bssid, network->bssid, ETH_ALEN)) { | 871 | if (!memcmp(mac->associnfo.bssid, network->bssid, ETH_ALEN)) { |
873 | if (!tmp_level) /* get initial value */ | 872 | if (!tmp_level) { /* get initial values */ |
874 | tmp_level = network->stats.rssi; | 873 | tmp_level = network->stats.signal; |
875 | else /* smooth results */ | 874 | tmp_qual = network->stats.rssi; |
876 | tmp_level = (7 * tmp_level + network->stats.rssi)/8; | 875 | } else { /* smooth results */ |
876 | tmp_level = (15 * tmp_level + network->stats.signal)/16; | ||
877 | tmp_qual = (15 * tmp_qual + network->stats.rssi)/16; | ||
878 | } | ||
877 | break; | 879 | break; |
878 | } | 880 | } |
879 | } | 881 | } |
880 | spin_unlock_irqrestore(&mac->ieee->lock, flags); | 882 | spin_unlock_irqrestore(&mac->ieee->lock, flags); |
881 | wstats->qual.level = tmp_level; | 883 | wstats->qual.level = tmp_level; |
882 | wstats->qual.qual = 100 + tmp_level - RX_POWER_MAX; // TODO: get the real signal quality | 884 | wstats->qual.qual = 100 * tmp_qual / RX_RSSI_MAX; |
883 | wstats->qual.noise = bcm->stats.noise; | 885 | wstats->qual.noise = bcm->stats.noise; |
884 | wstats->qual.updated = IW_QUAL_ALL_UPDATED; | 886 | wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; |
885 | wstats->discard.code = bcm->ieee->ieee_stats.rx_discards_undecryptable; | 887 | wstats->discard.code = bcm->ieee->ieee_stats.rx_discards_undecryptable; |
886 | wstats->discard.retries = bcm->ieee->ieee_stats.tx_retry_limit_exceeded; | 888 | wstats->discard.retries = bcm->ieee->ieee_stats.tx_retry_limit_exceeded; |
887 | wstats->discard.nwid = bcm->ieee->ieee_stats.tx_discards_wrong_sa; | 889 | wstats->discard.nwid = bcm->ieee->ieee_stats.tx_discards_wrong_sa; |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c b/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c index 6dbd855b3647..c0efbfe605a5 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c | |||
@@ -492,16 +492,15 @@ int bcm43xx_rx(struct bcm43xx_private *bcm, | |||
492 | 492 | ||
493 | memset(&stats, 0, sizeof(stats)); | 493 | memset(&stats, 0, sizeof(stats)); |
494 | stats.mac_time = le16_to_cpu(rxhdr->mactime); | 494 | stats.mac_time = le16_to_cpu(rxhdr->mactime); |
495 | stats.rssi = bcm43xx_rssi_postprocess(bcm, rxhdr->rssi, is_ofdm, | 495 | stats.rssi = rxhdr->rssi; |
496 | stats.signal = bcm43xx_rssi_postprocess(bcm, rxhdr->rssi, is_ofdm, | ||
496 | !!(rxflags1 & BCM43xx_RXHDR_FLAGS1_2053RSSIADJ), | 497 | !!(rxflags1 & BCM43xx_RXHDR_FLAGS1_2053RSSIADJ), |
497 | !!(rxflags3 & BCM43xx_RXHDR_FLAGS3_2050RSSIADJ)); | 498 | !!(rxflags3 & BCM43xx_RXHDR_FLAGS3_2050RSSIADJ)); |
498 | stats.signal = rxhdr->signal_quality; //FIXME | ||
499 | //TODO stats.noise = | 499 | //TODO stats.noise = |
500 | if (is_ofdm) | 500 | if (is_ofdm) |
501 | stats.rate = bcm43xx_plcp_get_bitrate_ofdm(plcp); | 501 | stats.rate = bcm43xx_plcp_get_bitrate_ofdm(plcp); |
502 | else | 502 | else |
503 | stats.rate = bcm43xx_plcp_get_bitrate_cck(plcp); | 503 | stats.rate = bcm43xx_plcp_get_bitrate_cck(plcp); |
504 | //printk("RX ofdm %d, rate == %u\n", is_ofdm, stats.rate); | ||
505 | stats.received_channel = radio->channel; | 504 | stats.received_channel = radio->channel; |
506 | //TODO stats.control = | 505 | //TODO stats.control = |
507 | stats.mask = IEEE80211_STATMASK_SIGNAL | | 506 | stats.mask = IEEE80211_STATMASK_SIGNAL | |