1 Index: linux-2.6.18/drivers/net/wireless/bcm43xx/bcm43xx.h
2 ===================================================================
3 --- linux-2.6.18.orig/drivers/net/wireless/bcm43xx/bcm43xx.h
4 +++ linux-2.6.18/drivers/net/wireless/bcm43xx/bcm43xx.h
6 #define BCM43xx_DEFAULT_SHORT_RETRY_LIMIT 7
7 #define BCM43xx_DEFAULT_LONG_RETRY_LIMIT 4
9 +/* FIXME: the next line is a guess as to what the maximum RSSI value might be */
10 +#define RX_RSSI_MAX 60
12 /* Max size of a security key */
13 #define BCM43xx_SEC_KEYSIZE 16
14 /* Security algorithms. */
15 Index: linux-2.6.18/drivers/net/wireless/bcm43xx/bcm43xx_main.c
16 ===================================================================
17 --- linux-2.6.18.orig/drivers/net/wireless/bcm43xx/bcm43xx_main.c
18 +++ linux-2.6.18/drivers/net/wireless/bcm43xx/bcm43xx_main.c
19 @@ -3647,6 +3647,8 @@ static int bcm43xx_read_phyinfo(struct b
23 + bcm->ieee->perfect_rssi = RX_RSSI_MAX;
24 + bcm->ieee->worst_rssi = 0;
26 printk(KERN_WARNING PFX "Invalid PHY Revision %x\n",
28 Index: linux-2.6.18/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
29 ===================================================================
30 --- linux-2.6.18.orig/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
31 +++ linux-2.6.18/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
34 #define MAX_WX_STRING 80
37 static int bcm43xx_wx_get_name(struct net_device *net_dev,
38 struct iw_request_info *info,
39 union iwreq_data *data,
40 @@ -227,15 +226,14 @@ static int bcm43xx_wx_get_rangeparams(st
41 range->throughput = 27 * 1000 * 1000;
43 range->max_qual.qual = 100;
44 - /* TODO: Real max RSSI */
45 - range->max_qual.level = 3;
46 - range->max_qual.noise = 100;
47 - range->max_qual.updated = 7;
49 - range->avg_qual.qual = 70;
50 - range->avg_qual.level = 2;
51 - range->avg_qual.noise = 40;
52 - range->avg_qual.updated = 7;
53 + range->max_qual.level = 146; /* set floor at -110 dBm (146 - 256) */
54 + range->max_qual.noise = 146;
55 + range->max_qual.updated = IW_QUAL_ALL_UPDATED;
57 + range->avg_qual.qual = 50;
58 + range->avg_qual.level = 0;
59 + range->avg_qual.noise = 0;
60 + range->avg_qual.updated = IW_QUAL_ALL_UPDATED;
62 range->min_rts = BCM43xx_MIN_RTS_THRESHOLD;
63 range->max_rts = BCM43xx_MAX_RTS_THRESHOLD;
64 @@ -840,6 +838,10 @@ static struct iw_statistics *bcm43xx_get
65 struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
66 struct ieee80211softmac_device *mac = ieee80211_priv(net_dev);
67 struct iw_statistics *wstats;
68 + struct ieee80211_network *network = NULL;
69 + static int tmp_level = 0;
70 + static int tmp_qual = 0;
71 + unsigned long flags;
73 wstats = &bcm->stats.wstats;
74 if (!mac->associated) {
75 @@ -857,16 +859,28 @@ static struct iw_statistics *bcm43xx_get
76 wstats->qual.level = 0;
77 wstats->qual.noise = 0;
78 wstats->qual.updated = 7;
79 - wstats->qual.updated |= IW_QUAL_NOISE_INVALID |
80 - IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID;
81 + wstats->qual.updated |= IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
84 /* fill in the real statistics when iface associated */
85 - wstats->qual.qual = 100; // TODO: get the real signal quality
86 - wstats->qual.level = 3 - bcm->stats.link_quality;
87 + spin_lock_irqsave(&mac->ieee->lock, flags);
88 + list_for_each_entry(network, &mac->ieee->network_list, list) {
89 + if (!memcmp(mac->associnfo.bssid, network->bssid, ETH_ALEN)) {
90 + if (!tmp_level) { /* get initial values */
91 + tmp_level = network->stats.signal;
92 + tmp_qual = network->stats.rssi;
93 + } else { /* smooth results */
94 + tmp_level = (15 * tmp_level + network->stats.signal)/16;
95 + tmp_qual = (15 * tmp_qual + network->stats.rssi)/16;
100 + spin_unlock_irqrestore(&mac->ieee->lock, flags);
101 + wstats->qual.level = tmp_level;
102 + wstats->qual.qual = 100 * tmp_qual / RX_RSSI_MAX;
103 wstats->qual.noise = bcm->stats.noise;
104 - wstats->qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED |
105 - IW_QUAL_NOISE_UPDATED;
106 + wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
107 wstats->discard.code = bcm->ieee->ieee_stats.rx_discards_undecryptable;
108 wstats->discard.retries = bcm->ieee->ieee_stats.tx_retry_limit_exceeded;
109 wstats->discard.nwid = bcm->ieee->ieee_stats.tx_discards_wrong_sa;
110 Index: linux-2.6.18/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c
111 ===================================================================
112 --- linux-2.6.18.orig/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c
113 +++ linux-2.6.18/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c
114 @@ -492,20 +492,18 @@ int bcm43xx_rx(struct bcm43xx_private *b
116 memset(&stats, 0, sizeof(stats));
117 stats.mac_time = le16_to_cpu(rxhdr->mactime);
118 - stats.rssi = bcm43xx_rssi_postprocess(bcm, rxhdr->rssi, is_ofdm,
119 + stats.rssi = rxhdr->rssi;
120 + stats.signal = bcm43xx_rssi_postprocess(bcm, rxhdr->rssi, is_ofdm,
121 !!(rxflags1 & BCM43xx_RXHDR_FLAGS1_2053RSSIADJ),
122 !!(rxflags3 & BCM43xx_RXHDR_FLAGS3_2050RSSIADJ));
123 - stats.signal = rxhdr->signal_quality; //FIXME
124 -//TODO stats.noise =
125 + stats.noise = bcm->stats.noise;
127 stats.rate = bcm43xx_plcp_get_bitrate_ofdm(plcp);
129 stats.rate = bcm43xx_plcp_get_bitrate_cck(plcp);
130 -//printk("RX ofdm %d, rate == %u\n", is_ofdm, stats.rate);
131 stats.received_channel = radio->channel;
132 -//TODO stats.control =
133 stats.mask = IEEE80211_STATMASK_SIGNAL |
134 -//TODO IEEE80211_STATMASK_NOISE |
135 + IEEE80211_STATMASK_NOISE |
136 IEEE80211_STATMASK_RATE |
137 IEEE80211_STATMASK_RSSI;
138 if (phy->type == BCM43xx_PHYTYPE_A)