aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c24
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c24
6 files changed, 53 insertions, 14 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 51b90309ce5a..1b81545b94ea 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -285,6 +285,8 @@ static void iwl3945_handle_data_packet(struct iwl3945_priv *priv, int is_data,
285 rxb->skb = NULL; 285 rxb->skb = NULL;
286} 286}
287 287
288#define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6)
289
288static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv, 290static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,
289 struct iwl3945_rx_mem_buffer *rxb) 291 struct iwl3945_rx_mem_buffer *rxb)
290{ 292{
@@ -442,6 +444,13 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,
442 case IEEE80211_STYPE_REASSOC_RESP:{ 444 case IEEE80211_STYPE_REASSOC_RESP:{
443 struct ieee80211_mgmt *mgnt = 445 struct ieee80211_mgmt *mgnt =
444 (struct ieee80211_mgmt *)header; 446 (struct ieee80211_mgmt *)header;
447
448 /* We have just associated, give some
449 * time for the 4-way handshake if
450 * any. Don't start scan too early. */
451 priv->next_scan_jiffies = jiffies +
452 IWL_DELAY_NEXT_SCAN_AFTER_ASSOC;
453
445 priv->assoc_id = (~((1 << 15) | (1 << 14)) & 454 priv->assoc_id = (~((1 << 15) | (1 << 14)) &
446 le16_to_cpu(mgnt->u. 455 le16_to_cpu(mgnt->u.
447 assoc_resp.aid)); 456 assoc_resp.aid));
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index 75cef3ed9511..1f82061221a1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -752,6 +752,7 @@ struct iwl3945_priv {
752 752
753 /* Scan related variables */ 753 /* Scan related variables */
754 unsigned long last_scan_jiffies; 754 unsigned long last_scan_jiffies;
755 unsigned long next_scan_jiffies;
755 unsigned long scan_start; 756 unsigned long scan_start;
756 unsigned long scan_pass_start; 757 unsigned long scan_pass_start;
757 unsigned long scan_start_tsf; 758 unsigned long scan_start_tsf;
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 40c795eaabac..c8e7adfe414a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -3802,6 +3802,8 @@ static void iwl4965_update_ps_mode(struct iwl4965_priv *priv, u16 ps_bit, u8 *ad
3802 } 3802 }
3803} 3803}
3804 3804
3805#define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6)
3806
3805/* Called for REPLY_4965_RX (legacy ABG frames), or 3807/* Called for REPLY_4965_RX (legacy ABG frames), or
3806 * REPLY_RX_MPDU_CMD (HT high-throughput N frames). */ 3808 * REPLY_RX_MPDU_CMD (HT high-throughput N frames). */
3807static void iwl4965_rx_reply_rx(struct iwl4965_priv *priv, 3809static void iwl4965_rx_reply_rx(struct iwl4965_priv *priv,
@@ -3973,6 +3975,12 @@ static void iwl4965_rx_reply_rx(struct iwl4965_priv *priv,
3973 struct ieee80211_mgmt *mgnt = 3975 struct ieee80211_mgmt *mgnt =
3974 (struct ieee80211_mgmt *)header; 3976 (struct ieee80211_mgmt *)header;
3975 3977
3978 /* We have just associated, give some
3979 * time for the 4-way handshake if
3980 * any. Don't start scan too early. */
3981 priv->next_scan_jiffies = jiffies +
3982 IWL_DELAY_NEXT_SCAN_AFTER_ASSOC;
3983
3976 priv->assoc_id = (~((1 << 15) | (1 << 14)) 3984 priv->assoc_id = (~((1 << 15) | (1 << 14))
3977 & le16_to_cpu(mgnt->u.assoc_resp.aid)); 3985 & le16_to_cpu(mgnt->u.assoc_resp.aid));
3978 priv->assoc_capability = 3986 priv->assoc_capability =
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h
index 2930c10b5ed8..c06273861223 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.h
@@ -1082,6 +1082,7 @@ struct iwl4965_priv {
1082 1082
1083 /* Scan related variables */ 1083 /* Scan related variables */
1084 unsigned long last_scan_jiffies; 1084 unsigned long last_scan_jiffies;
1085 unsigned long next_scan_jiffies;
1085 unsigned long scan_start; 1086 unsigned long scan_start;
1086 unsigned long scan_pass_start; 1087 unsigned long scan_pass_start;
1087 unsigned long scan_start_tsf; 1088 unsigned long scan_start_tsf;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 71e9b7c52d57..82c1e0d45cf2 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2800,7 +2800,8 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2800 IWL_DEBUG_TX("Sending REASSOC frame\n"); 2800 IWL_DEBUG_TX("Sending REASSOC frame\n");
2801#endif 2801#endif
2802 2802
2803 if (!iwl3945_is_associated(priv) && 2803 /* drop all data frame if we are not associated */
2804 if (!iwl3945_is_associated(priv) && !priv->assoc_id &&
2804 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { 2805 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) {
2805 IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n"); 2806 IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n");
2806 goto drop_unlock; 2807 goto drop_unlock;
@@ -3737,6 +3738,7 @@ static void iwl3945_rx_scan_results_notif(struct iwl3945_priv *priv,
3737 (priv->last_scan_jiffies, jiffies))); 3738 (priv->last_scan_jiffies, jiffies)));
3738 3739
3739 priv->last_scan_jiffies = jiffies; 3740 priv->last_scan_jiffies = jiffies;
3741 priv->next_scan_jiffies = 0;
3740} 3742}
3741 3743
3742/* Service SCAN_COMPLETE_NOTIFICATION (0x84) */ 3744/* Service SCAN_COMPLETE_NOTIFICATION (0x84) */
@@ -3779,6 +3781,7 @@ static void iwl3945_rx_scan_complete_notif(struct iwl3945_priv *priv,
3779 } 3781 }
3780 3782
3781 priv->last_scan_jiffies = jiffies; 3783 priv->last_scan_jiffies = jiffies;
3784 priv->next_scan_jiffies = 0;
3782 IWL_DEBUG_INFO("Setting scan to off\n"); 3785 IWL_DEBUG_INFO("Setting scan to off\n");
3783 3786
3784 clear_bit(STATUS_SCANNING, &priv->status); 3787 clear_bit(STATUS_SCANNING, &priv->status);
@@ -6806,6 +6809,8 @@ static void iwl3945_bg_rx_replenish(struct work_struct *data)
6806 mutex_unlock(&priv->mutex); 6809 mutex_unlock(&priv->mutex);
6807} 6810}
6808 6811
6812#define IWL_DELAY_NEXT_SCAN (HZ*2)
6813
6809static void iwl3945_bg_post_associate(struct work_struct *data) 6814static void iwl3945_bg_post_associate(struct work_struct *data)
6810{ 6815{
6811 struct iwl3945_priv *priv = container_of(data, struct iwl3945_priv, 6816 struct iwl3945_priv *priv = container_of(data, struct iwl3945_priv,
@@ -6906,6 +6911,8 @@ static void iwl3945_bg_post_associate(struct work_struct *data)
6906#ifdef CONFIG_IWL3945_QOS 6911#ifdef CONFIG_IWL3945_QOS
6907 iwl3945_activate_qos(priv, 0); 6912 iwl3945_activate_qos(priv, 0);
6908#endif /* CONFIG_IWL3945_QOS */ 6913#endif /* CONFIG_IWL3945_QOS */
6914 /* we have just associated, don't start scan too early */
6915 priv->next_scan_jiffies = jiffies + IWL_DELAY_NEXT_SCAN;
6909 mutex_unlock(&priv->mutex); 6916 mutex_unlock(&priv->mutex);
6910} 6917}
6911 6918
@@ -7338,7 +7345,6 @@ static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw,
7338 7345
7339} 7346}
7340 7347
7341#define IWL_DELAY_NEXT_SCAN (HZ*2)
7342static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) 7348static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7343{ 7349{
7344 int rc = 0; 7350 int rc = 0;
@@ -7362,16 +7368,20 @@ static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7362 goto out_unlock; 7368 goto out_unlock;
7363 } 7369 }
7364 7370
7371 /* we don't schedule scan within next_scan_jiffies period */
7372 if (priv->next_scan_jiffies &&
7373 time_after(priv->next_scan_jiffies, jiffies)) {
7374 rc = -EAGAIN;
7375 goto out_unlock;
7376 }
7365 /* if we just finished scan ask for delay */ 7377 /* if we just finished scan ask for delay */
7366 if (priv->last_scan_jiffies && 7378 if (priv->last_scan_jiffies && time_after(priv->last_scan_jiffies +
7367 time_after(priv->last_scan_jiffies + IWL_DELAY_NEXT_SCAN, 7379 IWL_DELAY_NEXT_SCAN, jiffies)) {
7368 jiffies)) {
7369 rc = -EAGAIN; 7380 rc = -EAGAIN;
7370 goto out_unlock; 7381 goto out_unlock;
7371 } 7382 }
7372 if (len) { 7383 if (len) {
7373 IWL_DEBUG_SCAN("direct scan for " 7384 IWL_DEBUG_SCAN("direct scan for %s [%d]\n ",
7374 "%s [%d]\n ",
7375 iwl3945_escape_essid(ssid, len), (int)len); 7385 iwl3945_escape_essid(ssid, len), (int)len);
7376 7386
7377 priv->one_direct_scan = 1; 7387 priv->one_direct_scan = 1;
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index e15986c33d0b..670f611adf9f 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -2905,7 +2905,8 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv,
2905 IWL_DEBUG_TX("Sending REASSOC frame\n"); 2905 IWL_DEBUG_TX("Sending REASSOC frame\n");
2906#endif 2906#endif
2907 2907
2908 if (!iwl4965_is_associated(priv) && 2908 /* drop all data frame if we are not associated */
2909 if (!iwl4965_is_associated(priv) && !priv->assoc_id &&
2909 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { 2910 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) {
2910 IWL_DEBUG_DROP("Dropping - !iwl4965_is_associated\n"); 2911 IWL_DEBUG_DROP("Dropping - !iwl4965_is_associated\n");
2911 goto drop_unlock; 2912 goto drop_unlock;
@@ -4055,6 +4056,7 @@ static void iwl4965_rx_scan_results_notif(struct iwl4965_priv *priv,
4055 (priv->last_scan_jiffies, jiffies))); 4056 (priv->last_scan_jiffies, jiffies)));
4056 4057
4057 priv->last_scan_jiffies = jiffies; 4058 priv->last_scan_jiffies = jiffies;
4059 priv->next_scan_jiffies = 0;
4058} 4060}
4059 4061
4060/* Service SCAN_COMPLETE_NOTIFICATION (0x84) */ 4062/* Service SCAN_COMPLETE_NOTIFICATION (0x84) */
@@ -4097,6 +4099,7 @@ static void iwl4965_rx_scan_complete_notif(struct iwl4965_priv *priv,
4097 } 4099 }
4098 4100
4099 priv->last_scan_jiffies = jiffies; 4101 priv->last_scan_jiffies = jiffies;
4102 priv->next_scan_jiffies = 0;
4100 IWL_DEBUG_INFO("Setting scan to off\n"); 4103 IWL_DEBUG_INFO("Setting scan to off\n");
4101 4104
4102 clear_bit(STATUS_SCANNING, &priv->status); 4105 clear_bit(STATUS_SCANNING, &priv->status);
@@ -7228,6 +7231,8 @@ static void iwl4965_bg_rx_replenish(struct work_struct *data)
7228 mutex_unlock(&priv->mutex); 7231 mutex_unlock(&priv->mutex);
7229} 7232}
7230 7233
7234#define IWL_DELAY_NEXT_SCAN (HZ*2)
7235
7231static void iwl4965_bg_post_associate(struct work_struct *data) 7236static void iwl4965_bg_post_associate(struct work_struct *data)
7232{ 7237{
7233 struct iwl4965_priv *priv = container_of(data, struct iwl4965_priv, 7238 struct iwl4965_priv *priv = container_of(data, struct iwl4965_priv,
@@ -7343,6 +7348,8 @@ static void iwl4965_bg_post_associate(struct work_struct *data)
7343#ifdef CONFIG_IWL4965_QOS 7348#ifdef CONFIG_IWL4965_QOS
7344 iwl4965_activate_qos(priv, 0); 7349 iwl4965_activate_qos(priv, 0);
7345#endif /* CONFIG_IWL4965_QOS */ 7350#endif /* CONFIG_IWL4965_QOS */
7351 /* we have just associated, don't start scan too early */
7352 priv->next_scan_jiffies = jiffies + IWL_DELAY_NEXT_SCAN;
7346 mutex_unlock(&priv->mutex); 7353 mutex_unlock(&priv->mutex);
7347} 7354}
7348 7355
@@ -7811,7 +7818,6 @@ static void iwl4965_mac_erp_ie_changed(struct ieee80211_hw *hw,
7811 iwl4965_send_rxon_assoc(priv); 7818 iwl4965_send_rxon_assoc(priv);
7812} 7819}
7813 7820
7814#define IWL_DELAY_NEXT_SCAN (HZ*2)
7815static int iwl4965_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) 7821static int iwl4965_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7816{ 7822{
7817 int rc = 0; 7823 int rc = 0;
@@ -7835,16 +7841,20 @@ static int iwl4965_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7835 goto out_unlock; 7841 goto out_unlock;
7836 } 7842 }
7837 7843
7844 /* we don't schedule scan within next_scan_jiffies period */
7845 if (priv->next_scan_jiffies &&
7846 time_after(priv->next_scan_jiffies, jiffies)) {
7847 rc = -EAGAIN;
7848 goto out_unlock;
7849 }
7838 /* if we just finished scan ask for delay */ 7850 /* if we just finished scan ask for delay */
7839 if (priv->last_scan_jiffies && 7851 if (priv->last_scan_jiffies && time_after(priv->last_scan_jiffies +
7840 time_after(priv->last_scan_jiffies + IWL_DELAY_NEXT_SCAN, 7852 IWL_DELAY_NEXT_SCAN, jiffies)) {
7841 jiffies)) {
7842 rc = -EAGAIN; 7853 rc = -EAGAIN;
7843 goto out_unlock; 7854 goto out_unlock;
7844 } 7855 }
7845 if (len) { 7856 if (len) {
7846 IWL_DEBUG_SCAN("direct scan for " 7857 IWL_DEBUG_SCAN("direct scan for %s [%d]\n ",
7847 "%s [%d]\n ",
7848 iwl4965_escape_essid(ssid, len), (int)len); 7858 iwl4965_escape_essid(ssid, len), (int)len);
7849 7859
7850 priv->one_direct_scan = 1; 7860 priv->one_direct_scan = 1;