iwlwifi: rewrite scan completion
Assure (partially) we call ieee80211_scan_completed() only once when scan was requested from mac80211. Code path that first clear STATUS_SCANNING bit is responsible to call ieee80211_scan_completed(). Before the call, we check if mac80211 really request the scan. Still persist some cases when we behave wrong, that will be addressed in the next patches. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Acked-by: Wey-Yi W Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
committed by
John W. Linville
parent
e693a802f0
commit
02d8c14b59
@@ -93,6 +93,19 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void iwl_complete_scan(struct iwl_priv *priv, bool aborted)
|
||||||
|
{
|
||||||
|
/* check if scan was requested from mac80211 */
|
||||||
|
if (priv->scan_request) {
|
||||||
|
IWL_DEBUG_SCAN(priv, "Complete scan in mac80211\n");
|
||||||
|
ieee80211_scan_completed(priv->hw, aborted);
|
||||||
|
}
|
||||||
|
|
||||||
|
priv->is_internal_short_scan = false;
|
||||||
|
priv->scan_vif = NULL;
|
||||||
|
priv->scan_request = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void iwl_do_scan_abort(struct iwl_priv *priv)
|
static void iwl_do_scan_abort(struct iwl_priv *priv)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@@ -115,7 +128,7 @@ static void iwl_do_scan_abort(struct iwl_priv *priv)
|
|||||||
clear_bit(STATUS_SCANNING, &priv->status);
|
clear_bit(STATUS_SCANNING, &priv->status);
|
||||||
clear_bit(STATUS_SCAN_HW, &priv->status);
|
clear_bit(STATUS_SCAN_HW, &priv->status);
|
||||||
clear_bit(STATUS_SCAN_ABORTING, &priv->status);
|
clear_bit(STATUS_SCAN_ABORTING, &priv->status);
|
||||||
ieee80211_scan_completed(priv->hw, true);
|
iwl_complete_scan(priv, true);
|
||||||
} else
|
} else
|
||||||
IWL_DEBUG_SCAN(priv, "Sucessfully send scan abort\n");
|
IWL_DEBUG_SCAN(priv, "Sucessfully send scan abort\n");
|
||||||
}
|
}
|
||||||
@@ -545,10 +558,11 @@ static void iwl_bg_scan_completed(struct work_struct *work)
|
|||||||
{
|
{
|
||||||
struct iwl_priv *priv =
|
struct iwl_priv *priv =
|
||||||
container_of(work, struct iwl_priv, scan_completed);
|
container_of(work, struct iwl_priv, scan_completed);
|
||||||
bool internal = false, aborted;
|
bool aborted;
|
||||||
struct iwl_rxon_context *ctx;
|
struct iwl_rxon_context *ctx;
|
||||||
|
|
||||||
IWL_DEBUG_SCAN(priv, "SCAN complete scan\n");
|
IWL_DEBUG_INFO(priv, "Completed %sscan.\n",
|
||||||
|
priv->is_internal_short_scan ? "internal short " : "");
|
||||||
|
|
||||||
cancel_delayed_work(&priv->scan_check);
|
cancel_delayed_work(&priv->scan_check);
|
||||||
|
|
||||||
@@ -558,37 +572,38 @@ static void iwl_bg_scan_completed(struct work_struct *work)
|
|||||||
if (aborted)
|
if (aborted)
|
||||||
IWL_DEBUG_INFO(priv, "Aborted scan completed.\n");
|
IWL_DEBUG_INFO(priv, "Aborted scan completed.\n");
|
||||||
|
|
||||||
IWL_DEBUG_INFO(priv, "Setting scan to off\n");
|
if (!test_and_clear_bit(STATUS_SCANNING, &priv->status)) {
|
||||||
|
IWL_DEBUG_INFO(priv, "Scan already completed.\n");
|
||||||
clear_bit(STATUS_SCANNING, &priv->status);
|
goto out;
|
||||||
|
|
||||||
if (priv->is_internal_short_scan) {
|
|
||||||
priv->is_internal_short_scan = false;
|
|
||||||
IWL_DEBUG_SCAN(priv, "internal short scan completed\n");
|
|
||||||
internal = true;
|
|
||||||
} else if (priv->scan_request) {
|
|
||||||
priv->scan_request = NULL;
|
|
||||||
priv->scan_vif = NULL;
|
|
||||||
ieee80211_scan_completed(priv->hw, aborted);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test_bit(STATUS_EXIT_PENDING, &priv->status))
|
if (priv->is_internal_short_scan && !aborted) {
|
||||||
goto out;
|
int err;
|
||||||
|
|
||||||
if (internal && priv->scan_request) {
|
/* Check if mac80211 requested scan during our internal scan */
|
||||||
int err = iwl_scan_initiate(priv, priv->scan_vif, false,
|
if (priv->scan_request == NULL)
|
||||||
|
goto out_complete;
|
||||||
|
|
||||||
|
/* If so request a new scan */
|
||||||
|
err = iwl_scan_initiate(priv, priv->scan_vif, false,
|
||||||
priv->scan_request->channels[0]->band);
|
priv->scan_request->channels[0]->band);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
IWL_DEBUG_SCAN(priv,
|
IWL_DEBUG_SCAN(priv,
|
||||||
"failed to initiate pending scan: %d\n", err);
|
"failed to initiate pending scan: %d\n", err);
|
||||||
priv->scan_request = NULL;
|
aborted = true;
|
||||||
priv->scan_vif = NULL;
|
goto out_complete;
|
||||||
ieee80211_scan_completed(priv->hw, true);
|
}
|
||||||
} else
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out_complete:
|
||||||
|
iwl_complete_scan(priv, aborted);
|
||||||
|
|
||||||
|
/* Can we still talk to firmware ? */
|
||||||
|
if (!iwl_is_ready_rf(priv))
|
||||||
|
goto out;
|
||||||
|
|
||||||
/* Since setting the TXPOWER may have been deferred while
|
/* Since setting the TXPOWER may have been deferred while
|
||||||
* performing the scan, fire one off */
|
* performing the scan, fire one off */
|
||||||
iwl_set_tx_power(priv, priv->tx_power_user_lmt, true);
|
iwl_set_tx_power(priv, priv->tx_power_user_lmt, true);
|
||||||
|
Reference in New Issue
Block a user