diff options
author | Ben Greear <greearb@candelatech.com> | 2011-01-28 13:20:47 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-02-03 16:38:26 -0500 |
commit | eeabee7e53f6fb5e63027519982b19616e8f166e (patch) | |
tree | a614d9ac017bed033d14505fe47d938ae307c27a /net/mac80211 | |
parent | 75abde4d193fe300a2c1d3ee7f632eb777aa48b2 (diff) |
mac80211: Be more careful when changing channels.
If we cannot set the channel type, set the channel back to the
original.
Don't update the driver hardware if nothing actually changed.
Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/cfg.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 4bc8a9250cfd..88b0884ebe6a 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -1215,6 +1215,9 @@ static int ieee80211_set_channel(struct wiphy *wiphy, | |||
1215 | { | 1215 | { |
1216 | struct ieee80211_local *local = wiphy_priv(wiphy); | 1216 | struct ieee80211_local *local = wiphy_priv(wiphy); |
1217 | struct ieee80211_sub_if_data *sdata = NULL; | 1217 | struct ieee80211_sub_if_data *sdata = NULL; |
1218 | struct ieee80211_channel *old_oper; | ||
1219 | enum nl80211_channel_type old_oper_type; | ||
1220 | enum nl80211_channel_type old_vif_oper_type= NL80211_CHAN_NO_HT; | ||
1218 | 1221 | ||
1219 | if (netdev) | 1222 | if (netdev) |
1220 | sdata = IEEE80211_DEV_TO_SUB_IF(netdev); | 1223 | sdata = IEEE80211_DEV_TO_SUB_IF(netdev); |
@@ -1232,13 +1235,23 @@ static int ieee80211_set_channel(struct wiphy *wiphy, | |||
1232 | break; | 1235 | break; |
1233 | } | 1236 | } |
1234 | 1237 | ||
1235 | local->oper_channel = chan; | 1238 | if (sdata) |
1239 | old_vif_oper_type = sdata->vif.bss_conf.channel_type; | ||
1240 | old_oper_type = local->_oper_channel_type; | ||
1236 | 1241 | ||
1237 | if (!ieee80211_set_channel_type(local, sdata, channel_type)) | 1242 | if (!ieee80211_set_channel_type(local, sdata, channel_type)) |
1238 | return -EBUSY; | 1243 | return -EBUSY; |
1239 | 1244 | ||
1240 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); | 1245 | old_oper = local->oper_channel; |
1241 | if (sdata && sdata->vif.type != NL80211_IFTYPE_MONITOR) | 1246 | local->oper_channel = chan; |
1247 | |||
1248 | /* Update driver if changes were actually made. */ | ||
1249 | if ((old_oper != local->oper_channel) || | ||
1250 | (old_oper_type != local->_oper_channel_type)) | ||
1251 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); | ||
1252 | |||
1253 | if ((sdata && sdata->vif.type != NL80211_IFTYPE_MONITOR) && | ||
1254 | old_vif_oper_type != sdata->vif.bss_conf.channel_type) | ||
1242 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_HT); | 1255 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_HT); |
1243 | 1256 | ||
1244 | return 0; | 1257 | return 0; |