diff options
author | Michal Kazior <michal.kazior@tieto.com> | 2014-04-09 09:11:00 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-05-06 09:10:00 -0400 |
commit | 66199506fb91058a78b154b7fecb703ddaa27146 (patch) | |
tree | 6fd05a1eda49b6ea238e106a4e455fbc08377bb1 /net | |
parent | 59af6928d2099479c0bc2ef3f66cc7b33998120a (diff) |
mac80211: split CSA finalize function
Improves readability and modularity.
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/cfg.c | 61 |
1 files changed, 37 insertions, 24 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index f789c3198af4..0c87c8c47123 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -3053,25 +3053,11 @@ void ieee80211_csa_finish(struct ieee80211_vif *vif) | |||
3053 | } | 3053 | } |
3054 | EXPORT_SYMBOL(ieee80211_csa_finish); | 3054 | EXPORT_SYMBOL(ieee80211_csa_finish); |
3055 | 3055 | ||
3056 | static void ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata) | 3056 | static int ieee80211_set_after_csa_beacon(struct ieee80211_sub_if_data *sdata, |
3057 | u32 *changed) | ||
3057 | { | 3058 | { |
3058 | struct ieee80211_local *local = sdata->local; | 3059 | int err; |
3059 | int err, changed = 0; | ||
3060 | |||
3061 | sdata_assert_lock(sdata); | ||
3062 | lockdep_assert_held(&local->mtx); | ||
3063 | |||
3064 | sdata->radar_required = sdata->csa_radar_required; | ||
3065 | err = ieee80211_vif_change_channel(sdata, &changed); | ||
3066 | if (WARN_ON(err < 0)) | ||
3067 | return; | ||
3068 | |||
3069 | if (!local->use_chanctx) { | ||
3070 | local->_oper_chandef = sdata->csa_chandef; | ||
3071 | ieee80211_hw_config(local, 0); | ||
3072 | } | ||
3073 | 3060 | ||
3074 | sdata->vif.csa_active = false; | ||
3075 | switch (sdata->vif.type) { | 3061 | switch (sdata->vif.type) { |
3076 | case NL80211_IFTYPE_AP: | 3062 | case NL80211_IFTYPE_AP: |
3077 | err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon); | 3063 | err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon); |
@@ -3079,30 +3065,57 @@ static void ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata) | |||
3079 | sdata->u.ap.next_beacon = NULL; | 3065 | sdata->u.ap.next_beacon = NULL; |
3080 | 3066 | ||
3081 | if (err < 0) | 3067 | if (err < 0) |
3082 | return; | 3068 | return err; |
3083 | changed |= err; | 3069 | *changed |= err; |
3084 | break; | 3070 | break; |
3085 | case NL80211_IFTYPE_ADHOC: | 3071 | case NL80211_IFTYPE_ADHOC: |
3086 | err = ieee80211_ibss_finish_csa(sdata); | 3072 | err = ieee80211_ibss_finish_csa(sdata); |
3087 | if (err < 0) | 3073 | if (err < 0) |
3088 | return; | 3074 | return err; |
3089 | changed |= err; | 3075 | *changed |= err; |
3090 | break; | 3076 | break; |
3091 | #ifdef CONFIG_MAC80211_MESH | 3077 | #ifdef CONFIG_MAC80211_MESH |
3092 | case NL80211_IFTYPE_MESH_POINT: | 3078 | case NL80211_IFTYPE_MESH_POINT: |
3093 | err = ieee80211_mesh_finish_csa(sdata); | 3079 | err = ieee80211_mesh_finish_csa(sdata); |
3094 | if (err < 0) | 3080 | if (err < 0) |
3095 | return; | 3081 | return err; |
3096 | changed |= err; | 3082 | *changed |= err; |
3097 | break; | 3083 | break; |
3098 | #endif | 3084 | #endif |
3099 | default: | 3085 | default: |
3100 | WARN_ON(1); | 3086 | WARN_ON(1); |
3087 | return -EINVAL; | ||
3088 | } | ||
3089 | |||
3090 | return 0; | ||
3091 | } | ||
3092 | |||
3093 | static void ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata) | ||
3094 | { | ||
3095 | struct ieee80211_local *local = sdata->local; | ||
3096 | u32 changed = 0; | ||
3097 | int err; | ||
3098 | |||
3099 | sdata_assert_lock(sdata); | ||
3100 | lockdep_assert_held(&local->mtx); | ||
3101 | |||
3102 | sdata->radar_required = sdata->csa_radar_required; | ||
3103 | err = ieee80211_vif_change_channel(sdata, &changed); | ||
3104 | if (WARN_ON(err < 0)) | ||
3101 | return; | 3105 | return; |
3106 | |||
3107 | if (!local->use_chanctx) { | ||
3108 | local->_oper_chandef = sdata->csa_chandef; | ||
3109 | ieee80211_hw_config(local, 0); | ||
3102 | } | 3110 | } |
3103 | 3111 | ||
3104 | ieee80211_bss_info_change_notify(sdata, changed); | 3112 | sdata->vif.csa_active = false; |
3113 | |||
3114 | err = ieee80211_set_after_csa_beacon(sdata, &changed); | ||
3115 | if (err) | ||
3116 | return; | ||
3105 | 3117 | ||
3118 | ieee80211_bss_info_change_notify(sdata, changed); | ||
3106 | cfg80211_ch_switch_notify(sdata->dev, &sdata->csa_chandef); | 3119 | cfg80211_ch_switch_notify(sdata->dev, &sdata->csa_chandef); |
3107 | 3120 | ||
3108 | if (!ieee80211_csa_needs_block_tx(local)) | 3121 | if (!ieee80211_csa_needs_block_tx(local)) |