nl80211: add api to abort a scan request on tx
authorSam Leffler <sleffler@chromium.org>
Mon, 23 May 2011 21:34:14 +0000 (14:34 -0700)
committerGrant Grundler <grundler@google.com>
Thu, 24 May 2012 22:17:14 +0000 (15:17 -0700)
Add NL80211_ATTR_SCAN_FLAGS to nl80211's NL80211_CMD_TRIGGER_SCAN and
define a flag to indicate outbound traffic should abort a scan request.

Signed-off-by: sleffler@chromium.org
BUG=chromium-os:11485
TEST=manual:run iw event -f in the background; run ping -i .25 <host>; wait for wpa_supplicant to issue a bgscan; note that the scan is aborted due to the ping; issue iw dev wlan0 scan and note the scan is not aborted and the ping packets are noticeably delayed

Change-Id: I27050f0e7b0485e2bc52f4dbd7fec9125436e238
Reviewed-on: http://gerrit.chromium.org/gerrit/5744
Reviewed-by: Gary Morain <gmorain@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Sam Leffler <sleffler@chromium.org>
Tested-by: Sam Leffler <sleffler@chromium.org>
include/linux/nl80211.h
net/wireless/nl80211.c

index e474f6e..32e94dc 100644 (file)
@@ -1046,6 +1046,8 @@ enum nl80211_commands {
  * @NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX: Bitmap of antennas which are available
  *     for configuration as RX antennas via the above parameters.
  *
+ * @NL80211_ATTR_SCAN_FLAGS: scan request control flags (u32)
+ *
  * @NL80211_ATTR_MCAST_RATE: Multicast tx rate (in 100 kbps) for IBSS
  *
  * @NL80211_ATTR_OFFCHANNEL_TX_OK: For management frame TX, the frame may be
@@ -1402,6 +1404,8 @@ enum nl80211_attrs {
        NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX,
        NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX,
 
+       NL80211_ATTR_SCAN_FLAGS,
+
        NL80211_ATTR_SUPPORT_MESH_AUTH,
        NL80211_ATTR_STA_PLINK_STATE,
 
@@ -2521,6 +2525,18 @@ enum nl80211_tx_power_setting {
        NL80211_TX_POWER_FIXED,
 };
 
+/**
+ * enum nl80211_scan_flags -  scan request control flags
+ *
+ * Scan request control flags are used to control the handling
+ * of NL80211_CMD_TRIGGER_SCAN, requests.
+ *
+ * @NL80211_SCAN_FLAG_TX_ABORT: abort scan if tx collides
+ */
+enum nl80211_scan_flags {
+       NL80211_SCAN_FLAG_TX_ABORT      = 1<<0,
+};
+
 /**
  * enum nl80211_wowlan_packet_pattern_attr - WoWLAN packet pattern attribute
  * @__NL80211_WOWLAN_PKTPAT_INVALID: invalid number for nested attribute
index f432c57..2142deb 100644 (file)
@@ -136,6 +136,7 @@ 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 },
+       [NL80211_ATTR_SCAN_FLAGS] = { .type = NLA_U32 },
        [NL80211_ATTR_SCAN_FREQUENCIES] = { .type = NLA_NESTED },
        [NL80211_ATTR_SCAN_SSIDS] = { .type = NLA_NESTED },
 
@@ -3874,6 +3875,10 @@ 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]);
 
+       if (info->attrs[NL80211_ATTR_SCAN_FLAGS])
+               request->flags = nla_get_u32(
+                   info->attrs[NL80211_ATTR_SCAN_FLAGS]);
+
        request->dev = dev;
        request->wiphy = &rdev->wiphy;
 
@@ -6930,6 +6935,8 @@ static int nl80211_add_scan_req(struct sk_buff *msg,
        if (req->ie)
                NLA_PUT(msg, NL80211_ATTR_IE, req->ie_len, req->ie);
 
+       NLA_PUT_U8(msg, NL80211_ATTR_SCAN_FLAGS, req->flags);
+
        return 0;
  nla_put_failure:
        return -ENOBUFS;