LCOV - code coverage report
Current view: top level - drivers/net/wireless/ath/ath10k - wmi.c (source / functions) Hit Total Coverage
Test: combined.info Lines: 5 3875 0.1 %
Date: 2022-03-28 15:32:58 Functions: 1 198 0.5 %
Branches: 1 1642 0.1 %

           Branch data     Line data    Source code
       1                 :            : // SPDX-License-Identifier: ISC
       2                 :            : /*
       3                 :            :  * Copyright (c) 2005-2011 Atheros Communications Inc.
       4                 :            :  * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
       5                 :            :  * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
       6                 :            :  */
       7                 :            : 
       8                 :            : #include <linux/skbuff.h>
       9                 :            : #include <linux/ctype.h>
      10                 :            : 
      11                 :            : #include "core.h"
      12                 :            : #include "htc.h"
      13                 :            : #include "debug.h"
      14                 :            : #include "wmi.h"
      15                 :            : #include "wmi-tlv.h"
      16                 :            : #include "mac.h"
      17                 :            : #include "testmode.h"
      18                 :            : #include "wmi-ops.h"
      19                 :            : #include "p2p.h"
      20                 :            : #include "hw.h"
      21                 :            : #include "hif.h"
      22                 :            : #include "txrx.h"
      23                 :            : 
      24                 :            : #define ATH10K_WMI_BARRIER_ECHO_ID 0xBA991E9
      25                 :            : #define ATH10K_WMI_BARRIER_TIMEOUT_HZ (3 * HZ)
      26                 :            : #define ATH10K_WMI_DFS_CONF_TIMEOUT_HZ (HZ / 6)
      27                 :            : 
      28                 :            : /* MAIN WMI cmd track */
      29                 :            : static struct wmi_cmd_map wmi_cmd_map = {
      30                 :            :         .init_cmdid = WMI_INIT_CMDID,
      31                 :            :         .start_scan_cmdid = WMI_START_SCAN_CMDID,
      32                 :            :         .stop_scan_cmdid = WMI_STOP_SCAN_CMDID,
      33                 :            :         .scan_chan_list_cmdid = WMI_SCAN_CHAN_LIST_CMDID,
      34                 :            :         .scan_sch_prio_tbl_cmdid = WMI_SCAN_SCH_PRIO_TBL_CMDID,
      35                 :            :         .scan_prob_req_oui_cmdid = WMI_CMD_UNSUPPORTED,
      36                 :            :         .pdev_set_regdomain_cmdid = WMI_PDEV_SET_REGDOMAIN_CMDID,
      37                 :            :         .pdev_set_channel_cmdid = WMI_PDEV_SET_CHANNEL_CMDID,
      38                 :            :         .pdev_set_param_cmdid = WMI_PDEV_SET_PARAM_CMDID,
      39                 :            :         .pdev_pktlog_enable_cmdid = WMI_PDEV_PKTLOG_ENABLE_CMDID,
      40                 :            :         .pdev_pktlog_disable_cmdid = WMI_PDEV_PKTLOG_DISABLE_CMDID,
      41                 :            :         .pdev_set_wmm_params_cmdid = WMI_PDEV_SET_WMM_PARAMS_CMDID,
      42                 :            :         .pdev_set_ht_cap_ie_cmdid = WMI_PDEV_SET_HT_CAP_IE_CMDID,
      43                 :            :         .pdev_set_vht_cap_ie_cmdid = WMI_PDEV_SET_VHT_CAP_IE_CMDID,
      44                 :            :         .pdev_set_dscp_tid_map_cmdid = WMI_PDEV_SET_DSCP_TID_MAP_CMDID,
      45                 :            :         .pdev_set_quiet_mode_cmdid = WMI_PDEV_SET_QUIET_MODE_CMDID,
      46                 :            :         .pdev_green_ap_ps_enable_cmdid = WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID,
      47                 :            :         .pdev_get_tpc_config_cmdid = WMI_PDEV_GET_TPC_CONFIG_CMDID,
      48                 :            :         .pdev_set_base_macaddr_cmdid = WMI_PDEV_SET_BASE_MACADDR_CMDID,
      49                 :            :         .vdev_create_cmdid = WMI_VDEV_CREATE_CMDID,
      50                 :            :         .vdev_delete_cmdid = WMI_VDEV_DELETE_CMDID,
      51                 :            :         .vdev_start_request_cmdid = WMI_VDEV_START_REQUEST_CMDID,
      52                 :            :         .vdev_restart_request_cmdid = WMI_VDEV_RESTART_REQUEST_CMDID,
      53                 :            :         .vdev_up_cmdid = WMI_VDEV_UP_CMDID,
      54                 :            :         .vdev_stop_cmdid = WMI_VDEV_STOP_CMDID,
      55                 :            :         .vdev_down_cmdid = WMI_VDEV_DOWN_CMDID,
      56                 :            :         .vdev_set_param_cmdid = WMI_VDEV_SET_PARAM_CMDID,
      57                 :            :         .vdev_install_key_cmdid = WMI_VDEV_INSTALL_KEY_CMDID,
      58                 :            :         .peer_create_cmdid = WMI_PEER_CREATE_CMDID,
      59                 :            :         .peer_delete_cmdid = WMI_PEER_DELETE_CMDID,
      60                 :            :         .peer_flush_tids_cmdid = WMI_PEER_FLUSH_TIDS_CMDID,
      61                 :            :         .peer_set_param_cmdid = WMI_PEER_SET_PARAM_CMDID,
      62                 :            :         .peer_assoc_cmdid = WMI_PEER_ASSOC_CMDID,
      63                 :            :         .peer_add_wds_entry_cmdid = WMI_PEER_ADD_WDS_ENTRY_CMDID,
      64                 :            :         .peer_remove_wds_entry_cmdid = WMI_PEER_REMOVE_WDS_ENTRY_CMDID,
      65                 :            :         .peer_mcast_group_cmdid = WMI_PEER_MCAST_GROUP_CMDID,
      66                 :            :         .bcn_tx_cmdid = WMI_BCN_TX_CMDID,
      67                 :            :         .pdev_send_bcn_cmdid = WMI_PDEV_SEND_BCN_CMDID,
      68                 :            :         .bcn_tmpl_cmdid = WMI_BCN_TMPL_CMDID,
      69                 :            :         .bcn_filter_rx_cmdid = WMI_BCN_FILTER_RX_CMDID,
      70                 :            :         .prb_req_filter_rx_cmdid = WMI_PRB_REQ_FILTER_RX_CMDID,
      71                 :            :         .mgmt_tx_cmdid = WMI_MGMT_TX_CMDID,
      72                 :            :         .prb_tmpl_cmdid = WMI_PRB_TMPL_CMDID,
      73                 :            :         .addba_clear_resp_cmdid = WMI_ADDBA_CLEAR_RESP_CMDID,
      74                 :            :         .addba_send_cmdid = WMI_ADDBA_SEND_CMDID,
      75                 :            :         .addba_status_cmdid = WMI_ADDBA_STATUS_CMDID,
      76                 :            :         .delba_send_cmdid = WMI_DELBA_SEND_CMDID,
      77                 :            :         .addba_set_resp_cmdid = WMI_ADDBA_SET_RESP_CMDID,
      78                 :            :         .send_singleamsdu_cmdid = WMI_SEND_SINGLEAMSDU_CMDID,
      79                 :            :         .sta_powersave_mode_cmdid = WMI_STA_POWERSAVE_MODE_CMDID,
      80                 :            :         .sta_powersave_param_cmdid = WMI_STA_POWERSAVE_PARAM_CMDID,
      81                 :            :         .sta_mimo_ps_mode_cmdid = WMI_STA_MIMO_PS_MODE_CMDID,
      82                 :            :         .pdev_dfs_enable_cmdid = WMI_PDEV_DFS_ENABLE_CMDID,
      83                 :            :         .pdev_dfs_disable_cmdid = WMI_PDEV_DFS_DISABLE_CMDID,
      84                 :            :         .roam_scan_mode = WMI_ROAM_SCAN_MODE,
      85                 :            :         .roam_scan_rssi_threshold = WMI_ROAM_SCAN_RSSI_THRESHOLD,
      86                 :            :         .roam_scan_period = WMI_ROAM_SCAN_PERIOD,
      87                 :            :         .roam_scan_rssi_change_threshold = WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD,
      88                 :            :         .roam_ap_profile = WMI_ROAM_AP_PROFILE,
      89                 :            :         .ofl_scan_add_ap_profile = WMI_ROAM_AP_PROFILE,
      90                 :            :         .ofl_scan_remove_ap_profile = WMI_OFL_SCAN_REMOVE_AP_PROFILE,
      91                 :            :         .ofl_scan_period = WMI_OFL_SCAN_PERIOD,
      92                 :            :         .p2p_dev_set_device_info = WMI_P2P_DEV_SET_DEVICE_INFO,
      93                 :            :         .p2p_dev_set_discoverability = WMI_P2P_DEV_SET_DISCOVERABILITY,
      94                 :            :         .p2p_go_set_beacon_ie = WMI_P2P_GO_SET_BEACON_IE,
      95                 :            :         .p2p_go_set_probe_resp_ie = WMI_P2P_GO_SET_PROBE_RESP_IE,
      96                 :            :         .p2p_set_vendor_ie_data_cmdid = WMI_P2P_SET_VENDOR_IE_DATA_CMDID,
      97                 :            :         .ap_ps_peer_param_cmdid = WMI_AP_PS_PEER_PARAM_CMDID,
      98                 :            :         .ap_ps_peer_uapsd_coex_cmdid = WMI_AP_PS_PEER_UAPSD_COEX_CMDID,
      99                 :            :         .peer_rate_retry_sched_cmdid = WMI_PEER_RATE_RETRY_SCHED_CMDID,
     100                 :            :         .wlan_profile_trigger_cmdid = WMI_WLAN_PROFILE_TRIGGER_CMDID,
     101                 :            :         .wlan_profile_set_hist_intvl_cmdid =
     102                 :            :                                 WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
     103                 :            :         .wlan_profile_get_profile_data_cmdid =
     104                 :            :                                 WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
     105                 :            :         .wlan_profile_enable_profile_id_cmdid =
     106                 :            :                                 WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
     107                 :            :         .wlan_profile_list_profile_id_cmdid =
     108                 :            :                                 WMI_WLAN_PROFILE_LIST_PROFILE_ID_CMDID,
     109                 :            :         .pdev_suspend_cmdid = WMI_PDEV_SUSPEND_CMDID,
     110                 :            :         .pdev_resume_cmdid = WMI_PDEV_RESUME_CMDID,
     111                 :            :         .add_bcn_filter_cmdid = WMI_ADD_BCN_FILTER_CMDID,
     112                 :            :         .rmv_bcn_filter_cmdid = WMI_RMV_BCN_FILTER_CMDID,
     113                 :            :         .wow_add_wake_pattern_cmdid = WMI_WOW_ADD_WAKE_PATTERN_CMDID,
     114                 :            :         .wow_del_wake_pattern_cmdid = WMI_WOW_DEL_WAKE_PATTERN_CMDID,
     115                 :            :         .wow_enable_disable_wake_event_cmdid =
     116                 :            :                                 WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID,
     117                 :            :         .wow_enable_cmdid = WMI_WOW_ENABLE_CMDID,
     118                 :            :         .wow_hostwakeup_from_sleep_cmdid = WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID,
     119                 :            :         .rtt_measreq_cmdid = WMI_RTT_MEASREQ_CMDID,
     120                 :            :         .rtt_tsf_cmdid = WMI_RTT_TSF_CMDID,
     121                 :            :         .vdev_spectral_scan_configure_cmdid =
     122                 :            :                                 WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID,
     123                 :            :         .vdev_spectral_scan_enable_cmdid = WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID,
     124                 :            :         .request_stats_cmdid = WMI_REQUEST_STATS_CMDID,
     125                 :            :         .set_arp_ns_offload_cmdid = WMI_SET_ARP_NS_OFFLOAD_CMDID,
     126                 :            :         .network_list_offload_config_cmdid =
     127                 :            :                                 WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID,
     128                 :            :         .gtk_offload_cmdid = WMI_GTK_OFFLOAD_CMDID,
     129                 :            :         .csa_offload_enable_cmdid = WMI_CSA_OFFLOAD_ENABLE_CMDID,
     130                 :            :         .csa_offload_chanswitch_cmdid = WMI_CSA_OFFLOAD_CHANSWITCH_CMDID,
     131                 :            :         .chatter_set_mode_cmdid = WMI_CHATTER_SET_MODE_CMDID,
     132                 :            :         .peer_tid_addba_cmdid = WMI_PEER_TID_ADDBA_CMDID,
     133                 :            :         .peer_tid_delba_cmdid = WMI_PEER_TID_DELBA_CMDID,
     134                 :            :         .sta_dtim_ps_method_cmdid = WMI_STA_DTIM_PS_METHOD_CMDID,
     135                 :            :         .sta_uapsd_auto_trig_cmdid = WMI_STA_UAPSD_AUTO_TRIG_CMDID,
     136                 :            :         .sta_keepalive_cmd = WMI_STA_KEEPALIVE_CMD,
     137                 :            :         .echo_cmdid = WMI_ECHO_CMDID,
     138                 :            :         .pdev_utf_cmdid = WMI_PDEV_UTF_CMDID,
     139                 :            :         .dbglog_cfg_cmdid = WMI_DBGLOG_CFG_CMDID,
     140                 :            :         .pdev_qvit_cmdid = WMI_PDEV_QVIT_CMDID,
     141                 :            :         .pdev_ftm_intg_cmdid = WMI_PDEV_FTM_INTG_CMDID,
     142                 :            :         .vdev_set_keepalive_cmdid = WMI_VDEV_SET_KEEPALIVE_CMDID,
     143                 :            :         .vdev_get_keepalive_cmdid = WMI_VDEV_GET_KEEPALIVE_CMDID,
     144                 :            :         .force_fw_hang_cmdid = WMI_FORCE_FW_HANG_CMDID,
     145                 :            :         .gpio_config_cmdid = WMI_GPIO_CONFIG_CMDID,
     146                 :            :         .gpio_output_cmdid = WMI_GPIO_OUTPUT_CMDID,
     147                 :            :         .pdev_get_temperature_cmdid = WMI_CMD_UNSUPPORTED,
     148                 :            :         .pdev_enable_adaptive_cca_cmdid = WMI_CMD_UNSUPPORTED,
     149                 :            :         .scan_update_request_cmdid = WMI_CMD_UNSUPPORTED,
     150                 :            :         .vdev_standby_response_cmdid = WMI_CMD_UNSUPPORTED,
     151                 :            :         .vdev_resume_response_cmdid = WMI_CMD_UNSUPPORTED,
     152                 :            :         .wlan_peer_caching_add_peer_cmdid = WMI_CMD_UNSUPPORTED,
     153                 :            :         .wlan_peer_caching_evict_peer_cmdid = WMI_CMD_UNSUPPORTED,
     154                 :            :         .wlan_peer_caching_restore_peer_cmdid = WMI_CMD_UNSUPPORTED,
     155                 :            :         .wlan_peer_caching_print_all_peers_info_cmdid = WMI_CMD_UNSUPPORTED,
     156                 :            :         .peer_update_wds_entry_cmdid = WMI_CMD_UNSUPPORTED,
     157                 :            :         .peer_add_proxy_sta_entry_cmdid = WMI_CMD_UNSUPPORTED,
     158                 :            :         .rtt_keepalive_cmdid = WMI_CMD_UNSUPPORTED,
     159                 :            :         .oem_req_cmdid = WMI_CMD_UNSUPPORTED,
     160                 :            :         .nan_cmdid = WMI_CMD_UNSUPPORTED,
     161                 :            :         .vdev_ratemask_cmdid = WMI_CMD_UNSUPPORTED,
     162                 :            :         .qboost_cfg_cmdid = WMI_CMD_UNSUPPORTED,
     163                 :            :         .pdev_smart_ant_enable_cmdid = WMI_CMD_UNSUPPORTED,
     164                 :            :         .pdev_smart_ant_set_rx_antenna_cmdid = WMI_CMD_UNSUPPORTED,
     165                 :            :         .peer_smart_ant_set_tx_antenna_cmdid = WMI_CMD_UNSUPPORTED,
     166                 :            :         .peer_smart_ant_set_train_info_cmdid = WMI_CMD_UNSUPPORTED,
     167                 :            :         .peer_smart_ant_set_node_config_ops_cmdid = WMI_CMD_UNSUPPORTED,
     168                 :            :         .pdev_set_antenna_switch_table_cmdid = WMI_CMD_UNSUPPORTED,
     169                 :            :         .pdev_set_ctl_table_cmdid = WMI_CMD_UNSUPPORTED,
     170                 :            :         .pdev_set_mimogain_table_cmdid = WMI_CMD_UNSUPPORTED,
     171                 :            :         .pdev_ratepwr_table_cmdid = WMI_CMD_UNSUPPORTED,
     172                 :            :         .pdev_ratepwr_chainmsk_table_cmdid = WMI_CMD_UNSUPPORTED,
     173                 :            :         .pdev_fips_cmdid = WMI_CMD_UNSUPPORTED,
     174                 :            :         .tt_set_conf_cmdid = WMI_CMD_UNSUPPORTED,
     175                 :            :         .fwtest_cmdid = WMI_CMD_UNSUPPORTED,
     176                 :            :         .vdev_atf_request_cmdid = WMI_CMD_UNSUPPORTED,
     177                 :            :         .peer_atf_request_cmdid = WMI_CMD_UNSUPPORTED,
     178                 :            :         .pdev_get_ani_cck_config_cmdid = WMI_CMD_UNSUPPORTED,
     179                 :            :         .pdev_get_ani_ofdm_config_cmdid = WMI_CMD_UNSUPPORTED,
     180                 :            :         .pdev_reserve_ast_entry_cmdid = WMI_CMD_UNSUPPORTED,
     181                 :            :         .pdev_get_nfcal_power_cmdid = WMI_CMD_UNSUPPORTED,
     182                 :            :         .pdev_get_tpc_cmdid = WMI_CMD_UNSUPPORTED,
     183                 :            :         .pdev_get_ast_info_cmdid = WMI_CMD_UNSUPPORTED,
     184                 :            :         .vdev_set_dscp_tid_map_cmdid = WMI_CMD_UNSUPPORTED,
     185                 :            :         .pdev_get_info_cmdid = WMI_CMD_UNSUPPORTED,
     186                 :            :         .vdev_get_info_cmdid = WMI_CMD_UNSUPPORTED,
     187                 :            :         .vdev_filter_neighbor_rx_packets_cmdid = WMI_CMD_UNSUPPORTED,
     188                 :            :         .mu_cal_start_cmdid = WMI_CMD_UNSUPPORTED,
     189                 :            :         .set_cca_params_cmdid = WMI_CMD_UNSUPPORTED,
     190                 :            :         .pdev_bss_chan_info_request_cmdid = WMI_CMD_UNSUPPORTED,
     191                 :            :         .pdev_get_tpc_table_cmdid = WMI_CMD_UNSUPPORTED,
     192                 :            :         .radar_found_cmdid = WMI_CMD_UNSUPPORTED,
     193                 :            : };
     194                 :            : 
     195                 :            : /* 10.X WMI cmd track */
     196                 :            : static struct wmi_cmd_map wmi_10x_cmd_map = {
     197                 :            :         .init_cmdid = WMI_10X_INIT_CMDID,
     198                 :            :         .start_scan_cmdid = WMI_10X_START_SCAN_CMDID,
     199                 :            :         .stop_scan_cmdid = WMI_10X_STOP_SCAN_CMDID,
     200                 :            :         .scan_chan_list_cmdid = WMI_10X_SCAN_CHAN_LIST_CMDID,
     201                 :            :         .scan_sch_prio_tbl_cmdid = WMI_CMD_UNSUPPORTED,
     202                 :            :         .scan_prob_req_oui_cmdid = WMI_CMD_UNSUPPORTED,
     203                 :            :         .pdev_set_regdomain_cmdid = WMI_10X_PDEV_SET_REGDOMAIN_CMDID,
     204                 :            :         .pdev_set_channel_cmdid = WMI_10X_PDEV_SET_CHANNEL_CMDID,
     205                 :            :         .pdev_set_param_cmdid = WMI_10X_PDEV_SET_PARAM_CMDID,
     206                 :            :         .pdev_pktlog_enable_cmdid = WMI_10X_PDEV_PKTLOG_ENABLE_CMDID,
     207                 :            :         .pdev_pktlog_disable_cmdid = WMI_10X_PDEV_PKTLOG_DISABLE_CMDID,
     208                 :            :         .pdev_set_wmm_params_cmdid = WMI_10X_PDEV_SET_WMM_PARAMS_CMDID,
     209                 :            :         .pdev_set_ht_cap_ie_cmdid = WMI_10X_PDEV_SET_HT_CAP_IE_CMDID,
     210                 :            :         .pdev_set_vht_cap_ie_cmdid = WMI_10X_PDEV_SET_VHT_CAP_IE_CMDID,
     211                 :            :         .pdev_set_dscp_tid_map_cmdid = WMI_10X_PDEV_SET_DSCP_TID_MAP_CMDID,
     212                 :            :         .pdev_set_quiet_mode_cmdid = WMI_10X_PDEV_SET_QUIET_MODE_CMDID,
     213                 :            :         .pdev_green_ap_ps_enable_cmdid = WMI_10X_PDEV_GREEN_AP_PS_ENABLE_CMDID,
     214                 :            :         .pdev_get_tpc_config_cmdid = WMI_10X_PDEV_GET_TPC_CONFIG_CMDID,
     215                 :            :         .pdev_set_base_macaddr_cmdid = WMI_10X_PDEV_SET_BASE_MACADDR_CMDID,
     216                 :            :         .vdev_create_cmdid = WMI_10X_VDEV_CREATE_CMDID,
     217                 :            :         .vdev_delete_cmdid = WMI_10X_VDEV_DELETE_CMDID,
     218                 :            :         .vdev_start_request_cmdid = WMI_10X_VDEV_START_REQUEST_CMDID,
     219                 :            :         .vdev_restart_request_cmdid = WMI_10X_VDEV_RESTART_REQUEST_CMDID,
     220                 :            :         .vdev_up_cmdid = WMI_10X_VDEV_UP_CMDID,
     221                 :            :         .vdev_stop_cmdid = WMI_10X_VDEV_STOP_CMDID,
     222                 :            :         .vdev_down_cmdid = WMI_10X_VDEV_DOWN_CMDID,
     223                 :            :         .vdev_set_param_cmdid = WMI_10X_VDEV_SET_PARAM_CMDID,
     224                 :            :         .vdev_install_key_cmdid = WMI_10X_VDEV_INSTALL_KEY_CMDID,
     225                 :            :         .peer_create_cmdid = WMI_10X_PEER_CREATE_CMDID,
     226                 :            :         .peer_delete_cmdid = WMI_10X_PEER_DELETE_CMDID,
     227                 :            :         .peer_flush_tids_cmdid = WMI_10X_PEER_FLUSH_TIDS_CMDID,
     228                 :            :         .peer_set_param_cmdid = WMI_10X_PEER_SET_PARAM_CMDID,
     229                 :            :         .peer_assoc_cmdid = WMI_10X_PEER_ASSOC_CMDID,
     230                 :            :         .peer_add_wds_entry_cmdid = WMI_10X_PEER_ADD_WDS_ENTRY_CMDID,
     231                 :            :         .peer_remove_wds_entry_cmdid = WMI_10X_PEER_REMOVE_WDS_ENTRY_CMDID,
     232                 :            :         .peer_mcast_group_cmdid = WMI_10X_PEER_MCAST_GROUP_CMDID,
     233                 :            :         .bcn_tx_cmdid = WMI_10X_BCN_TX_CMDID,
     234                 :            :         .pdev_send_bcn_cmdid = WMI_10X_PDEV_SEND_BCN_CMDID,
     235                 :            :         .bcn_tmpl_cmdid = WMI_CMD_UNSUPPORTED,
     236                 :            :         .bcn_filter_rx_cmdid = WMI_10X_BCN_FILTER_RX_CMDID,
     237                 :            :         .prb_req_filter_rx_cmdid = WMI_10X_PRB_REQ_FILTER_RX_CMDID,
     238                 :            :         .mgmt_tx_cmdid = WMI_10X_MGMT_TX_CMDID,
     239                 :            :         .prb_tmpl_cmdid = WMI_CMD_UNSUPPORTED,
     240                 :            :         .addba_clear_resp_cmdid = WMI_10X_ADDBA_CLEAR_RESP_CMDID,
     241                 :            :         .addba_send_cmdid = WMI_10X_ADDBA_SEND_CMDID,
     242                 :            :         .addba_status_cmdid = WMI_10X_ADDBA_STATUS_CMDID,
     243                 :            :         .delba_send_cmdid = WMI_10X_DELBA_SEND_CMDID,
     244                 :            :         .addba_set_resp_cmdid = WMI_10X_ADDBA_SET_RESP_CMDID,
     245                 :            :         .send_singleamsdu_cmdid = WMI_10X_SEND_SINGLEAMSDU_CMDID,
     246                 :            :         .sta_powersave_mode_cmdid = WMI_10X_STA_POWERSAVE_MODE_CMDID,
     247                 :            :         .sta_powersave_param_cmdid = WMI_10X_STA_POWERSAVE_PARAM_CMDID,
     248                 :            :         .sta_mimo_ps_mode_cmdid = WMI_10X_STA_MIMO_PS_MODE_CMDID,
     249                 :            :         .pdev_dfs_enable_cmdid = WMI_10X_PDEV_DFS_ENABLE_CMDID,
     250                 :            :         .pdev_dfs_disable_cmdid = WMI_10X_PDEV_DFS_DISABLE_CMDID,
     251                 :            :         .roam_scan_mode = WMI_10X_ROAM_SCAN_MODE,
     252                 :            :         .roam_scan_rssi_threshold = WMI_10X_ROAM_SCAN_RSSI_THRESHOLD,
     253                 :            :         .roam_scan_period = WMI_10X_ROAM_SCAN_PERIOD,
     254                 :            :         .roam_scan_rssi_change_threshold =
     255                 :            :                                 WMI_10X_ROAM_SCAN_RSSI_CHANGE_THRESHOLD,
     256                 :            :         .roam_ap_profile = WMI_10X_ROAM_AP_PROFILE,
     257                 :            :         .ofl_scan_add_ap_profile = WMI_10X_OFL_SCAN_ADD_AP_PROFILE,
     258                 :            :         .ofl_scan_remove_ap_profile = WMI_10X_OFL_SCAN_REMOVE_AP_PROFILE,
     259                 :            :         .ofl_scan_period = WMI_10X_OFL_SCAN_PERIOD,
     260                 :            :         .p2p_dev_set_device_info = WMI_10X_P2P_DEV_SET_DEVICE_INFO,
     261                 :            :         .p2p_dev_set_discoverability = WMI_10X_P2P_DEV_SET_DISCOVERABILITY,
     262                 :            :         .p2p_go_set_beacon_ie = WMI_10X_P2P_GO_SET_BEACON_IE,
     263                 :            :         .p2p_go_set_probe_resp_ie = WMI_10X_P2P_GO_SET_PROBE_RESP_IE,
     264                 :            :         .p2p_set_vendor_ie_data_cmdid = WMI_CMD_UNSUPPORTED,
     265                 :            :         .ap_ps_peer_param_cmdid = WMI_10X_AP_PS_PEER_PARAM_CMDID,
     266                 :            :         .ap_ps_peer_uapsd_coex_cmdid = WMI_CMD_UNSUPPORTED,
     267                 :            :         .peer_rate_retry_sched_cmdid = WMI_10X_PEER_RATE_RETRY_SCHED_CMDID,
     268                 :            :         .wlan_profile_trigger_cmdid = WMI_10X_WLAN_PROFILE_TRIGGER_CMDID,
     269                 :            :         .wlan_profile_set_hist_intvl_cmdid =
     270                 :            :                                 WMI_10X_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
     271                 :            :         .wlan_profile_get_profile_data_cmdid =
     272                 :            :                                 WMI_10X_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
     273                 :            :         .wlan_profile_enable_profile_id_cmdid =
     274                 :            :                                 WMI_10X_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
     275                 :            :         .wlan_profile_list_profile_id_cmdid =
     276                 :            :                                 WMI_10X_WLAN_PROFILE_LIST_PROFILE_ID_CMDID,
     277                 :            :         .pdev_suspend_cmdid = WMI_10X_PDEV_SUSPEND_CMDID,
     278                 :            :         .pdev_resume_cmdid = WMI_10X_PDEV_RESUME_CMDID,
     279                 :            :         .add_bcn_filter_cmdid = WMI_10X_ADD_BCN_FILTER_CMDID,
     280                 :            :         .rmv_bcn_filter_cmdid = WMI_10X_RMV_BCN_FILTER_CMDID,
     281                 :            :         .wow_add_wake_pattern_cmdid = WMI_10X_WOW_ADD_WAKE_PATTERN_CMDID,
     282                 :            :         .wow_del_wake_pattern_cmdid = WMI_10X_WOW_DEL_WAKE_PATTERN_CMDID,
     283                 :            :         .wow_enable_disable_wake_event_cmdid =
     284                 :            :                                 WMI_10X_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID,
     285                 :            :         .wow_enable_cmdid = WMI_10X_WOW_ENABLE_CMDID,
     286                 :            :         .wow_hostwakeup_from_sleep_cmdid =
     287                 :            :                                 WMI_10X_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID,
     288                 :            :         .rtt_measreq_cmdid = WMI_10X_RTT_MEASREQ_CMDID,
     289                 :            :         .rtt_tsf_cmdid = WMI_10X_RTT_TSF_CMDID,
     290                 :            :         .vdev_spectral_scan_configure_cmdid =
     291                 :            :                                 WMI_10X_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID,
     292                 :            :         .vdev_spectral_scan_enable_cmdid =
     293                 :            :                                 WMI_10X_VDEV_SPECTRAL_SCAN_ENABLE_CMDID,
     294                 :            :         .request_stats_cmdid = WMI_10X_REQUEST_STATS_CMDID,
     295                 :            :         .set_arp_ns_offload_cmdid = WMI_CMD_UNSUPPORTED,
     296                 :            :         .network_list_offload_config_cmdid = WMI_CMD_UNSUPPORTED,
     297                 :            :         .gtk_offload_cmdid = WMI_CMD_UNSUPPORTED,
     298                 :            :         .csa_offload_enable_cmdid = WMI_CMD_UNSUPPORTED,
     299                 :            :         .csa_offload_chanswitch_cmdid = WMI_CMD_UNSUPPORTED,
     300                 :            :         .chatter_set_mode_cmdid = WMI_CMD_UNSUPPORTED,
     301                 :            :         .peer_tid_addba_cmdid = WMI_CMD_UNSUPPORTED,
     302                 :            :         .peer_tid_delba_cmdid = WMI_CMD_UNSUPPORTED,
     303                 :            :         .sta_dtim_ps_method_cmdid = WMI_CMD_UNSUPPORTED,
     304                 :            :         .sta_uapsd_auto_trig_cmdid = WMI_CMD_UNSUPPORTED,
     305                 :            :         .sta_keepalive_cmd = WMI_CMD_UNSUPPORTED,
     306                 :            :         .echo_cmdid = WMI_10X_ECHO_CMDID,
     307                 :            :         .pdev_utf_cmdid = WMI_10X_PDEV_UTF_CMDID,
     308                 :            :         .dbglog_cfg_cmdid = WMI_10X_DBGLOG_CFG_CMDID,
     309                 :            :         .pdev_qvit_cmdid = WMI_10X_PDEV_QVIT_CMDID,
     310                 :            :         .pdev_ftm_intg_cmdid = WMI_CMD_UNSUPPORTED,
     311                 :            :         .vdev_set_keepalive_cmdid = WMI_CMD_UNSUPPORTED,
     312                 :            :         .vdev_get_keepalive_cmdid = WMI_CMD_UNSUPPORTED,
     313                 :            :         .force_fw_hang_cmdid = WMI_CMD_UNSUPPORTED,
     314                 :            :         .gpio_config_cmdid = WMI_10X_GPIO_CONFIG_CMDID,
     315                 :            :         .gpio_output_cmdid = WMI_10X_GPIO_OUTPUT_CMDID,
     316                 :            :         .pdev_get_temperature_cmdid = WMI_CMD_UNSUPPORTED,
     317                 :            :         .pdev_enable_adaptive_cca_cmdid = WMI_CMD_UNSUPPORTED,
     318                 :            :         .scan_update_request_cmdid = WMI_CMD_UNSUPPORTED,
     319                 :            :         .vdev_standby_response_cmdid = WMI_CMD_UNSUPPORTED,
     320                 :            :         .vdev_resume_response_cmdid = WMI_CMD_UNSUPPORTED,
     321                 :            :         .wlan_peer_caching_add_peer_cmdid = WMI_CMD_UNSUPPORTED,
     322                 :            :         .wlan_peer_caching_evict_peer_cmdid = WMI_CMD_UNSUPPORTED,
     323                 :            :         .wlan_peer_caching_restore_peer_cmdid = WMI_CMD_UNSUPPORTED,
     324                 :            :         .wlan_peer_caching_print_all_peers_info_cmdid = WMI_CMD_UNSUPPORTED,
     325                 :            :         .peer_update_wds_entry_cmdid = WMI_CMD_UNSUPPORTED,
     326                 :            :         .peer_add_proxy_sta_entry_cmdid = WMI_CMD_UNSUPPORTED,
     327                 :            :         .rtt_keepalive_cmdid = WMI_CMD_UNSUPPORTED,
     328                 :            :         .oem_req_cmdid = WMI_CMD_UNSUPPORTED,
     329                 :            :         .nan_cmdid = WMI_CMD_UNSUPPORTED,
     330                 :            :         .vdev_ratemask_cmdid = WMI_CMD_UNSUPPORTED,
     331                 :            :         .qboost_cfg_cmdid = WMI_CMD_UNSUPPORTED,
     332                 :            :         .pdev_smart_ant_enable_cmdid = WMI_CMD_UNSUPPORTED,
     333                 :            :         .pdev_smart_ant_set_rx_antenna_cmdid = WMI_CMD_UNSUPPORTED,
     334                 :            :         .peer_smart_ant_set_tx_antenna_cmdid = WMI_CMD_UNSUPPORTED,
     335                 :            :         .peer_smart_ant_set_train_info_cmdid = WMI_CMD_UNSUPPORTED,
     336                 :            :         .peer_smart_ant_set_node_config_ops_cmdid = WMI_CMD_UNSUPPORTED,
     337                 :            :         .pdev_set_antenna_switch_table_cmdid = WMI_CMD_UNSUPPORTED,
     338                 :            :         .pdev_set_ctl_table_cmdid = WMI_CMD_UNSUPPORTED,
     339                 :            :         .pdev_set_mimogain_table_cmdid = WMI_CMD_UNSUPPORTED,
     340                 :            :         .pdev_ratepwr_table_cmdid = WMI_CMD_UNSUPPORTED,
     341                 :            :         .pdev_ratepwr_chainmsk_table_cmdid = WMI_CMD_UNSUPPORTED,
     342                 :            :         .pdev_fips_cmdid = WMI_CMD_UNSUPPORTED,
     343                 :            :         .tt_set_conf_cmdid = WMI_CMD_UNSUPPORTED,
     344                 :            :         .fwtest_cmdid = WMI_CMD_UNSUPPORTED,
     345                 :            :         .vdev_atf_request_cmdid = WMI_CMD_UNSUPPORTED,
     346                 :            :         .peer_atf_request_cmdid = WMI_CMD_UNSUPPORTED,
     347                 :            :         .pdev_get_ani_cck_config_cmdid = WMI_CMD_UNSUPPORTED,
     348                 :            :         .pdev_get_ani_ofdm_config_cmdid = WMI_CMD_UNSUPPORTED,
     349                 :            :         .pdev_reserve_ast_entry_cmdid = WMI_CMD_UNSUPPORTED,
     350                 :            :         .pdev_get_nfcal_power_cmdid = WMI_CMD_UNSUPPORTED,
     351                 :            :         .pdev_get_tpc_cmdid = WMI_CMD_UNSUPPORTED,
     352                 :            :         .pdev_get_ast_info_cmdid = WMI_CMD_UNSUPPORTED,
     353                 :            :         .vdev_set_dscp_tid_map_cmdid = WMI_CMD_UNSUPPORTED,
     354                 :            :         .pdev_get_info_cmdid = WMI_CMD_UNSUPPORTED,
     355                 :            :         .vdev_get_info_cmdid = WMI_CMD_UNSUPPORTED,
     356                 :            :         .vdev_filter_neighbor_rx_packets_cmdid = WMI_CMD_UNSUPPORTED,
     357                 :            :         .mu_cal_start_cmdid = WMI_CMD_UNSUPPORTED,
     358                 :            :         .set_cca_params_cmdid = WMI_CMD_UNSUPPORTED,
     359                 :            :         .pdev_bss_chan_info_request_cmdid = WMI_CMD_UNSUPPORTED,
     360                 :            :         .pdev_get_tpc_table_cmdid = WMI_CMD_UNSUPPORTED,
     361                 :            :         .radar_found_cmdid = WMI_CMD_UNSUPPORTED,
     362                 :            : };
     363                 :            : 
     364                 :            : /* 10.2.4 WMI cmd track */
     365                 :            : static struct wmi_cmd_map wmi_10_2_4_cmd_map = {
     366                 :            :         .init_cmdid = WMI_10_2_INIT_CMDID,
     367                 :            :         .start_scan_cmdid = WMI_10_2_START_SCAN_CMDID,
     368                 :            :         .stop_scan_cmdid = WMI_10_2_STOP_SCAN_CMDID,
     369                 :            :         .scan_chan_list_cmdid = WMI_10_2_SCAN_CHAN_LIST_CMDID,
     370                 :            :         .scan_sch_prio_tbl_cmdid = WMI_CMD_UNSUPPORTED,
     371                 :            :         .scan_prob_req_oui_cmdid = WMI_CMD_UNSUPPORTED,
     372                 :            :         .pdev_set_regdomain_cmdid = WMI_10_2_PDEV_SET_REGDOMAIN_CMDID,
     373                 :            :         .pdev_set_channel_cmdid = WMI_10_2_PDEV_SET_CHANNEL_CMDID,
     374                 :            :         .pdev_set_param_cmdid = WMI_10_2_PDEV_SET_PARAM_CMDID,
     375                 :            :         .pdev_pktlog_enable_cmdid = WMI_10_2_PDEV_PKTLOG_ENABLE_CMDID,
     376                 :            :         .pdev_pktlog_disable_cmdid = WMI_10_2_PDEV_PKTLOG_DISABLE_CMDID,
     377                 :            :         .pdev_set_wmm_params_cmdid = WMI_10_2_PDEV_SET_WMM_PARAMS_CMDID,
     378                 :            :         .pdev_set_ht_cap_ie_cmdid = WMI_10_2_PDEV_SET_HT_CAP_IE_CMDID,
     379                 :            :         .pdev_set_vht_cap_ie_cmdid = WMI_10_2_PDEV_SET_VHT_CAP_IE_CMDID,
     380                 :            :         .pdev_set_quiet_mode_cmdid = WMI_10_2_PDEV_SET_QUIET_MODE_CMDID,
     381                 :            :         .pdev_green_ap_ps_enable_cmdid = WMI_10_2_PDEV_GREEN_AP_PS_ENABLE_CMDID,
     382                 :            :         .pdev_get_tpc_config_cmdid = WMI_10_2_PDEV_GET_TPC_CONFIG_CMDID,
     383                 :            :         .pdev_set_base_macaddr_cmdid = WMI_10_2_PDEV_SET_BASE_MACADDR_CMDID,
     384                 :            :         .vdev_create_cmdid = WMI_10_2_VDEV_CREATE_CMDID,
     385                 :            :         .vdev_delete_cmdid = WMI_10_2_VDEV_DELETE_CMDID,
     386                 :            :         .vdev_start_request_cmdid = WMI_10_2_VDEV_START_REQUEST_CMDID,
     387                 :            :         .vdev_restart_request_cmdid = WMI_10_2_VDEV_RESTART_REQUEST_CMDID,
     388                 :            :         .vdev_up_cmdid = WMI_10_2_VDEV_UP_CMDID,
     389                 :            :         .vdev_stop_cmdid = WMI_10_2_VDEV_STOP_CMDID,
     390                 :            :         .vdev_down_cmdid = WMI_10_2_VDEV_DOWN_CMDID,
     391                 :            :         .vdev_set_param_cmdid = WMI_10_2_VDEV_SET_PARAM_CMDID,
     392                 :            :         .vdev_install_key_cmdid = WMI_10_2_VDEV_INSTALL_KEY_CMDID,
     393                 :            :         .peer_create_cmdid = WMI_10_2_PEER_CREATE_CMDID,
     394                 :            :         .peer_delete_cmdid = WMI_10_2_PEER_DELETE_CMDID,
     395                 :            :         .peer_flush_tids_cmdid = WMI_10_2_PEER_FLUSH_TIDS_CMDID,
     396                 :            :         .peer_set_param_cmdid = WMI_10_2_PEER_SET_PARAM_CMDID,
     397                 :            :         .peer_assoc_cmdid = WMI_10_2_PEER_ASSOC_CMDID,
     398                 :            :         .peer_add_wds_entry_cmdid = WMI_10_2_PEER_ADD_WDS_ENTRY_CMDID,
     399                 :            :         .peer_remove_wds_entry_cmdid = WMI_10_2_PEER_REMOVE_WDS_ENTRY_CMDID,
     400                 :            :         .peer_mcast_group_cmdid = WMI_10_2_PEER_MCAST_GROUP_CMDID,
     401                 :            :         .bcn_tx_cmdid = WMI_10_2_BCN_TX_CMDID,
     402                 :            :         .pdev_send_bcn_cmdid = WMI_10_2_PDEV_SEND_BCN_CMDID,
     403                 :            :         .bcn_tmpl_cmdid = WMI_CMD_UNSUPPORTED,
     404                 :            :         .bcn_filter_rx_cmdid = WMI_10_2_BCN_FILTER_RX_CMDID,
     405                 :            :         .prb_req_filter_rx_cmdid = WMI_10_2_PRB_REQ_FILTER_RX_CMDID,
     406                 :            :         .mgmt_tx_cmdid = WMI_10_2_MGMT_TX_CMDID,
     407                 :            :         .prb_tmpl_cmdid = WMI_CMD_UNSUPPORTED,
     408                 :            :         .addba_clear_resp_cmdid = WMI_10_2_ADDBA_CLEAR_RESP_CMDID,
     409                 :            :         .addba_send_cmdid = WMI_10_2_ADDBA_SEND_CMDID,
     410                 :            :         .addba_status_cmdid = WMI_10_2_ADDBA_STATUS_CMDID,
     411                 :            :         .delba_send_cmdid = WMI_10_2_DELBA_SEND_CMDID,
     412                 :            :         .addba_set_resp_cmdid = WMI_10_2_ADDBA_SET_RESP_CMDID,
     413                 :            :         .send_singleamsdu_cmdid = WMI_10_2_SEND_SINGLEAMSDU_CMDID,
     414                 :            :         .sta_powersave_mode_cmdid = WMI_10_2_STA_POWERSAVE_MODE_CMDID,
     415                 :            :         .sta_powersave_param_cmdid = WMI_10_2_STA_POWERSAVE_PARAM_CMDID,
     416                 :            :         .sta_mimo_ps_mode_cmdid = WMI_10_2_STA_MIMO_PS_MODE_CMDID,
     417                 :            :         .pdev_dfs_enable_cmdid = WMI_10_2_PDEV_DFS_ENABLE_CMDID,
     418                 :            :         .pdev_dfs_disable_cmdid = WMI_10_2_PDEV_DFS_DISABLE_CMDID,
     419                 :            :         .roam_scan_mode = WMI_10_2_ROAM_SCAN_MODE,
     420                 :            :         .roam_scan_rssi_threshold = WMI_10_2_ROAM_SCAN_RSSI_THRESHOLD,
     421                 :            :         .roam_scan_period = WMI_10_2_ROAM_SCAN_PERIOD,
     422                 :            :         .roam_scan_rssi_change_threshold =
     423                 :            :                                 WMI_10_2_ROAM_SCAN_RSSI_CHANGE_THRESHOLD,
     424                 :            :         .roam_ap_profile = WMI_10_2_ROAM_AP_PROFILE,
     425                 :            :         .ofl_scan_add_ap_profile = WMI_10_2_OFL_SCAN_ADD_AP_PROFILE,
     426                 :            :         .ofl_scan_remove_ap_profile = WMI_10_2_OFL_SCAN_REMOVE_AP_PROFILE,
     427                 :            :         .ofl_scan_period = WMI_10_2_OFL_SCAN_PERIOD,
     428                 :            :         .p2p_dev_set_device_info = WMI_10_2_P2P_DEV_SET_DEVICE_INFO,
     429                 :            :         .p2p_dev_set_discoverability = WMI_10_2_P2P_DEV_SET_DISCOVERABILITY,
     430                 :            :         .p2p_go_set_beacon_ie = WMI_10_2_P2P_GO_SET_BEACON_IE,
     431                 :            :         .p2p_go_set_probe_resp_ie = WMI_10_2_P2P_GO_SET_PROBE_RESP_IE,
     432                 :            :         .p2p_set_vendor_ie_data_cmdid = WMI_CMD_UNSUPPORTED,
     433                 :            :         .ap_ps_peer_param_cmdid = WMI_10_2_AP_PS_PEER_PARAM_CMDID,
     434                 :            :         .ap_ps_peer_uapsd_coex_cmdid = WMI_CMD_UNSUPPORTED,
     435                 :            :         .peer_rate_retry_sched_cmdid = WMI_10_2_PEER_RATE_RETRY_SCHED_CMDID,
     436                 :            :         .wlan_profile_trigger_cmdid = WMI_10_2_WLAN_PROFILE_TRIGGER_CMDID,
     437                 :            :         .wlan_profile_set_hist_intvl_cmdid =
     438                 :            :                                 WMI_10_2_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
     439                 :            :         .wlan_profile_get_profile_data_cmdid =
     440                 :            :                                 WMI_10_2_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
     441                 :            :         .wlan_profile_enable_profile_id_cmdid =
     442                 :            :                                 WMI_10_2_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
     443                 :            :         .wlan_profile_list_profile_id_cmdid =
     444                 :            :                                 WMI_10_2_WLAN_PROFILE_LIST_PROFILE_ID_CMDID,
     445                 :            :         .pdev_suspend_cmdid = WMI_10_2_PDEV_SUSPEND_CMDID,
     446                 :            :         .pdev_resume_cmdid = WMI_10_2_PDEV_RESUME_CMDID,
     447                 :            :         .add_bcn_filter_cmdid = WMI_10_2_ADD_BCN_FILTER_CMDID,
     448                 :            :         .rmv_bcn_filter_cmdid = WMI_10_2_RMV_BCN_FILTER_CMDID,
     449                 :            :         .wow_add_wake_pattern_cmdid = WMI_10_2_WOW_ADD_WAKE_PATTERN_CMDID,
     450                 :            :         .wow_del_wake_pattern_cmdid = WMI_10_2_WOW_DEL_WAKE_PATTERN_CMDID,
     451                 :            :         .wow_enable_disable_wake_event_cmdid =
     452                 :            :                                 WMI_10_2_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID,
     453                 :            :         .wow_enable_cmdid = WMI_10_2_WOW_ENABLE_CMDID,
     454                 :            :         .wow_hostwakeup_from_sleep_cmdid =
     455                 :            :                                 WMI_10_2_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID,
     456                 :            :         .rtt_measreq_cmdid = WMI_10_2_RTT_MEASREQ_CMDID,
     457                 :            :         .rtt_tsf_cmdid = WMI_10_2_RTT_TSF_CMDID,
     458                 :            :         .vdev_spectral_scan_configure_cmdid =
     459                 :            :                                 WMI_10_2_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID,
     460                 :            :         .vdev_spectral_scan_enable_cmdid =
     461                 :            :                                 WMI_10_2_VDEV_SPECTRAL_SCAN_ENABLE_CMDID,
     462                 :            :         .request_stats_cmdid = WMI_10_2_REQUEST_STATS_CMDID,
     463                 :            :         .set_arp_ns_offload_cmdid = WMI_CMD_UNSUPPORTED,
     464                 :            :         .network_list_offload_config_cmdid = WMI_CMD_UNSUPPORTED,
     465                 :            :         .gtk_offload_cmdid = WMI_CMD_UNSUPPORTED,
     466                 :            :         .csa_offload_enable_cmdid = WMI_CMD_UNSUPPORTED,
     467                 :            :         .csa_offload_chanswitch_cmdid = WMI_CMD_UNSUPPORTED,
     468                 :            :         .chatter_set_mode_cmdid = WMI_CMD_UNSUPPORTED,
     469                 :            :         .peer_tid_addba_cmdid = WMI_CMD_UNSUPPORTED,
     470                 :            :         .peer_tid_delba_cmdid = WMI_CMD_UNSUPPORTED,
     471                 :            :         .sta_dtim_ps_method_cmdid = WMI_CMD_UNSUPPORTED,
     472                 :            :         .sta_uapsd_auto_trig_cmdid = WMI_CMD_UNSUPPORTED,
     473                 :            :         .sta_keepalive_cmd = WMI_CMD_UNSUPPORTED,
     474                 :            :         .echo_cmdid = WMI_10_2_ECHO_CMDID,
     475                 :            :         .pdev_utf_cmdid = WMI_10_2_PDEV_UTF_CMDID,
     476                 :            :         .dbglog_cfg_cmdid = WMI_10_2_DBGLOG_CFG_CMDID,
     477                 :            :         .pdev_qvit_cmdid = WMI_10_2_PDEV_QVIT_CMDID,
     478                 :            :         .pdev_ftm_intg_cmdid = WMI_CMD_UNSUPPORTED,
     479                 :            :         .vdev_set_keepalive_cmdid = WMI_CMD_UNSUPPORTED,
     480                 :            :         .vdev_get_keepalive_cmdid = WMI_CMD_UNSUPPORTED,
     481                 :            :         .force_fw_hang_cmdid = WMI_CMD_UNSUPPORTED,
     482                 :            :         .gpio_config_cmdid = WMI_10_2_GPIO_CONFIG_CMDID,
     483                 :            :         .gpio_output_cmdid = WMI_10_2_GPIO_OUTPUT_CMDID,
     484                 :            :         .pdev_get_temperature_cmdid = WMI_10_2_PDEV_GET_TEMPERATURE_CMDID,
     485                 :            :         .pdev_enable_adaptive_cca_cmdid = WMI_10_2_SET_CCA_PARAMS,
     486                 :            :         .scan_update_request_cmdid = WMI_CMD_UNSUPPORTED,
     487                 :            :         .vdev_standby_response_cmdid = WMI_CMD_UNSUPPORTED,
     488                 :            :         .vdev_resume_response_cmdid = WMI_CMD_UNSUPPORTED,
     489                 :            :         .wlan_peer_caching_add_peer_cmdid = WMI_CMD_UNSUPPORTED,
     490                 :            :         .wlan_peer_caching_evict_peer_cmdid = WMI_CMD_UNSUPPORTED,
     491                 :            :         .wlan_peer_caching_restore_peer_cmdid = WMI_CMD_UNSUPPORTED,
     492                 :            :         .wlan_peer_caching_print_all_peers_info_cmdid = WMI_CMD_UNSUPPORTED,
     493                 :            :         .peer_update_wds_entry_cmdid = WMI_CMD_UNSUPPORTED,
     494                 :            :         .peer_add_proxy_sta_entry_cmdid = WMI_CMD_UNSUPPORTED,
     495                 :            :         .rtt_keepalive_cmdid = WMI_CMD_UNSUPPORTED,
     496                 :            :         .oem_req_cmdid = WMI_CMD_UNSUPPORTED,
     497                 :            :         .nan_cmdid = WMI_CMD_UNSUPPORTED,
     498                 :            :         .vdev_ratemask_cmdid = WMI_CMD_UNSUPPORTED,
     499                 :            :         .qboost_cfg_cmdid = WMI_CMD_UNSUPPORTED,
     500                 :            :         .pdev_smart_ant_enable_cmdid = WMI_CMD_UNSUPPORTED,
     501                 :            :         .pdev_smart_ant_set_rx_antenna_cmdid = WMI_CMD_UNSUPPORTED,
     502                 :            :         .peer_smart_ant_set_tx_antenna_cmdid = WMI_CMD_UNSUPPORTED,
     503                 :            :         .peer_smart_ant_set_train_info_cmdid = WMI_CMD_UNSUPPORTED,
     504                 :            :         .peer_smart_ant_set_node_config_ops_cmdid = WMI_CMD_UNSUPPORTED,
     505                 :            :         .pdev_set_antenna_switch_table_cmdid = WMI_CMD_UNSUPPORTED,
     506                 :            :         .pdev_set_ctl_table_cmdid = WMI_CMD_UNSUPPORTED,
     507                 :            :         .pdev_set_mimogain_table_cmdid = WMI_CMD_UNSUPPORTED,
     508                 :            :         .pdev_ratepwr_table_cmdid = WMI_CMD_UNSUPPORTED,
     509                 :            :         .pdev_ratepwr_chainmsk_table_cmdid = WMI_CMD_UNSUPPORTED,
     510                 :            :         .pdev_fips_cmdid = WMI_CMD_UNSUPPORTED,
     511                 :            :         .tt_set_conf_cmdid = WMI_CMD_UNSUPPORTED,
     512                 :            :         .fwtest_cmdid = WMI_CMD_UNSUPPORTED,
     513                 :            :         .vdev_atf_request_cmdid = WMI_CMD_UNSUPPORTED,
     514                 :            :         .peer_atf_request_cmdid = WMI_CMD_UNSUPPORTED,
     515                 :            :         .pdev_get_ani_cck_config_cmdid = WMI_CMD_UNSUPPORTED,
     516                 :            :         .pdev_get_ani_ofdm_config_cmdid = WMI_CMD_UNSUPPORTED,
     517                 :            :         .pdev_reserve_ast_entry_cmdid = WMI_CMD_UNSUPPORTED,
     518                 :            :         .pdev_get_nfcal_power_cmdid = WMI_CMD_UNSUPPORTED,
     519                 :            :         .pdev_get_tpc_cmdid = WMI_CMD_UNSUPPORTED,
     520                 :            :         .pdev_get_ast_info_cmdid = WMI_CMD_UNSUPPORTED,
     521                 :            :         .vdev_set_dscp_tid_map_cmdid = WMI_CMD_UNSUPPORTED,
     522                 :            :         .pdev_get_info_cmdid = WMI_CMD_UNSUPPORTED,
     523                 :            :         .vdev_get_info_cmdid = WMI_CMD_UNSUPPORTED,
     524                 :            :         .vdev_filter_neighbor_rx_packets_cmdid = WMI_CMD_UNSUPPORTED,
     525                 :            :         .mu_cal_start_cmdid = WMI_CMD_UNSUPPORTED,
     526                 :            :         .set_cca_params_cmdid = WMI_CMD_UNSUPPORTED,
     527                 :            :         .pdev_bss_chan_info_request_cmdid =
     528                 :            :                 WMI_10_2_PDEV_BSS_CHAN_INFO_REQUEST_CMDID,
     529                 :            :         .pdev_get_tpc_table_cmdid = WMI_CMD_UNSUPPORTED,
     530                 :            :         .radar_found_cmdid = WMI_CMD_UNSUPPORTED,
     531                 :            :         .set_bb_timing_cmdid = WMI_10_2_PDEV_SET_BB_TIMING_CONFIG_CMDID,
     532                 :            : };
     533                 :            : 
     534                 :            : /* 10.4 WMI cmd track */
     535                 :            : static struct wmi_cmd_map wmi_10_4_cmd_map = {
     536                 :            :         .init_cmdid = WMI_10_4_INIT_CMDID,
     537                 :            :         .start_scan_cmdid = WMI_10_4_START_SCAN_CMDID,
     538                 :            :         .stop_scan_cmdid = WMI_10_4_STOP_SCAN_CMDID,
     539                 :            :         .scan_chan_list_cmdid = WMI_10_4_SCAN_CHAN_LIST_CMDID,
     540                 :            :         .scan_sch_prio_tbl_cmdid = WMI_10_4_SCAN_SCH_PRIO_TBL_CMDID,
     541                 :            :         .scan_prob_req_oui_cmdid = WMI_CMD_UNSUPPORTED,
     542                 :            :         .pdev_set_regdomain_cmdid = WMI_10_4_PDEV_SET_REGDOMAIN_CMDID,
     543                 :            :         .pdev_set_channel_cmdid = WMI_10_4_PDEV_SET_CHANNEL_CMDID,
     544                 :            :         .pdev_set_param_cmdid = WMI_10_4_PDEV_SET_PARAM_CMDID,
     545                 :            :         .pdev_pktlog_enable_cmdid = WMI_10_4_PDEV_PKTLOG_ENABLE_CMDID,
     546                 :            :         .pdev_pktlog_disable_cmdid = WMI_10_4_PDEV_PKTLOG_DISABLE_CMDID,
     547                 :            :         .pdev_set_wmm_params_cmdid = WMI_10_4_PDEV_SET_WMM_PARAMS_CMDID,
     548                 :            :         .pdev_set_ht_cap_ie_cmdid = WMI_10_4_PDEV_SET_HT_CAP_IE_CMDID,
     549                 :            :         .pdev_set_vht_cap_ie_cmdid = WMI_10_4_PDEV_SET_VHT_CAP_IE_CMDID,
     550                 :            :         .pdev_set_dscp_tid_map_cmdid = WMI_10_4_PDEV_SET_DSCP_TID_MAP_CMDID,
     551                 :            :         .pdev_set_quiet_mode_cmdid = WMI_10_4_PDEV_SET_QUIET_MODE_CMDID,
     552                 :            :         .pdev_green_ap_ps_enable_cmdid = WMI_10_4_PDEV_GREEN_AP_PS_ENABLE_CMDID,
     553                 :            :         .pdev_get_tpc_config_cmdid = WMI_10_4_PDEV_GET_TPC_CONFIG_CMDID,
     554                 :            :         .pdev_set_base_macaddr_cmdid = WMI_10_4_PDEV_SET_BASE_MACADDR_CMDID,
     555                 :            :         .vdev_create_cmdid = WMI_10_4_VDEV_CREATE_CMDID,
     556                 :            :         .vdev_delete_cmdid = WMI_10_4_VDEV_DELETE_CMDID,
     557                 :            :         .vdev_start_request_cmdid = WMI_10_4_VDEV_START_REQUEST_CMDID,
     558                 :            :         .vdev_restart_request_cmdid = WMI_10_4_VDEV_RESTART_REQUEST_CMDID,
     559                 :            :         .vdev_up_cmdid = WMI_10_4_VDEV_UP_CMDID,
     560                 :            :         .vdev_stop_cmdid = WMI_10_4_VDEV_STOP_CMDID,
     561                 :            :         .vdev_down_cmdid = WMI_10_4_VDEV_DOWN_CMDID,
     562                 :            :         .vdev_set_param_cmdid = WMI_10_4_VDEV_SET_PARAM_CMDID,
     563                 :            :         .vdev_install_key_cmdid = WMI_10_4_VDEV_INSTALL_KEY_CMDID,
     564                 :            :         .peer_create_cmdid = WMI_10_4_PEER_CREATE_CMDID,
     565                 :            :         .peer_delete_cmdid = WMI_10_4_PEER_DELETE_CMDID,
     566                 :            :         .peer_flush_tids_cmdid = WMI_10_4_PEER_FLUSH_TIDS_CMDID,
     567                 :            :         .peer_set_param_cmdid = WMI_10_4_PEER_SET_PARAM_CMDID,
     568                 :            :         .peer_assoc_cmdid = WMI_10_4_PEER_ASSOC_CMDID,
     569                 :            :         .peer_add_wds_entry_cmdid = WMI_10_4_PEER_ADD_WDS_ENTRY_CMDID,
     570                 :            :         .peer_remove_wds_entry_cmdid = WMI_10_4_PEER_REMOVE_WDS_ENTRY_CMDID,
     571                 :            :         .peer_mcast_group_cmdid = WMI_10_4_PEER_MCAST_GROUP_CMDID,
     572                 :            :         .bcn_tx_cmdid = WMI_10_4_BCN_TX_CMDID,
     573                 :            :         .pdev_send_bcn_cmdid = WMI_10_4_PDEV_SEND_BCN_CMDID,
     574                 :            :         .bcn_tmpl_cmdid = WMI_10_4_BCN_PRB_TMPL_CMDID,
     575                 :            :         .bcn_filter_rx_cmdid = WMI_10_4_BCN_FILTER_RX_CMDID,
     576                 :            :         .prb_req_filter_rx_cmdid = WMI_10_4_PRB_REQ_FILTER_RX_CMDID,
     577                 :            :         .mgmt_tx_cmdid = WMI_10_4_MGMT_TX_CMDID,
     578                 :            :         .prb_tmpl_cmdid = WMI_10_4_PRB_TMPL_CMDID,
     579                 :            :         .addba_clear_resp_cmdid = WMI_10_4_ADDBA_CLEAR_RESP_CMDID,
     580                 :            :         .addba_send_cmdid = WMI_10_4_ADDBA_SEND_CMDID,
     581                 :            :         .addba_status_cmdid = WMI_10_4_ADDBA_STATUS_CMDID,
     582                 :            :         .delba_send_cmdid = WMI_10_4_DELBA_SEND_CMDID,
     583                 :            :         .addba_set_resp_cmdid = WMI_10_4_ADDBA_SET_RESP_CMDID,
     584                 :            :         .send_singleamsdu_cmdid = WMI_10_4_SEND_SINGLEAMSDU_CMDID,
     585                 :            :         .sta_powersave_mode_cmdid = WMI_10_4_STA_POWERSAVE_MODE_CMDID,
     586                 :            :         .sta_powersave_param_cmdid = WMI_10_4_STA_POWERSAVE_PARAM_CMDID,
     587                 :            :         .sta_mimo_ps_mode_cmdid = WMI_10_4_STA_MIMO_PS_MODE_CMDID,
     588                 :            :         .pdev_dfs_enable_cmdid = WMI_10_4_PDEV_DFS_ENABLE_CMDID,
     589                 :            :         .pdev_dfs_disable_cmdid = WMI_10_4_PDEV_DFS_DISABLE_CMDID,
     590                 :            :         .roam_scan_mode = WMI_10_4_ROAM_SCAN_MODE,
     591                 :            :         .roam_scan_rssi_threshold = WMI_10_4_ROAM_SCAN_RSSI_THRESHOLD,
     592                 :            :         .roam_scan_period = WMI_10_4_ROAM_SCAN_PERIOD,
     593                 :            :         .roam_scan_rssi_change_threshold =
     594                 :            :                                 WMI_10_4_ROAM_SCAN_RSSI_CHANGE_THRESHOLD,
     595                 :            :         .roam_ap_profile = WMI_10_4_ROAM_AP_PROFILE,
     596                 :            :         .ofl_scan_add_ap_profile = WMI_10_4_OFL_SCAN_ADD_AP_PROFILE,
     597                 :            :         .ofl_scan_remove_ap_profile = WMI_10_4_OFL_SCAN_REMOVE_AP_PROFILE,
     598                 :            :         .ofl_scan_period = WMI_10_4_OFL_SCAN_PERIOD,
     599                 :            :         .p2p_dev_set_device_info = WMI_10_4_P2P_DEV_SET_DEVICE_INFO,
     600                 :            :         .p2p_dev_set_discoverability = WMI_10_4_P2P_DEV_SET_DISCOVERABILITY,
     601                 :            :         .p2p_go_set_beacon_ie = WMI_10_4_P2P_GO_SET_BEACON_IE,
     602                 :            :         .p2p_go_set_probe_resp_ie = WMI_10_4_P2P_GO_SET_PROBE_RESP_IE,
     603                 :            :         .p2p_set_vendor_ie_data_cmdid = WMI_10_4_P2P_SET_VENDOR_IE_DATA_CMDID,
     604                 :            :         .ap_ps_peer_param_cmdid = WMI_10_4_AP_PS_PEER_PARAM_CMDID,
     605                 :            :         .ap_ps_peer_uapsd_coex_cmdid = WMI_10_4_AP_PS_PEER_UAPSD_COEX_CMDID,
     606                 :            :         .peer_rate_retry_sched_cmdid = WMI_10_4_PEER_RATE_RETRY_SCHED_CMDID,
     607                 :            :         .wlan_profile_trigger_cmdid = WMI_10_4_WLAN_PROFILE_TRIGGER_CMDID,
     608                 :            :         .wlan_profile_set_hist_intvl_cmdid =
     609                 :            :                                 WMI_10_4_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
     610                 :            :         .wlan_profile_get_profile_data_cmdid =
     611                 :            :                                 WMI_10_4_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
     612                 :            :         .wlan_profile_enable_profile_id_cmdid =
     613                 :            :                                 WMI_10_4_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
     614                 :            :         .wlan_profile_list_profile_id_cmdid =
     615                 :            :                                 WMI_10_4_WLAN_PROFILE_LIST_PROFILE_ID_CMDID,
     616                 :            :         .pdev_suspend_cmdid = WMI_10_4_PDEV_SUSPEND_CMDID,
     617                 :            :         .pdev_resume_cmdid = WMI_10_4_PDEV_RESUME_CMDID,
     618                 :            :         .add_bcn_filter_cmdid = WMI_10_4_ADD_BCN_FILTER_CMDID,
     619                 :            :         .rmv_bcn_filter_cmdid = WMI_10_4_RMV_BCN_FILTER_CMDID,
     620                 :            :         .wow_add_wake_pattern_cmdid = WMI_10_4_WOW_ADD_WAKE_PATTERN_CMDID,
     621                 :            :         .wow_del_wake_pattern_cmdid = WMI_10_4_WOW_DEL_WAKE_PATTERN_CMDID,
     622                 :            :         .wow_enable_disable_wake_event_cmdid =
     623                 :            :                                 WMI_10_4_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID,
     624                 :            :         .wow_enable_cmdid = WMI_10_4_WOW_ENABLE_CMDID,
     625                 :            :         .wow_hostwakeup_from_sleep_cmdid =
     626                 :            :                                 WMI_10_4_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID,
     627                 :            :         .rtt_measreq_cmdid = WMI_10_4_RTT_MEASREQ_CMDID,
     628                 :            :         .rtt_tsf_cmdid = WMI_10_4_RTT_TSF_CMDID,
     629                 :            :         .vdev_spectral_scan_configure_cmdid =
     630                 :            :                                 WMI_10_4_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID,
     631                 :            :         .vdev_spectral_scan_enable_cmdid =
     632                 :            :                                 WMI_10_4_VDEV_SPECTRAL_SCAN_ENABLE_CMDID,
     633                 :            :         .request_stats_cmdid = WMI_10_4_REQUEST_STATS_CMDID,
     634                 :            :         .set_arp_ns_offload_cmdid = WMI_CMD_UNSUPPORTED,
     635                 :            :         .network_list_offload_config_cmdid = WMI_CMD_UNSUPPORTED,
     636                 :            :         .gtk_offload_cmdid = WMI_10_4_GTK_OFFLOAD_CMDID,
     637                 :            :         .csa_offload_enable_cmdid = WMI_10_4_CSA_OFFLOAD_ENABLE_CMDID,
     638                 :            :         .csa_offload_chanswitch_cmdid = WMI_10_4_CSA_OFFLOAD_CHANSWITCH_CMDID,
     639                 :            :         .chatter_set_mode_cmdid = WMI_CMD_UNSUPPORTED,
     640                 :            :         .peer_tid_addba_cmdid = WMI_CMD_UNSUPPORTED,
     641                 :            :         .peer_tid_delba_cmdid = WMI_CMD_UNSUPPORTED,
     642                 :            :         .sta_dtim_ps_method_cmdid = WMI_CMD_UNSUPPORTED,
     643                 :            :         .sta_uapsd_auto_trig_cmdid = WMI_CMD_UNSUPPORTED,
     644                 :            :         .sta_keepalive_cmd = WMI_CMD_UNSUPPORTED,
     645                 :            :         .echo_cmdid = WMI_10_4_ECHO_CMDID,
     646                 :            :         .pdev_utf_cmdid = WMI_10_4_PDEV_UTF_CMDID,
     647                 :            :         .dbglog_cfg_cmdid = WMI_10_4_DBGLOG_CFG_CMDID,
     648                 :            :         .pdev_qvit_cmdid = WMI_10_4_PDEV_QVIT_CMDID,
     649                 :            :         .pdev_ftm_intg_cmdid = WMI_CMD_UNSUPPORTED,
     650                 :            :         .vdev_set_keepalive_cmdid = WMI_10_4_VDEV_SET_KEEPALIVE_CMDID,
     651                 :            :         .vdev_get_keepalive_cmdid = WMI_10_4_VDEV_GET_KEEPALIVE_CMDID,
     652                 :            :         .force_fw_hang_cmdid = WMI_10_4_FORCE_FW_HANG_CMDID,
     653                 :            :         .gpio_config_cmdid = WMI_10_4_GPIO_CONFIG_CMDID,
     654                 :            :         .gpio_output_cmdid = WMI_10_4_GPIO_OUTPUT_CMDID,
     655                 :            :         .pdev_get_temperature_cmdid = WMI_10_4_PDEV_GET_TEMPERATURE_CMDID,
     656                 :            :         .vdev_set_wmm_params_cmdid = WMI_CMD_UNSUPPORTED,
     657                 :            :         .adaptive_qcs_cmdid = WMI_CMD_UNSUPPORTED,
     658                 :            :         .scan_update_request_cmdid = WMI_10_4_SCAN_UPDATE_REQUEST_CMDID,
     659                 :            :         .vdev_standby_response_cmdid = WMI_10_4_VDEV_STANDBY_RESPONSE_CMDID,
     660                 :            :         .vdev_resume_response_cmdid = WMI_10_4_VDEV_RESUME_RESPONSE_CMDID,
     661                 :            :         .wlan_peer_caching_add_peer_cmdid =
     662                 :            :                         WMI_10_4_WLAN_PEER_CACHING_ADD_PEER_CMDID,
     663                 :            :         .wlan_peer_caching_evict_peer_cmdid =
     664                 :            :                         WMI_10_4_WLAN_PEER_CACHING_EVICT_PEER_CMDID,
     665                 :            :         .wlan_peer_caching_restore_peer_cmdid =
     666                 :            :                         WMI_10_4_WLAN_PEER_CACHING_RESTORE_PEER_CMDID,
     667                 :            :         .wlan_peer_caching_print_all_peers_info_cmdid =
     668                 :            :                         WMI_10_4_WLAN_PEER_CACHING_PRINT_ALL_PEERS_INFO_CMDID,
     669                 :            :         .peer_update_wds_entry_cmdid = WMI_10_4_PEER_UPDATE_WDS_ENTRY_CMDID,
     670                 :            :         .peer_add_proxy_sta_entry_cmdid =
     671                 :            :                         WMI_10_4_PEER_ADD_PROXY_STA_ENTRY_CMDID,
     672                 :            :         .rtt_keepalive_cmdid = WMI_10_4_RTT_KEEPALIVE_CMDID,
     673                 :            :         .oem_req_cmdid = WMI_10_4_OEM_REQ_CMDID,
     674                 :            :         .nan_cmdid = WMI_10_4_NAN_CMDID,
     675                 :            :         .vdev_ratemask_cmdid = WMI_10_4_VDEV_RATEMASK_CMDID,
     676                 :            :         .qboost_cfg_cmdid = WMI_10_4_QBOOST_CFG_CMDID,
     677                 :            :         .pdev_smart_ant_enable_cmdid = WMI_10_4_PDEV_SMART_ANT_ENABLE_CMDID,
     678                 :            :         .pdev_smart_ant_set_rx_antenna_cmdid =
     679                 :            :                         WMI_10_4_PDEV_SMART_ANT_SET_RX_ANTENNA_CMDID,
     680                 :            :         .peer_smart_ant_set_tx_antenna_cmdid =
     681                 :            :                         WMI_10_4_PEER_SMART_ANT_SET_TX_ANTENNA_CMDID,
     682                 :            :         .peer_smart_ant_set_train_info_cmdid =
     683                 :            :                         WMI_10_4_PEER_SMART_ANT_SET_TRAIN_INFO_CMDID,
     684                 :            :         .peer_smart_ant_set_node_config_ops_cmdid =
     685                 :            :                         WMI_10_4_PEER_SMART_ANT_SET_NODE_CONFIG_OPS_CMDID,
     686                 :            :         .pdev_set_antenna_switch_table_cmdid =
     687                 :            :                         WMI_10_4_PDEV_SET_ANTENNA_SWITCH_TABLE_CMDID,
     688                 :            :         .pdev_set_ctl_table_cmdid = WMI_10_4_PDEV_SET_CTL_TABLE_CMDID,
     689                 :            :         .pdev_set_mimogain_table_cmdid = WMI_10_4_PDEV_SET_MIMOGAIN_TABLE_CMDID,
     690                 :            :         .pdev_ratepwr_table_cmdid = WMI_10_4_PDEV_RATEPWR_TABLE_CMDID,
     691                 :            :         .pdev_ratepwr_chainmsk_table_cmdid =
     692                 :            :                         WMI_10_4_PDEV_RATEPWR_CHAINMSK_TABLE_CMDID,
     693                 :            :         .pdev_fips_cmdid = WMI_10_4_PDEV_FIPS_CMDID,
     694                 :            :         .tt_set_conf_cmdid = WMI_10_4_TT_SET_CONF_CMDID,
     695                 :            :         .fwtest_cmdid = WMI_10_4_FWTEST_CMDID,
     696                 :            :         .vdev_atf_request_cmdid = WMI_10_4_VDEV_ATF_REQUEST_CMDID,
     697                 :            :         .peer_atf_request_cmdid = WMI_10_4_PEER_ATF_REQUEST_CMDID,
     698                 :            :         .pdev_get_ani_cck_config_cmdid = WMI_10_4_PDEV_GET_ANI_CCK_CONFIG_CMDID,
     699                 :            :         .pdev_get_ani_ofdm_config_cmdid =
     700                 :            :                         WMI_10_4_PDEV_GET_ANI_OFDM_CONFIG_CMDID,
     701                 :            :         .pdev_reserve_ast_entry_cmdid = WMI_10_4_PDEV_RESERVE_AST_ENTRY_CMDID,
     702                 :            :         .pdev_get_nfcal_power_cmdid = WMI_10_4_PDEV_GET_NFCAL_POWER_CMDID,
     703                 :            :         .pdev_get_tpc_cmdid = WMI_10_4_PDEV_GET_TPC_CMDID,
     704                 :            :         .pdev_get_ast_info_cmdid = WMI_10_4_PDEV_GET_AST_INFO_CMDID,
     705                 :            :         .vdev_set_dscp_tid_map_cmdid = WMI_10_4_VDEV_SET_DSCP_TID_MAP_CMDID,
     706                 :            :         .pdev_get_info_cmdid = WMI_10_4_PDEV_GET_INFO_CMDID,
     707                 :            :         .vdev_get_info_cmdid = WMI_10_4_VDEV_GET_INFO_CMDID,
     708                 :            :         .vdev_filter_neighbor_rx_packets_cmdid =
     709                 :            :                         WMI_10_4_VDEV_FILTER_NEIGHBOR_RX_PACKETS_CMDID,
     710                 :            :         .mu_cal_start_cmdid = WMI_10_4_MU_CAL_START_CMDID,
     711                 :            :         .set_cca_params_cmdid = WMI_10_4_SET_CCA_PARAMS_CMDID,
     712                 :            :         .pdev_bss_chan_info_request_cmdid =
     713                 :            :                         WMI_10_4_PDEV_BSS_CHAN_INFO_REQUEST_CMDID,
     714                 :            :         .ext_resource_cfg_cmdid = WMI_10_4_EXT_RESOURCE_CFG_CMDID,
     715                 :            :         .vdev_set_ie_cmdid = WMI_10_4_VDEV_SET_IE_CMDID,
     716                 :            :         .set_lteu_config_cmdid = WMI_10_4_SET_LTEU_CONFIG_CMDID,
     717                 :            :         .atf_ssid_grouping_request_cmdid =
     718                 :            :                         WMI_10_4_ATF_SSID_GROUPING_REQUEST_CMDID,
     719                 :            :         .peer_atf_ext_request_cmdid = WMI_10_4_PEER_ATF_EXT_REQUEST_CMDID,
     720                 :            :         .set_periodic_channel_stats_cfg_cmdid =
     721                 :            :                         WMI_10_4_SET_PERIODIC_CHANNEL_STATS_CONFIG,
     722                 :            :         .peer_bwf_request_cmdid = WMI_10_4_PEER_BWF_REQUEST_CMDID,
     723                 :            :         .btcoex_cfg_cmdid = WMI_10_4_BTCOEX_CFG_CMDID,
     724                 :            :         .peer_tx_mu_txmit_count_cmdid = WMI_10_4_PEER_TX_MU_TXMIT_COUNT_CMDID,
     725                 :            :         .peer_tx_mu_txmit_rstcnt_cmdid = WMI_10_4_PEER_TX_MU_TXMIT_RSTCNT_CMDID,
     726                 :            :         .peer_gid_userpos_list_cmdid = WMI_10_4_PEER_GID_USERPOS_LIST_CMDID,
     727                 :            :         .pdev_check_cal_version_cmdid = WMI_10_4_PDEV_CHECK_CAL_VERSION_CMDID,
     728                 :            :         .coex_version_cfg_cmid = WMI_10_4_COEX_VERSION_CFG_CMID,
     729                 :            :         .pdev_get_rx_filter_cmdid = WMI_10_4_PDEV_GET_RX_FILTER_CMDID,
     730                 :            :         .pdev_extended_nss_cfg_cmdid = WMI_10_4_PDEV_EXTENDED_NSS_CFG_CMDID,
     731                 :            :         .vdev_set_scan_nac_rssi_cmdid = WMI_10_4_VDEV_SET_SCAN_NAC_RSSI_CMDID,
     732                 :            :         .prog_gpio_band_select_cmdid = WMI_10_4_PROG_GPIO_BAND_SELECT_CMDID,
     733                 :            :         .config_smart_logging_cmdid = WMI_10_4_CONFIG_SMART_LOGGING_CMDID,
     734                 :            :         .debug_fatal_condition_cmdid = WMI_10_4_DEBUG_FATAL_CONDITION_CMDID,
     735                 :            :         .get_tsf_timer_cmdid = WMI_10_4_GET_TSF_TIMER_CMDID,
     736                 :            :         .pdev_get_tpc_table_cmdid = WMI_10_4_PDEV_GET_TPC_TABLE_CMDID,
     737                 :            :         .vdev_sifs_trigger_time_cmdid = WMI_10_4_VDEV_SIFS_TRIGGER_TIME_CMDID,
     738                 :            :         .pdev_wds_entry_list_cmdid = WMI_10_4_PDEV_WDS_ENTRY_LIST_CMDID,
     739                 :            :         .tdls_set_state_cmdid = WMI_10_4_TDLS_SET_STATE_CMDID,
     740                 :            :         .tdls_peer_update_cmdid = WMI_10_4_TDLS_PEER_UPDATE_CMDID,
     741                 :            :         .tdls_set_offchan_mode_cmdid = WMI_10_4_TDLS_SET_OFFCHAN_MODE_CMDID,
     742                 :            :         .radar_found_cmdid = WMI_10_4_RADAR_FOUND_CMDID,
     743                 :            : };
     744                 :            : 
     745                 :            : static struct wmi_peer_param_map wmi_peer_param_map = {
     746                 :            :         .smps_state = WMI_PEER_SMPS_STATE,
     747                 :            :         .ampdu = WMI_PEER_AMPDU,
     748                 :            :         .authorize = WMI_PEER_AUTHORIZE,
     749                 :            :         .chan_width = WMI_PEER_CHAN_WIDTH,
     750                 :            :         .nss = WMI_PEER_NSS,
     751                 :            :         .use_4addr = WMI_PEER_USE_4ADDR,
     752                 :            :         .use_fixed_power = WMI_PEER_USE_FIXED_PWR,
     753                 :            :         .debug = WMI_PEER_DEBUG,
     754                 :            :         .phymode = WMI_PEER_PHYMODE,
     755                 :            :         .dummy_var = WMI_PEER_DUMMY_VAR,
     756                 :            : };
     757                 :            : 
     758                 :            : /* MAIN WMI VDEV param map */
     759                 :            : static struct wmi_vdev_param_map wmi_vdev_param_map = {
     760                 :            :         .rts_threshold = WMI_VDEV_PARAM_RTS_THRESHOLD,
     761                 :            :         .fragmentation_threshold = WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD,
     762                 :            :         .beacon_interval = WMI_VDEV_PARAM_BEACON_INTERVAL,
     763                 :            :         .listen_interval = WMI_VDEV_PARAM_LISTEN_INTERVAL,
     764                 :            :         .multicast_rate = WMI_VDEV_PARAM_MULTICAST_RATE,
     765                 :            :         .mgmt_tx_rate = WMI_VDEV_PARAM_MGMT_TX_RATE,
     766                 :            :         .slot_time = WMI_VDEV_PARAM_SLOT_TIME,
     767                 :            :         .preamble = WMI_VDEV_PARAM_PREAMBLE,
     768                 :            :         .swba_time = WMI_VDEV_PARAM_SWBA_TIME,
     769                 :            :         .wmi_vdev_stats_update_period = WMI_VDEV_STATS_UPDATE_PERIOD,
     770                 :            :         .wmi_vdev_pwrsave_ageout_time = WMI_VDEV_PWRSAVE_AGEOUT_TIME,
     771                 :            :         .wmi_vdev_host_swba_interval = WMI_VDEV_HOST_SWBA_INTERVAL,
     772                 :            :         .dtim_period = WMI_VDEV_PARAM_DTIM_PERIOD,
     773                 :            :         .wmi_vdev_oc_scheduler_air_time_limit =
     774                 :            :                                         WMI_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT,
     775                 :            :         .wds = WMI_VDEV_PARAM_WDS,
     776                 :            :         .atim_window = WMI_VDEV_PARAM_ATIM_WINDOW,
     777                 :            :         .bmiss_count_max = WMI_VDEV_PARAM_BMISS_COUNT_MAX,
     778                 :            :         .bmiss_first_bcnt = WMI_VDEV_PARAM_BMISS_FIRST_BCNT,
     779                 :            :         .bmiss_final_bcnt = WMI_VDEV_PARAM_BMISS_FINAL_BCNT,
     780                 :            :         .feature_wmm = WMI_VDEV_PARAM_FEATURE_WMM,
     781                 :            :         .chwidth = WMI_VDEV_PARAM_CHWIDTH,
     782                 :            :         .chextoffset = WMI_VDEV_PARAM_CHEXTOFFSET,
     783                 :            :         .disable_htprotection = WMI_VDEV_PARAM_DISABLE_HTPROTECTION,
     784                 :            :         .sta_quickkickout = WMI_VDEV_PARAM_STA_QUICKKICKOUT,
     785                 :            :         .mgmt_rate = WMI_VDEV_PARAM_MGMT_RATE,
     786                 :            :         .protection_mode = WMI_VDEV_PARAM_PROTECTION_MODE,
     787                 :            :         .fixed_rate = WMI_VDEV_PARAM_FIXED_RATE,
     788                 :            :         .sgi = WMI_VDEV_PARAM_SGI,
     789                 :            :         .ldpc = WMI_VDEV_PARAM_LDPC,
     790                 :            :         .tx_stbc = WMI_VDEV_PARAM_TX_STBC,
     791                 :            :         .rx_stbc = WMI_VDEV_PARAM_RX_STBC,
     792                 :            :         .intra_bss_fwd = WMI_VDEV_PARAM_INTRA_BSS_FWD,
     793                 :            :         .def_keyid = WMI_VDEV_PARAM_DEF_KEYID,
     794                 :            :         .nss = WMI_VDEV_PARAM_NSS,
     795                 :            :         .bcast_data_rate = WMI_VDEV_PARAM_BCAST_DATA_RATE,
     796                 :            :         .mcast_data_rate = WMI_VDEV_PARAM_MCAST_DATA_RATE,
     797                 :            :         .mcast_indicate = WMI_VDEV_PARAM_MCAST_INDICATE,
     798                 :            :         .dhcp_indicate = WMI_VDEV_PARAM_DHCP_INDICATE,
     799                 :            :         .unknown_dest_indicate = WMI_VDEV_PARAM_UNKNOWN_DEST_INDICATE,
     800                 :            :         .ap_keepalive_min_idle_inactive_time_secs =
     801                 :            :                         WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS,
     802                 :            :         .ap_keepalive_max_idle_inactive_time_secs =
     803                 :            :                         WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS,
     804                 :            :         .ap_keepalive_max_unresponsive_time_secs =
     805                 :            :                         WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS,
     806                 :            :         .ap_enable_nawds = WMI_VDEV_PARAM_AP_ENABLE_NAWDS,
     807                 :            :         .mcast2ucast_set = WMI_VDEV_PARAM_UNSUPPORTED,
     808                 :            :         .enable_rtscts = WMI_VDEV_PARAM_ENABLE_RTSCTS,
     809                 :            :         .txbf = WMI_VDEV_PARAM_TXBF,
     810                 :            :         .packet_powersave = WMI_VDEV_PARAM_PACKET_POWERSAVE,
     811                 :            :         .drop_unencry = WMI_VDEV_PARAM_DROP_UNENCRY,
     812                 :            :         .tx_encap_type = WMI_VDEV_PARAM_TX_ENCAP_TYPE,
     813                 :            :         .ap_detect_out_of_sync_sleeping_sta_time_secs =
     814                 :            :                                         WMI_VDEV_PARAM_UNSUPPORTED,
     815                 :            :         .rc_num_retries = WMI_VDEV_PARAM_UNSUPPORTED,
     816                 :            :         .cabq_maxdur = WMI_VDEV_PARAM_UNSUPPORTED,
     817                 :            :         .mfptest_set = WMI_VDEV_PARAM_UNSUPPORTED,
     818                 :            :         .rts_fixed_rate = WMI_VDEV_PARAM_UNSUPPORTED,
     819                 :            :         .vht_sgimask = WMI_VDEV_PARAM_UNSUPPORTED,
     820                 :            :         .vht80_ratemask = WMI_VDEV_PARAM_UNSUPPORTED,
     821                 :            :         .early_rx_adjust_enable = WMI_VDEV_PARAM_UNSUPPORTED,
     822                 :            :         .early_rx_tgt_bmiss_num = WMI_VDEV_PARAM_UNSUPPORTED,
     823                 :            :         .early_rx_bmiss_sample_cycle = WMI_VDEV_PARAM_UNSUPPORTED,
     824                 :            :         .early_rx_slop_step = WMI_VDEV_PARAM_UNSUPPORTED,
     825                 :            :         .early_rx_init_slop = WMI_VDEV_PARAM_UNSUPPORTED,
     826                 :            :         .early_rx_adjust_pause = WMI_VDEV_PARAM_UNSUPPORTED,
     827                 :            :         .proxy_sta = WMI_VDEV_PARAM_UNSUPPORTED,
     828                 :            :         .meru_vc = WMI_VDEV_PARAM_UNSUPPORTED,
     829                 :            :         .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED,
     830                 :            :         .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED,
     831                 :            :         .disable_4addr_src_lrn = WMI_VDEV_PARAM_UNSUPPORTED,
     832                 :            :         .rtt_responder_role = WMI_VDEV_PARAM_UNSUPPORTED,
     833                 :            : };
     834                 :            : 
     835                 :            : /* 10.X WMI VDEV param map */
     836                 :            : static struct wmi_vdev_param_map wmi_10x_vdev_param_map = {
     837                 :            :         .rts_threshold = WMI_10X_VDEV_PARAM_RTS_THRESHOLD,
     838                 :            :         .fragmentation_threshold = WMI_10X_VDEV_PARAM_FRAGMENTATION_THRESHOLD,
     839                 :            :         .beacon_interval = WMI_10X_VDEV_PARAM_BEACON_INTERVAL,
     840                 :            :         .listen_interval = WMI_10X_VDEV_PARAM_LISTEN_INTERVAL,
     841                 :            :         .multicast_rate = WMI_10X_VDEV_PARAM_MULTICAST_RATE,
     842                 :            :         .mgmt_tx_rate = WMI_10X_VDEV_PARAM_MGMT_TX_RATE,
     843                 :            :         .slot_time = WMI_10X_VDEV_PARAM_SLOT_TIME,
     844                 :            :         .preamble = WMI_10X_VDEV_PARAM_PREAMBLE,
     845                 :            :         .swba_time = WMI_10X_VDEV_PARAM_SWBA_TIME,
     846                 :            :         .wmi_vdev_stats_update_period = WMI_10X_VDEV_STATS_UPDATE_PERIOD,
     847                 :            :         .wmi_vdev_pwrsave_ageout_time = WMI_10X_VDEV_PWRSAVE_AGEOUT_TIME,
     848                 :            :         .wmi_vdev_host_swba_interval = WMI_10X_VDEV_HOST_SWBA_INTERVAL,
     849                 :            :         .dtim_period = WMI_10X_VDEV_PARAM_DTIM_PERIOD,
     850                 :            :         .wmi_vdev_oc_scheduler_air_time_limit =
     851                 :            :                                 WMI_10X_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT,
     852                 :            :         .wds = WMI_10X_VDEV_PARAM_WDS,
     853                 :            :         .atim_window = WMI_10X_VDEV_PARAM_ATIM_WINDOW,
     854                 :            :         .bmiss_count_max = WMI_10X_VDEV_PARAM_BMISS_COUNT_MAX,
     855                 :            :         .bmiss_first_bcnt = WMI_VDEV_PARAM_UNSUPPORTED,
     856                 :            :         .bmiss_final_bcnt = WMI_VDEV_PARAM_UNSUPPORTED,
     857                 :            :         .feature_wmm = WMI_10X_VDEV_PARAM_FEATURE_WMM,
     858                 :            :         .chwidth = WMI_10X_VDEV_PARAM_CHWIDTH,
     859                 :            :         .chextoffset = WMI_10X_VDEV_PARAM_CHEXTOFFSET,
     860                 :            :         .disable_htprotection = WMI_10X_VDEV_PARAM_DISABLE_HTPROTECTION,
     861                 :            :         .sta_quickkickout = WMI_10X_VDEV_PARAM_STA_QUICKKICKOUT,
     862                 :            :         .mgmt_rate = WMI_10X_VDEV_PARAM_MGMT_RATE,
     863                 :            :         .protection_mode = WMI_10X_VDEV_PARAM_PROTECTION_MODE,
     864                 :            :         .fixed_rate = WMI_10X_VDEV_PARAM_FIXED_RATE,
     865                 :            :         .sgi = WMI_10X_VDEV_PARAM_SGI,
     866                 :            :         .ldpc = WMI_10X_VDEV_PARAM_LDPC,
     867                 :            :         .tx_stbc = WMI_10X_VDEV_PARAM_TX_STBC,
     868                 :            :         .rx_stbc = WMI_10X_VDEV_PARAM_RX_STBC,
     869                 :            :         .intra_bss_fwd = WMI_10X_VDEV_PARAM_INTRA_BSS_FWD,
     870                 :            :         .def_keyid = WMI_10X_VDEV_PARAM_DEF_KEYID,
     871                 :            :         .nss = WMI_10X_VDEV_PARAM_NSS,
     872                 :            :         .bcast_data_rate = WMI_10X_VDEV_PARAM_BCAST_DATA_RATE,
     873                 :            :         .mcast_data_rate = WMI_10X_VDEV_PARAM_MCAST_DATA_RATE,
     874                 :            :         .mcast_indicate = WMI_10X_VDEV_PARAM_MCAST_INDICATE,
     875                 :            :         .dhcp_indicate = WMI_10X_VDEV_PARAM_DHCP_INDICATE,
     876                 :            :         .unknown_dest_indicate = WMI_10X_VDEV_PARAM_UNKNOWN_DEST_INDICATE,
     877                 :            :         .ap_keepalive_min_idle_inactive_time_secs =
     878                 :            :                 WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS,
     879                 :            :         .ap_keepalive_max_idle_inactive_time_secs =
     880                 :            :                 WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS,
     881                 :            :         .ap_keepalive_max_unresponsive_time_secs =
     882                 :            :                 WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS,
     883                 :            :         .ap_enable_nawds = WMI_10X_VDEV_PARAM_AP_ENABLE_NAWDS,
     884                 :            :         .mcast2ucast_set = WMI_10X_VDEV_PARAM_MCAST2UCAST_SET,
     885                 :            :         .enable_rtscts = WMI_10X_VDEV_PARAM_ENABLE_RTSCTS,
     886                 :            :         .txbf = WMI_VDEV_PARAM_UNSUPPORTED,
     887                 :            :         .packet_powersave = WMI_VDEV_PARAM_UNSUPPORTED,
     888                 :            :         .drop_unencry = WMI_VDEV_PARAM_UNSUPPORTED,
     889                 :            :         .tx_encap_type = WMI_VDEV_PARAM_UNSUPPORTED,
     890                 :            :         .ap_detect_out_of_sync_sleeping_sta_time_secs =
     891                 :            :                 WMI_10X_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS,
     892                 :            :         .rc_num_retries = WMI_VDEV_PARAM_UNSUPPORTED,
     893                 :            :         .cabq_maxdur = WMI_VDEV_PARAM_UNSUPPORTED,
     894                 :            :         .mfptest_set = WMI_VDEV_PARAM_UNSUPPORTED,
     895                 :            :         .rts_fixed_rate = WMI_VDEV_PARAM_UNSUPPORTED,
     896                 :            :         .vht_sgimask = WMI_VDEV_PARAM_UNSUPPORTED,
     897                 :            :         .vht80_ratemask = WMI_VDEV_PARAM_UNSUPPORTED,
     898                 :            :         .early_rx_adjust_enable = WMI_VDEV_PARAM_UNSUPPORTED,
     899                 :            :         .early_rx_tgt_bmiss_num = WMI_VDEV_PARAM_UNSUPPORTED,
     900                 :            :         .early_rx_bmiss_sample_cycle = WMI_VDEV_PARAM_UNSUPPORTED,
     901                 :            :         .early_rx_slop_step = WMI_VDEV_PARAM_UNSUPPORTED,
     902                 :            :         .early_rx_init_slop = WMI_VDEV_PARAM_UNSUPPORTED,
     903                 :            :         .early_rx_adjust_pause = WMI_VDEV_PARAM_UNSUPPORTED,
     904                 :            :         .proxy_sta = WMI_VDEV_PARAM_UNSUPPORTED,
     905                 :            :         .meru_vc = WMI_VDEV_PARAM_UNSUPPORTED,
     906                 :            :         .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED,
     907                 :            :         .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED,
     908                 :            :         .disable_4addr_src_lrn = WMI_VDEV_PARAM_UNSUPPORTED,
     909                 :            :         .rtt_responder_role = WMI_VDEV_PARAM_UNSUPPORTED,
     910                 :            : };
     911                 :            : 
     912                 :            : static struct wmi_vdev_param_map wmi_10_2_4_vdev_param_map = {
     913                 :            :         .rts_threshold = WMI_10X_VDEV_PARAM_RTS_THRESHOLD,
     914                 :            :         .fragmentation_threshold = WMI_10X_VDEV_PARAM_FRAGMENTATION_THRESHOLD,
     915                 :            :         .beacon_interval = WMI_10X_VDEV_PARAM_BEACON_INTERVAL,
     916                 :            :         .listen_interval = WMI_10X_VDEV_PARAM_LISTEN_INTERVAL,
     917                 :            :         .multicast_rate = WMI_10X_VDEV_PARAM_MULTICAST_RATE,
     918                 :            :         .mgmt_tx_rate = WMI_10X_VDEV_PARAM_MGMT_TX_RATE,
     919                 :            :         .slot_time = WMI_10X_VDEV_PARAM_SLOT_TIME,
     920                 :            :         .preamble = WMI_10X_VDEV_PARAM_PREAMBLE,
     921                 :            :         .swba_time = WMI_10X_VDEV_PARAM_SWBA_TIME,
     922                 :            :         .wmi_vdev_stats_update_period = WMI_10X_VDEV_STATS_UPDATE_PERIOD,
     923                 :            :         .wmi_vdev_pwrsave_ageout_time = WMI_10X_VDEV_PWRSAVE_AGEOUT_TIME,
     924                 :            :         .wmi_vdev_host_swba_interval = WMI_10X_VDEV_HOST_SWBA_INTERVAL,
     925                 :            :         .dtim_period = WMI_10X_VDEV_PARAM_DTIM_PERIOD,
     926                 :            :         .wmi_vdev_oc_scheduler_air_time_limit =
     927                 :            :                                 WMI_10X_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT,
     928                 :            :         .wds = WMI_10X_VDEV_PARAM_WDS,
     929                 :            :         .atim_window = WMI_10X_VDEV_PARAM_ATIM_WINDOW,
     930                 :            :         .bmiss_count_max = WMI_10X_VDEV_PARAM_BMISS_COUNT_MAX,
     931                 :            :         .bmiss_first_bcnt = WMI_VDEV_PARAM_UNSUPPORTED,
     932                 :            :         .bmiss_final_bcnt = WMI_VDEV_PARAM_UNSUPPORTED,
     933                 :            :         .feature_wmm = WMI_10X_VDEV_PARAM_FEATURE_WMM,
     934                 :            :         .chwidth = WMI_10X_VDEV_PARAM_CHWIDTH,
     935                 :            :         .chextoffset = WMI_10X_VDEV_PARAM_CHEXTOFFSET,
     936                 :            :         .disable_htprotection = WMI_10X_VDEV_PARAM_DISABLE_HTPROTECTION,
     937                 :            :         .sta_quickkickout = WMI_10X_VDEV_PARAM_STA_QUICKKICKOUT,
     938                 :            :         .mgmt_rate = WMI_10X_VDEV_PARAM_MGMT_RATE,
     939                 :            :         .protection_mode = WMI_10X_VDEV_PARAM_PROTECTION_MODE,
     940                 :            :         .fixed_rate = WMI_10X_VDEV_PARAM_FIXED_RATE,
     941                 :            :         .sgi = WMI_10X_VDEV_PARAM_SGI,
     942                 :            :         .ldpc = WMI_10X_VDEV_PARAM_LDPC,
     943                 :            :         .tx_stbc = WMI_10X_VDEV_PARAM_TX_STBC,
     944                 :            :         .rx_stbc = WMI_10X_VDEV_PARAM_RX_STBC,
     945                 :            :         .intra_bss_fwd = WMI_10X_VDEV_PARAM_INTRA_BSS_FWD,
     946                 :            :         .def_keyid = WMI_10X_VDEV_PARAM_DEF_KEYID,
     947                 :            :         .nss = WMI_10X_VDEV_PARAM_NSS,
     948                 :            :         .bcast_data_rate = WMI_10X_VDEV_PARAM_BCAST_DATA_RATE,
     949                 :            :         .mcast_data_rate = WMI_10X_VDEV_PARAM_MCAST_DATA_RATE,
     950                 :            :         .mcast_indicate = WMI_10X_VDEV_PARAM_MCAST_INDICATE,
     951                 :            :         .dhcp_indicate = WMI_10X_VDEV_PARAM_DHCP_INDICATE,
     952                 :            :         .unknown_dest_indicate = WMI_10X_VDEV_PARAM_UNKNOWN_DEST_INDICATE,
     953                 :            :         .ap_keepalive_min_idle_inactive_time_secs =
     954                 :            :                 WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS,
     955                 :            :         .ap_keepalive_max_idle_inactive_time_secs =
     956                 :            :                 WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS,
     957                 :            :         .ap_keepalive_max_unresponsive_time_secs =
     958                 :            :                 WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS,
     959                 :            :         .ap_enable_nawds = WMI_10X_VDEV_PARAM_AP_ENABLE_NAWDS,
     960                 :            :         .mcast2ucast_set = WMI_10X_VDEV_PARAM_MCAST2UCAST_SET,
     961                 :            :         .enable_rtscts = WMI_10X_VDEV_PARAM_ENABLE_RTSCTS,
     962                 :            :         .txbf = WMI_VDEV_PARAM_UNSUPPORTED,
     963                 :            :         .packet_powersave = WMI_VDEV_PARAM_UNSUPPORTED,
     964                 :            :         .drop_unencry = WMI_VDEV_PARAM_UNSUPPORTED,
     965                 :            :         .tx_encap_type = WMI_VDEV_PARAM_UNSUPPORTED,
     966                 :            :         .ap_detect_out_of_sync_sleeping_sta_time_secs =
     967                 :            :                 WMI_10X_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS,
     968                 :            :         .rc_num_retries = WMI_VDEV_PARAM_UNSUPPORTED,
     969                 :            :         .cabq_maxdur = WMI_VDEV_PARAM_UNSUPPORTED,
     970                 :            :         .mfptest_set = WMI_VDEV_PARAM_UNSUPPORTED,
     971                 :            :         .rts_fixed_rate = WMI_VDEV_PARAM_UNSUPPORTED,
     972                 :            :         .vht_sgimask = WMI_VDEV_PARAM_UNSUPPORTED,
     973                 :            :         .vht80_ratemask = WMI_VDEV_PARAM_UNSUPPORTED,
     974                 :            :         .early_rx_adjust_enable = WMI_VDEV_PARAM_UNSUPPORTED,
     975                 :            :         .early_rx_tgt_bmiss_num = WMI_VDEV_PARAM_UNSUPPORTED,
     976                 :            :         .early_rx_bmiss_sample_cycle = WMI_VDEV_PARAM_UNSUPPORTED,
     977                 :            :         .early_rx_slop_step = WMI_VDEV_PARAM_UNSUPPORTED,
     978                 :            :         .early_rx_init_slop = WMI_VDEV_PARAM_UNSUPPORTED,
     979                 :            :         .early_rx_adjust_pause = WMI_VDEV_PARAM_UNSUPPORTED,
     980                 :            :         .proxy_sta = WMI_VDEV_PARAM_UNSUPPORTED,
     981                 :            :         .meru_vc = WMI_VDEV_PARAM_UNSUPPORTED,
     982                 :            :         .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED,
     983                 :            :         .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED,
     984                 :            :         .disable_4addr_src_lrn = WMI_VDEV_PARAM_UNSUPPORTED,
     985                 :            :         .rtt_responder_role = WMI_VDEV_PARAM_UNSUPPORTED,
     986                 :            : };
     987                 :            : 
     988                 :            : static struct wmi_vdev_param_map wmi_10_4_vdev_param_map = {
     989                 :            :         .rts_threshold = WMI_10_4_VDEV_PARAM_RTS_THRESHOLD,
     990                 :            :         .fragmentation_threshold = WMI_10_4_VDEV_PARAM_FRAGMENTATION_THRESHOLD,
     991                 :            :         .beacon_interval = WMI_10_4_VDEV_PARAM_BEACON_INTERVAL,
     992                 :            :         .listen_interval = WMI_10_4_VDEV_PARAM_LISTEN_INTERVAL,
     993                 :            :         .multicast_rate = WMI_10_4_VDEV_PARAM_MULTICAST_RATE,
     994                 :            :         .mgmt_tx_rate = WMI_10_4_VDEV_PARAM_MGMT_TX_RATE,
     995                 :            :         .slot_time = WMI_10_4_VDEV_PARAM_SLOT_TIME,
     996                 :            :         .preamble = WMI_10_4_VDEV_PARAM_PREAMBLE,
     997                 :            :         .swba_time = WMI_10_4_VDEV_PARAM_SWBA_TIME,
     998                 :            :         .wmi_vdev_stats_update_period = WMI_10_4_VDEV_STATS_UPDATE_PERIOD,
     999                 :            :         .wmi_vdev_pwrsave_ageout_time = WMI_10_4_VDEV_PWRSAVE_AGEOUT_TIME,
    1000                 :            :         .wmi_vdev_host_swba_interval = WMI_10_4_VDEV_HOST_SWBA_INTERVAL,
    1001                 :            :         .dtim_period = WMI_10_4_VDEV_PARAM_DTIM_PERIOD,
    1002                 :            :         .wmi_vdev_oc_scheduler_air_time_limit =
    1003                 :            :                WMI_10_4_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT,
    1004                 :            :         .wds = WMI_10_4_VDEV_PARAM_WDS,
    1005                 :            :         .atim_window = WMI_10_4_VDEV_PARAM_ATIM_WINDOW,
    1006                 :            :         .bmiss_count_max = WMI_10_4_VDEV_PARAM_BMISS_COUNT_MAX,
    1007                 :            :         .bmiss_first_bcnt = WMI_10_4_VDEV_PARAM_BMISS_FIRST_BCNT,
    1008                 :            :         .bmiss_final_bcnt = WMI_10_4_VDEV_PARAM_BMISS_FINAL_BCNT,
    1009                 :            :         .feature_wmm = WMI_10_4_VDEV_PARAM_FEATURE_WMM,
    1010                 :            :         .chwidth = WMI_10_4_VDEV_PARAM_CHWIDTH,
    1011                 :            :         .chextoffset = WMI_10_4_VDEV_PARAM_CHEXTOFFSET,
    1012                 :            :         .disable_htprotection = WMI_10_4_VDEV_PARAM_DISABLE_HTPROTECTION,
    1013                 :            :         .sta_quickkickout = WMI_10_4_VDEV_PARAM_STA_QUICKKICKOUT,
    1014                 :            :         .mgmt_rate = WMI_10_4_VDEV_PARAM_MGMT_RATE,
    1015                 :            :         .protection_mode = WMI_10_4_VDEV_PARAM_PROTECTION_MODE,
    1016                 :            :         .fixed_rate = WMI_10_4_VDEV_PARAM_FIXED_RATE,
    1017                 :            :         .sgi = WMI_10_4_VDEV_PARAM_SGI,
    1018                 :            :         .ldpc = WMI_10_4_VDEV_PARAM_LDPC,
    1019                 :            :         .tx_stbc = WMI_10_4_VDEV_PARAM_TX_STBC,
    1020                 :            :         .rx_stbc = WMI_10_4_VDEV_PARAM_RX_STBC,
    1021                 :            :         .intra_bss_fwd = WMI_10_4_VDEV_PARAM_INTRA_BSS_FWD,
    1022                 :            :         .def_keyid = WMI_10_4_VDEV_PARAM_DEF_KEYID,
    1023                 :            :         .nss = WMI_10_4_VDEV_PARAM_NSS,
    1024                 :            :         .bcast_data_rate = WMI_10_4_VDEV_PARAM_BCAST_DATA_RATE,
    1025                 :            :         .mcast_data_rate = WMI_10_4_VDEV_PARAM_MCAST_DATA_RATE,
    1026                 :            :         .mcast_indicate = WMI_10_4_VDEV_PARAM_MCAST_INDICATE,
    1027                 :            :         .dhcp_indicate = WMI_10_4_VDEV_PARAM_DHCP_INDICATE,
    1028                 :            :         .unknown_dest_indicate = WMI_10_4_VDEV_PARAM_UNKNOWN_DEST_INDICATE,
    1029                 :            :         .ap_keepalive_min_idle_inactive_time_secs =
    1030                 :            :                WMI_10_4_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS,
    1031                 :            :         .ap_keepalive_max_idle_inactive_time_secs =
    1032                 :            :                WMI_10_4_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS,
    1033                 :            :         .ap_keepalive_max_unresponsive_time_secs =
    1034                 :            :                WMI_10_4_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS,
    1035                 :            :         .ap_enable_nawds = WMI_10_4_VDEV_PARAM_AP_ENABLE_NAWDS,
    1036                 :            :         .mcast2ucast_set = WMI_10_4_VDEV_PARAM_MCAST2UCAST_SET,
    1037                 :            :         .enable_rtscts = WMI_10_4_VDEV_PARAM_ENABLE_RTSCTS,
    1038                 :            :         .txbf = WMI_10_4_VDEV_PARAM_TXBF,
    1039                 :            :         .packet_powersave = WMI_10_4_VDEV_PARAM_PACKET_POWERSAVE,
    1040                 :            :         .drop_unencry = WMI_10_4_VDEV_PARAM_DROP_UNENCRY,
    1041                 :            :         .tx_encap_type = WMI_10_4_VDEV_PARAM_TX_ENCAP_TYPE,
    1042                 :            :         .ap_detect_out_of_sync_sleeping_sta_time_secs =
    1043                 :            :                WMI_10_4_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS,
    1044                 :            :         .rc_num_retries = WMI_10_4_VDEV_PARAM_RC_NUM_RETRIES,
    1045                 :            :         .cabq_maxdur = WMI_10_4_VDEV_PARAM_CABQ_MAXDUR,
    1046                 :            :         .mfptest_set = WMI_10_4_VDEV_PARAM_MFPTEST_SET,
    1047                 :            :         .rts_fixed_rate = WMI_10_4_VDEV_PARAM_RTS_FIXED_RATE,
    1048                 :            :         .vht_sgimask = WMI_10_4_VDEV_PARAM_VHT_SGIMASK,
    1049                 :            :         .vht80_ratemask = WMI_10_4_VDEV_PARAM_VHT80_RATEMASK,
    1050                 :            :         .early_rx_adjust_enable = WMI_10_4_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE,
    1051                 :            :         .early_rx_tgt_bmiss_num = WMI_10_4_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM,
    1052                 :            :         .early_rx_bmiss_sample_cycle =
    1053                 :            :                WMI_10_4_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE,
    1054                 :            :         .early_rx_slop_step = WMI_10_4_VDEV_PARAM_EARLY_RX_SLOP_STEP,
    1055                 :            :         .early_rx_init_slop = WMI_10_4_VDEV_PARAM_EARLY_RX_INIT_SLOP,
    1056                 :            :         .early_rx_adjust_pause = WMI_10_4_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE,
    1057                 :            :         .proxy_sta = WMI_10_4_VDEV_PARAM_PROXY_STA,
    1058                 :            :         .meru_vc = WMI_10_4_VDEV_PARAM_MERU_VC,
    1059                 :            :         .rx_decap_type = WMI_10_4_VDEV_PARAM_RX_DECAP_TYPE,
    1060                 :            :         .bw_nss_ratemask = WMI_10_4_VDEV_PARAM_BW_NSS_RATEMASK,
    1061                 :            :         .inc_tsf = WMI_10_4_VDEV_PARAM_TSF_INCREMENT,
    1062                 :            :         .dec_tsf = WMI_10_4_VDEV_PARAM_TSF_DECREMENT,
    1063                 :            :         .disable_4addr_src_lrn = WMI_10_4_VDEV_PARAM_DISABLE_4_ADDR_SRC_LRN,
    1064                 :            :         .rtt_responder_role = WMI_10_4_VDEV_PARAM_ENABLE_DISABLE_RTT_RESPONDER_ROLE,
    1065                 :            : };
    1066                 :            : 
    1067                 :            : static struct wmi_pdev_param_map wmi_pdev_param_map = {
    1068                 :            :         .tx_chain_mask = WMI_PDEV_PARAM_TX_CHAIN_MASK,
    1069                 :            :         .rx_chain_mask = WMI_PDEV_PARAM_RX_CHAIN_MASK,
    1070                 :            :         .txpower_limit2g = WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
    1071                 :            :         .txpower_limit5g = WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
    1072                 :            :         .txpower_scale = WMI_PDEV_PARAM_TXPOWER_SCALE,
    1073                 :            :         .beacon_gen_mode = WMI_PDEV_PARAM_BEACON_GEN_MODE,
    1074                 :            :         .beacon_tx_mode = WMI_PDEV_PARAM_BEACON_TX_MODE,
    1075                 :            :         .resmgr_offchan_mode = WMI_PDEV_PARAM_RESMGR_OFFCHAN_MODE,
    1076                 :            :         .protection_mode = WMI_PDEV_PARAM_PROTECTION_MODE,
    1077                 :            :         .dynamic_bw = WMI_PDEV_PARAM_DYNAMIC_BW,
    1078                 :            :         .non_agg_sw_retry_th = WMI_PDEV_PARAM_NON_AGG_SW_RETRY_TH,
    1079                 :            :         .agg_sw_retry_th = WMI_PDEV_PARAM_AGG_SW_RETRY_TH,
    1080                 :            :         .sta_kickout_th = WMI_PDEV_PARAM_STA_KICKOUT_TH,
    1081                 :            :         .ac_aggrsize_scaling = WMI_PDEV_PARAM_AC_AGGRSIZE_SCALING,
    1082                 :            :         .ltr_enable = WMI_PDEV_PARAM_LTR_ENABLE,
    1083                 :            :         .ltr_ac_latency_be = WMI_PDEV_PARAM_LTR_AC_LATENCY_BE,
    1084                 :            :         .ltr_ac_latency_bk = WMI_PDEV_PARAM_LTR_AC_LATENCY_BK,
    1085                 :            :         .ltr_ac_latency_vi = WMI_PDEV_PARAM_LTR_AC_LATENCY_VI,
    1086                 :            :         .ltr_ac_latency_vo = WMI_PDEV_PARAM_LTR_AC_LATENCY_VO,
    1087                 :            :         .ltr_ac_latency_timeout = WMI_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT,
    1088                 :            :         .ltr_sleep_override = WMI_PDEV_PARAM_LTR_SLEEP_OVERRIDE,
    1089                 :            :         .ltr_rx_override = WMI_PDEV_PARAM_LTR_RX_OVERRIDE,
    1090                 :            :         .ltr_tx_activity_timeout = WMI_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT,
    1091                 :            :         .l1ss_enable = WMI_PDEV_PARAM_L1SS_ENABLE,
    1092                 :            :         .dsleep_enable = WMI_PDEV_PARAM_DSLEEP_ENABLE,
    1093                 :            :         .pcielp_txbuf_flush = WMI_PDEV_PARAM_PCIELP_TXBUF_FLUSH,
    1094                 :            :         .pcielp_txbuf_watermark = WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_EN,
    1095                 :            :         .pcielp_txbuf_tmo_en = WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_EN,
    1096                 :            :         .pcielp_txbuf_tmo_value = WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE,
    1097                 :            :         .pdev_stats_update_period = WMI_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD,
    1098                 :            :         .vdev_stats_update_period = WMI_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD,
    1099                 :            :         .peer_stats_update_period = WMI_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD,
    1100                 :            :         .bcnflt_stats_update_period = WMI_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD,
    1101                 :            :         .pmf_qos = WMI_PDEV_PARAM_PMF_QOS,
    1102                 :            :         .arp_ac_override = WMI_PDEV_PARAM_ARP_AC_OVERRIDE,
    1103                 :            :         .dcs = WMI_PDEV_PARAM_DCS,
    1104                 :            :         .ani_enable = WMI_PDEV_PARAM_ANI_ENABLE,
    1105                 :            :         .ani_poll_period = WMI_PDEV_PARAM_ANI_POLL_PERIOD,
    1106                 :            :         .ani_listen_period = WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
    1107                 :            :         .ani_ofdm_level = WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
    1108                 :            :         .ani_cck_level = WMI_PDEV_PARAM_ANI_CCK_LEVEL,
    1109                 :            :         .dyntxchain = WMI_PDEV_PARAM_DYNTXCHAIN,
    1110                 :            :         .proxy_sta = WMI_PDEV_PARAM_PROXY_STA,
    1111                 :            :         .idle_ps_config = WMI_PDEV_PARAM_IDLE_PS_CONFIG,
    1112                 :            :         .power_gating_sleep = WMI_PDEV_PARAM_POWER_GATING_SLEEP,
    1113                 :            :         .fast_channel_reset = WMI_PDEV_PARAM_UNSUPPORTED,
    1114                 :            :         .burst_dur = WMI_PDEV_PARAM_UNSUPPORTED,
    1115                 :            :         .burst_enable = WMI_PDEV_PARAM_UNSUPPORTED,
    1116                 :            :         .cal_period = WMI_PDEV_PARAM_UNSUPPORTED,
    1117                 :            :         .aggr_burst = WMI_PDEV_PARAM_UNSUPPORTED,
    1118                 :            :         .rx_decap_mode = WMI_PDEV_PARAM_UNSUPPORTED,
    1119                 :            :         .smart_antenna_default_antenna = WMI_PDEV_PARAM_UNSUPPORTED,
    1120                 :            :         .igmpmld_override = WMI_PDEV_PARAM_UNSUPPORTED,
    1121                 :            :         .igmpmld_tid = WMI_PDEV_PARAM_UNSUPPORTED,
    1122                 :            :         .antenna_gain = WMI_PDEV_PARAM_UNSUPPORTED,
    1123                 :            :         .rx_filter = WMI_PDEV_PARAM_UNSUPPORTED,
    1124                 :            :         .set_mcast_to_ucast_tid = WMI_PDEV_PARAM_UNSUPPORTED,
    1125                 :            :         .proxy_sta_mode = WMI_PDEV_PARAM_UNSUPPORTED,
    1126                 :            :         .set_mcast2ucast_mode = WMI_PDEV_PARAM_UNSUPPORTED,
    1127                 :            :         .set_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED,
    1128                 :            :         .remove_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED,
    1129                 :            :         .peer_sta_ps_statechg_enable = WMI_PDEV_PARAM_UNSUPPORTED,
    1130                 :            :         .igmpmld_ac_override = WMI_PDEV_PARAM_UNSUPPORTED,
    1131                 :            :         .block_interbss = WMI_PDEV_PARAM_UNSUPPORTED,
    1132                 :            :         .set_disable_reset_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
    1133                 :            :         .set_msdu_ttl_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
    1134                 :            :         .set_ppdu_duration_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
    1135                 :            :         .txbf_sound_period_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
    1136                 :            :         .set_promisc_mode_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
    1137                 :            :         .set_burst_mode_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
    1138                 :            :         .en_stats = WMI_PDEV_PARAM_UNSUPPORTED,
    1139                 :            :         .mu_group_policy = WMI_PDEV_PARAM_UNSUPPORTED,
    1140                 :            :         .noise_detection = WMI_PDEV_PARAM_UNSUPPORTED,
    1141                 :            :         .noise_threshold = WMI_PDEV_PARAM_UNSUPPORTED,
    1142                 :            :         .dpd_enable = WMI_PDEV_PARAM_UNSUPPORTED,
    1143                 :            :         .set_mcast_bcast_echo = WMI_PDEV_PARAM_UNSUPPORTED,
    1144                 :            :         .atf_strict_sch = WMI_PDEV_PARAM_UNSUPPORTED,
    1145                 :            :         .atf_sched_duration = WMI_PDEV_PARAM_UNSUPPORTED,
    1146                 :            :         .ant_plzn = WMI_PDEV_PARAM_UNSUPPORTED,
    1147                 :            :         .mgmt_retry_limit = WMI_PDEV_PARAM_UNSUPPORTED,
    1148                 :            :         .sensitivity_level = WMI_PDEV_PARAM_UNSUPPORTED,
    1149                 :            :         .signed_txpower_2g = WMI_PDEV_PARAM_UNSUPPORTED,
    1150                 :            :         .signed_txpower_5g = WMI_PDEV_PARAM_UNSUPPORTED,
    1151                 :            :         .enable_per_tid_amsdu = WMI_PDEV_PARAM_UNSUPPORTED,
    1152                 :            :         .enable_per_tid_ampdu = WMI_PDEV_PARAM_UNSUPPORTED,
    1153                 :            :         .cca_threshold = WMI_PDEV_PARAM_UNSUPPORTED,
    1154                 :            :         .rts_fixed_rate = WMI_PDEV_PARAM_UNSUPPORTED,
    1155                 :            :         .pdev_reset = WMI_PDEV_PARAM_UNSUPPORTED,
    1156                 :            :         .wapi_mbssid_offset = WMI_PDEV_PARAM_UNSUPPORTED,
    1157                 :            :         .arp_srcaddr = WMI_PDEV_PARAM_UNSUPPORTED,
    1158                 :            :         .arp_dstaddr = WMI_PDEV_PARAM_UNSUPPORTED,
    1159                 :            :         .enable_btcoex = WMI_PDEV_PARAM_UNSUPPORTED,
    1160                 :            : };
    1161                 :            : 
    1162                 :            : static struct wmi_pdev_param_map wmi_10x_pdev_param_map = {
    1163                 :            :         .tx_chain_mask = WMI_10X_PDEV_PARAM_TX_CHAIN_MASK,
    1164                 :            :         .rx_chain_mask = WMI_10X_PDEV_PARAM_RX_CHAIN_MASK,
    1165                 :            :         .txpower_limit2g = WMI_10X_PDEV_PARAM_TXPOWER_LIMIT2G,
    1166                 :            :         .txpower_limit5g = WMI_10X_PDEV_PARAM_TXPOWER_LIMIT5G,
    1167                 :            :         .txpower_scale = WMI_10X_PDEV_PARAM_TXPOWER_SCALE,
    1168                 :            :         .beacon_gen_mode = WMI_10X_PDEV_PARAM_BEACON_GEN_MODE,
    1169                 :            :         .beacon_tx_mode = WMI_10X_PDEV_PARAM_BEACON_TX_MODE,
    1170                 :            :         .resmgr_offchan_mode = WMI_10X_PDEV_PARAM_RESMGR_OFFCHAN_MODE,
    1171                 :            :         .protection_mode = WMI_10X_PDEV_PARAM_PROTECTION_MODE,
    1172                 :            :         .dynamic_bw = WMI_10X_PDEV_PARAM_DYNAMIC_BW,
    1173                 :            :         .non_agg_sw_retry_th = WMI_10X_PDEV_PARAM_NON_AGG_SW_RETRY_TH,
    1174                 :            :         .agg_sw_retry_th = WMI_10X_PDEV_PARAM_AGG_SW_RETRY_TH,
    1175                 :            :         .sta_kickout_th = WMI_10X_PDEV_PARAM_STA_KICKOUT_TH,
    1176                 :            :         .ac_aggrsize_scaling = WMI_10X_PDEV_PARAM_AC_AGGRSIZE_SCALING,
    1177                 :            :         .ltr_enable = WMI_10X_PDEV_PARAM_LTR_ENABLE,
    1178                 :            :         .ltr_ac_latency_be = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_BE,
    1179                 :            :         .ltr_ac_latency_bk = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_BK,
    1180                 :            :         .ltr_ac_latency_vi = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_VI,
    1181                 :            :         .ltr_ac_latency_vo = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_VO,
    1182                 :            :         .ltr_ac_latency_timeout = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT,
    1183                 :            :         .ltr_sleep_override = WMI_10X_PDEV_PARAM_LTR_SLEEP_OVERRIDE,
    1184                 :            :         .ltr_rx_override = WMI_10X_PDEV_PARAM_LTR_RX_OVERRIDE,
    1185                 :            :         .ltr_tx_activity_timeout = WMI_10X_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT,
    1186                 :            :         .l1ss_enable = WMI_10X_PDEV_PARAM_L1SS_ENABLE,
    1187                 :            :         .dsleep_enable = WMI_10X_PDEV_PARAM_DSLEEP_ENABLE,
    1188                 :            :         .pcielp_txbuf_flush = WMI_PDEV_PARAM_UNSUPPORTED,
    1189                 :            :         .pcielp_txbuf_watermark = WMI_PDEV_PARAM_UNSUPPORTED,
    1190                 :            :         .pcielp_txbuf_tmo_en = WMI_PDEV_PARAM_UNSUPPORTED,
    1191                 :            :         .pcielp_txbuf_tmo_value = WMI_PDEV_PARAM_UNSUPPORTED,
    1192                 :            :         .pdev_stats_update_period = WMI_10X_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD,
    1193                 :            :         .vdev_stats_update_period = WMI_10X_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD,
    1194                 :            :         .peer_stats_update_period = WMI_10X_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD,
    1195                 :            :         .bcnflt_stats_update_period =
    1196                 :            :                                 WMI_10X_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD,
    1197                 :            :         .pmf_qos = WMI_10X_PDEV_PARAM_PMF_QOS,
    1198                 :            :         .arp_ac_override = WMI_10X_PDEV_PARAM_ARPDHCP_AC_OVERRIDE,
    1199                 :            :         .dcs = WMI_10X_PDEV_PARAM_DCS,
    1200                 :            :         .ani_enable = WMI_10X_PDEV_PARAM_ANI_ENABLE,
    1201                 :            :         .ani_poll_period = WMI_10X_PDEV_PARAM_ANI_POLL_PERIOD,
    1202                 :            :         .ani_listen_period = WMI_10X_PDEV_PARAM_ANI_LISTEN_PERIOD,
    1203                 :            :         .ani_ofdm_level = WMI_10X_PDEV_PARAM_ANI_OFDM_LEVEL,
    1204                 :            :         .ani_cck_level = WMI_10X_PDEV_PARAM_ANI_CCK_LEVEL,
    1205                 :            :         .dyntxchain = WMI_10X_PDEV_PARAM_DYNTXCHAIN,
    1206                 :            :         .proxy_sta = WMI_PDEV_PARAM_UNSUPPORTED,
    1207                 :            :         .idle_ps_config = WMI_PDEV_PARAM_UNSUPPORTED,
    1208                 :            :         .power_gating_sleep = WMI_PDEV_PARAM_UNSUPPORTED,
    1209                 :            :         .fast_channel_reset = WMI_10X_PDEV_PARAM_FAST_CHANNEL_RESET,
    1210                 :            :         .burst_dur = WMI_10X_PDEV_PARAM_BURST_DUR,
    1211                 :            :         .burst_enable = WMI_10X_PDEV_PARAM_BURST_ENABLE,
    1212                 :            :         .cal_period = WMI_10X_PDEV_PARAM_CAL_PERIOD,
    1213                 :            :         .aggr_burst = WMI_PDEV_PARAM_UNSUPPORTED,
    1214                 :            :         .rx_decap_mode = WMI_PDEV_PARAM_UNSUPPORTED,
    1215                 :            :         .smart_antenna_default_antenna = WMI_PDEV_PARAM_UNSUPPORTED,
    1216                 :            :         .igmpmld_override = WMI_PDEV_PARAM_UNSUPPORTED,
    1217                 :            :         .igmpmld_tid = WMI_PDEV_PARAM_UNSUPPORTED,
    1218                 :            :         .antenna_gain = WMI_PDEV_PARAM_UNSUPPORTED,
    1219                 :            :         .rx_filter = WMI_PDEV_PARAM_UNSUPPORTED,
    1220                 :            :         .set_mcast_to_ucast_tid = WMI_PDEV_PARAM_UNSUPPORTED,
    1221                 :            :         .proxy_sta_mode = WMI_PDEV_PARAM_UNSUPPORTED,
    1222                 :            :         .set_mcast2ucast_mode = WMI_PDEV_PARAM_UNSUPPORTED,
    1223                 :            :         .set_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED,
    1224                 :            :         .remove_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED,
    1225                 :            :         .peer_sta_ps_statechg_enable = WMI_PDEV_PARAM_UNSUPPORTED,
    1226                 :            :         .igmpmld_ac_override = WMI_PDEV_PARAM_UNSUPPORTED,
    1227                 :            :         .block_interbss = WMI_PDEV_PARAM_UNSUPPORTED,
    1228                 :            :         .set_disable_reset_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
    1229                 :            :         .set_msdu_ttl_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
    1230                 :            :         .set_ppdu_duration_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
    1231                 :            :         .txbf_sound_period_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
    1232                 :            :         .set_promisc_mode_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
    1233                 :            :         .set_burst_mode_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
    1234                 :            :         .en_stats = WMI_PDEV_PARAM_UNSUPPORTED,
    1235                 :            :         .mu_group_policy = WMI_PDEV_PARAM_UNSUPPORTED,
    1236                 :            :         .noise_detection = WMI_PDEV_PARAM_UNSUPPORTED,
    1237                 :            :         .noise_threshold = WMI_PDEV_PARAM_UNSUPPORTED,
    1238                 :            :         .dpd_enable = WMI_PDEV_PARAM_UNSUPPORTED,
    1239                 :            :         .set_mcast_bcast_echo = WMI_PDEV_PARAM_UNSUPPORTED,
    1240                 :            :         .atf_strict_sch = WMI_PDEV_PARAM_UNSUPPORTED,
    1241                 :            :         .atf_sched_duration = WMI_PDEV_PARAM_UNSUPPORTED,
    1242                 :            :         .ant_plzn = WMI_PDEV_PARAM_UNSUPPORTED,
    1243                 :            :         .mgmt_retry_limit = WMI_PDEV_PARAM_UNSUPPORTED,
    1244                 :            :         .sensitivity_level = WMI_PDEV_PARAM_UNSUPPORTED,
    1245                 :            :         .signed_txpower_2g = WMI_PDEV_PARAM_UNSUPPORTED,
    1246                 :            :         .signed_txpower_5g = WMI_PDEV_PARAM_UNSUPPORTED,
    1247                 :            :         .enable_per_tid_amsdu = WMI_PDEV_PARAM_UNSUPPORTED,
    1248                 :            :         .enable_per_tid_ampdu = WMI_PDEV_PARAM_UNSUPPORTED,
    1249                 :            :         .cca_threshold = WMI_PDEV_PARAM_UNSUPPORTED,
    1250                 :            :         .rts_fixed_rate = WMI_PDEV_PARAM_UNSUPPORTED,
    1251                 :            :         .pdev_reset = WMI_PDEV_PARAM_UNSUPPORTED,
    1252                 :            :         .wapi_mbssid_offset = WMI_PDEV_PARAM_UNSUPPORTED,
    1253                 :            :         .arp_srcaddr = WMI_PDEV_PARAM_UNSUPPORTED,
    1254                 :            :         .arp_dstaddr = WMI_PDEV_PARAM_UNSUPPORTED,
    1255                 :            :         .enable_btcoex = WMI_PDEV_PARAM_UNSUPPORTED,
    1256                 :            : };
    1257                 :            : 
    1258                 :            : static struct wmi_pdev_param_map wmi_10_2_4_pdev_param_map = {
    1259                 :            :         .tx_chain_mask = WMI_10X_PDEV_PARAM_TX_CHAIN_MASK,
    1260                 :            :         .rx_chain_mask = WMI_10X_PDEV_PARAM_RX_CHAIN_MASK,
    1261                 :            :         .txpower_limit2g = WMI_10X_PDEV_PARAM_TXPOWER_LIMIT2G,
    1262                 :            :         .txpower_limit5g = WMI_10X_PDEV_PARAM_TXPOWER_LIMIT5G,
    1263                 :            :         .txpower_scale = WMI_10X_PDEV_PARAM_TXPOWER_SCALE,
    1264                 :            :         .beacon_gen_mode = WMI_10X_PDEV_PARAM_BEACON_GEN_MODE,
    1265                 :            :         .beacon_tx_mode = WMI_10X_PDEV_PARAM_BEACON_TX_MODE,
    1266                 :            :         .resmgr_offchan_mode = WMI_10X_PDEV_PARAM_RESMGR_OFFCHAN_MODE,
    1267                 :            :         .protection_mode = WMI_10X_PDEV_PARAM_PROTECTION_MODE,
    1268                 :            :         .dynamic_bw = WMI_10X_PDEV_PARAM_DYNAMIC_BW,
    1269                 :            :         .non_agg_sw_retry_th = WMI_10X_PDEV_PARAM_NON_AGG_SW_RETRY_TH,
    1270                 :            :         .agg_sw_retry_th = WMI_10X_PDEV_PARAM_AGG_SW_RETRY_TH,
    1271                 :            :         .sta_kickout_th = WMI_10X_PDEV_PARAM_STA_KICKOUT_TH,
    1272                 :            :         .ac_aggrsize_scaling = WMI_10X_PDEV_PARAM_AC_AGGRSIZE_SCALING,
    1273                 :            :         .ltr_enable = WMI_10X_PDEV_PARAM_LTR_ENABLE,
    1274                 :            :         .ltr_ac_latency_be = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_BE,
    1275                 :            :         .ltr_ac_latency_bk = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_BK,
    1276                 :            :         .ltr_ac_latency_vi = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_VI,
    1277                 :            :         .ltr_ac_latency_vo = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_VO,
    1278                 :            :         .ltr_ac_latency_timeout = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT,
    1279                 :            :         .ltr_sleep_override = WMI_10X_PDEV_PARAM_LTR_SLEEP_OVERRIDE,
    1280                 :            :         .ltr_rx_override = WMI_10X_PDEV_PARAM_LTR_RX_OVERRIDE,
    1281                 :            :         .ltr_tx_activity_timeout = WMI_10X_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT,
    1282                 :            :         .l1ss_enable = WMI_10X_PDEV_PARAM_L1SS_ENABLE,
    1283                 :            :         .dsleep_enable = WMI_10X_PDEV_PARAM_DSLEEP_ENABLE,
    1284                 :            :         .pcielp_txbuf_flush = WMI_PDEV_PARAM_UNSUPPORTED,
    1285                 :            :         .pcielp_txbuf_watermark = WMI_PDEV_PARAM_UNSUPPORTED,
    1286                 :            :         .pcielp_txbuf_tmo_en = WMI_PDEV_PARAM_UNSUPPORTED,
    1287                 :            :         .pcielp_txbuf_tmo_value = WMI_PDEV_PARAM_UNSUPPORTED,
    1288                 :            :         .pdev_stats_update_period = WMI_10X_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD,
    1289                 :            :         .vdev_stats_update_period = WMI_10X_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD,
    1290                 :            :         .peer_stats_update_period = WMI_10X_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD,
    1291                 :            :         .bcnflt_stats_update_period =
    1292                 :            :                                 WMI_10X_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD,
    1293                 :            :         .pmf_qos = WMI_10X_PDEV_PARAM_PMF_QOS,
    1294                 :            :         .arp_ac_override = WMI_10X_PDEV_PARAM_ARPDHCP_AC_OVERRIDE,
    1295                 :            :         .dcs = WMI_10X_PDEV_PARAM_DCS,
    1296                 :            :         .ani_enable = WMI_10X_PDEV_PARAM_ANI_ENABLE,
    1297                 :            :         .ani_poll_period = WMI_10X_PDEV_PARAM_ANI_POLL_PERIOD,
    1298                 :            :         .ani_listen_period = WMI_10X_PDEV_PARAM_ANI_LISTEN_PERIOD,
    1299                 :            :         .ani_ofdm_level = WMI_10X_PDEV_PARAM_ANI_OFDM_LEVEL,
    1300                 :            :         .ani_cck_level = WMI_10X_PDEV_PARAM_ANI_CCK_LEVEL,
    1301                 :            :         .dyntxchain = WMI_10X_PDEV_PARAM_DYNTXCHAIN,
    1302                 :            :         .proxy_sta = WMI_PDEV_PARAM_UNSUPPORTED,
    1303                 :            :         .idle_ps_config = WMI_PDEV_PARAM_UNSUPPORTED,
    1304                 :            :         .power_gating_sleep = WMI_PDEV_PARAM_UNSUPPORTED,
    1305                 :            :         .fast_channel_reset = WMI_10X_PDEV_PARAM_FAST_CHANNEL_RESET,
    1306                 :            :         .burst_dur = WMI_10X_PDEV_PARAM_BURST_DUR,
    1307                 :            :         .burst_enable = WMI_10X_PDEV_PARAM_BURST_ENABLE,
    1308                 :            :         .cal_period = WMI_10X_PDEV_PARAM_CAL_PERIOD,
    1309                 :            :         .aggr_burst = WMI_PDEV_PARAM_UNSUPPORTED,
    1310                 :            :         .rx_decap_mode = WMI_PDEV_PARAM_UNSUPPORTED,
    1311                 :            :         .smart_antenna_default_antenna = WMI_PDEV_PARAM_UNSUPPORTED,
    1312                 :            :         .igmpmld_override = WMI_PDEV_PARAM_UNSUPPORTED,
    1313                 :            :         .igmpmld_tid = WMI_PDEV_PARAM_UNSUPPORTED,
    1314                 :            :         .antenna_gain = WMI_PDEV_PARAM_UNSUPPORTED,
    1315                 :            :         .rx_filter = WMI_PDEV_PARAM_UNSUPPORTED,
    1316                 :            :         .set_mcast_to_ucast_tid = WMI_PDEV_PARAM_UNSUPPORTED,
    1317                 :            :         .proxy_sta_mode = WMI_PDEV_PARAM_UNSUPPORTED,
    1318                 :            :         .set_mcast2ucast_mode = WMI_PDEV_PARAM_UNSUPPORTED,
    1319                 :            :         .set_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED,
    1320                 :            :         .remove_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED,
    1321                 :            :         .peer_sta_ps_statechg_enable =
    1322                 :            :                                 WMI_10X_PDEV_PARAM_PEER_STA_PS_STATECHG_ENABLE,
    1323                 :            :         .igmpmld_ac_override = WMI_PDEV_PARAM_UNSUPPORTED,
    1324                 :            :         .block_interbss = WMI_PDEV_PARAM_UNSUPPORTED,
    1325                 :            :         .set_disable_reset_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
    1326                 :            :         .set_msdu_ttl_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
    1327                 :            :         .set_ppdu_duration_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
    1328                 :            :         .txbf_sound_period_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
    1329                 :            :         .set_promisc_mode_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
    1330                 :            :         .set_burst_mode_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
    1331                 :            :         .en_stats = WMI_PDEV_PARAM_UNSUPPORTED,
    1332                 :            :         .mu_group_policy = WMI_PDEV_PARAM_UNSUPPORTED,
    1333                 :            :         .noise_detection = WMI_PDEV_PARAM_UNSUPPORTED,
    1334                 :            :         .noise_threshold = WMI_PDEV_PARAM_UNSUPPORTED,
    1335                 :            :         .dpd_enable = WMI_PDEV_PARAM_UNSUPPORTED,
    1336                 :            :         .set_mcast_bcast_echo = WMI_PDEV_PARAM_UNSUPPORTED,
    1337                 :            :         .atf_strict_sch = WMI_PDEV_PARAM_UNSUPPORTED,
    1338                 :            :         .atf_sched_duration = WMI_PDEV_PARAM_UNSUPPORTED,
    1339                 :            :         .ant_plzn = WMI_PDEV_PARAM_UNSUPPORTED,
    1340                 :            :         .mgmt_retry_limit = WMI_PDEV_PARAM_UNSUPPORTED,
    1341                 :            :         .sensitivity_level = WMI_PDEV_PARAM_UNSUPPORTED,
    1342                 :            :         .signed_txpower_2g = WMI_PDEV_PARAM_UNSUPPORTED,
    1343                 :            :         .signed_txpower_5g = WMI_PDEV_PARAM_UNSUPPORTED,
    1344                 :            :         .enable_per_tid_amsdu = WMI_PDEV_PARAM_UNSUPPORTED,
    1345                 :            :         .enable_per_tid_ampdu = WMI_PDEV_PARAM_UNSUPPORTED,
    1346                 :            :         .cca_threshold = WMI_PDEV_PARAM_UNSUPPORTED,
    1347                 :            :         .rts_fixed_rate = WMI_PDEV_PARAM_UNSUPPORTED,
    1348                 :            :         .pdev_reset = WMI_10X_PDEV_PARAM_PDEV_RESET,
    1349                 :            :         .wapi_mbssid_offset = WMI_PDEV_PARAM_UNSUPPORTED,
    1350                 :            :         .arp_srcaddr = WMI_PDEV_PARAM_UNSUPPORTED,
    1351                 :            :         .arp_dstaddr = WMI_PDEV_PARAM_UNSUPPORTED,
    1352                 :            :         .enable_btcoex = WMI_PDEV_PARAM_UNSUPPORTED,
    1353                 :            : };
    1354                 :            : 
    1355                 :            : /* firmware 10.2 specific mappings */
    1356                 :            : static struct wmi_cmd_map wmi_10_2_cmd_map = {
    1357                 :            :         .init_cmdid = WMI_10_2_INIT_CMDID,
    1358                 :            :         .start_scan_cmdid = WMI_10_2_START_SCAN_CMDID,
    1359                 :            :         .stop_scan_cmdid = WMI_10_2_STOP_SCAN_CMDID,
    1360                 :            :         .scan_chan_list_cmdid = WMI_10_2_SCAN_CHAN_LIST_CMDID,
    1361                 :            :         .scan_sch_prio_tbl_cmdid = WMI_CMD_UNSUPPORTED,
    1362                 :            :         .scan_prob_req_oui_cmdid = WMI_CMD_UNSUPPORTED,
    1363                 :            :         .pdev_set_regdomain_cmdid = WMI_10_2_PDEV_SET_REGDOMAIN_CMDID,
    1364                 :            :         .pdev_set_channel_cmdid = WMI_10_2_PDEV_SET_CHANNEL_CMDID,
    1365                 :            :         .pdev_set_param_cmdid = WMI_10_2_PDEV_SET_PARAM_CMDID,
    1366                 :            :         .pdev_pktlog_enable_cmdid = WMI_10_2_PDEV_PKTLOG_ENABLE_CMDID,
    1367                 :            :         .pdev_pktlog_disable_cmdid = WMI_10_2_PDEV_PKTLOG_DISABLE_CMDID,
    1368                 :            :         .pdev_set_wmm_params_cmdid = WMI_10_2_PDEV_SET_WMM_PARAMS_CMDID,
    1369                 :            :         .pdev_set_ht_cap_ie_cmdid = WMI_10_2_PDEV_SET_HT_CAP_IE_CMDID,
    1370                 :            :         .pdev_set_vht_cap_ie_cmdid = WMI_10_2_PDEV_SET_VHT_CAP_IE_CMDID,
    1371                 :            :         .pdev_set_quiet_mode_cmdid = WMI_10_2_PDEV_SET_QUIET_MODE_CMDID,
    1372                 :            :         .pdev_green_ap_ps_enable_cmdid = WMI_10_2_PDEV_GREEN_AP_PS_ENABLE_CMDID,
    1373                 :            :         .pdev_get_tpc_config_cmdid = WMI_10_2_PDEV_GET_TPC_CONFIG_CMDID,
    1374                 :            :         .pdev_set_base_macaddr_cmdid = WMI_10_2_PDEV_SET_BASE_MACADDR_CMDID,
    1375                 :            :         .vdev_create_cmdid = WMI_10_2_VDEV_CREATE_CMDID,
    1376                 :            :         .vdev_delete_cmdid = WMI_10_2_VDEV_DELETE_CMDID,
    1377                 :            :         .vdev_start_request_cmdid = WMI_10_2_VDEV_START_REQUEST_CMDID,
    1378                 :            :         .vdev_restart_request_cmdid = WMI_10_2_VDEV_RESTART_REQUEST_CMDID,
    1379                 :            :         .vdev_up_cmdid = WMI_10_2_VDEV_UP_CMDID,
    1380                 :            :         .vdev_stop_cmdid = WMI_10_2_VDEV_STOP_CMDID,
    1381                 :            :         .vdev_down_cmdid = WMI_10_2_VDEV_DOWN_CMDID,
    1382                 :            :         .vdev_set_param_cmdid = WMI_10_2_VDEV_SET_PARAM_CMDID,
    1383                 :            :         .vdev_install_key_cmdid = WMI_10_2_VDEV_INSTALL_KEY_CMDID,
    1384                 :            :         .peer_create_cmdid = WMI_10_2_PEER_CREATE_CMDID,
    1385                 :            :         .peer_delete_cmdid = WMI_10_2_PEER_DELETE_CMDID,
    1386                 :            :         .peer_flush_tids_cmdid = WMI_10_2_PEER_FLUSH_TIDS_CMDID,
    1387                 :            :         .peer_set_param_cmdid = WMI_10_2_PEER_SET_PARAM_CMDID,
    1388                 :            :         .peer_assoc_cmdid = WMI_10_2_PEER_ASSOC_CMDID,
    1389                 :            :         .peer_add_wds_entry_cmdid = WMI_10_2_PEER_ADD_WDS_ENTRY_CMDID,
    1390                 :            :         .peer_remove_wds_entry_cmdid = WMI_10_2_PEER_REMOVE_WDS_ENTRY_CMDID,
    1391                 :            :         .peer_mcast_group_cmdid = WMI_10_2_PEER_MCAST_GROUP_CMDID,
    1392                 :            :         .bcn_tx_cmdid = WMI_10_2_BCN_TX_CMDID,
    1393                 :            :         .pdev_send_bcn_cmdid = WMI_10_2_PDEV_SEND_BCN_CMDID,
    1394                 :            :         .bcn_tmpl_cmdid = WMI_CMD_UNSUPPORTED,
    1395                 :            :         .bcn_filter_rx_cmdid = WMI_10_2_BCN_FILTER_RX_CMDID,
    1396                 :            :         .prb_req_filter_rx_cmdid = WMI_10_2_PRB_REQ_FILTER_RX_CMDID,
    1397                 :            :         .mgmt_tx_cmdid = WMI_10_2_MGMT_TX_CMDID,
    1398                 :            :         .prb_tmpl_cmdid = WMI_CMD_UNSUPPORTED,
    1399                 :            :         .addba_clear_resp_cmdid = WMI_10_2_ADDBA_CLEAR_RESP_CMDID,
    1400                 :            :         .addba_send_cmdid = WMI_10_2_ADDBA_SEND_CMDID,
    1401                 :            :         .addba_status_cmdid = WMI_10_2_ADDBA_STATUS_CMDID,
    1402                 :            :         .delba_send_cmdid = WMI_10_2_DELBA_SEND_CMDID,
    1403                 :            :         .addba_set_resp_cmdid = WMI_10_2_ADDBA_SET_RESP_CMDID,
    1404                 :            :         .send_singleamsdu_cmdid = WMI_10_2_SEND_SINGLEAMSDU_CMDID,
    1405                 :            :         .sta_powersave_mode_cmdid = WMI_10_2_STA_POWERSAVE_MODE_CMDID,
    1406                 :            :         .sta_powersave_param_cmdid = WMI_10_2_STA_POWERSAVE_PARAM_CMDID,
    1407                 :            :         .sta_mimo_ps_mode_cmdid = WMI_10_2_STA_MIMO_PS_MODE_CMDID,
    1408                 :            :         .pdev_dfs_enable_cmdid = WMI_10_2_PDEV_DFS_ENABLE_CMDID,
    1409                 :            :         .pdev_dfs_disable_cmdid = WMI_10_2_PDEV_DFS_DISABLE_CMDID,
    1410                 :            :         .roam_scan_mode = WMI_10_2_ROAM_SCAN_MODE,
    1411                 :            :         .roam_scan_rssi_threshold = WMI_10_2_ROAM_SCAN_RSSI_THRESHOLD,
    1412                 :            :         .roam_scan_period = WMI_10_2_ROAM_SCAN_PERIOD,
    1413                 :            :         .roam_scan_rssi_change_threshold =
    1414                 :            :                                 WMI_10_2_ROAM_SCAN_RSSI_CHANGE_THRESHOLD,
    1415                 :            :         .roam_ap_profile = WMI_10_2_ROAM_AP_PROFILE,
    1416                 :            :         .ofl_scan_add_ap_profile = WMI_10_2_OFL_SCAN_ADD_AP_PROFILE,
    1417                 :            :         .ofl_scan_remove_ap_profile = WMI_10_2_OFL_SCAN_REMOVE_AP_PROFILE,
    1418                 :            :         .ofl_scan_period = WMI_10_2_OFL_SCAN_PERIOD,
    1419                 :            :         .p2p_dev_set_device_info = WMI_10_2_P2P_DEV_SET_DEVICE_INFO,
    1420                 :            :         .p2p_dev_set_discoverability = WMI_10_2_P2P_DEV_SET_DISCOVERABILITY,
    1421                 :            :         .p2p_go_set_beacon_ie = WMI_10_2_P2P_GO_SET_BEACON_IE,
    1422                 :            :         .p2p_go_set_probe_resp_ie = WMI_10_2_P2P_GO_SET_PROBE_RESP_IE,
    1423                 :            :         .p2p_set_vendor_ie_data_cmdid = WMI_CMD_UNSUPPORTED,
    1424                 :            :         .ap_ps_peer_param_cmdid = WMI_10_2_AP_PS_PEER_PARAM_CMDID,
    1425                 :            :         .ap_ps_peer_uapsd_coex_cmdid = WMI_CMD_UNSUPPORTED,
    1426                 :            :         .peer_rate_retry_sched_cmdid = WMI_10_2_PEER_RATE_RETRY_SCHED_CMDID,
    1427                 :            :         .wlan_profile_trigger_cmdid = WMI_10_2_WLAN_PROFILE_TRIGGER_CMDID,
    1428                 :            :         .wlan_profile_set_hist_intvl_cmdid =
    1429                 :            :                                 WMI_10_2_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
    1430                 :            :         .wlan_profile_get_profile_data_cmdid =
    1431                 :            :                                 WMI_10_2_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
    1432                 :            :         .wlan_profile_enable_profile_id_cmdid =
    1433                 :            :                                 WMI_10_2_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
    1434                 :            :         .wlan_profile_list_profile_id_cmdid =
    1435                 :            :                                 WMI_10_2_WLAN_PROFILE_LIST_PROFILE_ID_CMDID,
    1436                 :            :         .pdev_suspend_cmdid = WMI_10_2_PDEV_SUSPEND_CMDID,
    1437                 :            :         .pdev_resume_cmdid = WMI_10_2_PDEV_RESUME_CMDID,
    1438                 :            :         .add_bcn_filter_cmdid = WMI_10_2_ADD_BCN_FILTER_CMDID,
    1439                 :            :         .rmv_bcn_filter_cmdid = WMI_10_2_RMV_BCN_FILTER_CMDID,
    1440                 :            :         .wow_add_wake_pattern_cmdid = WMI_10_2_WOW_ADD_WAKE_PATTERN_CMDID,
    1441                 :            :         .wow_del_wake_pattern_cmdid = WMI_10_2_WOW_DEL_WAKE_PATTERN_CMDID,
    1442                 :            :         .wow_enable_disable_wake_event_cmdid =
    1443                 :            :                                 WMI_10_2_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID,
    1444                 :            :         .wow_enable_cmdid = WMI_10_2_WOW_ENABLE_CMDID,
    1445                 :            :         .wow_hostwakeup_from_sleep_cmdid =
    1446                 :            :                                 WMI_10_2_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID,
    1447                 :            :         .rtt_measreq_cmdid = WMI_10_2_RTT_MEASREQ_CMDID,
    1448                 :            :         .rtt_tsf_cmdid = WMI_10_2_RTT_TSF_CMDID,
    1449                 :            :         .vdev_spectral_scan_configure_cmdid =
    1450                 :            :                                 WMI_10_2_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID,
    1451                 :            :         .vdev_spectral_scan_enable_cmdid =
    1452                 :            :                                 WMI_10_2_VDEV_SPECTRAL_SCAN_ENABLE_CMDID,
    1453                 :            :         .request_stats_cmdid = WMI_10_2_REQUEST_STATS_CMDID,
    1454                 :            :         .set_arp_ns_offload_cmdid = WMI_CMD_UNSUPPORTED,
    1455                 :            :         .network_list_offload_config_cmdid = WMI_CMD_UNSUPPORTED,
    1456                 :            :         .gtk_offload_cmdid = WMI_CMD_UNSUPPORTED,
    1457                 :            :         .csa_offload_enable_cmdid = WMI_CMD_UNSUPPORTED,
    1458                 :            :         .csa_offload_chanswitch_cmdid = WMI_CMD_UNSUPPORTED,
    1459                 :            :         .chatter_set_mode_cmdid = WMI_CMD_UNSUPPORTED,
    1460                 :            :         .peer_tid_addba_cmdid = WMI_CMD_UNSUPPORTED,
    1461                 :            :         .peer_tid_delba_cmdid = WMI_CMD_UNSUPPORTED,
    1462                 :            :         .sta_dtim_ps_method_cmdid = WMI_CMD_UNSUPPORTED,
    1463                 :            :         .sta_uapsd_auto_trig_cmdid = WMI_CMD_UNSUPPORTED,
    1464                 :            :         .sta_keepalive_cmd = WMI_CMD_UNSUPPORTED,
    1465                 :            :         .echo_cmdid = WMI_10_2_ECHO_CMDID,
    1466                 :            :         .pdev_utf_cmdid = WMI_10_2_PDEV_UTF_CMDID,
    1467                 :            :         .dbglog_cfg_cmdid = WMI_10_2_DBGLOG_CFG_CMDID,
    1468                 :            :         .pdev_qvit_cmdid = WMI_10_2_PDEV_QVIT_CMDID,
    1469                 :            :         .pdev_ftm_intg_cmdid = WMI_CMD_UNSUPPORTED,
    1470                 :            :         .vdev_set_keepalive_cmdid = WMI_CMD_UNSUPPORTED,
    1471                 :            :         .vdev_get_keepalive_cmdid = WMI_CMD_UNSUPPORTED,
    1472                 :            :         .force_fw_hang_cmdid = WMI_CMD_UNSUPPORTED,
    1473                 :            :         .gpio_config_cmdid = WMI_10_2_GPIO_CONFIG_CMDID,
    1474                 :            :         .gpio_output_cmdid = WMI_10_2_GPIO_OUTPUT_CMDID,
    1475                 :            :         .pdev_get_temperature_cmdid = WMI_CMD_UNSUPPORTED,
    1476                 :            :         .pdev_enable_adaptive_cca_cmdid = WMI_CMD_UNSUPPORTED,
    1477                 :            :         .scan_update_request_cmdid = WMI_CMD_UNSUPPORTED,
    1478                 :            :         .vdev_standby_response_cmdid = WMI_CMD_UNSUPPORTED,
    1479                 :            :         .vdev_resume_response_cmdid = WMI_CMD_UNSUPPORTED,
    1480                 :            :         .wlan_peer_caching_add_peer_cmdid = WMI_CMD_UNSUPPORTED,
    1481                 :            :         .wlan_peer_caching_evict_peer_cmdid = WMI_CMD_UNSUPPORTED,
    1482                 :            :         .wlan_peer_caching_restore_peer_cmdid = WMI_CMD_UNSUPPORTED,
    1483                 :            :         .wlan_peer_caching_print_all_peers_info_cmdid = WMI_CMD_UNSUPPORTED,
    1484                 :            :         .peer_update_wds_entry_cmdid = WMI_CMD_UNSUPPORTED,
    1485                 :            :         .peer_add_proxy_sta_entry_cmdid = WMI_CMD_UNSUPPORTED,
    1486                 :            :         .rtt_keepalive_cmdid = WMI_CMD_UNSUPPORTED,
    1487                 :            :         .oem_req_cmdid = WMI_CMD_UNSUPPORTED,
    1488                 :            :         .nan_cmdid = WMI_CMD_UNSUPPORTED,
    1489                 :            :         .vdev_ratemask_cmdid = WMI_CMD_UNSUPPORTED,
    1490                 :            :         .qboost_cfg_cmdid = WMI_CMD_UNSUPPORTED,
    1491                 :            :         .pdev_smart_ant_enable_cmdid = WMI_CMD_UNSUPPORTED,
    1492                 :            :         .pdev_smart_ant_set_rx_antenna_cmdid = WMI_CMD_UNSUPPORTED,
    1493                 :            :         .peer_smart_ant_set_tx_antenna_cmdid = WMI_CMD_UNSUPPORTED,
    1494                 :            :         .peer_smart_ant_set_train_info_cmdid = WMI_CMD_UNSUPPORTED,
    1495                 :            :         .peer_smart_ant_set_node_config_ops_cmdid = WMI_CMD_UNSUPPORTED,
    1496                 :            :         .pdev_set_antenna_switch_table_cmdid = WMI_CMD_UNSUPPORTED,
    1497                 :            :         .pdev_set_ctl_table_cmdid = WMI_CMD_UNSUPPORTED,
    1498                 :            :         .pdev_set_mimogain_table_cmdid = WMI_CMD_UNSUPPORTED,
    1499                 :            :         .pdev_ratepwr_table_cmdid = WMI_CMD_UNSUPPORTED,
    1500                 :            :         .pdev_ratepwr_chainmsk_table_cmdid = WMI_CMD_UNSUPPORTED,
    1501                 :            :         .pdev_fips_cmdid = WMI_CMD_UNSUPPORTED,
    1502                 :            :         .tt_set_conf_cmdid = WMI_CMD_UNSUPPORTED,
    1503                 :            :         .fwtest_cmdid = WMI_CMD_UNSUPPORTED,
    1504                 :            :         .vdev_atf_request_cmdid = WMI_CMD_UNSUPPORTED,
    1505                 :            :         .peer_atf_request_cmdid = WMI_CMD_UNSUPPORTED,
    1506                 :            :         .pdev_get_ani_cck_config_cmdid = WMI_CMD_UNSUPPORTED,
    1507                 :            :         .pdev_get_ani_ofdm_config_cmdid = WMI_CMD_UNSUPPORTED,
    1508                 :            :         .pdev_reserve_ast_entry_cmdid = WMI_CMD_UNSUPPORTED,
    1509                 :            :         .pdev_get_tpc_table_cmdid = WMI_CMD_UNSUPPORTED,
    1510                 :            :         .radar_found_cmdid = WMI_CMD_UNSUPPORTED,
    1511                 :            : };
    1512                 :            : 
    1513                 :            : static struct wmi_pdev_param_map wmi_10_4_pdev_param_map = {
    1514                 :            :         .tx_chain_mask = WMI_10_4_PDEV_PARAM_TX_CHAIN_MASK,
    1515                 :            :         .rx_chain_mask = WMI_10_4_PDEV_PARAM_RX_CHAIN_MASK,
    1516                 :            :         .txpower_limit2g = WMI_10_4_PDEV_PARAM_TXPOWER_LIMIT2G,
    1517                 :            :         .txpower_limit5g = WMI_10_4_PDEV_PARAM_TXPOWER_LIMIT5G,
    1518                 :            :         .txpower_scale = WMI_10_4_PDEV_PARAM_TXPOWER_SCALE,
    1519                 :            :         .beacon_gen_mode = WMI_10_4_PDEV_PARAM_BEACON_GEN_MODE,
    1520                 :            :         .beacon_tx_mode = WMI_10_4_PDEV_PARAM_BEACON_TX_MODE,
    1521                 :            :         .resmgr_offchan_mode = WMI_10_4_PDEV_PARAM_RESMGR_OFFCHAN_MODE,
    1522                 :            :         .protection_mode = WMI_10_4_PDEV_PARAM_PROTECTION_MODE,
    1523                 :            :         .dynamic_bw = WMI_10_4_PDEV_PARAM_DYNAMIC_BW,
    1524                 :            :         .non_agg_sw_retry_th = WMI_10_4_PDEV_PARAM_NON_AGG_SW_RETRY_TH,
    1525                 :            :         .agg_sw_retry_th = WMI_10_4_PDEV_PARAM_AGG_SW_RETRY_TH,
    1526                 :            :         .sta_kickout_th = WMI_10_4_PDEV_PARAM_STA_KICKOUT_TH,
    1527                 :            :         .ac_aggrsize_scaling = WMI_10_4_PDEV_PARAM_AC_AGGRSIZE_SCALING,
    1528                 :            :         .ltr_enable = WMI_10_4_PDEV_PARAM_LTR_ENABLE,
    1529                 :            :         .ltr_ac_latency_be = WMI_10_4_PDEV_PARAM_LTR_AC_LATENCY_BE,
    1530                 :            :         .ltr_ac_latency_bk = WMI_10_4_PDEV_PARAM_LTR_AC_LATENCY_BK,
    1531                 :            :         .ltr_ac_latency_vi = WMI_10_4_PDEV_PARAM_LTR_AC_LATENCY_VI,
    1532                 :            :         .ltr_ac_latency_vo = WMI_10_4_PDEV_PARAM_LTR_AC_LATENCY_VO,
    1533                 :            :         .ltr_ac_latency_timeout = WMI_10_4_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT,
    1534                 :            :         .ltr_sleep_override = WMI_10_4_PDEV_PARAM_LTR_SLEEP_OVERRIDE,
    1535                 :            :         .ltr_rx_override = WMI_10_4_PDEV_PARAM_LTR_RX_OVERRIDE,
    1536                 :            :         .ltr_tx_activity_timeout = WMI_10_4_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT,
    1537                 :            :         .l1ss_enable = WMI_10_4_PDEV_PARAM_L1SS_ENABLE,
    1538                 :            :         .dsleep_enable = WMI_10_4_PDEV_PARAM_DSLEEP_ENABLE,
    1539                 :            :         .pcielp_txbuf_flush = WMI_10_4_PDEV_PARAM_PCIELP_TXBUF_FLUSH,
    1540                 :            :         .pcielp_txbuf_watermark = WMI_10_4_PDEV_PARAM_PCIELP_TXBUF_WATERMARK,
    1541                 :            :         .pcielp_txbuf_tmo_en = WMI_10_4_PDEV_PARAM_PCIELP_TXBUF_TMO_EN,
    1542                 :            :         .pcielp_txbuf_tmo_value = WMI_10_4_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE,
    1543                 :            :         .pdev_stats_update_period =
    1544                 :            :                         WMI_10_4_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD,
    1545                 :            :         .vdev_stats_update_period =
    1546                 :            :                         WMI_10_4_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD,
    1547                 :            :         .peer_stats_update_period =
    1548                 :            :                         WMI_10_4_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD,
    1549                 :            :         .bcnflt_stats_update_period =
    1550                 :            :                         WMI_10_4_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD,
    1551                 :            :         .pmf_qos = WMI_10_4_PDEV_PARAM_PMF_QOS,
    1552                 :            :         .arp_ac_override = WMI_10_4_PDEV_PARAM_ARP_AC_OVERRIDE,
    1553                 :            :         .dcs = WMI_10_4_PDEV_PARAM_DCS,
    1554                 :            :         .ani_enable = WMI_10_4_PDEV_PARAM_ANI_ENABLE,
    1555                 :            :         .ani_poll_period = WMI_10_4_PDEV_PARAM_ANI_POLL_PERIOD,
    1556                 :            :         .ani_listen_period = WMI_10_4_PDEV_PARAM_ANI_LISTEN_PERIOD,
    1557                 :            :         .ani_ofdm_level = WMI_10_4_PDEV_PARAM_ANI_OFDM_LEVEL,
    1558                 :            :         .ani_cck_level = WMI_10_4_PDEV_PARAM_ANI_CCK_LEVEL,
    1559                 :            :         .dyntxchain = WMI_10_4_PDEV_PARAM_DYNTXCHAIN,
    1560                 :            :         .proxy_sta = WMI_10_4_PDEV_PARAM_PROXY_STA,
    1561                 :            :         .idle_ps_config = WMI_10_4_PDEV_PARAM_IDLE_PS_CONFIG,
    1562                 :            :         .power_gating_sleep = WMI_10_4_PDEV_PARAM_POWER_GATING_SLEEP,
    1563                 :            :         .fast_channel_reset = WMI_10_4_PDEV_PARAM_FAST_CHANNEL_RESET,
    1564                 :            :         .burst_dur = WMI_10_4_PDEV_PARAM_BURST_DUR,
    1565                 :            :         .burst_enable = WMI_10_4_PDEV_PARAM_BURST_ENABLE,
    1566                 :            :         .cal_period = WMI_10_4_PDEV_PARAM_CAL_PERIOD,
    1567                 :            :         .aggr_burst = WMI_10_4_PDEV_PARAM_AGGR_BURST,
    1568                 :            :         .rx_decap_mode = WMI_10_4_PDEV_PARAM_RX_DECAP_MODE,
    1569                 :            :         .smart_antenna_default_antenna =
    1570                 :            :                         WMI_10_4_PDEV_PARAM_SMART_ANTENNA_DEFAULT_ANTENNA,
    1571                 :            :         .igmpmld_override = WMI_10_4_PDEV_PARAM_IGMPMLD_OVERRIDE,
    1572                 :            :         .igmpmld_tid = WMI_10_4_PDEV_PARAM_IGMPMLD_TID,
    1573                 :            :         .antenna_gain = WMI_10_4_PDEV_PARAM_ANTENNA_GAIN,
    1574                 :            :         .rx_filter = WMI_10_4_PDEV_PARAM_RX_FILTER,
    1575                 :            :         .set_mcast_to_ucast_tid = WMI_10_4_PDEV_SET_MCAST_TO_UCAST_TID,
    1576                 :            :         .proxy_sta_mode = WMI_10_4_PDEV_PARAM_PROXY_STA_MODE,
    1577                 :            :         .set_mcast2ucast_mode = WMI_10_4_PDEV_PARAM_SET_MCAST2UCAST_MODE,
    1578                 :            :         .set_mcast2ucast_buffer = WMI_10_4_PDEV_PARAM_SET_MCAST2UCAST_BUFFER,
    1579                 :            :         .remove_mcast2ucast_buffer =
    1580                 :            :                         WMI_10_4_PDEV_PARAM_REMOVE_MCAST2UCAST_BUFFER,
    1581                 :            :         .peer_sta_ps_statechg_enable =
    1582                 :            :                         WMI_10_4_PDEV_PEER_STA_PS_STATECHG_ENABLE,
    1583                 :            :         .igmpmld_ac_override = WMI_10_4_PDEV_PARAM_IGMPMLD_AC_OVERRIDE,
    1584                 :            :         .block_interbss = WMI_10_4_PDEV_PARAM_BLOCK_INTERBSS,
    1585                 :            :         .set_disable_reset_cmdid = WMI_10_4_PDEV_PARAM_SET_DISABLE_RESET_CMDID,
    1586                 :            :         .set_msdu_ttl_cmdid = WMI_10_4_PDEV_PARAM_SET_MSDU_TTL_CMDID,
    1587                 :            :         .set_ppdu_duration_cmdid = WMI_10_4_PDEV_PARAM_SET_PPDU_DURATION_CMDID,
    1588                 :            :         .txbf_sound_period_cmdid = WMI_10_4_PDEV_PARAM_TXBF_SOUND_PERIOD_CMDID,
    1589                 :            :         .set_promisc_mode_cmdid = WMI_10_4_PDEV_PARAM_SET_PROMISC_MODE_CMDID,
    1590                 :            :         .set_burst_mode_cmdid = WMI_10_4_PDEV_PARAM_SET_BURST_MODE_CMDID,
    1591                 :            :         .en_stats = WMI_10_4_PDEV_PARAM_EN_STATS,
    1592                 :            :         .mu_group_policy = WMI_10_4_PDEV_PARAM_MU_GROUP_POLICY,
    1593                 :            :         .noise_detection = WMI_10_4_PDEV_PARAM_NOISE_DETECTION,
    1594                 :            :         .noise_threshold = WMI_10_4_PDEV_PARAM_NOISE_THRESHOLD,
    1595                 :            :         .dpd_enable = WMI_10_4_PDEV_PARAM_DPD_ENABLE,
    1596                 :            :         .set_mcast_bcast_echo = WMI_10_4_PDEV_PARAM_SET_MCAST_BCAST_ECHO,
    1597                 :            :         .atf_strict_sch = WMI_10_4_PDEV_PARAM_ATF_STRICT_SCH,
    1598                 :            :         .atf_sched_duration = WMI_10_4_PDEV_PARAM_ATF_SCHED_DURATION,
    1599                 :            :         .ant_plzn = WMI_10_4_PDEV_PARAM_ANT_PLZN,
    1600                 :            :         .mgmt_retry_limit = WMI_10_4_PDEV_PARAM_MGMT_RETRY_LIMIT,
    1601                 :            :         .sensitivity_level = WMI_10_4_PDEV_PARAM_SENSITIVITY_LEVEL,
    1602                 :            :         .signed_txpower_2g = WMI_10_4_PDEV_PARAM_SIGNED_TXPOWER_2G,
    1603                 :            :         .signed_txpower_5g = WMI_10_4_PDEV_PARAM_SIGNED_TXPOWER_5G,
    1604                 :            :         .enable_per_tid_amsdu = WMI_10_4_PDEV_PARAM_ENABLE_PER_TID_AMSDU,
    1605                 :            :         .enable_per_tid_ampdu = WMI_10_4_PDEV_PARAM_ENABLE_PER_TID_AMPDU,
    1606                 :            :         .cca_threshold = WMI_10_4_PDEV_PARAM_CCA_THRESHOLD,
    1607                 :            :         .rts_fixed_rate = WMI_10_4_PDEV_PARAM_RTS_FIXED_RATE,
    1608                 :            :         .pdev_reset = WMI_10_4_PDEV_PARAM_PDEV_RESET,
    1609                 :            :         .wapi_mbssid_offset = WMI_10_4_PDEV_PARAM_WAPI_MBSSID_OFFSET,
    1610                 :            :         .arp_srcaddr = WMI_10_4_PDEV_PARAM_ARP_SRCADDR,
    1611                 :            :         .arp_dstaddr = WMI_10_4_PDEV_PARAM_ARP_DSTADDR,
    1612                 :            :         .enable_btcoex = WMI_10_4_PDEV_PARAM_ENABLE_BTCOEX,
    1613                 :            : };
    1614                 :            : 
    1615                 :            : static const u8 wmi_key_cipher_suites[] = {
    1616                 :            :         [WMI_CIPHER_NONE] = WMI_CIPHER_NONE,
    1617                 :            :         [WMI_CIPHER_WEP] = WMI_CIPHER_WEP,
    1618                 :            :         [WMI_CIPHER_TKIP] = WMI_CIPHER_TKIP,
    1619                 :            :         [WMI_CIPHER_AES_OCB] = WMI_CIPHER_AES_OCB,
    1620                 :            :         [WMI_CIPHER_AES_CCM] = WMI_CIPHER_AES_CCM,
    1621                 :            :         [WMI_CIPHER_WAPI] = WMI_CIPHER_WAPI,
    1622                 :            :         [WMI_CIPHER_CKIP] = WMI_CIPHER_CKIP,
    1623                 :            :         [WMI_CIPHER_AES_CMAC] = WMI_CIPHER_AES_CMAC,
    1624                 :            :         [WMI_CIPHER_AES_GCM] = WMI_CIPHER_AES_GCM,
    1625                 :            : };
    1626                 :            : 
    1627                 :            : static const u8 wmi_tlv_key_cipher_suites[] = {
    1628                 :            :         [WMI_CIPHER_NONE] = WMI_TLV_CIPHER_NONE,
    1629                 :            :         [WMI_CIPHER_WEP] = WMI_TLV_CIPHER_WEP,
    1630                 :            :         [WMI_CIPHER_TKIP] = WMI_TLV_CIPHER_TKIP,
    1631                 :            :         [WMI_CIPHER_AES_OCB] = WMI_TLV_CIPHER_AES_OCB,
    1632                 :            :         [WMI_CIPHER_AES_CCM] = WMI_TLV_CIPHER_AES_CCM,
    1633                 :            :         [WMI_CIPHER_WAPI] = WMI_TLV_CIPHER_WAPI,
    1634                 :            :         [WMI_CIPHER_CKIP] = WMI_TLV_CIPHER_CKIP,
    1635                 :            :         [WMI_CIPHER_AES_CMAC] = WMI_TLV_CIPHER_AES_CMAC,
    1636                 :            :         [WMI_CIPHER_AES_GCM] = WMI_TLV_CIPHER_AES_GCM,
    1637                 :            : };
    1638                 :            : 
    1639                 :            : static const struct wmi_peer_flags_map wmi_peer_flags_map = {
    1640                 :            :         .auth = WMI_PEER_AUTH,
    1641                 :            :         .qos = WMI_PEER_QOS,
    1642                 :            :         .need_ptk_4_way = WMI_PEER_NEED_PTK_4_WAY,
    1643                 :            :         .need_gtk_2_way = WMI_PEER_NEED_GTK_2_WAY,
    1644                 :            :         .apsd = WMI_PEER_APSD,
    1645                 :            :         .ht = WMI_PEER_HT,
    1646                 :            :         .bw40 = WMI_PEER_40MHZ,
    1647                 :            :         .stbc = WMI_PEER_STBC,
    1648                 :            :         .ldbc = WMI_PEER_LDPC,
    1649                 :            :         .dyn_mimops = WMI_PEER_DYN_MIMOPS,
    1650                 :            :         .static_mimops = WMI_PEER_STATIC_MIMOPS,
    1651                 :            :         .spatial_mux = WMI_PEER_SPATIAL_MUX,
    1652                 :            :         .vht = WMI_PEER_VHT,
    1653                 :            :         .bw80 = WMI_PEER_80MHZ,
    1654                 :            :         .vht_2g = WMI_PEER_VHT_2G,
    1655                 :            :         .pmf = WMI_PEER_PMF,
    1656                 :            :         .bw160 = WMI_PEER_160MHZ,
    1657                 :            : };
    1658                 :            : 
    1659                 :            : static const struct wmi_peer_flags_map wmi_10x_peer_flags_map = {
    1660                 :            :         .auth = WMI_10X_PEER_AUTH,
    1661                 :            :         .qos = WMI_10X_PEER_QOS,
    1662                 :            :         .need_ptk_4_way = WMI_10X_PEER_NEED_PTK_4_WAY,
    1663                 :            :         .need_gtk_2_way = WMI_10X_PEER_NEED_GTK_2_WAY,
    1664                 :            :         .apsd = WMI_10X_PEER_APSD,
    1665                 :            :         .ht = WMI_10X_PEER_HT,
    1666                 :            :         .bw40 = WMI_10X_PEER_40MHZ,
    1667                 :            :         .stbc = WMI_10X_PEER_STBC,
    1668                 :            :         .ldbc = WMI_10X_PEER_LDPC,
    1669                 :            :         .dyn_mimops = WMI_10X_PEER_DYN_MIMOPS,
    1670                 :            :         .static_mimops = WMI_10X_PEER_STATIC_MIMOPS,
    1671                 :            :         .spatial_mux = WMI_10X_PEER_SPATIAL_MUX,
    1672                 :            :         .vht = WMI_10X_PEER_VHT,
    1673                 :            :         .bw80 = WMI_10X_PEER_80MHZ,
    1674                 :            :         .bw160 = WMI_10X_PEER_160MHZ,
    1675                 :            : };
    1676                 :            : 
    1677                 :            : static const struct wmi_peer_flags_map wmi_10_2_peer_flags_map = {
    1678                 :            :         .auth = WMI_10_2_PEER_AUTH,
    1679                 :            :         .qos = WMI_10_2_PEER_QOS,
    1680                 :            :         .need_ptk_4_way = WMI_10_2_PEER_NEED_PTK_4_WAY,
    1681                 :            :         .need_gtk_2_way = WMI_10_2_PEER_NEED_GTK_2_WAY,
    1682                 :            :         .apsd = WMI_10_2_PEER_APSD,
    1683                 :            :         .ht = WMI_10_2_PEER_HT,
    1684                 :            :         .bw40 = WMI_10_2_PEER_40MHZ,
    1685                 :            :         .stbc = WMI_10_2_PEER_STBC,
    1686                 :            :         .ldbc = WMI_10_2_PEER_LDPC,
    1687                 :            :         .dyn_mimops = WMI_10_2_PEER_DYN_MIMOPS,
    1688                 :            :         .static_mimops = WMI_10_2_PEER_STATIC_MIMOPS,
    1689                 :            :         .spatial_mux = WMI_10_2_PEER_SPATIAL_MUX,
    1690                 :            :         .vht = WMI_10_2_PEER_VHT,
    1691                 :            :         .bw80 = WMI_10_2_PEER_80MHZ,
    1692                 :            :         .vht_2g = WMI_10_2_PEER_VHT_2G,
    1693                 :            :         .pmf = WMI_10_2_PEER_PMF,
    1694                 :            :         .bw160 = WMI_10_2_PEER_160MHZ,
    1695                 :            : };
    1696                 :            : 
    1697                 :          0 : void ath10k_wmi_put_wmi_channel(struct wmi_channel *ch,
    1698                 :            :                                 const struct wmi_channel_arg *arg)
    1699                 :            : {
    1700                 :          0 :         u32 flags = 0;
    1701                 :            : 
    1702                 :          0 :         memset(ch, 0, sizeof(*ch));
    1703                 :            : 
    1704         [ #  # ]:          0 :         if (arg->passive)
    1705                 :          0 :                 flags |= WMI_CHAN_FLAG_PASSIVE;
    1706         [ #  # ]:          0 :         if (arg->allow_ibss)
    1707                 :          0 :                 flags |= WMI_CHAN_FLAG_ADHOC_ALLOWED;
    1708         [ #  # ]:          0 :         if (arg->allow_ht)
    1709                 :          0 :                 flags |= WMI_CHAN_FLAG_ALLOW_HT;
    1710         [ #  # ]:          0 :         if (arg->allow_vht)
    1711                 :          0 :                 flags |= WMI_CHAN_FLAG_ALLOW_VHT;
    1712         [ #  # ]:          0 :         if (arg->ht40plus)
    1713                 :          0 :                 flags |= WMI_CHAN_FLAG_HT40_PLUS;
    1714         [ #  # ]:          0 :         if (arg->chan_radar)
    1715                 :          0 :                 flags |= WMI_CHAN_FLAG_DFS;
    1716                 :            : 
    1717                 :          0 :         ch->mhz = __cpu_to_le32(arg->freq);
    1718                 :          0 :         ch->band_center_freq1 = __cpu_to_le32(arg->band_center_freq1);
    1719         [ #  # ]:          0 :         if (arg->mode == MODE_11AC_VHT80_80)
    1720                 :          0 :                 ch->band_center_freq2 = __cpu_to_le32(arg->band_center_freq2);
    1721                 :            :         else
    1722                 :          0 :                 ch->band_center_freq2 = 0;
    1723                 :          0 :         ch->min_power = arg->min_power;
    1724                 :          0 :         ch->max_power = arg->max_power;
    1725                 :          0 :         ch->reg_power = arg->max_reg_power;
    1726                 :          0 :         ch->antenna_max = arg->max_antenna_gain;
    1727                 :          0 :         ch->max_tx_power = arg->max_power;
    1728                 :            : 
    1729                 :            :         /* mode & flags share storage */
    1730                 :          0 :         ch->mode = arg->mode;
    1731                 :          0 :         ch->flags |= __cpu_to_le32(flags);
    1732                 :          0 : }
    1733                 :            : 
    1734                 :          0 : int ath10k_wmi_wait_for_service_ready(struct ath10k *ar)
    1735                 :            : {
    1736                 :          0 :         unsigned long time_left;
    1737                 :            : 
    1738                 :          0 :         time_left = wait_for_completion_timeout(&ar->wmi.service_ready,
    1739                 :            :                                                 WMI_SERVICE_READY_TIMEOUT_HZ);
    1740         [ #  # ]:          0 :         if (!time_left)
    1741                 :          0 :                 return -ETIMEDOUT;
    1742                 :            :         return 0;
    1743                 :            : }
    1744                 :            : 
    1745                 :          0 : int ath10k_wmi_wait_for_unified_ready(struct ath10k *ar)
    1746                 :            : {
    1747                 :          0 :         unsigned long time_left;
    1748                 :            : 
    1749                 :          0 :         time_left = wait_for_completion_timeout(&ar->wmi.unified_ready,
    1750                 :            :                                                 WMI_UNIFIED_READY_TIMEOUT_HZ);
    1751         [ #  # ]:          0 :         if (!time_left)
    1752                 :          0 :                 return -ETIMEDOUT;
    1753                 :            :         return 0;
    1754                 :            : }
    1755                 :            : 
    1756                 :          0 : struct sk_buff *ath10k_wmi_alloc_skb(struct ath10k *ar, u32 len)
    1757                 :            : {
    1758                 :          0 :         struct sk_buff *skb;
    1759                 :          0 :         u32 round_len = roundup(len, 4);
    1760                 :            : 
    1761                 :          0 :         skb = ath10k_htc_alloc_skb(ar, WMI_SKB_HEADROOM + round_len);
    1762         [ #  # ]:          0 :         if (!skb)
    1763                 :            :                 return NULL;
    1764                 :            : 
    1765         [ #  # ]:          0 :         skb_reserve(skb, WMI_SKB_HEADROOM);
    1766         [ #  # ]:          0 :         if (!IS_ALIGNED((unsigned long)skb->data, 4))
    1767                 :          0 :                 ath10k_warn(ar, "Unaligned WMI skb\n");
    1768                 :            : 
    1769                 :          0 :         skb_put(skb, round_len);
    1770                 :          0 :         memset(skb->data, 0, round_len);
    1771                 :            : 
    1772                 :          0 :         return skb;
    1773                 :            : }
    1774                 :            : 
    1775                 :          0 : static void ath10k_wmi_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb)
    1776                 :            : {
    1777                 :          0 :         dev_kfree_skb(skb);
    1778                 :          0 : }
    1779                 :            : 
    1780                 :          0 : int ath10k_wmi_cmd_send_nowait(struct ath10k *ar, struct sk_buff *skb,
    1781                 :            :                                u32 cmd_id)
    1782                 :            : {
    1783                 :          0 :         struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
    1784                 :          0 :         struct wmi_cmd_hdr *cmd_hdr;
    1785                 :          0 :         int ret;
    1786                 :          0 :         u32 cmd = 0;
    1787                 :            : 
    1788         [ #  # ]:          0 :         if (skb_push(skb, sizeof(struct wmi_cmd_hdr)) == NULL)
    1789                 :            :                 return -ENOMEM;
    1790                 :            : 
    1791                 :          0 :         cmd |= SM(cmd_id, WMI_CMD_HDR_CMD_ID);
    1792                 :            : 
    1793                 :          0 :         cmd_hdr = (struct wmi_cmd_hdr *)skb->data;
    1794                 :          0 :         cmd_hdr->cmd_id = __cpu_to_le32(cmd);
    1795                 :            : 
    1796                 :          0 :         memset(skb_cb, 0, sizeof(*skb_cb));
    1797                 :          0 :         trace_ath10k_wmi_cmd(ar, cmd_id, skb->data, skb->len);
    1798                 :          0 :         ret = ath10k_htc_send(&ar->htc, ar->wmi.eid, skb);
    1799                 :            : 
    1800         [ #  # ]:          0 :         if (ret)
    1801                 :          0 :                 goto err_pull;
    1802                 :            : 
    1803                 :            :         return 0;
    1804                 :            : 
    1805                 :            : err_pull:
    1806                 :          0 :         skb_pull(skb, sizeof(struct wmi_cmd_hdr));
    1807                 :          0 :         return ret;
    1808                 :            : }
    1809                 :            : 
    1810                 :          0 : static void ath10k_wmi_tx_beacon_nowait(struct ath10k_vif *arvif)
    1811                 :            : {
    1812                 :          0 :         struct ath10k *ar = arvif->ar;
    1813                 :          0 :         struct ath10k_skb_cb *cb;
    1814                 :          0 :         struct sk_buff *bcn;
    1815                 :          0 :         bool dtim_zero;
    1816                 :          0 :         bool deliver_cab;
    1817                 :          0 :         int ret;
    1818                 :            : 
    1819                 :          0 :         spin_lock_bh(&ar->data_lock);
    1820                 :            : 
    1821                 :          0 :         bcn = arvif->beacon;
    1822                 :            : 
    1823         [ #  # ]:          0 :         if (!bcn)
    1824                 :          0 :                 goto unlock;
    1825                 :            : 
    1826         [ #  # ]:          0 :         cb = ATH10K_SKB_CB(bcn);
    1827                 :            : 
    1828         [ #  # ]:          0 :         switch (arvif->beacon_state) {
    1829                 :            :         case ATH10K_BEACON_SENDING:
    1830                 :            :         case ATH10K_BEACON_SENT:
    1831                 :            :                 break;
    1832                 :          0 :         case ATH10K_BEACON_SCHEDULED:
    1833                 :          0 :                 arvif->beacon_state = ATH10K_BEACON_SENDING;
    1834                 :          0 :                 spin_unlock_bh(&ar->data_lock);
    1835                 :            : 
    1836                 :          0 :                 dtim_zero = !!(cb->flags & ATH10K_SKB_F_DTIM_ZERO);
    1837                 :          0 :                 deliver_cab = !!(cb->flags & ATH10K_SKB_F_DELIVER_CAB);
    1838                 :          0 :                 ret = ath10k_wmi_beacon_send_ref_nowait(arvif->ar,
    1839                 :            :                                                         arvif->vdev_id,
    1840                 :          0 :                                                         bcn->data, bcn->len,
    1841                 :          0 :                                                         cb->paddr,
    1842                 :            :                                                         dtim_zero,
    1843                 :            :                                                         deliver_cab);
    1844                 :            : 
    1845                 :          0 :                 spin_lock_bh(&ar->data_lock);
    1846                 :            : 
    1847         [ #  # ]:          0 :                 if (ret == 0)
    1848                 :          0 :                         arvif->beacon_state = ATH10K_BEACON_SENT;
    1849                 :            :                 else
    1850                 :          0 :                         arvif->beacon_state = ATH10K_BEACON_SCHEDULED;
    1851                 :            :         }
    1852                 :            : 
    1853                 :          0 : unlock:
    1854                 :          0 :         spin_unlock_bh(&ar->data_lock);
    1855                 :          0 : }
    1856                 :            : 
    1857                 :          0 : static void ath10k_wmi_tx_beacons_iter(void *data, u8 *mac,
    1858                 :            :                                        struct ieee80211_vif *vif)
    1859                 :            : {
    1860                 :          0 :         struct ath10k_vif *arvif = (void *)vif->drv_priv;
    1861                 :            : 
    1862                 :          0 :         ath10k_wmi_tx_beacon_nowait(arvif);
    1863                 :          0 : }
    1864                 :            : 
    1865                 :          0 : static void ath10k_wmi_tx_beacons_nowait(struct ath10k *ar)
    1866                 :            : {
    1867                 :          0 :         ieee80211_iterate_active_interfaces_atomic(ar->hw,
    1868                 :            :                                                    IEEE80211_IFACE_ITER_NORMAL,
    1869                 :            :                                                    ath10k_wmi_tx_beacons_iter,
    1870                 :            :                                                    NULL);
    1871                 :            : }
    1872                 :            : 
    1873                 :          0 : static void ath10k_wmi_op_ep_tx_credits(struct ath10k *ar)
    1874                 :            : {
    1875                 :            :         /* try to send pending beacons first. they take priority */
    1876                 :          0 :         ath10k_wmi_tx_beacons_nowait(ar);
    1877                 :            : 
    1878                 :          0 :         wake_up(&ar->wmi.tx_credits_wq);
    1879                 :          0 : }
    1880                 :            : 
    1881                 :          0 : int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id)
    1882                 :            : {
    1883                 :          0 :         int ret = -EOPNOTSUPP;
    1884                 :            : 
    1885                 :          0 :         might_sleep();
    1886                 :            : 
    1887         [ #  # ]:          0 :         if (cmd_id == WMI_CMD_UNSUPPORTED) {
    1888                 :          0 :                 ath10k_warn(ar, "wmi command %d is not supported by firmware\n",
    1889                 :            :                             cmd_id);
    1890                 :          0 :                 return ret;
    1891                 :            :         }
    1892                 :            : 
    1893   [ #  #  #  #  :          0 :         wait_event_timeout(ar->wmi.tx_credits_wq, ({
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
    1894                 :            :                 /* try to send pending beacons first. they take priority */
    1895                 :            :                 ath10k_wmi_tx_beacons_nowait(ar);
    1896                 :            : 
    1897                 :            :                 ret = ath10k_wmi_cmd_send_nowait(ar, skb, cmd_id);
    1898                 :            : 
    1899                 :            :                 if (ret && test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags))
    1900                 :            :                         ret = -ESHUTDOWN;
    1901                 :            : 
    1902                 :            :                 (ret != -EAGAIN);
    1903                 :            :         }), 3 * HZ);
    1904                 :            : 
    1905         [ #  # ]:          0 :         if (ret)
    1906                 :          0 :                 dev_kfree_skb_any(skb);
    1907                 :            : 
    1908         [ #  # ]:          0 :         if (ret == -EAGAIN) {
    1909                 :          0 :                 ath10k_warn(ar, "wmi command %d timeout, restarting hardware\n",
    1910                 :            :                             cmd_id);
    1911                 :          0 :                 queue_work(ar->workqueue, &ar->restart_work);
    1912                 :            :         }
    1913                 :            : 
    1914                 :            :         return ret;
    1915                 :            : }
    1916                 :            : 
    1917                 :            : static struct sk_buff *
    1918                 :          0 : ath10k_wmi_op_gen_mgmt_tx(struct ath10k *ar, struct sk_buff *msdu)
    1919                 :            : {
    1920         [ #  # ]:          0 :         struct ath10k_skb_cb *cb = ATH10K_SKB_CB(msdu);
    1921                 :          0 :         struct ath10k_vif *arvif;
    1922                 :          0 :         struct wmi_mgmt_tx_cmd *cmd;
    1923                 :          0 :         struct ieee80211_hdr *hdr;
    1924                 :          0 :         struct sk_buff *skb;
    1925                 :          0 :         int len;
    1926                 :          0 :         u32 vdev_id;
    1927                 :          0 :         u32 buf_len = msdu->len;
    1928                 :          0 :         u16 fc;
    1929                 :            : 
    1930                 :          0 :         hdr = (struct ieee80211_hdr *)msdu->data;
    1931                 :          0 :         fc = le16_to_cpu(hdr->frame_control);
    1932                 :            : 
    1933         [ #  # ]:          0 :         if (cb->vif) {
    1934                 :          0 :                 arvif = (void *)cb->vif->drv_priv;
    1935                 :          0 :                 vdev_id = arvif->vdev_id;
    1936                 :            :         } else {
    1937                 :            :                 vdev_id = 0;
    1938                 :            :         }
    1939                 :            : 
    1940   [ #  #  #  # ]:          0 :         if (WARN_ON_ONCE(!ieee80211_is_mgmt(hdr->frame_control)))
    1941                 :            :                 return ERR_PTR(-EINVAL);
    1942                 :            : 
    1943                 :          0 :         len = sizeof(cmd->hdr) + msdu->len;
    1944                 :            : 
    1945   [ #  #  #  # ]:          0 :         if ((ieee80211_is_action(hdr->frame_control) ||
    1946         [ #  # ]:          0 :              ieee80211_is_deauth(hdr->frame_control) ||
    1947         [ #  # ]:          0 :              ieee80211_is_disassoc(hdr->frame_control)) &&
    1948                 :            :              ieee80211_has_protected(hdr->frame_control)) {
    1949                 :          0 :                 len += IEEE80211_CCMP_MIC_LEN;
    1950                 :          0 :                 buf_len += IEEE80211_CCMP_MIC_LEN;
    1951                 :            :         }
    1952                 :            : 
    1953                 :          0 :         len = round_up(len, 4);
    1954                 :            : 
    1955                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, len);
    1956         [ #  # ]:          0 :         if (!skb)
    1957                 :            :                 return ERR_PTR(-ENOMEM);
    1958                 :            : 
    1959                 :          0 :         cmd = (struct wmi_mgmt_tx_cmd *)skb->data;
    1960                 :            : 
    1961                 :          0 :         cmd->hdr.vdev_id = __cpu_to_le32(vdev_id);
    1962                 :          0 :         cmd->hdr.tx_rate = 0;
    1963                 :          0 :         cmd->hdr.tx_power = 0;
    1964                 :          0 :         cmd->hdr.buf_len = __cpu_to_le32(buf_len);
    1965                 :            : 
    1966         [ #  # ]:          0 :         ether_addr_copy(cmd->hdr.peer_macaddr.addr, ieee80211_get_DA(hdr));
    1967                 :          0 :         memcpy(cmd->buf, msdu->data, msdu->len);
    1968                 :            : 
    1969         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi mgmt tx skb %pK len %d ftype %02x stype %02x\n",
    1970                 :            :                    msdu, skb->len, fc & IEEE80211_FCTL_FTYPE,
    1971                 :            :                    fc & IEEE80211_FCTL_STYPE);
    1972                 :          0 :         trace_ath10k_tx_hdr(ar, skb->data, skb->len);
    1973                 :          0 :         trace_ath10k_tx_payload(ar, skb->data, skb->len);
    1974                 :            : 
    1975                 :          0 :         return skb;
    1976                 :            : }
    1977                 :            : 
    1978                 :          0 : static void ath10k_wmi_event_scan_started(struct ath10k *ar)
    1979                 :            : {
    1980                 :          0 :         lockdep_assert_held(&ar->data_lock);
    1981                 :            : 
    1982      [ #  #  # ]:          0 :         switch (ar->scan.state) {
    1983                 :          0 :         case ATH10K_SCAN_IDLE:
    1984                 :            :         case ATH10K_SCAN_RUNNING:
    1985                 :            :         case ATH10K_SCAN_ABORTING:
    1986         [ #  # ]:          0 :                 ath10k_warn(ar, "received scan started event in an invalid scan state: %s (%d)\n",
    1987                 :            :                             ath10k_scan_state_str(ar->scan.state),
    1988                 :            :                             ar->scan.state);
    1989                 :          0 :                 break;
    1990                 :          0 :         case ATH10K_SCAN_STARTING:
    1991                 :          0 :                 ar->scan.state = ATH10K_SCAN_RUNNING;
    1992                 :            : 
    1993         [ #  # ]:          0 :                 if (ar->scan.is_roc)
    1994                 :          0 :                         ieee80211_ready_on_channel(ar->hw);
    1995                 :            : 
    1996                 :          0 :                 complete(&ar->scan.started);
    1997                 :          0 :                 break;
    1998                 :            :         }
    1999                 :          0 : }
    2000                 :            : 
    2001                 :          0 : static void ath10k_wmi_event_scan_start_failed(struct ath10k *ar)
    2002                 :            : {
    2003                 :          0 :         lockdep_assert_held(&ar->data_lock);
    2004                 :            : 
    2005      [ #  #  # ]:          0 :         switch (ar->scan.state) {
    2006                 :          0 :         case ATH10K_SCAN_IDLE:
    2007                 :            :         case ATH10K_SCAN_RUNNING:
    2008                 :            :         case ATH10K_SCAN_ABORTING:
    2009         [ #  # ]:          0 :                 ath10k_warn(ar, "received scan start failed event in an invalid scan state: %s (%d)\n",
    2010                 :            :                             ath10k_scan_state_str(ar->scan.state),
    2011                 :            :                             ar->scan.state);
    2012                 :          0 :                 break;
    2013                 :          0 :         case ATH10K_SCAN_STARTING:
    2014                 :          0 :                 complete(&ar->scan.started);
    2015                 :          0 :                 __ath10k_scan_finish(ar);
    2016                 :          0 :                 break;
    2017                 :            :         }
    2018                 :          0 : }
    2019                 :            : 
    2020                 :          0 : static void ath10k_wmi_event_scan_completed(struct ath10k *ar)
    2021                 :            : {
    2022                 :          0 :         lockdep_assert_held(&ar->data_lock);
    2023                 :            : 
    2024      [ #  #  # ]:          0 :         switch (ar->scan.state) {
    2025                 :          0 :         case ATH10K_SCAN_IDLE:
    2026                 :            :         case ATH10K_SCAN_STARTING:
    2027                 :            :                 /* One suspected reason scan can be completed while starting is
    2028                 :            :                  * if firmware fails to deliver all scan events to the host,
    2029                 :            :                  * e.g. when transport pipe is full. This has been observed
    2030                 :            :                  * with spectral scan phyerr events starving wmi transport
    2031                 :            :                  * pipe. In such case the "scan completed" event should be (and
    2032                 :            :                  * is) ignored by the host as it may be just firmware's scan
    2033                 :            :                  * state machine recovering.
    2034                 :            :                  */
    2035         [ #  # ]:          0 :                 ath10k_warn(ar, "received scan completed event in an invalid scan state: %s (%d)\n",
    2036                 :            :                             ath10k_scan_state_str(ar->scan.state),
    2037                 :            :                             ar->scan.state);
    2038                 :          0 :                 break;
    2039                 :          0 :         case ATH10K_SCAN_RUNNING:
    2040                 :            :         case ATH10K_SCAN_ABORTING:
    2041                 :          0 :                 __ath10k_scan_finish(ar);
    2042                 :          0 :                 break;
    2043                 :            :         }
    2044                 :          0 : }
    2045                 :            : 
    2046                 :          0 : static void ath10k_wmi_event_scan_bss_chan(struct ath10k *ar)
    2047                 :            : {
    2048                 :          0 :         lockdep_assert_held(&ar->data_lock);
    2049                 :            : 
    2050      [ #  #  # ]:          0 :         switch (ar->scan.state) {
    2051                 :          0 :         case ATH10K_SCAN_IDLE:
    2052                 :            :         case ATH10K_SCAN_STARTING:
    2053         [ #  # ]:          0 :                 ath10k_warn(ar, "received scan bss chan event in an invalid scan state: %s (%d)\n",
    2054                 :            :                             ath10k_scan_state_str(ar->scan.state),
    2055                 :            :                             ar->scan.state);
    2056                 :          0 :                 break;
    2057                 :          0 :         case ATH10K_SCAN_RUNNING:
    2058                 :            :         case ATH10K_SCAN_ABORTING:
    2059                 :          0 :                 ar->scan_channel = NULL;
    2060                 :          0 :                 break;
    2061                 :            :         }
    2062                 :          0 : }
    2063                 :            : 
    2064                 :          0 : static void ath10k_wmi_event_scan_foreign_chan(struct ath10k *ar, u32 freq)
    2065                 :            : {
    2066                 :          0 :         lockdep_assert_held(&ar->data_lock);
    2067                 :            : 
    2068      [ #  #  # ]:          0 :         switch (ar->scan.state) {
    2069                 :          0 :         case ATH10K_SCAN_IDLE:
    2070                 :            :         case ATH10K_SCAN_STARTING:
    2071         [ #  # ]:          0 :                 ath10k_warn(ar, "received scan foreign chan event in an invalid scan state: %s (%d)\n",
    2072                 :            :                             ath10k_scan_state_str(ar->scan.state),
    2073                 :            :                             ar->scan.state);
    2074                 :          0 :                 break;
    2075                 :          0 :         case ATH10K_SCAN_RUNNING:
    2076                 :            :         case ATH10K_SCAN_ABORTING:
    2077                 :          0 :                 ar->scan_channel = ieee80211_get_channel(ar->hw->wiphy, freq);
    2078                 :            : 
    2079   [ #  #  #  # ]:          0 :                 if (ar->scan.is_roc && ar->scan.roc_freq == freq)
    2080                 :          0 :                         complete(&ar->scan.on_channel);
    2081                 :            :                 break;
    2082                 :            :         }
    2083                 :          0 : }
    2084                 :            : 
    2085                 :            : static const char *
    2086                 :          0 : ath10k_wmi_event_scan_type_str(enum wmi_scan_event_type type,
    2087                 :            :                                enum wmi_scan_completion_reason reason)
    2088                 :            : {
    2089   [ #  #  #  #  :          0 :         switch (type) {
          #  #  #  #  #  
                      # ]
    2090                 :            :         case WMI_SCAN_EVENT_STARTED:
    2091                 :            :                 return "started";
    2092                 :          0 :         case WMI_SCAN_EVENT_COMPLETED:
    2093         [ #  # ]:          0 :                 switch (reason) {
    2094                 :            :                 case WMI_SCAN_REASON_COMPLETED:
    2095                 :            :                         return "completed";
    2096                 :            :                 case WMI_SCAN_REASON_CANCELLED:
    2097                 :            :                         return "completed [cancelled]";
    2098                 :            :                 case WMI_SCAN_REASON_PREEMPTED:
    2099                 :            :                         return "completed [preempted]";
    2100                 :            :                 case WMI_SCAN_REASON_TIMEDOUT:
    2101                 :            :                         return "completed [timedout]";
    2102                 :            :                 case WMI_SCAN_REASON_INTERNAL_FAILURE:
    2103                 :            :                         return "completed [internal err]";
    2104                 :            :                 case WMI_SCAN_REASON_MAX:
    2105                 :            :                         break;
    2106                 :            :                 }
    2107                 :            :                 return "completed [unknown]";
    2108                 :          0 :         case WMI_SCAN_EVENT_BSS_CHANNEL:
    2109                 :          0 :                 return "bss channel";
    2110                 :          0 :         case WMI_SCAN_EVENT_FOREIGN_CHANNEL:
    2111                 :          0 :                 return "foreign channel";
    2112                 :          0 :         case WMI_SCAN_EVENT_DEQUEUED:
    2113                 :          0 :                 return "dequeued";
    2114                 :          0 :         case WMI_SCAN_EVENT_PREEMPTED:
    2115                 :          0 :                 return "preempted";
    2116                 :          0 :         case WMI_SCAN_EVENT_START_FAILED:
    2117                 :          0 :                 return "start failed";
    2118                 :          0 :         case WMI_SCAN_EVENT_RESTARTED:
    2119                 :          0 :                 return "restarted";
    2120                 :          0 :         case WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT:
    2121                 :          0 :                 return "foreign channel exit";
    2122                 :          0 :         default:
    2123                 :          0 :                 return "unknown";
    2124                 :            :         }
    2125                 :            : }
    2126                 :            : 
    2127                 :          0 : static int ath10k_wmi_op_pull_scan_ev(struct ath10k *ar, struct sk_buff *skb,
    2128                 :            :                                       struct wmi_scan_ev_arg *arg)
    2129                 :            : {
    2130                 :          0 :         struct wmi_scan_event *ev = (void *)skb->data;
    2131                 :            : 
    2132         [ #  # ]:          0 :         if (skb->len < sizeof(*ev))
    2133                 :            :                 return -EPROTO;
    2134                 :            : 
    2135                 :          0 :         skb_pull(skb, sizeof(*ev));
    2136                 :          0 :         arg->event_type = ev->event_type;
    2137                 :          0 :         arg->reason = ev->reason;
    2138                 :          0 :         arg->channel_freq = ev->channel_freq;
    2139                 :          0 :         arg->scan_req_id = ev->scan_req_id;
    2140                 :          0 :         arg->scan_id = ev->scan_id;
    2141                 :          0 :         arg->vdev_id = ev->vdev_id;
    2142                 :            : 
    2143                 :          0 :         return 0;
    2144                 :            : }
    2145                 :            : 
    2146                 :          0 : int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb)
    2147                 :            : {
    2148                 :          0 :         struct wmi_scan_ev_arg arg = {};
    2149                 :          0 :         enum wmi_scan_event_type event_type;
    2150                 :          0 :         enum wmi_scan_completion_reason reason;
    2151                 :          0 :         u32 freq;
    2152                 :          0 :         u32 req_id;
    2153                 :          0 :         u32 scan_id;
    2154                 :          0 :         u32 vdev_id;
    2155                 :          0 :         int ret;
    2156                 :            : 
    2157         [ #  # ]:          0 :         ret = ath10k_wmi_pull_scan(ar, skb, &arg);
    2158         [ #  # ]:          0 :         if (ret) {
    2159                 :          0 :                 ath10k_warn(ar, "failed to parse scan event: %d\n", ret);
    2160                 :          0 :                 return ret;
    2161                 :            :         }
    2162                 :            : 
    2163                 :          0 :         event_type = __le32_to_cpu(arg.event_type);
    2164                 :          0 :         reason = __le32_to_cpu(arg.reason);
    2165                 :          0 :         freq = __le32_to_cpu(arg.channel_freq);
    2166                 :          0 :         req_id = __le32_to_cpu(arg.scan_req_id);
    2167                 :          0 :         scan_id = __le32_to_cpu(arg.scan_id);
    2168                 :          0 :         vdev_id = __le32_to_cpu(arg.vdev_id);
    2169                 :            : 
    2170                 :          0 :         spin_lock_bh(&ar->data_lock);
    2171                 :            : 
    2172   [ #  #  #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    2173                 :            :                    "scan event %s type %d reason %d freq %d req_id %d scan_id %d vdev_id %d state %s (%d)\n",
    2174                 :            :                    ath10k_wmi_event_scan_type_str(event_type, reason),
    2175                 :            :                    event_type, reason, freq, req_id, scan_id, vdev_id,
    2176                 :            :                    ath10k_scan_state_str(ar->scan.state), ar->scan.state);
    2177                 :            : 
    2178   [ #  #  #  #  :          0 :         switch (event_type) {
                   #  # ]
    2179                 :          0 :         case WMI_SCAN_EVENT_STARTED:
    2180                 :          0 :                 ath10k_wmi_event_scan_started(ar);
    2181                 :          0 :                 break;
    2182                 :          0 :         case WMI_SCAN_EVENT_COMPLETED:
    2183                 :          0 :                 ath10k_wmi_event_scan_completed(ar);
    2184                 :          0 :                 break;
    2185                 :          0 :         case WMI_SCAN_EVENT_BSS_CHANNEL:
    2186                 :          0 :                 ath10k_wmi_event_scan_bss_chan(ar);
    2187                 :          0 :                 break;
    2188                 :          0 :         case WMI_SCAN_EVENT_FOREIGN_CHANNEL:
    2189                 :          0 :                 ath10k_wmi_event_scan_foreign_chan(ar, freq);
    2190                 :          0 :                 break;
    2191                 :          0 :         case WMI_SCAN_EVENT_START_FAILED:
    2192                 :          0 :                 ath10k_warn(ar, "received scan start failure event\n");
    2193                 :          0 :                 ath10k_wmi_event_scan_start_failed(ar);
    2194                 :          0 :                 break;
    2195                 :            :         case WMI_SCAN_EVENT_DEQUEUED:
    2196                 :            :         case WMI_SCAN_EVENT_PREEMPTED:
    2197                 :            :         case WMI_SCAN_EVENT_RESTARTED:
    2198                 :            :         case WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT:
    2199                 :            :         default:
    2200                 :            :                 break;
    2201                 :            :         }
    2202                 :            : 
    2203                 :          0 :         spin_unlock_bh(&ar->data_lock);
    2204                 :          0 :         return 0;
    2205                 :            : }
    2206                 :            : 
    2207                 :            : /* If keys are configured, HW decrypts all frames
    2208                 :            :  * with protected bit set. Mark such frames as decrypted.
    2209                 :            :  */
    2210                 :            : static void ath10k_wmi_handle_wep_reauth(struct ath10k *ar,
    2211                 :            :                                          struct sk_buff *skb,
    2212                 :            :                                          struct ieee80211_rx_status *status)
    2213                 :            : {
    2214                 :            :         struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
    2215                 :            :         unsigned int hdrlen;
    2216                 :            :         bool peer_key;
    2217                 :            :         u8 *addr, keyidx;
    2218                 :            : 
    2219                 :            :         if (!ieee80211_is_auth(hdr->frame_control) ||
    2220                 :            :             !ieee80211_has_protected(hdr->frame_control))
    2221                 :            :                 return;
    2222                 :            : 
    2223                 :            :         hdrlen = ieee80211_hdrlen(hdr->frame_control);
    2224                 :            :         if (skb->len < (hdrlen + IEEE80211_WEP_IV_LEN))
    2225                 :            :                 return;
    2226                 :            : 
    2227                 :            :         keyidx = skb->data[hdrlen + (IEEE80211_WEP_IV_LEN - 1)] >> WEP_KEYID_SHIFT;
    2228                 :            :         addr = ieee80211_get_SA(hdr);
    2229                 :            : 
    2230                 :            :         spin_lock_bh(&ar->data_lock);
    2231                 :            :         peer_key = ath10k_mac_is_peer_wep_key_set(ar, addr, keyidx);
    2232                 :            :         spin_unlock_bh(&ar->data_lock);
    2233                 :            : 
    2234                 :            :         if (peer_key) {
    2235                 :            :                 ath10k_dbg(ar, ATH10K_DBG_MAC,
    2236                 :            :                            "mac wep key present for peer %pM\n", addr);
    2237                 :            :                 status->flag |= RX_FLAG_DECRYPTED;
    2238                 :            :         }
    2239                 :            : }
    2240                 :            : 
    2241                 :          0 : static int ath10k_wmi_op_pull_mgmt_rx_ev(struct ath10k *ar, struct sk_buff *skb,
    2242                 :            :                                          struct wmi_mgmt_rx_ev_arg *arg)
    2243                 :            : {
    2244                 :          0 :         struct wmi_mgmt_rx_event_v1 *ev_v1;
    2245                 :          0 :         struct wmi_mgmt_rx_event_v2 *ev_v2;
    2246                 :          0 :         struct wmi_mgmt_rx_hdr_v1 *ev_hdr;
    2247                 :          0 :         struct wmi_mgmt_rx_ext_info *ext_info;
    2248                 :          0 :         size_t pull_len;
    2249                 :          0 :         u32 msdu_len;
    2250                 :          0 :         u32 len;
    2251                 :            : 
    2252         [ #  # ]:          0 :         if (test_bit(ATH10K_FW_FEATURE_EXT_WMI_MGMT_RX,
    2253                 :          0 :                      ar->running_fw->fw_file.fw_features)) {
    2254                 :          0 :                 ev_v2 = (struct wmi_mgmt_rx_event_v2 *)skb->data;
    2255                 :          0 :                 ev_hdr = &ev_v2->hdr.v1;
    2256                 :          0 :                 pull_len = sizeof(*ev_v2);
    2257                 :            :         } else {
    2258                 :          0 :                 ev_v1 = (struct wmi_mgmt_rx_event_v1 *)skb->data;
    2259                 :          0 :                 ev_hdr = &ev_v1->hdr;
    2260                 :          0 :                 pull_len = sizeof(*ev_v1);
    2261                 :            :         }
    2262                 :            : 
    2263         [ #  # ]:          0 :         if (skb->len < pull_len)
    2264                 :            :                 return -EPROTO;
    2265                 :            : 
    2266                 :          0 :         skb_pull(skb, pull_len);
    2267                 :          0 :         arg->channel = ev_hdr->channel;
    2268                 :          0 :         arg->buf_len = ev_hdr->buf_len;
    2269                 :          0 :         arg->status = ev_hdr->status;
    2270                 :          0 :         arg->snr = ev_hdr->snr;
    2271                 :          0 :         arg->phy_mode = ev_hdr->phy_mode;
    2272                 :          0 :         arg->rate = ev_hdr->rate;
    2273                 :            : 
    2274                 :          0 :         msdu_len = __le32_to_cpu(arg->buf_len);
    2275         [ #  # ]:          0 :         if (skb->len < msdu_len)
    2276                 :            :                 return -EPROTO;
    2277                 :            : 
    2278         [ #  # ]:          0 :         if (le32_to_cpu(arg->status) & WMI_RX_STATUS_EXT_INFO) {
    2279                 :          0 :                 len = ALIGN(le32_to_cpu(arg->buf_len), 4);
    2280                 :          0 :                 ext_info = (struct wmi_mgmt_rx_ext_info *)(skb->data + len);
    2281                 :          0 :                 memcpy(&arg->ext_info, ext_info,
    2282                 :            :                        sizeof(struct wmi_mgmt_rx_ext_info));
    2283                 :            :         }
    2284                 :            :         /* the WMI buffer might've ended up being padded to 4 bytes due to HTC
    2285                 :            :          * trailer with credit update. Trim the excess garbage.
    2286                 :            :          */
    2287                 :          0 :         skb_trim(skb, msdu_len);
    2288                 :            : 
    2289                 :          0 :         return 0;
    2290                 :            : }
    2291                 :            : 
    2292                 :          0 : static int ath10k_wmi_10_4_op_pull_mgmt_rx_ev(struct ath10k *ar,
    2293                 :            :                                               struct sk_buff *skb,
    2294                 :            :                                               struct wmi_mgmt_rx_ev_arg *arg)
    2295                 :            : {
    2296                 :          0 :         struct wmi_10_4_mgmt_rx_event *ev;
    2297                 :          0 :         struct wmi_10_4_mgmt_rx_hdr *ev_hdr;
    2298                 :          0 :         size_t pull_len;
    2299                 :          0 :         u32 msdu_len;
    2300                 :          0 :         struct wmi_mgmt_rx_ext_info *ext_info;
    2301                 :          0 :         u32 len;
    2302                 :            : 
    2303                 :          0 :         ev = (struct wmi_10_4_mgmt_rx_event *)skb->data;
    2304                 :          0 :         ev_hdr = &ev->hdr;
    2305                 :          0 :         pull_len = sizeof(*ev);
    2306                 :            : 
    2307         [ #  # ]:          0 :         if (skb->len < pull_len)
    2308                 :            :                 return -EPROTO;
    2309                 :            : 
    2310                 :          0 :         skb_pull(skb, pull_len);
    2311                 :          0 :         arg->channel = ev_hdr->channel;
    2312                 :          0 :         arg->buf_len = ev_hdr->buf_len;
    2313                 :          0 :         arg->status = ev_hdr->status;
    2314                 :          0 :         arg->snr = ev_hdr->snr;
    2315                 :          0 :         arg->phy_mode = ev_hdr->phy_mode;
    2316                 :          0 :         arg->rate = ev_hdr->rate;
    2317                 :            : 
    2318                 :          0 :         msdu_len = __le32_to_cpu(arg->buf_len);
    2319         [ #  # ]:          0 :         if (skb->len < msdu_len)
    2320                 :            :                 return -EPROTO;
    2321                 :            : 
    2322         [ #  # ]:          0 :         if (le32_to_cpu(arg->status) & WMI_RX_STATUS_EXT_INFO) {
    2323                 :          0 :                 len = ALIGN(le32_to_cpu(arg->buf_len), 4);
    2324                 :          0 :                 ext_info = (struct wmi_mgmt_rx_ext_info *)(skb->data + len);
    2325                 :          0 :                 memcpy(&arg->ext_info, ext_info,
    2326                 :            :                        sizeof(struct wmi_mgmt_rx_ext_info));
    2327                 :            :         }
    2328                 :            : 
    2329                 :            :         /* Make sure bytes added for padding are removed. */
    2330                 :          0 :         skb_trim(skb, msdu_len);
    2331                 :            : 
    2332                 :          0 :         return 0;
    2333                 :            : }
    2334                 :            : 
    2335                 :          0 : static bool ath10k_wmi_rx_is_decrypted(struct ath10k *ar,
    2336                 :            :                                        struct ieee80211_hdr *hdr)
    2337                 :            : {
    2338                 :          0 :         if (!ieee80211_has_protected(hdr->frame_control))
    2339                 :            :                 return false;
    2340                 :            : 
    2341                 :            :         /* FW delivers WEP Shared Auth frame with Protected Bit set and
    2342                 :            :          * encrypted payload. However in case of PMF it delivers decrypted
    2343                 :            :          * frames with Protected Bit set.
    2344                 :            :          */
    2345         [ #  # ]:          0 :         if (ieee80211_is_auth(hdr->frame_control))
    2346                 :            :                 return false;
    2347                 :            : 
    2348                 :            :         /* qca99x0 based FW delivers broadcast or multicast management frames
    2349                 :            :          * (ex: group privacy action frames in mesh) as encrypted payload.
    2350                 :            :          */
    2351   [ #  #  #  # ]:          0 :         if (is_multicast_ether_addr(ieee80211_get_DA(hdr)) &&
    2352         [ #  # ]:          0 :             ar->hw_params.sw_decrypt_mcast_mgmt)
    2353                 :            :                 return false;
    2354                 :            : 
    2355                 :            :         return true;
    2356                 :            : }
    2357                 :            : 
    2358                 :            : static int
    2359                 :          0 : wmi_process_mgmt_tx_comp(struct ath10k *ar, struct mgmt_tx_compl_params *param)
    2360                 :            : {
    2361                 :          0 :         struct ath10k_mgmt_tx_pkt_addr *pkt_addr;
    2362                 :          0 :         struct ath10k_wmi *wmi = &ar->wmi;
    2363                 :          0 :         struct ieee80211_tx_info *info;
    2364                 :          0 :         struct sk_buff *msdu;
    2365                 :          0 :         int ret;
    2366                 :            : 
    2367                 :          0 :         spin_lock_bh(&ar->data_lock);
    2368                 :            : 
    2369                 :          0 :         pkt_addr = idr_find(&wmi->mgmt_pending_tx, param->desc_id);
    2370         [ #  # ]:          0 :         if (!pkt_addr) {
    2371                 :          0 :                 ath10k_warn(ar, "received mgmt tx completion for invalid msdu_id: %d\n",
    2372                 :            :                             param->desc_id);
    2373                 :          0 :                 ret = -ENOENT;
    2374                 :          0 :                 goto out;
    2375                 :            :         }
    2376                 :            : 
    2377                 :          0 :         msdu = pkt_addr->vaddr;
    2378                 :          0 :         dma_unmap_single(ar->dev, pkt_addr->paddr,
    2379                 :            :                          msdu->len, DMA_TO_DEVICE);
    2380         [ #  # ]:          0 :         info = IEEE80211_SKB_CB(msdu);
    2381                 :            : 
    2382         [ #  # ]:          0 :         if (param->status) {
    2383                 :          0 :                 info->flags &= ~IEEE80211_TX_STAT_ACK;
    2384                 :            :         } else {
    2385                 :          0 :                 info->flags |= IEEE80211_TX_STAT_ACK;
    2386                 :          0 :                 info->status.ack_signal = ATH10K_DEFAULT_NOISE_FLOOR +
    2387                 :          0 :                                           param->ack_rssi;
    2388                 :          0 :                 info->status.is_valid_ack_signal = true;
    2389                 :            :         }
    2390                 :            : 
    2391                 :          0 :         ieee80211_tx_status_irqsafe(ar->hw, msdu);
    2392                 :            : 
    2393                 :          0 :         ret = 0;
    2394                 :            : 
    2395                 :          0 : out:
    2396                 :          0 :         idr_remove(&wmi->mgmt_pending_tx, param->desc_id);
    2397                 :          0 :         spin_unlock_bh(&ar->data_lock);
    2398                 :          0 :         return ret;
    2399                 :            : }
    2400                 :            : 
    2401                 :          0 : int ath10k_wmi_event_mgmt_tx_compl(struct ath10k *ar, struct sk_buff *skb)
    2402                 :            : {
    2403                 :          0 :         struct wmi_tlv_mgmt_tx_compl_ev_arg arg;
    2404                 :          0 :         struct mgmt_tx_compl_params param;
    2405                 :          0 :         int ret;
    2406                 :            : 
    2407         [ #  # ]:          0 :         ret = ath10k_wmi_pull_mgmt_tx_compl(ar, skb, &arg);
    2408         [ #  # ]:          0 :         if (ret) {
    2409                 :          0 :                 ath10k_warn(ar, "failed to parse mgmt comp event: %d\n", ret);
    2410                 :          0 :                 return ret;
    2411                 :            :         }
    2412                 :            : 
    2413                 :          0 :         memset(&param, 0, sizeof(struct mgmt_tx_compl_params));
    2414                 :          0 :         param.desc_id = __le32_to_cpu(arg.desc_id);
    2415                 :          0 :         param.status = __le32_to_cpu(arg.status);
    2416                 :            : 
    2417         [ #  # ]:          0 :         if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI, ar->wmi.svc_map))
    2418                 :          0 :                 param.ack_rssi = __le32_to_cpu(arg.ack_rssi);
    2419                 :            : 
    2420                 :          0 :         wmi_process_mgmt_tx_comp(ar, &param);
    2421                 :            : 
    2422         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv evnt mgmt tx completion\n");
    2423                 :            : 
    2424                 :            :         return 0;
    2425                 :            : }
    2426                 :            : 
    2427                 :          0 : int ath10k_wmi_event_mgmt_tx_bundle_compl(struct ath10k *ar, struct sk_buff *skb)
    2428                 :            : {
    2429                 :          0 :         struct wmi_tlv_mgmt_tx_bundle_compl_ev_arg arg;
    2430                 :          0 :         struct mgmt_tx_compl_params param;
    2431                 :          0 :         u32 num_reports;
    2432                 :          0 :         int i, ret;
    2433                 :            : 
    2434         [ #  # ]:          0 :         ret = ath10k_wmi_pull_mgmt_tx_bundle_compl(ar, skb, &arg);
    2435         [ #  # ]:          0 :         if (ret) {
    2436                 :          0 :                 ath10k_warn(ar, "failed to parse bundle mgmt compl event: %d\n", ret);
    2437                 :          0 :                 return ret;
    2438                 :            :         }
    2439                 :            : 
    2440                 :          0 :         num_reports = __le32_to_cpu(arg.num_reports);
    2441                 :            : 
    2442         [ #  # ]:          0 :         for (i = 0; i < num_reports; i++) {
    2443                 :          0 :                 memset(&param, 0, sizeof(struct mgmt_tx_compl_params));
    2444                 :          0 :                 param.desc_id = __le32_to_cpu(arg.desc_ids[i]);
    2445                 :          0 :                 param.status = __le32_to_cpu(arg.desc_ids[i]);
    2446                 :            : 
    2447         [ #  # ]:          0 :                 if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI, ar->wmi.svc_map))
    2448                 :          0 :                         param.ack_rssi = __le32_to_cpu(arg.ack_rssi[i]);
    2449                 :          0 :                 wmi_process_mgmt_tx_comp(ar, &param);
    2450                 :            :         }
    2451                 :            : 
    2452         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv event bundle mgmt tx completion\n");
    2453                 :            : 
    2454                 :            :         return 0;
    2455                 :            : }
    2456                 :            : 
    2457                 :          0 : int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
    2458                 :            : {
    2459                 :          0 :         struct wmi_mgmt_rx_ev_arg arg = {};
    2460         [ #  # ]:          0 :         struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
    2461                 :          0 :         struct ieee80211_hdr *hdr;
    2462                 :          0 :         struct ieee80211_supported_band *sband;
    2463                 :          0 :         u32 rx_status;
    2464                 :          0 :         u32 channel;
    2465                 :          0 :         u32 phy_mode;
    2466                 :          0 :         u32 snr, rssi;
    2467                 :          0 :         u32 rate;
    2468                 :          0 :         u16 fc;
    2469                 :          0 :         int ret, i;
    2470                 :            : 
    2471         [ #  # ]:          0 :         ret = ath10k_wmi_pull_mgmt_rx(ar, skb, &arg);
    2472         [ #  # ]:          0 :         if (ret) {
    2473                 :          0 :                 ath10k_warn(ar, "failed to parse mgmt rx event: %d\n", ret);
    2474                 :          0 :                 dev_kfree_skb(skb);
    2475                 :          0 :                 return ret;
    2476                 :            :         }
    2477                 :            : 
    2478                 :          0 :         channel = __le32_to_cpu(arg.channel);
    2479                 :          0 :         rx_status = __le32_to_cpu(arg.status);
    2480                 :          0 :         snr = __le32_to_cpu(arg.snr);
    2481                 :          0 :         phy_mode = __le32_to_cpu(arg.phy_mode);
    2482                 :          0 :         rate = __le32_to_cpu(arg.rate);
    2483                 :            : 
    2484                 :          0 :         memset(status, 0, sizeof(*status));
    2485                 :            : 
    2486         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_MGMT,
    2487                 :            :                    "event mgmt rx status %08x\n", rx_status);
    2488                 :            : 
    2489         [ #  # ]:          0 :         if ((test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags)) ||
    2490         [ #  # ]:          0 :             (rx_status & (WMI_RX_STATUS_ERR_DECRYPT |
    2491                 :            :             WMI_RX_STATUS_ERR_KEY_CACHE_MISS | WMI_RX_STATUS_ERR_CRC))) {
    2492                 :          0 :                 dev_kfree_skb(skb);
    2493                 :          0 :                 return 0;
    2494                 :            :         }
    2495                 :            : 
    2496         [ #  # ]:          0 :         if (rx_status & WMI_RX_STATUS_ERR_MIC)
    2497                 :          0 :                 status->flag |= RX_FLAG_MMIC_ERROR;
    2498                 :            : 
    2499         [ #  # ]:          0 :         if (rx_status & WMI_RX_STATUS_EXT_INFO) {
    2500                 :          0 :                 status->mactime =
    2501                 :          0 :                         __le64_to_cpu(arg.ext_info.rx_mac_timestamp);
    2502                 :          0 :                 status->flag |= RX_FLAG_MACTIME_END;
    2503                 :            :         }
    2504                 :            :         /* Hardware can Rx CCK rates on 5GHz. In that case phy_mode is set to
    2505                 :            :          * MODE_11B. This means phy_mode is not a reliable source for the band
    2506                 :            :          * of mgmt rx.
    2507                 :            :          */
    2508         [ #  # ]:          0 :         if (channel >= 1 && channel <= 14) {
    2509                 :          0 :                 status->band = NL80211_BAND_2GHZ;
    2510         [ #  # ]:          0 :         } else if (channel >= 36 && channel <= ATH10K_MAX_5G_CHAN) {
    2511                 :          0 :                 status->band = NL80211_BAND_5GHZ;
    2512                 :            :         } else {
    2513                 :            :                 /* Shouldn't happen unless list of advertised channels to
    2514                 :            :                  * mac80211 has been changed.
    2515                 :            :                  */
    2516                 :          0 :                 WARN_ON_ONCE(1);
    2517                 :          0 :                 dev_kfree_skb(skb);
    2518                 :          0 :                 return 0;
    2519                 :            :         }
    2520                 :            : 
    2521   [ #  #  #  # ]:          0 :         if (phy_mode == MODE_11B && status->band == NL80211_BAND_5GHZ)
    2522         [ #  # ]:          0 :                 ath10k_dbg(ar, ATH10K_DBG_MGMT, "wmi mgmt rx 11b (CCK) on 5GHz\n");
    2523                 :            : 
    2524                 :          0 :         sband = &ar->mac.sbands[status->band];
    2525                 :            : 
    2526                 :          0 :         status->freq = ieee80211_channel_to_frequency(channel, status->band);
    2527                 :          0 :         status->signal = snr + ATH10K_DEFAULT_NOISE_FLOOR;
    2528                 :            : 
    2529                 :          0 :         BUILD_BUG_ON(ARRAY_SIZE(status->chain_signal) != ARRAY_SIZE(arg.rssi));
    2530                 :            : 
    2531         [ #  # ]:          0 :         for (i = 0; i < ARRAY_SIZE(status->chain_signal); i++) {
    2532                 :          0 :                 status->chains &= ~BIT(i);
    2533                 :          0 :                 rssi = __le32_to_cpu(arg.rssi[i]);
    2534         [ #  # ]:          0 :                 ath10k_dbg(ar, ATH10K_DBG_MGMT, "mgmt rssi[%d]:%d\n", i, arg.rssi[i]);
    2535                 :            : 
    2536   [ #  #  #  # ]:          0 :                 if (rssi != ATH10K_INVALID_RSSI && rssi != 0) {
    2537                 :          0 :                         status->chain_signal[i] = ATH10K_DEFAULT_NOISE_FLOOR + rssi;
    2538                 :          0 :                         status->chains |= BIT(i);
    2539                 :            :                 }
    2540                 :            :         }
    2541                 :            : 
    2542                 :          0 :         status->rate_idx = ath10k_mac_bitrate_to_idx(sband, rate / 100);
    2543                 :            : 
    2544                 :          0 :         hdr = (struct ieee80211_hdr *)skb->data;
    2545                 :          0 :         fc = le16_to_cpu(hdr->frame_control);
    2546                 :            : 
    2547                 :            :         /* Firmware is guaranteed to report all essential management frames via
    2548                 :            :          * WMI while it can deliver some extra via HTT. Since there can be
    2549                 :            :          * duplicates split the reporting wrt monitor/sniffing.
    2550                 :            :          */
    2551                 :          0 :         status->flag |= RX_FLAG_SKIP_MONITOR;
    2552                 :            : 
    2553                 :          0 :         ath10k_wmi_handle_wep_reauth(ar, skb, status);
    2554                 :            : 
    2555         [ #  # ]:          0 :         if (ath10k_wmi_rx_is_decrypted(ar, hdr)) {
    2556                 :          0 :                 status->flag |= RX_FLAG_DECRYPTED;
    2557                 :            : 
    2558   [ #  #  #  # ]:          0 :                 if (!ieee80211_is_action(hdr->frame_control) &&
    2559         [ #  # ]:          0 :                     !ieee80211_is_deauth(hdr->frame_control) &&
    2560                 :            :                     !ieee80211_is_disassoc(hdr->frame_control)) {
    2561                 :          0 :                         status->flag |= RX_FLAG_IV_STRIPPED |
    2562                 :            :                                         RX_FLAG_MMIC_STRIPPED;
    2563                 :          0 :                         hdr->frame_control = __cpu_to_le16(fc &
    2564                 :            :                                         ~IEEE80211_FCTL_PROTECTED);
    2565                 :            :                 }
    2566                 :            :         }
    2567                 :            : 
    2568         [ #  # ]:          0 :         if (ieee80211_is_beacon(hdr->frame_control))
    2569                 :          0 :                 ath10k_mac_handle_beacon(ar, skb);
    2570                 :            : 
    2571         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_MGMT,
    2572                 :            :                    "event mgmt rx skb %pK len %d ftype %02x stype %02x\n",
    2573                 :            :                    skb, skb->len,
    2574                 :            :                    fc & IEEE80211_FCTL_FTYPE, fc & IEEE80211_FCTL_STYPE);
    2575                 :            : 
    2576         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_MGMT,
    2577                 :            :                    "event mgmt rx freq %d band %d snr %d, rate_idx %d\n",
    2578                 :            :                    status->freq, status->band, status->signal,
    2579                 :            :                    status->rate_idx);
    2580                 :            : 
    2581                 :          0 :         ieee80211_rx_ni(ar->hw, skb);
    2582                 :            : 
    2583                 :          0 :         return 0;
    2584                 :            : }
    2585                 :            : 
    2586                 :            : static int freq_to_idx(struct ath10k *ar, int freq)
    2587                 :            : {
    2588                 :            :         struct ieee80211_supported_band *sband;
    2589                 :            :         int band, ch, idx = 0;
    2590                 :            : 
    2591                 :            :         for (band = NL80211_BAND_2GHZ; band < NUM_NL80211_BANDS; band++) {
    2592                 :            :                 sband = ar->hw->wiphy->bands[band];
    2593                 :            :                 if (!sband)
    2594                 :            :                         continue;
    2595                 :            : 
    2596                 :            :                 for (ch = 0; ch < sband->n_channels; ch++, idx++)
    2597                 :            :                         if (sband->channels[ch].center_freq == freq)
    2598                 :            :                                 goto exit;
    2599                 :            :         }
    2600                 :            : 
    2601                 :            : exit:
    2602                 :            :         return idx;
    2603                 :            : }
    2604                 :            : 
    2605                 :          0 : static int ath10k_wmi_op_pull_ch_info_ev(struct ath10k *ar, struct sk_buff *skb,
    2606                 :            :                                          struct wmi_ch_info_ev_arg *arg)
    2607                 :            : {
    2608                 :          0 :         struct wmi_chan_info_event *ev = (void *)skb->data;
    2609                 :            : 
    2610         [ #  # ]:          0 :         if (skb->len < sizeof(*ev))
    2611                 :            :                 return -EPROTO;
    2612                 :            : 
    2613                 :          0 :         skb_pull(skb, sizeof(*ev));
    2614                 :          0 :         arg->err_code = ev->err_code;
    2615                 :          0 :         arg->freq = ev->freq;
    2616                 :          0 :         arg->cmd_flags = ev->cmd_flags;
    2617                 :          0 :         arg->noise_floor = ev->noise_floor;
    2618                 :          0 :         arg->rx_clear_count = ev->rx_clear_count;
    2619                 :          0 :         arg->cycle_count = ev->cycle_count;
    2620                 :            : 
    2621                 :          0 :         return 0;
    2622                 :            : }
    2623                 :            : 
    2624                 :          0 : static int ath10k_wmi_10_4_op_pull_ch_info_ev(struct ath10k *ar,
    2625                 :            :                                               struct sk_buff *skb,
    2626                 :            :                                               struct wmi_ch_info_ev_arg *arg)
    2627                 :            : {
    2628                 :          0 :         struct wmi_10_4_chan_info_event *ev = (void *)skb->data;
    2629                 :            : 
    2630         [ #  # ]:          0 :         if (skb->len < sizeof(*ev))
    2631                 :            :                 return -EPROTO;
    2632                 :            : 
    2633                 :          0 :         skb_pull(skb, sizeof(*ev));
    2634                 :          0 :         arg->err_code = ev->err_code;
    2635                 :          0 :         arg->freq = ev->freq;
    2636                 :          0 :         arg->cmd_flags = ev->cmd_flags;
    2637                 :          0 :         arg->noise_floor = ev->noise_floor;
    2638                 :          0 :         arg->rx_clear_count = ev->rx_clear_count;
    2639                 :          0 :         arg->cycle_count = ev->cycle_count;
    2640                 :          0 :         arg->chan_tx_pwr_range = ev->chan_tx_pwr_range;
    2641                 :          0 :         arg->chan_tx_pwr_tp = ev->chan_tx_pwr_tp;
    2642                 :          0 :         arg->rx_frame_count = ev->rx_frame_count;
    2643                 :            : 
    2644                 :          0 :         return 0;
    2645                 :            : }
    2646                 :            : 
    2647                 :            : /*
    2648                 :            :  * Handle the channel info event for firmware which only sends one
    2649                 :            :  * chan_info event per scanned channel.
    2650                 :            :  */
    2651                 :          0 : static void ath10k_wmi_event_chan_info_unpaired(struct ath10k *ar,
    2652                 :            :                                                 struct chan_info_params *params)
    2653                 :            : {
    2654                 :          0 :         struct survey_info *survey;
    2655                 :          0 :         int idx;
    2656                 :            : 
    2657         [ #  # ]:          0 :         if (params->cmd_flags & WMI_CHAN_INFO_FLAG_COMPLETE) {
    2658         [ #  # ]:          0 :                 ath10k_dbg(ar, ATH10K_DBG_WMI, "chan info report completed\n");
    2659                 :          0 :                 return;
    2660                 :            :         }
    2661                 :            : 
    2662                 :          0 :         idx = freq_to_idx(ar, params->freq);
    2663         [ #  # ]:          0 :         if (idx >= ARRAY_SIZE(ar->survey)) {
    2664                 :          0 :                 ath10k_warn(ar, "chan info: invalid frequency %d (idx %d out of bounds)\n",
    2665                 :            :                             params->freq, idx);
    2666                 :          0 :                 return;
    2667                 :            :         }
    2668                 :            : 
    2669                 :          0 :         survey = &ar->survey[idx];
    2670                 :            : 
    2671         [ #  # ]:          0 :         if (!params->mac_clk_mhz)
    2672                 :            :                 return;
    2673                 :            : 
    2674                 :          0 :         memset(survey, 0, sizeof(*survey));
    2675                 :            : 
    2676                 :          0 :         survey->noise = params->noise_floor;
    2677                 :          0 :         survey->time = (params->cycle_count / params->mac_clk_mhz) / 1000;
    2678                 :          0 :         survey->time_busy = (params->rx_clear_count / params->mac_clk_mhz) / 1000;
    2679                 :          0 :         survey->filled |= SURVEY_INFO_NOISE_DBM | SURVEY_INFO_TIME |
    2680                 :            :                           SURVEY_INFO_TIME_BUSY;
    2681                 :            : }
    2682                 :            : 
    2683                 :            : /*
    2684                 :            :  * Handle the channel info event for firmware which sends chan_info
    2685                 :            :  * event in pairs(start and stop events) for every scanned channel.
    2686                 :            :  */
    2687                 :          0 : static void ath10k_wmi_event_chan_info_paired(struct ath10k *ar,
    2688                 :            :                                               struct chan_info_params *params)
    2689                 :            : {
    2690                 :          0 :         struct survey_info *survey;
    2691                 :          0 :         int idx;
    2692                 :            : 
    2693                 :          0 :         idx = freq_to_idx(ar, params->freq);
    2694         [ #  # ]:          0 :         if (idx >= ARRAY_SIZE(ar->survey)) {
    2695                 :          0 :                 ath10k_warn(ar, "chan info: invalid frequency %d (idx %d out of bounds)\n",
    2696                 :            :                             params->freq, idx);
    2697                 :          0 :                 return;
    2698                 :            :         }
    2699                 :            : 
    2700         [ #  # ]:          0 :         if (params->cmd_flags & WMI_CHAN_INFO_FLAG_COMPLETE) {
    2701         [ #  # ]:          0 :                 if (ar->ch_info_can_report_survey) {
    2702                 :          0 :                         survey = &ar->survey[idx];
    2703                 :          0 :                         survey->noise = params->noise_floor;
    2704                 :          0 :                         survey->filled = SURVEY_INFO_NOISE_DBM;
    2705                 :            : 
    2706                 :          0 :                         ath10k_hw_fill_survey_time(ar,
    2707                 :            :                                                    survey,
    2708                 :            :                                                    params->cycle_count,
    2709                 :            :                                                    params->rx_clear_count,
    2710                 :            :                                                    ar->survey_last_cycle_count,
    2711                 :            :                                                    ar->survey_last_rx_clear_count);
    2712                 :            :                 }
    2713                 :            : 
    2714                 :          0 :                 ar->ch_info_can_report_survey = false;
    2715                 :            :         } else {
    2716                 :          0 :                 ar->ch_info_can_report_survey = true;
    2717                 :            :         }
    2718                 :            : 
    2719         [ #  # ]:          0 :         if (!(params->cmd_flags & WMI_CHAN_INFO_FLAG_PRE_COMPLETE)) {
    2720                 :          0 :                 ar->survey_last_rx_clear_count = params->rx_clear_count;
    2721                 :          0 :                 ar->survey_last_cycle_count = params->cycle_count;
    2722                 :            :         }
    2723                 :            : }
    2724                 :            : 
    2725                 :          0 : void ath10k_wmi_event_chan_info(struct ath10k *ar, struct sk_buff *skb)
    2726                 :            : {
    2727                 :          0 :         struct chan_info_params ch_info_param;
    2728                 :          0 :         struct wmi_ch_info_ev_arg arg = {};
    2729                 :          0 :         int ret;
    2730                 :            : 
    2731         [ #  # ]:          0 :         ret = ath10k_wmi_pull_ch_info(ar, skb, &arg);
    2732         [ #  # ]:          0 :         if (ret) {
    2733                 :          0 :                 ath10k_warn(ar, "failed to parse chan info event: %d\n", ret);
    2734                 :          0 :                 return;
    2735                 :            :         }
    2736                 :            : 
    2737                 :          0 :         ch_info_param.err_code = __le32_to_cpu(arg.err_code);
    2738                 :          0 :         ch_info_param.freq = __le32_to_cpu(arg.freq);
    2739                 :          0 :         ch_info_param.cmd_flags = __le32_to_cpu(arg.cmd_flags);
    2740                 :          0 :         ch_info_param.noise_floor = __le32_to_cpu(arg.noise_floor);
    2741                 :          0 :         ch_info_param.rx_clear_count = __le32_to_cpu(arg.rx_clear_count);
    2742                 :          0 :         ch_info_param.cycle_count = __le32_to_cpu(arg.cycle_count);
    2743                 :          0 :         ch_info_param.mac_clk_mhz = __le32_to_cpu(arg.mac_clk_mhz);
    2744                 :            : 
    2745         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    2746                 :            :                    "chan info err_code %d freq %d cmd_flags %d noise_floor %d rx_clear_count %d cycle_count %d\n",
    2747                 :            :                    ch_info_param.err_code, ch_info_param.freq, ch_info_param.cmd_flags,
    2748                 :            :                    ch_info_param.noise_floor, ch_info_param.rx_clear_count,
    2749                 :            :                    ch_info_param.cycle_count);
    2750                 :            : 
    2751                 :          0 :         spin_lock_bh(&ar->data_lock);
    2752                 :            : 
    2753         [ #  # ]:          0 :         switch (ar->scan.state) {
    2754                 :          0 :         case ATH10K_SCAN_IDLE:
    2755                 :            :         case ATH10K_SCAN_STARTING:
    2756                 :          0 :                 ath10k_warn(ar, "received chan info event without a scan request, ignoring\n");
    2757                 :          0 :                 goto exit;
    2758                 :            :         case ATH10K_SCAN_RUNNING:
    2759                 :            :         case ATH10K_SCAN_ABORTING:
    2760                 :            :                 break;
    2761                 :            :         }
    2762                 :            : 
    2763         [ #  # ]:          0 :         if (test_bit(ATH10K_FW_FEATURE_SINGLE_CHAN_INFO_PER_CHANNEL,
    2764                 :          0 :                      ar->running_fw->fw_file.fw_features))
    2765                 :          0 :                 ath10k_wmi_event_chan_info_unpaired(ar, &ch_info_param);
    2766                 :            :         else
    2767                 :          0 :                 ath10k_wmi_event_chan_info_paired(ar, &ch_info_param);
    2768                 :            : 
    2769                 :          0 : exit:
    2770                 :          0 :         spin_unlock_bh(&ar->data_lock);
    2771                 :            : }
    2772                 :            : 
    2773                 :          0 : void ath10k_wmi_event_echo(struct ath10k *ar, struct sk_buff *skb)
    2774                 :            : {
    2775                 :          0 :         struct wmi_echo_ev_arg arg = {};
    2776                 :          0 :         int ret;
    2777                 :            : 
    2778         [ #  # ]:          0 :         ret = ath10k_wmi_pull_echo_ev(ar, skb, &arg);
    2779         [ #  # ]:          0 :         if (ret) {
    2780                 :          0 :                 ath10k_warn(ar, "failed to parse echo: %d\n", ret);
    2781                 :          0 :                 return;
    2782                 :            :         }
    2783                 :            : 
    2784         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    2785                 :            :                    "wmi event echo value 0x%08x\n",
    2786                 :            :                    le32_to_cpu(arg.value));
    2787                 :            : 
    2788         [ #  # ]:          0 :         if (le32_to_cpu(arg.value) == ATH10K_WMI_BARRIER_ECHO_ID)
    2789                 :          0 :                 complete(&ar->wmi.barrier);
    2790                 :            : }
    2791                 :            : 
    2792                 :          0 : int ath10k_wmi_event_debug_mesg(struct ath10k *ar, struct sk_buff *skb)
    2793                 :            : {
    2794         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi event debug mesg len %d\n",
    2795                 :            :                    skb->len);
    2796                 :            : 
    2797                 :          0 :         trace_ath10k_wmi_dbglog(ar, skb->data, skb->len);
    2798                 :            : 
    2799                 :          0 :         return 0;
    2800                 :            : }
    2801                 :            : 
    2802                 :          0 : void ath10k_wmi_pull_pdev_stats_base(const struct wmi_pdev_stats_base *src,
    2803                 :            :                                      struct ath10k_fw_stats_pdev *dst)
    2804                 :            : {
    2805                 :          0 :         dst->ch_noise_floor = __le32_to_cpu(src->chan_nf);
    2806                 :          0 :         dst->tx_frame_count = __le32_to_cpu(src->tx_frame_count);
    2807                 :          0 :         dst->rx_frame_count = __le32_to_cpu(src->rx_frame_count);
    2808                 :          0 :         dst->rx_clear_count = __le32_to_cpu(src->rx_clear_count);
    2809                 :          0 :         dst->cycle_count = __le32_to_cpu(src->cycle_count);
    2810                 :          0 :         dst->phy_err_count = __le32_to_cpu(src->phy_err_count);
    2811                 :          0 :         dst->chan_tx_power = __le32_to_cpu(src->chan_tx_pwr);
    2812                 :          0 : }
    2813                 :            : 
    2814                 :          0 : void ath10k_wmi_pull_pdev_stats_tx(const struct wmi_pdev_stats_tx *src,
    2815                 :            :                                    struct ath10k_fw_stats_pdev *dst)
    2816                 :            : {
    2817                 :          0 :         dst->comp_queued = __le32_to_cpu(src->comp_queued);
    2818                 :          0 :         dst->comp_delivered = __le32_to_cpu(src->comp_delivered);
    2819                 :          0 :         dst->msdu_enqued = __le32_to_cpu(src->msdu_enqued);
    2820                 :          0 :         dst->mpdu_enqued = __le32_to_cpu(src->mpdu_enqued);
    2821                 :          0 :         dst->wmm_drop = __le32_to_cpu(src->wmm_drop);
    2822                 :          0 :         dst->local_enqued = __le32_to_cpu(src->local_enqued);
    2823                 :          0 :         dst->local_freed = __le32_to_cpu(src->local_freed);
    2824                 :          0 :         dst->hw_queued = __le32_to_cpu(src->hw_queued);
    2825                 :          0 :         dst->hw_reaped = __le32_to_cpu(src->hw_reaped);
    2826                 :          0 :         dst->underrun = __le32_to_cpu(src->underrun);
    2827                 :          0 :         dst->tx_abort = __le32_to_cpu(src->tx_abort);
    2828                 :          0 :         dst->mpdus_requed = __le32_to_cpu(src->mpdus_requed);
    2829                 :          0 :         dst->tx_ko = __le32_to_cpu(src->tx_ko);
    2830                 :          0 :         dst->data_rc = __le32_to_cpu(src->data_rc);
    2831                 :          0 :         dst->self_triggers = __le32_to_cpu(src->self_triggers);
    2832                 :          0 :         dst->sw_retry_failure = __le32_to_cpu(src->sw_retry_failure);
    2833                 :          0 :         dst->illgl_rate_phy_err = __le32_to_cpu(src->illgl_rate_phy_err);
    2834                 :          0 :         dst->pdev_cont_xretry = __le32_to_cpu(src->pdev_cont_xretry);
    2835                 :          0 :         dst->pdev_tx_timeout = __le32_to_cpu(src->pdev_tx_timeout);
    2836                 :          0 :         dst->pdev_resets = __le32_to_cpu(src->pdev_resets);
    2837                 :          0 :         dst->phy_underrun = __le32_to_cpu(src->phy_underrun);
    2838                 :          0 :         dst->txop_ovf = __le32_to_cpu(src->txop_ovf);
    2839                 :          0 : }
    2840                 :            : 
    2841                 :            : static void
    2842                 :          0 : ath10k_wmi_10_4_pull_pdev_stats_tx(const struct wmi_10_4_pdev_stats_tx *src,
    2843                 :            :                                    struct ath10k_fw_stats_pdev *dst)
    2844                 :            : {
    2845                 :          0 :         dst->comp_queued = __le32_to_cpu(src->comp_queued);
    2846                 :          0 :         dst->comp_delivered = __le32_to_cpu(src->comp_delivered);
    2847                 :          0 :         dst->msdu_enqued = __le32_to_cpu(src->msdu_enqued);
    2848                 :          0 :         dst->mpdu_enqued = __le32_to_cpu(src->mpdu_enqued);
    2849                 :          0 :         dst->wmm_drop = __le32_to_cpu(src->wmm_drop);
    2850                 :          0 :         dst->local_enqued = __le32_to_cpu(src->local_enqued);
    2851                 :          0 :         dst->local_freed = __le32_to_cpu(src->local_freed);
    2852                 :          0 :         dst->hw_queued = __le32_to_cpu(src->hw_queued);
    2853                 :          0 :         dst->hw_reaped = __le32_to_cpu(src->hw_reaped);
    2854                 :          0 :         dst->underrun = __le32_to_cpu(src->underrun);
    2855                 :          0 :         dst->tx_abort = __le32_to_cpu(src->tx_abort);
    2856                 :          0 :         dst->mpdus_requed = __le32_to_cpu(src->mpdus_requed);
    2857                 :          0 :         dst->tx_ko = __le32_to_cpu(src->tx_ko);
    2858                 :          0 :         dst->data_rc = __le32_to_cpu(src->data_rc);
    2859                 :          0 :         dst->self_triggers = __le32_to_cpu(src->self_triggers);
    2860                 :          0 :         dst->sw_retry_failure = __le32_to_cpu(src->sw_retry_failure);
    2861                 :          0 :         dst->illgl_rate_phy_err = __le32_to_cpu(src->illgl_rate_phy_err);
    2862                 :          0 :         dst->pdev_cont_xretry = __le32_to_cpu(src->pdev_cont_xretry);
    2863                 :          0 :         dst->pdev_tx_timeout = __le32_to_cpu(src->pdev_tx_timeout);
    2864                 :          0 :         dst->pdev_resets = __le32_to_cpu(src->pdev_resets);
    2865                 :          0 :         dst->phy_underrun = __le32_to_cpu(src->phy_underrun);
    2866                 :          0 :         dst->txop_ovf = __le32_to_cpu(src->txop_ovf);
    2867                 :          0 :         dst->hw_paused = __le32_to_cpu(src->hw_paused);
    2868                 :          0 :         dst->seq_posted = __le32_to_cpu(src->seq_posted);
    2869                 :          0 :         dst->seq_failed_queueing =
    2870                 :          0 :                 __le32_to_cpu(src->seq_failed_queueing);
    2871                 :          0 :         dst->seq_completed = __le32_to_cpu(src->seq_completed);
    2872                 :          0 :         dst->seq_restarted = __le32_to_cpu(src->seq_restarted);
    2873                 :          0 :         dst->mu_seq_posted = __le32_to_cpu(src->mu_seq_posted);
    2874                 :          0 :         dst->mpdus_sw_flush = __le32_to_cpu(src->mpdus_sw_flush);
    2875                 :          0 :         dst->mpdus_hw_filter = __le32_to_cpu(src->mpdus_hw_filter);
    2876                 :          0 :         dst->mpdus_truncated = __le32_to_cpu(src->mpdus_truncated);
    2877                 :          0 :         dst->mpdus_ack_failed = __le32_to_cpu(src->mpdus_ack_failed);
    2878                 :          0 :         dst->mpdus_hw_filter = __le32_to_cpu(src->mpdus_hw_filter);
    2879                 :          0 :         dst->mpdus_expired = __le32_to_cpu(src->mpdus_expired);
    2880                 :          0 : }
    2881                 :            : 
    2882                 :          0 : void ath10k_wmi_pull_pdev_stats_rx(const struct wmi_pdev_stats_rx *src,
    2883                 :            :                                    struct ath10k_fw_stats_pdev *dst)
    2884                 :            : {
    2885                 :          0 :         dst->mid_ppdu_route_change = __le32_to_cpu(src->mid_ppdu_route_change);
    2886                 :          0 :         dst->status_rcvd = __le32_to_cpu(src->status_rcvd);
    2887                 :          0 :         dst->r0_frags = __le32_to_cpu(src->r0_frags);
    2888                 :          0 :         dst->r1_frags = __le32_to_cpu(src->r1_frags);
    2889                 :          0 :         dst->r2_frags = __le32_to_cpu(src->r2_frags);
    2890                 :          0 :         dst->r3_frags = __le32_to_cpu(src->r3_frags);
    2891                 :          0 :         dst->htt_msdus = __le32_to_cpu(src->htt_msdus);
    2892                 :          0 :         dst->htt_mpdus = __le32_to_cpu(src->htt_mpdus);
    2893                 :          0 :         dst->loc_msdus = __le32_to_cpu(src->loc_msdus);
    2894                 :          0 :         dst->loc_mpdus = __le32_to_cpu(src->loc_mpdus);
    2895                 :          0 :         dst->oversize_amsdu = __le32_to_cpu(src->oversize_amsdu);
    2896                 :          0 :         dst->phy_errs = __le32_to_cpu(src->phy_errs);
    2897                 :          0 :         dst->phy_err_drop = __le32_to_cpu(src->phy_err_drop);
    2898                 :          0 :         dst->mpdu_errs = __le32_to_cpu(src->mpdu_errs);
    2899                 :          0 : }
    2900                 :            : 
    2901                 :          0 : void ath10k_wmi_pull_pdev_stats_extra(const struct wmi_pdev_stats_extra *src,
    2902                 :            :                                       struct ath10k_fw_stats_pdev *dst)
    2903                 :            : {
    2904                 :          0 :         dst->ack_rx_bad = __le32_to_cpu(src->ack_rx_bad);
    2905                 :          0 :         dst->rts_bad = __le32_to_cpu(src->rts_bad);
    2906                 :          0 :         dst->rts_good = __le32_to_cpu(src->rts_good);
    2907                 :          0 :         dst->fcs_bad = __le32_to_cpu(src->fcs_bad);
    2908                 :          0 :         dst->no_beacons = __le32_to_cpu(src->no_beacons);
    2909                 :          0 :         dst->mib_int_count = __le32_to_cpu(src->mib_int_count);
    2910                 :          0 : }
    2911                 :            : 
    2912                 :          0 : void ath10k_wmi_pull_peer_stats(const struct wmi_peer_stats *src,
    2913                 :            :                                 struct ath10k_fw_stats_peer *dst)
    2914                 :            : {
    2915                 :          0 :         ether_addr_copy(dst->peer_macaddr, src->peer_macaddr.addr);
    2916                 :          0 :         dst->peer_rssi = __le32_to_cpu(src->peer_rssi);
    2917                 :          0 :         dst->peer_tx_rate = __le32_to_cpu(src->peer_tx_rate);
    2918                 :          0 : }
    2919                 :            : 
    2920                 :            : static void
    2921                 :          0 : ath10k_wmi_10_4_pull_peer_stats(const struct wmi_10_4_peer_stats *src,
    2922                 :            :                                 struct ath10k_fw_stats_peer *dst)
    2923                 :            : {
    2924                 :          0 :         ether_addr_copy(dst->peer_macaddr, src->peer_macaddr.addr);
    2925                 :          0 :         dst->peer_rssi = __le32_to_cpu(src->peer_rssi);
    2926                 :          0 :         dst->peer_tx_rate = __le32_to_cpu(src->peer_tx_rate);
    2927                 :          0 :         dst->peer_rx_rate = __le32_to_cpu(src->peer_rx_rate);
    2928                 :            : }
    2929                 :            : 
    2930                 :            : static void
    2931                 :          0 : ath10k_wmi_10_4_pull_vdev_stats(const struct wmi_vdev_stats_extd *src,
    2932                 :            :                                 struct ath10k_fw_stats_vdev_extd *dst)
    2933                 :            : {
    2934                 :          0 :         dst->vdev_id = __le32_to_cpu(src->vdev_id);
    2935                 :          0 :         dst->ppdu_aggr_cnt = __le32_to_cpu(src->ppdu_aggr_cnt);
    2936                 :          0 :         dst->ppdu_noack = __le32_to_cpu(src->ppdu_noack);
    2937                 :          0 :         dst->mpdu_queued = __le32_to_cpu(src->mpdu_queued);
    2938                 :          0 :         dst->ppdu_nonaggr_cnt = __le32_to_cpu(src->ppdu_nonaggr_cnt);
    2939                 :          0 :         dst->mpdu_sw_requeued = __le32_to_cpu(src->mpdu_sw_requeued);
    2940                 :          0 :         dst->mpdu_suc_retry = __le32_to_cpu(src->mpdu_suc_retry);
    2941                 :          0 :         dst->mpdu_suc_multitry = __le32_to_cpu(src->mpdu_suc_multitry);
    2942                 :          0 :         dst->mpdu_fail_retry = __le32_to_cpu(src->mpdu_fail_retry);
    2943                 :          0 :         dst->tx_ftm_suc = __le32_to_cpu(src->tx_ftm_suc);
    2944                 :          0 :         dst->tx_ftm_suc_retry = __le32_to_cpu(src->tx_ftm_suc_retry);
    2945                 :          0 :         dst->tx_ftm_fail = __le32_to_cpu(src->tx_ftm_fail);
    2946                 :          0 :         dst->rx_ftmr_cnt = __le32_to_cpu(src->rx_ftmr_cnt);
    2947                 :          0 :         dst->rx_ftmr_dup_cnt = __le32_to_cpu(src->rx_ftmr_dup_cnt);
    2948                 :          0 :         dst->rx_iftmr_cnt = __le32_to_cpu(src->rx_iftmr_cnt);
    2949                 :          0 :         dst->rx_iftmr_dup_cnt = __le32_to_cpu(src->rx_iftmr_dup_cnt);
    2950                 :            : }
    2951                 :            : 
    2952                 :          0 : static int ath10k_wmi_main_op_pull_fw_stats(struct ath10k *ar,
    2953                 :            :                                             struct sk_buff *skb,
    2954                 :            :                                             struct ath10k_fw_stats *stats)
    2955                 :            : {
    2956                 :          0 :         const struct wmi_stats_event *ev = (void *)skb->data;
    2957                 :          0 :         u32 num_pdev_stats, num_peer_stats;
    2958                 :          0 :         int i;
    2959                 :            : 
    2960         [ #  # ]:          0 :         if (!skb_pull(skb, sizeof(*ev)))
    2961                 :            :                 return -EPROTO;
    2962                 :            : 
    2963                 :          0 :         num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats);
    2964                 :          0 :         num_peer_stats = __le32_to_cpu(ev->num_peer_stats);
    2965                 :            : 
    2966         [ #  # ]:          0 :         for (i = 0; i < num_pdev_stats; i++) {
    2967                 :          0 :                 const struct wmi_pdev_stats *src;
    2968                 :          0 :                 struct ath10k_fw_stats_pdev *dst;
    2969                 :            : 
    2970                 :          0 :                 src = (void *)skb->data;
    2971         [ #  # ]:          0 :                 if (!skb_pull(skb, sizeof(*src)))
    2972                 :            :                         return -EPROTO;
    2973                 :            : 
    2974                 :          0 :                 dst = kzalloc(sizeof(*dst), GFP_ATOMIC);
    2975         [ #  # ]:          0 :                 if (!dst)
    2976                 :          0 :                         continue;
    2977                 :            : 
    2978                 :          0 :                 ath10k_wmi_pull_pdev_stats_base(&src->base, dst);
    2979                 :          0 :                 ath10k_wmi_pull_pdev_stats_tx(&src->tx, dst);
    2980                 :          0 :                 ath10k_wmi_pull_pdev_stats_rx(&src->rx, dst);
    2981                 :            : 
    2982                 :          0 :                 list_add_tail(&dst->list, &stats->pdevs);
    2983                 :            :         }
    2984                 :            : 
    2985                 :            :         /* fw doesn't implement vdev stats */
    2986                 :            : 
    2987         [ #  # ]:          0 :         for (i = 0; i < num_peer_stats; i++) {
    2988                 :          0 :                 const struct wmi_peer_stats *src;
    2989                 :          0 :                 struct ath10k_fw_stats_peer *dst;
    2990                 :            : 
    2991                 :          0 :                 src = (void *)skb->data;
    2992         [ #  # ]:          0 :                 if (!skb_pull(skb, sizeof(*src)))
    2993                 :            :                         return -EPROTO;
    2994                 :            : 
    2995                 :          0 :                 dst = kzalloc(sizeof(*dst), GFP_ATOMIC);
    2996         [ #  # ]:          0 :                 if (!dst)
    2997                 :          0 :                         continue;
    2998                 :            : 
    2999                 :          0 :                 ath10k_wmi_pull_peer_stats(src, dst);
    3000                 :          0 :                 list_add_tail(&dst->list, &stats->peers);
    3001                 :            :         }
    3002                 :            : 
    3003                 :            :         return 0;
    3004                 :            : }
    3005                 :            : 
    3006                 :          0 : static int ath10k_wmi_10x_op_pull_fw_stats(struct ath10k *ar,
    3007                 :            :                                            struct sk_buff *skb,
    3008                 :            :                                            struct ath10k_fw_stats *stats)
    3009                 :            : {
    3010                 :          0 :         const struct wmi_stats_event *ev = (void *)skb->data;
    3011                 :          0 :         u32 num_pdev_stats, num_peer_stats;
    3012                 :          0 :         int i;
    3013                 :            : 
    3014         [ #  # ]:          0 :         if (!skb_pull(skb, sizeof(*ev)))
    3015                 :            :                 return -EPROTO;
    3016                 :            : 
    3017                 :          0 :         num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats);
    3018                 :          0 :         num_peer_stats = __le32_to_cpu(ev->num_peer_stats);
    3019                 :            : 
    3020         [ #  # ]:          0 :         for (i = 0; i < num_pdev_stats; i++) {
    3021                 :          0 :                 const struct wmi_10x_pdev_stats *src;
    3022                 :          0 :                 struct ath10k_fw_stats_pdev *dst;
    3023                 :            : 
    3024                 :          0 :                 src = (void *)skb->data;
    3025         [ #  # ]:          0 :                 if (!skb_pull(skb, sizeof(*src)))
    3026                 :            :                         return -EPROTO;
    3027                 :            : 
    3028                 :          0 :                 dst = kzalloc(sizeof(*dst), GFP_ATOMIC);
    3029         [ #  # ]:          0 :                 if (!dst)
    3030                 :          0 :                         continue;
    3031                 :            : 
    3032                 :          0 :                 ath10k_wmi_pull_pdev_stats_base(&src->base, dst);
    3033                 :          0 :                 ath10k_wmi_pull_pdev_stats_tx(&src->tx, dst);
    3034                 :          0 :                 ath10k_wmi_pull_pdev_stats_rx(&src->rx, dst);
    3035                 :          0 :                 ath10k_wmi_pull_pdev_stats_extra(&src->extra, dst);
    3036                 :            : 
    3037                 :          0 :                 list_add_tail(&dst->list, &stats->pdevs);
    3038                 :            :         }
    3039                 :            : 
    3040                 :            :         /* fw doesn't implement vdev stats */
    3041                 :            : 
    3042         [ #  # ]:          0 :         for (i = 0; i < num_peer_stats; i++) {
    3043                 :          0 :                 const struct wmi_10x_peer_stats *src;
    3044                 :          0 :                 struct ath10k_fw_stats_peer *dst;
    3045                 :            : 
    3046                 :          0 :                 src = (void *)skb->data;
    3047         [ #  # ]:          0 :                 if (!skb_pull(skb, sizeof(*src)))
    3048                 :            :                         return -EPROTO;
    3049                 :            : 
    3050                 :          0 :                 dst = kzalloc(sizeof(*dst), GFP_ATOMIC);
    3051         [ #  # ]:          0 :                 if (!dst)
    3052                 :          0 :                         continue;
    3053                 :            : 
    3054                 :          0 :                 ath10k_wmi_pull_peer_stats(&src->old, dst);
    3055                 :            : 
    3056                 :          0 :                 dst->peer_rx_rate = __le32_to_cpu(src->peer_rx_rate);
    3057                 :            : 
    3058                 :          0 :                 list_add_tail(&dst->list, &stats->peers);
    3059                 :            :         }
    3060                 :            : 
    3061                 :            :         return 0;
    3062                 :            : }
    3063                 :            : 
    3064                 :          0 : static int ath10k_wmi_10_2_op_pull_fw_stats(struct ath10k *ar,
    3065                 :            :                                             struct sk_buff *skb,
    3066                 :            :                                             struct ath10k_fw_stats *stats)
    3067                 :            : {
    3068                 :          0 :         const struct wmi_10_2_stats_event *ev = (void *)skb->data;
    3069                 :          0 :         u32 num_pdev_stats;
    3070                 :          0 :         u32 num_pdev_ext_stats;
    3071                 :          0 :         u32 num_peer_stats;
    3072                 :          0 :         int i;
    3073                 :            : 
    3074         [ #  # ]:          0 :         if (!skb_pull(skb, sizeof(*ev)))
    3075                 :            :                 return -EPROTO;
    3076                 :            : 
    3077                 :          0 :         num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats);
    3078                 :          0 :         num_pdev_ext_stats = __le32_to_cpu(ev->num_pdev_ext_stats);
    3079                 :          0 :         num_peer_stats = __le32_to_cpu(ev->num_peer_stats);
    3080                 :            : 
    3081         [ #  # ]:          0 :         for (i = 0; i < num_pdev_stats; i++) {
    3082                 :          0 :                 const struct wmi_10_2_pdev_stats *src;
    3083                 :          0 :                 struct ath10k_fw_stats_pdev *dst;
    3084                 :            : 
    3085                 :          0 :                 src = (void *)skb->data;
    3086         [ #  # ]:          0 :                 if (!skb_pull(skb, sizeof(*src)))
    3087                 :            :                         return -EPROTO;
    3088                 :            : 
    3089                 :          0 :                 dst = kzalloc(sizeof(*dst), GFP_ATOMIC);
    3090         [ #  # ]:          0 :                 if (!dst)
    3091                 :          0 :                         continue;
    3092                 :            : 
    3093                 :          0 :                 ath10k_wmi_pull_pdev_stats_base(&src->base, dst);
    3094                 :          0 :                 ath10k_wmi_pull_pdev_stats_tx(&src->tx, dst);
    3095                 :          0 :                 ath10k_wmi_pull_pdev_stats_rx(&src->rx, dst);
    3096                 :          0 :                 ath10k_wmi_pull_pdev_stats_extra(&src->extra, dst);
    3097                 :            :                 /* FIXME: expose 10.2 specific values */
    3098                 :            : 
    3099                 :          0 :                 list_add_tail(&dst->list, &stats->pdevs);
    3100                 :            :         }
    3101                 :            : 
    3102         [ #  # ]:          0 :         for (i = 0; i < num_pdev_ext_stats; i++) {
    3103                 :          0 :                 const struct wmi_10_2_pdev_ext_stats *src;
    3104                 :            : 
    3105                 :          0 :                 src = (void *)skb->data;
    3106         [ #  # ]:          0 :                 if (!skb_pull(skb, sizeof(*src)))
    3107                 :            :                         return -EPROTO;
    3108                 :            : 
    3109                 :            :                 /* FIXME: expose values to userspace
    3110                 :            :                  *
    3111                 :            :                  * Note: Even though this loop seems to do nothing it is
    3112                 :            :                  * required to parse following sub-structures properly.
    3113                 :            :                  */
    3114                 :            :         }
    3115                 :            : 
    3116                 :            :         /* fw doesn't implement vdev stats */
    3117                 :            : 
    3118         [ #  # ]:          0 :         for (i = 0; i < num_peer_stats; i++) {
    3119                 :          0 :                 const struct wmi_10_2_peer_stats *src;
    3120                 :          0 :                 struct ath10k_fw_stats_peer *dst;
    3121                 :            : 
    3122                 :          0 :                 src = (void *)skb->data;
    3123         [ #  # ]:          0 :                 if (!skb_pull(skb, sizeof(*src)))
    3124                 :            :                         return -EPROTO;
    3125                 :            : 
    3126                 :          0 :                 dst = kzalloc(sizeof(*dst), GFP_ATOMIC);
    3127         [ #  # ]:          0 :                 if (!dst)
    3128                 :          0 :                         continue;
    3129                 :            : 
    3130                 :          0 :                 ath10k_wmi_pull_peer_stats(&src->old, dst);
    3131                 :            : 
    3132                 :          0 :                 dst->peer_rx_rate = __le32_to_cpu(src->peer_rx_rate);
    3133                 :            :                 /* FIXME: expose 10.2 specific values */
    3134                 :            : 
    3135                 :          0 :                 list_add_tail(&dst->list, &stats->peers);
    3136                 :            :         }
    3137                 :            : 
    3138                 :            :         return 0;
    3139                 :            : }
    3140                 :            : 
    3141                 :          0 : static int ath10k_wmi_10_2_4_op_pull_fw_stats(struct ath10k *ar,
    3142                 :            :                                               struct sk_buff *skb,
    3143                 :            :                                               struct ath10k_fw_stats *stats)
    3144                 :            : {
    3145                 :          0 :         const struct wmi_10_2_stats_event *ev = (void *)skb->data;
    3146                 :          0 :         u32 num_pdev_stats;
    3147                 :          0 :         u32 num_pdev_ext_stats;
    3148                 :          0 :         u32 num_peer_stats;
    3149                 :          0 :         int i;
    3150                 :            : 
    3151         [ #  # ]:          0 :         if (!skb_pull(skb, sizeof(*ev)))
    3152                 :            :                 return -EPROTO;
    3153                 :            : 
    3154                 :          0 :         num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats);
    3155                 :          0 :         num_pdev_ext_stats = __le32_to_cpu(ev->num_pdev_ext_stats);
    3156                 :          0 :         num_peer_stats = __le32_to_cpu(ev->num_peer_stats);
    3157                 :            : 
    3158         [ #  # ]:          0 :         for (i = 0; i < num_pdev_stats; i++) {
    3159                 :          0 :                 const struct wmi_10_2_pdev_stats *src;
    3160                 :          0 :                 struct ath10k_fw_stats_pdev *dst;
    3161                 :            : 
    3162                 :          0 :                 src = (void *)skb->data;
    3163         [ #  # ]:          0 :                 if (!skb_pull(skb, sizeof(*src)))
    3164                 :            :                         return -EPROTO;
    3165                 :            : 
    3166                 :          0 :                 dst = kzalloc(sizeof(*dst), GFP_ATOMIC);
    3167         [ #  # ]:          0 :                 if (!dst)
    3168                 :          0 :                         continue;
    3169                 :            : 
    3170                 :          0 :                 ath10k_wmi_pull_pdev_stats_base(&src->base, dst);
    3171                 :          0 :                 ath10k_wmi_pull_pdev_stats_tx(&src->tx, dst);
    3172                 :          0 :                 ath10k_wmi_pull_pdev_stats_rx(&src->rx, dst);
    3173                 :          0 :                 ath10k_wmi_pull_pdev_stats_extra(&src->extra, dst);
    3174                 :            :                 /* FIXME: expose 10.2 specific values */
    3175                 :            : 
    3176                 :          0 :                 list_add_tail(&dst->list, &stats->pdevs);
    3177                 :            :         }
    3178                 :            : 
    3179         [ #  # ]:          0 :         for (i = 0; i < num_pdev_ext_stats; i++) {
    3180                 :          0 :                 const struct wmi_10_2_pdev_ext_stats *src;
    3181                 :            : 
    3182                 :          0 :                 src = (void *)skb->data;
    3183         [ #  # ]:          0 :                 if (!skb_pull(skb, sizeof(*src)))
    3184                 :            :                         return -EPROTO;
    3185                 :            : 
    3186                 :            :                 /* FIXME: expose values to userspace
    3187                 :            :                  *
    3188                 :            :                  * Note: Even though this loop seems to do nothing it is
    3189                 :            :                  * required to parse following sub-structures properly.
    3190                 :            :                  */
    3191                 :            :         }
    3192                 :            : 
    3193                 :            :         /* fw doesn't implement vdev stats */
    3194                 :            : 
    3195         [ #  # ]:          0 :         for (i = 0; i < num_peer_stats; i++) {
    3196                 :          0 :                 const struct wmi_10_2_4_ext_peer_stats *src;
    3197                 :          0 :                 struct ath10k_fw_stats_peer *dst;
    3198                 :          0 :                 int stats_len;
    3199                 :            : 
    3200         [ #  # ]:          0 :                 if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map))
    3201                 :            :                         stats_len = sizeof(struct wmi_10_2_4_ext_peer_stats);
    3202                 :            :                 else
    3203                 :          0 :                         stats_len = sizeof(struct wmi_10_2_4_peer_stats);
    3204                 :            : 
    3205                 :          0 :                 src = (void *)skb->data;
    3206         [ #  # ]:          0 :                 if (!skb_pull(skb, stats_len))
    3207                 :            :                         return -EPROTO;
    3208                 :            : 
    3209                 :          0 :                 dst = kzalloc(sizeof(*dst), GFP_ATOMIC);
    3210         [ #  # ]:          0 :                 if (!dst)
    3211                 :          0 :                         continue;
    3212                 :            : 
    3213                 :          0 :                 ath10k_wmi_pull_peer_stats(&src->common.old, dst);
    3214                 :            : 
    3215                 :          0 :                 dst->peer_rx_rate = __le32_to_cpu(src->common.peer_rx_rate);
    3216                 :            : 
    3217         [ #  # ]:          0 :                 if (ath10k_peer_stats_enabled(ar))
    3218                 :          0 :                         dst->rx_duration = __le32_to_cpu(src->rx_duration);
    3219                 :            :                 /* FIXME: expose 10.2 specific values */
    3220                 :            : 
    3221                 :          0 :                 list_add_tail(&dst->list, &stats->peers);
    3222                 :            :         }
    3223                 :            : 
    3224                 :            :         return 0;
    3225                 :            : }
    3226                 :            : 
    3227                 :          0 : static int ath10k_wmi_10_4_op_pull_fw_stats(struct ath10k *ar,
    3228                 :            :                                             struct sk_buff *skb,
    3229                 :            :                                             struct ath10k_fw_stats *stats)
    3230                 :            : {
    3231                 :          0 :         const struct wmi_10_2_stats_event *ev = (void *)skb->data;
    3232                 :          0 :         u32 num_pdev_stats;
    3233                 :          0 :         u32 num_pdev_ext_stats;
    3234                 :          0 :         u32 num_vdev_stats;
    3235                 :          0 :         u32 num_peer_stats;
    3236                 :          0 :         u32 num_bcnflt_stats;
    3237                 :          0 :         u32 stats_id;
    3238                 :          0 :         int i;
    3239                 :            : 
    3240         [ #  # ]:          0 :         if (!skb_pull(skb, sizeof(*ev)))
    3241                 :            :                 return -EPROTO;
    3242                 :            : 
    3243                 :          0 :         num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats);
    3244                 :          0 :         num_pdev_ext_stats = __le32_to_cpu(ev->num_pdev_ext_stats);
    3245                 :          0 :         num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats);
    3246                 :          0 :         num_peer_stats = __le32_to_cpu(ev->num_peer_stats);
    3247                 :          0 :         num_bcnflt_stats = __le32_to_cpu(ev->num_bcnflt_stats);
    3248                 :          0 :         stats_id = __le32_to_cpu(ev->stats_id);
    3249                 :            : 
    3250         [ #  # ]:          0 :         for (i = 0; i < num_pdev_stats; i++) {
    3251                 :          0 :                 const struct wmi_10_4_pdev_stats *src;
    3252                 :          0 :                 struct ath10k_fw_stats_pdev *dst;
    3253                 :            : 
    3254                 :          0 :                 src = (void *)skb->data;
    3255         [ #  # ]:          0 :                 if (!skb_pull(skb, sizeof(*src)))
    3256                 :            :                         return -EPROTO;
    3257                 :            : 
    3258                 :          0 :                 dst = kzalloc(sizeof(*dst), GFP_ATOMIC);
    3259         [ #  # ]:          0 :                 if (!dst)
    3260                 :          0 :                         continue;
    3261                 :            : 
    3262                 :          0 :                 ath10k_wmi_pull_pdev_stats_base(&src->base, dst);
    3263                 :          0 :                 ath10k_wmi_10_4_pull_pdev_stats_tx(&src->tx, dst);
    3264                 :          0 :                 ath10k_wmi_pull_pdev_stats_rx(&src->rx, dst);
    3265                 :          0 :                 dst->rx_ovfl_errs = __le32_to_cpu(src->rx_ovfl_errs);
    3266                 :          0 :                 ath10k_wmi_pull_pdev_stats_extra(&src->extra, dst);
    3267                 :            : 
    3268                 :          0 :                 list_add_tail(&dst->list, &stats->pdevs);
    3269                 :            :         }
    3270                 :            : 
    3271         [ #  # ]:          0 :         for (i = 0; i < num_pdev_ext_stats; i++) {
    3272                 :          0 :                 const struct wmi_10_2_pdev_ext_stats *src;
    3273                 :            : 
    3274                 :          0 :                 src = (void *)skb->data;
    3275         [ #  # ]:          0 :                 if (!skb_pull(skb, sizeof(*src)))
    3276                 :            :                         return -EPROTO;
    3277                 :            : 
    3278                 :            :                 /* FIXME: expose values to userspace
    3279                 :            :                  *
    3280                 :            :                  * Note: Even though this loop seems to do nothing it is
    3281                 :            :                  * required to parse following sub-structures properly.
    3282                 :            :                  */
    3283                 :            :         }
    3284                 :            : 
    3285         [ #  # ]:          0 :         for (i = 0; i < num_vdev_stats; i++) {
    3286                 :          0 :                 const struct wmi_vdev_stats *src;
    3287                 :            : 
    3288                 :            :                 /* Ignore vdev stats here as it has only vdev id. Actual vdev
    3289                 :            :                  * stats will be retrieved from vdev extended stats.
    3290                 :            :                  */
    3291                 :          0 :                 src = (void *)skb->data;
    3292         [ #  # ]:          0 :                 if (!skb_pull(skb, sizeof(*src)))
    3293                 :            :                         return -EPROTO;
    3294                 :            :         }
    3295                 :            : 
    3296         [ #  # ]:          0 :         for (i = 0; i < num_peer_stats; i++) {
    3297                 :          0 :                 const struct wmi_10_4_peer_stats *src;
    3298                 :          0 :                 struct ath10k_fw_stats_peer *dst;
    3299                 :            : 
    3300                 :          0 :                 src = (void *)skb->data;
    3301         [ #  # ]:          0 :                 if (!skb_pull(skb, sizeof(*src)))
    3302                 :            :                         return -EPROTO;
    3303                 :            : 
    3304                 :          0 :                 dst = kzalloc(sizeof(*dst), GFP_ATOMIC);
    3305         [ #  # ]:          0 :                 if (!dst)
    3306                 :          0 :                         continue;
    3307                 :            : 
    3308                 :          0 :                 ath10k_wmi_10_4_pull_peer_stats(src, dst);
    3309                 :          0 :                 list_add_tail(&dst->list, &stats->peers);
    3310                 :            :         }
    3311                 :            : 
    3312         [ #  # ]:          0 :         for (i = 0; i < num_bcnflt_stats; i++) {
    3313                 :          0 :                 const struct wmi_10_4_bss_bcn_filter_stats *src;
    3314                 :            : 
    3315                 :          0 :                 src = (void *)skb->data;
    3316         [ #  # ]:          0 :                 if (!skb_pull(skb, sizeof(*src)))
    3317                 :            :                         return -EPROTO;
    3318                 :            : 
    3319                 :            :                 /* FIXME: expose values to userspace
    3320                 :            :                  *
    3321                 :            :                  * Note: Even though this loop seems to do nothing it is
    3322                 :            :                  * required to parse following sub-structures properly.
    3323                 :            :                  */
    3324                 :            :         }
    3325                 :            : 
    3326         [ #  # ]:          0 :         if (stats_id & WMI_10_4_STAT_PEER_EXTD) {
    3327                 :          0 :                 stats->extended = true;
    3328                 :            : 
    3329         [ #  # ]:          0 :                 for (i = 0; i < num_peer_stats; i++) {
    3330                 :          0 :                         const struct wmi_10_4_peer_extd_stats *src;
    3331                 :          0 :                         struct ath10k_fw_extd_stats_peer *dst;
    3332                 :            : 
    3333                 :          0 :                         src = (void *)skb->data;
    3334         [ #  # ]:          0 :                         if (!skb_pull(skb, sizeof(*src)))
    3335                 :            :                                 return -EPROTO;
    3336                 :            : 
    3337                 :          0 :                         dst = kzalloc(sizeof(*dst), GFP_ATOMIC);
    3338         [ #  # ]:          0 :                         if (!dst)
    3339                 :          0 :                                 continue;
    3340                 :            : 
    3341                 :          0 :                         ether_addr_copy(dst->peer_macaddr,
    3342                 :            :                                         src->peer_macaddr.addr);
    3343                 :          0 :                         dst->rx_duration = __le32_to_cpu(src->rx_duration);
    3344                 :          0 :                         list_add_tail(&dst->list, &stats->peers_extd);
    3345                 :            :                 }
    3346                 :            :         }
    3347                 :            : 
    3348         [ #  # ]:          0 :         if (stats_id & WMI_10_4_STAT_VDEV_EXTD) {
    3349         [ #  # ]:          0 :                 for (i = 0; i < num_vdev_stats; i++) {
    3350                 :          0 :                         const struct wmi_vdev_stats_extd *src;
    3351                 :          0 :                         struct ath10k_fw_stats_vdev_extd *dst;
    3352                 :            : 
    3353                 :          0 :                         src = (void *)skb->data;
    3354         [ #  # ]:          0 :                         if (!skb_pull(skb, sizeof(*src)))
    3355                 :            :                                 return -EPROTO;
    3356                 :            : 
    3357                 :          0 :                         dst = kzalloc(sizeof(*dst), GFP_ATOMIC);
    3358         [ #  # ]:          0 :                         if (!dst)
    3359                 :          0 :                                 continue;
    3360                 :          0 :                         ath10k_wmi_10_4_pull_vdev_stats(src, dst);
    3361                 :          0 :                         list_add_tail(&dst->list, &stats->vdevs);
    3362                 :            :                 }
    3363                 :            :         }
    3364                 :            : 
    3365                 :            :         return 0;
    3366                 :            : }
    3367                 :            : 
    3368                 :          0 : void ath10k_wmi_event_update_stats(struct ath10k *ar, struct sk_buff *skb)
    3369                 :            : {
    3370         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_UPDATE_STATS_EVENTID\n");
    3371                 :          0 :         ath10k_debug_fw_stats_process(ar, skb);
    3372                 :          0 : }
    3373                 :            : 
    3374                 :            : static int
    3375                 :          0 : ath10k_wmi_op_pull_vdev_start_ev(struct ath10k *ar, struct sk_buff *skb,
    3376                 :            :                                  struct wmi_vdev_start_ev_arg *arg)
    3377                 :            : {
    3378                 :          0 :         struct wmi_vdev_start_response_event *ev = (void *)skb->data;
    3379                 :            : 
    3380         [ #  # ]:          0 :         if (skb->len < sizeof(*ev))
    3381                 :            :                 return -EPROTO;
    3382                 :            : 
    3383                 :          0 :         skb_pull(skb, sizeof(*ev));
    3384                 :          0 :         arg->vdev_id = ev->vdev_id;
    3385                 :          0 :         arg->req_id = ev->req_id;
    3386                 :          0 :         arg->resp_type = ev->resp_type;
    3387                 :          0 :         arg->status = ev->status;
    3388                 :            : 
    3389                 :          0 :         return 0;
    3390                 :            : }
    3391                 :            : 
    3392                 :          0 : void ath10k_wmi_event_vdev_start_resp(struct ath10k *ar, struct sk_buff *skb)
    3393                 :            : {
    3394                 :          0 :         struct wmi_vdev_start_ev_arg arg = {};
    3395                 :          0 :         int ret;
    3396                 :          0 :         u32 status;
    3397                 :            : 
    3398         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_START_RESP_EVENTID\n");
    3399                 :            : 
    3400                 :          0 :         ar->last_wmi_vdev_start_status = 0;
    3401                 :            : 
    3402         [ #  # ]:          0 :         ret = ath10k_wmi_pull_vdev_start(ar, skb, &arg);
    3403         [ #  # ]:          0 :         if (ret) {
    3404                 :          0 :                 ath10k_warn(ar, "failed to parse vdev start event: %d\n", ret);
    3405                 :          0 :                 ar->last_wmi_vdev_start_status = ret;
    3406                 :          0 :                 goto out;
    3407                 :            :         }
    3408                 :            : 
    3409                 :          0 :         status = __le32_to_cpu(arg.status);
    3410   [ #  #  #  # ]:          0 :         if (WARN_ON_ONCE(status)) {
    3411         [ #  # ]:          0 :                 ath10k_warn(ar, "vdev-start-response reports status error: %d (%s)\n",
    3412                 :            :                             status, (status == WMI_VDEV_START_CHAN_INVALID) ?
    3413                 :            :                             "chan-invalid" : "unknown");
    3414                 :            :                 /* Setup is done one way or another though, so we should still
    3415                 :            :                  * do the completion, so don't return here.
    3416                 :            :                  */
    3417                 :          0 :                 ar->last_wmi_vdev_start_status = -EINVAL;
    3418                 :            :         }
    3419                 :            : 
    3420                 :          0 : out:
    3421                 :          0 :         complete(&ar->vdev_setup_done);
    3422                 :          0 : }
    3423                 :            : 
    3424                 :          0 : void ath10k_wmi_event_vdev_stopped(struct ath10k *ar, struct sk_buff *skb)
    3425                 :            : {
    3426         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_STOPPED_EVENTID\n");
    3427                 :          0 :         complete(&ar->vdev_setup_done);
    3428                 :          0 : }
    3429                 :            : 
    3430                 :            : static int
    3431                 :          0 : ath10k_wmi_op_pull_peer_kick_ev(struct ath10k *ar, struct sk_buff *skb,
    3432                 :            :                                 struct wmi_peer_kick_ev_arg *arg)
    3433                 :            : {
    3434                 :          0 :         struct wmi_peer_sta_kickout_event *ev = (void *)skb->data;
    3435                 :            : 
    3436         [ #  # ]:          0 :         if (skb->len < sizeof(*ev))
    3437                 :            :                 return -EPROTO;
    3438                 :            : 
    3439                 :          0 :         skb_pull(skb, sizeof(*ev));
    3440                 :          0 :         arg->mac_addr = ev->peer_macaddr.addr;
    3441                 :            : 
    3442                 :          0 :         return 0;
    3443                 :            : }
    3444                 :            : 
    3445                 :          0 : void ath10k_wmi_event_peer_sta_kickout(struct ath10k *ar, struct sk_buff *skb)
    3446                 :            : {
    3447                 :          0 :         struct wmi_peer_kick_ev_arg arg = {};
    3448                 :          0 :         struct ieee80211_sta *sta;
    3449                 :          0 :         int ret;
    3450                 :            : 
    3451         [ #  # ]:          0 :         ret = ath10k_wmi_pull_peer_kick(ar, skb, &arg);
    3452         [ #  # ]:          0 :         if (ret) {
    3453                 :          0 :                 ath10k_warn(ar, "failed to parse peer kickout event: %d\n",
    3454                 :            :                             ret);
    3455                 :          0 :                 return;
    3456                 :            :         }
    3457                 :            : 
    3458         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi event peer sta kickout %pM\n",
    3459                 :            :                    arg.mac_addr);
    3460                 :            : 
    3461                 :          0 :         rcu_read_lock();
    3462                 :            : 
    3463                 :          0 :         sta = ieee80211_find_sta_by_ifaddr(ar->hw, arg.mac_addr, NULL);
    3464         [ #  # ]:          0 :         if (!sta) {
    3465                 :          0 :                 ath10k_warn(ar, "Spurious quick kickout for STA %pM\n",
    3466                 :            :                             arg.mac_addr);
    3467                 :          0 :                 goto exit;
    3468                 :            :         }
    3469                 :            : 
    3470                 :          0 :         ieee80211_report_low_ack(sta, 10);
    3471                 :            : 
    3472                 :          0 : exit:
    3473                 :          0 :         rcu_read_unlock();
    3474                 :            : }
    3475                 :            : 
    3476                 :            : /*
    3477                 :            :  * FIXME
    3478                 :            :  *
    3479                 :            :  * We don't report to mac80211 sleep state of connected
    3480                 :            :  * stations. Due to this mac80211 can't fill in TIM IE
    3481                 :            :  * correctly.
    3482                 :            :  *
    3483                 :            :  * I know of no way of getting nullfunc frames that contain
    3484                 :            :  * sleep transition from connected stations - these do not
    3485                 :            :  * seem to be sent from the target to the host. There also
    3486                 :            :  * doesn't seem to be a dedicated event for that. So the
    3487                 :            :  * only way left to do this would be to read tim_bitmap
    3488                 :            :  * during SWBA.
    3489                 :            :  *
    3490                 :            :  * We could probably try using tim_bitmap from SWBA to tell
    3491                 :            :  * mac80211 which stations are asleep and which are not. The
    3492                 :            :  * problem here is calling mac80211 functions so many times
    3493                 :            :  * could take too long and make us miss the time to submit
    3494                 :            :  * the beacon to the target.
    3495                 :            :  *
    3496                 :            :  * So as a workaround we try to extend the TIM IE if there
    3497                 :            :  * is unicast buffered for stations with aid > 7 and fill it
    3498                 :            :  * in ourselves.
    3499                 :            :  */
    3500                 :          0 : static void ath10k_wmi_update_tim(struct ath10k *ar,
    3501                 :            :                                   struct ath10k_vif *arvif,
    3502                 :            :                                   struct sk_buff *bcn,
    3503                 :            :                                   const struct wmi_tim_info_arg *tim_info)
    3504                 :            : {
    3505                 :          0 :         struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)bcn->data;
    3506                 :          0 :         struct ieee80211_tim_ie *tim;
    3507                 :          0 :         u8 *ies, *ie;
    3508                 :          0 :         u8 ie_len, pvm_len;
    3509                 :          0 :         __le32 t;
    3510                 :          0 :         u32 v, tim_len;
    3511                 :            : 
    3512                 :            :         /* When FW reports 0 in tim_len, ensure atleast first byte
    3513                 :            :          * in tim_bitmap is considered for pvm calculation.
    3514                 :            :          */
    3515                 :          0 :         tim_len = tim_info->tim_len ? __le32_to_cpu(tim_info->tim_len) : 1;
    3516                 :            : 
    3517                 :            :         /* if next SWBA has no tim_changed the tim_bitmap is garbage.
    3518                 :            :          * we must copy the bitmap upon change and reuse it later
    3519                 :            :          */
    3520         [ #  # ]:          0 :         if (__le32_to_cpu(tim_info->tim_changed)) {
    3521                 :          0 :                 int i;
    3522                 :            : 
    3523         [ #  # ]:          0 :                 if (sizeof(arvif->u.ap.tim_bitmap) < tim_len) {
    3524                 :          0 :                         ath10k_warn(ar, "SWBA TIM field is too big (%u), truncated it to %zu",
    3525                 :            :                                     tim_len, sizeof(arvif->u.ap.tim_bitmap));
    3526                 :          0 :                         tim_len = sizeof(arvif->u.ap.tim_bitmap);
    3527                 :            :                 }
    3528                 :            : 
    3529         [ #  # ]:          0 :                 for (i = 0; i < tim_len; i++) {
    3530                 :          0 :                         t = tim_info->tim_bitmap[i / 4];
    3531                 :          0 :                         v = __le32_to_cpu(t);
    3532                 :          0 :                         arvif->u.ap.tim_bitmap[i] = (v >> ((i % 4) * 8)) & 0xFF;
    3533                 :            :                 }
    3534                 :            : 
    3535                 :            :                 /* FW reports either length 0 or length based on max supported
    3536                 :            :                  * station. so we calculate this on our own
    3537                 :            :                  */
    3538                 :          0 :                 arvif->u.ap.tim_len = 0;
    3539         [ #  # ]:          0 :                 for (i = 0; i < tim_len; i++)
    3540         [ #  # ]:          0 :                         if (arvif->u.ap.tim_bitmap[i])
    3541                 :          0 :                                 arvif->u.ap.tim_len = i;
    3542                 :            : 
    3543                 :          0 :                 arvif->u.ap.tim_len++;
    3544                 :            :         }
    3545                 :            : 
    3546                 :          0 :         ies = bcn->data;
    3547                 :          0 :         ies += ieee80211_hdrlen(hdr->frame_control);
    3548                 :          0 :         ies += 12; /* fixed parameters */
    3549                 :            : 
    3550                 :          0 :         ie = (u8 *)cfg80211_find_ie(WLAN_EID_TIM, ies,
    3551                 :          0 :                                     (u8 *)skb_tail_pointer(bcn) - ies);
    3552         [ #  # ]:          0 :         if (!ie) {
    3553         [ #  # ]:          0 :                 if (arvif->vdev_type != WMI_VDEV_TYPE_IBSS)
    3554                 :          0 :                         ath10k_warn(ar, "no tim ie found;\n");
    3555                 :          0 :                 return;
    3556                 :            :         }
    3557                 :            : 
    3558                 :          0 :         tim = (void *)ie + 2;
    3559                 :          0 :         ie_len = ie[1];
    3560                 :          0 :         pvm_len = ie_len - 3; /* exclude dtim count, dtim period, bmap ctl */
    3561                 :            : 
    3562         [ #  # ]:          0 :         if (pvm_len < arvif->u.ap.tim_len) {
    3563                 :          0 :                 int expand_size = tim_len - pvm_len;
    3564                 :          0 :                 int move_size = skb_tail_pointer(bcn) - (ie + 2 + ie_len);
    3565                 :          0 :                 void *next_ie = ie + 2 + ie_len;
    3566                 :            : 
    3567         [ #  # ]:          0 :                 if (skb_put(bcn, expand_size)) {
    3568                 :          0 :                         memmove(next_ie + expand_size, next_ie, move_size);
    3569                 :            : 
    3570                 :          0 :                         ie[1] += expand_size;
    3571                 :          0 :                         ie_len += expand_size;
    3572                 :          0 :                         pvm_len += expand_size;
    3573                 :            :                 } else {
    3574                 :          0 :                         ath10k_warn(ar, "tim expansion failed\n");
    3575                 :            :                 }
    3576                 :            :         }
    3577                 :            : 
    3578         [ #  # ]:          0 :         if (pvm_len > tim_len) {
    3579                 :          0 :                 ath10k_warn(ar, "tim pvm length is too great (%d)\n", pvm_len);
    3580                 :          0 :                 return;
    3581                 :            :         }
    3582                 :            : 
    3583                 :          0 :         tim->bitmap_ctrl = !!__le32_to_cpu(tim_info->tim_mcast);
    3584                 :          0 :         memcpy(tim->virtual_map, arvif->u.ap.tim_bitmap, pvm_len);
    3585                 :            : 
    3586         [ #  # ]:          0 :         if (tim->dtim_count == 0) {
    3587         [ #  # ]:          0 :                 ATH10K_SKB_CB(bcn)->flags |= ATH10K_SKB_F_DTIM_ZERO;
    3588                 :            : 
    3589         [ #  # ]:          0 :                 if (__le32_to_cpu(tim_info->tim_mcast) == 1)
    3590                 :          0 :                         ATH10K_SKB_CB(bcn)->flags |= ATH10K_SKB_F_DELIVER_CAB;
    3591                 :            :         }
    3592                 :            : 
    3593         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_MGMT, "dtim %d/%d mcast %d pvmlen %d\n",
    3594                 :            :                    tim->dtim_count, tim->dtim_period,
    3595                 :            :                    tim->bitmap_ctrl, pvm_len);
    3596                 :            : }
    3597                 :            : 
    3598                 :          0 : static void ath10k_wmi_update_noa(struct ath10k *ar, struct ath10k_vif *arvif,
    3599                 :            :                                   struct sk_buff *bcn,
    3600                 :            :                                   const struct wmi_p2p_noa_info *noa)
    3601                 :            : {
    3602         [ #  # ]:          0 :         if (!arvif->vif->p2p)
    3603                 :            :                 return;
    3604                 :            : 
    3605         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_MGMT, "noa changed: %d\n", noa->changed);
    3606                 :            : 
    3607         [ #  # ]:          0 :         if (noa->changed & WMI_P2P_NOA_CHANGED_BIT)
    3608                 :          0 :                 ath10k_p2p_noa_update(arvif, noa);
    3609                 :            : 
    3610         [ #  # ]:          0 :         if (arvif->u.ap.noa_data)
    3611         [ #  # ]:          0 :                 if (!pskb_expand_head(bcn, 0, arvif->u.ap.noa_len, GFP_ATOMIC))
    3612                 :          0 :                         skb_put_data(bcn, arvif->u.ap.noa_data,
    3613                 :            :                                      arvif->u.ap.noa_len);
    3614                 :            : }
    3615                 :            : 
    3616                 :          0 : static int ath10k_wmi_op_pull_swba_ev(struct ath10k *ar, struct sk_buff *skb,
    3617                 :            :                                       struct wmi_swba_ev_arg *arg)
    3618                 :            : {
    3619                 :          0 :         struct wmi_host_swba_event *ev = (void *)skb->data;
    3620                 :          0 :         u32 map;
    3621                 :          0 :         size_t i;
    3622                 :            : 
    3623         [ #  # ]:          0 :         if (skb->len < sizeof(*ev))
    3624                 :            :                 return -EPROTO;
    3625                 :            : 
    3626                 :          0 :         skb_pull(skb, sizeof(*ev));
    3627                 :          0 :         arg->vdev_map = ev->vdev_map;
    3628                 :            : 
    3629         [ #  # ]:          0 :         for (i = 0, map = __le32_to_cpu(ev->vdev_map); map; map >>= 1) {
    3630         [ #  # ]:          0 :                 if (!(map & BIT(0)))
    3631                 :          0 :                         continue;
    3632                 :            : 
    3633                 :            :                 /* If this happens there were some changes in firmware and
    3634                 :            :                  * ath10k should update the max size of tim_info array.
    3635                 :            :                  */
    3636   [ #  #  #  # ]:          0 :                 if (WARN_ON_ONCE(i == ARRAY_SIZE(arg->tim_info)))
    3637                 :            :                         break;
    3638                 :            : 
    3639         [ #  # ]:          0 :                 if (__le32_to_cpu(ev->bcn_info[i].tim_info.tim_len) >
    3640                 :            :                      sizeof(ev->bcn_info[i].tim_info.tim_bitmap)) {
    3641                 :          0 :                         ath10k_warn(ar, "refusing to parse invalid swba structure\n");
    3642                 :          0 :                         return -EPROTO;
    3643                 :            :                 }
    3644                 :            : 
    3645                 :          0 :                 arg->tim_info[i].tim_len = ev->bcn_info[i].tim_info.tim_len;
    3646                 :          0 :                 arg->tim_info[i].tim_mcast = ev->bcn_info[i].tim_info.tim_mcast;
    3647                 :          0 :                 arg->tim_info[i].tim_bitmap =
    3648                 :          0 :                                 ev->bcn_info[i].tim_info.tim_bitmap;
    3649                 :          0 :                 arg->tim_info[i].tim_changed =
    3650                 :          0 :                                 ev->bcn_info[i].tim_info.tim_changed;
    3651                 :          0 :                 arg->tim_info[i].tim_num_ps_pending =
    3652                 :          0 :                                 ev->bcn_info[i].tim_info.tim_num_ps_pending;
    3653                 :            : 
    3654                 :          0 :                 arg->noa_info[i] = &ev->bcn_info[i].p2p_noa_info;
    3655                 :          0 :                 i++;
    3656                 :            :         }
    3657                 :            : 
    3658                 :            :         return 0;
    3659                 :            : }
    3660                 :            : 
    3661                 :          0 : static int ath10k_wmi_10_2_4_op_pull_swba_ev(struct ath10k *ar,
    3662                 :            :                                              struct sk_buff *skb,
    3663                 :            :                                              struct wmi_swba_ev_arg *arg)
    3664                 :            : {
    3665                 :          0 :         struct wmi_10_2_4_host_swba_event *ev = (void *)skb->data;
    3666                 :          0 :         u32 map;
    3667                 :          0 :         size_t i;
    3668                 :            : 
    3669         [ #  # ]:          0 :         if (skb->len < sizeof(*ev))
    3670                 :            :                 return -EPROTO;
    3671                 :            : 
    3672                 :          0 :         skb_pull(skb, sizeof(*ev));
    3673                 :          0 :         arg->vdev_map = ev->vdev_map;
    3674                 :            : 
    3675         [ #  # ]:          0 :         for (i = 0, map = __le32_to_cpu(ev->vdev_map); map; map >>= 1) {
    3676         [ #  # ]:          0 :                 if (!(map & BIT(0)))
    3677                 :          0 :                         continue;
    3678                 :            : 
    3679                 :            :                 /* If this happens there were some changes in firmware and
    3680                 :            :                  * ath10k should update the max size of tim_info array.
    3681                 :            :                  */
    3682   [ #  #  #  # ]:          0 :                 if (WARN_ON_ONCE(i == ARRAY_SIZE(arg->tim_info)))
    3683                 :            :                         break;
    3684                 :            : 
    3685         [ #  # ]:          0 :                 if (__le32_to_cpu(ev->bcn_info[i].tim_info.tim_len) >
    3686                 :            :                      sizeof(ev->bcn_info[i].tim_info.tim_bitmap)) {
    3687                 :          0 :                         ath10k_warn(ar, "refusing to parse invalid swba structure\n");
    3688                 :          0 :                         return -EPROTO;
    3689                 :            :                 }
    3690                 :            : 
    3691                 :          0 :                 arg->tim_info[i].tim_len = ev->bcn_info[i].tim_info.tim_len;
    3692                 :          0 :                 arg->tim_info[i].tim_mcast = ev->bcn_info[i].tim_info.tim_mcast;
    3693                 :          0 :                 arg->tim_info[i].tim_bitmap =
    3694                 :          0 :                                 ev->bcn_info[i].tim_info.tim_bitmap;
    3695                 :          0 :                 arg->tim_info[i].tim_changed =
    3696                 :          0 :                                 ev->bcn_info[i].tim_info.tim_changed;
    3697                 :          0 :                 arg->tim_info[i].tim_num_ps_pending =
    3698                 :          0 :                                 ev->bcn_info[i].tim_info.tim_num_ps_pending;
    3699                 :          0 :                 i++;
    3700                 :            :         }
    3701                 :            : 
    3702                 :            :         return 0;
    3703                 :            : }
    3704                 :            : 
    3705                 :          0 : static int ath10k_wmi_10_4_op_pull_swba_ev(struct ath10k *ar,
    3706                 :            :                                            struct sk_buff *skb,
    3707                 :            :                                            struct wmi_swba_ev_arg *arg)
    3708                 :            : {
    3709                 :          0 :         struct wmi_10_4_host_swba_event *ev = (void *)skb->data;
    3710                 :          0 :         u32 map, tim_len;
    3711                 :          0 :         size_t i;
    3712                 :            : 
    3713         [ #  # ]:          0 :         if (skb->len < sizeof(*ev))
    3714                 :            :                 return -EPROTO;
    3715                 :            : 
    3716                 :          0 :         skb_pull(skb, sizeof(*ev));
    3717                 :          0 :         arg->vdev_map = ev->vdev_map;
    3718                 :            : 
    3719         [ #  # ]:          0 :         for (i = 0, map = __le32_to_cpu(ev->vdev_map); map; map >>= 1) {
    3720         [ #  # ]:          0 :                 if (!(map & BIT(0)))
    3721                 :          0 :                         continue;
    3722                 :            : 
    3723                 :            :                 /* If this happens there were some changes in firmware and
    3724                 :            :                  * ath10k should update the max size of tim_info array.
    3725                 :            :                  */
    3726   [ #  #  #  # ]:          0 :                 if (WARN_ON_ONCE(i == ARRAY_SIZE(arg->tim_info)))
    3727                 :            :                         break;
    3728                 :            : 
    3729         [ #  # ]:          0 :                 if (__le32_to_cpu(ev->bcn_info[i].tim_info.tim_len) >
    3730                 :            :                       sizeof(ev->bcn_info[i].tim_info.tim_bitmap)) {
    3731                 :          0 :                         ath10k_warn(ar, "refusing to parse invalid swba structure\n");
    3732                 :          0 :                         return -EPROTO;
    3733                 :            :                 }
    3734                 :            : 
    3735                 :          0 :                 tim_len = __le32_to_cpu(ev->bcn_info[i].tim_info.tim_len);
    3736         [ #  # ]:          0 :                 if (tim_len) {
    3737                 :            :                         /* Exclude 4 byte guard length */
    3738                 :          0 :                         tim_len -= 4;
    3739                 :          0 :                         arg->tim_info[i].tim_len = __cpu_to_le32(tim_len);
    3740                 :            :                 } else {
    3741                 :          0 :                         arg->tim_info[i].tim_len = 0;
    3742                 :            :                 }
    3743                 :            : 
    3744                 :          0 :                 arg->tim_info[i].tim_mcast = ev->bcn_info[i].tim_info.tim_mcast;
    3745                 :          0 :                 arg->tim_info[i].tim_bitmap =
    3746                 :          0 :                                 ev->bcn_info[i].tim_info.tim_bitmap;
    3747                 :          0 :                 arg->tim_info[i].tim_changed =
    3748                 :          0 :                                 ev->bcn_info[i].tim_info.tim_changed;
    3749                 :          0 :                 arg->tim_info[i].tim_num_ps_pending =
    3750                 :          0 :                                 ev->bcn_info[i].tim_info.tim_num_ps_pending;
    3751                 :            : 
    3752                 :            :                 /* 10.4 firmware doesn't have p2p support. notice of absence
    3753                 :            :                  * info can be ignored for now.
    3754                 :            :                  */
    3755                 :            : 
    3756                 :          0 :                 i++;
    3757                 :            :         }
    3758                 :            : 
    3759                 :            :         return 0;
    3760                 :            : }
    3761                 :            : 
    3762                 :          0 : static enum wmi_txbf_conf ath10k_wmi_10_4_txbf_conf_scheme(struct ath10k *ar)
    3763                 :            : {
    3764                 :          0 :         return WMI_TXBF_CONF_BEFORE_ASSOC;
    3765                 :            : }
    3766                 :            : 
    3767                 :          0 : void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb)
    3768                 :            : {
    3769                 :          0 :         struct wmi_swba_ev_arg arg = {};
    3770                 :          0 :         u32 map;
    3771                 :          0 :         int i = -1;
    3772                 :          0 :         const struct wmi_tim_info_arg *tim_info;
    3773                 :          0 :         const struct wmi_p2p_noa_info *noa_info;
    3774                 :          0 :         struct ath10k_vif *arvif;
    3775                 :          0 :         struct sk_buff *bcn;
    3776                 :          0 :         dma_addr_t paddr;
    3777                 :          0 :         int ret, vdev_id = 0;
    3778                 :            : 
    3779         [ #  # ]:          0 :         ret = ath10k_wmi_pull_swba(ar, skb, &arg);
    3780         [ #  # ]:          0 :         if (ret) {
    3781                 :          0 :                 ath10k_warn(ar, "failed to parse swba event: %d\n", ret);
    3782                 :          0 :                 return;
    3783                 :            :         }
    3784                 :            : 
    3785                 :          0 :         map = __le32_to_cpu(arg.vdev_map);
    3786                 :            : 
    3787         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_MGMT, "mgmt swba vdev_map 0x%x\n",
    3788                 :            :                    map);
    3789                 :            : 
    3790         [ #  # ]:          0 :         for (; map; map >>= 1, vdev_id++) {
    3791         [ #  # ]:          0 :                 if (!(map & 0x1))
    3792                 :          0 :                         continue;
    3793                 :            : 
    3794                 :          0 :                 i++;
    3795                 :            : 
    3796         [ #  # ]:          0 :                 if (i >= WMI_MAX_AP_VDEV) {
    3797                 :          0 :                         ath10k_warn(ar, "swba has corrupted vdev map\n");
    3798                 :          0 :                         break;
    3799                 :            :                 }
    3800                 :            : 
    3801                 :          0 :                 tim_info = &arg.tim_info[i];
    3802                 :          0 :                 noa_info = arg.noa_info[i];
    3803                 :            : 
    3804         [ #  # ]:          0 :                 ath10k_dbg(ar, ATH10K_DBG_MGMT,
    3805                 :            :                            "mgmt event bcn_info %d tim_len %d mcast %d changed %d num_ps_pending %d bitmap 0x%08x%08x%08x%08x\n",
    3806                 :            :                            i,
    3807                 :            :                            __le32_to_cpu(tim_info->tim_len),
    3808                 :            :                            __le32_to_cpu(tim_info->tim_mcast),
    3809                 :            :                            __le32_to_cpu(tim_info->tim_changed),
    3810                 :            :                            __le32_to_cpu(tim_info->tim_num_ps_pending),
    3811                 :            :                            __le32_to_cpu(tim_info->tim_bitmap[3]),
    3812                 :            :                            __le32_to_cpu(tim_info->tim_bitmap[2]),
    3813                 :            :                            __le32_to_cpu(tim_info->tim_bitmap[1]),
    3814                 :            :                            __le32_to_cpu(tim_info->tim_bitmap[0]));
    3815                 :            : 
    3816                 :            :                 /* TODO: Only first 4 word from tim_bitmap is dumped.
    3817                 :            :                  * Extend debug code to dump full tim_bitmap.
    3818                 :            :                  */
    3819                 :            : 
    3820                 :          0 :                 arvif = ath10k_get_arvif(ar, vdev_id);
    3821         [ #  # ]:          0 :                 if (arvif == NULL) {
    3822                 :          0 :                         ath10k_warn(ar, "no vif for vdev_id %d found\n",
    3823                 :            :                                     vdev_id);
    3824                 :          0 :                         continue;
    3825                 :            :                 }
    3826                 :            : 
    3827                 :            :                 /* mac80211 would have already asked us to stop beaconing and
    3828                 :            :                  * bring the vdev down, so continue in that case
    3829                 :            :                  */
    3830         [ #  # ]:          0 :                 if (!arvif->is_up)
    3831                 :          0 :                         continue;
    3832                 :            : 
    3833                 :            :                 /* There are no completions for beacons so wait for next SWBA
    3834                 :            :                  * before telling mac80211 to decrement CSA counter
    3835                 :            :                  *
    3836                 :            :                  * Once CSA counter is completed stop sending beacons until
    3837                 :            :                  * actual channel switch is done
    3838                 :            :                  */
    3839   [ #  #  #  # ]:          0 :                 if (arvif->vif->csa_active &&
    3840                 :          0 :                     ieee80211_csa_is_complete(arvif->vif)) {
    3841                 :          0 :                         ieee80211_csa_finish(arvif->vif);
    3842                 :          0 :                         continue;
    3843                 :            :                 }
    3844                 :            : 
    3845                 :          0 :                 bcn = ieee80211_beacon_get(ar->hw, arvif->vif);
    3846         [ #  # ]:          0 :                 if (!bcn) {
    3847                 :          0 :                         ath10k_warn(ar, "could not get mac80211 beacon\n");
    3848                 :          0 :                         continue;
    3849                 :            :                 }
    3850                 :            : 
    3851                 :          0 :                 ath10k_tx_h_seq_no(arvif->vif, bcn);
    3852                 :          0 :                 ath10k_wmi_update_tim(ar, arvif, bcn, tim_info);
    3853                 :          0 :                 ath10k_wmi_update_noa(ar, arvif, bcn, noa_info);
    3854                 :            : 
    3855                 :          0 :                 spin_lock_bh(&ar->data_lock);
    3856                 :            : 
    3857         [ #  # ]:          0 :                 if (arvif->beacon) {
    3858      [ #  #  # ]:          0 :                         switch (arvif->beacon_state) {
    3859                 :            :                         case ATH10K_BEACON_SENT:
    3860                 :            :                                 break;
    3861                 :          0 :                         case ATH10K_BEACON_SCHEDULED:
    3862                 :          0 :                                 ath10k_warn(ar, "SWBA overrun on vdev %d, skipped old beacon\n",
    3863                 :            :                                             arvif->vdev_id);
    3864                 :          0 :                                 break;
    3865                 :          0 :                         case ATH10K_BEACON_SENDING:
    3866                 :          0 :                                 ath10k_warn(ar, "SWBA overrun on vdev %d, skipped new beacon\n",
    3867                 :            :                                             arvif->vdev_id);
    3868                 :          0 :                                 dev_kfree_skb(bcn);
    3869                 :          0 :                                 goto skip;
    3870                 :            :                         }
    3871                 :            : 
    3872                 :          0 :                         ath10k_mac_vif_beacon_free(arvif);
    3873                 :            :                 }
    3874                 :            : 
    3875         [ #  # ]:          0 :                 if (!arvif->beacon_buf) {
    3876                 :          0 :                         paddr = dma_map_single(arvif->ar->dev, bcn->data,
    3877                 :            :                                                bcn->len, DMA_TO_DEVICE);
    3878                 :          0 :                         ret = dma_mapping_error(arvif->ar->dev, paddr);
    3879                 :          0 :                         if (ret) {
    3880                 :          0 :                                 ath10k_warn(ar, "failed to map beacon: %d\n",
    3881                 :            :                                             ret);
    3882                 :          0 :                                 dev_kfree_skb_any(bcn);
    3883                 :          0 :                                 goto skip;
    3884                 :            :                         }
    3885                 :            : 
    3886                 :          0 :                         ATH10K_SKB_CB(bcn)->paddr = paddr;
    3887                 :            :                 } else {
    3888         [ #  # ]:          0 :                         if (bcn->len > IEEE80211_MAX_FRAME_LEN) {
    3889                 :          0 :                                 ath10k_warn(ar, "trimming beacon %d -> %d bytes!\n",
    3890                 :            :                                             bcn->len, IEEE80211_MAX_FRAME_LEN);
    3891                 :          0 :                                 skb_trim(bcn, IEEE80211_MAX_FRAME_LEN);
    3892                 :            :                         }
    3893                 :          0 :                         memcpy(arvif->beacon_buf, bcn->data, bcn->len);
    3894                 :          0 :                         ATH10K_SKB_CB(bcn)->paddr = arvif->beacon_paddr;
    3895                 :            :                 }
    3896                 :            : 
    3897                 :          0 :                 arvif->beacon = bcn;
    3898                 :          0 :                 arvif->beacon_state = ATH10K_BEACON_SCHEDULED;
    3899                 :            : 
    3900                 :          0 :                 trace_ath10k_tx_hdr(ar, bcn->data, bcn->len);
    3901                 :          0 :                 trace_ath10k_tx_payload(ar, bcn->data, bcn->len);
    3902                 :            : 
    3903                 :          0 : skip:
    3904                 :          0 :                 spin_unlock_bh(&ar->data_lock);
    3905                 :            :         }
    3906                 :            : 
    3907                 :          0 :         ath10k_wmi_tx_beacons_nowait(ar);
    3908                 :            : }
    3909                 :            : 
    3910                 :          0 : void ath10k_wmi_event_tbttoffset_update(struct ath10k *ar, struct sk_buff *skb)
    3911                 :            : {
    3912         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_TBTTOFFSET_UPDATE_EVENTID\n");
    3913                 :          0 : }
    3914                 :            : 
    3915                 :          0 : static void ath10k_radar_detected(struct ath10k *ar)
    3916                 :            : {
    3917         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_REGULATORY, "dfs radar detected\n");
    3918                 :          0 :         ATH10K_DFS_STAT_INC(ar, radar_detected);
    3919                 :            : 
    3920                 :            :         /* Control radar events reporting in debugfs file
    3921                 :            :          * dfs_block_radar_events
    3922                 :            :          */
    3923         [ #  # ]:          0 :         if (ar->dfs_block_radar_events)
    3924                 :          0 :                 ath10k_info(ar, "DFS Radar detected, but ignored as requested\n");
    3925                 :            :         else
    3926                 :          0 :                 ieee80211_radar_detected(ar->hw);
    3927                 :          0 : }
    3928                 :            : 
    3929                 :          0 : static void ath10k_radar_confirmation_work(struct work_struct *work)
    3930                 :            : {
    3931                 :          0 :         struct ath10k *ar = container_of(work, struct ath10k,
    3932                 :            :                                          radar_confirmation_work);
    3933                 :          0 :         struct ath10k_radar_found_info radar_info;
    3934                 :          0 :         int ret, time_left;
    3935                 :            : 
    3936                 :          0 :         reinit_completion(&ar->wmi.radar_confirm);
    3937                 :            : 
    3938                 :          0 :         spin_lock_bh(&ar->data_lock);
    3939                 :          0 :         memcpy(&radar_info, &ar->last_radar_info, sizeof(radar_info));
    3940                 :          0 :         spin_unlock_bh(&ar->data_lock);
    3941                 :            : 
    3942                 :          0 :         ret = ath10k_wmi_report_radar_found(ar, &radar_info);
    3943         [ #  # ]:          0 :         if (ret) {
    3944                 :          0 :                 ath10k_warn(ar, "failed to send radar found %d\n", ret);
    3945                 :          0 :                 goto wait_complete;
    3946                 :            :         }
    3947                 :            : 
    3948                 :          0 :         time_left = wait_for_completion_timeout(&ar->wmi.radar_confirm,
    3949                 :            :                                                 ATH10K_WMI_DFS_CONF_TIMEOUT_HZ);
    3950         [ #  # ]:          0 :         if (time_left) {
    3951                 :            :                 /* DFS Confirmation status event received and
    3952                 :            :                  * necessary action completed.
    3953                 :            :                  */
    3954                 :          0 :                 goto wait_complete;
    3955                 :            :         } else {
    3956                 :            :                 /* DFS Confirmation event not received from FW.Considering this
    3957                 :            :                  * as real radar.
    3958                 :            :                  */
    3959         [ #  # ]:          0 :                 ath10k_dbg(ar, ATH10K_DBG_REGULATORY,
    3960                 :            :                            "dfs confirmation not received from fw, considering as radar\n");
    3961                 :          0 :                 goto radar_detected;
    3962                 :            :         }
    3963                 :            : 
    3964                 :            : radar_detected:
    3965                 :          0 :         ath10k_radar_detected(ar);
    3966                 :            : 
    3967                 :            :         /* Reset state to allow sending confirmation on consecutive radar
    3968                 :            :          * detections, unless radar confirmation is disabled/stopped.
    3969                 :            :          */
    3970                 :          0 : wait_complete:
    3971                 :          0 :         spin_lock_bh(&ar->data_lock);
    3972         [ #  # ]:          0 :         if (ar->radar_conf_state != ATH10K_RADAR_CONFIRMATION_STOPPED)
    3973                 :          0 :                 ar->radar_conf_state = ATH10K_RADAR_CONFIRMATION_IDLE;
    3974                 :          0 :         spin_unlock_bh(&ar->data_lock);
    3975                 :          0 : }
    3976                 :            : 
    3977                 :            : static void ath10k_dfs_radar_report(struct ath10k *ar,
    3978                 :            :                                     struct wmi_phyerr_ev_arg *phyerr,
    3979                 :            :                                     const struct phyerr_radar_report *rr,
    3980                 :            :                                     u64 tsf)
    3981                 :            : {
    3982                 :            :         u32 reg0, reg1, tsf32l;
    3983                 :            :         struct ieee80211_channel *ch;
    3984                 :            :         struct pulse_event pe;
    3985                 :            :         struct radar_detector_specs rs;
    3986                 :            :         u64 tsf64;
    3987                 :            :         u8 rssi, width;
    3988                 :            :         struct ath10k_radar_found_info *radar_info;
    3989                 :            : 
    3990                 :            :         reg0 = __le32_to_cpu(rr->reg0);
    3991                 :            :         reg1 = __le32_to_cpu(rr->reg1);
    3992                 :            : 
    3993                 :            :         ath10k_dbg(ar, ATH10K_DBG_REGULATORY,
    3994                 :            :                    "wmi phyerr radar report chirp %d max_width %d agc_total_gain %d pulse_delta_diff %d\n",
    3995                 :            :                    MS(reg0, RADAR_REPORT_REG0_PULSE_IS_CHIRP),
    3996                 :            :                    MS(reg0, RADAR_REPORT_REG0_PULSE_IS_MAX_WIDTH),
    3997                 :            :                    MS(reg0, RADAR_REPORT_REG0_AGC_TOTAL_GAIN),
    3998                 :            :                    MS(reg0, RADAR_REPORT_REG0_PULSE_DELTA_DIFF));
    3999                 :            :         ath10k_dbg(ar, ATH10K_DBG_REGULATORY,
    4000                 :            :                    "wmi phyerr radar report pulse_delta_pean %d pulse_sidx %d fft_valid %d agc_mb_gain %d subchan_mask %d\n",
    4001                 :            :                    MS(reg0, RADAR_REPORT_REG0_PULSE_DELTA_PEAK),
    4002                 :            :                    MS(reg0, RADAR_REPORT_REG0_PULSE_SIDX),
    4003                 :            :                    MS(reg1, RADAR_REPORT_REG1_PULSE_SRCH_FFT_VALID),
    4004                 :            :                    MS(reg1, RADAR_REPORT_REG1_PULSE_AGC_MB_GAIN),
    4005                 :            :                    MS(reg1, RADAR_REPORT_REG1_PULSE_SUBCHAN_MASK));
    4006                 :            :         ath10k_dbg(ar, ATH10K_DBG_REGULATORY,
    4007                 :            :                    "wmi phyerr radar report pulse_tsf_offset 0x%X pulse_dur: %d\n",
    4008                 :            :                    MS(reg1, RADAR_REPORT_REG1_PULSE_TSF_OFFSET),
    4009                 :            :                    MS(reg1, RADAR_REPORT_REG1_PULSE_DUR));
    4010                 :            : 
    4011                 :            :         if (!ar->dfs_detector)
    4012                 :            :                 return;
    4013                 :            : 
    4014                 :            :         spin_lock_bh(&ar->data_lock);
    4015                 :            :         ch = ar->rx_channel;
    4016                 :            : 
    4017                 :            :         /* fetch target operating channel during channel change */
    4018                 :            :         if (!ch)
    4019                 :            :                 ch = ar->tgt_oper_chan;
    4020                 :            : 
    4021                 :            :         spin_unlock_bh(&ar->data_lock);
    4022                 :            : 
    4023                 :            :         if (!ch) {
    4024                 :            :                 ath10k_warn(ar, "failed to derive channel for radar pulse, treating as radar\n");
    4025                 :            :                 goto radar_detected;
    4026                 :            :         }
    4027                 :            : 
    4028                 :            :         /* report event to DFS pattern detector */
    4029                 :            :         tsf32l = phyerr->tsf_timestamp;
    4030                 :            :         tsf64 = tsf & (~0xFFFFFFFFULL);
    4031                 :            :         tsf64 |= tsf32l;
    4032                 :            : 
    4033                 :            :         width = MS(reg1, RADAR_REPORT_REG1_PULSE_DUR);
    4034                 :            :         rssi = phyerr->rssi_combined;
    4035                 :            : 
    4036                 :            :         /* hardware store this as 8 bit signed value,
    4037                 :            :          * set to zero if negative number
    4038                 :            :          */
    4039                 :            :         if (rssi & 0x80)
    4040                 :            :                 rssi = 0;
    4041                 :            : 
    4042                 :            :         pe.ts = tsf64;
    4043                 :            :         pe.freq = ch->center_freq;
    4044                 :            :         pe.width = width;
    4045                 :            :         pe.rssi = rssi;
    4046                 :            :         pe.chirp = (MS(reg0, RADAR_REPORT_REG0_PULSE_IS_CHIRP) != 0);
    4047                 :            :         ath10k_dbg(ar, ATH10K_DBG_REGULATORY,
    4048                 :            :                    "dfs add pulse freq: %d, width: %d, rssi %d, tsf: %llX\n",
    4049                 :            :                    pe.freq, pe.width, pe.rssi, pe.ts);
    4050                 :            : 
    4051                 :            :         ATH10K_DFS_STAT_INC(ar, pulses_detected);
    4052                 :            : 
    4053                 :            :         if (!ar->dfs_detector->add_pulse(ar->dfs_detector, &pe, &rs)) {
    4054                 :            :                 ath10k_dbg(ar, ATH10K_DBG_REGULATORY,
    4055                 :            :                            "dfs no pulse pattern detected, yet\n");
    4056                 :            :                 return;
    4057                 :            :         }
    4058                 :            : 
    4059                 :            :         if ((test_bit(WMI_SERVICE_HOST_DFS_CHECK_SUPPORT, ar->wmi.svc_map)) &&
    4060                 :            :             ar->dfs_detector->region == NL80211_DFS_FCC) {
    4061                 :            :                 /* Consecutive radar indications need not be
    4062                 :            :                  * sent to the firmware until we get confirmation
    4063                 :            :                  * for the previous detected radar.
    4064                 :            :                  */
    4065                 :            :                 spin_lock_bh(&ar->data_lock);
    4066                 :            :                 if (ar->radar_conf_state != ATH10K_RADAR_CONFIRMATION_IDLE) {
    4067                 :            :                         spin_unlock_bh(&ar->data_lock);
    4068                 :            :                         return;
    4069                 :            :                 }
    4070                 :            :                 ar->radar_conf_state = ATH10K_RADAR_CONFIRMATION_INPROGRESS;
    4071                 :            :                 radar_info = &ar->last_radar_info;
    4072                 :            : 
    4073                 :            :                 radar_info->pri_min = rs.pri_min;
    4074                 :            :                 radar_info->pri_max = rs.pri_max;
    4075                 :            :                 radar_info->width_min = rs.width_min;
    4076                 :            :                 radar_info->width_max = rs.width_max;
    4077                 :            :                 /*TODO Find sidx_min and sidx_max */
    4078                 :            :                 radar_info->sidx_min = MS(reg0, RADAR_REPORT_REG0_PULSE_SIDX);
    4079                 :            :                 radar_info->sidx_max = MS(reg0, RADAR_REPORT_REG0_PULSE_SIDX);
    4080                 :            : 
    4081                 :            :                 ath10k_dbg(ar, ATH10K_DBG_REGULATORY,
    4082                 :            :                            "sending wmi radar found cmd pri_min %d pri_max %d width_min %d width_max %d sidx_min %d sidx_max %d\n",
    4083                 :            :                            radar_info->pri_min, radar_info->pri_max,
    4084                 :            :                            radar_info->width_min, radar_info->width_max,
    4085                 :            :                            radar_info->sidx_min, radar_info->sidx_max);
    4086                 :            :                 ieee80211_queue_work(ar->hw, &ar->radar_confirmation_work);
    4087                 :            :                 spin_unlock_bh(&ar->data_lock);
    4088                 :            :                 return;
    4089                 :            :         }
    4090                 :            : 
    4091                 :            : radar_detected:
    4092                 :            :         ath10k_radar_detected(ar);
    4093                 :            : }
    4094                 :            : 
    4095                 :            : static int ath10k_dfs_fft_report(struct ath10k *ar,
    4096                 :            :                                  struct wmi_phyerr_ev_arg *phyerr,
    4097                 :            :                                  const struct phyerr_fft_report *fftr,
    4098                 :            :                                  u64 tsf)
    4099                 :            : {
    4100                 :            :         u32 reg0, reg1;
    4101                 :            :         u8 rssi, peak_mag;
    4102                 :            : 
    4103                 :            :         reg0 = __le32_to_cpu(fftr->reg0);
    4104                 :            :         reg1 = __le32_to_cpu(fftr->reg1);
    4105                 :            :         rssi = phyerr->rssi_combined;
    4106                 :            : 
    4107                 :            :         ath10k_dbg(ar, ATH10K_DBG_REGULATORY,
    4108                 :            :                    "wmi phyerr fft report total_gain_db %d base_pwr_db %d fft_chn_idx %d peak_sidx %d\n",
    4109                 :            :                    MS(reg0, SEARCH_FFT_REPORT_REG0_TOTAL_GAIN_DB),
    4110                 :            :                    MS(reg0, SEARCH_FFT_REPORT_REG0_BASE_PWR_DB),
    4111                 :            :                    MS(reg0, SEARCH_FFT_REPORT_REG0_FFT_CHN_IDX),
    4112                 :            :                    MS(reg0, SEARCH_FFT_REPORT_REG0_PEAK_SIDX));
    4113                 :            :         ath10k_dbg(ar, ATH10K_DBG_REGULATORY,
    4114                 :            :                    "wmi phyerr fft report rel_pwr_db %d avgpwr_db %d peak_mag %d num_store_bin %d\n",
    4115                 :            :                    MS(reg1, SEARCH_FFT_REPORT_REG1_RELPWR_DB),
    4116                 :            :                    MS(reg1, SEARCH_FFT_REPORT_REG1_AVGPWR_DB),
    4117                 :            :                    MS(reg1, SEARCH_FFT_REPORT_REG1_PEAK_MAG),
    4118                 :            :                    MS(reg1, SEARCH_FFT_REPORT_REG1_NUM_STR_BINS_IB));
    4119                 :            : 
    4120                 :            :         peak_mag = MS(reg1, SEARCH_FFT_REPORT_REG1_PEAK_MAG);
    4121                 :            : 
    4122                 :            :         /* false event detection */
    4123                 :            :         if (rssi == DFS_RSSI_POSSIBLY_FALSE &&
    4124                 :            :             peak_mag < 2 * DFS_PEAK_MAG_THOLD_POSSIBLY_FALSE) {
    4125                 :            :                 ath10k_dbg(ar, ATH10K_DBG_REGULATORY, "dfs false pulse detected\n");
    4126                 :            :                 ATH10K_DFS_STAT_INC(ar, pulses_discarded);
    4127                 :            :                 return -EINVAL;
    4128                 :            :         }
    4129                 :            : 
    4130                 :            :         return 0;
    4131                 :            : }
    4132                 :            : 
    4133                 :          0 : void ath10k_wmi_event_dfs(struct ath10k *ar,
    4134                 :            :                           struct wmi_phyerr_ev_arg *phyerr,
    4135                 :            :                           u64 tsf)
    4136                 :            : {
    4137                 :          0 :         int buf_len, tlv_len, res, i = 0;
    4138                 :          0 :         const struct phyerr_tlv *tlv;
    4139                 :          0 :         const struct phyerr_radar_report *rr;
    4140                 :          0 :         const struct phyerr_fft_report *fftr;
    4141                 :          0 :         const u8 *tlv_buf;
    4142                 :            : 
    4143                 :          0 :         buf_len = phyerr->buf_len;
    4144         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_REGULATORY,
    4145                 :            :                    "wmi event dfs err_code %d rssi %d tsfl 0x%X tsf64 0x%llX len %d\n",
    4146                 :            :                    phyerr->phy_err_code, phyerr->rssi_combined,
    4147                 :            :                    phyerr->tsf_timestamp, tsf, buf_len);
    4148                 :            : 
    4149                 :            :         /* Skip event if DFS disabled */
    4150                 :          0 :         if (!IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED))
    4151                 :          0 :                 return;
    4152                 :            : 
    4153                 :            :         ATH10K_DFS_STAT_INC(ar, pulses_total);
    4154                 :            : 
    4155                 :            :         while (i < buf_len) {
    4156                 :            :                 if (i + sizeof(*tlv) > buf_len) {
    4157                 :            :                         ath10k_warn(ar, "too short buf for tlv header (%d)\n",
    4158                 :            :                                     i);
    4159                 :            :                         return;
    4160                 :            :                 }
    4161                 :            : 
    4162                 :            :                 tlv = (struct phyerr_tlv *)&phyerr->buf[i];
    4163                 :            :                 tlv_len = __le16_to_cpu(tlv->len);
    4164                 :            :                 tlv_buf = &phyerr->buf[i + sizeof(*tlv)];
    4165                 :            :                 ath10k_dbg(ar, ATH10K_DBG_REGULATORY,
    4166                 :            :                            "wmi event dfs tlv_len %d tlv_tag 0x%02X tlv_sig 0x%02X\n",
    4167                 :            :                            tlv_len, tlv->tag, tlv->sig);
    4168                 :            : 
    4169                 :            :                 switch (tlv->tag) {
    4170                 :            :                 case PHYERR_TLV_TAG_RADAR_PULSE_SUMMARY:
    4171                 :            :                         if (i + sizeof(*tlv) + sizeof(*rr) > buf_len) {
    4172                 :            :                                 ath10k_warn(ar, "too short radar pulse summary (%d)\n",
    4173                 :            :                                             i);
    4174                 :            :                                 return;
    4175                 :            :                         }
    4176                 :            : 
    4177                 :            :                         rr = (struct phyerr_radar_report *)tlv_buf;
    4178                 :            :                         ath10k_dfs_radar_report(ar, phyerr, rr, tsf);
    4179                 :            :                         break;
    4180                 :            :                 case PHYERR_TLV_TAG_SEARCH_FFT_REPORT:
    4181                 :            :                         if (i + sizeof(*tlv) + sizeof(*fftr) > buf_len) {
    4182                 :            :                                 ath10k_warn(ar, "too short fft report (%d)\n",
    4183                 :            :                                             i);
    4184                 :            :                                 return;
    4185                 :            :                         }
    4186                 :            : 
    4187                 :            :                         fftr = (struct phyerr_fft_report *)tlv_buf;
    4188                 :            :                         res = ath10k_dfs_fft_report(ar, phyerr, fftr, tsf);
    4189                 :            :                         if (res)
    4190                 :            :                                 return;
    4191                 :            :                         break;
    4192                 :            :                 }
    4193                 :            : 
    4194                 :            :                 i += sizeof(*tlv) + tlv_len;
    4195                 :            :         }
    4196                 :            : }
    4197                 :            : 
    4198                 :          0 : void ath10k_wmi_event_spectral_scan(struct ath10k *ar,
    4199                 :            :                                     struct wmi_phyerr_ev_arg *phyerr,
    4200                 :            :                                     u64 tsf)
    4201                 :            : {
    4202                 :          0 :         int buf_len, tlv_len, res, i = 0;
    4203                 :          0 :         struct phyerr_tlv *tlv;
    4204                 :          0 :         const void *tlv_buf;
    4205                 :          0 :         const struct phyerr_fft_report *fftr;
    4206                 :          0 :         size_t fftr_len;
    4207                 :            : 
    4208                 :          0 :         buf_len = phyerr->buf_len;
    4209                 :            : 
    4210         [ #  # ]:          0 :         while (i < buf_len) {
    4211         [ #  # ]:          0 :                 if (i + sizeof(*tlv) > buf_len) {
    4212                 :          0 :                         ath10k_warn(ar, "failed to parse phyerr tlv header at byte %d\n",
    4213                 :            :                                     i);
    4214                 :          0 :                         return;
    4215                 :            :                 }
    4216                 :            : 
    4217                 :          0 :                 tlv = (struct phyerr_tlv *)&phyerr->buf[i];
    4218                 :          0 :                 tlv_len = __le16_to_cpu(tlv->len);
    4219                 :          0 :                 tlv_buf = &phyerr->buf[i + sizeof(*tlv)];
    4220                 :            : 
    4221         [ #  # ]:          0 :                 if (i + sizeof(*tlv) + tlv_len > buf_len) {
    4222                 :          0 :                         ath10k_warn(ar, "failed to parse phyerr tlv payload at byte %d\n",
    4223                 :            :                                     i);
    4224                 :          0 :                         return;
    4225                 :            :                 }
    4226                 :            : 
    4227         [ #  # ]:          0 :                 switch (tlv->tag) {
    4228                 :          0 :                 case PHYERR_TLV_TAG_SEARCH_FFT_REPORT:
    4229         [ #  # ]:          0 :                         if (sizeof(*fftr) > tlv_len) {
    4230                 :          0 :                                 ath10k_warn(ar, "failed to parse fft report at byte %d\n",
    4231                 :            :                                             i);
    4232                 :          0 :                                 return;
    4233                 :            :                         }
    4234                 :            : 
    4235                 :            :                         fftr_len = tlv_len - sizeof(*fftr);
    4236                 :            :                         fftr = tlv_buf;
    4237                 :            :                         res = ath10k_spectral_process_fft(ar, phyerr,
    4238                 :            :                                                           fftr, fftr_len,
    4239                 :            :                                                           tsf);
    4240                 :            :                         if (res < 0) {
    4241                 :            :                                 ath10k_dbg(ar, ATH10K_DBG_WMI, "failed to process fft report: %d\n",
    4242                 :            :                                            res);
    4243                 :            :                                 return;
    4244                 :            :                         }
    4245                 :            :                         break;
    4246                 :            :                 }
    4247                 :            : 
    4248                 :          0 :                 i += sizeof(*tlv) + tlv_len;
    4249                 :            :         }
    4250                 :            : }
    4251                 :            : 
    4252                 :          0 : static int ath10k_wmi_op_pull_phyerr_ev_hdr(struct ath10k *ar,
    4253                 :            :                                             struct sk_buff *skb,
    4254                 :            :                                             struct wmi_phyerr_hdr_arg *arg)
    4255                 :            : {
    4256                 :          0 :         struct wmi_phyerr_event *ev = (void *)skb->data;
    4257                 :            : 
    4258         [ #  # ]:          0 :         if (skb->len < sizeof(*ev))
    4259                 :            :                 return -EPROTO;
    4260                 :            : 
    4261                 :          0 :         arg->num_phyerrs = __le32_to_cpu(ev->num_phyerrs);
    4262                 :          0 :         arg->tsf_l32 = __le32_to_cpu(ev->tsf_l32);
    4263                 :          0 :         arg->tsf_u32 = __le32_to_cpu(ev->tsf_u32);
    4264                 :          0 :         arg->buf_len = skb->len - sizeof(*ev);
    4265                 :          0 :         arg->phyerrs = ev->phyerrs;
    4266                 :            : 
    4267                 :          0 :         return 0;
    4268                 :            : }
    4269                 :            : 
    4270                 :          0 : static int ath10k_wmi_10_4_op_pull_phyerr_ev_hdr(struct ath10k *ar,
    4271                 :            :                                                  struct sk_buff *skb,
    4272                 :            :                                                  struct wmi_phyerr_hdr_arg *arg)
    4273                 :            : {
    4274                 :          0 :         struct wmi_10_4_phyerr_event *ev = (void *)skb->data;
    4275                 :            : 
    4276         [ #  # ]:          0 :         if (skb->len < sizeof(*ev))
    4277                 :            :                 return -EPROTO;
    4278                 :            : 
    4279                 :            :         /* 10.4 firmware always reports only one phyerr */
    4280                 :          0 :         arg->num_phyerrs = 1;
    4281                 :            : 
    4282                 :          0 :         arg->tsf_l32 = __le32_to_cpu(ev->tsf_l32);
    4283                 :          0 :         arg->tsf_u32 = __le32_to_cpu(ev->tsf_u32);
    4284                 :          0 :         arg->buf_len = skb->len;
    4285                 :          0 :         arg->phyerrs = skb->data;
    4286                 :            : 
    4287                 :          0 :         return 0;
    4288                 :            : }
    4289                 :            : 
    4290                 :          0 : int ath10k_wmi_op_pull_phyerr_ev(struct ath10k *ar,
    4291                 :            :                                  const void *phyerr_buf,
    4292                 :            :                                  int left_len,
    4293                 :            :                                  struct wmi_phyerr_ev_arg *arg)
    4294                 :            : {
    4295                 :          0 :         const struct wmi_phyerr *phyerr = phyerr_buf;
    4296                 :          0 :         int i;
    4297                 :            : 
    4298         [ #  # ]:          0 :         if (left_len < sizeof(*phyerr)) {
    4299                 :          0 :                 ath10k_warn(ar, "wrong phyerr event head len %d (need: >=%zd)\n",
    4300                 :            :                             left_len, sizeof(*phyerr));
    4301                 :          0 :                 return -EINVAL;
    4302                 :            :         }
    4303                 :            : 
    4304                 :          0 :         arg->tsf_timestamp = __le32_to_cpu(phyerr->tsf_timestamp);
    4305                 :          0 :         arg->freq1 = __le16_to_cpu(phyerr->freq1);
    4306                 :          0 :         arg->freq2 = __le16_to_cpu(phyerr->freq2);
    4307                 :          0 :         arg->rssi_combined = phyerr->rssi_combined;
    4308                 :          0 :         arg->chan_width_mhz = phyerr->chan_width_mhz;
    4309                 :          0 :         arg->buf_len = __le32_to_cpu(phyerr->buf_len);
    4310                 :          0 :         arg->buf = phyerr->buf;
    4311                 :          0 :         arg->hdr_len = sizeof(*phyerr);
    4312                 :            : 
    4313         [ #  # ]:          0 :         for (i = 0; i < 4; i++)
    4314                 :          0 :                 arg->nf_chains[i] = __le16_to_cpu(phyerr->nf_chains[i]);
    4315                 :            : 
    4316   [ #  #  #  # ]:          0 :         switch (phyerr->phy_err_code) {
    4317                 :          0 :         case PHY_ERROR_GEN_SPECTRAL_SCAN:
    4318                 :          0 :                 arg->phy_err_code = PHY_ERROR_SPECTRAL_SCAN;
    4319                 :          0 :                 break;
    4320                 :          0 :         case PHY_ERROR_GEN_FALSE_RADAR_EXT:
    4321                 :          0 :                 arg->phy_err_code = PHY_ERROR_FALSE_RADAR_EXT;
    4322                 :          0 :                 break;
    4323                 :          0 :         case PHY_ERROR_GEN_RADAR:
    4324                 :          0 :                 arg->phy_err_code = PHY_ERROR_RADAR;
    4325                 :          0 :                 break;
    4326                 :          0 :         default:
    4327                 :          0 :                 arg->phy_err_code = PHY_ERROR_UNKNOWN;
    4328                 :          0 :                 break;
    4329                 :            :         }
    4330                 :            : 
    4331                 :            :         return 0;
    4332                 :            : }
    4333                 :            : 
    4334                 :          0 : static int ath10k_wmi_10_4_op_pull_phyerr_ev(struct ath10k *ar,
    4335                 :            :                                              const void *phyerr_buf,
    4336                 :            :                                              int left_len,
    4337                 :            :                                              struct wmi_phyerr_ev_arg *arg)
    4338                 :            : {
    4339                 :          0 :         const struct wmi_10_4_phyerr_event *phyerr = phyerr_buf;
    4340                 :          0 :         u32 phy_err_mask;
    4341                 :          0 :         int i;
    4342                 :            : 
    4343         [ #  # ]:          0 :         if (left_len < sizeof(*phyerr)) {
    4344                 :          0 :                 ath10k_warn(ar, "wrong phyerr event head len %d (need: >=%zd)\n",
    4345                 :            :                             left_len, sizeof(*phyerr));
    4346                 :          0 :                 return -EINVAL;
    4347                 :            :         }
    4348                 :            : 
    4349                 :          0 :         arg->tsf_timestamp = __le32_to_cpu(phyerr->tsf_timestamp);
    4350                 :          0 :         arg->freq1 = __le16_to_cpu(phyerr->freq1);
    4351                 :          0 :         arg->freq2 = __le16_to_cpu(phyerr->freq2);
    4352                 :          0 :         arg->rssi_combined = phyerr->rssi_combined;
    4353                 :          0 :         arg->chan_width_mhz = phyerr->chan_width_mhz;
    4354                 :          0 :         arg->buf_len = __le32_to_cpu(phyerr->buf_len);
    4355                 :          0 :         arg->buf = phyerr->buf;
    4356                 :          0 :         arg->hdr_len = sizeof(*phyerr);
    4357                 :            : 
    4358         [ #  # ]:          0 :         for (i = 0; i < 4; i++)
    4359                 :          0 :                 arg->nf_chains[i] = __le16_to_cpu(phyerr->nf_chains[i]);
    4360                 :            : 
    4361                 :          0 :         phy_err_mask = __le32_to_cpu(phyerr->phy_err_mask[0]);
    4362                 :            : 
    4363         [ #  # ]:          0 :         if (phy_err_mask & PHY_ERROR_10_4_SPECTRAL_SCAN_MASK)
    4364                 :          0 :                 arg->phy_err_code = PHY_ERROR_SPECTRAL_SCAN;
    4365         [ #  # ]:          0 :         else if (phy_err_mask & PHY_ERROR_10_4_RADAR_MASK)
    4366                 :          0 :                 arg->phy_err_code = PHY_ERROR_RADAR;
    4367                 :            :         else
    4368                 :          0 :                 arg->phy_err_code = PHY_ERROR_UNKNOWN;
    4369                 :            : 
    4370                 :            :         return 0;
    4371                 :            : }
    4372                 :            : 
    4373                 :          0 : void ath10k_wmi_event_phyerr(struct ath10k *ar, struct sk_buff *skb)
    4374                 :            : {
    4375                 :          0 :         struct wmi_phyerr_hdr_arg hdr_arg = {};
    4376                 :          0 :         struct wmi_phyerr_ev_arg phyerr_arg = {};
    4377                 :          0 :         const void *phyerr;
    4378                 :          0 :         u32 count, i, buf_len, phy_err_code;
    4379                 :          0 :         u64 tsf;
    4380                 :          0 :         int left_len, ret;
    4381                 :            : 
    4382                 :          0 :         ATH10K_DFS_STAT_INC(ar, phy_errors);
    4383                 :            : 
    4384         [ #  # ]:          0 :         ret = ath10k_wmi_pull_phyerr_hdr(ar, skb, &hdr_arg);
    4385         [ #  # ]:          0 :         if (ret) {
    4386                 :          0 :                 ath10k_warn(ar, "failed to parse phyerr event hdr: %d\n", ret);
    4387                 :          0 :                 return;
    4388                 :            :         }
    4389                 :            : 
    4390                 :            :         /* Check number of included events */
    4391                 :          0 :         count = hdr_arg.num_phyerrs;
    4392                 :            : 
    4393                 :          0 :         left_len = hdr_arg.buf_len;
    4394                 :            : 
    4395                 :          0 :         tsf = hdr_arg.tsf_u32;
    4396                 :          0 :         tsf <<= 32;
    4397                 :          0 :         tsf |= hdr_arg.tsf_l32;
    4398                 :            : 
    4399         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    4400                 :            :                    "wmi event phyerr count %d tsf64 0x%llX\n",
    4401                 :            :                    count, tsf);
    4402                 :            : 
    4403                 :          0 :         phyerr = hdr_arg.phyerrs;
    4404         [ #  # ]:          0 :         for (i = 0; i < count; i++) {
    4405         [ #  # ]:          0 :                 ret = ath10k_wmi_pull_phyerr(ar, phyerr, left_len, &phyerr_arg);
    4406         [ #  # ]:          0 :                 if (ret) {
    4407                 :          0 :                         ath10k_warn(ar, "failed to parse phyerr event (%d)\n",
    4408                 :            :                                     i);
    4409                 :          0 :                         return;
    4410                 :            :                 }
    4411                 :            : 
    4412                 :          0 :                 left_len -= phyerr_arg.hdr_len;
    4413                 :          0 :                 buf_len = phyerr_arg.buf_len;
    4414                 :          0 :                 phy_err_code = phyerr_arg.phy_err_code;
    4415                 :            : 
    4416         [ #  # ]:          0 :                 if (left_len < buf_len) {
    4417                 :          0 :                         ath10k_warn(ar, "single event (%d) wrong buf len\n", i);
    4418                 :          0 :                         return;
    4419                 :            :                 }
    4420                 :            : 
    4421                 :          0 :                 left_len -= buf_len;
    4422                 :            : 
    4423   [ #  #  #  # ]:          0 :                 switch (phy_err_code) {
    4424                 :          0 :                 case PHY_ERROR_RADAR:
    4425                 :          0 :                         ath10k_wmi_event_dfs(ar, &phyerr_arg, tsf);
    4426                 :          0 :                         break;
    4427                 :          0 :                 case PHY_ERROR_SPECTRAL_SCAN:
    4428                 :          0 :                         ath10k_wmi_event_spectral_scan(ar, &phyerr_arg, tsf);
    4429                 :          0 :                         break;
    4430                 :          0 :                 case PHY_ERROR_FALSE_RADAR_EXT:
    4431                 :          0 :                         ath10k_wmi_event_dfs(ar, &phyerr_arg, tsf);
    4432                 :          0 :                         ath10k_wmi_event_spectral_scan(ar, &phyerr_arg, tsf);
    4433                 :          0 :                         break;
    4434                 :            :                 default:
    4435                 :            :                         break;
    4436                 :            :                 }
    4437                 :            : 
    4438                 :          0 :                 phyerr = phyerr + phyerr_arg.hdr_len + buf_len;
    4439                 :            :         }
    4440                 :            : }
    4441                 :            : 
    4442                 :            : static int
    4443                 :          0 : ath10k_wmi_10_4_op_pull_dfs_status_ev(struct ath10k *ar, struct sk_buff *skb,
    4444                 :            :                                       struct wmi_dfs_status_ev_arg *arg)
    4445                 :            : {
    4446                 :          0 :         struct wmi_dfs_status_ev_arg *ev = (void *)skb->data;
    4447                 :            : 
    4448         [ #  # ]:          0 :         if (skb->len < sizeof(*ev))
    4449                 :            :                 return -EPROTO;
    4450                 :            : 
    4451                 :          0 :         arg->status = ev->status;
    4452                 :            : 
    4453                 :          0 :         return 0;
    4454                 :            : }
    4455                 :            : 
    4456                 :            : static void
    4457                 :          0 : ath10k_wmi_event_dfs_status_check(struct ath10k *ar, struct sk_buff *skb)
    4458                 :            : {
    4459                 :          0 :         struct wmi_dfs_status_ev_arg status_arg = {};
    4460                 :          0 :         int ret;
    4461                 :            : 
    4462         [ #  # ]:          0 :         ret = ath10k_wmi_pull_dfs_status(ar, skb, &status_arg);
    4463                 :            : 
    4464         [ #  # ]:          0 :         if (ret) {
    4465                 :          0 :                 ath10k_warn(ar, "failed to parse dfs status event: %d\n", ret);
    4466                 :          0 :                 return;
    4467                 :            :         }
    4468                 :            : 
    4469         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_REGULATORY,
    4470                 :            :                    "dfs status event received from fw: %d\n",
    4471                 :            :                    status_arg.status);
    4472                 :            : 
    4473                 :            :         /* Even in case of radar detection failure we follow the same
    4474                 :            :          * behaviour as if radar is detected i.e to switch to a different
    4475                 :            :          * channel.
    4476                 :            :          */
    4477         [ #  # ]:          0 :         if (status_arg.status == WMI_HW_RADAR_DETECTED ||
    4478                 :            :             status_arg.status == WMI_RADAR_DETECTION_FAIL)
    4479                 :          0 :                 ath10k_radar_detected(ar);
    4480                 :          0 :         complete(&ar->wmi.radar_confirm);
    4481                 :            : }
    4482                 :            : 
    4483                 :          0 : void ath10k_wmi_event_roam(struct ath10k *ar, struct sk_buff *skb)
    4484                 :            : {
    4485                 :          0 :         struct wmi_roam_ev_arg arg = {};
    4486                 :          0 :         int ret;
    4487                 :          0 :         u32 vdev_id;
    4488                 :          0 :         u32 reason;
    4489                 :          0 :         s32 rssi;
    4490                 :            : 
    4491         [ #  # ]:          0 :         ret = ath10k_wmi_pull_roam_ev(ar, skb, &arg);
    4492         [ #  # ]:          0 :         if (ret) {
    4493                 :          0 :                 ath10k_warn(ar, "failed to parse roam event: %d\n", ret);
    4494                 :          0 :                 return;
    4495                 :            :         }
    4496                 :            : 
    4497                 :          0 :         vdev_id = __le32_to_cpu(arg.vdev_id);
    4498                 :          0 :         reason = __le32_to_cpu(arg.reason);
    4499                 :          0 :         rssi = __le32_to_cpu(arg.rssi);
    4500                 :          0 :         rssi += WMI_SPECTRAL_NOISE_FLOOR_REF_DEFAULT;
    4501                 :            : 
    4502         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    4503                 :            :                    "wmi roam event vdev %u reason 0x%08x rssi %d\n",
    4504                 :            :                    vdev_id, reason, rssi);
    4505                 :            : 
    4506         [ #  # ]:          0 :         if (reason >= WMI_ROAM_REASON_MAX)
    4507                 :          0 :                 ath10k_warn(ar, "ignoring unknown roam event reason %d on vdev %i\n",
    4508                 :            :                             reason, vdev_id);
    4509                 :            : 
    4510      [ #  #  # ]:          0 :         switch (reason) {
    4511                 :          0 :         case WMI_ROAM_REASON_BEACON_MISS:
    4512                 :          0 :                 ath10k_mac_handle_beacon_miss(ar, vdev_id);
    4513                 :          0 :                 break;
    4514                 :          0 :         case WMI_ROAM_REASON_BETTER_AP:
    4515                 :            :         case WMI_ROAM_REASON_LOW_RSSI:
    4516                 :            :         case WMI_ROAM_REASON_SUITABLE_AP_FOUND:
    4517                 :            :         case WMI_ROAM_REASON_HO_FAILED:
    4518                 :          0 :                 ath10k_warn(ar, "ignoring not implemented roam event reason %d on vdev %i\n",
    4519                 :            :                             reason, vdev_id);
    4520                 :          0 :                 break;
    4521                 :            :         }
    4522                 :          0 : }
    4523                 :            : 
    4524                 :          0 : void ath10k_wmi_event_profile_match(struct ath10k *ar, struct sk_buff *skb)
    4525                 :            : {
    4526         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_PROFILE_MATCH\n");
    4527                 :          0 : }
    4528                 :            : 
    4529                 :          0 : void ath10k_wmi_event_debug_print(struct ath10k *ar, struct sk_buff *skb)
    4530                 :            : {
    4531                 :          0 :         char buf[101], c;
    4532                 :          0 :         int i;
    4533                 :            : 
    4534         [ #  # ]:          0 :         for (i = 0; i < sizeof(buf) - 1; i++) {
    4535         [ #  # ]:          0 :                 if (i >= skb->len)
    4536                 :            :                         break;
    4537                 :            : 
    4538                 :          0 :                 c = skb->data[i];
    4539                 :            : 
    4540         [ #  # ]:          0 :                 if (c == '\0')
    4541                 :            :                         break;
    4542                 :            : 
    4543   [ #  #  #  # ]:          0 :                 if (isascii(c) && isprint(c))
    4544                 :          0 :                         buf[i] = c;
    4545                 :            :                 else
    4546                 :          0 :                         buf[i] = '.';
    4547                 :            :         }
    4548                 :            : 
    4549         [ #  # ]:          0 :         if (i == sizeof(buf) - 1)
    4550                 :          0 :                 ath10k_warn(ar, "wmi debug print truncated: %d\n", skb->len);
    4551                 :            : 
    4552                 :            :         /* for some reason the debug prints end with \n, remove that */
    4553         [ #  # ]:          0 :         if (skb->data[i - 1] == '\n')
    4554                 :          0 :                 i--;
    4555                 :            : 
    4556                 :            :         /* the last byte is always reserved for the null character */
    4557                 :          0 :         buf[i] = '\0';
    4558                 :            : 
    4559         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI_PRINT, "wmi print '%s'\n", buf);
    4560                 :          0 : }
    4561                 :            : 
    4562                 :          0 : void ath10k_wmi_event_pdev_qvit(struct ath10k *ar, struct sk_buff *skb)
    4563                 :            : {
    4564         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_PDEV_QVIT_EVENTID\n");
    4565                 :          0 : }
    4566                 :            : 
    4567                 :          0 : void ath10k_wmi_event_wlan_profile_data(struct ath10k *ar, struct sk_buff *skb)
    4568                 :            : {
    4569         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_WLAN_PROFILE_DATA_EVENTID\n");
    4570                 :          0 : }
    4571                 :            : 
    4572                 :          0 : void ath10k_wmi_event_rtt_measurement_report(struct ath10k *ar,
    4573                 :            :                                              struct sk_buff *skb)
    4574                 :            : {
    4575         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_RTT_MEASUREMENT_REPORT_EVENTID\n");
    4576                 :          0 : }
    4577                 :            : 
    4578                 :          0 : void ath10k_wmi_event_tsf_measurement_report(struct ath10k *ar,
    4579                 :            :                                              struct sk_buff *skb)
    4580                 :            : {
    4581         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_TSF_MEASUREMENT_REPORT_EVENTID\n");
    4582                 :          0 : }
    4583                 :            : 
    4584                 :          0 : void ath10k_wmi_event_rtt_error_report(struct ath10k *ar, struct sk_buff *skb)
    4585                 :            : {
    4586         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_RTT_ERROR_REPORT_EVENTID\n");
    4587                 :          0 : }
    4588                 :            : 
    4589                 :          0 : void ath10k_wmi_event_wow_wakeup_host(struct ath10k *ar, struct sk_buff *skb)
    4590                 :            : {
    4591                 :          0 :         struct wmi_wow_ev_arg ev = {};
    4592                 :          0 :         int ret;
    4593                 :            : 
    4594                 :          0 :         complete(&ar->wow.wakeup_completed);
    4595                 :            : 
    4596         [ #  # ]:          0 :         ret = ath10k_wmi_pull_wow_event(ar, skb, &ev);
    4597         [ #  # ]:          0 :         if (ret) {
    4598                 :          0 :                 ath10k_warn(ar, "failed to parse wow wakeup event: %d\n", ret);
    4599                 :          0 :                 return;
    4600                 :            :         }
    4601                 :            : 
    4602         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wow wakeup host reason %s\n",
    4603                 :            :                    wow_reason(ev.wake_reason));
    4604                 :            : }
    4605                 :            : 
    4606                 :          0 : void ath10k_wmi_event_dcs_interference(struct ath10k *ar, struct sk_buff *skb)
    4607                 :            : {
    4608         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_DCS_INTERFERENCE_EVENTID\n");
    4609                 :          0 : }
    4610                 :            : 
    4611                 :          0 : static u8 ath10k_tpc_config_get_rate(struct ath10k *ar,
    4612                 :            :                                      struct wmi_pdev_tpc_config_event *ev,
    4613                 :            :                                      u32 rate_idx, u32 num_chains,
    4614                 :            :                                      u32 rate_code, u8 type)
    4615                 :            : {
    4616                 :          0 :         u8 tpc, num_streams, preamble, ch, stm_idx;
    4617                 :            : 
    4618                 :          0 :         num_streams = ATH10K_HW_NSS(rate_code);
    4619                 :          0 :         preamble = ATH10K_HW_PREAMBLE(rate_code);
    4620                 :          0 :         ch = num_chains - 1;
    4621                 :            : 
    4622                 :          0 :         tpc = min_t(u8, ev->rates_array[rate_idx], ev->max_reg_allow_pow[ch]);
    4623                 :            : 
    4624         [ #  # ]:          0 :         if (__le32_to_cpu(ev->num_tx_chain) <= 1)
    4625                 :          0 :                 goto out;
    4626                 :            : 
    4627         [ #  # ]:          0 :         if (preamble == WMI_RATE_PREAMBLE_CCK)
    4628                 :          0 :                 goto out;
    4629                 :            : 
    4630                 :          0 :         stm_idx = num_streams - 1;
    4631         [ #  # ]:          0 :         if (num_chains <= num_streams)
    4632                 :          0 :                 goto out;
    4633                 :            : 
    4634   [ #  #  #  # ]:          0 :         switch (type) {
    4635                 :          0 :         case WMI_TPC_TABLE_TYPE_STBC:
    4636                 :          0 :                 tpc = min_t(u8, tpc,
    4637                 :            :                             ev->max_reg_allow_pow_agstbc[ch - 1][stm_idx]);
    4638                 :          0 :                 break;
    4639                 :          0 :         case WMI_TPC_TABLE_TYPE_TXBF:
    4640                 :          0 :                 tpc = min_t(u8, tpc,
    4641                 :            :                             ev->max_reg_allow_pow_agtxbf[ch - 1][stm_idx]);
    4642                 :          0 :                 break;
    4643                 :          0 :         case WMI_TPC_TABLE_TYPE_CDD:
    4644                 :          0 :                 tpc = min_t(u8, tpc,
    4645                 :            :                             ev->max_reg_allow_pow_agcdd[ch - 1][stm_idx]);
    4646                 :          0 :                 break;
    4647                 :          0 :         default:
    4648                 :          0 :                 ath10k_warn(ar, "unknown wmi tpc table type: %d\n", type);
    4649                 :          0 :                 tpc = 0;
    4650                 :          0 :                 break;
    4651                 :            :         }
    4652                 :            : 
    4653                 :          0 : out:
    4654                 :          0 :         return tpc;
    4655                 :            : }
    4656                 :            : 
    4657                 :          0 : static void ath10k_tpc_config_disp_tables(struct ath10k *ar,
    4658                 :            :                                           struct wmi_pdev_tpc_config_event *ev,
    4659                 :            :                                           struct ath10k_tpc_stats *tpc_stats,
    4660                 :            :                                           u8 *rate_code, u16 *pream_table, u8 type)
    4661                 :            : {
    4662                 :          0 :         u32 i, j, pream_idx, flags;
    4663                 :          0 :         u8 tpc[WMI_TPC_TX_N_CHAIN];
    4664                 :          0 :         char tpc_value[WMI_TPC_TX_N_CHAIN * WMI_TPC_BUF_SIZE];
    4665                 :          0 :         char buff[WMI_TPC_BUF_SIZE];
    4666                 :            : 
    4667                 :          0 :         flags = __le32_to_cpu(ev->flags);
    4668                 :            : 
    4669   [ #  #  #  # ]:          0 :         switch (type) {
    4670                 :          0 :         case WMI_TPC_TABLE_TYPE_CDD:
    4671         [ #  # ]:          0 :                 if (!(flags & WMI_TPC_CONFIG_EVENT_FLAG_TABLE_CDD)) {
    4672         [ #  # ]:          0 :                         ath10k_dbg(ar, ATH10K_DBG_WMI, "CDD not supported\n");
    4673                 :          0 :                         tpc_stats->flag[type] = ATH10K_TPC_TABLE_TYPE_FLAG;
    4674                 :          0 :                         return;
    4675                 :            :                 }
    4676                 :            :                 break;
    4677                 :          0 :         case WMI_TPC_TABLE_TYPE_STBC:
    4678         [ #  # ]:          0 :                 if (!(flags & WMI_TPC_CONFIG_EVENT_FLAG_TABLE_STBC)) {
    4679         [ #  # ]:          0 :                         ath10k_dbg(ar, ATH10K_DBG_WMI, "STBC not supported\n");
    4680                 :          0 :                         tpc_stats->flag[type] = ATH10K_TPC_TABLE_TYPE_FLAG;
    4681                 :          0 :                         return;
    4682                 :            :                 }
    4683                 :            :                 break;
    4684                 :          0 :         case WMI_TPC_TABLE_TYPE_TXBF:
    4685         [ #  # ]:          0 :                 if (!(flags & WMI_TPC_CONFIG_EVENT_FLAG_TABLE_TXBF)) {
    4686         [ #  # ]:          0 :                         ath10k_dbg(ar, ATH10K_DBG_WMI, "TXBF not supported\n");
    4687                 :          0 :                         tpc_stats->flag[type] = ATH10K_TPC_TABLE_TYPE_FLAG;
    4688                 :          0 :                         return;
    4689                 :            :                 }
    4690                 :            :                 break;
    4691                 :          0 :         default:
    4692         [ #  # ]:          0 :                 ath10k_dbg(ar, ATH10K_DBG_WMI,
    4693                 :            :                            "invalid table type in wmi tpc event: %d\n", type);
    4694                 :            :                 return;
    4695                 :            :         }
    4696                 :            : 
    4697                 :            :         pream_idx = 0;
    4698         [ #  # ]:          0 :         for (i = 0; i < tpc_stats->rate_max; i++) {
    4699                 :          0 :                 memset(tpc_value, 0, sizeof(tpc_value));
    4700                 :          0 :                 memset(buff, 0, sizeof(buff));
    4701         [ #  # ]:          0 :                 if (i == pream_table[pream_idx])
    4702                 :          0 :                         pream_idx++;
    4703                 :            : 
    4704         [ #  # ]:          0 :                 for (j = 0; j < tpc_stats->num_tx_chain; j++) {
    4705                 :          0 :                         tpc[j] = ath10k_tpc_config_get_rate(ar, ev, i, j + 1,
    4706                 :          0 :                                                             rate_code[i],
    4707                 :            :                                                             type);
    4708                 :          0 :                         snprintf(buff, sizeof(buff), "%8d ", tpc[j]);
    4709                 :          0 :                         strlcat(tpc_value, buff, sizeof(tpc_value));
    4710                 :            :                 }
    4711                 :          0 :                 tpc_stats->tpc_table[type].pream_idx[i] = pream_idx;
    4712                 :          0 :                 tpc_stats->tpc_table[type].rate_code[i] = rate_code[i];
    4713                 :          0 :                 memcpy(tpc_stats->tpc_table[type].tpc_value[i],
    4714                 :            :                        tpc_value, sizeof(tpc_value));
    4715                 :            :         }
    4716                 :            : }
    4717                 :            : 
    4718                 :          0 : void ath10k_wmi_tpc_config_get_rate_code(u8 *rate_code, u16 *pream_table,
    4719                 :            :                                          u32 num_tx_chain)
    4720                 :            : {
    4721                 :          0 :         u32 i, j, pream_idx;
    4722                 :          0 :         u8 rate_idx;
    4723                 :            : 
    4724                 :            :         /* Create the rate code table based on the chains supported */
    4725                 :          0 :         rate_idx = 0;
    4726                 :          0 :         pream_idx = 0;
    4727                 :            : 
    4728                 :            :         /* Fill CCK rate code */
    4729         [ #  # ]:          0 :         for (i = 0; i < 4; i++) {
    4730                 :          0 :                 rate_code[rate_idx] =
    4731                 :          0 :                         ATH10K_HW_RATECODE(i, 0, WMI_RATE_PREAMBLE_CCK);
    4732                 :          0 :                 rate_idx++;
    4733                 :            :         }
    4734                 :          0 :         pream_table[pream_idx] = rate_idx;
    4735                 :          0 :         pream_idx++;
    4736                 :            : 
    4737                 :            :         /* Fill OFDM rate code */
    4738         [ #  # ]:          0 :         for (i = 0; i < 8; i++) {
    4739                 :          0 :                 rate_code[rate_idx] =
    4740                 :            :                         ATH10K_HW_RATECODE(i, 0, WMI_RATE_PREAMBLE_OFDM);
    4741                 :          0 :                 rate_idx++;
    4742                 :            :         }
    4743                 :          0 :         pream_table[pream_idx] = rate_idx;
    4744                 :          0 :         pream_idx++;
    4745                 :            : 
    4746                 :            :         /* Fill HT20 rate code */
    4747         [ #  # ]:          0 :         for (i = 0; i < num_tx_chain; i++) {
    4748         [ #  # ]:          0 :                 for (j = 0; j < 8; j++) {
    4749                 :          0 :                         rate_code[rate_idx] =
    4750                 :          0 :                         ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_HT);
    4751                 :          0 :                         rate_idx++;
    4752                 :            :                 }
    4753                 :            :         }
    4754                 :          0 :         pream_table[pream_idx] = rate_idx;
    4755                 :          0 :         pream_idx++;
    4756                 :            : 
    4757                 :            :         /* Fill HT40 rate code */
    4758         [ #  # ]:          0 :         for (i = 0; i < num_tx_chain; i++) {
    4759         [ #  # ]:          0 :                 for (j = 0; j < 8; j++) {
    4760                 :          0 :                         rate_code[rate_idx] =
    4761                 :          0 :                         ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_HT);
    4762                 :          0 :                         rate_idx++;
    4763                 :            :                 }
    4764                 :            :         }
    4765                 :          0 :         pream_table[pream_idx] = rate_idx;
    4766                 :          0 :         pream_idx++;
    4767                 :            : 
    4768                 :            :         /* Fill VHT20 rate code */
    4769         [ #  # ]:          0 :         for (i = 0; i < num_tx_chain; i++) {
    4770         [ #  # ]:          0 :                 for (j = 0; j < 10; j++) {
    4771                 :          0 :                         rate_code[rate_idx] =
    4772                 :          0 :                         ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_VHT);
    4773                 :          0 :                         rate_idx++;
    4774                 :            :                 }
    4775                 :            :         }
    4776                 :          0 :         pream_table[pream_idx] = rate_idx;
    4777                 :          0 :         pream_idx++;
    4778                 :            : 
    4779                 :            :         /* Fill VHT40 rate code */
    4780         [ #  # ]:          0 :         for (i = 0; i < num_tx_chain; i++) {
    4781         [ #  # ]:          0 :                 for (j = 0; j < 10; j++) {
    4782                 :          0 :                         rate_code[rate_idx] =
    4783                 :          0 :                         ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_VHT);
    4784                 :          0 :                         rate_idx++;
    4785                 :            :                 }
    4786                 :            :         }
    4787                 :          0 :         pream_table[pream_idx] = rate_idx;
    4788                 :          0 :         pream_idx++;
    4789                 :            : 
    4790                 :            :         /* Fill VHT80 rate code */
    4791         [ #  # ]:          0 :         for (i = 0; i < num_tx_chain; i++) {
    4792         [ #  # ]:          0 :                 for (j = 0; j < 10; j++) {
    4793                 :          0 :                         rate_code[rate_idx] =
    4794                 :          0 :                         ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_VHT);
    4795                 :          0 :                         rate_idx++;
    4796                 :            :                 }
    4797                 :            :         }
    4798                 :          0 :         pream_table[pream_idx] = rate_idx;
    4799                 :          0 :         pream_idx++;
    4800                 :            : 
    4801                 :          0 :         rate_code[rate_idx++] =
    4802                 :            :                 ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_CCK);
    4803                 :          0 :         rate_code[rate_idx++] =
    4804                 :            :                 ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_OFDM);
    4805                 :          0 :         rate_code[rate_idx++] =
    4806                 :            :                 ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_CCK);
    4807                 :          0 :         rate_code[rate_idx++] =
    4808                 :            :                 ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_OFDM);
    4809                 :          0 :         rate_code[rate_idx++] =
    4810                 :            :                 ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_OFDM);
    4811                 :            : 
    4812                 :          0 :         pream_table[pream_idx] = ATH10K_TPC_PREAM_TABLE_END;
    4813                 :          0 : }
    4814                 :            : 
    4815                 :          0 : void ath10k_wmi_event_pdev_tpc_config(struct ath10k *ar, struct sk_buff *skb)
    4816                 :            : {
    4817                 :          0 :         u32 num_tx_chain, rate_max;
    4818                 :          0 :         u8 rate_code[WMI_TPC_RATE_MAX];
    4819                 :          0 :         u16 pream_table[WMI_TPC_PREAM_TABLE_MAX];
    4820                 :          0 :         struct wmi_pdev_tpc_config_event *ev;
    4821                 :          0 :         struct ath10k_tpc_stats *tpc_stats;
    4822                 :            : 
    4823                 :          0 :         ev = (struct wmi_pdev_tpc_config_event *)skb->data;
    4824                 :            : 
    4825                 :          0 :         num_tx_chain = __le32_to_cpu(ev->num_tx_chain);
    4826                 :            : 
    4827         [ #  # ]:          0 :         if (num_tx_chain > WMI_TPC_TX_N_CHAIN) {
    4828                 :          0 :                 ath10k_warn(ar, "number of tx chain is %d greater than TPC configured tx chain %d\n",
    4829                 :            :                             num_tx_chain, WMI_TPC_TX_N_CHAIN);
    4830                 :          0 :                 return;
    4831                 :            :         }
    4832                 :            : 
    4833                 :          0 :         rate_max = __le32_to_cpu(ev->rate_max);
    4834         [ #  # ]:          0 :         if (rate_max > WMI_TPC_RATE_MAX) {
    4835                 :          0 :                 ath10k_warn(ar, "number of rate is %d greater than TPC configured rate %d\n",
    4836                 :            :                             rate_max, WMI_TPC_RATE_MAX);
    4837                 :          0 :                 rate_max = WMI_TPC_RATE_MAX;
    4838                 :            :         }
    4839                 :            : 
    4840                 :          0 :         tpc_stats = kzalloc(sizeof(*tpc_stats), GFP_ATOMIC);
    4841         [ #  # ]:          0 :         if (!tpc_stats)
    4842                 :            :                 return;
    4843                 :            : 
    4844                 :          0 :         ath10k_wmi_tpc_config_get_rate_code(rate_code, pream_table,
    4845                 :            :                                             num_tx_chain);
    4846                 :            : 
    4847                 :          0 :         tpc_stats->chan_freq = __le32_to_cpu(ev->chan_freq);
    4848                 :          0 :         tpc_stats->phy_mode = __le32_to_cpu(ev->phy_mode);
    4849                 :          0 :         tpc_stats->ctl = __le32_to_cpu(ev->ctl);
    4850                 :          0 :         tpc_stats->reg_domain = __le32_to_cpu(ev->reg_domain);
    4851                 :          0 :         tpc_stats->twice_antenna_gain = a_sle32_to_cpu(ev->twice_antenna_gain);
    4852                 :          0 :         tpc_stats->twice_antenna_reduction =
    4853                 :          0 :                 __le32_to_cpu(ev->twice_antenna_reduction);
    4854                 :          0 :         tpc_stats->power_limit = __le32_to_cpu(ev->power_limit);
    4855                 :          0 :         tpc_stats->twice_max_rd_power = __le32_to_cpu(ev->twice_max_rd_power);
    4856                 :          0 :         tpc_stats->num_tx_chain = num_tx_chain;
    4857                 :          0 :         tpc_stats->rate_max = rate_max;
    4858                 :            : 
    4859                 :          0 :         ath10k_tpc_config_disp_tables(ar, ev, tpc_stats,
    4860                 :            :                                       rate_code, pream_table,
    4861                 :            :                                       WMI_TPC_TABLE_TYPE_CDD);
    4862                 :          0 :         ath10k_tpc_config_disp_tables(ar, ev,  tpc_stats,
    4863                 :            :                                       rate_code, pream_table,
    4864                 :            :                                       WMI_TPC_TABLE_TYPE_STBC);
    4865                 :          0 :         ath10k_tpc_config_disp_tables(ar, ev, tpc_stats,
    4866                 :            :                                       rate_code, pream_table,
    4867                 :            :                                       WMI_TPC_TABLE_TYPE_TXBF);
    4868                 :            : 
    4869                 :          0 :         ath10k_debug_tpc_stats_process(ar, tpc_stats);
    4870                 :            : 
    4871         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    4872                 :            :                    "wmi event tpc config channel %d mode %d ctl %d regd %d gain %d %d limit %d max_power %d tx_chanins %d rates %d\n",
    4873                 :            :                    __le32_to_cpu(ev->chan_freq),
    4874                 :            :                    __le32_to_cpu(ev->phy_mode),
    4875                 :            :                    __le32_to_cpu(ev->ctl),
    4876                 :            :                    __le32_to_cpu(ev->reg_domain),
    4877                 :            :                    a_sle32_to_cpu(ev->twice_antenna_gain),
    4878                 :            :                    __le32_to_cpu(ev->twice_antenna_reduction),
    4879                 :            :                    __le32_to_cpu(ev->power_limit),
    4880                 :            :                    __le32_to_cpu(ev->twice_max_rd_power) / 2,
    4881                 :            :                    __le32_to_cpu(ev->num_tx_chain),
    4882                 :            :                    __le32_to_cpu(ev->rate_max));
    4883                 :            : }
    4884                 :            : 
    4885                 :            : static u8
    4886                 :          0 : ath10k_wmi_tpc_final_get_rate(struct ath10k *ar,
    4887                 :            :                               struct wmi_pdev_tpc_final_table_event *ev,
    4888                 :            :                               u32 rate_idx, u32 num_chains,
    4889                 :            :                               u32 rate_code, u8 type, u32 pream_idx)
    4890                 :            : {
    4891                 :          0 :         u8 tpc, num_streams, preamble, ch, stm_idx;
    4892                 :          0 :         s8 pow_agcdd, pow_agstbc, pow_agtxbf;
    4893                 :          0 :         int pream;
    4894                 :            : 
    4895                 :          0 :         num_streams = ATH10K_HW_NSS(rate_code);
    4896                 :          0 :         preamble = ATH10K_HW_PREAMBLE(rate_code);
    4897                 :          0 :         ch = num_chains - 1;
    4898                 :          0 :         stm_idx = num_streams - 1;
    4899                 :          0 :         pream = -1;
    4900                 :            : 
    4901         [ #  # ]:          0 :         if (__le32_to_cpu(ev->chan_freq) <= 2483) {
    4902         [ #  # ]:          0 :                 switch (pream_idx) {
    4903                 :            :                 case WMI_TPC_PREAM_2GHZ_CCK:
    4904                 :            :                         pream = 0;
    4905                 :            :                         break;
    4906                 :            :                 case WMI_TPC_PREAM_2GHZ_OFDM:
    4907                 :            :                         pream = 1;
    4908                 :            :                         break;
    4909                 :            :                 case WMI_TPC_PREAM_2GHZ_HT20:
    4910                 :            :                 case WMI_TPC_PREAM_2GHZ_VHT20:
    4911                 :            :                         pream = 2;
    4912                 :            :                         break;
    4913                 :            :                 case WMI_TPC_PREAM_2GHZ_HT40:
    4914                 :            :                 case WMI_TPC_PREAM_2GHZ_VHT40:
    4915                 :            :                         pream = 3;
    4916                 :            :                         break;
    4917                 :            :                 case WMI_TPC_PREAM_2GHZ_VHT80:
    4918                 :            :                         pream = 4;
    4919                 :            :                         break;
    4920                 :            :                 default:
    4921                 :            :                         pream = -1;
    4922                 :            :                         break;
    4923                 :            :                 }
    4924                 :          0 :         }
    4925                 :            : 
    4926         [ #  # ]:          0 :         if (__le32_to_cpu(ev->chan_freq) >= 5180) {
    4927         [ #  # ]:          0 :                 switch (pream_idx) {
    4928                 :            :                 case WMI_TPC_PREAM_5GHZ_OFDM:
    4929                 :            :                         pream = 0;
    4930                 :            :                         break;
    4931                 :            :                 case WMI_TPC_PREAM_5GHZ_HT20:
    4932                 :            :                 case WMI_TPC_PREAM_5GHZ_VHT20:
    4933                 :            :                         pream = 1;
    4934                 :            :                         break;
    4935                 :            :                 case WMI_TPC_PREAM_5GHZ_HT40:
    4936                 :            :                 case WMI_TPC_PREAM_5GHZ_VHT40:
    4937                 :            :                         pream = 2;
    4938                 :            :                         break;
    4939                 :            :                 case WMI_TPC_PREAM_5GHZ_VHT80:
    4940                 :            :                         pream = 3;
    4941                 :            :                         break;
    4942                 :            :                 case WMI_TPC_PREAM_5GHZ_HTCUP:
    4943                 :            :                         pream = 4;
    4944                 :            :                         break;
    4945                 :            :                 default:
    4946                 :            :                         pream = -1;
    4947                 :            :                         break;
    4948                 :            :                 }
    4949                 :          0 :         }
    4950                 :            : 
    4951         [ #  # ]:          0 :         if (pream == -1) {
    4952                 :          0 :                 ath10k_warn(ar, "unknown wmi tpc final index and frequency: %u, %u\n",
    4953                 :            :                             pream_idx, __le32_to_cpu(ev->chan_freq));
    4954                 :          0 :                 tpc = 0;
    4955                 :          0 :                 goto out;
    4956                 :            :         }
    4957                 :            : 
    4958         [ #  # ]:          0 :         if (pream == 4)
    4959                 :          0 :                 tpc = min_t(u8, ev->rates_array[rate_idx],
    4960                 :            :                             ev->max_reg_allow_pow[ch]);
    4961                 :            :         else
    4962                 :          0 :                 tpc = min_t(u8, min_t(u8, ev->rates_array[rate_idx],
    4963                 :            :                                       ev->max_reg_allow_pow[ch]),
    4964                 :            :                             ev->ctl_power_table[0][pream][stm_idx]);
    4965                 :            : 
    4966         [ #  # ]:          0 :         if (__le32_to_cpu(ev->num_tx_chain) <= 1)
    4967                 :          0 :                 goto out;
    4968                 :            : 
    4969         [ #  # ]:          0 :         if (preamble == WMI_RATE_PREAMBLE_CCK)
    4970                 :          0 :                 goto out;
    4971                 :            : 
    4972         [ #  # ]:          0 :         if (num_chains <= num_streams)
    4973                 :          0 :                 goto out;
    4974                 :            : 
    4975   [ #  #  #  # ]:          0 :         switch (type) {
    4976                 :          0 :         case WMI_TPC_TABLE_TYPE_STBC:
    4977                 :          0 :                 pow_agstbc = ev->max_reg_allow_pow_agstbc[ch - 1][stm_idx];
    4978         [ #  # ]:          0 :                 if (pream == 4)
    4979                 :          0 :                         tpc = min_t(u8, tpc, pow_agstbc);
    4980                 :            :                 else
    4981                 :          0 :                         tpc = min_t(u8, min_t(u8, tpc, pow_agstbc),
    4982                 :            :                                     ev->ctl_power_table[0][pream][stm_idx]);
    4983                 :            :                 break;
    4984                 :          0 :         case WMI_TPC_TABLE_TYPE_TXBF:
    4985                 :          0 :                 pow_agtxbf = ev->max_reg_allow_pow_agtxbf[ch - 1][stm_idx];
    4986         [ #  # ]:          0 :                 if (pream == 4)
    4987                 :          0 :                         tpc = min_t(u8, tpc, pow_agtxbf);
    4988                 :            :                 else
    4989                 :          0 :                         tpc = min_t(u8, min_t(u8, tpc, pow_agtxbf),
    4990                 :            :                                     ev->ctl_power_table[1][pream][stm_idx]);
    4991                 :            :                 break;
    4992                 :          0 :         case WMI_TPC_TABLE_TYPE_CDD:
    4993                 :          0 :                 pow_agcdd = ev->max_reg_allow_pow_agcdd[ch - 1][stm_idx];
    4994         [ #  # ]:          0 :                 if (pream == 4)
    4995                 :          0 :                         tpc = min_t(u8, tpc, pow_agcdd);
    4996                 :            :                 else
    4997                 :          0 :                         tpc = min_t(u8, min_t(u8, tpc, pow_agcdd),
    4998                 :            :                                     ev->ctl_power_table[0][pream][stm_idx]);
    4999                 :            :                 break;
    5000                 :          0 :         default:
    5001                 :          0 :                 ath10k_warn(ar, "unknown wmi tpc final table type: %d\n", type);
    5002                 :          0 :                 tpc = 0;
    5003                 :          0 :                 break;
    5004                 :            :         }
    5005                 :            : 
    5006                 :          0 : out:
    5007                 :          0 :         return tpc;
    5008                 :            : }
    5009                 :            : 
    5010                 :            : static void
    5011                 :          0 : ath10k_wmi_tpc_stats_final_disp_tables(struct ath10k *ar,
    5012                 :            :                                        struct wmi_pdev_tpc_final_table_event *ev,
    5013                 :            :                                        struct ath10k_tpc_stats_final *tpc_stats,
    5014                 :            :                                        u8 *rate_code, u16 *pream_table, u8 type)
    5015                 :            : {
    5016                 :          0 :         u32 i, j, pream_idx, flags;
    5017                 :          0 :         u8 tpc[WMI_TPC_TX_N_CHAIN];
    5018                 :          0 :         char tpc_value[WMI_TPC_TX_N_CHAIN * WMI_TPC_BUF_SIZE];
    5019                 :          0 :         char buff[WMI_TPC_BUF_SIZE];
    5020                 :            : 
    5021                 :          0 :         flags = __le32_to_cpu(ev->flags);
    5022                 :            : 
    5023   [ #  #  #  # ]:          0 :         switch (type) {
    5024                 :          0 :         case WMI_TPC_TABLE_TYPE_CDD:
    5025         [ #  # ]:          0 :                 if (!(flags & WMI_TPC_CONFIG_EVENT_FLAG_TABLE_CDD)) {
    5026         [ #  # ]:          0 :                         ath10k_dbg(ar, ATH10K_DBG_WMI, "CDD not supported\n");
    5027                 :          0 :                         tpc_stats->flag[type] = ATH10K_TPC_TABLE_TYPE_FLAG;
    5028                 :          0 :                         return;
    5029                 :            :                 }
    5030                 :            :                 break;
    5031                 :          0 :         case WMI_TPC_TABLE_TYPE_STBC:
    5032         [ #  # ]:          0 :                 if (!(flags & WMI_TPC_CONFIG_EVENT_FLAG_TABLE_STBC)) {
    5033         [ #  # ]:          0 :                         ath10k_dbg(ar, ATH10K_DBG_WMI, "STBC not supported\n");
    5034                 :          0 :                         tpc_stats->flag[type] = ATH10K_TPC_TABLE_TYPE_FLAG;
    5035                 :          0 :                         return;
    5036                 :            :                 }
    5037                 :            :                 break;
    5038                 :          0 :         case WMI_TPC_TABLE_TYPE_TXBF:
    5039         [ #  # ]:          0 :                 if (!(flags & WMI_TPC_CONFIG_EVENT_FLAG_TABLE_TXBF)) {
    5040         [ #  # ]:          0 :                         ath10k_dbg(ar, ATH10K_DBG_WMI, "TXBF not supported\n");
    5041                 :          0 :                         tpc_stats->flag[type] = ATH10K_TPC_TABLE_TYPE_FLAG;
    5042                 :          0 :                         return;
    5043                 :            :                 }
    5044                 :            :                 break;
    5045                 :          0 :         default:
    5046         [ #  # ]:          0 :                 ath10k_dbg(ar, ATH10K_DBG_WMI,
    5047                 :            :                            "invalid table type in wmi tpc event: %d\n", type);
    5048                 :            :                 return;
    5049                 :            :         }
    5050                 :            : 
    5051                 :            :         pream_idx = 0;
    5052         [ #  # ]:          0 :         for (i = 0; i < tpc_stats->rate_max; i++) {
    5053                 :          0 :                 memset(tpc_value, 0, sizeof(tpc_value));
    5054                 :          0 :                 memset(buff, 0, sizeof(buff));
    5055         [ #  # ]:          0 :                 if (i == pream_table[pream_idx])
    5056                 :          0 :                         pream_idx++;
    5057                 :            : 
    5058         [ #  # ]:          0 :                 for (j = 0; j < tpc_stats->num_tx_chain; j++) {
    5059                 :          0 :                         tpc[j] = ath10k_wmi_tpc_final_get_rate(ar, ev, i, j + 1,
    5060                 :          0 :                                                                rate_code[i],
    5061                 :            :                                                                type, pream_idx);
    5062                 :          0 :                         snprintf(buff, sizeof(buff), "%8d ", tpc[j]);
    5063                 :          0 :                         strlcat(tpc_value, buff, sizeof(tpc_value));
    5064                 :            :                 }
    5065                 :          0 :                 tpc_stats->tpc_table_final[type].pream_idx[i] = pream_idx;
    5066                 :          0 :                 tpc_stats->tpc_table_final[type].rate_code[i] = rate_code[i];
    5067                 :          0 :                 memcpy(tpc_stats->tpc_table_final[type].tpc_value[i],
    5068                 :            :                        tpc_value, sizeof(tpc_value));
    5069                 :            :         }
    5070                 :            : }
    5071                 :            : 
    5072                 :          0 : void ath10k_wmi_event_tpc_final_table(struct ath10k *ar, struct sk_buff *skb)
    5073                 :            : {
    5074                 :          0 :         u32 num_tx_chain, rate_max;
    5075                 :          0 :         u8 rate_code[WMI_TPC_FINAL_RATE_MAX];
    5076                 :          0 :         u16 pream_table[WMI_TPC_PREAM_TABLE_MAX];
    5077                 :          0 :         struct wmi_pdev_tpc_final_table_event *ev;
    5078                 :          0 :         struct ath10k_tpc_stats_final *tpc_stats;
    5079                 :            : 
    5080                 :          0 :         ev = (struct wmi_pdev_tpc_final_table_event *)skb->data;
    5081                 :            : 
    5082                 :          0 :         num_tx_chain = __le32_to_cpu(ev->num_tx_chain);
    5083         [ #  # ]:          0 :         if (num_tx_chain > WMI_TPC_TX_N_CHAIN) {
    5084                 :          0 :                 ath10k_warn(ar, "number of tx chain is %d greater than TPC final configured tx chain %d\n",
    5085                 :            :                             num_tx_chain, WMI_TPC_TX_N_CHAIN);
    5086                 :          0 :                 return;
    5087                 :            :         }
    5088                 :            : 
    5089                 :          0 :         rate_max = __le32_to_cpu(ev->rate_max);
    5090         [ #  # ]:          0 :         if (rate_max > WMI_TPC_FINAL_RATE_MAX) {
    5091                 :          0 :                 ath10k_warn(ar, "number of rate is %d greater than TPC final configured rate %d\n",
    5092                 :            :                             rate_max, WMI_TPC_FINAL_RATE_MAX);
    5093                 :          0 :                 rate_max = WMI_TPC_FINAL_RATE_MAX;
    5094                 :            :         }
    5095                 :            : 
    5096                 :          0 :         tpc_stats = kzalloc(sizeof(*tpc_stats), GFP_ATOMIC);
    5097         [ #  # ]:          0 :         if (!tpc_stats)
    5098                 :            :                 return;
    5099                 :            : 
    5100                 :          0 :         ath10k_wmi_tpc_config_get_rate_code(rate_code, pream_table,
    5101                 :            :                                             num_tx_chain);
    5102                 :            : 
    5103                 :          0 :         tpc_stats->chan_freq = __le32_to_cpu(ev->chan_freq);
    5104                 :          0 :         tpc_stats->phy_mode = __le32_to_cpu(ev->phy_mode);
    5105                 :          0 :         tpc_stats->ctl = __le32_to_cpu(ev->ctl);
    5106                 :          0 :         tpc_stats->reg_domain = __le32_to_cpu(ev->reg_domain);
    5107                 :          0 :         tpc_stats->twice_antenna_gain = a_sle32_to_cpu(ev->twice_antenna_gain);
    5108                 :          0 :         tpc_stats->twice_antenna_reduction =
    5109                 :          0 :                 __le32_to_cpu(ev->twice_antenna_reduction);
    5110                 :          0 :         tpc_stats->power_limit = __le32_to_cpu(ev->power_limit);
    5111                 :          0 :         tpc_stats->twice_max_rd_power = __le32_to_cpu(ev->twice_max_rd_power);
    5112                 :          0 :         tpc_stats->num_tx_chain = num_tx_chain;
    5113                 :          0 :         tpc_stats->rate_max = rate_max;
    5114                 :            : 
    5115                 :          0 :         ath10k_wmi_tpc_stats_final_disp_tables(ar, ev, tpc_stats,
    5116                 :            :                                                rate_code, pream_table,
    5117                 :            :                                                WMI_TPC_TABLE_TYPE_CDD);
    5118                 :          0 :         ath10k_wmi_tpc_stats_final_disp_tables(ar, ev,  tpc_stats,
    5119                 :            :                                                rate_code, pream_table,
    5120                 :            :                                                WMI_TPC_TABLE_TYPE_STBC);
    5121                 :          0 :         ath10k_wmi_tpc_stats_final_disp_tables(ar, ev, tpc_stats,
    5122                 :            :                                                rate_code, pream_table,
    5123                 :            :                                                WMI_TPC_TABLE_TYPE_TXBF);
    5124                 :            : 
    5125                 :          0 :         ath10k_debug_tpc_stats_final_process(ar, tpc_stats);
    5126                 :            : 
    5127         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    5128                 :            :                    "wmi event tpc final table channel %d mode %d ctl %d regd %d gain %d %d limit %d max_power %d tx_chanins %d rates %d\n",
    5129                 :            :                    __le32_to_cpu(ev->chan_freq),
    5130                 :            :                    __le32_to_cpu(ev->phy_mode),
    5131                 :            :                    __le32_to_cpu(ev->ctl),
    5132                 :            :                    __le32_to_cpu(ev->reg_domain),
    5133                 :            :                    a_sle32_to_cpu(ev->twice_antenna_gain),
    5134                 :            :                    __le32_to_cpu(ev->twice_antenna_reduction),
    5135                 :            :                    __le32_to_cpu(ev->power_limit),
    5136                 :            :                    __le32_to_cpu(ev->twice_max_rd_power) / 2,
    5137                 :            :                    __le32_to_cpu(ev->num_tx_chain),
    5138                 :            :                    __le32_to_cpu(ev->rate_max));
    5139                 :            : }
    5140                 :            : 
    5141                 :            : static void
    5142                 :            : ath10k_wmi_handle_tdls_peer_event(struct ath10k *ar, struct sk_buff *skb)
    5143                 :            : {
    5144                 :            :         struct wmi_tdls_peer_event *ev;
    5145                 :            :         struct ath10k_peer *peer;
    5146                 :            :         struct ath10k_vif *arvif;
    5147                 :            :         int vdev_id;
    5148                 :            :         int peer_status;
    5149                 :            :         int peer_reason;
    5150                 :            :         u8 reason;
    5151                 :            : 
    5152                 :            :         if (skb->len < sizeof(*ev)) {
    5153                 :            :                 ath10k_err(ar, "received tdls peer event with invalid size (%d bytes)\n",
    5154                 :            :                            skb->len);
    5155                 :            :                 return;
    5156                 :            :         }
    5157                 :            : 
    5158                 :            :         ev = (struct wmi_tdls_peer_event *)skb->data;
    5159                 :            :         vdev_id = __le32_to_cpu(ev->vdev_id);
    5160                 :            :         peer_status = __le32_to_cpu(ev->peer_status);
    5161                 :            :         peer_reason = __le32_to_cpu(ev->peer_reason);
    5162                 :            : 
    5163                 :            :         spin_lock_bh(&ar->data_lock);
    5164                 :            :         peer = ath10k_peer_find(ar, vdev_id, ev->peer_macaddr.addr);
    5165                 :            :         spin_unlock_bh(&ar->data_lock);
    5166                 :            : 
    5167                 :            :         if (!peer) {
    5168                 :            :                 ath10k_warn(ar, "failed to find peer entry for %pM\n",
    5169                 :            :                             ev->peer_macaddr.addr);
    5170                 :            :                 return;
    5171                 :            :         }
    5172                 :            : 
    5173                 :            :         switch (peer_status) {
    5174                 :            :         case WMI_TDLS_SHOULD_TEARDOWN:
    5175                 :            :                 switch (peer_reason) {
    5176                 :            :                 case WMI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT:
    5177                 :            :                 case WMI_TDLS_TEARDOWN_REASON_NO_RESPONSE:
    5178                 :            :                 case WMI_TDLS_TEARDOWN_REASON_RSSI:
    5179                 :            :                         reason = WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE;
    5180                 :            :                         break;
    5181                 :            :                 default:
    5182                 :            :                         reason = WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED;
    5183                 :            :                         break;
    5184                 :            :                 }
    5185                 :            : 
    5186                 :            :                 arvif = ath10k_get_arvif(ar, vdev_id);
    5187                 :            :                 if (!arvif) {
    5188                 :            :                         ath10k_warn(ar, "received tdls peer event for invalid vdev id %u\n",
    5189                 :            :                                     vdev_id);
    5190                 :            :                         return;
    5191                 :            :                 }
    5192                 :            : 
    5193                 :            :                 ieee80211_tdls_oper_request(arvif->vif, ev->peer_macaddr.addr,
    5194                 :            :                                             NL80211_TDLS_TEARDOWN, reason,
    5195                 :            :                                             GFP_ATOMIC);
    5196                 :            : 
    5197                 :            :                 ath10k_dbg(ar, ATH10K_DBG_WMI,
    5198                 :            :                            "received tdls teardown event for peer %pM reason %u\n",
    5199                 :            :                            ev->peer_macaddr.addr, peer_reason);
    5200                 :            :                 break;
    5201                 :            :         default:
    5202                 :            :                 ath10k_dbg(ar, ATH10K_DBG_WMI,
    5203                 :            :                            "received unknown tdls peer event %u\n",
    5204                 :            :                            peer_status);
    5205                 :            :                 break;
    5206                 :            :         }
    5207                 :            : }
    5208                 :            : 
    5209                 :            : static void
    5210                 :            : ath10k_wmi_event_peer_sta_ps_state_chg(struct ath10k *ar, struct sk_buff *skb)
    5211                 :            : {
    5212                 :            :         struct wmi_peer_sta_ps_state_chg_event *ev;
    5213                 :            :         struct ieee80211_sta *sta;
    5214                 :            :         struct ath10k_sta *arsta;
    5215                 :            :         u8 peer_addr[ETH_ALEN];
    5216                 :            : 
    5217                 :            :         lockdep_assert_held(&ar->data_lock);
    5218                 :            : 
    5219                 :            :         ev = (struct wmi_peer_sta_ps_state_chg_event *)skb->data;
    5220                 :            :         ether_addr_copy(peer_addr, ev->peer_macaddr.addr);
    5221                 :            : 
    5222                 :            :         rcu_read_lock();
    5223                 :            : 
    5224                 :            :         sta = ieee80211_find_sta_by_ifaddr(ar->hw, peer_addr, NULL);
    5225                 :            : 
    5226                 :            :         if (!sta) {
    5227                 :            :                 ath10k_warn(ar, "failed to find station entry %pM\n",
    5228                 :            :                             peer_addr);
    5229                 :            :                 goto exit;
    5230                 :            :         }
    5231                 :            : 
    5232                 :            :         arsta = (struct ath10k_sta *)sta->drv_priv;
    5233                 :            :         arsta->peer_ps_state = __le32_to_cpu(ev->peer_ps_state);
    5234                 :            : 
    5235                 :            : exit:
    5236                 :            :         rcu_read_unlock();
    5237                 :            : }
    5238                 :            : 
    5239                 :          0 : void ath10k_wmi_event_pdev_ftm_intg(struct ath10k *ar, struct sk_buff *skb)
    5240                 :            : {
    5241         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_PDEV_FTM_INTG_EVENTID\n");
    5242                 :          0 : }
    5243                 :            : 
    5244                 :          0 : void ath10k_wmi_event_gtk_offload_status(struct ath10k *ar, struct sk_buff *skb)
    5245                 :            : {
    5246         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_GTK_OFFLOAD_STATUS_EVENTID\n");
    5247                 :          0 : }
    5248                 :            : 
    5249                 :          0 : void ath10k_wmi_event_gtk_rekey_fail(struct ath10k *ar, struct sk_buff *skb)
    5250                 :            : {
    5251         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_GTK_REKEY_FAIL_EVENTID\n");
    5252                 :          0 : }
    5253                 :            : 
    5254                 :          0 : void ath10k_wmi_event_delba_complete(struct ath10k *ar, struct sk_buff *skb)
    5255                 :            : {
    5256         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_TX_DELBA_COMPLETE_EVENTID\n");
    5257                 :          0 : }
    5258                 :            : 
    5259                 :          0 : void ath10k_wmi_event_addba_complete(struct ath10k *ar, struct sk_buff *skb)
    5260                 :            : {
    5261         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_TX_ADDBA_COMPLETE_EVENTID\n");
    5262                 :          0 : }
    5263                 :            : 
    5264                 :          0 : void ath10k_wmi_event_vdev_install_key_complete(struct ath10k *ar,
    5265                 :            :                                                 struct sk_buff *skb)
    5266                 :            : {
    5267         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID\n");
    5268                 :          0 : }
    5269                 :            : 
    5270                 :          0 : void ath10k_wmi_event_inst_rssi_stats(struct ath10k *ar, struct sk_buff *skb)
    5271                 :            : {
    5272         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_INST_RSSI_STATS_EVENTID\n");
    5273                 :          0 : }
    5274                 :            : 
    5275                 :          0 : void ath10k_wmi_event_vdev_standby_req(struct ath10k *ar, struct sk_buff *skb)
    5276                 :            : {
    5277         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_STANDBY_REQ_EVENTID\n");
    5278                 :          0 : }
    5279                 :            : 
    5280                 :          0 : void ath10k_wmi_event_vdev_resume_req(struct ath10k *ar, struct sk_buff *skb)
    5281                 :            : {
    5282         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_RESUME_REQ_EVENTID\n");
    5283                 :          0 : }
    5284                 :            : 
    5285                 :          0 : static int ath10k_wmi_alloc_chunk(struct ath10k *ar, u32 req_id,
    5286                 :            :                                   u32 num_units, u32 unit_len)
    5287                 :            : {
    5288                 :          0 :         dma_addr_t paddr;
    5289                 :          0 :         u32 pool_size;
    5290                 :          0 :         int idx = ar->wmi.num_mem_chunks;
    5291                 :          0 :         void *vaddr;
    5292                 :            : 
    5293                 :          0 :         pool_size = num_units * round_up(unit_len, 4);
    5294                 :          0 :         vaddr = dma_alloc_coherent(ar->dev, pool_size, &paddr, GFP_KERNEL);
    5295                 :            : 
    5296         [ #  # ]:          0 :         if (!vaddr)
    5297                 :            :                 return -ENOMEM;
    5298                 :            : 
    5299                 :          0 :         ar->wmi.mem_chunks[idx].vaddr = vaddr;
    5300                 :          0 :         ar->wmi.mem_chunks[idx].paddr = paddr;
    5301                 :          0 :         ar->wmi.mem_chunks[idx].len = pool_size;
    5302                 :          0 :         ar->wmi.mem_chunks[idx].req_id = req_id;
    5303                 :          0 :         ar->wmi.num_mem_chunks++;
    5304                 :            : 
    5305                 :          0 :         return num_units;
    5306                 :            : }
    5307                 :            : 
    5308                 :            : static int ath10k_wmi_alloc_host_mem(struct ath10k *ar, u32 req_id,
    5309                 :            :                                      u32 num_units, u32 unit_len)
    5310                 :            : {
    5311                 :            :         int ret;
    5312                 :            : 
    5313         [ #  # ]:          0 :         while (num_units) {
    5314                 :          0 :                 ret = ath10k_wmi_alloc_chunk(ar, req_id, num_units, unit_len);
    5315         [ #  # ]:          0 :                 if (ret < 0)
    5316                 :            :                         return ret;
    5317                 :            : 
    5318                 :          0 :                 num_units -= ret;
    5319                 :            :         }
    5320                 :            : 
    5321                 :            :         return 0;
    5322                 :            : }
    5323                 :            : 
    5324                 :            : static bool
    5325                 :          0 : ath10k_wmi_is_host_mem_allocated(struct ath10k *ar,
    5326                 :            :                                  const struct wlan_host_mem_req **mem_reqs,
    5327                 :            :                                  u32 num_mem_reqs)
    5328                 :            : {
    5329                 :          0 :         u32 req_id, num_units, unit_size, num_unit_info;
    5330                 :          0 :         u32 pool_size;
    5331                 :          0 :         int i, j;
    5332                 :          0 :         bool found;
    5333                 :            : 
    5334         [ #  # ]:          0 :         if (ar->wmi.num_mem_chunks != num_mem_reqs)
    5335                 :            :                 return false;
    5336                 :            : 
    5337         [ #  # ]:          0 :         for (i = 0; i < num_mem_reqs; ++i) {
    5338                 :          0 :                 req_id = __le32_to_cpu(mem_reqs[i]->req_id);
    5339                 :          0 :                 num_units = __le32_to_cpu(mem_reqs[i]->num_units);
    5340                 :          0 :                 unit_size = __le32_to_cpu(mem_reqs[i]->unit_size);
    5341                 :          0 :                 num_unit_info = __le32_to_cpu(mem_reqs[i]->num_unit_info);
    5342                 :            : 
    5343         [ #  # ]:          0 :                 if (num_unit_info & NUM_UNITS_IS_NUM_ACTIVE_PEERS) {
    5344         [ #  # ]:          0 :                         if (ar->num_active_peers)
    5345                 :          0 :                                 num_units = ar->num_active_peers + 1;
    5346                 :            :                         else
    5347                 :          0 :                                 num_units = ar->max_num_peers + 1;
    5348         [ #  # ]:          0 :                 } else if (num_unit_info & NUM_UNITS_IS_NUM_PEERS) {
    5349                 :          0 :                         num_units = ar->max_num_peers + 1;
    5350         [ #  # ]:          0 :                 } else if (num_unit_info & NUM_UNITS_IS_NUM_VDEVS) {
    5351                 :          0 :                         num_units = ar->max_num_vdevs + 1;
    5352                 :            :                 }
    5353                 :            : 
    5354                 :          0 :                 found = false;
    5355         [ #  # ]:          0 :                 for (j = 0; j < ar->wmi.num_mem_chunks; j++) {
    5356         [ #  # ]:          0 :                         if (ar->wmi.mem_chunks[j].req_id == req_id) {
    5357                 :          0 :                                 pool_size = num_units * round_up(unit_size, 4);
    5358         [ #  # ]:          0 :                                 if (ar->wmi.mem_chunks[j].len == pool_size) {
    5359                 :            :                                         found = true;
    5360                 :            :                                         break;
    5361                 :            :                                 }
    5362                 :            :                         }
    5363                 :            :                 }
    5364         [ #  # ]:          0 :                 if (!found)
    5365                 :            :                         return false;
    5366                 :            :         }
    5367                 :            : 
    5368                 :            :         return true;
    5369                 :            : }
    5370                 :            : 
    5371                 :            : static int
    5372                 :          0 : ath10k_wmi_main_op_pull_svc_rdy_ev(struct ath10k *ar, struct sk_buff *skb,
    5373                 :            :                                    struct wmi_svc_rdy_ev_arg *arg)
    5374                 :            : {
    5375                 :          0 :         struct wmi_service_ready_event *ev;
    5376                 :          0 :         size_t i, n;
    5377                 :            : 
    5378         [ #  # ]:          0 :         if (skb->len < sizeof(*ev))
    5379                 :            :                 return -EPROTO;
    5380                 :            : 
    5381                 :          0 :         ev = (void *)skb->data;
    5382                 :          0 :         skb_pull(skb, sizeof(*ev));
    5383                 :          0 :         arg->min_tx_power = ev->hw_min_tx_power;
    5384                 :          0 :         arg->max_tx_power = ev->hw_max_tx_power;
    5385                 :          0 :         arg->ht_cap = ev->ht_cap_info;
    5386                 :          0 :         arg->vht_cap = ev->vht_cap_info;
    5387                 :          0 :         arg->vht_supp_mcs = ev->vht_supp_mcs;
    5388                 :          0 :         arg->sw_ver0 = ev->sw_version;
    5389                 :          0 :         arg->sw_ver1 = ev->sw_version_1;
    5390                 :          0 :         arg->phy_capab = ev->phy_capability;
    5391                 :          0 :         arg->num_rf_chains = ev->num_rf_chains;
    5392                 :          0 :         arg->eeprom_rd = ev->hal_reg_capabilities.eeprom_rd;
    5393                 :          0 :         arg->low_2ghz_chan = ev->hal_reg_capabilities.low_2ghz_chan;
    5394                 :          0 :         arg->high_2ghz_chan = ev->hal_reg_capabilities.high_2ghz_chan;
    5395                 :          0 :         arg->low_5ghz_chan = ev->hal_reg_capabilities.low_5ghz_chan;
    5396                 :          0 :         arg->high_5ghz_chan = ev->hal_reg_capabilities.high_5ghz_chan;
    5397                 :          0 :         arg->num_mem_reqs = ev->num_mem_reqs;
    5398                 :          0 :         arg->service_map = ev->wmi_service_bitmap;
    5399                 :          0 :         arg->service_map_len = sizeof(ev->wmi_service_bitmap);
    5400                 :            : 
    5401                 :          0 :         n = min_t(size_t, __le32_to_cpu(arg->num_mem_reqs),
    5402                 :            :                   ARRAY_SIZE(arg->mem_reqs));
    5403         [ #  # ]:          0 :         for (i = 0; i < n; i++)
    5404                 :          0 :                 arg->mem_reqs[i] = &ev->mem_reqs[i];
    5405                 :            : 
    5406                 :          0 :         if (skb->len <
    5407         [ #  # ]:          0 :             __le32_to_cpu(arg->num_mem_reqs) * sizeof(arg->mem_reqs[0]))
    5408                 :          0 :                 return -EPROTO;
    5409                 :            : 
    5410                 :            :         return 0;
    5411                 :            : }
    5412                 :            : 
    5413                 :            : static int
    5414                 :          0 : ath10k_wmi_10x_op_pull_svc_rdy_ev(struct ath10k *ar, struct sk_buff *skb,
    5415                 :            :                                   struct wmi_svc_rdy_ev_arg *arg)
    5416                 :            : {
    5417                 :          0 :         struct wmi_10x_service_ready_event *ev;
    5418                 :          0 :         int i, n;
    5419                 :            : 
    5420         [ #  # ]:          0 :         if (skb->len < sizeof(*ev))
    5421                 :            :                 return -EPROTO;
    5422                 :            : 
    5423                 :          0 :         ev = (void *)skb->data;
    5424                 :          0 :         skb_pull(skb, sizeof(*ev));
    5425                 :          0 :         arg->min_tx_power = ev->hw_min_tx_power;
    5426                 :          0 :         arg->max_tx_power = ev->hw_max_tx_power;
    5427                 :          0 :         arg->ht_cap = ev->ht_cap_info;
    5428                 :          0 :         arg->vht_cap = ev->vht_cap_info;
    5429                 :          0 :         arg->vht_supp_mcs = ev->vht_supp_mcs;
    5430                 :          0 :         arg->sw_ver0 = ev->sw_version;
    5431                 :          0 :         arg->phy_capab = ev->phy_capability;
    5432                 :          0 :         arg->num_rf_chains = ev->num_rf_chains;
    5433                 :          0 :         arg->eeprom_rd = ev->hal_reg_capabilities.eeprom_rd;
    5434                 :          0 :         arg->low_2ghz_chan = ev->hal_reg_capabilities.low_2ghz_chan;
    5435                 :          0 :         arg->high_2ghz_chan = ev->hal_reg_capabilities.high_2ghz_chan;
    5436                 :          0 :         arg->low_5ghz_chan = ev->hal_reg_capabilities.low_5ghz_chan;
    5437                 :          0 :         arg->high_5ghz_chan = ev->hal_reg_capabilities.high_5ghz_chan;
    5438                 :          0 :         arg->num_mem_reqs = ev->num_mem_reqs;
    5439                 :          0 :         arg->service_map = ev->wmi_service_bitmap;
    5440                 :          0 :         arg->service_map_len = sizeof(ev->wmi_service_bitmap);
    5441                 :            : 
    5442                 :            :         /* Deliberately skipping ev->sys_cap_info as WMI and WMI-TLV have
    5443                 :            :          * different values. We would need a translation to handle that,
    5444                 :            :          * but as we don't currently need anything from sys_cap_info from
    5445                 :            :          * WMI interface (only from WMI-TLV) safest it to skip it.
    5446                 :            :          */
    5447                 :            : 
    5448                 :          0 :         n = min_t(size_t, __le32_to_cpu(arg->num_mem_reqs),
    5449                 :            :                   ARRAY_SIZE(arg->mem_reqs));
    5450         [ #  # ]:          0 :         for (i = 0; i < n; i++)
    5451                 :          0 :                 arg->mem_reqs[i] = &ev->mem_reqs[i];
    5452                 :            : 
    5453                 :          0 :         if (skb->len <
    5454         [ #  # ]:          0 :             __le32_to_cpu(arg->num_mem_reqs) * sizeof(arg->mem_reqs[0]))
    5455                 :          0 :                 return -EPROTO;
    5456                 :            : 
    5457                 :            :         return 0;
    5458                 :            : }
    5459                 :            : 
    5460                 :          0 : static void ath10k_wmi_event_service_ready_work(struct work_struct *work)
    5461                 :            : {
    5462                 :          0 :         struct ath10k *ar = container_of(work, struct ath10k, svc_rdy_work);
    5463                 :          0 :         struct sk_buff *skb = ar->svc_rdy_skb;
    5464                 :          0 :         struct wmi_svc_rdy_ev_arg arg = {};
    5465                 :          0 :         u32 num_units, req_id, unit_size, num_mem_reqs, num_unit_info, i;
    5466                 :          0 :         int ret;
    5467                 :          0 :         bool allocated;
    5468                 :            : 
    5469         [ #  # ]:          0 :         if (!skb) {
    5470                 :          0 :                 ath10k_warn(ar, "invalid service ready event skb\n");
    5471                 :          0 :                 return;
    5472                 :            :         }
    5473                 :            : 
    5474         [ #  # ]:          0 :         ret = ath10k_wmi_pull_svc_rdy(ar, skb, &arg);
    5475         [ #  # ]:          0 :         if (ret) {
    5476                 :          0 :                 ath10k_warn(ar, "failed to parse service ready: %d\n", ret);
    5477                 :          0 :                 return;
    5478                 :            :         }
    5479                 :            : 
    5480         [ #  # ]:          0 :         ath10k_wmi_map_svc(ar, arg.service_map, ar->wmi.svc_map,
    5481                 :            :                            arg.service_map_len);
    5482                 :            : 
    5483                 :          0 :         ar->hw_min_tx_power = __le32_to_cpu(arg.min_tx_power);
    5484                 :          0 :         ar->hw_max_tx_power = __le32_to_cpu(arg.max_tx_power);
    5485                 :          0 :         ar->ht_cap_info = __le32_to_cpu(arg.ht_cap);
    5486                 :          0 :         ar->vht_cap_info = __le32_to_cpu(arg.vht_cap);
    5487                 :          0 :         ar->vht_supp_mcs = __le32_to_cpu(arg.vht_supp_mcs);
    5488                 :          0 :         ar->fw_version_major =
    5489                 :          0 :                 (__le32_to_cpu(arg.sw_ver0) & 0xff000000) >> 24;
    5490                 :          0 :         ar->fw_version_minor = (__le32_to_cpu(arg.sw_ver0) & 0x00ffffff);
    5491                 :          0 :         ar->fw_version_release =
    5492                 :          0 :                 (__le32_to_cpu(arg.sw_ver1) & 0xffff0000) >> 16;
    5493                 :          0 :         ar->fw_version_build = (__le32_to_cpu(arg.sw_ver1) & 0x0000ffff);
    5494                 :          0 :         ar->phy_capability = __le32_to_cpu(arg.phy_capab);
    5495                 :          0 :         ar->num_rf_chains = __le32_to_cpu(arg.num_rf_chains);
    5496                 :          0 :         ar->hw_eeprom_rd = __le32_to_cpu(arg.eeprom_rd);
    5497                 :          0 :         ar->low_2ghz_chan = __le32_to_cpu(arg.low_2ghz_chan);
    5498                 :          0 :         ar->high_2ghz_chan = __le32_to_cpu(arg.high_2ghz_chan);
    5499                 :          0 :         ar->low_5ghz_chan = __le32_to_cpu(arg.low_5ghz_chan);
    5500                 :          0 :         ar->high_5ghz_chan = __le32_to_cpu(arg.high_5ghz_chan);
    5501                 :          0 :         ar->sys_cap_info = __le32_to_cpu(arg.sys_cap_info);
    5502                 :            : 
    5503                 :          0 :         ath10k_dbg_dump(ar, ATH10K_DBG_WMI, NULL, "wmi svc: ",
    5504                 :          0 :                         arg.service_map, arg.service_map_len);
    5505         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi sys_cap_info 0x%x\n",
    5506                 :            :                    ar->sys_cap_info);
    5507                 :            : 
    5508         [ #  # ]:          0 :         if (ar->num_rf_chains > ar->max_spatial_stream) {
    5509                 :          0 :                 ath10k_warn(ar, "hardware advertises support for more spatial streams than it should (%d > %d)\n",
    5510                 :            :                             ar->num_rf_chains, ar->max_spatial_stream);
    5511                 :          0 :                 ar->num_rf_chains = ar->max_spatial_stream;
    5512                 :            :         }
    5513                 :            : 
    5514         [ #  # ]:          0 :         if (!ar->cfg_tx_chainmask) {
    5515                 :          0 :                 ar->cfg_tx_chainmask = (1 << ar->num_rf_chains) - 1;
    5516                 :          0 :                 ar->cfg_rx_chainmask = (1 << ar->num_rf_chains) - 1;
    5517                 :            :         }
    5518                 :            : 
    5519         [ #  # ]:          0 :         if (strlen(ar->hw->wiphy->fw_version) == 0) {
    5520                 :          0 :                 snprintf(ar->hw->wiphy->fw_version,
    5521                 :            :                          sizeof(ar->hw->wiphy->fw_version),
    5522                 :            :                          "%u.%u.%u.%u",
    5523                 :          0 :                          ar->fw_version_major,
    5524                 :            :                          ar->fw_version_minor,
    5525                 :          0 :                          ar->fw_version_release,
    5526                 :          0 :                          ar->fw_version_build);
    5527                 :            :         }
    5528                 :            : 
    5529                 :          0 :         num_mem_reqs = __le32_to_cpu(arg.num_mem_reqs);
    5530         [ #  # ]:          0 :         if (num_mem_reqs > WMI_MAX_MEM_REQS) {
    5531                 :          0 :                 ath10k_warn(ar, "requested memory chunks number (%d) exceeds the limit\n",
    5532                 :            :                             num_mem_reqs);
    5533                 :          0 :                 return;
    5534                 :            :         }
    5535                 :            : 
    5536         [ #  # ]:          0 :         if (test_bit(WMI_SERVICE_PEER_CACHING, ar->wmi.svc_map)) {
    5537         [ #  # ]:          0 :                 if (test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL,
    5538                 :          0 :                              ar->running_fw->fw_file.fw_features))
    5539                 :          0 :                         ar->num_active_peers = TARGET_10_4_QCACHE_ACTIVE_PEERS_PFC +
    5540                 :          0 :                                                ar->max_num_vdevs;
    5541                 :            :                 else
    5542                 :          0 :                         ar->num_active_peers = TARGET_10_4_QCACHE_ACTIVE_PEERS +
    5543                 :          0 :                                                ar->max_num_vdevs;
    5544                 :            : 
    5545                 :          0 :                 ar->max_num_peers = TARGET_10_4_NUM_QCACHE_PEERS_MAX +
    5546                 :          0 :                                     ar->max_num_vdevs;
    5547                 :          0 :                 ar->num_tids = ar->num_active_peers * 2;
    5548                 :          0 :                 ar->max_num_stations = TARGET_10_4_NUM_QCACHE_PEERS_MAX;
    5549                 :            :         }
    5550                 :            : 
    5551                 :            :         /* TODO: Adjust max peer count for cases like WMI_SERVICE_RATECTRL_CACHE
    5552                 :            :          * and WMI_SERVICE_IRAM_TIDS, etc.
    5553                 :            :          */
    5554                 :            : 
    5555                 :          0 :         allocated = ath10k_wmi_is_host_mem_allocated(ar, arg.mem_reqs,
    5556                 :            :                                                      num_mem_reqs);
    5557         [ #  # ]:          0 :         if (allocated)
    5558                 :          0 :                 goto skip_mem_alloc;
    5559                 :            : 
    5560                 :            :         /* Either this event is received during boot time or there is a change
    5561                 :            :          * in memory requirement from firmware when compared to last request.
    5562                 :            :          * Free any old memory and do a fresh allocation based on the current
    5563                 :            :          * memory requirement.
    5564                 :            :          */
    5565                 :          0 :         ath10k_wmi_free_host_mem(ar);
    5566                 :            : 
    5567         [ #  # ]:          0 :         for (i = 0; i < num_mem_reqs; ++i) {
    5568                 :          0 :                 req_id = __le32_to_cpu(arg.mem_reqs[i]->req_id);
    5569                 :          0 :                 num_units = __le32_to_cpu(arg.mem_reqs[i]->num_units);
    5570                 :          0 :                 unit_size = __le32_to_cpu(arg.mem_reqs[i]->unit_size);
    5571                 :          0 :                 num_unit_info = __le32_to_cpu(arg.mem_reqs[i]->num_unit_info);
    5572                 :            : 
    5573         [ #  # ]:          0 :                 if (num_unit_info & NUM_UNITS_IS_NUM_ACTIVE_PEERS) {
    5574         [ #  # ]:          0 :                         if (ar->num_active_peers)
    5575                 :          0 :                                 num_units = ar->num_active_peers + 1;
    5576                 :            :                         else
    5577                 :          0 :                                 num_units = ar->max_num_peers + 1;
    5578         [ #  # ]:          0 :                 } else if (num_unit_info & NUM_UNITS_IS_NUM_PEERS) {
    5579                 :            :                         /* number of units to allocate is number of
    5580                 :            :                          * peers, 1 extra for self peer on target
    5581                 :            :                          * this needs to be tied, host and target
    5582                 :            :                          * can get out of sync
    5583                 :            :                          */
    5584                 :          0 :                         num_units = ar->max_num_peers + 1;
    5585         [ #  # ]:          0 :                 } else if (num_unit_info & NUM_UNITS_IS_NUM_VDEVS) {
    5586                 :          0 :                         num_units = ar->max_num_vdevs + 1;
    5587                 :            :                 }
    5588                 :            : 
    5589         [ #  # ]:          0 :                 ath10k_dbg(ar, ATH10K_DBG_WMI,
    5590                 :            :                            "wmi mem_req_id %d num_units %d num_unit_info %d unit size %d actual units %d\n",
    5591                 :            :                            req_id,
    5592                 :            :                            __le32_to_cpu(arg.mem_reqs[i]->num_units),
    5593                 :            :                            num_unit_info,
    5594                 :            :                            unit_size,
    5595                 :            :                            num_units);
    5596                 :            : 
    5597                 :            :                 ret = ath10k_wmi_alloc_host_mem(ar, req_id, num_units,
    5598                 :            :                                                 unit_size);
    5599         [ #  # ]:          0 :                 if (ret)
    5600                 :            :                         return;
    5601                 :            :         }
    5602                 :            : 
    5603                 :          0 : skip_mem_alloc:
    5604         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    5605                 :            :                    "wmi event service ready min_tx_power 0x%08x max_tx_power 0x%08x ht_cap 0x%08x vht_cap 0x%08x vht_supp_mcs 0x%08x sw_ver0 0x%08x sw_ver1 0x%08x fw_build 0x%08x phy_capab 0x%08x num_rf_chains 0x%08x eeprom_rd 0x%08x low_2ghz_chan %d high_2ghz_chan %d low_5ghz_chan %d high_5ghz_chan %d num_mem_reqs 0x%08x\n",
    5606                 :            :                    __le32_to_cpu(arg.min_tx_power),
    5607                 :            :                    __le32_to_cpu(arg.max_tx_power),
    5608                 :            :                    __le32_to_cpu(arg.ht_cap),
    5609                 :            :                    __le32_to_cpu(arg.vht_cap),
    5610                 :            :                    __le32_to_cpu(arg.vht_supp_mcs),
    5611                 :            :                    __le32_to_cpu(arg.sw_ver0),
    5612                 :            :                    __le32_to_cpu(arg.sw_ver1),
    5613                 :            :                    __le32_to_cpu(arg.fw_build),
    5614                 :            :                    __le32_to_cpu(arg.phy_capab),
    5615                 :            :                    __le32_to_cpu(arg.num_rf_chains),
    5616                 :            :                    __le32_to_cpu(arg.eeprom_rd),
    5617                 :            :                    __le32_to_cpu(arg.low_2ghz_chan),
    5618                 :            :                    __le32_to_cpu(arg.high_2ghz_chan),
    5619                 :            :                    __le32_to_cpu(arg.low_5ghz_chan),
    5620                 :            :                    __le32_to_cpu(arg.high_5ghz_chan),
    5621                 :            :                    __le32_to_cpu(arg.num_mem_reqs));
    5622                 :            : 
    5623                 :          0 :         dev_kfree_skb(skb);
    5624                 :          0 :         ar->svc_rdy_skb = NULL;
    5625                 :          0 :         complete(&ar->wmi.service_ready);
    5626                 :            : }
    5627                 :            : 
    5628                 :          0 : void ath10k_wmi_event_service_ready(struct ath10k *ar, struct sk_buff *skb)
    5629                 :            : {
    5630                 :          0 :         ar->svc_rdy_skb = skb;
    5631                 :          0 :         queue_work(ar->workqueue_aux, &ar->svc_rdy_work);
    5632                 :          0 : }
    5633                 :            : 
    5634                 :          0 : static int ath10k_wmi_op_pull_rdy_ev(struct ath10k *ar, struct sk_buff *skb,
    5635                 :            :                                      struct wmi_rdy_ev_arg *arg)
    5636                 :            : {
    5637                 :          0 :         struct wmi_ready_event *ev = (void *)skb->data;
    5638                 :            : 
    5639         [ #  # ]:          0 :         if (skb->len < sizeof(*ev))
    5640                 :            :                 return -EPROTO;
    5641                 :            : 
    5642                 :          0 :         skb_pull(skb, sizeof(*ev));
    5643                 :          0 :         arg->sw_version = ev->sw_version;
    5644                 :          0 :         arg->abi_version = ev->abi_version;
    5645                 :          0 :         arg->status = ev->status;
    5646                 :          0 :         arg->mac_addr = ev->mac_addr.addr;
    5647                 :            : 
    5648                 :          0 :         return 0;
    5649                 :            : }
    5650                 :            : 
    5651                 :          0 : static int ath10k_wmi_op_pull_roam_ev(struct ath10k *ar, struct sk_buff *skb,
    5652                 :            :                                       struct wmi_roam_ev_arg *arg)
    5653                 :            : {
    5654                 :          0 :         struct wmi_roam_ev *ev = (void *)skb->data;
    5655                 :            : 
    5656         [ #  # ]:          0 :         if (skb->len < sizeof(*ev))
    5657                 :            :                 return -EPROTO;
    5658                 :            : 
    5659                 :          0 :         skb_pull(skb, sizeof(*ev));
    5660                 :          0 :         arg->vdev_id = ev->vdev_id;
    5661                 :          0 :         arg->reason = ev->reason;
    5662                 :            : 
    5663                 :          0 :         return 0;
    5664                 :            : }
    5665                 :            : 
    5666                 :          0 : static int ath10k_wmi_op_pull_echo_ev(struct ath10k *ar,
    5667                 :            :                                       struct sk_buff *skb,
    5668                 :            :                                       struct wmi_echo_ev_arg *arg)
    5669                 :            : {
    5670                 :          0 :         struct wmi_echo_event *ev = (void *)skb->data;
    5671                 :            : 
    5672                 :          0 :         arg->value = ev->value;
    5673                 :            : 
    5674                 :          0 :         return 0;
    5675                 :            : }
    5676                 :            : 
    5677                 :          0 : int ath10k_wmi_event_ready(struct ath10k *ar, struct sk_buff *skb)
    5678                 :            : {
    5679                 :          0 :         struct wmi_rdy_ev_arg arg = {};
    5680                 :          0 :         int ret;
    5681                 :            : 
    5682         [ #  # ]:          0 :         ret = ath10k_wmi_pull_rdy(ar, skb, &arg);
    5683         [ #  # ]:          0 :         if (ret) {
    5684                 :          0 :                 ath10k_warn(ar, "failed to parse ready event: %d\n", ret);
    5685                 :          0 :                 return ret;
    5686                 :            :         }
    5687                 :            : 
    5688         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    5689                 :            :                    "wmi event ready sw_version 0x%08x abi_version %u mac_addr %pM status %d\n",
    5690                 :            :                    __le32_to_cpu(arg.sw_version),
    5691                 :            :                    __le32_to_cpu(arg.abi_version),
    5692                 :            :                    arg.mac_addr,
    5693                 :            :                    __le32_to_cpu(arg.status));
    5694                 :            : 
    5695         [ #  # ]:          0 :         if (is_zero_ether_addr(ar->mac_addr))
    5696                 :          0 :                 ether_addr_copy(ar->mac_addr, arg.mac_addr);
    5697                 :          0 :         complete(&ar->wmi.unified_ready);
    5698                 :          0 :         return 0;
    5699                 :            : }
    5700                 :            : 
    5701                 :          0 : void ath10k_wmi_event_service_available(struct ath10k *ar, struct sk_buff *skb)
    5702                 :            : {
    5703                 :          0 :         int ret;
    5704                 :          0 :         struct wmi_svc_avail_ev_arg arg = {};
    5705                 :            : 
    5706         [ #  # ]:          0 :         ret = ath10k_wmi_pull_svc_avail(ar, skb, &arg);
    5707         [ #  # ]:          0 :         if (ret) {
    5708                 :          0 :                 ath10k_warn(ar, "failed to parse service available event: %d\n",
    5709                 :            :                             ret);
    5710                 :            :         }
    5711                 :            : 
    5712                 :          0 :         ath10k_wmi_map_svc_ext(ar, arg.service_map_ext, ar->wmi.svc_map,
    5713         [ #  # ]:          0 :                                __le32_to_cpu(arg.service_map_ext_len));
    5714                 :          0 : }
    5715                 :            : 
    5716                 :            : static int ath10k_wmi_event_temperature(struct ath10k *ar, struct sk_buff *skb)
    5717                 :            : {
    5718                 :            :         const struct wmi_pdev_temperature_event *ev;
    5719                 :            : 
    5720                 :            :         ev = (struct wmi_pdev_temperature_event *)skb->data;
    5721                 :            :         if (WARN_ON(skb->len < sizeof(*ev)))
    5722                 :            :                 return -EPROTO;
    5723                 :            : 
    5724                 :            :         ath10k_thermal_event_temperature(ar, __le32_to_cpu(ev->temperature));
    5725                 :            :         return 0;
    5726                 :            : }
    5727                 :            : 
    5728                 :            : static int ath10k_wmi_event_pdev_bss_chan_info(struct ath10k *ar,
    5729                 :            :                                                struct sk_buff *skb)
    5730                 :            : {
    5731                 :            :         struct wmi_pdev_bss_chan_info_event *ev;
    5732                 :            :         struct survey_info *survey;
    5733                 :            :         u64 busy, total, tx, rx, rx_bss;
    5734                 :            :         u32 freq, noise_floor;
    5735                 :            :         u32 cc_freq_hz = ar->hw_params.channel_counters_freq_hz;
    5736                 :            :         int idx;
    5737                 :            : 
    5738                 :            :         ev = (struct wmi_pdev_bss_chan_info_event *)skb->data;
    5739                 :            :         if (WARN_ON(skb->len < sizeof(*ev)))
    5740                 :            :                 return -EPROTO;
    5741                 :            : 
    5742                 :            :         freq        = __le32_to_cpu(ev->freq);
    5743                 :            :         noise_floor = __le32_to_cpu(ev->noise_floor);
    5744                 :            :         busy        = __le64_to_cpu(ev->cycle_busy);
    5745                 :            :         total       = __le64_to_cpu(ev->cycle_total);
    5746                 :            :         tx          = __le64_to_cpu(ev->cycle_tx);
    5747                 :            :         rx          = __le64_to_cpu(ev->cycle_rx);
    5748                 :            :         rx_bss      = __le64_to_cpu(ev->cycle_rx_bss);
    5749                 :            : 
    5750                 :            :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    5751                 :            :                    "wmi event pdev bss chan info:\n freq: %d noise: %d cycle: busy %llu total %llu tx %llu rx %llu rx_bss %llu\n",
    5752                 :            :                    freq, noise_floor, busy, total, tx, rx, rx_bss);
    5753                 :            : 
    5754                 :            :         spin_lock_bh(&ar->data_lock);
    5755                 :            :         idx = freq_to_idx(ar, freq);
    5756                 :            :         if (idx >= ARRAY_SIZE(ar->survey)) {
    5757                 :            :                 ath10k_warn(ar, "bss chan info: invalid frequency %d (idx %d out of bounds)\n",
    5758                 :            :                             freq, idx);
    5759                 :            :                 goto exit;
    5760                 :            :         }
    5761                 :            : 
    5762                 :            :         survey = &ar->survey[idx];
    5763                 :            : 
    5764                 :            :         survey->noise     = noise_floor;
    5765                 :            :         survey->time      = div_u64(total, cc_freq_hz);
    5766                 :            :         survey->time_busy = div_u64(busy, cc_freq_hz);
    5767                 :            :         survey->time_rx   = div_u64(rx_bss, cc_freq_hz);
    5768                 :            :         survey->time_tx   = div_u64(tx, cc_freq_hz);
    5769                 :            :         survey->filled   |= (SURVEY_INFO_NOISE_DBM |
    5770                 :            :                              SURVEY_INFO_TIME |
    5771                 :            :                              SURVEY_INFO_TIME_BUSY |
    5772                 :            :                              SURVEY_INFO_TIME_RX |
    5773                 :            :                              SURVEY_INFO_TIME_TX);
    5774                 :            : exit:
    5775                 :            :         spin_unlock_bh(&ar->data_lock);
    5776                 :            :         complete(&ar->bss_survey_done);
    5777                 :            :         return 0;
    5778                 :            : }
    5779                 :            : 
    5780                 :          0 : static inline void ath10k_wmi_queue_set_coverage_class_work(struct ath10k *ar)
    5781                 :            : {
    5782         [ #  # ]:          0 :         if (ar->hw_params.hw_ops->set_coverage_class) {
    5783                 :          0 :                 spin_lock_bh(&ar->data_lock);
    5784                 :            : 
    5785                 :            :                 /* This call only ensures that the modified coverage class
    5786                 :            :                  * persists in case the firmware sets the registers back to
    5787                 :            :                  * their default value. So calling it is only necessary if the
    5788                 :            :                  * coverage class has a non-zero value.
    5789                 :            :                  */
    5790         [ #  # ]:          0 :                 if (ar->fw_coverage.coverage_class)
    5791                 :          0 :                         queue_work(ar->workqueue, &ar->set_coverage_class_work);
    5792                 :            : 
    5793                 :          0 :                 spin_unlock_bh(&ar->data_lock);
    5794                 :            :         }
    5795                 :          0 : }
    5796                 :            : 
    5797                 :          0 : static void ath10k_wmi_op_rx(struct ath10k *ar, struct sk_buff *skb)
    5798                 :            : {
    5799                 :          0 :         struct wmi_cmd_hdr *cmd_hdr;
    5800                 :          0 :         enum wmi_event_id id;
    5801                 :            : 
    5802                 :          0 :         cmd_hdr = (struct wmi_cmd_hdr *)skb->data;
    5803                 :          0 :         id = MS(__le32_to_cpu(cmd_hdr->cmd_id), WMI_CMD_HDR_CMD_ID);
    5804                 :            : 
    5805         [ #  # ]:          0 :         if (skb_pull(skb, sizeof(struct wmi_cmd_hdr)) == NULL)
    5806                 :          0 :                 goto out;
    5807                 :            : 
    5808                 :          0 :         trace_ath10k_wmi_event(ar, id, skb->data, skb->len);
    5809                 :            : 
    5810   [ #  #  #  #  :          0 :         switch (id) {
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
    5811                 :          0 :         case WMI_MGMT_RX_EVENTID:
    5812                 :          0 :                 ath10k_wmi_event_mgmt_rx(ar, skb);
    5813                 :            :                 /* mgmt_rx() owns the skb now! */
    5814                 :          0 :                 return;
    5815                 :          0 :         case WMI_SCAN_EVENTID:
    5816                 :          0 :                 ath10k_wmi_event_scan(ar, skb);
    5817                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    5818                 :          0 :                 break;
    5819                 :          0 :         case WMI_CHAN_INFO_EVENTID:
    5820                 :          0 :                 ath10k_wmi_event_chan_info(ar, skb);
    5821                 :          0 :                 break;
    5822                 :          0 :         case WMI_ECHO_EVENTID:
    5823                 :          0 :                 ath10k_wmi_event_echo(ar, skb);
    5824                 :          0 :                 break;
    5825                 :          0 :         case WMI_DEBUG_MESG_EVENTID:
    5826                 :          0 :                 ath10k_wmi_event_debug_mesg(ar, skb);
    5827                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    5828                 :          0 :                 break;
    5829                 :          0 :         case WMI_UPDATE_STATS_EVENTID:
    5830                 :          0 :                 ath10k_wmi_event_update_stats(ar, skb);
    5831                 :          0 :                 break;
    5832                 :          0 :         case WMI_VDEV_START_RESP_EVENTID:
    5833                 :          0 :                 ath10k_wmi_event_vdev_start_resp(ar, skb);
    5834                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    5835                 :          0 :                 break;
    5836                 :          0 :         case WMI_VDEV_STOPPED_EVENTID:
    5837                 :          0 :                 ath10k_wmi_event_vdev_stopped(ar, skb);
    5838                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    5839                 :          0 :                 break;
    5840                 :          0 :         case WMI_PEER_STA_KICKOUT_EVENTID:
    5841                 :          0 :                 ath10k_wmi_event_peer_sta_kickout(ar, skb);
    5842                 :          0 :                 break;
    5843                 :          0 :         case WMI_HOST_SWBA_EVENTID:
    5844                 :          0 :                 ath10k_wmi_event_host_swba(ar, skb);
    5845                 :          0 :                 break;
    5846                 :          0 :         case WMI_TBTTOFFSET_UPDATE_EVENTID:
    5847                 :          0 :                 ath10k_wmi_event_tbttoffset_update(ar, skb);
    5848                 :          0 :                 break;
    5849                 :          0 :         case WMI_PHYERR_EVENTID:
    5850                 :          0 :                 ath10k_wmi_event_phyerr(ar, skb);
    5851                 :          0 :                 break;
    5852                 :          0 :         case WMI_ROAM_EVENTID:
    5853                 :          0 :                 ath10k_wmi_event_roam(ar, skb);
    5854                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    5855                 :          0 :                 break;
    5856                 :          0 :         case WMI_PROFILE_MATCH:
    5857                 :          0 :                 ath10k_wmi_event_profile_match(ar, skb);
    5858                 :          0 :                 break;
    5859                 :          0 :         case WMI_DEBUG_PRINT_EVENTID:
    5860                 :          0 :                 ath10k_wmi_event_debug_print(ar, skb);
    5861                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    5862                 :          0 :                 break;
    5863                 :          0 :         case WMI_PDEV_QVIT_EVENTID:
    5864                 :          0 :                 ath10k_wmi_event_pdev_qvit(ar, skb);
    5865                 :          0 :                 break;
    5866                 :          0 :         case WMI_WLAN_PROFILE_DATA_EVENTID:
    5867                 :          0 :                 ath10k_wmi_event_wlan_profile_data(ar, skb);
    5868                 :          0 :                 break;
    5869                 :          0 :         case WMI_RTT_MEASUREMENT_REPORT_EVENTID:
    5870                 :          0 :                 ath10k_wmi_event_rtt_measurement_report(ar, skb);
    5871                 :          0 :                 break;
    5872                 :          0 :         case WMI_TSF_MEASUREMENT_REPORT_EVENTID:
    5873                 :          0 :                 ath10k_wmi_event_tsf_measurement_report(ar, skb);
    5874                 :          0 :                 break;
    5875                 :          0 :         case WMI_RTT_ERROR_REPORT_EVENTID:
    5876                 :          0 :                 ath10k_wmi_event_rtt_error_report(ar, skb);
    5877                 :          0 :                 break;
    5878                 :          0 :         case WMI_WOW_WAKEUP_HOST_EVENTID:
    5879                 :          0 :                 ath10k_wmi_event_wow_wakeup_host(ar, skb);
    5880                 :          0 :                 break;
    5881                 :          0 :         case WMI_DCS_INTERFERENCE_EVENTID:
    5882                 :          0 :                 ath10k_wmi_event_dcs_interference(ar, skb);
    5883                 :          0 :                 break;
    5884                 :          0 :         case WMI_PDEV_TPC_CONFIG_EVENTID:
    5885                 :          0 :                 ath10k_wmi_event_pdev_tpc_config(ar, skb);
    5886                 :          0 :                 break;
    5887                 :          0 :         case WMI_PDEV_FTM_INTG_EVENTID:
    5888                 :          0 :                 ath10k_wmi_event_pdev_ftm_intg(ar, skb);
    5889                 :          0 :                 break;
    5890                 :          0 :         case WMI_GTK_OFFLOAD_STATUS_EVENTID:
    5891                 :          0 :                 ath10k_wmi_event_gtk_offload_status(ar, skb);
    5892                 :          0 :                 break;
    5893                 :          0 :         case WMI_GTK_REKEY_FAIL_EVENTID:
    5894                 :          0 :                 ath10k_wmi_event_gtk_rekey_fail(ar, skb);
    5895                 :          0 :                 break;
    5896                 :          0 :         case WMI_TX_DELBA_COMPLETE_EVENTID:
    5897                 :          0 :                 ath10k_wmi_event_delba_complete(ar, skb);
    5898                 :          0 :                 break;
    5899                 :          0 :         case WMI_TX_ADDBA_COMPLETE_EVENTID:
    5900                 :          0 :                 ath10k_wmi_event_addba_complete(ar, skb);
    5901                 :          0 :                 break;
    5902                 :          0 :         case WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID:
    5903                 :          0 :                 ath10k_wmi_event_vdev_install_key_complete(ar, skb);
    5904                 :          0 :                 break;
    5905                 :            :         case WMI_SERVICE_READY_EVENTID:
    5906                 :          0 :                 ath10k_wmi_event_service_ready(ar, skb);
    5907                 :            :                 return;
    5908                 :          0 :         case WMI_READY_EVENTID:
    5909                 :          0 :                 ath10k_wmi_event_ready(ar, skb);
    5910                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    5911                 :          0 :                 break;
    5912                 :          0 :         case WMI_SERVICE_AVAILABLE_EVENTID:
    5913                 :          0 :                 ath10k_wmi_event_service_available(ar, skb);
    5914                 :          0 :                 break;
    5915                 :          0 :         default:
    5916                 :          0 :                 ath10k_warn(ar, "Unknown eventid: %d\n", id);
    5917                 :          0 :                 break;
    5918                 :            :         }
    5919                 :            : 
    5920                 :          0 : out:
    5921                 :          0 :         dev_kfree_skb(skb);
    5922                 :            : }
    5923                 :            : 
    5924                 :          0 : static void ath10k_wmi_10_1_op_rx(struct ath10k *ar, struct sk_buff *skb)
    5925                 :            : {
    5926                 :          0 :         struct wmi_cmd_hdr *cmd_hdr;
    5927                 :          0 :         enum wmi_10x_event_id id;
    5928                 :          0 :         bool consumed;
    5929                 :            : 
    5930                 :          0 :         cmd_hdr = (struct wmi_cmd_hdr *)skb->data;
    5931                 :          0 :         id = MS(__le32_to_cpu(cmd_hdr->cmd_id), WMI_CMD_HDR_CMD_ID);
    5932                 :            : 
    5933         [ #  # ]:          0 :         if (skb_pull(skb, sizeof(struct wmi_cmd_hdr)) == NULL)
    5934                 :          0 :                 goto out;
    5935                 :            : 
    5936                 :          0 :         trace_ath10k_wmi_event(ar, id, skb->data, skb->len);
    5937                 :            : 
    5938   [ #  #  #  #  :          0 :         consumed = ath10k_tm_event_wmi(ar, id, skb);
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                      # ]
    5939                 :            : 
    5940                 :            :         /* Ready event must be handled normally also in UTF mode so that we
    5941                 :            :          * know the UTF firmware has booted, others we are just bypass WMI
    5942                 :            :          * events to testmode.
    5943                 :            :          */
    5944                 :          0 :         if (consumed && id != WMI_10X_READY_EVENTID) {
    5945                 :            :                 ath10k_dbg(ar, ATH10K_DBG_WMI,
    5946                 :            :                            "wmi testmode consumed 0x%x\n", id);
    5947                 :            :                 goto out;
    5948                 :            :         }
    5949                 :            : 
    5950   [ #  #  #  #  :          0 :         switch (id) {
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                      # ]
    5951                 :          0 :         case WMI_10X_MGMT_RX_EVENTID:
    5952                 :          0 :                 ath10k_wmi_event_mgmt_rx(ar, skb);
    5953                 :            :                 /* mgmt_rx() owns the skb now! */
    5954                 :          0 :                 return;
    5955                 :          0 :         case WMI_10X_SCAN_EVENTID:
    5956                 :          0 :                 ath10k_wmi_event_scan(ar, skb);
    5957                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    5958                 :          0 :                 break;
    5959                 :          0 :         case WMI_10X_CHAN_INFO_EVENTID:
    5960                 :          0 :                 ath10k_wmi_event_chan_info(ar, skb);
    5961                 :          0 :                 break;
    5962                 :          0 :         case WMI_10X_ECHO_EVENTID:
    5963                 :          0 :                 ath10k_wmi_event_echo(ar, skb);
    5964                 :          0 :                 break;
    5965                 :          0 :         case WMI_10X_DEBUG_MESG_EVENTID:
    5966                 :          0 :                 ath10k_wmi_event_debug_mesg(ar, skb);
    5967                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    5968                 :          0 :                 break;
    5969                 :          0 :         case WMI_10X_UPDATE_STATS_EVENTID:
    5970                 :          0 :                 ath10k_wmi_event_update_stats(ar, skb);
    5971                 :          0 :                 break;
    5972                 :          0 :         case WMI_10X_VDEV_START_RESP_EVENTID:
    5973                 :          0 :                 ath10k_wmi_event_vdev_start_resp(ar, skb);
    5974                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    5975                 :          0 :                 break;
    5976                 :          0 :         case WMI_10X_VDEV_STOPPED_EVENTID:
    5977                 :          0 :                 ath10k_wmi_event_vdev_stopped(ar, skb);
    5978                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    5979                 :          0 :                 break;
    5980                 :          0 :         case WMI_10X_PEER_STA_KICKOUT_EVENTID:
    5981                 :          0 :                 ath10k_wmi_event_peer_sta_kickout(ar, skb);
    5982                 :          0 :                 break;
    5983                 :          0 :         case WMI_10X_HOST_SWBA_EVENTID:
    5984                 :          0 :                 ath10k_wmi_event_host_swba(ar, skb);
    5985                 :          0 :                 break;
    5986                 :          0 :         case WMI_10X_TBTTOFFSET_UPDATE_EVENTID:
    5987                 :          0 :                 ath10k_wmi_event_tbttoffset_update(ar, skb);
    5988                 :          0 :                 break;
    5989                 :          0 :         case WMI_10X_PHYERR_EVENTID:
    5990                 :          0 :                 ath10k_wmi_event_phyerr(ar, skb);
    5991                 :          0 :                 break;
    5992                 :          0 :         case WMI_10X_ROAM_EVENTID:
    5993                 :          0 :                 ath10k_wmi_event_roam(ar, skb);
    5994                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    5995                 :          0 :                 break;
    5996                 :          0 :         case WMI_10X_PROFILE_MATCH:
    5997                 :          0 :                 ath10k_wmi_event_profile_match(ar, skb);
    5998                 :          0 :                 break;
    5999                 :          0 :         case WMI_10X_DEBUG_PRINT_EVENTID:
    6000                 :          0 :                 ath10k_wmi_event_debug_print(ar, skb);
    6001                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    6002                 :          0 :                 break;
    6003                 :          0 :         case WMI_10X_PDEV_QVIT_EVENTID:
    6004                 :          0 :                 ath10k_wmi_event_pdev_qvit(ar, skb);
    6005                 :          0 :                 break;
    6006                 :          0 :         case WMI_10X_WLAN_PROFILE_DATA_EVENTID:
    6007                 :          0 :                 ath10k_wmi_event_wlan_profile_data(ar, skb);
    6008                 :          0 :                 break;
    6009                 :          0 :         case WMI_10X_RTT_MEASUREMENT_REPORT_EVENTID:
    6010                 :          0 :                 ath10k_wmi_event_rtt_measurement_report(ar, skb);
    6011                 :          0 :                 break;
    6012                 :          0 :         case WMI_10X_TSF_MEASUREMENT_REPORT_EVENTID:
    6013                 :          0 :                 ath10k_wmi_event_tsf_measurement_report(ar, skb);
    6014                 :          0 :                 break;
    6015                 :          0 :         case WMI_10X_RTT_ERROR_REPORT_EVENTID:
    6016                 :          0 :                 ath10k_wmi_event_rtt_error_report(ar, skb);
    6017                 :          0 :                 break;
    6018                 :          0 :         case WMI_10X_WOW_WAKEUP_HOST_EVENTID:
    6019                 :          0 :                 ath10k_wmi_event_wow_wakeup_host(ar, skb);
    6020                 :          0 :                 break;
    6021                 :          0 :         case WMI_10X_DCS_INTERFERENCE_EVENTID:
    6022                 :          0 :                 ath10k_wmi_event_dcs_interference(ar, skb);
    6023                 :          0 :                 break;
    6024                 :          0 :         case WMI_10X_PDEV_TPC_CONFIG_EVENTID:
    6025                 :          0 :                 ath10k_wmi_event_pdev_tpc_config(ar, skb);
    6026                 :          0 :                 break;
    6027                 :          0 :         case WMI_10X_INST_RSSI_STATS_EVENTID:
    6028                 :          0 :                 ath10k_wmi_event_inst_rssi_stats(ar, skb);
    6029                 :          0 :                 break;
    6030                 :          0 :         case WMI_10X_VDEV_STANDBY_REQ_EVENTID:
    6031                 :          0 :                 ath10k_wmi_event_vdev_standby_req(ar, skb);
    6032                 :          0 :                 break;
    6033                 :          0 :         case WMI_10X_VDEV_RESUME_REQ_EVENTID:
    6034                 :          0 :                 ath10k_wmi_event_vdev_resume_req(ar, skb);
    6035                 :          0 :                 break;
    6036                 :            :         case WMI_10X_SERVICE_READY_EVENTID:
    6037                 :          0 :                 ath10k_wmi_event_service_ready(ar, skb);
    6038                 :            :                 return;
    6039                 :          0 :         case WMI_10X_READY_EVENTID:
    6040                 :          0 :                 ath10k_wmi_event_ready(ar, skb);
    6041                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    6042                 :          0 :                 break;
    6043                 :            :         case WMI_10X_PDEV_UTF_EVENTID:
    6044                 :            :                 /* ignore utf events */
    6045                 :            :                 break;
    6046                 :          0 :         default:
    6047                 :          0 :                 ath10k_warn(ar, "Unknown eventid: %d\n", id);
    6048                 :          0 :                 break;
    6049                 :            :         }
    6050                 :            : 
    6051                 :          0 : out:
    6052                 :          0 :         dev_kfree_skb(skb);
    6053                 :            : }
    6054                 :            : 
    6055                 :          0 : static void ath10k_wmi_10_2_op_rx(struct ath10k *ar, struct sk_buff *skb)
    6056                 :            : {
    6057                 :          0 :         struct wmi_cmd_hdr *cmd_hdr;
    6058                 :          0 :         enum wmi_10_2_event_id id;
    6059                 :          0 :         bool consumed;
    6060                 :            : 
    6061                 :          0 :         cmd_hdr = (struct wmi_cmd_hdr *)skb->data;
    6062                 :          0 :         id = MS(__le32_to_cpu(cmd_hdr->cmd_id), WMI_CMD_HDR_CMD_ID);
    6063                 :            : 
    6064         [ #  # ]:          0 :         if (skb_pull(skb, sizeof(struct wmi_cmd_hdr)) == NULL)
    6065                 :          0 :                 goto out;
    6066                 :            : 
    6067                 :          0 :         trace_ath10k_wmi_event(ar, id, skb->data, skb->len);
    6068                 :            : 
    6069   [ #  #  #  #  :          0 :         consumed = ath10k_tm_event_wmi(ar, id, skb);
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
    6070                 :            : 
    6071                 :            :         /* Ready event must be handled normally also in UTF mode so that we
    6072                 :            :          * know the UTF firmware has booted, others we are just bypass WMI
    6073                 :            :          * events to testmode.
    6074                 :            :          */
    6075                 :          0 :         if (consumed && id != WMI_10_2_READY_EVENTID) {
    6076                 :            :                 ath10k_dbg(ar, ATH10K_DBG_WMI,
    6077                 :            :                            "wmi testmode consumed 0x%x\n", id);
    6078                 :            :                 goto out;
    6079                 :            :         }
    6080                 :            : 
    6081   [ #  #  #  #  :          0 :         switch (id) {
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
    6082                 :          0 :         case WMI_10_2_MGMT_RX_EVENTID:
    6083                 :          0 :                 ath10k_wmi_event_mgmt_rx(ar, skb);
    6084                 :            :                 /* mgmt_rx() owns the skb now! */
    6085                 :          0 :                 return;
    6086                 :          0 :         case WMI_10_2_SCAN_EVENTID:
    6087                 :          0 :                 ath10k_wmi_event_scan(ar, skb);
    6088                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    6089                 :          0 :                 break;
    6090                 :          0 :         case WMI_10_2_CHAN_INFO_EVENTID:
    6091                 :          0 :                 ath10k_wmi_event_chan_info(ar, skb);
    6092                 :          0 :                 break;
    6093                 :          0 :         case WMI_10_2_ECHO_EVENTID:
    6094                 :          0 :                 ath10k_wmi_event_echo(ar, skb);
    6095                 :          0 :                 break;
    6096                 :          0 :         case WMI_10_2_DEBUG_MESG_EVENTID:
    6097                 :          0 :                 ath10k_wmi_event_debug_mesg(ar, skb);
    6098                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    6099                 :          0 :                 break;
    6100                 :          0 :         case WMI_10_2_UPDATE_STATS_EVENTID:
    6101                 :          0 :                 ath10k_wmi_event_update_stats(ar, skb);
    6102                 :          0 :                 break;
    6103                 :          0 :         case WMI_10_2_VDEV_START_RESP_EVENTID:
    6104                 :          0 :                 ath10k_wmi_event_vdev_start_resp(ar, skb);
    6105                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    6106                 :          0 :                 break;
    6107                 :          0 :         case WMI_10_2_VDEV_STOPPED_EVENTID:
    6108                 :          0 :                 ath10k_wmi_event_vdev_stopped(ar, skb);
    6109                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    6110                 :          0 :                 break;
    6111                 :          0 :         case WMI_10_2_PEER_STA_KICKOUT_EVENTID:
    6112                 :          0 :                 ath10k_wmi_event_peer_sta_kickout(ar, skb);
    6113                 :          0 :                 break;
    6114                 :          0 :         case WMI_10_2_HOST_SWBA_EVENTID:
    6115                 :          0 :                 ath10k_wmi_event_host_swba(ar, skb);
    6116                 :          0 :                 break;
    6117                 :          0 :         case WMI_10_2_TBTTOFFSET_UPDATE_EVENTID:
    6118                 :          0 :                 ath10k_wmi_event_tbttoffset_update(ar, skb);
    6119                 :          0 :                 break;
    6120                 :          0 :         case WMI_10_2_PHYERR_EVENTID:
    6121                 :          0 :                 ath10k_wmi_event_phyerr(ar, skb);
    6122                 :          0 :                 break;
    6123                 :          0 :         case WMI_10_2_ROAM_EVENTID:
    6124                 :          0 :                 ath10k_wmi_event_roam(ar, skb);
    6125                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    6126                 :          0 :                 break;
    6127                 :          0 :         case WMI_10_2_PROFILE_MATCH:
    6128                 :          0 :                 ath10k_wmi_event_profile_match(ar, skb);
    6129                 :          0 :                 break;
    6130                 :          0 :         case WMI_10_2_DEBUG_PRINT_EVENTID:
    6131                 :          0 :                 ath10k_wmi_event_debug_print(ar, skb);
    6132                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    6133                 :          0 :                 break;
    6134                 :          0 :         case WMI_10_2_PDEV_QVIT_EVENTID:
    6135                 :          0 :                 ath10k_wmi_event_pdev_qvit(ar, skb);
    6136                 :          0 :                 break;
    6137                 :          0 :         case WMI_10_2_WLAN_PROFILE_DATA_EVENTID:
    6138                 :          0 :                 ath10k_wmi_event_wlan_profile_data(ar, skb);
    6139                 :          0 :                 break;
    6140                 :          0 :         case WMI_10_2_RTT_MEASUREMENT_REPORT_EVENTID:
    6141                 :          0 :                 ath10k_wmi_event_rtt_measurement_report(ar, skb);
    6142                 :          0 :                 break;
    6143                 :          0 :         case WMI_10_2_TSF_MEASUREMENT_REPORT_EVENTID:
    6144                 :          0 :                 ath10k_wmi_event_tsf_measurement_report(ar, skb);
    6145                 :          0 :                 break;
    6146                 :          0 :         case WMI_10_2_RTT_ERROR_REPORT_EVENTID:
    6147                 :          0 :                 ath10k_wmi_event_rtt_error_report(ar, skb);
    6148                 :          0 :                 break;
    6149                 :          0 :         case WMI_10_2_WOW_WAKEUP_HOST_EVENTID:
    6150                 :          0 :                 ath10k_wmi_event_wow_wakeup_host(ar, skb);
    6151                 :          0 :                 break;
    6152                 :          0 :         case WMI_10_2_DCS_INTERFERENCE_EVENTID:
    6153                 :          0 :                 ath10k_wmi_event_dcs_interference(ar, skb);
    6154                 :          0 :                 break;
    6155                 :          0 :         case WMI_10_2_PDEV_TPC_CONFIG_EVENTID:
    6156                 :          0 :                 ath10k_wmi_event_pdev_tpc_config(ar, skb);
    6157                 :          0 :                 break;
    6158                 :          0 :         case WMI_10_2_INST_RSSI_STATS_EVENTID:
    6159                 :          0 :                 ath10k_wmi_event_inst_rssi_stats(ar, skb);
    6160                 :          0 :                 break;
    6161                 :          0 :         case WMI_10_2_VDEV_STANDBY_REQ_EVENTID:
    6162                 :          0 :                 ath10k_wmi_event_vdev_standby_req(ar, skb);
    6163                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    6164                 :          0 :                 break;
    6165                 :          0 :         case WMI_10_2_VDEV_RESUME_REQ_EVENTID:
    6166                 :          0 :                 ath10k_wmi_event_vdev_resume_req(ar, skb);
    6167                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    6168                 :          0 :                 break;
    6169                 :            :         case WMI_10_2_SERVICE_READY_EVENTID:
    6170                 :          0 :                 ath10k_wmi_event_service_ready(ar, skb);
    6171                 :            :                 return;
    6172                 :          0 :         case WMI_10_2_READY_EVENTID:
    6173                 :          0 :                 ath10k_wmi_event_ready(ar, skb);
    6174                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    6175                 :          0 :                 break;
    6176                 :          0 :         case WMI_10_2_PDEV_TEMPERATURE_EVENTID:
    6177                 :          0 :                 ath10k_wmi_event_temperature(ar, skb);
    6178                 :          0 :                 break;
    6179                 :          0 :         case WMI_10_2_PDEV_BSS_CHAN_INFO_EVENTID:
    6180                 :          0 :                 ath10k_wmi_event_pdev_bss_chan_info(ar, skb);
    6181                 :          0 :                 break;
    6182                 :          0 :         case WMI_10_2_RTT_KEEPALIVE_EVENTID:
    6183                 :            :         case WMI_10_2_GPIO_INPUT_EVENTID:
    6184                 :            :         case WMI_10_2_PEER_RATECODE_LIST_EVENTID:
    6185                 :            :         case WMI_10_2_GENERIC_BUFFER_EVENTID:
    6186                 :            :         case WMI_10_2_MCAST_BUF_RELEASE_EVENTID:
    6187                 :            :         case WMI_10_2_MCAST_LIST_AGEOUT_EVENTID:
    6188                 :            :         case WMI_10_2_WDS_PEER_EVENTID:
    6189         [ #  # ]:          0 :                 ath10k_dbg(ar, ATH10K_DBG_WMI,
    6190                 :            :                            "received event id %d not implemented\n", id);
    6191                 :            :                 break;
    6192                 :          0 :         case WMI_10_2_PEER_STA_PS_STATECHG_EVENTID:
    6193                 :          0 :                 ath10k_wmi_event_peer_sta_ps_state_chg(ar, skb);
    6194                 :          0 :                 break;
    6195                 :          0 :         default:
    6196                 :          0 :                 ath10k_warn(ar, "Unknown eventid: %d\n", id);
    6197                 :          0 :                 break;
    6198                 :            :         }
    6199                 :            : 
    6200                 :          0 : out:
    6201                 :          0 :         dev_kfree_skb(skb);
    6202                 :            : }
    6203                 :            : 
    6204                 :          0 : static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, struct sk_buff *skb)
    6205                 :            : {
    6206                 :          0 :         struct wmi_cmd_hdr *cmd_hdr;
    6207                 :          0 :         enum wmi_10_4_event_id id;
    6208                 :          0 :         bool consumed;
    6209                 :            : 
    6210                 :          0 :         cmd_hdr = (struct wmi_cmd_hdr *)skb->data;
    6211                 :          0 :         id = MS(__le32_to_cpu(cmd_hdr->cmd_id), WMI_CMD_HDR_CMD_ID);
    6212                 :            : 
    6213         [ #  # ]:          0 :         if (!skb_pull(skb, sizeof(struct wmi_cmd_hdr)))
    6214                 :          0 :                 goto out;
    6215                 :            : 
    6216                 :          0 :         trace_ath10k_wmi_event(ar, id, skb->data, skb->len);
    6217                 :            : 
    6218   [ #  #  #  #  :          0 :         consumed = ath10k_tm_event_wmi(ar, id, skb);
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                      # ]
    6219                 :            : 
    6220                 :            :         /* Ready event must be handled normally also in UTF mode so that we
    6221                 :            :          * know the UTF firmware has booted, others we are just bypass WMI
    6222                 :            :          * events to testmode.
    6223                 :            :          */
    6224                 :          0 :         if (consumed && id != WMI_10_4_READY_EVENTID) {
    6225                 :            :                 ath10k_dbg(ar, ATH10K_DBG_WMI,
    6226                 :            :                            "wmi testmode consumed 0x%x\n", id);
    6227                 :            :                 goto out;
    6228                 :            :         }
    6229                 :            : 
    6230   [ #  #  #  #  :          0 :         switch (id) {
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                      # ]
    6231                 :          0 :         case WMI_10_4_MGMT_RX_EVENTID:
    6232                 :          0 :                 ath10k_wmi_event_mgmt_rx(ar, skb);
    6233                 :            :                 /* mgmt_rx() owns the skb now! */
    6234                 :          0 :                 return;
    6235                 :          0 :         case WMI_10_4_ECHO_EVENTID:
    6236                 :          0 :                 ath10k_wmi_event_echo(ar, skb);
    6237                 :          0 :                 break;
    6238                 :          0 :         case WMI_10_4_DEBUG_MESG_EVENTID:
    6239                 :          0 :                 ath10k_wmi_event_debug_mesg(ar, skb);
    6240                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    6241                 :          0 :                 break;
    6242                 :            :         case WMI_10_4_SERVICE_READY_EVENTID:
    6243                 :          0 :                 ath10k_wmi_event_service_ready(ar, skb);
    6244                 :            :                 return;
    6245                 :          0 :         case WMI_10_4_SCAN_EVENTID:
    6246                 :          0 :                 ath10k_wmi_event_scan(ar, skb);
    6247                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    6248                 :          0 :                 break;
    6249                 :          0 :         case WMI_10_4_CHAN_INFO_EVENTID:
    6250                 :          0 :                 ath10k_wmi_event_chan_info(ar, skb);
    6251                 :          0 :                 break;
    6252                 :          0 :         case WMI_10_4_PHYERR_EVENTID:
    6253                 :          0 :                 ath10k_wmi_event_phyerr(ar, skb);
    6254                 :          0 :                 break;
    6255                 :          0 :         case WMI_10_4_READY_EVENTID:
    6256                 :          0 :                 ath10k_wmi_event_ready(ar, skb);
    6257                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    6258                 :          0 :                 break;
    6259                 :          0 :         case WMI_10_4_PEER_STA_KICKOUT_EVENTID:
    6260                 :          0 :                 ath10k_wmi_event_peer_sta_kickout(ar, skb);
    6261                 :          0 :                 break;
    6262                 :          0 :         case WMI_10_4_ROAM_EVENTID:
    6263                 :          0 :                 ath10k_wmi_event_roam(ar, skb);
    6264                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    6265                 :          0 :                 break;
    6266                 :          0 :         case WMI_10_4_HOST_SWBA_EVENTID:
    6267                 :          0 :                 ath10k_wmi_event_host_swba(ar, skb);
    6268                 :          0 :                 break;
    6269                 :          0 :         case WMI_10_4_TBTTOFFSET_UPDATE_EVENTID:
    6270                 :          0 :                 ath10k_wmi_event_tbttoffset_update(ar, skb);
    6271                 :          0 :                 break;
    6272                 :          0 :         case WMI_10_4_DEBUG_PRINT_EVENTID:
    6273                 :          0 :                 ath10k_wmi_event_debug_print(ar, skb);
    6274                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    6275                 :          0 :                 break;
    6276                 :          0 :         case WMI_10_4_VDEV_START_RESP_EVENTID:
    6277                 :          0 :                 ath10k_wmi_event_vdev_start_resp(ar, skb);
    6278                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    6279                 :          0 :                 break;
    6280                 :          0 :         case WMI_10_4_VDEV_STOPPED_EVENTID:
    6281                 :          0 :                 ath10k_wmi_event_vdev_stopped(ar, skb);
    6282                 :          0 :                 ath10k_wmi_queue_set_coverage_class_work(ar);
    6283                 :          0 :                 break;
    6284                 :          0 :         case WMI_10_4_WOW_WAKEUP_HOST_EVENTID:
    6285                 :            :         case WMI_10_4_PEER_RATECODE_LIST_EVENTID:
    6286                 :            :         case WMI_10_4_WDS_PEER_EVENTID:
    6287                 :            :         case WMI_10_4_DEBUG_FATAL_CONDITION_EVENTID:
    6288         [ #  # ]:          0 :                 ath10k_dbg(ar, ATH10K_DBG_WMI,
    6289                 :            :                            "received event id %d not implemented\n", id);
    6290                 :            :                 break;
    6291                 :          0 :         case WMI_10_4_UPDATE_STATS_EVENTID:
    6292                 :          0 :                 ath10k_wmi_event_update_stats(ar, skb);
    6293                 :          0 :                 break;
    6294                 :          0 :         case WMI_10_4_PDEV_TEMPERATURE_EVENTID:
    6295                 :          0 :                 ath10k_wmi_event_temperature(ar, skb);
    6296                 :          0 :                 break;
    6297                 :          0 :         case WMI_10_4_PDEV_BSS_CHAN_INFO_EVENTID:
    6298                 :          0 :                 ath10k_wmi_event_pdev_bss_chan_info(ar, skb);
    6299                 :          0 :                 break;
    6300                 :          0 :         case WMI_10_4_PDEV_TPC_CONFIG_EVENTID:
    6301                 :          0 :                 ath10k_wmi_event_pdev_tpc_config(ar, skb);
    6302                 :          0 :                 break;
    6303                 :          0 :         case WMI_10_4_TDLS_PEER_EVENTID:
    6304                 :          0 :                 ath10k_wmi_handle_tdls_peer_event(ar, skb);
    6305                 :          0 :                 break;
    6306                 :          0 :         case WMI_10_4_PDEV_TPC_TABLE_EVENTID:
    6307                 :          0 :                 ath10k_wmi_event_tpc_final_table(ar, skb);
    6308                 :          0 :                 break;
    6309                 :          0 :         case WMI_10_4_DFS_STATUS_CHECK_EVENTID:
    6310                 :          0 :                 ath10k_wmi_event_dfs_status_check(ar, skb);
    6311                 :          0 :                 break;
    6312                 :          0 :         case WMI_10_4_PEER_STA_PS_STATECHG_EVENTID:
    6313                 :          0 :                 ath10k_wmi_event_peer_sta_ps_state_chg(ar, skb);
    6314                 :          0 :                 break;
    6315                 :          0 :         default:
    6316                 :          0 :                 ath10k_warn(ar, "Unknown eventid: %d\n", id);
    6317                 :          0 :                 break;
    6318                 :            :         }
    6319                 :            : 
    6320                 :          0 : out:
    6321                 :          0 :         dev_kfree_skb(skb);
    6322                 :            : }
    6323                 :            : 
    6324                 :          0 : static void ath10k_wmi_process_rx(struct ath10k *ar, struct sk_buff *skb)
    6325                 :            : {
    6326                 :          0 :         int ret;
    6327                 :            : 
    6328         [ #  # ]:          0 :         ret = ath10k_wmi_rx(ar, skb);
    6329                 :          0 :         if (ret)
    6330                 :          0 :                 ath10k_warn(ar, "failed to process wmi rx: %d\n", ret);
    6331                 :          0 : }
    6332                 :            : 
    6333                 :          0 : int ath10k_wmi_connect(struct ath10k *ar)
    6334                 :            : {
    6335                 :          0 :         int status;
    6336                 :          0 :         struct ath10k_htc_svc_conn_req conn_req;
    6337                 :          0 :         struct ath10k_htc_svc_conn_resp conn_resp;
    6338                 :            : 
    6339                 :          0 :         memset(&ar->wmi.svc_map, 0, sizeof(ar->wmi.svc_map));
    6340                 :            : 
    6341                 :          0 :         memset(&conn_req, 0, sizeof(conn_req));
    6342                 :          0 :         memset(&conn_resp, 0, sizeof(conn_resp));
    6343                 :            : 
    6344                 :            :         /* these fields are the same for all service endpoints */
    6345                 :          0 :         conn_req.ep_ops.ep_tx_complete = ath10k_wmi_htc_tx_complete;
    6346                 :          0 :         conn_req.ep_ops.ep_rx_complete = ath10k_wmi_process_rx;
    6347                 :          0 :         conn_req.ep_ops.ep_tx_credits = ath10k_wmi_op_ep_tx_credits;
    6348                 :            : 
    6349                 :            :         /* connect to control service */
    6350                 :          0 :         conn_req.service_id = ATH10K_HTC_SVC_ID_WMI_CONTROL;
    6351                 :            : 
    6352                 :          0 :         status = ath10k_htc_connect_service(&ar->htc, &conn_req, &conn_resp);
    6353         [ #  # ]:          0 :         if (status) {
    6354                 :          0 :                 ath10k_warn(ar, "failed to connect to WMI CONTROL service status: %d\n",
    6355                 :            :                             status);
    6356                 :          0 :                 return status;
    6357                 :            :         }
    6358                 :            : 
    6359                 :          0 :         ar->wmi.eid = conn_resp.eid;
    6360                 :          0 :         return 0;
    6361                 :            : }
    6362                 :            : 
    6363                 :            : static struct sk_buff *
    6364                 :          0 : ath10k_wmi_op_gen_pdev_set_base_macaddr(struct ath10k *ar,
    6365                 :            :                                         const u8 macaddr[ETH_ALEN])
    6366                 :            : {
    6367                 :          0 :         struct wmi_pdev_set_base_macaddr_cmd *cmd;
    6368                 :          0 :         struct sk_buff *skb;
    6369                 :            : 
    6370                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    6371         [ #  # ]:          0 :         if (!skb)
    6372                 :            :                 return ERR_PTR(-ENOMEM);
    6373                 :            : 
    6374                 :          0 :         cmd = (struct wmi_pdev_set_base_macaddr_cmd *)skb->data;
    6375         [ #  # ]:          0 :         ether_addr_copy(cmd->mac_addr.addr, macaddr);
    6376                 :            : 
    6377         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    6378                 :            :                    "wmi pdev basemac %pM\n", macaddr);
    6379                 :            :         return skb;
    6380                 :            : }
    6381                 :            : 
    6382                 :            : static struct sk_buff *
    6383                 :          0 : ath10k_wmi_op_gen_pdev_set_rd(struct ath10k *ar, u16 rd, u16 rd2g, u16 rd5g,
    6384                 :            :                               u16 ctl2g, u16 ctl5g,
    6385                 :            :                               enum wmi_dfs_region dfs_reg)
    6386                 :            : {
    6387                 :          0 :         struct wmi_pdev_set_regdomain_cmd *cmd;
    6388                 :          0 :         struct sk_buff *skb;
    6389                 :            : 
    6390                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    6391         [ #  # ]:          0 :         if (!skb)
    6392                 :            :                 return ERR_PTR(-ENOMEM);
    6393                 :            : 
    6394                 :          0 :         cmd = (struct wmi_pdev_set_regdomain_cmd *)skb->data;
    6395                 :          0 :         cmd->reg_domain = __cpu_to_le32(rd);
    6396                 :          0 :         cmd->reg_domain_2G = __cpu_to_le32(rd2g);
    6397                 :          0 :         cmd->reg_domain_5G = __cpu_to_le32(rd5g);
    6398                 :          0 :         cmd->conformance_test_limit_2G = __cpu_to_le32(ctl2g);
    6399                 :          0 :         cmd->conformance_test_limit_5G = __cpu_to_le32(ctl5g);
    6400                 :            : 
    6401         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    6402                 :            :                    "wmi pdev regdomain rd %x rd2g %x rd5g %x ctl2g %x ctl5g %x\n",
    6403                 :            :                    rd, rd2g, rd5g, ctl2g, ctl5g);
    6404                 :            :         return skb;
    6405                 :            : }
    6406                 :            : 
    6407                 :            : static struct sk_buff *
    6408                 :          0 : ath10k_wmi_10x_op_gen_pdev_set_rd(struct ath10k *ar, u16 rd, u16 rd2g, u16
    6409                 :            :                                   rd5g, u16 ctl2g, u16 ctl5g,
    6410                 :            :                                   enum wmi_dfs_region dfs_reg)
    6411                 :            : {
    6412                 :          0 :         struct wmi_pdev_set_regdomain_cmd_10x *cmd;
    6413                 :          0 :         struct sk_buff *skb;
    6414                 :            : 
    6415                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    6416         [ #  # ]:          0 :         if (!skb)
    6417                 :            :                 return ERR_PTR(-ENOMEM);
    6418                 :            : 
    6419                 :          0 :         cmd = (struct wmi_pdev_set_regdomain_cmd_10x *)skb->data;
    6420                 :          0 :         cmd->reg_domain = __cpu_to_le32(rd);
    6421                 :          0 :         cmd->reg_domain_2G = __cpu_to_le32(rd2g);
    6422                 :          0 :         cmd->reg_domain_5G = __cpu_to_le32(rd5g);
    6423                 :          0 :         cmd->conformance_test_limit_2G = __cpu_to_le32(ctl2g);
    6424                 :          0 :         cmd->conformance_test_limit_5G = __cpu_to_le32(ctl5g);
    6425                 :          0 :         cmd->dfs_domain = __cpu_to_le32(dfs_reg);
    6426                 :            : 
    6427         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    6428                 :            :                    "wmi pdev regdomain rd %x rd2g %x rd5g %x ctl2g %x ctl5g %x dfs_region %x\n",
    6429                 :            :                    rd, rd2g, rd5g, ctl2g, ctl5g, dfs_reg);
    6430                 :            :         return skb;
    6431                 :            : }
    6432                 :            : 
    6433                 :            : static struct sk_buff *
    6434                 :          0 : ath10k_wmi_op_gen_pdev_suspend(struct ath10k *ar, u32 suspend_opt)
    6435                 :            : {
    6436                 :          0 :         struct wmi_pdev_suspend_cmd *cmd;
    6437                 :          0 :         struct sk_buff *skb;
    6438                 :            : 
    6439                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    6440         [ #  # ]:          0 :         if (!skb)
    6441                 :            :                 return ERR_PTR(-ENOMEM);
    6442                 :            : 
    6443                 :          0 :         cmd = (struct wmi_pdev_suspend_cmd *)skb->data;
    6444                 :          0 :         cmd->suspend_opt = __cpu_to_le32(suspend_opt);
    6445                 :            : 
    6446                 :          0 :         return skb;
    6447                 :            : }
    6448                 :            : 
    6449                 :            : static struct sk_buff *
    6450                 :          0 : ath10k_wmi_op_gen_pdev_resume(struct ath10k *ar)
    6451                 :            : {
    6452                 :          0 :         struct sk_buff *skb;
    6453                 :            : 
    6454                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, 0);
    6455         [ #  # ]:          0 :         if (!skb)
    6456                 :          0 :                 return ERR_PTR(-ENOMEM);
    6457                 :            : 
    6458                 :            :         return skb;
    6459                 :            : }
    6460                 :            : 
    6461                 :            : static struct sk_buff *
    6462                 :          0 : ath10k_wmi_op_gen_pdev_set_param(struct ath10k *ar, u32 id, u32 value)
    6463                 :            : {
    6464                 :          0 :         struct wmi_pdev_set_param_cmd *cmd;
    6465                 :          0 :         struct sk_buff *skb;
    6466                 :            : 
    6467         [ #  # ]:          0 :         if (id == WMI_PDEV_PARAM_UNSUPPORTED) {
    6468                 :          0 :                 ath10k_warn(ar, "pdev param %d not supported by firmware\n",
    6469                 :            :                             id);
    6470                 :          0 :                 return ERR_PTR(-EOPNOTSUPP);
    6471                 :            :         }
    6472                 :            : 
    6473                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    6474         [ #  # ]:          0 :         if (!skb)
    6475                 :            :                 return ERR_PTR(-ENOMEM);
    6476                 :            : 
    6477                 :          0 :         cmd = (struct wmi_pdev_set_param_cmd *)skb->data;
    6478                 :          0 :         cmd->param_id    = __cpu_to_le32(id);
    6479                 :          0 :         cmd->param_value = __cpu_to_le32(value);
    6480                 :            : 
    6481         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi pdev set param %d value %d\n",
    6482                 :            :                    id, value);
    6483                 :            :         return skb;
    6484                 :            : }
    6485                 :            : 
    6486                 :          0 : void ath10k_wmi_put_host_mem_chunks(struct ath10k *ar,
    6487                 :            :                                     struct wmi_host_mem_chunks *chunks)
    6488                 :            : {
    6489                 :          0 :         struct host_memory_chunk *chunk;
    6490                 :          0 :         int i;
    6491                 :            : 
    6492                 :          0 :         chunks->count = __cpu_to_le32(ar->wmi.num_mem_chunks);
    6493                 :            : 
    6494         [ #  # ]:          0 :         for (i = 0; i < ar->wmi.num_mem_chunks; i++) {
    6495                 :          0 :                 chunk = &chunks->items[i];
    6496                 :          0 :                 chunk->ptr = __cpu_to_le32(ar->wmi.mem_chunks[i].paddr);
    6497                 :          0 :                 chunk->size = __cpu_to_le32(ar->wmi.mem_chunks[i].len);
    6498                 :          0 :                 chunk->req_id = __cpu_to_le32(ar->wmi.mem_chunks[i].req_id);
    6499                 :            : 
    6500         [ #  # ]:          0 :                 ath10k_dbg(ar, ATH10K_DBG_WMI,
    6501                 :            :                            "wmi chunk %d len %d requested, addr 0x%llx\n",
    6502                 :            :                            i,
    6503                 :            :                            ar->wmi.mem_chunks[i].len,
    6504                 :            :                            (unsigned long long)ar->wmi.mem_chunks[i].paddr);
    6505                 :            :         }
    6506                 :          0 : }
    6507                 :            : 
    6508                 :          0 : static struct sk_buff *ath10k_wmi_op_gen_init(struct ath10k *ar)
    6509                 :            : {
    6510                 :          0 :         struct wmi_init_cmd *cmd;
    6511                 :          0 :         struct sk_buff *buf;
    6512                 :          0 :         struct wmi_resource_config config = {};
    6513                 :          0 :         u32 len, val;
    6514                 :            : 
    6515                 :          0 :         config.num_vdevs = __cpu_to_le32(TARGET_NUM_VDEVS);
    6516                 :          0 :         config.num_peers = __cpu_to_le32(TARGET_NUM_PEERS);
    6517                 :          0 :         config.num_offload_peers = __cpu_to_le32(TARGET_NUM_OFFLOAD_PEERS);
    6518                 :            : 
    6519                 :          0 :         config.num_offload_reorder_bufs =
    6520                 :            :                 __cpu_to_le32(TARGET_NUM_OFFLOAD_REORDER_BUFS);
    6521                 :            : 
    6522                 :          0 :         config.num_peer_keys = __cpu_to_le32(TARGET_NUM_PEER_KEYS);
    6523                 :          0 :         config.num_tids = __cpu_to_le32(TARGET_NUM_TIDS);
    6524                 :          0 :         config.ast_skid_limit = __cpu_to_le32(TARGET_AST_SKID_LIMIT);
    6525                 :          0 :         config.tx_chain_mask = __cpu_to_le32(TARGET_TX_CHAIN_MASK);
    6526                 :          0 :         config.rx_chain_mask = __cpu_to_le32(TARGET_RX_CHAIN_MASK);
    6527                 :          0 :         config.rx_timeout_pri_vo = __cpu_to_le32(TARGET_RX_TIMEOUT_LO_PRI);
    6528                 :          0 :         config.rx_timeout_pri_vi = __cpu_to_le32(TARGET_RX_TIMEOUT_LO_PRI);
    6529                 :          0 :         config.rx_timeout_pri_be = __cpu_to_le32(TARGET_RX_TIMEOUT_LO_PRI);
    6530                 :          0 :         config.rx_timeout_pri_bk = __cpu_to_le32(TARGET_RX_TIMEOUT_HI_PRI);
    6531                 :          0 :         config.rx_decap_mode = __cpu_to_le32(ar->wmi.rx_decap_mode);
    6532                 :          0 :         config.scan_max_pending_reqs =
    6533                 :            :                 __cpu_to_le32(TARGET_SCAN_MAX_PENDING_REQS);
    6534                 :            : 
    6535                 :          0 :         config.bmiss_offload_max_vdev =
    6536                 :            :                 __cpu_to_le32(TARGET_BMISS_OFFLOAD_MAX_VDEV);
    6537                 :            : 
    6538                 :          0 :         config.roam_offload_max_vdev =
    6539                 :            :                 __cpu_to_le32(TARGET_ROAM_OFFLOAD_MAX_VDEV);
    6540                 :            : 
    6541                 :          0 :         config.roam_offload_max_ap_profiles =
    6542                 :            :                 __cpu_to_le32(TARGET_ROAM_OFFLOAD_MAX_AP_PROFILES);
    6543                 :            : 
    6544                 :          0 :         config.num_mcast_groups = __cpu_to_le32(TARGET_NUM_MCAST_GROUPS);
    6545                 :          0 :         config.num_mcast_table_elems =
    6546                 :            :                 __cpu_to_le32(TARGET_NUM_MCAST_TABLE_ELEMS);
    6547                 :            : 
    6548                 :          0 :         config.mcast2ucast_mode = __cpu_to_le32(TARGET_MCAST2UCAST_MODE);
    6549                 :          0 :         config.tx_dbg_log_size = __cpu_to_le32(TARGET_TX_DBG_LOG_SIZE);
    6550                 :          0 :         config.num_wds_entries = __cpu_to_le32(TARGET_NUM_WDS_ENTRIES);
    6551                 :          0 :         config.dma_burst_size = __cpu_to_le32(TARGET_DMA_BURST_SIZE);
    6552                 :          0 :         config.mac_aggr_delim = __cpu_to_le32(TARGET_MAC_AGGR_DELIM);
    6553                 :            : 
    6554                 :          0 :         val = TARGET_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK;
    6555                 :          0 :         config.rx_skip_defrag_timeout_dup_detection_check = __cpu_to_le32(val);
    6556                 :            : 
    6557                 :          0 :         config.vow_config = __cpu_to_le32(TARGET_VOW_CONFIG);
    6558                 :            : 
    6559                 :          0 :         config.gtk_offload_max_vdev =
    6560                 :            :                 __cpu_to_le32(TARGET_GTK_OFFLOAD_MAX_VDEV);
    6561                 :            : 
    6562                 :          0 :         config.num_msdu_desc = __cpu_to_le32(TARGET_NUM_MSDU_DESC);
    6563                 :          0 :         config.max_frag_entries = __cpu_to_le32(TARGET_MAX_FRAG_ENTRIES);
    6564                 :            : 
    6565                 :          0 :         len = sizeof(*cmd) +
    6566                 :          0 :               (sizeof(struct host_memory_chunk) * ar->wmi.num_mem_chunks);
    6567                 :            : 
    6568                 :          0 :         buf = ath10k_wmi_alloc_skb(ar, len);
    6569         [ #  # ]:          0 :         if (!buf)
    6570                 :            :                 return ERR_PTR(-ENOMEM);
    6571                 :            : 
    6572                 :          0 :         cmd = (struct wmi_init_cmd *)buf->data;
    6573                 :            : 
    6574                 :          0 :         memcpy(&cmd->resource_config, &config, sizeof(config));
    6575                 :          0 :         ath10k_wmi_put_host_mem_chunks(ar, &cmd->mem_chunks);
    6576                 :            : 
    6577         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi init\n");
    6578                 :            :         return buf;
    6579                 :            : }
    6580                 :            : 
    6581                 :          0 : static struct sk_buff *ath10k_wmi_10_1_op_gen_init(struct ath10k *ar)
    6582                 :            : {
    6583                 :          0 :         struct wmi_init_cmd_10x *cmd;
    6584                 :          0 :         struct sk_buff *buf;
    6585                 :          0 :         struct wmi_resource_config_10x config = {};
    6586                 :          0 :         u32 len, val;
    6587                 :            : 
    6588                 :          0 :         config.num_vdevs = __cpu_to_le32(TARGET_10X_NUM_VDEVS);
    6589                 :          0 :         config.num_peers = __cpu_to_le32(TARGET_10X_NUM_PEERS);
    6590                 :          0 :         config.num_peer_keys = __cpu_to_le32(TARGET_10X_NUM_PEER_KEYS);
    6591                 :          0 :         config.num_tids = __cpu_to_le32(TARGET_10X_NUM_TIDS);
    6592                 :          0 :         config.ast_skid_limit = __cpu_to_le32(TARGET_10X_AST_SKID_LIMIT);
    6593                 :          0 :         config.tx_chain_mask = __cpu_to_le32(TARGET_10X_TX_CHAIN_MASK);
    6594                 :          0 :         config.rx_chain_mask = __cpu_to_le32(TARGET_10X_RX_CHAIN_MASK);
    6595                 :          0 :         config.rx_timeout_pri_vo = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_LO_PRI);
    6596                 :          0 :         config.rx_timeout_pri_vi = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_LO_PRI);
    6597                 :          0 :         config.rx_timeout_pri_be = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_LO_PRI);
    6598                 :          0 :         config.rx_timeout_pri_bk = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_HI_PRI);
    6599                 :          0 :         config.rx_decap_mode = __cpu_to_le32(ar->wmi.rx_decap_mode);
    6600                 :          0 :         config.scan_max_pending_reqs =
    6601                 :            :                 __cpu_to_le32(TARGET_10X_SCAN_MAX_PENDING_REQS);
    6602                 :            : 
    6603                 :          0 :         config.bmiss_offload_max_vdev =
    6604                 :            :                 __cpu_to_le32(TARGET_10X_BMISS_OFFLOAD_MAX_VDEV);
    6605                 :            : 
    6606                 :          0 :         config.roam_offload_max_vdev =
    6607                 :            :                 __cpu_to_le32(TARGET_10X_ROAM_OFFLOAD_MAX_VDEV);
    6608                 :            : 
    6609                 :          0 :         config.roam_offload_max_ap_profiles =
    6610                 :            :                 __cpu_to_le32(TARGET_10X_ROAM_OFFLOAD_MAX_AP_PROFILES);
    6611                 :            : 
    6612                 :          0 :         config.num_mcast_groups = __cpu_to_le32(TARGET_10X_NUM_MCAST_GROUPS);
    6613                 :          0 :         config.num_mcast_table_elems =
    6614                 :            :                 __cpu_to_le32(TARGET_10X_NUM_MCAST_TABLE_ELEMS);
    6615                 :            : 
    6616                 :          0 :         config.mcast2ucast_mode = __cpu_to_le32(TARGET_10X_MCAST2UCAST_MODE);
    6617                 :          0 :         config.tx_dbg_log_size = __cpu_to_le32(TARGET_10X_TX_DBG_LOG_SIZE);
    6618                 :          0 :         config.num_wds_entries = __cpu_to_le32(TARGET_10X_NUM_WDS_ENTRIES);
    6619                 :          0 :         config.dma_burst_size = __cpu_to_le32(TARGET_10X_DMA_BURST_SIZE);
    6620                 :          0 :         config.mac_aggr_delim = __cpu_to_le32(TARGET_10X_MAC_AGGR_DELIM);
    6621                 :            : 
    6622                 :          0 :         val = TARGET_10X_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK;
    6623                 :          0 :         config.rx_skip_defrag_timeout_dup_detection_check = __cpu_to_le32(val);
    6624                 :            : 
    6625                 :          0 :         config.vow_config = __cpu_to_le32(TARGET_10X_VOW_CONFIG);
    6626                 :            : 
    6627                 :          0 :         config.num_msdu_desc = __cpu_to_le32(TARGET_10X_NUM_MSDU_DESC);
    6628                 :          0 :         config.max_frag_entries = __cpu_to_le32(TARGET_10X_MAX_FRAG_ENTRIES);
    6629                 :            : 
    6630                 :          0 :         len = sizeof(*cmd) +
    6631                 :          0 :               (sizeof(struct host_memory_chunk) * ar->wmi.num_mem_chunks);
    6632                 :            : 
    6633                 :          0 :         buf = ath10k_wmi_alloc_skb(ar, len);
    6634         [ #  # ]:          0 :         if (!buf)
    6635                 :            :                 return ERR_PTR(-ENOMEM);
    6636                 :            : 
    6637                 :          0 :         cmd = (struct wmi_init_cmd_10x *)buf->data;
    6638                 :            : 
    6639                 :          0 :         memcpy(&cmd->resource_config, &config, sizeof(config));
    6640                 :          0 :         ath10k_wmi_put_host_mem_chunks(ar, &cmd->mem_chunks);
    6641                 :            : 
    6642         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi init 10x\n");
    6643                 :            :         return buf;
    6644                 :            : }
    6645                 :            : 
    6646                 :          0 : static struct sk_buff *ath10k_wmi_10_2_op_gen_init(struct ath10k *ar)
    6647                 :            : {
    6648                 :          0 :         struct wmi_init_cmd_10_2 *cmd;
    6649                 :          0 :         struct sk_buff *buf;
    6650                 :          0 :         struct wmi_resource_config_10x config = {};
    6651                 :          0 :         u32 len, val, features;
    6652                 :            : 
    6653                 :          0 :         config.num_vdevs = __cpu_to_le32(TARGET_10X_NUM_VDEVS);
    6654                 :          0 :         config.num_peer_keys = __cpu_to_le32(TARGET_10X_NUM_PEER_KEYS);
    6655                 :            : 
    6656         [ #  # ]:          0 :         if (ath10k_peer_stats_enabled(ar)) {
    6657                 :            :                 config.num_peers = __cpu_to_le32(TARGET_10X_TX_STATS_NUM_PEERS);
    6658                 :            :                 config.num_tids = __cpu_to_le32(TARGET_10X_TX_STATS_NUM_TIDS);
    6659                 :            :         } else {
    6660                 :          0 :                 config.num_peers = __cpu_to_le32(TARGET_10X_NUM_PEERS);
    6661                 :          0 :                 config.num_tids = __cpu_to_le32(TARGET_10X_NUM_TIDS);
    6662                 :            :         }
    6663                 :            : 
    6664                 :          0 :         config.ast_skid_limit = __cpu_to_le32(TARGET_10X_AST_SKID_LIMIT);
    6665                 :          0 :         config.tx_chain_mask = __cpu_to_le32(TARGET_10X_TX_CHAIN_MASK);
    6666                 :          0 :         config.rx_chain_mask = __cpu_to_le32(TARGET_10X_RX_CHAIN_MASK);
    6667                 :          0 :         config.rx_timeout_pri_vo = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_LO_PRI);
    6668                 :          0 :         config.rx_timeout_pri_vi = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_LO_PRI);
    6669                 :          0 :         config.rx_timeout_pri_be = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_LO_PRI);
    6670                 :          0 :         config.rx_timeout_pri_bk = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_HI_PRI);
    6671                 :          0 :         config.rx_decap_mode = __cpu_to_le32(ar->wmi.rx_decap_mode);
    6672                 :            : 
    6673                 :          0 :         config.scan_max_pending_reqs =
    6674                 :            :                 __cpu_to_le32(TARGET_10X_SCAN_MAX_PENDING_REQS);
    6675                 :            : 
    6676                 :          0 :         config.bmiss_offload_max_vdev =
    6677                 :            :                 __cpu_to_le32(TARGET_10X_BMISS_OFFLOAD_MAX_VDEV);
    6678                 :            : 
    6679                 :          0 :         config.roam_offload_max_vdev =
    6680                 :            :                 __cpu_to_le32(TARGET_10X_ROAM_OFFLOAD_MAX_VDEV);
    6681                 :            : 
    6682                 :          0 :         config.roam_offload_max_ap_profiles =
    6683                 :            :                 __cpu_to_le32(TARGET_10X_ROAM_OFFLOAD_MAX_AP_PROFILES);
    6684                 :            : 
    6685                 :          0 :         config.num_mcast_groups = __cpu_to_le32(TARGET_10X_NUM_MCAST_GROUPS);
    6686                 :          0 :         config.num_mcast_table_elems =
    6687                 :            :                 __cpu_to_le32(TARGET_10X_NUM_MCAST_TABLE_ELEMS);
    6688                 :            : 
    6689                 :          0 :         config.mcast2ucast_mode = __cpu_to_le32(TARGET_10X_MCAST2UCAST_MODE);
    6690                 :          0 :         config.tx_dbg_log_size = __cpu_to_le32(TARGET_10X_TX_DBG_LOG_SIZE);
    6691                 :          0 :         config.num_wds_entries = __cpu_to_le32(TARGET_10X_NUM_WDS_ENTRIES);
    6692                 :          0 :         config.dma_burst_size = __cpu_to_le32(TARGET_10_2_DMA_BURST_SIZE);
    6693                 :          0 :         config.mac_aggr_delim = __cpu_to_le32(TARGET_10X_MAC_AGGR_DELIM);
    6694                 :            : 
    6695                 :          0 :         val = TARGET_10X_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK;
    6696                 :          0 :         config.rx_skip_defrag_timeout_dup_detection_check = __cpu_to_le32(val);
    6697                 :            : 
    6698                 :          0 :         config.vow_config = __cpu_to_le32(TARGET_10X_VOW_CONFIG);
    6699                 :            : 
    6700                 :          0 :         config.num_msdu_desc = __cpu_to_le32(TARGET_10X_NUM_MSDU_DESC);
    6701                 :          0 :         config.max_frag_entries = __cpu_to_le32(TARGET_10X_MAX_FRAG_ENTRIES);
    6702                 :            : 
    6703                 :          0 :         len = sizeof(*cmd) +
    6704                 :          0 :               (sizeof(struct host_memory_chunk) * ar->wmi.num_mem_chunks);
    6705                 :            : 
    6706                 :          0 :         buf = ath10k_wmi_alloc_skb(ar, len);
    6707         [ #  # ]:          0 :         if (!buf)
    6708                 :            :                 return ERR_PTR(-ENOMEM);
    6709                 :            : 
    6710                 :          0 :         cmd = (struct wmi_init_cmd_10_2 *)buf->data;
    6711                 :            : 
    6712                 :          0 :         features = WMI_10_2_RX_BATCH_MODE;
    6713                 :            : 
    6714   [ #  #  #  # ]:          0 :         if (test_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags) &&
    6715                 :            :             test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map))
    6716                 :          0 :                 features |= WMI_10_2_COEX_GPIO;
    6717                 :            : 
    6718         [ #  # ]:          0 :         if (ath10k_peer_stats_enabled(ar))
    6719                 :          0 :                 features |= WMI_10_2_PEER_STATS;
    6720                 :            : 
    6721         [ #  # ]:          0 :         if (test_bit(WMI_SERVICE_BSS_CHANNEL_INFO_64, ar->wmi.svc_map))
    6722                 :          0 :                 features |= WMI_10_2_BSS_CHAN_INFO;
    6723                 :            : 
    6724                 :          0 :         cmd->resource_config.feature_mask = __cpu_to_le32(features);
    6725                 :            : 
    6726                 :          0 :         memcpy(&cmd->resource_config.common, &config, sizeof(config));
    6727                 :          0 :         ath10k_wmi_put_host_mem_chunks(ar, &cmd->mem_chunks);
    6728                 :            : 
    6729         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi init 10.2\n");
    6730                 :            :         return buf;
    6731                 :            : }
    6732                 :            : 
    6733                 :          0 : static struct sk_buff *ath10k_wmi_10_4_op_gen_init(struct ath10k *ar)
    6734                 :            : {
    6735                 :          0 :         struct wmi_init_cmd_10_4 *cmd;
    6736                 :          0 :         struct sk_buff *buf;
    6737                 :          0 :         struct wmi_resource_config_10_4 config = {};
    6738                 :          0 :         u32 len;
    6739                 :            : 
    6740                 :          0 :         config.num_vdevs = __cpu_to_le32(ar->max_num_vdevs);
    6741                 :          0 :         config.num_peers = __cpu_to_le32(ar->max_num_peers);
    6742                 :          0 :         config.num_active_peers = __cpu_to_le32(ar->num_active_peers);
    6743                 :          0 :         config.num_tids = __cpu_to_le32(ar->num_tids);
    6744                 :            : 
    6745                 :          0 :         config.num_offload_peers = __cpu_to_le32(TARGET_10_4_NUM_OFFLOAD_PEERS);
    6746                 :          0 :         config.num_offload_reorder_buffs =
    6747                 :            :                         __cpu_to_le32(TARGET_10_4_NUM_OFFLOAD_REORDER_BUFFS);
    6748                 :          0 :         config.num_peer_keys  = __cpu_to_le32(TARGET_10_4_NUM_PEER_KEYS);
    6749                 :          0 :         config.ast_skid_limit = __cpu_to_le32(TARGET_10_4_AST_SKID_LIMIT);
    6750                 :          0 :         config.tx_chain_mask  = __cpu_to_le32(ar->hw_params.tx_chain_mask);
    6751                 :          0 :         config.rx_chain_mask  = __cpu_to_le32(ar->hw_params.rx_chain_mask);
    6752                 :            : 
    6753                 :          0 :         config.rx_timeout_pri[0] = __cpu_to_le32(TARGET_10_4_RX_TIMEOUT_LO_PRI);
    6754                 :          0 :         config.rx_timeout_pri[1] = __cpu_to_le32(TARGET_10_4_RX_TIMEOUT_LO_PRI);
    6755                 :          0 :         config.rx_timeout_pri[2] = __cpu_to_le32(TARGET_10_4_RX_TIMEOUT_LO_PRI);
    6756                 :          0 :         config.rx_timeout_pri[3] = __cpu_to_le32(TARGET_10_4_RX_TIMEOUT_HI_PRI);
    6757                 :            : 
    6758                 :          0 :         config.rx_decap_mode        = __cpu_to_le32(ar->wmi.rx_decap_mode);
    6759                 :          0 :         config.scan_max_pending_req = __cpu_to_le32(TARGET_10_4_SCAN_MAX_REQS);
    6760                 :          0 :         config.bmiss_offload_max_vdev =
    6761                 :            :                         __cpu_to_le32(TARGET_10_4_BMISS_OFFLOAD_MAX_VDEV);
    6762                 :          0 :         config.roam_offload_max_vdev  =
    6763                 :            :                         __cpu_to_le32(TARGET_10_4_ROAM_OFFLOAD_MAX_VDEV);
    6764                 :          0 :         config.roam_offload_max_ap_profiles =
    6765                 :            :                         __cpu_to_le32(TARGET_10_4_ROAM_OFFLOAD_MAX_PROFILES);
    6766                 :          0 :         config.num_mcast_groups = __cpu_to_le32(TARGET_10_4_NUM_MCAST_GROUPS);
    6767                 :          0 :         config.num_mcast_table_elems =
    6768                 :            :                         __cpu_to_le32(TARGET_10_4_NUM_MCAST_TABLE_ELEMS);
    6769                 :            : 
    6770                 :          0 :         config.mcast2ucast_mode = __cpu_to_le32(TARGET_10_4_MCAST2UCAST_MODE);
    6771                 :          0 :         config.tx_dbg_log_size  = __cpu_to_le32(TARGET_10_4_TX_DBG_LOG_SIZE);
    6772                 :          0 :         config.num_wds_entries  = __cpu_to_le32(TARGET_10_4_NUM_WDS_ENTRIES);
    6773                 :          0 :         config.dma_burst_size   = __cpu_to_le32(TARGET_10_4_DMA_BURST_SIZE);
    6774                 :          0 :         config.mac_aggr_delim   = __cpu_to_le32(TARGET_10_4_MAC_AGGR_DELIM);
    6775                 :            : 
    6776                 :          0 :         config.rx_skip_defrag_timeout_dup_detection_check =
    6777                 :            :           __cpu_to_le32(TARGET_10_4_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK);
    6778                 :            : 
    6779                 :          0 :         config.vow_config = __cpu_to_le32(TARGET_10_4_VOW_CONFIG);
    6780                 :          0 :         config.gtk_offload_max_vdev =
    6781                 :            :                         __cpu_to_le32(TARGET_10_4_GTK_OFFLOAD_MAX_VDEV);
    6782                 :          0 :         config.num_msdu_desc = __cpu_to_le32(ar->htt.max_num_pending_tx);
    6783                 :          0 :         config.max_frag_entries = __cpu_to_le32(TARGET_10_4_11AC_TX_MAX_FRAGS);
    6784                 :          0 :         config.max_peer_ext_stats =
    6785                 :            :                         __cpu_to_le32(TARGET_10_4_MAX_PEER_EXT_STATS);
    6786                 :          0 :         config.smart_ant_cap = __cpu_to_le32(TARGET_10_4_SMART_ANT_CAP);
    6787                 :            : 
    6788                 :          0 :         config.bk_minfree = __cpu_to_le32(TARGET_10_4_BK_MIN_FREE);
    6789                 :          0 :         config.be_minfree = __cpu_to_le32(TARGET_10_4_BE_MIN_FREE);
    6790                 :          0 :         config.vi_minfree = __cpu_to_le32(TARGET_10_4_VI_MIN_FREE);
    6791                 :          0 :         config.vo_minfree = __cpu_to_le32(TARGET_10_4_VO_MIN_FREE);
    6792                 :            : 
    6793                 :          0 :         config.rx_batchmode = __cpu_to_le32(TARGET_10_4_RX_BATCH_MODE);
    6794                 :          0 :         config.tt_support =
    6795                 :            :                         __cpu_to_le32(TARGET_10_4_THERMAL_THROTTLING_CONFIG);
    6796                 :          0 :         config.atf_config = __cpu_to_le32(TARGET_10_4_ATF_CONFIG);
    6797                 :          0 :         config.iphdr_pad_config = __cpu_to_le32(TARGET_10_4_IPHDR_PAD_CONFIG);
    6798                 :          0 :         config.qwrap_config = __cpu_to_le32(TARGET_10_4_QWRAP_CONFIG);
    6799                 :            : 
    6800                 :          0 :         len = sizeof(*cmd) +
    6801                 :          0 :               (sizeof(struct host_memory_chunk) * ar->wmi.num_mem_chunks);
    6802                 :            : 
    6803                 :          0 :         buf = ath10k_wmi_alloc_skb(ar, len);
    6804         [ #  # ]:          0 :         if (!buf)
    6805                 :            :                 return ERR_PTR(-ENOMEM);
    6806                 :            : 
    6807                 :          0 :         cmd = (struct wmi_init_cmd_10_4 *)buf->data;
    6808                 :          0 :         memcpy(&cmd->resource_config, &config, sizeof(config));
    6809                 :          0 :         ath10k_wmi_put_host_mem_chunks(ar, &cmd->mem_chunks);
    6810                 :            : 
    6811         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi init 10.4\n");
    6812                 :            :         return buf;
    6813                 :            : }
    6814                 :            : 
    6815                 :          0 : int ath10k_wmi_start_scan_verify(const struct wmi_start_scan_arg *arg)
    6816                 :            : {
    6817         [ #  # ]:          0 :         if (arg->ie_len > WLAN_SCAN_PARAMS_MAX_IE_LEN)
    6818                 :            :                 return -EINVAL;
    6819   [ #  #  #  #  :          0 :         if (arg->n_channels > ARRAY_SIZE(arg->channels))
                   #  # ]
    6820                 :            :                 return -EINVAL;
    6821   [ #  #  #  #  :          0 :         if (arg->n_ssids > WLAN_SCAN_PARAMS_MAX_SSID)
                   #  # ]
    6822                 :            :                 return -EINVAL;
    6823   [ #  #  #  #  :          0 :         if (arg->n_bssids > WLAN_SCAN_PARAMS_MAX_BSSID)
                   #  # ]
    6824                 :          0 :                 return -EINVAL;
    6825                 :            : 
    6826                 :            :         return 0;
    6827                 :            : }
    6828                 :            : 
    6829                 :            : static size_t
    6830                 :          0 : ath10k_wmi_start_scan_tlvs_len(const struct wmi_start_scan_arg *arg)
    6831                 :            : {
    6832                 :          0 :         int len = 0;
    6833                 :            : 
    6834         [ #  # ]:          0 :         if (arg->ie_len) {
    6835                 :          0 :                 len += sizeof(struct wmi_ie_data);
    6836                 :          0 :                 len += roundup(arg->ie_len, 4);
    6837                 :            :         }
    6838                 :            : 
    6839         [ #  # ]:          0 :         if (arg->n_channels) {
    6840                 :          0 :                 len += sizeof(struct wmi_chan_list);
    6841                 :          0 :                 len += sizeof(__le32) * arg->n_channels;
    6842                 :            :         }
    6843                 :            : 
    6844         [ #  # ]:          0 :         if (arg->n_ssids) {
    6845                 :          0 :                 len += sizeof(struct wmi_ssid_list);
    6846                 :          0 :                 len += sizeof(struct wmi_ssid) * arg->n_ssids;
    6847                 :            :         }
    6848                 :            : 
    6849         [ #  # ]:          0 :         if (arg->n_bssids) {
    6850                 :          0 :                 len += sizeof(struct wmi_bssid_list);
    6851                 :          0 :                 len += sizeof(struct wmi_mac_addr) * arg->n_bssids;
    6852                 :            :         }
    6853                 :            : 
    6854                 :          0 :         return len;
    6855                 :            : }
    6856                 :            : 
    6857                 :          0 : void ath10k_wmi_put_start_scan_common(struct wmi_start_scan_common *cmn,
    6858                 :            :                                       const struct wmi_start_scan_arg *arg)
    6859                 :            : {
    6860                 :          0 :         u32 scan_id;
    6861                 :          0 :         u32 scan_req_id;
    6862                 :            : 
    6863                 :          0 :         scan_id  = WMI_HOST_SCAN_REQ_ID_PREFIX;
    6864                 :          0 :         scan_id |= arg->scan_id;
    6865                 :            : 
    6866                 :          0 :         scan_req_id  = WMI_HOST_SCAN_REQUESTOR_ID_PREFIX;
    6867                 :          0 :         scan_req_id |= arg->scan_req_id;
    6868                 :            : 
    6869                 :          0 :         cmn->scan_id            = __cpu_to_le32(scan_id);
    6870                 :          0 :         cmn->scan_req_id        = __cpu_to_le32(scan_req_id);
    6871                 :          0 :         cmn->vdev_id            = __cpu_to_le32(arg->vdev_id);
    6872                 :          0 :         cmn->scan_priority      = __cpu_to_le32(arg->scan_priority);
    6873                 :          0 :         cmn->notify_scan_events = __cpu_to_le32(arg->notify_scan_events);
    6874                 :          0 :         cmn->dwell_time_active  = __cpu_to_le32(arg->dwell_time_active);
    6875                 :          0 :         cmn->dwell_time_passive = __cpu_to_le32(arg->dwell_time_passive);
    6876                 :          0 :         cmn->min_rest_time      = __cpu_to_le32(arg->min_rest_time);
    6877                 :          0 :         cmn->max_rest_time      = __cpu_to_le32(arg->max_rest_time);
    6878                 :          0 :         cmn->repeat_probe_time  = __cpu_to_le32(arg->repeat_probe_time);
    6879                 :          0 :         cmn->probe_spacing_time = __cpu_to_le32(arg->probe_spacing_time);
    6880                 :          0 :         cmn->idle_time          = __cpu_to_le32(arg->idle_time);
    6881                 :          0 :         cmn->max_scan_time      = __cpu_to_le32(arg->max_scan_time);
    6882                 :          0 :         cmn->probe_delay        = __cpu_to_le32(arg->probe_delay);
    6883                 :          0 :         cmn->scan_ctrl_flags    = __cpu_to_le32(arg->scan_ctrl_flags);
    6884                 :          0 : }
    6885                 :            : 
    6886                 :            : static void
    6887                 :          0 : ath10k_wmi_put_start_scan_tlvs(struct wmi_start_scan_tlvs *tlvs,
    6888                 :            :                                const struct wmi_start_scan_arg *arg)
    6889                 :            : {
    6890                 :          0 :         struct wmi_ie_data *ie;
    6891                 :          0 :         struct wmi_chan_list *channels;
    6892                 :          0 :         struct wmi_ssid_list *ssids;
    6893                 :          0 :         struct wmi_bssid_list *bssids;
    6894                 :          0 :         void *ptr = tlvs->tlvs;
    6895                 :          0 :         int i;
    6896                 :            : 
    6897         [ #  # ]:          0 :         if (arg->n_channels) {
    6898                 :          0 :                 channels = ptr;
    6899                 :          0 :                 channels->tag = __cpu_to_le32(WMI_CHAN_LIST_TAG);
    6900                 :          0 :                 channels->num_chan = __cpu_to_le32(arg->n_channels);
    6901                 :            : 
    6902         [ #  # ]:          0 :                 for (i = 0; i < arg->n_channels; i++)
    6903                 :          0 :                         channels->channel_list[i].freq =
    6904                 :          0 :                                 __cpu_to_le16(arg->channels[i]);
    6905                 :            : 
    6906                 :          0 :                 ptr += sizeof(*channels);
    6907                 :          0 :                 ptr += sizeof(__le32) * arg->n_channels;
    6908                 :            :         }
    6909                 :            : 
    6910         [ #  # ]:          0 :         if (arg->n_ssids) {
    6911                 :          0 :                 ssids = ptr;
    6912                 :          0 :                 ssids->tag = __cpu_to_le32(WMI_SSID_LIST_TAG);
    6913                 :          0 :                 ssids->num_ssids = __cpu_to_le32(arg->n_ssids);
    6914                 :            : 
    6915         [ #  # ]:          0 :                 for (i = 0; i < arg->n_ssids; i++) {
    6916                 :          0 :                         ssids->ssids[i].ssid_len =
    6917                 :          0 :                                 __cpu_to_le32(arg->ssids[i].len);
    6918                 :          0 :                         memcpy(&ssids->ssids[i].ssid,
    6919                 :          0 :                                arg->ssids[i].ssid,
    6920                 :          0 :                                arg->ssids[i].len);
    6921                 :            :                 }
    6922                 :            : 
    6923                 :          0 :                 ptr += sizeof(*ssids);
    6924                 :          0 :                 ptr += sizeof(struct wmi_ssid) * arg->n_ssids;
    6925                 :            :         }
    6926                 :            : 
    6927         [ #  # ]:          0 :         if (arg->n_bssids) {
    6928                 :          0 :                 bssids = ptr;
    6929                 :          0 :                 bssids->tag = __cpu_to_le32(WMI_BSSID_LIST_TAG);
    6930                 :          0 :                 bssids->num_bssid = __cpu_to_le32(arg->n_bssids);
    6931                 :            : 
    6932         [ #  # ]:          0 :                 for (i = 0; i < arg->n_bssids; i++)
    6933                 :          0 :                         ether_addr_copy(bssids->bssid_list[i].addr,
    6934                 :            :                                         arg->bssids[i].bssid);
    6935                 :            : 
    6936                 :          0 :                 ptr += sizeof(*bssids);
    6937                 :          0 :                 ptr += sizeof(struct wmi_mac_addr) * arg->n_bssids;
    6938                 :            :         }
    6939                 :            : 
    6940         [ #  # ]:          0 :         if (arg->ie_len) {
    6941                 :          0 :                 ie = ptr;
    6942                 :          0 :                 ie->tag = __cpu_to_le32(WMI_IE_TAG);
    6943                 :          0 :                 ie->ie_len = __cpu_to_le32(arg->ie_len);
    6944                 :          0 :                 memcpy(ie->ie_data, arg->ie, arg->ie_len);
    6945                 :            : 
    6946                 :          0 :                 ptr += sizeof(*ie);
    6947                 :          0 :                 ptr += roundup(arg->ie_len, 4);
    6948                 :            :         }
    6949                 :          0 : }
    6950                 :            : 
    6951                 :            : static struct sk_buff *
    6952                 :          0 : ath10k_wmi_op_gen_start_scan(struct ath10k *ar,
    6953                 :            :                              const struct wmi_start_scan_arg *arg)
    6954                 :            : {
    6955                 :          0 :         struct wmi_start_scan_cmd *cmd;
    6956                 :          0 :         struct sk_buff *skb;
    6957                 :          0 :         size_t len;
    6958                 :          0 :         int ret;
    6959                 :            : 
    6960         [ #  # ]:          0 :         ret = ath10k_wmi_start_scan_verify(arg);
    6961                 :          0 :         if (ret)
    6962                 :            :                 return ERR_PTR(ret);
    6963                 :            : 
    6964                 :          0 :         len = sizeof(*cmd) + ath10k_wmi_start_scan_tlvs_len(arg);
    6965                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, len);
    6966         [ #  # ]:          0 :         if (!skb)
    6967                 :            :                 return ERR_PTR(-ENOMEM);
    6968                 :            : 
    6969                 :          0 :         cmd = (struct wmi_start_scan_cmd *)skb->data;
    6970                 :            : 
    6971                 :          0 :         ath10k_wmi_put_start_scan_common(&cmd->common, arg);
    6972                 :          0 :         ath10k_wmi_put_start_scan_tlvs(&cmd->tlvs, arg);
    6973                 :            : 
    6974                 :          0 :         cmd->burst_duration_ms = __cpu_to_le32(0);
    6975                 :            : 
    6976         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi start scan\n");
    6977                 :            :         return skb;
    6978                 :            : }
    6979                 :            : 
    6980                 :            : static struct sk_buff *
    6981                 :          0 : ath10k_wmi_10x_op_gen_start_scan(struct ath10k *ar,
    6982                 :            :                                  const struct wmi_start_scan_arg *arg)
    6983                 :            : {
    6984                 :          0 :         struct wmi_10x_start_scan_cmd *cmd;
    6985                 :          0 :         struct sk_buff *skb;
    6986                 :          0 :         size_t len;
    6987                 :          0 :         int ret;
    6988                 :            : 
    6989         [ #  # ]:          0 :         ret = ath10k_wmi_start_scan_verify(arg);
    6990                 :          0 :         if (ret)
    6991                 :            :                 return ERR_PTR(ret);
    6992                 :            : 
    6993                 :          0 :         len = sizeof(*cmd) + ath10k_wmi_start_scan_tlvs_len(arg);
    6994                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, len);
    6995         [ #  # ]:          0 :         if (!skb)
    6996                 :            :                 return ERR_PTR(-ENOMEM);
    6997                 :            : 
    6998                 :          0 :         cmd = (struct wmi_10x_start_scan_cmd *)skb->data;
    6999                 :            : 
    7000                 :          0 :         ath10k_wmi_put_start_scan_common(&cmd->common, arg);
    7001                 :          0 :         ath10k_wmi_put_start_scan_tlvs(&cmd->tlvs, arg);
    7002                 :            : 
    7003         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi 10x start scan\n");
    7004                 :            :         return skb;
    7005                 :            : }
    7006                 :            : 
    7007                 :          0 : void ath10k_wmi_start_scan_init(struct ath10k *ar,
    7008                 :            :                                 struct wmi_start_scan_arg *arg)
    7009                 :            : {
    7010                 :            :         /* setup commonly used values */
    7011                 :          0 :         arg->scan_req_id = 1;
    7012                 :          0 :         arg->scan_priority = WMI_SCAN_PRIORITY_LOW;
    7013                 :          0 :         arg->dwell_time_active = 50;
    7014                 :          0 :         arg->dwell_time_passive = 150;
    7015                 :          0 :         arg->min_rest_time = 50;
    7016                 :          0 :         arg->max_rest_time = 500;
    7017                 :          0 :         arg->repeat_probe_time = 0;
    7018                 :          0 :         arg->probe_spacing_time = 0;
    7019                 :          0 :         arg->idle_time = 0;
    7020                 :          0 :         arg->max_scan_time = 20000;
    7021                 :          0 :         arg->probe_delay = 5;
    7022                 :          0 :         arg->notify_scan_events = WMI_SCAN_EVENT_STARTED
    7023                 :            :                 | WMI_SCAN_EVENT_COMPLETED
    7024                 :            :                 | WMI_SCAN_EVENT_BSS_CHANNEL
    7025                 :            :                 | WMI_SCAN_EVENT_FOREIGN_CHANNEL
    7026                 :            :                 | WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT
    7027                 :            :                 | WMI_SCAN_EVENT_DEQUEUED;
    7028                 :          0 :         arg->scan_ctrl_flags |= WMI_SCAN_CHAN_STAT_EVENT;
    7029                 :          0 :         arg->n_bssids = 1;
    7030                 :          0 :         arg->bssids[0].bssid = "\xFF\xFF\xFF\xFF\xFF\xFF";
    7031                 :          0 : }
    7032                 :            : 
    7033                 :            : static struct sk_buff *
    7034                 :          0 : ath10k_wmi_op_gen_stop_scan(struct ath10k *ar,
    7035                 :            :                             const struct wmi_stop_scan_arg *arg)
    7036                 :            : {
    7037                 :          0 :         struct wmi_stop_scan_cmd *cmd;
    7038                 :          0 :         struct sk_buff *skb;
    7039                 :          0 :         u32 scan_id;
    7040                 :          0 :         u32 req_id;
    7041                 :            : 
    7042         [ #  # ]:          0 :         if (arg->req_id > 0xFFF)
    7043                 :            :                 return ERR_PTR(-EINVAL);
    7044   [ #  #  #  # ]:          0 :         if (arg->req_type == WMI_SCAN_STOP_ONE && arg->u.scan_id > 0xFFF)
    7045                 :            :                 return ERR_PTR(-EINVAL);
    7046                 :            : 
    7047                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7048         [ #  # ]:          0 :         if (!skb)
    7049                 :            :                 return ERR_PTR(-ENOMEM);
    7050                 :            : 
    7051                 :          0 :         scan_id = arg->u.scan_id;
    7052                 :          0 :         scan_id |= WMI_HOST_SCAN_REQ_ID_PREFIX;
    7053                 :            : 
    7054                 :          0 :         req_id = arg->req_id;
    7055                 :          0 :         req_id |= WMI_HOST_SCAN_REQUESTOR_ID_PREFIX;
    7056                 :            : 
    7057                 :          0 :         cmd = (struct wmi_stop_scan_cmd *)skb->data;
    7058                 :          0 :         cmd->req_type    = __cpu_to_le32(arg->req_type);
    7059                 :          0 :         cmd->vdev_id     = __cpu_to_le32(arg->u.vdev_id);
    7060                 :          0 :         cmd->scan_id     = __cpu_to_le32(scan_id);
    7061                 :          0 :         cmd->scan_req_id = __cpu_to_le32(req_id);
    7062                 :            : 
    7063         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7064                 :            :                    "wmi stop scan reqid %d req_type %d vdev/scan_id %d\n",
    7065                 :            :                    arg->req_id, arg->req_type, arg->u.scan_id);
    7066                 :            :         return skb;
    7067                 :            : }
    7068                 :            : 
    7069                 :            : static struct sk_buff *
    7070                 :          0 : ath10k_wmi_op_gen_vdev_create(struct ath10k *ar, u32 vdev_id,
    7071                 :            :                               enum wmi_vdev_type type,
    7072                 :            :                               enum wmi_vdev_subtype subtype,
    7073                 :            :                               const u8 macaddr[ETH_ALEN])
    7074                 :            : {
    7075                 :          0 :         struct wmi_vdev_create_cmd *cmd;
    7076                 :          0 :         struct sk_buff *skb;
    7077                 :            : 
    7078                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7079         [ #  # ]:          0 :         if (!skb)
    7080                 :            :                 return ERR_PTR(-ENOMEM);
    7081                 :            : 
    7082                 :          0 :         cmd = (struct wmi_vdev_create_cmd *)skb->data;
    7083                 :          0 :         cmd->vdev_id      = __cpu_to_le32(vdev_id);
    7084                 :          0 :         cmd->vdev_type    = __cpu_to_le32(type);
    7085                 :          0 :         cmd->vdev_subtype = __cpu_to_le32(subtype);
    7086         [ #  # ]:          0 :         ether_addr_copy(cmd->vdev_macaddr.addr, macaddr);
    7087                 :            : 
    7088         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7089                 :            :                    "WMI vdev create: id %d type %d subtype %d macaddr %pM\n",
    7090                 :            :                    vdev_id, type, subtype, macaddr);
    7091                 :            :         return skb;
    7092                 :            : }
    7093                 :            : 
    7094                 :            : static struct sk_buff *
    7095                 :          0 : ath10k_wmi_op_gen_vdev_delete(struct ath10k *ar, u32 vdev_id)
    7096                 :            : {
    7097                 :          0 :         struct wmi_vdev_delete_cmd *cmd;
    7098                 :          0 :         struct sk_buff *skb;
    7099                 :            : 
    7100                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7101         [ #  # ]:          0 :         if (!skb)
    7102                 :            :                 return ERR_PTR(-ENOMEM);
    7103                 :            : 
    7104                 :          0 :         cmd = (struct wmi_vdev_delete_cmd *)skb->data;
    7105                 :          0 :         cmd->vdev_id = __cpu_to_le32(vdev_id);
    7106                 :            : 
    7107         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7108                 :            :                    "WMI vdev delete id %d\n", vdev_id);
    7109                 :            :         return skb;
    7110                 :            : }
    7111                 :            : 
    7112                 :            : static struct sk_buff *
    7113                 :          0 : ath10k_wmi_op_gen_vdev_start(struct ath10k *ar,
    7114                 :            :                              const struct wmi_vdev_start_request_arg *arg,
    7115                 :            :                              bool restart)
    7116                 :            : {
    7117                 :          0 :         struct wmi_vdev_start_request_cmd *cmd;
    7118                 :          0 :         struct sk_buff *skb;
    7119                 :          0 :         const char *cmdname;
    7120                 :          0 :         u32 flags = 0;
    7121                 :            : 
    7122   [ #  #  #  #  :          0 :         if (WARN_ON(arg->hidden_ssid && !arg->ssid))
             #  #  #  # ]
    7123                 :            :                 return ERR_PTR(-EINVAL);
    7124   [ #  #  #  # ]:          0 :         if (WARN_ON(arg->ssid_len > sizeof(cmd->ssid.ssid)))
    7125                 :            :                 return ERR_PTR(-EINVAL);
    7126                 :            : 
    7127         [ #  # ]:          0 :         if (restart)
    7128                 :            :                 cmdname = "restart";
    7129                 :            :         else
    7130                 :          0 :                 cmdname = "start";
    7131                 :            : 
    7132                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7133         [ #  # ]:          0 :         if (!skb)
    7134                 :            :                 return ERR_PTR(-ENOMEM);
    7135                 :            : 
    7136         [ #  # ]:          0 :         if (arg->hidden_ssid)
    7137                 :          0 :                 flags |= WMI_VDEV_START_HIDDEN_SSID;
    7138         [ #  # ]:          0 :         if (arg->pmf_enabled)
    7139                 :          0 :                 flags |= WMI_VDEV_START_PMF_ENABLED;
    7140                 :            : 
    7141                 :          0 :         cmd = (struct wmi_vdev_start_request_cmd *)skb->data;
    7142                 :          0 :         cmd->vdev_id         = __cpu_to_le32(arg->vdev_id);
    7143                 :          0 :         cmd->disable_hw_ack  = __cpu_to_le32(arg->disable_hw_ack);
    7144                 :          0 :         cmd->beacon_interval = __cpu_to_le32(arg->bcn_intval);
    7145                 :          0 :         cmd->dtim_period     = __cpu_to_le32(arg->dtim_period);
    7146                 :          0 :         cmd->flags           = __cpu_to_le32(flags);
    7147                 :          0 :         cmd->bcn_tx_rate     = __cpu_to_le32(arg->bcn_tx_rate);
    7148                 :          0 :         cmd->bcn_tx_power    = __cpu_to_le32(arg->bcn_tx_power);
    7149                 :            : 
    7150         [ #  # ]:          0 :         if (arg->ssid) {
    7151                 :          0 :                 cmd->ssid.ssid_len = __cpu_to_le32(arg->ssid_len);
    7152                 :          0 :                 memcpy(cmd->ssid.ssid, arg->ssid, arg->ssid_len);
    7153                 :            :         }
    7154                 :            : 
    7155                 :          0 :         ath10k_wmi_put_wmi_channel(&cmd->chan, &arg->channel);
    7156                 :            : 
    7157         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7158                 :            :                    "wmi vdev %s id 0x%x flags: 0x%0X, freq %d, mode %d, ch_flags: 0x%0X, max_power: %d\n",
    7159                 :            :                    cmdname, arg->vdev_id,
    7160                 :            :                    flags, arg->channel.freq, arg->channel.mode,
    7161                 :            :                    cmd->chan.flags, arg->channel.max_power);
    7162                 :            : 
    7163                 :            :         return skb;
    7164                 :            : }
    7165                 :            : 
    7166                 :            : static struct sk_buff *
    7167                 :          0 : ath10k_wmi_op_gen_vdev_stop(struct ath10k *ar, u32 vdev_id)
    7168                 :            : {
    7169                 :          0 :         struct wmi_vdev_stop_cmd *cmd;
    7170                 :          0 :         struct sk_buff *skb;
    7171                 :            : 
    7172                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7173         [ #  # ]:          0 :         if (!skb)
    7174                 :            :                 return ERR_PTR(-ENOMEM);
    7175                 :            : 
    7176                 :          0 :         cmd = (struct wmi_vdev_stop_cmd *)skb->data;
    7177                 :          0 :         cmd->vdev_id = __cpu_to_le32(vdev_id);
    7178                 :            : 
    7179         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi vdev stop id 0x%x\n", vdev_id);
    7180                 :            :         return skb;
    7181                 :            : }
    7182                 :            : 
    7183                 :            : static struct sk_buff *
    7184                 :          0 : ath10k_wmi_op_gen_vdev_up(struct ath10k *ar, u32 vdev_id, u32 aid,
    7185                 :            :                           const u8 *bssid)
    7186                 :            : {
    7187                 :          0 :         struct wmi_vdev_up_cmd *cmd;
    7188                 :          0 :         struct sk_buff *skb;
    7189                 :            : 
    7190                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7191         [ #  # ]:          0 :         if (!skb)
    7192                 :            :                 return ERR_PTR(-ENOMEM);
    7193                 :            : 
    7194                 :          0 :         cmd = (struct wmi_vdev_up_cmd *)skb->data;
    7195                 :          0 :         cmd->vdev_id       = __cpu_to_le32(vdev_id);
    7196                 :          0 :         cmd->vdev_assoc_id = __cpu_to_le32(aid);
    7197         [ #  # ]:          0 :         ether_addr_copy(cmd->vdev_bssid.addr, bssid);
    7198                 :            : 
    7199         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7200                 :            :                    "wmi mgmt vdev up id 0x%x assoc id %d bssid %pM\n",
    7201                 :            :                    vdev_id, aid, bssid);
    7202                 :            :         return skb;
    7203                 :            : }
    7204                 :            : 
    7205                 :            : static struct sk_buff *
    7206                 :          0 : ath10k_wmi_op_gen_vdev_down(struct ath10k *ar, u32 vdev_id)
    7207                 :            : {
    7208                 :          0 :         struct wmi_vdev_down_cmd *cmd;
    7209                 :          0 :         struct sk_buff *skb;
    7210                 :            : 
    7211                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7212         [ #  # ]:          0 :         if (!skb)
    7213                 :            :                 return ERR_PTR(-ENOMEM);
    7214                 :            : 
    7215                 :          0 :         cmd = (struct wmi_vdev_down_cmd *)skb->data;
    7216                 :          0 :         cmd->vdev_id = __cpu_to_le32(vdev_id);
    7217                 :            : 
    7218         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7219                 :            :                    "wmi mgmt vdev down id 0x%x\n", vdev_id);
    7220                 :            :         return skb;
    7221                 :            : }
    7222                 :            : 
    7223                 :            : static struct sk_buff *
    7224                 :          0 : ath10k_wmi_op_gen_vdev_set_param(struct ath10k *ar, u32 vdev_id,
    7225                 :            :                                  u32 param_id, u32 param_value)
    7226                 :            : {
    7227                 :          0 :         struct wmi_vdev_set_param_cmd *cmd;
    7228                 :          0 :         struct sk_buff *skb;
    7229                 :            : 
    7230         [ #  # ]:          0 :         if (param_id == WMI_VDEV_PARAM_UNSUPPORTED) {
    7231         [ #  # ]:          0 :                 ath10k_dbg(ar, ATH10K_DBG_WMI,
    7232                 :            :                            "vdev param %d not supported by firmware\n",
    7233                 :            :                             param_id);
    7234                 :          0 :                 return ERR_PTR(-EOPNOTSUPP);
    7235                 :            :         }
    7236                 :            : 
    7237                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7238         [ #  # ]:          0 :         if (!skb)
    7239                 :            :                 return ERR_PTR(-ENOMEM);
    7240                 :            : 
    7241                 :          0 :         cmd = (struct wmi_vdev_set_param_cmd *)skb->data;
    7242                 :          0 :         cmd->vdev_id     = __cpu_to_le32(vdev_id);
    7243                 :          0 :         cmd->param_id    = __cpu_to_le32(param_id);
    7244                 :          0 :         cmd->param_value = __cpu_to_le32(param_value);
    7245                 :            : 
    7246         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7247                 :            :                    "wmi vdev id 0x%x set param %d value %d\n",
    7248                 :            :                    vdev_id, param_id, param_value);
    7249                 :            :         return skb;
    7250                 :            : }
    7251                 :            : 
    7252                 :            : static struct sk_buff *
    7253                 :          0 : ath10k_wmi_op_gen_vdev_install_key(struct ath10k *ar,
    7254                 :            :                                    const struct wmi_vdev_install_key_arg *arg)
    7255                 :            : {
    7256                 :          0 :         struct wmi_vdev_install_key_cmd *cmd;
    7257                 :          0 :         struct sk_buff *skb;
    7258                 :            : 
    7259   [ #  #  #  # ]:          0 :         if (arg->key_cipher == WMI_CIPHER_NONE && arg->key_data != NULL)
    7260                 :            :                 return ERR_PTR(-EINVAL);
    7261   [ #  #  #  # ]:          0 :         if (arg->key_cipher != WMI_CIPHER_NONE && arg->key_data == NULL)
    7262                 :            :                 return ERR_PTR(-EINVAL);
    7263                 :            : 
    7264                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd) + arg->key_len);
    7265         [ #  # ]:          0 :         if (!skb)
    7266                 :            :                 return ERR_PTR(-ENOMEM);
    7267                 :            : 
    7268                 :          0 :         cmd = (struct wmi_vdev_install_key_cmd *)skb->data;
    7269                 :          0 :         cmd->vdev_id       = __cpu_to_le32(arg->vdev_id);
    7270                 :          0 :         cmd->key_idx       = __cpu_to_le32(arg->key_idx);
    7271                 :          0 :         cmd->key_flags     = __cpu_to_le32(arg->key_flags);
    7272                 :          0 :         cmd->key_cipher    = __cpu_to_le32(arg->key_cipher);
    7273                 :          0 :         cmd->key_len       = __cpu_to_le32(arg->key_len);
    7274                 :          0 :         cmd->key_txmic_len = __cpu_to_le32(arg->key_txmic_len);
    7275                 :          0 :         cmd->key_rxmic_len = __cpu_to_le32(arg->key_rxmic_len);
    7276                 :            : 
    7277         [ #  # ]:          0 :         if (arg->macaddr)
    7278                 :          0 :                 ether_addr_copy(cmd->peer_macaddr.addr, arg->macaddr);
    7279         [ #  # ]:          0 :         if (arg->key_data)
    7280                 :          0 :                 memcpy(cmd->key_data, arg->key_data, arg->key_len);
    7281                 :            : 
    7282         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7283                 :            :                    "wmi vdev install key idx %d cipher %d len %d\n",
    7284                 :            :                    arg->key_idx, arg->key_cipher, arg->key_len);
    7285                 :            :         return skb;
    7286                 :            : }
    7287                 :            : 
    7288                 :            : static struct sk_buff *
    7289                 :          0 : ath10k_wmi_op_gen_vdev_spectral_conf(struct ath10k *ar,
    7290                 :            :                                      const struct wmi_vdev_spectral_conf_arg *arg)
    7291                 :            : {
    7292                 :          0 :         struct wmi_vdev_spectral_conf_cmd *cmd;
    7293                 :          0 :         struct sk_buff *skb;
    7294                 :            : 
    7295                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7296         [ #  # ]:          0 :         if (!skb)
    7297                 :            :                 return ERR_PTR(-ENOMEM);
    7298                 :            : 
    7299                 :          0 :         cmd = (struct wmi_vdev_spectral_conf_cmd *)skb->data;
    7300                 :          0 :         cmd->vdev_id = __cpu_to_le32(arg->vdev_id);
    7301                 :          0 :         cmd->scan_count = __cpu_to_le32(arg->scan_count);
    7302                 :          0 :         cmd->scan_period = __cpu_to_le32(arg->scan_period);
    7303                 :          0 :         cmd->scan_priority = __cpu_to_le32(arg->scan_priority);
    7304                 :          0 :         cmd->scan_fft_size = __cpu_to_le32(arg->scan_fft_size);
    7305                 :          0 :         cmd->scan_gc_ena = __cpu_to_le32(arg->scan_gc_ena);
    7306                 :          0 :         cmd->scan_restart_ena = __cpu_to_le32(arg->scan_restart_ena);
    7307                 :          0 :         cmd->scan_noise_floor_ref = __cpu_to_le32(arg->scan_noise_floor_ref);
    7308                 :          0 :         cmd->scan_init_delay = __cpu_to_le32(arg->scan_init_delay);
    7309                 :          0 :         cmd->scan_nb_tone_thr = __cpu_to_le32(arg->scan_nb_tone_thr);
    7310                 :          0 :         cmd->scan_str_bin_thr = __cpu_to_le32(arg->scan_str_bin_thr);
    7311                 :          0 :         cmd->scan_wb_rpt_mode = __cpu_to_le32(arg->scan_wb_rpt_mode);
    7312                 :          0 :         cmd->scan_rssi_rpt_mode = __cpu_to_le32(arg->scan_rssi_rpt_mode);
    7313                 :          0 :         cmd->scan_rssi_thr = __cpu_to_le32(arg->scan_rssi_thr);
    7314                 :          0 :         cmd->scan_pwr_format = __cpu_to_le32(arg->scan_pwr_format);
    7315                 :          0 :         cmd->scan_rpt_mode = __cpu_to_le32(arg->scan_rpt_mode);
    7316                 :          0 :         cmd->scan_bin_scale = __cpu_to_le32(arg->scan_bin_scale);
    7317                 :          0 :         cmd->scan_dbm_adj = __cpu_to_le32(arg->scan_dbm_adj);
    7318                 :          0 :         cmd->scan_chn_mask = __cpu_to_le32(arg->scan_chn_mask);
    7319                 :            : 
    7320                 :          0 :         return skb;
    7321                 :            : }
    7322                 :            : 
    7323                 :            : static struct sk_buff *
    7324                 :          0 : ath10k_wmi_op_gen_vdev_spectral_enable(struct ath10k *ar, u32 vdev_id,
    7325                 :            :                                        u32 trigger, u32 enable)
    7326                 :            : {
    7327                 :          0 :         struct wmi_vdev_spectral_enable_cmd *cmd;
    7328                 :          0 :         struct sk_buff *skb;
    7329                 :            : 
    7330                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7331         [ #  # ]:          0 :         if (!skb)
    7332                 :            :                 return ERR_PTR(-ENOMEM);
    7333                 :            : 
    7334                 :          0 :         cmd = (struct wmi_vdev_spectral_enable_cmd *)skb->data;
    7335                 :          0 :         cmd->vdev_id = __cpu_to_le32(vdev_id);
    7336                 :          0 :         cmd->trigger_cmd = __cpu_to_le32(trigger);
    7337                 :          0 :         cmd->enable_cmd = __cpu_to_le32(enable);
    7338                 :            : 
    7339                 :          0 :         return skb;
    7340                 :            : }
    7341                 :            : 
    7342                 :            : static struct sk_buff *
    7343                 :          0 : ath10k_wmi_op_gen_peer_create(struct ath10k *ar, u32 vdev_id,
    7344                 :            :                               const u8 peer_addr[ETH_ALEN],
    7345                 :            :                               enum wmi_peer_type peer_type)
    7346                 :            : {
    7347                 :          0 :         struct wmi_peer_create_cmd *cmd;
    7348                 :          0 :         struct sk_buff *skb;
    7349                 :            : 
    7350                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7351         [ #  # ]:          0 :         if (!skb)
    7352                 :            :                 return ERR_PTR(-ENOMEM);
    7353                 :            : 
    7354                 :          0 :         cmd = (struct wmi_peer_create_cmd *)skb->data;
    7355                 :          0 :         cmd->vdev_id = __cpu_to_le32(vdev_id);
    7356         [ #  # ]:          0 :         ether_addr_copy(cmd->peer_macaddr.addr, peer_addr);
    7357                 :          0 :         cmd->peer_type = __cpu_to_le32(peer_type);
    7358                 :            : 
    7359         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7360                 :            :                    "wmi peer create vdev_id %d peer_addr %pM\n",
    7361                 :            :                    vdev_id, peer_addr);
    7362                 :            :         return skb;
    7363                 :            : }
    7364                 :            : 
    7365                 :            : static struct sk_buff *
    7366                 :          0 : ath10k_wmi_op_gen_peer_delete(struct ath10k *ar, u32 vdev_id,
    7367                 :            :                               const u8 peer_addr[ETH_ALEN])
    7368                 :            : {
    7369                 :          0 :         struct wmi_peer_delete_cmd *cmd;
    7370                 :          0 :         struct sk_buff *skb;
    7371                 :            : 
    7372                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7373         [ #  # ]:          0 :         if (!skb)
    7374                 :            :                 return ERR_PTR(-ENOMEM);
    7375                 :            : 
    7376                 :          0 :         cmd = (struct wmi_peer_delete_cmd *)skb->data;
    7377                 :          0 :         cmd->vdev_id = __cpu_to_le32(vdev_id);
    7378         [ #  # ]:          0 :         ether_addr_copy(cmd->peer_macaddr.addr, peer_addr);
    7379                 :            : 
    7380         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7381                 :            :                    "wmi peer delete vdev_id %d peer_addr %pM\n",
    7382                 :            :                    vdev_id, peer_addr);
    7383                 :            :         return skb;
    7384                 :            : }
    7385                 :            : 
    7386                 :            : static struct sk_buff *
    7387                 :          0 : ath10k_wmi_op_gen_peer_flush(struct ath10k *ar, u32 vdev_id,
    7388                 :            :                              const u8 peer_addr[ETH_ALEN], u32 tid_bitmap)
    7389                 :            : {
    7390                 :          0 :         struct wmi_peer_flush_tids_cmd *cmd;
    7391                 :          0 :         struct sk_buff *skb;
    7392                 :            : 
    7393                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7394         [ #  # ]:          0 :         if (!skb)
    7395                 :            :                 return ERR_PTR(-ENOMEM);
    7396                 :            : 
    7397                 :          0 :         cmd = (struct wmi_peer_flush_tids_cmd *)skb->data;
    7398                 :          0 :         cmd->vdev_id         = __cpu_to_le32(vdev_id);
    7399                 :          0 :         cmd->peer_tid_bitmap = __cpu_to_le32(tid_bitmap);
    7400         [ #  # ]:          0 :         ether_addr_copy(cmd->peer_macaddr.addr, peer_addr);
    7401                 :            : 
    7402         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7403                 :            :                    "wmi peer flush vdev_id %d peer_addr %pM tids %08x\n",
    7404                 :            :                    vdev_id, peer_addr, tid_bitmap);
    7405                 :            :         return skb;
    7406                 :            : }
    7407                 :            : 
    7408                 :            : static struct sk_buff *
    7409                 :          0 : ath10k_wmi_op_gen_peer_set_param(struct ath10k *ar, u32 vdev_id,
    7410                 :            :                                  const u8 *peer_addr,
    7411                 :            :                                  enum wmi_peer_param param_id,
    7412                 :            :                                  u32 param_value)
    7413                 :            : {
    7414                 :          0 :         struct wmi_peer_set_param_cmd *cmd;
    7415                 :          0 :         struct sk_buff *skb;
    7416                 :            : 
    7417                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7418         [ #  # ]:          0 :         if (!skb)
    7419                 :            :                 return ERR_PTR(-ENOMEM);
    7420                 :            : 
    7421                 :          0 :         cmd = (struct wmi_peer_set_param_cmd *)skb->data;
    7422                 :          0 :         cmd->vdev_id     = __cpu_to_le32(vdev_id);
    7423                 :          0 :         cmd->param_id    = __cpu_to_le32(param_id);
    7424                 :          0 :         cmd->param_value = __cpu_to_le32(param_value);
    7425         [ #  # ]:          0 :         ether_addr_copy(cmd->peer_macaddr.addr, peer_addr);
    7426                 :            : 
    7427         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7428                 :            :                    "wmi vdev %d peer 0x%pM set param %d value %d\n",
    7429                 :            :                    vdev_id, peer_addr, param_id, param_value);
    7430                 :            :         return skb;
    7431                 :            : }
    7432                 :            : 
    7433                 :            : static struct sk_buff *
    7434                 :          0 : ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id,
    7435                 :            :                              enum wmi_sta_ps_mode psmode)
    7436                 :            : {
    7437                 :          0 :         struct wmi_sta_powersave_mode_cmd *cmd;
    7438                 :          0 :         struct sk_buff *skb;
    7439                 :            : 
    7440                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7441         [ #  # ]:          0 :         if (!skb)
    7442                 :            :                 return ERR_PTR(-ENOMEM);
    7443                 :            : 
    7444                 :          0 :         cmd = (struct wmi_sta_powersave_mode_cmd *)skb->data;
    7445                 :          0 :         cmd->vdev_id     = __cpu_to_le32(vdev_id);
    7446                 :          0 :         cmd->sta_ps_mode = __cpu_to_le32(psmode);
    7447                 :            : 
    7448         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7449                 :            :                    "wmi set powersave id 0x%x mode %d\n",
    7450                 :            :                    vdev_id, psmode);
    7451                 :            :         return skb;
    7452                 :            : }
    7453                 :            : 
    7454                 :            : static struct sk_buff *
    7455                 :          0 : ath10k_wmi_op_gen_set_sta_ps(struct ath10k *ar, u32 vdev_id,
    7456                 :            :                              enum wmi_sta_powersave_param param_id,
    7457                 :            :                              u32 value)
    7458                 :            : {
    7459                 :          0 :         struct wmi_sta_powersave_param_cmd *cmd;
    7460                 :          0 :         struct sk_buff *skb;
    7461                 :            : 
    7462                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7463         [ #  # ]:          0 :         if (!skb)
    7464                 :            :                 return ERR_PTR(-ENOMEM);
    7465                 :            : 
    7466                 :          0 :         cmd = (struct wmi_sta_powersave_param_cmd *)skb->data;
    7467                 :          0 :         cmd->vdev_id     = __cpu_to_le32(vdev_id);
    7468                 :          0 :         cmd->param_id    = __cpu_to_le32(param_id);
    7469                 :          0 :         cmd->param_value = __cpu_to_le32(value);
    7470                 :            : 
    7471         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7472                 :            :                    "wmi sta ps param vdev_id 0x%x param %d value %d\n",
    7473                 :            :                    vdev_id, param_id, value);
    7474                 :            :         return skb;
    7475                 :            : }
    7476                 :            : 
    7477                 :            : static struct sk_buff *
    7478                 :          0 : ath10k_wmi_op_gen_set_ap_ps(struct ath10k *ar, u32 vdev_id, const u8 *mac,
    7479                 :            :                             enum wmi_ap_ps_peer_param param_id, u32 value)
    7480                 :            : {
    7481                 :          0 :         struct wmi_ap_ps_peer_cmd *cmd;
    7482                 :          0 :         struct sk_buff *skb;
    7483                 :            : 
    7484         [ #  # ]:          0 :         if (!mac)
    7485                 :            :                 return ERR_PTR(-EINVAL);
    7486                 :            : 
    7487                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7488         [ #  # ]:          0 :         if (!skb)
    7489                 :            :                 return ERR_PTR(-ENOMEM);
    7490                 :            : 
    7491                 :          0 :         cmd = (struct wmi_ap_ps_peer_cmd *)skb->data;
    7492                 :          0 :         cmd->vdev_id = __cpu_to_le32(vdev_id);
    7493                 :          0 :         cmd->param_id = __cpu_to_le32(param_id);
    7494                 :          0 :         cmd->param_value = __cpu_to_le32(value);
    7495         [ #  # ]:          0 :         ether_addr_copy(cmd->peer_macaddr.addr, mac);
    7496                 :            : 
    7497         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7498                 :            :                    "wmi ap ps param vdev_id 0x%X param %d value %d mac_addr %pM\n",
    7499                 :            :                    vdev_id, param_id, value, mac);
    7500                 :            :         return skb;
    7501                 :            : }
    7502                 :            : 
    7503                 :            : static struct sk_buff *
    7504                 :          0 : ath10k_wmi_op_gen_scan_chan_list(struct ath10k *ar,
    7505                 :            :                                  const struct wmi_scan_chan_list_arg *arg)
    7506                 :            : {
    7507                 :          0 :         struct wmi_scan_chan_list_cmd *cmd;
    7508                 :          0 :         struct sk_buff *skb;
    7509                 :          0 :         struct wmi_channel_arg *ch;
    7510                 :          0 :         struct wmi_channel *ci;
    7511                 :          0 :         int len;
    7512                 :          0 :         int i;
    7513                 :            : 
    7514                 :          0 :         len = sizeof(*cmd) + arg->n_channels * sizeof(struct wmi_channel);
    7515                 :            : 
    7516                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, len);
    7517         [ #  # ]:          0 :         if (!skb)
    7518                 :            :                 return ERR_PTR(-EINVAL);
    7519                 :            : 
    7520                 :          0 :         cmd = (struct wmi_scan_chan_list_cmd *)skb->data;
    7521                 :          0 :         cmd->num_scan_chans = __cpu_to_le32(arg->n_channels);
    7522                 :            : 
    7523         [ #  # ]:          0 :         for (i = 0; i < arg->n_channels; i++) {
    7524                 :          0 :                 ch = &arg->channels[i];
    7525                 :          0 :                 ci = &cmd->chan_info[i];
    7526                 :            : 
    7527                 :          0 :                 ath10k_wmi_put_wmi_channel(ci, ch);
    7528                 :            :         }
    7529                 :            : 
    7530                 :            :         return skb;
    7531                 :            : }
    7532                 :            : 
    7533                 :            : static void
    7534                 :            : ath10k_wmi_peer_assoc_fill(struct ath10k *ar, void *buf,
    7535                 :            :                            const struct wmi_peer_assoc_complete_arg *arg)
    7536                 :            : {
    7537                 :            :         struct wmi_common_peer_assoc_complete_cmd *cmd = buf;
    7538                 :            : 
    7539                 :            :         cmd->vdev_id            = __cpu_to_le32(arg->vdev_id);
    7540                 :            :         cmd->peer_new_assoc     = __cpu_to_le32(arg->peer_reassoc ? 0 : 1);
    7541                 :            :         cmd->peer_associd       = __cpu_to_le32(arg->peer_aid);
    7542                 :            :         cmd->peer_flags         = __cpu_to_le32(arg->peer_flags);
    7543                 :            :         cmd->peer_caps          = __cpu_to_le32(arg->peer_caps);
    7544                 :            :         cmd->peer_listen_intval = __cpu_to_le32(arg->peer_listen_intval);
    7545                 :            :         cmd->peer_ht_caps       = __cpu_to_le32(arg->peer_ht_caps);
    7546                 :            :         cmd->peer_max_mpdu      = __cpu_to_le32(arg->peer_max_mpdu);
    7547                 :            :         cmd->peer_mpdu_density  = __cpu_to_le32(arg->peer_mpdu_density);
    7548                 :            :         cmd->peer_rate_caps     = __cpu_to_le32(arg->peer_rate_caps);
    7549                 :            :         cmd->peer_nss           = __cpu_to_le32(arg->peer_num_spatial_streams);
    7550                 :            :         cmd->peer_vht_caps      = __cpu_to_le32(arg->peer_vht_caps);
    7551                 :            :         cmd->peer_phymode       = __cpu_to_le32(arg->peer_phymode);
    7552                 :            : 
    7553                 :            :         ether_addr_copy(cmd->peer_macaddr.addr, arg->addr);
    7554                 :            : 
    7555                 :            :         cmd->peer_legacy_rates.num_rates =
    7556                 :            :                 __cpu_to_le32(arg->peer_legacy_rates.num_rates);
    7557                 :            :         memcpy(cmd->peer_legacy_rates.rates, arg->peer_legacy_rates.rates,
    7558                 :            :                arg->peer_legacy_rates.num_rates);
    7559                 :            : 
    7560                 :            :         cmd->peer_ht_rates.num_rates =
    7561                 :            :                 __cpu_to_le32(arg->peer_ht_rates.num_rates);
    7562                 :            :         memcpy(cmd->peer_ht_rates.rates, arg->peer_ht_rates.rates,
    7563                 :            :                arg->peer_ht_rates.num_rates);
    7564                 :            : 
    7565                 :            :         cmd->peer_vht_rates.rx_max_rate =
    7566                 :            :                 __cpu_to_le32(arg->peer_vht_rates.rx_max_rate);
    7567                 :            :         cmd->peer_vht_rates.rx_mcs_set =
    7568                 :            :                 __cpu_to_le32(arg->peer_vht_rates.rx_mcs_set);
    7569                 :            :         cmd->peer_vht_rates.tx_max_rate =
    7570                 :            :                 __cpu_to_le32(arg->peer_vht_rates.tx_max_rate);
    7571                 :            :         cmd->peer_vht_rates.tx_mcs_set =
    7572                 :            :                 __cpu_to_le32(arg->peer_vht_rates.tx_mcs_set);
    7573                 :            : }
    7574                 :            : 
    7575                 :            : static void
    7576                 :          0 : ath10k_wmi_peer_assoc_fill_main(struct ath10k *ar, void *buf,
    7577                 :            :                                 const struct wmi_peer_assoc_complete_arg *arg)
    7578                 :            : {
    7579                 :          0 :         struct wmi_main_peer_assoc_complete_cmd *cmd = buf;
    7580                 :            : 
    7581                 :          0 :         ath10k_wmi_peer_assoc_fill(ar, buf, arg);
    7582                 :          0 :         memset(cmd->peer_ht_info, 0, sizeof(cmd->peer_ht_info));
    7583                 :            : }
    7584                 :            : 
    7585                 :            : static void
    7586                 :          0 : ath10k_wmi_peer_assoc_fill_10_1(struct ath10k *ar, void *buf,
    7587                 :            :                                 const struct wmi_peer_assoc_complete_arg *arg)
    7588                 :            : {
    7589                 :          0 :         ath10k_wmi_peer_assoc_fill(ar, buf, arg);
    7590                 :            : }
    7591                 :            : 
    7592                 :            : static void
    7593                 :          0 : ath10k_wmi_peer_assoc_fill_10_2(struct ath10k *ar, void *buf,
    7594                 :            :                                 const struct wmi_peer_assoc_complete_arg *arg)
    7595                 :            : {
    7596                 :          0 :         struct wmi_10_2_peer_assoc_complete_cmd *cmd = buf;
    7597                 :          0 :         int max_mcs, max_nss;
    7598                 :          0 :         u32 info0;
    7599                 :            : 
    7600                 :            :         /* TODO: Is using max values okay with firmware? */
    7601                 :          0 :         max_mcs = 0xf;
    7602                 :          0 :         max_nss = 0xf;
    7603                 :            : 
    7604                 :          0 :         info0 = SM(max_mcs, WMI_PEER_ASSOC_INFO0_MAX_MCS_IDX) |
    7605                 :            :                 SM(max_nss, WMI_PEER_ASSOC_INFO0_MAX_NSS);
    7606                 :            : 
    7607                 :          0 :         ath10k_wmi_peer_assoc_fill(ar, buf, arg);
    7608                 :          0 :         cmd->info0 = __cpu_to_le32(info0);
    7609                 :            : }
    7610                 :            : 
    7611                 :            : static void
    7612                 :          0 : ath10k_wmi_peer_assoc_fill_10_4(struct ath10k *ar, void *buf,
    7613                 :            :                                 const struct wmi_peer_assoc_complete_arg *arg)
    7614                 :            : {
    7615                 :          0 :         struct wmi_10_4_peer_assoc_complete_cmd *cmd = buf;
    7616                 :            : 
    7617                 :          0 :         ath10k_wmi_peer_assoc_fill_10_2(ar, buf, arg);
    7618         [ #  # ]:          0 :         if (arg->peer_bw_rxnss_override)
    7619                 :          0 :                 cmd->peer_bw_rxnss_override =
    7620                 :          0 :                         __cpu_to_le32((arg->peer_bw_rxnss_override - 1) |
    7621                 :            :                                       BIT(PEER_BW_RXNSS_OVERRIDE_OFFSET));
    7622                 :            :         else
    7623                 :          0 :                 cmd->peer_bw_rxnss_override = 0;
    7624                 :            : }
    7625                 :            : 
    7626                 :            : static int
    7627                 :          0 : ath10k_wmi_peer_assoc_check_arg(const struct wmi_peer_assoc_complete_arg *arg)
    7628                 :            : {
    7629                 :          0 :         if (arg->peer_mpdu_density > 16)
    7630                 :            :                 return -EINVAL;
    7631   [ #  #  #  #  :          0 :         if (arg->peer_legacy_rates.num_rates > MAX_SUPPORTED_RATES)
             #  #  #  # ]
    7632                 :            :                 return -EINVAL;
    7633   [ #  #  #  #  :          0 :         if (arg->peer_ht_rates.num_rates > MAX_SUPPORTED_RATES)
             #  #  #  # ]
    7634                 :            :                 return -EINVAL;
    7635                 :            : 
    7636                 :            :         return 0;
    7637                 :            : }
    7638                 :            : 
    7639                 :            : static struct sk_buff *
    7640                 :          0 : ath10k_wmi_op_gen_peer_assoc(struct ath10k *ar,
    7641                 :            :                              const struct wmi_peer_assoc_complete_arg *arg)
    7642                 :            : {
    7643                 :          0 :         size_t len = sizeof(struct wmi_main_peer_assoc_complete_cmd);
    7644                 :          0 :         struct sk_buff *skb;
    7645                 :          0 :         int ret;
    7646                 :            : 
    7647         [ #  # ]:          0 :         ret = ath10k_wmi_peer_assoc_check_arg(arg);
    7648                 :          0 :         if (ret)
    7649                 :            :                 return ERR_PTR(ret);
    7650                 :            : 
    7651                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, len);
    7652         [ #  # ]:          0 :         if (!skb)
    7653                 :            :                 return ERR_PTR(-ENOMEM);
    7654                 :            : 
    7655                 :          0 :         ath10k_wmi_peer_assoc_fill_main(ar, skb->data, arg);
    7656                 :            : 
    7657   [ #  #  #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7658                 :            :                    "wmi peer assoc vdev %d addr %pM (%s)\n",
    7659                 :            :                    arg->vdev_id, arg->addr,
    7660                 :            :                    arg->peer_reassoc ? "reassociate" : "new");
    7661                 :            :         return skb;
    7662                 :            : }
    7663                 :            : 
    7664                 :            : static struct sk_buff *
    7665                 :          0 : ath10k_wmi_10_1_op_gen_peer_assoc(struct ath10k *ar,
    7666                 :            :                                   const struct wmi_peer_assoc_complete_arg *arg)
    7667                 :            : {
    7668                 :          0 :         size_t len = sizeof(struct wmi_10_1_peer_assoc_complete_cmd);
    7669                 :          0 :         struct sk_buff *skb;
    7670                 :          0 :         int ret;
    7671                 :            : 
    7672         [ #  # ]:          0 :         ret = ath10k_wmi_peer_assoc_check_arg(arg);
    7673                 :          0 :         if (ret)
    7674                 :            :                 return ERR_PTR(ret);
    7675                 :            : 
    7676                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, len);
    7677         [ #  # ]:          0 :         if (!skb)
    7678                 :            :                 return ERR_PTR(-ENOMEM);
    7679                 :            : 
    7680                 :          0 :         ath10k_wmi_peer_assoc_fill_10_1(ar, skb->data, arg);
    7681                 :            : 
    7682   [ #  #  #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7683                 :            :                    "wmi peer assoc vdev %d addr %pM (%s)\n",
    7684                 :            :                    arg->vdev_id, arg->addr,
    7685                 :            :                    arg->peer_reassoc ? "reassociate" : "new");
    7686                 :            :         return skb;
    7687                 :            : }
    7688                 :            : 
    7689                 :            : static struct sk_buff *
    7690                 :          0 : ath10k_wmi_10_2_op_gen_peer_assoc(struct ath10k *ar,
    7691                 :            :                                   const struct wmi_peer_assoc_complete_arg *arg)
    7692                 :            : {
    7693                 :          0 :         size_t len = sizeof(struct wmi_10_2_peer_assoc_complete_cmd);
    7694                 :          0 :         struct sk_buff *skb;
    7695                 :          0 :         int ret;
    7696                 :            : 
    7697         [ #  # ]:          0 :         ret = ath10k_wmi_peer_assoc_check_arg(arg);
    7698                 :          0 :         if (ret)
    7699                 :            :                 return ERR_PTR(ret);
    7700                 :            : 
    7701                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, len);
    7702         [ #  # ]:          0 :         if (!skb)
    7703                 :            :                 return ERR_PTR(-ENOMEM);
    7704                 :            : 
    7705                 :          0 :         ath10k_wmi_peer_assoc_fill_10_2(ar, skb->data, arg);
    7706                 :            : 
    7707   [ #  #  #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7708                 :            :                    "wmi peer assoc vdev %d addr %pM (%s)\n",
    7709                 :            :                    arg->vdev_id, arg->addr,
    7710                 :            :                    arg->peer_reassoc ? "reassociate" : "new");
    7711                 :            :         return skb;
    7712                 :            : }
    7713                 :            : 
    7714                 :            : static struct sk_buff *
    7715                 :          0 : ath10k_wmi_10_4_op_gen_peer_assoc(struct ath10k *ar,
    7716                 :            :                                   const struct wmi_peer_assoc_complete_arg *arg)
    7717                 :            : {
    7718                 :          0 :         size_t len = sizeof(struct wmi_10_4_peer_assoc_complete_cmd);
    7719                 :          0 :         struct sk_buff *skb;
    7720                 :          0 :         int ret;
    7721                 :            : 
    7722         [ #  # ]:          0 :         ret = ath10k_wmi_peer_assoc_check_arg(arg);
    7723                 :          0 :         if (ret)
    7724                 :            :                 return ERR_PTR(ret);
    7725                 :            : 
    7726                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, len);
    7727         [ #  # ]:          0 :         if (!skb)
    7728                 :            :                 return ERR_PTR(-ENOMEM);
    7729                 :            : 
    7730                 :          0 :         ath10k_wmi_peer_assoc_fill_10_4(ar, skb->data, arg);
    7731                 :            : 
    7732   [ #  #  #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7733                 :            :                    "wmi peer assoc vdev %d addr %pM (%s)\n",
    7734                 :            :                    arg->vdev_id, arg->addr,
    7735                 :            :                    arg->peer_reassoc ? "reassociate" : "new");
    7736                 :            :         return skb;
    7737                 :            : }
    7738                 :            : 
    7739                 :            : static struct sk_buff *
    7740                 :          0 : ath10k_wmi_10_2_op_gen_pdev_get_temperature(struct ath10k *ar)
    7741                 :            : {
    7742                 :          0 :         struct sk_buff *skb;
    7743                 :            : 
    7744                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, 0);
    7745         [ #  # ]:          0 :         if (!skb)
    7746                 :            :                 return ERR_PTR(-ENOMEM);
    7747                 :            : 
    7748         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi pdev get temperature\n");
    7749                 :            :         return skb;
    7750                 :            : }
    7751                 :            : 
    7752                 :            : static struct sk_buff *
    7753                 :          0 : ath10k_wmi_10_2_op_gen_pdev_bss_chan_info(struct ath10k *ar,
    7754                 :            :                                           enum wmi_bss_survey_req_type type)
    7755                 :            : {
    7756                 :          0 :         struct wmi_pdev_chan_info_req_cmd *cmd;
    7757                 :          0 :         struct sk_buff *skb;
    7758                 :            : 
    7759                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7760         [ #  # ]:          0 :         if (!skb)
    7761                 :            :                 return ERR_PTR(-ENOMEM);
    7762                 :            : 
    7763                 :          0 :         cmd = (struct wmi_pdev_chan_info_req_cmd *)skb->data;
    7764                 :          0 :         cmd->type = __cpu_to_le32(type);
    7765                 :            : 
    7766         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7767                 :            :                    "wmi pdev bss info request type %d\n", type);
    7768                 :            : 
    7769                 :            :         return skb;
    7770                 :            : }
    7771                 :            : 
    7772                 :            : /* This function assumes the beacon is already DMA mapped */
    7773                 :            : static struct sk_buff *
    7774                 :          0 : ath10k_wmi_op_gen_beacon_dma(struct ath10k *ar, u32 vdev_id, const void *bcn,
    7775                 :            :                              size_t bcn_len, u32 bcn_paddr, bool dtim_zero,
    7776                 :            :                              bool deliver_cab)
    7777                 :            : {
    7778                 :          0 :         struct wmi_bcn_tx_ref_cmd *cmd;
    7779                 :          0 :         struct sk_buff *skb;
    7780                 :          0 :         struct ieee80211_hdr *hdr;
    7781                 :          0 :         u16 fc;
    7782                 :            : 
    7783                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7784         [ #  # ]:          0 :         if (!skb)
    7785                 :            :                 return ERR_PTR(-ENOMEM);
    7786                 :            : 
    7787                 :          0 :         hdr = (struct ieee80211_hdr *)bcn;
    7788                 :          0 :         fc = le16_to_cpu(hdr->frame_control);
    7789                 :            : 
    7790                 :          0 :         cmd = (struct wmi_bcn_tx_ref_cmd *)skb->data;
    7791                 :          0 :         cmd->vdev_id = __cpu_to_le32(vdev_id);
    7792                 :          0 :         cmd->data_len = __cpu_to_le32(bcn_len);
    7793                 :          0 :         cmd->data_ptr = __cpu_to_le32(bcn_paddr);
    7794                 :          0 :         cmd->msdu_id = 0;
    7795                 :          0 :         cmd->frame_control = __cpu_to_le32(fc);
    7796                 :          0 :         cmd->flags = 0;
    7797                 :          0 :         cmd->antenna_mask = __cpu_to_le32(WMI_BCN_TX_REF_DEF_ANTENNA);
    7798                 :            : 
    7799         [ #  # ]:          0 :         if (dtim_zero)
    7800                 :          0 :                 cmd->flags |= __cpu_to_le32(WMI_BCN_TX_REF_FLAG_DTIM_ZERO);
    7801                 :            : 
    7802         [ #  # ]:          0 :         if (deliver_cab)
    7803                 :          0 :                 cmd->flags |= __cpu_to_le32(WMI_BCN_TX_REF_FLAG_DELIVER_CAB);
    7804                 :            : 
    7805                 :            :         return skb;
    7806                 :            : }
    7807                 :            : 
    7808                 :          0 : void ath10k_wmi_set_wmm_param(struct wmi_wmm_params *params,
    7809                 :            :                               const struct wmi_wmm_params_arg *arg)
    7810                 :            : {
    7811                 :          0 :         params->cwmin  = __cpu_to_le32(arg->cwmin);
    7812                 :          0 :         params->cwmax  = __cpu_to_le32(arg->cwmax);
    7813                 :          0 :         params->aifs   = __cpu_to_le32(arg->aifs);
    7814                 :          0 :         params->txop   = __cpu_to_le32(arg->txop);
    7815                 :          0 :         params->acm    = __cpu_to_le32(arg->acm);
    7816                 :          0 :         params->no_ack = __cpu_to_le32(arg->no_ack);
    7817                 :          0 : }
    7818                 :            : 
    7819                 :            : static struct sk_buff *
    7820                 :          0 : ath10k_wmi_op_gen_pdev_set_wmm(struct ath10k *ar,
    7821                 :            :                                const struct wmi_wmm_params_all_arg *arg)
    7822                 :            : {
    7823                 :          0 :         struct wmi_pdev_set_wmm_params *cmd;
    7824                 :          0 :         struct sk_buff *skb;
    7825                 :            : 
    7826                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7827         [ #  # ]:          0 :         if (!skb)
    7828                 :            :                 return ERR_PTR(-ENOMEM);
    7829                 :            : 
    7830                 :          0 :         cmd = (struct wmi_pdev_set_wmm_params *)skb->data;
    7831                 :          0 :         ath10k_wmi_set_wmm_param(&cmd->ac_be, &arg->ac_be);
    7832                 :          0 :         ath10k_wmi_set_wmm_param(&cmd->ac_bk, &arg->ac_bk);
    7833                 :          0 :         ath10k_wmi_set_wmm_param(&cmd->ac_vi, &arg->ac_vi);
    7834                 :          0 :         ath10k_wmi_set_wmm_param(&cmd->ac_vo, &arg->ac_vo);
    7835                 :            : 
    7836         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi pdev set wmm params\n");
    7837                 :            :         return skb;
    7838                 :            : }
    7839                 :            : 
    7840                 :            : static struct sk_buff *
    7841                 :          0 : ath10k_wmi_op_gen_request_stats(struct ath10k *ar, u32 stats_mask)
    7842                 :            : {
    7843                 :          0 :         struct wmi_request_stats_cmd *cmd;
    7844                 :          0 :         struct sk_buff *skb;
    7845                 :            : 
    7846                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7847         [ #  # ]:          0 :         if (!skb)
    7848                 :            :                 return ERR_PTR(-ENOMEM);
    7849                 :            : 
    7850                 :          0 :         cmd = (struct wmi_request_stats_cmd *)skb->data;
    7851                 :          0 :         cmd->stats_id = __cpu_to_le32(stats_mask);
    7852                 :            : 
    7853         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi request stats 0x%08x\n",
    7854                 :            :                    stats_mask);
    7855                 :            :         return skb;
    7856                 :            : }
    7857                 :            : 
    7858                 :            : static struct sk_buff *
    7859                 :          0 : ath10k_wmi_op_gen_force_fw_hang(struct ath10k *ar,
    7860                 :            :                                 enum wmi_force_fw_hang_type type, u32 delay_ms)
    7861                 :            : {
    7862                 :          0 :         struct wmi_force_fw_hang_cmd *cmd;
    7863                 :          0 :         struct sk_buff *skb;
    7864                 :            : 
    7865                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7866         [ #  # ]:          0 :         if (!skb)
    7867                 :            :                 return ERR_PTR(-ENOMEM);
    7868                 :            : 
    7869                 :          0 :         cmd = (struct wmi_force_fw_hang_cmd *)skb->data;
    7870                 :          0 :         cmd->type = __cpu_to_le32(type);
    7871                 :          0 :         cmd->delay_ms = __cpu_to_le32(delay_ms);
    7872                 :            : 
    7873         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi force fw hang %d delay %d\n",
    7874                 :            :                    type, delay_ms);
    7875                 :            :         return skb;
    7876                 :            : }
    7877                 :            : 
    7878                 :            : static struct sk_buff *
    7879                 :          0 : ath10k_wmi_op_gen_dbglog_cfg(struct ath10k *ar, u64 module_enable,
    7880                 :            :                              u32 log_level)
    7881                 :            : {
    7882                 :          0 :         struct wmi_dbglog_cfg_cmd *cmd;
    7883                 :          0 :         struct sk_buff *skb;
    7884                 :          0 :         u32 cfg;
    7885                 :            : 
    7886                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7887         [ #  # ]:          0 :         if (!skb)
    7888                 :            :                 return ERR_PTR(-ENOMEM);
    7889                 :            : 
    7890                 :          0 :         cmd = (struct wmi_dbglog_cfg_cmd *)skb->data;
    7891                 :            : 
    7892         [ #  # ]:          0 :         if (module_enable) {
    7893                 :          0 :                 cfg = SM(log_level,
    7894                 :            :                          ATH10K_DBGLOG_CFG_LOG_LVL);
    7895                 :            :         } else {
    7896                 :            :                 /* set back defaults, all modules with WARN level */
    7897                 :            :                 cfg = SM(ATH10K_DBGLOG_LEVEL_WARN,
    7898                 :            :                          ATH10K_DBGLOG_CFG_LOG_LVL);
    7899                 :            :                 module_enable = ~0;
    7900                 :            :         }
    7901                 :            : 
    7902                 :          0 :         cmd->module_enable = __cpu_to_le32(module_enable);
    7903                 :          0 :         cmd->module_valid = __cpu_to_le32(~0);
    7904                 :          0 :         cmd->config_enable = __cpu_to_le32(cfg);
    7905                 :          0 :         cmd->config_valid = __cpu_to_le32(ATH10K_DBGLOG_CFG_LOG_LVL_MASK);
    7906                 :            : 
    7907         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7908                 :            :                    "wmi dbglog cfg modules %08x %08x config %08x %08x\n",
    7909                 :            :                    __le32_to_cpu(cmd->module_enable),
    7910                 :            :                    __le32_to_cpu(cmd->module_valid),
    7911                 :            :                    __le32_to_cpu(cmd->config_enable),
    7912                 :            :                    __le32_to_cpu(cmd->config_valid));
    7913                 :            :         return skb;
    7914                 :            : }
    7915                 :            : 
    7916                 :            : static struct sk_buff *
    7917                 :          0 : ath10k_wmi_10_4_op_gen_dbglog_cfg(struct ath10k *ar, u64 module_enable,
    7918                 :            :                                   u32 log_level)
    7919                 :            : {
    7920                 :          0 :         struct wmi_10_4_dbglog_cfg_cmd *cmd;
    7921                 :          0 :         struct sk_buff *skb;
    7922                 :          0 :         u32 cfg;
    7923                 :            : 
    7924                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7925         [ #  # ]:          0 :         if (!skb)
    7926                 :            :                 return ERR_PTR(-ENOMEM);
    7927                 :            : 
    7928                 :          0 :         cmd = (struct wmi_10_4_dbglog_cfg_cmd *)skb->data;
    7929                 :            : 
    7930         [ #  # ]:          0 :         if (module_enable) {
    7931                 :          0 :                 cfg = SM(log_level,
    7932                 :            :                          ATH10K_DBGLOG_CFG_LOG_LVL);
    7933                 :            :         } else {
    7934                 :            :                 /* set back defaults, all modules with WARN level */
    7935                 :            :                 cfg = SM(ATH10K_DBGLOG_LEVEL_WARN,
    7936                 :            :                          ATH10K_DBGLOG_CFG_LOG_LVL);
    7937                 :            :                 module_enable = ~0;
    7938                 :            :         }
    7939                 :            : 
    7940                 :          0 :         cmd->module_enable = __cpu_to_le64(module_enable);
    7941                 :          0 :         cmd->module_valid = __cpu_to_le64(~0);
    7942                 :          0 :         cmd->config_enable = __cpu_to_le32(cfg);
    7943                 :          0 :         cmd->config_valid = __cpu_to_le32(ATH10K_DBGLOG_CFG_LOG_LVL_MASK);
    7944                 :            : 
    7945         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    7946                 :            :                    "wmi dbglog cfg modules 0x%016llx 0x%016llx config %08x %08x\n",
    7947                 :            :                    __le64_to_cpu(cmd->module_enable),
    7948                 :            :                    __le64_to_cpu(cmd->module_valid),
    7949                 :            :                    __le32_to_cpu(cmd->config_enable),
    7950                 :            :                    __le32_to_cpu(cmd->config_valid));
    7951                 :            :         return skb;
    7952                 :            : }
    7953                 :            : 
    7954                 :            : static struct sk_buff *
    7955                 :          0 : ath10k_wmi_op_gen_pktlog_enable(struct ath10k *ar, u32 ev_bitmap)
    7956                 :            : {
    7957                 :          0 :         struct wmi_pdev_pktlog_enable_cmd *cmd;
    7958                 :          0 :         struct sk_buff *skb;
    7959                 :            : 
    7960                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7961         [ #  # ]:          0 :         if (!skb)
    7962                 :            :                 return ERR_PTR(-ENOMEM);
    7963                 :            : 
    7964                 :          0 :         ev_bitmap &= ATH10K_PKTLOG_ANY;
    7965                 :            : 
    7966                 :          0 :         cmd = (struct wmi_pdev_pktlog_enable_cmd *)skb->data;
    7967                 :          0 :         cmd->ev_bitmap = __cpu_to_le32(ev_bitmap);
    7968                 :            : 
    7969         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi enable pktlog filter 0x%08x\n",
    7970                 :            :                    ev_bitmap);
    7971                 :            :         return skb;
    7972                 :            : }
    7973                 :            : 
    7974                 :            : static struct sk_buff *
    7975                 :          0 : ath10k_wmi_op_gen_pktlog_disable(struct ath10k *ar)
    7976                 :            : {
    7977                 :          0 :         struct sk_buff *skb;
    7978                 :            : 
    7979                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, 0);
    7980         [ #  # ]:          0 :         if (!skb)
    7981                 :            :                 return ERR_PTR(-ENOMEM);
    7982                 :            : 
    7983         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi disable pktlog\n");
    7984                 :            :         return skb;
    7985                 :            : }
    7986                 :            : 
    7987                 :            : static struct sk_buff *
    7988                 :          0 : ath10k_wmi_op_gen_pdev_set_quiet_mode(struct ath10k *ar, u32 period,
    7989                 :            :                                       u32 duration, u32 next_offset,
    7990                 :            :                                       u32 enabled)
    7991                 :            : {
    7992                 :          0 :         struct wmi_pdev_set_quiet_cmd *cmd;
    7993                 :          0 :         struct sk_buff *skb;
    7994                 :            : 
    7995                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    7996         [ #  # ]:          0 :         if (!skb)
    7997                 :            :                 return ERR_PTR(-ENOMEM);
    7998                 :            : 
    7999                 :          0 :         cmd = (struct wmi_pdev_set_quiet_cmd *)skb->data;
    8000                 :          0 :         cmd->period = __cpu_to_le32(period);
    8001                 :          0 :         cmd->duration = __cpu_to_le32(duration);
    8002                 :          0 :         cmd->next_start = __cpu_to_le32(next_offset);
    8003                 :          0 :         cmd->enabled = __cpu_to_le32(enabled);
    8004                 :            : 
    8005         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    8006                 :            :                    "wmi quiet param: period %u duration %u enabled %d\n",
    8007                 :            :                    period, duration, enabled);
    8008                 :            :         return skb;
    8009                 :            : }
    8010                 :            : 
    8011                 :            : static struct sk_buff *
    8012                 :          0 : ath10k_wmi_op_gen_addba_clear_resp(struct ath10k *ar, u32 vdev_id,
    8013                 :            :                                    const u8 *mac)
    8014                 :            : {
    8015                 :          0 :         struct wmi_addba_clear_resp_cmd *cmd;
    8016                 :          0 :         struct sk_buff *skb;
    8017                 :            : 
    8018         [ #  # ]:          0 :         if (!mac)
    8019                 :            :                 return ERR_PTR(-EINVAL);
    8020                 :            : 
    8021                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    8022         [ #  # ]:          0 :         if (!skb)
    8023                 :            :                 return ERR_PTR(-ENOMEM);
    8024                 :            : 
    8025                 :          0 :         cmd = (struct wmi_addba_clear_resp_cmd *)skb->data;
    8026                 :          0 :         cmd->vdev_id = __cpu_to_le32(vdev_id);
    8027         [ #  # ]:          0 :         ether_addr_copy(cmd->peer_macaddr.addr, mac);
    8028                 :            : 
    8029         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    8030                 :            :                    "wmi addba clear resp vdev_id 0x%X mac_addr %pM\n",
    8031                 :            :                    vdev_id, mac);
    8032                 :            :         return skb;
    8033                 :            : }
    8034                 :            : 
    8035                 :            : static struct sk_buff *
    8036                 :          0 : ath10k_wmi_op_gen_addba_send(struct ath10k *ar, u32 vdev_id, const u8 *mac,
    8037                 :            :                              u32 tid, u32 buf_size)
    8038                 :            : {
    8039                 :          0 :         struct wmi_addba_send_cmd *cmd;
    8040                 :          0 :         struct sk_buff *skb;
    8041                 :            : 
    8042         [ #  # ]:          0 :         if (!mac)
    8043                 :            :                 return ERR_PTR(-EINVAL);
    8044                 :            : 
    8045                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    8046         [ #  # ]:          0 :         if (!skb)
    8047                 :            :                 return ERR_PTR(-ENOMEM);
    8048                 :            : 
    8049                 :          0 :         cmd = (struct wmi_addba_send_cmd *)skb->data;
    8050                 :          0 :         cmd->vdev_id = __cpu_to_le32(vdev_id);
    8051         [ #  # ]:          0 :         ether_addr_copy(cmd->peer_macaddr.addr, mac);
    8052                 :          0 :         cmd->tid = __cpu_to_le32(tid);
    8053                 :          0 :         cmd->buffersize = __cpu_to_le32(buf_size);
    8054                 :            : 
    8055         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    8056                 :            :                    "wmi addba send vdev_id 0x%X mac_addr %pM tid %u bufsize %u\n",
    8057                 :            :                    vdev_id, mac, tid, buf_size);
    8058                 :            :         return skb;
    8059                 :            : }
    8060                 :            : 
    8061                 :            : static struct sk_buff *
    8062                 :          0 : ath10k_wmi_op_gen_addba_set_resp(struct ath10k *ar, u32 vdev_id, const u8 *mac,
    8063                 :            :                                  u32 tid, u32 status)
    8064                 :            : {
    8065                 :          0 :         struct wmi_addba_setresponse_cmd *cmd;
    8066                 :          0 :         struct sk_buff *skb;
    8067                 :            : 
    8068         [ #  # ]:          0 :         if (!mac)
    8069                 :            :                 return ERR_PTR(-EINVAL);
    8070                 :            : 
    8071                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    8072         [ #  # ]:          0 :         if (!skb)
    8073                 :            :                 return ERR_PTR(-ENOMEM);
    8074                 :            : 
    8075                 :          0 :         cmd = (struct wmi_addba_setresponse_cmd *)skb->data;
    8076                 :          0 :         cmd->vdev_id = __cpu_to_le32(vdev_id);
    8077         [ #  # ]:          0 :         ether_addr_copy(cmd->peer_macaddr.addr, mac);
    8078                 :          0 :         cmd->tid = __cpu_to_le32(tid);
    8079                 :          0 :         cmd->statuscode = __cpu_to_le32(status);
    8080                 :            : 
    8081         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    8082                 :            :                    "wmi addba set resp vdev_id 0x%X mac_addr %pM tid %u status %u\n",
    8083                 :            :                    vdev_id, mac, tid, status);
    8084                 :            :         return skb;
    8085                 :            : }
    8086                 :            : 
    8087                 :            : static struct sk_buff *
    8088                 :          0 : ath10k_wmi_op_gen_delba_send(struct ath10k *ar, u32 vdev_id, const u8 *mac,
    8089                 :            :                              u32 tid, u32 initiator, u32 reason)
    8090                 :            : {
    8091                 :          0 :         struct wmi_delba_send_cmd *cmd;
    8092                 :          0 :         struct sk_buff *skb;
    8093                 :            : 
    8094         [ #  # ]:          0 :         if (!mac)
    8095                 :            :                 return ERR_PTR(-EINVAL);
    8096                 :            : 
    8097                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    8098         [ #  # ]:          0 :         if (!skb)
    8099                 :            :                 return ERR_PTR(-ENOMEM);
    8100                 :            : 
    8101                 :          0 :         cmd = (struct wmi_delba_send_cmd *)skb->data;
    8102                 :          0 :         cmd->vdev_id = __cpu_to_le32(vdev_id);
    8103         [ #  # ]:          0 :         ether_addr_copy(cmd->peer_macaddr.addr, mac);
    8104                 :          0 :         cmd->tid = __cpu_to_le32(tid);
    8105                 :          0 :         cmd->initiator = __cpu_to_le32(initiator);
    8106                 :          0 :         cmd->reasoncode = __cpu_to_le32(reason);
    8107                 :            : 
    8108         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    8109                 :            :                    "wmi delba send vdev_id 0x%X mac_addr %pM tid %u initiator %u reason %u\n",
    8110                 :            :                    vdev_id, mac, tid, initiator, reason);
    8111                 :            :         return skb;
    8112                 :            : }
    8113                 :            : 
    8114                 :            : static struct sk_buff *
    8115                 :          0 : ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config(struct ath10k *ar, u32 param)
    8116                 :            : {
    8117                 :          0 :         struct wmi_pdev_get_tpc_config_cmd *cmd;
    8118                 :          0 :         struct sk_buff *skb;
    8119                 :            : 
    8120                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    8121         [ #  # ]:          0 :         if (!skb)
    8122                 :            :                 return ERR_PTR(-ENOMEM);
    8123                 :            : 
    8124                 :          0 :         cmd = (struct wmi_pdev_get_tpc_config_cmd *)skb->data;
    8125                 :          0 :         cmd->param = __cpu_to_le32(param);
    8126                 :            : 
    8127         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    8128                 :            :                    "wmi pdev get tpc config param %d\n", param);
    8129                 :            :         return skb;
    8130                 :            : }
    8131                 :            : 
    8132                 :          0 : size_t ath10k_wmi_fw_stats_num_peers(struct list_head *head)
    8133                 :            : {
    8134                 :          0 :         struct ath10k_fw_stats_peer *i;
    8135                 :          0 :         size_t num = 0;
    8136                 :            : 
    8137   [ #  #  #  #  :          0 :         list_for_each_entry(i, head, list)
             #  #  #  # ]
    8138                 :          0 :                 ++num;
    8139                 :            : 
    8140                 :          0 :         return num;
    8141                 :            : }
    8142                 :            : 
    8143                 :          0 : size_t ath10k_wmi_fw_stats_num_vdevs(struct list_head *head)
    8144                 :            : {
    8145                 :          0 :         struct ath10k_fw_stats_vdev *i;
    8146                 :          0 :         size_t num = 0;
    8147                 :            : 
    8148   [ #  #  #  #  :          0 :         list_for_each_entry(i, head, list)
             #  #  #  # ]
    8149                 :          0 :                 ++num;
    8150                 :            : 
    8151                 :          0 :         return num;
    8152                 :            : }
    8153                 :            : 
    8154                 :            : static void
    8155                 :          0 : ath10k_wmi_fw_pdev_base_stats_fill(const struct ath10k_fw_stats_pdev *pdev,
    8156                 :            :                                    char *buf, u32 *length)
    8157                 :            : {
    8158                 :          0 :         u32 len = *length;
    8159                 :          0 :         u32 buf_len = ATH10K_FW_STATS_BUF_SIZE;
    8160                 :            : 
    8161                 :          0 :         len += scnprintf(buf + len, buf_len - len, "\n");
    8162                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s\n",
    8163                 :            :                         "ath10k PDEV stats");
    8164                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s\n\n",
    8165                 :            :                         "=================");
    8166                 :            : 
    8167                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8168                 :            :                         "Channel noise floor", pdev->ch_noise_floor);
    8169                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
    8170                 :            :                         "Channel TX power", pdev->chan_tx_power);
    8171                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
    8172                 :            :                         "TX frame count", pdev->tx_frame_count);
    8173                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
    8174                 :            :                         "RX frame count", pdev->rx_frame_count);
    8175                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
    8176                 :            :                         "RX clear count", pdev->rx_clear_count);
    8177                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
    8178                 :            :                         "Cycle count", pdev->cycle_count);
    8179                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
    8180                 :            :                         "PHY error count", pdev->phy_err_count);
    8181                 :            : 
    8182                 :          0 :         *length = len;
    8183                 :          0 : }
    8184                 :            : 
    8185                 :            : static void
    8186                 :          0 : ath10k_wmi_fw_pdev_extra_stats_fill(const struct ath10k_fw_stats_pdev *pdev,
    8187                 :            :                                     char *buf, u32 *length)
    8188                 :            : {
    8189                 :          0 :         u32 len = *length;
    8190                 :          0 :         u32 buf_len = ATH10K_FW_STATS_BUF_SIZE;
    8191                 :            : 
    8192                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
    8193                 :            :                         "RTS bad count", pdev->rts_bad);
    8194                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
    8195                 :            :                         "RTS good count", pdev->rts_good);
    8196                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
    8197                 :            :                         "FCS bad count", pdev->fcs_bad);
    8198                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
    8199                 :            :                         "No beacon count", pdev->no_beacons);
    8200                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10u\n",
    8201                 :            :                         "MIB int count", pdev->mib_int_count);
    8202                 :            : 
    8203                 :          0 :         len += scnprintf(buf + len, buf_len - len, "\n");
    8204                 :          0 :         *length = len;
    8205                 :          0 : }
    8206                 :            : 
    8207                 :            : static void
    8208                 :          0 : ath10k_wmi_fw_pdev_tx_stats_fill(const struct ath10k_fw_stats_pdev *pdev,
    8209                 :            :                                  char *buf, u32 *length)
    8210                 :            : {
    8211                 :          0 :         u32 len = *length;
    8212                 :          0 :         u32 buf_len = ATH10K_FW_STATS_BUF_SIZE;
    8213                 :            : 
    8214                 :          0 :         len += scnprintf(buf + len, buf_len - len, "\n%30s\n",
    8215                 :            :                          "ath10k PDEV TX stats");
    8216                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s\n\n",
    8217                 :            :                                  "=================");
    8218                 :            : 
    8219                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8220                 :            :                          "HTT cookies queued", pdev->comp_queued);
    8221                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8222                 :            :                          "HTT cookies disp.", pdev->comp_delivered);
    8223                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8224                 :            :                          "MSDU queued", pdev->msdu_enqued);
    8225                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8226                 :            :                          "MPDU queued", pdev->mpdu_enqued);
    8227                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8228                 :            :                          "MSDUs dropped", pdev->wmm_drop);
    8229                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8230                 :            :                          "Local enqued", pdev->local_enqued);
    8231                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8232                 :            :                          "Local freed", pdev->local_freed);
    8233                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8234                 :            :                          "HW queued", pdev->hw_queued);
    8235                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8236                 :            :                          "PPDUs reaped", pdev->hw_reaped);
    8237                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8238                 :            :                          "Num underruns", pdev->underrun);
    8239                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8240                 :            :                          "PPDUs cleaned", pdev->tx_abort);
    8241                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8242                 :            :                          "MPDUs requed", pdev->mpdus_requed);
    8243                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8244                 :            :                          "Excessive retries", pdev->tx_ko);
    8245                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8246                 :            :                          "HW rate", pdev->data_rc);
    8247                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8248                 :            :                          "Sched self triggers", pdev->self_triggers);
    8249                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8250                 :            :                          "Dropped due to SW retries",
    8251                 :            :                          pdev->sw_retry_failure);
    8252                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8253                 :            :                          "Illegal rate phy errors",
    8254                 :            :                          pdev->illgl_rate_phy_err);
    8255                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8256                 :            :                          "Pdev continuous xretry", pdev->pdev_cont_xretry);
    8257                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8258                 :            :                          "TX timeout", pdev->pdev_tx_timeout);
    8259                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8260                 :            :                          "PDEV resets", pdev->pdev_resets);
    8261                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8262                 :            :                          "PHY underrun", pdev->phy_underrun);
    8263                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8264                 :            :                          "MPDU is more than txop limit", pdev->txop_ovf);
    8265                 :          0 :         *length = len;
    8266                 :          0 : }
    8267                 :            : 
    8268                 :            : static void
    8269                 :          0 : ath10k_wmi_fw_pdev_rx_stats_fill(const struct ath10k_fw_stats_pdev *pdev,
    8270                 :            :                                  char *buf, u32 *length)
    8271                 :            : {
    8272                 :          0 :         u32 len = *length;
    8273                 :          0 :         u32 buf_len = ATH10K_FW_STATS_BUF_SIZE;
    8274                 :            : 
    8275                 :          0 :         len += scnprintf(buf + len, buf_len - len, "\n%30s\n",
    8276                 :            :                          "ath10k PDEV RX stats");
    8277                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s\n\n",
    8278                 :            :                                  "=================");
    8279                 :            : 
    8280                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8281                 :            :                          "Mid PPDU route change",
    8282                 :            :                          pdev->mid_ppdu_route_change);
    8283                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8284                 :            :                          "Tot. number of statuses", pdev->status_rcvd);
    8285                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8286                 :            :                          "Extra frags on rings 0", pdev->r0_frags);
    8287                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8288                 :            :                          "Extra frags on rings 1", pdev->r1_frags);
    8289                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8290                 :            :                          "Extra frags on rings 2", pdev->r2_frags);
    8291                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8292                 :            :                          "Extra frags on rings 3", pdev->r3_frags);
    8293                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8294                 :            :                          "MSDUs delivered to HTT", pdev->htt_msdus);
    8295                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8296                 :            :                          "MPDUs delivered to HTT", pdev->htt_mpdus);
    8297                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8298                 :            :                          "MSDUs delivered to stack", pdev->loc_msdus);
    8299                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8300                 :            :                          "MPDUs delivered to stack", pdev->loc_mpdus);
    8301                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8302                 :            :                          "Oversized AMSUs", pdev->oversize_amsdu);
    8303                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8304                 :            :                          "PHY errors", pdev->phy_errs);
    8305                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8306                 :            :                          "PHY errors drops", pdev->phy_err_drop);
    8307                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8308                 :            :                          "MPDU errors (FCS, MIC, ENC)", pdev->mpdu_errs);
    8309                 :          0 :         *length = len;
    8310                 :          0 : }
    8311                 :            : 
    8312                 :            : static void
    8313                 :          0 : ath10k_wmi_fw_vdev_stats_fill(const struct ath10k_fw_stats_vdev *vdev,
    8314                 :            :                               char *buf, u32 *length)
    8315                 :            : {
    8316                 :          0 :         u32 len = *length;
    8317                 :          0 :         u32 buf_len = ATH10K_FW_STATS_BUF_SIZE;
    8318                 :          0 :         int i;
    8319                 :            : 
    8320                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8321                 :            :                         "vdev id", vdev->vdev_id);
    8322                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8323                 :            :                         "beacon snr", vdev->beacon_snr);
    8324                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8325                 :            :                         "data snr", vdev->data_snr);
    8326                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8327                 :            :                         "num rx frames", vdev->num_rx_frames);
    8328                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8329                 :            :                         "num rts fail", vdev->num_rts_fail);
    8330                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8331                 :            :                         "num rts success", vdev->num_rts_success);
    8332                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8333                 :            :                         "num rx err", vdev->num_rx_err);
    8334                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8335                 :            :                         "num rx discard", vdev->num_rx_discard);
    8336                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8337                 :            :                         "num tx not acked", vdev->num_tx_not_acked);
    8338                 :            : 
    8339         [ #  # ]:          0 :         for (i = 0 ; i < ARRAY_SIZE(vdev->num_tx_frames); i++)
    8340                 :          0 :                 len += scnprintf(buf + len, buf_len - len,
    8341                 :            :                                 "%25s [%02d] %u\n",
    8342                 :            :                                 "num tx frames", i,
    8343                 :            :                                 vdev->num_tx_frames[i]);
    8344                 :            : 
    8345         [ #  # ]:          0 :         for (i = 0 ; i < ARRAY_SIZE(vdev->num_tx_frames_retries); i++)
    8346                 :          0 :                 len += scnprintf(buf + len, buf_len - len,
    8347                 :            :                                 "%25s [%02d] %u\n",
    8348                 :            :                                 "num tx frames retries", i,
    8349                 :            :                                 vdev->num_tx_frames_retries[i]);
    8350                 :            : 
    8351         [ #  # ]:          0 :         for (i = 0 ; i < ARRAY_SIZE(vdev->num_tx_frames_failures); i++)
    8352                 :          0 :                 len += scnprintf(buf + len, buf_len - len,
    8353                 :            :                                 "%25s [%02d] %u\n",
    8354                 :            :                                 "num tx frames failures", i,
    8355                 :            :                                 vdev->num_tx_frames_failures[i]);
    8356                 :            : 
    8357         [ #  # ]:          0 :         for (i = 0 ; i < ARRAY_SIZE(vdev->tx_rate_history); i++)
    8358                 :          0 :                 len += scnprintf(buf + len, buf_len - len,
    8359                 :            :                                 "%25s [%02d] 0x%08x\n",
    8360                 :            :                                 "tx rate history", i,
    8361                 :            :                                 vdev->tx_rate_history[i]);
    8362                 :            : 
    8363         [ #  # ]:          0 :         for (i = 0 ; i < ARRAY_SIZE(vdev->beacon_rssi_history); i++)
    8364                 :          0 :                 len += scnprintf(buf + len, buf_len - len,
    8365                 :            :                                 "%25s [%02d] %u\n",
    8366                 :            :                                 "beacon rssi history", i,
    8367                 :            :                                 vdev->beacon_rssi_history[i]);
    8368                 :            : 
    8369                 :          0 :         len += scnprintf(buf + len, buf_len - len, "\n");
    8370                 :          0 :         *length = len;
    8371                 :          0 : }
    8372                 :            : 
    8373                 :            : static void
    8374                 :          0 : ath10k_wmi_fw_peer_stats_fill(const struct ath10k_fw_stats_peer *peer,
    8375                 :            :                               char *buf, u32 *length, bool extended_peer)
    8376                 :            : {
    8377                 :          0 :         u32 len = *length;
    8378                 :          0 :         u32 buf_len = ATH10K_FW_STATS_BUF_SIZE;
    8379                 :            : 
    8380                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %pM\n",
    8381                 :          0 :                         "Peer MAC address", peer->peer_macaddr);
    8382                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8383                 :            :                         "Peer RSSI", peer->peer_rssi);
    8384                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8385                 :            :                         "Peer TX rate", peer->peer_tx_rate);
    8386                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8387                 :            :                         "Peer RX rate", peer->peer_rx_rate);
    8388         [ #  # ]:          0 :         if (!extended_peer)
    8389                 :          0 :                 len += scnprintf(buf + len, buf_len - len, "%30s %llu\n",
    8390                 :            :                                 "Peer RX duration", peer->rx_duration);
    8391                 :            : 
    8392                 :          0 :         len += scnprintf(buf + len, buf_len - len, "\n");
    8393                 :          0 :         *length = len;
    8394                 :          0 : }
    8395                 :            : 
    8396                 :            : static void
    8397                 :            : ath10k_wmi_fw_extd_peer_stats_fill(const struct ath10k_fw_extd_stats_peer *peer,
    8398                 :            :                                    char *buf, u32 *length)
    8399                 :            : {
    8400                 :            :         u32 len = *length;
    8401                 :            :         u32 buf_len = ATH10K_FW_STATS_BUF_SIZE;
    8402                 :            : 
    8403                 :            :         len += scnprintf(buf + len, buf_len - len, "%30s %pM\n",
    8404                 :            :                         "Peer MAC address", peer->peer_macaddr);
    8405                 :            :         len += scnprintf(buf + len, buf_len - len, "%30s %llu\n",
    8406                 :            :                         "Peer RX duration", peer->rx_duration);
    8407                 :            : }
    8408                 :            : 
    8409                 :          0 : void ath10k_wmi_main_op_fw_stats_fill(struct ath10k *ar,
    8410                 :            :                                       struct ath10k_fw_stats *fw_stats,
    8411                 :            :                                       char *buf)
    8412                 :            : {
    8413                 :          0 :         u32 len = 0;
    8414                 :          0 :         u32 buf_len = ATH10K_FW_STATS_BUF_SIZE;
    8415                 :          0 :         const struct ath10k_fw_stats_pdev *pdev;
    8416                 :          0 :         const struct ath10k_fw_stats_vdev *vdev;
    8417                 :          0 :         const struct ath10k_fw_stats_peer *peer;
    8418                 :          0 :         size_t num_peers;
    8419                 :          0 :         size_t num_vdevs;
    8420                 :            : 
    8421                 :          0 :         spin_lock_bh(&ar->data_lock);
    8422                 :            : 
    8423         [ #  # ]:          0 :         pdev = list_first_entry_or_null(&fw_stats->pdevs,
    8424                 :            :                                         struct ath10k_fw_stats_pdev, list);
    8425         [ #  # ]:          0 :         if (!pdev) {
    8426                 :          0 :                 ath10k_warn(ar, "failed to get pdev stats\n");
    8427                 :          0 :                 goto unlock;
    8428                 :            :         }
    8429                 :            : 
    8430                 :          0 :         num_peers = ath10k_wmi_fw_stats_num_peers(&fw_stats->peers);
    8431                 :          0 :         num_vdevs = ath10k_wmi_fw_stats_num_vdevs(&fw_stats->vdevs);
    8432                 :            : 
    8433                 :          0 :         ath10k_wmi_fw_pdev_base_stats_fill(pdev, buf, &len);
    8434                 :          0 :         ath10k_wmi_fw_pdev_tx_stats_fill(pdev, buf, &len);
    8435                 :          0 :         ath10k_wmi_fw_pdev_rx_stats_fill(pdev, buf, &len);
    8436                 :            : 
    8437                 :          0 :         len += scnprintf(buf + len, buf_len - len, "\n");
    8438                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s (%zu)\n",
    8439                 :            :                          "ath10k VDEV stats", num_vdevs);
    8440                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s\n\n",
    8441                 :            :                                  "=================");
    8442                 :            : 
    8443         [ #  # ]:          0 :         list_for_each_entry(vdev, &fw_stats->vdevs, list) {
    8444                 :          0 :                 ath10k_wmi_fw_vdev_stats_fill(vdev, buf, &len);
    8445                 :            :         }
    8446                 :            : 
    8447                 :          0 :         len += scnprintf(buf + len, buf_len - len, "\n");
    8448                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s (%zu)\n",
    8449                 :            :                          "ath10k PEER stats", num_peers);
    8450                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s\n\n",
    8451                 :            :                                  "=================");
    8452                 :            : 
    8453         [ #  # ]:          0 :         list_for_each_entry(peer, &fw_stats->peers, list) {
    8454                 :          0 :                 ath10k_wmi_fw_peer_stats_fill(peer, buf, &len,
    8455                 :          0 :                                               fw_stats->extended);
    8456                 :            :         }
    8457                 :            : 
    8458                 :          0 : unlock:
    8459                 :          0 :         spin_unlock_bh(&ar->data_lock);
    8460                 :            : 
    8461         [ #  # ]:          0 :         if (len >= buf_len)
    8462                 :          0 :                 buf[len - 1] = 0;
    8463                 :            :         else
    8464                 :          0 :                 buf[len] = 0;
    8465                 :          0 : }
    8466                 :            : 
    8467                 :          0 : void ath10k_wmi_10x_op_fw_stats_fill(struct ath10k *ar,
    8468                 :            :                                      struct ath10k_fw_stats *fw_stats,
    8469                 :            :                                      char *buf)
    8470                 :            : {
    8471                 :          0 :         unsigned int len = 0;
    8472                 :          0 :         unsigned int buf_len = ATH10K_FW_STATS_BUF_SIZE;
    8473                 :          0 :         const struct ath10k_fw_stats_pdev *pdev;
    8474                 :          0 :         const struct ath10k_fw_stats_vdev *vdev;
    8475                 :          0 :         const struct ath10k_fw_stats_peer *peer;
    8476                 :          0 :         size_t num_peers;
    8477                 :          0 :         size_t num_vdevs;
    8478                 :            : 
    8479                 :          0 :         spin_lock_bh(&ar->data_lock);
    8480                 :            : 
    8481         [ #  # ]:          0 :         pdev = list_first_entry_or_null(&fw_stats->pdevs,
    8482                 :            :                                         struct ath10k_fw_stats_pdev, list);
    8483         [ #  # ]:          0 :         if (!pdev) {
    8484                 :          0 :                 ath10k_warn(ar, "failed to get pdev stats\n");
    8485                 :          0 :                 goto unlock;
    8486                 :            :         }
    8487                 :            : 
    8488                 :          0 :         num_peers = ath10k_wmi_fw_stats_num_peers(&fw_stats->peers);
    8489                 :          0 :         num_vdevs = ath10k_wmi_fw_stats_num_vdevs(&fw_stats->vdevs);
    8490                 :            : 
    8491                 :          0 :         ath10k_wmi_fw_pdev_base_stats_fill(pdev, buf, &len);
    8492                 :          0 :         ath10k_wmi_fw_pdev_extra_stats_fill(pdev, buf, &len);
    8493                 :          0 :         ath10k_wmi_fw_pdev_tx_stats_fill(pdev, buf, &len);
    8494                 :          0 :         ath10k_wmi_fw_pdev_rx_stats_fill(pdev, buf, &len);
    8495                 :            : 
    8496                 :          0 :         len += scnprintf(buf + len, buf_len - len, "\n");
    8497                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s (%zu)\n",
    8498                 :            :                          "ath10k VDEV stats", num_vdevs);
    8499                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s\n\n",
    8500                 :            :                                  "=================");
    8501                 :            : 
    8502         [ #  # ]:          0 :         list_for_each_entry(vdev, &fw_stats->vdevs, list) {
    8503                 :          0 :                 ath10k_wmi_fw_vdev_stats_fill(vdev, buf, &len);
    8504                 :            :         }
    8505                 :            : 
    8506                 :          0 :         len += scnprintf(buf + len, buf_len - len, "\n");
    8507                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s (%zu)\n",
    8508                 :            :                          "ath10k PEER stats", num_peers);
    8509                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s\n\n",
    8510                 :            :                                  "=================");
    8511                 :            : 
    8512         [ #  # ]:          0 :         list_for_each_entry(peer, &fw_stats->peers, list) {
    8513                 :          0 :                 ath10k_wmi_fw_peer_stats_fill(peer, buf, &len,
    8514                 :          0 :                                               fw_stats->extended);
    8515                 :            :         }
    8516                 :            : 
    8517                 :          0 : unlock:
    8518                 :          0 :         spin_unlock_bh(&ar->data_lock);
    8519                 :            : 
    8520         [ #  # ]:          0 :         if (len >= buf_len)
    8521                 :          0 :                 buf[len - 1] = 0;
    8522                 :            :         else
    8523                 :          0 :                 buf[len] = 0;
    8524                 :          0 : }
    8525                 :            : 
    8526                 :            : static struct sk_buff *
    8527                 :          0 : ath10k_wmi_op_gen_pdev_enable_adaptive_cca(struct ath10k *ar, u8 enable,
    8528                 :            :                                            u32 detect_level, u32 detect_margin)
    8529                 :            : {
    8530                 :          0 :         struct wmi_pdev_set_adaptive_cca_params *cmd;
    8531                 :          0 :         struct sk_buff *skb;
    8532                 :            : 
    8533                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    8534         [ #  # ]:          0 :         if (!skb)
    8535                 :            :                 return ERR_PTR(-ENOMEM);
    8536                 :            : 
    8537                 :          0 :         cmd = (struct wmi_pdev_set_adaptive_cca_params *)skb->data;
    8538                 :          0 :         cmd->enable = __cpu_to_le32(enable);
    8539                 :          0 :         cmd->cca_detect_level = __cpu_to_le32(detect_level);
    8540                 :          0 :         cmd->cca_detect_margin = __cpu_to_le32(detect_margin);
    8541                 :            : 
    8542         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    8543                 :            :                    "wmi pdev set adaptive cca params enable:%d detection level:%d detection margin:%d\n",
    8544                 :            :                    enable, detect_level, detect_margin);
    8545                 :            :         return skb;
    8546                 :            : }
    8547                 :            : 
    8548                 :            : static void
    8549                 :          0 : ath10k_wmi_fw_vdev_stats_extd_fill(const struct ath10k_fw_stats_vdev_extd *vdev,
    8550                 :            :                                    char *buf, u32 *length)
    8551                 :            : {
    8552                 :          0 :         u32 len = *length;
    8553                 :          0 :         u32 buf_len = ATH10K_FW_STATS_BUF_SIZE;
    8554                 :          0 :         u32 val;
    8555                 :            : 
    8556                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8557                 :            :                          "vdev id", vdev->vdev_id);
    8558                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8559                 :            :                          "ppdu aggr count", vdev->ppdu_aggr_cnt);
    8560                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8561                 :            :                          "ppdu noack", vdev->ppdu_noack);
    8562                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8563                 :            :                          "mpdu queued", vdev->mpdu_queued);
    8564                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8565                 :            :                          "ppdu nonaggr count", vdev->ppdu_nonaggr_cnt);
    8566                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8567                 :            :                          "mpdu sw requeued", vdev->mpdu_sw_requeued);
    8568                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8569                 :            :                          "mpdu success retry", vdev->mpdu_suc_retry);
    8570                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8571                 :            :                          "mpdu success multitry", vdev->mpdu_suc_multitry);
    8572                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8573                 :            :                          "mpdu fail retry", vdev->mpdu_fail_retry);
    8574                 :          0 :         val = vdev->tx_ftm_suc;
    8575         [ #  # ]:          0 :         if (val & WMI_VDEV_STATS_FTM_COUNT_VALID)
    8576                 :          0 :                 len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8577                 :            :                                  "tx ftm success",
    8578                 :            :                                  MS(val, WMI_VDEV_STATS_FTM_COUNT));
    8579                 :          0 :         val = vdev->tx_ftm_suc_retry;
    8580         [ #  # ]:          0 :         if (val & WMI_VDEV_STATS_FTM_COUNT_VALID)
    8581                 :          0 :                 len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8582                 :            :                                  "tx ftm success retry",
    8583                 :            :                                  MS(val, WMI_VDEV_STATS_FTM_COUNT));
    8584                 :          0 :         val = vdev->tx_ftm_fail;
    8585         [ #  # ]:          0 :         if (val & WMI_VDEV_STATS_FTM_COUNT_VALID)
    8586                 :          0 :                 len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8587                 :            :                                  "tx ftm fail",
    8588                 :            :                                  MS(val, WMI_VDEV_STATS_FTM_COUNT));
    8589                 :          0 :         val = vdev->rx_ftmr_cnt;
    8590         [ #  # ]:          0 :         if (val & WMI_VDEV_STATS_FTM_COUNT_VALID)
    8591                 :          0 :                 len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8592                 :            :                                  "rx ftm request count",
    8593                 :            :                                  MS(val, WMI_VDEV_STATS_FTM_COUNT));
    8594                 :          0 :         val = vdev->rx_ftmr_dup_cnt;
    8595         [ #  # ]:          0 :         if (val & WMI_VDEV_STATS_FTM_COUNT_VALID)
    8596                 :          0 :                 len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8597                 :            :                                  "rx ftm request dup count",
    8598                 :            :                                  MS(val, WMI_VDEV_STATS_FTM_COUNT));
    8599                 :          0 :         val = vdev->rx_iftmr_cnt;
    8600         [ #  # ]:          0 :         if (val & WMI_VDEV_STATS_FTM_COUNT_VALID)
    8601                 :          0 :                 len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8602                 :            :                                  "rx initial ftm req count",
    8603                 :            :                                  MS(val, WMI_VDEV_STATS_FTM_COUNT));
    8604                 :          0 :         val = vdev->rx_iftmr_dup_cnt;
    8605         [ #  # ]:          0 :         if (val & WMI_VDEV_STATS_FTM_COUNT_VALID)
    8606                 :          0 :                 len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
    8607                 :            :                                  "rx initial ftm req dup cnt",
    8608                 :            :                                  MS(val, WMI_VDEV_STATS_FTM_COUNT));
    8609                 :          0 :         len += scnprintf(buf + len, buf_len - len, "\n");
    8610                 :            : 
    8611                 :          0 :         *length = len;
    8612                 :          0 : }
    8613                 :            : 
    8614                 :          0 : void ath10k_wmi_10_4_op_fw_stats_fill(struct ath10k *ar,
    8615                 :            :                                       struct ath10k_fw_stats *fw_stats,
    8616                 :            :                                       char *buf)
    8617                 :            : {
    8618                 :          0 :         u32 len = 0;
    8619                 :          0 :         u32 buf_len = ATH10K_FW_STATS_BUF_SIZE;
    8620                 :          0 :         const struct ath10k_fw_stats_pdev *pdev;
    8621                 :          0 :         const struct ath10k_fw_stats_vdev_extd *vdev;
    8622                 :          0 :         const struct ath10k_fw_stats_peer *peer;
    8623                 :          0 :         const struct ath10k_fw_extd_stats_peer *extd_peer;
    8624                 :          0 :         size_t num_peers;
    8625                 :          0 :         size_t num_vdevs;
    8626                 :            : 
    8627                 :          0 :         spin_lock_bh(&ar->data_lock);
    8628                 :            : 
    8629         [ #  # ]:          0 :         pdev = list_first_entry_or_null(&fw_stats->pdevs,
    8630                 :            :                                         struct ath10k_fw_stats_pdev, list);
    8631         [ #  # ]:          0 :         if (!pdev) {
    8632                 :          0 :                 ath10k_warn(ar, "failed to get pdev stats\n");
    8633                 :          0 :                 goto unlock;
    8634                 :            :         }
    8635                 :            : 
    8636                 :          0 :         num_peers = ath10k_wmi_fw_stats_num_peers(&fw_stats->peers);
    8637                 :          0 :         num_vdevs = ath10k_wmi_fw_stats_num_vdevs(&fw_stats->vdevs);
    8638                 :            : 
    8639                 :          0 :         ath10k_wmi_fw_pdev_base_stats_fill(pdev, buf, &len);
    8640                 :          0 :         ath10k_wmi_fw_pdev_extra_stats_fill(pdev, buf, &len);
    8641                 :          0 :         ath10k_wmi_fw_pdev_tx_stats_fill(pdev, buf, &len);
    8642                 :            : 
    8643                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8644                 :            :                         "HW paused", pdev->hw_paused);
    8645                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8646                 :            :                         "Seqs posted", pdev->seq_posted);
    8647                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8648                 :            :                         "Seqs failed queueing", pdev->seq_failed_queueing);
    8649                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8650                 :            :                         "Seqs completed", pdev->seq_completed);
    8651                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8652                 :            :                         "Seqs restarted", pdev->seq_restarted);
    8653                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8654                 :            :                         "MU Seqs posted", pdev->mu_seq_posted);
    8655                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8656                 :            :                         "MPDUs SW flushed", pdev->mpdus_sw_flush);
    8657                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8658                 :            :                         "MPDUs HW filtered", pdev->mpdus_hw_filter);
    8659                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8660                 :            :                         "MPDUs truncated", pdev->mpdus_truncated);
    8661                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8662                 :            :                         "MPDUs receive no ACK", pdev->mpdus_ack_failed);
    8663                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8664                 :            :                         "MPDUs expired", pdev->mpdus_expired);
    8665                 :            : 
    8666                 :          0 :         ath10k_wmi_fw_pdev_rx_stats_fill(pdev, buf, &len);
    8667                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
    8668                 :            :                         "Num Rx Overflow errors", pdev->rx_ovfl_errs);
    8669                 :            : 
    8670                 :          0 :         len += scnprintf(buf + len, buf_len - len, "\n");
    8671                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s (%zu)\n",
    8672                 :            :                         "ath10k VDEV stats", num_vdevs);
    8673                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s\n\n",
    8674                 :            :                                 "=================");
    8675         [ #  # ]:          0 :         list_for_each_entry(vdev, &fw_stats->vdevs, list) {
    8676                 :          0 :                 ath10k_wmi_fw_vdev_stats_extd_fill(vdev, buf, &len);
    8677                 :            :         }
    8678                 :            : 
    8679                 :          0 :         len += scnprintf(buf + len, buf_len - len, "\n");
    8680                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s (%zu)\n",
    8681                 :            :                         "ath10k PEER stats", num_peers);
    8682                 :          0 :         len += scnprintf(buf + len, buf_len - len, "%30s\n\n",
    8683                 :            :                                 "=================");
    8684                 :            : 
    8685         [ #  # ]:          0 :         list_for_each_entry(peer, &fw_stats->peers, list) {
    8686                 :          0 :                 ath10k_wmi_fw_peer_stats_fill(peer, buf, &len,
    8687                 :          0 :                                               fw_stats->extended);
    8688                 :            :         }
    8689                 :            : 
    8690         [ #  # ]:          0 :         if (fw_stats->extended) {
    8691         [ #  # ]:          0 :                 list_for_each_entry(extd_peer, &fw_stats->peers_extd, list) {
    8692                 :          0 :                         ath10k_wmi_fw_extd_peer_stats_fill(extd_peer, buf,
    8693                 :            :                                                            &len);
    8694                 :            :                 }
    8695                 :            :         }
    8696                 :            : 
    8697                 :          0 : unlock:
    8698                 :          0 :         spin_unlock_bh(&ar->data_lock);
    8699                 :            : 
    8700         [ #  # ]:          0 :         if (len >= buf_len)
    8701                 :          0 :                 buf[len - 1] = 0;
    8702                 :            :         else
    8703                 :          0 :                 buf[len] = 0;
    8704                 :          0 : }
    8705                 :            : 
    8706                 :          0 : int ath10k_wmi_op_get_vdev_subtype(struct ath10k *ar,
    8707                 :            :                                    enum wmi_vdev_subtype subtype)
    8708                 :            : {
    8709         [ #  # ]:          0 :         switch (subtype) {
    8710                 :            :         case WMI_VDEV_SUBTYPE_NONE:
    8711                 :            :                 return WMI_VDEV_SUBTYPE_LEGACY_NONE;
    8712                 :            :         case WMI_VDEV_SUBTYPE_P2P_DEVICE:
    8713                 :            :                 return WMI_VDEV_SUBTYPE_LEGACY_P2P_DEV;
    8714                 :            :         case WMI_VDEV_SUBTYPE_P2P_CLIENT:
    8715                 :            :                 return WMI_VDEV_SUBTYPE_LEGACY_P2P_CLI;
    8716                 :            :         case WMI_VDEV_SUBTYPE_P2P_GO:
    8717                 :            :                 return WMI_VDEV_SUBTYPE_LEGACY_P2P_GO;
    8718                 :            :         case WMI_VDEV_SUBTYPE_PROXY_STA:
    8719                 :            :                 return WMI_VDEV_SUBTYPE_LEGACY_PROXY_STA;
    8720                 :            :         case WMI_VDEV_SUBTYPE_MESH_11S:
    8721                 :            :         case WMI_VDEV_SUBTYPE_MESH_NON_11S:
    8722                 :            :                 return -ENOTSUPP;
    8723                 :            :         }
    8724                 :            :         return -ENOTSUPP;
    8725                 :            : }
    8726                 :            : 
    8727                 :          0 : static int ath10k_wmi_10_2_4_op_get_vdev_subtype(struct ath10k *ar,
    8728                 :            :                                                  enum wmi_vdev_subtype subtype)
    8729                 :            : {
    8730         [ #  # ]:          0 :         switch (subtype) {
    8731                 :            :         case WMI_VDEV_SUBTYPE_NONE:
    8732                 :            :                 return WMI_VDEV_SUBTYPE_10_2_4_NONE;
    8733                 :            :         case WMI_VDEV_SUBTYPE_P2P_DEVICE:
    8734                 :            :                 return WMI_VDEV_SUBTYPE_10_2_4_P2P_DEV;
    8735                 :            :         case WMI_VDEV_SUBTYPE_P2P_CLIENT:
    8736                 :            :                 return WMI_VDEV_SUBTYPE_10_2_4_P2P_CLI;
    8737                 :            :         case WMI_VDEV_SUBTYPE_P2P_GO:
    8738                 :            :                 return WMI_VDEV_SUBTYPE_10_2_4_P2P_GO;
    8739                 :            :         case WMI_VDEV_SUBTYPE_PROXY_STA:
    8740                 :            :                 return WMI_VDEV_SUBTYPE_10_2_4_PROXY_STA;
    8741                 :            :         case WMI_VDEV_SUBTYPE_MESH_11S:
    8742                 :            :                 return WMI_VDEV_SUBTYPE_10_2_4_MESH_11S;
    8743                 :            :         case WMI_VDEV_SUBTYPE_MESH_NON_11S:
    8744                 :            :                 return -ENOTSUPP;
    8745                 :            :         }
    8746                 :            :         return -ENOTSUPP;
    8747                 :            : }
    8748                 :            : 
    8749                 :          0 : static int ath10k_wmi_10_4_op_get_vdev_subtype(struct ath10k *ar,
    8750                 :            :                                                enum wmi_vdev_subtype subtype)
    8751                 :            : {
    8752         [ #  # ]:          0 :         switch (subtype) {
    8753                 :            :         case WMI_VDEV_SUBTYPE_NONE:
    8754                 :            :                 return WMI_VDEV_SUBTYPE_10_4_NONE;
    8755                 :            :         case WMI_VDEV_SUBTYPE_P2P_DEVICE:
    8756                 :            :                 return WMI_VDEV_SUBTYPE_10_4_P2P_DEV;
    8757                 :            :         case WMI_VDEV_SUBTYPE_P2P_CLIENT:
    8758                 :            :                 return WMI_VDEV_SUBTYPE_10_4_P2P_CLI;
    8759                 :            :         case WMI_VDEV_SUBTYPE_P2P_GO:
    8760                 :            :                 return WMI_VDEV_SUBTYPE_10_4_P2P_GO;
    8761                 :            :         case WMI_VDEV_SUBTYPE_PROXY_STA:
    8762                 :            :                 return WMI_VDEV_SUBTYPE_10_4_PROXY_STA;
    8763                 :            :         case WMI_VDEV_SUBTYPE_MESH_11S:
    8764                 :            :                 return WMI_VDEV_SUBTYPE_10_4_MESH_11S;
    8765                 :            :         case WMI_VDEV_SUBTYPE_MESH_NON_11S:
    8766                 :            :                 return WMI_VDEV_SUBTYPE_10_4_MESH_NON_11S;
    8767                 :            :         }
    8768                 :            :         return -ENOTSUPP;
    8769                 :            : }
    8770                 :            : 
    8771                 :            : static struct sk_buff *
    8772                 :          0 : ath10k_wmi_10_4_ext_resource_config(struct ath10k *ar,
    8773                 :            :                                     enum wmi_host_platform_type type,
    8774                 :            :                                     u32 fw_feature_bitmap)
    8775                 :            : {
    8776                 :          0 :         struct wmi_ext_resource_config_10_4_cmd *cmd;
    8777                 :          0 :         struct sk_buff *skb;
    8778                 :          0 :         u32 num_tdls_sleep_sta = 0;
    8779                 :            : 
    8780                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    8781         [ #  # ]:          0 :         if (!skb)
    8782                 :            :                 return ERR_PTR(-ENOMEM);
    8783                 :            : 
    8784         [ #  # ]:          0 :         if (test_bit(WMI_SERVICE_TDLS_UAPSD_SLEEP_STA, ar->wmi.svc_map))
    8785                 :          0 :                 num_tdls_sleep_sta = TARGET_10_4_NUM_TDLS_SLEEP_STA;
    8786                 :            : 
    8787                 :          0 :         cmd = (struct wmi_ext_resource_config_10_4_cmd *)skb->data;
    8788                 :          0 :         cmd->host_platform_config = __cpu_to_le32(type);
    8789                 :          0 :         cmd->fw_feature_bitmap = __cpu_to_le32(fw_feature_bitmap);
    8790                 :          0 :         cmd->wlan_gpio_priority = __cpu_to_le32(-1);
    8791                 :          0 :         cmd->coex_version = __cpu_to_le32(WMI_NO_COEX_VERSION_SUPPORT);
    8792                 :          0 :         cmd->coex_gpio_pin1 = __cpu_to_le32(-1);
    8793                 :          0 :         cmd->coex_gpio_pin2 = __cpu_to_le32(-1);
    8794                 :          0 :         cmd->coex_gpio_pin3 = __cpu_to_le32(-1);
    8795                 :          0 :         cmd->num_tdls_vdevs = __cpu_to_le32(TARGET_10_4_NUM_TDLS_VDEVS);
    8796                 :          0 :         cmd->num_tdls_conn_table_entries = __cpu_to_le32(20);
    8797                 :          0 :         cmd->max_tdls_concurrent_sleep_sta = __cpu_to_le32(num_tdls_sleep_sta);
    8798                 :          0 :         cmd->max_tdls_concurrent_buffer_sta =
    8799                 :            :                         __cpu_to_le32(TARGET_10_4_NUM_TDLS_BUFFER_STA);
    8800                 :            : 
    8801         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    8802                 :            :                    "wmi ext resource config host type %d firmware feature bitmap %08x\n",
    8803                 :            :                    type, fw_feature_bitmap);
    8804                 :            :         return skb;
    8805                 :            : }
    8806                 :            : 
    8807                 :            : static struct sk_buff *
    8808                 :          0 : ath10k_wmi_10_4_gen_update_fw_tdls_state(struct ath10k *ar, u32 vdev_id,
    8809                 :            :                                          enum wmi_tdls_state state)
    8810                 :            : {
    8811                 :          0 :         struct wmi_10_4_tdls_set_state_cmd *cmd;
    8812                 :          0 :         struct sk_buff *skb;
    8813                 :          0 :         u32 options = 0;
    8814                 :            : 
    8815                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    8816         [ #  # ]:          0 :         if (!skb)
    8817                 :            :                 return ERR_PTR(-ENOMEM);
    8818                 :            : 
    8819   [ #  #  #  # ]:          0 :         if (test_bit(WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY, ar->wmi.svc_map) &&
    8820                 :            :             state == WMI_TDLS_ENABLE_ACTIVE)
    8821                 :          0 :                 state = WMI_TDLS_ENABLE_PASSIVE;
    8822                 :            : 
    8823         [ #  # ]:          0 :         if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, ar->wmi.svc_map))
    8824                 :          0 :                 options |= WMI_TDLS_BUFFER_STA_EN;
    8825                 :            : 
    8826                 :          0 :         cmd = (struct wmi_10_4_tdls_set_state_cmd *)skb->data;
    8827                 :          0 :         cmd->vdev_id = __cpu_to_le32(vdev_id);
    8828                 :          0 :         cmd->state = __cpu_to_le32(state);
    8829                 :          0 :         cmd->notification_interval_ms = __cpu_to_le32(5000);
    8830                 :          0 :         cmd->tx_discovery_threshold = __cpu_to_le32(100);
    8831                 :          0 :         cmd->tx_teardown_threshold = __cpu_to_le32(5);
    8832                 :          0 :         cmd->rssi_teardown_threshold = __cpu_to_le32(-75);
    8833                 :          0 :         cmd->rssi_delta = __cpu_to_le32(-20);
    8834                 :          0 :         cmd->tdls_options = __cpu_to_le32(options);
    8835                 :          0 :         cmd->tdls_peer_traffic_ind_window = __cpu_to_le32(2);
    8836                 :          0 :         cmd->tdls_peer_traffic_response_timeout_ms = __cpu_to_le32(5000);
    8837                 :          0 :         cmd->tdls_puapsd_mask = __cpu_to_le32(0xf);
    8838                 :          0 :         cmd->tdls_puapsd_inactivity_time_ms = __cpu_to_le32(0);
    8839                 :          0 :         cmd->tdls_puapsd_rx_frame_threshold = __cpu_to_le32(10);
    8840                 :          0 :         cmd->teardown_notification_ms = __cpu_to_le32(10);
    8841                 :          0 :         cmd->tdls_peer_kickout_threshold = __cpu_to_le32(96);
    8842                 :            : 
    8843         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi update fw tdls state %d for vdev %i\n",
    8844                 :            :                    state, vdev_id);
    8845                 :            :         return skb;
    8846                 :            : }
    8847                 :            : 
    8848                 :          0 : static u32 ath10k_wmi_prepare_peer_qos(u8 uapsd_queues, u8 sp)
    8849                 :            : {
    8850                 :          0 :         u32 peer_qos = 0;
    8851                 :            : 
    8852                 :          0 :         if (uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO)
    8853                 :            :                 peer_qos |= WMI_TDLS_PEER_QOS_AC_VO;
    8854                 :          0 :         if (uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VI)
    8855                 :          0 :                 peer_qos |= WMI_TDLS_PEER_QOS_AC_VI;
    8856         [ #  # ]:          0 :         if (uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BK)
    8857                 :          0 :                 peer_qos |= WMI_TDLS_PEER_QOS_AC_BK;
    8858         [ #  # ]:          0 :         if (uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BE)
    8859                 :          0 :                 peer_qos |= WMI_TDLS_PEER_QOS_AC_BE;
    8860                 :            : 
    8861                 :          0 :         peer_qos |= SM(sp, WMI_TDLS_PEER_SP);
    8862                 :            : 
    8863                 :          0 :         return peer_qos;
    8864                 :            : }
    8865                 :            : 
    8866                 :            : static struct sk_buff *
    8867                 :          0 : ath10k_wmi_10_4_op_gen_pdev_get_tpc_table_cmdid(struct ath10k *ar, u32 param)
    8868                 :            : {
    8869                 :          0 :         struct wmi_pdev_get_tpc_table_cmd *cmd;
    8870                 :          0 :         struct sk_buff *skb;
    8871                 :            : 
    8872                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    8873         [ #  # ]:          0 :         if (!skb)
    8874                 :            :                 return ERR_PTR(-ENOMEM);
    8875                 :            : 
    8876                 :          0 :         cmd = (struct wmi_pdev_get_tpc_table_cmd *)skb->data;
    8877                 :          0 :         cmd->param = __cpu_to_le32(param);
    8878                 :            : 
    8879         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    8880                 :            :                    "wmi pdev get tpc table param:%d\n", param);
    8881                 :            :         return skb;
    8882                 :            : }
    8883                 :            : 
    8884                 :            : static struct sk_buff *
    8885                 :          0 : ath10k_wmi_10_4_gen_tdls_peer_update(struct ath10k *ar,
    8886                 :            :                                      const struct wmi_tdls_peer_update_cmd_arg *arg,
    8887                 :            :                                      const struct wmi_tdls_peer_capab_arg *cap,
    8888                 :            :                                      const struct wmi_channel_arg *chan_arg)
    8889                 :            : {
    8890                 :          0 :         struct wmi_10_4_tdls_peer_update_cmd *cmd;
    8891                 :          0 :         struct wmi_tdls_peer_capabilities *peer_cap;
    8892                 :          0 :         struct wmi_channel *chan;
    8893                 :          0 :         struct sk_buff *skb;
    8894                 :          0 :         u32 peer_qos;
    8895                 :          0 :         int len, chan_len;
    8896                 :          0 :         int i;
    8897                 :            : 
    8898                 :            :         /* tdls peer update cmd has place holder for one channel*/
    8899         [ #  # ]:          0 :         chan_len = cap->peer_chan_len ? (cap->peer_chan_len - 1) : 0;
    8900                 :            : 
    8901                 :          0 :         len = sizeof(*cmd) + chan_len * sizeof(*chan);
    8902                 :            : 
    8903                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, len);
    8904         [ #  # ]:          0 :         if (!skb)
    8905                 :            :                 return ERR_PTR(-ENOMEM);
    8906                 :            : 
    8907                 :          0 :         memset(skb->data, 0, sizeof(*cmd));
    8908                 :            : 
    8909                 :          0 :         cmd = (struct wmi_10_4_tdls_peer_update_cmd *)skb->data;
    8910                 :          0 :         cmd->vdev_id = __cpu_to_le32(arg->vdev_id);
    8911         [ #  # ]:          0 :         ether_addr_copy(cmd->peer_macaddr.addr, arg->addr);
    8912                 :          0 :         cmd->peer_state = __cpu_to_le32(arg->peer_state);
    8913                 :            : 
    8914                 :          0 :         peer_qos = ath10k_wmi_prepare_peer_qos(cap->peer_uapsd_queues,
    8915         [ #  # ]:          0 :                                                cap->peer_max_sp);
    8916                 :            : 
    8917                 :          0 :         peer_cap = &cmd->peer_capab;
    8918                 :          0 :         peer_cap->peer_qos = __cpu_to_le32(peer_qos);
    8919                 :          0 :         peer_cap->buff_sta_support = __cpu_to_le32(cap->buff_sta_support);
    8920                 :          0 :         peer_cap->off_chan_support = __cpu_to_le32(cap->off_chan_support);
    8921                 :          0 :         peer_cap->peer_curr_operclass = __cpu_to_le32(cap->peer_curr_operclass);
    8922                 :          0 :         peer_cap->self_curr_operclass = __cpu_to_le32(cap->self_curr_operclass);
    8923                 :          0 :         peer_cap->peer_chan_len = __cpu_to_le32(cap->peer_chan_len);
    8924                 :          0 :         peer_cap->peer_operclass_len = __cpu_to_le32(cap->peer_operclass_len);
    8925                 :            : 
    8926         [ #  # ]:          0 :         for (i = 0; i < WMI_TDLS_MAX_SUPP_OPER_CLASSES; i++)
    8927                 :          0 :                 peer_cap->peer_operclass[i] = cap->peer_operclass[i];
    8928                 :            : 
    8929                 :          0 :         peer_cap->is_peer_responder = __cpu_to_le32(cap->is_peer_responder);
    8930                 :          0 :         peer_cap->pref_offchan_num = __cpu_to_le32(cap->pref_offchan_num);
    8931                 :          0 :         peer_cap->pref_offchan_bw = __cpu_to_le32(cap->pref_offchan_bw);
    8932                 :            : 
    8933         [ #  # ]:          0 :         for (i = 0; i < cap->peer_chan_len; i++) {
    8934                 :          0 :                 chan = (struct wmi_channel *)&peer_cap->peer_chan_list[i];
    8935                 :          0 :                 ath10k_wmi_put_wmi_channel(chan, &chan_arg[i]);
    8936                 :            :         }
    8937                 :            : 
    8938         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    8939                 :            :                    "wmi tdls peer update vdev %i state %d n_chans %u\n",
    8940                 :            :                    arg->vdev_id, arg->peer_state, cap->peer_chan_len);
    8941                 :            :         return skb;
    8942                 :            : }
    8943                 :            : 
    8944                 :            : static struct sk_buff *
    8945                 :          0 : ath10k_wmi_10_4_gen_radar_found(struct ath10k *ar,
    8946                 :            :                                 const struct ath10k_radar_found_info *arg)
    8947                 :            : {
    8948                 :          0 :         struct wmi_radar_found_info *cmd;
    8949                 :          0 :         struct sk_buff *skb;
    8950                 :            : 
    8951                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    8952         [ #  # ]:          0 :         if (!skb)
    8953                 :            :                 return ERR_PTR(-ENOMEM);
    8954                 :            : 
    8955                 :          0 :         cmd = (struct wmi_radar_found_info *)skb->data;
    8956                 :          0 :         cmd->pri_min   = __cpu_to_le32(arg->pri_min);
    8957                 :          0 :         cmd->pri_max   = __cpu_to_le32(arg->pri_max);
    8958                 :          0 :         cmd->width_min = __cpu_to_le32(arg->width_min);
    8959                 :          0 :         cmd->width_max = __cpu_to_le32(arg->width_max);
    8960                 :          0 :         cmd->sidx_min  = __cpu_to_le32(arg->sidx_min);
    8961                 :          0 :         cmd->sidx_max  = __cpu_to_le32(arg->sidx_max);
    8962                 :            : 
    8963         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    8964                 :            :                    "wmi radar found pri_min %d pri_max %d width_min %d width_max %d sidx_min %d sidx_max %d\n",
    8965                 :            :                    arg->pri_min, arg->pri_max, arg->width_min,
    8966                 :            :                    arg->width_max, arg->sidx_min, arg->sidx_max);
    8967                 :            :         return skb;
    8968                 :            : }
    8969                 :            : 
    8970                 :            : static struct sk_buff *
    8971                 :          0 : ath10k_wmi_op_gen_echo(struct ath10k *ar, u32 value)
    8972                 :            : {
    8973                 :          0 :         struct wmi_echo_cmd *cmd;
    8974                 :          0 :         struct sk_buff *skb;
    8975                 :            : 
    8976                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    8977         [ #  # ]:          0 :         if (!skb)
    8978                 :            :                 return ERR_PTR(-ENOMEM);
    8979                 :            : 
    8980                 :          0 :         cmd = (struct wmi_echo_cmd *)skb->data;
    8981                 :          0 :         cmd->value = cpu_to_le32(value);
    8982                 :            : 
    8983         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    8984                 :            :                    "wmi echo value 0x%08x\n", value);
    8985                 :            :         return skb;
    8986                 :            : }
    8987                 :            : 
    8988                 :            : int
    8989                 :          0 : ath10k_wmi_barrier(struct ath10k *ar)
    8990                 :            : {
    8991                 :          0 :         int ret;
    8992                 :          0 :         int time_left;
    8993                 :            : 
    8994                 :          0 :         spin_lock_bh(&ar->data_lock);
    8995                 :          0 :         reinit_completion(&ar->wmi.barrier);
    8996                 :          0 :         spin_unlock_bh(&ar->data_lock);
    8997                 :            : 
    8998                 :          0 :         ret = ath10k_wmi_echo(ar, ATH10K_WMI_BARRIER_ECHO_ID);
    8999         [ #  # ]:          0 :         if (ret) {
    9000                 :          0 :                 ath10k_warn(ar, "failed to submit wmi echo: %d\n", ret);
    9001                 :          0 :                 return ret;
    9002                 :            :         }
    9003                 :            : 
    9004                 :          0 :         time_left = wait_for_completion_timeout(&ar->wmi.barrier,
    9005                 :            :                                                 ATH10K_WMI_BARRIER_TIMEOUT_HZ);
    9006         [ #  # ]:          0 :         if (!time_left)
    9007                 :          0 :                 return -ETIMEDOUT;
    9008                 :            : 
    9009                 :            :         return 0;
    9010                 :            : }
    9011                 :            : 
    9012                 :            : static struct sk_buff *
    9013                 :          0 : ath10k_wmi_10_2_4_op_gen_bb_timing(struct ath10k *ar,
    9014                 :            :                                    const struct wmi_bb_timing_cfg_arg *arg)
    9015                 :            : {
    9016                 :          0 :         struct wmi_pdev_bb_timing_cfg_cmd *cmd;
    9017                 :          0 :         struct sk_buff *skb;
    9018                 :            : 
    9019                 :          0 :         skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
    9020         [ #  # ]:          0 :         if (!skb)
    9021                 :            :                 return ERR_PTR(-ENOMEM);
    9022                 :            : 
    9023                 :          0 :         cmd = (struct wmi_pdev_bb_timing_cfg_cmd *)skb->data;
    9024                 :          0 :         cmd->bb_tx_timing = __cpu_to_le32(arg->bb_tx_timing);
    9025                 :          0 :         cmd->bb_xpa_timing = __cpu_to_le32(arg->bb_xpa_timing);
    9026                 :            : 
    9027         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    9028                 :            :                    "wmi pdev bb_tx_timing 0x%x bb_xpa_timing 0x%x\n",
    9029                 :            :                    arg->bb_tx_timing, arg->bb_xpa_timing);
    9030                 :            :         return skb;
    9031                 :            : }
    9032                 :            : 
    9033                 :            : static const struct wmi_ops wmi_ops = {
    9034                 :            :         .rx = ath10k_wmi_op_rx,
    9035                 :            :         .map_svc = wmi_main_svc_map,
    9036                 :            : 
    9037                 :            :         .pull_scan = ath10k_wmi_op_pull_scan_ev,
    9038                 :            :         .pull_mgmt_rx = ath10k_wmi_op_pull_mgmt_rx_ev,
    9039                 :            :         .pull_ch_info = ath10k_wmi_op_pull_ch_info_ev,
    9040                 :            :         .pull_vdev_start = ath10k_wmi_op_pull_vdev_start_ev,
    9041                 :            :         .pull_peer_kick = ath10k_wmi_op_pull_peer_kick_ev,
    9042                 :            :         .pull_swba = ath10k_wmi_op_pull_swba_ev,
    9043                 :            :         .pull_phyerr_hdr = ath10k_wmi_op_pull_phyerr_ev_hdr,
    9044                 :            :         .pull_phyerr = ath10k_wmi_op_pull_phyerr_ev,
    9045                 :            :         .pull_svc_rdy = ath10k_wmi_main_op_pull_svc_rdy_ev,
    9046                 :            :         .pull_rdy = ath10k_wmi_op_pull_rdy_ev,
    9047                 :            :         .pull_fw_stats = ath10k_wmi_main_op_pull_fw_stats,
    9048                 :            :         .pull_roam_ev = ath10k_wmi_op_pull_roam_ev,
    9049                 :            :         .pull_echo_ev = ath10k_wmi_op_pull_echo_ev,
    9050                 :            : 
    9051                 :            :         .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend,
    9052                 :            :         .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume,
    9053                 :            :         .gen_pdev_set_rd = ath10k_wmi_op_gen_pdev_set_rd,
    9054                 :            :         .gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param,
    9055                 :            :         .gen_init = ath10k_wmi_op_gen_init,
    9056                 :            :         .gen_start_scan = ath10k_wmi_op_gen_start_scan,
    9057                 :            :         .gen_stop_scan = ath10k_wmi_op_gen_stop_scan,
    9058                 :            :         .gen_vdev_create = ath10k_wmi_op_gen_vdev_create,
    9059                 :            :         .gen_vdev_delete = ath10k_wmi_op_gen_vdev_delete,
    9060                 :            :         .gen_vdev_start = ath10k_wmi_op_gen_vdev_start,
    9061                 :            :         .gen_vdev_stop = ath10k_wmi_op_gen_vdev_stop,
    9062                 :            :         .gen_vdev_up = ath10k_wmi_op_gen_vdev_up,
    9063                 :            :         .gen_vdev_down = ath10k_wmi_op_gen_vdev_down,
    9064                 :            :         .gen_vdev_set_param = ath10k_wmi_op_gen_vdev_set_param,
    9065                 :            :         .gen_vdev_install_key = ath10k_wmi_op_gen_vdev_install_key,
    9066                 :            :         .gen_vdev_spectral_conf = ath10k_wmi_op_gen_vdev_spectral_conf,
    9067                 :            :         .gen_vdev_spectral_enable = ath10k_wmi_op_gen_vdev_spectral_enable,
    9068                 :            :         /* .gen_vdev_wmm_conf not implemented */
    9069                 :            :         .gen_peer_create = ath10k_wmi_op_gen_peer_create,
    9070                 :            :         .gen_peer_delete = ath10k_wmi_op_gen_peer_delete,
    9071                 :            :         .gen_peer_flush = ath10k_wmi_op_gen_peer_flush,
    9072                 :            :         .gen_peer_set_param = ath10k_wmi_op_gen_peer_set_param,
    9073                 :            :         .gen_peer_assoc = ath10k_wmi_op_gen_peer_assoc,
    9074                 :            :         .gen_set_psmode = ath10k_wmi_op_gen_set_psmode,
    9075                 :            :         .gen_set_sta_ps = ath10k_wmi_op_gen_set_sta_ps,
    9076                 :            :         .gen_set_ap_ps = ath10k_wmi_op_gen_set_ap_ps,
    9077                 :            :         .gen_scan_chan_list = ath10k_wmi_op_gen_scan_chan_list,
    9078                 :            :         .gen_beacon_dma = ath10k_wmi_op_gen_beacon_dma,
    9079                 :            :         .gen_pdev_set_wmm = ath10k_wmi_op_gen_pdev_set_wmm,
    9080                 :            :         .gen_request_stats = ath10k_wmi_op_gen_request_stats,
    9081                 :            :         .gen_force_fw_hang = ath10k_wmi_op_gen_force_fw_hang,
    9082                 :            :         .gen_mgmt_tx = ath10k_wmi_op_gen_mgmt_tx,
    9083                 :            :         .gen_dbglog_cfg = ath10k_wmi_op_gen_dbglog_cfg,
    9084                 :            :         .gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable,
    9085                 :            :         .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable,
    9086                 :            :         .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode,
    9087                 :            :         /* .gen_pdev_get_temperature not implemented */
    9088                 :            :         .gen_addba_clear_resp = ath10k_wmi_op_gen_addba_clear_resp,
    9089                 :            :         .gen_addba_send = ath10k_wmi_op_gen_addba_send,
    9090                 :            :         .gen_addba_set_resp = ath10k_wmi_op_gen_addba_set_resp,
    9091                 :            :         .gen_delba_send = ath10k_wmi_op_gen_delba_send,
    9092                 :            :         .fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill,
    9093                 :            :         .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
    9094                 :            :         .gen_echo = ath10k_wmi_op_gen_echo,
    9095                 :            :         /* .gen_bcn_tmpl not implemented */
    9096                 :            :         /* .gen_prb_tmpl not implemented */
    9097                 :            :         /* .gen_p2p_go_bcn_ie not implemented */
    9098                 :            :         /* .gen_adaptive_qcs not implemented */
    9099                 :            :         /* .gen_pdev_enable_adaptive_cca not implemented */
    9100                 :            : };
    9101                 :            : 
    9102                 :            : static const struct wmi_ops wmi_10_1_ops = {
    9103                 :            :         .rx = ath10k_wmi_10_1_op_rx,
    9104                 :            :         .map_svc = wmi_10x_svc_map,
    9105                 :            :         .pull_svc_rdy = ath10k_wmi_10x_op_pull_svc_rdy_ev,
    9106                 :            :         .pull_fw_stats = ath10k_wmi_10x_op_pull_fw_stats,
    9107                 :            :         .gen_init = ath10k_wmi_10_1_op_gen_init,
    9108                 :            :         .gen_pdev_set_rd = ath10k_wmi_10x_op_gen_pdev_set_rd,
    9109                 :            :         .gen_start_scan = ath10k_wmi_10x_op_gen_start_scan,
    9110                 :            :         .gen_peer_assoc = ath10k_wmi_10_1_op_gen_peer_assoc,
    9111                 :            :         /* .gen_pdev_get_temperature not implemented */
    9112                 :            : 
    9113                 :            :         /* shared with main branch */
    9114                 :            :         .pull_scan = ath10k_wmi_op_pull_scan_ev,
    9115                 :            :         .pull_mgmt_rx = ath10k_wmi_op_pull_mgmt_rx_ev,
    9116                 :            :         .pull_ch_info = ath10k_wmi_op_pull_ch_info_ev,
    9117                 :            :         .pull_vdev_start = ath10k_wmi_op_pull_vdev_start_ev,
    9118                 :            :         .pull_peer_kick = ath10k_wmi_op_pull_peer_kick_ev,
    9119                 :            :         .pull_swba = ath10k_wmi_op_pull_swba_ev,
    9120                 :            :         .pull_phyerr_hdr = ath10k_wmi_op_pull_phyerr_ev_hdr,
    9121                 :            :         .pull_phyerr = ath10k_wmi_op_pull_phyerr_ev,
    9122                 :            :         .pull_rdy = ath10k_wmi_op_pull_rdy_ev,
    9123                 :            :         .pull_roam_ev = ath10k_wmi_op_pull_roam_ev,
    9124                 :            :         .pull_echo_ev = ath10k_wmi_op_pull_echo_ev,
    9125                 :            : 
    9126                 :            :         .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend,
    9127                 :            :         .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume,
    9128                 :            :         .gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param,
    9129                 :            :         .gen_stop_scan = ath10k_wmi_op_gen_stop_scan,
    9130                 :            :         .gen_vdev_create = ath10k_wmi_op_gen_vdev_create,
    9131                 :            :         .gen_vdev_delete = ath10k_wmi_op_gen_vdev_delete,
    9132                 :            :         .gen_vdev_start = ath10k_wmi_op_gen_vdev_start,
    9133                 :            :         .gen_vdev_stop = ath10k_wmi_op_gen_vdev_stop,
    9134                 :            :         .gen_vdev_up = ath10k_wmi_op_gen_vdev_up,
    9135                 :            :         .gen_vdev_down = ath10k_wmi_op_gen_vdev_down,
    9136                 :            :         .gen_vdev_set_param = ath10k_wmi_op_gen_vdev_set_param,
    9137                 :            :         .gen_vdev_install_key = ath10k_wmi_op_gen_vdev_install_key,
    9138                 :            :         .gen_vdev_spectral_conf = ath10k_wmi_op_gen_vdev_spectral_conf,
    9139                 :            :         .gen_vdev_spectral_enable = ath10k_wmi_op_gen_vdev_spectral_enable,
    9140                 :            :         /* .gen_vdev_wmm_conf not implemented */
    9141                 :            :         .gen_peer_create = ath10k_wmi_op_gen_peer_create,
    9142                 :            :         .gen_peer_delete = ath10k_wmi_op_gen_peer_delete,
    9143                 :            :         .gen_peer_flush = ath10k_wmi_op_gen_peer_flush,
    9144                 :            :         .gen_peer_set_param = ath10k_wmi_op_gen_peer_set_param,
    9145                 :            :         .gen_set_psmode = ath10k_wmi_op_gen_set_psmode,
    9146                 :            :         .gen_set_sta_ps = ath10k_wmi_op_gen_set_sta_ps,
    9147                 :            :         .gen_set_ap_ps = ath10k_wmi_op_gen_set_ap_ps,
    9148                 :            :         .gen_scan_chan_list = ath10k_wmi_op_gen_scan_chan_list,
    9149                 :            :         .gen_beacon_dma = ath10k_wmi_op_gen_beacon_dma,
    9150                 :            :         .gen_pdev_set_wmm = ath10k_wmi_op_gen_pdev_set_wmm,
    9151                 :            :         .gen_request_stats = ath10k_wmi_op_gen_request_stats,
    9152                 :            :         .gen_force_fw_hang = ath10k_wmi_op_gen_force_fw_hang,
    9153                 :            :         .gen_mgmt_tx = ath10k_wmi_op_gen_mgmt_tx,
    9154                 :            :         .gen_dbglog_cfg = ath10k_wmi_op_gen_dbglog_cfg,
    9155                 :            :         .gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable,
    9156                 :            :         .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable,
    9157                 :            :         .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode,
    9158                 :            :         .gen_addba_clear_resp = ath10k_wmi_op_gen_addba_clear_resp,
    9159                 :            :         .gen_addba_send = ath10k_wmi_op_gen_addba_send,
    9160                 :            :         .gen_addba_set_resp = ath10k_wmi_op_gen_addba_set_resp,
    9161                 :            :         .gen_delba_send = ath10k_wmi_op_gen_delba_send,
    9162                 :            :         .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill,
    9163                 :            :         .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
    9164                 :            :         .gen_echo = ath10k_wmi_op_gen_echo,
    9165                 :            :         /* .gen_bcn_tmpl not implemented */
    9166                 :            :         /* .gen_prb_tmpl not implemented */
    9167                 :            :         /* .gen_p2p_go_bcn_ie not implemented */
    9168                 :            :         /* .gen_adaptive_qcs not implemented */
    9169                 :            :         /* .gen_pdev_enable_adaptive_cca not implemented */
    9170                 :            : };
    9171                 :            : 
    9172                 :            : static const struct wmi_ops wmi_10_2_ops = {
    9173                 :            :         .rx = ath10k_wmi_10_2_op_rx,
    9174                 :            :         .pull_fw_stats = ath10k_wmi_10_2_op_pull_fw_stats,
    9175                 :            :         .gen_init = ath10k_wmi_10_2_op_gen_init,
    9176                 :            :         .gen_peer_assoc = ath10k_wmi_10_2_op_gen_peer_assoc,
    9177                 :            :         /* .gen_pdev_get_temperature not implemented */
    9178                 :            : 
    9179                 :            :         /* shared with 10.1 */
    9180                 :            :         .map_svc = wmi_10x_svc_map,
    9181                 :            :         .pull_svc_rdy = ath10k_wmi_10x_op_pull_svc_rdy_ev,
    9182                 :            :         .gen_pdev_set_rd = ath10k_wmi_10x_op_gen_pdev_set_rd,
    9183                 :            :         .gen_start_scan = ath10k_wmi_10x_op_gen_start_scan,
    9184                 :            :         .gen_echo = ath10k_wmi_op_gen_echo,
    9185                 :            : 
    9186                 :            :         .pull_scan = ath10k_wmi_op_pull_scan_ev,
    9187                 :            :         .pull_mgmt_rx = ath10k_wmi_op_pull_mgmt_rx_ev,
    9188                 :            :         .pull_ch_info = ath10k_wmi_op_pull_ch_info_ev,
    9189                 :            :         .pull_vdev_start = ath10k_wmi_op_pull_vdev_start_ev,
    9190                 :            :         .pull_peer_kick = ath10k_wmi_op_pull_peer_kick_ev,
    9191                 :            :         .pull_swba = ath10k_wmi_op_pull_swba_ev,
    9192                 :            :         .pull_phyerr_hdr = ath10k_wmi_op_pull_phyerr_ev_hdr,
    9193                 :            :         .pull_phyerr = ath10k_wmi_op_pull_phyerr_ev,
    9194                 :            :         .pull_rdy = ath10k_wmi_op_pull_rdy_ev,
    9195                 :            :         .pull_roam_ev = ath10k_wmi_op_pull_roam_ev,
    9196                 :            :         .pull_echo_ev = ath10k_wmi_op_pull_echo_ev,
    9197                 :            : 
    9198                 :            :         .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend,
    9199                 :            :         .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume,
    9200                 :            :         .gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param,
    9201                 :            :         .gen_stop_scan = ath10k_wmi_op_gen_stop_scan,
    9202                 :            :         .gen_vdev_create = ath10k_wmi_op_gen_vdev_create,
    9203                 :            :         .gen_vdev_delete = ath10k_wmi_op_gen_vdev_delete,
    9204                 :            :         .gen_vdev_start = ath10k_wmi_op_gen_vdev_start,
    9205                 :            :         .gen_vdev_stop = ath10k_wmi_op_gen_vdev_stop,
    9206                 :            :         .gen_vdev_up = ath10k_wmi_op_gen_vdev_up,
    9207                 :            :         .gen_vdev_down = ath10k_wmi_op_gen_vdev_down,
    9208                 :            :         .gen_vdev_set_param = ath10k_wmi_op_gen_vdev_set_param,
    9209                 :            :         .gen_vdev_install_key = ath10k_wmi_op_gen_vdev_install_key,
    9210                 :            :         .gen_vdev_spectral_conf = ath10k_wmi_op_gen_vdev_spectral_conf,
    9211                 :            :         .gen_vdev_spectral_enable = ath10k_wmi_op_gen_vdev_spectral_enable,
    9212                 :            :         /* .gen_vdev_wmm_conf not implemented */
    9213                 :            :         .gen_peer_create = ath10k_wmi_op_gen_peer_create,
    9214                 :            :         .gen_peer_delete = ath10k_wmi_op_gen_peer_delete,
    9215                 :            :         .gen_peer_flush = ath10k_wmi_op_gen_peer_flush,
    9216                 :            :         .gen_pdev_set_base_macaddr = ath10k_wmi_op_gen_pdev_set_base_macaddr,
    9217                 :            :         .gen_peer_set_param = ath10k_wmi_op_gen_peer_set_param,
    9218                 :            :         .gen_set_psmode = ath10k_wmi_op_gen_set_psmode,
    9219                 :            :         .gen_set_sta_ps = ath10k_wmi_op_gen_set_sta_ps,
    9220                 :            :         .gen_set_ap_ps = ath10k_wmi_op_gen_set_ap_ps,
    9221                 :            :         .gen_scan_chan_list = ath10k_wmi_op_gen_scan_chan_list,
    9222                 :            :         .gen_beacon_dma = ath10k_wmi_op_gen_beacon_dma,
    9223                 :            :         .gen_pdev_set_wmm = ath10k_wmi_op_gen_pdev_set_wmm,
    9224                 :            :         .gen_request_stats = ath10k_wmi_op_gen_request_stats,
    9225                 :            :         .gen_force_fw_hang = ath10k_wmi_op_gen_force_fw_hang,
    9226                 :            :         .gen_mgmt_tx = ath10k_wmi_op_gen_mgmt_tx,
    9227                 :            :         .gen_dbglog_cfg = ath10k_wmi_op_gen_dbglog_cfg,
    9228                 :            :         .gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable,
    9229                 :            :         .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable,
    9230                 :            :         .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode,
    9231                 :            :         .gen_addba_clear_resp = ath10k_wmi_op_gen_addba_clear_resp,
    9232                 :            :         .gen_addba_send = ath10k_wmi_op_gen_addba_send,
    9233                 :            :         .gen_addba_set_resp = ath10k_wmi_op_gen_addba_set_resp,
    9234                 :            :         .gen_delba_send = ath10k_wmi_op_gen_delba_send,
    9235                 :            :         .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill,
    9236                 :            :         .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
    9237                 :            :         /* .gen_pdev_enable_adaptive_cca not implemented */
    9238                 :            : };
    9239                 :            : 
    9240                 :            : static const struct wmi_ops wmi_10_2_4_ops = {
    9241                 :            :         .rx = ath10k_wmi_10_2_op_rx,
    9242                 :            :         .pull_fw_stats = ath10k_wmi_10_2_4_op_pull_fw_stats,
    9243                 :            :         .gen_init = ath10k_wmi_10_2_op_gen_init,
    9244                 :            :         .gen_peer_assoc = ath10k_wmi_10_2_op_gen_peer_assoc,
    9245                 :            :         .gen_pdev_get_temperature = ath10k_wmi_10_2_op_gen_pdev_get_temperature,
    9246                 :            :         .gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info,
    9247                 :            : 
    9248                 :            :         /* shared with 10.1 */
    9249                 :            :         .map_svc = wmi_10x_svc_map,
    9250                 :            :         .pull_svc_rdy = ath10k_wmi_10x_op_pull_svc_rdy_ev,
    9251                 :            :         .gen_pdev_set_rd = ath10k_wmi_10x_op_gen_pdev_set_rd,
    9252                 :            :         .gen_start_scan = ath10k_wmi_10x_op_gen_start_scan,
    9253                 :            :         .gen_echo = ath10k_wmi_op_gen_echo,
    9254                 :            : 
    9255                 :            :         .pull_scan = ath10k_wmi_op_pull_scan_ev,
    9256                 :            :         .pull_mgmt_rx = ath10k_wmi_op_pull_mgmt_rx_ev,
    9257                 :            :         .pull_ch_info = ath10k_wmi_op_pull_ch_info_ev,
    9258                 :            :         .pull_vdev_start = ath10k_wmi_op_pull_vdev_start_ev,
    9259                 :            :         .pull_peer_kick = ath10k_wmi_op_pull_peer_kick_ev,
    9260                 :            :         .pull_swba = ath10k_wmi_10_2_4_op_pull_swba_ev,
    9261                 :            :         .pull_phyerr_hdr = ath10k_wmi_op_pull_phyerr_ev_hdr,
    9262                 :            :         .pull_phyerr = ath10k_wmi_op_pull_phyerr_ev,
    9263                 :            :         .pull_rdy = ath10k_wmi_op_pull_rdy_ev,
    9264                 :            :         .pull_roam_ev = ath10k_wmi_op_pull_roam_ev,
    9265                 :            :         .pull_echo_ev = ath10k_wmi_op_pull_echo_ev,
    9266                 :            : 
    9267                 :            :         .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend,
    9268                 :            :         .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume,
    9269                 :            :         .gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param,
    9270                 :            :         .gen_stop_scan = ath10k_wmi_op_gen_stop_scan,
    9271                 :            :         .gen_vdev_create = ath10k_wmi_op_gen_vdev_create,
    9272                 :            :         .gen_vdev_delete = ath10k_wmi_op_gen_vdev_delete,
    9273                 :            :         .gen_vdev_start = ath10k_wmi_op_gen_vdev_start,
    9274                 :            :         .gen_vdev_stop = ath10k_wmi_op_gen_vdev_stop,
    9275                 :            :         .gen_vdev_up = ath10k_wmi_op_gen_vdev_up,
    9276                 :            :         .gen_vdev_down = ath10k_wmi_op_gen_vdev_down,
    9277                 :            :         .gen_vdev_set_param = ath10k_wmi_op_gen_vdev_set_param,
    9278                 :            :         .gen_vdev_install_key = ath10k_wmi_op_gen_vdev_install_key,
    9279                 :            :         .gen_vdev_spectral_conf = ath10k_wmi_op_gen_vdev_spectral_conf,
    9280                 :            :         .gen_vdev_spectral_enable = ath10k_wmi_op_gen_vdev_spectral_enable,
    9281                 :            :         .gen_peer_create = ath10k_wmi_op_gen_peer_create,
    9282                 :            :         .gen_peer_delete = ath10k_wmi_op_gen_peer_delete,
    9283                 :            :         .gen_peer_flush = ath10k_wmi_op_gen_peer_flush,
    9284                 :            :         .gen_peer_set_param = ath10k_wmi_op_gen_peer_set_param,
    9285                 :            :         .gen_set_psmode = ath10k_wmi_op_gen_set_psmode,
    9286                 :            :         .gen_set_sta_ps = ath10k_wmi_op_gen_set_sta_ps,
    9287                 :            :         .gen_set_ap_ps = ath10k_wmi_op_gen_set_ap_ps,
    9288                 :            :         .gen_scan_chan_list = ath10k_wmi_op_gen_scan_chan_list,
    9289                 :            :         .gen_beacon_dma = ath10k_wmi_op_gen_beacon_dma,
    9290                 :            :         .gen_pdev_set_wmm = ath10k_wmi_op_gen_pdev_set_wmm,
    9291                 :            :         .gen_request_stats = ath10k_wmi_op_gen_request_stats,
    9292                 :            :         .gen_force_fw_hang = ath10k_wmi_op_gen_force_fw_hang,
    9293                 :            :         .gen_mgmt_tx = ath10k_wmi_op_gen_mgmt_tx,
    9294                 :            :         .gen_dbglog_cfg = ath10k_wmi_op_gen_dbglog_cfg,
    9295                 :            :         .gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable,
    9296                 :            :         .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable,
    9297                 :            :         .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode,
    9298                 :            :         .gen_addba_clear_resp = ath10k_wmi_op_gen_addba_clear_resp,
    9299                 :            :         .gen_addba_send = ath10k_wmi_op_gen_addba_send,
    9300                 :            :         .gen_addba_set_resp = ath10k_wmi_op_gen_addba_set_resp,
    9301                 :            :         .gen_delba_send = ath10k_wmi_op_gen_delba_send,
    9302                 :            :         .gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config,
    9303                 :            :         .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill,
    9304                 :            :         .gen_pdev_enable_adaptive_cca =
    9305                 :            :                 ath10k_wmi_op_gen_pdev_enable_adaptive_cca,
    9306                 :            :         .get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype,
    9307                 :            :         .gen_bb_timing = ath10k_wmi_10_2_4_op_gen_bb_timing,
    9308                 :            :         /* .gen_bcn_tmpl not implemented */
    9309                 :            :         /* .gen_prb_tmpl not implemented */
    9310                 :            :         /* .gen_p2p_go_bcn_ie not implemented */
    9311                 :            :         /* .gen_adaptive_qcs not implemented */
    9312                 :            : };
    9313                 :            : 
    9314                 :            : static const struct wmi_ops wmi_10_4_ops = {
    9315                 :            :         .rx = ath10k_wmi_10_4_op_rx,
    9316                 :            :         .map_svc = wmi_10_4_svc_map,
    9317                 :            : 
    9318                 :            :         .pull_fw_stats = ath10k_wmi_10_4_op_pull_fw_stats,
    9319                 :            :         .pull_scan = ath10k_wmi_op_pull_scan_ev,
    9320                 :            :         .pull_mgmt_rx = ath10k_wmi_10_4_op_pull_mgmt_rx_ev,
    9321                 :            :         .pull_ch_info = ath10k_wmi_10_4_op_pull_ch_info_ev,
    9322                 :            :         .pull_vdev_start = ath10k_wmi_op_pull_vdev_start_ev,
    9323                 :            :         .pull_peer_kick = ath10k_wmi_op_pull_peer_kick_ev,
    9324                 :            :         .pull_swba = ath10k_wmi_10_4_op_pull_swba_ev,
    9325                 :            :         .pull_phyerr_hdr = ath10k_wmi_10_4_op_pull_phyerr_ev_hdr,
    9326                 :            :         .pull_phyerr = ath10k_wmi_10_4_op_pull_phyerr_ev,
    9327                 :            :         .pull_svc_rdy = ath10k_wmi_main_op_pull_svc_rdy_ev,
    9328                 :            :         .pull_rdy = ath10k_wmi_op_pull_rdy_ev,
    9329                 :            :         .pull_roam_ev = ath10k_wmi_op_pull_roam_ev,
    9330                 :            :         .pull_dfs_status_ev = ath10k_wmi_10_4_op_pull_dfs_status_ev,
    9331                 :            :         .get_txbf_conf_scheme = ath10k_wmi_10_4_txbf_conf_scheme,
    9332                 :            : 
    9333                 :            :         .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend,
    9334                 :            :         .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume,
    9335                 :            :         .gen_pdev_set_base_macaddr = ath10k_wmi_op_gen_pdev_set_base_macaddr,
    9336                 :            :         .gen_pdev_set_rd = ath10k_wmi_10x_op_gen_pdev_set_rd,
    9337                 :            :         .gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param,
    9338                 :            :         .gen_init = ath10k_wmi_10_4_op_gen_init,
    9339                 :            :         .gen_start_scan = ath10k_wmi_op_gen_start_scan,
    9340                 :            :         .gen_stop_scan = ath10k_wmi_op_gen_stop_scan,
    9341                 :            :         .gen_vdev_create = ath10k_wmi_op_gen_vdev_create,
    9342                 :            :         .gen_vdev_delete = ath10k_wmi_op_gen_vdev_delete,
    9343                 :            :         .gen_vdev_start = ath10k_wmi_op_gen_vdev_start,
    9344                 :            :         .gen_vdev_stop = ath10k_wmi_op_gen_vdev_stop,
    9345                 :            :         .gen_vdev_up = ath10k_wmi_op_gen_vdev_up,
    9346                 :            :         .gen_vdev_down = ath10k_wmi_op_gen_vdev_down,
    9347                 :            :         .gen_vdev_set_param = ath10k_wmi_op_gen_vdev_set_param,
    9348                 :            :         .gen_vdev_install_key = ath10k_wmi_op_gen_vdev_install_key,
    9349                 :            :         .gen_vdev_spectral_conf = ath10k_wmi_op_gen_vdev_spectral_conf,
    9350                 :            :         .gen_vdev_spectral_enable = ath10k_wmi_op_gen_vdev_spectral_enable,
    9351                 :            :         .gen_peer_create = ath10k_wmi_op_gen_peer_create,
    9352                 :            :         .gen_peer_delete = ath10k_wmi_op_gen_peer_delete,
    9353                 :            :         .gen_peer_flush = ath10k_wmi_op_gen_peer_flush,
    9354                 :            :         .gen_peer_set_param = ath10k_wmi_op_gen_peer_set_param,
    9355                 :            :         .gen_peer_assoc = ath10k_wmi_10_4_op_gen_peer_assoc,
    9356                 :            :         .gen_set_psmode = ath10k_wmi_op_gen_set_psmode,
    9357                 :            :         .gen_set_sta_ps = ath10k_wmi_op_gen_set_sta_ps,
    9358                 :            :         .gen_set_ap_ps = ath10k_wmi_op_gen_set_ap_ps,
    9359                 :            :         .gen_scan_chan_list = ath10k_wmi_op_gen_scan_chan_list,
    9360                 :            :         .gen_beacon_dma = ath10k_wmi_op_gen_beacon_dma,
    9361                 :            :         .gen_pdev_set_wmm = ath10k_wmi_op_gen_pdev_set_wmm,
    9362                 :            :         .gen_force_fw_hang = ath10k_wmi_op_gen_force_fw_hang,
    9363                 :            :         .gen_mgmt_tx = ath10k_wmi_op_gen_mgmt_tx,
    9364                 :            :         .gen_dbglog_cfg = ath10k_wmi_10_4_op_gen_dbglog_cfg,
    9365                 :            :         .gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable,
    9366                 :            :         .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable,
    9367                 :            :         .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode,
    9368                 :            :         .gen_addba_clear_resp = ath10k_wmi_op_gen_addba_clear_resp,
    9369                 :            :         .gen_addba_send = ath10k_wmi_op_gen_addba_send,
    9370                 :            :         .gen_addba_set_resp = ath10k_wmi_op_gen_addba_set_resp,
    9371                 :            :         .gen_delba_send = ath10k_wmi_op_gen_delba_send,
    9372                 :            :         .fw_stats_fill = ath10k_wmi_10_4_op_fw_stats_fill,
    9373                 :            :         .ext_resource_config = ath10k_wmi_10_4_ext_resource_config,
    9374                 :            :         .gen_update_fw_tdls_state = ath10k_wmi_10_4_gen_update_fw_tdls_state,
    9375                 :            :         .gen_tdls_peer_update = ath10k_wmi_10_4_gen_tdls_peer_update,
    9376                 :            :         .gen_pdev_get_tpc_table_cmdid =
    9377                 :            :                         ath10k_wmi_10_4_op_gen_pdev_get_tpc_table_cmdid,
    9378                 :            :         .gen_radar_found = ath10k_wmi_10_4_gen_radar_found,
    9379                 :            : 
    9380                 :            :         /* shared with 10.2 */
    9381                 :            :         .pull_echo_ev = ath10k_wmi_op_pull_echo_ev,
    9382                 :            :         .gen_request_stats = ath10k_wmi_op_gen_request_stats,
    9383                 :            :         .gen_pdev_get_temperature = ath10k_wmi_10_2_op_gen_pdev_get_temperature,
    9384                 :            :         .get_vdev_subtype = ath10k_wmi_10_4_op_get_vdev_subtype,
    9385                 :            :         .gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info,
    9386                 :            :         .gen_echo = ath10k_wmi_op_gen_echo,
    9387                 :            :         .gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config,
    9388                 :            : };
    9389                 :            : 
    9390                 :          0 : int ath10k_wmi_attach(struct ath10k *ar)
    9391                 :            : {
    9392   [ #  #  #  #  :          0 :         switch (ar->running_fw->fw_file.wmi_op_version) {
             #  #  #  # ]
    9393                 :          0 :         case ATH10K_FW_WMI_OP_VERSION_10_4:
    9394                 :          0 :                 ar->wmi.ops = &wmi_10_4_ops;
    9395                 :          0 :                 ar->wmi.cmd = &wmi_10_4_cmd_map;
    9396                 :          0 :                 ar->wmi.vdev_param = &wmi_10_4_vdev_param_map;
    9397                 :          0 :                 ar->wmi.pdev_param = &wmi_10_4_pdev_param_map;
    9398                 :          0 :                 ar->wmi.peer_param = &wmi_peer_param_map;
    9399                 :          0 :                 ar->wmi.peer_flags = &wmi_10_2_peer_flags_map;
    9400                 :          0 :                 ar->wmi_key_cipher = wmi_key_cipher_suites;
    9401                 :          0 :                 break;
    9402                 :          0 :         case ATH10K_FW_WMI_OP_VERSION_10_2_4:
    9403                 :          0 :                 ar->wmi.cmd = &wmi_10_2_4_cmd_map;
    9404                 :          0 :                 ar->wmi.ops = &wmi_10_2_4_ops;
    9405                 :          0 :                 ar->wmi.vdev_param = &wmi_10_2_4_vdev_param_map;
    9406                 :          0 :                 ar->wmi.pdev_param = &wmi_10_2_4_pdev_param_map;
    9407                 :          0 :                 ar->wmi.peer_param = &wmi_peer_param_map;
    9408                 :          0 :                 ar->wmi.peer_flags = &wmi_10_2_peer_flags_map;
    9409                 :          0 :                 ar->wmi_key_cipher = wmi_key_cipher_suites;
    9410                 :          0 :                 break;
    9411                 :          0 :         case ATH10K_FW_WMI_OP_VERSION_10_2:
    9412                 :          0 :                 ar->wmi.cmd = &wmi_10_2_cmd_map;
    9413                 :          0 :                 ar->wmi.ops = &wmi_10_2_ops;
    9414                 :          0 :                 ar->wmi.vdev_param = &wmi_10x_vdev_param_map;
    9415                 :          0 :                 ar->wmi.pdev_param = &wmi_10x_pdev_param_map;
    9416                 :          0 :                 ar->wmi.peer_param = &wmi_peer_param_map;
    9417                 :          0 :                 ar->wmi.peer_flags = &wmi_10_2_peer_flags_map;
    9418                 :          0 :                 ar->wmi_key_cipher = wmi_key_cipher_suites;
    9419                 :          0 :                 break;
    9420                 :          0 :         case ATH10K_FW_WMI_OP_VERSION_10_1:
    9421                 :          0 :                 ar->wmi.cmd = &wmi_10x_cmd_map;
    9422                 :          0 :                 ar->wmi.ops = &wmi_10_1_ops;
    9423                 :          0 :                 ar->wmi.vdev_param = &wmi_10x_vdev_param_map;
    9424                 :          0 :                 ar->wmi.pdev_param = &wmi_10x_pdev_param_map;
    9425                 :          0 :                 ar->wmi.peer_param = &wmi_peer_param_map;
    9426                 :          0 :                 ar->wmi.peer_flags = &wmi_10x_peer_flags_map;
    9427                 :          0 :                 ar->wmi_key_cipher = wmi_key_cipher_suites;
    9428                 :          0 :                 break;
    9429                 :          0 :         case ATH10K_FW_WMI_OP_VERSION_MAIN:
    9430                 :          0 :                 ar->wmi.cmd = &wmi_cmd_map;
    9431                 :          0 :                 ar->wmi.ops = &wmi_ops;
    9432                 :          0 :                 ar->wmi.vdev_param = &wmi_vdev_param_map;
    9433                 :          0 :                 ar->wmi.pdev_param = &wmi_pdev_param_map;
    9434                 :          0 :                 ar->wmi.peer_param = &wmi_peer_param_map;
    9435                 :          0 :                 ar->wmi.peer_flags = &wmi_peer_flags_map;
    9436                 :          0 :                 ar->wmi_key_cipher = wmi_key_cipher_suites;
    9437                 :          0 :                 break;
    9438                 :          0 :         case ATH10K_FW_WMI_OP_VERSION_TLV:
    9439                 :          0 :                 ath10k_wmi_tlv_attach(ar);
    9440                 :          0 :                 ar->wmi_key_cipher = wmi_tlv_key_cipher_suites;
    9441                 :          0 :                 break;
    9442                 :          0 :         case ATH10K_FW_WMI_OP_VERSION_UNSET:
    9443                 :            :         case ATH10K_FW_WMI_OP_VERSION_MAX:
    9444                 :          0 :                 ath10k_err(ar, "unsupported WMI op version: %d\n",
    9445                 :            :                            ar->running_fw->fw_file.wmi_op_version);
    9446                 :          0 :                 return -EINVAL;
    9447                 :            :         }
    9448                 :            : 
    9449                 :          0 :         init_completion(&ar->wmi.service_ready);
    9450                 :          0 :         init_completion(&ar->wmi.unified_ready);
    9451                 :          0 :         init_completion(&ar->wmi.barrier);
    9452                 :          0 :         init_completion(&ar->wmi.radar_confirm);
    9453                 :            : 
    9454                 :          0 :         INIT_WORK(&ar->svc_rdy_work, ath10k_wmi_event_service_ready_work);
    9455                 :          0 :         INIT_WORK(&ar->radar_confirmation_work,
    9456                 :            :                   ath10k_radar_confirmation_work);
    9457                 :            : 
    9458         [ #  # ]:          0 :         if (test_bit(ATH10K_FW_FEATURE_MGMT_TX_BY_REF,
    9459                 :          0 :                      ar->running_fw->fw_file.fw_features)) {
    9460                 :          0 :                 idr_init(&ar->wmi.mgmt_pending_tx);
    9461                 :            :         }
    9462                 :            : 
    9463                 :            :         return 0;
    9464                 :            : }
    9465                 :            : 
    9466                 :          3 : void ath10k_wmi_free_host_mem(struct ath10k *ar)
    9467                 :            : {
    9468                 :          3 :         int i;
    9469                 :            : 
    9470                 :            :         /* free the host memory chunks requested by firmware */
    9471         [ -  + ]:          3 :         for (i = 0; i < ar->wmi.num_mem_chunks; i++) {
    9472                 :          0 :                 dma_free_coherent(ar->dev,
    9473                 :          0 :                                   ar->wmi.mem_chunks[i].len,
    9474                 :            :                                   ar->wmi.mem_chunks[i].vaddr,
    9475                 :            :                                   ar->wmi.mem_chunks[i].paddr);
    9476                 :            :         }
    9477                 :            : 
    9478                 :          3 :         ar->wmi.num_mem_chunks = 0;
    9479                 :          3 : }
    9480                 :            : 
    9481                 :          0 : static int ath10k_wmi_mgmt_tx_clean_up_pending(int msdu_id, void *ptr,
    9482                 :            :                                                void *ctx)
    9483                 :            : {
    9484                 :          0 :         struct ath10k_mgmt_tx_pkt_addr *pkt_addr = ptr;
    9485                 :          0 :         struct ath10k *ar = ctx;
    9486                 :          0 :         struct sk_buff *msdu;
    9487                 :            : 
    9488         [ #  # ]:          0 :         ath10k_dbg(ar, ATH10K_DBG_WMI,
    9489                 :            :                    "force cleanup mgmt msdu_id %hu\n", msdu_id);
    9490                 :            : 
    9491                 :          0 :         msdu = pkt_addr->vaddr;
    9492                 :          0 :         dma_unmap_single(ar->dev, pkt_addr->paddr,
    9493                 :            :                          msdu->len, DMA_TO_DEVICE);
    9494                 :          0 :         ieee80211_free_txskb(ar->hw, msdu);
    9495                 :            : 
    9496                 :          0 :         return 0;
    9497                 :            : }
    9498                 :            : 
    9499                 :          0 : void ath10k_wmi_detach(struct ath10k *ar)
    9500                 :            : {
    9501         [ #  # ]:          0 :         if (test_bit(ATH10K_FW_FEATURE_MGMT_TX_BY_REF,
    9502                 :          0 :                      ar->running_fw->fw_file.fw_features)) {
    9503                 :          0 :                 spin_lock_bh(&ar->data_lock);
    9504                 :          0 :                 idr_for_each(&ar->wmi.mgmt_pending_tx,
    9505                 :            :                              ath10k_wmi_mgmt_tx_clean_up_pending, ar);
    9506                 :          0 :                 idr_destroy(&ar->wmi.mgmt_pending_tx);
    9507                 :          0 :                 spin_unlock_bh(&ar->data_lock);
    9508                 :            :         }
    9509                 :            : 
    9510                 :          0 :         cancel_work_sync(&ar->svc_rdy_work);
    9511                 :          0 :         dev_kfree_skb(ar->svc_rdy_skb);
    9512                 :          0 : }

Generated by: LCOV version 1.14