aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-03-28 19:33:35 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-04-08 15:05:56 -0400
commit3109ece1114293b8201d9c140d02d7ce9a9fa387 (patch)
treefd04ee3aab9fde3d0b93633263bc0504d73aa418
parent21c0cbe760ca6b5d4c6927c3ec1352a843a8c11c (diff)
iwlwifi: Eliminate association from beacon
This patch removes association from beacon using bss_info_change handler for association Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-rs.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c174
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.h6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c73
4 files changed, 51 insertions, 204 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
index 90ecf26af280..32eb414899d6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
@@ -275,7 +275,7 @@ static int rs_send_lq_cmd(struct iwl_priv *priv,
275 if (flags & CMD_ASYNC) 275 if (flags & CMD_ASYNC)
276 cmd.meta.u.callback = iwl4965_lq_sync_callback; 276 cmd.meta.u.callback = iwl4965_lq_sync_callback;
277 277
278 if (iwl4965_is_associated(priv) && priv->assoc_station_added && 278 if (iwl_is_associated(priv) && priv->assoc_station_added &&
279 priv->lq_mngr.lq_ready) 279 priv->lq_mngr.lq_ready)
280 return iwl_send_cmd(priv, &cmd); 280 return iwl_send_cmd(priv, &cmd);
281 281
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 89d600cfb846..0171bb8cbbc6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -1306,7 +1306,7 @@ void iwl4965_chain_noise_reset(struct iwl_priv *priv)
1306 struct iwl4965_chain_noise_data *data = NULL; 1306 struct iwl4965_chain_noise_data *data = NULL;
1307 1307
1308 data = &(priv->chain_noise_data); 1308 data = &(priv->chain_noise_data);
1309 if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl4965_is_associated(priv)) { 1309 if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl_is_associated(priv)) {
1310 struct iwl4965_calibration_cmd cmd; 1310 struct iwl4965_calibration_cmd cmd;
1311 1311
1312 memset(&cmd, 0, sizeof(cmd)); 1312 memset(&cmd, 0, sizeof(cmd));
@@ -1581,7 +1581,7 @@ static void iwl4965_sensitivity_calibration(struct iwl_priv *priv,
1581 1581
1582 data = &(priv->sensitivity_data); 1582 data = &(priv->sensitivity_data);
1583 1583
1584 if (!iwl4965_is_associated(priv)) { 1584 if (!iwl_is_associated(priv)) {
1585 IWL_DEBUG_CALIB("<< - not associated\n"); 1585 IWL_DEBUG_CALIB("<< - not associated\n");
1586 return; 1586 return;
1587 } 1587 }
@@ -3575,77 +3575,6 @@ static int iwl4965_calc_rssi(struct iwl4965_rx_phy_res *rx_resp)
3575 3575
3576#ifdef CONFIG_IWL4965_HT 3576#ifdef CONFIG_IWL4965_HT
3577 3577
3578/* Parsed Information Elements */
3579struct ieee802_11_elems {
3580 u8 *ds_params;
3581 u8 ds_params_len;
3582 u8 *tim;
3583 u8 tim_len;
3584 u8 *ibss_params;
3585 u8 ibss_params_len;
3586 u8 *erp_info;
3587 u8 erp_info_len;
3588 u8 *ht_cap_param;
3589 u8 ht_cap_param_len;
3590 u8 *ht_extra_param;
3591 u8 ht_extra_param_len;
3592};
3593
3594static int parse_elems(u8 *start, size_t len, struct ieee802_11_elems *elems)
3595{
3596 size_t left = len;
3597 u8 *pos = start;
3598 int unknown = 0;
3599
3600 memset(elems, 0, sizeof(*elems));
3601
3602 while (left >= 2) {
3603 u8 id, elen;
3604
3605 id = *pos++;
3606 elen = *pos++;
3607 left -= 2;
3608
3609 if (elen > left)
3610 return -1;
3611
3612 switch (id) {
3613 case WLAN_EID_DS_PARAMS:
3614 elems->ds_params = pos;
3615 elems->ds_params_len = elen;
3616 break;
3617 case WLAN_EID_TIM:
3618 elems->tim = pos;
3619 elems->tim_len = elen;
3620 break;
3621 case WLAN_EID_IBSS_PARAMS:
3622 elems->ibss_params = pos;
3623 elems->ibss_params_len = elen;
3624 break;
3625 case WLAN_EID_ERP_INFO:
3626 elems->erp_info = pos;
3627 elems->erp_info_len = elen;
3628 break;
3629 case WLAN_EID_HT_CAPABILITY:
3630 elems->ht_cap_param = pos;
3631 elems->ht_cap_param_len = elen;
3632 break;
3633 case WLAN_EID_HT_EXTRA_INFO:
3634 elems->ht_extra_param = pos;
3635 elems->ht_extra_param_len = elen;
3636 break;
3637 default:
3638 unknown++;
3639 break;
3640 }
3641
3642 left -= elen;
3643 pos += elen;
3644 }
3645
3646 return 0;
3647}
3648
3649void iwl4965_init_ht_hw_capab(struct iwl_priv *priv, 3578void iwl4965_init_ht_hw_capab(struct iwl_priv *priv,
3650 struct ieee80211_ht_info *ht_info, 3579 struct ieee80211_ht_info *ht_info,
3651 enum ieee80211_band band) 3580 enum ieee80211_band band)
@@ -3862,7 +3791,6 @@ static inline void iwl4965_dbg_report_frame(struct iwl_priv *priv,
3862#endif 3791#endif
3863 3792
3864 3793
3865#define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6)
3866 3794
3867/* Called for REPLY_RX (legacy ABG frames), or 3795/* Called for REPLY_RX (legacy ABG frames), or
3868 * REPLY_RX_MPDU_CMD (HT high-throughput N frames). */ 3796 * REPLY_RX_MPDU_CMD (HT high-throughput N frames). */
@@ -3951,7 +3879,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv,
3951 * which are gathered only when associated, and indicate noise 3879 * which are gathered only when associated, and indicate noise
3952 * only for the associated network channel ... 3880 * only for the associated network channel ...
3953 * Ignore these noise values while scanning (other channels) */ 3881 * Ignore these noise values while scanning (other channels) */
3954 if (iwl4965_is_associated(priv) && 3882 if (iwl_is_associated(priv) &&
3955 !test_bit(STATUS_SCANNING, &priv->status)) { 3883 !test_bit(STATUS_SCANNING, &priv->status)) {
3956 rx_status.noise = priv->last_rx_noise; 3884 rx_status.noise = priv->last_rx_noise;
3957 rx_status.signal = iwl4965_calc_sig_qual(rx_status.ssi, 3885 rx_status.signal = iwl4965_calc_sig_qual(rx_status.ssi,
@@ -3962,7 +3890,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv,
3962 } 3890 }
3963 3891
3964 /* Reset beacon noise level if not associated. */ 3892 /* Reset beacon noise level if not associated. */
3965 if (!iwl4965_is_associated(priv)) 3893 if (!iwl_is_associated(priv))
3966 priv->last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE; 3894 priv->last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE;
3967 3895
3968 /* Set "1" to report good data frames in groups of 100 */ 3896 /* Set "1" to report good data frames in groups of 100 */
@@ -3983,101 +3911,9 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv,
3983 fc = le16_to_cpu(header->frame_control); 3911 fc = le16_to_cpu(header->frame_control);
3984 switch (fc & IEEE80211_FCTL_FTYPE) { 3912 switch (fc & IEEE80211_FCTL_FTYPE) {
3985 case IEEE80211_FTYPE_MGMT: 3913 case IEEE80211_FTYPE_MGMT:
3986
3987 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) 3914 if (priv->iw_mode == IEEE80211_IF_TYPE_AP)
3988 iwl4965_update_ps_mode(priv, fc & IEEE80211_FCTL_PM, 3915 iwl4965_update_ps_mode(priv, fc & IEEE80211_FCTL_PM,
3989 header->addr2); 3916 header->addr2);
3990 switch (fc & IEEE80211_FCTL_STYPE) {
3991 case IEEE80211_STYPE_PROBE_RESP:
3992 case IEEE80211_STYPE_BEACON:
3993 if ((priv->iw_mode == IEEE80211_IF_TYPE_STA &&
3994 !compare_ether_addr(header->addr2, priv->bssid)) ||
3995 (priv->iw_mode == IEEE80211_IF_TYPE_IBSS &&
3996 !compare_ether_addr(header->addr3, priv->bssid))) {
3997 struct ieee80211_mgmt *mgmt =
3998 (struct ieee80211_mgmt *)header;
3999 u64 timestamp =
4000 le64_to_cpu(mgmt->u.beacon.timestamp);
4001
4002 priv->timestamp0 = timestamp & 0xFFFFFFFF;
4003 priv->timestamp1 =
4004 (timestamp >> 32) & 0xFFFFFFFF;
4005 priv->beacon_int = le16_to_cpu(
4006 mgmt->u.beacon.beacon_int);
4007 if (priv->call_post_assoc_from_beacon &&
4008 (priv->iw_mode == IEEE80211_IF_TYPE_STA)) {
4009 priv->call_post_assoc_from_beacon = 0;
4010 queue_work(priv->workqueue,
4011 &priv->post_associate.work);
4012 }
4013 }
4014 break;
4015
4016 case IEEE80211_STYPE_ACTION:
4017 break;
4018
4019 /*
4020 * TODO: Use the new callback function from
4021 * mac80211 instead of sniffing these packets.
4022 */
4023 case IEEE80211_STYPE_ASSOC_RESP:
4024 case IEEE80211_STYPE_REASSOC_RESP:
4025 if (network_packet) {
4026#ifdef CONFIG_IWL4965_HT
4027 u8 *pos = NULL;
4028 struct ieee802_11_elems elems;
4029#endif /*CONFIG_IWL4965_HT */
4030 struct ieee80211_mgmt *mgnt =
4031 (struct ieee80211_mgmt *)header;
4032
4033 /* We have just associated, give some
4034 * time for the 4-way handshake if
4035 * any. Don't start scan too early. */
4036 priv->next_scan_jiffies = jiffies +
4037 IWL_DELAY_NEXT_SCAN_AFTER_ASSOC;
4038
4039 priv->assoc_id = (~((1 << 15) | (1 << 14))
4040 & le16_to_cpu(mgnt->u.assoc_resp.aid));
4041 priv->assoc_capability =
4042 le16_to_cpu(
4043 mgnt->u.assoc_resp.capab_info);
4044#ifdef CONFIG_IWL4965_HT
4045 pos = mgnt->u.assoc_resp.variable;
4046 if (!parse_elems(pos,
4047 len - (pos - (u8 *) mgnt),
4048 &elems)) {
4049 if (elems.ht_extra_param &&
4050 elems.ht_cap_param)
4051 break;
4052 }
4053#endif /*CONFIG_IWL4965_HT */
4054 /* assoc_id is 0 no association */
4055 if (!priv->assoc_id)
4056 break;
4057 if (priv->beacon_int)
4058 queue_work(priv->workqueue,
4059 &priv->post_associate.work);
4060 else
4061 priv->call_post_assoc_from_beacon = 1;
4062 }
4063
4064 break;
4065
4066 case IEEE80211_STYPE_PROBE_REQ:
4067 if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) &&
4068 !iwl4965_is_associated(priv)) {
4069 DECLARE_MAC_BUF(mac1);
4070 DECLARE_MAC_BUF(mac2);
4071 DECLARE_MAC_BUF(mac3);
4072
4073 IWL_DEBUG_DROP("Dropping (non network): "
4074 "%s, %s, %s\n",
4075 print_mac(mac1, header->addr1),
4076 print_mac(mac2, header->addr2),
4077 print_mac(mac3, header->addr3));
4078 return;
4079 }
4080 }
4081 iwl4965_handle_data_packet(priv, 0, include_phy, rxb, &rx_status); 3917 iwl4965_handle_data_packet(priv, 0, include_phy, rxb, &rx_status);
4082 break; 3918 break;
4083 3919
@@ -4136,7 +3972,6 @@ static void iwl4965_rx_reply_rx_phy(struct iwl_priv *priv,
4136 memcpy(&priv->last_phy_res[1], &(pkt->u.raw[0]), 3972 memcpy(&priv->last_phy_res[1], &(pkt->u.raw[0]),
4137 sizeof(struct iwl4965_rx_phy_res)); 3973 sizeof(struct iwl4965_rx_phy_res));
4138} 3974}
4139
4140static void iwl4965_rx_missed_beacon_notif(struct iwl_priv *priv, 3975static void iwl4965_rx_missed_beacon_notif(struct iwl_priv *priv,
4141 struct iwl4965_rx_mem_buffer *rxb) 3976 struct iwl4965_rx_mem_buffer *rxb)
4142 3977
@@ -4158,7 +3993,6 @@ static void iwl4965_rx_missed_beacon_notif(struct iwl_priv *priv,
4158 } 3993 }
4159#endif /*CONFIG_IWL4965_SENSITIVITY*/ 3994#endif /*CONFIG_IWL4965_SENSITIVITY*/
4160} 3995}
4161
4162#ifdef CONFIG_IWL4965_HT 3996#ifdef CONFIG_IWL4965_HT
4163 3997
4164/** 3998/**
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h
index 8c14e9a87c14..c8e7028cdf2a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.h
@@ -1068,7 +1068,6 @@ struct iwl_priv {
1068 u16 active_rate; 1068 u16 active_rate;
1069 u16 active_rate_basic; 1069 u16 active_rate_basic;
1070 1070
1071 u8 call_post_assoc_from_beacon;
1072 u8 assoc_station_added; 1071 u8 assoc_station_added;
1073 u8 use_ant_b_for_management_frame; /* Tx antenna selection */ 1072 u8 use_ant_b_for_management_frame; /* Tx antenna selection */
1074 u8 valid_antenna; /* Bit mask of antennas actually connected */ 1073 u8 valid_antenna; /* Bit mask of antennas actually connected */
@@ -1161,8 +1160,7 @@ struct iwl_priv {
1161 struct sk_buff *ibss_beacon; 1160 struct sk_buff *ibss_beacon;
1162 1161
1163 /* Last Rx'd beacon timestamp */ 1162 /* Last Rx'd beacon timestamp */
1164 u32 timestamp0; 1163 u64 timestamp;
1165 u32 timestamp1;
1166 u16 beacon_int; 1164 u16 beacon_int;
1167 struct iwl4965_driver_hw_info hw_setting; 1165 struct iwl4965_driver_hw_info hw_setting;
1168 struct ieee80211_vif *vif; 1166 struct ieee80211_vif *vif;
@@ -1226,7 +1224,7 @@ struct iwl_priv {
1226 struct timer_list statistics_periodic; 1224 struct timer_list statistics_periodic;
1227}; /*iwl_priv */ 1225}; /*iwl_priv */
1228 1226
1229static inline int iwl4965_is_associated(struct iwl_priv *priv) 1227static inline int iwl_is_associated(struct iwl_priv *priv)
1230{ 1228{
1231 return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; 1229 return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
1232} 1230}
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 826c912aea9a..f995af682233 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -901,7 +901,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv)
901 * an RXON_ASSOC and the new config wants the associated mask enabled, 901 * an RXON_ASSOC and the new config wants the associated mask enabled,
902 * we must clear the associated from the active configuration 902 * we must clear the associated from the active configuration
903 * before we apply the new config */ 903 * before we apply the new config */
904 if (iwl4965_is_associated(priv) && 904 if (iwl_is_associated(priv) &&
905 (priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK)) { 905 (priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK)) {
906 IWL_DEBUG_INFO("Toggling associated bit on current RXON\n"); 906 IWL_DEBUG_INFO("Toggling associated bit on current RXON\n");
907 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 907 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
@@ -967,7 +967,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv)
967 967
968 /* If we have set the ASSOC_MSK and we are in BSS mode then 968 /* If we have set the ASSOC_MSK and we are in BSS mode then
969 * add the IWL_AP_ID to the station rate table */ 969 * add the IWL_AP_ID to the station rate table */
970 if (iwl4965_is_associated(priv) && 970 if (iwl_is_associated(priv) &&
971 (priv->iw_mode == IEEE80211_IF_TYPE_STA)) { 971 (priv->iw_mode == IEEE80211_IF_TYPE_STA)) {
972 if (iwl4965_rxon_add_station(priv, priv->active_rxon.bssid_addr, 1) 972 if (iwl4965_rxon_add_station(priv, priv->active_rxon.bssid_addr, 1)
973 == IWL_INVALID_STATION) { 973 == IWL_INVALID_STATION) {
@@ -1319,7 +1319,7 @@ unsigned int iwl4965_fill_beacon_frame(struct iwl_priv *priv,
1319 const u8 *dest, int left) 1319 const u8 *dest, int left)
1320{ 1320{
1321 1321
1322 if (!iwl4965_is_associated(priv) || !priv->ibss_beacon || 1322 if (!iwl_is_associated(priv) || !priv->ibss_beacon ||
1323 ((priv->iw_mode != IEEE80211_IF_TYPE_IBSS) && 1323 ((priv->iw_mode != IEEE80211_IF_TYPE_IBSS) &&
1324 (priv->iw_mode != IEEE80211_IF_TYPE_AP))) 1324 (priv->iw_mode != IEEE80211_IF_TYPE_AP)))
1325 return 0; 1325 return 0;
@@ -1582,7 +1582,7 @@ static void iwl4965_activate_qos(struct iwl_priv *priv, u8 force)
1582 1582
1583 spin_unlock_irqrestore(&priv->lock, flags); 1583 spin_unlock_irqrestore(&priv->lock, flags);
1584 1584
1585 if (force || iwl4965_is_associated(priv)) { 1585 if (force || iwl_is_associated(priv)) {
1586 IWL_DEBUG_QOS("send QoS cmd with Qos active=%d FLAGS=0x%X\n", 1586 IWL_DEBUG_QOS("send QoS cmd with Qos active=%d FLAGS=0x%X\n",
1587 priv->qos_data.qos_active, 1587 priv->qos_data.qos_active,
1588 priv->qos_data.def_qos_parm.qos_flags); 1588 priv->qos_data.def_qos_parm.qos_flags);
@@ -1921,13 +1921,13 @@ static void iwl4965_setup_rxon_timing(struct iwl_priv *priv)
1921 conf = ieee80211_get_hw_conf(priv->hw); 1921 conf = ieee80211_get_hw_conf(priv->hw);
1922 1922
1923 spin_lock_irqsave(&priv->lock, flags); 1923 spin_lock_irqsave(&priv->lock, flags);
1924 priv->rxon_timing.timestamp.dw[1] = cpu_to_le32(priv->timestamp1); 1924 priv->rxon_timing.timestamp.dw[1] = cpu_to_le32(priv->timestamp >> 32);
1925 priv->rxon_timing.timestamp.dw[0] = cpu_to_le32(priv->timestamp0); 1925 priv->rxon_timing.timestamp.dw[0] =
1926 cpu_to_le32(priv->timestamp & 0xFFFFFFFF);
1926 1927
1927 priv->rxon_timing.listen_interval = INTEL_CONN_LISTEN_INTERVAL; 1928 priv->rxon_timing.listen_interval = INTEL_CONN_LISTEN_INTERVAL;
1928 1929
1929 tsf = priv->timestamp1; 1930 tsf = priv->timestamp;
1930 tsf = ((tsf << 32) | priv->timestamp0);
1931 1931
1932 beacon_int = priv->beacon_int; 1932 beacon_int = priv->beacon_int;
1933 spin_unlock_irqrestore(&priv->lock, flags); 1933 spin_unlock_irqrestore(&priv->lock, flags);
@@ -2374,10 +2374,10 @@ static int iwl4965_tx_skb(struct iwl_priv *priv,
2374 2374
2375 /* drop all data frame if we are not associated */ 2375 /* drop all data frame if we are not associated */
2376 if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && 2376 if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) &&
2377 (!iwl4965_is_associated(priv) || 2377 (!iwl_is_associated(priv) ||
2378 ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && !priv->assoc_id) || 2378 ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && !priv->assoc_id) ||
2379 !priv->assoc_station_added)) { 2379 !priv->assoc_station_added)) {
2380 IWL_DEBUG_DROP("Dropping - !iwl4965_is_associated\n"); 2380 IWL_DEBUG_DROP("Dropping - !iwl_is_associated\n");
2381 goto drop_unlock; 2381 goto drop_unlock;
2382 } 2382 }
2383 2383
@@ -2838,7 +2838,7 @@ static int iwl4965_get_measurement(struct iwl_priv *priv,
2838 int spectrum_resp_status; 2838 int spectrum_resp_status;
2839 int duration = le16_to_cpu(params->duration); 2839 int duration = le16_to_cpu(params->duration);
2840 2840
2841 if (iwl4965_is_associated(priv)) 2841 if (iwl_is_associated(priv))
2842 add_time = 2842 add_time =
2843 iwl4965_usecs_to_beacons( 2843 iwl4965_usecs_to_beacons(
2844 le64_to_cpu(params->start_time) - priv->last_tsf, 2844 le64_to_cpu(params->start_time) - priv->last_tsf,
@@ -2853,7 +2853,7 @@ static int iwl4965_get_measurement(struct iwl_priv *priv,
2853 cmd.len = sizeof(spectrum); 2853 cmd.len = sizeof(spectrum);
2854 spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len)); 2854 spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len));
2855 2855
2856 if (iwl4965_is_associated(priv)) 2856 if (iwl_is_associated(priv))
2857 spectrum.start_time = 2857 spectrum.start_time =
2858 iwl4965_add_beacon_time(priv->last_beacon_time, 2858 iwl4965_add_beacon_time(priv->last_beacon_time,
2859 add_time, 2859 add_time,
@@ -4504,7 +4504,7 @@ static void iwl4965_irq_handle_error(struct iwl_priv *priv)
4504 IWL_DEBUG(IWL_DL_INFO | IWL_DL_FW_ERRORS, 4504 IWL_DEBUG(IWL_DL_INFO | IWL_DL_FW_ERRORS,
4505 "Restarting adapter due to uCode error.\n"); 4505 "Restarting adapter due to uCode error.\n");
4506 4506
4507 if (iwl4965_is_associated(priv)) { 4507 if (iwl_is_associated(priv)) {
4508 memcpy(&priv->recovery_rxon, &priv->active_rxon, 4508 memcpy(&priv->recovery_rxon, &priv->active_rxon,
4509 sizeof(priv->recovery_rxon)); 4509 sizeof(priv->recovery_rxon));
4510 priv->error_recovering = 1; 4510 priv->error_recovering = 1;
@@ -4790,7 +4790,7 @@ static u16 iwl4965_get_passive_dwell_time(struct iwl_priv *priv,
4790 IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : 4790 IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 :
4791 IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; 4791 IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52;
4792 4792
4793 if (iwl4965_is_associated(priv)) { 4793 if (iwl_is_associated(priv)) {
4794 /* If we're associated, we clamp the maximum passive 4794 /* If we're associated, we clamp the maximum passive
4795 * dwell time to be 98% of the beacon interval (minus 4795 * dwell time to be 98% of the beacon interval (minus
4796 * 2 * channel tune time) */ 4796 * 2 * channel tune time) */
@@ -4830,7 +4830,7 @@ static int iwl4965_get_channels_for_scan(struct iwl_priv *priv,
4830 for (i = 0, added = 0; i < sband->n_channels; i++) { 4830 for (i = 0, added = 0; i < sband->n_channels; i++) {
4831 if (ieee80211_frequency_to_channel(channels[i].center_freq) == 4831 if (ieee80211_frequency_to_channel(channels[i].center_freq) ==
4832 le16_to_cpu(priv->active_rxon.channel)) { 4832 le16_to_cpu(priv->active_rxon.channel)) {
4833 if (iwl4965_is_associated(priv)) { 4833 if (iwl_is_associated(priv)) {
4834 IWL_DEBUG_SCAN 4834 IWL_DEBUG_SCAN
4835 ("Skipping current channel %d\n", 4835 ("Skipping current channel %d\n",
4836 le16_to_cpu(priv->active_rxon.channel)); 4836 le16_to_cpu(priv->active_rxon.channel));
@@ -5711,7 +5711,7 @@ static void iwl4965_alive_start(struct iwl_priv *priv)
5711 5711
5712 iwl4965_send_power_mode(priv, IWL_POWER_LEVEL(priv->power_mode)); 5712 iwl4965_send_power_mode(priv, IWL_POWER_LEVEL(priv->power_mode));
5713 5713
5714 if (iwl4965_is_associated(priv)) { 5714 if (iwl_is_associated(priv)) {
5715 struct iwl4965_rxon_cmd *active_rxon = 5715 struct iwl4965_rxon_cmd *active_rxon =
5716 (struct iwl4965_rxon_cmd *)(&priv->active_rxon); 5716 (struct iwl4965_rxon_cmd *)(&priv->active_rxon);
5717 5717
@@ -6129,7 +6129,7 @@ static void iwl4965_bg_request_scan(struct work_struct *data)
6129 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; 6129 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH;
6130 scan->quiet_time = IWL_ACTIVE_QUIET_TIME; 6130 scan->quiet_time = IWL_ACTIVE_QUIET_TIME;
6131 6131
6132 if (iwl4965_is_associated(priv)) { 6132 if (iwl_is_associated(priv)) {
6133 u16 interval = 0; 6133 u16 interval = 0;
6134 u32 extra; 6134 u32 extra;
6135 u32 suspend_time = 100; 6135 u32 suspend_time = 100;
@@ -6166,7 +6166,7 @@ static void iwl4965_bg_request_scan(struct work_struct *data)
6166 memcpy(scan->direct_scan[0].ssid, 6166 memcpy(scan->direct_scan[0].ssid,
6167 priv->direct_ssid, priv->direct_ssid_len); 6167 priv->direct_ssid, priv->direct_ssid_len);
6168 direct_mask = 1; 6168 direct_mask = 1;
6169 } else if (!iwl4965_is_associated(priv) && priv->essid_len) { 6169 } else if (!iwl_is_associated(priv) && priv->essid_len) {
6170 scan->direct_scan[0].id = WLAN_EID_SSID; 6170 scan->direct_scan[0].id = WLAN_EID_SSID;
6171 scan->direct_scan[0].len = priv->essid_len; 6171 scan->direct_scan[0].len = priv->essid_len;
6172 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); 6172 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len);
@@ -6999,6 +6999,7 @@ static inline void iwl4965_ht_conf(struct iwl_priv *priv,
6999} 6999}
7000#endif 7000#endif
7001 7001
7002#define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6)
7002static void iwl4965_bss_info_changed(struct ieee80211_hw *hw, 7003static void iwl4965_bss_info_changed(struct ieee80211_hw *hw,
7003 struct ieee80211_vif *vif, 7004 struct ieee80211_vif *vif,
7004 struct ieee80211_bss_conf *bss_conf, 7005 struct ieee80211_bss_conf *bss_conf,
@@ -7006,7 +7007,11 @@ static void iwl4965_bss_info_changed(struct ieee80211_hw *hw,
7006{ 7007{
7007 struct iwl_priv *priv = hw->priv; 7008 struct iwl_priv *priv = hw->priv;
7008 7009
7010 IWL_DEBUG_MAC80211("changes = 0x%X\n", changes);
7011
7009 if (changes & BSS_CHANGED_ERP_PREAMBLE) { 7012 if (changes & BSS_CHANGED_ERP_PREAMBLE) {
7013 IWL_DEBUG_MAC80211("ERP_PREAMBLE %d\n",
7014 bss_conf->use_short_preamble);
7010 if (bss_conf->use_short_preamble) 7015 if (bss_conf->use_short_preamble)
7011 priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; 7016 priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
7012 else 7017 else
@@ -7014,6 +7019,7 @@ static void iwl4965_bss_info_changed(struct ieee80211_hw *hw,
7014 } 7019 }
7015 7020
7016 if (changes & BSS_CHANGED_ERP_CTS_PROT) { 7021 if (changes & BSS_CHANGED_ERP_CTS_PROT) {
7022 IWL_DEBUG_MAC80211("ERP_CTS %d\n", bss_conf->use_cts_prot);
7017 if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ)) 7023 if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ))
7018 priv->staging_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK; 7024 priv->staging_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK;
7019 else 7025 else
@@ -7021,19 +7027,30 @@ static void iwl4965_bss_info_changed(struct ieee80211_hw *hw,
7021 } 7027 }
7022 7028
7023 if (changes & BSS_CHANGED_HT) { 7029 if (changes & BSS_CHANGED_HT) {
7030 IWL_DEBUG_MAC80211("HT %d\n", bss_conf->assoc_ht);
7024 iwl4965_ht_conf(priv, bss_conf); 7031 iwl4965_ht_conf(priv, bss_conf);
7025 iwl4965_set_rxon_chain(priv); 7032 iwl4965_set_rxon_chain(priv);
7026 } 7033 }
7027 7034
7028 if (changes & BSS_CHANGED_ASSOC) { 7035 if (changes & BSS_CHANGED_ASSOC) {
7029 /* 7036 IWL_DEBUG_MAC80211("ASSOC %d\n", bss_conf->assoc);
7030 * TODO: 7037 if (bss_conf->assoc) {
7031 * do stuff instead of sniffing assoc resp 7038 priv->assoc_id = bss_conf->aid;
7032 */ 7039 priv->beacon_int = bss_conf->beacon_int;
7040 priv->timestamp = bss_conf->timestamp;
7041 priv->assoc_capability = bss_conf->assoc_capability;
7042 priv->next_scan_jiffies = jiffies +
7043 IWL_DELAY_NEXT_SCAN_AFTER_ASSOC;
7044 queue_work(priv->workqueue, &priv->post_associate.work);
7045 } else {
7046 priv->assoc_id = 0;
7047 IWL_DEBUG_MAC80211("DISASSOC %d\n", bss_conf->assoc);
7048 }
7049 } else if (changes && iwl_is_associated(priv) && priv->assoc_id) {
7050 IWL_DEBUG_MAC80211("Associated Changes %d\n", changes);
7051 iwl4965_send_rxon_assoc(priv);
7033 } 7052 }
7034 7053
7035 if (iwl4965_is_associated(priv))
7036 iwl4965_send_rxon_assoc(priv);
7037} 7054}
7038 7055
7039static int iwl4965_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) 7056static int iwl4965_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
@@ -7166,7 +7183,7 @@ static int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
7166 7183
7167 /* FIXME: need to differenciate between static and dynamic key 7184 /* FIXME: need to differenciate between static and dynamic key
7168 * in the level of mac80211 */ 7185 * in the level of mac80211 */
7169 static_key = !iwl4965_is_associated(priv); 7186 static_key = !iwl_is_associated(priv);
7170 7187
7171 if (!static_key) { 7188 if (!static_key) {
7172 sta_id = iwl4965_hw_find_station(priv, addr); 7189 sta_id = iwl4965_hw_find_station(priv, addr);
@@ -7247,7 +7264,7 @@ static int iwl4965_mac_conf_tx(struct ieee80211_hw *hw, int queue,
7247 mutex_lock(&priv->mutex); 7264 mutex_lock(&priv->mutex);
7248 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) 7265 if (priv->iw_mode == IEEE80211_IF_TYPE_AP)
7249 iwl4965_activate_qos(priv, 1); 7266 iwl4965_activate_qos(priv, 1);
7250 else if (priv->assoc_id && iwl4965_is_associated(priv)) 7267 else if (priv->assoc_id && iwl_is_associated(priv))
7251 iwl4965_activate_qos(priv, 0); 7268 iwl4965_activate_qos(priv, 0);
7252 7269
7253 mutex_unlock(&priv->mutex); 7270 mutex_unlock(&priv->mutex);
@@ -7330,7 +7347,6 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw)
7330 spin_lock_irqsave(&priv->lock, flags); 7347 spin_lock_irqsave(&priv->lock, flags);
7331 priv->assoc_id = 0; 7348 priv->assoc_id = 0;
7332 priv->assoc_capability = 0; 7349 priv->assoc_capability = 0;
7333 priv->call_post_assoc_from_beacon = 0;
7334 priv->assoc_station_added = 0; 7350 priv->assoc_station_added = 0;
7335 7351
7336 /* new association get rid of ibss beacon skb */ 7352 /* new association get rid of ibss beacon skb */
@@ -7340,8 +7356,7 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw)
7340 priv->ibss_beacon = NULL; 7356 priv->ibss_beacon = NULL;
7341 7357
7342 priv->beacon_int = priv->hw->conf.beacon_int; 7358 priv->beacon_int = priv->hw->conf.beacon_int;
7343 priv->timestamp1 = 0; 7359 priv->timestamp = 0;
7344 priv->timestamp0 = 0;
7345 if ((priv->iw_mode == IEEE80211_IF_TYPE_STA)) 7360 if ((priv->iw_mode == IEEE80211_IF_TYPE_STA))
7346 priv->beacon_int = 0; 7361 priv->beacon_int = 0;
7347 7362