Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 327634
b: refs/heads/master
c: b17166a
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Berg committed Jul 31, 2012
1 parent 01d66da commit 903d59b
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 13e0c8e355983cdd4ea7accc3b3208e80944716d
refs/heads/master: b17166a707e748ad87907f38431a1df26bb643f2
69 changes: 43 additions & 26 deletions trunk/net/mac80211/mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -3038,41 +3038,17 @@ int ieee80211_max_network_latency(struct notifier_block *nb,
return 0;
}

static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
struct cfg80211_bss *cbss, bool assoc)
static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
struct cfg80211_bss *cbss)
{
struct ieee80211_local *local = sdata->local;
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
struct ieee80211_bss *bss = (void *)cbss->priv;
struct sta_info *new_sta = NULL;
bool have_sta = false;
int err;
int ht_cfreq;
enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT;
const u8 *ht_oper_ie;
const struct ieee80211_ht_operation *ht_oper = NULL;
struct ieee80211_supported_band *sband;

if (WARN_ON(!ifmgd->auth_data && !ifmgd->assoc_data))
return -EINVAL;

if (assoc) {
rcu_read_lock();
have_sta = sta_info_get(sdata, cbss->bssid);
rcu_read_unlock();
}

if (!have_sta) {
new_sta = sta_info_alloc(sdata, cbss->bssid, GFP_KERNEL);
if (!new_sta)
return -ENOMEM;
}

mutex_lock(&local->mtx);
ieee80211_recalc_idle(sdata->local);
mutex_unlock(&local->mtx);

/* switch to the right channel */
sband = local->hw.wiphy->bands[cbss->channel->band];

ifmgd->flags &= ~IEEE80211_STA_DISABLE_40MHZ;
Expand Down Expand Up @@ -3135,10 +3111,51 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
local->oper_channel = cbss->channel;
ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);

return 0;
}

static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
struct cfg80211_bss *cbss, bool assoc)
{
struct ieee80211_local *local = sdata->local;
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
struct ieee80211_bss *bss = (void *)cbss->priv;
struct sta_info *new_sta = NULL;
bool have_sta = false;
int err;

if (WARN_ON(!ifmgd->auth_data && !ifmgd->assoc_data))
return -EINVAL;

if (assoc) {
rcu_read_lock();
have_sta = sta_info_get(sdata, cbss->bssid);
rcu_read_unlock();
}

if (!have_sta) {
new_sta = sta_info_alloc(sdata, cbss->bssid, GFP_KERNEL);
if (!new_sta)
return -ENOMEM;
}

mutex_lock(&local->mtx);
ieee80211_recalc_idle(sdata->local);
mutex_unlock(&local->mtx);

if (new_sta) {
u32 rates = 0, basic_rates = 0;
bool have_higher_than_11mbit;
int min_rate = INT_MAX, min_rate_index = -1;
struct ieee80211_supported_band *sband;

sband = local->hw.wiphy->bands[cbss->channel->band];

err = ieee80211_prep_channel(sdata, cbss);
if (err) {
sta_info_free(local, new_sta);
return err;
}

ieee80211_get_rates(sband, bss->supp_rates,
bss->supp_rates_len,
Expand Down

0 comments on commit 903d59b

Please sign in to comment.