diff options
author | Chun-Yeow Yeoh <yeohchunyeow@cozybit.com> | 2013-10-14 22:08:29 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-10-28 10:05:28 -0400 |
commit | c0f17eb9b2d4d322c099a0700437209149224583 (patch) | |
tree | ed32c2de60b9dc2dc50e2125ce49fae54e5507a8 /net/mac80211/spectmgmt.c | |
parent | 06be6b149f7e406bcf16098567f5a6c9f042bced (diff) |
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.c | 27 |
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 @@ | |||
24 | int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, | 24 | int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, |
25 | struct ieee802_11_elems *elems, bool beacon, | 25 | struct ieee802_11_elems *elems, bool beacon, |
26 | enum ieee80211_band current_band, | 26 | enum ieee80211_band current_band, |
27 | u32 sta_flags, u8 *bssid, u8 *count, u8 *mode, | 27 | u32 sta_flags, u8 *bssid, |
28 | struct cfg80211_chan_def *new_chandef) | 28 | struct ieee80211_csa_ie *csa_ie) |
29 | { | 29 | { |
30 | enum ieee80211_band new_band; | 30 | enum ieee80211_band new_band; |
31 | int new_freq; | 31 | int new_freq; |
@@ -62,13 +62,13 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, | |||
62 | return -EINVAL; | 62 | return -EINVAL; |
63 | } | 63 | } |
64 | new_chan_no = elems->ext_chansw_ie->new_ch_num; | 64 | new_chan_no = elems->ext_chansw_ie->new_ch_num; |
65 | *count = elems->ext_chansw_ie->count; | 65 | csa_ie->count = elems->ext_chansw_ie->count; |
66 | *mode = elems->ext_chansw_ie->mode; | 66 | csa_ie->mode = elems->ext_chansw_ie->mode; |
67 | } else if (elems->ch_switch_ie) { | 67 | } else if (elems->ch_switch_ie) { |
68 | new_band = current_band; | 68 | new_band = current_band; |
69 | new_chan_no = elems->ch_switch_ie->new_ch_num; | 69 | new_chan_no = elems->ch_switch_ie->new_ch_num; |
70 | *count = elems->ch_switch_ie->count; | 70 | csa_ie->count = elems->ch_switch_ie->count; |
71 | *mode = elems->ch_switch_ie->mode; | 71 | csa_ie->mode = elems->ch_switch_ie->mode; |
72 | } else { | 72 | } else { |
73 | /* nothing here we understand */ | 73 | /* nothing here we understand */ |
74 | return 1; | 74 | return 1; |
@@ -103,25 +103,26 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, | |||
103 | default: | 103 | default: |
104 | /* secondary_channel_offset was present but is invalid */ | 104 | /* secondary_channel_offset was present but is invalid */ |
105 | case IEEE80211_HT_PARAM_CHA_SEC_NONE: | 105 | case IEEE80211_HT_PARAM_CHA_SEC_NONE: |
106 | cfg80211_chandef_create(new_chandef, new_chan, | 106 | cfg80211_chandef_create(&csa_ie->chandef, new_chan, |
107 | NL80211_CHAN_HT20); | 107 | NL80211_CHAN_HT20); |
108 | break; | 108 | break; |
109 | case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: | 109 | case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: |
110 | cfg80211_chandef_create(new_chandef, new_chan, | 110 | cfg80211_chandef_create(&csa_ie->chandef, new_chan, |
111 | NL80211_CHAN_HT40PLUS); | 111 | NL80211_CHAN_HT40PLUS); |
112 | break; | 112 | break; |
113 | case IEEE80211_HT_PARAM_CHA_SEC_BELOW: | 113 | case IEEE80211_HT_PARAM_CHA_SEC_BELOW: |
114 | cfg80211_chandef_create(new_chandef, new_chan, | 114 | cfg80211_chandef_create(&csa_ie->chandef, new_chan, |
115 | NL80211_CHAN_HT40MINUS); | 115 | NL80211_CHAN_HT40MINUS); |
116 | break; | 116 | break; |
117 | case -1: | 117 | case -1: |
118 | cfg80211_chandef_create(new_chandef, new_chan, | 118 | cfg80211_chandef_create(&csa_ie->chandef, new_chan, |
119 | NL80211_CHAN_NO_HT); | 119 | NL80211_CHAN_NO_HT); |
120 | /* keep width for 5/10 MHz channels */ | 120 | /* keep width for 5/10 MHz channels */ |
121 | switch (sdata->vif.bss_conf.chandef.width) { | 121 | switch (sdata->vif.bss_conf.chandef.width) { |
122 | case NL80211_CHAN_WIDTH_5: | 122 | case NL80211_CHAN_WIDTH_5: |
123 | case NL80211_CHAN_WIDTH_10: | 123 | case NL80211_CHAN_WIDTH_10: |
124 | new_chandef->width = sdata->vif.bss_conf.chandef.width; | 124 | csa_ie->chandef.width = |
125 | sdata->vif.bss_conf.chandef.width; | ||
125 | break; | 126 | break; |
126 | default: | 127 | default: |
127 | break; | 128 | break; |
@@ -171,13 +172,13 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, | |||
171 | /* if VHT data is there validate & use it */ | 172 | /* if VHT data is there validate & use it */ |
172 | if (new_vht_chandef.chan) { | 173 | if (new_vht_chandef.chan) { |
173 | if (!cfg80211_chandef_compatible(&new_vht_chandef, | 174 | if (!cfg80211_chandef_compatible(&new_vht_chandef, |
174 | new_chandef)) { | 175 | &csa_ie->chandef)) { |
175 | sdata_info(sdata, | 176 | sdata_info(sdata, |
176 | "BSS %pM: CSA has inconsistent channel data, disconnecting\n", | 177 | "BSS %pM: CSA has inconsistent channel data, disconnecting\n", |
177 | bssid); | 178 | bssid); |
178 | return -EINVAL; | 179 | return -EINVAL; |
179 | } | 180 | } |
180 | *new_chandef = new_vht_chandef; | 181 | csa_ie->chandef = new_vht_chandef; |
181 | } | 182 | } |
182 | 183 | ||
183 | return 0; | 184 | return 0; |