implement background scan
Subsystems (2)
cover implement background scan
This patch series implements basic background scanning in mac80211 by interrupting the scan after each scanned channel to allow RX/TX.
I only tested the patches on current wireless-testing with iwlagn in sw-scan mode and it works fine already. Nevertheless, it would be great if somebody could test the patches on other hardware as well.
A scan now takes ~13s on my iwl4965 with a total of 31 channels (17 passive channels) while associated. Two possibilities for the future to reduce the time a scan takes:
- leave the operating channel as soon as RX and TX were idle for a small period of time (currently we just stay 250ms on the operating channel after each scanned channel).
- Scan multiple channels in a row if the qos latency allows us to do so.
Helmut
---
Helmut Schaa (7):
cfg80211: increase scan result expire time
mac80211: rename scan_state to next_scan_state
mac80211: implement basic background scanning
mac80211: Replace {sw,hw}_scanning variables with a bitfield
mac80211: introduce a new scan state "decision"
mac80211: advance the state machine immediately if no delay is needed
mac80211: refactor the scan code
net/mac80211/ibss.c | 2 net/mac80211/ieee80211_i.h | 41 ++++++ net/mac80211/iface.c | 4 - net/mac80211/main.c | 2 net/mac80211/mesh.c | 2 net/mac80211/mlme.c | 8 + net/mac80211/rx.c | 8 + net/mac80211/scan.c | 300 ++++++++++++++++++++++++++++++++------------ net/mac80211/tx.c | 6 - net/wireless/scan.c | 2 10 files changed, 275 insertions(+), 100 deletions(-)
Signature · 1 line
Signature
PATCH 1/7 mac80211: refactor the scan code
Move the processing of each scan state into its own functions for better readability. This patch does not introduce functional changes.
---
net/mac80211/scan.c | 136 +++++++++++++++++++++++++++++---------------------- 1 files changed, 78 insertions(+), 58 deletions(-)
net/mac80211/scan.c +78 -58
@@ -474,13 +474,87 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,return rc; } +static int ieee80211_scan_state_set_channel (struct ieee80211_local *local, +unsigned long *next_delay) +{ +int skip; +struct ieee80211_channel *chan; +struct ieee80211_sub_if_data *sdata = local->scan_sdata; + +/* if no more bands/channels left, complete scan */ +if (local->scan_channel_idx >= local->scan_req->n_channels) { +ieee80211_scan_completed (&local->hw, false); +return 1 ; + } + skip =0 ; + chan = local->scan_req->channels[local->scan_channel_idx]; + +if (chan->flags &IEEE80211_CHAN_DISABLED || + (sdata->vif.type ==NL80211_IFTYPE_ADHOC && + chan->flags &IEEE80211_CHAN_NO_IBSS )) + skip =1 ; + +if (!skip) { + local->scan_channel = chan; +if (ieee80211_hw_config (local, +IEEE80211_CONF_CHANGE_CHANNEL )) + skip =1 ; + } + +/* advance state machine to next channel/band */ + local->scan_channel_idx++; + +if (skip) +return 0 ; + +/* +* Probe delay is used to update the NAV, cf. 11.1.3.2.2 +* (which unfortunately doesn't say _why_ step a) is done, +* but it waits for the probe delay or until a frame is +* received - and the received frame would update the NAV). +* For now, we do not support waiting until a frame is +* received. +* +* In any case, it is not necessary for a passive scan. +*/ +if (chan->flags &IEEE80211_CHAN_PASSIVE_SCAN || + !local->scan_req->n_ssids) { + *next_delay =IEEE80211_PASSIVE_CHANNEL_TIME ; +return 0 ; + } + + *next_delay =IEEE80211_PROBE_DELAY ; + local->scan_state =SCAN_SEND_PROBE ; + +return 0 ; +} + +static void ieee80211_scan_state_send_probe (struct ieee80211_local *local, +unsigned long *next_delay) +{ +int i; +struct ieee80211_sub_if_data *sdata = local->scan_sdata; + +for (i =0 ; i < local->scan_req->n_ssids; i++) +ieee80211_send_probe_req ( + sdata,NULL , + local->scan_req->ssids[i].ssid, + local->scan_req->ssids[i].ssid_len, + local->scan_req->ie, local->scan_req->ie_len); + +/* +* After sending probe requests, wait for probe responses +* on the channel. +*/ + *next_delay =IEEE80211_CHANNEL_TIME ; + local->scan_state =SCAN_SET_CHANNEL ; +} +void ieee80211_scan_work (struct work_struct *work) {struct ieee80211_local *local = container_of(work, struct ieee80211_local, scan_work.work);struct ieee80211_sub_if_data *sdata = local->scan_sdata; -struct ieee80211_channel *chan; -int skip, i;unsigned long next_delay =0 ;mutex_lock (&local->scan_mtx);
@@ -515,65 +589,11 @@ void ieee80211_scan_work(struct work_struct *work)switch (local->scan_state) {case SCAN_SET_CHANNEL : -/* if no more bands/channels left, complete scan */ -if (local->scan_channel_idx >= local->scan_req->n_channels) { -ieee80211_scan_completed (&local->hw, false); +if (ieee80211_scan_state_set_channel (local, &next_delay))return ; - } - skip =0 ; - chan = local->scan_req->channels[local->scan_channel_idx]; - -if (chan->flags &IEEE80211_CHAN_DISABLED || - (sdata->vif.type ==NL80211_IFTYPE_ADHOC && - chan->flags &IEEE80211_CHAN_NO_IBSS )) - skip =1 ; - -if (!skip) { - local->scan_channel = chan; -if (ieee80211_hw_config (local, -IEEE80211_CONF_CHANGE_CHANNEL )) - skip =1 ; - } - -/* advance state machine to next channel/band */ - local->scan_channel_idx++; - -if (skip) -break ; - -/* -* Probe delay is used to update the NAV, cf. 11.1.3.2.2 -* (which unfortunately doesn't say _why_ step a) is done, -* but it waits for the probe delay or until a frame is -* received - and the received frame would update the NAV). -* For now, we do not support waiting until a frame is -* received. -* -* In any case, it is not necessary for a passive scan. -*/ -if (chan->flags &IEEE80211_CHAN_PASSIVE_SCAN || - !local->scan_req->n_ssids) { - next_delay =IEEE80211_PASSIVE_CHANNEL_TIME ; -break ; - } - - next_delay =IEEE80211_PROBE_DELAY ; - local->scan_state =SCAN_SEND_PROBE ;break ;case SCAN_SEND_PROBE : -for (i =0 ; i < local->scan_req->n_ssids; i++) -ieee80211_send_probe_req ( - sdata,NULL , - local->scan_req->ssids[i].ssid, - local->scan_req->ssids[i].ssid_len, - local->scan_req->ie, local->scan_req->ie_len); - -/* -* After sending probe requests, wait for probe responses -* on the channel. -*/ - next_delay =IEEE80211_CHANNEL_TIME ; - local->scan_state =SCAN_SET_CHANNEL ; +ieee80211_scan_state_send_probe (local, &next_delay);break ; }
Re: [PATCH 1/7] mac80211: refactor the scan code
Quoted 4 lines · Helmut Schaa
Move the processing of each scan state into its own functions for better readability. This patch does not introduce functional changes.
Signed-off-by Helmut Schaa <[email protected]>
Quoted 169 lines
---
net/mac80211/scan.c | 136 +++++++++++++++++++++++++++++---------------------- 1 files changed, 78 insertions(+), 58 deletions(-)net/mac80211/scan.c +78
-58@@ -474,13 +474,87 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,return rc; } +static int ieee80211_scan_state_set_channel (struct ieee80211_local *local, +unsigned long *next_delay) +{ +int skip; +struct ieee80211_channel *chan; +struct ieee80211_sub_if_data *sdata = local->scan_sdata; + +/* if no more bands/channels left, complete scan */ +if (local->scan_channel_idx >= local->scan_req->n_channels) { +ieee80211_scan_completed (&local->hw, false); +return 1 ; + } + skip =0 ; + chan = local->scan_req->channels[local->scan_channel_idx]; + +if (chan->flags &IEEE80211_CHAN_DISABLED || + (sdata->vif.type ==NL80211_IFTYPE_ADHOC && + chan->flags &IEEE80211_CHAN_NO_IBSS )) + skip =1 ; + +if (!skip) { + local->scan_channel = chan; +if (ieee80211_hw_config (local, +IEEE80211_CONF_CHANGE_CHANNEL )) + skip =1 ; + } + +/* advance state machine to next channel/band */ + local->scan_channel_idx++; + +if (skip) +return 0 ; + +/* +* Probe delay is used to update the NAV, cf. 11.1.3.2.2 +* (which unfortunately doesn't say _why_ step a) is done, +* but it waits for the probe delay or until a frame is +* received - and the received frame would update the NAV). +* For now, we do not support waiting until a frame is +* received. +* +* In any case, it is not necessary for a passive scan. +*/ +if (chan->flags &IEEE80211_CHAN_PASSIVE_SCAN || + !local->scan_req->n_ssids) { + *next_delay =IEEE80211_PASSIVE_CHANNEL_TIME ; +return 0 ; + } + + *next_delay =IEEE80211_PROBE_DELAY ; + local->scan_state =SCAN_SEND_PROBE ; + +return 0 ; +} + +static void ieee80211_scan_state_send_probe (struct ieee80211_local *local, +unsigned long *next_delay) +{ +int i; +struct ieee80211_sub_if_data *sdata = local->scan_sdata; + +for (i =0 ; i < local->scan_req->n_ssids; i++) +ieee80211_send_probe_req ( + sdata,NULL , + local->scan_req->ssids[i].ssid, + local->scan_req->ssids[i].ssid_len, + local->scan_req->ie, local->scan_req->ie_len); + +/* +* After sending probe requests, wait for probe responses +* on the channel. +*/ + *next_delay =IEEE80211_CHANNEL_TIME ; + local->scan_state =SCAN_SET_CHANNEL ; +} +void ieee80211_scan_work (struct work_struct *work) {struct ieee80211_local *local = container_of(work, struct ieee80211_local, scan_work.work);struct ieee80211_sub_if_data *sdata = local->scan_sdata; -struct ieee80211_channel *chan; -int skip, i;unsigned long next_delay =0 ;mutex_lock (&local->scan_mtx);@@ -515,65 +589,11 @@ void ieee80211_scan_work(struct work_struct *work)switch (local->scan_state) {case SCAN_SET_CHANNEL : -/* if no more bands/channels left, complete scan */ -if (local->scan_channel_idx >= local->scan_req->n_channels) { -ieee80211_scan_completed (&local->hw, false); +if (ieee80211_scan_state_set_channel (local, &next_delay))return ; - } - skip =0 ; - chan = local->scan_req->channels[local->scan_channel_idx]; - -if (chan->flags &IEEE80211_CHAN_DISABLED || - (sdata->vif.type ==NL80211_IFTYPE_ADHOC && - chan->flags &IEEE80211_CHAN_NO_IBSS )) - skip =1 ; - -if (!skip) { - local->scan_channel = chan; -if (ieee80211_hw_config (local, -IEEE80211_CONF_CHANGE_CHANNEL )) - skip =1 ; - } - -/* advance state machine to next channel/band */ - local->scan_channel_idx++; - -if (skip) -break ; - -/* -* Probe delay is used to update the NAV, cf. 11.1.3.2.2 -* (which unfortunately doesn't say _why_ step a) is done, -* but it waits for the probe delay or until a frame is -* received - and the received frame would update the NAV). -* For now, we do not support waiting until a frame is -* received. -* -* In any case, it is not necessary for a passive scan. -*/ -if (chan->flags &IEEE80211_CHAN_PASSIVE_SCAN || - !local->scan_req->n_ssids) { - next_delay =IEEE80211_PASSIVE_CHANNEL_TIME ; -break ; - } - - next_delay =IEEE80211_PROBE_DELAY ; - local->scan_state =SCAN_SEND_PROBE ;break ;case SCAN_SEND_PROBE : -for (i =0 ; i < local->scan_req->n_ssids; i++) -ieee80211_send_probe_req ( - sdata,NULL , - local->scan_req->ssids[i].ssid, - local->scan_req->ssids[i].ssid_len, - local->scan_req->ie, local->scan_req->ie_len); - -/* -* After sending probe requests, wait for probe responses -* on the channel. -*/ - next_delay =IEEE80211_CHANNEL_TIME ; - local->scan_state =SCAN_SET_CHANNEL ; +ieee80211_scan_state_send_probe (local, &next_delay);break ; }
PATCH 2/7 mac80211: advance the state machine immediately if no delay is needed
In reply to Helmut SchaaInstead of queueing the scan work again without delay just process the next state immediately.
---
net/mac80211/scan.c | 24 +++++++++++++++--------- 1 files changed, 15 insertions(+), 9 deletions(-)
net/mac80211/scan.c +15 -9
@@ -587,15 +587,21 @@ void ieee80211_scan_work(struct work_struct *work)return ; } -switch (local->scan_state) { -case SCAN_SET_CHANNEL : -if (ieee80211_scan_state_set_channel (local, &next_delay)) -return ; -break ; -case SCAN_SEND_PROBE : -ieee80211_scan_state_send_probe (local, &next_delay); -break ; - } +/* +* as long as no delay is required advance immediately +* without scheduling a new work +*/ +do { +switch (local->scan_state) { +case SCAN_SET_CHANNEL : +if (ieee80211_scan_state_set_channel (local, &next_delay)) +return ; +break ; +case SCAN_SEND_PROBE : +ieee80211_scan_state_send_probe (local, &next_delay); +break ; + } + }while (next_delay ==0 );queue_delayed_work (local->hw.workqueue, &local->scan_work, next_delay);
Re: [PATCH 2/7] mac80211: advance the state machine immediately if no delay is needed
Quoted 4 lines · Helmut Schaa
Instead of queueing the scan work again without delay just process the next state immediately.
Signed-off-by Helmut Schaa <[email protected]>
Quoted 42 lines
---
net/mac80211/scan.c | 24 +++++++++++++++--------- 1 files changed, 15 insertions(+), 9 deletions(-)net/mac80211/scan.c +15
-9@@ -587,15 +587,21 @@ void ieee80211_scan_work(struct work_struct *work)return ; } -switch (local->scan_state) { -case SCAN_SET_CHANNEL : -if (ieee80211_scan_state_set_channel (local, &next_delay)) -return ; -break ; -case SCAN_SEND_PROBE : -ieee80211_scan_state_send_probe (local, &next_delay); -break ; - } +/* +* as long as no delay is required advance immediately +* without scheduling a new work +*/ +do { +switch (local->scan_state) { +case SCAN_SET_CHANNEL : +if (ieee80211_scan_state_set_channel (local, &next_delay)) +return ; +break ; +case SCAN_SEND_PROBE : +ieee80211_scan_state_send_probe (local, &next_delay); +break ; + } + }while (next_delay ==0 );queue_delayed_work (local->hw.workqueue, &local->scan_work, next_delay);
PATCH 3/7 mac80211: introduce a new scan state "decision"
In reply to Helmut SchaaIntroduce a new scan state "decision" which is entered after every completed scan operation and decides about the next steps. At first the decision is in any case to scan the next channel. This shouldn't introduce any functional changes.
---
net/mac80211/ieee80211_i.h | 2 +- net/mac80211/scan.c | 40 ++++++++++++++++++++++++++-------------- 2 files changed, 27 insertions(+), 15 deletions(-)
net/mac80211/ieee80211_i.h +1 -1
@@ -678,7 +678,7 @@ struct ieee80211_local {int scan_channel_idx;int scan_ies_len; -enum {SCAN_SET_CHANNEL ,SCAN_SEND_PROBE } scan_state; +enum {SCAN_DECISION ,SCAN_SET_CHANNEL ,SCAN_SEND_PROBE } scan_state;struct delayed_work scan_work;struct ieee80211_sub_if_data *scan_sdata;enum nl80211_channel_type oper_channel_type;
net/mac80211/scan.c +26 -14
@@ -376,7 +376,7 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local) }mutex_unlock (&local->iflist_mtx); - local->scan_state =SCAN_SET_CHANNEL ; + local->scan_state =SCAN_DECISION ; local->scan_channel_idx =0 ;spin_lock_bh (&local->filter_lock);
@@ -474,18 +474,27 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,return rc; } -static int ieee80211_scan_state_set_channel (struct ieee80211_local *local, -unsigned long *next_delay) +static int ieee80211_scan_state_decision (struct ieee80211_local *local, +unsigned long *next_delay) { -int skip; -struct ieee80211_channel *chan; -struct ieee80211_sub_if_data *sdata = local->scan_sdata; -/* if no more bands/channels left, complete scan */ if (local->scan_channel_idx >= local->scan_req->n_channels) {ieee80211_scan_completed (&local->hw, false);return 1 ; } + + *next_delay =0 ; + local->scan_state =SCAN_SET_CHANNEL ; +return 0 ; +} + +static void ieee80211_scan_state_set_channel (struct ieee80211_local *local, +unsigned long *next_delay) +{ +int skip; +struct ieee80211_channel *chan; +struct ieee80211_sub_if_data *sdata = local->scan_sdata; + skip =0 ; chan = local->scan_req->channels[local->scan_channel_idx];
@@ -505,7 +514,7 @@ static int ieee80211_scan_state_set_channel(struct ieee80211_local *local, local->scan_channel_idx++;if (skip) -return 0 ; +return ;/* * Probe delay is used to update the NAV, cf. 11.1.3.2.2
@@ -520,13 +529,13 @@ static int ieee80211_scan_state_set_channel(struct ieee80211_local *local,if (chan->flags &IEEE80211_CHAN_PASSIVE_SCAN || !local->scan_req->n_ssids) { *next_delay =IEEE80211_PASSIVE_CHANNEL_TIME ; -return 0 ; + local->scan_state =SCAN_DECISION ; +return ; } +/* active scan, send probes */ *next_delay =IEEE80211_PROBE_DELAY ; local->scan_state =SCAN_SEND_PROBE ; - -return 0 ; } static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,
@@ -547,7 +556,7 @@ static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,* on the channel. */ *next_delay =IEEE80211_CHANNEL_TIME ; - local->scan_state =SCAN_SET_CHANNEL ; + local->scan_state =SCAN_DECISION ; }void ieee80211_scan_work (struct work_struct *work)
@@ -593,10 +602,13 @@ void ieee80211_scan_work(struct work_struct *work)*/ do { switch (local->scan_state) { - case SCAN_SET_CHANNEL: - if (ieee80211_scan_state_set_channel(local, &next_delay)) + case SCAN_DECISION: + if (ieee80211_scan_state_decision(local, &next_delay)) return; break; + case SCAN_SET_CHANNEL: + ieee80211_scan_state_set_channel(local, &next_delay); + break; case SCAN_SEND_PROBE: ieee80211_scan_state_send_probe(local, &next_delay); break;
Re: [PATCH 3/7] mac80211: introduce a new scan state "decision"
Quoted 6 lines · Helmut Schaa
Introduce a new scan state "decision" which is entered after every completed scan operation and decides about the next steps. At first the decision is in any case to scan the next channel. This shouldn't introduce any functional changes.
Signed-off-by Helmut Schaa <[email protected]>
Quoted 119 lines
---
net/mac80211/ieee80211_i.h | 2 +- net/mac80211/scan.c | 40 ++++++++++++++++++++++++++-------------- 2 files changed, 27 insertions(+), 15 deletions(-)net/mac80211/ieee80211_i.h +1
-1@@ -678,7 +678,7 @@ struct ieee80211_local {int scan_channel_idx;int scan_ies_len; -enum {SCAN_SET_CHANNEL ,SCAN_SEND_PROBE } scan_state; +enum {SCAN_DECISION ,SCAN_SET_CHANNEL ,SCAN_SEND_PROBE } scan_state;struct delayed_work scan_work;struct ieee80211_sub_if_data *scan_sdata;enum nl80211_channel_type oper_channel_type;net/mac80211/scan.c +26
-14@@ -376,7 +376,7 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local) }mutex_unlock (&local->iflist_mtx); - local->scan_state =SCAN_SET_CHANNEL ; + local->scan_state =SCAN_DECISION ; local->scan_channel_idx =0 ;spin_lock_bh (&local->filter_lock);@@ -474,18 +474,27 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,return rc; } -static int ieee80211_scan_state_set_channel (struct ieee80211_local *local, -unsigned long *next_delay) +static int ieee80211_scan_state_decision (struct ieee80211_local *local, +unsigned long *next_delay) { -int skip; -struct ieee80211_channel *chan; -struct ieee80211_sub_if_data *sdata = local->scan_sdata; -/* if no more bands/channels left, complete scan */ if (local->scan_channel_idx >= local->scan_req->n_channels) {ieee80211_scan_completed (&local->hw, false);return 1 ; } + + *next_delay =0 ; + local->scan_state =SCAN_SET_CHANNEL ; +return 0 ; +} + +static void ieee80211_scan_state_set_channel (struct ieee80211_local *local, +unsigned long *next_delay) +{ +int skip; +struct ieee80211_channel *chan; +struct ieee80211_sub_if_data *sdata = local->scan_sdata; + skip =0 ; chan = local->scan_req->channels[local->scan_channel_idx];@@ -505,7 +514,7 @@ static int ieee80211_scan_state_set_channel(struct ieee80211_local *local, local->scan_channel_idx++;if (skip) -return 0 ; +return ;/* * Probe delay is used to update the NAV, cf. 11.1.3.2.2 @@ -520,13 +529,13 @@ static int ieee80211_scan_state_set_channel(struct ieee80211_local *local,if (chan->flags &IEEE80211_CHAN_PASSIVE_SCAN || !local->scan_req->n_ssids) { *next_delay =IEEE80211_PASSIVE_CHANNEL_TIME ; -return 0 ; + local->scan_state =SCAN_DECISION ; +return ; } +/* active scan, send probes */ *next_delay =IEEE80211_PROBE_DELAY ; local->scan_state =SCAN_SEND_PROBE ; - -return 0 ; } static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,@@ -547,7 +556,7 @@ static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,* on the channel. */ *next_delay =IEEE80211_CHANNEL_TIME ; - local->scan_state =SCAN_SET_CHANNEL ; + local->scan_state =SCAN_DECISION ; }void ieee80211_scan_work (struct work_struct *work)@@ -593,10 +602,13 @@ void ieee80211_scan_work(struct work_struct *work)*/ do { switch (local->scan_state) { - case SCAN_SET_CHANNEL: - if (ieee80211_scan_state_set_channel(local, &next_delay)) + case SCAN_DECISION: + if (ieee80211_scan_state_decision(local, &next_delay)) return; break; + case SCAN_SET_CHANNEL: + ieee80211_scan_state_set_channel(local, &next_delay); + break; case SCAN_SEND_PROBE: ieee80211_scan_state_send_probe(local, &next_delay); break;
PATCH 4/7 mac80211: Replace {sw, hw}_scanning variables with a bitfield
In reply to Helmut SchaaUse a bitfield to store the current scan mode instead of two boolean variables {sw,hw}_scanning. This patch does not introduce functional changes but allows us to enhance the scan flags later (for example for background scanning).
---
net/mac80211/ibss.c | 2 +- net/mac80211/ieee80211_i.h | 7 ++++++- net/mac80211/iface.c | 4 ++-- net/mac80211/main.c | 2 +- net/mac80211/mesh.c | 2 +- net/mac80211/mlme.c | 8 ++++---- net/mac80211/rx.c | 6 +++--- net/mac80211/scan.c | 23 ++++++++++------------- net/mac80211/tx.c | 6 +++--- 9 files changed, 31 insertions(+), 29 deletions(-)
net/mac80211/ibss.c +1 -1
@@ -742,7 +742,7 @@ static void ieee80211_ibss_work(struct work_struct *work)if (!netif_running (sdata->dev))return ; -if (local->sw_scanning || local->hw_scanning) +if (local->scanning)return ;if (WARN_ON (sdata->vif.type !=NL80211_IFTYPE_ADHOC ))
net/mac80211/ieee80211_i.h +6 -1
@@ -570,6 +570,11 @@ enum queue_stop_reason { IEEE80211_QUEUE_STOP_REASON_SKB_ADD, }; +enum { +SCAN_SW_SCANNING , +SCAN_HW_SCANNING +}; +struct ieee80211_local {/* embed the driver visible part. * don't cast (use the static inlines below), but we keep
@@ -668,7 +673,7 @@ struct ieee80211_local {/* Scanning and BSS list */ struct mutex scan_mtx; -bool sw_scanning, hw_scanning; +unsigned long scanning;struct cfg80211_ssid scan_ssid;struct cfg80211_scan_request int_scan_req;struct cfg80211_scan_request *scan_req;
net/mac80211/iface.c +2 -2
@@ -515,7 +515,7 @@ static int ieee80211_stop(struct net_device *dev)* the scan_sdata is NULL already don't send out a * scan event to userspace -- the scan is incomplete. */ -if (local->sw_scanning) +if (test_bit (SCAN_SW_SCANNING , &local->scanning))ieee80211_scan_completed (&local->hw, true); }
@@ -905,7 +905,7 @@ u32 __ieee80211_recalc_idle(struct ieee80211_local *local)struct ieee80211_sub_if_data *sdata;int count =0 ; -if (local->hw_scanning || local->sw_scanning) +if (local->scanning)return ieee80211_idle_off (local,"scanning" );list_for_each_entry (sdata, &local->interfaces, list) {
net/mac80211/main.c +1 -1
@@ -198,7 +198,7 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, }if (changed &BSS_CHANGED_BEACON_ENABLED ) { -if (local->sw_scanning) { +if (test_bit (SCAN_SW_SCANNING , &local->scanning)) { sdata->vif.bss_conf.enable_beacon = false; }else {/*
net/mac80211/mesh.c +1 -1
@@ -597,7 +597,7 @@ static void ieee80211_mesh_work(struct work_struct *work)if (!netif_running (sdata->dev))return ; -if (local->sw_scanning || local->hw_scanning) +if (local->scanning)return ;while ((skb =skb_dequeue (&ifmsh->skb_queue)))
net/mac80211/mlme.c +4 -4
@@ -581,7 +581,7 @@ void ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,if (!ifmgd->associated)return ; -if (sdata->local->sw_scanning || sdata->local->hw_scanning) +if (sdata->local->scanning)return ;/* Disregard subsequent beacons if we are already running a timer
@@ -639,7 +639,7 @@ static void ieee80211_enable_ps(struct ieee80211_local *local,* If we are scanning right now then the parameters will * take effect when scan finishes. */ -if (local->hw_scanning || local->sw_scanning) +if (local->scanning)return ; if (conf->dynamic_ps_timeout > 0 &&
@@ -2038,7 +2038,7 @@ static void ieee80211_sta_work(struct work_struct *work)if (!netif_running (sdata->dev))return ; -if (local->sw_scanning || local->hw_scanning) +if (local->scanning)return ;if (WARN_ON (sdata->vif.type !=NL80211_IFTYPE_STATION ))
@@ -2213,7 +2213,7 @@ static void ieee80211_sta_monitor_work(struct work_struct *work) container_of(work, struct ieee80211_sub_if_data, u.mgd.monitor_work); -if (sdata->local->sw_scanning || sdata->local->hw_scanning) +if (sdata->local->scanning)return ;ieee80211_mgd_probe_ap (sdata, false);
net/mac80211/rx.c +3 -3
@@ -418,10 +418,10 @@ ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx)struct ieee80211_local *local = rx->local;struct sk_buff *skb = rx->skb; -if (unlikely (local->hw_scanning)) +if (unlikely (test_bit (SCAN_HW_SCANNING , &local->scanning)))return ieee80211_scan_rx (rx->sdata, skb); -if (unlikely (local->sw_scanning)) { +if (unlikely (test_bit (SCAN_SW_SCANNING , &local->scanning))) {/* drop all the other packets during a software scan anyway */ if (ieee80211_scan_rx (rx->sdata, skb) !=RX_QUEUED )dev_kfree_skb (skb);
@@ -2136,7 +2136,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,return ; } -if (unlikely (local->sw_scanning || local->hw_scanning)) +if (unlikely (local->scanning)) rx.flags |=IEEE80211_RX_IN_SCAN ;ieee80211_parse_qos (&rx);
net/mac80211/scan.c +10 -13
@@ -265,7 +265,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)mutex_lock (&local->scan_mtx); -if (WARN_ON (!local->hw_scanning && !local->sw_scanning)) { +if (WARN_ON (!local->scanning)) {mutex_unlock (&local->scan_mtx);return ; }
@@ -275,16 +275,15 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)return ; } -if (local->hw_scanning) +if (test_bit (SCAN_HW_SCANNING , &local->scanning))ieee80211_restore_scan_ies (local);if (local->scan_req != &local->int_scan_req)cfg80211_scan_done (local->scan_req, aborted); local->scan_req =NULL ; - was_hw_scan = local->hw_scanning; - local->hw_scanning = false; - local->sw_scanning = false; + was_hw_scan =test_bit (SCAN_HW_SCANNING , &local->scanning); + local->scanning =0 ; local->scan_channel =NULL ;/* we only have to protect scan_req and hw/sw scan */
@@ -434,9 +433,9 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata, }if (local->ops->hw_scan) - local->hw_scanning = true; +__set_bit (SCAN_HW_SCANNING , &local->scanning);else - local->sw_scanning = true; +__set_bit (SCAN_SW_SCANNING , &local->scanning);/* * Kicking off the scan need not be protected, * only the scan variable stuff, since now
@@ -459,11 +458,9 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,mutex_lock (&local->scan_mtx);if (rc) { -if (local->ops->hw_scan) { - local->hw_scanning = false; +if (local->ops->hw_scan)ieee80211_restore_scan_ies (local); - }else - local->sw_scanning = false; + local->scanning =0 ;ieee80211_recalc_idle (local);
@@ -572,7 +569,7 @@ void ieee80211_scan_work(struct work_struct *work)return ; } -if (local->scan_req && !(local->sw_scanning || local->hw_scanning)) { +if (local->scan_req && !local->scanning) {struct cfg80211_scan_request *req = local->scan_req;int rc;
@@ -663,7 +660,7 @@ void ieee80211_scan_cancel(struct ieee80211_local *local)* queued -- mostly at suspend under RTNL. */ mutex_lock (&local->scan_mtx); - swscan = local->sw_scanning; + swscan =test_bit (SCAN_SW_SCANNING , &local->scanning);mutex_unlock (&local->scan_mtx);if (swscan)
net/mac80211/tx.c +3 -3
@@ -192,7 +192,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)if (unlikely (info->flags &IEEE80211_TX_CTL_INJECTED ))return TX_CONTINUE ; -if (unlikely (tx->local->sw_scanning) && +if (unlikely (test_bit (SCAN_SW_SCANNING , &tx->local->scanning)) && !ieee80211_is_probe_req (hdr->frame_control) && !ieee80211_is_nullfunc (hdr->frame_control))/*
@@ -551,7 +551,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)* Lets not bother rate control if we're associated and cannot * talk to the sta. This should not happen. */ - if (WARN((tx->local->sw_scanning) && + if (WARN(test_bit(SCAN_SW_SCANNING, &tx->local->scanning) && (sta_flags & WLAN_STA_ASSOC) && !rate_usable_index_exists(sband, &tx->sta->sta), "%s: Dropped data frame as no usable bitrate found while "
@@ -1396,7 +1396,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,if ((local->hw.flags &IEEE80211_HW_PS_NULLFUNC_STACK ) && local->hw.conf.dynamic_ps_timeout >0 && - !local->sw_scanning && !local->hw_scanning && local->ps_sdata) { + !(local->scanning) && local->ps_sdata) {if (local->hw.conf.flags &IEEE80211_CONF_PS ) {ieee80211_stop_queues_by_reason (&local->hw,IEEE80211_QUEUE_STOP_REASON_PS );
Johannes Berg
maintainerRe: [PATCH 4/7] mac80211: Replace {sw, hw}_scanning variables with a bitfield
net/mac80211/iface.c static int ieee80211_stop(struct net_device *dev) · line 518
Quoted 6 lines · Helmut Schaa
Use a bitfield to store the current scan mode instead of two boolean variables {sw,hw}_scanning. This patch does not introduce functional changes but allows us to enhance the scan flags later (for example for background scanning).
net/mac80211/iface.c +1
-0+if (test_bit (SCAN_SW_SCANNING , &local->scanning))
Do we actually need atomic bitops?
johannes
Re: [PATCH 4/7] mac80211: Replace {sw, hw}_scanning variables with a bitfield
Am Donnerstag, 23. Juli 2009 schrieb Johannes Berg:
Quoted 9 lines · Helmut Schaa
net/mac80211/iface.c static int ieee80211_stop(struct net_device *dev) · line 518
Quoted 6 lines
Use a bitfield to store the current scan mode instead of two boolean variables {sw,hw}_scanning. This patch does not introduce functional changes but allows us to enhance the scan flags later (for example for background scanning).
net/mac80211/iface.c +1
-0+if (test_bit (SCAN_SW_SCANNING , &local->scanning))Do we actually need atomic bitops?
No (at least not yet). That's why I used __set_bit. test_bit seems to not have a non-atomic equivalent. Or did you mean not to use *_bit functions at all?
Helmut
Johannes Berg
maintainerRe: [PATCH 4/7] mac80211: Replace {sw, hw}_scanning variables with a bitfield
Quoted 7 lines · Helmut Schaa
Am Donnerstag, 23. Juli 2009 schrieb Johannes Berg:
Quoted 6 lines · Helmut Schaa
Quoted 4 lines
Use a bitfield to store the current scan mode instead of two boolean variables {sw,hw}_scanning. This patch does not introduce functional changes but allows us to enhance the scan flags later (for example for background scanning).
Quoted 7 lines
Quoted 3 lines
net/mac80211/iface.c static int ieee80211_stop(struct net_device *dev) · line 518
Quoted 1 line
net/mac80211/iface.c +1
-0+if (test_bit (SCAN_SW_SCANNING , &local->scanning))Do we actually need atomic bitops?
No (at least not yet). That's why I used
__set_bit.test_bitseems to not have a non-atomic equivalent. Or did you mean not to use*_bitfunctions at all?
Sorry, you're right, I got confused.
johannes
PATCH 5/7 mac80211: implement basic background scanning
In reply to Helmut SchaaIntroduce a new scan flag "SCAN_BG_SCANNING" which basically tells us that we are currently scanning but may as well be on the operating channel to RX/TX data whereas "SCAN_SW_SCANNING" tells us that we are currently on a different channel for scanning. While "SCAN_BG_SCANNING" is set during the whole scan "SCAN_SW_SCANNING" is set when leaving the operating channel and unset when coming back.
Introduce two new scan states "SCAN_LEAVE_OPER_CHANNEL" and "SCAN_ENTER_OPER_CHANNEL" which basically implement the functionality we need to leave the operating channel (send a nullfunc to the AP and stop the queues) and enter it again (send a nullfunc to the AP and start the queues again).
Enhance the scan state "SCAN_DECISION" to switch back to the operating channel after each scanned channel. In the future it sould be simple to enhance the decision state to scan as much channels in a row as the qos latency allows us.
---
net/mac80211/ieee80211_i.h | 36 +++++++++++++- net/mac80211/rx.c | 6 ++ net/mac80211/scan.c | 117 +++++++++++++++++++++++++++++++++++++++++--- net/mac80211/tx.c | 2 - 4 files changed, 148 insertions(+), 13 deletions(-)
net/mac80211/ieee80211_i.h +34 -2
@@ -570,9 +570,41 @@ enum queue_stop_reason { IEEE80211_QUEUE_STOP_REASON_SKB_ADD, }; +/** +* mac80211 scan flags - currently active scan mode +* +* @SCAN_SW_SCANNING: We're currently in the process of scanning but may as +* well be on the operating channel +* @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to +* determine if we are on the operating channel or not +* @SCAN_OFF_CHANNEL: We're off our operating channel for scanning, +* gets only set in conjunction with SCAN_SW_SCANNING +*/ enum {SCAN_SW_SCANNING , -SCAN_HW_SCANNING +SCAN_HW_SCANNING , +SCAN_OFF_CHANNEL , +}; + +/** +* enum mac80211_scan_state - scan state machine states +* +* @SCAN_DECISION: Main entry point to the scan state machine, this state +* determines if we should keep on scanning or switch back to the +* operating channel +* @SCAN_SET_CHANNEL: Set the next channel to be scanned +* @SCAN_SEND_PROBE: Send probe requests and wait for probe responses +* @SCAN_LEAVE_OPER_CHANNEL: Leave the operating channel, notify the AP +* about us leaving the channel and stop all associated STA interfaces +* @SCAN_ENTER_OPER_CHANNEL: Enter the operating channel again, notify the +* AP about us being back and restart all associated STA interfaces +*/ +enum mac80211_scan_state { +SCAN_DECISION , +SCAN_SET_CHANNEL , +SCAN_SEND_PROBE , +SCAN_LEAVE_OPER_CHANNEL , +SCAN_ENTER_OPER_CHANNEL , };struct ieee80211_local {
@@ -683,7 +715,7 @@ struct ieee80211_local {int scan_channel_idx;int scan_ies_len; -enum {SCAN_DECISION ,SCAN_SET_CHANNEL ,SCAN_SEND_PROBE } scan_state; +enum mac80211_scan_state scan_state;struct delayed_work scan_work;struct ieee80211_sub_if_data *scan_sdata;enum nl80211_channel_type oper_channel_type;
net/mac80211/rx.c +4 -2
@@ -421,7 +421,8 @@ ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx)if (unlikely (test_bit (SCAN_HW_SCANNING , &local->scanning)))return ieee80211_scan_rx (rx->sdata, skb); -if (unlikely (test_bit (SCAN_SW_SCANNING , &local->scanning))) { +if (unlikely (test_bit (SCAN_SW_SCANNING , &local->scanning) && + (rx->flags &IEEE80211_RX_IN_SCAN ))) {/* drop all the other packets during a software scan anyway */ if (ieee80211_scan_rx (rx->sdata, skb) !=RX_QUEUED )dev_kfree_skb (skb);
@@ -2136,7 +2137,8 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,return ; } -if (unlikely (local->scanning)) +if (unlikely (test_bit (SCAN_HW_SCANNING , &local->scanning) || +test_bit (SCAN_OFF_CHANNEL , &local->scanning))) rx.flags |=IEEE80211_RX_IN_SCAN ;ieee80211_parse_qos (&rx);
net/mac80211/scan.c +109 -8
144 lines not on this page · raw message
net/mac80211/tx.c +1 -1
@@ -192,7 +192,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)if (unlikely (info->flags &IEEE80211_TX_CTL_INJECTED ))return TX_CONTINUE ; -if (unlikely (test_bit (SCAN_SW_SCANNING , &tx->local->scanning)) && +if (unlikely (test_bit (SCAN_OFF_CHANNEL , &tx->local->scanning)) && !ieee80211_is_probe_req (hdr->frame_control) && !ieee80211_is_nullfunc (hdr->frame_control))/*
Johannes Berg
maintainerRe: [PATCH 5/7] mac80211: implement basic background scanning
Quoted 6 lines · Helmut Schaa
Introduce a new scan flag "
SCAN_BG_SCANNING" which basically tells us that we are currently scanning but may as well be on the operating channel to RX/TX data whereas "SCAN_SW_SCANNING" tells us that we are currently on a different channel for scanning. While "SCAN_BG_SCANNING" is set during the whole scan "SCAN_SW_SCANNING" is set when leaving the operating channel and unset when coming back.
I think you got that description wrong :)
Quoted 6 lines
+ * @SCAN_SW_SCANNING: We're currently in the process of scanning but may as
+ * well be on the operating channel
+ * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to
+ * determine if we are on the operating channel or not
+ * @SCAN_OFF_CHANNEL: We're off our operating channel for scanning,
+ * gets only set in conjunction withSCAN_SW_SCANNING
johannes
Re: [PATCH 5/7] mac80211: implement basic background scanning
Am Donnerstag, 23. Juli 2009 schrieb Johannes Berg:
Quoted 9 lines · Helmut Schaa
Quoted 6 lines
Introduce a new scan flag "
SCAN_BG_SCANNING" which basically tells us that we are currently scanning but may as well be on the operating channel to RX/TX data whereas "SCAN_SW_SCANNING" tells us that we are currently on a different channel for scanning. While "SCAN_BG_SCANNING" is set during the whole scan "SCAN_SW_SCANNING" is set when leaving the operating channel and unset when coming back.I think you got that description wrong :)
Argh, yes. Should I respin the whole series?
Quoted 9 lines
Quoted 6 lines
+ * @SCAN_SW_SCANNING: We're currently in the process of scanning but may as
+ * well be on the operating channel
+ * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to
+ * determine if we are on the operating channel or not
+ * @SCAN_OFF_CHANNEL: We're off our operating channel for scanning,
+ * gets only set in conjunction withSCAN_SW_SCANNINGjohannes
Johannes Berg
maintainerRe: [PATCH 5/7] mac80211: implement basic background scanning
Quoted 9 lines · Helmut Schaa
Am Donnerstag, 23. Juli 2009 schrieb Johannes Berg:
Quoted 8 lines · Helmut Schaa
Quoted 6 lines
Introduce a new scan flag "
SCAN_BG_SCANNING" which basically tells us that we are currently scanning but may as well be on the operating channel to RX/TX data whereas "SCAN_SW_SCANNING" tells us that we are currently on a different channel for scanning. While "SCAN_BG_SCANNING" is set during the whole scan "SCAN_SW_SCANNING" is set when leaving the operating channel and unset when coming back.
Quoted 3 lines
Quoted 1 line
I think you got that description wrong :)
Argh, yes. Should I respin the whole series?
Not for all I care, just resend this one as a reply to it?
johannes
PATCH v2 5/7 mac80211: implement basic background scanning
In reply to Helmut SchaaIntroduce a new scan flag "SCAN_OFF_CHANNEL" which basically tells us that we are currently on a different channel for scanning and cannot RX/TX. "SCAN_SW_SCANNING" tells us that we are currently running a software scan but we might as well be on the operating channel to RX/TX. While "SCAN_SW_SCANNING" is set during the whole scan "SCAN_OFF_CHANNEL" is set when leaving the operating channel and unset when coming back.
Introduce two new scan states "SCAN_LEAVE_OPER_CHANNEL" and "SCAN_ENTER_OPER_CHANNEL" which basically implement the functionality we need to leave the operating channel (send a nullfunc to the AP and stop the queues) and enter it again (send a nullfunc to the AP and start the queues again).
Enhance the scan state "SCAN_DECISION" to switch back to the operating channel after each scanned channel. In the future it sould be simple to enhance the decision state to scan as much channels in a row as the qos latency allows us.
---
net/mac80211/ieee80211_i.h | 36 +++++++++++++- net/mac80211/rx.c | 6 ++ net/mac80211/scan.c | 117 +++++++++++++++++++++++++++++++++++++++++--- net/mac80211/tx.c | 2 - 4 files changed, 148 insertions(+), 13 deletions(-)
net/mac80211/ieee80211_i.h +34 -2
@@ -570,9 +570,41 @@ enum queue_stop_reason { IEEE80211_QUEUE_STOP_REASON_SKB_ADD, }; +/** +* mac80211 scan flags - currently active scan mode +* +* @SCAN_SW_SCANNING: We're currently in the process of scanning but may as +* well be on the operating channel +* @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to +* determine if we are on the operating channel or not +* @SCAN_OFF_CHANNEL: We're off our operating channel for scanning, +* gets only set in conjunction with SCAN_SW_SCANNING +*/ enum {SCAN_SW_SCANNING , -SCAN_HW_SCANNING +SCAN_HW_SCANNING , +SCAN_OFF_CHANNEL , +}; + +/** +* enum mac80211_scan_state - scan state machine states +* +* @SCAN_DECISION: Main entry point to the scan state machine, this state +* determines if we should keep on scanning or switch back to the +* operating channel +* @SCAN_SET_CHANNEL: Set the next channel to be scanned +* @SCAN_SEND_PROBE: Send probe requests and wait for probe responses +* @SCAN_LEAVE_OPER_CHANNEL: Leave the operating channel, notify the AP +* about us leaving the channel and stop all associated STA interfaces +* @SCAN_ENTER_OPER_CHANNEL: Enter the operating channel again, notify the +* AP about us being back and restart all associated STA interfaces +*/ +enum mac80211_scan_state { +SCAN_DECISION , +SCAN_SET_CHANNEL , +SCAN_SEND_PROBE , +SCAN_LEAVE_OPER_CHANNEL , +SCAN_ENTER_OPER_CHANNEL , };struct ieee80211_local {
@@ -683,7 +715,7 @@ struct ieee80211_local {int scan_channel_idx;int scan_ies_len; -enum {SCAN_DECISION ,SCAN_SET_CHANNEL ,SCAN_SEND_PROBE } scan_state; +enum mac80211_scan_state scan_state;struct delayed_work scan_work;struct ieee80211_sub_if_data *scan_sdata;enum nl80211_channel_type oper_channel_type;
net/mac80211/rx.c +4 -2
@@ -421,7 +421,8 @@ ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx)if (unlikely (test_bit (SCAN_HW_SCANNING , &local->scanning)))return ieee80211_scan_rx (rx->sdata, skb); -if (unlikely (test_bit (SCAN_SW_SCANNING , &local->scanning))) { +if (unlikely (test_bit (SCAN_SW_SCANNING , &local->scanning) && + (rx->flags &IEEE80211_RX_IN_SCAN ))) {/* drop all the other packets during a software scan anyway */ if (ieee80211_scan_rx (rx->sdata, skb) !=RX_QUEUED )dev_kfree_skb (skb);
@@ -2136,7 +2137,8 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,return ; } -if (unlikely (local->scanning)) +if (unlikely (test_bit (SCAN_HW_SCANNING , &local->scanning) || +test_bit (SCAN_OFF_CHANNEL , &local->scanning))) rx.flags |=IEEE80211_RX_IN_SCAN ;ieee80211_parse_qos (&rx);
net/mac80211/scan.c +109 -8
144 lines not on this page · raw message
net/mac80211/tx.c +1 -1
@@ -192,7 +192,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)if (unlikely (info->flags &IEEE80211_TX_CTL_INJECTED ))return TX_CONTINUE ; -if (unlikely (test_bit (SCAN_SW_SCANNING , &tx->local->scanning)) && +if (unlikely (test_bit (SCAN_OFF_CHANNEL , &tx->local->scanning)) && !ieee80211_is_probe_req (hdr->frame_control) && !ieee80211_is_nullfunc (hdr->frame_control))/*
PATCH 6/7 mac80211: rename scan_state to next_scan_state
In reply to Helmut SchaaRename scan_state to next_scan_state to better reflect what it is used for.
---
net/mac80211/ieee80211_i.h | 2 +- net/mac80211/scan.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-)
net/mac80211/ieee80211_i.h +1 -1
@@ -715,7 +715,7 @@ struct ieee80211_local {int scan_channel_idx;int scan_ies_len; -enum mac80211_scan_state scan_state; +enum mac80211_scan_state next_scan_state;struct delayed_work scan_work;struct ieee80211_sub_if_data *scan_sdata;enum nl80211_channel_type oper_channel_type;
net/mac80211/scan.c +10 -10
@@ -374,7 +374,7 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local) }mutex_unlock (&local->iflist_mtx); - local->scan_state =SCAN_DECISION ; + local->next_scan_state =SCAN_DECISION ; local->scan_channel_idx =0 ;spin_lock_bh (&local->filter_lock);
@@ -505,15 +505,15 @@ static int ieee80211_scan_state_decision(struct ieee80211_local *local,* next channel */ if (associated) - local->scan_state =SCAN_ENTER_OPER_CHANNEL ; + local->next_scan_state =SCAN_ENTER_OPER_CHANNEL ;else - local->scan_state =SCAN_SET_CHANNEL ; + local->next_scan_state =SCAN_SET_CHANNEL ; }else {/* * we're on the operating channel currently, let's * leave that channel now to scan another one */ - local->scan_state =SCAN_LEAVE_OPER_CHANNEL ; + local->next_scan_state =SCAN_LEAVE_OPER_CHANNEL ; } *next_delay =0 ;
@@ -545,7 +545,7 @@ static void ieee80211_scan_state_leave_oper_channel(struct ieee80211_local *loca/* advance to the next channel to be scanned */ *next_delay =HZ /10 ; - local->scan_state =SCAN_SET_CHANNEL ; + local->next_scan_state =SCAN_SET_CHANNEL ; } static void ieee80211_scan_state_enter_oper_channel(struct ieee80211_local *local,
@@ -577,7 +577,7 @@ static void ieee80211_scan_state_enter_oper_channel(struct ieee80211_local *loca__clear_bit (SCAN_OFF_CHANNEL , &local->scanning); *next_delay =HZ /5 ; - local->scan_state =SCAN_DECISION ; + local->next_scan_state =SCAN_DECISION ; } static void ieee80211_scan_state_set_channel(struct ieee80211_local *local,
@@ -621,13 +621,13 @@ static void ieee80211_scan_state_set_channel(struct ieee80211_local *local,if (chan->flags &IEEE80211_CHAN_PASSIVE_SCAN || !local->scan_req->n_ssids) { *next_delay =IEEE80211_PASSIVE_CHANNEL_TIME ; - local->scan_state =SCAN_DECISION ; + local->next_scan_state =SCAN_DECISION ;return ; }/* active scan, send probes */ *next_delay =IEEE80211_PROBE_DELAY ; - local->scan_state =SCAN_SEND_PROBE ; + local->next_scan_state =SCAN_SEND_PROBE ; } static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,
@@ -648,7 +648,7 @@ static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,* on the channel. */ *next_delay =IEEE80211_CHANNEL_TIME ; - local->scan_state =SCAN_DECISION ; + local->next_scan_state =SCAN_DECISION ; }void ieee80211_scan_work (struct work_struct *work)
@@ -693,7 +693,7 @@ void ieee80211_scan_work(struct work_struct *work)* without scheduling a new work */ do { - switch (local->scan_state) { + switch (local->next_scan_state) { case SCAN_DECISION: if (ieee80211_scan_state_decision(local, &next_delay)) return;
Re: [PATCH 6/7] mac80211: rename scan_state to next_scan_state
Quoted 4 lines · Helmut Schaa
Rename
scan_statetonext_scan_stateto better reflect what it is used for.Signed-off-by Helmut Schaa <[email protected]>
Quoted 105 lines
---
net/mac80211/ieee80211_i.h | 2 +- net/mac80211/scan.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-)net/mac80211/ieee80211_i.h +1
-1@@ -715,7 +715,7 @@ struct ieee80211_local {int scan_channel_idx;int scan_ies_len; -enum mac80211_scan_state scan_state; +enum mac80211_scan_state next_scan_state;struct delayed_work scan_work;struct ieee80211_sub_if_data *scan_sdata;enum nl80211_channel_type oper_channel_type;net/mac80211/scan.c +10
-10@@ -374,7 +374,7 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local) }mutex_unlock (&local->iflist_mtx); - local->scan_state =SCAN_DECISION ; + local->next_scan_state =SCAN_DECISION ; local->scan_channel_idx =0 ;spin_lock_bh (&local->filter_lock);@@ -505,15 +505,15 @@ static int ieee80211_scan_state_decision(struct ieee80211_local *local,* next channel */ if (associated) - local->scan_state =SCAN_ENTER_OPER_CHANNEL ; + local->next_scan_state =SCAN_ENTER_OPER_CHANNEL ;else - local->scan_state =SCAN_SET_CHANNEL ; + local->next_scan_state =SCAN_SET_CHANNEL ; }else {/* * we're on the operating channel currently, let's * leave that channel now to scan another one */ - local->scan_state =SCAN_LEAVE_OPER_CHANNEL ; + local->next_scan_state =SCAN_LEAVE_OPER_CHANNEL ; } *next_delay =0 ;@@ -545,7 +545,7 @@ static void ieee80211_scan_state_leave_oper_channel(struct ieee80211_local *loca/* advance to the next channel to be scanned */ *next_delay =HZ /10 ; - local->scan_state =SCAN_SET_CHANNEL ; + local->next_scan_state =SCAN_SET_CHANNEL ; } static void ieee80211_scan_state_enter_oper_channel(struct ieee80211_local *local,@@ -577,7 +577,7 @@ static void ieee80211_scan_state_enter_oper_channel(struct ieee80211_local *loca__clear_bit (SCAN_OFF_CHANNEL , &local->scanning); *next_delay =HZ /5 ; - local->scan_state =SCAN_DECISION ; + local->next_scan_state =SCAN_DECISION ; } static void ieee80211_scan_state_set_channel(struct ieee80211_local *local,@@ -621,13 +621,13 @@ static void ieee80211_scan_state_set_channel(struct ieee80211_local *local,if (chan->flags &IEEE80211_CHAN_PASSIVE_SCAN || !local->scan_req->n_ssids) { *next_delay =IEEE80211_PASSIVE_CHANNEL_TIME ; - local->scan_state =SCAN_DECISION ; + local->next_scan_state =SCAN_DECISION ;return ; }/* active scan, send probes */ *next_delay =IEEE80211_PROBE_DELAY ; - local->scan_state =SCAN_SEND_PROBE ; + local->next_scan_state =SCAN_SEND_PROBE ; } static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,@@ -648,7 +648,7 @@ static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,* on the channel. */ *next_delay =IEEE80211_CHANNEL_TIME ; - local->scan_state =SCAN_DECISION ; + local->next_scan_state =SCAN_DECISION ; }void ieee80211_scan_work (struct work_struct *work)@@ -693,7 +693,7 @@ void ieee80211_scan_work(struct work_struct *work)* without scheduling a new work */ do { - switch (local->scan_state) { + switch (local->next_scan_state) { case SCAN_DECISION: if (ieee80211_scan_state_decision(local, &next_delay)) return;
PATCH 7/7 cfg80211: increase scan result expire time
In reply to Helmut SchaaUsing background scanning in mac80211 the time a scan needs to finish can exceed 10 seconds. Hence, increase the scan results expire time to 15 seconds which should be sufficient.
---
net/wireless/scan.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/wireless/scan.c +1 -1
@@ -15,7 +15,7 @@#include "core.h" #include "nl80211.h" -#define IEEE80211_SCAN_RESULT_EXPIRE (10 * HZ) +#define IEEE80211_SCAN_RESULT_EXPIRE (15 * HZ)void __cfg80211_scan_done (struct work_struct *wk) {
Re: [PATCH 7/7] cfg80211: increase scan result expire time
Quoted 5 lines · Helmut Schaa
Using background scanning in mac80211 the time a scan needs to finish can exceed 10 seconds. Hence, increase the scan results expire time to 15 seconds which should be sufficient.
Signed-off-by Helmut Schaa <[email protected]>
Heh.
johannes
Quoted 20 lines
---
net/wireless/scan.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)net/wireless/scan.c +1
-1@@ -15,7 +15,7 @@#include "core.h" #include "nl80211.h" -#define IEEE80211_SCAN_RESULT_EXPIRE (10 * HZ) +#define IEEE80211_SCAN_RESULT_EXPIRE (15 * HZ)void __cfg80211_scan_done (struct work_struct *wk) {
Re: [PATCH 7/7] cfg80211: increase scan result expire time
Am Donnerstag, 23. Juli 2009 schrieb Johannes Berg:
Quoted 8 lines · Helmut Schaa
Quoted 5 lines
Using background scanning in mac80211 the time a scan needs to finish can exceed 10 seconds. Hence, increase the scan results expire time to 15 seconds which should be sufficient.
Signed-off-by Helmut Schaa <[email protected]>Heh.
;)
Maybe we could later use a dynamic expire time based on the time the last scan took or something similar. But for now 15 seconds should suffice.
Quoted 25 lines
Acked-by Johannes Berg <[email protected]>johannes
Quoted 20 lines
---
net/wireless/scan.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)net/wireless/scan.c +1
-1@@ -15,7 +15,7 @@#include "core.h" #include "nl80211.h" -#define IEEE80211_SCAN_RESULT_EXPIRE (10 * HZ) +#define IEEE80211_SCAN_RESULT_EXPIRE (15 * HZ)void __cfg80211_scan_done (struct work_struct *wk) {
Johannes Berg
maintainerRe: [PATCH 7/7] cfg80211: increase scan result expire time
Quoted 8 lines · Helmut Schaa
Am Donnerstag, 23. Juli 2009 schrieb Johannes Berg:
Quoted 7 lines · Helmut Schaa
Quoted 5 lines
Using background scanning in mac80211 the time a scan needs to finish can exceed 10 seconds. Hence, increase the scan results expire time to 15 seconds which should be sufficient.
Signed-off-by Helmut Schaa <[email protected]>
Quoted 7 lines
Quoted 1 line
Heh.
;)
Maybe we could later use a dynamic expire time based on the time the last scan took or something similar. But for now 15 seconds should suffice.
Since we tell (or if we don't, should) userspace when that was last seen, I guess we could just increase this more anyway. But ultimately it doesn't matter all that much since people are just using wpa_supplicant and keeping a copy in userspace.
johannes