diff options
author | Wei Ni <wni@nvidia.com> | 2012-11-02 13:40:04 +0800 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-11-20 17:32:27 -0800 |
commit | 666c26e13352b19da7197ed1ca4c7bc1046b0625 (patch) | |
tree | ee2dea819c9728a83deadcd2f71dffd6a864e4f5 /net | |
parent | c2f496f4fdc8598f2fe7e3cd0bfdb0abee5daf74 (diff) |
mac80211&nl80211: support to abort a scan request on tx
mac80211 & nl80211: add support to abort a scan request on tx
The original issue is the chromium issue:
http://code.google.com/p/chromium-os/issues/detail?id=11485
This fix comes from:
https://gerrit.chromium.org/gerrit/#change,5744
https://gerrit.chromium.org/gerrit/#change,5745
Since this change is for ChromeOs and will affect Android P2P function,
so we add config option MAC80211_SCAN_ABORT for it.
Bug 1051830
Change-Id: I77504f4d279f3f3d99b5e5f9d734480888d62193
Signed-off-by: Wei Ni <wni@nvidia.com>
Reviewed-on: http://git-master/r/160777
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Rhyland Klein <rklein@nvidia.com>
Reviewed-by: Bibhay Ranjan <bibhayr@nvidia.com>
Tested-by: Bibhay Ranjan <bibhayr@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/Kconfig | 9 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 6 | ||||
-rw-r--r-- | net/mac80211/scan.c | 43 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 13 |
4 files changed, 71 insertions, 0 deletions
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig index 96ddb72760b9..778f88d75741 100644 --- a/net/mac80211/Kconfig +++ b/net/mac80211/Kconfig @@ -247,3 +247,12 @@ config MAC80211_DEBUG_COUNTERS and show them in debugfs. If unsure, say N. + +config MAC80211_SCAN_ABORT + bool "Support to abort a scan request on tx" + depends on MAC80211 + depends on WIRELESS + default n + ---help--- + Add support for aborting scan requests. + This is only for ChromeOs, because it will affect Android P2P. diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index db8fae51714c..a68ef6219833 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -808,6 +808,10 @@ enum { * @SCAN_SUSPEND: Suspend the scan and go back to operating channel to * send out data * @SCAN_RESUME: Resume the scan and scan the next channel + * @SCAN_ABORT: Abnormally terminate the scan operation, set only when + * on the operating channel. + * @SCAN_SUSPEND_ABORT: Return to the operating channel then + * terminate the scan operation. */ enum mac80211_scan_state { SCAN_DECISION, @@ -815,6 +819,8 @@ enum mac80211_scan_state { SCAN_SEND_PROBE, SCAN_SUSPEND, SCAN_RESUME, + SCAN_ABORT, + SCAN_SUSPEND_ABORT, }; struct ieee80211_local { diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index c70e17677135..9f8412c48960 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c @@ -487,6 +487,9 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local, unsigned long min_beacon_int = 0; struct ieee80211_sub_if_data *sdata; struct ieee80211_channel *next_chan; +#ifdef CONFIG_MAC80211_SCAN_ABORT + enum mac80211_scan_state next_scan_state; +#endif /* * check if at least one STA interface is associated, @@ -545,10 +548,31 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local, usecs_to_jiffies(min_beacon_int * 1024) * local->hw.conf.listen_interval); +#ifndef CONFIG_MAC80211_SCAN_ABORT if (associated && (!tx_empty || bad_latency || listen_int_exceeded)) local->next_scan_state = SCAN_SUSPEND; else local->next_scan_state = SCAN_SET_CHANNEL; +#else + if (associated && !tx_empty) { + if (unlikely(local->scan_req->flags & + CFG80211_SCAN_FLAG_TX_ABORT)) { + /* + * Scan request is marked to abort when there + * is outbound traffic. Mark state to return + * the operating channel and then abort. This + * happens as soon as possible. + */ + next_scan_state = SCAN_SUSPEND_ABORT; + } else + next_scan_state = SCAN_SUSPEND; + } else if (associated && (bad_latency || listen_int_exceeded)) + next_scan_state = SCAN_SUSPEND; + else + next_scan_state = SCAN_SET_CHANNEL; + + local->next_scan_state = next_scan_state; +#endif *next_delay = 0; } @@ -636,9 +660,20 @@ static void ieee80211_scan_state_suspend(struct ieee80211_local *local, */ ieee80211_offchannel_return(local, false); +#ifndef CONFIG_MAC80211_SCAN_ABORT *next_delay = HZ / 5; /* afterwards, resume scan & go to next channel */ local->next_scan_state = SCAN_RESUME; +#else + if (local->next_scan_state == SCAN_SUSPEND) { + *next_delay = HZ / 5; + /* afterwards, resume scan & go to next channel */ + local->next_scan_state = SCAN_RESUME; + } else { + *next_delay = 0; + local->next_scan_state = SCAN_ABORT; + } +#endif } static void ieee80211_scan_state_resume(struct ieee80211_local *local, @@ -731,11 +766,19 @@ void ieee80211_scan_work(struct work_struct *work) ieee80211_scan_state_send_probe(local, &next_delay); break; case SCAN_SUSPEND: +#ifdef CONFIG_MAC80211_SCAN_ABORT + case SCAN_SUSPEND_ABORT: +#endif ieee80211_scan_state_suspend(local, &next_delay); break; case SCAN_RESUME: ieee80211_scan_state_resume(local, &next_delay); break; +#ifdef CONFIG_MAC80211_SCAN_ABORT + case SCAN_ABORT: + aborted = true; + goto out_complete; +#endif } } while (next_delay == 0); diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index e0e655b4b80a..4371ed4729d5 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -136,6 +136,9 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { [NL80211_ATTR_MGMT_SUBTYPE] = { .type = NLA_U8 }, [NL80211_ATTR_IE] = { .type = NLA_BINARY, .len = IEEE80211_MAX_DATA_LEN }, +#ifdef CONFIG_MAC80211_SCAN_ABORT + [NL80211_ATTR_SCAN_FLAGS] = { .type = NLA_U32 }, +#endif [NL80211_ATTR_SCAN_FREQUENCIES] = { .type = NLA_NESTED }, [NL80211_ATTR_SCAN_SSIDS] = { .type = NLA_NESTED }, @@ -3867,6 +3870,12 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) request->no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); +#ifdef CONFIG_MAC80211_SCAN_ABORT + if (info->attrs[NL80211_ATTR_SCAN_FLAGS]) + request->flags = nla_get_u32( + info->attrs[NL80211_ATTR_SCAN_FLAGS]); +#endif + request->dev = dev; request->wiphy = &rdev->wiphy; @@ -6923,6 +6932,10 @@ static int nl80211_add_scan_req(struct sk_buff *msg, if (req->ie) NLA_PUT(msg, NL80211_ATTR_IE, req->ie_len, req->ie); +#ifdef CONFIG_MAC80211_SCAN_ABORT + NLA_PUT_U32(msg, NL80211_ATTR_SCAN_FLAGS, req->flags); +#endif + return 0; nla_put_failure: return -ENOBUFS; |