aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2010-04-23 14:43:45 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-04-23 14:43:45 -0400
commit3b51cc996e81d8a113416d8094fa4a88f8360a51 (patch)
treee75b98b228bb4e456c30673fcc4b56ffa1d09cf5 /drivers/net/wireless/iwlwifi/iwl3945-base.c
parentc68ed255265968c3948fa2678bf59d15c471b055 (diff)
parent672724403b42da1d276c6cf811e8e34d15efd964 (diff)
Merge branch 'master' into for-davem
Conflicts: drivers/net/wireless/ath/ath9k/phy.c drivers/net/wireless/iwlwifi/iwl-6000.c drivers/net/wireless/iwlwifi/iwl-debugfs.c
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c87
1 files changed, 15 insertions, 72 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 9f362024a29c..a41ba72ceb00 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2527,7 +2527,7 @@ static void iwl3945_alive_start(struct iwl_priv *priv)
2527 } 2527 }
2528 2528
2529 /* Configure Bluetooth device coexistence support */ 2529 /* Configure Bluetooth device coexistence support */
2530 iwl_send_bt_config(priv); 2530 priv->cfg->ops->hcmd->send_bt_config(priv);
2531 2531
2532 /* Configure the adapter for unassociated operation */ 2532 /* Configure the adapter for unassociated operation */
2533 iwlcore_commit_rxon(priv); 2533 iwlcore_commit_rxon(priv);
@@ -2791,11 +2791,8 @@ static void iwl3945_rfkill_poll(struct work_struct *data)
2791 2791
2792} 2792}
2793 2793
2794#define IWL_SCAN_CHECK_WATCHDOG (7 * HZ) 2794void iwl3945_request_scan(struct iwl_priv *priv)
2795static void iwl3945_bg_request_scan(struct work_struct *data)
2796{ 2795{
2797 struct iwl_priv *priv =
2798 container_of(data, struct iwl_priv, request_scan);
2799 struct iwl_host_cmd cmd = { 2796 struct iwl_host_cmd cmd = {
2800 .id = REPLY_SCAN_CMD, 2797 .id = REPLY_SCAN_CMD,
2801 .len = sizeof(struct iwl3945_scan_cmd), 2798 .len = sizeof(struct iwl3945_scan_cmd),
@@ -2809,8 +2806,6 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
2809 2806
2810 conf = ieee80211_get_hw_conf(priv->hw); 2807 conf = ieee80211_get_hw_conf(priv->hw);
2811 2808
2812 mutex_lock(&priv->mutex);
2813
2814 cancel_delayed_work(&priv->scan_check); 2809 cancel_delayed_work(&priv->scan_check);
2815 2810
2816 if (!iwl_is_ready(priv)) { 2811 if (!iwl_is_ready(priv)) {
@@ -2853,20 +2848,15 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
2853 goto done; 2848 goto done;
2854 } 2849 }
2855 2850
2856 if (!priv->scan_bands) { 2851 if (!priv->scan_cmd) {
2857 IWL_DEBUG_HC(priv, "Aborting scan due to no requested bands\n"); 2852 priv->scan_cmd = kmalloc(sizeof(struct iwl3945_scan_cmd) +
2858 goto done; 2853 IWL_MAX_SCAN_SIZE, GFP_KERNEL);
2859 } 2854 if (!priv->scan_cmd) {
2860
2861 if (!priv->scan) {
2862 priv->scan = kmalloc(sizeof(struct iwl3945_scan_cmd) +
2863 IWL_MAX_SCAN_SIZE, GFP_KERNEL);
2864 if (!priv->scan) {
2865 IWL_DEBUG_SCAN(priv, "Fail to allocate scan memory\n"); 2855 IWL_DEBUG_SCAN(priv, "Fail to allocate scan memory\n");
2866 goto done; 2856 goto done;
2867 } 2857 }
2868 } 2858 }
2869 scan = priv->scan; 2859 scan = priv->scan_cmd;
2870 memset(scan, 0, sizeof(struct iwl3945_scan_cmd) + IWL_MAX_SCAN_SIZE); 2860 memset(scan, 0, sizeof(struct iwl3945_scan_cmd) + IWL_MAX_SCAN_SIZE);
2871 2861
2872 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; 2862 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH;
@@ -2935,12 +2925,14 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
2935 2925
2936 /* flags + rate selection */ 2926 /* flags + rate selection */
2937 2927
2938 if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) { 2928 switch (priv->scan_band) {
2929 case IEEE80211_BAND_2GHZ:
2939 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; 2930 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
2940 scan->tx_cmd.rate = IWL_RATE_1M_PLCP; 2931 scan->tx_cmd.rate = IWL_RATE_1M_PLCP;
2941 scan->good_CRC_th = 0; 2932 scan->good_CRC_th = 0;
2942 band = IEEE80211_BAND_2GHZ; 2933 band = IEEE80211_BAND_2GHZ;
2943 } else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) { 2934 break;
2935 case IEEE80211_BAND_5GHZ:
2944 scan->tx_cmd.rate = IWL_RATE_6M_PLCP; 2936 scan->tx_cmd.rate = IWL_RATE_6M_PLCP;
2945 /* 2937 /*
2946 * If active scaning is requested but a certain channel 2938 * If active scaning is requested but a certain channel
@@ -2949,8 +2941,9 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
2949 */ 2941 */
2950 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH : 0; 2942 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH : 0;
2951 band = IEEE80211_BAND_5GHZ; 2943 band = IEEE80211_BAND_5GHZ;
2952 } else { 2944 break;
2953 IWL_WARN(priv, "Invalid scan band count\n"); 2945 default:
2946 IWL_WARN(priv, "Invalid scan band\n");
2954 goto done; 2947 goto done;
2955 } 2948 }
2956 2949
@@ -2971,9 +2964,6 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
2971 /* select Rx antennas */ 2964 /* select Rx antennas */
2972 scan->flags |= iwl3945_get_antenna_flags(priv); 2965 scan->flags |= iwl3945_get_antenna_flags(priv);
2973 2966
2974 if (iwl_is_monitor_mode(priv))
2975 scan->filter_flags = RXON_FILTER_PROMISC_MSK;
2976
2977 scan->channel_count = 2967 scan->channel_count =
2978 iwl3945_get_channels_for_scan(priv, band, is_active, n_probes, 2968 iwl3945_get_channels_for_scan(priv, band, is_active, n_probes,
2979 (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); 2969 (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]);
@@ -2995,7 +2985,6 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
2995 queue_delayed_work(priv->workqueue, &priv->scan_check, 2985 queue_delayed_work(priv->workqueue, &priv->scan_check,
2996 IWL_SCAN_CHECK_WATCHDOG); 2986 IWL_SCAN_CHECK_WATCHDOG);
2997 2987
2998 mutex_unlock(&priv->mutex);
2999 return; 2988 return;
3000 2989
3001 done: 2990 done:
@@ -3009,7 +2998,6 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
3009 2998
3010 /* inform mac80211 scan aborted */ 2999 /* inform mac80211 scan aborted */
3011 queue_work(priv->workqueue, &priv->scan_completed); 3000 queue_work(priv->workqueue, &priv->scan_completed);
3012 mutex_unlock(&priv->mutex);
3013} 3001}
3014 3002
3015static void iwl3945_bg_restart(struct work_struct *data) 3003static void iwl3945_bg_restart(struct work_struct *data)
@@ -3051,8 +3039,6 @@ static void iwl3945_bg_rx_replenish(struct work_struct *data)
3051 mutex_unlock(&priv->mutex); 3039 mutex_unlock(&priv->mutex);
3052} 3040}
3053 3041
3054#define IWL_DELAY_NEXT_SCAN (HZ*2)
3055
3056void iwl3945_post_associate(struct iwl_priv *priv) 3042void iwl3945_post_associate(struct iwl_priv *priv)
3057{ 3043{
3058 int rc = 0; 3044 int rc = 0;
@@ -3137,9 +3123,6 @@ void iwl3945_post_associate(struct iwl_priv *priv)
3137 __func__, priv->iw_mode); 3123 __func__, priv->iw_mode);
3138 break; 3124 break;
3139 } 3125 }
3140
3141 /* we have just associated, don't start scan too early */
3142 priv->next_scan_jiffies = jiffies + IWL_DELAY_NEXT_SCAN;
3143} 3126}
3144 3127
3145/***************************************************************************** 3128/*****************************************************************************
@@ -3672,44 +3655,6 @@ static ssize_t show_channels(struct device *d,
3672 3655
3673static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL); 3656static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL);
3674 3657
3675static ssize_t show_statistics(struct device *d,
3676 struct device_attribute *attr, char *buf)
3677{
3678 struct iwl_priv *priv = dev_get_drvdata(d);
3679 u32 size = sizeof(struct iwl3945_notif_statistics);
3680 u32 len = 0, ofs = 0;
3681 u8 *data = (u8 *)&priv->_3945.statistics;
3682 int rc = 0;
3683
3684 if (!iwl_is_alive(priv))
3685 return -EAGAIN;
3686
3687 mutex_lock(&priv->mutex);
3688 rc = iwl_send_statistics_request(priv, CMD_SYNC, false);
3689 mutex_unlock(&priv->mutex);
3690
3691 if (rc) {
3692 len = sprintf(buf,
3693 "Error sending statistics request: 0x%08X\n", rc);
3694 return len;
3695 }
3696
3697 while (size && (PAGE_SIZE - len)) {
3698 hex_dump_to_buffer(data + ofs, size, 16, 1, buf + len,
3699 PAGE_SIZE - len, 1);
3700 len = strlen(buf);
3701 if (PAGE_SIZE - len)
3702 buf[len++] = '\n';
3703
3704 ofs += 16;
3705 size -= min(size, 16U);
3706 }
3707
3708 return len;
3709}
3710
3711static DEVICE_ATTR(statistics, S_IRUGO, show_statistics, NULL);
3712
3713static ssize_t show_antenna(struct device *d, 3658static ssize_t show_antenna(struct device *d,
3714 struct device_attribute *attr, char *buf) 3659 struct device_attribute *attr, char *buf)
3715{ 3660{
@@ -3793,7 +3738,6 @@ static void iwl3945_setup_deferred_work(struct iwl_priv *priv)
3793 INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start); 3738 INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start);
3794 INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, iwl3945_rfkill_poll); 3739 INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, iwl3945_rfkill_poll);
3795 INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); 3740 INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed);
3796 INIT_WORK(&priv->request_scan, iwl3945_bg_request_scan);
3797 INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); 3741 INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan);
3798 INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check); 3742 INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check);
3799 3743
@@ -3830,7 +3774,6 @@ static struct attribute *iwl3945_sysfs_entries[] = {
3830 &dev_attr_filter_flags.attr, 3774 &dev_attr_filter_flags.attr,
3831 &dev_attr_measurement.attr, 3775 &dev_attr_measurement.attr,
3832 &dev_attr_retry_rate.attr, 3776 &dev_attr_retry_rate.attr,
3833 &dev_attr_statistics.attr,
3834 &dev_attr_status.attr, 3777 &dev_attr_status.attr,
3835 &dev_attr_temperature.attr, 3778 &dev_attr_temperature.attr,
3836 &dev_attr_tx_power.attr, 3779 &dev_attr_tx_power.attr,
@@ -4253,7 +4196,7 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
4253 4196
4254 iwl_free_channel_map(priv); 4197 iwl_free_channel_map(priv);
4255 iwlcore_free_geos(priv); 4198 iwlcore_free_geos(priv);
4256 kfree(priv->scan); 4199 kfree(priv->scan_cmd);
4257 if (priv->ibss_beacon) 4200 if (priv->ibss_beacon)
4258 dev_kfree_skb(priv->ibss_beacon); 4201 dev_kfree_skb(priv->ibss_beacon);
4259 4202