aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-scan.c
diff options
context:
space:
mode:
authorAbhijeet Kolekar <abhijeet.kolekar@intel.com>2009-02-18 18:54:27 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-27 14:52:45 -0500
commite9dde6f6edf9954e2c75d2d738cae0f00e9b0fbc (patch)
tree2af59857d5f05d975c10006277f3011bfb9ab609 /drivers/net/wireless/iwlwifi/iwl-scan.c
parentcade0eb2c7c7b8df60ac54409592c1a23e3220c8 (diff)
iwl3945: use iwl_mac_hw_scan callback
3945 can use iwl_mac_hw_scan callback instead of iwl3945_mac_hw_scan callback. Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com> Acked-by: Samuel Ortiz <samuel.ortiz@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-scan.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 1ec2b20eb37c..23644cf884f1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -440,6 +440,74 @@ int iwl_scan_initiate(struct iwl_priv *priv)
440} 440}
441EXPORT_SYMBOL(iwl_scan_initiate); 441EXPORT_SYMBOL(iwl_scan_initiate);
442 442
443#define IWL_DELAY_NEXT_SCAN (HZ*2)
444
445int iwl_mac_hw_scan(struct ieee80211_hw *hw,
446 struct cfg80211_scan_request *req)
447{
448 unsigned long flags;
449 struct iwl_priv *priv = hw->priv;
450 int ret;
451 u8 *ssid = NULL;
452 size_t ssid_len = 0;
453
454 if (req->n_ssids) {
455 ssid = req->ssids[0].ssid;
456 ssid_len = req->ssids[0].ssid_len;
457 }
458
459 IWL_DEBUG_MAC80211(priv, "enter\n");
460
461 mutex_lock(&priv->mutex);
462 spin_lock_irqsave(&priv->lock, flags);
463
464 if (!iwl_is_ready_rf(priv)) {
465 ret = -EIO;
466 IWL_DEBUG_MAC80211(priv, "leave - not ready or exit pending\n");
467 goto out_unlock;
468 }
469
470 /* We don't schedule scan within next_scan_jiffies period.
471 * Avoid scanning during possible EAPOL exchange, return
472 * success immediately.
473 */
474 if (priv->next_scan_jiffies &&
475 time_after(priv->next_scan_jiffies, jiffies)) {
476 IWL_DEBUG_SCAN(priv, "scan rejected: within next scan period\n");
477 queue_work(priv->workqueue, &priv->scan_completed);
478 ret = 0;
479 goto out_unlock;
480 }
481
482 /* if we just finished scan ask for delay */
483 if (iwl_is_associated(priv) && priv->last_scan_jiffies &&
484 time_after(priv->last_scan_jiffies + IWL_DELAY_NEXT_SCAN, jiffies)) {
485 IWL_DEBUG_SCAN(priv, "scan rejected: within previous scan period\n");
486 queue_work(priv->workqueue, &priv->scan_completed);
487 ret = 0;
488 goto out_unlock;
489 }
490
491 if (ssid_len) {
492 priv->one_direct_scan = 1;
493 priv->direct_ssid_len = ssid_len;
494 memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len);
495 } else {
496 priv->one_direct_scan = 0;
497 }
498
499 ret = iwl_scan_initiate(priv);
500
501 IWL_DEBUG_MAC80211(priv, "leave\n");
502
503out_unlock:
504 spin_unlock_irqrestore(&priv->lock, flags);
505 mutex_unlock(&priv->mutex);
506
507 return ret;
508}
509EXPORT_SYMBOL(iwl_mac_hw_scan);
510
443#define IWL_SCAN_CHECK_WATCHDOG (7 * HZ) 511#define IWL_SCAN_CHECK_WATCHDOG (7 * HZ)
444 512
445void iwl_bg_scan_check(struct work_struct *data) 513void iwl_bg_scan_check(struct work_struct *data)