mac80211: support hw scan while idle
authorEliad Peller <eliad@wizery.com>
Thu, 2 Feb 2012 15:44:55 +0000 (17:44 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 6 Feb 2012 19:55:51 +0000 (14:55 -0500)
Currently, mac80211 goes to idle-off before starting a scan.
However, some devices that implement hw scan might not
need going idle-off in order to perform a hw scan, and
thus saving some energy and simplifying their state machine.

(Note that this is also the case for sched scan - it
currently doesn't make mac80211 go idle-off)

Add a new flag to indicate support for hw scan while idle.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
include/net/mac80211.h
net/mac80211/debugfs.c
net/mac80211/iface.c
net/mac80211/main.c

index 922313f0b39bcca99cb34cb5f180e3b3e63dbd15..cbff4f94a2002465db85e0143175e1ccef6c7f2f 100644 (file)
@@ -1164,6 +1164,10 @@ enum sta_notify_cmd {
  * @IEEE80211_HW_TX_AMPDU_SETUP_IN_HW: The device handles TX A-MPDU session
  *     setup strictly in HW. mac80211 should not attempt to do this in
  *     software.
+ *
+ * @IEEE80211_HW_SCAN_WHILE_IDLE: The device can do hw scan while
+ *     being idle (i.e. mac80211 doesn't have to go idle-off during the
+ *     the scan).
  */
 enum ieee80211_hw_flags {
        IEEE80211_HW_HAS_RATE_CONTROL                   = 1<<0,
@@ -1190,6 +1194,7 @@ enum ieee80211_hw_flags {
        IEEE80211_HW_SUPPORTS_PER_STA_GTK               = 1<<21,
        IEEE80211_HW_AP_LINK_PS                         = 1<<22,
        IEEE80211_HW_TX_AMPDU_SETUP_IN_HW               = 1<<23,
+       IEEE80211_HW_SCAN_WHILE_IDLE                    = 1<<24,
 };
 
 /**
index affe64be909211b124c3f9c232517838bc32f816..483e96ed95c10b4f62b8c847db07dbc3d9f1ab8a 100644 (file)
@@ -263,6 +263,8 @@ static ssize_t hwflags_read(struct file *file, char __user *user_buf,
                sf += snprintf(buf + sf, mxln - sf, "AP_LINK_PS\n");
        if (local->hw.flags & IEEE80211_HW_TX_AMPDU_SETUP_IN_HW)
                sf += snprintf(buf + sf, mxln - sf, "TX_AMPDU_SETUP_IN_HW\n");
+       if (local->hw.flags & IEEE80211_HW_SCAN_WHILE_IDLE)
+               sf += snprintf(buf + sf, mxln - sf, "SCAN_WHILE_IDLE\n");
 
        rv = simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
        kfree(buf);
index 19f0818eba7840d4a4705d77484ad17ae446718f..6b3cd65d1e07f0d1fbea7c201410055fc8be06c3 100644 (file)
@@ -1332,7 +1332,8 @@ u32 __ieee80211_recalc_idle(struct ieee80211_local *local)
                wk->sdata->vif.bss_conf.idle = false;
        }
 
-       if (local->scan_sdata) {
+       if (local->scan_sdata &&
+           !(local->hw.flags & IEEE80211_HW_SCAN_WHILE_IDLE)) {
                scanning = true;
                local->scan_sdata->vif.bss_conf.idle = false;
        }
index 362e89d6d467db4bc086da2ede37b49445be4e14..831a5bd44fd0cf96210ac1b7533b0626e3a4ee05 100644 (file)
@@ -697,6 +697,9 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
            )
                return -EINVAL;
 
+       if ((hw->flags & IEEE80211_HW_SCAN_WHILE_IDLE) && !local->ops->hw_scan)
+               return -EINVAL;
+
        if (hw->max_report_rates == 0)
                hw->max_report_rates = hw->max_rates;