diff options
author | Luciano Coelho <luciano.coelho@intel.com> | 2014-10-08 02:48:37 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-10-09 05:30:08 -0400 |
commit | 6d027bcc8a4e2518ae825b0ff3dd069ab1abfe96 (patch) | |
tree | 798d3bfaf90f5f653905da6cb3be864f2a7a0443 /net/mac80211/mlme.c | |
parent | e9a21949b79414dda42a017855b288901c07e613 (diff) |
mac80211: add pre_channel_switch driver operation
Some drivers may need to prepare for a channel switch also when it is
initiated from the remote side (eg. station, P2P client). To make
this possible, add a generic callback that can be called for all
interface types.
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r-- | net/mac80211/mlme.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index f2e048fa250c..d23d6d97e453 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1057,6 +1057,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
1057 | struct ieee80211_chanctx *chanctx; | 1057 | struct ieee80211_chanctx *chanctx; |
1058 | enum ieee80211_band current_band; | 1058 | enum ieee80211_band current_band; |
1059 | struct ieee80211_csa_ie csa_ie; | 1059 | struct ieee80211_csa_ie csa_ie; |
1060 | struct ieee80211_channel_switch ch_switch; | ||
1060 | int res; | 1061 | int res; |
1061 | 1062 | ||
1062 | sdata_assert_lock(sdata); | 1063 | sdata_assert_lock(sdata); |
@@ -1128,6 +1129,22 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
1128 | } | 1129 | } |
1129 | } | 1130 | } |
1130 | 1131 | ||
1132 | ch_switch.timestamp = timestamp; | ||
1133 | ch_switch.device_timestamp = device_timestamp; | ||
1134 | ch_switch.block_tx = csa_ie.mode; | ||
1135 | ch_switch.chandef = csa_ie.chandef; | ||
1136 | ch_switch.count = csa_ie.count; | ||
1137 | |||
1138 | if (drv_pre_channel_switch(sdata, &ch_switch)) { | ||
1139 | sdata_info(sdata, | ||
1140 | "preparing for channel switch failed, disconnecting\n"); | ||
1141 | ieee80211_queue_work(&local->hw, | ||
1142 | &ifmgd->csa_connection_drop_work); | ||
1143 | mutex_unlock(&local->chanctx_mtx); | ||
1144 | mutex_unlock(&local->mtx); | ||
1145 | return; | ||
1146 | } | ||
1147 | |||
1131 | res = ieee80211_vif_reserve_chanctx(sdata, &csa_ie.chandef, | 1148 | res = ieee80211_vif_reserve_chanctx(sdata, &csa_ie.chandef, |
1132 | chanctx->mode, false); | 1149 | chanctx->mode, false); |
1133 | if (res) { | 1150 | if (res) { |
@@ -1153,14 +1170,6 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
1153 | 1170 | ||
1154 | if (local->ops->channel_switch) { | 1171 | if (local->ops->channel_switch) { |
1155 | /* use driver's channel switch callback */ | 1172 | /* use driver's channel switch callback */ |
1156 | struct ieee80211_channel_switch ch_switch = { | ||
1157 | .timestamp = timestamp, | ||
1158 | .device_timestamp = device_timestamp, | ||
1159 | .block_tx = csa_ie.mode, | ||
1160 | .chandef = csa_ie.chandef, | ||
1161 | .count = csa_ie.count, | ||
1162 | }; | ||
1163 | |||
1164 | drv_channel_switch(local, &ch_switch); | 1173 | drv_channel_switch(local, &ch_switch); |
1165 | return; | 1174 | return; |
1166 | } | 1175 | } |