aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ibss.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-11-08 15:25:48 -0500
committerJohannes Berg <johannes.berg@intel.com>2012-11-26 06:42:58 -0500
commit683b6d3b31a51956ea540df00abb0b78894924c1 (patch)
tree558e0f316b56368ab259755cb4eeaeb40331853d /net/mac80211/ibss.c
parentfe4b31810c06cc6518fb193efb9b3c3289b55832 (diff)
cfg80211: pass a channel definition struct
Instead of passing a channel pointer and channel type to all functions and driver methods, pass a new channel definition struct. Right now, this struct contains just the control channel and channel type, but for VHT this will change. Also, add a small inline cfg80211_get_chandef_type() so that drivers don't need to use the _type field of the new structure all the time, which will change. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/ibss.c')
-rw-r--r--net/mac80211/ibss.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 845973b67a73..bed616fd97e9 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -51,7 +51,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
51 struct cfg80211_bss *bss; 51 struct cfg80211_bss *bss;
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 enum nl80211_channel_type channel_type; 54 struct cfg80211_chan_def chandef;
55 55
56 lockdep_assert_held(&ifibss->mtx); 56 lockdep_assert_held(&ifibss->mtx);
57 57
@@ -79,12 +79,13 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
79 79
80 sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0; 80 sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
81 81
82 channel_type = ifibss->channel_type; 82 chandef.chan = chan;
83 if (!cfg80211_can_beacon_sec_chan(local->hw.wiphy, chan, channel_type)) 83 chandef._type = ifibss->channel_type;
84 channel_type = NL80211_CHAN_HT20; 84 if (!cfg80211_reg_can_beacon(local->hw.wiphy, &chandef))
85 chandef._type = NL80211_CHAN_HT20;
85 86
86 ieee80211_vif_release_channel(sdata); 87 ieee80211_vif_release_channel(sdata);
87 if (ieee80211_vif_use_channel(sdata, chan, channel_type, 88 if (ieee80211_vif_use_channel(sdata, chan, chandef._type,
88 ifibss->fixed_channel ? 89 ifibss->fixed_channel ?
89 IEEE80211_CHANCTX_SHARED : 90 IEEE80211_CHANCTX_SHARED :
90 IEEE80211_CHANCTX_EXCLUSIVE)) { 91 IEEE80211_CHANCTX_EXCLUSIVE)) {
@@ -158,7 +159,8 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
158 ifibss->ie, ifibss->ie_len); 159 ifibss->ie, ifibss->ie_len);
159 160
160 /* add HT capability and information IEs */ 161 /* add HT capability and information IEs */
161 if (channel_type && sband->ht_cap.ht_supported) { 162 if (chandef._type != NL80211_CHAN_NO_HT &&
163 sband->ht_cap.ht_supported) {
162 pos = skb_put(skb, 4 + 164 pos = skb_put(skb, 4 +
163 sizeof(struct ieee80211_ht_cap) + 165 sizeof(struct ieee80211_ht_cap) +
164 sizeof(struct ieee80211_ht_operation)); 166 sizeof(struct ieee80211_ht_operation));
@@ -170,7 +172,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
170 * keep them at 0 172 * keep them at 0
171 */ 173 */
172 pos = ieee80211_ie_build_ht_oper(pos, &sband->ht_cap, 174 pos = ieee80211_ie_build_ht_oper(pos, &sband->ht_cap,
173 chan, channel_type, 0); 175 chan, chandef._type, 0);
174 } 176 }
175 177
176 if (local->hw.queues >= IEEE80211_NUM_ACS) { 178 if (local->hw.queues >= IEEE80211_NUM_ACS) {
@@ -1078,8 +1080,9 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
1078 1080
1079 sdata->vif.bss_conf.beacon_int = params->beacon_interval; 1081 sdata->vif.bss_conf.beacon_int = params->beacon_interval;
1080 1082
1081 sdata->u.ibss.channel = params->channel; 1083 sdata->u.ibss.channel = params->chandef.chan;
1082 sdata->u.ibss.channel_type = params->channel_type; 1084 sdata->u.ibss.channel_type =
1085 cfg80211_get_chandef_type(&params->chandef);
1083 sdata->u.ibss.fixed_channel = params->channel_fixed; 1086 sdata->u.ibss.fixed_channel = params->channel_fixed;
1084 1087
1085 if (params->ie) { 1088 if (params->ie) {