diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 78 |
1 files changed, 31 insertions, 47 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 54daa38ecba3..2579bbcaab36 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -351,11 +351,11 @@ static int iwl3945_send_beacon_cmd(struct iwl_priv *priv) | |||
351 | 351 | ||
352 | static void iwl3945_unset_hw_params(struct iwl_priv *priv) | 352 | static void iwl3945_unset_hw_params(struct iwl_priv *priv) |
353 | { | 353 | { |
354 | if (priv->shared_virt) | 354 | if (priv->_3945.shared_virt) |
355 | dma_free_coherent(&priv->pci_dev->dev, | 355 | dma_free_coherent(&priv->pci_dev->dev, |
356 | sizeof(struct iwl3945_shared), | 356 | sizeof(struct iwl3945_shared), |
357 | priv->shared_virt, | 357 | priv->_3945.shared_virt, |
358 | priv->shared_phys); | 358 | priv->_3945.shared_phys); |
359 | } | 359 | } |
360 | 360 | ||
361 | static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, | 361 | static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, |
@@ -504,15 +504,6 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
504 | IWL_DEBUG_TX(priv, "Sending REASSOC frame\n"); | 504 | IWL_DEBUG_TX(priv, "Sending REASSOC frame\n"); |
505 | #endif | 505 | #endif |
506 | 506 | ||
507 | /* drop all non-injected data frame if we are not associated */ | ||
508 | if (ieee80211_is_data(fc) && | ||
509 | !(info->flags & IEEE80211_TX_CTL_INJECTED) && | ||
510 | (!iwl_is_associated(priv) || | ||
511 | ((priv->iw_mode == NL80211_IFTYPE_STATION) && !priv->assoc_id))) { | ||
512 | IWL_DEBUG_DROP(priv, "Dropping - !iwl_is_associated\n"); | ||
513 | goto drop_unlock; | ||
514 | } | ||
515 | |||
516 | spin_unlock_irqrestore(&priv->lock, flags); | 507 | spin_unlock_irqrestore(&priv->lock, flags); |
517 | 508 | ||
518 | hdr_len = ieee80211_hdrlen(fc); | 509 | hdr_len = ieee80211_hdrlen(fc); |
@@ -753,7 +744,7 @@ static int iwl3945_get_measurement(struct iwl_priv *priv, | |||
753 | if (iwl_is_associated(priv)) | 744 | if (iwl_is_associated(priv)) |
754 | add_time = | 745 | add_time = |
755 | iwl3945_usecs_to_beacons( | 746 | iwl3945_usecs_to_beacons( |
756 | le64_to_cpu(params->start_time) - priv->last_tsf, | 747 | le64_to_cpu(params->start_time) - priv->_3945.last_tsf, |
757 | le16_to_cpu(priv->rxon_timing.beacon_interval)); | 748 | le16_to_cpu(priv->rxon_timing.beacon_interval)); |
758 | 749 | ||
759 | memset(&spectrum, 0, sizeof(spectrum)); | 750 | memset(&spectrum, 0, sizeof(spectrum)); |
@@ -767,7 +758,7 @@ static int iwl3945_get_measurement(struct iwl_priv *priv, | |||
767 | 758 | ||
768 | if (iwl_is_associated(priv)) | 759 | if (iwl_is_associated(priv)) |
769 | spectrum.start_time = | 760 | spectrum.start_time = |
770 | iwl3945_add_beacon_time(priv->last_beacon_time, | 761 | iwl3945_add_beacon_time(priv->_3945.last_beacon_time, |
771 | add_time, | 762 | add_time, |
772 | le16_to_cpu(priv->rxon_timing.beacon_interval)); | 763 | le16_to_cpu(priv->rxon_timing.beacon_interval)); |
773 | else | 764 | else |
@@ -2517,8 +2508,7 @@ static void iwl3945_alive_start(struct iwl_priv *priv) | |||
2517 | 2508 | ||
2518 | ieee80211_wake_queues(priv->hw); | 2509 | ieee80211_wake_queues(priv->hw); |
2519 | 2510 | ||
2520 | priv->active_rate = priv->rates_mask; | 2511 | priv->active_rate = IWL_RATES_MASK; |
2521 | priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; | ||
2522 | 2512 | ||
2523 | iwl_power_update_mode(priv, true); | 2513 | iwl_power_update_mode(priv, true); |
2524 | 2514 | ||
@@ -2547,17 +2537,6 @@ static void iwl3945_alive_start(struct iwl_priv *priv) | |||
2547 | set_bit(STATUS_READY, &priv->status); | 2537 | set_bit(STATUS_READY, &priv->status); |
2548 | wake_up_interruptible(&priv->wait_command_queue); | 2538 | wake_up_interruptible(&priv->wait_command_queue); |
2549 | 2539 | ||
2550 | /* reassociate for ADHOC mode */ | ||
2551 | if (priv->vif && (priv->iw_mode == NL80211_IFTYPE_ADHOC)) { | ||
2552 | struct sk_buff *beacon = ieee80211_beacon_get(priv->hw, | ||
2553 | priv->vif); | ||
2554 | if (beacon) | ||
2555 | iwl_mac_beacon_update(priv->hw, beacon); | ||
2556 | } | ||
2557 | |||
2558 | if (test_and_clear_bit(STATUS_MODE_PENDING, &priv->status)) | ||
2559 | iwl_set_mode(priv, priv->iw_mode); | ||
2560 | |||
2561 | return; | 2540 | return; |
2562 | 2541 | ||
2563 | restart: | 2542 | restart: |
@@ -2718,7 +2697,7 @@ static int __iwl3945_up(struct iwl_priv *priv) | |||
2718 | /* load bootstrap state machine, | 2697 | /* load bootstrap state machine, |
2719 | * load bootstrap program into processor's memory, | 2698 | * load bootstrap program into processor's memory, |
2720 | * prepare to load the "initialize" uCode */ | 2699 | * prepare to load the "initialize" uCode */ |
2721 | priv->cfg->ops->lib->load_ucode(priv); | 2700 | rc = priv->cfg->ops->lib->load_ucode(priv); |
2722 | 2701 | ||
2723 | if (rc) { | 2702 | if (rc) { |
2724 | IWL_ERR(priv, | 2703 | IWL_ERR(priv, |
@@ -2786,7 +2765,7 @@ static void iwl3945_bg_alive_start(struct work_struct *data) | |||
2786 | static void iwl3945_rfkill_poll(struct work_struct *data) | 2765 | static void iwl3945_rfkill_poll(struct work_struct *data) |
2787 | { | 2766 | { |
2788 | struct iwl_priv *priv = | 2767 | struct iwl_priv *priv = |
2789 | container_of(data, struct iwl_priv, rfkill_poll.work); | 2768 | container_of(data, struct iwl_priv, _3945.rfkill_poll.work); |
2790 | bool old_rfkill = test_bit(STATUS_RF_KILL_HW, &priv->status); | 2769 | bool old_rfkill = test_bit(STATUS_RF_KILL_HW, &priv->status); |
2791 | bool new_rfkill = !(iwl_read32(priv, CSR_GP_CNTRL) | 2770 | bool new_rfkill = !(iwl_read32(priv, CSR_GP_CNTRL) |
2792 | & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); | 2771 | & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); |
@@ -2805,7 +2784,7 @@ static void iwl3945_rfkill_poll(struct work_struct *data) | |||
2805 | 2784 | ||
2806 | /* Keep this running, even if radio now enabled. This will be | 2785 | /* Keep this running, even if radio now enabled. This will be |
2807 | * cancelled in mac_start() if system decides to start again */ | 2786 | * cancelled in mac_start() if system decides to start again */ |
2808 | queue_delayed_work(priv->workqueue, &priv->rfkill_poll, | 2787 | queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll, |
2809 | round_jiffies_relative(2 * HZ)); | 2788 | round_jiffies_relative(2 * HZ)); |
2810 | 2789 | ||
2811 | } | 2790 | } |
@@ -2820,7 +2799,6 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
2820 | .len = sizeof(struct iwl3945_scan_cmd), | 2799 | .len = sizeof(struct iwl3945_scan_cmd), |
2821 | .flags = CMD_SIZE_HUGE, | 2800 | .flags = CMD_SIZE_HUGE, |
2822 | }; | 2801 | }; |
2823 | int rc = 0; | ||
2824 | struct iwl3945_scan_cmd *scan; | 2802 | struct iwl3945_scan_cmd *scan; |
2825 | struct ieee80211_conf *conf = NULL; | 2803 | struct ieee80211_conf *conf = NULL; |
2826 | u8 n_probes = 0; | 2804 | u8 n_probes = 0; |
@@ -2848,7 +2826,6 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
2848 | if (test_bit(STATUS_SCAN_HW, &priv->status)) { | 2826 | if (test_bit(STATUS_SCAN_HW, &priv->status)) { |
2849 | IWL_DEBUG_INFO(priv, "Multiple concurrent scan requests " | 2827 | IWL_DEBUG_INFO(priv, "Multiple concurrent scan requests " |
2850 | "Ignoring second request.\n"); | 2828 | "Ignoring second request.\n"); |
2851 | rc = -EIO; | ||
2852 | goto done; | 2829 | goto done; |
2853 | } | 2830 | } |
2854 | 2831 | ||
@@ -2883,7 +2860,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
2883 | priv->scan = kmalloc(sizeof(struct iwl3945_scan_cmd) + | 2860 | priv->scan = kmalloc(sizeof(struct iwl3945_scan_cmd) + |
2884 | IWL_MAX_SCAN_SIZE, GFP_KERNEL); | 2861 | IWL_MAX_SCAN_SIZE, GFP_KERNEL); |
2885 | if (!priv->scan) { | 2862 | if (!priv->scan) { |
2886 | rc = -ENOMEM; | 2863 | IWL_DEBUG_SCAN(priv, "Fail to allocate scan memory\n"); |
2887 | goto done; | 2864 | goto done; |
2888 | } | 2865 | } |
2889 | } | 2866 | } |
@@ -2926,7 +2903,9 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
2926 | scan_suspend_time, interval); | 2903 | scan_suspend_time, interval); |
2927 | } | 2904 | } |
2928 | 2905 | ||
2929 | if (priv->scan_request->n_ssids) { | 2906 | if (priv->is_internal_short_scan) { |
2907 | IWL_DEBUG_SCAN(priv, "Start internal passive scan.\n"); | ||
2908 | } else if (priv->scan_request->n_ssids) { | ||
2930 | int i, p = 0; | 2909 | int i, p = 0; |
2931 | IWL_DEBUG_SCAN(priv, "Kicking off active scan\n"); | 2910 | IWL_DEBUG_SCAN(priv, "Kicking off active scan\n"); |
2932 | for (i = 0; i < priv->scan_request->n_ssids; i++) { | 2911 | for (i = 0; i < priv->scan_request->n_ssids; i++) { |
@@ -2973,13 +2952,20 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
2973 | goto done; | 2952 | goto done; |
2974 | } | 2953 | } |
2975 | 2954 | ||
2976 | scan->tx_cmd.len = cpu_to_le16( | 2955 | if (!priv->is_internal_short_scan) { |
2956 | scan->tx_cmd.len = cpu_to_le16( | ||
2977 | iwl_fill_probe_req(priv, | 2957 | iwl_fill_probe_req(priv, |
2978 | (struct ieee80211_mgmt *)scan->data, | 2958 | (struct ieee80211_mgmt *)scan->data, |
2979 | priv->scan_request->ie, | 2959 | priv->scan_request->ie, |
2980 | priv->scan_request->ie_len, | 2960 | priv->scan_request->ie_len, |
2981 | IWL_MAX_SCAN_SIZE - sizeof(*scan))); | 2961 | IWL_MAX_SCAN_SIZE - sizeof(*scan))); |
2982 | 2962 | } else { | |
2963 | scan->tx_cmd.len = cpu_to_le16( | ||
2964 | iwl_fill_probe_req(priv, | ||
2965 | (struct ieee80211_mgmt *)scan->data, | ||
2966 | NULL, 0, | ||
2967 | IWL_MAX_SCAN_SIZE - sizeof(*scan))); | ||
2968 | } | ||
2983 | /* select Rx antennas */ | 2969 | /* select Rx antennas */ |
2984 | scan->flags |= iwl3945_get_antenna_flags(priv); | 2970 | scan->flags |= iwl3945_get_antenna_flags(priv); |
2985 | 2971 | ||
@@ -3001,8 +2987,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
3001 | scan->len = cpu_to_le16(cmd.len); | 2987 | scan->len = cpu_to_le16(cmd.len); |
3002 | 2988 | ||
3003 | set_bit(STATUS_SCAN_HW, &priv->status); | 2989 | set_bit(STATUS_SCAN_HW, &priv->status); |
3004 | rc = iwl_send_cmd_sync(priv, &cmd); | 2990 | if (iwl_send_cmd_sync(priv, &cmd)) |
3005 | if (rc) | ||
3006 | goto done; | 2991 | goto done; |
3007 | 2992 | ||
3008 | queue_delayed_work(priv->workqueue, &priv->scan_check, | 2993 | queue_delayed_work(priv->workqueue, &priv->scan_check, |
@@ -3212,7 +3197,7 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw) | |||
3212 | 3197 | ||
3213 | /* ucode is running and will send rfkill notifications, | 3198 | /* ucode is running and will send rfkill notifications, |
3214 | * no need to poll the killswitch state anymore */ | 3199 | * no need to poll the killswitch state anymore */ |
3215 | cancel_delayed_work(&priv->rfkill_poll); | 3200 | cancel_delayed_work(&priv->_3945.rfkill_poll); |
3216 | 3201 | ||
3217 | iwl_led_start(priv); | 3202 | iwl_led_start(priv); |
3218 | 3203 | ||
@@ -3253,7 +3238,7 @@ static void iwl3945_mac_stop(struct ieee80211_hw *hw) | |||
3253 | flush_workqueue(priv->workqueue); | 3238 | flush_workqueue(priv->workqueue); |
3254 | 3239 | ||
3255 | /* start polling the killswitch state again */ | 3240 | /* start polling the killswitch state again */ |
3256 | queue_delayed_work(priv->workqueue, &priv->rfkill_poll, | 3241 | queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll, |
3257 | round_jiffies_relative(2 * HZ)); | 3242 | round_jiffies_relative(2 * HZ)); |
3258 | 3243 | ||
3259 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 3244 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
@@ -3365,7 +3350,6 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
3365 | 3350 | ||
3366 | mutex_lock(&priv->mutex); | 3351 | mutex_lock(&priv->mutex); |
3367 | iwl_scan_cancel_timeout(priv, 100); | 3352 | iwl_scan_cancel_timeout(priv, 100); |
3368 | mutex_unlock(&priv->mutex); | ||
3369 | 3353 | ||
3370 | switch (cmd) { | 3354 | switch (cmd) { |
3371 | case SET_KEY: | 3355 | case SET_KEY: |
@@ -3386,6 +3370,7 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
3386 | ret = -EINVAL; | 3370 | ret = -EINVAL; |
3387 | } | 3371 | } |
3388 | 3372 | ||
3373 | mutex_unlock(&priv->mutex); | ||
3389 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 3374 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
3390 | 3375 | ||
3391 | return ret; | 3376 | return ret; |
@@ -3590,7 +3575,7 @@ static ssize_t store_measurement(struct device *d, | |||
3590 | struct iwl_priv *priv = dev_get_drvdata(d); | 3575 | struct iwl_priv *priv = dev_get_drvdata(d); |
3591 | struct ieee80211_measurement_params params = { | 3576 | struct ieee80211_measurement_params params = { |
3592 | .channel = le16_to_cpu(priv->active_rxon.channel), | 3577 | .channel = le16_to_cpu(priv->active_rxon.channel), |
3593 | .start_time = cpu_to_le64(priv->last_tsf), | 3578 | .start_time = cpu_to_le64(priv->_3945.last_tsf), |
3594 | .duration = cpu_to_le16(1), | 3579 | .duration = cpu_to_le16(1), |
3595 | }; | 3580 | }; |
3596 | u8 type = IWL_MEASURE_BASIC; | 3581 | u8 type = IWL_MEASURE_BASIC; |
@@ -3660,7 +3645,7 @@ static ssize_t show_statistics(struct device *d, | |||
3660 | struct iwl_priv *priv = dev_get_drvdata(d); | 3645 | struct iwl_priv *priv = dev_get_drvdata(d); |
3661 | u32 size = sizeof(struct iwl3945_notif_statistics); | 3646 | u32 size = sizeof(struct iwl3945_notif_statistics); |
3662 | u32 len = 0, ofs = 0; | 3647 | u32 len = 0, ofs = 0; |
3663 | u8 *data = (u8 *)&priv->statistics_39; | 3648 | u8 *data = (u8 *)&priv->_3945.statistics; |
3664 | int rc = 0; | 3649 | int rc = 0; |
3665 | 3650 | ||
3666 | if (!iwl_is_alive(priv)) | 3651 | if (!iwl_is_alive(priv)) |
@@ -3773,7 +3758,7 @@ static void iwl3945_setup_deferred_work(struct iwl_priv *priv) | |||
3773 | INIT_WORK(&priv->beacon_update, iwl3945_bg_beacon_update); | 3758 | INIT_WORK(&priv->beacon_update, iwl3945_bg_beacon_update); |
3774 | INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start); | 3759 | INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start); |
3775 | INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start); | 3760 | INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start); |
3776 | INIT_DELAYED_WORK(&priv->rfkill_poll, iwl3945_rfkill_poll); | 3761 | INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, iwl3945_rfkill_poll); |
3777 | INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); | 3762 | INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); |
3778 | INIT_WORK(&priv->request_scan, iwl3945_bg_request_scan); | 3763 | INIT_WORK(&priv->request_scan, iwl3945_bg_request_scan); |
3779 | INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); | 3764 | INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); |
@@ -3864,7 +3849,6 @@ static int iwl3945_init_drv(struct iwl_priv *priv) | |||
3864 | priv->qos_data.qos_active = 0; | 3849 | priv->qos_data.qos_active = 0; |
3865 | priv->qos_data.qos_cap.val = 0; | 3850 | priv->qos_data.qos_cap.val = 0; |
3866 | 3851 | ||
3867 | priv->rates_mask = IWL_RATES_MASK; | ||
3868 | priv->tx_power_user_lmt = IWL_DEFAULT_TX_POWER; | 3852 | priv->tx_power_user_lmt = IWL_DEFAULT_TX_POWER; |
3869 | 3853 | ||
3870 | if (eeprom->version < EEPROM_3945_EEPROM_VERSION) { | 3854 | if (eeprom->version < EEPROM_3945_EEPROM_VERSION) { |
@@ -4129,7 +4113,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
4129 | IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); | 4113 | IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); |
4130 | 4114 | ||
4131 | /* Start monitoring the killswitch */ | 4115 | /* Start monitoring the killswitch */ |
4132 | queue_delayed_work(priv->workqueue, &priv->rfkill_poll, | 4116 | queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll, |
4133 | 2 * HZ); | 4117 | 2 * HZ); |
4134 | 4118 | ||
4135 | return 0; | 4119 | return 0; |
@@ -4203,7 +4187,7 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev) | |||
4203 | 4187 | ||
4204 | sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); | 4188 | sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); |
4205 | 4189 | ||
4206 | cancel_delayed_work_sync(&priv->rfkill_poll); | 4190 | cancel_delayed_work_sync(&priv->_3945.rfkill_poll); |
4207 | 4191 | ||
4208 | iwl3945_dealloc_ucode_pci(priv); | 4192 | iwl3945_dealloc_ucode_pci(priv); |
4209 | 4193 | ||