mac80211: remove IEEE80211_HW_SCAN_WHILE_IDLE
authorJohannes Berg <johannes.berg@intel.com>
Wed, 6 Feb 2013 22:57:57 +0000 (23:57 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 11 Feb 2013 17:45:01 +0000 (18:45 +0100)
There are only a few drivers that use HW scan, and
all of those don't need a non-idle transition before
starting the scan -- some don't even care about idle
at all. Remove the flag and code associated with it.

The only driver that really actually needed this is
wl1251 and it can just do it itself in the hw_scan
callback -- implement that.

Acked-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/iwlwifi/dvm/mac80211.c
drivers/net/wireless/iwlwifi/mvm/mac80211.c
drivers/net/wireless/ti/wl1251/event.c
drivers/net/wireless/ti/wl1251/main.c
drivers/net/wireless/ti/wlcore/main.c
include/net/mac80211.h
net/mac80211/debugfs.c
net/mac80211/iface.c
net/mac80211/main.c

index 75f6f6cfdd47024cbde5dde219d6bd5234fadf27..0fccf725a2e6e81e4cbba273dda99c784672087c 100644 (file)
@@ -151,8 +151,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
                    IEEE80211_HW_QUEUE_CONTROL |
                    IEEE80211_HW_SUPPORTS_PS |
                    IEEE80211_HW_SUPPORTS_DYNAMIC_PS |
-                   IEEE80211_HW_WANT_MONITOR_VIF |
-                   IEEE80211_HW_SCAN_WHILE_IDLE;
+                   IEEE80211_HW_WANT_MONITOR_VIF;
 
        hw->offchannel_tx_hw_queue = IWL_AUX_QUEUE;
        hw->radiotap_mcs_details |= IEEE80211_RADIOTAP_MCS_HAVE_FMT;
index ce6127caabdf87791dd41ca12e22d5adfe3bc3c0..bbb8a5b35662b29855e08baffd853158241ce723 100644 (file)
@@ -113,7 +113,6 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
                    IEEE80211_HW_REPORTS_TX_ACK_STATUS |
                    IEEE80211_HW_QUEUE_CONTROL |
                    IEEE80211_HW_WANT_MONITOR_VIF |
-                   IEEE80211_HW_SCAN_WHILE_IDLE |
                    IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC |
                    IEEE80211_HW_SUPPORTS_PS |
                    IEEE80211_HW_SUPPORTS_DYNAMIC_PS |
index 5ec50a476a69c084ccba378813db16fca7087db1..74ae8e1c2e334a3f61071209a2e9b6fd952014d4 100644 (file)
@@ -29,6 +29,8 @@
 static int wl1251_event_scan_complete(struct wl1251 *wl,
                                      struct event_mailbox *mbox)
 {
+       int ret = 0;
+
        wl1251_debug(DEBUG_EVENT, "status: 0x%x, channels: %d",
                     mbox->scheduled_scan_status,
                     mbox->scheduled_scan_channels);
@@ -37,9 +39,11 @@ static int wl1251_event_scan_complete(struct wl1251 *wl,
                ieee80211_scan_completed(wl->hw, false);
                wl1251_debug(DEBUG_MAC80211, "mac80211 hw scan completed");
                wl->scanning = false;
+               if (wl->hw->conf.flags & IEEE80211_CONF_IDLE)
+                       ret = wl1251_ps_set_mode(wl, STATION_IDLE);
        }
 
-       return 0;
+       return ret;
 }
 
 static void wl1251_event_mbox_dump(struct event_mailbox *mbox)
index f47e8b0482adcc5b49f344a897ff34d80814b71a..bbbf68cf50a754a121e4bd3015afe880c544fa79 100644 (file)
@@ -623,7 +623,7 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed)
                }
        }
 
-       if (changed & IEEE80211_CONF_CHANGE_IDLE) {
+       if (changed & IEEE80211_CONF_CHANGE_IDLE && !wl->scanning) {
                if (conf->flags & IEEE80211_CONF_IDLE) {
                        ret = wl1251_ps_set_mode(wl, STATION_IDLE);
                        if (ret < 0)
@@ -895,11 +895,21 @@ static int wl1251_op_hw_scan(struct ieee80211_hw *hw,
        if (ret < 0)
                goto out;
 
+       if (hw->conf.flags & IEEE80211_CONF_IDLE) {
+               ret = wl1251_ps_set_mode(wl, STATION_ACTIVE_MODE);
+               if (ret < 0)
+                       goto out_sleep;
+               ret = wl1251_join(wl, wl->bss_type, wl->channel,
+                                 wl->beacon_int, wl->dtim_period);
+               if (ret < 0)
+                       goto out_sleep;
+       }
+
        skb = ieee80211_probereq_get(wl->hw, wl->vif, ssid, ssid_len,
                                     req->ie_len);
        if (!skb) {
                ret = -ENOMEM;
-               goto out;
+               goto out_idle;
        }
        if (req->ie_len)
                memcpy(skb_put(skb, req->ie_len), req->ie, req->ie_len);
@@ -908,11 +918,11 @@ static int wl1251_op_hw_scan(struct ieee80211_hw *hw,
                                      skb->len);
        dev_kfree_skb(skb);
        if (ret < 0)
-               goto out_sleep;
+               goto out_idle;
 
        ret = wl1251_cmd_trigger_scan_to(wl, 0);
        if (ret < 0)
-               goto out_sleep;
+               goto out_idle;
 
        wl->scanning = true;
 
@@ -920,9 +930,13 @@ static int wl1251_op_hw_scan(struct ieee80211_hw *hw,
                              req->n_channels, WL1251_SCAN_NUM_PROBES);
        if (ret < 0) {
                wl->scanning = false;
-               goto out_sleep;
+               goto out_idle;
        }
+       goto out_sleep;
 
+out_idle:
+       if (hw->conf.flags & IEEE80211_CONF_IDLE)
+               ret = wl1251_ps_set_mode(wl, STATION_IDLE);
 out_sleep:
        wl1251_ps_elp_sleep(wl);
 
index 28a37576d568b7f273de571f7f3174d9badbd9fb..2c2ff3e1f849047de636a7ff6da4149b26380755 100644 (file)
@@ -5636,7 +5636,6 @@ static int wl1271_init_ieee80211(struct wl1271 *wl)
                IEEE80211_HW_AP_LINK_PS |
                IEEE80211_HW_AMPDU_AGGREGATION |
                IEEE80211_HW_TX_AMPDU_SETUP_IN_HW |
-               IEEE80211_HW_SCAN_WHILE_IDLE |
                IEEE80211_HW_QUEUE_CONTROL;
 
        wl->hw->wiphy->cipher_suites = cipher_suites;
index 8d25769b3259807c0ab14667e090df9405cf505d..86ad2c341525e628b9db80ea94a7e5f67fe1ad92 100644 (file)
@@ -1363,10 +1363,6 @@ struct ieee80211_tx_control {
  *     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).
- *
  * @IEEE80211_HW_WANT_MONITOR_VIF: The driver would like to be informed of
  *     a virtual monitor interface when monitor interfaces are the only
  *     active interfaces.
@@ -1408,7 +1404,6 @@ 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,
        IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF              = 1<<25,
        IEEE80211_HW_TIMING_BEACON_ONLY                 = 1<<26,
 };
index 8e6040998ba6e43b1eaabeb430bbec93239418b4..b0e32d6281146231061d34f63088db6b90106fc1 100644 (file)
@@ -151,8 +151,6 @@ 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 deb78e864af6a48ad4aadd27b47099a6ca9a3b7a..3ece8eb6d2df9af6924ee72b21156d52d152a359 100644 (file)
@@ -151,12 +151,8 @@ static u32 __ieee80211_recalc_idle(struct ieee80211_local *local)
                }
        }
 
-       sdata = rcu_dereference_protected(local->scan_sdata,
-                                         lockdep_is_held(&local->mtx));
-       if (sdata && !(local->hw.flags & IEEE80211_HW_SCAN_WHILE_IDLE)) {
-               scanning = true;
-               sdata->vif.bss_conf.idle = false;
-       }
+       scanning = test_bit(SCAN_SW_SCANNING, &local->scanning) ||
+                  test_bit(SCAN_ONCHANNEL_SCANNING, &local->scanning);
 
        list_for_each_entry(sdata, &local->interfaces, list) {
                if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||
index 2220331f4b7cb4c5f5858de72c4192306811c229..38b3468bc515dd0ab915910fe3bf1ffeb61be523 100644 (file)
@@ -696,9 +696,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
                return -EINVAL;
 #endif
 
-       if ((hw->flags & IEEE80211_HW_SCAN_WHILE_IDLE) && !local->ops->hw_scan)
-               return -EINVAL;
-
        if (!local->use_chanctx) {
                for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
                        const struct ieee80211_iface_combination *comb;