aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-3945.c
diff options
context:
space:
mode:
authorBruno Randolf <br1@einfach.org>2008-05-08 13:15:40 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-14 16:29:49 -0400
commit566bfe5a8bcde13188a356f77666f8115813cf31 (patch)
tree785412c505e9efbd0fac477d71c8ca6945ffce04 /drivers/net/wireless/iwlwifi/iwl-3945.c
parentfac371d9f09f461dfe9fbbceb2a38e2e12164dda (diff)
mac80211: use hardware flags for signal/noise units
trying to clean up the signal/noise code. the previous code in mac80211 had confusing names for the related variables, did not have much definition of what units of signal and noise were provided and used implicit mechanisms from the wireless extensions. this patch introduces hardware capability flags to let the hardware specify clearly if it can provide signal and noise level values and which units it can provide. this also anticipates possible new units like RCPI in the future. for signal: IEEE80211_HW_SIGNAL_UNSPEC - unspecified, unknown, hw specific IEEE80211_HW_SIGNAL_DB - dB difference to unspecified reference point IEEE80211_HW_SIGNAL_DBM - dBm, difference to 1mW for noise we currently only have dBm: IEEE80211_HW_NOISE_DBM - dBm, difference to 1mW if IEEE80211_HW_SIGNAL_UNSPEC or IEEE80211_HW_SIGNAL_DB is used the driver has to provide the maximum value (max_signal) it reports in order for applications to make sense of the signal values. i tried my best to find out for each driver what it can provide and update it but i'm not sure (?) for some of them and used the more conservative guess in doubt. this can be fixed easily after this patch has been merged by changing the hardware flags of the driver. DRIVER SIGNAL MAX NOISE QUAL ----------------------------------------------------------------- adm8211 unspec(?) 100 n/a missing at76_usb unspec(?) (?) unused missing ath5k dBm dBm percent rssi b43legacy dBm dBm percent jssi(?) b43 dBm dBm percent jssi(?) iwl-3945 dBm dBm percent snr+more iwl-4965 dBm dBm percent snr+more p54 unspec 127 n/a missing rt2x00 dBm n/a percent rssi+tx/rx frame success rt2400 dBm n/a rt2500pci dBm n/a rt2500usb dBm n/a rt61pci dBm n/a rt73usb dBm n/a rtl8180 unspec(?) 65 n/a (?) rtl8187 unspec(?) 65 (?) noise(?) zd1211 dB(?) 100 n/a percent drivers/net/wireless/ath5k/base.c: Changes-licensed-under: 3-Clause-BSD Signed-off-by: Bruno Randolf <br1@einfach.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-3945.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 8464397f781..d7beeff2642 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -520,7 +520,7 @@ static void iwl3945_add_radiotap(struct iwl3945_priv *priv,
520{ 520{
521 /* First cache any information we need before we overwrite 521 /* First cache any information we need before we overwrite
522 * the information provided in the skb from the hardware */ 522 * the information provided in the skb from the hardware */
523 s8 signal = stats->ssi; 523 s8 signal = stats->signal;
524 s8 noise = 0; 524 s8 noise = 0;
525 int rate = stats->rate_idx; 525 int rate = stats->rate_idx;
526 u64 tsf = stats->mactime; 526 u64 tsf = stats->mactime;
@@ -693,7 +693,7 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,
693 } 693 }
694 694
695 /* Convert 3945's rssi indicator to dBm */ 695 /* Convert 3945's rssi indicator to dBm */
696 rx_status.ssi = rx_stats->rssi - IWL_RSSI_OFFSET; 696 rx_status.signal = rx_stats->rssi - IWL_RSSI_OFFSET;
697 697
698 /* Set default noise value to -127 */ 698 /* Set default noise value to -127 */
699 if (priv->last_rx_noise == 0) 699 if (priv->last_rx_noise == 0)
@@ -712,21 +712,21 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,
712 * Calculate rx_status.signal (quality indicator in %) based on SNR. */ 712 * Calculate rx_status.signal (quality indicator in %) based on SNR. */
713 if (rx_stats_noise_diff) { 713 if (rx_stats_noise_diff) {
714 snr = rx_stats_sig_avg / rx_stats_noise_diff; 714 snr = rx_stats_sig_avg / rx_stats_noise_diff;
715 rx_status.noise = rx_status.ssi - 715 rx_status.noise = rx_status.signal -
716 iwl3945_calc_db_from_ratio(snr); 716 iwl3945_calc_db_from_ratio(snr);
717 rx_status.signal = iwl3945_calc_sig_qual(rx_status.ssi, 717 rx_status.qual = iwl3945_calc_sig_qual(rx_status.signal,
718 rx_status.noise); 718 rx_status.noise);
719 719
720 /* If noise info not available, calculate signal quality indicator (%) 720 /* If noise info not available, calculate signal quality indicator (%)
721 * using just the dBm signal level. */ 721 * using just the dBm signal level. */
722 } else { 722 } else {
723 rx_status.noise = priv->last_rx_noise; 723 rx_status.noise = priv->last_rx_noise;
724 rx_status.signal = iwl3945_calc_sig_qual(rx_status.ssi, 0); 724 rx_status.qual = iwl3945_calc_sig_qual(rx_status.signal, 0);
725 } 725 }
726 726
727 727
728 IWL_DEBUG_STATS("Rssi %d noise %d qual %d sig_avg %d noise_diff %d\n", 728 IWL_DEBUG_STATS("Rssi %d noise %d qual %d sig_avg %d noise_diff %d\n",
729 rx_status.ssi, rx_status.noise, rx_status.signal, 729 rx_status.signal, rx_status.noise, rx_status.qual,
730 rx_stats_sig_avg, rx_stats_noise_diff); 730 rx_stats_sig_avg, rx_stats_noise_diff);
731 731
732 header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt); 732 header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt);
@@ -736,8 +736,8 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,
736 IWL_DEBUG_STATS_LIMIT("[%c] %d RSSI:%d Signal:%u, Noise:%u, Rate:%u\n", 736 IWL_DEBUG_STATS_LIMIT("[%c] %d RSSI:%d Signal:%u, Noise:%u, Rate:%u\n",
737 network_packet ? '*' : ' ', 737 network_packet ? '*' : ' ',
738 le16_to_cpu(rx_hdr->channel), 738 le16_to_cpu(rx_hdr->channel),
739 rx_status.ssi, rx_status.ssi, 739 rx_status.signal, rx_status.signal,
740 rx_status.ssi, rx_status.rate_idx); 740 rx_status.noise, rx_status.rate_idx);
741 741
742#ifdef CONFIG_IWL3945_DEBUG 742#ifdef CONFIG_IWL3945_DEBUG
743 if (iwl3945_debug_level & (IWL_DL_RX)) 743 if (iwl3945_debug_level & (IWL_DL_RX))
@@ -748,7 +748,7 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,
748 if (network_packet) { 748 if (network_packet) {
749 priv->last_beacon_time = le32_to_cpu(rx_end->beacon_timestamp); 749 priv->last_beacon_time = le32_to_cpu(rx_end->beacon_timestamp);
750 priv->last_tsf = le64_to_cpu(rx_end->timestamp); 750 priv->last_tsf = le64_to_cpu(rx_end->timestamp);
751 priv->last_rx_rssi = rx_status.ssi; 751 priv->last_rx_rssi = rx_status.signal;
752 priv->last_rx_noise = rx_status.noise; 752 priv->last_rx_noise = rx_status.noise;
753 } 753 }
754 754