diff options
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-rx.c | 46 |
3 files changed, 30 insertions, 22 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 6b6f2d88be16..19bb567d1c52 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -3737,6 +3737,8 @@ static int iwl_init_drv(struct iwl_priv *priv) | |||
3737 | priv->force_reset[IWL_FW_RESET].reset_duration = | 3737 | priv->force_reset[IWL_FW_RESET].reset_duration = |
3738 | IWL_DELAY_NEXT_FORCE_FW_RELOAD; | 3738 | IWL_DELAY_NEXT_FORCE_FW_RELOAD; |
3739 | 3739 | ||
3740 | priv->rx_statistics_jiffies = jiffies; | ||
3741 | |||
3740 | /* Choose which receivers/antennas to use */ | 3742 | /* Choose which receivers/antennas to use */ |
3741 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 3743 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
3742 | priv->cfg->ops->hcmd->set_rxon_chain(priv, | 3744 | priv->cfg->ops->hcmd->set_rxon_chain(priv, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 58165c769cf1..6a41deba6863 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -1261,8 +1261,8 @@ struct iwl_priv { | |||
1261 | /* track IBSS manager (last beacon) status */ | 1261 | /* track IBSS manager (last beacon) status */ |
1262 | u32 ibss_manager; | 1262 | u32 ibss_manager; |
1263 | 1263 | ||
1264 | /* storing the jiffies when the plcp error rate is received */ | 1264 | /* jiffies when last recovery from statistics was performed */ |
1265 | unsigned long plcp_jiffies; | 1265 | unsigned long rx_statistics_jiffies; |
1266 | 1266 | ||
1267 | /* force reset */ | 1267 | /* force reset */ |
1268 | struct iwl_force_reset force_reset[IWL_MAX_FORCE_RESET]; | 1268 | struct iwl_force_reset force_reset[IWL_MAX_FORCE_RESET]; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index a70f1eb08e5c..7dc2d39e5cd6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
@@ -449,10 +449,8 @@ static bool iwl_good_ack_health(struct iwl_priv *priv, struct iwl_rx_packet *pkt | |||
449 | * to improve the throughput. | 449 | * to improve the throughput. |
450 | */ | 450 | */ |
451 | static bool iwl_good_plcp_health(struct iwl_priv *priv, | 451 | static bool iwl_good_plcp_health(struct iwl_priv *priv, |
452 | struct iwl_rx_packet *pkt) | 452 | struct iwl_rx_packet *pkt, unsigned int msecs) |
453 | { | 453 | { |
454 | unsigned int msecs; | ||
455 | unsigned long stamp; | ||
456 | int delta; | 454 | int delta; |
457 | int threshold = priv->cfg->base_params->plcp_delta_threshold; | 455 | int threshold = priv->cfg->base_params->plcp_delta_threshold; |
458 | 456 | ||
@@ -461,13 +459,6 @@ static bool iwl_good_plcp_health(struct iwl_priv *priv, | |||
461 | return true; | 459 | return true; |
462 | } | 460 | } |
463 | 461 | ||
464 | stamp = jiffies; | ||
465 | msecs = jiffies_to_msecs(stamp - priv->plcp_jiffies); | ||
466 | priv->plcp_jiffies = stamp; | ||
467 | |||
468 | if (msecs == 0) | ||
469 | return true; | ||
470 | |||
471 | if (iwl_bt_statistics(priv)) { | 462 | if (iwl_bt_statistics(priv)) { |
472 | struct statistics_rx_bt *cur, *old; | 463 | struct statistics_rx_bt *cur, *old; |
473 | 464 | ||
@@ -508,9 +499,21 @@ static void iwl_recover_from_statistics(struct iwl_priv *priv, | |||
508 | struct iwl_rx_packet *pkt) | 499 | struct iwl_rx_packet *pkt) |
509 | { | 500 | { |
510 | const struct iwl_mod_params *mod_params = priv->cfg->mod_params; | 501 | const struct iwl_mod_params *mod_params = priv->cfg->mod_params; |
502 | unsigned int msecs; | ||
503 | unsigned long stamp; | ||
511 | 504 | ||
512 | if (test_bit(STATUS_EXIT_PENDING, &priv->status) || | 505 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
513 | !iwl_is_any_associated(priv)) | 506 | return; |
507 | |||
508 | stamp = jiffies; | ||
509 | msecs = jiffies_to_msecs(stamp - priv->rx_statistics_jiffies); | ||
510 | |||
511 | /* Only gather statistics and update time stamp when not associated */ | ||
512 | if (!iwl_is_any_associated(priv)) | ||
513 | goto out; | ||
514 | |||
515 | /* Do not check/recover when do not have enough statistics data */ | ||
516 | if (msecs < 99) | ||
514 | return; | 517 | return; |
515 | 518 | ||
516 | if (mod_params->ack_check && !iwl_good_ack_health(priv, pkt)) { | 519 | if (mod_params->ack_check && !iwl_good_ack_health(priv, pkt)) { |
@@ -519,8 +522,18 @@ static void iwl_recover_from_statistics(struct iwl_priv *priv, | |||
519 | return; | 522 | return; |
520 | } | 523 | } |
521 | 524 | ||
522 | if (mod_params->plcp_check && !iwl_good_plcp_health(priv, pkt)) | 525 | if (mod_params->plcp_check && !iwl_good_plcp_health(priv, pkt, msecs)) |
523 | iwl_force_reset(priv, IWL_RF_RESET, false); | 526 | iwl_force_reset(priv, IWL_RF_RESET, false); |
527 | |||
528 | out: | ||
529 | if (iwl_bt_statistics(priv)) | ||
530 | memcpy(&priv->_agn.statistics_bt, &pkt->u.stats_bt, | ||
531 | sizeof(priv->_agn.statistics_bt)); | ||
532 | else | ||
533 | memcpy(&priv->_agn.statistics, &pkt->u.stats, | ||
534 | sizeof(priv->_agn.statistics)); | ||
535 | |||
536 | priv->rx_statistics_jiffies = stamp; | ||
524 | } | 537 | } |
525 | 538 | ||
526 | /* Calculate noise level, based on measurements during network silence just | 539 | /* Calculate noise level, based on measurements during network silence just |
@@ -669,13 +682,6 @@ static void iwl_rx_statistics(struct iwl_priv *priv, | |||
669 | 682 | ||
670 | iwl_recover_from_statistics(priv, pkt); | 683 | iwl_recover_from_statistics(priv, pkt); |
671 | 684 | ||
672 | if (iwl_bt_statistics(priv)) | ||
673 | memcpy(&priv->_agn.statistics_bt, &pkt->u.stats_bt, | ||
674 | sizeof(priv->_agn.statistics_bt)); | ||
675 | else | ||
676 | memcpy(&priv->_agn.statistics, &pkt->u.stats, | ||
677 | sizeof(priv->_agn.statistics)); | ||
678 | |||
679 | set_bit(STATUS_STATISTICS, &priv->status); | 685 | set_bit(STATUS_STATISTICS, &priv->status); |
680 | 686 | ||
681 | /* Reschedule the statistics timer to occur in | 687 | /* Reschedule the statistics timer to occur in |