aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c69
1 files changed, 36 insertions, 33 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 59a308b02f95..94d7e6e1323d 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -33,6 +33,7 @@
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/init.h> 34#include <linux/init.h>
35#include <linux/pci.h> 35#include <linux/pci.h>
36#include <linux/pci-aspm.h>
36#include <linux/slab.h> 37#include <linux/slab.h>
37#include <linux/dma-mapping.h> 38#include <linux/dma-mapping.h>
38#include <linux/delay.h> 39#include <linux/delay.h>
@@ -151,7 +152,7 @@ static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
151 key_flags &= ~STA_KEY_FLG_INVALID; 152 key_flags &= ~STA_KEY_FLG_INVALID;
152 153
153 spin_lock_irqsave(&priv->sta_lock, flags); 154 spin_lock_irqsave(&priv->sta_lock, flags);
154 priv->stations[sta_id].keyinfo.alg = keyconf->alg; 155 priv->stations[sta_id].keyinfo.cipher = keyconf->cipher;
155 priv->stations[sta_id].keyinfo.keylen = keyconf->keylen; 156 priv->stations[sta_id].keyinfo.keylen = keyconf->keylen;
156 memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, 157 memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key,
157 keyconf->keylen); 158 keyconf->keylen);
@@ -222,23 +223,25 @@ static int iwl3945_set_dynamic_key(struct iwl_priv *priv,
222 223
223 keyconf->hw_key_idx = HW_KEY_DYNAMIC; 224 keyconf->hw_key_idx = HW_KEY_DYNAMIC;
224 225
225 switch (keyconf->alg) { 226 switch (keyconf->cipher) {
226 case ALG_CCMP: 227 case WLAN_CIPHER_SUITE_CCMP:
227 ret = iwl3945_set_ccmp_dynamic_key_info(priv, keyconf, sta_id); 228 ret = iwl3945_set_ccmp_dynamic_key_info(priv, keyconf, sta_id);
228 break; 229 break;
229 case ALG_TKIP: 230 case WLAN_CIPHER_SUITE_TKIP:
230 ret = iwl3945_set_tkip_dynamic_key_info(priv, keyconf, sta_id); 231 ret = iwl3945_set_tkip_dynamic_key_info(priv, keyconf, sta_id);
231 break; 232 break;
232 case ALG_WEP: 233 case WLAN_CIPHER_SUITE_WEP40:
234 case WLAN_CIPHER_SUITE_WEP104:
233 ret = iwl3945_set_wep_dynamic_key_info(priv, keyconf, sta_id); 235 ret = iwl3945_set_wep_dynamic_key_info(priv, keyconf, sta_id);
234 break; 236 break;
235 default: 237 default:
236 IWL_ERR(priv, "Unknown alg: %s alg = %d\n", __func__, keyconf->alg); 238 IWL_ERR(priv, "Unknown alg: %s alg=%x\n", __func__,
239 keyconf->cipher);
237 ret = -EINVAL; 240 ret = -EINVAL;
238 } 241 }
239 242
240 IWL_DEBUG_WEP(priv, "Set dynamic key: alg= %d len=%d idx=%d sta=%d ret=%d\n", 243 IWL_DEBUG_WEP(priv, "Set dynamic key: alg=%x len=%d idx=%d sta=%d ret=%d\n",
241 keyconf->alg, keyconf->keylen, keyconf->keyidx, 244 keyconf->cipher, keyconf->keylen, keyconf->keyidx,
242 sta_id, ret); 245 sta_id, ret);
243 246
244 return ret; 247 return ret;
@@ -254,10 +257,11 @@ static int iwl3945_remove_static_key(struct iwl_priv *priv)
254static int iwl3945_set_static_key(struct iwl_priv *priv, 257static int iwl3945_set_static_key(struct iwl_priv *priv,
255 struct ieee80211_key_conf *key) 258 struct ieee80211_key_conf *key)
256{ 259{
257 if (key->alg == ALG_WEP) 260 if (key->cipher == WLAN_CIPHER_SUITE_WEP40 ||
261 key->cipher == WLAN_CIPHER_SUITE_WEP104)
258 return -EOPNOTSUPP; 262 return -EOPNOTSUPP;
259 263
260 IWL_ERR(priv, "Static key invalid: alg %d\n", key->alg); 264 IWL_ERR(priv, "Static key invalid: cipher %x\n", key->cipher);
261 return -EINVAL; 265 return -EINVAL;
262} 266}
263 267
@@ -369,23 +373,25 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
369 struct iwl3945_tx_cmd *tx_cmd = (struct iwl3945_tx_cmd *)cmd->cmd.payload; 373 struct iwl3945_tx_cmd *tx_cmd = (struct iwl3945_tx_cmd *)cmd->cmd.payload;
370 struct iwl_hw_key *keyinfo = &priv->stations[sta_id].keyinfo; 374 struct iwl_hw_key *keyinfo = &priv->stations[sta_id].keyinfo;
371 375
372 switch (keyinfo->alg) { 376 tx_cmd->sec_ctl = 0;
373 case ALG_CCMP: 377
378 switch (keyinfo->cipher) {
379 case WLAN_CIPHER_SUITE_CCMP:
374 tx_cmd->sec_ctl = TX_CMD_SEC_CCM; 380 tx_cmd->sec_ctl = TX_CMD_SEC_CCM;
375 memcpy(tx_cmd->key, keyinfo->key, keyinfo->keylen); 381 memcpy(tx_cmd->key, keyinfo->key, keyinfo->keylen);
376 IWL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n"); 382 IWL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n");
377 break; 383 break;
378 384
379 case ALG_TKIP: 385 case WLAN_CIPHER_SUITE_TKIP:
380 break; 386 break;
381 387
382 case ALG_WEP: 388 case WLAN_CIPHER_SUITE_WEP104:
383 tx_cmd->sec_ctl = TX_CMD_SEC_WEP | 389 tx_cmd->sec_ctl |= TX_CMD_SEC_KEY128;
390 /* fall through */
391 case WLAN_CIPHER_SUITE_WEP40:
392 tx_cmd->sec_ctl |= TX_CMD_SEC_WEP |
384 (info->control.hw_key->hw_key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT; 393 (info->control.hw_key->hw_key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT;
385 394
386 if (keyinfo->keylen == 13)
387 tx_cmd->sec_ctl |= TX_CMD_SEC_KEY128;
388
389 memcpy(&tx_cmd->key[3], keyinfo->key, keyinfo->keylen); 395 memcpy(&tx_cmd->key[3], keyinfo->key, keyinfo->keylen);
390 396
391 IWL_DEBUG_TX(priv, "Configuring packet for WEP encryption " 397 IWL_DEBUG_TX(priv, "Configuring packet for WEP encryption "
@@ -393,7 +399,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
393 break; 399 break;
394 400
395 default: 401 default:
396 IWL_ERR(priv, "Unknown encode alg %d\n", keyinfo->alg); 402 IWL_ERR(priv, "Unknown encode cipher %x\n", keyinfo->cipher);
397 break; 403 break;
398 } 404 }
399} 405}
@@ -813,9 +819,9 @@ static void iwl3945_bg_beacon_update(struct work_struct *work)
813static void iwl3945_rx_beacon_notif(struct iwl_priv *priv, 819static void iwl3945_rx_beacon_notif(struct iwl_priv *priv,
814 struct iwl_rx_mem_buffer *rxb) 820 struct iwl_rx_mem_buffer *rxb)
815{ 821{
816#ifdef CONFIG_IWLWIFI_DEBUG
817 struct iwl_rx_packet *pkt = rxb_addr(rxb); 822 struct iwl_rx_packet *pkt = rxb_addr(rxb);
818 struct iwl3945_beacon_notif *beacon = &(pkt->u.beacon_status); 823 struct iwl3945_beacon_notif *beacon = &(pkt->u.beacon_status);
824#ifdef CONFIG_IWLWIFI_DEBUG
819 u8 rate = beacon->beacon_notify_hdr.rate; 825 u8 rate = beacon->beacon_notify_hdr.rate;
820 826
821 IWL_DEBUG_RX(priv, "beacon status %x retries %d iss %d " 827 IWL_DEBUG_RX(priv, "beacon status %x retries %d iss %d "
@@ -827,6 +833,8 @@ static void iwl3945_rx_beacon_notif(struct iwl_priv *priv,
827 le32_to_cpu(beacon->low_tsf), rate); 833 le32_to_cpu(beacon->low_tsf), rate);
828#endif 834#endif
829 835
836 priv->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status);
837
830 if ((priv->iw_mode == NL80211_IFTYPE_AP) && 838 if ((priv->iw_mode == NL80211_IFTYPE_AP) &&
831 (!test_bit(STATUS_EXIT_PENDING, &priv->status))) 839 (!test_bit(STATUS_EXIT_PENDING, &priv->status)))
832 queue_work(priv->workqueue, &priv->beacon_update); 840 queue_work(priv->workqueue, &priv->beacon_update);
@@ -3086,10 +3094,7 @@ void iwl3945_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif)
3086 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 3094 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
3087 iwlcore_commit_rxon(priv); 3095 iwlcore_commit_rxon(priv);
3088 3096
3089 memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); 3097 rc = iwl_send_rxon_timing(priv, vif);
3090 iwl_setup_rxon_timing(priv, vif);
3091 rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
3092 sizeof(priv->rxon_timing), &priv->rxon_timing);
3093 if (rc) 3098 if (rc)
3094 IWL_WARN(priv, "REPLY_RXON_TIMING failed - " 3099 IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
3095 "Attempting to continue.\n"); 3100 "Attempting to continue.\n");
@@ -3263,11 +3268,7 @@ void iwl3945_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif)
3263 iwlcore_commit_rxon(priv); 3268 iwlcore_commit_rxon(priv);
3264 3269
3265 /* RXON Timing */ 3270 /* RXON Timing */
3266 memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); 3271 rc = iwl_send_rxon_timing(priv, vif);
3267 iwl_setup_rxon_timing(priv, vif);
3268 rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
3269 sizeof(priv->rxon_timing),
3270 &priv->rxon_timing);
3271 if (rc) 3272 if (rc)
3272 IWL_WARN(priv, "REPLY_RXON_TIMING failed - " 3273 IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
3273 "Attempting to continue.\n"); 3274 "Attempting to continue.\n");
@@ -3785,10 +3786,8 @@ static void iwl3945_setup_deferred_work(struct iwl_priv *priv)
3785 INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start); 3786 INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start);
3786 INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start); 3787 INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start);
3787 INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, iwl3945_rfkill_poll); 3788 INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, iwl3945_rfkill_poll);
3788 INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); 3789
3789 INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); 3790 iwl_setup_scan_deferred_work(priv);
3790 INIT_WORK(&priv->start_internal_scan, iwl_bg_start_internal_scan);
3791 INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check);
3792 3791
3793 iwl3945_hw_setup_deferred_work(priv); 3792 iwl3945_hw_setup_deferred_work(priv);
3794 3793
@@ -3853,6 +3852,7 @@ static struct ieee80211_ops iwl3945_hw_ops = {
3853 .hw_scan = iwl_mac_hw_scan, 3852 .hw_scan = iwl_mac_hw_scan,
3854 .sta_add = iwl3945_mac_sta_add, 3853 .sta_add = iwl3945_mac_sta_add,
3855 .sta_remove = iwl_mac_sta_remove, 3854 .sta_remove = iwl_mac_sta_remove,
3855 .tx_last_beacon = iwl_mac_tx_last_beacon,
3856}; 3856};
3857 3857
3858static int iwl3945_init_drv(struct iwl_priv *priv) 3858static int iwl3945_init_drv(struct iwl_priv *priv)
@@ -4009,6 +4009,9 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
4009 /*************************** 4009 /***************************
4010 * 2. Initializing PCI bus 4010 * 2. Initializing PCI bus
4011 * *************************/ 4011 * *************************/
4012 pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 |
4013 PCIE_LINK_STATE_CLKPM);
4014
4012 if (pci_enable_device(pdev)) { 4015 if (pci_enable_device(pdev)) {
4013 err = -ENODEV; 4016 err = -ENODEV;
4014 goto out_ieee80211_free_hw; 4017 goto out_ieee80211_free_hw;