aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-07-27 05:41:27 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-07-31 10:18:50 -0400
commitb17166a707e748ad87907f38431a1df26bb643f2 (patch)
tree4c3580c9ef9900e76723cc3c3b596fd15068b66a /net
parent13e0c8e355983cdd4ea7accc3b3208e80944716d (diff)
mac80211: set channel only once during auth/assoc
There's no need to set up the channel during auth and again during assoc, just do it once. Currently this doesn't result in any changes since calling hw_config() with an unchanged channel will return early, but with the channel context work this has an impact on channel context assignment. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/mlme.c69
1 files changed, 43 insertions, 26 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index e065ef5f7b2..68205520758 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -3038,41 +3038,17 @@ int ieee80211_max_network_latency(struct notifier_block *nb,
3038 return 0; 3038 return 0;
3039} 3039}
3040 3040
3041static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, 3041static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
3042 struct cfg80211_bss *cbss, bool assoc) 3042 struct cfg80211_bss *cbss)
3043{ 3043{
3044 struct ieee80211_local *local = sdata->local; 3044 struct ieee80211_local *local = sdata->local;
3045 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 3045 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
3046 struct ieee80211_bss *bss = (void *)cbss->priv;
3047 struct sta_info *new_sta = NULL;
3048 bool have_sta = false;
3049 int err;
3050 int ht_cfreq; 3046 int ht_cfreq;
3051 enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; 3047 enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT;
3052 const u8 *ht_oper_ie; 3048 const u8 *ht_oper_ie;
3053 const struct ieee80211_ht_operation *ht_oper = NULL; 3049 const struct ieee80211_ht_operation *ht_oper = NULL;
3054 struct ieee80211_supported_band *sband; 3050 struct ieee80211_supported_band *sband;
3055 3051
3056 if (WARN_ON(!ifmgd->auth_data && !ifmgd->assoc_data))
3057 return -EINVAL;
3058
3059 if (assoc) {
3060 rcu_read_lock();
3061 have_sta = sta_info_get(sdata, cbss->bssid);
3062 rcu_read_unlock();
3063 }
3064
3065 if (!have_sta) {
3066 new_sta = sta_info_alloc(sdata, cbss->bssid, GFP_KERNEL);
3067 if (!new_sta)
3068 return -ENOMEM;
3069 }
3070
3071 mutex_lock(&local->mtx);
3072 ieee80211_recalc_idle(sdata->local);
3073 mutex_unlock(&local->mtx);
3074
3075 /* switch to the right channel */
3076 sband = local->hw.wiphy->bands[cbss->channel->band]; 3052 sband = local->hw.wiphy->bands[cbss->channel->band];
3077 3053
3078 ifmgd->flags &= ~IEEE80211_STA_DISABLE_40MHZ; 3054 ifmgd->flags &= ~IEEE80211_STA_DISABLE_40MHZ;
@@ -3135,10 +3111,51 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
3135 local->oper_channel = cbss->channel; 3111 local->oper_channel = cbss->channel;
3136 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); 3112 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
3137 3113
3114 return 0;
3115}
3116
3117static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
3118 struct cfg80211_bss *cbss, bool assoc)
3119{
3120 struct ieee80211_local *local = sdata->local;
3121 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
3122 struct ieee80211_bss *bss = (void *)cbss->priv;
3123 struct sta_info *new_sta = NULL;
3124 bool have_sta = false;
3125 int err;
3126
3127 if (WARN_ON(!ifmgd->auth_data && !ifmgd->assoc_data))
3128 return -EINVAL;
3129
3130 if (assoc) {
3131 rcu_read_lock();
3132 have_sta = sta_info_get(sdata, cbss->bssid);
3133 rcu_read_unlock();
3134 }
3135
3136 if (!have_sta) {
3137 new_sta = sta_info_alloc(sdata, cbss->bssid, GFP_KERNEL);
3138 if (!new_sta)
3139 return -ENOMEM;
3140 }
3141
3142 mutex_lock(&local->mtx);
3143 ieee80211_recalc_idle(sdata->local);
3144 mutex_unlock(&local->mtx);
3145
3138 if (new_sta) { 3146 if (new_sta) {
3139 u32 rates = 0, basic_rates = 0; 3147 u32 rates = 0, basic_rates = 0;
3140 bool have_higher_than_11mbit; 3148 bool have_higher_than_11mbit;
3141 int min_rate = INT_MAX, min_rate_index = -1; 3149 int min_rate = INT_MAX, min_rate_index = -1;
3150 struct ieee80211_supported_band *sband;
3151
3152 sband = local->hw.wiphy->bands[cbss->channel->band];
3153
3154 err = ieee80211_prep_channel(sdata, cbss);
3155 if (err) {
3156 sta_info_free(local, new_sta);
3157 return err;
3158 }
3142 3159
3143 ieee80211_get_rates(sband, bss->supp_rates, 3160 ieee80211_get_rates(sband, bss->supp_rates,
3144 bss->supp_rates_len, 3161 bss->supp_rates_len,