Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 35084
b: refs/heads/master
c: 4221f98
h: refs/heads/master
v: v3
  • Loading branch information
Larry Finger authored and John W. Linville committed Jul 10, 2006
1 parent f070806 commit ce122dd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2087da5dc12c497123d5fb8949ceed9021b673ec
refs/heads/master: 4221f980a4931364be7ffd81c4f16784990f6f8b
41 changes: 28 additions & 13 deletions trunk/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
#define BCM43xx_WX_VERSION 18

#define MAX_WX_STRING 80
/* FIXME: the next line is a guess as to what the maximum value of RX power
(in dBm) might be */
#define RX_POWER_MAX -10


static int bcm43xx_wx_get_name(struct net_device *net_dev,
Expand Down Expand Up @@ -228,14 +231,14 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev,

range->max_qual.qual = 100;
/* TODO: Real max RSSI */
range->max_qual.level = 3;
range->max_qual.noise = 100;
range->max_qual.updated = 7;
range->max_qual.level = 0;
range->max_qual.noise = 0;
range->max_qual.updated = IW_QUAL_ALL_UPDATED;

range->avg_qual.qual = 70;
range->avg_qual.level = 2;
range->avg_qual.noise = 40;
range->avg_qual.updated = 7;
range->avg_qual.qual = 50;
range->avg_qual.level = 0;
range->avg_qual.noise = 0;
range->avg_qual.updated = IW_QUAL_ALL_UPDATED;

range->min_rts = BCM43xx_MIN_RTS_THRESHOLD;
range->max_rts = BCM43xx_MAX_RTS_THRESHOLD;
Expand Down Expand Up @@ -840,6 +843,9 @@ static struct iw_statistics *bcm43xx_get_wireless_stats(struct net_device *net_d
struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
struct ieee80211softmac_device *mac = ieee80211_priv(net_dev);
struct iw_statistics *wstats;
struct ieee80211_network *network = NULL;
static int tmp_level = 0;
unsigned long flags;

wstats = &bcm->stats.wstats;
if (!mac->associated) {
Expand All @@ -857,16 +863,25 @@ static struct iw_statistics *bcm43xx_get_wireless_stats(struct net_device *net_d
wstats->qual.level = 0;
wstats->qual.noise = 0;
wstats->qual.updated = 7;
wstats->qual.updated |= IW_QUAL_NOISE_INVALID |
IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID;
wstats->qual.updated |= IW_QUAL_ALL_UPDATED;
return wstats;
}
/* fill in the real statistics when iface associated */
wstats->qual.qual = 100; // TODO: get the real signal quality
wstats->qual.level = 3 - bcm->stats.link_quality;
spin_lock_irqsave(&mac->ieee->lock, flags);
list_for_each_entry(network, &mac->ieee->network_list, list) {
if (!memcmp(mac->associnfo.bssid, network->bssid, ETH_ALEN)) {
if (!tmp_level) /* get initial value */
tmp_level = network->stats.rssi;
else /* smooth results */
tmp_level = (7 * tmp_level + network->stats.rssi)/8;
break;
}
}
spin_unlock_irqrestore(&mac->ieee->lock, flags);
wstats->qual.level = tmp_level;
wstats->qual.qual = 100 + tmp_level - RX_POWER_MAX; // TODO: get the real signal quality
wstats->qual.noise = bcm->stats.noise;
wstats->qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED |
IW_QUAL_NOISE_UPDATED;
wstats->qual.updated = IW_QUAL_ALL_UPDATED;
wstats->discard.code = bcm->ieee->ieee_stats.rx_discards_undecryptable;
wstats->discard.retries = bcm->ieee->ieee_stats.tx_retry_limit_exceeded;
wstats->discard.nwid = bcm->ieee->ieee_stats.tx_discards_wrong_sa;
Expand Down

0 comments on commit ce122dd

Please sign in to comment.