diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2008-06-30 05:23:07 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-30 17:37:39 -0400 |
commit | 8f91aecb4cdc2d786df8941e827b9dff3c10a4e4 (patch) | |
tree | 868178c41e3559b7f91bda02a78f4a9caea79fe6 /drivers/net/wireless/iwlwifi/iwl-rx.c | |
parent | 43d59b323743b8a01e9ad1a1b31b0d7c0ef6e35a (diff) |
iwlwifi: move RX stats to core, and move temperature to handler
This patch moves RX stats flow to core modules, and moves temperature
calibration to handler since it is not needed in 5000.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-rx.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-rx.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index c24844802a88..b3ca1375c01a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
@@ -466,3 +466,78 @@ void iwl_rx_missed_beacon_notif(struct iwl_priv *priv, | |||
466 | } | 466 | } |
467 | } | 467 | } |
468 | EXPORT_SYMBOL(iwl_rx_missed_beacon_notif); | 468 | EXPORT_SYMBOL(iwl_rx_missed_beacon_notif); |
469 | |||
470 | |||
471 | /* Calculate noise level, based on measurements during network silence just | ||
472 | * before arriving beacon. This measurement can be done only if we know | ||
473 | * exactly when to expect beacons, therefore only when we're associated. */ | ||
474 | static void iwl_rx_calc_noise(struct iwl_priv *priv) | ||
475 | { | ||
476 | struct statistics_rx_non_phy *rx_info | ||
477 | = &(priv->statistics.rx.general); | ||
478 | int num_active_rx = 0; | ||
479 | int total_silence = 0; | ||
480 | int bcn_silence_a = | ||
481 | le32_to_cpu(rx_info->beacon_silence_rssi_a) & IN_BAND_FILTER; | ||
482 | int bcn_silence_b = | ||
483 | le32_to_cpu(rx_info->beacon_silence_rssi_b) & IN_BAND_FILTER; | ||
484 | int bcn_silence_c = | ||
485 | le32_to_cpu(rx_info->beacon_silence_rssi_c) & IN_BAND_FILTER; | ||
486 | |||
487 | if (bcn_silence_a) { | ||
488 | total_silence += bcn_silence_a; | ||
489 | num_active_rx++; | ||
490 | } | ||
491 | if (bcn_silence_b) { | ||
492 | total_silence += bcn_silence_b; | ||
493 | num_active_rx++; | ||
494 | } | ||
495 | if (bcn_silence_c) { | ||
496 | total_silence += bcn_silence_c; | ||
497 | num_active_rx++; | ||
498 | } | ||
499 | |||
500 | /* Average among active antennas */ | ||
501 | if (num_active_rx) | ||
502 | priv->last_rx_noise = (total_silence / num_active_rx) - 107; | ||
503 | else | ||
504 | priv->last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE; | ||
505 | |||
506 | IWL_DEBUG_CALIB("inband silence a %u, b %u, c %u, dBm %d\n", | ||
507 | bcn_silence_a, bcn_silence_b, bcn_silence_c, | ||
508 | priv->last_rx_noise); | ||
509 | } | ||
510 | |||
511 | #define REG_RECALIB_PERIOD (60) | ||
512 | |||
513 | void iwl_rx_statistics(struct iwl_priv *priv, | ||
514 | struct iwl_rx_mem_buffer *rxb) | ||
515 | { | ||
516 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | ||
517 | |||
518 | IWL_DEBUG_RX("Statistics notification received (%d vs %d).\n", | ||
519 | (int)sizeof(priv->statistics), pkt->len); | ||
520 | |||
521 | memcpy(&priv->statistics, &pkt->u.stats, sizeof(priv->statistics)); | ||
522 | |||
523 | set_bit(STATUS_STATISTICS, &priv->status); | ||
524 | |||
525 | /* Reschedule the statistics timer to occur in | ||
526 | * REG_RECALIB_PERIOD seconds to ensure we get a | ||
527 | * thermal update even if the uCode doesn't give | ||
528 | * us one */ | ||
529 | mod_timer(&priv->statistics_periodic, jiffies + | ||
530 | msecs_to_jiffies(REG_RECALIB_PERIOD * 1000)); | ||
531 | |||
532 | if (unlikely(!test_bit(STATUS_SCANNING, &priv->status)) && | ||
533 | (pkt->hdr.cmd == STATISTICS_NOTIFICATION)) { | ||
534 | iwl_rx_calc_noise(priv); | ||
535 | queue_work(priv->workqueue, &priv->run_time_calib_work); | ||
536 | } | ||
537 | |||
538 | iwl_leds_background(priv); | ||
539 | |||
540 | if (priv->cfg->ops->lib->temperature) | ||
541 | priv->cfg->ops->lib->temperature(priv, &pkt->u.stats); | ||
542 | } | ||
543 | EXPORT_SYMBOL(iwl_rx_statistics); | ||