]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
iwlwifi: perform bss_info_changed post association work right away
authorReinette Chatre <reinette.chatre@intel.com>
Tue, 15 Apr 2008 04:16:13 +0000 (21:16 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 16 Apr 2008 19:59:59 +0000 (15:59 -0400)
Do not use workqueue for bss_info_changed post association work.
When driver is notified of association the upper layer will be notified
right after that the association is complete. Doing the post association
work in a workqueue introduces a race condition where the upper layer may
want to make use of the association, but it is not yet complete.

Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl4965-base.c

index 9fb985770fd29205228fa560bea1c32bf394ec39..1f343409c904155729e1c42d2e257a1b804a8188 100644 (file)
@@ -1840,7 +1840,7 @@ static void iwl4965_set_flags_for_phymode(struct iwl_priv *priv,
                      | RXON_FLG_CCK_MSK);
                priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
        } else {
-               /* Copied from iwl4965_bg_post_associate() */
+               /* Copied from iwl4965_post_associate() */
                if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
                        priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
                else
@@ -6004,10 +6004,8 @@ static void iwl4965_bg_rx_replenish(struct work_struct *data)
 
 #define IWL_DELAY_NEXT_SCAN (HZ*2)
 
-static void iwl4965_bg_post_associate(struct work_struct *data)
+static void iwl4965_post_associate(struct iwl_priv *priv)
 {
-       struct iwl_priv *priv = container_of(data, struct iwl_priv,
-                                            post_associate.work);
        struct ieee80211_conf *conf = NULL;
        int ret = 0;
        DECLARE_MAC_BUF(mac);
@@ -6025,12 +6023,10 @@ static void iwl4965_bg_post_associate(struct work_struct *data)
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
-       mutex_lock(&priv->mutex);
 
-       if (!priv->vif || !priv->is_open) {
-               mutex_unlock(&priv->mutex);
+       if (!priv->vif || !priv->is_open)
                return;
-       }
+
        iwl4965_scan_cancel_timeout(priv, 200);
 
        conf = ieee80211_get_hw_conf(priv->hw);
@@ -6114,7 +6110,18 @@ static void iwl4965_bg_post_associate(struct work_struct *data)
 
        /* we have just associated, don't start scan too early */
        priv->next_scan_jiffies = jiffies + IWL_DELAY_NEXT_SCAN;
+}
+
+
+static void iwl4965_bg_post_associate(struct work_struct *data)
+{
+       struct iwl_priv *priv = container_of(data, struct iwl_priv,
+                                            post_associate.work);
+
+       mutex_lock(&priv->mutex);
+       iwl4965_post_associate(priv);
        mutex_unlock(&priv->mutex);
+
 }
 
 static void iwl4965_bg_abort_scan(struct work_struct *work)
@@ -6736,6 +6743,10 @@ static void iwl4965_bss_info_changed(struct ieee80211_hw *hw,
 
        if (changes & BSS_CHANGED_ASSOC) {
                IWL_DEBUG_MAC80211("ASSOC %d\n", bss_conf->assoc);
+               /* This should never happen as this function should
+                * never be called from interrupt context. */
+               if (WARN_ON_ONCE(in_interrupt()))
+                       return;
                if (bss_conf->assoc) {
                        priv->assoc_id = bss_conf->aid;
                        priv->beacon_int = bss_conf->beacon_int;
@@ -6743,7 +6754,9 @@ static void iwl4965_bss_info_changed(struct ieee80211_hw *hw,
                        priv->assoc_capability = bss_conf->assoc_capability;
                        priv->next_scan_jiffies = jiffies +
                                        IWL_DELAY_NEXT_SCAN_AFTER_ASSOC;
-                       queue_work(priv->workqueue, &priv->post_associate.work);
+                       mutex_lock(&priv->mutex);
+                       iwl4965_post_associate(priv);
+                       mutex_unlock(&priv->mutex);
                } else {
                        priv->assoc_id = 0;
                        IWL_DEBUG_MAC80211("DISASSOC %d\n", bss_conf->assoc);