basic background scan
RFC v2 1/1 basic background scan
The patch basically enhances the scanning state machine by two further states (SCAN_SET_OPER_CHANNEL & SCAN_OPERATION). In state SCAN_SET_OPER_CHANNEL the driver is advised to switch back to the operating channel while SCAN_OPERATION tells the access point about being back from power saving and restarts the tx queue. Just before SCAN_SET_CHANNEL sets the next channel to scan it notifies the access point about going to power save state and stops the tx queue.
It does not add any periodic scan behavior, it only reduces the impact of a scan onto the traffic (multiple short interruptions instead of one long) which results in a smoother user experience.
---
Could somebody please have a look at the TODO comments (I have no idea how to wait until all null-func frames are ACKed)? Thanks.
net/mac80211/ieee80211_i.h +2 -2
@@ -646,11 +647,11 @@ struct ieee80211_local {/* Scanning and BSS list */ -bool sw_scanning, hw_scanning; +bool sw_scanning, hw_scanning, bg_scanning;int scan_channel_idx;enum ieee80211_band scan_band; -enum {SCAN_SET_CHANNEL ,SCAN_SEND_PROBE } scan_state; +enum {SCAN_SET_CHANNEL ,SCAN_SEND_PROBE ,SCAN_SET_OPER_CHANNEL ,SCAN_OPERATION } scan_state;unsigned long last_scan_completed;struct delayed_work scan_work;struct ieee80211_sub_if_data *scan_sdata;
net/mac80211/rx.c +1 -1
@@ -414,7 +414,7 @@ ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx)return RX_QUEUED ; } -if (unlikely (rx->flags &IEEE80211_RX_IN_SCAN )) { +if (unlikely ((rx->flags &IEEE80211_RX_IN_SCAN ) && !local->bg_scanning)) {/* scanning finished during invoking of handlers */ I802_DEBUG_INC (local->rx_handlers_drop_passive_scan);return RX_DROP_UNUSABLE ;
net/mac80211/scan.c +102 -12
172 lines not on this page · raw message
net/mac80211/wext.c +1 -1
@@ -566,7 +566,7 @@ static int ieee80211_ioctl_giwscan(struct net_device *dev, sdata =IEEE80211_DEV_TO_SUB_IF (dev); -if (local->sw_scanning || local->hw_scanning) +if (local->sw_scanning || local->hw_scanning || local->bg_scanning)return -EAGAIN ; res =ieee80211_scan_results (local, info, extra, data->length);
Johannes Berg
maintainerQuoted 2 lines · Helmut Schaa
Could somebody please have a look at the TODO comments (I have no idea how to wait until all null-func frames are ACKed)? Thanks.
It's not really possible.
net/mac80211/scan.c void ieee80211_scan_work(struct work_struct *work) · line 521
Quoted 7 lines
net/mac80211/scan.c +7
-0+if (local->bg_scanning) { +/* +* background scan is in progress, notify all associated +* access points about us leaving the channel and +* update the filter flags +*/ + local->sw_scanning =1 ;
use true/false please
net/mac80211/scan.c void ieee80211_scan_work(struct work_struct *work) · line 529
Quoted 7 lines
net/mac80211/scan.c +7
-0+rcu_read_lock (); +list_for_each_entry_rcu (sdata, &local->interfaces, list) { +if (sdata->vif.type ==NL80211_IFTYPE_STATION && + (sdata->u.sta.flags &IEEE80211_STA_ASSOCIATED )) { +ieee80211_send_nullfunc (local, sdata,1 ); +/* TODO: wait until all nullfunc frames are ACKed */ +msleep (1 );
I don't think you can msleep here?
net/mac80211/scan.c void ieee80211_scan_work(struct work_struct *work) · line 654
Quoted 12 lines
net/mac80211/scan.c +12
-0+break ; + +case SCAN_OPERATION : +rcu_read_lock (); +list_for_each_entry_rcu (sdata, &local->interfaces, list) { +/* Tell AP we're back */ +if (sdata->vif.type ==NL80211_IFTYPE_STATION && + sdata->u.sta.flags &IEEE80211_STA_ASSOCIATED ) { +ieee80211_send_nullfunc (local, sdata,0 ); +/* TODO: wait until all nullfunc frames are ACKed */ +msleep (1 ); +netif_tx_wake_all_queues (sdata->dev);
This is worsening a problem we already have -- you can enable queues that the driver asked to be disabled. Until we fix that, I don't think we should tempt our luck even more.
net/mac80211/wext.c static int ieee80211_ioctl_giwscan(struct net_device *dev, · line 569
Quoted 2 lines
net/mac80211/wext.c +1
-1-if (local->sw_scanning || local->hw_scanning) +if (local->sw_scanning || local->hw_scanning || local->bg_scanning)
I don't really like that. I think these three bools should become an enum now. And why is sw_scanning false if bg_scanning is true anyway?
johannes
Am Mittwoch, 24. September 2008 16:46:18 schrieb Johannes Berg:
Quoted 5 lines · Helmut Schaa
Quoted 2 lines
Could somebody please have a look at the TODO comments (I have no idea how to wait until all null-func frames are ACKed)? Thanks.
It's not really possible.
:(
Quoted 9 lines
net/mac80211/scan.c void ieee80211_scan_work(struct work_struct *work) · line 521
Quoted 7 lines
net/mac80211/scan.c +7
-0+if (local->bg_scanning) { +/* +* background scan is in progress, notify all associated +* access points about us leaving the channel and +* update the filter flags +*/ + local->sw_scanning =1 ;use true/false please
Sure, my fault.
Quoted 5 lines
net/mac80211/scan.c void ieee80211_scan_work(struct work_struct *work) · line 654
Quoted 1 line
net/mac80211/scan.c +1
-0+netif_tx_wake_all_queues (sdata->dev);This is worsening a problem we already have -- you can enable queues that the driver asked to be disabled. Until we fix that, I don't think we should tempt our luck even more.
I see! That's really problematic.
Do you have already an idea on how to fix it?
Quoted 5 lines
net/mac80211/wext.c static int ieee80211_ioctl_giwscan(struct net_device *dev, · line 569
Quoted 2 lines
net/mac80211/wext.c +1
-1-if (local->sw_scanning || local->hw_scanning) +if (local->sw_scanning || local->hw_scanning || local->bg_scanning)I don't really like that. I think these three bools should become an enum now.
Agreed.
Quoted 1 line
And why is
sw_scanningfalse ifbg_scanningis true anyway?
During a background scan the sw_scanning flag is set when a scan phase is active and unset when an operation phase is active. Therefore I did not need to adapt all checks for sw_scanning.
Thanks for your comments,
Helmut
Johannes Berg
maintainerQuoted 8 lines · Helmut Schaa
Am Mittwoch, 24. September 2008 16:46:18 schrieb Johannes Berg:
Quoted 5 lines · Helmut Schaa
Quoted 2 lines
Could somebody please have a look at the TODO comments (I have no idea how to wait until all null-func frames are ACKed)? Thanks.
It's not really possible.
:(
What I meant to say is that it'll give problems with drivers that don't do status reporting properly, and what are you going to do when one of them fails anyway? retry it? how long? assume the connection was lost if it isn't acked? I see little point in it to start with.
Quoted 8 lines
Quoted 5 lines
net/mac80211/scan.c void ieee80211_scan_work(struct work_struct *work) · line 654
Quoted 1 line
net/mac80211/scan.c +1
-0+netif_tx_wake_all_queues (sdata->dev);This is worsening a problem we already have -- you can enable queues that the driver asked to be disabled. Until we fix that, I don't think we should tempt our luck even more.
I see! That's really problematic.
Do you have already an idea on how to fix it?
Not really; introduce bits somewhere to keep track of who wants to enable/disable queues I guess.
Quoted 5 lines
Quoted 1 line
And why is
sw_scanningfalse ifbg_scanningis true anyway?During a background scan the
sw_scanningflag is set when a scan phase is active and unset when an operation phase is active. Therefore I did not need to adapt all checks forsw_scanning.
Oh, hmm, ok, that might make the enum problematic. Or do something like
SCAN_OFF,SCAN_BG,SCAN_SW,SCAN_HW
then you can check for scan >= SCAN_SW
johannes
Am Mittwoch, 24. September 2008 17:33:41 schrieb Johannes Berg:
Quoted 6 lines · Helmut Schaa
Quoted 5 lines
Am Mittwoch, 24. September 2008 16:46:18 schrieb Johannes Berg:
Quoted 4 lines · Helmut Schaa
Quoted 2 lines
Could somebody please have a look at the TODO comments (I have no idea how to wait until all null-func frames are ACKed)? Thanks.
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
It's not really possible.
:(
What I meant to say is that it'll give problems with drivers that don't do status reporting properly, and what are you going to do when one of them fails anyway? retry it? how long? assume the connection was lost if it isn't acked? I see little point in it to start with.
The main reason why I'd like to know when the frame was acked is that it might happen (and it did happen in my tests already) that the frame notifying the AP about entering power save state wasn't send before switching to another channel. Hence the AP won't buffer any frames for us.
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
net/mac80211/scan.c void ieee80211_scan_work(struct work_struct *work) · line 654
Quoted 1 line
net/mac80211/scan.c +1
-0+netif_tx_wake_all_queues (sdata->dev);This is worsening a problem we already have -- you can enable queues that the driver asked to be disabled. Until we fix that, I don't think we should tempt our luck even more.
I see! That's really problematic.
Do you have already an idea on how to fix it?Not really; introduce bits somewhere to keep track of who wants to enable/disable queues I guess.
A first trivial solution would be to just store which queues are active when the scan is started and restarting only these queues after the scan completed.
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
And why is
sw_scanningfalse ifbg_scanningis true anyway?During a background scan the
sw_scanningflag is set when a scan phase is active and unset when an operation phase is active. Therefore I did not need to adapt all checks forsw_scanning.
Quoted 8 lines
Oh, hmm, ok, that might make the enum problematic. Or do something like
SCAN_OFF,SCAN_BG,SCAN_SW,SCAN_HWthen you can check for scan >=
SCAN_SW
Maybe. Thinking about it.
Helmut
Johannes Berg
maintainerQuoted 9 lines · Helmut Schaa
Quoted 4 lines
What I meant to say is that it'll give problems with drivers that don't do status reporting properly, and what are you going to do when one of them fails anyway? retry it? how long? assume the connection was lost if it isn't acked? I see little point in it to start with.
The main reason why I'd like to know when the frame was acked is that it might happen (and it did happen in my tests already) that the frame notifying the AP about entering power save state wasn't send before switching to another channel. Hence the AP won't buffer any frames for us.
We should make these frames able to "skip the queue" so to speak, that would be smarter either way.
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 5 lines
net/mac80211/scan.c void ieee80211_scan_work(struct work_struct *work) · line 654
Quoted 1 line
net/mac80211/scan.c +1
-0+netif_tx_wake_all_queues (sdata->dev);This is worsening a problem we already have -- you can enable queues that the driver asked to be disabled. Until we fix that, I don't think we should tempt our luck even more.
I see! That's really problematic.
Do you have already an idea on how to fix it?
Quoted 6 lines
Quoted 2 lines
Not really; introduce bits somewhere to keep track of who wants to enable/disable queues I guess.
A first trivial solution would be to just store which queues are active when the scan is started and restarting only these queues after the scan completed.
Actually, well, you have to deal with drivers like adm8211 that stop/start the queues for each packet...
johannes
Quoted 9 lines
Quoted 7 lines
SCAN_OFF,SCAN_BG,SCAN_SW,SCAN_HWthen you can check for scan >=
SCAN_SWMaybe. Thinking about it.
SCAN_BG is under soft scan so why SCAN_HW is in the same level? Conceptually this is wrong
Tomas
Am Mittwoch, 24. September 2008 17:59:01 schrieb Johannes Berg:
Quoted 7 lines · Helmut Schaa
Quoted 6 lines
Quoted 5 lines
What I meant to say is that it'll give problems with drivers that don't do status reporting properly, and what are you going to do when one of them fails anyway? retry it? how long? assume the connection was lost if it isn't acked? I see little point in it to start with.
Quoted 7 lines
Quoted 4 lines
The main reason why I'd like to know when the frame was acked is that it might happen (and it did happen in my tests already) that the frame notifying the AP about entering power save state wasn't send before switching to another channel. Hence the AP won't buffer any frames for us.
We should make these frames able to "skip the queue" so to speak, that would be smarter either way.
Agreed. That would at least enhance the probability that the frame is sent out fast enough.
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
net/mac80211/scan.c void ieee80211_scan_work(struct work_struct *work) · line 654
Quoted 1 line
net/mac80211/scan.c +1
-0+netif_tx_wake_all_queues (sdata->dev);This is worsening a problem we already have -- you can enable queues that the driver asked to be disabled. Until we fix that, I don't think we should tempt our luck even more.
I see! That's really problematic.
Do you have already an idea on how to fix it?Not really; introduce bits somewhere to keep track of who wants to enable/disable queues I guess.
Quoted 6 lines
Quoted 3 lines
A first trivial solution would be to just store which queues are active when the scan is started and restarting only these queues after the scan completed.
Actually, well, you have to deal with drivers like adm8211 that stop/start the queues for each packet...
Oops. I did not know about drivers behaving like that
=> have to find a better way to deal with starting/stopping queues.
Thanks,
Helmut