aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2011-02-28 08:33:17 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-02-28 14:11:36 -0500
commit67289941d80f18fd8239e350e015a4b84878412b (patch)
treeacc5e98bfdc1f1fcf19ac0bc7698fa6f581cc5a6 /drivers/net/wireless/iwlwifi/iwl-agn-rx.c
parentad6e82a5348e494c0023d77fa55933f23b55711c (diff)
iwlwifi: move remaining iwl-agn-rx.c code into iwl-rx.c
There is no need to have separate iwl-agn-rx.c file after iwlegacy split. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Acked-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn-rx.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rx.c264
1 files changed, 0 insertions, 264 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
deleted file mode 100644
index 7a89a55ec316..000000000000
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
+++ /dev/null
@@ -1,264 +0,0 @@
1/******************************************************************************
2 *
3 * GPL LICENSE SUMMARY
4 *
5 * Copyright(c) 2008 - 2010 Intel Corporation. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
19 * USA
20 *
21 * The full GNU General Public License is included in this distribution
22 * in the file called LICENSE.GPL.
23 *
24 * Contact Information:
25 * Intel Linux Wireless <ilw@linux.intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *
28 *****************************************************************************/
29
30#include <linux/kernel.h>
31#include <linux/module.h>
32#include <linux/init.h>
33#include <linux/sched.h>
34
35#include "iwl-dev.h"
36#include "iwl-core.h"
37#include "iwl-agn-calib.h"
38#include "iwl-sta.h"
39#include "iwl-io.h"
40#include "iwl-helpers.h"
41#include "iwl-agn-hw.h"
42#include "iwl-agn.h"
43
44void iwl_rx_missed_beacon_notif(struct iwl_priv *priv,
45 struct iwl_rx_mem_buffer *rxb)
46
47{
48 struct iwl_rx_packet *pkt = rxb_addr(rxb);
49 struct iwl_missed_beacon_notif *missed_beacon;
50
51 missed_beacon = &pkt->u.missed_beacon;
52 if (le32_to_cpu(missed_beacon->consecutive_missed_beacons) >
53 priv->missed_beacon_threshold) {
54 IWL_DEBUG_CALIB(priv,
55 "missed bcn cnsq %d totl %d rcd %d expctd %d\n",
56 le32_to_cpu(missed_beacon->consecutive_missed_beacons),
57 le32_to_cpu(missed_beacon->total_missed_becons),
58 le32_to_cpu(missed_beacon->num_recvd_beacons),
59 le32_to_cpu(missed_beacon->num_expected_beacons));
60 if (!test_bit(STATUS_SCANNING, &priv->status))
61 iwl_init_sensitivity(priv);
62 }
63}
64
65/* Calculate noise level, based on measurements during network silence just
66 * before arriving beacon. This measurement can be done only if we know
67 * exactly when to expect beacons, therefore only when we're associated. */
68static void iwl_rx_calc_noise(struct iwl_priv *priv)
69{
70 struct statistics_rx_non_phy *rx_info;
71 int num_active_rx = 0;
72 int total_silence = 0;
73 int bcn_silence_a, bcn_silence_b, bcn_silence_c;
74 int last_rx_noise;
75
76 if (iwl_bt_statistics(priv))
77 rx_info = &(priv->_agn.statistics_bt.rx.general.common);
78 else
79 rx_info = &(priv->_agn.statistics.rx.general);
80 bcn_silence_a =
81 le32_to_cpu(rx_info->beacon_silence_rssi_a) & IN_BAND_FILTER;
82 bcn_silence_b =
83 le32_to_cpu(rx_info->beacon_silence_rssi_b) & IN_BAND_FILTER;
84 bcn_silence_c =
85 le32_to_cpu(rx_info->beacon_silence_rssi_c) & IN_BAND_FILTER;
86
87 if (bcn_silence_a) {
88 total_silence += bcn_silence_a;
89 num_active_rx++;
90 }
91 if (bcn_silence_b) {
92 total_silence += bcn_silence_b;
93 num_active_rx++;
94 }
95 if (bcn_silence_c) {
96 total_silence += bcn_silence_c;
97 num_active_rx++;
98 }
99
100 /* Average among active antennas */
101 if (num_active_rx)
102 last_rx_noise = (total_silence / num_active_rx) - 107;
103 else
104 last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE;
105
106 IWL_DEBUG_CALIB(priv, "inband silence a %u, b %u, c %u, dBm %d\n",
107 bcn_silence_a, bcn_silence_b, bcn_silence_c,
108 last_rx_noise);
109}
110
111#ifdef CONFIG_IWLWIFI_DEBUGFS
112/*
113 * based on the assumption of all statistics counter are in DWORD
114 * FIXME: This function is for debugging, do not deal with
115 * the case of counters roll-over.
116 */
117static void iwl_accumulative_statistics(struct iwl_priv *priv,
118 __le32 *stats)
119{
120 int i, size;
121 __le32 *prev_stats;
122 u32 *accum_stats;
123 u32 *delta, *max_delta;
124 struct statistics_general_common *general, *accum_general;
125 struct statistics_tx *tx, *accum_tx;
126
127 if (iwl_bt_statistics(priv)) {
128 prev_stats = (__le32 *)&priv->_agn.statistics_bt;
129 accum_stats = (u32 *)&priv->_agn.accum_statistics_bt;
130 size = sizeof(struct iwl_bt_notif_statistics);
131 general = &priv->_agn.statistics_bt.general.common;
132 accum_general = &priv->_agn.accum_statistics_bt.general.common;
133 tx = &priv->_agn.statistics_bt.tx;
134 accum_tx = &priv->_agn.accum_statistics_bt.tx;
135 delta = (u32 *)&priv->_agn.delta_statistics_bt;
136 max_delta = (u32 *)&priv->_agn.max_delta_bt;
137 } else {
138 prev_stats = (__le32 *)&priv->_agn.statistics;
139 accum_stats = (u32 *)&priv->_agn.accum_statistics;
140 size = sizeof(struct iwl_notif_statistics);
141 general = &priv->_agn.statistics.general.common;
142 accum_general = &priv->_agn.accum_statistics.general.common;
143 tx = &priv->_agn.statistics.tx;
144 accum_tx = &priv->_agn.accum_statistics.tx;
145 delta = (u32 *)&priv->_agn.delta_statistics;
146 max_delta = (u32 *)&priv->_agn.max_delta;
147 }
148 for (i = sizeof(__le32); i < size;
149 i += sizeof(__le32), stats++, prev_stats++, delta++,
150 max_delta++, accum_stats++) {
151 if (le32_to_cpu(*stats) > le32_to_cpu(*prev_stats)) {
152 *delta = (le32_to_cpu(*stats) -
153 le32_to_cpu(*prev_stats));
154 *accum_stats += *delta;
155 if (*delta > *max_delta)
156 *max_delta = *delta;
157 }
158 }
159
160 /* reset accumulative statistics for "no-counter" type statistics */
161 accum_general->temperature = general->temperature;
162 accum_general->temperature_m = general->temperature_m;
163 accum_general->ttl_timestamp = general->ttl_timestamp;
164 accum_tx->tx_power.ant_a = tx->tx_power.ant_a;
165 accum_tx->tx_power.ant_b = tx->tx_power.ant_b;
166 accum_tx->tx_power.ant_c = tx->tx_power.ant_c;
167}
168#endif
169
170#define REG_RECALIB_PERIOD (60)
171
172void iwl_rx_statistics(struct iwl_priv *priv,
173 struct iwl_rx_mem_buffer *rxb)
174{
175 int change;
176 struct iwl_rx_packet *pkt = rxb_addr(rxb);
177
178 if (iwl_bt_statistics(priv)) {
179 IWL_DEBUG_RX(priv,
180 "Statistics notification received (%d vs %d).\n",
181 (int)sizeof(struct iwl_bt_notif_statistics),
182 le32_to_cpu(pkt->len_n_flags) &
183 FH_RSCSR_FRAME_SIZE_MSK);
184
185 change = ((priv->_agn.statistics_bt.general.common.temperature !=
186 pkt->u.stats_bt.general.common.temperature) ||
187 ((priv->_agn.statistics_bt.flag &
188 STATISTICS_REPLY_FLG_HT40_MODE_MSK) !=
189 (pkt->u.stats_bt.flag &
190 STATISTICS_REPLY_FLG_HT40_MODE_MSK)));
191#ifdef CONFIG_IWLWIFI_DEBUGFS
192 iwl_accumulative_statistics(priv, (__le32 *)&pkt->u.stats_bt);
193#endif
194
195 } else {
196 IWL_DEBUG_RX(priv,
197 "Statistics notification received (%d vs %d).\n",
198 (int)sizeof(struct iwl_notif_statistics),
199 le32_to_cpu(pkt->len_n_flags) &
200 FH_RSCSR_FRAME_SIZE_MSK);
201
202 change = ((priv->_agn.statistics.general.common.temperature !=
203 pkt->u.stats.general.common.temperature) ||
204 ((priv->_agn.statistics.flag &
205 STATISTICS_REPLY_FLG_HT40_MODE_MSK) !=
206 (pkt->u.stats.flag &
207 STATISTICS_REPLY_FLG_HT40_MODE_MSK)));
208#ifdef CONFIG_IWLWIFI_DEBUGFS
209 iwl_accumulative_statistics(priv, (__le32 *)&pkt->u.stats);
210#endif
211
212 }
213
214 iwl_recover_from_statistics(priv, pkt);
215
216 if (iwl_bt_statistics(priv))
217 memcpy(&priv->_agn.statistics_bt, &pkt->u.stats_bt,
218 sizeof(priv->_agn.statistics_bt));
219 else
220 memcpy(&priv->_agn.statistics, &pkt->u.stats,
221 sizeof(priv->_agn.statistics));
222
223 set_bit(STATUS_STATISTICS, &priv->status);
224
225 /* Reschedule the statistics timer to occur in
226 * REG_RECALIB_PERIOD seconds to ensure we get a
227 * thermal update even if the uCode doesn't give
228 * us one */
229 mod_timer(&priv->statistics_periodic, jiffies +
230 msecs_to_jiffies(REG_RECALIB_PERIOD * 1000));
231
232 if (unlikely(!test_bit(STATUS_SCANNING, &priv->status)) &&
233 (pkt->hdr.cmd == STATISTICS_NOTIFICATION)) {
234 iwl_rx_calc_noise(priv);
235 queue_work(priv->workqueue, &priv->run_time_calib_work);
236 }
237 if (priv->cfg->ops->lib->temp_ops.temperature && change)
238 priv->cfg->ops->lib->temp_ops.temperature(priv);
239}
240
241void iwl_reply_statistics(struct iwl_priv *priv,
242 struct iwl_rx_mem_buffer *rxb)
243{
244 struct iwl_rx_packet *pkt = rxb_addr(rxb);
245
246 if (le32_to_cpu(pkt->u.stats.flag) & UCODE_STATISTICS_CLEAR_MSK) {
247#ifdef CONFIG_IWLWIFI_DEBUGFS
248 memset(&priv->_agn.accum_statistics, 0,
249 sizeof(struct iwl_notif_statistics));
250 memset(&priv->_agn.delta_statistics, 0,
251 sizeof(struct iwl_notif_statistics));
252 memset(&priv->_agn.max_delta, 0,
253 sizeof(struct iwl_notif_statistics));
254 memset(&priv->_agn.accum_statistics_bt, 0,
255 sizeof(struct iwl_bt_notif_statistics));
256 memset(&priv->_agn.delta_statistics_bt, 0,
257 sizeof(struct iwl_bt_notif_statistics));
258 memset(&priv->_agn.max_delta_bt, 0,
259 sizeof(struct iwl_bt_notif_statistics));
260#endif
261 IWL_DEBUG_RX(priv, "Statistics have been cleared\n");
262 }
263 iwl_rx_statistics(priv, rxb);
264}