summaryrefslogtreecommitdiff
path: root/net/mac80211/spectmgmt.c
diff options
context:
space:
mode:
authorChun-Yeow Yeoh <yeohchunyeow@cozybit.com>2013-10-14 19:08:29 -0700
committerJohannes Berg <johannes.berg@intel.com>2013-10-28 15:05:28 +0100
commitc0f17eb9b2d4d322c099a0700437209149224583 (patch)
treeed32c2de60b9dc2dc50e2125ce49fae54e5507a8 /net/mac80211/spectmgmt.c
parent06be6b149f7e406bcf16098567f5a6c9f042bced (diff)
downloadlinux-c0f17eb9b2d4d322c099a0700437209149224583.tar.gz
mac80211: refactor the parsing of chan switch ie
Refactor the channel switch IE parsing to reduce the number of function parameters. Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@cozybit.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/spectmgmt.c')
-rw-r--r--net/mac80211/spectmgmt.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/net/mac80211/spectmgmt.c b/net/mac80211/spectmgmt.c
index 921597e279a3..a298e129633b 100644
--- a/net/mac80211/spectmgmt.c
+++ b/net/mac80211/spectmgmt.c
@@ -24,8 +24,8 @@
int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
struct ieee802_11_elems *elems, bool beacon,
enum ieee80211_band current_band,
- u32 sta_flags, u8 *bssid, u8 *count, u8 *mode,
- struct cfg80211_chan_def *new_chandef)
+ u32 sta_flags, u8 *bssid,
+ struct ieee80211_csa_ie *csa_ie)
{
enum ieee80211_band new_band;
int new_freq;
@@ -62,13 +62,13 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
return -EINVAL;
}
new_chan_no = elems->ext_chansw_ie->new_ch_num;
- *count = elems->ext_chansw_ie->count;
- *mode = elems->ext_chansw_ie->mode;
+ csa_ie->count = elems->ext_chansw_ie->count;
+ csa_ie->mode = elems->ext_chansw_ie->mode;
} else if (elems->ch_switch_ie) {
new_band = current_band;
new_chan_no = elems->ch_switch_ie->new_ch_num;
- *count = elems->ch_switch_ie->count;
- *mode = elems->ch_switch_ie->mode;
+ csa_ie->count = elems->ch_switch_ie->count;
+ csa_ie->mode = elems->ch_switch_ie->mode;
} else {
/* nothing here we understand */
return 1;
@@ -103,25 +103,26 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
default:
/* secondary_channel_offset was present but is invalid */
case IEEE80211_HT_PARAM_CHA_SEC_NONE:
- cfg80211_chandef_create(new_chandef, new_chan,
+ cfg80211_chandef_create(&csa_ie->chandef, new_chan,
NL80211_CHAN_HT20);
break;
case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
- cfg80211_chandef_create(new_chandef, new_chan,
+ cfg80211_chandef_create(&csa_ie->chandef, new_chan,
NL80211_CHAN_HT40PLUS);
break;
case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
- cfg80211_chandef_create(new_chandef, new_chan,
+ cfg80211_chandef_create(&csa_ie->chandef, new_chan,
NL80211_CHAN_HT40MINUS);
break;
case -1:
- cfg80211_chandef_create(new_chandef, new_chan,
+ cfg80211_chandef_create(&csa_ie->chandef, new_chan,
NL80211_CHAN_NO_HT);
/* keep width for 5/10 MHz channels */
switch (sdata->vif.bss_conf.chandef.width) {
case NL80211_CHAN_WIDTH_5:
case NL80211_CHAN_WIDTH_10:
- new_chandef->width = sdata->vif.bss_conf.chandef.width;
+ csa_ie->chandef.width =
+ sdata->vif.bss_conf.chandef.width;
break;
default:
break;
@@ -171,13 +172,13 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
/* if VHT data is there validate & use it */
if (new_vht_chandef.chan) {
if (!cfg80211_chandef_compatible(&new_vht_chandef,
- new_chandef)) {
+ &csa_ie->chandef)) {
sdata_info(sdata,
"BSS %pM: CSA has inconsistent channel data, disconnecting\n",
bssid);
return -EINVAL;
}
- *new_chandef = new_vht_chandef;
+ csa_ie->chandef = new_vht_chandef;
}
return 0;