aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-11-08 12:31:02 -0500
committerJohannes Berg <johannes.berg@intel.com>2012-11-26 06:42:58 -0500
commit42d97a599eb6b2aab3a401b3e5799a399d6c7652 (patch)
tree1905b71c2092ad299503515dd0d59fa74573cd12 /net/mac80211
parent028e8da0723a6f6a00d9d1e3dae9ad448a28987e (diff)
cfg80211: remove remain-on-channel channel type
As mwifiex (and mac80211 in the software case) are the only drivers actually implementing remain-on-channel with channel type, userspace can't be relying on it. This is the case, as it's used only for P2P operations right now. Rather than adding a flag to tell userspace whether or not it can actually rely on it, simplify all the code by removing the ability to use different channel types. Leave only the validation of the attribute, so that if we extend it again later (with the needed capability flag), it can't break userspace sending invalid data. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/cfg.c27
-rw-r--r--net/mac80211/driver-ops.h5
-rw-r--r--net/mac80211/ieee80211_i.h2
-rw-r--r--net/mac80211/main.c2
-rw-r--r--net/mac80211/offchannel.c8
-rw-r--r--net/mac80211/trace.h6
6 files changed, 16 insertions, 34 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 18926aea480c..ac0241e3539b 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2236,7 +2236,6 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
2236static int ieee80211_start_roc_work(struct ieee80211_local *local, 2236static int ieee80211_start_roc_work(struct ieee80211_local *local,
2237 struct ieee80211_sub_if_data *sdata, 2237 struct ieee80211_sub_if_data *sdata,
2238 struct ieee80211_channel *channel, 2238 struct ieee80211_channel *channel,
2239 enum nl80211_channel_type channel_type,
2240 unsigned int duration, u64 *cookie, 2239 unsigned int duration, u64 *cookie,
2241 struct sk_buff *txskb) 2240 struct sk_buff *txskb)
2242{ 2241{
@@ -2254,7 +2253,6 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local,
2254 return -ENOMEM; 2253 return -ENOMEM;
2255 2254
2256 roc->chan = channel; 2255 roc->chan = channel;
2257 roc->chan_type = channel_type;
2258 roc->duration = duration; 2256 roc->duration = duration;
2259 roc->req_duration = duration; 2257 roc->req_duration = duration;
2260 roc->frame = txskb; 2258 roc->frame = txskb;
@@ -2287,8 +2285,7 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local,
2287 if (!duration) 2285 if (!duration)
2288 duration = 10; 2286 duration = 10;
2289 2287
2290 ret = drv_remain_on_channel(local, sdata, channel, channel_type, 2288 ret = drv_remain_on_channel(local, sdata, channel, duration);
2291 duration);
2292 if (ret) { 2289 if (ret) {
2293 kfree(roc); 2290 kfree(roc);
2294 return ret; 2291 return ret;
@@ -2299,8 +2296,7 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local,
2299 2296
2300 out_check_combine: 2297 out_check_combine:
2301 list_for_each_entry(tmp, &local->roc_list, list) { 2298 list_for_each_entry(tmp, &local->roc_list, list) {
2302 if (tmp->chan != channel || tmp->chan_type != channel_type || 2299 if (tmp->chan != channel || tmp->sdata != sdata)
2303 tmp->sdata != sdata)
2304 continue; 2300 continue;
2305 2301
2306 /* 2302 /*
@@ -2417,7 +2413,6 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local,
2417static int ieee80211_remain_on_channel(struct wiphy *wiphy, 2413static int ieee80211_remain_on_channel(struct wiphy *wiphy,
2418 struct wireless_dev *wdev, 2414 struct wireless_dev *wdev,
2419 struct ieee80211_channel *chan, 2415 struct ieee80211_channel *chan,
2420 enum nl80211_channel_type channel_type,
2421 unsigned int duration, 2416 unsigned int duration,
2422 u64 *cookie) 2417 u64 *cookie)
2423{ 2418{
@@ -2426,7 +2421,7 @@ static int ieee80211_remain_on_channel(struct wiphy *wiphy,
2426 int ret; 2421 int ret;
2427 2422
2428 mutex_lock(&local->mtx); 2423 mutex_lock(&local->mtx);
2429 ret = ieee80211_start_roc_work(local, sdata, chan, channel_type, 2424 ret = ieee80211_start_roc_work(local, sdata, chan,
2430 duration, cookie, NULL); 2425 duration, cookie, NULL);
2431 mutex_unlock(&local->mtx); 2426 mutex_unlock(&local->mtx);
2432 2427
@@ -2519,10 +2514,8 @@ static int ieee80211_cancel_remain_on_channel(struct wiphy *wiphy,
2519 2514
2520static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, 2515static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
2521 struct ieee80211_channel *chan, bool offchan, 2516 struct ieee80211_channel *chan, bool offchan,
2522 enum nl80211_channel_type channel_type, 2517 unsigned int wait, const u8 *buf, size_t len,
2523 bool channel_type_valid, unsigned int wait, 2518 bool no_cck, bool dont_wait_for_ack, u64 *cookie)
2524 const u8 *buf, size_t len, bool no_cck,
2525 bool dont_wait_for_ack, u64 *cookie)
2526{ 2519{
2527 struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); 2520 struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
2528 struct ieee80211_local *local = sdata->local; 2521 struct ieee80211_local *local = sdata->local;
@@ -2591,14 +2584,10 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
2591 rcu_read_lock(); 2584 rcu_read_lock();
2592 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 2585 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
2593 2586
2594 if (chanctx_conf) { 2587 if (chanctx_conf)
2595 need_offchan = chan != chanctx_conf->channel; 2588 need_offchan = chan != chanctx_conf->channel;
2596 if (channel_type_valid && 2589 else
2597 channel_type != chanctx_conf->channel_type)
2598 need_offchan = true;
2599 } else {
2600 need_offchan = true; 2590 need_offchan = true;
2601 }
2602 rcu_read_unlock(); 2591 rcu_read_unlock();
2603 } 2592 }
2604 2593
@@ -2633,7 +2622,7 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
2633 local->hw.offchannel_tx_hw_queue; 2622 local->hw.offchannel_tx_hw_queue;
2634 2623
2635 /* This will handle all kinds of coalescing and immediate TX */ 2624 /* This will handle all kinds of coalescing and immediate TX */
2636 ret = ieee80211_start_roc_work(local, sdata, chan, channel_type, 2625 ret = ieee80211_start_roc_work(local, sdata, chan,
2637 wait, cookie, skb); 2626 wait, cookie, skb);
2638 if (ret) 2627 if (ret)
2639 kfree_skb(skb); 2628 kfree_skb(skb);
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 68c27aaf5c93..c6560cc7a9d6 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -738,16 +738,15 @@ static inline int drv_get_antenna(struct ieee80211_local *local,
738static inline int drv_remain_on_channel(struct ieee80211_local *local, 738static inline int drv_remain_on_channel(struct ieee80211_local *local,
739 struct ieee80211_sub_if_data *sdata, 739 struct ieee80211_sub_if_data *sdata,
740 struct ieee80211_channel *chan, 740 struct ieee80211_channel *chan,
741 enum nl80211_channel_type chantype,
742 unsigned int duration) 741 unsigned int duration)
743{ 742{
744 int ret; 743 int ret;
745 744
746 might_sleep(); 745 might_sleep();
747 746
748 trace_drv_remain_on_channel(local, sdata, chan, chantype, duration); 747 trace_drv_remain_on_channel(local, sdata, chan, duration);
749 ret = local->ops->remain_on_channel(&local->hw, &sdata->vif, 748 ret = local->ops->remain_on_channel(&local->hw, &sdata->vif,
750 chan, chantype, duration); 749 chan, duration);
751 trace_drv_return_int(local, ret); 750 trace_drv_return_int(local, ret);
752 751
753 return ret; 752 return ret;
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index d5da0fe14318..fba4b1f425c1 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -348,7 +348,6 @@ struct ieee80211_roc_work {
348 struct ieee80211_sub_if_data *sdata; 348 struct ieee80211_sub_if_data *sdata;
349 349
350 struct ieee80211_channel *chan; 350 struct ieee80211_channel *chan;
351 enum nl80211_channel_type chan_type;
352 351
353 bool started, abort, hw_begun, notified; 352 bool started, abort, hw_begun, notified;
354 353
@@ -1048,7 +1047,6 @@ struct ieee80211_local {
1048 1047
1049 /* Temporary remain-on-channel for off-channel operations */ 1048 /* Temporary remain-on-channel for off-channel operations */
1050 struct ieee80211_channel *tmp_channel; 1049 struct ieee80211_channel *tmp_channel;
1051 enum nl80211_channel_type tmp_channel_type;
1052 1050
1053 /* channel contexts */ 1051 /* channel contexts */
1054 struct list_head chanctx_list; 1052 struct list_head chanctx_list;
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 70e87600cacc..b229cded4567 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -115,7 +115,7 @@ static u32 ieee80211_hw_conf_chan(struct ieee80211_local *local)
115 channel_type = NL80211_CHAN_NO_HT; 115 channel_type = NL80211_CHAN_NO_HT;
116 } else if (local->tmp_channel) { 116 } else if (local->tmp_channel) {
117 chan = local->tmp_channel; 117 chan = local->tmp_channel;
118 channel_type = local->tmp_channel_type; 118 channel_type = NL80211_CHAN_NO_HT;
119 } else { 119 } else {
120 chan = local->_oper_channel; 120 chan = local->_oper_channel;
121 channel_type = local->_oper_channel_type; 121 channel_type = local->_oper_channel_type;
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
index 7f8a36510813..5abddfe3e101 100644
--- a/net/mac80211/offchannel.c
+++ b/net/mac80211/offchannel.c
@@ -205,8 +205,8 @@ void ieee80211_handle_roc_started(struct ieee80211_roc_work *roc)
205 } 205 }
206 } else { 206 } else {
207 cfg80211_ready_on_channel(&roc->sdata->wdev, roc->cookie, 207 cfg80211_ready_on_channel(&roc->sdata->wdev, roc->cookie,
208 roc->chan, roc->chan_type, 208 roc->chan, roc->req_duration,
209 roc->req_duration, GFP_KERNEL); 209 GFP_KERNEL);
210 } 210 }
211 211
212 roc->notified = true; 212 roc->notified = true;
@@ -284,7 +284,6 @@ void ieee80211_start_next_roc(struct ieee80211_local *local)
284 duration = 10; 284 duration = 10;
285 285
286 ret = drv_remain_on_channel(local, roc->sdata, roc->chan, 286 ret = drv_remain_on_channel(local, roc->sdata, roc->chan,
287 roc->chan_type,
288 duration); 287 duration);
289 288
290 roc->started = true; 289 roc->started = true;
@@ -321,7 +320,7 @@ void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc)
321 if (!roc->mgmt_tx_cookie) 320 if (!roc->mgmt_tx_cookie)
322 cfg80211_remain_on_channel_expired(&roc->sdata->wdev, 321 cfg80211_remain_on_channel_expired(&roc->sdata->wdev,
323 roc->cookie, roc->chan, 322 roc->cookie, roc->chan,
324 roc->chan_type, GFP_KERNEL); 323 GFP_KERNEL);
325 324
326 list_for_each_entry_safe(dep, tmp, &roc->dependents, list) 325 list_for_each_entry_safe(dep, tmp, &roc->dependents, list)
327 ieee80211_roc_notify_destroy(dep); 326 ieee80211_roc_notify_destroy(dep);
@@ -359,7 +358,6 @@ void ieee80211_sw_roc_work(struct work_struct *work)
359 ieee80211_recalc_idle(local); 358 ieee80211_recalc_idle(local);
360 359
361 local->tmp_channel = roc->chan; 360 local->tmp_channel = roc->chan;
362 local->tmp_channel_type = roc->chan_type;
363 ieee80211_hw_config(local, 0); 361 ieee80211_hw_config(local, 0);
364 362
365 /* tell userspace or send frame */ 363 /* tell userspace or send frame */
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index e9579b7a2cd0..bc28346ba207 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -1022,15 +1022,14 @@ TRACE_EVENT(drv_remain_on_channel,
1022 TP_PROTO(struct ieee80211_local *local, 1022 TP_PROTO(struct ieee80211_local *local,
1023 struct ieee80211_sub_if_data *sdata, 1023 struct ieee80211_sub_if_data *sdata,
1024 struct ieee80211_channel *chan, 1024 struct ieee80211_channel *chan,
1025 enum nl80211_channel_type chantype, unsigned int duration), 1025 unsigned int duration),
1026 1026
1027 TP_ARGS(local, sdata, chan, chantype, duration), 1027 TP_ARGS(local, sdata, chan, duration),
1028 1028
1029 TP_STRUCT__entry( 1029 TP_STRUCT__entry(
1030 LOCAL_ENTRY 1030 LOCAL_ENTRY
1031 VIF_ENTRY 1031 VIF_ENTRY
1032 __field(int, center_freq) 1032 __field(int, center_freq)
1033 __field(int, channel_type)
1034 __field(unsigned int, duration) 1033 __field(unsigned int, duration)
1035 ), 1034 ),
1036 1035
@@ -1038,7 +1037,6 @@ TRACE_EVENT(drv_remain_on_channel,
1038 LOCAL_ASSIGN; 1037 LOCAL_ASSIGN;
1039 VIF_ASSIGN; 1038 VIF_ASSIGN;
1040 __entry->center_freq = chan->center_freq; 1039 __entry->center_freq = chan->center_freq;
1041 __entry->channel_type = chantype;
1042 __entry->duration = duration; 1040 __entry->duration = duration;
1043 ), 1041 ),
1044 1042