diff options
author | Michael Buesch <mbuesch@freenet.de> | 2006-03-22 12:10:19 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-03-27 11:19:44 -0500 |
commit | 72fb851e971a416f47ad0a3ffca7342a424af37a (patch) | |
tree | 934229d25a830186335ef4b4b12b47844b4cdb23 /drivers | |
parent | cf017e1b6f625978288e2cd8ede04f8185b97c08 (diff) |
[PATCH] bcm43xx: add useless and broken statistics stuff. People seem to want it. well...
Signed-off-by: Michael Buesch <mbuesch@freenet.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_main.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_wx.c | 52 |
3 files changed, 53 insertions, 4 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx.h b/drivers/net/wireless/bcm43xx/bcm43xx.h index 57fcaafcf7dd..ae0fe5cf1d44 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx.h +++ b/drivers/net/wireless/bcm43xx/bcm43xx.h | |||
@@ -621,6 +621,8 @@ struct bcm43xx_noise_calculation { | |||
621 | 621 | ||
622 | struct bcm43xx_stats { | 622 | struct bcm43xx_stats { |
623 | u8 link_quality; | 623 | u8 link_quality; |
624 | u8 noise; | ||
625 | struct iw_statistics wstats; | ||
624 | /* Store the last TX/RX times here for updating the leds. */ | 626 | /* Store the last TX/RX times here for updating the leds. */ |
625 | unsigned long last_tx; | 627 | unsigned long last_tx; |
626 | unsigned long last_rx; | 628 | unsigned long last_rx; |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c index e680d2acc44b..15deaa508e55 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c | |||
@@ -1539,6 +1539,7 @@ static void handle_irq_noise(struct bcm43xx_private *bcm) | |||
1539 | average *= 125; | 1539 | average *= 125; |
1540 | average += 64; | 1540 | average += 64; |
1541 | average /= 128; | 1541 | average /= 128; |
1542 | |||
1542 | tmp = bcm43xx_shm_read16(bcm, BCM43xx_SHM_SHARED, 0x40C); | 1543 | tmp = bcm43xx_shm_read16(bcm, BCM43xx_SHM_SHARED, 0x40C); |
1543 | tmp = (tmp / 128) & 0x1F; | 1544 | tmp = (tmp / 128) & 0x1F; |
1544 | if (tmp >= 8) | 1545 | if (tmp >= 8) |
@@ -1550,6 +1551,8 @@ static void handle_irq_noise(struct bcm43xx_private *bcm) | |||
1550 | else | 1551 | else |
1551 | average -= 48; | 1552 | average -= 48; |
1552 | 1553 | ||
1554 | /* FIXME: This is wrong, but people want fancy stats. well... */ | ||
1555 | bcm->stats.noise = average; | ||
1553 | if (average > -65) | 1556 | if (average > -65) |
1554 | bcm->stats.link_quality = 0; | 1557 | bcm->stats.link_quality = 0; |
1555 | else if (average > -75) | 1558 | else if (average > -75) |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c index 651ba6054957..e92963402852 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c | |||
@@ -244,13 +244,13 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev, | |||
244 | 244 | ||
245 | range->max_qual.qual = 100; | 245 | range->max_qual.qual = 100; |
246 | /* TODO: Real max RSSI */ | 246 | /* TODO: Real max RSSI */ |
247 | range->max_qual.level = 0; | 247 | range->max_qual.level = 3; |
248 | range->max_qual.noise = 0; | 248 | range->max_qual.noise = 100; |
249 | range->max_qual.updated = 7; | 249 | range->max_qual.updated = 7; |
250 | 250 | ||
251 | range->avg_qual.qual = 70; | 251 | range->avg_qual.qual = 70; |
252 | range->avg_qual.level = 0; | 252 | range->avg_qual.level = 2; |
253 | range->avg_qual.noise = 0; | 253 | range->avg_qual.noise = 40; |
254 | range->avg_qual.updated = 7; | 254 | range->avg_qual.updated = 7; |
255 | 255 | ||
256 | range->min_rts = BCM43xx_MIN_RTS_THRESHOLD; | 256 | range->min_rts = BCM43xx_MIN_RTS_THRESHOLD; |
@@ -875,6 +875,49 @@ out: | |||
875 | return err; | 875 | return err; |
876 | } | 876 | } |
877 | 877 | ||
878 | /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */ | ||
879 | |||
880 | static struct iw_statistics *bcm43xx_get_wireless_stats(struct net_device *net_dev) | ||
881 | { | ||
882 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | ||
883 | struct ieee80211softmac_device *mac = ieee80211_priv(net_dev); | ||
884 | struct iw_statistics *wstats; | ||
885 | |||
886 | wstats = &bcm->stats.wstats; | ||
887 | if (!mac->associated) { | ||
888 | wstats->miss.beacon = 0; | ||
889 | // bcm->ieee->ieee_stats.tx_retry_limit_exceeded = 0; // FIXME: should this be cleared here? | ||
890 | wstats->discard.retries = 0; | ||
891 | // bcm->ieee->ieee_stats.tx_discards_wrong_sa = 0; // FIXME: same question | ||
892 | wstats->discard.nwid = 0; | ||
893 | // bcm->ieee->ieee_stats.rx_discards_undecryptable = 0; // FIXME: ditto | ||
894 | wstats->discard.code = 0; | ||
895 | // bcm->ieee->ieee_stats.rx_fragments = 0; // FIXME: same here | ||
896 | wstats->discard.fragment = 0; | ||
897 | wstats->discard.misc = 0; | ||
898 | wstats->qual.qual = 0; | ||
899 | wstats->qual.level = 0; | ||
900 | wstats->qual.noise = 0; | ||
901 | wstats->qual.updated = 7; | ||
902 | wstats->qual.updated |= IW_QUAL_NOISE_INVALID | | ||
903 | IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; | ||
904 | return wstats; | ||
905 | } | ||
906 | /* fill in the real statistics when iface associated */ | ||
907 | wstats->qual.qual = 100; // TODO: get the real signal quality | ||
908 | wstats->qual.level = 3 - bcm->stats.link_quality; | ||
909 | wstats->qual.noise = bcm->stats.noise; | ||
910 | wstats->qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED | | ||
911 | IW_QUAL_NOISE_UPDATED; | ||
912 | wstats->discard.code = bcm->ieee->ieee_stats.rx_discards_undecryptable; | ||
913 | wstats->discard.retries = bcm->ieee->ieee_stats.tx_retry_limit_exceeded; | ||
914 | wstats->discard.nwid = bcm->ieee->ieee_stats.tx_discards_wrong_sa; | ||
915 | wstats->discard.fragment = bcm->ieee->ieee_stats.rx_fragments; | ||
916 | wstats->discard.misc = 0; // FIXME | ||
917 | wstats->miss.beacon = 0; // FIXME | ||
918 | return wstats; | ||
919 | } | ||
920 | |||
878 | 921 | ||
879 | #ifdef WX | 922 | #ifdef WX |
880 | # undef WX | 923 | # undef WX |
@@ -1010,6 +1053,7 @@ const struct iw_handler_def bcm43xx_wx_handlers_def = { | |||
1010 | .num_private_args = ARRAY_SIZE(bcm43xx_priv_wx_args), | 1053 | .num_private_args = ARRAY_SIZE(bcm43xx_priv_wx_args), |
1011 | .private = bcm43xx_priv_wx_handlers, | 1054 | .private = bcm43xx_priv_wx_handlers, |
1012 | .private_args = bcm43xx_priv_wx_args, | 1055 | .private_args = bcm43xx_priv_wx_args, |
1056 | .get_wireless_stats = bcm43xx_get_wireless_stats, | ||
1013 | }; | 1057 | }; |
1014 | 1058 | ||
1015 | /* vim: set ts=8 sw=8 sts=8: */ | 1059 | /* vim: set ts=8 sw=8 sts=8: */ |