Commit b6e4c55a authored by Johannes Berg's avatar Johannes Berg Committed by Reinette Chatre

iwlwifi: trigger scan synchronously

Scan requesting doesn't need to be asynchronous
since all code paths leading up to it can sleep.
Make the scan request a new util operation that
is hw-specific (to account for 3945 vs. agn)
and call it right in place.

This patch moves a lot of code into iwlagn as
it need not be in iwlcore.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
parent 811ecc99
...@@ -2740,6 +2740,7 @@ static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = { ...@@ -2740,6 +2740,7 @@ static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = {
.get_hcmd_size = iwl3945_get_hcmd_size, .get_hcmd_size = iwl3945_get_hcmd_size,
.build_addsta_hcmd = iwl3945_build_addsta_hcmd, .build_addsta_hcmd = iwl3945_build_addsta_hcmd,
.rts_tx_cmd_flag = iwlcore_rts_tx_cmd_flag, .rts_tx_cmd_flag = iwlcore_rts_tx_cmd_flag,
.request_scan = iwl3945_request_scan,
}; };
static const struct iwl_ops iwl3945_ops = { static const struct iwl_ops iwl3945_ops = {
......
...@@ -294,6 +294,9 @@ extern const struct iwl_channel_info *iwl3945_get_channel_info( ...@@ -294,6 +294,9 @@ extern const struct iwl_channel_info *iwl3945_get_channel_info(
extern int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate); extern int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate);
/* scanning */
void iwl3945_request_scan(struct iwl_priv *priv);
/* Requires full declaration of iwl_priv before including */ /* Requires full declaration of iwl_priv before including */
#include "iwl-io.h" #include "iwl-io.h"
......
...@@ -2162,6 +2162,7 @@ static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = { ...@@ -2162,6 +2162,7 @@ static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = {
.gain_computation = iwl4965_gain_computation, .gain_computation = iwl4965_gain_computation,
.rts_tx_cmd_flag = iwlcore_rts_tx_cmd_flag, .rts_tx_cmd_flag = iwlcore_rts_tx_cmd_flag,
.calc_rssi = iwl4965_calc_rssi, .calc_rssi = iwl4965_calc_rssi,
.request_scan = iwlagn_request_scan,
}; };
static struct iwl_lib_ops iwl4965_lib = { static struct iwl_lib_ops iwl4965_lib = {
......
...@@ -271,4 +271,5 @@ struct iwl_hcmd_utils_ops iwlagn_hcmd_utils = { ...@@ -271,4 +271,5 @@ struct iwl_hcmd_utils_ops iwlagn_hcmd_utils = {
.chain_noise_reset = iwlagn_chain_noise_reset, .chain_noise_reset = iwlagn_chain_noise_reset,
.rts_tx_cmd_flag = iwlagn_rts_tx_cmd_flag, .rts_tx_cmd_flag = iwlagn_rts_tx_cmd_flag,
.calc_rssi = iwlagn_calc_rssi, .calc_rssi = iwlagn_calc_rssi,
.request_scan = iwlagn_request_scan,
}; };
This diff is collapsed.
...@@ -171,4 +171,7 @@ static inline bool iwl_is_tx_success(u32 status) ...@@ -171,4 +171,7 @@ static inline bool iwl_is_tx_success(u32 status)
(status == TX_STATUS_DIRECT_DONE); (status == TX_STATUS_DIRECT_DONE);
} }
/* scan */
void iwlagn_request_scan(struct iwl_priv *priv);
#endif /* __iwl_agn_h__ */ #endif /* __iwl_agn_h__ */
...@@ -105,6 +105,7 @@ struct iwl_hcmd_utils_ops { ...@@ -105,6 +105,7 @@ struct iwl_hcmd_utils_ops {
__le32 *tx_flags); __le32 *tx_flags);
int (*calc_rssi)(struct iwl_priv *priv, int (*calc_rssi)(struct iwl_priv *priv,
struct iwl_rx_phy_res *rx_resp); struct iwl_rx_phy_res *rx_resp);
void (*request_scan)(struct iwl_priv *priv);
}; };
struct iwl_apm_ops { struct iwl_apm_ops {
...@@ -526,6 +527,7 @@ void iwl_setup_scan_deferred_work(struct iwl_priv *priv); ...@@ -526,6 +527,7 @@ void iwl_setup_scan_deferred_work(struct iwl_priv *priv);
#define IWL_ACTIVE_QUIET_TIME cpu_to_le16(10) /* msec */ #define IWL_ACTIVE_QUIET_TIME cpu_to_le16(10) /* msec */
#define IWL_PLCP_QUIET_THRESH cpu_to_le16(1) /* packets */ #define IWL_PLCP_QUIET_THRESH cpu_to_le16(1) /* packets */
#define IWL_SCAN_CHECK_WATCHDOG (HZ * 7)
/******************************************************************************* /*******************************************************************************
* Calibrations - implemented in iwl-calib.c * Calibrations - implemented in iwl-calib.c
......
...@@ -1257,7 +1257,6 @@ struct iwl_priv { ...@@ -1257,7 +1257,6 @@ struct iwl_priv {
struct work_struct scan_completed; struct work_struct scan_completed;
struct work_struct rx_replenish; struct work_struct rx_replenish;
struct work_struct abort_scan; struct work_struct abort_scan;
struct work_struct request_scan;
struct work_struct beacon_update; struct work_struct beacon_update;
struct work_struct tt_work; struct work_struct tt_work;
struct work_struct ct_enter; struct work_struct ct_enter;
......
This diff is collapsed.
...@@ -2790,11 +2790,8 @@ static void iwl3945_rfkill_poll(struct work_struct *data) ...@@ -2790,11 +2790,8 @@ static void iwl3945_rfkill_poll(struct work_struct *data)
} }
#define IWL_SCAN_CHECK_WATCHDOG (7 * HZ) void iwl3945_request_scan(struct iwl_priv *priv)
static void iwl3945_bg_request_scan(struct work_struct *data)
{ {
struct iwl_priv *priv =
container_of(data, struct iwl_priv, request_scan);
struct iwl_host_cmd cmd = { struct iwl_host_cmd cmd = {
.id = REPLY_SCAN_CMD, .id = REPLY_SCAN_CMD,
.len = sizeof(struct iwl3945_scan_cmd), .len = sizeof(struct iwl3945_scan_cmd),
...@@ -2808,8 +2805,6 @@ static void iwl3945_bg_request_scan(struct work_struct *data) ...@@ -2808,8 +2805,6 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
conf = ieee80211_get_hw_conf(priv->hw); conf = ieee80211_get_hw_conf(priv->hw);
mutex_lock(&priv->mutex);
cancel_delayed_work(&priv->scan_check); cancel_delayed_work(&priv->scan_check);
if (!iwl_is_ready(priv)) { if (!iwl_is_ready(priv)) {
...@@ -2992,7 +2987,6 @@ static void iwl3945_bg_request_scan(struct work_struct *data) ...@@ -2992,7 +2987,6 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
queue_delayed_work(priv->workqueue, &priv->scan_check, queue_delayed_work(priv->workqueue, &priv->scan_check,
IWL_SCAN_CHECK_WATCHDOG); IWL_SCAN_CHECK_WATCHDOG);
mutex_unlock(&priv->mutex);
return; return;
done: done:
...@@ -3006,7 +3000,6 @@ static void iwl3945_bg_request_scan(struct work_struct *data) ...@@ -3006,7 +3000,6 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
/* inform mac80211 scan aborted */ /* inform mac80211 scan aborted */
queue_work(priv->workqueue, &priv->scan_completed); queue_work(priv->workqueue, &priv->scan_completed);
mutex_unlock(&priv->mutex);
} }
static void iwl3945_bg_restart(struct work_struct *data) static void iwl3945_bg_restart(struct work_struct *data)
...@@ -3785,7 +3778,6 @@ static void iwl3945_setup_deferred_work(struct iwl_priv *priv) ...@@ -3785,7 +3778,6 @@ static void iwl3945_setup_deferred_work(struct iwl_priv *priv)
INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start); INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start);
INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, iwl3945_rfkill_poll); INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, iwl3945_rfkill_poll);
INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed);
INIT_WORK(&priv->request_scan, iwl3945_bg_request_scan);
INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan);
INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check); INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment