summaryrefslogtreecommitdiffstats
path: root/net/mac80211/mlme.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2015-03-12 02:53:25 -0400
committerJohannes Berg <johannes.berg@intel.com>2015-03-16 04:31:02 -0400
commitf3b0bbb35dac575c571dadeace59bd23ce797d31 (patch)
tree7112458ced74882128af0d5dce1f9bd11b655b09 /net/mac80211/mlme.c
parentdc5a1ad7bd830b7789ba2950342bdecfe4787945 (diff)
mac80211: refactor drop connection/unlock in CSA processing
The schedule_work()/mutex unlocking code is duplicated many times, refactor that to a common place in the function. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r--net/mac80211/mlme.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 539d6a976cbf..1999bc08fdcc 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1157,11 +1157,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
1157 if (!conf) { 1157 if (!conf) {
1158 sdata_info(sdata, 1158 sdata_info(sdata,
1159 "no channel context assigned to vif?, disconnecting\n"); 1159 "no channel context assigned to vif?, disconnecting\n");
1160 ieee80211_queue_work(&local->hw, 1160 goto drop_connection;
1161 &ifmgd->csa_connection_drop_work);
1162 mutex_unlock(&local->chanctx_mtx);
1163 mutex_unlock(&local->mtx);
1164 return;
1165 } 1161 }
1166 1162
1167 chanctx = container_of(conf, struct ieee80211_chanctx, conf); 1163 chanctx = container_of(conf, struct ieee80211_chanctx, conf);
@@ -1170,11 +1166,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
1170 !(local->hw.flags & IEEE80211_HW_CHANCTX_STA_CSA)) { 1166 !(local->hw.flags & IEEE80211_HW_CHANCTX_STA_CSA)) {
1171 sdata_info(sdata, 1167 sdata_info(sdata,
1172 "driver doesn't support chan-switch with channel contexts\n"); 1168 "driver doesn't support chan-switch with channel contexts\n");
1173 ieee80211_queue_work(&local->hw, 1169 goto drop_connection;
1174 &ifmgd->csa_connection_drop_work);
1175 mutex_unlock(&local->chanctx_mtx);
1176 mutex_unlock(&local->mtx);
1177 return;
1178 } 1170 }
1179 1171
1180 ch_switch.timestamp = timestamp; 1172 ch_switch.timestamp = timestamp;
@@ -1186,11 +1178,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
1186 if (drv_pre_channel_switch(sdata, &ch_switch)) { 1178 if (drv_pre_channel_switch(sdata, &ch_switch)) {
1187 sdata_info(sdata, 1179 sdata_info(sdata,
1188 "preparing for channel switch failed, disconnecting\n"); 1180 "preparing for channel switch failed, disconnecting\n");
1189 ieee80211_queue_work(&local->hw, 1181 goto drop_connection;
1190 &ifmgd->csa_connection_drop_work);
1191 mutex_unlock(&local->chanctx_mtx);
1192 mutex_unlock(&local->mtx);
1193 return;
1194 } 1182 }
1195 1183
1196 res = ieee80211_vif_reserve_chanctx(sdata, &csa_ie.chandef, 1184 res = ieee80211_vif_reserve_chanctx(sdata, &csa_ie.chandef,
@@ -1199,11 +1187,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
1199 sdata_info(sdata, 1187 sdata_info(sdata,
1200 "failed to reserve channel context for channel switch, disconnecting (err=%d)\n", 1188 "failed to reserve channel context for channel switch, disconnecting (err=%d)\n",
1201 res); 1189 res);
1202 ieee80211_queue_work(&local->hw, 1190 goto drop_connection;
1203 &ifmgd->csa_connection_drop_work);
1204 mutex_unlock(&local->chanctx_mtx);
1205 mutex_unlock(&local->mtx);
1206 return;
1207 } 1191 }
1208 mutex_unlock(&local->chanctx_mtx); 1192 mutex_unlock(&local->chanctx_mtx);
1209 1193
@@ -1232,6 +1216,11 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
1232 mod_timer(&ifmgd->chswitch_timer, 1216 mod_timer(&ifmgd->chswitch_timer,
1233 TU_TO_EXP_TIME((csa_ie.count - 1) * 1217 TU_TO_EXP_TIME((csa_ie.count - 1) *
1234 cbss->beacon_interval)); 1218 cbss->beacon_interval));
1219 return;
1220 drop_connection:
1221 ieee80211_queue_work(&local->hw, &ifmgd->csa_connection_drop_work);
1222 mutex_unlock(&local->chanctx_mtx);
1223 mutex_unlock(&local->mtx);
1235} 1224}
1236 1225
1237static bool 1226static bool