iwlwifi: mvm: set BT-coex high priority for 802.1X/4-way-HS
authorJohannes Berg <johannes.berg@intel.com>
Sun, 17 Oct 2021 13:59:49 +0000 (16:59 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 22 Oct 2021 07:49:04 +0000 (10:49 +0300)
Set BT coex high priority during the 802.1X handshake to avoid
issues where BT is active enough to kill all the big negotiation
frames that we may need to send (e.g. with a large certificate),
leading to the connection not being established correctly. Give
WiFi priority over BT during this short but critical phase.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211017165728.a1825bbba397.I10315577fb41dfcec15c92e8f6785d9655f74c6a@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/api/mac.h
drivers/net/wireless/intel/iwlwifi/fw/file.h
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h

index 7be7715b431dfd82595ac3490545048b38487ec8..11f0bd283e499f3599537a1d0c7605f4303375c2 100644 (file)
@@ -138,6 +138,8 @@ struct iwl_mac_data_ibss {
  * @FLEXIBLE_TWT_SUPPORTED: AP supports flexible TWT schedule
  * @PROTECTED_TWT_SUPPORTED: AP supports protected TWT frames (with 11w)
  * @BROADCAST_TWT_SUPPORTED: AP and STA support broadcast TWT
+ * @COEX_HIGH_PRIORITY_ENABLE: high priority mode for BT coex, to be used
+ *     during 802.1X negotiation (and allowed during 4-way-HS)
  */
 enum iwl_mac_data_policy {
        TWT_SUPPORTED = BIT(0),
@@ -145,6 +147,7 @@ enum iwl_mac_data_policy {
        FLEXIBLE_TWT_SUPPORTED = BIT(2),
        PROTECTED_TWT_SUPPORTED = BIT(3),
        BROADCAST_TWT_SUPPORTED = BIT(4),
+       COEX_HIGH_PRIORITY_ENABLE = BIT(5),
 };
 
 /**
index c65196daf55b3a77561f32ca7e3de921aca0ae80..565918054ed1918d4d35c54bd1f8edad998240cc 100644 (file)
@@ -420,6 +420,7 @@ enum iwl_ucode_tlv_capa {
        IWL_UCODE_TLV_CAPA_PASSIVE_6GHZ_SCAN            = (__force iwl_ucode_tlv_capa_t)58,
        IWL_UCODE_TLV_CAPA_HIDDEN_6GHZ_SCAN             = (__force iwl_ucode_tlv_capa_t)59,
        IWL_UCODE_TLV_CAPA_BROADCAST_TWT                = (__force iwl_ucode_tlv_capa_t)60,
+       IWL_UCODE_TLV_CAPA_COEX_HIGH_PRIO               = (__force iwl_ucode_tlv_capa_t)61,
 
        /* set 2 */
        IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE         = (__force iwl_ucode_tlv_capa_t)64,
index e31d81a4033991d237867c98fe7a6c62ce4546d9..cfb69e49a687aada5fb2e777adccaee9dc501f4b 100644 (file)
@@ -604,6 +604,12 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm,
 
                ctxt_sta->is_assoc = cpu_to_le32(1);
 
+               if (!mvmvif->authorized &&
+                   fw_has_capa(&mvm->fw->ucode_capa,
+                               IWL_UCODE_TLV_CAPA_COEX_HIGH_PRIO))
+                       ctxt_sta->data_policy |=
+                               cpu_to_le32(COEX_HIGH_PRIORITY_ENABLE);
+
                /*
                 * allow multicast data frames only as long as the station is
                 * authorized, i.e., GTK keys are already installed (if needed)
index adca7c78b815c847b20e5abc6f0dd1b0e5eb024c..5277f63dac3d262efdb09e279dc25a818c5f80b1 100644 (file)
@@ -3201,6 +3201,8 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
                        /* enable beacon filtering */
                        WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0));
 
+                       mvmvif->authorized = 1;
+
                        /*
                         * Now that the station is authorized, i.e., keys were already
                         * installed, need to indicate to the FW that
@@ -3217,6 +3219,12 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
                        /* Multicast data frames are no longer allowed */
                        iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL);
 
+                       /*
+                        * Set this after the above iwl_mvm_mac_ctxt_changed()
+                        * to avoid sending high prio again for a little time.
+                        */
+                       mvmvif->authorized = 0;
+
                        /* disable beacon filtering */
                        ret = iwl_mvm_disable_beacon_filter(mvm, vif, 0);
                        WARN_ON(ret &&
index cc11961b0d83fb80f76952f811c10f56f1af0bc0..4277536e31c3a003e7e30f588cfc08cbc88b34c5 100644 (file)
@@ -297,6 +297,7 @@ struct iwl_probe_resp_data {
  *     see enum &iwl_mvm_low_latency_cause for causes.
  * @low_latency_actual: boolean, indicates low latency is set,
  *     as a result from low_latency bit flags and takes force into account.
+ * @authorized: indicates the AP station was set to authorized
  * @ps_disabled: indicates that this interface requires PS to be disabled
  * @queue_params: QoS params for this MAC
  * @bcast_sta: station used for broadcast packets. Used by the following
@@ -330,6 +331,7 @@ struct iwl_mvm_vif {
        bool monitor_active;
        u8 low_latency: 6;
        u8 low_latency_actual: 1;
+       u8 authorized:1;
        bool ps_disabled;
        struct iwl_mvm_vif_bf_data bf_data;