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/ibss.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/ibss.c')
-rw-r--r-- | net/mac80211/ibss.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 275bbb2c1a5a..a0ae02760139 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -836,13 +836,13 @@ ieee80211_ibss_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
836 | bool beacon) | 836 | bool beacon) |
837 | { | 837 | { |
838 | struct cfg80211_csa_settings params; | 838 | struct cfg80211_csa_settings params; |
839 | struct ieee80211_csa_ie csa_ie; | ||
839 | struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; | 840 | struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; |
840 | struct ieee80211_chanctx_conf *chanctx_conf; | 841 | struct ieee80211_chanctx_conf *chanctx_conf; |
841 | struct ieee80211_chanctx *chanctx; | 842 | struct ieee80211_chanctx *chanctx; |
842 | enum nl80211_channel_type ch_type; | 843 | enum nl80211_channel_type ch_type; |
843 | int err, num_chanctx; | 844 | int err, num_chanctx; |
844 | u32 sta_flags; | 845 | u32 sta_flags; |
845 | u8 mode; | ||
846 | 846 | ||
847 | if (sdata->vif.csa_active) | 847 | if (sdata->vif.csa_active) |
848 | return true; | 848 | return true; |
@@ -865,12 +865,10 @@ ieee80211_ibss_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
865 | } | 865 | } |
866 | 866 | ||
867 | memset(¶ms, 0, sizeof(params)); | 867 | memset(¶ms, 0, sizeof(params)); |
868 | memset(&csa_ie, 0, sizeof(csa_ie)); | ||
868 | err = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, | 869 | err = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, |
869 | ifibss->chandef.chan->band, | 870 | ifibss->chandef.chan->band, |
870 | sta_flags, ifibss->bssid, | 871 | sta_flags, ifibss->bssid, &csa_ie); |
871 | ¶ms.count, &mode, | ||
872 | ¶ms.chandef); | ||
873 | |||
874 | /* can't switch to destination channel, fail */ | 872 | /* can't switch to destination channel, fail */ |
875 | if (err < 0) | 873 | if (err < 0) |
876 | goto disconnect; | 874 | goto disconnect; |
@@ -879,6 +877,9 @@ ieee80211_ibss_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
879 | if (err) | 877 | if (err) |
880 | return false; | 878 | return false; |
881 | 879 | ||
880 | params.count = csa_ie.count; | ||
881 | params.chandef = csa_ie.chandef; | ||
882 | |||
882 | if (ifibss->chandef.chan->band != params.chandef.chan->band) | 883 | if (ifibss->chandef.chan->band != params.chandef.chan->band) |
883 | goto disconnect; | 884 | goto disconnect; |
884 | 885 | ||
@@ -965,7 +966,7 @@ ieee80211_ibss_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
965 | "received channel switch announcement to go to channel %d MHz\n", | 966 | "received channel switch announcement to go to channel %d MHz\n", |
966 | params.chandef.chan->center_freq); | 967 | params.chandef.chan->center_freq); |
967 | 968 | ||
968 | params.block_tx = !!mode; | 969 | params.block_tx = !!csa_ie.mode; |
969 | 970 | ||
970 | ieee80211_ibss_csa_beacon(sdata, ¶ms); | 971 | ieee80211_ibss_csa_beacon(sdata, ¶ms); |
971 | sdata->csa_radar_required = params.radar_required; | 972 | sdata->csa_radar_required = params.radar_required; |