diff options
author | Sam Leffler <sleffler@chromium.org> | 2012-10-12 00:03:35 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-10-18 03:01:53 -0400 |
commit | cd2bb512cda58f1efb922ad6dc29013ea5d5d9d0 (patch) | |
tree | 68d6ca0c3bed7979f578b3b554b2c8e6b668c32a /net | |
parent | 15d6030b4bec618742b8b9ccae9209c8f9e4a916 (diff) |
mac80211: add support for tx to abort low priority scan requests
Use NL80211_SCAN_FLAG_LOW_PRIORITY flag in mac80211's scan state
machine to prematurely terminate scan operations if outbound
traffic collides. This is useful for marking background scans so
they don't affect throughput.
Signed-off-by: Sam Leffler <sleffler@chromium.org>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
[set feature flag only if software scan is used]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/ieee80211_i.h | 2 | ||||
-rw-r--r-- | net/mac80211/main.c | 3 | ||||
-rw-r--r-- | net/mac80211/scan.c | 21 |
3 files changed, 22 insertions, 4 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 6327816790e6..02e47930964f 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -866,6 +866,7 @@ enum { | |||
866 | * @SCAN_SUSPEND: Suspend the scan and go back to operating channel to | 866 | * @SCAN_SUSPEND: Suspend the scan and go back to operating channel to |
867 | * send out data | 867 | * send out data |
868 | * @SCAN_RESUME: Resume the scan and scan the next channel | 868 | * @SCAN_RESUME: Resume the scan and scan the next channel |
869 | * @SCAN_ABORT: Abort the scan and go back to operating channel | ||
869 | */ | 870 | */ |
870 | enum mac80211_scan_state { | 871 | enum mac80211_scan_state { |
871 | SCAN_DECISION, | 872 | SCAN_DECISION, |
@@ -873,6 +874,7 @@ enum mac80211_scan_state { | |||
873 | SCAN_SEND_PROBE, | 874 | SCAN_SEND_PROBE, |
874 | SCAN_SUSPEND, | 875 | SCAN_SUSPEND, |
875 | SCAN_RESUME, | 876 | SCAN_RESUME, |
877 | SCAN_ABORT, | ||
876 | }; | 878 | }; |
877 | 879 | ||
878 | struct ieee80211_local { | 880 | struct ieee80211_local { |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 931f14f3281f..ba5a23249771 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -602,6 +602,9 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, | |||
602 | NL80211_FEATURE_SAE | | 602 | NL80211_FEATURE_SAE | |
603 | NL80211_FEATURE_HT_IBSS; | 603 | NL80211_FEATURE_HT_IBSS; |
604 | 604 | ||
605 | if (!ops->hw_scan) | ||
606 | wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN; | ||
607 | |||
605 | if (!ops->set_key) | 608 | if (!ops->set_key) |
606 | wiphy->flags |= WIPHY_FLAG_IBSS_RSN; | 609 | wiphy->flags |= WIPHY_FLAG_IBSS_RSN; |
607 | 610 | ||
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 987c75d46bc0..13d23299e696 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -466,6 +466,7 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata, | |||
466 | sizeof(*local->hw_scan_req) + | 466 | sizeof(*local->hw_scan_req) + |
467 | req->n_channels * sizeof(req->channels[0]); | 467 | req->n_channels * sizeof(req->channels[0]); |
468 | local->hw_scan_req->ie = ies; | 468 | local->hw_scan_req->ie = ies; |
469 | local->hw_scan_req->flags = req->flags; | ||
469 | 470 | ||
470 | local->hw_scan_band = 0; | 471 | local->hw_scan_band = 0; |
471 | 472 | ||
@@ -566,6 +567,7 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local, | |||
566 | unsigned long min_beacon_int = 0; | 567 | unsigned long min_beacon_int = 0; |
567 | struct ieee80211_sub_if_data *sdata; | 568 | struct ieee80211_sub_if_data *sdata; |
568 | struct ieee80211_channel *next_chan; | 569 | struct ieee80211_channel *next_chan; |
570 | enum mac80211_scan_state next_scan_state; | ||
569 | 571 | ||
570 | /* | 572 | /* |
571 | * check if at least one STA interface is associated, | 573 | * check if at least one STA interface is associated, |
@@ -624,10 +626,18 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local, | |||
624 | usecs_to_jiffies(min_beacon_int * 1024) * | 626 | usecs_to_jiffies(min_beacon_int * 1024) * |
625 | local->hw.conf.listen_interval); | 627 | local->hw.conf.listen_interval); |
626 | 628 | ||
627 | if (associated && (!tx_empty || bad_latency || listen_int_exceeded)) | 629 | if (associated && !tx_empty) { |
628 | local->next_scan_state = SCAN_SUSPEND; | 630 | if (local->scan_req->flags & NL80211_SCAN_FLAG_LOW_PRIORITY) |
629 | else | 631 | next_scan_state = SCAN_ABORT; |
630 | local->next_scan_state = SCAN_SET_CHANNEL; | 632 | else |
633 | next_scan_state = SCAN_SUSPEND; | ||
634 | } else if (associated && (bad_latency || listen_int_exceeded)) { | ||
635 | next_scan_state = SCAN_SUSPEND; | ||
636 | } else { | ||
637 | next_scan_state = SCAN_SET_CHANNEL; | ||
638 | } | ||
639 | |||
640 | local->next_scan_state = next_scan_state; | ||
631 | 641 | ||
632 | *next_delay = 0; | 642 | *next_delay = 0; |
633 | } | 643 | } |
@@ -798,6 +808,9 @@ void ieee80211_scan_work(struct work_struct *work) | |||
798 | case SCAN_RESUME: | 808 | case SCAN_RESUME: |
799 | ieee80211_scan_state_resume(local, &next_delay); | 809 | ieee80211_scan_state_resume(local, &next_delay); |
800 | break; | 810 | break; |
811 | case SCAN_ABORT: | ||
812 | aborted = true; | ||
813 | goto out_complete; | ||
801 | } | 814 | } |
802 | } while (next_delay == 0); | 815 | } while (next_delay == 0); |
803 | 816 | ||