]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blobdiff - drivers/net/wireless/ath/ath11k/wmi.c
ath11k: put hw to DBS using WMI_PDEV_SET_HW_MODE_CMDID
[mirror_ubuntu-hirsute-kernel.git] / drivers / net / wireless / ath / ath11k / wmi.c
index f6f726979710c58dac913896d80bcda2f015b2bc..79b7f991c61217b80a048dc4a952f598f7b56fdb 100644 (file)
@@ -1688,7 +1688,8 @@ int ath11k_wmi_vdev_install_key(struct ath11k *ar,
 
 static inline void
 ath11k_wmi_copy_peer_flags(struct wmi_peer_assoc_complete_cmd *cmd,
-                          struct peer_assoc_params *param)
+                          struct peer_assoc_params *param,
+                          bool hw_crypto_disabled)
 {
        cmd->peer_flags = 0;
 
@@ -1742,7 +1743,8 @@ ath11k_wmi_copy_peer_flags(struct wmi_peer_assoc_complete_cmd *cmd,
                cmd->peer_flags |= WMI_PEER_AUTH;
        if (param->need_ptk_4_way) {
                cmd->peer_flags |= WMI_PEER_NEED_PTK_4_WAY;
-               cmd->peer_flags &= ~WMI_PEER_AUTH;
+               if (!hw_crypto_disabled)
+                       cmd->peer_flags &= ~WMI_PEER_AUTH;
        }
        if (param->need_gtk_2_way)
                cmd->peer_flags |= WMI_PEER_NEED_GTK_2_WAY;
@@ -1809,7 +1811,9 @@ int ath11k_wmi_send_peer_assoc_cmd(struct ath11k *ar,
        cmd->peer_new_assoc = param->peer_new_assoc;
        cmd->peer_associd = param->peer_associd;
 
-       ath11k_wmi_copy_peer_flags(cmd, param);
+       ath11k_wmi_copy_peer_flags(cmd, param,
+                                  test_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED,
+                                           &ar->ab->dev_flags));
 
        ether_addr_copy(cmd->peer_macaddr.addr, param->peer_mac);
 
@@ -3475,6 +3479,35 @@ int ath11k_wmi_wait_for_unified_ready(struct ath11k_base *ab)
        return 0;
 }
 
+int ath11k_wmi_set_hw_mode(struct ath11k_base *ab,
+                          enum wmi_host_hw_mode_config_type mode)
+{
+       struct wmi_pdev_set_hw_mode_cmd_param *cmd;
+       struct sk_buff *skb;
+       struct ath11k_wmi_base *wmi_ab = &ab->wmi_ab;
+       int len;
+       int ret;
+
+       len = sizeof(*cmd);
+
+       skb = ath11k_wmi_alloc_skb(wmi_ab, len);
+       cmd = (struct wmi_pdev_set_hw_mode_cmd_param *)skb->data;
+
+       cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_PDEV_SET_HW_MODE_CMD) |
+                         FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE);
+
+       cmd->pdev_id = WMI_PDEV_ID_SOC;
+       cmd->hw_mode_index = mode;
+
+       ret = ath11k_wmi_cmd_send(&wmi_ab->wmi[0], skb, WMI_PDEV_SET_HW_MODE_CMDID);
+       if (ret) {
+               ath11k_warn(ab, "failed to send WMI_PDEV_SET_HW_MODE_CMDID\n");
+               dev_kfree_skb(skb);
+       }
+
+       return ret;
+}
+
 int ath11k_wmi_cmd_init(struct ath11k_base *ab)
 {
        struct ath11k_wmi_base *wmi_sc = &ab->wmi_ab;
@@ -3493,10 +3526,11 @@ int ath11k_wmi_cmd_init(struct ath11k_base *ab)
        init_param.hw_mode_id = wmi_sc->preferred_hw_mode;
        init_param.mem_chunks = wmi_sc->mem_chunks;
 
-       if (ab->hw_params.needs_band_to_mac) {
-               init_param.num_band_to_mac = ab->num_radios;
-               ath11k_fill_band_to_mac_param(ab, init_param.band_to_mac);
-       }
+       if (ab->hw_params.single_pdev_only)
+               init_param.hw_mode_id = WMI_HOST_HW_MODE_MAX;
+
+       init_param.num_band_to_mac = ab->num_radios;
+       ath11k_fill_band_to_mac_param(ab, init_param.band_to_mac);
 
        return ath11k_init_cmd_send(&wmi_sc->wmi[0], &init_param);
 }