Skip to content

Commit

Permalink
iwlwifi: remove noise reporting
Browse files Browse the repository at this point in the history
We go to great lengths to calculate this value
that is never used by mac80211. Additionally,
it is now deprecated by mac80211 and is causing
driver compilation to give warnings.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
  • Loading branch information
Johannes Berg authored and Reinette Chatre committed Mar 25, 2010
1 parent 3d2b162 commit ed1b6e9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 56 deletions.
36 changes: 5 additions & 31 deletions drivers/net/wireless/iwlwifi/iwl-3945.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,6 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
struct iwl3945_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt);
struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt);
struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt);
int snr;
u16 rx_stats_sig_avg = le16_to_cpu(rx_stats->sig_avg);
u16 rx_stats_noise_diff = le16_to_cpu(rx_stats->noise_diff);
u8 network_packet;
Expand Down Expand Up @@ -662,43 +661,19 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
/* Convert 3945's rssi indicator to dBm */
rx_status.signal = rx_stats->rssi - IWL39_RSSI_OFFSET;

/* Set default noise value to -127 */
if (priv->last_rx_noise == 0)
priv->last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE;

/* 3945 provides noise info for OFDM frames only.
* sig_avg and noise_diff are measured by the 3945's digital signal
* processor (DSP), and indicate linear levels of signal level and
* distortion/noise within the packet preamble after
* automatic gain control (AGC). sig_avg should stay fairly
* constant if the radio's AGC is working well.
* Since these values are linear (not dB or dBm), linear
* signal-to-noise ratio (SNR) is (sig_avg / noise_diff).
* Convert linear SNR to dB SNR, then subtract that from rssi dBm
* to obtain noise level in dBm.
* Calculate rx_status.signal (quality indicator in %) based on SNR. */
if (rx_stats_noise_diff) {
snr = rx_stats_sig_avg / rx_stats_noise_diff;
rx_status.noise = rx_status.signal -
iwl3945_calc_db_from_ratio(snr);
} else {
rx_status.noise = priv->last_rx_noise;
}


IWL_DEBUG_STATS(priv, "Rssi %d noise %d sig_avg %d noise_diff %d\n",
rx_status.signal, rx_status.noise,
rx_stats_sig_avg, rx_stats_noise_diff);
IWL_DEBUG_STATS(priv, "Rssi %d sig_avg %d noise_diff %d\n",
rx_status.signal, rx_stats_sig_avg,
rx_stats_noise_diff);

header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt);

network_packet = iwl3945_is_network_packet(priv, header);

IWL_DEBUG_STATS_LIMIT(priv, "[%c] %d RSSI:%d Signal:%u, Noise:%u, Rate:%u\n",
IWL_DEBUG_STATS_LIMIT(priv, "[%c] %d RSSI:%d Signal:%u, Rate:%u\n",
network_packet ? '*' : ' ',
le16_to_cpu(rx_hdr->channel),
rx_status.signal, rx_status.signal,
rx_status.noise, rx_status.rate_idx);
rx_status.rate_idx);

/* Set "1" to report good data frames in groups of 100 */
iwl3945_dbg_report_frame(priv, pkt, header, 1);
Expand All @@ -709,7 +684,6 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
le32_to_cpu(rx_end->beacon_timestamp);
priv->_3945.last_tsf = le64_to_cpu(rx_end->timestamp);
priv->_3945.last_rx_rssi = rx_status.signal;
priv->last_rx_noise = rx_status.noise;
}

iwl3945_pass_packet_to_mac80211(priv, rxb, &rx_status);
Expand Down
20 changes: 2 additions & 18 deletions drivers/net/wireless/iwlwifi/iwl-agn-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1071,30 +1071,14 @@ void iwlagn_rx_reply_rx(struct iwl_priv *priv,
/* Find max signal strength (dBm) among 3 antenna/receiver chains */
rx_status.signal = iwlagn_calc_rssi(priv, phy_res);

/* Meaningful noise values are available only from beacon statistics,
* which are gathered only when associated, and indicate noise
* only for the associated network channel ...
* Ignore these noise values while scanning (other channels) */
if (iwl_is_associated(priv) &&
!test_bit(STATUS_SCANNING, &priv->status)) {
rx_status.noise = priv->last_rx_noise;
} else {
rx_status.noise = IWL_NOISE_MEAS_NOT_AVAILABLE;
}

/* Reset beacon noise level if not associated. */
if (!iwl_is_associated(priv))
priv->last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE;

#ifdef CONFIG_IWLWIFI_DEBUG
/* Set "1" to report good data frames in groups of 100 */
if (unlikely(iwl_get_debug_level(priv) & IWL_DL_RX))
iwlagn_dbg_report_frame(priv, phy_res, len, header, 1);
#endif
iwl_dbg_log_rx_data_frame(priv, len, header);
IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, TSF %llu\n",
rx_status.signal, rx_status.noise,
(unsigned long long)rx_status.mactime);
IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, TSF %llu\n",
rx_status.signal, (unsigned long long)rx_status.mactime);

/*
* "antenna number"
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/wireless/iwlwifi/iwl-agn-rs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2940,8 +2940,6 @@ static ssize_t rs_sta_dbgfs_rate_scale_data_read(struct file *file,
desc += sprintf(buff+desc,
"Bit Rate= %d Mb/s\n",
iwl_rates[lq_sta->last_txrate_idx].ieee >> 1);
desc += sprintf(buff+desc, "Noise Level= %d dBm\n",
priv->last_rx_noise);

ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc);
return ret;
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/wireless/iwlwifi/iwl-dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -1167,8 +1167,6 @@ struct iwl_priv {

unsigned long status;

int last_rx_noise; /* From beacon statistics */

/* counts mgmt, ctl, and data packets */
struct traffic_stats tx_stats;
struct traffic_stats rx_stats;
Expand Down
7 changes: 4 additions & 3 deletions drivers/net/wireless/iwlwifi/iwl-rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ static void iwl_rx_calc_noise(struct iwl_priv *priv)
le32_to_cpu(rx_info->beacon_silence_rssi_b) & IN_BAND_FILTER;
int bcn_silence_c =
le32_to_cpu(rx_info->beacon_silence_rssi_c) & IN_BAND_FILTER;
int last_rx_noise;

if (bcn_silence_a) {
total_silence += bcn_silence_a;
Expand All @@ -275,13 +276,13 @@ static void iwl_rx_calc_noise(struct iwl_priv *priv)

/* Average among active antennas */
if (num_active_rx)
priv->last_rx_noise = (total_silence / num_active_rx) - 107;
last_rx_noise = (total_silence / num_active_rx) - 107;
else
priv->last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE;
last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE;

IWL_DEBUG_CALIB(priv, "inband silence a %u, b %u, c %u, dBm %d\n",
bcn_silence_a, bcn_silence_b, bcn_silence_c,
priv->last_rx_noise);
last_rx_noise);
}

#ifdef CONFIG_IWLWIFI_DEBUG
Expand Down

0 comments on commit ed1b6e9

Please sign in to comment.