aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-04-29 07:43:06 -0400
committerReinette Chatre <reinette.chatre@intel.com>2010-05-10 18:08:58 -0400
commit1dda6d28377bec52f96767e8d4a59aa95102b9dd (patch)
tree583e26326f5d7d59c34c4f584b29b674c24f0e29 /drivers/net/wireless/iwlwifi/iwl3945-base.c
parent3474ad635db371b0d8d0ee40086f15d223d5b6a4 (diff)
iwlwifi: push virtual interface through
Rather than keeping every bit of information around in priv and the virtual interface, add a virtual interface to many functions and use the information directly from it. This removes beacon_int, assoc_capability and assoc_id from struct iwl_priv. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c63
1 files changed, 31 insertions, 32 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 77ab00b98778..85a46ad667de 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -1847,7 +1847,8 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv)
1847static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, 1847static int iwl3945_get_channels_for_scan(struct iwl_priv *priv,
1848 enum ieee80211_band band, 1848 enum ieee80211_band band,
1849 u8 is_active, u8 n_probes, 1849 u8 is_active, u8 n_probes,
1850 struct iwl3945_scan_channel *scan_ch) 1850 struct iwl3945_scan_channel *scan_ch,
1851 struct ieee80211_vif *vif)
1851{ 1852{
1852 struct ieee80211_channel *chan; 1853 struct ieee80211_channel *chan;
1853 const struct ieee80211_supported_band *sband; 1854 const struct ieee80211_supported_band *sband;
@@ -1861,7 +1862,7 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv,
1861 return 0; 1862 return 0;
1862 1863
1863 active_dwell = iwl_get_active_dwell_time(priv, band, n_probes); 1864 active_dwell = iwl_get_active_dwell_time(priv, band, n_probes);
1864 passive_dwell = iwl_get_passive_dwell_time(priv, band); 1865 passive_dwell = iwl_get_passive_dwell_time(priv, band, vif);
1865 1866
1866 if (passive_dwell <= active_dwell) 1867 if (passive_dwell <= active_dwell)
1867 passive_dwell = active_dwell + 1; 1868 passive_dwell = active_dwell + 1;
@@ -2543,7 +2544,7 @@ static void iwl3945_alive_start(struct iwl_priv *priv)
2543 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2544 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2544 } else { 2545 } else {
2545 /* Initialize our rx_config data */ 2546 /* Initialize our rx_config data */
2546 iwl_connection_init_rx_config(priv, priv->iw_mode); 2547 iwl_connection_init_rx_config(priv, NULL);
2547 } 2548 }
2548 2549
2549 /* Configure Bluetooth device coexistence support */ 2550 /* Configure Bluetooth device coexistence support */
@@ -2811,7 +2812,7 @@ static void iwl3945_rfkill_poll(struct work_struct *data)
2811 2812
2812} 2813}
2813 2814
2814void iwl3945_request_scan(struct iwl_priv *priv) 2815void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
2815{ 2816{
2816 struct iwl_host_cmd cmd = { 2817 struct iwl_host_cmd cmd = {
2817 .id = REPLY_SCAN_CMD, 2818 .id = REPLY_SCAN_CMD,
@@ -2892,7 +2893,7 @@ void iwl3945_request_scan(struct iwl_priv *priv)
2892 IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); 2893 IWL_DEBUG_INFO(priv, "Scanning while associated...\n");
2893 2894
2894 spin_lock_irqsave(&priv->lock, flags); 2895 spin_lock_irqsave(&priv->lock, flags);
2895 interval = priv->beacon_int; 2896 interval = vif ? vif->bss_conf.beacon_int : 0;
2896 spin_unlock_irqrestore(&priv->lock, flags); 2897 spin_unlock_irqrestore(&priv->lock, flags);
2897 2898
2898 scan->suspend_time = 0; 2899 scan->suspend_time = 0;
@@ -2987,7 +2988,7 @@ void iwl3945_request_scan(struct iwl_priv *priv)
2987 2988
2988 scan->channel_count = 2989 scan->channel_count =
2989 iwl3945_get_channels_for_scan(priv, band, is_active, n_probes, 2990 iwl3945_get_channels_for_scan(priv, band, is_active, n_probes,
2990 (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); 2991 (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)], vif);
2991 2992
2992 if (scan->channel_count == 0) { 2993 if (scan->channel_count == 0) {
2993 IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); 2994 IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count);
@@ -3060,26 +3061,25 @@ static void iwl3945_bg_rx_replenish(struct work_struct *data)
3060 mutex_unlock(&priv->mutex); 3061 mutex_unlock(&priv->mutex);
3061} 3062}
3062 3063
3063void iwl3945_post_associate(struct iwl_priv *priv) 3064void iwl3945_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif)
3064{ 3065{
3065 int rc = 0; 3066 int rc = 0;
3066 struct ieee80211_conf *conf = NULL; 3067 struct ieee80211_conf *conf = NULL;
3067 3068
3068 if (priv->iw_mode == NL80211_IFTYPE_AP) { 3069 if (!vif || !priv->is_open)
3070 return;
3071
3072 if (vif->type == NL80211_IFTYPE_AP) {
3069 IWL_ERR(priv, "%s Should not be called in AP mode\n", __func__); 3073 IWL_ERR(priv, "%s Should not be called in AP mode\n", __func__);
3070 return; 3074 return;
3071 } 3075 }
3072 3076
3073
3074 IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", 3077 IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n",
3075 priv->assoc_id, priv->active_rxon.bssid_addr); 3078 vif->bss_conf.aid, priv->active_rxon.bssid_addr);
3076 3079
3077 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 3080 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
3078 return; 3081 return;
3079 3082
3080 if (!priv->vif || !priv->is_open)
3081 return;
3082
3083 iwl_scan_cancel_timeout(priv, 200); 3083 iwl_scan_cancel_timeout(priv, 200);
3084 3084
3085 conf = ieee80211_get_hw_conf(priv->hw); 3085 conf = ieee80211_get_hw_conf(priv->hw);
@@ -3088,7 +3088,7 @@ void iwl3945_post_associate(struct iwl_priv *priv)
3088 iwlcore_commit_rxon(priv); 3088 iwlcore_commit_rxon(priv);
3089 3089
3090 memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); 3090 memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd));
3091 iwl_setup_rxon_timing(priv); 3091 iwl_setup_rxon_timing(priv, vif);
3092 rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, 3092 rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
3093 sizeof(priv->rxon_timing), &priv->rxon_timing); 3093 sizeof(priv->rxon_timing), &priv->rxon_timing);
3094 if (rc) 3094 if (rc)
@@ -3097,40 +3097,38 @@ void iwl3945_post_associate(struct iwl_priv *priv)
3097 3097
3098 priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; 3098 priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;
3099 3099
3100 priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id); 3100 priv->staging_rxon.assoc_id = cpu_to_le16(vif->bss_conf.aid);
3101 3101
3102 IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", 3102 IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n",
3103 priv->assoc_id, priv->beacon_int); 3103 vif->bss_conf.aid, vif->bss_conf.beacon_int);
3104 3104
3105 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE) 3105 if (vif->bss_conf.assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
3106 priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; 3106 priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
3107 else 3107 else
3108 priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; 3108 priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
3109 3109
3110 if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { 3110 if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) {
3111 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) 3111 if (vif->bss_conf.assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
3112 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; 3112 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
3113 else 3113 else
3114 priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; 3114 priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
3115 3115
3116 if (priv->iw_mode == NL80211_IFTYPE_ADHOC) 3116 if (vif->type == NL80211_IFTYPE_ADHOC)
3117 priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; 3117 priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
3118
3119 } 3118 }
3120 3119
3121 iwlcore_commit_rxon(priv); 3120 iwlcore_commit_rxon(priv);
3122 3121
3123 switch (priv->iw_mode) { 3122 switch (vif->type) {
3124 case NL80211_IFTYPE_STATION: 3123 case NL80211_IFTYPE_STATION:
3125 iwl3945_rate_scale_init(priv->hw, IWL_AP_ID); 3124 iwl3945_rate_scale_init(priv->hw, IWL_AP_ID);
3126 break; 3125 break;
3127 case NL80211_IFTYPE_ADHOC: 3126 case NL80211_IFTYPE_ADHOC:
3128 priv->assoc_id = 1;
3129 iwl3945_send_beacon_cmd(priv); 3127 iwl3945_send_beacon_cmd(priv);
3130 break; 3128 break;
3131 default: 3129 default:
3132 IWL_ERR(priv, "%s Should not be called in %d mode\n", 3130 IWL_ERR(priv, "%s Should not be called in %d mode\n",
3133 __func__, priv->iw_mode); 3131 __func__, vif->type);
3134 break; 3132 break;
3135 } 3133 }
3136} 3134}
@@ -3254,7 +3252,7 @@ static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
3254 return NETDEV_TX_OK; 3252 return NETDEV_TX_OK;
3255} 3253}
3256 3254
3257void iwl3945_config_ap(struct iwl_priv *priv) 3255void iwl3945_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif)
3258{ 3256{
3259 int rc = 0; 3257 int rc = 0;
3260 3258
@@ -3270,7 +3268,7 @@ void iwl3945_config_ap(struct iwl_priv *priv)
3270 3268
3271 /* RXON Timing */ 3269 /* RXON Timing */
3272 memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); 3270 memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd));
3273 iwl_setup_rxon_timing(priv); 3271 iwl_setup_rxon_timing(priv, vif);
3274 rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, 3272 rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
3275 sizeof(priv->rxon_timing), 3273 sizeof(priv->rxon_timing),
3276 &priv->rxon_timing); 3274 &priv->rxon_timing);
@@ -3278,9 +3276,10 @@ void iwl3945_config_ap(struct iwl_priv *priv)
3278 IWL_WARN(priv, "REPLY_RXON_TIMING failed - " 3276 IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
3279 "Attempting to continue.\n"); 3277 "Attempting to continue.\n");
3280 3278
3281 /* FIXME: what should be the assoc_id for AP? */ 3279 priv->staging_rxon.assoc_id = 0;
3282 priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id); 3280
3283 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE) 3281 if (vif->bss_conf.assoc_capability &
3282 WLAN_CAPABILITY_SHORT_PREAMBLE)
3284 priv->staging_rxon.flags |= 3283 priv->staging_rxon.flags |=
3285 RXON_FLG_SHORT_PREAMBLE_MSK; 3284 RXON_FLG_SHORT_PREAMBLE_MSK;
3286 else 3285 else
@@ -3288,15 +3287,15 @@ void iwl3945_config_ap(struct iwl_priv *priv)
3288 ~RXON_FLG_SHORT_PREAMBLE_MSK; 3287 ~RXON_FLG_SHORT_PREAMBLE_MSK;
3289 3288
3290 if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { 3289 if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) {
3291 if (priv->assoc_capability & 3290 if (vif->bss_conf.assoc_capability &
3292 WLAN_CAPABILITY_SHORT_SLOT_TIME) 3291 WLAN_CAPABILITY_SHORT_SLOT_TIME)
3293 priv->staging_rxon.flags |= 3292 priv->staging_rxon.flags |=
3294 RXON_FLG_SHORT_SLOT_MSK; 3293 RXON_FLG_SHORT_SLOT_MSK;
3295 else 3294 else
3296 priv->staging_rxon.flags &= 3295 priv->staging_rxon.flags &=
3297 ~RXON_FLG_SHORT_SLOT_MSK; 3296 ~RXON_FLG_SHORT_SLOT_MSK;
3298 3297
3299 if (priv->iw_mode == NL80211_IFTYPE_ADHOC) 3298 if (vif->type == NL80211_IFTYPE_ADHOC)
3300 priv->staging_rxon.flags &= 3299 priv->staging_rxon.flags &=
3301 ~RXON_FLG_SHORT_SLOT_MSK; 3300 ~RXON_FLG_SHORT_SLOT_MSK;
3302 } 3301 }