iwlwifi: don't pass iwl_rx_mem_buffer to upper layers
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / iwl-scan.c
index e5d727f537d08eb09080fa8170609771cb230b5b..28899dabe6fb5564f357448006390e91348808ce 100644 (file)
@@ -2,7 +2,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
+ * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -69,15 +69,14 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
        if (!test_bit(STATUS_READY, &priv->shrd->status) ||
            !test_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status) ||
            !test_bit(STATUS_SCAN_HW, &priv->shrd->status) ||
-           test_bit(STATUS_FW_ERROR, &priv->shrd->status) ||
-           test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+           test_bit(STATUS_FW_ERROR, &priv->shrd->status))
                return -EIO;
 
        ret = iwl_trans_send_cmd(trans(priv), &cmd);
        if (ret)
                return ret;
 
-       pkt = (struct iwl_rx_packet *)cmd.reply_page;
+       pkt = cmd.resp_pkt;
        if (pkt->u.status != CAN_ABORT_STATUS) {
                /* The scan abort will return 1 for success or
                 * 2 for "failure".  A failure condition can be
@@ -89,7 +88,7 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
                ret = -EIO;
        }
 
-       iwl_free_pages(priv->shrd, cmd.reply_page);
+       iwl_free_resp(&cmd);
        return ret;
 }
 
@@ -218,7 +217,7 @@ static void iwl_do_scan_abort(struct iwl_priv *priv)
 int iwl_scan_cancel(struct iwl_priv *priv)
 {
        IWL_DEBUG_SCAN(priv, "Queuing abort scan\n");
-       queue_work(priv->shrd->workqueue, &priv->abort_scan);
+       queue_work(priv->workqueue, &priv->abort_scan);
        return 0;
 }
 
@@ -261,7 +260,7 @@ void iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms)
 
 /* Service response to REPLY_SCAN_CMD (0x80) */
 static int iwl_rx_reply_scan(struct iwl_priv *priv,
-                             struct iwl_rx_mem_buffer *rxb,
+                             struct iwl_rx_cmd_buffer *rxb,
                              struct iwl_device_cmd *cmd)
 {
 #ifdef CONFIG_IWLWIFI_DEBUG
@@ -276,7 +275,7 @@ static int iwl_rx_reply_scan(struct iwl_priv *priv,
 
 /* Service SCAN_START_NOTIFICATION (0x82) */
 static int iwl_rx_scan_start_notif(struct iwl_priv *priv,
-                                   struct iwl_rx_mem_buffer *rxb,
+                                   struct iwl_rx_cmd_buffer *rxb,
                                    struct iwl_device_cmd *cmd)
 {
        struct iwl_rx_packet *pkt = rxb_addr(rxb);
@@ -303,7 +302,7 @@ static int iwl_rx_scan_start_notif(struct iwl_priv *priv,
 
 /* Service SCAN_RESULTS_NOTIFICATION (0x83) */
 static int iwl_rx_scan_results_notif(struct iwl_priv *priv,
-                                     struct iwl_rx_mem_buffer *rxb,
+                                     struct iwl_rx_cmd_buffer *rxb,
                                      struct iwl_device_cmd *cmd)
 {
 #ifdef CONFIG_IWLWIFI_DEBUG
@@ -329,7 +328,7 @@ static int iwl_rx_scan_results_notif(struct iwl_priv *priv,
 
 /* Service SCAN_COMPLETE_NOTIFICATION (0x84) */
 static int iwl_rx_scan_complete_notif(struct iwl_priv *priv,
-                                      struct iwl_rx_mem_buffer *rxb,
+                                      struct iwl_rx_cmd_buffer *rxb,
                                       struct iwl_device_cmd *cmd)
 {
        struct iwl_rx_packet *pkt = rxb_addr(rxb);
@@ -354,7 +353,7 @@ static int iwl_rx_scan_complete_notif(struct iwl_priv *priv,
         */
        set_bit(STATUS_SCAN_COMPLETE, &priv->shrd->status);
        clear_bit(STATUS_SCAN_HW, &priv->shrd->status);
-       queue_work(priv->shrd->workqueue, &priv->scan_completed);
+       queue_work(priv->workqueue, &priv->scan_completed);
 
        if (priv->iw_mode != NL80211_IFTYPE_ADHOC &&
            iwl_advanced_bt_coexist(priv) &&
@@ -374,7 +373,7 @@ static int iwl_rx_scan_complete_notif(struct iwl_priv *priv,
                                IWL_BT_COEX_TRAFFIC_LOAD_NONE;
                }
                priv->bt_status = scan_notif->bt_status;
-               queue_work(priv->shrd->workqueue,
+               queue_work(priv->workqueue,
                           &priv->bt_traffic_change_work);
        }
        return 0;
@@ -414,8 +413,25 @@ static u16 iwl_limit_dwell(struct iwl_priv *priv, u16 dwell_time)
        for_each_context(priv, ctx) {
                u16 value;
 
-               if (!iwl_is_associated_ctx(ctx))
+               switch (ctx->staging.dev_type) {
+               case RXON_DEV_TYPE_P2P:
+                       /* no timing constraints */
                        continue;
+               case RXON_DEV_TYPE_ESS:
+               default:
+                       /* timing constraints if associated */
+                       if (!iwl_is_associated_ctx(ctx))
+                               continue;
+                       break;
+               case RXON_DEV_TYPE_CP:
+               case RXON_DEV_TYPE_2STA:
+                       /*
+                        * These seem to always have timers for TBTT
+                        * active in uCode even when not associated yet.
+                        */
+                       break;
+               }
+
                value = ctx->beacon_int;
                if (!value)
                        value = IWL_PASSIVE_DWELL_BASE;
@@ -567,7 +583,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
        struct iwl_scan_cmd *scan;
        struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
        u32 rate_flags = 0;
-       u16 cmd_len;
+       u16 cmd_len = 0;
        u16 rx_chain = 0;
        enum ieee80211_band band;
        u8 n_probes = 0;
@@ -678,7 +694,8 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
                        priv->contexts[IWL_RXON_CTX_BSS].active.flags &
                                                RXON_FLG_CHANNEL_MODE_MSK)
                                       >> RXON_FLG_CHANNEL_MODE_POS;
-               if (chan_mod == CHANNEL_MODE_PURE_40) {
+               if ((priv->scan_request && priv->scan_request->no_cck) ||
+                   chan_mod == CHANNEL_MODE_PURE_40) {
                        rate = IWL_RATE_6M_PLCP;
                } else {
                        rate = IWL_RATE_1M_PLCP;
@@ -688,8 +705,8 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
                 * Internal scans are passive, so we can indiscriminately set
                 * the BT ignore flag on 2.4 GHz since it applies to TX only.
                 */
-               if (priv->cfg->bt_params &&
-                   priv->cfg->bt_params->advanced_bt_coexist)
+               if (cfg(priv)->bt_params &&
+                   cfg(priv)->bt_params->advanced_bt_coexist)
                        scan->tx_cmd.tx_flags |= TX_CMD_FLG_IGNORE_BT;
                break;
        case IEEE80211_BAND_5GHZ:
@@ -730,12 +747,12 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
 
        band = priv->scan_band;
 
-       if (priv->cfg->scan_rx_antennas[band])
-               rx_ant = priv->cfg->scan_rx_antennas[band];
+       if (cfg(priv)->scan_rx_antennas[band])
+               rx_ant = cfg(priv)->scan_rx_antennas[band];
 
        if (band == IEEE80211_BAND_2GHZ &&
-           priv->cfg->bt_params &&
-           priv->cfg->bt_params->advanced_bt_coexist) {
+           cfg(priv)->bt_params &&
+           cfg(priv)->bt_params->advanced_bt_coexist) {
                /* transmit 2.4 GHz probes only on first antenna */
                scan_tx_antennas = first_antenna(scan_tx_antennas);
        }
@@ -759,8 +776,8 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
 
                rx_ant = first_antenna(active_chains);
        }
-       if (priv->cfg->bt_params &&
-           priv->cfg->bt_params->advanced_bt_coexist &&
+       if (cfg(priv)->bt_params &&
+           cfg(priv)->bt_params->advanced_bt_coexist &&
            priv->bt_full_concurrent) {
                /* operated as 1x1 in full concurrency mode */
                rx_ant = first_antenna(rx_ant);
@@ -932,57 +949,12 @@ int __must_check iwl_scan_initiate(struct iwl_priv *priv,
                return ret;
        }
 
-       queue_delayed_work(priv->shrd->workqueue, &priv->scan_check,
+       queue_delayed_work(priv->workqueue, &priv->scan_check,
                           IWL_SCAN_CHECK_WATCHDOG);
 
        return 0;
 }
 
-int iwlagn_mac_hw_scan(struct ieee80211_hw *hw,
-                   struct ieee80211_vif *vif,
-                   struct cfg80211_scan_request *req)
-{
-       struct iwl_priv *priv = hw->priv;
-       int ret;
-
-       IWL_DEBUG_MAC80211(priv, "enter\n");
-
-       if (req->n_channels == 0)
-               return -EINVAL;
-
-       mutex_lock(&priv->shrd->mutex);
-
-       /*
-        * If an internal scan is in progress, just set
-        * up the scan_request as per above.
-        */
-       if (priv->scan_type != IWL_SCAN_NORMAL) {
-               IWL_DEBUG_SCAN(priv,
-                              "SCAN request during internal scan - defer\n");
-               priv->scan_request = req;
-               priv->scan_vif = vif;
-               ret = 0;
-       } else {
-               priv->scan_request = req;
-               priv->scan_vif = vif;
-               /*
-                * mac80211 will only ask for one band at a time
-                * so using channels[0] here is ok
-                */
-               ret = iwl_scan_initiate(priv, vif, IWL_SCAN_NORMAL,
-                                       req->channels[0]->band);
-               if (ret) {
-                       priv->scan_request = NULL;
-                       priv->scan_vif = NULL;
-               }
-       }
-
-       IWL_DEBUG_MAC80211(priv, "leave\n");
-
-       mutex_unlock(&priv->shrd->mutex);
-
-       return ret;
-}
 
 /*
  * internal short scan, this function should only been called while associated.
@@ -990,7 +962,7 @@ int iwlagn_mac_hw_scan(struct ieee80211_hw *hw,
  */
 void iwl_internal_short_hw_scan(struct iwl_priv *priv)
 {
-       queue_work(priv->shrd->workqueue, &priv->start_internal_scan);
+       queue_work(priv->workqueue, &priv->start_internal_scan);
 }
 
 static void iwl_bg_start_internal_scan(struct work_struct *work)
This page took 0.031443 seconds and 5 git commands to generate.