iwlwifi: mvm: Prevent setting assoc flag in MAC_CONTEXT_CMD
authorAlexander Bondar <alexander.bondar@intel.com>
Thu, 2 May 2013 13:34:48 +0000 (16:34 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 16 May 2013 20:39:06 +0000 (22:39 +0200)
In the normal flow first MAC_CONTEXT_CMD for particular interface is
never sent while associated. The exception is fw restart flow when
resuming from suspend when WoWLAN is enabled. In this case successive
"add" and "modify" MAC_CONTEXT_CMD commands may be sent with assoc flag
set what cause FW mal functioning. To prevent this never set assoc flag
in MAC_CONTEXT_CMD with action "add".

Cc: stable@vger.kernel.org
Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c

index e6eca4d66f6c8bf2b0b9ada40a6ca9fe9ab83ce4..b2cc3d98e0f7aa2e89b744b17cd706ed20268cc6 100644 (file)
@@ -586,10 +586,12 @@ static int iwl_mvm_mac_ctxt_send_cmd(struct iwl_mvm *mvm,
  */
 static void iwl_mvm_mac_ctxt_cmd_fill_sta(struct iwl_mvm *mvm,
                                          struct ieee80211_vif *vif,
-                                         struct iwl_mac_data_sta *ctxt_sta)
+                                         struct iwl_mac_data_sta *ctxt_sta,
+                                         bool force_assoc_off)
 {
        /* We need the dtim_period to set the MAC as associated */
-       if (vif->bss_conf.assoc && vif->bss_conf.dtim_period) {
+       if (vif->bss_conf.assoc && vif->bss_conf.dtim_period &&
+           !force_assoc_off) {
                u32 dtim_offs;
 
                /*
@@ -659,7 +661,8 @@ static int iwl_mvm_mac_ctxt_cmd_station(struct iwl_mvm *mvm,
                cmd.filter_flags &= ~cpu_to_le32(MAC_FILTER_IN_BEACON);
 
        /* Fill the data specific for station mode */
-       iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.sta);
+       iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.sta,
+                                     action == FW_CTXT_ACTION_ADD);
 
        return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
 }
@@ -677,7 +680,8 @@ static int iwl_mvm_mac_ctxt_cmd_p2p_client(struct iwl_mvm *mvm,
        iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action);
 
        /* Fill the data specific for station mode */
-       iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.p2p_sta.sta);
+       iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.p2p_sta.sta,
+                                     action == FW_CTXT_ACTION_ADD);
 
        cmd.p2p_sta.ctwin = cpu_to_le32(noa->oppps_ctwindow &
                                        IEEE80211_P2P_OPPPS_CTWINDOW_MASK);