Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 35116
b: refs/heads/master
c: 27be44f
h: refs/heads/master
v: v3
  • Loading branch information
Larry Finger authored and John W. Linville committed Jul 27, 2006
1 parent 34e66e0 commit 7d80c15
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 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: 58e5528ee464d38040b9489e10033c9387a10d56
refs/heads/master: 27be44ff8ee29e945adad226cc360c9278239d17
28 changes: 15 additions & 13 deletions trunk/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@
#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
/* FIXME: the next line is a guess as to what the maximum RSSI value might be */
#define RX_RSSI_MAX 60


static int bcm43xx_wx_get_name(struct net_device *net_dev,
Expand Down Expand Up @@ -230,9 +229,8 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev,
range->throughput = 27 * 1000 * 1000;

range->max_qual.qual = 100;
/* TODO: Real max RSSI */
range->max_qual.level = 0;
range->max_qual.noise = 0;
range->max_qual.level = 152; /* set floor at -104 dBm (152 - 256) */
range->max_qual.noise = 152;
range->max_qual.updated = IW_QUAL_ALL_UPDATED;

range->avg_qual.qual = 50;
Expand Down Expand Up @@ -845,6 +843,7 @@ static struct iw_statistics *bcm43xx_get_wireless_stats(struct net_device *net_d
struct iw_statistics *wstats;
struct ieee80211_network *network = NULL;
static int tmp_level = 0;
static int tmp_qual = 0;
unsigned long flags;

wstats = &bcm->stats.wstats;
Expand All @@ -863,25 +862,28 @@ 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_ALL_UPDATED;
wstats->qual.updated |= IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
return wstats;
}
/* fill in the real statistics when iface associated */
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;
if (!tmp_level) { /* get initial values */
tmp_level = network->stats.signal;
tmp_qual = network->stats.rssi;
} else { /* smooth results */
tmp_level = (15 * tmp_level + network->stats.signal)/16;
tmp_qual = (15 * tmp_qual + network->stats.rssi)/16;
}
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.qual = 100 * tmp_qual / RX_RSSI_MAX;
wstats->qual.noise = bcm->stats.noise;
wstats->qual.updated = IW_QUAL_ALL_UPDATED;
wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
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
5 changes: 2 additions & 3 deletions trunk/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,16 +492,15 @@ int bcm43xx_rx(struct bcm43xx_private *bcm,

memset(&stats, 0, sizeof(stats));
stats.mac_time = le16_to_cpu(rxhdr->mactime);
stats.rssi = bcm43xx_rssi_postprocess(bcm, rxhdr->rssi, is_ofdm,
stats.rssi = rxhdr->rssi;
stats.signal = bcm43xx_rssi_postprocess(bcm, rxhdr->rssi, is_ofdm,
!!(rxflags1 & BCM43xx_RXHDR_FLAGS1_2053RSSIADJ),
!!(rxflags3 & BCM43xx_RXHDR_FLAGS3_2050RSSIADJ));
stats.signal = rxhdr->signal_quality; //FIXME
//TODO stats.noise =
if (is_ofdm)
stats.rate = bcm43xx_plcp_get_bitrate_ofdm(plcp);
else
stats.rate = bcm43xx_plcp_get_bitrate_cck(plcp);
//printk("RX ofdm %d, rate == %u\n", is_ofdm, stats.rate);
stats.received_channel = radio->channel;
//TODO stats.control =
stats.mask = IEEE80211_STATMASK_SIGNAL |
Expand Down

0 comments on commit 7d80c15

Please sign in to comment.