iwlwifi: mvm: don't send a CSA command the firmware doesn't know
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Thu, 8 Oct 2020 15:12:40 +0000 (18:12 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 8 Oct 2020 17:14:50 +0000 (20:14 +0300)
We introduced a new flow to remove an on-going CSA but we
assumed the firwmare understands the
CHANNEL_SWITCH_TIME_EVENT_CMD. This is not true for 7265 and down.

Don't send this command for those devices, but rather use the older
command.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/iwlwifi.20201008181047.2574e3e47927.Ic0c56411da1096e9a45ee5c3383edf777c5baca0@changeid
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
drivers/net/wireless/intel/iwlwifi/mvm/time-event.c
drivers/net/wireless/intel/iwlwifi/mvm/time-event.h

index 27b2a68..688c112 100644 (file)
@@ -1409,10 +1409,14 @@ static void iwl_mvm_abort_channel_switch(struct ieee80211_hw *hw,
        IWL_DEBUG_MAC80211(mvm, "Abort CSA on mac %d\n", mvmvif->id);
 
        mutex_lock(&mvm->mutex);
-       WARN_ON(iwl_mvm_send_cmd_pdu(mvm,
-                                    WIDE_ID(MAC_CONF_GROUP,
-                                            CHANNEL_SWITCH_TIME_EVENT_CMD),
-                                    0, sizeof(cmd), &cmd));
+       if (!fw_has_capa(&mvm->fw->ucode_capa,
+                        IWL_UCODE_TLV_CAPA_CHANNEL_SWITCH_CMD))
+               iwl_mvm_remove_csa_period(mvm, vif);
+       else
+               WARN_ON(iwl_mvm_send_cmd_pdu(mvm,
+                                            WIDE_ID(MAC_CONF_GROUP,
+                                                    CHANNEL_SWITCH_TIME_EVENT_CMD),
+                                            0, sizeof(cmd), &cmd));
        mutex_unlock(&mvm->mutex);
 
        WARN_ON(iwl_mvm_post_channel_switch(hw, vif));
index 7ad6c9a..7fce79c 100644 (file)
@@ -1016,6 +1016,28 @@ void iwl_mvm_stop_roc(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
        iwl_mvm_roc_finished(mvm);
 }
 
+void iwl_mvm_remove_csa_period(struct iwl_mvm *mvm,
+                              struct ieee80211_vif *vif)
+{
+       struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
+       struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data;
+       u32 id;
+
+       lockdep_assert_held(&mvm->mutex);
+
+       if (!te_data->running)
+               return;
+
+       spin_lock_bh(&mvm->time_event_lock);
+       id = te_data->id;
+       spin_unlock_bh(&mvm->time_event_lock);
+
+       if (id != TE_CHANNEL_SWITCH_PERIOD)
+               return;
+
+       iwl_mvm_remove_time_event(mvm, mvmvif, te_data);
+}
+
 int iwl_mvm_schedule_csa_period(struct iwl_mvm *mvm,
                                struct ieee80211_vif *vif,
                                u32 duration, u32 apply_time)
index 3186d7e..b6bac77 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
- * Copyright (C) 2019 Intel Corporation
+ * Copyright (C) 2019 - 2020 Intel Corporation
  *
  * 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
@@ -29,7 +29,7 @@
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
- * Copyright (C) 2019 Intel Corporation
+ * Copyright (C) 2019 - 2020 Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -216,6 +216,9 @@ void iwl_mvm_te_clear_data(struct iwl_mvm *mvm,
 void iwl_mvm_cleanup_roc_te(struct iwl_mvm *mvm);
 void iwl_mvm_roc_done_wk(struct work_struct *wk);
 
+void iwl_mvm_remove_csa_period(struct iwl_mvm *mvm,
+                              struct ieee80211_vif *vif);
+
 /**
  * iwl_mvm_schedule_csa_period - request channel switch absence period
  * @mvm: the mvm component