aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-4965.c
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 /drivers/net/wireless/iwlwifi/iwl-4965.c
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>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-4965.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c174
1 files changed, 4 insertions, 170 deletions
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/**