diff options
author | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2010-06-14 20:09:53 -0400 |
---|---|---|
committer | Reinette Chatre <reinette.chatre@intel.com> | 2010-06-21 13:47:12 -0400 |
commit | 278fc73c0c6014bc2f55bce898bdeaa322bf4aba (patch) | |
tree | 9b27447d23b0c07aea6cd886f074392cb1de1539 /drivers/net/wireless/iwlwifi/iwl-rx.c | |
parent | 8756371589e7d3ad15f1a385e1c09f5ae706b75e (diff) |
iwlwifi: move agn specific rx related code to iwl-agn-rx.c
To avoid having unnecessary functions in iwlcore.ko, those that
are not shared by agn and 3945, move agn specific rx related code
to iwl-agn-rx.c.
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-rx.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-rx.c | 238 |
1 files changed, 0 insertions, 238 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index 86a35376579..b437f317b97 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
@@ -205,26 +205,6 @@ err_bd: | |||
205 | } | 205 | } |
206 | EXPORT_SYMBOL(iwl_rx_queue_alloc); | 206 | EXPORT_SYMBOL(iwl_rx_queue_alloc); |
207 | 207 | ||
208 | void iwl_rx_missed_beacon_notif(struct iwl_priv *priv, | ||
209 | struct iwl_rx_mem_buffer *rxb) | ||
210 | |||
211 | { | ||
212 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | ||
213 | struct iwl_missed_beacon_notif *missed_beacon; | ||
214 | |||
215 | missed_beacon = &pkt->u.missed_beacon; | ||
216 | if (le32_to_cpu(missed_beacon->consecutive_missed_beacons) > | ||
217 | priv->missed_beacon_threshold) { | ||
218 | IWL_DEBUG_CALIB(priv, "missed bcn cnsq %d totl %d rcd %d expctd %d\n", | ||
219 | le32_to_cpu(missed_beacon->consecutive_missed_beacons), | ||
220 | le32_to_cpu(missed_beacon->total_missed_becons), | ||
221 | le32_to_cpu(missed_beacon->num_recvd_beacons), | ||
222 | le32_to_cpu(missed_beacon->num_expected_beacons)); | ||
223 | if (!test_bit(STATUS_SCANNING, &priv->status)) | ||
224 | iwl_init_sensitivity(priv); | ||
225 | } | ||
226 | } | ||
227 | EXPORT_SYMBOL(iwl_rx_missed_beacon_notif); | ||
228 | 208 | ||
229 | void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv, | 209 | void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv, |
230 | struct iwl_rx_mem_buffer *rxb) | 210 | struct iwl_rx_mem_buffer *rxb) |
@@ -243,161 +223,6 @@ void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv, | |||
243 | } | 223 | } |
244 | EXPORT_SYMBOL(iwl_rx_spectrum_measure_notif); | 224 | EXPORT_SYMBOL(iwl_rx_spectrum_measure_notif); |
245 | 225 | ||
246 | |||
247 | |||
248 | /* Calculate noise level, based on measurements during network silence just | ||
249 | * before arriving beacon. This measurement can be done only if we know | ||
250 | * exactly when to expect beacons, therefore only when we're associated. */ | ||
251 | static void iwl_rx_calc_noise(struct iwl_priv *priv) | ||
252 | { | ||
253 | struct statistics_rx_non_phy *rx_info | ||
254 | = &(priv->statistics.rx.general); | ||
255 | int num_active_rx = 0; | ||
256 | int total_silence = 0; | ||
257 | int bcn_silence_a = | ||
258 | le32_to_cpu(rx_info->beacon_silence_rssi_a) & IN_BAND_FILTER; | ||
259 | int bcn_silence_b = | ||
260 | le32_to_cpu(rx_info->beacon_silence_rssi_b) & IN_BAND_FILTER; | ||
261 | int bcn_silence_c = | ||
262 | le32_to_cpu(rx_info->beacon_silence_rssi_c) & IN_BAND_FILTER; | ||
263 | int last_rx_noise; | ||
264 | |||
265 | if (bcn_silence_a) { | ||
266 | total_silence += bcn_silence_a; | ||
267 | num_active_rx++; | ||
268 | } | ||
269 | if (bcn_silence_b) { | ||
270 | total_silence += bcn_silence_b; | ||
271 | num_active_rx++; | ||
272 | } | ||
273 | if (bcn_silence_c) { | ||
274 | total_silence += bcn_silence_c; | ||
275 | num_active_rx++; | ||
276 | } | ||
277 | |||
278 | /* Average among active antennas */ | ||
279 | if (num_active_rx) | ||
280 | last_rx_noise = (total_silence / num_active_rx) - 107; | ||
281 | else | ||
282 | last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE; | ||
283 | |||
284 | IWL_DEBUG_CALIB(priv, "inband silence a %u, b %u, c %u, dBm %d\n", | ||
285 | bcn_silence_a, bcn_silence_b, bcn_silence_c, | ||
286 | last_rx_noise); | ||
287 | } | ||
288 | |||
289 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
290 | /* | ||
291 | * based on the assumption of all statistics counter are in DWORD | ||
292 | * FIXME: This function is for debugging, do not deal with | ||
293 | * the case of counters roll-over. | ||
294 | */ | ||
295 | static void iwl_accumulative_statistics(struct iwl_priv *priv, | ||
296 | __le32 *stats) | ||
297 | { | ||
298 | int i; | ||
299 | __le32 *prev_stats; | ||
300 | u32 *accum_stats; | ||
301 | u32 *delta, *max_delta; | ||
302 | |||
303 | prev_stats = (__le32 *)&priv->statistics; | ||
304 | accum_stats = (u32 *)&priv->accum_statistics; | ||
305 | delta = (u32 *)&priv->delta_statistics; | ||
306 | max_delta = (u32 *)&priv->max_delta; | ||
307 | |||
308 | for (i = sizeof(__le32); i < sizeof(struct iwl_notif_statistics); | ||
309 | i += sizeof(__le32), stats++, prev_stats++, delta++, | ||
310 | max_delta++, accum_stats++) { | ||
311 | if (le32_to_cpu(*stats) > le32_to_cpu(*prev_stats)) { | ||
312 | *delta = (le32_to_cpu(*stats) - | ||
313 | le32_to_cpu(*prev_stats)); | ||
314 | *accum_stats += *delta; | ||
315 | if (*delta > *max_delta) | ||
316 | *max_delta = *delta; | ||
317 | } | ||
318 | } | ||
319 | |||
320 | /* reset accumulative statistics for "no-counter" type statistics */ | ||
321 | priv->accum_statistics.general.temperature = | ||
322 | priv->statistics.general.temperature; | ||
323 | priv->accum_statistics.general.temperature_m = | ||
324 | priv->statistics.general.temperature_m; | ||
325 | priv->accum_statistics.general.ttl_timestamp = | ||
326 | priv->statistics.general.ttl_timestamp; | ||
327 | priv->accum_statistics.tx.tx_power.ant_a = | ||
328 | priv->statistics.tx.tx_power.ant_a; | ||
329 | priv->accum_statistics.tx.tx_power.ant_b = | ||
330 | priv->statistics.tx.tx_power.ant_b; | ||
331 | priv->accum_statistics.tx.tx_power.ant_c = | ||
332 | priv->statistics.tx.tx_power.ant_c; | ||
333 | } | ||
334 | #endif | ||
335 | |||
336 | #define REG_RECALIB_PERIOD (60) | ||
337 | |||
338 | /** | ||
339 | * iwl_good_plcp_health - checks for plcp error. | ||
340 | * | ||
341 | * When the plcp error is exceeding the thresholds, reset the radio | ||
342 | * to improve the throughput. | ||
343 | */ | ||
344 | bool iwl_good_plcp_health(struct iwl_priv *priv, | ||
345 | struct iwl_rx_packet *pkt) | ||
346 | { | ||
347 | bool rc = true; | ||
348 | int combined_plcp_delta; | ||
349 | unsigned int plcp_msec; | ||
350 | unsigned long plcp_received_jiffies; | ||
351 | |||
352 | /* | ||
353 | * check for plcp_err and trigger radio reset if it exceeds | ||
354 | * the plcp error threshold plcp_delta. | ||
355 | */ | ||
356 | plcp_received_jiffies = jiffies; | ||
357 | plcp_msec = jiffies_to_msecs((long) plcp_received_jiffies - | ||
358 | (long) priv->plcp_jiffies); | ||
359 | priv->plcp_jiffies = plcp_received_jiffies; | ||
360 | /* | ||
361 | * check to make sure plcp_msec is not 0 to prevent division | ||
362 | * by zero. | ||
363 | */ | ||
364 | if (plcp_msec) { | ||
365 | combined_plcp_delta = | ||
366 | (le32_to_cpu(pkt->u.stats.rx.ofdm.plcp_err) - | ||
367 | le32_to_cpu(priv->statistics.rx.ofdm.plcp_err)) + | ||
368 | (le32_to_cpu(pkt->u.stats.rx.ofdm_ht.plcp_err) - | ||
369 | le32_to_cpu(priv->statistics.rx.ofdm_ht.plcp_err)); | ||
370 | |||
371 | if ((combined_plcp_delta > 0) && | ||
372 | ((combined_plcp_delta * 100) / plcp_msec) > | ||
373 | priv->cfg->plcp_delta_threshold) { | ||
374 | /* | ||
375 | * if plcp_err exceed the threshold, | ||
376 | * the following data is printed in csv format: | ||
377 | * Text: plcp_err exceeded %d, | ||
378 | * Received ofdm.plcp_err, | ||
379 | * Current ofdm.plcp_err, | ||
380 | * Received ofdm_ht.plcp_err, | ||
381 | * Current ofdm_ht.plcp_err, | ||
382 | * combined_plcp_delta, | ||
383 | * plcp_msec | ||
384 | */ | ||
385 | IWL_DEBUG_RADIO(priv, "plcp_err exceeded %u, " | ||
386 | "%u, %u, %u, %u, %d, %u mSecs\n", | ||
387 | priv->cfg->plcp_delta_threshold, | ||
388 | le32_to_cpu(pkt->u.stats.rx.ofdm.plcp_err), | ||
389 | le32_to_cpu(priv->statistics.rx.ofdm.plcp_err), | ||
390 | le32_to_cpu(pkt->u.stats.rx.ofdm_ht.plcp_err), | ||
391 | le32_to_cpu( | ||
392 | priv->statistics.rx.ofdm_ht.plcp_err), | ||
393 | combined_plcp_delta, plcp_msec); | ||
394 | rc = false; | ||
395 | } | ||
396 | } | ||
397 | return rc; | ||
398 | } | ||
399 | EXPORT_SYMBOL(iwl_good_plcp_health); | ||
400 | |||
401 | void iwl_recover_from_statistics(struct iwl_priv *priv, | 226 | void iwl_recover_from_statistics(struct iwl_priv *priv, |
402 | struct iwl_rx_packet *pkt) | 227 | struct iwl_rx_packet *pkt) |
403 | { | 228 | { |
@@ -431,69 +256,6 @@ void iwl_recover_from_statistics(struct iwl_priv *priv, | |||
431 | } | 256 | } |
432 | EXPORT_SYMBOL(iwl_recover_from_statistics); | 257 | EXPORT_SYMBOL(iwl_recover_from_statistics); |
433 | 258 | ||
434 | void iwl_rx_statistics(struct iwl_priv *priv, | ||
435 | struct iwl_rx_mem_buffer *rxb) | ||
436 | { | ||
437 | int change; | ||
438 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | ||
439 | |||
440 | |||
441 | IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n", | ||
442 | (int)sizeof(priv->statistics), | ||
443 | le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK); | ||
444 | |||
445 | change = ((priv->statistics.general.temperature != | ||
446 | pkt->u.stats.general.temperature) || | ||
447 | ((priv->statistics.flag & | ||
448 | STATISTICS_REPLY_FLG_HT40_MODE_MSK) != | ||
449 | (pkt->u.stats.flag & STATISTICS_REPLY_FLG_HT40_MODE_MSK))); | ||
450 | |||
451 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
452 | iwl_accumulative_statistics(priv, (__le32 *)&pkt->u.stats); | ||
453 | #endif | ||
454 | iwl_recover_from_statistics(priv, pkt); | ||
455 | |||
456 | memcpy(&priv->statistics, &pkt->u.stats, sizeof(priv->statistics)); | ||
457 | |||
458 | set_bit(STATUS_STATISTICS, &priv->status); | ||
459 | |||
460 | /* Reschedule the statistics timer to occur in | ||
461 | * REG_RECALIB_PERIOD seconds to ensure we get a | ||
462 | * thermal update even if the uCode doesn't give | ||
463 | * us one */ | ||
464 | mod_timer(&priv->statistics_periodic, jiffies + | ||
465 | msecs_to_jiffies(REG_RECALIB_PERIOD * 1000)); | ||
466 | |||
467 | if (unlikely(!test_bit(STATUS_SCANNING, &priv->status)) && | ||
468 | (pkt->hdr.cmd == STATISTICS_NOTIFICATION)) { | ||
469 | iwl_rx_calc_noise(priv); | ||
470 | queue_work(priv->workqueue, &priv->run_time_calib_work); | ||
471 | } | ||
472 | if (priv->cfg->ops->lib->temp_ops.temperature && change) | ||
473 | priv->cfg->ops->lib->temp_ops.temperature(priv); | ||
474 | } | ||
475 | EXPORT_SYMBOL(iwl_rx_statistics); | ||
476 | |||
477 | void iwl_reply_statistics(struct iwl_priv *priv, | ||
478 | struct iwl_rx_mem_buffer *rxb) | ||
479 | { | ||
480 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | ||
481 | |||
482 | if (le32_to_cpu(pkt->u.stats.flag) & UCODE_STATISTICS_CLEAR_MSK) { | ||
483 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
484 | memset(&priv->accum_statistics, 0, | ||
485 | sizeof(struct iwl_notif_statistics)); | ||
486 | memset(&priv->delta_statistics, 0, | ||
487 | sizeof(struct iwl_notif_statistics)); | ||
488 | memset(&priv->max_delta, 0, | ||
489 | sizeof(struct iwl_notif_statistics)); | ||
490 | #endif | ||
491 | IWL_DEBUG_RX(priv, "Statistics have been cleared\n"); | ||
492 | } | ||
493 | iwl_rx_statistics(priv, rxb); | ||
494 | } | ||
495 | EXPORT_SYMBOL(iwl_reply_statistics); | ||
496 | |||
497 | /* | 259 | /* |
498 | * returns non-zero if packet should be dropped | 260 | * returns non-zero if packet should be dropped |
499 | */ | 261 | */ |