diff options
author | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2010-02-19 01:03:06 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-02-19 15:52:50 -0500 |
commit | 8a472da431998b7357e6dc562e79a3061ed56cad (patch) | |
tree | aecc7c0220e0ac59edae6d2549da0cfe4e0a3304 /drivers/net/wireless | |
parent | d5755939e810f38c969a1d1b0effb2b75095b94e (diff) |
iwlwifi: separated time check for different type of force reset
Use different timing duration check for different type of force reset,
force reset request can come from different source and based on
different reason; one type of reset request should not block other type of
reset request.
Adding structure to keep track of different force reset request.
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.c | 25 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 14 |
3 files changed, 33 insertions, 12 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 52b6beb371fe..c5b724eaf306 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -3378,6 +3378,12 @@ static int iwl_init_drv(struct iwl_priv *priv) | |||
3378 | priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF; | 3378 | priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF; |
3379 | priv->agg_tids_count = 0; | 3379 | priv->agg_tids_count = 0; |
3380 | 3380 | ||
3381 | /* initialize force reset */ | ||
3382 | priv->force_reset[IWL_RF_RESET].reset_duration = | ||
3383 | IWL_DELAY_NEXT_FORCE_RF_RESET; | ||
3384 | priv->force_reset[IWL_FW_RESET].reset_duration = | ||
3385 | IWL_DELAY_NEXT_FORCE_FW_RELOAD; | ||
3386 | |||
3381 | /* Choose which receivers/antennas to use */ | 3387 | /* Choose which receivers/antennas to use */ |
3382 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 3388 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
3383 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 3389 | priv->cfg->ops->hcmd->set_rxon_chain(priv); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index bd56827b8fef..55252a692de7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -3357,22 +3357,30 @@ static void iwl_force_rf_reset(struct iwl_priv *priv) | |||
3357 | return; | 3357 | return; |
3358 | } | 3358 | } |
3359 | 3359 | ||
3360 | #define IWL_DELAY_NEXT_FORCE_RESET (HZ*3) | ||
3361 | 3360 | ||
3362 | int iwl_force_reset(struct iwl_priv *priv, int mode) | 3361 | int iwl_force_reset(struct iwl_priv *priv, int mode) |
3363 | { | 3362 | { |
3363 | struct iwl_force_reset *force_reset; | ||
3364 | |||
3364 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 3365 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
3365 | return -EINVAL; | 3366 | return -EINVAL; |
3366 | 3367 | ||
3367 | if (priv->last_force_reset_jiffies && | 3368 | if (mode >= IWL_MAX_FORCE_RESET) { |
3368 | time_after(priv->last_force_reset_jiffies + | 3369 | IWL_DEBUG_INFO(priv, "invalid reset request.\n"); |
3369 | IWL_DELAY_NEXT_FORCE_RESET, jiffies)) { | 3370 | return -EINVAL; |
3371 | } | ||
3372 | force_reset = &priv->force_reset[mode]; | ||
3373 | force_reset->reset_request_count++; | ||
3374 | if (force_reset->last_force_reset_jiffies && | ||
3375 | time_after(force_reset->last_force_reset_jiffies + | ||
3376 | force_reset->reset_duration, jiffies)) { | ||
3370 | IWL_DEBUG_INFO(priv, "force reset rejected\n"); | 3377 | IWL_DEBUG_INFO(priv, "force reset rejected\n"); |
3378 | force_reset->reset_reject_count++; | ||
3371 | return -EAGAIN; | 3379 | return -EAGAIN; |
3372 | } | 3380 | } |
3373 | 3381 | force_reset->reset_success_count++; | |
3382 | force_reset->last_force_reset_jiffies = jiffies; | ||
3374 | IWL_DEBUG_INFO(priv, "perform force reset (%d)\n", mode); | 3383 | IWL_DEBUG_INFO(priv, "perform force reset (%d)\n", mode); |
3375 | |||
3376 | switch (mode) { | 3384 | switch (mode) { |
3377 | case IWL_RF_RESET: | 3385 | case IWL_RF_RESET: |
3378 | iwl_force_rf_reset(priv); | 3386 | iwl_force_rf_reset(priv); |
@@ -3389,12 +3397,7 @@ int iwl_force_reset(struct iwl_priv *priv, int mode) | |||
3389 | clear_bit(STATUS_READY, &priv->status); | 3397 | clear_bit(STATUS_READY, &priv->status); |
3390 | queue_work(priv->workqueue, &priv->restart); | 3398 | queue_work(priv->workqueue, &priv->restart); |
3391 | break; | 3399 | break; |
3392 | default: | ||
3393 | IWL_DEBUG_INFO(priv, "invalid reset request.\n"); | ||
3394 | return -EINVAL; | ||
3395 | } | 3400 | } |
3396 | priv->last_force_reset_jiffies = jiffies; | ||
3397 | |||
3398 | return 0; | 3401 | return 0; |
3399 | } | 3402 | } |
3400 | 3403 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 021c68658718..7914d65a5a55 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -1036,9 +1036,21 @@ struct iwl_event_log { | |||
1036 | #define IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF (200) | 1036 | #define IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF (200) |
1037 | #define IWL_MAX_PLCP_ERR_THRESHOLD_MAX (255) | 1037 | #define IWL_MAX_PLCP_ERR_THRESHOLD_MAX (255) |
1038 | 1038 | ||
1039 | #define IWL_DELAY_NEXT_FORCE_RF_RESET (HZ*3) | ||
1040 | #define IWL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5) | ||
1041 | |||
1039 | enum iwl_reset { | 1042 | enum iwl_reset { |
1040 | IWL_RF_RESET = 0, | 1043 | IWL_RF_RESET = 0, |
1041 | IWL_FW_RESET, | 1044 | IWL_FW_RESET, |
1045 | IWL_MAX_FORCE_RESET, | ||
1046 | }; | ||
1047 | |||
1048 | struct iwl_force_reset { | ||
1049 | int reset_request_count; | ||
1050 | int reset_success_count; | ||
1051 | int reset_reject_count; | ||
1052 | unsigned long reset_duration; | ||
1053 | unsigned long last_force_reset_jiffies; | ||
1042 | }; | 1054 | }; |
1043 | 1055 | ||
1044 | struct iwl_priv { | 1056 | struct iwl_priv { |
@@ -1076,7 +1088,7 @@ struct iwl_priv { | |||
1076 | u8 agg_tids_count; | 1088 | u8 agg_tids_count; |
1077 | 1089 | ||
1078 | /* force reset */ | 1090 | /* force reset */ |
1079 | unsigned long last_force_reset_jiffies; | 1091 | struct iwl_force_reset force_reset[IWL_MAX_FORCE_RESET]; |
1080 | 1092 | ||
1081 | /* we allocate array of iwl4965_channel_info for NIC's valid channels. | 1093 | /* we allocate array of iwl4965_channel_info for NIC's valid channels. |
1082 | * Access via channel # using indirect index array */ | 1094 | * Access via channel # using indirect index array */ |