aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ibss.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-11-09 05:39:59 -0500
committerJohannes Berg <johannes.berg@intel.com>2012-11-26 06:42:59 -0500
commit4bf88530be971bf95a7830ca61b4120980bf4347 (patch)
tree405d426806cb76551d09f427dafeeee79dac0dea /net/mac80211/ibss.c
parent3d9d1d6656a73ea8407734cfb00b81d14ef62d4b (diff)
mac80211: convert to channel definition struct
Convert mac80211 (and where necessary, some drivers a little bit) to the new channel definition struct. This will allow extending mac80211 for VHT, which is currently restricted to channel contexts since there are no drivers using that which makes it easier. As I also don't care about VHT for drivers not using the channel context API, I won't convert the previous API to VHT support. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/ibss.c')
-rw-r--r--net/mac80211/ibss.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 5648bbed240..11a6a1bde2f 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -52,7 +52,6 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
52 u32 bss_change; 52 u32 bss_change;
53 u8 supp_rates[IEEE80211_MAX_SUPP_RATES]; 53 u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
54 struct cfg80211_chan_def chandef; 54 struct cfg80211_chan_def chandef;
55 enum nl80211_channel_type chan_type;
56 55
57 lockdep_assert_held(&ifibss->mtx); 56 lockdep_assert_held(&ifibss->mtx);
58 57
@@ -80,13 +79,14 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
80 79
81 sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0; 80 sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
82 81
83 chan_type = ifibss->channel_type; 82 cfg80211_chandef_create(&chandef, chan, ifibss->channel_type);
84 cfg80211_chandef_create(&chandef, chan, chan_type); 83 if (!cfg80211_reg_can_beacon(local->hw.wiphy, &chandef)) {
85 if (!cfg80211_reg_can_beacon(local->hw.wiphy, &chandef)) 84 chandef.width = NL80211_CHAN_WIDTH_20;
86 chan_type = NL80211_CHAN_HT20; 85 chandef.center_freq1 = chan->center_freq;
86 }
87 87
88 ieee80211_vif_release_channel(sdata); 88 ieee80211_vif_release_channel(sdata);
89 if (ieee80211_vif_use_channel(sdata, chan, chan_type, 89 if (ieee80211_vif_use_channel(sdata, &chandef,
90 ifibss->fixed_channel ? 90 ifibss->fixed_channel ?
91 IEEE80211_CHANCTX_SHARED : 91 IEEE80211_CHANCTX_SHARED :
92 IEEE80211_CHANCTX_EXCLUSIVE)) { 92 IEEE80211_CHANCTX_EXCLUSIVE)) {
@@ -160,7 +160,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
160 ifibss->ie, ifibss->ie_len); 160 ifibss->ie, ifibss->ie_len);
161 161
162 /* add HT capability and information IEs */ 162 /* add HT capability and information IEs */
163 if (chan_type != NL80211_CHAN_NO_HT && 163 if (chandef.width != NL80211_CHAN_WIDTH_20_NOHT &&
164 sband->ht_cap.ht_supported) { 164 sband->ht_cap.ht_supported) {
165 pos = skb_put(skb, 4 + 165 pos = skb_put(skb, 4 +
166 sizeof(struct ieee80211_ht_cap) + 166 sizeof(struct ieee80211_ht_cap) +
@@ -173,7 +173,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
173 * keep them at 0 173 * keep them at 0
174 */ 174 */
175 pos = ieee80211_ie_build_ht_oper(pos, &sband->ht_cap, 175 pos = ieee80211_ie_build_ht_oper(pos, &sband->ht_cap,
176 chan, chan_type, 0); 176 &chandef, 0);
177 } 177 }
178 178
179 if (local->hw.queues >= IEEE80211_NUM_ACS) { 179 if (local->hw.queues >= IEEE80211_NUM_ACS) {
@@ -329,7 +329,7 @@ ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
329 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 329 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
330 if (WARN_ON_ONCE(!chanctx_conf)) 330 if (WARN_ON_ONCE(!chanctx_conf))
331 return NULL; 331 return NULL;
332 band = chanctx_conf->channel->band; 332 band = chanctx_conf->def.chan->band;
333 rcu_read_unlock(); 333 rcu_read_unlock();
334 334
335 sta = sta_info_alloc(sdata, addr, GFP_KERNEL); 335 sta = sta_info_alloc(sdata, addr, GFP_KERNEL);
@@ -478,9 +478,11 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
478 sdata->u.ibss.channel_type != NL80211_CHAN_NO_HT) { 478 sdata->u.ibss.channel_type != NL80211_CHAN_NO_HT) {
479 /* we both use HT */ 479 /* we both use HT */
480 struct ieee80211_sta_ht_cap sta_ht_cap_new; 480 struct ieee80211_sta_ht_cap sta_ht_cap_new;
481 enum nl80211_channel_type channel_type = 481 struct cfg80211_chan_def chandef;
482 ieee80211_ht_oper_to_channel_type( 482
483 elems->ht_operation); 483 ieee80211_ht_oper_to_chandef(channel,
484 elems->ht_operation,
485 &chandef);
484 486
485 ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, 487 ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
486 elems->ht_cap_elem, 488 elems->ht_cap_elem,
@@ -490,9 +492,9 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
490 * fall back to HT20 if we don't use or use 492 * fall back to HT20 if we don't use or use
491 * the other extension channel 493 * the other extension channel
492 */ 494 */
493 if (!(channel_type == NL80211_CHAN_HT40MINUS || 495 if (chandef.width != NL80211_CHAN_WIDTH_40 ||
494 channel_type == NL80211_CHAN_HT40PLUS) || 496 cfg80211_get_chandef_type(&chandef) !=
495 channel_type != sdata->u.ibss.channel_type) 497 sdata->u.ibss.channel_type)
496 sta_ht_cap_new.cap &= 498 sta_ht_cap_new.cap &=
497 ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; 499 ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
498 500
@@ -616,7 +618,7 @@ void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,
616 rcu_read_unlock(); 618 rcu_read_unlock();
617 return; 619 return;
618 } 620 }
619 band = chanctx_conf->channel->band; 621 band = chanctx_conf->def.chan->band;
620 rcu_read_unlock(); 622 rcu_read_unlock();
621 623
622 sta = sta_info_alloc(sdata, addr, GFP_ATOMIC); 624 sta = sta_info_alloc(sdata, addr, GFP_ATOMIC);