Skip to content

Commit 3a90ac2

Browse files
author
Patrick Pfeifer
committed
revert mac80211_offchannel_rework
$ wget "http://pkgs.fedoraproject.org/gitweb/?p=kernel.git;a=blob_plain;f=mac80211_offchannel_rework_revert.patch;h=859799714cd85a58450ecde4a1dabc5adffd5100;hb=refs/heads/f16" -O mac80211_offchannel_rework_revert.patch $ patch -p1 --dry-run < mac80211_offchannel_rework_revert.patch patching file net/mac80211/ieee80211_i.h Hunk #1 succeeded at 702 (offset 8 lines). Hunk #2 succeeded at 712 (offset 8 lines). Hunk #3 succeeded at 1143 (offset -57 lines). patching file net/mac80211/main.c patching file net/mac80211/offchannel.c Hunk #1 succeeded at 18 (offset 1 line). Hunk #2 succeeded at 42 (offset 1 line). Hunk #3 succeeded at 78 (offset 1 line). Hunk #4 succeeded at 96 (offset 1 line). Hunk #5 succeeded at 162 (offset 1 line). Hunk torvalds#6 succeeded at 182 (offset 1 line). patching file net/mac80211/rx.c Hunk #1 succeeded at 421 (offset 4 lines). Hunk #2 succeeded at 2864 (offset 87 lines). patching file net/mac80211/scan.c Hunk #1 succeeded at 213 (offset 1 line). Hunk #2 succeeded at 256 (offset 2 lines). Hunk #3 succeeded at 288 (offset 2 lines). Hunk #4 succeeded at 333 (offset 2 lines). Hunk #5 succeeded at 482 (offset 2 lines). Hunk torvalds#6 succeeded at 498 (offset 2 lines). Hunk torvalds#7 succeeded at 516 (offset 2 lines). Hunk torvalds#8 succeeded at 530 (offset 2 lines). Hunk torvalds#9 succeeded at 555 (offset 2 lines). patching file net/mac80211/tx.c Hunk #1 succeeded at 259 (offset 1 line). patching file net/mac80211/work.c Hunk #1 succeeded at 899 (offset -2 lines). Hunk #2 succeeded at 949 (offset -2 lines). Hunk #3 succeeded at 1046 (offset -2 lines). Hunk #4 succeeded at 1054 (offset -2 lines).
1 parent b0d1e3d commit 3a90ac2

File tree

7 files changed

+85
-221
lines changed

7 files changed

+85
-221
lines changed

net/mac80211/ieee80211_i.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,8 @@ struct tpt_led_trigger {
702702
* well be on the operating channel
703703
* @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to
704704
* determine if we are on the operating channel or not
705+
* @SCAN_OFF_CHANNEL: We're off our operating channel for scanning,
706+
* gets only set in conjunction with SCAN_SW_SCANNING
705707
* @SCAN_COMPLETED: Set for our scan work function when the driver reported
706708
* that the scan completed.
707709
* @SCAN_ABORTED: Set for our scan work function when the driver reported
@@ -710,6 +712,7 @@ struct tpt_led_trigger {
710712
enum {
711713
SCAN_SW_SCANNING,
712714
SCAN_HW_SCANNING,
715+
SCAN_OFF_CHANNEL,
713716
SCAN_COMPLETED,
714717
SCAN_ABORTED,
715718
};
@@ -1140,14 +1143,10 @@ int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata);
11401143
void ieee80211_sched_scan_stopped_work(struct work_struct *work);
11411144

11421145
/* off-channel helpers */
1143-
bool ieee80211_cfg_on_oper_channel(struct ieee80211_local *local);
1144-
void ieee80211_offchannel_enable_all_ps(struct ieee80211_local *local,
1145-
bool tell_ap);
1146-
void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local,
1147-
bool offchannel_ps_enable);
1146+
void ieee80211_offchannel_stop_beaconing(struct ieee80211_local *local);
1147+
void ieee80211_offchannel_stop_station(struct ieee80211_local *local);
11481148
void ieee80211_offchannel_return(struct ieee80211_local *local,
1149-
bool enable_beaconing,
1150-
bool offchannel_ps_disable);
1149+
bool enable_beaconing);
11511150
void ieee80211_hw_roc_setup(struct ieee80211_local *local);
11521151

11531152
/* interface handling */

net/mac80211/main.c

Lines changed: 6 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -92,47 +92,6 @@ static void ieee80211_reconfig_filter(struct work_struct *work)
9292
ieee80211_configure_filter(local);
9393
}
9494

95-
/*
96-
* Returns true if we are logically configured to be on
97-
* the operating channel AND the hardware-conf is currently
98-
* configured on the operating channel. Compares channel-type
99-
* as well.
100-
*/
101-
bool ieee80211_cfg_on_oper_channel(struct ieee80211_local *local)
102-
{
103-
struct ieee80211_channel *chan, *scan_chan;
104-
enum nl80211_channel_type channel_type;
105-
106-
/* This logic needs to match logic in ieee80211_hw_config */
107-
if (local->scan_channel) {
108-
chan = local->scan_channel;
109-
/* If scanning on oper channel, use whatever channel-type
110-
* is currently in use.
111-
*/
112-
if (chan == local->oper_channel)
113-
channel_type = local->_oper_channel_type;
114-
else
115-
channel_type = NL80211_CHAN_NO_HT;
116-
} else if (local->tmp_channel) {
117-
chan = scan_chan = local->tmp_channel;
118-
channel_type = local->tmp_channel_type;
119-
} else {
120-
chan = local->oper_channel;
121-
channel_type = local->_oper_channel_type;
122-
}
123-
124-
if (chan != local->oper_channel ||
125-
channel_type != local->_oper_channel_type)
126-
return false;
127-
128-
/* Check current hardware-config against oper_channel. */
129-
if ((local->oper_channel != local->hw.conf.channel) ||
130-
(local->_oper_channel_type != local->hw.conf.channel_type))
131-
return false;
132-
133-
return true;
134-
}
135-
13695
int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
13796
{
13897
struct ieee80211_channel *chan, *scan_chan;
@@ -145,9 +104,6 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
145104

146105
scan_chan = local->scan_channel;
147106

148-
/* If this off-channel logic ever changes, ieee80211_on_oper_channel
149-
* may need to change as well.
150-
*/
151107
offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
152108
if (scan_chan) {
153109
chan = scan_chan;
@@ -158,19 +114,17 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
158114
channel_type = local->_oper_channel_type;
159115
else
160116
channel_type = NL80211_CHAN_NO_HT;
161-
} else if (local->tmp_channel) {
117+
local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL;
118+
} else if (local->tmp_channel &&
119+
local->oper_channel != local->tmp_channel) {
162120
chan = scan_chan = local->tmp_channel;
163121
channel_type = local->tmp_channel_type;
122+
local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL;
164123
} else {
165124
chan = local->oper_channel;
166125
channel_type = local->_oper_channel_type;
167-
}
168-
169-
if (chan != local->oper_channel ||
170-
channel_type != local->_oper_channel_type)
171-
local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL;
172-
else
173126
local->hw.conf.flags &= ~IEEE80211_CONF_OFFCHANNEL;
127+
}
174128

175129
offchannel_flag ^= local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
176130

@@ -279,7 +233,7 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
279233

280234
if (changed & BSS_CHANGED_BEACON_ENABLED) {
281235
if (local->quiescing || !ieee80211_sdata_running(sdata) ||
282-
test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state)) {
236+
test_bit(SCAN_SW_SCANNING, &local->scanning)) {
283237
sdata->vif.bss_conf.enable_beacon = false;
284238
} else {
285239
/*

net/mac80211/offchannel.c

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,10 @@
1818
#include "driver-trace.h"
1919

2020
/*
21-
* Tell our hardware to disable PS.
22-
* Optionally inform AP that we will go to sleep so that it will buffer
23-
* the frames while we are doing off-channel work. This is optional
24-
* because we *may* be doing work on-operating channel, and want our
25-
* hardware unconditionally awake, but still let the AP send us normal frames.
21+
* inform AP that we will go to sleep so that it will buffer the frames
22+
* while we scan
2623
*/
27-
static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata,
28-
bool tell_ap)
24+
static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata)
2925
{
3026
struct ieee80211_local *local = sdata->local;
3127
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
@@ -46,8 +42,8 @@ static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata,
4642
ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
4743
}
4844

49-
if (tell_ap && (!local->offchannel_ps_enabled ||
50-
!(local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK)))
45+
if (!(local->offchannel_ps_enabled) ||
46+
!(local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK))
5147
/*
5248
* If power save was enabled, no need to send a nullfunc
5349
* frame because AP knows that we are sleeping. But if the
@@ -82,9 +78,6 @@ static void ieee80211_offchannel_ps_disable(struct ieee80211_sub_if_data *sdata)
8278
* we are sleeping, let's just enable power save mode in
8379
* hardware.
8480
*/
85-
/* TODO: Only set hardware if CONF_PS changed?
86-
* TODO: Should we set offchannel_ps_enabled to false?
87-
*/
8881
local->hw.conf.flags |= IEEE80211_CONF_PS;
8982
ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
9083
} else if (local->hw.conf.dynamic_ps_timeout > 0) {
@@ -103,61 +96,63 @@ static void ieee80211_offchannel_ps_disable(struct ieee80211_sub_if_data *sdata)
10396
ieee80211_sta_reset_conn_monitor(sdata);
10497
}
10598

106-
void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local,
107-
bool offchannel_ps_enable)
99+
void ieee80211_offchannel_stop_beaconing(struct ieee80211_local *local)
108100
{
109101
struct ieee80211_sub_if_data *sdata;
110102

111-
/*
112-
* notify the AP about us leaving the channel and stop all
113-
* STA interfaces.
114-
*/
115103
mutex_lock(&local->iflist_mtx);
116104
list_for_each_entry(sdata, &local->interfaces, list) {
117105
if (!ieee80211_sdata_running(sdata))
118106
continue;
119107

120-
if (sdata->vif.type != NL80211_IFTYPE_MONITOR)
121-
set_bit(SDATA_STATE_OFFCHANNEL, &sdata->state);
122-
123-
/* Check to see if we should disable beaconing. */
108+
/* disable beaconing */
124109
if (sdata->vif.type == NL80211_IFTYPE_AP ||
125110
sdata->vif.type == NL80211_IFTYPE_ADHOC ||
126111
sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
127112
ieee80211_bss_info_change_notify(
128113
sdata, BSS_CHANGED_BEACON_ENABLED);
129114

130-
if (sdata->vif.type != NL80211_IFTYPE_MONITOR) {
115+
/*
116+
* only handle non-STA interfaces here, STA interfaces
117+
* are handled in ieee80211_offchannel_stop_station(),
118+
* e.g., from the background scan state machine.
119+
*
120+
* In addition, do not stop monitor interface to allow it to be
121+
* used from user space controlled off-channel operations.
122+
*/
123+
if (sdata->vif.type != NL80211_IFTYPE_STATION &&
124+
sdata->vif.type != NL80211_IFTYPE_MONITOR) {
125+
set_bit(SDATA_STATE_OFFCHANNEL, &sdata->state);
131126
netif_tx_stop_all_queues(sdata->dev);
132-
if (offchannel_ps_enable &&
133-
(sdata->vif.type == NL80211_IFTYPE_STATION) &&
134-
sdata->u.mgd.associated)
135-
ieee80211_offchannel_ps_enable(sdata, true);
136127
}
137128
}
138129
mutex_unlock(&local->iflist_mtx);
139130
}
140131

141-
void ieee80211_offchannel_enable_all_ps(struct ieee80211_local *local,
142-
bool tell_ap)
132+
void ieee80211_offchannel_stop_station(struct ieee80211_local *local)
143133
{
144134
struct ieee80211_sub_if_data *sdata;
145135

136+
/*
137+
* notify the AP about us leaving the channel and stop all STA interfaces
138+
*/
146139
mutex_lock(&local->iflist_mtx);
147140
list_for_each_entry(sdata, &local->interfaces, list) {
148141
if (!ieee80211_sdata_running(sdata))
149142
continue;
150143

151-
if (sdata->vif.type == NL80211_IFTYPE_STATION &&
152-
sdata->u.mgd.associated)
153-
ieee80211_offchannel_ps_enable(sdata, tell_ap);
144+
if (sdata->vif.type == NL80211_IFTYPE_STATION) {
145+
set_bit(SDATA_STATE_OFFCHANNEL, &sdata->state);
146+
netif_tx_stop_all_queues(sdata->dev);
147+
if (sdata->u.mgd.associated)
148+
ieee80211_offchannel_ps_enable(sdata);
149+
}
154150
}
155151
mutex_unlock(&local->iflist_mtx);
156152
}
157153

158154
void ieee80211_offchannel_return(struct ieee80211_local *local,
159-
bool enable_beaconing,
160-
bool offchannel_ps_disable)
155+
bool enable_beaconing)
161156
{
162157
struct ieee80211_sub_if_data *sdata;
163158

@@ -167,8 +162,7 @@ void ieee80211_offchannel_return(struct ieee80211_local *local,
167162
continue;
168163

169164
/* Tell AP we're back */
170-
if (offchannel_ps_disable &&
171-
sdata->vif.type == NL80211_IFTYPE_STATION) {
165+
if (sdata->vif.type == NL80211_IFTYPE_STATION) {
172166
if (sdata->u.mgd.associated)
173167
ieee80211_offchannel_ps_disable(sdata);
174168
}
@@ -188,7 +182,7 @@ void ieee80211_offchannel_return(struct ieee80211_local *local,
188182
netif_tx_wake_all_queues(sdata->dev);
189183
}
190184

191-
/* Check to see if we should re-enable beaconing */
185+
/* re-enable beaconing */
192186
if (enable_beaconing &&
193187
(sdata->vif.type == NL80211_IFTYPE_AP ||
194188
sdata->vif.type == NL80211_IFTYPE_ADHOC ||

net/mac80211/rx.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,16 @@ ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx)
421421
return RX_CONTINUE;
422422

423423
if (test_bit(SCAN_HW_SCANNING, &local->scanning) ||
424-
test_bit(SCAN_SW_SCANNING, &local->scanning) ||
425424
local->sched_scanning)
426425
return ieee80211_scan_rx(rx->sdata, skb);
427426

427+
if (test_bit(SCAN_SW_SCANNING, &local->scanning)) {
428+
/* drop all the other packets during a software scan anyway */
429+
if (ieee80211_scan_rx(rx->sdata, skb) != RX_QUEUED)
430+
dev_kfree_skb(skb);
431+
return RX_QUEUED;
432+
}
433+
428434
/* scanning finished during invoking of handlers */
429435
I802_DEBUG_INC(local->rx_handlers_drop_passive_scan);
430436
return RX_DROP_UNUSABLE;
@@ -2858,7 +2864,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
28582864
local->dot11ReceivedFragmentCount++;
28592865

28602866
if (unlikely(test_bit(SCAN_HW_SCANNING, &local->scanning) ||
2861-
test_bit(SCAN_SW_SCANNING, &local->scanning)))
2867+
test_bit(SCAN_OFF_CHANNEL, &local->scanning)))
28622868
status->rx_flags |= IEEE80211_RX_IN_SCAN;
28632869

28642870
if (ieee80211_is_mgmt(fc))

0 commit comments

Comments
 (0)