Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2005-2011 Atheros Communications Inc. |
| 3 | * Copyright (c) 2011-2013 Qualcomm Atheros, Inc. |
| 4 | * |
| 5 | * Permission to use, copy, modify, and/or distribute this software for any |
| 6 | * purpose with or without fee is hereby granted, provided that the above |
| 7 | * copyright notice and this permission notice appear in all copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | */ |
| 17 | |
| 18 | #include <linux/skbuff.h> |
Kalle Valo | 2fe5288 | 2014-01-03 12:59:20 +0200 | [diff] [blame] | 19 | #include <linux/ctype.h> |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 20 | |
| 21 | #include "core.h" |
| 22 | #include "htc.h" |
| 23 | #include "debug.h" |
| 24 | #include "wmi.h" |
Michal Kazior | ca996ec | 2014-12-03 10:11:32 +0200 | [diff] [blame] | 25 | #include "wmi-tlv.h" |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 26 | #include "mac.h" |
Kalle Valo | 43d2a30 | 2014-09-10 18:23:30 +0300 | [diff] [blame] | 27 | #include "testmode.h" |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 28 | #include "wmi-ops.h" |
Michal Kazior | 6a94888 | 2015-02-26 13:23:17 +0100 | [diff] [blame] | 29 | #include "p2p.h" |
Michal Kazior | 587f703 | 2015-05-25 14:06:18 +0200 | [diff] [blame] | 30 | #include "hw.h" |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 31 | |
Bartosz Markowski | ce42870 | 2013-09-26 17:47:05 +0200 | [diff] [blame] | 32 | /* MAIN WMI cmd track */ |
| 33 | static struct wmi_cmd_map wmi_cmd_map = { |
| 34 | .init_cmdid = WMI_INIT_CMDID, |
| 35 | .start_scan_cmdid = WMI_START_SCAN_CMDID, |
| 36 | .stop_scan_cmdid = WMI_STOP_SCAN_CMDID, |
| 37 | .scan_chan_list_cmdid = WMI_SCAN_CHAN_LIST_CMDID, |
| 38 | .scan_sch_prio_tbl_cmdid = WMI_SCAN_SCH_PRIO_TBL_CMDID, |
| 39 | .pdev_set_regdomain_cmdid = WMI_PDEV_SET_REGDOMAIN_CMDID, |
| 40 | .pdev_set_channel_cmdid = WMI_PDEV_SET_CHANNEL_CMDID, |
| 41 | .pdev_set_param_cmdid = WMI_PDEV_SET_PARAM_CMDID, |
| 42 | .pdev_pktlog_enable_cmdid = WMI_PDEV_PKTLOG_ENABLE_CMDID, |
| 43 | .pdev_pktlog_disable_cmdid = WMI_PDEV_PKTLOG_DISABLE_CMDID, |
| 44 | .pdev_set_wmm_params_cmdid = WMI_PDEV_SET_WMM_PARAMS_CMDID, |
| 45 | .pdev_set_ht_cap_ie_cmdid = WMI_PDEV_SET_HT_CAP_IE_CMDID, |
| 46 | .pdev_set_vht_cap_ie_cmdid = WMI_PDEV_SET_VHT_CAP_IE_CMDID, |
| 47 | .pdev_set_dscp_tid_map_cmdid = WMI_PDEV_SET_DSCP_TID_MAP_CMDID, |
| 48 | .pdev_set_quiet_mode_cmdid = WMI_PDEV_SET_QUIET_MODE_CMDID, |
| 49 | .pdev_green_ap_ps_enable_cmdid = WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID, |
| 50 | .pdev_get_tpc_config_cmdid = WMI_PDEV_GET_TPC_CONFIG_CMDID, |
| 51 | .pdev_set_base_macaddr_cmdid = WMI_PDEV_SET_BASE_MACADDR_CMDID, |
| 52 | .vdev_create_cmdid = WMI_VDEV_CREATE_CMDID, |
| 53 | .vdev_delete_cmdid = WMI_VDEV_DELETE_CMDID, |
| 54 | .vdev_start_request_cmdid = WMI_VDEV_START_REQUEST_CMDID, |
| 55 | .vdev_restart_request_cmdid = WMI_VDEV_RESTART_REQUEST_CMDID, |
| 56 | .vdev_up_cmdid = WMI_VDEV_UP_CMDID, |
| 57 | .vdev_stop_cmdid = WMI_VDEV_STOP_CMDID, |
| 58 | .vdev_down_cmdid = WMI_VDEV_DOWN_CMDID, |
| 59 | .vdev_set_param_cmdid = WMI_VDEV_SET_PARAM_CMDID, |
| 60 | .vdev_install_key_cmdid = WMI_VDEV_INSTALL_KEY_CMDID, |
| 61 | .peer_create_cmdid = WMI_PEER_CREATE_CMDID, |
| 62 | .peer_delete_cmdid = WMI_PEER_DELETE_CMDID, |
| 63 | .peer_flush_tids_cmdid = WMI_PEER_FLUSH_TIDS_CMDID, |
| 64 | .peer_set_param_cmdid = WMI_PEER_SET_PARAM_CMDID, |
| 65 | .peer_assoc_cmdid = WMI_PEER_ASSOC_CMDID, |
| 66 | .peer_add_wds_entry_cmdid = WMI_PEER_ADD_WDS_ENTRY_CMDID, |
| 67 | .peer_remove_wds_entry_cmdid = WMI_PEER_REMOVE_WDS_ENTRY_CMDID, |
| 68 | .peer_mcast_group_cmdid = WMI_PEER_MCAST_GROUP_CMDID, |
| 69 | .bcn_tx_cmdid = WMI_BCN_TX_CMDID, |
| 70 | .pdev_send_bcn_cmdid = WMI_PDEV_SEND_BCN_CMDID, |
| 71 | .bcn_tmpl_cmdid = WMI_BCN_TMPL_CMDID, |
| 72 | .bcn_filter_rx_cmdid = WMI_BCN_FILTER_RX_CMDID, |
| 73 | .prb_req_filter_rx_cmdid = WMI_PRB_REQ_FILTER_RX_CMDID, |
| 74 | .mgmt_tx_cmdid = WMI_MGMT_TX_CMDID, |
| 75 | .prb_tmpl_cmdid = WMI_PRB_TMPL_CMDID, |
| 76 | .addba_clear_resp_cmdid = WMI_ADDBA_CLEAR_RESP_CMDID, |
| 77 | .addba_send_cmdid = WMI_ADDBA_SEND_CMDID, |
| 78 | .addba_status_cmdid = WMI_ADDBA_STATUS_CMDID, |
| 79 | .delba_send_cmdid = WMI_DELBA_SEND_CMDID, |
| 80 | .addba_set_resp_cmdid = WMI_ADDBA_SET_RESP_CMDID, |
| 81 | .send_singleamsdu_cmdid = WMI_SEND_SINGLEAMSDU_CMDID, |
| 82 | .sta_powersave_mode_cmdid = WMI_STA_POWERSAVE_MODE_CMDID, |
| 83 | .sta_powersave_param_cmdid = WMI_STA_POWERSAVE_PARAM_CMDID, |
| 84 | .sta_mimo_ps_mode_cmdid = WMI_STA_MIMO_PS_MODE_CMDID, |
| 85 | .pdev_dfs_enable_cmdid = WMI_PDEV_DFS_ENABLE_CMDID, |
| 86 | .pdev_dfs_disable_cmdid = WMI_PDEV_DFS_DISABLE_CMDID, |
| 87 | .roam_scan_mode = WMI_ROAM_SCAN_MODE, |
| 88 | .roam_scan_rssi_threshold = WMI_ROAM_SCAN_RSSI_THRESHOLD, |
| 89 | .roam_scan_period = WMI_ROAM_SCAN_PERIOD, |
| 90 | .roam_scan_rssi_change_threshold = WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD, |
| 91 | .roam_ap_profile = WMI_ROAM_AP_PROFILE, |
| 92 | .ofl_scan_add_ap_profile = WMI_ROAM_AP_PROFILE, |
| 93 | .ofl_scan_remove_ap_profile = WMI_OFL_SCAN_REMOVE_AP_PROFILE, |
| 94 | .ofl_scan_period = WMI_OFL_SCAN_PERIOD, |
| 95 | .p2p_dev_set_device_info = WMI_P2P_DEV_SET_DEVICE_INFO, |
| 96 | .p2p_dev_set_discoverability = WMI_P2P_DEV_SET_DISCOVERABILITY, |
| 97 | .p2p_go_set_beacon_ie = WMI_P2P_GO_SET_BEACON_IE, |
| 98 | .p2p_go_set_probe_resp_ie = WMI_P2P_GO_SET_PROBE_RESP_IE, |
| 99 | .p2p_set_vendor_ie_data_cmdid = WMI_P2P_SET_VENDOR_IE_DATA_CMDID, |
| 100 | .ap_ps_peer_param_cmdid = WMI_AP_PS_PEER_PARAM_CMDID, |
| 101 | .ap_ps_peer_uapsd_coex_cmdid = WMI_AP_PS_PEER_UAPSD_COEX_CMDID, |
| 102 | .peer_rate_retry_sched_cmdid = WMI_PEER_RATE_RETRY_SCHED_CMDID, |
| 103 | .wlan_profile_trigger_cmdid = WMI_WLAN_PROFILE_TRIGGER_CMDID, |
| 104 | .wlan_profile_set_hist_intvl_cmdid = |
| 105 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID, |
| 106 | .wlan_profile_get_profile_data_cmdid = |
| 107 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID, |
| 108 | .wlan_profile_enable_profile_id_cmdid = |
| 109 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID, |
| 110 | .wlan_profile_list_profile_id_cmdid = |
| 111 | WMI_WLAN_PROFILE_LIST_PROFILE_ID_CMDID, |
| 112 | .pdev_suspend_cmdid = WMI_PDEV_SUSPEND_CMDID, |
| 113 | .pdev_resume_cmdid = WMI_PDEV_RESUME_CMDID, |
| 114 | .add_bcn_filter_cmdid = WMI_ADD_BCN_FILTER_CMDID, |
| 115 | .rmv_bcn_filter_cmdid = WMI_RMV_BCN_FILTER_CMDID, |
| 116 | .wow_add_wake_pattern_cmdid = WMI_WOW_ADD_WAKE_PATTERN_CMDID, |
| 117 | .wow_del_wake_pattern_cmdid = WMI_WOW_DEL_WAKE_PATTERN_CMDID, |
| 118 | .wow_enable_disable_wake_event_cmdid = |
| 119 | WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID, |
| 120 | .wow_enable_cmdid = WMI_WOW_ENABLE_CMDID, |
| 121 | .wow_hostwakeup_from_sleep_cmdid = WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID, |
| 122 | .rtt_measreq_cmdid = WMI_RTT_MEASREQ_CMDID, |
| 123 | .rtt_tsf_cmdid = WMI_RTT_TSF_CMDID, |
| 124 | .vdev_spectral_scan_configure_cmdid = |
| 125 | WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID, |
| 126 | .vdev_spectral_scan_enable_cmdid = WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID, |
| 127 | .request_stats_cmdid = WMI_REQUEST_STATS_CMDID, |
| 128 | .set_arp_ns_offload_cmdid = WMI_SET_ARP_NS_OFFLOAD_CMDID, |
| 129 | .network_list_offload_config_cmdid = |
| 130 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID, |
| 131 | .gtk_offload_cmdid = WMI_GTK_OFFLOAD_CMDID, |
| 132 | .csa_offload_enable_cmdid = WMI_CSA_OFFLOAD_ENABLE_CMDID, |
| 133 | .csa_offload_chanswitch_cmdid = WMI_CSA_OFFLOAD_CHANSWITCH_CMDID, |
| 134 | .chatter_set_mode_cmdid = WMI_CHATTER_SET_MODE_CMDID, |
| 135 | .peer_tid_addba_cmdid = WMI_PEER_TID_ADDBA_CMDID, |
| 136 | .peer_tid_delba_cmdid = WMI_PEER_TID_DELBA_CMDID, |
| 137 | .sta_dtim_ps_method_cmdid = WMI_STA_DTIM_PS_METHOD_CMDID, |
| 138 | .sta_uapsd_auto_trig_cmdid = WMI_STA_UAPSD_AUTO_TRIG_CMDID, |
| 139 | .sta_keepalive_cmd = WMI_STA_KEEPALIVE_CMD, |
| 140 | .echo_cmdid = WMI_ECHO_CMDID, |
| 141 | .pdev_utf_cmdid = WMI_PDEV_UTF_CMDID, |
| 142 | .dbglog_cfg_cmdid = WMI_DBGLOG_CFG_CMDID, |
| 143 | .pdev_qvit_cmdid = WMI_PDEV_QVIT_CMDID, |
| 144 | .pdev_ftm_intg_cmdid = WMI_PDEV_FTM_INTG_CMDID, |
| 145 | .vdev_set_keepalive_cmdid = WMI_VDEV_SET_KEEPALIVE_CMDID, |
| 146 | .vdev_get_keepalive_cmdid = WMI_VDEV_GET_KEEPALIVE_CMDID, |
| 147 | .force_fw_hang_cmdid = WMI_FORCE_FW_HANG_CMDID, |
| 148 | .gpio_config_cmdid = WMI_GPIO_CONFIG_CMDID, |
| 149 | .gpio_output_cmdid = WMI_GPIO_OUTPUT_CMDID, |
Rajkumar Manoharan | a57a6a2 | 2014-12-17 12:22:17 +0200 | [diff] [blame] | 150 | .pdev_get_temperature_cmdid = WMI_CMD_UNSUPPORTED, |
Raja Mani | 772b4ae | 2015-06-22 20:10:12 +0530 | [diff] [blame] | 151 | .scan_update_request_cmdid = WMI_CMD_UNSUPPORTED, |
| 152 | .vdev_standby_response_cmdid = WMI_CMD_UNSUPPORTED, |
| 153 | .vdev_resume_response_cmdid = WMI_CMD_UNSUPPORTED, |
| 154 | .wlan_peer_caching_add_peer_cmdid = WMI_CMD_UNSUPPORTED, |
| 155 | .wlan_peer_caching_evict_peer_cmdid = WMI_CMD_UNSUPPORTED, |
| 156 | .wlan_peer_caching_restore_peer_cmdid = WMI_CMD_UNSUPPORTED, |
| 157 | .wlan_peer_caching_print_all_peers_info_cmdid = WMI_CMD_UNSUPPORTED, |
| 158 | .peer_update_wds_entry_cmdid = WMI_CMD_UNSUPPORTED, |
| 159 | .peer_add_proxy_sta_entry_cmdid = WMI_CMD_UNSUPPORTED, |
| 160 | .rtt_keepalive_cmdid = WMI_CMD_UNSUPPORTED, |
| 161 | .oem_req_cmdid = WMI_CMD_UNSUPPORTED, |
| 162 | .nan_cmdid = WMI_CMD_UNSUPPORTED, |
| 163 | .vdev_ratemask_cmdid = WMI_CMD_UNSUPPORTED, |
| 164 | .qboost_cfg_cmdid = WMI_CMD_UNSUPPORTED, |
| 165 | .pdev_smart_ant_enable_cmdid = WMI_CMD_UNSUPPORTED, |
| 166 | .pdev_smart_ant_set_rx_antenna_cmdid = WMI_CMD_UNSUPPORTED, |
| 167 | .peer_smart_ant_set_tx_antenna_cmdid = WMI_CMD_UNSUPPORTED, |
| 168 | .peer_smart_ant_set_train_info_cmdid = WMI_CMD_UNSUPPORTED, |
| 169 | .peer_smart_ant_set_node_config_ops_cmdid = WMI_CMD_UNSUPPORTED, |
| 170 | .pdev_set_antenna_switch_table_cmdid = WMI_CMD_UNSUPPORTED, |
| 171 | .pdev_set_ctl_table_cmdid = WMI_CMD_UNSUPPORTED, |
| 172 | .pdev_set_mimogain_table_cmdid = WMI_CMD_UNSUPPORTED, |
| 173 | .pdev_ratepwr_table_cmdid = WMI_CMD_UNSUPPORTED, |
| 174 | .pdev_ratepwr_chainmsk_table_cmdid = WMI_CMD_UNSUPPORTED, |
| 175 | .pdev_fips_cmdid = WMI_CMD_UNSUPPORTED, |
| 176 | .tt_set_conf_cmdid = WMI_CMD_UNSUPPORTED, |
| 177 | .fwtest_cmdid = WMI_CMD_UNSUPPORTED, |
| 178 | .vdev_atf_request_cmdid = WMI_CMD_UNSUPPORTED, |
| 179 | .peer_atf_request_cmdid = WMI_CMD_UNSUPPORTED, |
| 180 | .pdev_get_ani_cck_config_cmdid = WMI_CMD_UNSUPPORTED, |
| 181 | .pdev_get_ani_ofdm_config_cmdid = WMI_CMD_UNSUPPORTED, |
| 182 | .pdev_reserve_ast_entry_cmdid = WMI_CMD_UNSUPPORTED, |
| 183 | .pdev_get_nfcal_power_cmdid = WMI_CMD_UNSUPPORTED, |
| 184 | .pdev_get_tpc_cmdid = WMI_CMD_UNSUPPORTED, |
| 185 | .pdev_get_ast_info_cmdid = WMI_CMD_UNSUPPORTED, |
| 186 | .vdev_set_dscp_tid_map_cmdid = WMI_CMD_UNSUPPORTED, |
| 187 | .pdev_get_info_cmdid = WMI_CMD_UNSUPPORTED, |
| 188 | .vdev_get_info_cmdid = WMI_CMD_UNSUPPORTED, |
| 189 | .vdev_filter_neighbor_rx_packets_cmdid = WMI_CMD_UNSUPPORTED, |
| 190 | .mu_cal_start_cmdid = WMI_CMD_UNSUPPORTED, |
| 191 | .set_cca_params_cmdid = WMI_CMD_UNSUPPORTED, |
| 192 | .pdev_bss_chan_info_request_cmdid = WMI_CMD_UNSUPPORTED, |
Bartosz Markowski | ce42870 | 2013-09-26 17:47:05 +0200 | [diff] [blame] | 193 | }; |
| 194 | |
Bartosz Markowski | b7e3adf | 2013-09-26 17:47:06 +0200 | [diff] [blame] | 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, |
Bartosz Markowski | 34957b2 | 2013-10-15 09:55:31 +0200 | [diff] [blame] | 201 | .scan_sch_prio_tbl_cmdid = WMI_CMD_UNSUPPORTED, |
Bartosz Markowski | b7e3adf | 2013-09-26 17:47:06 +0200 | [diff] [blame] | 202 | .pdev_set_regdomain_cmdid = WMI_10X_PDEV_SET_REGDOMAIN_CMDID, |
| 203 | .pdev_set_channel_cmdid = WMI_10X_PDEV_SET_CHANNEL_CMDID, |
| 204 | .pdev_set_param_cmdid = WMI_10X_PDEV_SET_PARAM_CMDID, |
| 205 | .pdev_pktlog_enable_cmdid = WMI_10X_PDEV_PKTLOG_ENABLE_CMDID, |
| 206 | .pdev_pktlog_disable_cmdid = WMI_10X_PDEV_PKTLOG_DISABLE_CMDID, |
| 207 | .pdev_set_wmm_params_cmdid = WMI_10X_PDEV_SET_WMM_PARAMS_CMDID, |
| 208 | .pdev_set_ht_cap_ie_cmdid = WMI_10X_PDEV_SET_HT_CAP_IE_CMDID, |
| 209 | .pdev_set_vht_cap_ie_cmdid = WMI_10X_PDEV_SET_VHT_CAP_IE_CMDID, |
| 210 | .pdev_set_dscp_tid_map_cmdid = WMI_10X_PDEV_SET_DSCP_TID_MAP_CMDID, |
| 211 | .pdev_set_quiet_mode_cmdid = WMI_10X_PDEV_SET_QUIET_MODE_CMDID, |
| 212 | .pdev_green_ap_ps_enable_cmdid = WMI_10X_PDEV_GREEN_AP_PS_ENABLE_CMDID, |
| 213 | .pdev_get_tpc_config_cmdid = WMI_10X_PDEV_GET_TPC_CONFIG_CMDID, |
| 214 | .pdev_set_base_macaddr_cmdid = WMI_10X_PDEV_SET_BASE_MACADDR_CMDID, |
| 215 | .vdev_create_cmdid = WMI_10X_VDEV_CREATE_CMDID, |
| 216 | .vdev_delete_cmdid = WMI_10X_VDEV_DELETE_CMDID, |
| 217 | .vdev_start_request_cmdid = WMI_10X_VDEV_START_REQUEST_CMDID, |
| 218 | .vdev_restart_request_cmdid = WMI_10X_VDEV_RESTART_REQUEST_CMDID, |
| 219 | .vdev_up_cmdid = WMI_10X_VDEV_UP_CMDID, |
| 220 | .vdev_stop_cmdid = WMI_10X_VDEV_STOP_CMDID, |
| 221 | .vdev_down_cmdid = WMI_10X_VDEV_DOWN_CMDID, |
| 222 | .vdev_set_param_cmdid = WMI_10X_VDEV_SET_PARAM_CMDID, |
| 223 | .vdev_install_key_cmdid = WMI_10X_VDEV_INSTALL_KEY_CMDID, |
| 224 | .peer_create_cmdid = WMI_10X_PEER_CREATE_CMDID, |
| 225 | .peer_delete_cmdid = WMI_10X_PEER_DELETE_CMDID, |
| 226 | .peer_flush_tids_cmdid = WMI_10X_PEER_FLUSH_TIDS_CMDID, |
| 227 | .peer_set_param_cmdid = WMI_10X_PEER_SET_PARAM_CMDID, |
| 228 | .peer_assoc_cmdid = WMI_10X_PEER_ASSOC_CMDID, |
| 229 | .peer_add_wds_entry_cmdid = WMI_10X_PEER_ADD_WDS_ENTRY_CMDID, |
| 230 | .peer_remove_wds_entry_cmdid = WMI_10X_PEER_REMOVE_WDS_ENTRY_CMDID, |
| 231 | .peer_mcast_group_cmdid = WMI_10X_PEER_MCAST_GROUP_CMDID, |
| 232 | .bcn_tx_cmdid = WMI_10X_BCN_TX_CMDID, |
| 233 | .pdev_send_bcn_cmdid = WMI_10X_PDEV_SEND_BCN_CMDID, |
Bartosz Markowski | 34957b2 | 2013-10-15 09:55:31 +0200 | [diff] [blame] | 234 | .bcn_tmpl_cmdid = WMI_CMD_UNSUPPORTED, |
Bartosz Markowski | b7e3adf | 2013-09-26 17:47:06 +0200 | [diff] [blame] | 235 | .bcn_filter_rx_cmdid = WMI_10X_BCN_FILTER_RX_CMDID, |
| 236 | .prb_req_filter_rx_cmdid = WMI_10X_PRB_REQ_FILTER_RX_CMDID, |
| 237 | .mgmt_tx_cmdid = WMI_10X_MGMT_TX_CMDID, |
Bartosz Markowski | 34957b2 | 2013-10-15 09:55:31 +0200 | [diff] [blame] | 238 | .prb_tmpl_cmdid = WMI_CMD_UNSUPPORTED, |
Bartosz Markowski | b7e3adf | 2013-09-26 17:47:06 +0200 | [diff] [blame] | 239 | .addba_clear_resp_cmdid = WMI_10X_ADDBA_CLEAR_RESP_CMDID, |
| 240 | .addba_send_cmdid = WMI_10X_ADDBA_SEND_CMDID, |
| 241 | .addba_status_cmdid = WMI_10X_ADDBA_STATUS_CMDID, |
| 242 | .delba_send_cmdid = WMI_10X_DELBA_SEND_CMDID, |
| 243 | .addba_set_resp_cmdid = WMI_10X_ADDBA_SET_RESP_CMDID, |
| 244 | .send_singleamsdu_cmdid = WMI_10X_SEND_SINGLEAMSDU_CMDID, |
| 245 | .sta_powersave_mode_cmdid = WMI_10X_STA_POWERSAVE_MODE_CMDID, |
| 246 | .sta_powersave_param_cmdid = WMI_10X_STA_POWERSAVE_PARAM_CMDID, |
| 247 | .sta_mimo_ps_mode_cmdid = WMI_10X_STA_MIMO_PS_MODE_CMDID, |
| 248 | .pdev_dfs_enable_cmdid = WMI_10X_PDEV_DFS_ENABLE_CMDID, |
| 249 | .pdev_dfs_disable_cmdid = WMI_10X_PDEV_DFS_DISABLE_CMDID, |
| 250 | .roam_scan_mode = WMI_10X_ROAM_SCAN_MODE, |
| 251 | .roam_scan_rssi_threshold = WMI_10X_ROAM_SCAN_RSSI_THRESHOLD, |
| 252 | .roam_scan_period = WMI_10X_ROAM_SCAN_PERIOD, |
| 253 | .roam_scan_rssi_change_threshold = |
| 254 | WMI_10X_ROAM_SCAN_RSSI_CHANGE_THRESHOLD, |
| 255 | .roam_ap_profile = WMI_10X_ROAM_AP_PROFILE, |
| 256 | .ofl_scan_add_ap_profile = WMI_10X_OFL_SCAN_ADD_AP_PROFILE, |
| 257 | .ofl_scan_remove_ap_profile = WMI_10X_OFL_SCAN_REMOVE_AP_PROFILE, |
| 258 | .ofl_scan_period = WMI_10X_OFL_SCAN_PERIOD, |
| 259 | .p2p_dev_set_device_info = WMI_10X_P2P_DEV_SET_DEVICE_INFO, |
| 260 | .p2p_dev_set_discoverability = WMI_10X_P2P_DEV_SET_DISCOVERABILITY, |
| 261 | .p2p_go_set_beacon_ie = WMI_10X_P2P_GO_SET_BEACON_IE, |
| 262 | .p2p_go_set_probe_resp_ie = WMI_10X_P2P_GO_SET_PROBE_RESP_IE, |
Bartosz Markowski | 34957b2 | 2013-10-15 09:55:31 +0200 | [diff] [blame] | 263 | .p2p_set_vendor_ie_data_cmdid = WMI_CMD_UNSUPPORTED, |
Janusz Dziedzic | 542fb17 | 2014-01-17 14:08:08 +0100 | [diff] [blame] | 264 | .ap_ps_peer_param_cmdid = WMI_10X_AP_PS_PEER_PARAM_CMDID, |
Bartosz Markowski | 34957b2 | 2013-10-15 09:55:31 +0200 | [diff] [blame] | 265 | .ap_ps_peer_uapsd_coex_cmdid = WMI_CMD_UNSUPPORTED, |
Bartosz Markowski | b7e3adf | 2013-09-26 17:47:06 +0200 | [diff] [blame] | 266 | .peer_rate_retry_sched_cmdid = WMI_10X_PEER_RATE_RETRY_SCHED_CMDID, |
| 267 | .wlan_profile_trigger_cmdid = WMI_10X_WLAN_PROFILE_TRIGGER_CMDID, |
| 268 | .wlan_profile_set_hist_intvl_cmdid = |
| 269 | WMI_10X_WLAN_PROFILE_SET_HIST_INTVL_CMDID, |
| 270 | .wlan_profile_get_profile_data_cmdid = |
| 271 | WMI_10X_WLAN_PROFILE_GET_PROFILE_DATA_CMDID, |
| 272 | .wlan_profile_enable_profile_id_cmdid = |
| 273 | WMI_10X_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID, |
| 274 | .wlan_profile_list_profile_id_cmdid = |
| 275 | WMI_10X_WLAN_PROFILE_LIST_PROFILE_ID_CMDID, |
| 276 | .pdev_suspend_cmdid = WMI_10X_PDEV_SUSPEND_CMDID, |
| 277 | .pdev_resume_cmdid = WMI_10X_PDEV_RESUME_CMDID, |
| 278 | .add_bcn_filter_cmdid = WMI_10X_ADD_BCN_FILTER_CMDID, |
| 279 | .rmv_bcn_filter_cmdid = WMI_10X_RMV_BCN_FILTER_CMDID, |
| 280 | .wow_add_wake_pattern_cmdid = WMI_10X_WOW_ADD_WAKE_PATTERN_CMDID, |
| 281 | .wow_del_wake_pattern_cmdid = WMI_10X_WOW_DEL_WAKE_PATTERN_CMDID, |
| 282 | .wow_enable_disable_wake_event_cmdid = |
| 283 | WMI_10X_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID, |
| 284 | .wow_enable_cmdid = WMI_10X_WOW_ENABLE_CMDID, |
| 285 | .wow_hostwakeup_from_sleep_cmdid = |
| 286 | WMI_10X_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID, |
| 287 | .rtt_measreq_cmdid = WMI_10X_RTT_MEASREQ_CMDID, |
| 288 | .rtt_tsf_cmdid = WMI_10X_RTT_TSF_CMDID, |
| 289 | .vdev_spectral_scan_configure_cmdid = |
| 290 | WMI_10X_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID, |
| 291 | .vdev_spectral_scan_enable_cmdid = |
| 292 | WMI_10X_VDEV_SPECTRAL_SCAN_ENABLE_CMDID, |
| 293 | .request_stats_cmdid = WMI_10X_REQUEST_STATS_CMDID, |
Bartosz Markowski | 34957b2 | 2013-10-15 09:55:31 +0200 | [diff] [blame] | 294 | .set_arp_ns_offload_cmdid = WMI_CMD_UNSUPPORTED, |
| 295 | .network_list_offload_config_cmdid = WMI_CMD_UNSUPPORTED, |
| 296 | .gtk_offload_cmdid = WMI_CMD_UNSUPPORTED, |
| 297 | .csa_offload_enable_cmdid = WMI_CMD_UNSUPPORTED, |
| 298 | .csa_offload_chanswitch_cmdid = WMI_CMD_UNSUPPORTED, |
| 299 | .chatter_set_mode_cmdid = WMI_CMD_UNSUPPORTED, |
| 300 | .peer_tid_addba_cmdid = WMI_CMD_UNSUPPORTED, |
| 301 | .peer_tid_delba_cmdid = WMI_CMD_UNSUPPORTED, |
| 302 | .sta_dtim_ps_method_cmdid = WMI_CMD_UNSUPPORTED, |
| 303 | .sta_uapsd_auto_trig_cmdid = WMI_CMD_UNSUPPORTED, |
| 304 | .sta_keepalive_cmd = WMI_CMD_UNSUPPORTED, |
Bartosz Markowski | b7e3adf | 2013-09-26 17:47:06 +0200 | [diff] [blame] | 305 | .echo_cmdid = WMI_10X_ECHO_CMDID, |
| 306 | .pdev_utf_cmdid = WMI_10X_PDEV_UTF_CMDID, |
| 307 | .dbglog_cfg_cmdid = WMI_10X_DBGLOG_CFG_CMDID, |
| 308 | .pdev_qvit_cmdid = WMI_10X_PDEV_QVIT_CMDID, |
Bartosz Markowski | 34957b2 | 2013-10-15 09:55:31 +0200 | [diff] [blame] | 309 | .pdev_ftm_intg_cmdid = WMI_CMD_UNSUPPORTED, |
| 310 | .vdev_set_keepalive_cmdid = WMI_CMD_UNSUPPORTED, |
| 311 | .vdev_get_keepalive_cmdid = WMI_CMD_UNSUPPORTED, |
| 312 | .force_fw_hang_cmdid = WMI_CMD_UNSUPPORTED, |
Bartosz Markowski | b7e3adf | 2013-09-26 17:47:06 +0200 | [diff] [blame] | 313 | .gpio_config_cmdid = WMI_10X_GPIO_CONFIG_CMDID, |
| 314 | .gpio_output_cmdid = WMI_10X_GPIO_OUTPUT_CMDID, |
Rajkumar Manoharan | a57a6a2 | 2014-12-17 12:22:17 +0200 | [diff] [blame] | 315 | .pdev_get_temperature_cmdid = WMI_CMD_UNSUPPORTED, |
Raja Mani | 772b4ae | 2015-06-22 20:10:12 +0530 | [diff] [blame] | 316 | .scan_update_request_cmdid = WMI_CMD_UNSUPPORTED, |
| 317 | .vdev_standby_response_cmdid = WMI_CMD_UNSUPPORTED, |
| 318 | .vdev_resume_response_cmdid = WMI_CMD_UNSUPPORTED, |
| 319 | .wlan_peer_caching_add_peer_cmdid = WMI_CMD_UNSUPPORTED, |
| 320 | .wlan_peer_caching_evict_peer_cmdid = WMI_CMD_UNSUPPORTED, |
| 321 | .wlan_peer_caching_restore_peer_cmdid = WMI_CMD_UNSUPPORTED, |
| 322 | .wlan_peer_caching_print_all_peers_info_cmdid = WMI_CMD_UNSUPPORTED, |
| 323 | .peer_update_wds_entry_cmdid = WMI_CMD_UNSUPPORTED, |
| 324 | .peer_add_proxy_sta_entry_cmdid = WMI_CMD_UNSUPPORTED, |
| 325 | .rtt_keepalive_cmdid = WMI_CMD_UNSUPPORTED, |
| 326 | .oem_req_cmdid = WMI_CMD_UNSUPPORTED, |
| 327 | .nan_cmdid = WMI_CMD_UNSUPPORTED, |
| 328 | .vdev_ratemask_cmdid = WMI_CMD_UNSUPPORTED, |
| 329 | .qboost_cfg_cmdid = WMI_CMD_UNSUPPORTED, |
| 330 | .pdev_smart_ant_enable_cmdid = WMI_CMD_UNSUPPORTED, |
| 331 | .pdev_smart_ant_set_rx_antenna_cmdid = WMI_CMD_UNSUPPORTED, |
| 332 | .peer_smart_ant_set_tx_antenna_cmdid = WMI_CMD_UNSUPPORTED, |
| 333 | .peer_smart_ant_set_train_info_cmdid = WMI_CMD_UNSUPPORTED, |
| 334 | .peer_smart_ant_set_node_config_ops_cmdid = WMI_CMD_UNSUPPORTED, |
| 335 | .pdev_set_antenna_switch_table_cmdid = WMI_CMD_UNSUPPORTED, |
| 336 | .pdev_set_ctl_table_cmdid = WMI_CMD_UNSUPPORTED, |
| 337 | .pdev_set_mimogain_table_cmdid = WMI_CMD_UNSUPPORTED, |
| 338 | .pdev_ratepwr_table_cmdid = WMI_CMD_UNSUPPORTED, |
| 339 | .pdev_ratepwr_chainmsk_table_cmdid = WMI_CMD_UNSUPPORTED, |
| 340 | .pdev_fips_cmdid = WMI_CMD_UNSUPPORTED, |
| 341 | .tt_set_conf_cmdid = WMI_CMD_UNSUPPORTED, |
| 342 | .fwtest_cmdid = WMI_CMD_UNSUPPORTED, |
| 343 | .vdev_atf_request_cmdid = WMI_CMD_UNSUPPORTED, |
| 344 | .peer_atf_request_cmdid = WMI_CMD_UNSUPPORTED, |
| 345 | .pdev_get_ani_cck_config_cmdid = WMI_CMD_UNSUPPORTED, |
| 346 | .pdev_get_ani_ofdm_config_cmdid = WMI_CMD_UNSUPPORTED, |
| 347 | .pdev_reserve_ast_entry_cmdid = WMI_CMD_UNSUPPORTED, |
| 348 | .pdev_get_nfcal_power_cmdid = WMI_CMD_UNSUPPORTED, |
| 349 | .pdev_get_tpc_cmdid = WMI_CMD_UNSUPPORTED, |
| 350 | .pdev_get_ast_info_cmdid = WMI_CMD_UNSUPPORTED, |
| 351 | .vdev_set_dscp_tid_map_cmdid = WMI_CMD_UNSUPPORTED, |
| 352 | .pdev_get_info_cmdid = WMI_CMD_UNSUPPORTED, |
| 353 | .vdev_get_info_cmdid = WMI_CMD_UNSUPPORTED, |
| 354 | .vdev_filter_neighbor_rx_packets_cmdid = WMI_CMD_UNSUPPORTED, |
| 355 | .mu_cal_start_cmdid = WMI_CMD_UNSUPPORTED, |
| 356 | .set_cca_params_cmdid = WMI_CMD_UNSUPPORTED, |
| 357 | .pdev_bss_chan_info_request_cmdid = WMI_CMD_UNSUPPORTED, |
Bartosz Markowski | b7e3adf | 2013-09-26 17:47:06 +0200 | [diff] [blame] | 358 | }; |
Bartosz Markowski | ce42870 | 2013-09-26 17:47:05 +0200 | [diff] [blame] | 359 | |
Rajkumar Manoharan | 4a16fbe | 2014-12-17 12:21:12 +0200 | [diff] [blame] | 360 | /* 10.2.4 WMI cmd track */ |
| 361 | static struct wmi_cmd_map wmi_10_2_4_cmd_map = { |
| 362 | .init_cmdid = WMI_10_2_INIT_CMDID, |
| 363 | .start_scan_cmdid = WMI_10_2_START_SCAN_CMDID, |
| 364 | .stop_scan_cmdid = WMI_10_2_STOP_SCAN_CMDID, |
| 365 | .scan_chan_list_cmdid = WMI_10_2_SCAN_CHAN_LIST_CMDID, |
| 366 | .scan_sch_prio_tbl_cmdid = WMI_CMD_UNSUPPORTED, |
| 367 | .pdev_set_regdomain_cmdid = WMI_10_2_PDEV_SET_REGDOMAIN_CMDID, |
| 368 | .pdev_set_channel_cmdid = WMI_10_2_PDEV_SET_CHANNEL_CMDID, |
| 369 | .pdev_set_param_cmdid = WMI_10_2_PDEV_SET_PARAM_CMDID, |
| 370 | .pdev_pktlog_enable_cmdid = WMI_10_2_PDEV_PKTLOG_ENABLE_CMDID, |
| 371 | .pdev_pktlog_disable_cmdid = WMI_10_2_PDEV_PKTLOG_DISABLE_CMDID, |
| 372 | .pdev_set_wmm_params_cmdid = WMI_10_2_PDEV_SET_WMM_PARAMS_CMDID, |
| 373 | .pdev_set_ht_cap_ie_cmdid = WMI_10_2_PDEV_SET_HT_CAP_IE_CMDID, |
| 374 | .pdev_set_vht_cap_ie_cmdid = WMI_10_2_PDEV_SET_VHT_CAP_IE_CMDID, |
| 375 | .pdev_set_quiet_mode_cmdid = WMI_10_2_PDEV_SET_QUIET_MODE_CMDID, |
| 376 | .pdev_green_ap_ps_enable_cmdid = WMI_10_2_PDEV_GREEN_AP_PS_ENABLE_CMDID, |
| 377 | .pdev_get_tpc_config_cmdid = WMI_10_2_PDEV_GET_TPC_CONFIG_CMDID, |
| 378 | .pdev_set_base_macaddr_cmdid = WMI_10_2_PDEV_SET_BASE_MACADDR_CMDID, |
| 379 | .vdev_create_cmdid = WMI_10_2_VDEV_CREATE_CMDID, |
| 380 | .vdev_delete_cmdid = WMI_10_2_VDEV_DELETE_CMDID, |
| 381 | .vdev_start_request_cmdid = WMI_10_2_VDEV_START_REQUEST_CMDID, |
| 382 | .vdev_restart_request_cmdid = WMI_10_2_VDEV_RESTART_REQUEST_CMDID, |
| 383 | .vdev_up_cmdid = WMI_10_2_VDEV_UP_CMDID, |
| 384 | .vdev_stop_cmdid = WMI_10_2_VDEV_STOP_CMDID, |
| 385 | .vdev_down_cmdid = WMI_10_2_VDEV_DOWN_CMDID, |
| 386 | .vdev_set_param_cmdid = WMI_10_2_VDEV_SET_PARAM_CMDID, |
| 387 | .vdev_install_key_cmdid = WMI_10_2_VDEV_INSTALL_KEY_CMDID, |
| 388 | .peer_create_cmdid = WMI_10_2_PEER_CREATE_CMDID, |
| 389 | .peer_delete_cmdid = WMI_10_2_PEER_DELETE_CMDID, |
| 390 | .peer_flush_tids_cmdid = WMI_10_2_PEER_FLUSH_TIDS_CMDID, |
| 391 | .peer_set_param_cmdid = WMI_10_2_PEER_SET_PARAM_CMDID, |
| 392 | .peer_assoc_cmdid = WMI_10_2_PEER_ASSOC_CMDID, |
| 393 | .peer_add_wds_entry_cmdid = WMI_10_2_PEER_ADD_WDS_ENTRY_CMDID, |
| 394 | .peer_remove_wds_entry_cmdid = WMI_10_2_PEER_REMOVE_WDS_ENTRY_CMDID, |
| 395 | .peer_mcast_group_cmdid = WMI_10_2_PEER_MCAST_GROUP_CMDID, |
| 396 | .bcn_tx_cmdid = WMI_10_2_BCN_TX_CMDID, |
| 397 | .pdev_send_bcn_cmdid = WMI_10_2_PDEV_SEND_BCN_CMDID, |
| 398 | .bcn_tmpl_cmdid = WMI_CMD_UNSUPPORTED, |
| 399 | .bcn_filter_rx_cmdid = WMI_10_2_BCN_FILTER_RX_CMDID, |
| 400 | .prb_req_filter_rx_cmdid = WMI_10_2_PRB_REQ_FILTER_RX_CMDID, |
| 401 | .mgmt_tx_cmdid = WMI_10_2_MGMT_TX_CMDID, |
| 402 | .prb_tmpl_cmdid = WMI_CMD_UNSUPPORTED, |
| 403 | .addba_clear_resp_cmdid = WMI_10_2_ADDBA_CLEAR_RESP_CMDID, |
| 404 | .addba_send_cmdid = WMI_10_2_ADDBA_SEND_CMDID, |
| 405 | .addba_status_cmdid = WMI_10_2_ADDBA_STATUS_CMDID, |
| 406 | .delba_send_cmdid = WMI_10_2_DELBA_SEND_CMDID, |
| 407 | .addba_set_resp_cmdid = WMI_10_2_ADDBA_SET_RESP_CMDID, |
| 408 | .send_singleamsdu_cmdid = WMI_10_2_SEND_SINGLEAMSDU_CMDID, |
| 409 | .sta_powersave_mode_cmdid = WMI_10_2_STA_POWERSAVE_MODE_CMDID, |
| 410 | .sta_powersave_param_cmdid = WMI_10_2_STA_POWERSAVE_PARAM_CMDID, |
| 411 | .sta_mimo_ps_mode_cmdid = WMI_10_2_STA_MIMO_PS_MODE_CMDID, |
| 412 | .pdev_dfs_enable_cmdid = WMI_10_2_PDEV_DFS_ENABLE_CMDID, |
| 413 | .pdev_dfs_disable_cmdid = WMI_10_2_PDEV_DFS_DISABLE_CMDID, |
| 414 | .roam_scan_mode = WMI_10_2_ROAM_SCAN_MODE, |
| 415 | .roam_scan_rssi_threshold = WMI_10_2_ROAM_SCAN_RSSI_THRESHOLD, |
| 416 | .roam_scan_period = WMI_10_2_ROAM_SCAN_PERIOD, |
| 417 | .roam_scan_rssi_change_threshold = |
| 418 | WMI_10_2_ROAM_SCAN_RSSI_CHANGE_THRESHOLD, |
| 419 | .roam_ap_profile = WMI_10_2_ROAM_AP_PROFILE, |
| 420 | .ofl_scan_add_ap_profile = WMI_10_2_OFL_SCAN_ADD_AP_PROFILE, |
| 421 | .ofl_scan_remove_ap_profile = WMI_10_2_OFL_SCAN_REMOVE_AP_PROFILE, |
| 422 | .ofl_scan_period = WMI_10_2_OFL_SCAN_PERIOD, |
| 423 | .p2p_dev_set_device_info = WMI_10_2_P2P_DEV_SET_DEVICE_INFO, |
| 424 | .p2p_dev_set_discoverability = WMI_10_2_P2P_DEV_SET_DISCOVERABILITY, |
| 425 | .p2p_go_set_beacon_ie = WMI_10_2_P2P_GO_SET_BEACON_IE, |
| 426 | .p2p_go_set_probe_resp_ie = WMI_10_2_P2P_GO_SET_PROBE_RESP_IE, |
| 427 | .p2p_set_vendor_ie_data_cmdid = WMI_CMD_UNSUPPORTED, |
| 428 | .ap_ps_peer_param_cmdid = WMI_10_2_AP_PS_PEER_PARAM_CMDID, |
| 429 | .ap_ps_peer_uapsd_coex_cmdid = WMI_CMD_UNSUPPORTED, |
| 430 | .peer_rate_retry_sched_cmdid = WMI_10_2_PEER_RATE_RETRY_SCHED_CMDID, |
| 431 | .wlan_profile_trigger_cmdid = WMI_10_2_WLAN_PROFILE_TRIGGER_CMDID, |
| 432 | .wlan_profile_set_hist_intvl_cmdid = |
| 433 | WMI_10_2_WLAN_PROFILE_SET_HIST_INTVL_CMDID, |
| 434 | .wlan_profile_get_profile_data_cmdid = |
| 435 | WMI_10_2_WLAN_PROFILE_GET_PROFILE_DATA_CMDID, |
| 436 | .wlan_profile_enable_profile_id_cmdid = |
| 437 | WMI_10_2_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID, |
| 438 | .wlan_profile_list_profile_id_cmdid = |
| 439 | WMI_10_2_WLAN_PROFILE_LIST_PROFILE_ID_CMDID, |
| 440 | .pdev_suspend_cmdid = WMI_10_2_PDEV_SUSPEND_CMDID, |
| 441 | .pdev_resume_cmdid = WMI_10_2_PDEV_RESUME_CMDID, |
| 442 | .add_bcn_filter_cmdid = WMI_10_2_ADD_BCN_FILTER_CMDID, |
| 443 | .rmv_bcn_filter_cmdid = WMI_10_2_RMV_BCN_FILTER_CMDID, |
| 444 | .wow_add_wake_pattern_cmdid = WMI_10_2_WOW_ADD_WAKE_PATTERN_CMDID, |
| 445 | .wow_del_wake_pattern_cmdid = WMI_10_2_WOW_DEL_WAKE_PATTERN_CMDID, |
| 446 | .wow_enable_disable_wake_event_cmdid = |
| 447 | WMI_10_2_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID, |
| 448 | .wow_enable_cmdid = WMI_10_2_WOW_ENABLE_CMDID, |
| 449 | .wow_hostwakeup_from_sleep_cmdid = |
| 450 | WMI_10_2_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID, |
| 451 | .rtt_measreq_cmdid = WMI_10_2_RTT_MEASREQ_CMDID, |
| 452 | .rtt_tsf_cmdid = WMI_10_2_RTT_TSF_CMDID, |
| 453 | .vdev_spectral_scan_configure_cmdid = |
| 454 | WMI_10_2_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID, |
| 455 | .vdev_spectral_scan_enable_cmdid = |
| 456 | WMI_10_2_VDEV_SPECTRAL_SCAN_ENABLE_CMDID, |
| 457 | .request_stats_cmdid = WMI_10_2_REQUEST_STATS_CMDID, |
| 458 | .set_arp_ns_offload_cmdid = WMI_CMD_UNSUPPORTED, |
| 459 | .network_list_offload_config_cmdid = WMI_CMD_UNSUPPORTED, |
| 460 | .gtk_offload_cmdid = WMI_CMD_UNSUPPORTED, |
| 461 | .csa_offload_enable_cmdid = WMI_CMD_UNSUPPORTED, |
| 462 | .csa_offload_chanswitch_cmdid = WMI_CMD_UNSUPPORTED, |
| 463 | .chatter_set_mode_cmdid = WMI_CMD_UNSUPPORTED, |
| 464 | .peer_tid_addba_cmdid = WMI_CMD_UNSUPPORTED, |
| 465 | .peer_tid_delba_cmdid = WMI_CMD_UNSUPPORTED, |
| 466 | .sta_dtim_ps_method_cmdid = WMI_CMD_UNSUPPORTED, |
| 467 | .sta_uapsd_auto_trig_cmdid = WMI_CMD_UNSUPPORTED, |
| 468 | .sta_keepalive_cmd = WMI_CMD_UNSUPPORTED, |
| 469 | .echo_cmdid = WMI_10_2_ECHO_CMDID, |
| 470 | .pdev_utf_cmdid = WMI_10_2_PDEV_UTF_CMDID, |
| 471 | .dbglog_cfg_cmdid = WMI_10_2_DBGLOG_CFG_CMDID, |
| 472 | .pdev_qvit_cmdid = WMI_10_2_PDEV_QVIT_CMDID, |
| 473 | .pdev_ftm_intg_cmdid = WMI_CMD_UNSUPPORTED, |
| 474 | .vdev_set_keepalive_cmdid = WMI_CMD_UNSUPPORTED, |
| 475 | .vdev_get_keepalive_cmdid = WMI_CMD_UNSUPPORTED, |
| 476 | .force_fw_hang_cmdid = WMI_CMD_UNSUPPORTED, |
| 477 | .gpio_config_cmdid = WMI_10_2_GPIO_CONFIG_CMDID, |
| 478 | .gpio_output_cmdid = WMI_10_2_GPIO_OUTPUT_CMDID, |
Rajkumar Manoharan | a57a6a2 | 2014-12-17 12:22:17 +0200 | [diff] [blame] | 479 | .pdev_get_temperature_cmdid = WMI_10_2_PDEV_GET_TEMPERATURE_CMDID, |
Raja Mani | 772b4ae | 2015-06-22 20:10:12 +0530 | [diff] [blame] | 480 | .scan_update_request_cmdid = WMI_CMD_UNSUPPORTED, |
| 481 | .vdev_standby_response_cmdid = WMI_CMD_UNSUPPORTED, |
| 482 | .vdev_resume_response_cmdid = WMI_CMD_UNSUPPORTED, |
| 483 | .wlan_peer_caching_add_peer_cmdid = WMI_CMD_UNSUPPORTED, |
| 484 | .wlan_peer_caching_evict_peer_cmdid = WMI_CMD_UNSUPPORTED, |
| 485 | .wlan_peer_caching_restore_peer_cmdid = WMI_CMD_UNSUPPORTED, |
| 486 | .wlan_peer_caching_print_all_peers_info_cmdid = WMI_CMD_UNSUPPORTED, |
| 487 | .peer_update_wds_entry_cmdid = WMI_CMD_UNSUPPORTED, |
| 488 | .peer_add_proxy_sta_entry_cmdid = WMI_CMD_UNSUPPORTED, |
| 489 | .rtt_keepalive_cmdid = WMI_CMD_UNSUPPORTED, |
| 490 | .oem_req_cmdid = WMI_CMD_UNSUPPORTED, |
| 491 | .nan_cmdid = WMI_CMD_UNSUPPORTED, |
| 492 | .vdev_ratemask_cmdid = WMI_CMD_UNSUPPORTED, |
| 493 | .qboost_cfg_cmdid = WMI_CMD_UNSUPPORTED, |
| 494 | .pdev_smart_ant_enable_cmdid = WMI_CMD_UNSUPPORTED, |
| 495 | .pdev_smart_ant_set_rx_antenna_cmdid = WMI_CMD_UNSUPPORTED, |
| 496 | .peer_smart_ant_set_tx_antenna_cmdid = WMI_CMD_UNSUPPORTED, |
| 497 | .peer_smart_ant_set_train_info_cmdid = WMI_CMD_UNSUPPORTED, |
| 498 | .peer_smart_ant_set_node_config_ops_cmdid = WMI_CMD_UNSUPPORTED, |
| 499 | .pdev_set_antenna_switch_table_cmdid = WMI_CMD_UNSUPPORTED, |
| 500 | .pdev_set_ctl_table_cmdid = WMI_CMD_UNSUPPORTED, |
| 501 | .pdev_set_mimogain_table_cmdid = WMI_CMD_UNSUPPORTED, |
| 502 | .pdev_ratepwr_table_cmdid = WMI_CMD_UNSUPPORTED, |
| 503 | .pdev_ratepwr_chainmsk_table_cmdid = WMI_CMD_UNSUPPORTED, |
| 504 | .pdev_fips_cmdid = WMI_CMD_UNSUPPORTED, |
| 505 | .tt_set_conf_cmdid = WMI_CMD_UNSUPPORTED, |
| 506 | .fwtest_cmdid = WMI_CMD_UNSUPPORTED, |
| 507 | .vdev_atf_request_cmdid = WMI_CMD_UNSUPPORTED, |
| 508 | .peer_atf_request_cmdid = WMI_CMD_UNSUPPORTED, |
| 509 | .pdev_get_ani_cck_config_cmdid = WMI_CMD_UNSUPPORTED, |
| 510 | .pdev_get_ani_ofdm_config_cmdid = WMI_CMD_UNSUPPORTED, |
| 511 | .pdev_reserve_ast_entry_cmdid = WMI_CMD_UNSUPPORTED, |
| 512 | .pdev_get_nfcal_power_cmdid = WMI_CMD_UNSUPPORTED, |
| 513 | .pdev_get_tpc_cmdid = WMI_CMD_UNSUPPORTED, |
| 514 | .pdev_get_ast_info_cmdid = WMI_CMD_UNSUPPORTED, |
| 515 | .vdev_set_dscp_tid_map_cmdid = WMI_CMD_UNSUPPORTED, |
| 516 | .pdev_get_info_cmdid = WMI_CMD_UNSUPPORTED, |
| 517 | .vdev_get_info_cmdid = WMI_CMD_UNSUPPORTED, |
| 518 | .vdev_filter_neighbor_rx_packets_cmdid = WMI_CMD_UNSUPPORTED, |
| 519 | .mu_cal_start_cmdid = WMI_CMD_UNSUPPORTED, |
| 520 | .set_cca_params_cmdid = WMI_CMD_UNSUPPORTED, |
| 521 | .pdev_bss_chan_info_request_cmdid = WMI_CMD_UNSUPPORTED, |
Rajkumar Manoharan | 4a16fbe | 2014-12-17 12:21:12 +0200 | [diff] [blame] | 522 | }; |
| 523 | |
Raja Mani | 2d491e6 | 2015-06-22 20:10:11 +0530 | [diff] [blame] | 524 | /* 10.4 WMI cmd track */ |
| 525 | static struct wmi_cmd_map wmi_10_4_cmd_map = { |
| 526 | .init_cmdid = WMI_10_4_INIT_CMDID, |
| 527 | .start_scan_cmdid = WMI_10_4_START_SCAN_CMDID, |
| 528 | .stop_scan_cmdid = WMI_10_4_STOP_SCAN_CMDID, |
| 529 | .scan_chan_list_cmdid = WMI_10_4_SCAN_CHAN_LIST_CMDID, |
| 530 | .scan_sch_prio_tbl_cmdid = WMI_10_4_SCAN_SCH_PRIO_TBL_CMDID, |
| 531 | .pdev_set_regdomain_cmdid = WMI_10_4_PDEV_SET_REGDOMAIN_CMDID, |
| 532 | .pdev_set_channel_cmdid = WMI_10_4_PDEV_SET_CHANNEL_CMDID, |
| 533 | .pdev_set_param_cmdid = WMI_10_4_PDEV_SET_PARAM_CMDID, |
| 534 | .pdev_pktlog_enable_cmdid = WMI_10_4_PDEV_PKTLOG_ENABLE_CMDID, |
| 535 | .pdev_pktlog_disable_cmdid = WMI_10_4_PDEV_PKTLOG_DISABLE_CMDID, |
| 536 | .pdev_set_wmm_params_cmdid = WMI_10_4_PDEV_SET_WMM_PARAMS_CMDID, |
| 537 | .pdev_set_ht_cap_ie_cmdid = WMI_10_4_PDEV_SET_HT_CAP_IE_CMDID, |
| 538 | .pdev_set_vht_cap_ie_cmdid = WMI_10_4_PDEV_SET_VHT_CAP_IE_CMDID, |
| 539 | .pdev_set_dscp_tid_map_cmdid = WMI_10_4_PDEV_SET_DSCP_TID_MAP_CMDID, |
| 540 | .pdev_set_quiet_mode_cmdid = WMI_10_4_PDEV_SET_QUIET_MODE_CMDID, |
| 541 | .pdev_green_ap_ps_enable_cmdid = WMI_10_4_PDEV_GREEN_AP_PS_ENABLE_CMDID, |
| 542 | .pdev_get_tpc_config_cmdid = WMI_10_4_PDEV_GET_TPC_CONFIG_CMDID, |
| 543 | .pdev_set_base_macaddr_cmdid = WMI_10_4_PDEV_SET_BASE_MACADDR_CMDID, |
| 544 | .vdev_create_cmdid = WMI_10_4_VDEV_CREATE_CMDID, |
| 545 | .vdev_delete_cmdid = WMI_10_4_VDEV_DELETE_CMDID, |
| 546 | .vdev_start_request_cmdid = WMI_10_4_VDEV_START_REQUEST_CMDID, |
| 547 | .vdev_restart_request_cmdid = WMI_10_4_VDEV_RESTART_REQUEST_CMDID, |
| 548 | .vdev_up_cmdid = WMI_10_4_VDEV_UP_CMDID, |
| 549 | .vdev_stop_cmdid = WMI_10_4_VDEV_STOP_CMDID, |
| 550 | .vdev_down_cmdid = WMI_10_4_VDEV_DOWN_CMDID, |
| 551 | .vdev_set_param_cmdid = WMI_10_4_VDEV_SET_PARAM_CMDID, |
| 552 | .vdev_install_key_cmdid = WMI_10_4_VDEV_INSTALL_KEY_CMDID, |
| 553 | .peer_create_cmdid = WMI_10_4_PEER_CREATE_CMDID, |
| 554 | .peer_delete_cmdid = WMI_10_4_PEER_DELETE_CMDID, |
| 555 | .peer_flush_tids_cmdid = WMI_10_4_PEER_FLUSH_TIDS_CMDID, |
| 556 | .peer_set_param_cmdid = WMI_10_4_PEER_SET_PARAM_CMDID, |
| 557 | .peer_assoc_cmdid = WMI_10_4_PEER_ASSOC_CMDID, |
| 558 | .peer_add_wds_entry_cmdid = WMI_10_4_PEER_ADD_WDS_ENTRY_CMDID, |
| 559 | .peer_remove_wds_entry_cmdid = WMI_10_4_PEER_REMOVE_WDS_ENTRY_CMDID, |
| 560 | .peer_mcast_group_cmdid = WMI_10_4_PEER_MCAST_GROUP_CMDID, |
| 561 | .bcn_tx_cmdid = WMI_10_4_BCN_TX_CMDID, |
| 562 | .pdev_send_bcn_cmdid = WMI_10_4_PDEV_SEND_BCN_CMDID, |
| 563 | .bcn_tmpl_cmdid = WMI_10_4_BCN_PRB_TMPL_CMDID, |
| 564 | .bcn_filter_rx_cmdid = WMI_10_4_BCN_FILTER_RX_CMDID, |
| 565 | .prb_req_filter_rx_cmdid = WMI_10_4_PRB_REQ_FILTER_RX_CMDID, |
| 566 | .mgmt_tx_cmdid = WMI_10_4_MGMT_TX_CMDID, |
| 567 | .prb_tmpl_cmdid = WMI_10_4_PRB_TMPL_CMDID, |
| 568 | .addba_clear_resp_cmdid = WMI_10_4_ADDBA_CLEAR_RESP_CMDID, |
| 569 | .addba_send_cmdid = WMI_10_4_ADDBA_SEND_CMDID, |
| 570 | .addba_status_cmdid = WMI_10_4_ADDBA_STATUS_CMDID, |
| 571 | .delba_send_cmdid = WMI_10_4_DELBA_SEND_CMDID, |
| 572 | .addba_set_resp_cmdid = WMI_10_4_ADDBA_SET_RESP_CMDID, |
| 573 | .send_singleamsdu_cmdid = WMI_10_4_SEND_SINGLEAMSDU_CMDID, |
| 574 | .sta_powersave_mode_cmdid = WMI_10_4_STA_POWERSAVE_MODE_CMDID, |
| 575 | .sta_powersave_param_cmdid = WMI_10_4_STA_POWERSAVE_PARAM_CMDID, |
| 576 | .sta_mimo_ps_mode_cmdid = WMI_10_4_STA_MIMO_PS_MODE_CMDID, |
| 577 | .pdev_dfs_enable_cmdid = WMI_10_4_PDEV_DFS_ENABLE_CMDID, |
| 578 | .pdev_dfs_disable_cmdid = WMI_10_4_PDEV_DFS_DISABLE_CMDID, |
| 579 | .roam_scan_mode = WMI_10_4_ROAM_SCAN_MODE, |
| 580 | .roam_scan_rssi_threshold = WMI_10_4_ROAM_SCAN_RSSI_THRESHOLD, |
| 581 | .roam_scan_period = WMI_10_4_ROAM_SCAN_PERIOD, |
| 582 | .roam_scan_rssi_change_threshold = |
| 583 | WMI_10_4_ROAM_SCAN_RSSI_CHANGE_THRESHOLD, |
| 584 | .roam_ap_profile = WMI_10_4_ROAM_AP_PROFILE, |
| 585 | .ofl_scan_add_ap_profile = WMI_10_4_OFL_SCAN_ADD_AP_PROFILE, |
| 586 | .ofl_scan_remove_ap_profile = WMI_10_4_OFL_SCAN_REMOVE_AP_PROFILE, |
| 587 | .ofl_scan_period = WMI_10_4_OFL_SCAN_PERIOD, |
| 588 | .p2p_dev_set_device_info = WMI_10_4_P2P_DEV_SET_DEVICE_INFO, |
| 589 | .p2p_dev_set_discoverability = WMI_10_4_P2P_DEV_SET_DISCOVERABILITY, |
| 590 | .p2p_go_set_beacon_ie = WMI_10_4_P2P_GO_SET_BEACON_IE, |
| 591 | .p2p_go_set_probe_resp_ie = WMI_10_4_P2P_GO_SET_PROBE_RESP_IE, |
| 592 | .p2p_set_vendor_ie_data_cmdid = WMI_10_4_P2P_SET_VENDOR_IE_DATA_CMDID, |
| 593 | .ap_ps_peer_param_cmdid = WMI_10_4_AP_PS_PEER_PARAM_CMDID, |
| 594 | .ap_ps_peer_uapsd_coex_cmdid = WMI_10_4_AP_PS_PEER_UAPSD_COEX_CMDID, |
| 595 | .peer_rate_retry_sched_cmdid = WMI_10_4_PEER_RATE_RETRY_SCHED_CMDID, |
| 596 | .wlan_profile_trigger_cmdid = WMI_10_4_WLAN_PROFILE_TRIGGER_CMDID, |
| 597 | .wlan_profile_set_hist_intvl_cmdid = |
| 598 | WMI_10_4_WLAN_PROFILE_SET_HIST_INTVL_CMDID, |
| 599 | .wlan_profile_get_profile_data_cmdid = |
| 600 | WMI_10_4_WLAN_PROFILE_GET_PROFILE_DATA_CMDID, |
| 601 | .wlan_profile_enable_profile_id_cmdid = |
| 602 | WMI_10_4_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID, |
| 603 | .wlan_profile_list_profile_id_cmdid = |
| 604 | WMI_10_4_WLAN_PROFILE_LIST_PROFILE_ID_CMDID, |
| 605 | .pdev_suspend_cmdid = WMI_10_4_PDEV_SUSPEND_CMDID, |
| 606 | .pdev_resume_cmdid = WMI_10_4_PDEV_RESUME_CMDID, |
| 607 | .add_bcn_filter_cmdid = WMI_10_4_ADD_BCN_FILTER_CMDID, |
| 608 | .rmv_bcn_filter_cmdid = WMI_10_4_RMV_BCN_FILTER_CMDID, |
| 609 | .wow_add_wake_pattern_cmdid = WMI_10_4_WOW_ADD_WAKE_PATTERN_CMDID, |
| 610 | .wow_del_wake_pattern_cmdid = WMI_10_4_WOW_DEL_WAKE_PATTERN_CMDID, |
| 611 | .wow_enable_disable_wake_event_cmdid = |
| 612 | WMI_10_4_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID, |
| 613 | .wow_enable_cmdid = WMI_10_4_WOW_ENABLE_CMDID, |
| 614 | .wow_hostwakeup_from_sleep_cmdid = |
| 615 | WMI_10_4_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID, |
| 616 | .rtt_measreq_cmdid = WMI_10_4_RTT_MEASREQ_CMDID, |
| 617 | .rtt_tsf_cmdid = WMI_10_4_RTT_TSF_CMDID, |
| 618 | .vdev_spectral_scan_configure_cmdid = |
| 619 | WMI_10_4_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID, |
| 620 | .vdev_spectral_scan_enable_cmdid = |
| 621 | WMI_10_4_VDEV_SPECTRAL_SCAN_ENABLE_CMDID, |
| 622 | .request_stats_cmdid = WMI_10_4_REQUEST_STATS_CMDID, |
| 623 | .set_arp_ns_offload_cmdid = WMI_CMD_UNSUPPORTED, |
| 624 | .network_list_offload_config_cmdid = WMI_CMD_UNSUPPORTED, |
| 625 | .gtk_offload_cmdid = WMI_10_4_GTK_OFFLOAD_CMDID, |
| 626 | .csa_offload_enable_cmdid = WMI_10_4_CSA_OFFLOAD_ENABLE_CMDID, |
| 627 | .csa_offload_chanswitch_cmdid = WMI_10_4_CSA_OFFLOAD_CHANSWITCH_CMDID, |
| 628 | .chatter_set_mode_cmdid = WMI_CMD_UNSUPPORTED, |
| 629 | .peer_tid_addba_cmdid = WMI_CMD_UNSUPPORTED, |
| 630 | .peer_tid_delba_cmdid = WMI_CMD_UNSUPPORTED, |
| 631 | .sta_dtim_ps_method_cmdid = WMI_CMD_UNSUPPORTED, |
| 632 | .sta_uapsd_auto_trig_cmdid = WMI_CMD_UNSUPPORTED, |
| 633 | .sta_keepalive_cmd = WMI_CMD_UNSUPPORTED, |
| 634 | .echo_cmdid = WMI_10_4_ECHO_CMDID, |
| 635 | .pdev_utf_cmdid = WMI_10_4_PDEV_UTF_CMDID, |
| 636 | .dbglog_cfg_cmdid = WMI_10_4_DBGLOG_CFG_CMDID, |
| 637 | .pdev_qvit_cmdid = WMI_10_4_PDEV_QVIT_CMDID, |
| 638 | .pdev_ftm_intg_cmdid = WMI_CMD_UNSUPPORTED, |
| 639 | .vdev_set_keepalive_cmdid = WMI_10_4_VDEV_SET_KEEPALIVE_CMDID, |
| 640 | .vdev_get_keepalive_cmdid = WMI_10_4_VDEV_GET_KEEPALIVE_CMDID, |
| 641 | .force_fw_hang_cmdid = WMI_10_4_FORCE_FW_HANG_CMDID, |
| 642 | .gpio_config_cmdid = WMI_10_4_GPIO_CONFIG_CMDID, |
| 643 | .gpio_output_cmdid = WMI_10_4_GPIO_OUTPUT_CMDID, |
| 644 | .pdev_get_temperature_cmdid = WMI_10_4_PDEV_GET_TEMPERATURE_CMDID, |
| 645 | .vdev_set_wmm_params_cmdid = WMI_CMD_UNSUPPORTED, |
| 646 | .tdls_set_state_cmdid = WMI_CMD_UNSUPPORTED, |
| 647 | .tdls_peer_update_cmdid = WMI_CMD_UNSUPPORTED, |
| 648 | .adaptive_qcs_cmdid = WMI_CMD_UNSUPPORTED, |
| 649 | .scan_update_request_cmdid = WMI_10_4_SCAN_UPDATE_REQUEST_CMDID, |
| 650 | .vdev_standby_response_cmdid = WMI_10_4_VDEV_STANDBY_RESPONSE_CMDID, |
| 651 | .vdev_resume_response_cmdid = WMI_10_4_VDEV_RESUME_RESPONSE_CMDID, |
| 652 | .wlan_peer_caching_add_peer_cmdid = |
| 653 | WMI_10_4_WLAN_PEER_CACHING_ADD_PEER_CMDID, |
| 654 | .wlan_peer_caching_evict_peer_cmdid = |
| 655 | WMI_10_4_WLAN_PEER_CACHING_EVICT_PEER_CMDID, |
| 656 | .wlan_peer_caching_restore_peer_cmdid = |
| 657 | WMI_10_4_WLAN_PEER_CACHING_RESTORE_PEER_CMDID, |
| 658 | .wlan_peer_caching_print_all_peers_info_cmdid = |
| 659 | WMI_10_4_WLAN_PEER_CACHING_PRINT_ALL_PEERS_INFO_CMDID, |
| 660 | .peer_update_wds_entry_cmdid = WMI_10_4_PEER_UPDATE_WDS_ENTRY_CMDID, |
| 661 | .peer_add_proxy_sta_entry_cmdid = |
| 662 | WMI_10_4_PEER_ADD_PROXY_STA_ENTRY_CMDID, |
| 663 | .rtt_keepalive_cmdid = WMI_10_4_RTT_KEEPALIVE_CMDID, |
| 664 | .oem_req_cmdid = WMI_10_4_OEM_REQ_CMDID, |
| 665 | .nan_cmdid = WMI_10_4_NAN_CMDID, |
| 666 | .vdev_ratemask_cmdid = WMI_10_4_VDEV_RATEMASK_CMDID, |
| 667 | .qboost_cfg_cmdid = WMI_10_4_QBOOST_CFG_CMDID, |
| 668 | .pdev_smart_ant_enable_cmdid = WMI_10_4_PDEV_SMART_ANT_ENABLE_CMDID, |
| 669 | .pdev_smart_ant_set_rx_antenna_cmdid = |
| 670 | WMI_10_4_PDEV_SMART_ANT_SET_RX_ANTENNA_CMDID, |
| 671 | .peer_smart_ant_set_tx_antenna_cmdid = |
| 672 | WMI_10_4_PEER_SMART_ANT_SET_TX_ANTENNA_CMDID, |
| 673 | .peer_smart_ant_set_train_info_cmdid = |
| 674 | WMI_10_4_PEER_SMART_ANT_SET_TRAIN_INFO_CMDID, |
| 675 | .peer_smart_ant_set_node_config_ops_cmdid = |
| 676 | WMI_10_4_PEER_SMART_ANT_SET_NODE_CONFIG_OPS_CMDID, |
| 677 | .pdev_set_antenna_switch_table_cmdid = |
| 678 | WMI_10_4_PDEV_SET_ANTENNA_SWITCH_TABLE_CMDID, |
| 679 | .pdev_set_ctl_table_cmdid = WMI_10_4_PDEV_SET_CTL_TABLE_CMDID, |
| 680 | .pdev_set_mimogain_table_cmdid = WMI_10_4_PDEV_SET_MIMOGAIN_TABLE_CMDID, |
| 681 | .pdev_ratepwr_table_cmdid = WMI_10_4_PDEV_RATEPWR_TABLE_CMDID, |
| 682 | .pdev_ratepwr_chainmsk_table_cmdid = |
| 683 | WMI_10_4_PDEV_RATEPWR_CHAINMSK_TABLE_CMDID, |
| 684 | .pdev_fips_cmdid = WMI_10_4_PDEV_FIPS_CMDID, |
| 685 | .tt_set_conf_cmdid = WMI_10_4_TT_SET_CONF_CMDID, |
| 686 | .fwtest_cmdid = WMI_10_4_FWTEST_CMDID, |
| 687 | .vdev_atf_request_cmdid = WMI_10_4_VDEV_ATF_REQUEST_CMDID, |
| 688 | .peer_atf_request_cmdid = WMI_10_4_PEER_ATF_REQUEST_CMDID, |
| 689 | .pdev_get_ani_cck_config_cmdid = WMI_10_4_PDEV_GET_ANI_CCK_CONFIG_CMDID, |
| 690 | .pdev_get_ani_ofdm_config_cmdid = |
| 691 | WMI_10_4_PDEV_GET_ANI_OFDM_CONFIG_CMDID, |
| 692 | .pdev_reserve_ast_entry_cmdid = WMI_10_4_PDEV_RESERVE_AST_ENTRY_CMDID, |
| 693 | .pdev_get_nfcal_power_cmdid = WMI_10_4_PDEV_GET_NFCAL_POWER_CMDID, |
| 694 | .pdev_get_tpc_cmdid = WMI_10_4_PDEV_GET_TPC_CMDID, |
| 695 | .pdev_get_ast_info_cmdid = WMI_10_4_PDEV_GET_AST_INFO_CMDID, |
| 696 | .vdev_set_dscp_tid_map_cmdid = WMI_10_4_VDEV_SET_DSCP_TID_MAP_CMDID, |
| 697 | .pdev_get_info_cmdid = WMI_10_4_PDEV_GET_INFO_CMDID, |
| 698 | .vdev_get_info_cmdid = WMI_10_4_VDEV_GET_INFO_CMDID, |
| 699 | .vdev_filter_neighbor_rx_packets_cmdid = |
| 700 | WMI_10_4_VDEV_FILTER_NEIGHBOR_RX_PACKETS_CMDID, |
| 701 | .mu_cal_start_cmdid = WMI_10_4_MU_CAL_START_CMDID, |
| 702 | .set_cca_params_cmdid = WMI_10_4_SET_CCA_PARAMS_CMDID, |
| 703 | .pdev_bss_chan_info_request_cmdid = |
| 704 | WMI_10_4_PDEV_BSS_CHAN_INFO_REQUEST_CMDID, |
| 705 | }; |
| 706 | |
Bartosz Markowski | 6d1506e | 2013-09-26 17:47:15 +0200 | [diff] [blame] | 707 | /* MAIN WMI VDEV param map */ |
| 708 | static struct wmi_vdev_param_map wmi_vdev_param_map = { |
| 709 | .rts_threshold = WMI_VDEV_PARAM_RTS_THRESHOLD, |
| 710 | .fragmentation_threshold = WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD, |
| 711 | .beacon_interval = WMI_VDEV_PARAM_BEACON_INTERVAL, |
| 712 | .listen_interval = WMI_VDEV_PARAM_LISTEN_INTERVAL, |
| 713 | .multicast_rate = WMI_VDEV_PARAM_MULTICAST_RATE, |
| 714 | .mgmt_tx_rate = WMI_VDEV_PARAM_MGMT_TX_RATE, |
| 715 | .slot_time = WMI_VDEV_PARAM_SLOT_TIME, |
| 716 | .preamble = WMI_VDEV_PARAM_PREAMBLE, |
| 717 | .swba_time = WMI_VDEV_PARAM_SWBA_TIME, |
| 718 | .wmi_vdev_stats_update_period = WMI_VDEV_STATS_UPDATE_PERIOD, |
| 719 | .wmi_vdev_pwrsave_ageout_time = WMI_VDEV_PWRSAVE_AGEOUT_TIME, |
| 720 | .wmi_vdev_host_swba_interval = WMI_VDEV_HOST_SWBA_INTERVAL, |
| 721 | .dtim_period = WMI_VDEV_PARAM_DTIM_PERIOD, |
| 722 | .wmi_vdev_oc_scheduler_air_time_limit = |
| 723 | WMI_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT, |
| 724 | .wds = WMI_VDEV_PARAM_WDS, |
| 725 | .atim_window = WMI_VDEV_PARAM_ATIM_WINDOW, |
| 726 | .bmiss_count_max = WMI_VDEV_PARAM_BMISS_COUNT_MAX, |
| 727 | .bmiss_first_bcnt = WMI_VDEV_PARAM_BMISS_FIRST_BCNT, |
| 728 | .bmiss_final_bcnt = WMI_VDEV_PARAM_BMISS_FINAL_BCNT, |
| 729 | .feature_wmm = WMI_VDEV_PARAM_FEATURE_WMM, |
| 730 | .chwidth = WMI_VDEV_PARAM_CHWIDTH, |
| 731 | .chextoffset = WMI_VDEV_PARAM_CHEXTOFFSET, |
| 732 | .disable_htprotection = WMI_VDEV_PARAM_DISABLE_HTPROTECTION, |
| 733 | .sta_quickkickout = WMI_VDEV_PARAM_STA_QUICKKICKOUT, |
| 734 | .mgmt_rate = WMI_VDEV_PARAM_MGMT_RATE, |
| 735 | .protection_mode = WMI_VDEV_PARAM_PROTECTION_MODE, |
| 736 | .fixed_rate = WMI_VDEV_PARAM_FIXED_RATE, |
| 737 | .sgi = WMI_VDEV_PARAM_SGI, |
| 738 | .ldpc = WMI_VDEV_PARAM_LDPC, |
| 739 | .tx_stbc = WMI_VDEV_PARAM_TX_STBC, |
| 740 | .rx_stbc = WMI_VDEV_PARAM_RX_STBC, |
| 741 | .intra_bss_fwd = WMI_VDEV_PARAM_INTRA_BSS_FWD, |
| 742 | .def_keyid = WMI_VDEV_PARAM_DEF_KEYID, |
| 743 | .nss = WMI_VDEV_PARAM_NSS, |
| 744 | .bcast_data_rate = WMI_VDEV_PARAM_BCAST_DATA_RATE, |
| 745 | .mcast_data_rate = WMI_VDEV_PARAM_MCAST_DATA_RATE, |
| 746 | .mcast_indicate = WMI_VDEV_PARAM_MCAST_INDICATE, |
| 747 | .dhcp_indicate = WMI_VDEV_PARAM_DHCP_INDICATE, |
| 748 | .unknown_dest_indicate = WMI_VDEV_PARAM_UNKNOWN_DEST_INDICATE, |
| 749 | .ap_keepalive_min_idle_inactive_time_secs = |
| 750 | WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS, |
| 751 | .ap_keepalive_max_idle_inactive_time_secs = |
| 752 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS, |
| 753 | .ap_keepalive_max_unresponsive_time_secs = |
| 754 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS, |
| 755 | .ap_enable_nawds = WMI_VDEV_PARAM_AP_ENABLE_NAWDS, |
| 756 | .mcast2ucast_set = WMI_VDEV_PARAM_UNSUPPORTED, |
| 757 | .enable_rtscts = WMI_VDEV_PARAM_ENABLE_RTSCTS, |
| 758 | .txbf = WMI_VDEV_PARAM_TXBF, |
| 759 | .packet_powersave = WMI_VDEV_PARAM_PACKET_POWERSAVE, |
| 760 | .drop_unencry = WMI_VDEV_PARAM_DROP_UNENCRY, |
| 761 | .tx_encap_type = WMI_VDEV_PARAM_TX_ENCAP_TYPE, |
| 762 | .ap_detect_out_of_sync_sleeping_sta_time_secs = |
| 763 | WMI_VDEV_PARAM_UNSUPPORTED, |
Raja Mani | 93841a1 | 2015-06-22 20:10:13 +0530 | [diff] [blame] | 764 | .rc_num_retries = WMI_VDEV_PARAM_UNSUPPORTED, |
| 765 | .cabq_maxdur = WMI_VDEV_PARAM_UNSUPPORTED, |
| 766 | .mfptest_set = WMI_VDEV_PARAM_UNSUPPORTED, |
| 767 | .rts_fixed_rate = WMI_VDEV_PARAM_UNSUPPORTED, |
| 768 | .vht_sgimask = WMI_VDEV_PARAM_UNSUPPORTED, |
| 769 | .vht80_ratemask = WMI_VDEV_PARAM_UNSUPPORTED, |
| 770 | .early_rx_adjust_enable = WMI_VDEV_PARAM_UNSUPPORTED, |
| 771 | .early_rx_tgt_bmiss_num = WMI_VDEV_PARAM_UNSUPPORTED, |
| 772 | .early_rx_bmiss_sample_cycle = WMI_VDEV_PARAM_UNSUPPORTED, |
| 773 | .early_rx_slop_step = WMI_VDEV_PARAM_UNSUPPORTED, |
| 774 | .early_rx_init_slop = WMI_VDEV_PARAM_UNSUPPORTED, |
| 775 | .early_rx_adjust_pause = WMI_VDEV_PARAM_UNSUPPORTED, |
| 776 | .proxy_sta = WMI_VDEV_PARAM_UNSUPPORTED, |
| 777 | .meru_vc = WMI_VDEV_PARAM_UNSUPPORTED, |
| 778 | .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED, |
| 779 | .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED, |
Bartosz Markowski | 6d1506e | 2013-09-26 17:47:15 +0200 | [diff] [blame] | 780 | }; |
| 781 | |
| 782 | /* 10.X WMI VDEV param map */ |
| 783 | static struct wmi_vdev_param_map wmi_10x_vdev_param_map = { |
| 784 | .rts_threshold = WMI_10X_VDEV_PARAM_RTS_THRESHOLD, |
| 785 | .fragmentation_threshold = WMI_10X_VDEV_PARAM_FRAGMENTATION_THRESHOLD, |
| 786 | .beacon_interval = WMI_10X_VDEV_PARAM_BEACON_INTERVAL, |
| 787 | .listen_interval = WMI_10X_VDEV_PARAM_LISTEN_INTERVAL, |
| 788 | .multicast_rate = WMI_10X_VDEV_PARAM_MULTICAST_RATE, |
| 789 | .mgmt_tx_rate = WMI_10X_VDEV_PARAM_MGMT_TX_RATE, |
| 790 | .slot_time = WMI_10X_VDEV_PARAM_SLOT_TIME, |
| 791 | .preamble = WMI_10X_VDEV_PARAM_PREAMBLE, |
| 792 | .swba_time = WMI_10X_VDEV_PARAM_SWBA_TIME, |
| 793 | .wmi_vdev_stats_update_period = WMI_10X_VDEV_STATS_UPDATE_PERIOD, |
| 794 | .wmi_vdev_pwrsave_ageout_time = WMI_10X_VDEV_PWRSAVE_AGEOUT_TIME, |
| 795 | .wmi_vdev_host_swba_interval = WMI_10X_VDEV_HOST_SWBA_INTERVAL, |
| 796 | .dtim_period = WMI_10X_VDEV_PARAM_DTIM_PERIOD, |
| 797 | .wmi_vdev_oc_scheduler_air_time_limit = |
| 798 | WMI_10X_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT, |
| 799 | .wds = WMI_10X_VDEV_PARAM_WDS, |
| 800 | .atim_window = WMI_10X_VDEV_PARAM_ATIM_WINDOW, |
| 801 | .bmiss_count_max = WMI_10X_VDEV_PARAM_BMISS_COUNT_MAX, |
| 802 | .bmiss_first_bcnt = WMI_VDEV_PARAM_UNSUPPORTED, |
| 803 | .bmiss_final_bcnt = WMI_VDEV_PARAM_UNSUPPORTED, |
| 804 | .feature_wmm = WMI_10X_VDEV_PARAM_FEATURE_WMM, |
| 805 | .chwidth = WMI_10X_VDEV_PARAM_CHWIDTH, |
| 806 | .chextoffset = WMI_10X_VDEV_PARAM_CHEXTOFFSET, |
| 807 | .disable_htprotection = WMI_10X_VDEV_PARAM_DISABLE_HTPROTECTION, |
| 808 | .sta_quickkickout = WMI_10X_VDEV_PARAM_STA_QUICKKICKOUT, |
| 809 | .mgmt_rate = WMI_10X_VDEV_PARAM_MGMT_RATE, |
| 810 | .protection_mode = WMI_10X_VDEV_PARAM_PROTECTION_MODE, |
| 811 | .fixed_rate = WMI_10X_VDEV_PARAM_FIXED_RATE, |
| 812 | .sgi = WMI_10X_VDEV_PARAM_SGI, |
| 813 | .ldpc = WMI_10X_VDEV_PARAM_LDPC, |
| 814 | .tx_stbc = WMI_10X_VDEV_PARAM_TX_STBC, |
| 815 | .rx_stbc = WMI_10X_VDEV_PARAM_RX_STBC, |
| 816 | .intra_bss_fwd = WMI_10X_VDEV_PARAM_INTRA_BSS_FWD, |
| 817 | .def_keyid = WMI_10X_VDEV_PARAM_DEF_KEYID, |
| 818 | .nss = WMI_10X_VDEV_PARAM_NSS, |
| 819 | .bcast_data_rate = WMI_10X_VDEV_PARAM_BCAST_DATA_RATE, |
| 820 | .mcast_data_rate = WMI_10X_VDEV_PARAM_MCAST_DATA_RATE, |
| 821 | .mcast_indicate = WMI_10X_VDEV_PARAM_MCAST_INDICATE, |
| 822 | .dhcp_indicate = WMI_10X_VDEV_PARAM_DHCP_INDICATE, |
| 823 | .unknown_dest_indicate = WMI_10X_VDEV_PARAM_UNKNOWN_DEST_INDICATE, |
| 824 | .ap_keepalive_min_idle_inactive_time_secs = |
| 825 | WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS, |
| 826 | .ap_keepalive_max_idle_inactive_time_secs = |
| 827 | WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS, |
| 828 | .ap_keepalive_max_unresponsive_time_secs = |
| 829 | WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS, |
| 830 | .ap_enable_nawds = WMI_10X_VDEV_PARAM_AP_ENABLE_NAWDS, |
| 831 | .mcast2ucast_set = WMI_10X_VDEV_PARAM_MCAST2UCAST_SET, |
| 832 | .enable_rtscts = WMI_10X_VDEV_PARAM_ENABLE_RTSCTS, |
| 833 | .txbf = WMI_VDEV_PARAM_UNSUPPORTED, |
| 834 | .packet_powersave = WMI_VDEV_PARAM_UNSUPPORTED, |
| 835 | .drop_unencry = WMI_VDEV_PARAM_UNSUPPORTED, |
| 836 | .tx_encap_type = WMI_VDEV_PARAM_UNSUPPORTED, |
| 837 | .ap_detect_out_of_sync_sleeping_sta_time_secs = |
| 838 | WMI_10X_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS, |
Raja Mani | 93841a1 | 2015-06-22 20:10:13 +0530 | [diff] [blame] | 839 | .rc_num_retries = WMI_VDEV_PARAM_UNSUPPORTED, |
| 840 | .cabq_maxdur = WMI_VDEV_PARAM_UNSUPPORTED, |
| 841 | .mfptest_set = WMI_VDEV_PARAM_UNSUPPORTED, |
| 842 | .rts_fixed_rate = WMI_VDEV_PARAM_UNSUPPORTED, |
| 843 | .vht_sgimask = WMI_VDEV_PARAM_UNSUPPORTED, |
| 844 | .vht80_ratemask = WMI_VDEV_PARAM_UNSUPPORTED, |
| 845 | .early_rx_adjust_enable = WMI_VDEV_PARAM_UNSUPPORTED, |
| 846 | .early_rx_tgt_bmiss_num = WMI_VDEV_PARAM_UNSUPPORTED, |
| 847 | .early_rx_bmiss_sample_cycle = WMI_VDEV_PARAM_UNSUPPORTED, |
| 848 | .early_rx_slop_step = WMI_VDEV_PARAM_UNSUPPORTED, |
| 849 | .early_rx_init_slop = WMI_VDEV_PARAM_UNSUPPORTED, |
| 850 | .early_rx_adjust_pause = WMI_VDEV_PARAM_UNSUPPORTED, |
| 851 | .proxy_sta = WMI_VDEV_PARAM_UNSUPPORTED, |
| 852 | .meru_vc = WMI_VDEV_PARAM_UNSUPPORTED, |
| 853 | .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED, |
| 854 | .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED, |
Bartosz Markowski | 6d1506e | 2013-09-26 17:47:15 +0200 | [diff] [blame] | 855 | }; |
| 856 | |
Rajkumar Manoharan | 4a16fbe | 2014-12-17 12:21:12 +0200 | [diff] [blame] | 857 | static struct wmi_vdev_param_map wmi_10_2_4_vdev_param_map = { |
| 858 | .rts_threshold = WMI_10X_VDEV_PARAM_RTS_THRESHOLD, |
| 859 | .fragmentation_threshold = WMI_10X_VDEV_PARAM_FRAGMENTATION_THRESHOLD, |
| 860 | .beacon_interval = WMI_10X_VDEV_PARAM_BEACON_INTERVAL, |
| 861 | .listen_interval = WMI_10X_VDEV_PARAM_LISTEN_INTERVAL, |
| 862 | .multicast_rate = WMI_10X_VDEV_PARAM_MULTICAST_RATE, |
| 863 | .mgmt_tx_rate = WMI_10X_VDEV_PARAM_MGMT_TX_RATE, |
| 864 | .slot_time = WMI_10X_VDEV_PARAM_SLOT_TIME, |
| 865 | .preamble = WMI_10X_VDEV_PARAM_PREAMBLE, |
| 866 | .swba_time = WMI_10X_VDEV_PARAM_SWBA_TIME, |
| 867 | .wmi_vdev_stats_update_period = WMI_10X_VDEV_STATS_UPDATE_PERIOD, |
| 868 | .wmi_vdev_pwrsave_ageout_time = WMI_10X_VDEV_PWRSAVE_AGEOUT_TIME, |
| 869 | .wmi_vdev_host_swba_interval = WMI_10X_VDEV_HOST_SWBA_INTERVAL, |
| 870 | .dtim_period = WMI_10X_VDEV_PARAM_DTIM_PERIOD, |
| 871 | .wmi_vdev_oc_scheduler_air_time_limit = |
| 872 | WMI_10X_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT, |
| 873 | .wds = WMI_10X_VDEV_PARAM_WDS, |
| 874 | .atim_window = WMI_10X_VDEV_PARAM_ATIM_WINDOW, |
| 875 | .bmiss_count_max = WMI_10X_VDEV_PARAM_BMISS_COUNT_MAX, |
| 876 | .bmiss_first_bcnt = WMI_VDEV_PARAM_UNSUPPORTED, |
| 877 | .bmiss_final_bcnt = WMI_VDEV_PARAM_UNSUPPORTED, |
| 878 | .feature_wmm = WMI_10X_VDEV_PARAM_FEATURE_WMM, |
| 879 | .chwidth = WMI_10X_VDEV_PARAM_CHWIDTH, |
| 880 | .chextoffset = WMI_10X_VDEV_PARAM_CHEXTOFFSET, |
| 881 | .disable_htprotection = WMI_10X_VDEV_PARAM_DISABLE_HTPROTECTION, |
| 882 | .sta_quickkickout = WMI_10X_VDEV_PARAM_STA_QUICKKICKOUT, |
| 883 | .mgmt_rate = WMI_10X_VDEV_PARAM_MGMT_RATE, |
| 884 | .protection_mode = WMI_10X_VDEV_PARAM_PROTECTION_MODE, |
| 885 | .fixed_rate = WMI_10X_VDEV_PARAM_FIXED_RATE, |
| 886 | .sgi = WMI_10X_VDEV_PARAM_SGI, |
| 887 | .ldpc = WMI_10X_VDEV_PARAM_LDPC, |
| 888 | .tx_stbc = WMI_10X_VDEV_PARAM_TX_STBC, |
| 889 | .rx_stbc = WMI_10X_VDEV_PARAM_RX_STBC, |
| 890 | .intra_bss_fwd = WMI_10X_VDEV_PARAM_INTRA_BSS_FWD, |
| 891 | .def_keyid = WMI_10X_VDEV_PARAM_DEF_KEYID, |
| 892 | .nss = WMI_10X_VDEV_PARAM_NSS, |
| 893 | .bcast_data_rate = WMI_10X_VDEV_PARAM_BCAST_DATA_RATE, |
| 894 | .mcast_data_rate = WMI_10X_VDEV_PARAM_MCAST_DATA_RATE, |
| 895 | .mcast_indicate = WMI_10X_VDEV_PARAM_MCAST_INDICATE, |
| 896 | .dhcp_indicate = WMI_10X_VDEV_PARAM_DHCP_INDICATE, |
| 897 | .unknown_dest_indicate = WMI_10X_VDEV_PARAM_UNKNOWN_DEST_INDICATE, |
| 898 | .ap_keepalive_min_idle_inactive_time_secs = |
| 899 | WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS, |
| 900 | .ap_keepalive_max_idle_inactive_time_secs = |
| 901 | WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS, |
| 902 | .ap_keepalive_max_unresponsive_time_secs = |
| 903 | WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS, |
| 904 | .ap_enable_nawds = WMI_10X_VDEV_PARAM_AP_ENABLE_NAWDS, |
| 905 | .mcast2ucast_set = WMI_10X_VDEV_PARAM_MCAST2UCAST_SET, |
| 906 | .enable_rtscts = WMI_10X_VDEV_PARAM_ENABLE_RTSCTS, |
| 907 | .txbf = WMI_VDEV_PARAM_UNSUPPORTED, |
| 908 | .packet_powersave = WMI_VDEV_PARAM_UNSUPPORTED, |
| 909 | .drop_unencry = WMI_VDEV_PARAM_UNSUPPORTED, |
| 910 | .tx_encap_type = WMI_VDEV_PARAM_UNSUPPORTED, |
| 911 | .ap_detect_out_of_sync_sleeping_sta_time_secs = |
| 912 | WMI_10X_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS, |
Raja Mani | 93841a1 | 2015-06-22 20:10:13 +0530 | [diff] [blame] | 913 | .rc_num_retries = WMI_VDEV_PARAM_UNSUPPORTED, |
| 914 | .cabq_maxdur = WMI_VDEV_PARAM_UNSUPPORTED, |
| 915 | .mfptest_set = WMI_VDEV_PARAM_UNSUPPORTED, |
| 916 | .rts_fixed_rate = WMI_VDEV_PARAM_UNSUPPORTED, |
| 917 | .vht_sgimask = WMI_VDEV_PARAM_UNSUPPORTED, |
| 918 | .vht80_ratemask = WMI_VDEV_PARAM_UNSUPPORTED, |
| 919 | .early_rx_adjust_enable = WMI_VDEV_PARAM_UNSUPPORTED, |
| 920 | .early_rx_tgt_bmiss_num = WMI_VDEV_PARAM_UNSUPPORTED, |
| 921 | .early_rx_bmiss_sample_cycle = WMI_VDEV_PARAM_UNSUPPORTED, |
| 922 | .early_rx_slop_step = WMI_VDEV_PARAM_UNSUPPORTED, |
| 923 | .early_rx_init_slop = WMI_VDEV_PARAM_UNSUPPORTED, |
| 924 | .early_rx_adjust_pause = WMI_VDEV_PARAM_UNSUPPORTED, |
| 925 | .proxy_sta = WMI_VDEV_PARAM_UNSUPPORTED, |
| 926 | .meru_vc = WMI_VDEV_PARAM_UNSUPPORTED, |
| 927 | .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED, |
| 928 | .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED, |
| 929 | }; |
| 930 | |
| 931 | static struct wmi_vdev_param_map wmi_10_4_vdev_param_map = { |
| 932 | .rts_threshold = WMI_10_4_VDEV_PARAM_RTS_THRESHOLD, |
| 933 | .fragmentation_threshold = WMI_10_4_VDEV_PARAM_FRAGMENTATION_THRESHOLD, |
| 934 | .beacon_interval = WMI_10_4_VDEV_PARAM_BEACON_INTERVAL, |
| 935 | .listen_interval = WMI_10_4_VDEV_PARAM_LISTEN_INTERVAL, |
| 936 | .multicast_rate = WMI_10_4_VDEV_PARAM_MULTICAST_RATE, |
| 937 | .mgmt_tx_rate = WMI_10_4_VDEV_PARAM_MGMT_TX_RATE, |
| 938 | .slot_time = WMI_10_4_VDEV_PARAM_SLOT_TIME, |
| 939 | .preamble = WMI_10_4_VDEV_PARAM_PREAMBLE, |
| 940 | .swba_time = WMI_10_4_VDEV_PARAM_SWBA_TIME, |
| 941 | .wmi_vdev_stats_update_period = WMI_10_4_VDEV_STATS_UPDATE_PERIOD, |
| 942 | .wmi_vdev_pwrsave_ageout_time = WMI_10_4_VDEV_PWRSAVE_AGEOUT_TIME, |
| 943 | .wmi_vdev_host_swba_interval = WMI_10_4_VDEV_HOST_SWBA_INTERVAL, |
| 944 | .dtim_period = WMI_10_4_VDEV_PARAM_DTIM_PERIOD, |
| 945 | .wmi_vdev_oc_scheduler_air_time_limit = |
| 946 | WMI_10_4_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT, |
| 947 | .wds = WMI_10_4_VDEV_PARAM_WDS, |
| 948 | .atim_window = WMI_10_4_VDEV_PARAM_ATIM_WINDOW, |
| 949 | .bmiss_count_max = WMI_10_4_VDEV_PARAM_BMISS_COUNT_MAX, |
| 950 | .bmiss_first_bcnt = WMI_10_4_VDEV_PARAM_BMISS_FIRST_BCNT, |
| 951 | .bmiss_final_bcnt = WMI_10_4_VDEV_PARAM_BMISS_FINAL_BCNT, |
| 952 | .feature_wmm = WMI_10_4_VDEV_PARAM_FEATURE_WMM, |
| 953 | .chwidth = WMI_10_4_VDEV_PARAM_CHWIDTH, |
| 954 | .chextoffset = WMI_10_4_VDEV_PARAM_CHEXTOFFSET, |
| 955 | .disable_htprotection = WMI_10_4_VDEV_PARAM_DISABLE_HTPROTECTION, |
| 956 | .sta_quickkickout = WMI_10_4_VDEV_PARAM_STA_QUICKKICKOUT, |
| 957 | .mgmt_rate = WMI_10_4_VDEV_PARAM_MGMT_RATE, |
| 958 | .protection_mode = WMI_10_4_VDEV_PARAM_PROTECTION_MODE, |
| 959 | .fixed_rate = WMI_10_4_VDEV_PARAM_FIXED_RATE, |
| 960 | .sgi = WMI_10_4_VDEV_PARAM_SGI, |
| 961 | .ldpc = WMI_10_4_VDEV_PARAM_LDPC, |
| 962 | .tx_stbc = WMI_10_4_VDEV_PARAM_TX_STBC, |
| 963 | .rx_stbc = WMI_10_4_VDEV_PARAM_RX_STBC, |
| 964 | .intra_bss_fwd = WMI_10_4_VDEV_PARAM_INTRA_BSS_FWD, |
| 965 | .def_keyid = WMI_10_4_VDEV_PARAM_DEF_KEYID, |
| 966 | .nss = WMI_10_4_VDEV_PARAM_NSS, |
| 967 | .bcast_data_rate = WMI_10_4_VDEV_PARAM_BCAST_DATA_RATE, |
| 968 | .mcast_data_rate = WMI_10_4_VDEV_PARAM_MCAST_DATA_RATE, |
| 969 | .mcast_indicate = WMI_10_4_VDEV_PARAM_MCAST_INDICATE, |
| 970 | .dhcp_indicate = WMI_10_4_VDEV_PARAM_DHCP_INDICATE, |
| 971 | .unknown_dest_indicate = WMI_10_4_VDEV_PARAM_UNKNOWN_DEST_INDICATE, |
| 972 | .ap_keepalive_min_idle_inactive_time_secs = |
| 973 | WMI_10_4_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS, |
| 974 | .ap_keepalive_max_idle_inactive_time_secs = |
| 975 | WMI_10_4_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS, |
| 976 | .ap_keepalive_max_unresponsive_time_secs = |
| 977 | WMI_10_4_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS, |
| 978 | .ap_enable_nawds = WMI_10_4_VDEV_PARAM_AP_ENABLE_NAWDS, |
| 979 | .mcast2ucast_set = WMI_10_4_VDEV_PARAM_MCAST2UCAST_SET, |
| 980 | .enable_rtscts = WMI_10_4_VDEV_PARAM_ENABLE_RTSCTS, |
| 981 | .txbf = WMI_10_4_VDEV_PARAM_TXBF, |
| 982 | .packet_powersave = WMI_10_4_VDEV_PARAM_PACKET_POWERSAVE, |
| 983 | .drop_unencry = WMI_10_4_VDEV_PARAM_DROP_UNENCRY, |
| 984 | .tx_encap_type = WMI_10_4_VDEV_PARAM_TX_ENCAP_TYPE, |
| 985 | .ap_detect_out_of_sync_sleeping_sta_time_secs = |
| 986 | WMI_10_4_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS, |
| 987 | .rc_num_retries = WMI_10_4_VDEV_PARAM_RC_NUM_RETRIES, |
| 988 | .cabq_maxdur = WMI_10_4_VDEV_PARAM_CABQ_MAXDUR, |
| 989 | .mfptest_set = WMI_10_4_VDEV_PARAM_MFPTEST_SET, |
| 990 | .rts_fixed_rate = WMI_10_4_VDEV_PARAM_RTS_FIXED_RATE, |
| 991 | .vht_sgimask = WMI_10_4_VDEV_PARAM_VHT_SGIMASK, |
| 992 | .vht80_ratemask = WMI_10_4_VDEV_PARAM_VHT80_RATEMASK, |
| 993 | .early_rx_adjust_enable = WMI_10_4_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE, |
| 994 | .early_rx_tgt_bmiss_num = WMI_10_4_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM, |
| 995 | .early_rx_bmiss_sample_cycle = |
| 996 | WMI_10_4_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE, |
| 997 | .early_rx_slop_step = WMI_10_4_VDEV_PARAM_EARLY_RX_SLOP_STEP, |
| 998 | .early_rx_init_slop = WMI_10_4_VDEV_PARAM_EARLY_RX_INIT_SLOP, |
| 999 | .early_rx_adjust_pause = WMI_10_4_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE, |
| 1000 | .proxy_sta = WMI_10_4_VDEV_PARAM_PROXY_STA, |
| 1001 | .meru_vc = WMI_10_4_VDEV_PARAM_MERU_VC, |
| 1002 | .rx_decap_type = WMI_10_4_VDEV_PARAM_RX_DECAP_TYPE, |
| 1003 | .bw_nss_ratemask = WMI_10_4_VDEV_PARAM_BW_NSS_RATEMASK, |
Rajkumar Manoharan | 4a16fbe | 2014-12-17 12:21:12 +0200 | [diff] [blame] | 1004 | }; |
| 1005 | |
Bartosz Markowski | 226a339 | 2013-09-26 17:47:16 +0200 | [diff] [blame] | 1006 | static struct wmi_pdev_param_map wmi_pdev_param_map = { |
| 1007 | .tx_chain_mask = WMI_PDEV_PARAM_TX_CHAIN_MASK, |
| 1008 | .rx_chain_mask = WMI_PDEV_PARAM_RX_CHAIN_MASK, |
| 1009 | .txpower_limit2g = WMI_PDEV_PARAM_TXPOWER_LIMIT2G, |
| 1010 | .txpower_limit5g = WMI_PDEV_PARAM_TXPOWER_LIMIT5G, |
| 1011 | .txpower_scale = WMI_PDEV_PARAM_TXPOWER_SCALE, |
| 1012 | .beacon_gen_mode = WMI_PDEV_PARAM_BEACON_GEN_MODE, |
| 1013 | .beacon_tx_mode = WMI_PDEV_PARAM_BEACON_TX_MODE, |
| 1014 | .resmgr_offchan_mode = WMI_PDEV_PARAM_RESMGR_OFFCHAN_MODE, |
| 1015 | .protection_mode = WMI_PDEV_PARAM_PROTECTION_MODE, |
| 1016 | .dynamic_bw = WMI_PDEV_PARAM_DYNAMIC_BW, |
| 1017 | .non_agg_sw_retry_th = WMI_PDEV_PARAM_NON_AGG_SW_RETRY_TH, |
| 1018 | .agg_sw_retry_th = WMI_PDEV_PARAM_AGG_SW_RETRY_TH, |
| 1019 | .sta_kickout_th = WMI_PDEV_PARAM_STA_KICKOUT_TH, |
| 1020 | .ac_aggrsize_scaling = WMI_PDEV_PARAM_AC_AGGRSIZE_SCALING, |
| 1021 | .ltr_enable = WMI_PDEV_PARAM_LTR_ENABLE, |
| 1022 | .ltr_ac_latency_be = WMI_PDEV_PARAM_LTR_AC_LATENCY_BE, |
| 1023 | .ltr_ac_latency_bk = WMI_PDEV_PARAM_LTR_AC_LATENCY_BK, |
| 1024 | .ltr_ac_latency_vi = WMI_PDEV_PARAM_LTR_AC_LATENCY_VI, |
| 1025 | .ltr_ac_latency_vo = WMI_PDEV_PARAM_LTR_AC_LATENCY_VO, |
| 1026 | .ltr_ac_latency_timeout = WMI_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT, |
| 1027 | .ltr_sleep_override = WMI_PDEV_PARAM_LTR_SLEEP_OVERRIDE, |
| 1028 | .ltr_rx_override = WMI_PDEV_PARAM_LTR_RX_OVERRIDE, |
| 1029 | .ltr_tx_activity_timeout = WMI_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT, |
| 1030 | .l1ss_enable = WMI_PDEV_PARAM_L1SS_ENABLE, |
| 1031 | .dsleep_enable = WMI_PDEV_PARAM_DSLEEP_ENABLE, |
| 1032 | .pcielp_txbuf_flush = WMI_PDEV_PARAM_PCIELP_TXBUF_FLUSH, |
| 1033 | .pcielp_txbuf_watermark = WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_EN, |
| 1034 | .pcielp_txbuf_tmo_en = WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_EN, |
| 1035 | .pcielp_txbuf_tmo_value = WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE, |
| 1036 | .pdev_stats_update_period = WMI_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD, |
| 1037 | .vdev_stats_update_period = WMI_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD, |
| 1038 | .peer_stats_update_period = WMI_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD, |
| 1039 | .bcnflt_stats_update_period = WMI_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD, |
| 1040 | .pmf_qos = WMI_PDEV_PARAM_PMF_QOS, |
| 1041 | .arp_ac_override = WMI_PDEV_PARAM_ARP_AC_OVERRIDE, |
Bartosz Markowski | 226a339 | 2013-09-26 17:47:16 +0200 | [diff] [blame] | 1042 | .dcs = WMI_PDEV_PARAM_DCS, |
| 1043 | .ani_enable = WMI_PDEV_PARAM_ANI_ENABLE, |
| 1044 | .ani_poll_period = WMI_PDEV_PARAM_ANI_POLL_PERIOD, |
| 1045 | .ani_listen_period = WMI_PDEV_PARAM_ANI_LISTEN_PERIOD, |
| 1046 | .ani_ofdm_level = WMI_PDEV_PARAM_ANI_OFDM_LEVEL, |
| 1047 | .ani_cck_level = WMI_PDEV_PARAM_ANI_CCK_LEVEL, |
| 1048 | .dyntxchain = WMI_PDEV_PARAM_DYNTXCHAIN, |
| 1049 | .proxy_sta = WMI_PDEV_PARAM_PROXY_STA, |
| 1050 | .idle_ps_config = WMI_PDEV_PARAM_IDLE_PS_CONFIG, |
| 1051 | .power_gating_sleep = WMI_PDEV_PARAM_POWER_GATING_SLEEP, |
| 1052 | .fast_channel_reset = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1053 | .burst_dur = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1054 | .burst_enable = WMI_PDEV_PARAM_UNSUPPORTED, |
Peter Oh | a7bd3e9 | 2014-12-02 13:07:14 +0200 | [diff] [blame] | 1055 | .cal_period = WMI_PDEV_PARAM_UNSUPPORTED, |
Raja Mani | d86561f | 2015-06-22 20:10:14 +0530 | [diff] [blame] | 1056 | .aggr_burst = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1057 | .rx_decap_mode = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1058 | .smart_antenna_default_antenna = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1059 | .igmpmld_override = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1060 | .igmpmld_tid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1061 | .antenna_gain = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1062 | .rx_filter = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1063 | .set_mcast_to_ucast_tid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1064 | .proxy_sta_mode = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1065 | .set_mcast2ucast_mode = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1066 | .set_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1067 | .remove_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1068 | .peer_sta_ps_statechg_enable = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1069 | .igmpmld_ac_override = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1070 | .block_interbss = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1071 | .set_disable_reset_cmdid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1072 | .set_msdu_ttl_cmdid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1073 | .set_ppdu_duration_cmdid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1074 | .txbf_sound_period_cmdid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1075 | .set_promisc_mode_cmdid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1076 | .set_burst_mode_cmdid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1077 | .en_stats = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1078 | .mu_group_policy = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1079 | .noise_detection = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1080 | .noise_threshold = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1081 | .dpd_enable = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1082 | .set_mcast_bcast_echo = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1083 | .atf_strict_sch = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1084 | .atf_sched_duration = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1085 | .ant_plzn = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1086 | .mgmt_retry_limit = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1087 | .sensitivity_level = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1088 | .signed_txpower_2g = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1089 | .signed_txpower_5g = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1090 | .enable_per_tid_amsdu = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1091 | .enable_per_tid_ampdu = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1092 | .cca_threshold = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1093 | .rts_fixed_rate = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1094 | .pdev_reset = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1095 | .wapi_mbssid_offset = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1096 | .arp_srcaddr = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1097 | .arp_dstaddr = WMI_PDEV_PARAM_UNSUPPORTED, |
Bartosz Markowski | 226a339 | 2013-09-26 17:47:16 +0200 | [diff] [blame] | 1098 | }; |
| 1099 | |
| 1100 | static struct wmi_pdev_param_map wmi_10x_pdev_param_map = { |
| 1101 | .tx_chain_mask = WMI_10X_PDEV_PARAM_TX_CHAIN_MASK, |
| 1102 | .rx_chain_mask = WMI_10X_PDEV_PARAM_RX_CHAIN_MASK, |
| 1103 | .txpower_limit2g = WMI_10X_PDEV_PARAM_TXPOWER_LIMIT2G, |
| 1104 | .txpower_limit5g = WMI_10X_PDEV_PARAM_TXPOWER_LIMIT5G, |
| 1105 | .txpower_scale = WMI_10X_PDEV_PARAM_TXPOWER_SCALE, |
| 1106 | .beacon_gen_mode = WMI_10X_PDEV_PARAM_BEACON_GEN_MODE, |
| 1107 | .beacon_tx_mode = WMI_10X_PDEV_PARAM_BEACON_TX_MODE, |
| 1108 | .resmgr_offchan_mode = WMI_10X_PDEV_PARAM_RESMGR_OFFCHAN_MODE, |
| 1109 | .protection_mode = WMI_10X_PDEV_PARAM_PROTECTION_MODE, |
| 1110 | .dynamic_bw = WMI_10X_PDEV_PARAM_DYNAMIC_BW, |
| 1111 | .non_agg_sw_retry_th = WMI_10X_PDEV_PARAM_NON_AGG_SW_RETRY_TH, |
| 1112 | .agg_sw_retry_th = WMI_10X_PDEV_PARAM_AGG_SW_RETRY_TH, |
| 1113 | .sta_kickout_th = WMI_10X_PDEV_PARAM_STA_KICKOUT_TH, |
| 1114 | .ac_aggrsize_scaling = WMI_10X_PDEV_PARAM_AC_AGGRSIZE_SCALING, |
| 1115 | .ltr_enable = WMI_10X_PDEV_PARAM_LTR_ENABLE, |
| 1116 | .ltr_ac_latency_be = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_BE, |
| 1117 | .ltr_ac_latency_bk = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_BK, |
| 1118 | .ltr_ac_latency_vi = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_VI, |
| 1119 | .ltr_ac_latency_vo = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_VO, |
| 1120 | .ltr_ac_latency_timeout = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT, |
| 1121 | .ltr_sleep_override = WMI_10X_PDEV_PARAM_LTR_SLEEP_OVERRIDE, |
| 1122 | .ltr_rx_override = WMI_10X_PDEV_PARAM_LTR_RX_OVERRIDE, |
| 1123 | .ltr_tx_activity_timeout = WMI_10X_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT, |
| 1124 | .l1ss_enable = WMI_10X_PDEV_PARAM_L1SS_ENABLE, |
| 1125 | .dsleep_enable = WMI_10X_PDEV_PARAM_DSLEEP_ENABLE, |
| 1126 | .pcielp_txbuf_flush = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1127 | .pcielp_txbuf_watermark = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1128 | .pcielp_txbuf_tmo_en = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1129 | .pcielp_txbuf_tmo_value = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1130 | .pdev_stats_update_period = WMI_10X_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD, |
| 1131 | .vdev_stats_update_period = WMI_10X_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD, |
| 1132 | .peer_stats_update_period = WMI_10X_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD, |
| 1133 | .bcnflt_stats_update_period = |
| 1134 | WMI_10X_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD, |
| 1135 | .pmf_qos = WMI_10X_PDEV_PARAM_PMF_QOS, |
Marek Puzyniak | ab6258e | 2014-01-29 15:03:31 +0200 | [diff] [blame] | 1136 | .arp_ac_override = WMI_10X_PDEV_PARAM_ARPDHCP_AC_OVERRIDE, |
Bartosz Markowski | 226a339 | 2013-09-26 17:47:16 +0200 | [diff] [blame] | 1137 | .dcs = WMI_10X_PDEV_PARAM_DCS, |
| 1138 | .ani_enable = WMI_10X_PDEV_PARAM_ANI_ENABLE, |
| 1139 | .ani_poll_period = WMI_10X_PDEV_PARAM_ANI_POLL_PERIOD, |
| 1140 | .ani_listen_period = WMI_10X_PDEV_PARAM_ANI_LISTEN_PERIOD, |
| 1141 | .ani_ofdm_level = WMI_10X_PDEV_PARAM_ANI_OFDM_LEVEL, |
| 1142 | .ani_cck_level = WMI_10X_PDEV_PARAM_ANI_CCK_LEVEL, |
| 1143 | .dyntxchain = WMI_10X_PDEV_PARAM_DYNTXCHAIN, |
| 1144 | .proxy_sta = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1145 | .idle_ps_config = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1146 | .power_gating_sleep = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1147 | .fast_channel_reset = WMI_10X_PDEV_PARAM_FAST_CHANNEL_RESET, |
| 1148 | .burst_dur = WMI_10X_PDEV_PARAM_BURST_DUR, |
| 1149 | .burst_enable = WMI_10X_PDEV_PARAM_BURST_ENABLE, |
Peter Oh | a7bd3e9 | 2014-12-02 13:07:14 +0200 | [diff] [blame] | 1150 | .cal_period = WMI_10X_PDEV_PARAM_CAL_PERIOD, |
Raja Mani | d86561f | 2015-06-22 20:10:14 +0530 | [diff] [blame] | 1151 | .aggr_burst = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1152 | .rx_decap_mode = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1153 | .smart_antenna_default_antenna = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1154 | .igmpmld_override = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1155 | .igmpmld_tid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1156 | .antenna_gain = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1157 | .rx_filter = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1158 | .set_mcast_to_ucast_tid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1159 | .proxy_sta_mode = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1160 | .set_mcast2ucast_mode = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1161 | .set_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1162 | .remove_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1163 | .peer_sta_ps_statechg_enable = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1164 | .igmpmld_ac_override = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1165 | .block_interbss = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1166 | .set_disable_reset_cmdid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1167 | .set_msdu_ttl_cmdid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1168 | .set_ppdu_duration_cmdid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1169 | .txbf_sound_period_cmdid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1170 | .set_promisc_mode_cmdid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1171 | .set_burst_mode_cmdid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1172 | .en_stats = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1173 | .mu_group_policy = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1174 | .noise_detection = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1175 | .noise_threshold = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1176 | .dpd_enable = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1177 | .set_mcast_bcast_echo = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1178 | .atf_strict_sch = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1179 | .atf_sched_duration = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1180 | .ant_plzn = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1181 | .mgmt_retry_limit = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1182 | .sensitivity_level = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1183 | .signed_txpower_2g = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1184 | .signed_txpower_5g = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1185 | .enable_per_tid_amsdu = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1186 | .enable_per_tid_ampdu = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1187 | .cca_threshold = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1188 | .rts_fixed_rate = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1189 | .pdev_reset = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1190 | .wapi_mbssid_offset = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1191 | .arp_srcaddr = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1192 | .arp_dstaddr = WMI_PDEV_PARAM_UNSUPPORTED, |
Bartosz Markowski | 226a339 | 2013-09-26 17:47:16 +0200 | [diff] [blame] | 1193 | }; |
| 1194 | |
Rajkumar Manoharan | 4a16fbe | 2014-12-17 12:21:12 +0200 | [diff] [blame] | 1195 | static struct wmi_pdev_param_map wmi_10_2_4_pdev_param_map = { |
| 1196 | .tx_chain_mask = WMI_10X_PDEV_PARAM_TX_CHAIN_MASK, |
| 1197 | .rx_chain_mask = WMI_10X_PDEV_PARAM_RX_CHAIN_MASK, |
| 1198 | .txpower_limit2g = WMI_10X_PDEV_PARAM_TXPOWER_LIMIT2G, |
| 1199 | .txpower_limit5g = WMI_10X_PDEV_PARAM_TXPOWER_LIMIT5G, |
| 1200 | .txpower_scale = WMI_10X_PDEV_PARAM_TXPOWER_SCALE, |
| 1201 | .beacon_gen_mode = WMI_10X_PDEV_PARAM_BEACON_GEN_MODE, |
| 1202 | .beacon_tx_mode = WMI_10X_PDEV_PARAM_BEACON_TX_MODE, |
| 1203 | .resmgr_offchan_mode = WMI_10X_PDEV_PARAM_RESMGR_OFFCHAN_MODE, |
| 1204 | .protection_mode = WMI_10X_PDEV_PARAM_PROTECTION_MODE, |
| 1205 | .dynamic_bw = WMI_10X_PDEV_PARAM_DYNAMIC_BW, |
| 1206 | .non_agg_sw_retry_th = WMI_10X_PDEV_PARAM_NON_AGG_SW_RETRY_TH, |
| 1207 | .agg_sw_retry_th = WMI_10X_PDEV_PARAM_AGG_SW_RETRY_TH, |
| 1208 | .sta_kickout_th = WMI_10X_PDEV_PARAM_STA_KICKOUT_TH, |
| 1209 | .ac_aggrsize_scaling = WMI_10X_PDEV_PARAM_AC_AGGRSIZE_SCALING, |
| 1210 | .ltr_enable = WMI_10X_PDEV_PARAM_LTR_ENABLE, |
| 1211 | .ltr_ac_latency_be = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_BE, |
| 1212 | .ltr_ac_latency_bk = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_BK, |
| 1213 | .ltr_ac_latency_vi = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_VI, |
| 1214 | .ltr_ac_latency_vo = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_VO, |
| 1215 | .ltr_ac_latency_timeout = WMI_10X_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT, |
| 1216 | .ltr_sleep_override = WMI_10X_PDEV_PARAM_LTR_SLEEP_OVERRIDE, |
| 1217 | .ltr_rx_override = WMI_10X_PDEV_PARAM_LTR_RX_OVERRIDE, |
| 1218 | .ltr_tx_activity_timeout = WMI_10X_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT, |
| 1219 | .l1ss_enable = WMI_10X_PDEV_PARAM_L1SS_ENABLE, |
| 1220 | .dsleep_enable = WMI_10X_PDEV_PARAM_DSLEEP_ENABLE, |
| 1221 | .pcielp_txbuf_flush = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1222 | .pcielp_txbuf_watermark = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1223 | .pcielp_txbuf_tmo_en = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1224 | .pcielp_txbuf_tmo_value = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1225 | .pdev_stats_update_period = WMI_10X_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD, |
| 1226 | .vdev_stats_update_period = WMI_10X_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD, |
| 1227 | .peer_stats_update_period = WMI_10X_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD, |
| 1228 | .bcnflt_stats_update_period = |
| 1229 | WMI_10X_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD, |
| 1230 | .pmf_qos = WMI_10X_PDEV_PARAM_PMF_QOS, |
| 1231 | .arp_ac_override = WMI_10X_PDEV_PARAM_ARPDHCP_AC_OVERRIDE, |
| 1232 | .dcs = WMI_10X_PDEV_PARAM_DCS, |
| 1233 | .ani_enable = WMI_10X_PDEV_PARAM_ANI_ENABLE, |
| 1234 | .ani_poll_period = WMI_10X_PDEV_PARAM_ANI_POLL_PERIOD, |
| 1235 | .ani_listen_period = WMI_10X_PDEV_PARAM_ANI_LISTEN_PERIOD, |
| 1236 | .ani_ofdm_level = WMI_10X_PDEV_PARAM_ANI_OFDM_LEVEL, |
| 1237 | .ani_cck_level = WMI_10X_PDEV_PARAM_ANI_CCK_LEVEL, |
| 1238 | .dyntxchain = WMI_10X_PDEV_PARAM_DYNTXCHAIN, |
| 1239 | .proxy_sta = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1240 | .idle_ps_config = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1241 | .power_gating_sleep = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1242 | .fast_channel_reset = WMI_10X_PDEV_PARAM_FAST_CHANNEL_RESET, |
| 1243 | .burst_dur = WMI_10X_PDEV_PARAM_BURST_DUR, |
| 1244 | .burst_enable = WMI_10X_PDEV_PARAM_BURST_ENABLE, |
| 1245 | .cal_period = WMI_10X_PDEV_PARAM_CAL_PERIOD, |
Raja Mani | d86561f | 2015-06-22 20:10:14 +0530 | [diff] [blame] | 1246 | .aggr_burst = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1247 | .rx_decap_mode = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1248 | .smart_antenna_default_antenna = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1249 | .igmpmld_override = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1250 | .igmpmld_tid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1251 | .antenna_gain = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1252 | .rx_filter = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1253 | .set_mcast_to_ucast_tid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1254 | .proxy_sta_mode = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1255 | .set_mcast2ucast_mode = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1256 | .set_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1257 | .remove_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1258 | .peer_sta_ps_statechg_enable = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1259 | .igmpmld_ac_override = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1260 | .block_interbss = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1261 | .set_disable_reset_cmdid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1262 | .set_msdu_ttl_cmdid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1263 | .set_ppdu_duration_cmdid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1264 | .txbf_sound_period_cmdid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1265 | .set_promisc_mode_cmdid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1266 | .set_burst_mode_cmdid = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1267 | .en_stats = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1268 | .mu_group_policy = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1269 | .noise_detection = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1270 | .noise_threshold = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1271 | .dpd_enable = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1272 | .set_mcast_bcast_echo = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1273 | .atf_strict_sch = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1274 | .atf_sched_duration = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1275 | .ant_plzn = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1276 | .mgmt_retry_limit = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1277 | .sensitivity_level = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1278 | .signed_txpower_2g = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1279 | .signed_txpower_5g = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1280 | .enable_per_tid_amsdu = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1281 | .enable_per_tid_ampdu = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1282 | .cca_threshold = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1283 | .rts_fixed_rate = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1284 | .pdev_reset = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1285 | .wapi_mbssid_offset = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1286 | .arp_srcaddr = WMI_PDEV_PARAM_UNSUPPORTED, |
| 1287 | .arp_dstaddr = WMI_PDEV_PARAM_UNSUPPORTED, |
Rajkumar Manoharan | 4a16fbe | 2014-12-17 12:21:12 +0200 | [diff] [blame] | 1288 | }; |
| 1289 | |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 1290 | /* firmware 10.2 specific mappings */ |
| 1291 | static struct wmi_cmd_map wmi_10_2_cmd_map = { |
| 1292 | .init_cmdid = WMI_10_2_INIT_CMDID, |
| 1293 | .start_scan_cmdid = WMI_10_2_START_SCAN_CMDID, |
| 1294 | .stop_scan_cmdid = WMI_10_2_STOP_SCAN_CMDID, |
| 1295 | .scan_chan_list_cmdid = WMI_10_2_SCAN_CHAN_LIST_CMDID, |
| 1296 | .scan_sch_prio_tbl_cmdid = WMI_CMD_UNSUPPORTED, |
| 1297 | .pdev_set_regdomain_cmdid = WMI_10_2_PDEV_SET_REGDOMAIN_CMDID, |
| 1298 | .pdev_set_channel_cmdid = WMI_10_2_PDEV_SET_CHANNEL_CMDID, |
| 1299 | .pdev_set_param_cmdid = WMI_10_2_PDEV_SET_PARAM_CMDID, |
| 1300 | .pdev_pktlog_enable_cmdid = WMI_10_2_PDEV_PKTLOG_ENABLE_CMDID, |
| 1301 | .pdev_pktlog_disable_cmdid = WMI_10_2_PDEV_PKTLOG_DISABLE_CMDID, |
| 1302 | .pdev_set_wmm_params_cmdid = WMI_10_2_PDEV_SET_WMM_PARAMS_CMDID, |
| 1303 | .pdev_set_ht_cap_ie_cmdid = WMI_10_2_PDEV_SET_HT_CAP_IE_CMDID, |
| 1304 | .pdev_set_vht_cap_ie_cmdid = WMI_10_2_PDEV_SET_VHT_CAP_IE_CMDID, |
| 1305 | .pdev_set_quiet_mode_cmdid = WMI_10_2_PDEV_SET_QUIET_MODE_CMDID, |
| 1306 | .pdev_green_ap_ps_enable_cmdid = WMI_10_2_PDEV_GREEN_AP_PS_ENABLE_CMDID, |
| 1307 | .pdev_get_tpc_config_cmdid = WMI_10_2_PDEV_GET_TPC_CONFIG_CMDID, |
| 1308 | .pdev_set_base_macaddr_cmdid = WMI_10_2_PDEV_SET_BASE_MACADDR_CMDID, |
| 1309 | .vdev_create_cmdid = WMI_10_2_VDEV_CREATE_CMDID, |
| 1310 | .vdev_delete_cmdid = WMI_10_2_VDEV_DELETE_CMDID, |
| 1311 | .vdev_start_request_cmdid = WMI_10_2_VDEV_START_REQUEST_CMDID, |
| 1312 | .vdev_restart_request_cmdid = WMI_10_2_VDEV_RESTART_REQUEST_CMDID, |
| 1313 | .vdev_up_cmdid = WMI_10_2_VDEV_UP_CMDID, |
| 1314 | .vdev_stop_cmdid = WMI_10_2_VDEV_STOP_CMDID, |
| 1315 | .vdev_down_cmdid = WMI_10_2_VDEV_DOWN_CMDID, |
| 1316 | .vdev_set_param_cmdid = WMI_10_2_VDEV_SET_PARAM_CMDID, |
| 1317 | .vdev_install_key_cmdid = WMI_10_2_VDEV_INSTALL_KEY_CMDID, |
| 1318 | .peer_create_cmdid = WMI_10_2_PEER_CREATE_CMDID, |
| 1319 | .peer_delete_cmdid = WMI_10_2_PEER_DELETE_CMDID, |
| 1320 | .peer_flush_tids_cmdid = WMI_10_2_PEER_FLUSH_TIDS_CMDID, |
| 1321 | .peer_set_param_cmdid = WMI_10_2_PEER_SET_PARAM_CMDID, |
| 1322 | .peer_assoc_cmdid = WMI_10_2_PEER_ASSOC_CMDID, |
| 1323 | .peer_add_wds_entry_cmdid = WMI_10_2_PEER_ADD_WDS_ENTRY_CMDID, |
| 1324 | .peer_remove_wds_entry_cmdid = WMI_10_2_PEER_REMOVE_WDS_ENTRY_CMDID, |
| 1325 | .peer_mcast_group_cmdid = WMI_10_2_PEER_MCAST_GROUP_CMDID, |
| 1326 | .bcn_tx_cmdid = WMI_10_2_BCN_TX_CMDID, |
| 1327 | .pdev_send_bcn_cmdid = WMI_10_2_PDEV_SEND_BCN_CMDID, |
| 1328 | .bcn_tmpl_cmdid = WMI_CMD_UNSUPPORTED, |
| 1329 | .bcn_filter_rx_cmdid = WMI_10_2_BCN_FILTER_RX_CMDID, |
| 1330 | .prb_req_filter_rx_cmdid = WMI_10_2_PRB_REQ_FILTER_RX_CMDID, |
| 1331 | .mgmt_tx_cmdid = WMI_10_2_MGMT_TX_CMDID, |
| 1332 | .prb_tmpl_cmdid = WMI_CMD_UNSUPPORTED, |
| 1333 | .addba_clear_resp_cmdid = WMI_10_2_ADDBA_CLEAR_RESP_CMDID, |
| 1334 | .addba_send_cmdid = WMI_10_2_ADDBA_SEND_CMDID, |
| 1335 | .addba_status_cmdid = WMI_10_2_ADDBA_STATUS_CMDID, |
| 1336 | .delba_send_cmdid = WMI_10_2_DELBA_SEND_CMDID, |
| 1337 | .addba_set_resp_cmdid = WMI_10_2_ADDBA_SET_RESP_CMDID, |
| 1338 | .send_singleamsdu_cmdid = WMI_10_2_SEND_SINGLEAMSDU_CMDID, |
| 1339 | .sta_powersave_mode_cmdid = WMI_10_2_STA_POWERSAVE_MODE_CMDID, |
| 1340 | .sta_powersave_param_cmdid = WMI_10_2_STA_POWERSAVE_PARAM_CMDID, |
| 1341 | .sta_mimo_ps_mode_cmdid = WMI_10_2_STA_MIMO_PS_MODE_CMDID, |
| 1342 | .pdev_dfs_enable_cmdid = WMI_10_2_PDEV_DFS_ENABLE_CMDID, |
| 1343 | .pdev_dfs_disable_cmdid = WMI_10_2_PDEV_DFS_DISABLE_CMDID, |
| 1344 | .roam_scan_mode = WMI_10_2_ROAM_SCAN_MODE, |
| 1345 | .roam_scan_rssi_threshold = WMI_10_2_ROAM_SCAN_RSSI_THRESHOLD, |
| 1346 | .roam_scan_period = WMI_10_2_ROAM_SCAN_PERIOD, |
| 1347 | .roam_scan_rssi_change_threshold = |
| 1348 | WMI_10_2_ROAM_SCAN_RSSI_CHANGE_THRESHOLD, |
| 1349 | .roam_ap_profile = WMI_10_2_ROAM_AP_PROFILE, |
| 1350 | .ofl_scan_add_ap_profile = WMI_10_2_OFL_SCAN_ADD_AP_PROFILE, |
| 1351 | .ofl_scan_remove_ap_profile = WMI_10_2_OFL_SCAN_REMOVE_AP_PROFILE, |
| 1352 | .ofl_scan_period = WMI_10_2_OFL_SCAN_PERIOD, |
| 1353 | .p2p_dev_set_device_info = WMI_10_2_P2P_DEV_SET_DEVICE_INFO, |
| 1354 | .p2p_dev_set_discoverability = WMI_10_2_P2P_DEV_SET_DISCOVERABILITY, |
| 1355 | .p2p_go_set_beacon_ie = WMI_10_2_P2P_GO_SET_BEACON_IE, |
| 1356 | .p2p_go_set_probe_resp_ie = WMI_10_2_P2P_GO_SET_PROBE_RESP_IE, |
| 1357 | .p2p_set_vendor_ie_data_cmdid = WMI_CMD_UNSUPPORTED, |
| 1358 | .ap_ps_peer_param_cmdid = WMI_10_2_AP_PS_PEER_PARAM_CMDID, |
| 1359 | .ap_ps_peer_uapsd_coex_cmdid = WMI_CMD_UNSUPPORTED, |
| 1360 | .peer_rate_retry_sched_cmdid = WMI_10_2_PEER_RATE_RETRY_SCHED_CMDID, |
| 1361 | .wlan_profile_trigger_cmdid = WMI_10_2_WLAN_PROFILE_TRIGGER_CMDID, |
| 1362 | .wlan_profile_set_hist_intvl_cmdid = |
| 1363 | WMI_10_2_WLAN_PROFILE_SET_HIST_INTVL_CMDID, |
| 1364 | .wlan_profile_get_profile_data_cmdid = |
| 1365 | WMI_10_2_WLAN_PROFILE_GET_PROFILE_DATA_CMDID, |
| 1366 | .wlan_profile_enable_profile_id_cmdid = |
| 1367 | WMI_10_2_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID, |
| 1368 | .wlan_profile_list_profile_id_cmdid = |
| 1369 | WMI_10_2_WLAN_PROFILE_LIST_PROFILE_ID_CMDID, |
| 1370 | .pdev_suspend_cmdid = WMI_10_2_PDEV_SUSPEND_CMDID, |
| 1371 | .pdev_resume_cmdid = WMI_10_2_PDEV_RESUME_CMDID, |
| 1372 | .add_bcn_filter_cmdid = WMI_10_2_ADD_BCN_FILTER_CMDID, |
| 1373 | .rmv_bcn_filter_cmdid = WMI_10_2_RMV_BCN_FILTER_CMDID, |
| 1374 | .wow_add_wake_pattern_cmdid = WMI_10_2_WOW_ADD_WAKE_PATTERN_CMDID, |
| 1375 | .wow_del_wake_pattern_cmdid = WMI_10_2_WOW_DEL_WAKE_PATTERN_CMDID, |
| 1376 | .wow_enable_disable_wake_event_cmdid = |
| 1377 | WMI_10_2_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID, |
| 1378 | .wow_enable_cmdid = WMI_10_2_WOW_ENABLE_CMDID, |
| 1379 | .wow_hostwakeup_from_sleep_cmdid = |
| 1380 | WMI_10_2_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID, |
| 1381 | .rtt_measreq_cmdid = WMI_10_2_RTT_MEASREQ_CMDID, |
| 1382 | .rtt_tsf_cmdid = WMI_10_2_RTT_TSF_CMDID, |
| 1383 | .vdev_spectral_scan_configure_cmdid = |
| 1384 | WMI_10_2_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID, |
| 1385 | .vdev_spectral_scan_enable_cmdid = |
| 1386 | WMI_10_2_VDEV_SPECTRAL_SCAN_ENABLE_CMDID, |
| 1387 | .request_stats_cmdid = WMI_10_2_REQUEST_STATS_CMDID, |
| 1388 | .set_arp_ns_offload_cmdid = WMI_CMD_UNSUPPORTED, |
| 1389 | .network_list_offload_config_cmdid = WMI_CMD_UNSUPPORTED, |
| 1390 | .gtk_offload_cmdid = WMI_CMD_UNSUPPORTED, |
| 1391 | .csa_offload_enable_cmdid = WMI_CMD_UNSUPPORTED, |
| 1392 | .csa_offload_chanswitch_cmdid = WMI_CMD_UNSUPPORTED, |
| 1393 | .chatter_set_mode_cmdid = WMI_CMD_UNSUPPORTED, |
| 1394 | .peer_tid_addba_cmdid = WMI_CMD_UNSUPPORTED, |
| 1395 | .peer_tid_delba_cmdid = WMI_CMD_UNSUPPORTED, |
| 1396 | .sta_dtim_ps_method_cmdid = WMI_CMD_UNSUPPORTED, |
| 1397 | .sta_uapsd_auto_trig_cmdid = WMI_CMD_UNSUPPORTED, |
| 1398 | .sta_keepalive_cmd = WMI_CMD_UNSUPPORTED, |
| 1399 | .echo_cmdid = WMI_10_2_ECHO_CMDID, |
| 1400 | .pdev_utf_cmdid = WMI_10_2_PDEV_UTF_CMDID, |
| 1401 | .dbglog_cfg_cmdid = WMI_10_2_DBGLOG_CFG_CMDID, |
| 1402 | .pdev_qvit_cmdid = WMI_10_2_PDEV_QVIT_CMDID, |
| 1403 | .pdev_ftm_intg_cmdid = WMI_CMD_UNSUPPORTED, |
| 1404 | .vdev_set_keepalive_cmdid = WMI_CMD_UNSUPPORTED, |
| 1405 | .vdev_get_keepalive_cmdid = WMI_CMD_UNSUPPORTED, |
| 1406 | .force_fw_hang_cmdid = WMI_CMD_UNSUPPORTED, |
| 1407 | .gpio_config_cmdid = WMI_10_2_GPIO_CONFIG_CMDID, |
| 1408 | .gpio_output_cmdid = WMI_10_2_GPIO_OUTPUT_CMDID, |
Rajkumar Manoharan | a57a6a2 | 2014-12-17 12:22:17 +0200 | [diff] [blame] | 1409 | .pdev_get_temperature_cmdid = WMI_CMD_UNSUPPORTED, |
Raja Mani | 772b4ae | 2015-06-22 20:10:12 +0530 | [diff] [blame] | 1410 | .scan_update_request_cmdid = WMI_CMD_UNSUPPORTED, |
| 1411 | .vdev_standby_response_cmdid = WMI_CMD_UNSUPPORTED, |
| 1412 | .vdev_resume_response_cmdid = WMI_CMD_UNSUPPORTED, |
| 1413 | .wlan_peer_caching_add_peer_cmdid = WMI_CMD_UNSUPPORTED, |
| 1414 | .wlan_peer_caching_evict_peer_cmdid = WMI_CMD_UNSUPPORTED, |
| 1415 | .wlan_peer_caching_restore_peer_cmdid = WMI_CMD_UNSUPPORTED, |
| 1416 | .wlan_peer_caching_print_all_peers_info_cmdid = WMI_CMD_UNSUPPORTED, |
| 1417 | .peer_update_wds_entry_cmdid = WMI_CMD_UNSUPPORTED, |
| 1418 | .peer_add_proxy_sta_entry_cmdid = WMI_CMD_UNSUPPORTED, |
| 1419 | .rtt_keepalive_cmdid = WMI_CMD_UNSUPPORTED, |
| 1420 | .oem_req_cmdid = WMI_CMD_UNSUPPORTED, |
| 1421 | .nan_cmdid = WMI_CMD_UNSUPPORTED, |
| 1422 | .vdev_ratemask_cmdid = WMI_CMD_UNSUPPORTED, |
| 1423 | .qboost_cfg_cmdid = WMI_CMD_UNSUPPORTED, |
| 1424 | .pdev_smart_ant_enable_cmdid = WMI_CMD_UNSUPPORTED, |
| 1425 | .pdev_smart_ant_set_rx_antenna_cmdid = WMI_CMD_UNSUPPORTED, |
| 1426 | .peer_smart_ant_set_tx_antenna_cmdid = WMI_CMD_UNSUPPORTED, |
| 1427 | .peer_smart_ant_set_train_info_cmdid = WMI_CMD_UNSUPPORTED, |
| 1428 | .peer_smart_ant_set_node_config_ops_cmdid = WMI_CMD_UNSUPPORTED, |
| 1429 | .pdev_set_antenna_switch_table_cmdid = WMI_CMD_UNSUPPORTED, |
| 1430 | .pdev_set_ctl_table_cmdid = WMI_CMD_UNSUPPORTED, |
| 1431 | .pdev_set_mimogain_table_cmdid = WMI_CMD_UNSUPPORTED, |
| 1432 | .pdev_ratepwr_table_cmdid = WMI_CMD_UNSUPPORTED, |
| 1433 | .pdev_ratepwr_chainmsk_table_cmdid = WMI_CMD_UNSUPPORTED, |
| 1434 | .pdev_fips_cmdid = WMI_CMD_UNSUPPORTED, |
| 1435 | .tt_set_conf_cmdid = WMI_CMD_UNSUPPORTED, |
| 1436 | .fwtest_cmdid = WMI_CMD_UNSUPPORTED, |
| 1437 | .vdev_atf_request_cmdid = WMI_CMD_UNSUPPORTED, |
| 1438 | .peer_atf_request_cmdid = WMI_CMD_UNSUPPORTED, |
| 1439 | .pdev_get_ani_cck_config_cmdid = WMI_CMD_UNSUPPORTED, |
| 1440 | .pdev_get_ani_ofdm_config_cmdid = WMI_CMD_UNSUPPORTED, |
| 1441 | .pdev_reserve_ast_entry_cmdid = WMI_CMD_UNSUPPORTED, |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 1442 | }; |
| 1443 | |
Raja Mani | d86561f | 2015-06-22 20:10:14 +0530 | [diff] [blame] | 1444 | static struct wmi_pdev_param_map wmi_10_4_pdev_param_map = { |
| 1445 | .tx_chain_mask = WMI_10_4_PDEV_PARAM_TX_CHAIN_MASK, |
| 1446 | .rx_chain_mask = WMI_10_4_PDEV_PARAM_RX_CHAIN_MASK, |
| 1447 | .txpower_limit2g = WMI_10_4_PDEV_PARAM_TXPOWER_LIMIT2G, |
| 1448 | .txpower_limit5g = WMI_10_4_PDEV_PARAM_TXPOWER_LIMIT5G, |
| 1449 | .txpower_scale = WMI_10_4_PDEV_PARAM_TXPOWER_SCALE, |
| 1450 | .beacon_gen_mode = WMI_10_4_PDEV_PARAM_BEACON_GEN_MODE, |
| 1451 | .beacon_tx_mode = WMI_10_4_PDEV_PARAM_BEACON_TX_MODE, |
| 1452 | .resmgr_offchan_mode = WMI_10_4_PDEV_PARAM_RESMGR_OFFCHAN_MODE, |
| 1453 | .protection_mode = WMI_10_4_PDEV_PARAM_PROTECTION_MODE, |
| 1454 | .dynamic_bw = WMI_10_4_PDEV_PARAM_DYNAMIC_BW, |
| 1455 | .non_agg_sw_retry_th = WMI_10_4_PDEV_PARAM_NON_AGG_SW_RETRY_TH, |
| 1456 | .agg_sw_retry_th = WMI_10_4_PDEV_PARAM_AGG_SW_RETRY_TH, |
| 1457 | .sta_kickout_th = WMI_10_4_PDEV_PARAM_STA_KICKOUT_TH, |
| 1458 | .ac_aggrsize_scaling = WMI_10_4_PDEV_PARAM_AC_AGGRSIZE_SCALING, |
| 1459 | .ltr_enable = WMI_10_4_PDEV_PARAM_LTR_ENABLE, |
| 1460 | .ltr_ac_latency_be = WMI_10_4_PDEV_PARAM_LTR_AC_LATENCY_BE, |
| 1461 | .ltr_ac_latency_bk = WMI_10_4_PDEV_PARAM_LTR_AC_LATENCY_BK, |
| 1462 | .ltr_ac_latency_vi = WMI_10_4_PDEV_PARAM_LTR_AC_LATENCY_VI, |
| 1463 | .ltr_ac_latency_vo = WMI_10_4_PDEV_PARAM_LTR_AC_LATENCY_VO, |
| 1464 | .ltr_ac_latency_timeout = WMI_10_4_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT, |
| 1465 | .ltr_sleep_override = WMI_10_4_PDEV_PARAM_LTR_SLEEP_OVERRIDE, |
| 1466 | .ltr_rx_override = WMI_10_4_PDEV_PARAM_LTR_RX_OVERRIDE, |
| 1467 | .ltr_tx_activity_timeout = WMI_10_4_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT, |
| 1468 | .l1ss_enable = WMI_10_4_PDEV_PARAM_L1SS_ENABLE, |
| 1469 | .dsleep_enable = WMI_10_4_PDEV_PARAM_DSLEEP_ENABLE, |
| 1470 | .pcielp_txbuf_flush = WMI_10_4_PDEV_PARAM_PCIELP_TXBUF_FLUSH, |
| 1471 | .pcielp_txbuf_watermark = WMI_10_4_PDEV_PARAM_PCIELP_TXBUF_WATERMARK, |
| 1472 | .pcielp_txbuf_tmo_en = WMI_10_4_PDEV_PARAM_PCIELP_TXBUF_TMO_EN, |
| 1473 | .pcielp_txbuf_tmo_value = WMI_10_4_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE, |
| 1474 | .pdev_stats_update_period = |
| 1475 | WMI_10_4_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD, |
| 1476 | .vdev_stats_update_period = |
| 1477 | WMI_10_4_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD, |
| 1478 | .peer_stats_update_period = |
| 1479 | WMI_10_4_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD, |
| 1480 | .bcnflt_stats_update_period = |
| 1481 | WMI_10_4_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD, |
| 1482 | .pmf_qos = WMI_10_4_PDEV_PARAM_PMF_QOS, |
| 1483 | .arp_ac_override = WMI_10_4_PDEV_PARAM_ARP_AC_OVERRIDE, |
| 1484 | .dcs = WMI_10_4_PDEV_PARAM_DCS, |
| 1485 | .ani_enable = WMI_10_4_PDEV_PARAM_ANI_ENABLE, |
| 1486 | .ani_poll_period = WMI_10_4_PDEV_PARAM_ANI_POLL_PERIOD, |
| 1487 | .ani_listen_period = WMI_10_4_PDEV_PARAM_ANI_LISTEN_PERIOD, |
| 1488 | .ani_ofdm_level = WMI_10_4_PDEV_PARAM_ANI_OFDM_LEVEL, |
| 1489 | .ani_cck_level = WMI_10_4_PDEV_PARAM_ANI_CCK_LEVEL, |
| 1490 | .dyntxchain = WMI_10_4_PDEV_PARAM_DYNTXCHAIN, |
| 1491 | .proxy_sta = WMI_10_4_PDEV_PARAM_PROXY_STA, |
| 1492 | .idle_ps_config = WMI_10_4_PDEV_PARAM_IDLE_PS_CONFIG, |
| 1493 | .power_gating_sleep = WMI_10_4_PDEV_PARAM_POWER_GATING_SLEEP, |
| 1494 | .fast_channel_reset = WMI_10_4_PDEV_PARAM_FAST_CHANNEL_RESET, |
| 1495 | .burst_dur = WMI_10_4_PDEV_PARAM_BURST_DUR, |
| 1496 | .burst_enable = WMI_10_4_PDEV_PARAM_BURST_ENABLE, |
| 1497 | .cal_period = WMI_10_4_PDEV_PARAM_CAL_PERIOD, |
| 1498 | .aggr_burst = WMI_10_4_PDEV_PARAM_AGGR_BURST, |
| 1499 | .rx_decap_mode = WMI_10_4_PDEV_PARAM_RX_DECAP_MODE, |
| 1500 | .smart_antenna_default_antenna = |
| 1501 | WMI_10_4_PDEV_PARAM_SMART_ANTENNA_DEFAULT_ANTENNA, |
| 1502 | .igmpmld_override = WMI_10_4_PDEV_PARAM_IGMPMLD_OVERRIDE, |
| 1503 | .igmpmld_tid = WMI_10_4_PDEV_PARAM_IGMPMLD_TID, |
| 1504 | .antenna_gain = WMI_10_4_PDEV_PARAM_ANTENNA_GAIN, |
| 1505 | .rx_filter = WMI_10_4_PDEV_PARAM_RX_FILTER, |
| 1506 | .set_mcast_to_ucast_tid = WMI_10_4_PDEV_SET_MCAST_TO_UCAST_TID, |
| 1507 | .proxy_sta_mode = WMI_10_4_PDEV_PARAM_PROXY_STA_MODE, |
| 1508 | .set_mcast2ucast_mode = WMI_10_4_PDEV_PARAM_SET_MCAST2UCAST_MODE, |
| 1509 | .set_mcast2ucast_buffer = WMI_10_4_PDEV_PARAM_SET_MCAST2UCAST_BUFFER, |
| 1510 | .remove_mcast2ucast_buffer = |
| 1511 | WMI_10_4_PDEV_PARAM_REMOVE_MCAST2UCAST_BUFFER, |
| 1512 | .peer_sta_ps_statechg_enable = |
| 1513 | WMI_10_4_PDEV_PEER_STA_PS_STATECHG_ENABLE, |
| 1514 | .igmpmld_ac_override = WMI_10_4_PDEV_PARAM_IGMPMLD_AC_OVERRIDE, |
| 1515 | .block_interbss = WMI_10_4_PDEV_PARAM_BLOCK_INTERBSS, |
| 1516 | .set_disable_reset_cmdid = WMI_10_4_PDEV_PARAM_SET_DISABLE_RESET_CMDID, |
| 1517 | .set_msdu_ttl_cmdid = WMI_10_4_PDEV_PARAM_SET_MSDU_TTL_CMDID, |
| 1518 | .set_ppdu_duration_cmdid = WMI_10_4_PDEV_PARAM_SET_PPDU_DURATION_CMDID, |
| 1519 | .txbf_sound_period_cmdid = WMI_10_4_PDEV_PARAM_TXBF_SOUND_PERIOD_CMDID, |
| 1520 | .set_promisc_mode_cmdid = WMI_10_4_PDEV_PARAM_SET_PROMISC_MODE_CMDID, |
| 1521 | .set_burst_mode_cmdid = WMI_10_4_PDEV_PARAM_SET_BURST_MODE_CMDID, |
| 1522 | .en_stats = WMI_10_4_PDEV_PARAM_EN_STATS, |
| 1523 | .mu_group_policy = WMI_10_4_PDEV_PARAM_MU_GROUP_POLICY, |
| 1524 | .noise_detection = WMI_10_4_PDEV_PARAM_NOISE_DETECTION, |
| 1525 | .noise_threshold = WMI_10_4_PDEV_PARAM_NOISE_THRESHOLD, |
| 1526 | .dpd_enable = WMI_10_4_PDEV_PARAM_DPD_ENABLE, |
| 1527 | .set_mcast_bcast_echo = WMI_10_4_PDEV_PARAM_SET_MCAST_BCAST_ECHO, |
| 1528 | .atf_strict_sch = WMI_10_4_PDEV_PARAM_ATF_STRICT_SCH, |
| 1529 | .atf_sched_duration = WMI_10_4_PDEV_PARAM_ATF_SCHED_DURATION, |
| 1530 | .ant_plzn = WMI_10_4_PDEV_PARAM_ANT_PLZN, |
| 1531 | .mgmt_retry_limit = WMI_10_4_PDEV_PARAM_MGMT_RETRY_LIMIT, |
| 1532 | .sensitivity_level = WMI_10_4_PDEV_PARAM_SENSITIVITY_LEVEL, |
| 1533 | .signed_txpower_2g = WMI_10_4_PDEV_PARAM_SIGNED_TXPOWER_2G, |
| 1534 | .signed_txpower_5g = WMI_10_4_PDEV_PARAM_SIGNED_TXPOWER_5G, |
| 1535 | .enable_per_tid_amsdu = WMI_10_4_PDEV_PARAM_ENABLE_PER_TID_AMSDU, |
| 1536 | .enable_per_tid_ampdu = WMI_10_4_PDEV_PARAM_ENABLE_PER_TID_AMPDU, |
| 1537 | .cca_threshold = WMI_10_4_PDEV_PARAM_CCA_THRESHOLD, |
| 1538 | .rts_fixed_rate = WMI_10_4_PDEV_PARAM_RTS_FIXED_RATE, |
| 1539 | .pdev_reset = WMI_10_4_PDEV_PARAM_PDEV_RESET, |
| 1540 | .wapi_mbssid_offset = WMI_10_4_PDEV_PARAM_WAPI_MBSSID_OFFSET, |
| 1541 | .arp_srcaddr = WMI_10_4_PDEV_PARAM_ARP_SRCADDR, |
| 1542 | .arp_dstaddr = WMI_10_4_PDEV_PARAM_ARP_DSTADDR, |
| 1543 | }; |
| 1544 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 1545 | void ath10k_wmi_put_wmi_channel(struct wmi_channel *ch, |
| 1546 | const struct wmi_channel_arg *arg) |
Michal Kazior | 2d66721 | 2014-09-18 15:21:21 +0200 | [diff] [blame] | 1547 | { |
| 1548 | u32 flags = 0; |
| 1549 | |
| 1550 | memset(ch, 0, sizeof(*ch)); |
| 1551 | |
| 1552 | if (arg->passive) |
| 1553 | flags |= WMI_CHAN_FLAG_PASSIVE; |
| 1554 | if (arg->allow_ibss) |
| 1555 | flags |= WMI_CHAN_FLAG_ADHOC_ALLOWED; |
| 1556 | if (arg->allow_ht) |
| 1557 | flags |= WMI_CHAN_FLAG_ALLOW_HT; |
| 1558 | if (arg->allow_vht) |
| 1559 | flags |= WMI_CHAN_FLAG_ALLOW_VHT; |
| 1560 | if (arg->ht40plus) |
| 1561 | flags |= WMI_CHAN_FLAG_HT40_PLUS; |
| 1562 | if (arg->chan_radar) |
| 1563 | flags |= WMI_CHAN_FLAG_DFS; |
| 1564 | |
| 1565 | ch->mhz = __cpu_to_le32(arg->freq); |
| 1566 | ch->band_center_freq1 = __cpu_to_le32(arg->band_center_freq1); |
| 1567 | ch->band_center_freq2 = 0; |
| 1568 | ch->min_power = arg->min_power; |
| 1569 | ch->max_power = arg->max_power; |
| 1570 | ch->reg_power = arg->max_reg_power; |
| 1571 | ch->antenna_max = arg->max_antenna_gain; |
| 1572 | |
| 1573 | /* mode & flags share storage */ |
| 1574 | ch->mode = arg->mode; |
| 1575 | ch->flags |= __cpu_to_le32(flags); |
| 1576 | } |
| 1577 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1578 | int ath10k_wmi_wait_for_service_ready(struct ath10k *ar) |
| 1579 | { |
Nicholas Mc Guire | 9eea568 | 2015-03-30 15:39:21 +0300 | [diff] [blame] | 1580 | unsigned long time_left; |
Kalle Valo | af762c0 | 2014-09-14 12:50:17 +0300 | [diff] [blame] | 1581 | |
Nicholas Mc Guire | 9eea568 | 2015-03-30 15:39:21 +0300 | [diff] [blame] | 1582 | time_left = wait_for_completion_timeout(&ar->wmi.service_ready, |
| 1583 | WMI_SERVICE_READY_TIMEOUT_HZ); |
| 1584 | if (!time_left) |
| 1585 | return -ETIMEDOUT; |
| 1586 | return 0; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1587 | } |
| 1588 | |
| 1589 | int ath10k_wmi_wait_for_unified_ready(struct ath10k *ar) |
| 1590 | { |
Nicholas Mc Guire | 9eea568 | 2015-03-30 15:39:21 +0300 | [diff] [blame] | 1591 | unsigned long time_left; |
Kalle Valo | af762c0 | 2014-09-14 12:50:17 +0300 | [diff] [blame] | 1592 | |
Nicholas Mc Guire | 9eea568 | 2015-03-30 15:39:21 +0300 | [diff] [blame] | 1593 | time_left = wait_for_completion_timeout(&ar->wmi.unified_ready, |
| 1594 | WMI_UNIFIED_READY_TIMEOUT_HZ); |
| 1595 | if (!time_left) |
| 1596 | return -ETIMEDOUT; |
| 1597 | return 0; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1598 | } |
| 1599 | |
Kalle Valo | 666a73f3 | 2014-09-10 18:23:23 +0300 | [diff] [blame] | 1600 | struct sk_buff *ath10k_wmi_alloc_skb(struct ath10k *ar, u32 len) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1601 | { |
| 1602 | struct sk_buff *skb; |
| 1603 | u32 round_len = roundup(len, 4); |
| 1604 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 1605 | skb = ath10k_htc_alloc_skb(ar, WMI_SKB_HEADROOM + round_len); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1606 | if (!skb) |
| 1607 | return NULL; |
| 1608 | |
| 1609 | skb_reserve(skb, WMI_SKB_HEADROOM); |
| 1610 | if (!IS_ALIGNED((unsigned long)skb->data, 4)) |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 1611 | ath10k_warn(ar, "Unaligned WMI skb\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1612 | |
| 1613 | skb_put(skb, round_len); |
| 1614 | memset(skb->data, 0, round_len); |
| 1615 | |
| 1616 | return skb; |
| 1617 | } |
| 1618 | |
| 1619 | static void ath10k_wmi_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb) |
| 1620 | { |
| 1621 | dev_kfree_skb(skb); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1622 | } |
| 1623 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 1624 | int ath10k_wmi_cmd_send_nowait(struct ath10k *ar, struct sk_buff *skb, |
| 1625 | u32 cmd_id) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1626 | { |
| 1627 | struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb); |
| 1628 | struct wmi_cmd_hdr *cmd_hdr; |
Michal Kazior | be8b394 | 2013-09-13 14:16:54 +0200 | [diff] [blame] | 1629 | int ret; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1630 | u32 cmd = 0; |
| 1631 | |
| 1632 | if (skb_push(skb, sizeof(struct wmi_cmd_hdr)) == NULL) |
| 1633 | return -ENOMEM; |
| 1634 | |
| 1635 | cmd |= SM(cmd_id, WMI_CMD_HDR_CMD_ID); |
| 1636 | |
| 1637 | cmd_hdr = (struct wmi_cmd_hdr *)skb->data; |
| 1638 | cmd_hdr->cmd_id = __cpu_to_le32(cmd); |
| 1639 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1640 | memset(skb_cb, 0, sizeof(*skb_cb)); |
Michal Kazior | be8b394 | 2013-09-13 14:16:54 +0200 | [diff] [blame] | 1641 | ret = ath10k_htc_send(&ar->htc, ar->wmi.eid, skb); |
Michal Kazior | d35a6c1 | 2014-09-02 11:00:21 +0300 | [diff] [blame] | 1642 | trace_ath10k_wmi_cmd(ar, cmd_id, skb->data, skb->len, ret); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1643 | |
Michal Kazior | be8b394 | 2013-09-13 14:16:54 +0200 | [diff] [blame] | 1644 | if (ret) |
| 1645 | goto err_pull; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1646 | |
| 1647 | return 0; |
Michal Kazior | be8b394 | 2013-09-13 14:16:54 +0200 | [diff] [blame] | 1648 | |
| 1649 | err_pull: |
| 1650 | skb_pull(skb, sizeof(struct wmi_cmd_hdr)); |
| 1651 | return ret; |
| 1652 | } |
| 1653 | |
Michal Kazior | ed54388 | 2013-09-13 14:16:56 +0200 | [diff] [blame] | 1654 | static void ath10k_wmi_tx_beacon_nowait(struct ath10k_vif *arvif) |
| 1655 | { |
Michal Kazior | af21319 | 2015-01-29 14:29:52 +0200 | [diff] [blame] | 1656 | struct ath10k *ar = arvif->ar; |
Michal Kazior | 9ad5018 | 2015-01-29 14:29:47 +0200 | [diff] [blame] | 1657 | struct ath10k_skb_cb *cb; |
Michal Kazior | af21319 | 2015-01-29 14:29:52 +0200 | [diff] [blame] | 1658 | struct sk_buff *bcn; |
Michal Kazior | ed54388 | 2013-09-13 14:16:56 +0200 | [diff] [blame] | 1659 | int ret; |
| 1660 | |
Michal Kazior | af21319 | 2015-01-29 14:29:52 +0200 | [diff] [blame] | 1661 | spin_lock_bh(&ar->data_lock); |
Michal Kazior | ed54388 | 2013-09-13 14:16:56 +0200 | [diff] [blame] | 1662 | |
Michal Kazior | 9ad5018 | 2015-01-29 14:29:47 +0200 | [diff] [blame] | 1663 | bcn = arvif->beacon; |
Michal Kazior | ed54388 | 2013-09-13 14:16:56 +0200 | [diff] [blame] | 1664 | |
Michal Kazior | af21319 | 2015-01-29 14:29:52 +0200 | [diff] [blame] | 1665 | if (!bcn) |
| 1666 | goto unlock; |
Michal Kazior | ed54388 | 2013-09-13 14:16:56 +0200 | [diff] [blame] | 1667 | |
Michal Kazior | af21319 | 2015-01-29 14:29:52 +0200 | [diff] [blame] | 1668 | cb = ATH10K_SKB_CB(bcn); |
Michal Kazior | ed54388 | 2013-09-13 14:16:56 +0200 | [diff] [blame] | 1669 | |
Michal Kazior | af21319 | 2015-01-29 14:29:52 +0200 | [diff] [blame] | 1670 | switch (arvif->beacon_state) { |
| 1671 | case ATH10K_BEACON_SENDING: |
| 1672 | case ATH10K_BEACON_SENT: |
| 1673 | break; |
| 1674 | case ATH10K_BEACON_SCHEDULED: |
| 1675 | arvif->beacon_state = ATH10K_BEACON_SENDING; |
| 1676 | spin_unlock_bh(&ar->data_lock); |
| 1677 | |
| 1678 | ret = ath10k_wmi_beacon_send_ref_nowait(arvif->ar, |
| 1679 | arvif->vdev_id, |
| 1680 | bcn->data, bcn->len, |
| 1681 | cb->paddr, |
| 1682 | cb->bcn.dtim_zero, |
| 1683 | cb->bcn.deliver_cab); |
| 1684 | |
| 1685 | spin_lock_bh(&ar->data_lock); |
| 1686 | |
| 1687 | if (ret == 0) |
| 1688 | arvif->beacon_state = ATH10K_BEACON_SENT; |
| 1689 | else |
| 1690 | arvif->beacon_state = ATH10K_BEACON_SCHEDULED; |
| 1691 | } |
| 1692 | |
| 1693 | unlock: |
| 1694 | spin_unlock_bh(&ar->data_lock); |
Michal Kazior | ed54388 | 2013-09-13 14:16:56 +0200 | [diff] [blame] | 1695 | } |
| 1696 | |
| 1697 | static void ath10k_wmi_tx_beacons_iter(void *data, u8 *mac, |
| 1698 | struct ieee80211_vif *vif) |
| 1699 | { |
| 1700 | struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif); |
| 1701 | |
| 1702 | ath10k_wmi_tx_beacon_nowait(arvif); |
| 1703 | } |
| 1704 | |
| 1705 | static void ath10k_wmi_tx_beacons_nowait(struct ath10k *ar) |
| 1706 | { |
Michal Kazior | ed54388 | 2013-09-13 14:16:56 +0200 | [diff] [blame] | 1707 | ieee80211_iterate_active_interfaces_atomic(ar->hw, |
| 1708 | IEEE80211_IFACE_ITER_NORMAL, |
| 1709 | ath10k_wmi_tx_beacons_iter, |
| 1710 | NULL); |
Michal Kazior | ed54388 | 2013-09-13 14:16:56 +0200 | [diff] [blame] | 1711 | } |
| 1712 | |
Michal Kazior | 12acbc4 | 2013-09-13 14:16:55 +0200 | [diff] [blame] | 1713 | static void ath10k_wmi_op_ep_tx_credits(struct ath10k *ar) |
Michal Kazior | be8b394 | 2013-09-13 14:16:54 +0200 | [diff] [blame] | 1714 | { |
Michal Kazior | ed54388 | 2013-09-13 14:16:56 +0200 | [diff] [blame] | 1715 | /* try to send pending beacons first. they take priority */ |
| 1716 | ath10k_wmi_tx_beacons_nowait(ar); |
| 1717 | |
Michal Kazior | be8b394 | 2013-09-13 14:16:54 +0200 | [diff] [blame] | 1718 | wake_up(&ar->wmi.tx_credits_wq); |
| 1719 | } |
| 1720 | |
Kalle Valo | 666a73f3 | 2014-09-10 18:23:23 +0300 | [diff] [blame] | 1721 | int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id) |
Michal Kazior | be8b394 | 2013-09-13 14:16:54 +0200 | [diff] [blame] | 1722 | { |
Bartosz Markowski | 34957b2 | 2013-10-15 09:55:31 +0200 | [diff] [blame] | 1723 | int ret = -EOPNOTSUPP; |
Michal Kazior | be8b394 | 2013-09-13 14:16:54 +0200 | [diff] [blame] | 1724 | |
Kalle Valo | 56b8428 | 2013-10-16 15:44:47 +0300 | [diff] [blame] | 1725 | might_sleep(); |
| 1726 | |
Bartosz Markowski | 34957b2 | 2013-10-15 09:55:31 +0200 | [diff] [blame] | 1727 | if (cmd_id == WMI_CMD_UNSUPPORTED) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 1728 | ath10k_warn(ar, "wmi command %d is not supported by firmware\n", |
Bartosz Markowski | 5532155 | 2013-09-26 17:47:07 +0200 | [diff] [blame] | 1729 | cmd_id); |
| 1730 | return ret; |
| 1731 | } |
Michal Kazior | be8b394 | 2013-09-13 14:16:54 +0200 | [diff] [blame] | 1732 | |
| 1733 | wait_event_timeout(ar->wmi.tx_credits_wq, ({ |
Michal Kazior | ed54388 | 2013-09-13 14:16:56 +0200 | [diff] [blame] | 1734 | /* try to send pending beacons first. they take priority */ |
| 1735 | ath10k_wmi_tx_beacons_nowait(ar); |
| 1736 | |
Michal Kazior | be8b394 | 2013-09-13 14:16:54 +0200 | [diff] [blame] | 1737 | ret = ath10k_wmi_cmd_send_nowait(ar, skb, cmd_id); |
Michal Kazior | 7962b0d | 2014-10-28 10:34:38 +0100 | [diff] [blame] | 1738 | |
| 1739 | if (ret && test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags)) |
| 1740 | ret = -ESHUTDOWN; |
| 1741 | |
Michal Kazior | be8b394 | 2013-09-13 14:16:54 +0200 | [diff] [blame] | 1742 | (ret != -EAGAIN); |
| 1743 | }), 3*HZ); |
| 1744 | |
| 1745 | if (ret) |
| 1746 | dev_kfree_skb_any(skb); |
| 1747 | |
| 1748 | return ret; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1749 | } |
| 1750 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 1751 | static struct sk_buff * |
| 1752 | ath10k_wmi_op_gen_mgmt_tx(struct ath10k *ar, struct sk_buff *msdu) |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 1753 | { |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 1754 | struct wmi_mgmt_tx_cmd *cmd; |
| 1755 | struct ieee80211_hdr *hdr; |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 1756 | struct sk_buff *skb; |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 1757 | int len; |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 1758 | u32 buf_len = msdu->len; |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 1759 | u16 fc; |
| 1760 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 1761 | hdr = (struct ieee80211_hdr *)msdu->data; |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 1762 | fc = le16_to_cpu(hdr->frame_control); |
| 1763 | |
| 1764 | if (WARN_ON_ONCE(!ieee80211_is_mgmt(hdr->frame_control))) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 1765 | return ERR_PTR(-EINVAL); |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 1766 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 1767 | len = sizeof(cmd->hdr) + msdu->len; |
Marek Kwaczynski | eeab266 | 2014-05-14 16:56:17 +0300 | [diff] [blame] | 1768 | |
| 1769 | if ((ieee80211_is_action(hdr->frame_control) || |
| 1770 | ieee80211_is_deauth(hdr->frame_control) || |
| 1771 | ieee80211_is_disassoc(hdr->frame_control)) && |
| 1772 | ieee80211_has_protected(hdr->frame_control)) { |
| 1773 | len += IEEE80211_CCMP_MIC_LEN; |
| 1774 | buf_len += IEEE80211_CCMP_MIC_LEN; |
| 1775 | } |
| 1776 | |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 1777 | len = round_up(len, 4); |
| 1778 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 1779 | skb = ath10k_wmi_alloc_skb(ar, len); |
| 1780 | if (!skb) |
| 1781 | return ERR_PTR(-ENOMEM); |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 1782 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 1783 | cmd = (struct wmi_mgmt_tx_cmd *)skb->data; |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 1784 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 1785 | cmd->hdr.vdev_id = __cpu_to_le32(ATH10K_SKB_CB(msdu)->vdev_id); |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 1786 | cmd->hdr.tx_rate = 0; |
| 1787 | cmd->hdr.tx_power = 0; |
Marek Kwaczynski | eeab266 | 2014-05-14 16:56:17 +0300 | [diff] [blame] | 1788 | cmd->hdr.buf_len = __cpu_to_le32(buf_len); |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 1789 | |
Kalle Valo | b25f32c | 2014-09-14 12:50:49 +0300 | [diff] [blame] | 1790 | ether_addr_copy(cmd->hdr.peer_macaddr.addr, ieee80211_get_DA(hdr)); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 1791 | memcpy(cmd->buf, msdu->data, msdu->len); |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 1792 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 1793 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi mgmt tx skb %p len %d ftype %02x stype %02x\n", |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 1794 | msdu, skb->len, fc & IEEE80211_FCTL_FTYPE, |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 1795 | fc & IEEE80211_FCTL_STYPE); |
Rajkumar Manoharan | 5ce8e7f | 2014-11-05 19:14:31 +0530 | [diff] [blame] | 1796 | trace_ath10k_tx_hdr(ar, skb->data, skb->len); |
| 1797 | trace_ath10k_tx_payload(ar, skb->data, skb->len); |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 1798 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 1799 | return skb; |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 1800 | } |
| 1801 | |
Michal Kazior | 5c81c7f | 2014-08-05 14:54:44 +0200 | [diff] [blame] | 1802 | static void ath10k_wmi_event_scan_started(struct ath10k *ar) |
| 1803 | { |
| 1804 | lockdep_assert_held(&ar->data_lock); |
| 1805 | |
| 1806 | switch (ar->scan.state) { |
| 1807 | case ATH10K_SCAN_IDLE: |
| 1808 | case ATH10K_SCAN_RUNNING: |
| 1809 | case ATH10K_SCAN_ABORTING: |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 1810 | ath10k_warn(ar, "received scan started event in an invalid scan state: %s (%d)\n", |
Michal Kazior | 5c81c7f | 2014-08-05 14:54:44 +0200 | [diff] [blame] | 1811 | ath10k_scan_state_str(ar->scan.state), |
| 1812 | ar->scan.state); |
| 1813 | break; |
| 1814 | case ATH10K_SCAN_STARTING: |
| 1815 | ar->scan.state = ATH10K_SCAN_RUNNING; |
| 1816 | |
| 1817 | if (ar->scan.is_roc) |
| 1818 | ieee80211_ready_on_channel(ar->hw); |
| 1819 | |
| 1820 | complete(&ar->scan.started); |
| 1821 | break; |
| 1822 | } |
| 1823 | } |
| 1824 | |
Ben Greear | 2f9eec0 | 2015-02-15 16:50:38 +0200 | [diff] [blame] | 1825 | static void ath10k_wmi_event_scan_start_failed(struct ath10k *ar) |
| 1826 | { |
| 1827 | lockdep_assert_held(&ar->data_lock); |
| 1828 | |
| 1829 | switch (ar->scan.state) { |
| 1830 | case ATH10K_SCAN_IDLE: |
| 1831 | case ATH10K_SCAN_RUNNING: |
| 1832 | case ATH10K_SCAN_ABORTING: |
| 1833 | ath10k_warn(ar, "received scan start failed event in an invalid scan state: %s (%d)\n", |
| 1834 | ath10k_scan_state_str(ar->scan.state), |
| 1835 | ar->scan.state); |
| 1836 | break; |
| 1837 | case ATH10K_SCAN_STARTING: |
| 1838 | complete(&ar->scan.started); |
| 1839 | __ath10k_scan_finish(ar); |
| 1840 | break; |
| 1841 | } |
| 1842 | } |
| 1843 | |
Michal Kazior | 5c81c7f | 2014-08-05 14:54:44 +0200 | [diff] [blame] | 1844 | static void ath10k_wmi_event_scan_completed(struct ath10k *ar) |
| 1845 | { |
| 1846 | lockdep_assert_held(&ar->data_lock); |
| 1847 | |
| 1848 | switch (ar->scan.state) { |
| 1849 | case ATH10K_SCAN_IDLE: |
| 1850 | case ATH10K_SCAN_STARTING: |
| 1851 | /* One suspected reason scan can be completed while starting is |
| 1852 | * if firmware fails to deliver all scan events to the host, |
| 1853 | * e.g. when transport pipe is full. This has been observed |
| 1854 | * with spectral scan phyerr events starving wmi transport |
| 1855 | * pipe. In such case the "scan completed" event should be (and |
| 1856 | * is) ignored by the host as it may be just firmware's scan |
| 1857 | * state machine recovering. |
| 1858 | */ |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 1859 | ath10k_warn(ar, "received scan completed event in an invalid scan state: %s (%d)\n", |
Michal Kazior | 5c81c7f | 2014-08-05 14:54:44 +0200 | [diff] [blame] | 1860 | ath10k_scan_state_str(ar->scan.state), |
| 1861 | ar->scan.state); |
| 1862 | break; |
| 1863 | case ATH10K_SCAN_RUNNING: |
| 1864 | case ATH10K_SCAN_ABORTING: |
| 1865 | __ath10k_scan_finish(ar); |
| 1866 | break; |
| 1867 | } |
| 1868 | } |
| 1869 | |
| 1870 | static void ath10k_wmi_event_scan_bss_chan(struct ath10k *ar) |
| 1871 | { |
| 1872 | lockdep_assert_held(&ar->data_lock); |
| 1873 | |
| 1874 | switch (ar->scan.state) { |
| 1875 | case ATH10K_SCAN_IDLE: |
| 1876 | case ATH10K_SCAN_STARTING: |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 1877 | ath10k_warn(ar, "received scan bss chan event in an invalid scan state: %s (%d)\n", |
Michal Kazior | 5c81c7f | 2014-08-05 14:54:44 +0200 | [diff] [blame] | 1878 | ath10k_scan_state_str(ar->scan.state), |
| 1879 | ar->scan.state); |
| 1880 | break; |
| 1881 | case ATH10K_SCAN_RUNNING: |
| 1882 | case ATH10K_SCAN_ABORTING: |
| 1883 | ar->scan_channel = NULL; |
| 1884 | break; |
| 1885 | } |
| 1886 | } |
| 1887 | |
| 1888 | static void ath10k_wmi_event_scan_foreign_chan(struct ath10k *ar, u32 freq) |
| 1889 | { |
| 1890 | lockdep_assert_held(&ar->data_lock); |
| 1891 | |
| 1892 | switch (ar->scan.state) { |
| 1893 | case ATH10K_SCAN_IDLE: |
| 1894 | case ATH10K_SCAN_STARTING: |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 1895 | ath10k_warn(ar, "received scan foreign chan event in an invalid scan state: %s (%d)\n", |
Michal Kazior | 5c81c7f | 2014-08-05 14:54:44 +0200 | [diff] [blame] | 1896 | ath10k_scan_state_str(ar->scan.state), |
| 1897 | ar->scan.state); |
| 1898 | break; |
| 1899 | case ATH10K_SCAN_RUNNING: |
| 1900 | case ATH10K_SCAN_ABORTING: |
| 1901 | ar->scan_channel = ieee80211_get_channel(ar->hw->wiphy, freq); |
| 1902 | |
| 1903 | if (ar->scan.is_roc && ar->scan.roc_freq == freq) |
| 1904 | complete(&ar->scan.on_channel); |
| 1905 | break; |
| 1906 | } |
| 1907 | } |
| 1908 | |
Michal Kazior | 9ff8b72 | 2014-08-05 14:54:43 +0200 | [diff] [blame] | 1909 | static const char * |
| 1910 | ath10k_wmi_event_scan_type_str(enum wmi_scan_event_type type, |
| 1911 | enum wmi_scan_completion_reason reason) |
| 1912 | { |
| 1913 | switch (type) { |
| 1914 | case WMI_SCAN_EVENT_STARTED: |
| 1915 | return "started"; |
| 1916 | case WMI_SCAN_EVENT_COMPLETED: |
| 1917 | switch (reason) { |
| 1918 | case WMI_SCAN_REASON_COMPLETED: |
| 1919 | return "completed"; |
| 1920 | case WMI_SCAN_REASON_CANCELLED: |
| 1921 | return "completed [cancelled]"; |
| 1922 | case WMI_SCAN_REASON_PREEMPTED: |
| 1923 | return "completed [preempted]"; |
| 1924 | case WMI_SCAN_REASON_TIMEDOUT: |
| 1925 | return "completed [timedout]"; |
Raja Mani | b2297ba | 2015-06-22 20:22:23 +0530 | [diff] [blame] | 1926 | case WMI_SCAN_REASON_INTERNAL_FAILURE: |
| 1927 | return "completed [internal err]"; |
Michal Kazior | 9ff8b72 | 2014-08-05 14:54:43 +0200 | [diff] [blame] | 1928 | case WMI_SCAN_REASON_MAX: |
| 1929 | break; |
| 1930 | } |
| 1931 | return "completed [unknown]"; |
| 1932 | case WMI_SCAN_EVENT_BSS_CHANNEL: |
| 1933 | return "bss channel"; |
| 1934 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL: |
| 1935 | return "foreign channel"; |
| 1936 | case WMI_SCAN_EVENT_DEQUEUED: |
| 1937 | return "dequeued"; |
| 1938 | case WMI_SCAN_EVENT_PREEMPTED: |
| 1939 | return "preempted"; |
| 1940 | case WMI_SCAN_EVENT_START_FAILED: |
| 1941 | return "start failed"; |
Raja Mani | b2297ba | 2015-06-22 20:22:23 +0530 | [diff] [blame] | 1942 | case WMI_SCAN_EVENT_RESTARTED: |
| 1943 | return "restarted"; |
| 1944 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT: |
| 1945 | return "foreign channel exit"; |
Michal Kazior | 9ff8b72 | 2014-08-05 14:54:43 +0200 | [diff] [blame] | 1946 | default: |
| 1947 | return "unknown"; |
| 1948 | } |
| 1949 | } |
| 1950 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 1951 | static int ath10k_wmi_op_pull_scan_ev(struct ath10k *ar, struct sk_buff *skb, |
| 1952 | struct wmi_scan_ev_arg *arg) |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 1953 | { |
| 1954 | struct wmi_scan_event *ev = (void *)skb->data; |
| 1955 | |
| 1956 | if (skb->len < sizeof(*ev)) |
| 1957 | return -EPROTO; |
| 1958 | |
| 1959 | skb_pull(skb, sizeof(*ev)); |
| 1960 | arg->event_type = ev->event_type; |
| 1961 | arg->reason = ev->reason; |
| 1962 | arg->channel_freq = ev->channel_freq; |
| 1963 | arg->scan_req_id = ev->scan_req_id; |
| 1964 | arg->scan_id = ev->scan_id; |
| 1965 | arg->vdev_id = ev->vdev_id; |
| 1966 | |
| 1967 | return 0; |
| 1968 | } |
| 1969 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 1970 | int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1971 | { |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 1972 | struct wmi_scan_ev_arg arg = {}; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1973 | enum wmi_scan_event_type event_type; |
| 1974 | enum wmi_scan_completion_reason reason; |
| 1975 | u32 freq; |
| 1976 | u32 req_id; |
| 1977 | u32 scan_id; |
| 1978 | u32 vdev_id; |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 1979 | int ret; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1980 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 1981 | ret = ath10k_wmi_pull_scan(ar, skb, &arg); |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 1982 | if (ret) { |
| 1983 | ath10k_warn(ar, "failed to parse scan event: %d\n", ret); |
| 1984 | return ret; |
| 1985 | } |
| 1986 | |
| 1987 | event_type = __le32_to_cpu(arg.event_type); |
| 1988 | reason = __le32_to_cpu(arg.reason); |
| 1989 | freq = __le32_to_cpu(arg.channel_freq); |
| 1990 | req_id = __le32_to_cpu(arg.scan_req_id); |
| 1991 | scan_id = __le32_to_cpu(arg.scan_id); |
| 1992 | vdev_id = __le32_to_cpu(arg.vdev_id); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1993 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1994 | spin_lock_bh(&ar->data_lock); |
| 1995 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 1996 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Michal Kazior | 5c81c7f | 2014-08-05 14:54:44 +0200 | [diff] [blame] | 1997 | "scan event %s type %d reason %d freq %d req_id %d scan_id %d vdev_id %d state %s (%d)\n", |
| 1998 | ath10k_wmi_event_scan_type_str(event_type, reason), |
| 1999 | event_type, reason, freq, req_id, scan_id, vdev_id, |
| 2000 | ath10k_scan_state_str(ar->scan.state), ar->scan.state); |
| 2001 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2002 | switch (event_type) { |
| 2003 | case WMI_SCAN_EVENT_STARTED: |
Michal Kazior | 5c81c7f | 2014-08-05 14:54:44 +0200 | [diff] [blame] | 2004 | ath10k_wmi_event_scan_started(ar); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2005 | break; |
| 2006 | case WMI_SCAN_EVENT_COMPLETED: |
Michal Kazior | 5c81c7f | 2014-08-05 14:54:44 +0200 | [diff] [blame] | 2007 | ath10k_wmi_event_scan_completed(ar); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2008 | break; |
| 2009 | case WMI_SCAN_EVENT_BSS_CHANNEL: |
Michal Kazior | 5c81c7f | 2014-08-05 14:54:44 +0200 | [diff] [blame] | 2010 | ath10k_wmi_event_scan_bss_chan(ar); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2011 | break; |
| 2012 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL: |
Michal Kazior | 5c81c7f | 2014-08-05 14:54:44 +0200 | [diff] [blame] | 2013 | ath10k_wmi_event_scan_foreign_chan(ar, freq); |
| 2014 | break; |
| 2015 | case WMI_SCAN_EVENT_START_FAILED: |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 2016 | ath10k_warn(ar, "received scan start failure event\n"); |
Ben Greear | 2f9eec0 | 2015-02-15 16:50:38 +0200 | [diff] [blame] | 2017 | ath10k_wmi_event_scan_start_failed(ar); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2018 | break; |
| 2019 | case WMI_SCAN_EVENT_DEQUEUED: |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2020 | case WMI_SCAN_EVENT_PREEMPTED: |
Raja Mani | b2297ba | 2015-06-22 20:22:23 +0530 | [diff] [blame] | 2021 | case WMI_SCAN_EVENT_RESTARTED: |
| 2022 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT: |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2023 | default: |
| 2024 | break; |
| 2025 | } |
| 2026 | |
| 2027 | spin_unlock_bh(&ar->data_lock); |
| 2028 | return 0; |
| 2029 | } |
| 2030 | |
| 2031 | static inline enum ieee80211_band phy_mode_to_band(u32 phy_mode) |
| 2032 | { |
| 2033 | enum ieee80211_band band; |
| 2034 | |
| 2035 | switch (phy_mode) { |
| 2036 | case MODE_11A: |
| 2037 | case MODE_11NA_HT20: |
| 2038 | case MODE_11NA_HT40: |
| 2039 | case MODE_11AC_VHT20: |
| 2040 | case MODE_11AC_VHT40: |
| 2041 | case MODE_11AC_VHT80: |
| 2042 | band = IEEE80211_BAND_5GHZ; |
| 2043 | break; |
| 2044 | case MODE_11G: |
| 2045 | case MODE_11B: |
| 2046 | case MODE_11GONLY: |
| 2047 | case MODE_11NG_HT20: |
| 2048 | case MODE_11NG_HT40: |
| 2049 | case MODE_11AC_VHT20_2G: |
| 2050 | case MODE_11AC_VHT40_2G: |
| 2051 | case MODE_11AC_VHT80_2G: |
| 2052 | default: |
| 2053 | band = IEEE80211_BAND_2GHZ; |
| 2054 | } |
| 2055 | |
| 2056 | return band; |
| 2057 | } |
| 2058 | |
Sujith Manoharan | 504f6cd | 2014-11-25 11:46:58 +0530 | [diff] [blame] | 2059 | /* If keys are configured, HW decrypts all frames |
| 2060 | * with protected bit set. Mark such frames as decrypted. |
| 2061 | */ |
| 2062 | static void ath10k_wmi_handle_wep_reauth(struct ath10k *ar, |
| 2063 | struct sk_buff *skb, |
| 2064 | struct ieee80211_rx_status *status) |
| 2065 | { |
| 2066 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
| 2067 | unsigned int hdrlen; |
| 2068 | bool peer_key; |
| 2069 | u8 *addr, keyidx; |
| 2070 | |
| 2071 | if (!ieee80211_is_auth(hdr->frame_control) || |
| 2072 | !ieee80211_has_protected(hdr->frame_control)) |
| 2073 | return; |
| 2074 | |
| 2075 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
| 2076 | if (skb->len < (hdrlen + IEEE80211_WEP_IV_LEN)) |
| 2077 | return; |
| 2078 | |
| 2079 | keyidx = skb->data[hdrlen + (IEEE80211_WEP_IV_LEN - 1)] >> WEP_KEYID_SHIFT; |
| 2080 | addr = ieee80211_get_SA(hdr); |
| 2081 | |
| 2082 | spin_lock_bh(&ar->data_lock); |
| 2083 | peer_key = ath10k_mac_is_peer_wep_key_set(ar, addr, keyidx); |
| 2084 | spin_unlock_bh(&ar->data_lock); |
| 2085 | |
| 2086 | if (peer_key) { |
| 2087 | ath10k_dbg(ar, ATH10K_DBG_MAC, |
| 2088 | "mac wep key present for peer %pM\n", addr); |
| 2089 | status->flag |= RX_FLAG_DECRYPTED; |
| 2090 | } |
| 2091 | } |
| 2092 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 2093 | static int ath10k_wmi_op_pull_mgmt_rx_ev(struct ath10k *ar, struct sk_buff *skb, |
| 2094 | struct wmi_mgmt_rx_ev_arg *arg) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2095 | { |
Michal Kazior | 0d9b043 | 2013-08-09 10:13:33 +0200 | [diff] [blame] | 2096 | struct wmi_mgmt_rx_event_v1 *ev_v1; |
| 2097 | struct wmi_mgmt_rx_event_v2 *ev_v2; |
| 2098 | struct wmi_mgmt_rx_hdr_v1 *ev_hdr; |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2099 | size_t pull_len; |
| 2100 | u32 msdu_len; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2101 | |
Michal Kazior | 0d9b043 | 2013-08-09 10:13:33 +0200 | [diff] [blame] | 2102 | if (test_bit(ATH10K_FW_FEATURE_EXT_WMI_MGMT_RX, ar->fw_features)) { |
| 2103 | ev_v2 = (struct wmi_mgmt_rx_event_v2 *)skb->data; |
| 2104 | ev_hdr = &ev_v2->hdr.v1; |
| 2105 | pull_len = sizeof(*ev_v2); |
| 2106 | } else { |
| 2107 | ev_v1 = (struct wmi_mgmt_rx_event_v1 *)skb->data; |
| 2108 | ev_hdr = &ev_v1->hdr; |
| 2109 | pull_len = sizeof(*ev_v1); |
| 2110 | } |
| 2111 | |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2112 | if (skb->len < pull_len) |
| 2113 | return -EPROTO; |
| 2114 | |
| 2115 | skb_pull(skb, pull_len); |
| 2116 | arg->channel = ev_hdr->channel; |
| 2117 | arg->buf_len = ev_hdr->buf_len; |
| 2118 | arg->status = ev_hdr->status; |
| 2119 | arg->snr = ev_hdr->snr; |
| 2120 | arg->phy_mode = ev_hdr->phy_mode; |
| 2121 | arg->rate = ev_hdr->rate; |
| 2122 | |
| 2123 | msdu_len = __le32_to_cpu(arg->buf_len); |
| 2124 | if (skb->len < msdu_len) |
| 2125 | return -EPROTO; |
| 2126 | |
| 2127 | /* the WMI buffer might've ended up being padded to 4 bytes due to HTC |
| 2128 | * trailer with credit update. Trim the excess garbage. |
| 2129 | */ |
| 2130 | skb_trim(skb, msdu_len); |
| 2131 | |
| 2132 | return 0; |
| 2133 | } |
| 2134 | |
Raja Mani | 1c09296 | 2015-06-22 20:10:16 +0530 | [diff] [blame] | 2135 | static int ath10k_wmi_10_4_op_pull_mgmt_rx_ev(struct ath10k *ar, |
| 2136 | struct sk_buff *skb, |
| 2137 | struct wmi_mgmt_rx_ev_arg *arg) |
| 2138 | { |
| 2139 | struct wmi_10_4_mgmt_rx_event *ev; |
| 2140 | struct wmi_10_4_mgmt_rx_hdr *ev_hdr; |
| 2141 | size_t pull_len; |
| 2142 | u32 msdu_len; |
| 2143 | |
| 2144 | ev = (struct wmi_10_4_mgmt_rx_event *)skb->data; |
| 2145 | ev_hdr = &ev->hdr; |
| 2146 | pull_len = sizeof(*ev); |
| 2147 | |
| 2148 | if (skb->len < pull_len) |
| 2149 | return -EPROTO; |
| 2150 | |
| 2151 | skb_pull(skb, pull_len); |
| 2152 | arg->channel = ev_hdr->channel; |
| 2153 | arg->buf_len = ev_hdr->buf_len; |
| 2154 | arg->status = ev_hdr->status; |
| 2155 | arg->snr = ev_hdr->snr; |
| 2156 | arg->phy_mode = ev_hdr->phy_mode; |
| 2157 | arg->rate = ev_hdr->rate; |
| 2158 | |
| 2159 | msdu_len = __le32_to_cpu(arg->buf_len); |
| 2160 | if (skb->len < msdu_len) |
| 2161 | return -EPROTO; |
| 2162 | |
| 2163 | /* Make sure bytes added for padding are removed. */ |
| 2164 | skb_trim(skb, msdu_len); |
| 2165 | |
| 2166 | return 0; |
| 2167 | } |
| 2168 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 2169 | int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2170 | { |
| 2171 | struct wmi_mgmt_rx_ev_arg arg = {}; |
| 2172 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
| 2173 | struct ieee80211_hdr *hdr; |
Michal Kazior | 01cebe1 | 2015-03-30 09:51:56 +0300 | [diff] [blame] | 2174 | struct ieee80211_supported_band *sband; |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2175 | u32 rx_status; |
| 2176 | u32 channel; |
| 2177 | u32 phy_mode; |
| 2178 | u32 snr; |
| 2179 | u32 rate; |
| 2180 | u32 buf_len; |
| 2181 | u16 fc; |
| 2182 | int ret; |
| 2183 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 2184 | ret = ath10k_wmi_pull_mgmt_rx(ar, skb, &arg); |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2185 | if (ret) { |
| 2186 | ath10k_warn(ar, "failed to parse mgmt rx event: %d\n", ret); |
Raja Mani | 08603f2 | 2015-06-01 14:53:33 +0530 | [diff] [blame] | 2187 | dev_kfree_skb(skb); |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2188 | return ret; |
| 2189 | } |
| 2190 | |
| 2191 | channel = __le32_to_cpu(arg.channel); |
| 2192 | buf_len = __le32_to_cpu(arg.buf_len); |
| 2193 | rx_status = __le32_to_cpu(arg.status); |
| 2194 | snr = __le32_to_cpu(arg.snr); |
| 2195 | phy_mode = __le32_to_cpu(arg.phy_mode); |
| 2196 | rate = __le32_to_cpu(arg.rate); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2197 | |
| 2198 | memset(status, 0, sizeof(*status)); |
| 2199 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 2200 | ath10k_dbg(ar, ATH10K_DBG_MGMT, |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2201 | "event mgmt rx status %08x\n", rx_status); |
| 2202 | |
Marek Puzyniak | e8a50f8 | 2013-11-20 09:59:47 +0200 | [diff] [blame] | 2203 | if (test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags)) { |
| 2204 | dev_kfree_skb(skb); |
| 2205 | return 0; |
| 2206 | } |
| 2207 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2208 | if (rx_status & WMI_RX_STATUS_ERR_DECRYPT) { |
| 2209 | dev_kfree_skb(skb); |
| 2210 | return 0; |
| 2211 | } |
| 2212 | |
| 2213 | if (rx_status & WMI_RX_STATUS_ERR_KEY_CACHE_MISS) { |
| 2214 | dev_kfree_skb(skb); |
| 2215 | return 0; |
| 2216 | } |
| 2217 | |
Michal Kazior | d67d0a0 | 2014-11-24 15:34:08 +0100 | [diff] [blame] | 2218 | if (rx_status & WMI_RX_STATUS_ERR_CRC) { |
| 2219 | dev_kfree_skb(skb); |
| 2220 | return 0; |
| 2221 | } |
| 2222 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2223 | if (rx_status & WMI_RX_STATUS_ERR_MIC) |
| 2224 | status->flag |= RX_FLAG_MMIC_ERROR; |
| 2225 | |
Michal Kazior | 21040bf | 2014-10-21 10:10:30 +0300 | [diff] [blame] | 2226 | /* Hardware can Rx CCK rates on 5GHz. In that case phy_mode is set to |
Michal Kazior | 453cdb6 | 2013-12-13 10:44:43 +0100 | [diff] [blame] | 2227 | * MODE_11B. This means phy_mode is not a reliable source for the band |
Michal Kazior | 21040bf | 2014-10-21 10:10:30 +0300 | [diff] [blame] | 2228 | * of mgmt rx. |
| 2229 | */ |
| 2230 | if (channel >= 1 && channel <= 14) { |
| 2231 | status->band = IEEE80211_BAND_2GHZ; |
| 2232 | } else if (channel >= 36 && channel <= 165) { |
| 2233 | status->band = IEEE80211_BAND_5GHZ; |
Michal Kazior | 453cdb6 | 2013-12-13 10:44:43 +0100 | [diff] [blame] | 2234 | } else { |
Michal Kazior | 21040bf | 2014-10-21 10:10:30 +0300 | [diff] [blame] | 2235 | /* Shouldn't happen unless list of advertised channels to |
| 2236 | * mac80211 has been changed. |
| 2237 | */ |
| 2238 | WARN_ON_ONCE(1); |
| 2239 | dev_kfree_skb(skb); |
| 2240 | return 0; |
Michal Kazior | 453cdb6 | 2013-12-13 10:44:43 +0100 | [diff] [blame] | 2241 | } |
| 2242 | |
Michal Kazior | 21040bf | 2014-10-21 10:10:30 +0300 | [diff] [blame] | 2243 | if (phy_mode == MODE_11B && status->band == IEEE80211_BAND_5GHZ) |
| 2244 | ath10k_dbg(ar, ATH10K_DBG_MGMT, "wmi mgmt rx 11b (CCK) on 5GHz\n"); |
| 2245 | |
Michal Kazior | 01cebe1 | 2015-03-30 09:51:56 +0300 | [diff] [blame] | 2246 | sband = &ar->mac.sbands[status->band]; |
| 2247 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2248 | status->freq = ieee80211_channel_to_frequency(channel, status->band); |
| 2249 | status->signal = snr + ATH10K_DEFAULT_NOISE_FLOOR; |
Michal Kazior | 01cebe1 | 2015-03-30 09:51:56 +0300 | [diff] [blame] | 2250 | status->rate_idx = ath10k_mac_bitrate_to_idx(sband, rate / 100); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2251 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2252 | hdr = (struct ieee80211_hdr *)skb->data; |
| 2253 | fc = le16_to_cpu(hdr->frame_control); |
| 2254 | |
Sujith Manoharan | 504f6cd | 2014-11-25 11:46:58 +0530 | [diff] [blame] | 2255 | ath10k_wmi_handle_wep_reauth(ar, skb, status); |
| 2256 | |
Michal Kazior | 2b6a6a9 | 2013-12-05 06:53:41 +0100 | [diff] [blame] | 2257 | /* FW delivers WEP Shared Auth frame with Protected Bit set and |
| 2258 | * encrypted payload. However in case of PMF it delivers decrypted |
| 2259 | * frames with Protected Bit set. */ |
| 2260 | if (ieee80211_has_protected(hdr->frame_control) && |
| 2261 | !ieee80211_is_auth(hdr->frame_control)) { |
Marek Kwaczynski | eeab266 | 2014-05-14 16:56:17 +0300 | [diff] [blame] | 2262 | status->flag |= RX_FLAG_DECRYPTED; |
| 2263 | |
| 2264 | if (!ieee80211_is_action(hdr->frame_control) && |
| 2265 | !ieee80211_is_deauth(hdr->frame_control) && |
| 2266 | !ieee80211_is_disassoc(hdr->frame_control)) { |
| 2267 | status->flag |= RX_FLAG_IV_STRIPPED | |
| 2268 | RX_FLAG_MMIC_STRIPPED; |
| 2269 | hdr->frame_control = __cpu_to_le16(fc & |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2270 | ~IEEE80211_FCTL_PROTECTED); |
Marek Kwaczynski | eeab266 | 2014-05-14 16:56:17 +0300 | [diff] [blame] | 2271 | } |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2272 | } |
| 2273 | |
Michal Kazior | cc9904e | 2015-03-10 16:22:01 +0200 | [diff] [blame] | 2274 | if (ieee80211_is_beacon(hdr->frame_control)) |
| 2275 | ath10k_mac_handle_beacon(ar, skb); |
| 2276 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 2277 | ath10k_dbg(ar, ATH10K_DBG_MGMT, |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2278 | "event mgmt rx skb %p len %d ftype %02x stype %02x\n", |
| 2279 | skb, skb->len, |
| 2280 | fc & IEEE80211_FCTL_FTYPE, fc & IEEE80211_FCTL_STYPE); |
| 2281 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 2282 | ath10k_dbg(ar, ATH10K_DBG_MGMT, |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2283 | "event mgmt rx freq %d band %d snr %d, rate_idx %d\n", |
| 2284 | status->freq, status->band, status->signal, |
| 2285 | status->rate_idx); |
| 2286 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2287 | ieee80211_rx(ar->hw, skb); |
| 2288 | return 0; |
| 2289 | } |
| 2290 | |
Michal Kazior | 2e1dea4 | 2013-07-31 10:32:40 +0200 | [diff] [blame] | 2291 | static int freq_to_idx(struct ath10k *ar, int freq) |
| 2292 | { |
| 2293 | struct ieee80211_supported_band *sband; |
| 2294 | int band, ch, idx = 0; |
| 2295 | |
| 2296 | for (band = IEEE80211_BAND_2GHZ; band < IEEE80211_NUM_BANDS; band++) { |
| 2297 | sband = ar->hw->wiphy->bands[band]; |
| 2298 | if (!sband) |
| 2299 | continue; |
| 2300 | |
| 2301 | for (ch = 0; ch < sband->n_channels; ch++, idx++) |
| 2302 | if (sband->channels[ch].center_freq == freq) |
| 2303 | goto exit; |
| 2304 | } |
| 2305 | |
| 2306 | exit: |
| 2307 | return idx; |
| 2308 | } |
| 2309 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 2310 | static int ath10k_wmi_op_pull_ch_info_ev(struct ath10k *ar, struct sk_buff *skb, |
| 2311 | struct wmi_ch_info_ev_arg *arg) |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2312 | { |
| 2313 | struct wmi_chan_info_event *ev = (void *)skb->data; |
| 2314 | |
| 2315 | if (skb->len < sizeof(*ev)) |
| 2316 | return -EPROTO; |
| 2317 | |
| 2318 | skb_pull(skb, sizeof(*ev)); |
| 2319 | arg->err_code = ev->err_code; |
| 2320 | arg->freq = ev->freq; |
| 2321 | arg->cmd_flags = ev->cmd_flags; |
| 2322 | arg->noise_floor = ev->noise_floor; |
| 2323 | arg->rx_clear_count = ev->rx_clear_count; |
| 2324 | arg->cycle_count = ev->cycle_count; |
| 2325 | |
| 2326 | return 0; |
| 2327 | } |
| 2328 | |
Raja Mani | b2297ba | 2015-06-22 20:22:23 +0530 | [diff] [blame] | 2329 | static int ath10k_wmi_10_4_op_pull_ch_info_ev(struct ath10k *ar, |
| 2330 | struct sk_buff *skb, |
| 2331 | struct wmi_ch_info_ev_arg *arg) |
| 2332 | { |
| 2333 | struct wmi_10_4_chan_info_event *ev = (void *)skb->data; |
| 2334 | |
| 2335 | if (skb->len < sizeof(*ev)) |
| 2336 | return -EPROTO; |
| 2337 | |
| 2338 | skb_pull(skb, sizeof(*ev)); |
| 2339 | arg->err_code = ev->err_code; |
| 2340 | arg->freq = ev->freq; |
| 2341 | arg->cmd_flags = ev->cmd_flags; |
| 2342 | arg->noise_floor = ev->noise_floor; |
| 2343 | arg->rx_clear_count = ev->rx_clear_count; |
| 2344 | arg->cycle_count = ev->cycle_count; |
| 2345 | arg->chan_tx_pwr_range = ev->chan_tx_pwr_range; |
| 2346 | arg->chan_tx_pwr_tp = ev->chan_tx_pwr_tp; |
| 2347 | arg->rx_frame_count = ev->rx_frame_count; |
| 2348 | |
| 2349 | return 0; |
| 2350 | } |
| 2351 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 2352 | void ath10k_wmi_event_chan_info(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2353 | { |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2354 | struct wmi_ch_info_ev_arg arg = {}; |
Michal Kazior | 2e1dea4 | 2013-07-31 10:32:40 +0200 | [diff] [blame] | 2355 | struct survey_info *survey; |
| 2356 | u32 err_code, freq, cmd_flags, noise_floor, rx_clear_count, cycle_count; |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2357 | int idx, ret; |
Michal Kazior | 2e1dea4 | 2013-07-31 10:32:40 +0200 | [diff] [blame] | 2358 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 2359 | ret = ath10k_wmi_pull_ch_info(ar, skb, &arg); |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2360 | if (ret) { |
| 2361 | ath10k_warn(ar, "failed to parse chan info event: %d\n", ret); |
| 2362 | return; |
| 2363 | } |
Michal Kazior | 2e1dea4 | 2013-07-31 10:32:40 +0200 | [diff] [blame] | 2364 | |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2365 | err_code = __le32_to_cpu(arg.err_code); |
| 2366 | freq = __le32_to_cpu(arg.freq); |
| 2367 | cmd_flags = __le32_to_cpu(arg.cmd_flags); |
| 2368 | noise_floor = __le32_to_cpu(arg.noise_floor); |
| 2369 | rx_clear_count = __le32_to_cpu(arg.rx_clear_count); |
| 2370 | cycle_count = __le32_to_cpu(arg.cycle_count); |
Michal Kazior | 2e1dea4 | 2013-07-31 10:32:40 +0200 | [diff] [blame] | 2371 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 2372 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Michal Kazior | 2e1dea4 | 2013-07-31 10:32:40 +0200 | [diff] [blame] | 2373 | "chan info err_code %d freq %d cmd_flags %d noise_floor %d rx_clear_count %d cycle_count %d\n", |
| 2374 | err_code, freq, cmd_flags, noise_floor, rx_clear_count, |
| 2375 | cycle_count); |
| 2376 | |
| 2377 | spin_lock_bh(&ar->data_lock); |
| 2378 | |
Michal Kazior | 5c81c7f | 2014-08-05 14:54:44 +0200 | [diff] [blame] | 2379 | switch (ar->scan.state) { |
| 2380 | case ATH10K_SCAN_IDLE: |
| 2381 | case ATH10K_SCAN_STARTING: |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 2382 | ath10k_warn(ar, "received chan info event without a scan request, ignoring\n"); |
Michal Kazior | 2e1dea4 | 2013-07-31 10:32:40 +0200 | [diff] [blame] | 2383 | goto exit; |
Michal Kazior | 5c81c7f | 2014-08-05 14:54:44 +0200 | [diff] [blame] | 2384 | case ATH10K_SCAN_RUNNING: |
| 2385 | case ATH10K_SCAN_ABORTING: |
| 2386 | break; |
Michal Kazior | 2e1dea4 | 2013-07-31 10:32:40 +0200 | [diff] [blame] | 2387 | } |
| 2388 | |
| 2389 | idx = freq_to_idx(ar, freq); |
| 2390 | if (idx >= ARRAY_SIZE(ar->survey)) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 2391 | ath10k_warn(ar, "chan info: invalid frequency %d (idx %d out of bounds)\n", |
Michal Kazior | 2e1dea4 | 2013-07-31 10:32:40 +0200 | [diff] [blame] | 2392 | freq, idx); |
| 2393 | goto exit; |
| 2394 | } |
| 2395 | |
| 2396 | if (cmd_flags & WMI_CHAN_INFO_FLAG_COMPLETE) { |
Michal Kazior | 44b7d48 | 2015-05-25 14:06:19 +0200 | [diff] [blame] | 2397 | if (ar->ch_info_can_report_survey) { |
| 2398 | survey = &ar->survey[idx]; |
| 2399 | survey->noise = noise_floor; |
| 2400 | survey->filled = SURVEY_INFO_NOISE_DBM; |
Michal Kazior | 2e1dea4 | 2013-07-31 10:32:40 +0200 | [diff] [blame] | 2401 | |
Michal Kazior | 44b7d48 | 2015-05-25 14:06:19 +0200 | [diff] [blame] | 2402 | ath10k_hw_fill_survey_time(ar, |
| 2403 | survey, |
| 2404 | cycle_count, |
| 2405 | rx_clear_count, |
| 2406 | ar->survey_last_cycle_count, |
| 2407 | ar->survey_last_rx_clear_count); |
| 2408 | } |
Michal Kazior | 587f703 | 2015-05-25 14:06:18 +0200 | [diff] [blame] | 2409 | |
Michal Kazior | 44b7d48 | 2015-05-25 14:06:19 +0200 | [diff] [blame] | 2410 | ar->ch_info_can_report_survey = false; |
| 2411 | } else { |
| 2412 | ar->ch_info_can_report_survey = true; |
Michal Kazior | 2e1dea4 | 2013-07-31 10:32:40 +0200 | [diff] [blame] | 2413 | } |
| 2414 | |
Vasanthakumar Thiagarajan | 3d2a2e2 | 2015-08-12 16:24:04 +0530 | [diff] [blame] | 2415 | if (!(cmd_flags & WMI_CHAN_INFO_FLAG_PRE_COMPLETE)) { |
| 2416 | ar->survey_last_rx_clear_count = rx_clear_count; |
| 2417 | ar->survey_last_cycle_count = cycle_count; |
| 2418 | } |
Michal Kazior | 2e1dea4 | 2013-07-31 10:32:40 +0200 | [diff] [blame] | 2419 | |
| 2420 | exit: |
| 2421 | spin_unlock_bh(&ar->data_lock); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2422 | } |
| 2423 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 2424 | void ath10k_wmi_event_echo(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2425 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 2426 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_ECHO_EVENTID\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2427 | } |
| 2428 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 2429 | int ath10k_wmi_event_debug_mesg(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2430 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 2431 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi event debug mesg len %d\n", |
Kalle Valo | 869526b | 2014-01-03 12:59:26 +0200 | [diff] [blame] | 2432 | skb->len); |
| 2433 | |
Michal Kazior | d35a6c1 | 2014-09-02 11:00:21 +0300 | [diff] [blame] | 2434 | trace_ath10k_wmi_dbglog(ar, skb->data, skb->len); |
Kalle Valo | 869526b | 2014-01-03 12:59:26 +0200 | [diff] [blame] | 2435 | |
| 2436 | return 0; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2437 | } |
| 2438 | |
Michal Kazior | b91251f | 2015-01-24 12:14:49 +0200 | [diff] [blame] | 2439 | void ath10k_wmi_pull_pdev_stats_base(const struct wmi_pdev_stats_base *src, |
| 2440 | struct ath10k_fw_stats_pdev *dst) |
Michal Kazior | d15fb52 | 2014-09-25 12:33:47 +0200 | [diff] [blame] | 2441 | { |
Michal Kazior | d15fb52 | 2014-09-25 12:33:47 +0200 | [diff] [blame] | 2442 | dst->ch_noise_floor = __le32_to_cpu(src->chan_nf); |
| 2443 | dst->tx_frame_count = __le32_to_cpu(src->tx_frame_count); |
| 2444 | dst->rx_frame_count = __le32_to_cpu(src->rx_frame_count); |
| 2445 | dst->rx_clear_count = __le32_to_cpu(src->rx_clear_count); |
| 2446 | dst->cycle_count = __le32_to_cpu(src->cycle_count); |
| 2447 | dst->phy_err_count = __le32_to_cpu(src->phy_err_count); |
| 2448 | dst->chan_tx_power = __le32_to_cpu(src->chan_tx_pwr); |
Michal Kazior | b91251f | 2015-01-24 12:14:49 +0200 | [diff] [blame] | 2449 | } |
Michal Kazior | d15fb52 | 2014-09-25 12:33:47 +0200 | [diff] [blame] | 2450 | |
Michal Kazior | b91251f | 2015-01-24 12:14:49 +0200 | [diff] [blame] | 2451 | void ath10k_wmi_pull_pdev_stats_tx(const struct wmi_pdev_stats_tx *src, |
| 2452 | struct ath10k_fw_stats_pdev *dst) |
| 2453 | { |
| 2454 | dst->comp_queued = __le32_to_cpu(src->comp_queued); |
| 2455 | dst->comp_delivered = __le32_to_cpu(src->comp_delivered); |
| 2456 | dst->msdu_enqued = __le32_to_cpu(src->msdu_enqued); |
| 2457 | dst->mpdu_enqued = __le32_to_cpu(src->mpdu_enqued); |
| 2458 | dst->wmm_drop = __le32_to_cpu(src->wmm_drop); |
| 2459 | dst->local_enqued = __le32_to_cpu(src->local_enqued); |
| 2460 | dst->local_freed = __le32_to_cpu(src->local_freed); |
| 2461 | dst->hw_queued = __le32_to_cpu(src->hw_queued); |
| 2462 | dst->hw_reaped = __le32_to_cpu(src->hw_reaped); |
| 2463 | dst->underrun = __le32_to_cpu(src->underrun); |
| 2464 | dst->tx_abort = __le32_to_cpu(src->tx_abort); |
| 2465 | dst->mpdus_requed = __le32_to_cpu(src->mpdus_requed); |
| 2466 | dst->tx_ko = __le32_to_cpu(src->tx_ko); |
| 2467 | dst->data_rc = __le32_to_cpu(src->data_rc); |
| 2468 | dst->self_triggers = __le32_to_cpu(src->self_triggers); |
| 2469 | dst->sw_retry_failure = __le32_to_cpu(src->sw_retry_failure); |
| 2470 | dst->illgl_rate_phy_err = __le32_to_cpu(src->illgl_rate_phy_err); |
| 2471 | dst->pdev_cont_xretry = __le32_to_cpu(src->pdev_cont_xretry); |
| 2472 | dst->pdev_tx_timeout = __le32_to_cpu(src->pdev_tx_timeout); |
| 2473 | dst->pdev_resets = __le32_to_cpu(src->pdev_resets); |
| 2474 | dst->phy_underrun = __le32_to_cpu(src->phy_underrun); |
| 2475 | dst->txop_ovf = __le32_to_cpu(src->txop_ovf); |
| 2476 | } |
Michal Kazior | d15fb52 | 2014-09-25 12:33:47 +0200 | [diff] [blame] | 2477 | |
Michal Kazior | b91251f | 2015-01-24 12:14:49 +0200 | [diff] [blame] | 2478 | void ath10k_wmi_pull_pdev_stats_rx(const struct wmi_pdev_stats_rx *src, |
| 2479 | struct ath10k_fw_stats_pdev *dst) |
| 2480 | { |
| 2481 | dst->mid_ppdu_route_change = __le32_to_cpu(src->mid_ppdu_route_change); |
| 2482 | dst->status_rcvd = __le32_to_cpu(src->status_rcvd); |
| 2483 | dst->r0_frags = __le32_to_cpu(src->r0_frags); |
| 2484 | dst->r1_frags = __le32_to_cpu(src->r1_frags); |
| 2485 | dst->r2_frags = __le32_to_cpu(src->r2_frags); |
| 2486 | dst->r3_frags = __le32_to_cpu(src->r3_frags); |
| 2487 | dst->htt_msdus = __le32_to_cpu(src->htt_msdus); |
| 2488 | dst->htt_mpdus = __le32_to_cpu(src->htt_mpdus); |
| 2489 | dst->loc_msdus = __le32_to_cpu(src->loc_msdus); |
| 2490 | dst->loc_mpdus = __le32_to_cpu(src->loc_mpdus); |
| 2491 | dst->oversize_amsdu = __le32_to_cpu(src->oversize_amsdu); |
| 2492 | dst->phy_errs = __le32_to_cpu(src->phy_errs); |
| 2493 | dst->phy_err_drop = __le32_to_cpu(src->phy_err_drop); |
| 2494 | dst->mpdu_errs = __le32_to_cpu(src->mpdu_errs); |
| 2495 | } |
| 2496 | |
| 2497 | void ath10k_wmi_pull_pdev_stats_extra(const struct wmi_pdev_stats_extra *src, |
| 2498 | struct ath10k_fw_stats_pdev *dst) |
| 2499 | { |
| 2500 | dst->ack_rx_bad = __le32_to_cpu(src->ack_rx_bad); |
| 2501 | dst->rts_bad = __le32_to_cpu(src->rts_bad); |
| 2502 | dst->rts_good = __le32_to_cpu(src->rts_good); |
| 2503 | dst->fcs_bad = __le32_to_cpu(src->fcs_bad); |
| 2504 | dst->no_beacons = __le32_to_cpu(src->no_beacons); |
| 2505 | dst->mib_int_count = __le32_to_cpu(src->mib_int_count); |
Michal Kazior | d15fb52 | 2014-09-25 12:33:47 +0200 | [diff] [blame] | 2506 | } |
| 2507 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 2508 | void ath10k_wmi_pull_peer_stats(const struct wmi_peer_stats *src, |
| 2509 | struct ath10k_fw_stats_peer *dst) |
Michal Kazior | d15fb52 | 2014-09-25 12:33:47 +0200 | [diff] [blame] | 2510 | { |
| 2511 | ether_addr_copy(dst->peer_macaddr, src->peer_macaddr.addr); |
| 2512 | dst->peer_rssi = __le32_to_cpu(src->peer_rssi); |
| 2513 | dst->peer_tx_rate = __le32_to_cpu(src->peer_tx_rate); |
| 2514 | } |
| 2515 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 2516 | static int ath10k_wmi_main_op_pull_fw_stats(struct ath10k *ar, |
| 2517 | struct sk_buff *skb, |
| 2518 | struct ath10k_fw_stats *stats) |
Michal Kazior | d15fb52 | 2014-09-25 12:33:47 +0200 | [diff] [blame] | 2519 | { |
| 2520 | const struct wmi_stats_event *ev = (void *)skb->data; |
| 2521 | u32 num_pdev_stats, num_vdev_stats, num_peer_stats; |
| 2522 | int i; |
| 2523 | |
| 2524 | if (!skb_pull(skb, sizeof(*ev))) |
| 2525 | return -EPROTO; |
| 2526 | |
| 2527 | num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats); |
| 2528 | num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats); |
| 2529 | num_peer_stats = __le32_to_cpu(ev->num_peer_stats); |
| 2530 | |
Michal Kazior | 5326849 | 2014-09-25 12:33:50 +0200 | [diff] [blame] | 2531 | for (i = 0; i < num_pdev_stats; i++) { |
Michal Kazior | d15fb52 | 2014-09-25 12:33:47 +0200 | [diff] [blame] | 2532 | const struct wmi_pdev_stats *src; |
Michal Kazior | 5326849 | 2014-09-25 12:33:50 +0200 | [diff] [blame] | 2533 | struct ath10k_fw_stats_pdev *dst; |
Michal Kazior | d15fb52 | 2014-09-25 12:33:47 +0200 | [diff] [blame] | 2534 | |
| 2535 | src = (void *)skb->data; |
| 2536 | if (!skb_pull(skb, sizeof(*src))) |
| 2537 | return -EPROTO; |
| 2538 | |
Michal Kazior | 5326849 | 2014-09-25 12:33:50 +0200 | [diff] [blame] | 2539 | dst = kzalloc(sizeof(*dst), GFP_ATOMIC); |
| 2540 | if (!dst) |
| 2541 | continue; |
| 2542 | |
Michal Kazior | b91251f | 2015-01-24 12:14:49 +0200 | [diff] [blame] | 2543 | ath10k_wmi_pull_pdev_stats_base(&src->base, dst); |
| 2544 | ath10k_wmi_pull_pdev_stats_tx(&src->tx, dst); |
| 2545 | ath10k_wmi_pull_pdev_stats_rx(&src->rx, dst); |
| 2546 | |
Michal Kazior | 5326849 | 2014-09-25 12:33:50 +0200 | [diff] [blame] | 2547 | list_add_tail(&dst->list, &stats->pdevs); |
Michal Kazior | d15fb52 | 2014-09-25 12:33:47 +0200 | [diff] [blame] | 2548 | } |
| 2549 | |
| 2550 | /* fw doesn't implement vdev stats */ |
| 2551 | |
| 2552 | for (i = 0; i < num_peer_stats; i++) { |
| 2553 | const struct wmi_peer_stats *src; |
Michal Kazior | 5326849 | 2014-09-25 12:33:50 +0200 | [diff] [blame] | 2554 | struct ath10k_fw_stats_peer *dst; |
Michal Kazior | d15fb52 | 2014-09-25 12:33:47 +0200 | [diff] [blame] | 2555 | |
| 2556 | src = (void *)skb->data; |
| 2557 | if (!skb_pull(skb, sizeof(*src))) |
| 2558 | return -EPROTO; |
| 2559 | |
Michal Kazior | 5326849 | 2014-09-25 12:33:50 +0200 | [diff] [blame] | 2560 | dst = kzalloc(sizeof(*dst), GFP_ATOMIC); |
| 2561 | if (!dst) |
| 2562 | continue; |
| 2563 | |
| 2564 | ath10k_wmi_pull_peer_stats(src, dst); |
| 2565 | list_add_tail(&dst->list, &stats->peers); |
Michal Kazior | d15fb52 | 2014-09-25 12:33:47 +0200 | [diff] [blame] | 2566 | } |
| 2567 | |
| 2568 | return 0; |
| 2569 | } |
| 2570 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 2571 | static int ath10k_wmi_10x_op_pull_fw_stats(struct ath10k *ar, |
| 2572 | struct sk_buff *skb, |
| 2573 | struct ath10k_fw_stats *stats) |
Michal Kazior | d15fb52 | 2014-09-25 12:33:47 +0200 | [diff] [blame] | 2574 | { |
| 2575 | const struct wmi_stats_event *ev = (void *)skb->data; |
| 2576 | u32 num_pdev_stats, num_vdev_stats, num_peer_stats; |
| 2577 | int i; |
| 2578 | |
| 2579 | if (!skb_pull(skb, sizeof(*ev))) |
| 2580 | return -EPROTO; |
| 2581 | |
| 2582 | num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats); |
| 2583 | num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats); |
| 2584 | num_peer_stats = __le32_to_cpu(ev->num_peer_stats); |
| 2585 | |
Michal Kazior | 5326849 | 2014-09-25 12:33:50 +0200 | [diff] [blame] | 2586 | for (i = 0; i < num_pdev_stats; i++) { |
Michal Kazior | d15fb52 | 2014-09-25 12:33:47 +0200 | [diff] [blame] | 2587 | const struct wmi_10x_pdev_stats *src; |
Michal Kazior | 5326849 | 2014-09-25 12:33:50 +0200 | [diff] [blame] | 2588 | struct ath10k_fw_stats_pdev *dst; |
Michal Kazior | d15fb52 | 2014-09-25 12:33:47 +0200 | [diff] [blame] | 2589 | |
| 2590 | src = (void *)skb->data; |
| 2591 | if (!skb_pull(skb, sizeof(*src))) |
| 2592 | return -EPROTO; |
| 2593 | |
Michal Kazior | 5326849 | 2014-09-25 12:33:50 +0200 | [diff] [blame] | 2594 | dst = kzalloc(sizeof(*dst), GFP_ATOMIC); |
| 2595 | if (!dst) |
| 2596 | continue; |
Michal Kazior | d15fb52 | 2014-09-25 12:33:47 +0200 | [diff] [blame] | 2597 | |
Michal Kazior | b91251f | 2015-01-24 12:14:49 +0200 | [diff] [blame] | 2598 | ath10k_wmi_pull_pdev_stats_base(&src->base, dst); |
| 2599 | ath10k_wmi_pull_pdev_stats_tx(&src->tx, dst); |
| 2600 | ath10k_wmi_pull_pdev_stats_rx(&src->rx, dst); |
| 2601 | ath10k_wmi_pull_pdev_stats_extra(&src->extra, dst); |
Michal Kazior | 5326849 | 2014-09-25 12:33:50 +0200 | [diff] [blame] | 2602 | |
| 2603 | list_add_tail(&dst->list, &stats->pdevs); |
Michal Kazior | d15fb52 | 2014-09-25 12:33:47 +0200 | [diff] [blame] | 2604 | } |
| 2605 | |
| 2606 | /* fw doesn't implement vdev stats */ |
| 2607 | |
| 2608 | for (i = 0; i < num_peer_stats; i++) { |
| 2609 | const struct wmi_10x_peer_stats *src; |
Michal Kazior | 5326849 | 2014-09-25 12:33:50 +0200 | [diff] [blame] | 2610 | struct ath10k_fw_stats_peer *dst; |
Michal Kazior | d15fb52 | 2014-09-25 12:33:47 +0200 | [diff] [blame] | 2611 | |
| 2612 | src = (void *)skb->data; |
| 2613 | if (!skb_pull(skb, sizeof(*src))) |
| 2614 | return -EPROTO; |
| 2615 | |
Michal Kazior | 5326849 | 2014-09-25 12:33:50 +0200 | [diff] [blame] | 2616 | dst = kzalloc(sizeof(*dst), GFP_ATOMIC); |
| 2617 | if (!dst) |
| 2618 | continue; |
Michal Kazior | d15fb52 | 2014-09-25 12:33:47 +0200 | [diff] [blame] | 2619 | |
Michal Kazior | 5326849 | 2014-09-25 12:33:50 +0200 | [diff] [blame] | 2620 | ath10k_wmi_pull_peer_stats(&src->old, dst); |
| 2621 | |
| 2622 | dst->peer_rx_rate = __le32_to_cpu(src->peer_rx_rate); |
| 2623 | |
| 2624 | list_add_tail(&dst->list, &stats->peers); |
Michal Kazior | d15fb52 | 2014-09-25 12:33:47 +0200 | [diff] [blame] | 2625 | } |
| 2626 | |
| 2627 | return 0; |
| 2628 | } |
| 2629 | |
Michal Kazior | 20de222 | 2015-01-24 12:14:49 +0200 | [diff] [blame] | 2630 | static int ath10k_wmi_10_2_op_pull_fw_stats(struct ath10k *ar, |
| 2631 | struct sk_buff *skb, |
| 2632 | struct ath10k_fw_stats *stats) |
| 2633 | { |
| 2634 | const struct wmi_10_2_stats_event *ev = (void *)skb->data; |
| 2635 | u32 num_pdev_stats; |
| 2636 | u32 num_pdev_ext_stats; |
| 2637 | u32 num_vdev_stats; |
| 2638 | u32 num_peer_stats; |
| 2639 | int i; |
| 2640 | |
| 2641 | if (!skb_pull(skb, sizeof(*ev))) |
| 2642 | return -EPROTO; |
| 2643 | |
| 2644 | num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats); |
| 2645 | num_pdev_ext_stats = __le32_to_cpu(ev->num_pdev_ext_stats); |
| 2646 | num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats); |
| 2647 | num_peer_stats = __le32_to_cpu(ev->num_peer_stats); |
| 2648 | |
| 2649 | for (i = 0; i < num_pdev_stats; i++) { |
| 2650 | const struct wmi_10_2_pdev_stats *src; |
| 2651 | struct ath10k_fw_stats_pdev *dst; |
| 2652 | |
| 2653 | src = (void *)skb->data; |
| 2654 | if (!skb_pull(skb, sizeof(*src))) |
| 2655 | return -EPROTO; |
| 2656 | |
| 2657 | dst = kzalloc(sizeof(*dst), GFP_ATOMIC); |
| 2658 | if (!dst) |
| 2659 | continue; |
| 2660 | |
| 2661 | ath10k_wmi_pull_pdev_stats_base(&src->base, dst); |
| 2662 | ath10k_wmi_pull_pdev_stats_tx(&src->tx, dst); |
| 2663 | ath10k_wmi_pull_pdev_stats_rx(&src->rx, dst); |
| 2664 | ath10k_wmi_pull_pdev_stats_extra(&src->extra, dst); |
| 2665 | /* FIXME: expose 10.2 specific values */ |
| 2666 | |
| 2667 | list_add_tail(&dst->list, &stats->pdevs); |
| 2668 | } |
| 2669 | |
| 2670 | for (i = 0; i < num_pdev_ext_stats; i++) { |
| 2671 | const struct wmi_10_2_pdev_ext_stats *src; |
| 2672 | |
| 2673 | src = (void *)skb->data; |
| 2674 | if (!skb_pull(skb, sizeof(*src))) |
| 2675 | return -EPROTO; |
| 2676 | |
| 2677 | /* FIXME: expose values to userspace |
| 2678 | * |
| 2679 | * Note: Even though this loop seems to do nothing it is |
| 2680 | * required to parse following sub-structures properly. |
| 2681 | */ |
| 2682 | } |
| 2683 | |
| 2684 | /* fw doesn't implement vdev stats */ |
| 2685 | |
| 2686 | for (i = 0; i < num_peer_stats; i++) { |
| 2687 | const struct wmi_10_2_peer_stats *src; |
| 2688 | struct ath10k_fw_stats_peer *dst; |
| 2689 | |
| 2690 | src = (void *)skb->data; |
| 2691 | if (!skb_pull(skb, sizeof(*src))) |
| 2692 | return -EPROTO; |
| 2693 | |
| 2694 | dst = kzalloc(sizeof(*dst), GFP_ATOMIC); |
| 2695 | if (!dst) |
| 2696 | continue; |
| 2697 | |
| 2698 | ath10k_wmi_pull_peer_stats(&src->old, dst); |
| 2699 | |
| 2700 | dst->peer_rx_rate = __le32_to_cpu(src->peer_rx_rate); |
| 2701 | /* FIXME: expose 10.2 specific values */ |
| 2702 | |
| 2703 | list_add_tail(&dst->list, &stats->peers); |
| 2704 | } |
| 2705 | |
| 2706 | return 0; |
| 2707 | } |
| 2708 | |
| 2709 | static int ath10k_wmi_10_2_4_op_pull_fw_stats(struct ath10k *ar, |
| 2710 | struct sk_buff *skb, |
| 2711 | struct ath10k_fw_stats *stats) |
| 2712 | { |
| 2713 | const struct wmi_10_2_stats_event *ev = (void *)skb->data; |
| 2714 | u32 num_pdev_stats; |
| 2715 | u32 num_pdev_ext_stats; |
| 2716 | u32 num_vdev_stats; |
| 2717 | u32 num_peer_stats; |
| 2718 | int i; |
| 2719 | |
| 2720 | if (!skb_pull(skb, sizeof(*ev))) |
| 2721 | return -EPROTO; |
| 2722 | |
| 2723 | num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats); |
| 2724 | num_pdev_ext_stats = __le32_to_cpu(ev->num_pdev_ext_stats); |
| 2725 | num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats); |
| 2726 | num_peer_stats = __le32_to_cpu(ev->num_peer_stats); |
| 2727 | |
| 2728 | for (i = 0; i < num_pdev_stats; i++) { |
| 2729 | const struct wmi_10_2_pdev_stats *src; |
| 2730 | struct ath10k_fw_stats_pdev *dst; |
| 2731 | |
| 2732 | src = (void *)skb->data; |
| 2733 | if (!skb_pull(skb, sizeof(*src))) |
| 2734 | return -EPROTO; |
| 2735 | |
| 2736 | dst = kzalloc(sizeof(*dst), GFP_ATOMIC); |
| 2737 | if (!dst) |
| 2738 | continue; |
| 2739 | |
| 2740 | ath10k_wmi_pull_pdev_stats_base(&src->base, dst); |
| 2741 | ath10k_wmi_pull_pdev_stats_tx(&src->tx, dst); |
| 2742 | ath10k_wmi_pull_pdev_stats_rx(&src->rx, dst); |
| 2743 | ath10k_wmi_pull_pdev_stats_extra(&src->extra, dst); |
| 2744 | /* FIXME: expose 10.2 specific values */ |
| 2745 | |
| 2746 | list_add_tail(&dst->list, &stats->pdevs); |
| 2747 | } |
| 2748 | |
| 2749 | for (i = 0; i < num_pdev_ext_stats; i++) { |
| 2750 | const struct wmi_10_2_pdev_ext_stats *src; |
| 2751 | |
| 2752 | src = (void *)skb->data; |
| 2753 | if (!skb_pull(skb, sizeof(*src))) |
| 2754 | return -EPROTO; |
| 2755 | |
| 2756 | /* FIXME: expose values to userspace |
| 2757 | * |
| 2758 | * Note: Even though this loop seems to do nothing it is |
| 2759 | * required to parse following sub-structures properly. |
| 2760 | */ |
| 2761 | } |
| 2762 | |
| 2763 | /* fw doesn't implement vdev stats */ |
| 2764 | |
| 2765 | for (i = 0; i < num_peer_stats; i++) { |
| 2766 | const struct wmi_10_2_4_peer_stats *src; |
| 2767 | struct ath10k_fw_stats_peer *dst; |
| 2768 | |
| 2769 | src = (void *)skb->data; |
| 2770 | if (!skb_pull(skb, sizeof(*src))) |
| 2771 | return -EPROTO; |
| 2772 | |
| 2773 | dst = kzalloc(sizeof(*dst), GFP_ATOMIC); |
| 2774 | if (!dst) |
| 2775 | continue; |
| 2776 | |
| 2777 | ath10k_wmi_pull_peer_stats(&src->common.old, dst); |
| 2778 | |
| 2779 | dst->peer_rx_rate = __le32_to_cpu(src->common.peer_rx_rate); |
| 2780 | /* FIXME: expose 10.2 specific values */ |
| 2781 | |
| 2782 | list_add_tail(&dst->list, &stats->peers); |
| 2783 | } |
| 2784 | |
| 2785 | return 0; |
| 2786 | } |
| 2787 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 2788 | void ath10k_wmi_event_update_stats(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2789 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 2790 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_UPDATE_STATS_EVENTID\n"); |
Michal Kazior | 60ef401 | 2014-09-25 12:33:48 +0200 | [diff] [blame] | 2791 | ath10k_debug_fw_stats_process(ar, skb); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2792 | } |
| 2793 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 2794 | static int |
| 2795 | ath10k_wmi_op_pull_vdev_start_ev(struct ath10k *ar, struct sk_buff *skb, |
| 2796 | struct wmi_vdev_start_ev_arg *arg) |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2797 | { |
| 2798 | struct wmi_vdev_start_response_event *ev = (void *)skb->data; |
| 2799 | |
| 2800 | if (skb->len < sizeof(*ev)) |
| 2801 | return -EPROTO; |
| 2802 | |
| 2803 | skb_pull(skb, sizeof(*ev)); |
| 2804 | arg->vdev_id = ev->vdev_id; |
| 2805 | arg->req_id = ev->req_id; |
| 2806 | arg->resp_type = ev->resp_type; |
| 2807 | arg->status = ev->status; |
| 2808 | |
| 2809 | return 0; |
| 2810 | } |
| 2811 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 2812 | void ath10k_wmi_event_vdev_start_resp(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2813 | { |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2814 | struct wmi_vdev_start_ev_arg arg = {}; |
| 2815 | int ret; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2816 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 2817 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_START_RESP_EVENTID\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2818 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 2819 | ret = ath10k_wmi_pull_vdev_start(ar, skb, &arg); |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2820 | if (ret) { |
| 2821 | ath10k_warn(ar, "failed to parse vdev start event: %d\n", ret); |
| 2822 | return; |
| 2823 | } |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2824 | |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2825 | if (WARN_ON(__le32_to_cpu(arg.status))) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2826 | return; |
| 2827 | |
| 2828 | complete(&ar->vdev_setup_done); |
| 2829 | } |
| 2830 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 2831 | void ath10k_wmi_event_vdev_stopped(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2832 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 2833 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_STOPPED_EVENTID\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2834 | complete(&ar->vdev_setup_done); |
| 2835 | } |
| 2836 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 2837 | static int |
| 2838 | ath10k_wmi_op_pull_peer_kick_ev(struct ath10k *ar, struct sk_buff *skb, |
| 2839 | struct wmi_peer_kick_ev_arg *arg) |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2840 | { |
| 2841 | struct wmi_peer_sta_kickout_event *ev = (void *)skb->data; |
| 2842 | |
| 2843 | if (skb->len < sizeof(*ev)) |
| 2844 | return -EPROTO; |
| 2845 | |
| 2846 | skb_pull(skb, sizeof(*ev)); |
| 2847 | arg->mac_addr = ev->peer_macaddr.addr; |
| 2848 | |
| 2849 | return 0; |
| 2850 | } |
| 2851 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 2852 | void ath10k_wmi_event_peer_sta_kickout(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2853 | { |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2854 | struct wmi_peer_kick_ev_arg arg = {}; |
Kalle Valo | 5a13e76 | 2014-01-20 11:01:46 +0200 | [diff] [blame] | 2855 | struct ieee80211_sta *sta; |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2856 | int ret; |
Kalle Valo | 5a13e76 | 2014-01-20 11:01:46 +0200 | [diff] [blame] | 2857 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 2858 | ret = ath10k_wmi_pull_peer_kick(ar, skb, &arg); |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2859 | if (ret) { |
| 2860 | ath10k_warn(ar, "failed to parse peer kickout event: %d\n", |
| 2861 | ret); |
| 2862 | return; |
| 2863 | } |
Kalle Valo | 5a13e76 | 2014-01-20 11:01:46 +0200 | [diff] [blame] | 2864 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 2865 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi event peer sta kickout %pM\n", |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2866 | arg.mac_addr); |
Kalle Valo | 5a13e76 | 2014-01-20 11:01:46 +0200 | [diff] [blame] | 2867 | |
| 2868 | rcu_read_lock(); |
| 2869 | |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2870 | sta = ieee80211_find_sta_by_ifaddr(ar->hw, arg.mac_addr, NULL); |
Kalle Valo | 5a13e76 | 2014-01-20 11:01:46 +0200 | [diff] [blame] | 2871 | if (!sta) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 2872 | ath10k_warn(ar, "Spurious quick kickout for STA %pM\n", |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2873 | arg.mac_addr); |
Kalle Valo | 5a13e76 | 2014-01-20 11:01:46 +0200 | [diff] [blame] | 2874 | goto exit; |
| 2875 | } |
| 2876 | |
| 2877 | ieee80211_report_low_ack(sta, 10); |
| 2878 | |
| 2879 | exit: |
| 2880 | rcu_read_unlock(); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2881 | } |
| 2882 | |
| 2883 | /* |
| 2884 | * FIXME |
| 2885 | * |
| 2886 | * We don't report to mac80211 sleep state of connected |
| 2887 | * stations. Due to this mac80211 can't fill in TIM IE |
| 2888 | * correctly. |
| 2889 | * |
| 2890 | * I know of no way of getting nullfunc frames that contain |
| 2891 | * sleep transition from connected stations - these do not |
| 2892 | * seem to be sent from the target to the host. There also |
| 2893 | * doesn't seem to be a dedicated event for that. So the |
| 2894 | * only way left to do this would be to read tim_bitmap |
| 2895 | * during SWBA. |
| 2896 | * |
| 2897 | * We could probably try using tim_bitmap from SWBA to tell |
| 2898 | * mac80211 which stations are asleep and which are not. The |
| 2899 | * problem here is calling mac80211 functions so many times |
| 2900 | * could take too long and make us miss the time to submit |
| 2901 | * the beacon to the target. |
| 2902 | * |
| 2903 | * So as a workaround we try to extend the TIM IE if there |
| 2904 | * is unicast buffered for stations with aid > 7 and fill it |
| 2905 | * in ourselves. |
| 2906 | */ |
| 2907 | static void ath10k_wmi_update_tim(struct ath10k *ar, |
| 2908 | struct ath10k_vif *arvif, |
| 2909 | struct sk_buff *bcn, |
Raja Mani | a03fee3 | 2015-06-22 20:22:20 +0530 | [diff] [blame] | 2910 | const struct wmi_tim_info_arg *tim_info) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2911 | { |
| 2912 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)bcn->data; |
| 2913 | struct ieee80211_tim_ie *tim; |
| 2914 | u8 *ies, *ie; |
| 2915 | u8 ie_len, pvm_len; |
Kalle Valo | af762c0 | 2014-09-14 12:50:17 +0300 | [diff] [blame] | 2916 | __le32 t; |
Raja Mani | a03fee3 | 2015-06-22 20:22:20 +0530 | [diff] [blame] | 2917 | u32 v, tim_len; |
| 2918 | |
| 2919 | /* When FW reports 0 in tim_len, ensure atleast first byte |
| 2920 | * in tim_bitmap is considered for pvm calculation. |
| 2921 | */ |
| 2922 | tim_len = tim_info->tim_len ? __le32_to_cpu(tim_info->tim_len) : 1; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2923 | |
| 2924 | /* if next SWBA has no tim_changed the tim_bitmap is garbage. |
| 2925 | * we must copy the bitmap upon change and reuse it later */ |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2926 | if (__le32_to_cpu(tim_info->tim_changed)) { |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2927 | int i; |
| 2928 | |
Raja Mani | a03fee3 | 2015-06-22 20:22:20 +0530 | [diff] [blame] | 2929 | if (sizeof(arvif->u.ap.tim_bitmap) < tim_len) { |
| 2930 | ath10k_warn(ar, "SWBA TIM field is too big (%u), truncated it to %zu", |
| 2931 | tim_len, sizeof(arvif->u.ap.tim_bitmap)); |
| 2932 | tim_len = sizeof(arvif->u.ap.tim_bitmap); |
| 2933 | } |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2934 | |
Raja Mani | a03fee3 | 2015-06-22 20:22:20 +0530 | [diff] [blame] | 2935 | for (i = 0; i < tim_len; i++) { |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2936 | t = tim_info->tim_bitmap[i / 4]; |
Kalle Valo | af762c0 | 2014-09-14 12:50:17 +0300 | [diff] [blame] | 2937 | v = __le32_to_cpu(t); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2938 | arvif->u.ap.tim_bitmap[i] = (v >> ((i % 4) * 8)) & 0xFF; |
| 2939 | } |
| 2940 | |
Raja Mani | a03fee3 | 2015-06-22 20:22:20 +0530 | [diff] [blame] | 2941 | /* FW reports either length 0 or length based on max supported |
| 2942 | * station. so we calculate this on our own |
| 2943 | */ |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2944 | arvif->u.ap.tim_len = 0; |
Raja Mani | a03fee3 | 2015-06-22 20:22:20 +0530 | [diff] [blame] | 2945 | for (i = 0; i < tim_len; i++) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2946 | if (arvif->u.ap.tim_bitmap[i]) |
| 2947 | arvif->u.ap.tim_len = i; |
| 2948 | |
| 2949 | arvif->u.ap.tim_len++; |
| 2950 | } |
| 2951 | |
| 2952 | ies = bcn->data; |
| 2953 | ies += ieee80211_hdrlen(hdr->frame_control); |
| 2954 | ies += 12; /* fixed parameters */ |
| 2955 | |
| 2956 | ie = (u8 *)cfg80211_find_ie(WLAN_EID_TIM, ies, |
| 2957 | (u8 *)skb_tail_pointer(bcn) - ies); |
| 2958 | if (!ie) { |
Michal Kazior | 09af8f8 | 2013-07-05 16:15:08 +0300 | [diff] [blame] | 2959 | if (arvif->vdev_type != WMI_VDEV_TYPE_IBSS) |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 2960 | ath10k_warn(ar, "no tim ie found;\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2961 | return; |
| 2962 | } |
| 2963 | |
| 2964 | tim = (void *)ie + 2; |
| 2965 | ie_len = ie[1]; |
| 2966 | pvm_len = ie_len - 3; /* exclude dtim count, dtim period, bmap ctl */ |
| 2967 | |
| 2968 | if (pvm_len < arvif->u.ap.tim_len) { |
Raja Mani | a03fee3 | 2015-06-22 20:22:20 +0530 | [diff] [blame] | 2969 | int expand_size = tim_len - pvm_len; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2970 | int move_size = skb_tail_pointer(bcn) - (ie + 2 + ie_len); |
| 2971 | void *next_ie = ie + 2 + ie_len; |
| 2972 | |
| 2973 | if (skb_put(bcn, expand_size)) { |
| 2974 | memmove(next_ie + expand_size, next_ie, move_size); |
| 2975 | |
| 2976 | ie[1] += expand_size; |
| 2977 | ie_len += expand_size; |
| 2978 | pvm_len += expand_size; |
| 2979 | } else { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 2980 | ath10k_warn(ar, "tim expansion failed\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2981 | } |
| 2982 | } |
| 2983 | |
Raja Mani | a03fee3 | 2015-06-22 20:22:20 +0530 | [diff] [blame] | 2984 | if (pvm_len > tim_len) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 2985 | ath10k_warn(ar, "tim pvm length is too great (%d)\n", pvm_len); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2986 | return; |
| 2987 | } |
| 2988 | |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2989 | tim->bitmap_ctrl = !!__le32_to_cpu(tim_info->tim_mcast); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 2990 | memcpy(tim->virtual_map, arvif->u.ap.tim_bitmap, pvm_len); |
| 2991 | |
Michal Kazior | 748afc4 | 2014-01-23 12:48:21 +0100 | [diff] [blame] | 2992 | if (tim->dtim_count == 0) { |
| 2993 | ATH10K_SKB_CB(bcn)->bcn.dtim_zero = true; |
| 2994 | |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 2995 | if (__le32_to_cpu(tim_info->tim_mcast) == 1) |
Michal Kazior | 748afc4 | 2014-01-23 12:48:21 +0100 | [diff] [blame] | 2996 | ATH10K_SKB_CB(bcn)->bcn.deliver_cab = true; |
| 2997 | } |
| 2998 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 2999 | ath10k_dbg(ar, ATH10K_DBG_MGMT, "dtim %d/%d mcast %d pvmlen %d\n", |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3000 | tim->dtim_count, tim->dtim_period, |
| 3001 | tim->bitmap_ctrl, pvm_len); |
| 3002 | } |
| 3003 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3004 | static void ath10k_wmi_update_noa(struct ath10k *ar, struct ath10k_vif *arvif, |
| 3005 | struct sk_buff *bcn, |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 3006 | const struct wmi_p2p_noa_info *noa) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3007 | { |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3008 | if (arvif->vdev_subtype != WMI_VDEV_SUBTYPE_P2P_GO) |
| 3009 | return; |
| 3010 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3011 | ath10k_dbg(ar, ATH10K_DBG_MGMT, "noa changed: %d\n", noa->changed); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3012 | |
Michal Kazior | 6a94888 | 2015-02-26 13:23:17 +0100 | [diff] [blame] | 3013 | if (noa->changed & WMI_P2P_NOA_CHANGED_BIT) |
| 3014 | ath10k_p2p_noa_update(arvif, noa); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3015 | |
| 3016 | if (arvif->u.ap.noa_data) |
| 3017 | if (!pskb_expand_head(bcn, 0, arvif->u.ap.noa_len, GFP_ATOMIC)) |
| 3018 | memcpy(skb_put(bcn, arvif->u.ap.noa_len), |
| 3019 | arvif->u.ap.noa_data, |
| 3020 | arvif->u.ap.noa_len); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3021 | } |
| 3022 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 3023 | static int ath10k_wmi_op_pull_swba_ev(struct ath10k *ar, struct sk_buff *skb, |
| 3024 | struct wmi_swba_ev_arg *arg) |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 3025 | { |
| 3026 | struct wmi_host_swba_event *ev = (void *)skb->data; |
| 3027 | u32 map; |
| 3028 | size_t i; |
| 3029 | |
| 3030 | if (skb->len < sizeof(*ev)) |
| 3031 | return -EPROTO; |
| 3032 | |
| 3033 | skb_pull(skb, sizeof(*ev)); |
| 3034 | arg->vdev_map = ev->vdev_map; |
| 3035 | |
| 3036 | for (i = 0, map = __le32_to_cpu(ev->vdev_map); map; map >>= 1) { |
| 3037 | if (!(map & BIT(0))) |
| 3038 | continue; |
| 3039 | |
| 3040 | /* If this happens there were some changes in firmware and |
| 3041 | * ath10k should update the max size of tim_info array. |
| 3042 | */ |
| 3043 | if (WARN_ON_ONCE(i == ARRAY_SIZE(arg->tim_info))) |
| 3044 | break; |
| 3045 | |
Raja Mani | a03fee3 | 2015-06-22 20:22:20 +0530 | [diff] [blame] | 3046 | if (__le32_to_cpu(ev->bcn_info[i].tim_info.tim_len) > |
| 3047 | sizeof(ev->bcn_info[i].tim_info.tim_bitmap)) { |
| 3048 | ath10k_warn(ar, "refusing to parse invalid swba structure\n"); |
| 3049 | return -EPROTO; |
| 3050 | } |
| 3051 | |
| 3052 | arg->tim_info[i].tim_len = ev->bcn_info[i].tim_info.tim_len; |
| 3053 | arg->tim_info[i].tim_mcast = ev->bcn_info[i].tim_info.tim_mcast; |
| 3054 | arg->tim_info[i].tim_bitmap = |
| 3055 | ev->bcn_info[i].tim_info.tim_bitmap; |
| 3056 | arg->tim_info[i].tim_changed = |
| 3057 | ev->bcn_info[i].tim_info.tim_changed; |
| 3058 | arg->tim_info[i].tim_num_ps_pending = |
| 3059 | ev->bcn_info[i].tim_info.tim_num_ps_pending; |
| 3060 | |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 3061 | arg->noa_info[i] = &ev->bcn_info[i].p2p_noa_info; |
| 3062 | i++; |
| 3063 | } |
| 3064 | |
| 3065 | return 0; |
| 3066 | } |
| 3067 | |
Raja Mani | 3cec3be | 2015-06-22 20:22:21 +0530 | [diff] [blame] | 3068 | static int ath10k_wmi_10_4_op_pull_swba_ev(struct ath10k *ar, |
| 3069 | struct sk_buff *skb, |
| 3070 | struct wmi_swba_ev_arg *arg) |
| 3071 | { |
| 3072 | struct wmi_10_4_host_swba_event *ev = (void *)skb->data; |
| 3073 | u32 map, tim_len; |
| 3074 | size_t i; |
| 3075 | |
| 3076 | if (skb->len < sizeof(*ev)) |
| 3077 | return -EPROTO; |
| 3078 | |
| 3079 | skb_pull(skb, sizeof(*ev)); |
| 3080 | arg->vdev_map = ev->vdev_map; |
| 3081 | |
| 3082 | for (i = 0, map = __le32_to_cpu(ev->vdev_map); map; map >>= 1) { |
| 3083 | if (!(map & BIT(0))) |
| 3084 | continue; |
| 3085 | |
| 3086 | /* If this happens there were some changes in firmware and |
| 3087 | * ath10k should update the max size of tim_info array. |
| 3088 | */ |
| 3089 | if (WARN_ON_ONCE(i == ARRAY_SIZE(arg->tim_info))) |
| 3090 | break; |
| 3091 | |
| 3092 | if (__le32_to_cpu(ev->bcn_info[i].tim_info.tim_len) > |
| 3093 | sizeof(ev->bcn_info[i].tim_info.tim_bitmap)) { |
| 3094 | ath10k_warn(ar, "refusing to parse invalid swba structure\n"); |
| 3095 | return -EPROTO; |
| 3096 | } |
| 3097 | |
| 3098 | tim_len = __le32_to_cpu(ev->bcn_info[i].tim_info.tim_len); |
| 3099 | if (tim_len) { |
| 3100 | /* Exclude 4 byte guard length */ |
| 3101 | tim_len -= 4; |
| 3102 | arg->tim_info[i].tim_len = __cpu_to_le32(tim_len); |
| 3103 | } else { |
| 3104 | arg->tim_info[i].tim_len = 0; |
| 3105 | } |
| 3106 | |
| 3107 | arg->tim_info[i].tim_mcast = ev->bcn_info[i].tim_info.tim_mcast; |
| 3108 | arg->tim_info[i].tim_bitmap = |
| 3109 | ev->bcn_info[i].tim_info.tim_bitmap; |
| 3110 | arg->tim_info[i].tim_changed = |
| 3111 | ev->bcn_info[i].tim_info.tim_changed; |
| 3112 | arg->tim_info[i].tim_num_ps_pending = |
| 3113 | ev->bcn_info[i].tim_info.tim_num_ps_pending; |
| 3114 | |
| 3115 | /* 10.4 firmware doesn't have p2p support. notice of absence |
| 3116 | * info can be ignored for now. |
| 3117 | */ |
| 3118 | |
| 3119 | i++; |
| 3120 | } |
| 3121 | |
| 3122 | return 0; |
| 3123 | } |
| 3124 | |
Vivek Natarajan | 08e75ea | 2015-08-04 10:45:11 +0530 | [diff] [blame] | 3125 | static enum wmi_txbf_conf ath10k_wmi_10_4_txbf_conf_scheme(struct ath10k *ar) |
| 3126 | { |
| 3127 | return WMI_TXBF_CONF_BEFORE_ASSOC; |
| 3128 | } |
| 3129 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 3130 | void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3131 | { |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 3132 | struct wmi_swba_ev_arg arg = {}; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3133 | u32 map; |
| 3134 | int i = -1; |
Raja Mani | a03fee3 | 2015-06-22 20:22:20 +0530 | [diff] [blame] | 3135 | const struct wmi_tim_info_arg *tim_info; |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 3136 | const struct wmi_p2p_noa_info *noa_info; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3137 | struct ath10k_vif *arvif; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3138 | struct sk_buff *bcn; |
Michal Kazior | 64badcb | 2014-09-18 11:18:02 +0300 | [diff] [blame] | 3139 | dma_addr_t paddr; |
Michal Kazior | 767d34f | 2014-02-27 18:50:03 +0200 | [diff] [blame] | 3140 | int ret, vdev_id = 0; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3141 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 3142 | ret = ath10k_wmi_pull_swba(ar, skb, &arg); |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 3143 | if (ret) { |
| 3144 | ath10k_warn(ar, "failed to parse swba event: %d\n", ret); |
| 3145 | return; |
| 3146 | } |
| 3147 | |
| 3148 | map = __le32_to_cpu(arg.vdev_map); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3149 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3150 | ath10k_dbg(ar, ATH10K_DBG_MGMT, "mgmt swba vdev_map 0x%x\n", |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 3151 | map); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3152 | |
| 3153 | for (; map; map >>= 1, vdev_id++) { |
| 3154 | if (!(map & 0x1)) |
| 3155 | continue; |
| 3156 | |
| 3157 | i++; |
| 3158 | |
| 3159 | if (i >= WMI_MAX_AP_VDEV) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3160 | ath10k_warn(ar, "swba has corrupted vdev map\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3161 | break; |
| 3162 | } |
| 3163 | |
Raja Mani | a03fee3 | 2015-06-22 20:22:20 +0530 | [diff] [blame] | 3164 | tim_info = &arg.tim_info[i]; |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 3165 | noa_info = arg.noa_info[i]; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3166 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3167 | ath10k_dbg(ar, ATH10K_DBG_MGMT, |
Kalle Valo | 7a8a396 | 2014-03-28 14:35:16 +0200 | [diff] [blame] | 3168 | "mgmt event bcn_info %d tim_len %d mcast %d changed %d num_ps_pending %d bitmap 0x%08x%08x%08x%08x\n", |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3169 | i, |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 3170 | __le32_to_cpu(tim_info->tim_len), |
| 3171 | __le32_to_cpu(tim_info->tim_mcast), |
| 3172 | __le32_to_cpu(tim_info->tim_changed), |
| 3173 | __le32_to_cpu(tim_info->tim_num_ps_pending), |
| 3174 | __le32_to_cpu(tim_info->tim_bitmap[3]), |
| 3175 | __le32_to_cpu(tim_info->tim_bitmap[2]), |
| 3176 | __le32_to_cpu(tim_info->tim_bitmap[1]), |
| 3177 | __le32_to_cpu(tim_info->tim_bitmap[0])); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3178 | |
Raja Mani | a03fee3 | 2015-06-22 20:22:20 +0530 | [diff] [blame] | 3179 | /* TODO: Only first 4 word from tim_bitmap is dumped. |
| 3180 | * Extend debug code to dump full tim_bitmap. |
| 3181 | */ |
| 3182 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3183 | arvif = ath10k_get_arvif(ar, vdev_id); |
| 3184 | if (arvif == NULL) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3185 | ath10k_warn(ar, "no vif for vdev_id %d found\n", |
| 3186 | vdev_id); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3187 | continue; |
| 3188 | } |
| 3189 | |
Michal Kazior | c2df44b | 2014-01-23 11:38:26 +0100 | [diff] [blame] | 3190 | /* There are no completions for beacons so wait for next SWBA |
| 3191 | * before telling mac80211 to decrement CSA counter |
| 3192 | * |
| 3193 | * Once CSA counter is completed stop sending beacons until |
| 3194 | * actual channel switch is done */ |
| 3195 | if (arvif->vif->csa_active && |
| 3196 | ieee80211_csa_is_complete(arvif->vif)) { |
| 3197 | ieee80211_csa_finish(arvif->vif); |
| 3198 | continue; |
| 3199 | } |
| 3200 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3201 | bcn = ieee80211_beacon_get(ar->hw, arvif->vif); |
| 3202 | if (!bcn) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3203 | ath10k_warn(ar, "could not get mac80211 beacon\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3204 | continue; |
| 3205 | } |
| 3206 | |
Michal Kazior | 4b60455 | 2014-07-21 21:03:09 +0300 | [diff] [blame] | 3207 | ath10k_tx_h_seq_no(arvif->vif, bcn); |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 3208 | ath10k_wmi_update_tim(ar, arvif, bcn, tim_info); |
| 3209 | ath10k_wmi_update_noa(ar, arvif, bcn, noa_info); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3210 | |
Michal Kazior | ed54388 | 2013-09-13 14:16:56 +0200 | [diff] [blame] | 3211 | spin_lock_bh(&ar->data_lock); |
Michal Kazior | 748afc4 | 2014-01-23 12:48:21 +0100 | [diff] [blame] | 3212 | |
Michal Kazior | ed54388 | 2013-09-13 14:16:56 +0200 | [diff] [blame] | 3213 | if (arvif->beacon) { |
Michal Kazior | af21319 | 2015-01-29 14:29:52 +0200 | [diff] [blame] | 3214 | switch (arvif->beacon_state) { |
| 3215 | case ATH10K_BEACON_SENT: |
| 3216 | break; |
| 3217 | case ATH10K_BEACON_SCHEDULED: |
| 3218 | ath10k_warn(ar, "SWBA overrun on vdev %d, skipped old beacon\n", |
Michal Kazior | 748afc4 | 2014-01-23 12:48:21 +0100 | [diff] [blame] | 3219 | arvif->vdev_id); |
Michal Kazior | af21319 | 2015-01-29 14:29:52 +0200 | [diff] [blame] | 3220 | break; |
| 3221 | case ATH10K_BEACON_SENDING: |
| 3222 | ath10k_warn(ar, "SWBA overrun on vdev %d, skipped new beacon\n", |
| 3223 | arvif->vdev_id); |
| 3224 | dev_kfree_skb(bcn); |
| 3225 | goto skip; |
| 3226 | } |
Michal Kazior | 748afc4 | 2014-01-23 12:48:21 +0100 | [diff] [blame] | 3227 | |
Michal Kazior | 64badcb | 2014-09-18 11:18:02 +0300 | [diff] [blame] | 3228 | ath10k_mac_vif_beacon_free(arvif); |
Michal Kazior | ed54388 | 2013-09-13 14:16:56 +0200 | [diff] [blame] | 3229 | } |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3230 | |
Michal Kazior | 64badcb | 2014-09-18 11:18:02 +0300 | [diff] [blame] | 3231 | if (!arvif->beacon_buf) { |
| 3232 | paddr = dma_map_single(arvif->ar->dev, bcn->data, |
| 3233 | bcn->len, DMA_TO_DEVICE); |
| 3234 | ret = dma_mapping_error(arvif->ar->dev, paddr); |
| 3235 | if (ret) { |
| 3236 | ath10k_warn(ar, "failed to map beacon: %d\n", |
| 3237 | ret); |
| 3238 | dev_kfree_skb_any(bcn); |
Michal Kazior | 5e55e3c | 2015-08-19 13:10:43 +0200 | [diff] [blame] | 3239 | ret = -EIO; |
Michal Kazior | 64badcb | 2014-09-18 11:18:02 +0300 | [diff] [blame] | 3240 | goto skip; |
| 3241 | } |
| 3242 | |
| 3243 | ATH10K_SKB_CB(bcn)->paddr = paddr; |
| 3244 | } else { |
| 3245 | if (bcn->len > IEEE80211_MAX_FRAME_LEN) { |
| 3246 | ath10k_warn(ar, "trimming beacon %d -> %d bytes!\n", |
| 3247 | bcn->len, IEEE80211_MAX_FRAME_LEN); |
| 3248 | skb_trim(bcn, IEEE80211_MAX_FRAME_LEN); |
| 3249 | } |
| 3250 | memcpy(arvif->beacon_buf, bcn->data, bcn->len); |
| 3251 | ATH10K_SKB_CB(bcn)->paddr = arvif->beacon_paddr; |
Michal Kazior | 767d34f | 2014-02-27 18:50:03 +0200 | [diff] [blame] | 3252 | } |
Michal Kazior | 748afc4 | 2014-01-23 12:48:21 +0100 | [diff] [blame] | 3253 | |
Michal Kazior | ed54388 | 2013-09-13 14:16:56 +0200 | [diff] [blame] | 3254 | arvif->beacon = bcn; |
Michal Kazior | af21319 | 2015-01-29 14:29:52 +0200 | [diff] [blame] | 3255 | arvif->beacon_state = ATH10K_BEACON_SCHEDULED; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3256 | |
Rajkumar Manoharan | 5ce8e7f | 2014-11-05 19:14:31 +0530 | [diff] [blame] | 3257 | trace_ath10k_tx_hdr(ar, bcn->data, bcn->len); |
| 3258 | trace_ath10k_tx_payload(ar, bcn->data, bcn->len); |
| 3259 | |
Michal Kazior | 767d34f | 2014-02-27 18:50:03 +0200 | [diff] [blame] | 3260 | skip: |
Michal Kazior | ed54388 | 2013-09-13 14:16:56 +0200 | [diff] [blame] | 3261 | spin_unlock_bh(&ar->data_lock); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3262 | } |
Michal Kazior | af21319 | 2015-01-29 14:29:52 +0200 | [diff] [blame] | 3263 | |
| 3264 | ath10k_wmi_tx_beacons_nowait(ar); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3265 | } |
| 3266 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 3267 | void ath10k_wmi_event_tbttoffset_update(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3268 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3269 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_TBTTOFFSET_UPDATE_EVENTID\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3270 | } |
| 3271 | |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3272 | static void ath10k_dfs_radar_report(struct ath10k *ar, |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3273 | struct wmi_phyerr_ev_arg *phyerr, |
Michal Kazior | 2332d0a | 2014-09-18 15:21:25 +0200 | [diff] [blame] | 3274 | const struct phyerr_radar_report *rr, |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3275 | u64 tsf) |
| 3276 | { |
| 3277 | u32 reg0, reg1, tsf32l; |
Michal Kazior | 500ff9f | 2015-03-31 10:26:21 +0000 | [diff] [blame] | 3278 | struct ieee80211_channel *ch; |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3279 | struct pulse_event pe; |
| 3280 | u64 tsf64; |
| 3281 | u8 rssi, width; |
| 3282 | |
| 3283 | reg0 = __le32_to_cpu(rr->reg0); |
| 3284 | reg1 = __le32_to_cpu(rr->reg1); |
| 3285 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3286 | ath10k_dbg(ar, ATH10K_DBG_REGULATORY, |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3287 | "wmi phyerr radar report chirp %d max_width %d agc_total_gain %d pulse_delta_diff %d\n", |
| 3288 | MS(reg0, RADAR_REPORT_REG0_PULSE_IS_CHIRP), |
| 3289 | MS(reg0, RADAR_REPORT_REG0_PULSE_IS_MAX_WIDTH), |
| 3290 | MS(reg0, RADAR_REPORT_REG0_AGC_TOTAL_GAIN), |
| 3291 | MS(reg0, RADAR_REPORT_REG0_PULSE_DELTA_DIFF)); |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3292 | ath10k_dbg(ar, ATH10K_DBG_REGULATORY, |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3293 | "wmi phyerr radar report pulse_delta_pean %d pulse_sidx %d fft_valid %d agc_mb_gain %d subchan_mask %d\n", |
| 3294 | MS(reg0, RADAR_REPORT_REG0_PULSE_DELTA_PEAK), |
| 3295 | MS(reg0, RADAR_REPORT_REG0_PULSE_SIDX), |
| 3296 | MS(reg1, RADAR_REPORT_REG1_PULSE_SRCH_FFT_VALID), |
| 3297 | MS(reg1, RADAR_REPORT_REG1_PULSE_AGC_MB_GAIN), |
| 3298 | MS(reg1, RADAR_REPORT_REG1_PULSE_SUBCHAN_MASK)); |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3299 | ath10k_dbg(ar, ATH10K_DBG_REGULATORY, |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3300 | "wmi phyerr radar report pulse_tsf_offset 0x%X pulse_dur: %d\n", |
| 3301 | MS(reg1, RADAR_REPORT_REG1_PULSE_TSF_OFFSET), |
| 3302 | MS(reg1, RADAR_REPORT_REG1_PULSE_DUR)); |
| 3303 | |
| 3304 | if (!ar->dfs_detector) |
| 3305 | return; |
| 3306 | |
Michal Kazior | 500ff9f | 2015-03-31 10:26:21 +0000 | [diff] [blame] | 3307 | spin_lock_bh(&ar->data_lock); |
| 3308 | ch = ar->rx_channel; |
| 3309 | spin_unlock_bh(&ar->data_lock); |
| 3310 | |
| 3311 | if (!ch) { |
| 3312 | ath10k_warn(ar, "failed to derive channel for radar pulse, treating as radar\n"); |
| 3313 | goto radar_detected; |
| 3314 | } |
| 3315 | |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3316 | /* report event to DFS pattern detector */ |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3317 | tsf32l = phyerr->tsf_timestamp; |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3318 | tsf64 = tsf & (~0xFFFFFFFFULL); |
| 3319 | tsf64 |= tsf32l; |
| 3320 | |
| 3321 | width = MS(reg1, RADAR_REPORT_REG1_PULSE_DUR); |
Michal Kazior | 2332d0a | 2014-09-18 15:21:25 +0200 | [diff] [blame] | 3322 | rssi = phyerr->rssi_combined; |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3323 | |
| 3324 | /* hardware store this as 8 bit signed value, |
| 3325 | * set to zero if negative number |
| 3326 | */ |
| 3327 | if (rssi & 0x80) |
| 3328 | rssi = 0; |
| 3329 | |
| 3330 | pe.ts = tsf64; |
Michal Kazior | 500ff9f | 2015-03-31 10:26:21 +0000 | [diff] [blame] | 3331 | pe.freq = ch->center_freq; |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3332 | pe.width = width; |
| 3333 | pe.rssi = rssi; |
Peter Oh | 2c3f26a | 2015-03-04 15:43:46 +0200 | [diff] [blame] | 3334 | pe.chirp = (MS(reg0, RADAR_REPORT_REG0_PULSE_IS_CHIRP) != 0); |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3335 | ath10k_dbg(ar, ATH10K_DBG_REGULATORY, |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3336 | "dfs add pulse freq: %d, width: %d, rssi %d, tsf: %llX\n", |
| 3337 | pe.freq, pe.width, pe.rssi, pe.ts); |
| 3338 | |
| 3339 | ATH10K_DFS_STAT_INC(ar, pulses_detected); |
| 3340 | |
| 3341 | if (!ar->dfs_detector->add_pulse(ar->dfs_detector, &pe)) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3342 | ath10k_dbg(ar, ATH10K_DBG_REGULATORY, |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3343 | "dfs no pulse pattern detected, yet\n"); |
| 3344 | return; |
| 3345 | } |
| 3346 | |
Michal Kazior | 500ff9f | 2015-03-31 10:26:21 +0000 | [diff] [blame] | 3347 | radar_detected: |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3348 | ath10k_dbg(ar, ATH10K_DBG_REGULATORY, "dfs radar detected\n"); |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3349 | ATH10K_DFS_STAT_INC(ar, radar_detected); |
Marek Puzyniak | 7d9b40b | 2013-11-20 10:00:28 +0200 | [diff] [blame] | 3350 | |
| 3351 | /* Control radar events reporting in debugfs file |
| 3352 | dfs_block_radar_events */ |
| 3353 | if (ar->dfs_block_radar_events) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3354 | ath10k_info(ar, "DFS Radar detected, but ignored as requested\n"); |
Marek Puzyniak | 7d9b40b | 2013-11-20 10:00:28 +0200 | [diff] [blame] | 3355 | return; |
| 3356 | } |
| 3357 | |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3358 | ieee80211_radar_detected(ar->hw); |
| 3359 | } |
| 3360 | |
| 3361 | static int ath10k_dfs_fft_report(struct ath10k *ar, |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3362 | struct wmi_phyerr_ev_arg *phyerr, |
Michal Kazior | 2332d0a | 2014-09-18 15:21:25 +0200 | [diff] [blame] | 3363 | const struct phyerr_fft_report *fftr, |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3364 | u64 tsf) |
| 3365 | { |
| 3366 | u32 reg0, reg1; |
| 3367 | u8 rssi, peak_mag; |
| 3368 | |
| 3369 | reg0 = __le32_to_cpu(fftr->reg0); |
| 3370 | reg1 = __le32_to_cpu(fftr->reg1); |
Michal Kazior | 2332d0a | 2014-09-18 15:21:25 +0200 | [diff] [blame] | 3371 | rssi = phyerr->rssi_combined; |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3372 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3373 | ath10k_dbg(ar, ATH10K_DBG_REGULATORY, |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3374 | "wmi phyerr fft report total_gain_db %d base_pwr_db %d fft_chn_idx %d peak_sidx %d\n", |
| 3375 | MS(reg0, SEARCH_FFT_REPORT_REG0_TOTAL_GAIN_DB), |
| 3376 | MS(reg0, SEARCH_FFT_REPORT_REG0_BASE_PWR_DB), |
| 3377 | MS(reg0, SEARCH_FFT_REPORT_REG0_FFT_CHN_IDX), |
| 3378 | MS(reg0, SEARCH_FFT_REPORT_REG0_PEAK_SIDX)); |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3379 | ath10k_dbg(ar, ATH10K_DBG_REGULATORY, |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3380 | "wmi phyerr fft report rel_pwr_db %d avgpwr_db %d peak_mag %d num_store_bin %d\n", |
| 3381 | MS(reg1, SEARCH_FFT_REPORT_REG1_RELPWR_DB), |
| 3382 | MS(reg1, SEARCH_FFT_REPORT_REG1_AVGPWR_DB), |
| 3383 | MS(reg1, SEARCH_FFT_REPORT_REG1_PEAK_MAG), |
| 3384 | MS(reg1, SEARCH_FFT_REPORT_REG1_NUM_STR_BINS_IB)); |
| 3385 | |
| 3386 | peak_mag = MS(reg1, SEARCH_FFT_REPORT_REG1_PEAK_MAG); |
| 3387 | |
| 3388 | /* false event detection */ |
| 3389 | if (rssi == DFS_RSSI_POSSIBLY_FALSE && |
| 3390 | peak_mag < 2 * DFS_PEAK_MAG_THOLD_POSSIBLY_FALSE) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3391 | ath10k_dbg(ar, ATH10K_DBG_REGULATORY, "dfs false pulse detected\n"); |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3392 | ATH10K_DFS_STAT_INC(ar, pulses_discarded); |
| 3393 | return -EINVAL; |
| 3394 | } |
| 3395 | |
| 3396 | return 0; |
| 3397 | } |
| 3398 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 3399 | void ath10k_wmi_event_dfs(struct ath10k *ar, |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3400 | struct wmi_phyerr_ev_arg *phyerr, |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 3401 | u64 tsf) |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3402 | { |
| 3403 | int buf_len, tlv_len, res, i = 0; |
Michal Kazior | 2332d0a | 2014-09-18 15:21:25 +0200 | [diff] [blame] | 3404 | const struct phyerr_tlv *tlv; |
| 3405 | const struct phyerr_radar_report *rr; |
| 3406 | const struct phyerr_fft_report *fftr; |
| 3407 | const u8 *tlv_buf; |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3408 | |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3409 | buf_len = phyerr->buf_len; |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3410 | ath10k_dbg(ar, ATH10K_DBG_REGULATORY, |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3411 | "wmi event dfs err_code %d rssi %d tsfl 0x%X tsf64 0x%llX len %d\n", |
Michal Kazior | 2332d0a | 2014-09-18 15:21:25 +0200 | [diff] [blame] | 3412 | phyerr->phy_err_code, phyerr->rssi_combined, |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3413 | phyerr->tsf_timestamp, tsf, buf_len); |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3414 | |
| 3415 | /* Skip event if DFS disabled */ |
| 3416 | if (!config_enabled(CONFIG_ATH10K_DFS_CERTIFIED)) |
| 3417 | return; |
| 3418 | |
| 3419 | ATH10K_DFS_STAT_INC(ar, pulses_total); |
| 3420 | |
| 3421 | while (i < buf_len) { |
| 3422 | if (i + sizeof(*tlv) > buf_len) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3423 | ath10k_warn(ar, "too short buf for tlv header (%d)\n", |
| 3424 | i); |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3425 | return; |
| 3426 | } |
| 3427 | |
Michal Kazior | 2332d0a | 2014-09-18 15:21:25 +0200 | [diff] [blame] | 3428 | tlv = (struct phyerr_tlv *)&phyerr->buf[i]; |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3429 | tlv_len = __le16_to_cpu(tlv->len); |
Michal Kazior | 2332d0a | 2014-09-18 15:21:25 +0200 | [diff] [blame] | 3430 | tlv_buf = &phyerr->buf[i + sizeof(*tlv)]; |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3431 | ath10k_dbg(ar, ATH10K_DBG_REGULATORY, |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3432 | "wmi event dfs tlv_len %d tlv_tag 0x%02X tlv_sig 0x%02X\n", |
| 3433 | tlv_len, tlv->tag, tlv->sig); |
| 3434 | |
| 3435 | switch (tlv->tag) { |
| 3436 | case PHYERR_TLV_TAG_RADAR_PULSE_SUMMARY: |
| 3437 | if (i + sizeof(*tlv) + sizeof(*rr) > buf_len) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3438 | ath10k_warn(ar, "too short radar pulse summary (%d)\n", |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3439 | i); |
| 3440 | return; |
| 3441 | } |
| 3442 | |
| 3443 | rr = (struct phyerr_radar_report *)tlv_buf; |
Michal Kazior | 2332d0a | 2014-09-18 15:21:25 +0200 | [diff] [blame] | 3444 | ath10k_dfs_radar_report(ar, phyerr, rr, tsf); |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3445 | break; |
| 3446 | case PHYERR_TLV_TAG_SEARCH_FFT_REPORT: |
| 3447 | if (i + sizeof(*tlv) + sizeof(*fftr) > buf_len) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3448 | ath10k_warn(ar, "too short fft report (%d)\n", |
| 3449 | i); |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3450 | return; |
| 3451 | } |
| 3452 | |
| 3453 | fftr = (struct phyerr_fft_report *)tlv_buf; |
Michal Kazior | 2332d0a | 2014-09-18 15:21:25 +0200 | [diff] [blame] | 3454 | res = ath10k_dfs_fft_report(ar, phyerr, fftr, tsf); |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3455 | if (res) |
| 3456 | return; |
| 3457 | break; |
| 3458 | } |
| 3459 | |
| 3460 | i += sizeof(*tlv) + tlv_len; |
| 3461 | } |
| 3462 | } |
| 3463 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 3464 | void ath10k_wmi_event_spectral_scan(struct ath10k *ar, |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3465 | struct wmi_phyerr_ev_arg *phyerr, |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 3466 | u64 tsf) |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3467 | { |
Simon Wunderlich | 855aed1 | 2014-08-02 09:12:54 +0300 | [diff] [blame] | 3468 | int buf_len, tlv_len, res, i = 0; |
| 3469 | struct phyerr_tlv *tlv; |
Michal Kazior | 2332d0a | 2014-09-18 15:21:25 +0200 | [diff] [blame] | 3470 | const void *tlv_buf; |
| 3471 | const struct phyerr_fft_report *fftr; |
Simon Wunderlich | 855aed1 | 2014-08-02 09:12:54 +0300 | [diff] [blame] | 3472 | size_t fftr_len; |
| 3473 | |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3474 | buf_len = phyerr->buf_len; |
Simon Wunderlich | 855aed1 | 2014-08-02 09:12:54 +0300 | [diff] [blame] | 3475 | |
| 3476 | while (i < buf_len) { |
| 3477 | if (i + sizeof(*tlv) > buf_len) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3478 | ath10k_warn(ar, "failed to parse phyerr tlv header at byte %d\n", |
Simon Wunderlich | 855aed1 | 2014-08-02 09:12:54 +0300 | [diff] [blame] | 3479 | i); |
| 3480 | return; |
| 3481 | } |
| 3482 | |
Michal Kazior | 2332d0a | 2014-09-18 15:21:25 +0200 | [diff] [blame] | 3483 | tlv = (struct phyerr_tlv *)&phyerr->buf[i]; |
Simon Wunderlich | 855aed1 | 2014-08-02 09:12:54 +0300 | [diff] [blame] | 3484 | tlv_len = __le16_to_cpu(tlv->len); |
Michal Kazior | 2332d0a | 2014-09-18 15:21:25 +0200 | [diff] [blame] | 3485 | tlv_buf = &phyerr->buf[i + sizeof(*tlv)]; |
Simon Wunderlich | 855aed1 | 2014-08-02 09:12:54 +0300 | [diff] [blame] | 3486 | |
| 3487 | if (i + sizeof(*tlv) + tlv_len > buf_len) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3488 | ath10k_warn(ar, "failed to parse phyerr tlv payload at byte %d\n", |
Simon Wunderlich | 855aed1 | 2014-08-02 09:12:54 +0300 | [diff] [blame] | 3489 | i); |
| 3490 | return; |
| 3491 | } |
| 3492 | |
| 3493 | switch (tlv->tag) { |
| 3494 | case PHYERR_TLV_TAG_SEARCH_FFT_REPORT: |
| 3495 | if (sizeof(*fftr) > tlv_len) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3496 | ath10k_warn(ar, "failed to parse fft report at byte %d\n", |
Simon Wunderlich | 855aed1 | 2014-08-02 09:12:54 +0300 | [diff] [blame] | 3497 | i); |
| 3498 | return; |
| 3499 | } |
| 3500 | |
| 3501 | fftr_len = tlv_len - sizeof(*fftr); |
Michal Kazior | 2332d0a | 2014-09-18 15:21:25 +0200 | [diff] [blame] | 3502 | fftr = tlv_buf; |
| 3503 | res = ath10k_spectral_process_fft(ar, phyerr, |
Simon Wunderlich | 855aed1 | 2014-08-02 09:12:54 +0300 | [diff] [blame] | 3504 | fftr, fftr_len, |
| 3505 | tsf); |
| 3506 | if (res < 0) { |
Kevin Darbyshire-Bryant | 3413e97 | 2015-07-21 15:50:15 +0100 | [diff] [blame] | 3507 | ath10k_dbg(ar, ATH10K_DBG_WMI, "failed to process fft report: %d\n", |
Kalle Valo | 617b0f4 | 2015-10-05 17:56:35 +0300 | [diff] [blame] | 3508 | res); |
Simon Wunderlich | 855aed1 | 2014-08-02 09:12:54 +0300 | [diff] [blame] | 3509 | return; |
| 3510 | } |
| 3511 | break; |
| 3512 | } |
| 3513 | |
| 3514 | i += sizeof(*tlv) + tlv_len; |
| 3515 | } |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3516 | } |
| 3517 | |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3518 | static int ath10k_wmi_op_pull_phyerr_ev_hdr(struct ath10k *ar, |
| 3519 | struct sk_buff *skb, |
| 3520 | struct wmi_phyerr_hdr_arg *arg) |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 3521 | { |
| 3522 | struct wmi_phyerr_event *ev = (void *)skb->data; |
| 3523 | |
| 3524 | if (skb->len < sizeof(*ev)) |
| 3525 | return -EPROTO; |
| 3526 | |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3527 | arg->num_phyerrs = __le32_to_cpu(ev->num_phyerrs); |
| 3528 | arg->tsf_l32 = __le32_to_cpu(ev->tsf_l32); |
| 3529 | arg->tsf_u32 = __le32_to_cpu(ev->tsf_u32); |
| 3530 | arg->buf_len = skb->len - sizeof(*ev); |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 3531 | arg->phyerrs = ev->phyerrs; |
| 3532 | |
| 3533 | return 0; |
| 3534 | } |
| 3535 | |
Raja Mani | 2b0a2e0 | 2015-08-14 11:13:34 +0300 | [diff] [blame] | 3536 | static int ath10k_wmi_10_4_op_pull_phyerr_ev_hdr(struct ath10k *ar, |
| 3537 | struct sk_buff *skb, |
| 3538 | struct wmi_phyerr_hdr_arg *arg) |
| 3539 | { |
| 3540 | struct wmi_10_4_phyerr_event *ev = (void *)skb->data; |
| 3541 | |
| 3542 | if (skb->len < sizeof(*ev)) |
| 3543 | return -EPROTO; |
| 3544 | |
| 3545 | /* 10.4 firmware always reports only one phyerr */ |
| 3546 | arg->num_phyerrs = 1; |
| 3547 | |
| 3548 | arg->tsf_l32 = __le32_to_cpu(ev->tsf_l32); |
| 3549 | arg->tsf_u32 = __le32_to_cpu(ev->tsf_u32); |
| 3550 | arg->buf_len = skb->len; |
| 3551 | arg->phyerrs = skb->data; |
| 3552 | |
| 3553 | return 0; |
| 3554 | } |
| 3555 | |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3556 | int ath10k_wmi_op_pull_phyerr_ev(struct ath10k *ar, |
| 3557 | const void *phyerr_buf, |
| 3558 | int left_len, |
| 3559 | struct wmi_phyerr_ev_arg *arg) |
| 3560 | { |
| 3561 | const struct wmi_phyerr *phyerr = phyerr_buf; |
| 3562 | int i; |
| 3563 | |
| 3564 | if (left_len < sizeof(*phyerr)) { |
Raja Mani | ee92a20 | 2015-08-21 18:42:36 +0530 | [diff] [blame] | 3565 | ath10k_warn(ar, "wrong phyerr event head len %d (need: >=%zd)\n", |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3566 | left_len, sizeof(*phyerr)); |
| 3567 | return -EINVAL; |
| 3568 | } |
| 3569 | |
| 3570 | arg->tsf_timestamp = __le32_to_cpu(phyerr->tsf_timestamp); |
| 3571 | arg->freq1 = __le16_to_cpu(phyerr->freq1); |
| 3572 | arg->freq2 = __le16_to_cpu(phyerr->freq2); |
| 3573 | arg->rssi_combined = phyerr->rssi_combined; |
| 3574 | arg->chan_width_mhz = phyerr->chan_width_mhz; |
| 3575 | arg->buf_len = __le32_to_cpu(phyerr->buf_len); |
| 3576 | arg->buf = phyerr->buf; |
| 3577 | arg->hdr_len = sizeof(*phyerr); |
| 3578 | |
| 3579 | for (i = 0; i < 4; i++) |
| 3580 | arg->nf_chains[i] = __le16_to_cpu(phyerr->nf_chains[i]); |
| 3581 | |
| 3582 | switch (phyerr->phy_err_code) { |
| 3583 | case PHY_ERROR_GEN_SPECTRAL_SCAN: |
| 3584 | arg->phy_err_code = PHY_ERROR_SPECTRAL_SCAN; |
| 3585 | break; |
| 3586 | case PHY_ERROR_GEN_FALSE_RADAR_EXT: |
| 3587 | arg->phy_err_code = PHY_ERROR_FALSE_RADAR_EXT; |
| 3588 | break; |
| 3589 | case PHY_ERROR_GEN_RADAR: |
| 3590 | arg->phy_err_code = PHY_ERROR_RADAR; |
| 3591 | break; |
| 3592 | default: |
| 3593 | arg->phy_err_code = PHY_ERROR_UNKNOWN; |
| 3594 | break; |
| 3595 | } |
| 3596 | |
| 3597 | return 0; |
| 3598 | } |
| 3599 | |
Raja Mani | 2b0a2e0 | 2015-08-14 11:13:34 +0300 | [diff] [blame] | 3600 | static int ath10k_wmi_10_4_op_pull_phyerr_ev(struct ath10k *ar, |
| 3601 | const void *phyerr_buf, |
| 3602 | int left_len, |
| 3603 | struct wmi_phyerr_ev_arg *arg) |
| 3604 | { |
| 3605 | const struct wmi_10_4_phyerr_event *phyerr = phyerr_buf; |
| 3606 | u32 phy_err_mask; |
| 3607 | int i; |
| 3608 | |
| 3609 | if (left_len < sizeof(*phyerr)) { |
Raja Mani | ee92a20 | 2015-08-21 18:42:36 +0530 | [diff] [blame] | 3610 | ath10k_warn(ar, "wrong phyerr event head len %d (need: >=%zd)\n", |
Raja Mani | 2b0a2e0 | 2015-08-14 11:13:34 +0300 | [diff] [blame] | 3611 | left_len, sizeof(*phyerr)); |
| 3612 | return -EINVAL; |
| 3613 | } |
| 3614 | |
| 3615 | arg->tsf_timestamp = __le32_to_cpu(phyerr->tsf_timestamp); |
| 3616 | arg->freq1 = __le16_to_cpu(phyerr->freq1); |
| 3617 | arg->freq2 = __le16_to_cpu(phyerr->freq2); |
| 3618 | arg->rssi_combined = phyerr->rssi_combined; |
| 3619 | arg->chan_width_mhz = phyerr->chan_width_mhz; |
| 3620 | arg->buf_len = __le32_to_cpu(phyerr->buf_len); |
| 3621 | arg->buf = phyerr->buf; |
| 3622 | arg->hdr_len = sizeof(*phyerr); |
| 3623 | |
| 3624 | for (i = 0; i < 4; i++) |
| 3625 | arg->nf_chains[i] = __le16_to_cpu(phyerr->nf_chains[i]); |
| 3626 | |
| 3627 | phy_err_mask = __le32_to_cpu(phyerr->phy_err_mask[0]); |
| 3628 | |
| 3629 | if (phy_err_mask & PHY_ERROR_10_4_SPECTRAL_SCAN_MASK) |
| 3630 | arg->phy_err_code = PHY_ERROR_SPECTRAL_SCAN; |
| 3631 | else if (phy_err_mask & PHY_ERROR_10_4_RADAR_MASK) |
| 3632 | arg->phy_err_code = PHY_ERROR_RADAR; |
| 3633 | else |
| 3634 | arg->phy_err_code = PHY_ERROR_UNKNOWN; |
| 3635 | |
| 3636 | return 0; |
| 3637 | } |
| 3638 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 3639 | void ath10k_wmi_event_phyerr(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3640 | { |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3641 | struct wmi_phyerr_hdr_arg hdr_arg = {}; |
| 3642 | struct wmi_phyerr_ev_arg phyerr_arg = {}; |
| 3643 | const void *phyerr; |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3644 | u32 count, i, buf_len, phy_err_code; |
| 3645 | u64 tsf; |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 3646 | int left_len, ret; |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3647 | |
| 3648 | ATH10K_DFS_STAT_INC(ar, phy_errors); |
| 3649 | |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3650 | ret = ath10k_wmi_pull_phyerr_hdr(ar, skb, &hdr_arg); |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 3651 | if (ret) { |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3652 | ath10k_warn(ar, "failed to parse phyerr event hdr: %d\n", ret); |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3653 | return; |
| 3654 | } |
| 3655 | |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3656 | /* Check number of included events */ |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3657 | count = hdr_arg.num_phyerrs; |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3658 | |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3659 | left_len = hdr_arg.buf_len; |
| 3660 | |
| 3661 | tsf = hdr_arg.tsf_u32; |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3662 | tsf <<= 32; |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3663 | tsf |= hdr_arg.tsf_l32; |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3664 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3665 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3666 | "wmi event phyerr count %d tsf64 0x%llX\n", |
| 3667 | count, tsf); |
| 3668 | |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3669 | phyerr = hdr_arg.phyerrs; |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3670 | for (i = 0; i < count; i++) { |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3671 | ret = ath10k_wmi_pull_phyerr(ar, phyerr, left_len, &phyerr_arg); |
| 3672 | if (ret) { |
| 3673 | ath10k_warn(ar, "failed to parse phyerr event (%d)\n", |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3674 | i); |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3675 | return; |
| 3676 | } |
| 3677 | |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3678 | left_len -= phyerr_arg.hdr_len; |
| 3679 | buf_len = phyerr_arg.buf_len; |
| 3680 | phy_err_code = phyerr_arg.phy_err_code; |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3681 | |
| 3682 | if (left_len < buf_len) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3683 | ath10k_warn(ar, "single event (%d) wrong buf len\n", i); |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3684 | return; |
| 3685 | } |
| 3686 | |
| 3687 | left_len -= buf_len; |
| 3688 | |
| 3689 | switch (phy_err_code) { |
| 3690 | case PHY_ERROR_RADAR: |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3691 | ath10k_wmi_event_dfs(ar, &phyerr_arg, tsf); |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3692 | break; |
| 3693 | case PHY_ERROR_SPECTRAL_SCAN: |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3694 | ath10k_wmi_event_spectral_scan(ar, &phyerr_arg, tsf); |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3695 | break; |
| 3696 | case PHY_ERROR_FALSE_RADAR_EXT: |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3697 | ath10k_wmi_event_dfs(ar, &phyerr_arg, tsf); |
| 3698 | ath10k_wmi_event_spectral_scan(ar, &phyerr_arg, tsf); |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3699 | break; |
| 3700 | default: |
| 3701 | break; |
| 3702 | } |
| 3703 | |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 3704 | phyerr = phyerr + phyerr_arg.hdr_len + buf_len; |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 3705 | } |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3706 | } |
| 3707 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 3708 | void ath10k_wmi_event_roam(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3709 | { |
Michal Kazior | c1a4654 | 2015-03-10 16:21:54 +0200 | [diff] [blame] | 3710 | struct wmi_roam_ev_arg arg = {}; |
| 3711 | int ret; |
| 3712 | u32 vdev_id; |
| 3713 | u32 reason; |
| 3714 | s32 rssi; |
| 3715 | |
| 3716 | ret = ath10k_wmi_pull_roam_ev(ar, skb, &arg); |
| 3717 | if (ret) { |
| 3718 | ath10k_warn(ar, "failed to parse roam event: %d\n", ret); |
| 3719 | return; |
| 3720 | } |
| 3721 | |
| 3722 | vdev_id = __le32_to_cpu(arg.vdev_id); |
| 3723 | reason = __le32_to_cpu(arg.reason); |
| 3724 | rssi = __le32_to_cpu(arg.rssi); |
| 3725 | rssi += WMI_SPECTRAL_NOISE_FLOOR_REF_DEFAULT; |
| 3726 | |
| 3727 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
| 3728 | "wmi roam event vdev %u reason 0x%08x rssi %d\n", |
| 3729 | vdev_id, reason, rssi); |
| 3730 | |
| 3731 | if (reason >= WMI_ROAM_REASON_MAX) |
| 3732 | ath10k_warn(ar, "ignoring unknown roam event reason %d on vdev %i\n", |
| 3733 | reason, vdev_id); |
| 3734 | |
| 3735 | switch (reason) { |
Michal Kazior | c1a4654 | 2015-03-10 16:21:54 +0200 | [diff] [blame] | 3736 | case WMI_ROAM_REASON_BEACON_MISS: |
Michal Kazior | cc9904e | 2015-03-10 16:22:01 +0200 | [diff] [blame] | 3737 | ath10k_mac_handle_beacon_miss(ar, vdev_id); |
| 3738 | break; |
| 3739 | case WMI_ROAM_REASON_BETTER_AP: |
Michal Kazior | c1a4654 | 2015-03-10 16:21:54 +0200 | [diff] [blame] | 3740 | case WMI_ROAM_REASON_LOW_RSSI: |
| 3741 | case WMI_ROAM_REASON_SUITABLE_AP_FOUND: |
| 3742 | case WMI_ROAM_REASON_HO_FAILED: |
| 3743 | ath10k_warn(ar, "ignoring not implemented roam event reason %d on vdev %i\n", |
| 3744 | reason, vdev_id); |
| 3745 | break; |
| 3746 | } |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3747 | } |
| 3748 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 3749 | void ath10k_wmi_event_profile_match(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3750 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3751 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_PROFILE_MATCH\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3752 | } |
| 3753 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 3754 | void ath10k_wmi_event_debug_print(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3755 | { |
Kalle Valo | 2fe5288 | 2014-01-03 12:59:20 +0200 | [diff] [blame] | 3756 | char buf[101], c; |
| 3757 | int i; |
| 3758 | |
| 3759 | for (i = 0; i < sizeof(buf) - 1; i++) { |
| 3760 | if (i >= skb->len) |
| 3761 | break; |
| 3762 | |
| 3763 | c = skb->data[i]; |
| 3764 | |
| 3765 | if (c == '\0') |
| 3766 | break; |
| 3767 | |
| 3768 | if (isascii(c) && isprint(c)) |
| 3769 | buf[i] = c; |
| 3770 | else |
| 3771 | buf[i] = '.'; |
| 3772 | } |
| 3773 | |
| 3774 | if (i == sizeof(buf) - 1) |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3775 | ath10k_warn(ar, "wmi debug print truncated: %d\n", skb->len); |
Kalle Valo | 2fe5288 | 2014-01-03 12:59:20 +0200 | [diff] [blame] | 3776 | |
| 3777 | /* for some reason the debug prints end with \n, remove that */ |
| 3778 | if (skb->data[i - 1] == '\n') |
| 3779 | i--; |
| 3780 | |
| 3781 | /* the last byte is always reserved for the null character */ |
| 3782 | buf[i] = '\0'; |
| 3783 | |
Ben Greear | 3be004c | 2014-09-23 14:17:19 -0700 | [diff] [blame] | 3784 | ath10k_dbg(ar, ATH10K_DBG_WMI_PRINT, "wmi print '%s'\n", buf); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3785 | } |
| 3786 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 3787 | void ath10k_wmi_event_pdev_qvit(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3788 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3789 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_PDEV_QVIT_EVENTID\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3790 | } |
| 3791 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 3792 | void ath10k_wmi_event_wlan_profile_data(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3793 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3794 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_WLAN_PROFILE_DATA_EVENTID\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3795 | } |
| 3796 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 3797 | void ath10k_wmi_event_rtt_measurement_report(struct ath10k *ar, |
| 3798 | struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3799 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3800 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_RTT_MEASUREMENT_REPORT_EVENTID\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3801 | } |
| 3802 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 3803 | void ath10k_wmi_event_tsf_measurement_report(struct ath10k *ar, |
| 3804 | struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3805 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3806 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_TSF_MEASUREMENT_REPORT_EVENTID\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3807 | } |
| 3808 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 3809 | void ath10k_wmi_event_rtt_error_report(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3810 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3811 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_RTT_ERROR_REPORT_EVENTID\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3812 | } |
| 3813 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 3814 | void ath10k_wmi_event_wow_wakeup_host(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3815 | { |
Janusz Dziedzic | 5fd3ac3 | 2015-03-23 17:32:53 +0200 | [diff] [blame] | 3816 | struct wmi_wow_ev_arg ev = {}; |
| 3817 | int ret; |
| 3818 | |
| 3819 | complete(&ar->wow.wakeup_completed); |
| 3820 | |
| 3821 | ret = ath10k_wmi_pull_wow_event(ar, skb, &ev); |
| 3822 | if (ret) { |
| 3823 | ath10k_warn(ar, "failed to parse wow wakeup event: %d\n", ret); |
| 3824 | return; |
| 3825 | } |
| 3826 | |
| 3827 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wow wakeup host reason %s\n", |
| 3828 | wow_reason(ev.wake_reason)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3829 | } |
| 3830 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 3831 | void ath10k_wmi_event_dcs_interference(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3832 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 3833 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_DCS_INTERFERENCE_EVENTID\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3834 | } |
| 3835 | |
Maharaja Kennadyrajan | 2954266 | 2015-10-05 17:56:38 +0300 | [diff] [blame] | 3836 | static u8 ath10k_tpc_config_get_rate(struct ath10k *ar, |
| 3837 | struct wmi_pdev_tpc_config_event *ev, |
| 3838 | u32 rate_idx, u32 num_chains, |
| 3839 | u32 rate_code, u8 type) |
| 3840 | { |
| 3841 | u8 tpc, num_streams, preamble, ch, stm_idx; |
| 3842 | |
| 3843 | num_streams = ATH10K_HW_NSS(rate_code); |
| 3844 | preamble = ATH10K_HW_PREAMBLE(rate_code); |
| 3845 | ch = num_chains - 1; |
| 3846 | |
| 3847 | tpc = min_t(u8, ev->rates_array[rate_idx], ev->max_reg_allow_pow[ch]); |
| 3848 | |
| 3849 | if (__le32_to_cpu(ev->num_tx_chain) <= 1) |
| 3850 | goto out; |
| 3851 | |
| 3852 | if (preamble == WMI_RATE_PREAMBLE_CCK) |
| 3853 | goto out; |
| 3854 | |
| 3855 | stm_idx = num_streams - 1; |
| 3856 | if (num_chains <= num_streams) |
| 3857 | goto out; |
| 3858 | |
| 3859 | switch (type) { |
| 3860 | case WMI_TPC_TABLE_TYPE_STBC: |
| 3861 | tpc = min_t(u8, tpc, |
| 3862 | ev->max_reg_allow_pow_agstbc[ch - 1][stm_idx]); |
| 3863 | break; |
| 3864 | case WMI_TPC_TABLE_TYPE_TXBF: |
| 3865 | tpc = min_t(u8, tpc, |
| 3866 | ev->max_reg_allow_pow_agtxbf[ch - 1][stm_idx]); |
| 3867 | break; |
| 3868 | case WMI_TPC_TABLE_TYPE_CDD: |
| 3869 | tpc = min_t(u8, tpc, |
| 3870 | ev->max_reg_allow_pow_agcdd[ch - 1][stm_idx]); |
| 3871 | break; |
| 3872 | default: |
| 3873 | ath10k_warn(ar, "unknown wmi tpc table type: %d\n", type); |
| 3874 | tpc = 0; |
| 3875 | break; |
| 3876 | } |
| 3877 | |
| 3878 | out: |
| 3879 | return tpc; |
| 3880 | } |
| 3881 | |
| 3882 | static void ath10k_tpc_config_disp_tables(struct ath10k *ar, |
| 3883 | struct wmi_pdev_tpc_config_event *ev, |
| 3884 | struct ath10k_tpc_stats *tpc_stats, |
| 3885 | u8 *rate_code, u16 *pream_table, u8 type) |
| 3886 | { |
| 3887 | u32 i, j, pream_idx, flags; |
| 3888 | u8 tpc[WMI_TPC_TX_N_CHAIN]; |
| 3889 | char tpc_value[WMI_TPC_TX_N_CHAIN * WMI_TPC_BUF_SIZE]; |
| 3890 | char buff[WMI_TPC_BUF_SIZE]; |
| 3891 | |
| 3892 | flags = __le32_to_cpu(ev->flags); |
| 3893 | |
| 3894 | switch (type) { |
| 3895 | case WMI_TPC_TABLE_TYPE_CDD: |
| 3896 | if (!(flags & WMI_TPC_CONFIG_EVENT_FLAG_TABLE_CDD)) { |
| 3897 | ath10k_dbg(ar, ATH10K_DBG_WMI, "CDD not supported\n"); |
| 3898 | tpc_stats->flag[type] = ATH10K_TPC_TABLE_TYPE_FLAG; |
| 3899 | return; |
| 3900 | } |
| 3901 | break; |
| 3902 | case WMI_TPC_TABLE_TYPE_STBC: |
| 3903 | if (!(flags & WMI_TPC_CONFIG_EVENT_FLAG_TABLE_STBC)) { |
| 3904 | ath10k_dbg(ar, ATH10K_DBG_WMI, "STBC not supported\n"); |
| 3905 | tpc_stats->flag[type] = ATH10K_TPC_TABLE_TYPE_FLAG; |
| 3906 | return; |
| 3907 | } |
| 3908 | break; |
| 3909 | case WMI_TPC_TABLE_TYPE_TXBF: |
| 3910 | if (!(flags & WMI_TPC_CONFIG_EVENT_FLAG_TABLE_TXBF)) { |
| 3911 | ath10k_dbg(ar, ATH10K_DBG_WMI, "TXBF not supported\n"); |
| 3912 | tpc_stats->flag[type] = ATH10K_TPC_TABLE_TYPE_FLAG; |
| 3913 | return; |
| 3914 | } |
| 3915 | break; |
| 3916 | default: |
| 3917 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
| 3918 | "invalid table type in wmi tpc event: %d\n", type); |
| 3919 | return; |
| 3920 | } |
| 3921 | |
| 3922 | pream_idx = 0; |
| 3923 | for (i = 0; i < __le32_to_cpu(ev->rate_max); i++) { |
| 3924 | memset(tpc_value, 0, sizeof(tpc_value)); |
| 3925 | memset(buff, 0, sizeof(buff)); |
| 3926 | if (i == pream_table[pream_idx]) |
| 3927 | pream_idx++; |
| 3928 | |
| 3929 | for (j = 0; j < WMI_TPC_TX_N_CHAIN; j++) { |
| 3930 | if (j >= __le32_to_cpu(ev->num_tx_chain)) |
| 3931 | break; |
| 3932 | |
| 3933 | tpc[j] = ath10k_tpc_config_get_rate(ar, ev, i, j + 1, |
| 3934 | rate_code[i], |
| 3935 | type); |
| 3936 | snprintf(buff, sizeof(buff), "%8d ", tpc[j]); |
| 3937 | strncat(tpc_value, buff, strlen(buff)); |
| 3938 | } |
| 3939 | tpc_stats->tpc_table[type].pream_idx[i] = pream_idx; |
| 3940 | tpc_stats->tpc_table[type].rate_code[i] = rate_code[i]; |
| 3941 | memcpy(tpc_stats->tpc_table[type].tpc_value[i], |
| 3942 | tpc_value, sizeof(tpc_value)); |
| 3943 | } |
| 3944 | } |
| 3945 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 3946 | void ath10k_wmi_event_pdev_tpc_config(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 3947 | { |
Maharaja Kennadyrajan | 2954266 | 2015-10-05 17:56:38 +0300 | [diff] [blame] | 3948 | u32 i, j, pream_idx, num_tx_chain; |
| 3949 | u8 rate_code[WMI_TPC_RATE_MAX], rate_idx; |
| 3950 | u16 pream_table[WMI_TPC_PREAM_TABLE_MAX]; |
| 3951 | struct wmi_pdev_tpc_config_event *ev; |
| 3952 | struct ath10k_tpc_stats *tpc_stats; |
| 3953 | |
| 3954 | ev = (struct wmi_pdev_tpc_config_event *)skb->data; |
| 3955 | |
| 3956 | tpc_stats = kzalloc(sizeof(*tpc_stats), GFP_ATOMIC); |
| 3957 | if (!tpc_stats) |
| 3958 | return; |
| 3959 | |
| 3960 | /* Create the rate code table based on the chains supported */ |
| 3961 | rate_idx = 0; |
| 3962 | pream_idx = 0; |
| 3963 | |
| 3964 | /* Fill CCK rate code */ |
| 3965 | for (i = 0; i < 4; i++) { |
| 3966 | rate_code[rate_idx] = |
| 3967 | ATH10K_HW_RATECODE(i, 0, WMI_RATE_PREAMBLE_CCK); |
| 3968 | rate_idx++; |
| 3969 | } |
| 3970 | pream_table[pream_idx] = rate_idx; |
| 3971 | pream_idx++; |
| 3972 | |
| 3973 | /* Fill OFDM rate code */ |
| 3974 | for (i = 0; i < 8; i++) { |
| 3975 | rate_code[rate_idx] = |
| 3976 | ATH10K_HW_RATECODE(i, 0, WMI_RATE_PREAMBLE_OFDM); |
| 3977 | rate_idx++; |
| 3978 | } |
| 3979 | pream_table[pream_idx] = rate_idx; |
| 3980 | pream_idx++; |
| 3981 | |
| 3982 | num_tx_chain = __le32_to_cpu(ev->num_tx_chain); |
| 3983 | |
| 3984 | /* Fill HT20 rate code */ |
| 3985 | for (i = 0; i < num_tx_chain; i++) { |
| 3986 | for (j = 0; j < 8; j++) { |
| 3987 | rate_code[rate_idx] = |
| 3988 | ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_HT); |
| 3989 | rate_idx++; |
| 3990 | } |
| 3991 | } |
| 3992 | pream_table[pream_idx] = rate_idx; |
| 3993 | pream_idx++; |
| 3994 | |
| 3995 | /* Fill HT40 rate code */ |
| 3996 | for (i = 0; i < num_tx_chain; i++) { |
| 3997 | for (j = 0; j < 8; j++) { |
| 3998 | rate_code[rate_idx] = |
| 3999 | ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_HT); |
| 4000 | rate_idx++; |
| 4001 | } |
| 4002 | } |
| 4003 | pream_table[pream_idx] = rate_idx; |
| 4004 | pream_idx++; |
| 4005 | |
| 4006 | /* Fill VHT20 rate code */ |
| 4007 | for (i = 0; i < __le32_to_cpu(ev->num_tx_chain); i++) { |
| 4008 | for (j = 0; j < 10; j++) { |
| 4009 | rate_code[rate_idx] = |
| 4010 | ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_VHT); |
| 4011 | rate_idx++; |
| 4012 | } |
| 4013 | } |
| 4014 | pream_table[pream_idx] = rate_idx; |
| 4015 | pream_idx++; |
| 4016 | |
| 4017 | /* Fill VHT40 rate code */ |
| 4018 | for (i = 0; i < num_tx_chain; i++) { |
| 4019 | for (j = 0; j < 10; j++) { |
| 4020 | rate_code[rate_idx] = |
| 4021 | ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_VHT); |
| 4022 | rate_idx++; |
| 4023 | } |
| 4024 | } |
| 4025 | pream_table[pream_idx] = rate_idx; |
| 4026 | pream_idx++; |
| 4027 | |
| 4028 | /* Fill VHT80 rate code */ |
| 4029 | for (i = 0; i < num_tx_chain; i++) { |
| 4030 | for (j = 0; j < 10; j++) { |
| 4031 | rate_code[rate_idx] = |
| 4032 | ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_VHT); |
| 4033 | rate_idx++; |
| 4034 | } |
| 4035 | } |
| 4036 | pream_table[pream_idx] = rate_idx; |
| 4037 | pream_idx++; |
| 4038 | |
| 4039 | rate_code[rate_idx++] = |
| 4040 | ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_CCK); |
| 4041 | rate_code[rate_idx++] = |
| 4042 | ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_OFDM); |
| 4043 | rate_code[rate_idx++] = |
| 4044 | ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_CCK); |
| 4045 | rate_code[rate_idx++] = |
| 4046 | ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_OFDM); |
| 4047 | rate_code[rate_idx++] = |
| 4048 | ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_OFDM); |
| 4049 | |
| 4050 | pream_table[pream_idx] = ATH10K_TPC_PREAM_TABLE_END; |
| 4051 | |
| 4052 | tpc_stats->chan_freq = __le32_to_cpu(ev->chan_freq); |
| 4053 | tpc_stats->phy_mode = __le32_to_cpu(ev->phy_mode); |
| 4054 | tpc_stats->ctl = __le32_to_cpu(ev->ctl); |
| 4055 | tpc_stats->reg_domain = __le32_to_cpu(ev->reg_domain); |
| 4056 | tpc_stats->twice_antenna_gain = a_sle32_to_cpu(ev->twice_antenna_gain); |
| 4057 | tpc_stats->twice_antenna_reduction = |
| 4058 | __le32_to_cpu(ev->twice_antenna_reduction); |
| 4059 | tpc_stats->power_limit = __le32_to_cpu(ev->power_limit); |
| 4060 | tpc_stats->twice_max_rd_power = __le32_to_cpu(ev->twice_max_rd_power); |
| 4061 | tpc_stats->num_tx_chain = __le32_to_cpu(ev->num_tx_chain); |
| 4062 | tpc_stats->rate_max = __le32_to_cpu(ev->rate_max); |
| 4063 | |
| 4064 | ath10k_tpc_config_disp_tables(ar, ev, tpc_stats, |
| 4065 | rate_code, pream_table, |
| 4066 | WMI_TPC_TABLE_TYPE_CDD); |
| 4067 | ath10k_tpc_config_disp_tables(ar, ev, tpc_stats, |
| 4068 | rate_code, pream_table, |
| 4069 | WMI_TPC_TABLE_TYPE_STBC); |
| 4070 | ath10k_tpc_config_disp_tables(ar, ev, tpc_stats, |
| 4071 | rate_code, pream_table, |
| 4072 | WMI_TPC_TABLE_TYPE_TXBF); |
| 4073 | |
| 4074 | ath10k_debug_tpc_stats_process(ar, tpc_stats); |
| 4075 | |
| 4076 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
| 4077 | "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", |
| 4078 | __le32_to_cpu(ev->chan_freq), |
| 4079 | __le32_to_cpu(ev->phy_mode), |
| 4080 | __le32_to_cpu(ev->ctl), |
| 4081 | __le32_to_cpu(ev->reg_domain), |
| 4082 | a_sle32_to_cpu(ev->twice_antenna_gain), |
| 4083 | __le32_to_cpu(ev->twice_antenna_reduction), |
| 4084 | __le32_to_cpu(ev->power_limit), |
| 4085 | __le32_to_cpu(ev->twice_max_rd_power) / 2, |
| 4086 | __le32_to_cpu(ev->num_tx_chain), |
| 4087 | __le32_to_cpu(ev->rate_max)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4088 | } |
| 4089 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 4090 | void ath10k_wmi_event_pdev_ftm_intg(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4091 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4092 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_PDEV_FTM_INTG_EVENTID\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4093 | } |
| 4094 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 4095 | void ath10k_wmi_event_gtk_offload_status(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4096 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4097 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_GTK_OFFLOAD_STATUS_EVENTID\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4098 | } |
| 4099 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 4100 | void ath10k_wmi_event_gtk_rekey_fail(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4101 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4102 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_GTK_REKEY_FAIL_EVENTID\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4103 | } |
| 4104 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 4105 | void ath10k_wmi_event_delba_complete(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4106 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4107 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_TX_DELBA_COMPLETE_EVENTID\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4108 | } |
| 4109 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 4110 | void ath10k_wmi_event_addba_complete(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4111 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4112 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_TX_ADDBA_COMPLETE_EVENTID\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4113 | } |
| 4114 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 4115 | void ath10k_wmi_event_vdev_install_key_complete(struct ath10k *ar, |
| 4116 | struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4117 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4118 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID\n"); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4119 | } |
| 4120 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 4121 | void ath10k_wmi_event_inst_rssi_stats(struct ath10k *ar, struct sk_buff *skb) |
Bartosz Markowski | 8a6618b | 2013-09-26 17:47:08 +0200 | [diff] [blame] | 4122 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4123 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_INST_RSSI_STATS_EVENTID\n"); |
Bartosz Markowski | 8a6618b | 2013-09-26 17:47:08 +0200 | [diff] [blame] | 4124 | } |
| 4125 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 4126 | void ath10k_wmi_event_vdev_standby_req(struct ath10k *ar, struct sk_buff *skb) |
Bartosz Markowski | 8a6618b | 2013-09-26 17:47:08 +0200 | [diff] [blame] | 4127 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4128 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_STANDBY_REQ_EVENTID\n"); |
Bartosz Markowski | 8a6618b | 2013-09-26 17:47:08 +0200 | [diff] [blame] | 4129 | } |
| 4130 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 4131 | void ath10k_wmi_event_vdev_resume_req(struct ath10k *ar, struct sk_buff *skb) |
Bartosz Markowski | 8a6618b | 2013-09-26 17:47:08 +0200 | [diff] [blame] | 4132 | { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4133 | ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_RESUME_REQ_EVENTID\n"); |
Bartosz Markowski | 8a6618b | 2013-09-26 17:47:08 +0200 | [diff] [blame] | 4134 | } |
| 4135 | |
Bartosz Markowski | b3effe6 | 2013-09-26 17:47:11 +0200 | [diff] [blame] | 4136 | static int ath10k_wmi_alloc_host_mem(struct ath10k *ar, u32 req_id, |
Kalle Valo | 5b07e07 | 2014-09-14 12:50:06 +0300 | [diff] [blame] | 4137 | u32 num_units, u32 unit_len) |
Bartosz Markowski | b3effe6 | 2013-09-26 17:47:11 +0200 | [diff] [blame] | 4138 | { |
| 4139 | dma_addr_t paddr; |
| 4140 | u32 pool_size; |
| 4141 | int idx = ar->wmi.num_mem_chunks; |
| 4142 | |
| 4143 | pool_size = num_units * round_up(unit_len, 4); |
| 4144 | |
| 4145 | if (!pool_size) |
| 4146 | return -EINVAL; |
| 4147 | |
| 4148 | ar->wmi.mem_chunks[idx].vaddr = dma_alloc_coherent(ar->dev, |
| 4149 | pool_size, |
| 4150 | &paddr, |
Raja Mani | c8ecfc1 | 2015-07-29 11:40:38 +0300 | [diff] [blame] | 4151 | GFP_KERNEL); |
Bartosz Markowski | b3effe6 | 2013-09-26 17:47:11 +0200 | [diff] [blame] | 4152 | if (!ar->wmi.mem_chunks[idx].vaddr) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4153 | ath10k_warn(ar, "failed to allocate memory chunk\n"); |
Bartosz Markowski | b3effe6 | 2013-09-26 17:47:11 +0200 | [diff] [blame] | 4154 | return -ENOMEM; |
| 4155 | } |
| 4156 | |
| 4157 | memset(ar->wmi.mem_chunks[idx].vaddr, 0, pool_size); |
| 4158 | |
| 4159 | ar->wmi.mem_chunks[idx].paddr = paddr; |
| 4160 | ar->wmi.mem_chunks[idx].len = pool_size; |
| 4161 | ar->wmi.mem_chunks[idx].req_id = req_id; |
| 4162 | ar->wmi.num_mem_chunks++; |
| 4163 | |
| 4164 | return 0; |
| 4165 | } |
| 4166 | |
Vasanthakumar Thiagarajan | a925a37 | 2015-08-28 17:21:34 +0530 | [diff] [blame] | 4167 | static bool |
| 4168 | ath10k_wmi_is_host_mem_allocated(struct ath10k *ar, |
| 4169 | const struct wlan_host_mem_req **mem_reqs, |
| 4170 | u32 num_mem_reqs) |
| 4171 | { |
| 4172 | u32 req_id, num_units, unit_size, num_unit_info; |
| 4173 | u32 pool_size; |
| 4174 | int i, j; |
| 4175 | bool found; |
| 4176 | |
| 4177 | if (ar->wmi.num_mem_chunks != num_mem_reqs) |
| 4178 | return false; |
| 4179 | |
| 4180 | for (i = 0; i < num_mem_reqs; ++i) { |
| 4181 | req_id = __le32_to_cpu(mem_reqs[i]->req_id); |
| 4182 | num_units = __le32_to_cpu(mem_reqs[i]->num_units); |
| 4183 | unit_size = __le32_to_cpu(mem_reqs[i]->unit_size); |
| 4184 | num_unit_info = __le32_to_cpu(mem_reqs[i]->num_unit_info); |
| 4185 | |
| 4186 | if (num_unit_info & NUM_UNITS_IS_NUM_ACTIVE_PEERS) { |
| 4187 | if (ar->num_active_peers) |
| 4188 | num_units = ar->num_active_peers + 1; |
| 4189 | else |
| 4190 | num_units = ar->max_num_peers + 1; |
| 4191 | } else if (num_unit_info & NUM_UNITS_IS_NUM_PEERS) { |
| 4192 | num_units = ar->max_num_peers + 1; |
| 4193 | } else if (num_unit_info & NUM_UNITS_IS_NUM_VDEVS) { |
| 4194 | num_units = ar->max_num_vdevs + 1; |
| 4195 | } |
| 4196 | |
| 4197 | found = false; |
| 4198 | for (j = 0; j < ar->wmi.num_mem_chunks; j++) { |
| 4199 | if (ar->wmi.mem_chunks[j].req_id == req_id) { |
| 4200 | pool_size = num_units * round_up(unit_size, 4); |
| 4201 | if (ar->wmi.mem_chunks[j].len == pool_size) { |
| 4202 | found = true; |
| 4203 | break; |
| 4204 | } |
| 4205 | } |
| 4206 | } |
| 4207 | if (!found) |
| 4208 | return false; |
| 4209 | } |
| 4210 | |
| 4211 | return true; |
| 4212 | } |
| 4213 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 4214 | static int |
| 4215 | ath10k_wmi_main_op_pull_svc_rdy_ev(struct ath10k *ar, struct sk_buff *skb, |
| 4216 | struct wmi_svc_rdy_ev_arg *arg) |
Michal Kazior | 5c01aa3d | 2014-09-18 15:21:24 +0200 | [diff] [blame] | 4217 | { |
| 4218 | struct wmi_service_ready_event *ev; |
| 4219 | size_t i, n; |
| 4220 | |
| 4221 | if (skb->len < sizeof(*ev)) |
| 4222 | return -EPROTO; |
| 4223 | |
| 4224 | ev = (void *)skb->data; |
| 4225 | skb_pull(skb, sizeof(*ev)); |
| 4226 | arg->min_tx_power = ev->hw_min_tx_power; |
| 4227 | arg->max_tx_power = ev->hw_max_tx_power; |
| 4228 | arg->ht_cap = ev->ht_cap_info; |
| 4229 | arg->vht_cap = ev->vht_cap_info; |
| 4230 | arg->sw_ver0 = ev->sw_version; |
| 4231 | arg->sw_ver1 = ev->sw_version_1; |
| 4232 | arg->phy_capab = ev->phy_capability; |
| 4233 | arg->num_rf_chains = ev->num_rf_chains; |
| 4234 | arg->eeprom_rd = ev->hal_reg_capabilities.eeprom_rd; |
| 4235 | arg->num_mem_reqs = ev->num_mem_reqs; |
| 4236 | arg->service_map = ev->wmi_service_bitmap; |
Michal Kazior | 2a3e60d | 2014-11-27 10:11:15 +0100 | [diff] [blame] | 4237 | arg->service_map_len = sizeof(ev->wmi_service_bitmap); |
Michal Kazior | 5c01aa3d | 2014-09-18 15:21:24 +0200 | [diff] [blame] | 4238 | |
| 4239 | n = min_t(size_t, __le32_to_cpu(arg->num_mem_reqs), |
| 4240 | ARRAY_SIZE(arg->mem_reqs)); |
| 4241 | for (i = 0; i < n; i++) |
| 4242 | arg->mem_reqs[i] = &ev->mem_reqs[i]; |
| 4243 | |
| 4244 | if (skb->len < |
| 4245 | __le32_to_cpu(arg->num_mem_reqs) * sizeof(arg->mem_reqs[0])) |
| 4246 | return -EPROTO; |
| 4247 | |
| 4248 | return 0; |
| 4249 | } |
| 4250 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 4251 | static int |
| 4252 | ath10k_wmi_10x_op_pull_svc_rdy_ev(struct ath10k *ar, struct sk_buff *skb, |
| 4253 | struct wmi_svc_rdy_ev_arg *arg) |
Michal Kazior | 5c01aa3d | 2014-09-18 15:21:24 +0200 | [diff] [blame] | 4254 | { |
| 4255 | struct wmi_10x_service_ready_event *ev; |
| 4256 | int i, n; |
| 4257 | |
| 4258 | if (skb->len < sizeof(*ev)) |
| 4259 | return -EPROTO; |
| 4260 | |
| 4261 | ev = (void *)skb->data; |
| 4262 | skb_pull(skb, sizeof(*ev)); |
| 4263 | arg->min_tx_power = ev->hw_min_tx_power; |
| 4264 | arg->max_tx_power = ev->hw_max_tx_power; |
| 4265 | arg->ht_cap = ev->ht_cap_info; |
| 4266 | arg->vht_cap = ev->vht_cap_info; |
| 4267 | arg->sw_ver0 = ev->sw_version; |
| 4268 | arg->phy_capab = ev->phy_capability; |
| 4269 | arg->num_rf_chains = ev->num_rf_chains; |
| 4270 | arg->eeprom_rd = ev->hal_reg_capabilities.eeprom_rd; |
| 4271 | arg->num_mem_reqs = ev->num_mem_reqs; |
| 4272 | arg->service_map = ev->wmi_service_bitmap; |
Michal Kazior | 2a3e60d | 2014-11-27 10:11:15 +0100 | [diff] [blame] | 4273 | arg->service_map_len = sizeof(ev->wmi_service_bitmap); |
Michal Kazior | 5c01aa3d | 2014-09-18 15:21:24 +0200 | [diff] [blame] | 4274 | |
| 4275 | n = min_t(size_t, __le32_to_cpu(arg->num_mem_reqs), |
| 4276 | ARRAY_SIZE(arg->mem_reqs)); |
| 4277 | for (i = 0; i < n; i++) |
| 4278 | arg->mem_reqs[i] = &ev->mem_reqs[i]; |
| 4279 | |
| 4280 | if (skb->len < |
| 4281 | __le32_to_cpu(arg->num_mem_reqs) * sizeof(arg->mem_reqs[0])) |
| 4282 | return -EPROTO; |
| 4283 | |
| 4284 | return 0; |
| 4285 | } |
| 4286 | |
Raja Mani | c8ecfc1 | 2015-07-29 11:40:38 +0300 | [diff] [blame] | 4287 | static void ath10k_wmi_event_service_ready_work(struct work_struct *work) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4288 | { |
Raja Mani | c8ecfc1 | 2015-07-29 11:40:38 +0300 | [diff] [blame] | 4289 | struct ath10k *ar = container_of(work, struct ath10k, svc_rdy_work); |
| 4290 | struct sk_buff *skb = ar->svc_rdy_skb; |
Michal Kazior | 5c01aa3d | 2014-09-18 15:21:24 +0200 | [diff] [blame] | 4291 | struct wmi_svc_rdy_ev_arg arg = {}; |
| 4292 | u32 num_units, req_id, unit_size, num_mem_reqs, num_unit_info, i; |
Michal Kazior | 5c01aa3d | 2014-09-18 15:21:24 +0200 | [diff] [blame] | 4293 | int ret; |
Vasanthakumar Thiagarajan | a925a37 | 2015-08-28 17:21:34 +0530 | [diff] [blame] | 4294 | bool allocated; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4295 | |
Raja Mani | c8ecfc1 | 2015-07-29 11:40:38 +0300 | [diff] [blame] | 4296 | if (!skb) { |
| 4297 | ath10k_warn(ar, "invalid service ready event skb\n"); |
| 4298 | return; |
| 4299 | } |
| 4300 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 4301 | ret = ath10k_wmi_pull_svc_rdy(ar, skb, &arg); |
Michal Kazior | 5c01aa3d | 2014-09-18 15:21:24 +0200 | [diff] [blame] | 4302 | if (ret) { |
| 4303 | ath10k_warn(ar, "failed to parse service ready: %d\n", ret); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4304 | return; |
| 4305 | } |
| 4306 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 4307 | memset(&ar->wmi.svc_map, 0, sizeof(ar->wmi.svc_map)); |
| 4308 | ath10k_wmi_map_svc(ar, arg.service_map, ar->wmi.svc_map, |
| 4309 | arg.service_map_len); |
| 4310 | |
Michal Kazior | 5c01aa3d | 2014-09-18 15:21:24 +0200 | [diff] [blame] | 4311 | ar->hw_min_tx_power = __le32_to_cpu(arg.min_tx_power); |
| 4312 | ar->hw_max_tx_power = __le32_to_cpu(arg.max_tx_power); |
| 4313 | ar->ht_cap_info = __le32_to_cpu(arg.ht_cap); |
| 4314 | ar->vht_cap_info = __le32_to_cpu(arg.vht_cap); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4315 | ar->fw_version_major = |
Michal Kazior | 5c01aa3d | 2014-09-18 15:21:24 +0200 | [diff] [blame] | 4316 | (__le32_to_cpu(arg.sw_ver0) & 0xff000000) >> 24; |
| 4317 | ar->fw_version_minor = (__le32_to_cpu(arg.sw_ver0) & 0x00ffffff); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4318 | ar->fw_version_release = |
Michal Kazior | 5c01aa3d | 2014-09-18 15:21:24 +0200 | [diff] [blame] | 4319 | (__le32_to_cpu(arg.sw_ver1) & 0xffff0000) >> 16; |
| 4320 | ar->fw_version_build = (__le32_to_cpu(arg.sw_ver1) & 0x0000ffff); |
| 4321 | ar->phy_capability = __le32_to_cpu(arg.phy_capab); |
| 4322 | ar->num_rf_chains = __le32_to_cpu(arg.num_rf_chains); |
| 4323 | ar->ath_common.regulatory.current_rd = __le32_to_cpu(arg.eeprom_rd); |
| 4324 | |
Michal Kazior | 5c01aa3d | 2014-09-18 15:21:24 +0200 | [diff] [blame] | 4325 | ath10k_dbg_dump(ar, ATH10K_DBG_WMI, NULL, "wmi svc: ", |
Michal Kazior | 2a3e60d | 2014-11-27 10:11:15 +0100 | [diff] [blame] | 4326 | arg.service_map, arg.service_map_len); |
Michal Kazior | 8865bee4 | 2013-07-24 12:36:46 +0200 | [diff] [blame] | 4327 | |
Kalle Valo | 1a22243 | 2013-09-27 19:55:07 +0300 | [diff] [blame] | 4328 | /* only manually set fw features when not using FW IE format */ |
| 4329 | if (ar->fw_api == 1 && ar->fw_version_build > 636) |
Michal Kazior | 0d9b043 | 2013-08-09 10:13:33 +0200 | [diff] [blame] | 4330 | set_bit(ATH10K_FW_FEATURE_EXT_WMI_MGMT_RX, ar->fw_features); |
| 4331 | |
Raja Mani | 5c8726e | 2015-06-22 20:22:26 +0530 | [diff] [blame] | 4332 | if (ar->num_rf_chains > ar->max_spatial_stream) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4333 | ath10k_warn(ar, "hardware advertises support for more spatial streams than it should (%d > %d)\n", |
Raja Mani | 5c8726e | 2015-06-22 20:22:26 +0530 | [diff] [blame] | 4334 | ar->num_rf_chains, ar->max_spatial_stream); |
| 4335 | ar->num_rf_chains = ar->max_spatial_stream; |
Michal Kazior | 8865bee4 | 2013-07-24 12:36:46 +0200 | [diff] [blame] | 4336 | } |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4337 | |
Michal Kazior | fdb959c | 2014-09-18 15:21:19 +0200 | [diff] [blame] | 4338 | ar->supp_tx_chainmask = (1 << ar->num_rf_chains) - 1; |
| 4339 | ar->supp_rx_chainmask = (1 << ar->num_rf_chains) - 1; |
| 4340 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4341 | if (strlen(ar->hw->wiphy->fw_version) == 0) { |
| 4342 | snprintf(ar->hw->wiphy->fw_version, |
| 4343 | sizeof(ar->hw->wiphy->fw_version), |
| 4344 | "%u.%u.%u.%u", |
| 4345 | ar->fw_version_major, |
| 4346 | ar->fw_version_minor, |
| 4347 | ar->fw_version_release, |
| 4348 | ar->fw_version_build); |
| 4349 | } |
| 4350 | |
Michal Kazior | 5c01aa3d | 2014-09-18 15:21:24 +0200 | [diff] [blame] | 4351 | num_mem_reqs = __le32_to_cpu(arg.num_mem_reqs); |
| 4352 | if (num_mem_reqs > WMI_MAX_MEM_REQS) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4353 | ath10k_warn(ar, "requested memory chunks number (%d) exceeds the limit\n", |
Bartosz Markowski | b3effe6 | 2013-09-26 17:47:11 +0200 | [diff] [blame] | 4354 | num_mem_reqs); |
| 4355 | return; |
Bartosz Markowski | 6f97d25 | 2013-09-26 17:47:09 +0200 | [diff] [blame] | 4356 | } |
| 4357 | |
Raja Mani | b039941 | 2015-06-22 20:10:17 +0530 | [diff] [blame] | 4358 | if (test_bit(WMI_SERVICE_PEER_CACHING, ar->wmi.svc_map)) { |
| 4359 | ar->max_num_peers = TARGET_10_4_NUM_QCACHE_PEERS_MAX + |
| 4360 | TARGET_10_4_NUM_VDEVS; |
| 4361 | ar->num_active_peers = TARGET_10_4_QCACHE_ACTIVE_PEERS + |
| 4362 | TARGET_10_4_NUM_VDEVS; |
| 4363 | ar->num_tids = ar->num_active_peers * 2; |
| 4364 | ar->max_num_stations = TARGET_10_4_NUM_QCACHE_PEERS_MAX; |
| 4365 | } |
| 4366 | |
| 4367 | /* TODO: Adjust max peer count for cases like WMI_SERVICE_RATECTRL_CACHE |
| 4368 | * and WMI_SERVICE_IRAM_TIDS, etc. |
| 4369 | */ |
| 4370 | |
Vasanthakumar Thiagarajan | a925a37 | 2015-08-28 17:21:34 +0530 | [diff] [blame] | 4371 | allocated = ath10k_wmi_is_host_mem_allocated(ar, arg.mem_reqs, |
| 4372 | num_mem_reqs); |
| 4373 | if (allocated) |
| 4374 | goto skip_mem_alloc; |
| 4375 | |
| 4376 | /* Either this event is received during boot time or there is a change |
| 4377 | * in memory requirement from firmware when compared to last request. |
| 4378 | * Free any old memory and do a fresh allocation based on the current |
| 4379 | * memory requirement. |
| 4380 | */ |
| 4381 | ath10k_wmi_free_host_mem(ar); |
| 4382 | |
Bartosz Markowski | b3effe6 | 2013-09-26 17:47:11 +0200 | [diff] [blame] | 4383 | for (i = 0; i < num_mem_reqs; ++i) { |
Michal Kazior | 5c01aa3d | 2014-09-18 15:21:24 +0200 | [diff] [blame] | 4384 | req_id = __le32_to_cpu(arg.mem_reqs[i]->req_id); |
| 4385 | num_units = __le32_to_cpu(arg.mem_reqs[i]->num_units); |
| 4386 | unit_size = __le32_to_cpu(arg.mem_reqs[i]->unit_size); |
| 4387 | num_unit_info = __le32_to_cpu(arg.mem_reqs[i]->num_unit_info); |
Bartosz Markowski | b3effe6 | 2013-09-26 17:47:11 +0200 | [diff] [blame] | 4388 | |
Raja Mani | b039941 | 2015-06-22 20:10:17 +0530 | [diff] [blame] | 4389 | if (num_unit_info & NUM_UNITS_IS_NUM_ACTIVE_PEERS) { |
| 4390 | if (ar->num_active_peers) |
| 4391 | num_units = ar->num_active_peers + 1; |
| 4392 | else |
| 4393 | num_units = ar->max_num_peers + 1; |
| 4394 | } else if (num_unit_info & NUM_UNITS_IS_NUM_PEERS) { |
Bartosz Markowski | b3effe6 | 2013-09-26 17:47:11 +0200 | [diff] [blame] | 4395 | /* number of units to allocate is number of |
| 4396 | * peers, 1 extra for self peer on target */ |
| 4397 | /* this needs to be tied, host and target |
| 4398 | * can get out of sync */ |
Raja Mani | b039941 | 2015-06-22 20:10:17 +0530 | [diff] [blame] | 4399 | num_units = ar->max_num_peers + 1; |
| 4400 | } else if (num_unit_info & NUM_UNITS_IS_NUM_VDEVS) { |
| 4401 | num_units = ar->max_num_vdevs + 1; |
| 4402 | } |
Bartosz Markowski | b3effe6 | 2013-09-26 17:47:11 +0200 | [diff] [blame] | 4403 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4404 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Bartosz Markowski | b3effe6 | 2013-09-26 17:47:11 +0200 | [diff] [blame] | 4405 | "wmi mem_req_id %d num_units %d num_unit_info %d unit size %d actual units %d\n", |
| 4406 | req_id, |
Michal Kazior | 5c01aa3d | 2014-09-18 15:21:24 +0200 | [diff] [blame] | 4407 | __le32_to_cpu(arg.mem_reqs[i]->num_units), |
Bartosz Markowski | b3effe6 | 2013-09-26 17:47:11 +0200 | [diff] [blame] | 4408 | num_unit_info, |
| 4409 | unit_size, |
| 4410 | num_units); |
| 4411 | |
| 4412 | ret = ath10k_wmi_alloc_host_mem(ar, req_id, num_units, |
| 4413 | unit_size); |
| 4414 | if (ret) |
| 4415 | return; |
| 4416 | } |
| 4417 | |
Vasanthakumar Thiagarajan | a925a37 | 2015-08-28 17:21:34 +0530 | [diff] [blame] | 4418 | skip_mem_alloc: |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4419 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Michal Kazior | ca996ec | 2014-12-03 10:11:32 +0200 | [diff] [blame] | 4420 | "wmi event service ready min_tx_power 0x%08x max_tx_power 0x%08x ht_cap 0x%08x vht_cap 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 num_mem_reqs 0x%08x\n", |
Michal Kazior | 5c01aa3d | 2014-09-18 15:21:24 +0200 | [diff] [blame] | 4421 | __le32_to_cpu(arg.min_tx_power), |
| 4422 | __le32_to_cpu(arg.max_tx_power), |
| 4423 | __le32_to_cpu(arg.ht_cap), |
| 4424 | __le32_to_cpu(arg.vht_cap), |
| 4425 | __le32_to_cpu(arg.sw_ver0), |
| 4426 | __le32_to_cpu(arg.sw_ver1), |
Michal Kazior | ca996ec | 2014-12-03 10:11:32 +0200 | [diff] [blame] | 4427 | __le32_to_cpu(arg.fw_build), |
Michal Kazior | 5c01aa3d | 2014-09-18 15:21:24 +0200 | [diff] [blame] | 4428 | __le32_to_cpu(arg.phy_capab), |
| 4429 | __le32_to_cpu(arg.num_rf_chains), |
| 4430 | __le32_to_cpu(arg.eeprom_rd), |
| 4431 | __le32_to_cpu(arg.num_mem_reqs)); |
Bartosz Markowski | 6f97d25 | 2013-09-26 17:47:09 +0200 | [diff] [blame] | 4432 | |
Raja Mani | c8ecfc1 | 2015-07-29 11:40:38 +0300 | [diff] [blame] | 4433 | dev_kfree_skb(skb); |
| 4434 | ar->svc_rdy_skb = NULL; |
Bartosz Markowski | 6f97d25 | 2013-09-26 17:47:09 +0200 | [diff] [blame] | 4435 | complete(&ar->wmi.service_ready); |
| 4436 | } |
| 4437 | |
Raja Mani | c8ecfc1 | 2015-07-29 11:40:38 +0300 | [diff] [blame] | 4438 | void ath10k_wmi_event_service_ready(struct ath10k *ar, struct sk_buff *skb) |
| 4439 | { |
| 4440 | ar->svc_rdy_skb = skb; |
| 4441 | queue_work(ar->workqueue_aux, &ar->svc_rdy_work); |
| 4442 | } |
| 4443 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 4444 | static int ath10k_wmi_op_pull_rdy_ev(struct ath10k *ar, struct sk_buff *skb, |
| 4445 | struct wmi_rdy_ev_arg *arg) |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 4446 | { |
| 4447 | struct wmi_ready_event *ev = (void *)skb->data; |
| 4448 | |
| 4449 | if (skb->len < sizeof(*ev)) |
| 4450 | return -EPROTO; |
| 4451 | |
| 4452 | skb_pull(skb, sizeof(*ev)); |
| 4453 | arg->sw_version = ev->sw_version; |
| 4454 | arg->abi_version = ev->abi_version; |
| 4455 | arg->status = ev->status; |
| 4456 | arg->mac_addr = ev->mac_addr.addr; |
| 4457 | |
| 4458 | return 0; |
| 4459 | } |
| 4460 | |
Michal Kazior | c1a4654 | 2015-03-10 16:21:54 +0200 | [diff] [blame] | 4461 | static int ath10k_wmi_op_pull_roam_ev(struct ath10k *ar, struct sk_buff *skb, |
| 4462 | struct wmi_roam_ev_arg *arg) |
| 4463 | { |
| 4464 | struct wmi_roam_ev *ev = (void *)skb->data; |
| 4465 | |
| 4466 | if (skb->len < sizeof(*ev)) |
| 4467 | return -EPROTO; |
| 4468 | |
| 4469 | skb_pull(skb, sizeof(*ev)); |
| 4470 | arg->vdev_id = ev->vdev_id; |
| 4471 | arg->reason = ev->reason; |
| 4472 | |
| 4473 | return 0; |
| 4474 | } |
| 4475 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 4476 | int ath10k_wmi_event_ready(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4477 | { |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 4478 | struct wmi_rdy_ev_arg arg = {}; |
| 4479 | int ret; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4480 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 4481 | ret = ath10k_wmi_pull_rdy(ar, skb, &arg); |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 4482 | if (ret) { |
| 4483 | ath10k_warn(ar, "failed to parse ready event: %d\n", ret); |
| 4484 | return ret; |
| 4485 | } |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4486 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4487 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 4488 | "wmi event ready sw_version %u abi_version %u mac_addr %pM status %d\n", |
| 4489 | __le32_to_cpu(arg.sw_version), |
| 4490 | __le32_to_cpu(arg.abi_version), |
| 4491 | arg.mac_addr, |
| 4492 | __le32_to_cpu(arg.status)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4493 | |
Michal Kazior | 32653cf | 2014-12-03 10:10:26 +0200 | [diff] [blame] | 4494 | ether_addr_copy(ar->mac_addr, arg.mac_addr); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4495 | complete(&ar->wmi.unified_ready); |
| 4496 | return 0; |
| 4497 | } |
| 4498 | |
Rajkumar Manoharan | a57a6a2 | 2014-12-17 12:22:17 +0200 | [diff] [blame] | 4499 | static int ath10k_wmi_event_temperature(struct ath10k *ar, struct sk_buff *skb) |
| 4500 | { |
| 4501 | const struct wmi_pdev_temperature_event *ev; |
| 4502 | |
| 4503 | ev = (struct wmi_pdev_temperature_event *)skb->data; |
| 4504 | if (WARN_ON(skb->len < sizeof(*ev))) |
| 4505 | return -EPROTO; |
| 4506 | |
Rajkumar Manoharan | ac2953f | 2014-12-17 12:22:26 +0200 | [diff] [blame] | 4507 | ath10k_thermal_event_temperature(ar, __le32_to_cpu(ev->temperature)); |
Rajkumar Manoharan | a57a6a2 | 2014-12-17 12:22:17 +0200 | [diff] [blame] | 4508 | return 0; |
| 4509 | } |
| 4510 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 4511 | static void ath10k_wmi_op_rx(struct ath10k *ar, struct sk_buff *skb) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4512 | { |
| 4513 | struct wmi_cmd_hdr *cmd_hdr; |
| 4514 | enum wmi_event_id id; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4515 | |
| 4516 | cmd_hdr = (struct wmi_cmd_hdr *)skb->data; |
| 4517 | id = MS(__le32_to_cpu(cmd_hdr->cmd_id), WMI_CMD_HDR_CMD_ID); |
| 4518 | |
| 4519 | if (skb_pull(skb, sizeof(struct wmi_cmd_hdr)) == NULL) |
Michal Kazior | 469d479 | 2015-06-08 13:23:27 +0200 | [diff] [blame] | 4520 | goto out; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4521 | |
Michal Kazior | d35a6c1 | 2014-09-02 11:00:21 +0300 | [diff] [blame] | 4522 | trace_ath10k_wmi_event(ar, id, skb->data, skb->len); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4523 | |
| 4524 | switch (id) { |
| 4525 | case WMI_MGMT_RX_EVENTID: |
| 4526 | ath10k_wmi_event_mgmt_rx(ar, skb); |
| 4527 | /* mgmt_rx() owns the skb now! */ |
| 4528 | return; |
| 4529 | case WMI_SCAN_EVENTID: |
| 4530 | ath10k_wmi_event_scan(ar, skb); |
| 4531 | break; |
| 4532 | case WMI_CHAN_INFO_EVENTID: |
| 4533 | ath10k_wmi_event_chan_info(ar, skb); |
| 4534 | break; |
| 4535 | case WMI_ECHO_EVENTID: |
| 4536 | ath10k_wmi_event_echo(ar, skb); |
| 4537 | break; |
| 4538 | case WMI_DEBUG_MESG_EVENTID: |
| 4539 | ath10k_wmi_event_debug_mesg(ar, skb); |
| 4540 | break; |
| 4541 | case WMI_UPDATE_STATS_EVENTID: |
| 4542 | ath10k_wmi_event_update_stats(ar, skb); |
| 4543 | break; |
| 4544 | case WMI_VDEV_START_RESP_EVENTID: |
| 4545 | ath10k_wmi_event_vdev_start_resp(ar, skb); |
| 4546 | break; |
| 4547 | case WMI_VDEV_STOPPED_EVENTID: |
| 4548 | ath10k_wmi_event_vdev_stopped(ar, skb); |
| 4549 | break; |
| 4550 | case WMI_PEER_STA_KICKOUT_EVENTID: |
| 4551 | ath10k_wmi_event_peer_sta_kickout(ar, skb); |
| 4552 | break; |
| 4553 | case WMI_HOST_SWBA_EVENTID: |
| 4554 | ath10k_wmi_event_host_swba(ar, skb); |
| 4555 | break; |
| 4556 | case WMI_TBTTOFFSET_UPDATE_EVENTID: |
| 4557 | ath10k_wmi_event_tbttoffset_update(ar, skb); |
| 4558 | break; |
| 4559 | case WMI_PHYERR_EVENTID: |
| 4560 | ath10k_wmi_event_phyerr(ar, skb); |
| 4561 | break; |
| 4562 | case WMI_ROAM_EVENTID: |
| 4563 | ath10k_wmi_event_roam(ar, skb); |
| 4564 | break; |
| 4565 | case WMI_PROFILE_MATCH: |
| 4566 | ath10k_wmi_event_profile_match(ar, skb); |
| 4567 | break; |
| 4568 | case WMI_DEBUG_PRINT_EVENTID: |
| 4569 | ath10k_wmi_event_debug_print(ar, skb); |
| 4570 | break; |
| 4571 | case WMI_PDEV_QVIT_EVENTID: |
| 4572 | ath10k_wmi_event_pdev_qvit(ar, skb); |
| 4573 | break; |
| 4574 | case WMI_WLAN_PROFILE_DATA_EVENTID: |
| 4575 | ath10k_wmi_event_wlan_profile_data(ar, skb); |
| 4576 | break; |
| 4577 | case WMI_RTT_MEASUREMENT_REPORT_EVENTID: |
| 4578 | ath10k_wmi_event_rtt_measurement_report(ar, skb); |
| 4579 | break; |
| 4580 | case WMI_TSF_MEASUREMENT_REPORT_EVENTID: |
| 4581 | ath10k_wmi_event_tsf_measurement_report(ar, skb); |
| 4582 | break; |
| 4583 | case WMI_RTT_ERROR_REPORT_EVENTID: |
| 4584 | ath10k_wmi_event_rtt_error_report(ar, skb); |
| 4585 | break; |
| 4586 | case WMI_WOW_WAKEUP_HOST_EVENTID: |
| 4587 | ath10k_wmi_event_wow_wakeup_host(ar, skb); |
| 4588 | break; |
| 4589 | case WMI_DCS_INTERFERENCE_EVENTID: |
| 4590 | ath10k_wmi_event_dcs_interference(ar, skb); |
| 4591 | break; |
| 4592 | case WMI_PDEV_TPC_CONFIG_EVENTID: |
| 4593 | ath10k_wmi_event_pdev_tpc_config(ar, skb); |
| 4594 | break; |
| 4595 | case WMI_PDEV_FTM_INTG_EVENTID: |
| 4596 | ath10k_wmi_event_pdev_ftm_intg(ar, skb); |
| 4597 | break; |
| 4598 | case WMI_GTK_OFFLOAD_STATUS_EVENTID: |
| 4599 | ath10k_wmi_event_gtk_offload_status(ar, skb); |
| 4600 | break; |
| 4601 | case WMI_GTK_REKEY_FAIL_EVENTID: |
| 4602 | ath10k_wmi_event_gtk_rekey_fail(ar, skb); |
| 4603 | break; |
| 4604 | case WMI_TX_DELBA_COMPLETE_EVENTID: |
| 4605 | ath10k_wmi_event_delba_complete(ar, skb); |
| 4606 | break; |
| 4607 | case WMI_TX_ADDBA_COMPLETE_EVENTID: |
| 4608 | ath10k_wmi_event_addba_complete(ar, skb); |
| 4609 | break; |
| 4610 | case WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID: |
| 4611 | ath10k_wmi_event_vdev_install_key_complete(ar, skb); |
| 4612 | break; |
| 4613 | case WMI_SERVICE_READY_EVENTID: |
Michal Kazior | b34d2b3 | 2014-09-18 15:21:26 +0200 | [diff] [blame] | 4614 | ath10k_wmi_event_service_ready(ar, skb); |
Raja Mani | c8ecfc1 | 2015-07-29 11:40:38 +0300 | [diff] [blame] | 4615 | return; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4616 | case WMI_READY_EVENTID: |
Michal Kazior | b34d2b3 | 2014-09-18 15:21:26 +0200 | [diff] [blame] | 4617 | ath10k_wmi_event_ready(ar, skb); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4618 | break; |
| 4619 | default: |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4620 | ath10k_warn(ar, "Unknown eventid: %d\n", id); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4621 | break; |
| 4622 | } |
| 4623 | |
Michal Kazior | 469d479 | 2015-06-08 13:23:27 +0200 | [diff] [blame] | 4624 | out: |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4625 | dev_kfree_skb(skb); |
| 4626 | } |
| 4627 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 4628 | static void ath10k_wmi_10_1_op_rx(struct ath10k *ar, struct sk_buff *skb) |
Bartosz Markowski | 8a6618b | 2013-09-26 17:47:08 +0200 | [diff] [blame] | 4629 | { |
| 4630 | struct wmi_cmd_hdr *cmd_hdr; |
| 4631 | enum wmi_10x_event_id id; |
Kalle Valo | 43d2a30 | 2014-09-10 18:23:30 +0300 | [diff] [blame] | 4632 | bool consumed; |
Bartosz Markowski | 8a6618b | 2013-09-26 17:47:08 +0200 | [diff] [blame] | 4633 | |
| 4634 | cmd_hdr = (struct wmi_cmd_hdr *)skb->data; |
| 4635 | id = MS(__le32_to_cpu(cmd_hdr->cmd_id), WMI_CMD_HDR_CMD_ID); |
| 4636 | |
| 4637 | if (skb_pull(skb, sizeof(struct wmi_cmd_hdr)) == NULL) |
Michal Kazior | 469d479 | 2015-06-08 13:23:27 +0200 | [diff] [blame] | 4638 | goto out; |
Bartosz Markowski | 8a6618b | 2013-09-26 17:47:08 +0200 | [diff] [blame] | 4639 | |
Michal Kazior | d35a6c1 | 2014-09-02 11:00:21 +0300 | [diff] [blame] | 4640 | trace_ath10k_wmi_event(ar, id, skb->data, skb->len); |
Bartosz Markowski | 8a6618b | 2013-09-26 17:47:08 +0200 | [diff] [blame] | 4641 | |
Kalle Valo | 43d2a30 | 2014-09-10 18:23:30 +0300 | [diff] [blame] | 4642 | consumed = ath10k_tm_event_wmi(ar, id, skb); |
| 4643 | |
| 4644 | /* Ready event must be handled normally also in UTF mode so that we |
| 4645 | * know the UTF firmware has booted, others we are just bypass WMI |
| 4646 | * events to testmode. |
| 4647 | */ |
| 4648 | if (consumed && id != WMI_10X_READY_EVENTID) { |
| 4649 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
| 4650 | "wmi testmode consumed 0x%x\n", id); |
| 4651 | goto out; |
| 4652 | } |
| 4653 | |
Bartosz Markowski | 8a6618b | 2013-09-26 17:47:08 +0200 | [diff] [blame] | 4654 | switch (id) { |
| 4655 | case WMI_10X_MGMT_RX_EVENTID: |
| 4656 | ath10k_wmi_event_mgmt_rx(ar, skb); |
| 4657 | /* mgmt_rx() owns the skb now! */ |
| 4658 | return; |
| 4659 | case WMI_10X_SCAN_EVENTID: |
| 4660 | ath10k_wmi_event_scan(ar, skb); |
| 4661 | break; |
| 4662 | case WMI_10X_CHAN_INFO_EVENTID: |
| 4663 | ath10k_wmi_event_chan_info(ar, skb); |
| 4664 | break; |
| 4665 | case WMI_10X_ECHO_EVENTID: |
| 4666 | ath10k_wmi_event_echo(ar, skb); |
| 4667 | break; |
| 4668 | case WMI_10X_DEBUG_MESG_EVENTID: |
| 4669 | ath10k_wmi_event_debug_mesg(ar, skb); |
| 4670 | break; |
| 4671 | case WMI_10X_UPDATE_STATS_EVENTID: |
| 4672 | ath10k_wmi_event_update_stats(ar, skb); |
| 4673 | break; |
| 4674 | case WMI_10X_VDEV_START_RESP_EVENTID: |
| 4675 | ath10k_wmi_event_vdev_start_resp(ar, skb); |
| 4676 | break; |
| 4677 | case WMI_10X_VDEV_STOPPED_EVENTID: |
| 4678 | ath10k_wmi_event_vdev_stopped(ar, skb); |
| 4679 | break; |
| 4680 | case WMI_10X_PEER_STA_KICKOUT_EVENTID: |
| 4681 | ath10k_wmi_event_peer_sta_kickout(ar, skb); |
| 4682 | break; |
| 4683 | case WMI_10X_HOST_SWBA_EVENTID: |
| 4684 | ath10k_wmi_event_host_swba(ar, skb); |
| 4685 | break; |
| 4686 | case WMI_10X_TBTTOFFSET_UPDATE_EVENTID: |
| 4687 | ath10k_wmi_event_tbttoffset_update(ar, skb); |
| 4688 | break; |
| 4689 | case WMI_10X_PHYERR_EVENTID: |
| 4690 | ath10k_wmi_event_phyerr(ar, skb); |
| 4691 | break; |
| 4692 | case WMI_10X_ROAM_EVENTID: |
| 4693 | ath10k_wmi_event_roam(ar, skb); |
| 4694 | break; |
| 4695 | case WMI_10X_PROFILE_MATCH: |
| 4696 | ath10k_wmi_event_profile_match(ar, skb); |
| 4697 | break; |
| 4698 | case WMI_10X_DEBUG_PRINT_EVENTID: |
| 4699 | ath10k_wmi_event_debug_print(ar, skb); |
| 4700 | break; |
| 4701 | case WMI_10X_PDEV_QVIT_EVENTID: |
| 4702 | ath10k_wmi_event_pdev_qvit(ar, skb); |
| 4703 | break; |
| 4704 | case WMI_10X_WLAN_PROFILE_DATA_EVENTID: |
| 4705 | ath10k_wmi_event_wlan_profile_data(ar, skb); |
| 4706 | break; |
| 4707 | case WMI_10X_RTT_MEASUREMENT_REPORT_EVENTID: |
| 4708 | ath10k_wmi_event_rtt_measurement_report(ar, skb); |
| 4709 | break; |
| 4710 | case WMI_10X_TSF_MEASUREMENT_REPORT_EVENTID: |
| 4711 | ath10k_wmi_event_tsf_measurement_report(ar, skb); |
| 4712 | break; |
| 4713 | case WMI_10X_RTT_ERROR_REPORT_EVENTID: |
| 4714 | ath10k_wmi_event_rtt_error_report(ar, skb); |
| 4715 | break; |
| 4716 | case WMI_10X_WOW_WAKEUP_HOST_EVENTID: |
| 4717 | ath10k_wmi_event_wow_wakeup_host(ar, skb); |
| 4718 | break; |
| 4719 | case WMI_10X_DCS_INTERFERENCE_EVENTID: |
| 4720 | ath10k_wmi_event_dcs_interference(ar, skb); |
| 4721 | break; |
| 4722 | case WMI_10X_PDEV_TPC_CONFIG_EVENTID: |
| 4723 | ath10k_wmi_event_pdev_tpc_config(ar, skb); |
| 4724 | break; |
| 4725 | case WMI_10X_INST_RSSI_STATS_EVENTID: |
| 4726 | ath10k_wmi_event_inst_rssi_stats(ar, skb); |
| 4727 | break; |
| 4728 | case WMI_10X_VDEV_STANDBY_REQ_EVENTID: |
| 4729 | ath10k_wmi_event_vdev_standby_req(ar, skb); |
| 4730 | break; |
| 4731 | case WMI_10X_VDEV_RESUME_REQ_EVENTID: |
| 4732 | ath10k_wmi_event_vdev_resume_req(ar, skb); |
| 4733 | break; |
| 4734 | case WMI_10X_SERVICE_READY_EVENTID: |
Michal Kazior | b34d2b3 | 2014-09-18 15:21:26 +0200 | [diff] [blame] | 4735 | ath10k_wmi_event_service_ready(ar, skb); |
Raja Mani | c8ecfc1 | 2015-07-29 11:40:38 +0300 | [diff] [blame] | 4736 | return; |
Bartosz Markowski | 8a6618b | 2013-09-26 17:47:08 +0200 | [diff] [blame] | 4737 | case WMI_10X_READY_EVENTID: |
Michal Kazior | b34d2b3 | 2014-09-18 15:21:26 +0200 | [diff] [blame] | 4738 | ath10k_wmi_event_ready(ar, skb); |
Bartosz Markowski | 8a6618b | 2013-09-26 17:47:08 +0200 | [diff] [blame] | 4739 | break; |
Kalle Valo | 43d2a30 | 2014-09-10 18:23:30 +0300 | [diff] [blame] | 4740 | case WMI_10X_PDEV_UTF_EVENTID: |
| 4741 | /* ignore utf events */ |
| 4742 | break; |
Bartosz Markowski | 8a6618b | 2013-09-26 17:47:08 +0200 | [diff] [blame] | 4743 | default: |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4744 | ath10k_warn(ar, "Unknown eventid: %d\n", id); |
Bartosz Markowski | 8a6618b | 2013-09-26 17:47:08 +0200 | [diff] [blame] | 4745 | break; |
| 4746 | } |
| 4747 | |
Kalle Valo | 43d2a30 | 2014-09-10 18:23:30 +0300 | [diff] [blame] | 4748 | out: |
Bartosz Markowski | 8a6618b | 2013-09-26 17:47:08 +0200 | [diff] [blame] | 4749 | dev_kfree_skb(skb); |
| 4750 | } |
| 4751 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 4752 | static void ath10k_wmi_10_2_op_rx(struct ath10k *ar, struct sk_buff *skb) |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 4753 | { |
| 4754 | struct wmi_cmd_hdr *cmd_hdr; |
| 4755 | enum wmi_10_2_event_id id; |
| 4756 | |
| 4757 | cmd_hdr = (struct wmi_cmd_hdr *)skb->data; |
| 4758 | id = MS(__le32_to_cpu(cmd_hdr->cmd_id), WMI_CMD_HDR_CMD_ID); |
| 4759 | |
| 4760 | if (skb_pull(skb, sizeof(struct wmi_cmd_hdr)) == NULL) |
Michal Kazior | 469d479 | 2015-06-08 13:23:27 +0200 | [diff] [blame] | 4761 | goto out; |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 4762 | |
Michal Kazior | d35a6c1 | 2014-09-02 11:00:21 +0300 | [diff] [blame] | 4763 | trace_ath10k_wmi_event(ar, id, skb->data, skb->len); |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 4764 | |
| 4765 | switch (id) { |
| 4766 | case WMI_10_2_MGMT_RX_EVENTID: |
| 4767 | ath10k_wmi_event_mgmt_rx(ar, skb); |
| 4768 | /* mgmt_rx() owns the skb now! */ |
| 4769 | return; |
| 4770 | case WMI_10_2_SCAN_EVENTID: |
| 4771 | ath10k_wmi_event_scan(ar, skb); |
| 4772 | break; |
| 4773 | case WMI_10_2_CHAN_INFO_EVENTID: |
| 4774 | ath10k_wmi_event_chan_info(ar, skb); |
| 4775 | break; |
| 4776 | case WMI_10_2_ECHO_EVENTID: |
| 4777 | ath10k_wmi_event_echo(ar, skb); |
| 4778 | break; |
| 4779 | case WMI_10_2_DEBUG_MESG_EVENTID: |
| 4780 | ath10k_wmi_event_debug_mesg(ar, skb); |
| 4781 | break; |
| 4782 | case WMI_10_2_UPDATE_STATS_EVENTID: |
| 4783 | ath10k_wmi_event_update_stats(ar, skb); |
| 4784 | break; |
| 4785 | case WMI_10_2_VDEV_START_RESP_EVENTID: |
| 4786 | ath10k_wmi_event_vdev_start_resp(ar, skb); |
| 4787 | break; |
| 4788 | case WMI_10_2_VDEV_STOPPED_EVENTID: |
| 4789 | ath10k_wmi_event_vdev_stopped(ar, skb); |
| 4790 | break; |
| 4791 | case WMI_10_2_PEER_STA_KICKOUT_EVENTID: |
| 4792 | ath10k_wmi_event_peer_sta_kickout(ar, skb); |
| 4793 | break; |
| 4794 | case WMI_10_2_HOST_SWBA_EVENTID: |
| 4795 | ath10k_wmi_event_host_swba(ar, skb); |
| 4796 | break; |
| 4797 | case WMI_10_2_TBTTOFFSET_UPDATE_EVENTID: |
| 4798 | ath10k_wmi_event_tbttoffset_update(ar, skb); |
| 4799 | break; |
| 4800 | case WMI_10_2_PHYERR_EVENTID: |
| 4801 | ath10k_wmi_event_phyerr(ar, skb); |
| 4802 | break; |
| 4803 | case WMI_10_2_ROAM_EVENTID: |
| 4804 | ath10k_wmi_event_roam(ar, skb); |
| 4805 | break; |
| 4806 | case WMI_10_2_PROFILE_MATCH: |
| 4807 | ath10k_wmi_event_profile_match(ar, skb); |
| 4808 | break; |
| 4809 | case WMI_10_2_DEBUG_PRINT_EVENTID: |
| 4810 | ath10k_wmi_event_debug_print(ar, skb); |
| 4811 | break; |
| 4812 | case WMI_10_2_PDEV_QVIT_EVENTID: |
| 4813 | ath10k_wmi_event_pdev_qvit(ar, skb); |
| 4814 | break; |
| 4815 | case WMI_10_2_WLAN_PROFILE_DATA_EVENTID: |
| 4816 | ath10k_wmi_event_wlan_profile_data(ar, skb); |
| 4817 | break; |
| 4818 | case WMI_10_2_RTT_MEASUREMENT_REPORT_EVENTID: |
| 4819 | ath10k_wmi_event_rtt_measurement_report(ar, skb); |
| 4820 | break; |
| 4821 | case WMI_10_2_TSF_MEASUREMENT_REPORT_EVENTID: |
| 4822 | ath10k_wmi_event_tsf_measurement_report(ar, skb); |
| 4823 | break; |
| 4824 | case WMI_10_2_RTT_ERROR_REPORT_EVENTID: |
| 4825 | ath10k_wmi_event_rtt_error_report(ar, skb); |
| 4826 | break; |
| 4827 | case WMI_10_2_WOW_WAKEUP_HOST_EVENTID: |
| 4828 | ath10k_wmi_event_wow_wakeup_host(ar, skb); |
| 4829 | break; |
| 4830 | case WMI_10_2_DCS_INTERFERENCE_EVENTID: |
| 4831 | ath10k_wmi_event_dcs_interference(ar, skb); |
| 4832 | break; |
| 4833 | case WMI_10_2_PDEV_TPC_CONFIG_EVENTID: |
| 4834 | ath10k_wmi_event_pdev_tpc_config(ar, skb); |
| 4835 | break; |
| 4836 | case WMI_10_2_INST_RSSI_STATS_EVENTID: |
| 4837 | ath10k_wmi_event_inst_rssi_stats(ar, skb); |
| 4838 | break; |
| 4839 | case WMI_10_2_VDEV_STANDBY_REQ_EVENTID: |
| 4840 | ath10k_wmi_event_vdev_standby_req(ar, skb); |
| 4841 | break; |
| 4842 | case WMI_10_2_VDEV_RESUME_REQ_EVENTID: |
| 4843 | ath10k_wmi_event_vdev_resume_req(ar, skb); |
| 4844 | break; |
| 4845 | case WMI_10_2_SERVICE_READY_EVENTID: |
Michal Kazior | b34d2b3 | 2014-09-18 15:21:26 +0200 | [diff] [blame] | 4846 | ath10k_wmi_event_service_ready(ar, skb); |
Raja Mani | c8ecfc1 | 2015-07-29 11:40:38 +0300 | [diff] [blame] | 4847 | return; |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 4848 | case WMI_10_2_READY_EVENTID: |
Michal Kazior | b34d2b3 | 2014-09-18 15:21:26 +0200 | [diff] [blame] | 4849 | ath10k_wmi_event_ready(ar, skb); |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 4850 | break; |
Rajkumar Manoharan | a57a6a2 | 2014-12-17 12:22:17 +0200 | [diff] [blame] | 4851 | case WMI_10_2_PDEV_TEMPERATURE_EVENTID: |
| 4852 | ath10k_wmi_event_temperature(ar, skb); |
| 4853 | break; |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 4854 | case WMI_10_2_RTT_KEEPALIVE_EVENTID: |
| 4855 | case WMI_10_2_GPIO_INPUT_EVENTID: |
| 4856 | case WMI_10_2_PEER_RATECODE_LIST_EVENTID: |
| 4857 | case WMI_10_2_GENERIC_BUFFER_EVENTID: |
| 4858 | case WMI_10_2_MCAST_BUF_RELEASE_EVENTID: |
| 4859 | case WMI_10_2_MCAST_LIST_AGEOUT_EVENTID: |
| 4860 | case WMI_10_2_WDS_PEER_EVENTID: |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4861 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 4862 | "received event id %d not implemented\n", id); |
| 4863 | break; |
| 4864 | default: |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4865 | ath10k_warn(ar, "Unknown eventid: %d\n", id); |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 4866 | break; |
| 4867 | } |
| 4868 | |
Michal Kazior | 469d479 | 2015-06-08 13:23:27 +0200 | [diff] [blame] | 4869 | out: |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 4870 | dev_kfree_skb(skb); |
| 4871 | } |
Bartosz Markowski | 8a6618b | 2013-09-26 17:47:08 +0200 | [diff] [blame] | 4872 | |
Raja Mani | 1c09296 | 2015-06-22 20:10:16 +0530 | [diff] [blame] | 4873 | static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, struct sk_buff *skb) |
| 4874 | { |
| 4875 | struct wmi_cmd_hdr *cmd_hdr; |
| 4876 | enum wmi_10_4_event_id id; |
| 4877 | |
| 4878 | cmd_hdr = (struct wmi_cmd_hdr *)skb->data; |
| 4879 | id = MS(__le32_to_cpu(cmd_hdr->cmd_id), WMI_CMD_HDR_CMD_ID); |
| 4880 | |
| 4881 | if (!skb_pull(skb, sizeof(struct wmi_cmd_hdr))) |
| 4882 | goto out; |
| 4883 | |
| 4884 | trace_ath10k_wmi_event(ar, id, skb->data, skb->len); |
| 4885 | |
| 4886 | switch (id) { |
| 4887 | case WMI_10_4_MGMT_RX_EVENTID: |
| 4888 | ath10k_wmi_event_mgmt_rx(ar, skb); |
| 4889 | /* mgmt_rx() owns the skb now! */ |
| 4890 | return; |
Raja Mani | 373b48c | 2015-06-22 20:22:22 +0530 | [diff] [blame] | 4891 | case WMI_10_4_ECHO_EVENTID: |
| 4892 | ath10k_wmi_event_echo(ar, skb); |
| 4893 | break; |
| 4894 | case WMI_10_4_DEBUG_MESG_EVENTID: |
| 4895 | ath10k_wmi_event_debug_mesg(ar, skb); |
| 4896 | break; |
| 4897 | case WMI_10_4_SERVICE_READY_EVENTID: |
| 4898 | ath10k_wmi_event_service_ready(ar, skb); |
Raja Mani | c8ecfc1 | 2015-07-29 11:40:38 +0300 | [diff] [blame] | 4899 | return; |
Raja Mani | b2297ba | 2015-06-22 20:22:23 +0530 | [diff] [blame] | 4900 | case WMI_10_4_SCAN_EVENTID: |
| 4901 | ath10k_wmi_event_scan(ar, skb); |
| 4902 | break; |
| 4903 | case WMI_10_4_CHAN_INFO_EVENTID: |
| 4904 | ath10k_wmi_event_chan_info(ar, skb); |
| 4905 | break; |
Raja Mani | 2b0a2e0 | 2015-08-14 11:13:34 +0300 | [diff] [blame] | 4906 | case WMI_10_4_PHYERR_EVENTID: |
| 4907 | ath10k_wmi_event_phyerr(ar, skb); |
| 4908 | break; |
Raja Mani | d02e752 | 2015-06-22 20:10:18 +0530 | [diff] [blame] | 4909 | case WMI_10_4_READY_EVENTID: |
| 4910 | ath10k_wmi_event_ready(ar, skb); |
| 4911 | break; |
Raja Mani | 373b48c | 2015-06-22 20:22:22 +0530 | [diff] [blame] | 4912 | case WMI_10_4_PEER_STA_KICKOUT_EVENTID: |
| 4913 | ath10k_wmi_event_peer_sta_kickout(ar, skb); |
| 4914 | break; |
Raja Mani | 3cec3be | 2015-06-22 20:22:21 +0530 | [diff] [blame] | 4915 | case WMI_10_4_HOST_SWBA_EVENTID: |
| 4916 | ath10k_wmi_event_host_swba(ar, skb); |
| 4917 | break; |
Raja Mani | 373b48c | 2015-06-22 20:22:22 +0530 | [diff] [blame] | 4918 | case WMI_10_4_TBTTOFFSET_UPDATE_EVENTID: |
| 4919 | ath10k_wmi_event_tbttoffset_update(ar, skb); |
| 4920 | break; |
| 4921 | case WMI_10_4_DEBUG_PRINT_EVENTID: |
| 4922 | ath10k_wmi_event_debug_print(ar, skb); |
| 4923 | break; |
| 4924 | case WMI_10_4_VDEV_START_RESP_EVENTID: |
| 4925 | ath10k_wmi_event_vdev_start_resp(ar, skb); |
| 4926 | break; |
| 4927 | case WMI_10_4_VDEV_STOPPED_EVENTID: |
| 4928 | ath10k_wmi_event_vdev_stopped(ar, skb); |
| 4929 | break; |
| 4930 | case WMI_10_4_WOW_WAKEUP_HOST_EVENTID: |
| 4931 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
| 4932 | "received event id %d not implemented\n", id); |
| 4933 | break; |
Raja Mani | 1c09296 | 2015-06-22 20:10:16 +0530 | [diff] [blame] | 4934 | default: |
| 4935 | ath10k_warn(ar, "Unknown eventid: %d\n", id); |
| 4936 | break; |
| 4937 | } |
| 4938 | |
| 4939 | out: |
| 4940 | dev_kfree_skb(skb); |
| 4941 | } |
| 4942 | |
Bartosz Markowski | ce42870 | 2013-09-26 17:47:05 +0200 | [diff] [blame] | 4943 | static void ath10k_wmi_process_rx(struct ath10k *ar, struct sk_buff *skb) |
| 4944 | { |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 4945 | int ret; |
| 4946 | |
| 4947 | ret = ath10k_wmi_rx(ar, skb); |
| 4948 | if (ret) |
| 4949 | ath10k_warn(ar, "failed to process wmi rx: %d\n", ret); |
Bartosz Markowski | ce42870 | 2013-09-26 17:47:05 +0200 | [diff] [blame] | 4950 | } |
| 4951 | |
Michal Kazior | 95bf21f | 2014-05-16 17:15:39 +0300 | [diff] [blame] | 4952 | int ath10k_wmi_connect(struct ath10k *ar) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4953 | { |
| 4954 | int status; |
| 4955 | struct ath10k_htc_svc_conn_req conn_req; |
| 4956 | struct ath10k_htc_svc_conn_resp conn_resp; |
| 4957 | |
| 4958 | memset(&conn_req, 0, sizeof(conn_req)); |
| 4959 | memset(&conn_resp, 0, sizeof(conn_resp)); |
| 4960 | |
| 4961 | /* these fields are the same for all service endpoints */ |
| 4962 | conn_req.ep_ops.ep_tx_complete = ath10k_wmi_htc_tx_complete; |
| 4963 | conn_req.ep_ops.ep_rx_complete = ath10k_wmi_process_rx; |
Michal Kazior | be8b394 | 2013-09-13 14:16:54 +0200 | [diff] [blame] | 4964 | conn_req.ep_ops.ep_tx_credits = ath10k_wmi_op_ep_tx_credits; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4965 | |
| 4966 | /* connect to control service */ |
| 4967 | conn_req.service_id = ATH10K_HTC_SVC_ID_WMI_CONTROL; |
| 4968 | |
Michal Kazior | cd003fa | 2013-07-05 16:15:13 +0300 | [diff] [blame] | 4969 | status = ath10k_htc_connect_service(&ar->htc, &conn_req, &conn_resp); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4970 | if (status) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4971 | ath10k_warn(ar, "failed to connect to WMI CONTROL service status: %d\n", |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4972 | status); |
| 4973 | return status; |
| 4974 | } |
| 4975 | |
| 4976 | ar->wmi.eid = conn_resp.eid; |
| 4977 | return 0; |
| 4978 | } |
| 4979 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 4980 | static struct sk_buff * |
| 4981 | ath10k_wmi_op_gen_pdev_set_rd(struct ath10k *ar, u16 rd, u16 rd2g, u16 rd5g, |
| 4982 | u16 ctl2g, u16 ctl5g, |
| 4983 | enum wmi_dfs_region dfs_reg) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4984 | { |
| 4985 | struct wmi_pdev_set_regdomain_cmd *cmd; |
| 4986 | struct sk_buff *skb; |
| 4987 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4988 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4989 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 4990 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 4991 | |
| 4992 | cmd = (struct wmi_pdev_set_regdomain_cmd *)skb->data; |
| 4993 | cmd->reg_domain = __cpu_to_le32(rd); |
| 4994 | cmd->reg_domain_2G = __cpu_to_le32(rd2g); |
| 4995 | cmd->reg_domain_5G = __cpu_to_le32(rd5g); |
| 4996 | cmd->conformance_test_limit_2G = __cpu_to_le32(ctl2g); |
| 4997 | cmd->conformance_test_limit_5G = __cpu_to_le32(ctl5g); |
| 4998 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 4999 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5000 | "wmi pdev regdomain rd %x rd2g %x rd5g %x ctl2g %x ctl5g %x\n", |
| 5001 | rd, rd2g, rd5g, ctl2g, ctl5g); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5002 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5003 | } |
| 5004 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5005 | static struct sk_buff * |
| 5006 | ath10k_wmi_10x_op_gen_pdev_set_rd(struct ath10k *ar, u16 rd, u16 rd2g, u16 |
| 5007 | rd5g, u16 ctl2g, u16 ctl5g, |
| 5008 | enum wmi_dfs_region dfs_reg) |
Marek Puzyniak | 821af6a | 2014-03-21 17:46:57 +0200 | [diff] [blame] | 5009 | { |
| 5010 | struct wmi_pdev_set_regdomain_cmd_10x *cmd; |
| 5011 | struct sk_buff *skb; |
| 5012 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5013 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Marek Puzyniak | 821af6a | 2014-03-21 17:46:57 +0200 | [diff] [blame] | 5014 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5015 | return ERR_PTR(-ENOMEM); |
Marek Puzyniak | 821af6a | 2014-03-21 17:46:57 +0200 | [diff] [blame] | 5016 | |
| 5017 | cmd = (struct wmi_pdev_set_regdomain_cmd_10x *)skb->data; |
| 5018 | cmd->reg_domain = __cpu_to_le32(rd); |
| 5019 | cmd->reg_domain_2G = __cpu_to_le32(rd2g); |
| 5020 | cmd->reg_domain_5G = __cpu_to_le32(rd5g); |
| 5021 | cmd->conformance_test_limit_2G = __cpu_to_le32(ctl2g); |
| 5022 | cmd->conformance_test_limit_5G = __cpu_to_le32(ctl5g); |
| 5023 | cmd->dfs_domain = __cpu_to_le32(dfs_reg); |
| 5024 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5025 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Marek Puzyniak | 821af6a | 2014-03-21 17:46:57 +0200 | [diff] [blame] | 5026 | "wmi pdev regdomain rd %x rd2g %x rd5g %x ctl2g %x ctl5g %x dfs_region %x\n", |
| 5027 | rd, rd2g, rd5g, ctl2g, ctl5g, dfs_reg); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5028 | return skb; |
Marek Puzyniak | 821af6a | 2014-03-21 17:46:57 +0200 | [diff] [blame] | 5029 | } |
| 5030 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5031 | static struct sk_buff * |
| 5032 | ath10k_wmi_op_gen_pdev_suspend(struct ath10k *ar, u32 suspend_opt) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5033 | { |
| 5034 | struct wmi_pdev_suspend_cmd *cmd; |
| 5035 | struct sk_buff *skb; |
| 5036 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5037 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5038 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5039 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5040 | |
| 5041 | cmd = (struct wmi_pdev_suspend_cmd *)skb->data; |
Marek Puzyniak | 00f5482 | 2014-02-10 17:14:24 +0100 | [diff] [blame] | 5042 | cmd->suspend_opt = __cpu_to_le32(suspend_opt); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5043 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5044 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5045 | } |
| 5046 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5047 | static struct sk_buff * |
| 5048 | ath10k_wmi_op_gen_pdev_resume(struct ath10k *ar) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5049 | { |
| 5050 | struct sk_buff *skb; |
| 5051 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5052 | skb = ath10k_wmi_alloc_skb(ar, 0); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5053 | if (!skb) |
| 5054 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5055 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5056 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5057 | } |
| 5058 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5059 | static struct sk_buff * |
| 5060 | ath10k_wmi_op_gen_pdev_set_param(struct ath10k *ar, u32 id, u32 value) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5061 | { |
| 5062 | struct wmi_pdev_set_param_cmd *cmd; |
| 5063 | struct sk_buff *skb; |
| 5064 | |
Bartosz Markowski | 226a339 | 2013-09-26 17:47:16 +0200 | [diff] [blame] | 5065 | if (id == WMI_PDEV_PARAM_UNSUPPORTED) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5066 | ath10k_warn(ar, "pdev param %d not supported by firmware\n", |
| 5067 | id); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5068 | return ERR_PTR(-EOPNOTSUPP); |
Bartosz Markowski | 226a339 | 2013-09-26 17:47:16 +0200 | [diff] [blame] | 5069 | } |
| 5070 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5071 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5072 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5073 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5074 | |
| 5075 | cmd = (struct wmi_pdev_set_param_cmd *)skb->data; |
| 5076 | cmd->param_id = __cpu_to_le32(id); |
| 5077 | cmd->param_value = __cpu_to_le32(value); |
| 5078 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5079 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi pdev set param %d value %d\n", |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5080 | id, value); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5081 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5082 | } |
| 5083 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 5084 | void ath10k_wmi_put_host_mem_chunks(struct ath10k *ar, |
| 5085 | struct wmi_host_mem_chunks *chunks) |
Michal Kazior | cf9fca8 | 2014-09-18 15:21:22 +0200 | [diff] [blame] | 5086 | { |
| 5087 | struct host_memory_chunk *chunk; |
| 5088 | int i; |
| 5089 | |
| 5090 | chunks->count = __cpu_to_le32(ar->wmi.num_mem_chunks); |
| 5091 | |
| 5092 | for (i = 0; i < ar->wmi.num_mem_chunks; i++) { |
| 5093 | chunk = &chunks->items[i]; |
| 5094 | chunk->ptr = __cpu_to_le32(ar->wmi.mem_chunks[i].paddr); |
| 5095 | chunk->size = __cpu_to_le32(ar->wmi.mem_chunks[i].len); |
| 5096 | chunk->req_id = __cpu_to_le32(ar->wmi.mem_chunks[i].req_id); |
| 5097 | |
| 5098 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
| 5099 | "wmi chunk %d len %d requested, addr 0x%llx\n", |
| 5100 | i, |
| 5101 | ar->wmi.mem_chunks[i].len, |
| 5102 | (unsigned long long)ar->wmi.mem_chunks[i].paddr); |
| 5103 | } |
| 5104 | } |
| 5105 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5106 | static struct sk_buff *ath10k_wmi_op_gen_init(struct ath10k *ar) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5107 | { |
| 5108 | struct wmi_init_cmd *cmd; |
| 5109 | struct sk_buff *buf; |
| 5110 | struct wmi_resource_config config = {}; |
Bartosz Markowski | b3effe6 | 2013-09-26 17:47:11 +0200 | [diff] [blame] | 5111 | u32 len, val; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5112 | |
| 5113 | config.num_vdevs = __cpu_to_le32(TARGET_NUM_VDEVS); |
Michal Kazior | cfd1061 | 2014-11-25 15:16:05 +0100 | [diff] [blame] | 5114 | config.num_peers = __cpu_to_le32(TARGET_NUM_PEERS); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5115 | config.num_offload_peers = __cpu_to_le32(TARGET_NUM_OFFLOAD_PEERS); |
| 5116 | |
| 5117 | config.num_offload_reorder_bufs = |
| 5118 | __cpu_to_le32(TARGET_NUM_OFFLOAD_REORDER_BUFS); |
| 5119 | |
| 5120 | config.num_peer_keys = __cpu_to_le32(TARGET_NUM_PEER_KEYS); |
| 5121 | config.num_tids = __cpu_to_le32(TARGET_NUM_TIDS); |
| 5122 | config.ast_skid_limit = __cpu_to_le32(TARGET_AST_SKID_LIMIT); |
| 5123 | config.tx_chain_mask = __cpu_to_le32(TARGET_TX_CHAIN_MASK); |
| 5124 | config.rx_chain_mask = __cpu_to_le32(TARGET_RX_CHAIN_MASK); |
| 5125 | config.rx_timeout_pri_vo = __cpu_to_le32(TARGET_RX_TIMEOUT_LO_PRI); |
| 5126 | config.rx_timeout_pri_vi = __cpu_to_le32(TARGET_RX_TIMEOUT_LO_PRI); |
| 5127 | config.rx_timeout_pri_be = __cpu_to_le32(TARGET_RX_TIMEOUT_LO_PRI); |
| 5128 | config.rx_timeout_pri_bk = __cpu_to_le32(TARGET_RX_TIMEOUT_HI_PRI); |
David Liu | ccec903 | 2015-07-24 20:25:32 +0300 | [diff] [blame] | 5129 | config.rx_decap_mode = __cpu_to_le32(ar->wmi.rx_decap_mode); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5130 | config.scan_max_pending_reqs = |
| 5131 | __cpu_to_le32(TARGET_SCAN_MAX_PENDING_REQS); |
| 5132 | |
| 5133 | config.bmiss_offload_max_vdev = |
| 5134 | __cpu_to_le32(TARGET_BMISS_OFFLOAD_MAX_VDEV); |
| 5135 | |
| 5136 | config.roam_offload_max_vdev = |
| 5137 | __cpu_to_le32(TARGET_ROAM_OFFLOAD_MAX_VDEV); |
| 5138 | |
| 5139 | config.roam_offload_max_ap_profiles = |
| 5140 | __cpu_to_le32(TARGET_ROAM_OFFLOAD_MAX_AP_PROFILES); |
| 5141 | |
| 5142 | config.num_mcast_groups = __cpu_to_le32(TARGET_NUM_MCAST_GROUPS); |
| 5143 | config.num_mcast_table_elems = |
| 5144 | __cpu_to_le32(TARGET_NUM_MCAST_TABLE_ELEMS); |
| 5145 | |
| 5146 | config.mcast2ucast_mode = __cpu_to_le32(TARGET_MCAST2UCAST_MODE); |
| 5147 | config.tx_dbg_log_size = __cpu_to_le32(TARGET_TX_DBG_LOG_SIZE); |
| 5148 | config.num_wds_entries = __cpu_to_le32(TARGET_NUM_WDS_ENTRIES); |
| 5149 | config.dma_burst_size = __cpu_to_le32(TARGET_DMA_BURST_SIZE); |
| 5150 | config.mac_aggr_delim = __cpu_to_le32(TARGET_MAC_AGGR_DELIM); |
| 5151 | |
| 5152 | val = TARGET_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK; |
| 5153 | config.rx_skip_defrag_timeout_dup_detection_check = __cpu_to_le32(val); |
| 5154 | |
| 5155 | config.vow_config = __cpu_to_le32(TARGET_VOW_CONFIG); |
| 5156 | |
| 5157 | config.gtk_offload_max_vdev = |
| 5158 | __cpu_to_le32(TARGET_GTK_OFFLOAD_MAX_VDEV); |
| 5159 | |
| 5160 | config.num_msdu_desc = __cpu_to_le32(TARGET_NUM_MSDU_DESC); |
| 5161 | config.max_frag_entries = __cpu_to_le32(TARGET_MAX_FRAG_ENTRIES); |
| 5162 | |
Bartosz Markowski | b3effe6 | 2013-09-26 17:47:11 +0200 | [diff] [blame] | 5163 | len = sizeof(*cmd) + |
| 5164 | (sizeof(struct host_memory_chunk) * ar->wmi.num_mem_chunks); |
| 5165 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5166 | buf = ath10k_wmi_alloc_skb(ar, len); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5167 | if (!buf) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5168 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5169 | |
| 5170 | cmd = (struct wmi_init_cmd *)buf->data; |
Bartosz Markowski | b3effe6 | 2013-09-26 17:47:11 +0200 | [diff] [blame] | 5171 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5172 | memcpy(&cmd->resource_config, &config, sizeof(config)); |
Michal Kazior | cf9fca8 | 2014-09-18 15:21:22 +0200 | [diff] [blame] | 5173 | ath10k_wmi_put_host_mem_chunks(ar, &cmd->mem_chunks); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5174 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5175 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi init\n"); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5176 | return buf; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5177 | } |
| 5178 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5179 | static struct sk_buff *ath10k_wmi_10_1_op_gen_init(struct ath10k *ar) |
Bartosz Markowski | 12b2b9e | 2013-09-26 17:47:13 +0200 | [diff] [blame] | 5180 | { |
| 5181 | struct wmi_init_cmd_10x *cmd; |
| 5182 | struct sk_buff *buf; |
| 5183 | struct wmi_resource_config_10x config = {}; |
| 5184 | u32 len, val; |
Bartosz Markowski | 12b2b9e | 2013-09-26 17:47:13 +0200 | [diff] [blame] | 5185 | |
Bartosz Markowski | ec6a73f | 2013-09-26 17:47:14 +0200 | [diff] [blame] | 5186 | config.num_vdevs = __cpu_to_le32(TARGET_10X_NUM_VDEVS); |
| 5187 | config.num_peers = __cpu_to_le32(TARGET_10X_NUM_PEERS); |
| 5188 | config.num_peer_keys = __cpu_to_le32(TARGET_10X_NUM_PEER_KEYS); |
| 5189 | config.num_tids = __cpu_to_le32(TARGET_10X_NUM_TIDS); |
| 5190 | config.ast_skid_limit = __cpu_to_le32(TARGET_10X_AST_SKID_LIMIT); |
| 5191 | config.tx_chain_mask = __cpu_to_le32(TARGET_10X_TX_CHAIN_MASK); |
| 5192 | config.rx_chain_mask = __cpu_to_le32(TARGET_10X_RX_CHAIN_MASK); |
| 5193 | config.rx_timeout_pri_vo = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_LO_PRI); |
| 5194 | config.rx_timeout_pri_vi = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_LO_PRI); |
| 5195 | config.rx_timeout_pri_be = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_LO_PRI); |
| 5196 | config.rx_timeout_pri_bk = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_HI_PRI); |
David Liu | ccec903 | 2015-07-24 20:25:32 +0300 | [diff] [blame] | 5197 | config.rx_decap_mode = __cpu_to_le32(ar->wmi.rx_decap_mode); |
Bartosz Markowski | 12b2b9e | 2013-09-26 17:47:13 +0200 | [diff] [blame] | 5198 | config.scan_max_pending_reqs = |
Bartosz Markowski | ec6a73f | 2013-09-26 17:47:14 +0200 | [diff] [blame] | 5199 | __cpu_to_le32(TARGET_10X_SCAN_MAX_PENDING_REQS); |
Bartosz Markowski | 12b2b9e | 2013-09-26 17:47:13 +0200 | [diff] [blame] | 5200 | |
| 5201 | config.bmiss_offload_max_vdev = |
Bartosz Markowski | ec6a73f | 2013-09-26 17:47:14 +0200 | [diff] [blame] | 5202 | __cpu_to_le32(TARGET_10X_BMISS_OFFLOAD_MAX_VDEV); |
Bartosz Markowski | 12b2b9e | 2013-09-26 17:47:13 +0200 | [diff] [blame] | 5203 | |
| 5204 | config.roam_offload_max_vdev = |
Bartosz Markowski | ec6a73f | 2013-09-26 17:47:14 +0200 | [diff] [blame] | 5205 | __cpu_to_le32(TARGET_10X_ROAM_OFFLOAD_MAX_VDEV); |
Bartosz Markowski | 12b2b9e | 2013-09-26 17:47:13 +0200 | [diff] [blame] | 5206 | |
| 5207 | config.roam_offload_max_ap_profiles = |
Bartosz Markowski | ec6a73f | 2013-09-26 17:47:14 +0200 | [diff] [blame] | 5208 | __cpu_to_le32(TARGET_10X_ROAM_OFFLOAD_MAX_AP_PROFILES); |
Bartosz Markowski | 12b2b9e | 2013-09-26 17:47:13 +0200 | [diff] [blame] | 5209 | |
Bartosz Markowski | ec6a73f | 2013-09-26 17:47:14 +0200 | [diff] [blame] | 5210 | config.num_mcast_groups = __cpu_to_le32(TARGET_10X_NUM_MCAST_GROUPS); |
Bartosz Markowski | 12b2b9e | 2013-09-26 17:47:13 +0200 | [diff] [blame] | 5211 | config.num_mcast_table_elems = |
Bartosz Markowski | ec6a73f | 2013-09-26 17:47:14 +0200 | [diff] [blame] | 5212 | __cpu_to_le32(TARGET_10X_NUM_MCAST_TABLE_ELEMS); |
Bartosz Markowski | 12b2b9e | 2013-09-26 17:47:13 +0200 | [diff] [blame] | 5213 | |
Bartosz Markowski | ec6a73f | 2013-09-26 17:47:14 +0200 | [diff] [blame] | 5214 | config.mcast2ucast_mode = __cpu_to_le32(TARGET_10X_MCAST2UCAST_MODE); |
| 5215 | config.tx_dbg_log_size = __cpu_to_le32(TARGET_10X_TX_DBG_LOG_SIZE); |
| 5216 | config.num_wds_entries = __cpu_to_le32(TARGET_10X_NUM_WDS_ENTRIES); |
| 5217 | config.dma_burst_size = __cpu_to_le32(TARGET_10X_DMA_BURST_SIZE); |
| 5218 | config.mac_aggr_delim = __cpu_to_le32(TARGET_10X_MAC_AGGR_DELIM); |
Bartosz Markowski | 12b2b9e | 2013-09-26 17:47:13 +0200 | [diff] [blame] | 5219 | |
Bartosz Markowski | ec6a73f | 2013-09-26 17:47:14 +0200 | [diff] [blame] | 5220 | val = TARGET_10X_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK; |
Bartosz Markowski | 12b2b9e | 2013-09-26 17:47:13 +0200 | [diff] [blame] | 5221 | config.rx_skip_defrag_timeout_dup_detection_check = __cpu_to_le32(val); |
| 5222 | |
Bartosz Markowski | ec6a73f | 2013-09-26 17:47:14 +0200 | [diff] [blame] | 5223 | config.vow_config = __cpu_to_le32(TARGET_10X_VOW_CONFIG); |
Bartosz Markowski | 12b2b9e | 2013-09-26 17:47:13 +0200 | [diff] [blame] | 5224 | |
Bartosz Markowski | ec6a73f | 2013-09-26 17:47:14 +0200 | [diff] [blame] | 5225 | config.num_msdu_desc = __cpu_to_le32(TARGET_10X_NUM_MSDU_DESC); |
| 5226 | config.max_frag_entries = __cpu_to_le32(TARGET_10X_MAX_FRAG_ENTRIES); |
Bartosz Markowski | 12b2b9e | 2013-09-26 17:47:13 +0200 | [diff] [blame] | 5227 | |
| 5228 | len = sizeof(*cmd) + |
| 5229 | (sizeof(struct host_memory_chunk) * ar->wmi.num_mem_chunks); |
| 5230 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5231 | buf = ath10k_wmi_alloc_skb(ar, len); |
Bartosz Markowski | 12b2b9e | 2013-09-26 17:47:13 +0200 | [diff] [blame] | 5232 | if (!buf) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5233 | return ERR_PTR(-ENOMEM); |
Bartosz Markowski | 12b2b9e | 2013-09-26 17:47:13 +0200 | [diff] [blame] | 5234 | |
| 5235 | cmd = (struct wmi_init_cmd_10x *)buf->data; |
| 5236 | |
Bartosz Markowski | 12b2b9e | 2013-09-26 17:47:13 +0200 | [diff] [blame] | 5237 | memcpy(&cmd->resource_config, &config, sizeof(config)); |
Michal Kazior | cf9fca8 | 2014-09-18 15:21:22 +0200 | [diff] [blame] | 5238 | ath10k_wmi_put_host_mem_chunks(ar, &cmd->mem_chunks); |
Bartosz Markowski | 12b2b9e | 2013-09-26 17:47:13 +0200 | [diff] [blame] | 5239 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5240 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi init 10x\n"); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5241 | return buf; |
Bartosz Markowski | 12b2b9e | 2013-09-26 17:47:13 +0200 | [diff] [blame] | 5242 | } |
| 5243 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5244 | static struct sk_buff *ath10k_wmi_10_2_op_gen_init(struct ath10k *ar) |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 5245 | { |
| 5246 | struct wmi_init_cmd_10_2 *cmd; |
| 5247 | struct sk_buff *buf; |
| 5248 | struct wmi_resource_config_10x config = {}; |
Sujith Manoharan | b6c8e28 | 2015-01-12 12:30:02 +0200 | [diff] [blame] | 5249 | u32 len, val, features; |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 5250 | |
| 5251 | config.num_vdevs = __cpu_to_le32(TARGET_10X_NUM_VDEVS); |
| 5252 | config.num_peers = __cpu_to_le32(TARGET_10X_NUM_PEERS); |
| 5253 | config.num_peer_keys = __cpu_to_le32(TARGET_10X_NUM_PEER_KEYS); |
| 5254 | config.num_tids = __cpu_to_le32(TARGET_10X_NUM_TIDS); |
| 5255 | config.ast_skid_limit = __cpu_to_le32(TARGET_10X_AST_SKID_LIMIT); |
| 5256 | config.tx_chain_mask = __cpu_to_le32(TARGET_10X_TX_CHAIN_MASK); |
| 5257 | config.rx_chain_mask = __cpu_to_le32(TARGET_10X_RX_CHAIN_MASK); |
| 5258 | config.rx_timeout_pri_vo = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_LO_PRI); |
| 5259 | config.rx_timeout_pri_vi = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_LO_PRI); |
| 5260 | config.rx_timeout_pri_be = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_LO_PRI); |
| 5261 | config.rx_timeout_pri_bk = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_HI_PRI); |
David Liu | ccec903 | 2015-07-24 20:25:32 +0300 | [diff] [blame] | 5262 | config.rx_decap_mode = __cpu_to_le32(ar->wmi.rx_decap_mode); |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 5263 | |
| 5264 | config.scan_max_pending_reqs = |
| 5265 | __cpu_to_le32(TARGET_10X_SCAN_MAX_PENDING_REQS); |
| 5266 | |
| 5267 | config.bmiss_offload_max_vdev = |
| 5268 | __cpu_to_le32(TARGET_10X_BMISS_OFFLOAD_MAX_VDEV); |
| 5269 | |
| 5270 | config.roam_offload_max_vdev = |
| 5271 | __cpu_to_le32(TARGET_10X_ROAM_OFFLOAD_MAX_VDEV); |
| 5272 | |
| 5273 | config.roam_offload_max_ap_profiles = |
| 5274 | __cpu_to_le32(TARGET_10X_ROAM_OFFLOAD_MAX_AP_PROFILES); |
| 5275 | |
| 5276 | config.num_mcast_groups = __cpu_to_le32(TARGET_10X_NUM_MCAST_GROUPS); |
| 5277 | config.num_mcast_table_elems = |
| 5278 | __cpu_to_le32(TARGET_10X_NUM_MCAST_TABLE_ELEMS); |
| 5279 | |
| 5280 | config.mcast2ucast_mode = __cpu_to_le32(TARGET_10X_MCAST2UCAST_MODE); |
| 5281 | config.tx_dbg_log_size = __cpu_to_le32(TARGET_10X_TX_DBG_LOG_SIZE); |
| 5282 | config.num_wds_entries = __cpu_to_le32(TARGET_10X_NUM_WDS_ENTRIES); |
Sujith Manoharan | f6603ff | 2015-01-12 12:30:02 +0200 | [diff] [blame] | 5283 | config.dma_burst_size = __cpu_to_le32(TARGET_10_2_DMA_BURST_SIZE); |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 5284 | config.mac_aggr_delim = __cpu_to_le32(TARGET_10X_MAC_AGGR_DELIM); |
| 5285 | |
| 5286 | val = TARGET_10X_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK; |
| 5287 | config.rx_skip_defrag_timeout_dup_detection_check = __cpu_to_le32(val); |
| 5288 | |
| 5289 | config.vow_config = __cpu_to_le32(TARGET_10X_VOW_CONFIG); |
| 5290 | |
| 5291 | config.num_msdu_desc = __cpu_to_le32(TARGET_10X_NUM_MSDU_DESC); |
| 5292 | config.max_frag_entries = __cpu_to_le32(TARGET_10X_MAX_FRAG_ENTRIES); |
| 5293 | |
| 5294 | len = sizeof(*cmd) + |
| 5295 | (sizeof(struct host_memory_chunk) * ar->wmi.num_mem_chunks); |
| 5296 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5297 | buf = ath10k_wmi_alloc_skb(ar, len); |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 5298 | if (!buf) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5299 | return ERR_PTR(-ENOMEM); |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 5300 | |
| 5301 | cmd = (struct wmi_init_cmd_10_2 *)buf->data; |
| 5302 | |
Sujith Manoharan | b6c8e28 | 2015-01-12 12:30:02 +0200 | [diff] [blame] | 5303 | features = WMI_10_2_RX_BATCH_MODE; |
Yanbo Li | de0c789 | 2015-04-15 15:28:08 +0300 | [diff] [blame] | 5304 | if (test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map)) |
| 5305 | features |= WMI_10_2_COEX_GPIO; |
Sujith Manoharan | b6c8e28 | 2015-01-12 12:30:02 +0200 | [diff] [blame] | 5306 | cmd->resource_config.feature_mask = __cpu_to_le32(features); |
| 5307 | |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 5308 | memcpy(&cmd->resource_config.common, &config, sizeof(config)); |
Michal Kazior | cf9fca8 | 2014-09-18 15:21:22 +0200 | [diff] [blame] | 5309 | ath10k_wmi_put_host_mem_chunks(ar, &cmd->mem_chunks); |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 5310 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5311 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi init 10.2\n"); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5312 | return buf; |
Bartosz Markowski | 12b2b9e | 2013-09-26 17:47:13 +0200 | [diff] [blame] | 5313 | } |
| 5314 | |
Raja Mani | d1e52a8 | 2015-06-22 20:10:15 +0530 | [diff] [blame] | 5315 | static struct sk_buff *ath10k_wmi_10_4_op_gen_init(struct ath10k *ar) |
| 5316 | { |
| 5317 | struct wmi_init_cmd_10_4 *cmd; |
| 5318 | struct sk_buff *buf; |
| 5319 | struct wmi_resource_config_10_4 config = {}; |
| 5320 | u32 len; |
| 5321 | |
| 5322 | config.num_vdevs = __cpu_to_le32(ar->max_num_vdevs); |
| 5323 | config.num_peers = __cpu_to_le32(ar->max_num_peers); |
| 5324 | config.num_active_peers = __cpu_to_le32(ar->num_active_peers); |
| 5325 | config.num_tids = __cpu_to_le32(ar->num_tids); |
| 5326 | |
| 5327 | config.num_offload_peers = __cpu_to_le32(TARGET_10_4_NUM_OFFLOAD_PEERS); |
| 5328 | config.num_offload_reorder_buffs = |
| 5329 | __cpu_to_le32(TARGET_10_4_NUM_OFFLOAD_REORDER_BUFFS); |
| 5330 | config.num_peer_keys = __cpu_to_le32(TARGET_10_4_NUM_PEER_KEYS); |
| 5331 | config.ast_skid_limit = __cpu_to_le32(TARGET_10_4_AST_SKID_LIMIT); |
| 5332 | config.tx_chain_mask = __cpu_to_le32(TARGET_10_4_TX_CHAIN_MASK); |
| 5333 | config.rx_chain_mask = __cpu_to_le32(TARGET_10_4_RX_CHAIN_MASK); |
| 5334 | |
| 5335 | config.rx_timeout_pri[0] = __cpu_to_le32(TARGET_10_4_RX_TIMEOUT_LO_PRI); |
| 5336 | config.rx_timeout_pri[1] = __cpu_to_le32(TARGET_10_4_RX_TIMEOUT_LO_PRI); |
| 5337 | config.rx_timeout_pri[2] = __cpu_to_le32(TARGET_10_4_RX_TIMEOUT_LO_PRI); |
| 5338 | config.rx_timeout_pri[3] = __cpu_to_le32(TARGET_10_4_RX_TIMEOUT_HI_PRI); |
| 5339 | |
Peter Oh | bc27e8c | 2015-10-05 17:56:39 +0300 | [diff] [blame] | 5340 | config.rx_decap_mode = __cpu_to_le32(ar->wmi.rx_decap_mode); |
Raja Mani | d1e52a8 | 2015-06-22 20:10:15 +0530 | [diff] [blame] | 5341 | config.scan_max_pending_req = __cpu_to_le32(TARGET_10_4_SCAN_MAX_REQS); |
| 5342 | config.bmiss_offload_max_vdev = |
| 5343 | __cpu_to_le32(TARGET_10_4_BMISS_OFFLOAD_MAX_VDEV); |
| 5344 | config.roam_offload_max_vdev = |
| 5345 | __cpu_to_le32(TARGET_10_4_ROAM_OFFLOAD_MAX_VDEV); |
| 5346 | config.roam_offload_max_ap_profiles = |
| 5347 | __cpu_to_le32(TARGET_10_4_ROAM_OFFLOAD_MAX_PROFILES); |
| 5348 | config.num_mcast_groups = __cpu_to_le32(TARGET_10_4_NUM_MCAST_GROUPS); |
| 5349 | config.num_mcast_table_elems = |
| 5350 | __cpu_to_le32(TARGET_10_4_NUM_MCAST_TABLE_ELEMS); |
| 5351 | |
| 5352 | config.mcast2ucast_mode = __cpu_to_le32(TARGET_10_4_MCAST2UCAST_MODE); |
| 5353 | config.tx_dbg_log_size = __cpu_to_le32(TARGET_10_4_TX_DBG_LOG_SIZE); |
| 5354 | config.num_wds_entries = __cpu_to_le32(TARGET_10_4_NUM_WDS_ENTRIES); |
| 5355 | config.dma_burst_size = __cpu_to_le32(TARGET_10_4_DMA_BURST_SIZE); |
| 5356 | config.mac_aggr_delim = __cpu_to_le32(TARGET_10_4_MAC_AGGR_DELIM); |
| 5357 | |
| 5358 | config.rx_skip_defrag_timeout_dup_detection_check = |
| 5359 | __cpu_to_le32(TARGET_10_4_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK); |
| 5360 | |
| 5361 | config.vow_config = __cpu_to_le32(TARGET_10_4_VOW_CONFIG); |
| 5362 | config.gtk_offload_max_vdev = |
| 5363 | __cpu_to_le32(TARGET_10_4_GTK_OFFLOAD_MAX_VDEV); |
| 5364 | config.num_msdu_desc = __cpu_to_le32(TARGET_10_4_NUM_MSDU_DESC); |
| 5365 | config.max_frag_entries = __cpu_to_le32(TARGET_10_4_11AC_TX_MAX_FRAGS); |
| 5366 | config.max_peer_ext_stats = |
| 5367 | __cpu_to_le32(TARGET_10_4_MAX_PEER_EXT_STATS); |
| 5368 | config.smart_ant_cap = __cpu_to_le32(TARGET_10_4_SMART_ANT_CAP); |
| 5369 | |
| 5370 | config.bk_minfree = __cpu_to_le32(TARGET_10_4_BK_MIN_FREE); |
| 5371 | config.be_minfree = __cpu_to_le32(TARGET_10_4_BE_MIN_FREE); |
| 5372 | config.vi_minfree = __cpu_to_le32(TARGET_10_4_VI_MIN_FREE); |
| 5373 | config.vo_minfree = __cpu_to_le32(TARGET_10_4_VO_MIN_FREE); |
| 5374 | |
| 5375 | config.rx_batchmode = __cpu_to_le32(TARGET_10_4_RX_BATCH_MODE); |
| 5376 | config.tt_support = |
| 5377 | __cpu_to_le32(TARGET_10_4_THERMAL_THROTTLING_CONFIG); |
| 5378 | config.atf_config = __cpu_to_le32(TARGET_10_4_ATF_CONFIG); |
| 5379 | config.iphdr_pad_config = __cpu_to_le32(TARGET_10_4_IPHDR_PAD_CONFIG); |
| 5380 | config.qwrap_config = __cpu_to_le32(TARGET_10_4_QWRAP_CONFIG); |
| 5381 | |
| 5382 | len = sizeof(*cmd) + |
| 5383 | (sizeof(struct host_memory_chunk) * ar->wmi.num_mem_chunks); |
| 5384 | |
| 5385 | buf = ath10k_wmi_alloc_skb(ar, len); |
| 5386 | if (!buf) |
| 5387 | return ERR_PTR(-ENOMEM); |
| 5388 | |
| 5389 | cmd = (struct wmi_init_cmd_10_4 *)buf->data; |
| 5390 | memcpy(&cmd->resource_config, &config, sizeof(config)); |
| 5391 | ath10k_wmi_put_host_mem_chunks(ar, &cmd->mem_chunks); |
| 5392 | |
| 5393 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi init 10.4\n"); |
| 5394 | return buf; |
| 5395 | } |
| 5396 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 5397 | int ath10k_wmi_start_scan_verify(const struct wmi_start_scan_arg *arg) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5398 | { |
Michal Kazior | a6aa5da | 2014-09-18 15:21:27 +0200 | [diff] [blame] | 5399 | if (arg->ie_len && !arg->ie) |
| 5400 | return -EINVAL; |
| 5401 | if (arg->n_channels && !arg->channels) |
| 5402 | return -EINVAL; |
| 5403 | if (arg->n_ssids && !arg->ssids) |
| 5404 | return -EINVAL; |
| 5405 | if (arg->n_bssids && !arg->bssids) |
| 5406 | return -EINVAL; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5407 | |
Michal Kazior | a6aa5da | 2014-09-18 15:21:27 +0200 | [diff] [blame] | 5408 | if (arg->ie_len > WLAN_SCAN_PARAMS_MAX_IE_LEN) |
| 5409 | return -EINVAL; |
| 5410 | if (arg->n_channels > ARRAY_SIZE(arg->channels)) |
| 5411 | return -EINVAL; |
| 5412 | if (arg->n_ssids > WLAN_SCAN_PARAMS_MAX_SSID) |
| 5413 | return -EINVAL; |
| 5414 | if (arg->n_bssids > WLAN_SCAN_PARAMS_MAX_BSSID) |
| 5415 | return -EINVAL; |
| 5416 | |
| 5417 | return 0; |
| 5418 | } |
| 5419 | |
| 5420 | static size_t |
| 5421 | ath10k_wmi_start_scan_tlvs_len(const struct wmi_start_scan_arg *arg) |
| 5422 | { |
| 5423 | int len = 0; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5424 | |
| 5425 | if (arg->ie_len) { |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5426 | len += sizeof(struct wmi_ie_data); |
| 5427 | len += roundup(arg->ie_len, 4); |
| 5428 | } |
| 5429 | |
| 5430 | if (arg->n_channels) { |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5431 | len += sizeof(struct wmi_chan_list); |
| 5432 | len += sizeof(__le32) * arg->n_channels; |
| 5433 | } |
| 5434 | |
| 5435 | if (arg->n_ssids) { |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5436 | len += sizeof(struct wmi_ssid_list); |
| 5437 | len += sizeof(struct wmi_ssid) * arg->n_ssids; |
| 5438 | } |
| 5439 | |
| 5440 | if (arg->n_bssids) { |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5441 | len += sizeof(struct wmi_bssid_list); |
| 5442 | len += sizeof(struct wmi_mac_addr) * arg->n_bssids; |
| 5443 | } |
| 5444 | |
| 5445 | return len; |
| 5446 | } |
| 5447 | |
Michal Kazior | 0226d60 | 2014-12-03 10:11:22 +0200 | [diff] [blame] | 5448 | void ath10k_wmi_put_start_scan_common(struct wmi_start_scan_common *cmn, |
| 5449 | const struct wmi_start_scan_arg *arg) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5450 | { |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5451 | u32 scan_id; |
| 5452 | u32 scan_req_id; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5453 | |
| 5454 | scan_id = WMI_HOST_SCAN_REQ_ID_PREFIX; |
| 5455 | scan_id |= arg->scan_id; |
| 5456 | |
| 5457 | scan_req_id = WMI_HOST_SCAN_REQUESTOR_ID_PREFIX; |
| 5458 | scan_req_id |= arg->scan_req_id; |
| 5459 | |
Michal Kazior | a6aa5da | 2014-09-18 15:21:27 +0200 | [diff] [blame] | 5460 | cmn->scan_id = __cpu_to_le32(scan_id); |
| 5461 | cmn->scan_req_id = __cpu_to_le32(scan_req_id); |
| 5462 | cmn->vdev_id = __cpu_to_le32(arg->vdev_id); |
| 5463 | cmn->scan_priority = __cpu_to_le32(arg->scan_priority); |
| 5464 | cmn->notify_scan_events = __cpu_to_le32(arg->notify_scan_events); |
| 5465 | cmn->dwell_time_active = __cpu_to_le32(arg->dwell_time_active); |
| 5466 | cmn->dwell_time_passive = __cpu_to_le32(arg->dwell_time_passive); |
| 5467 | cmn->min_rest_time = __cpu_to_le32(arg->min_rest_time); |
| 5468 | cmn->max_rest_time = __cpu_to_le32(arg->max_rest_time); |
| 5469 | cmn->repeat_probe_time = __cpu_to_le32(arg->repeat_probe_time); |
| 5470 | cmn->probe_spacing_time = __cpu_to_le32(arg->probe_spacing_time); |
| 5471 | cmn->idle_time = __cpu_to_le32(arg->idle_time); |
| 5472 | cmn->max_scan_time = __cpu_to_le32(arg->max_scan_time); |
| 5473 | cmn->probe_delay = __cpu_to_le32(arg->probe_delay); |
| 5474 | cmn->scan_ctrl_flags = __cpu_to_le32(arg->scan_ctrl_flags); |
| 5475 | } |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5476 | |
Michal Kazior | a6aa5da | 2014-09-18 15:21:27 +0200 | [diff] [blame] | 5477 | static void |
| 5478 | ath10k_wmi_put_start_scan_tlvs(struct wmi_start_scan_tlvs *tlvs, |
| 5479 | const struct wmi_start_scan_arg *arg) |
| 5480 | { |
| 5481 | struct wmi_ie_data *ie; |
| 5482 | struct wmi_chan_list *channels; |
| 5483 | struct wmi_ssid_list *ssids; |
| 5484 | struct wmi_bssid_list *bssids; |
| 5485 | void *ptr = tlvs->tlvs; |
| 5486 | int i; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5487 | |
| 5488 | if (arg->n_channels) { |
Michal Kazior | a6aa5da | 2014-09-18 15:21:27 +0200 | [diff] [blame] | 5489 | channels = ptr; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5490 | channels->tag = __cpu_to_le32(WMI_CHAN_LIST_TAG); |
| 5491 | channels->num_chan = __cpu_to_le32(arg->n_channels); |
| 5492 | |
| 5493 | for (i = 0; i < arg->n_channels; i++) |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 5494 | channels->channel_list[i].freq = |
| 5495 | __cpu_to_le16(arg->channels[i]); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5496 | |
Michal Kazior | a6aa5da | 2014-09-18 15:21:27 +0200 | [diff] [blame] | 5497 | ptr += sizeof(*channels); |
| 5498 | ptr += sizeof(__le32) * arg->n_channels; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5499 | } |
| 5500 | |
| 5501 | if (arg->n_ssids) { |
Michal Kazior | a6aa5da | 2014-09-18 15:21:27 +0200 | [diff] [blame] | 5502 | ssids = ptr; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5503 | ssids->tag = __cpu_to_le32(WMI_SSID_LIST_TAG); |
| 5504 | ssids->num_ssids = __cpu_to_le32(arg->n_ssids); |
| 5505 | |
| 5506 | for (i = 0; i < arg->n_ssids; i++) { |
| 5507 | ssids->ssids[i].ssid_len = |
| 5508 | __cpu_to_le32(arg->ssids[i].len); |
| 5509 | memcpy(&ssids->ssids[i].ssid, |
| 5510 | arg->ssids[i].ssid, |
| 5511 | arg->ssids[i].len); |
| 5512 | } |
| 5513 | |
Michal Kazior | a6aa5da | 2014-09-18 15:21:27 +0200 | [diff] [blame] | 5514 | ptr += sizeof(*ssids); |
| 5515 | ptr += sizeof(struct wmi_ssid) * arg->n_ssids; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5516 | } |
| 5517 | |
| 5518 | if (arg->n_bssids) { |
Michal Kazior | a6aa5da | 2014-09-18 15:21:27 +0200 | [diff] [blame] | 5519 | bssids = ptr; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5520 | bssids->tag = __cpu_to_le32(WMI_BSSID_LIST_TAG); |
| 5521 | bssids->num_bssid = __cpu_to_le32(arg->n_bssids); |
| 5522 | |
| 5523 | for (i = 0; i < arg->n_bssids; i++) |
| 5524 | memcpy(&bssids->bssid_list[i], |
| 5525 | arg->bssids[i].bssid, |
| 5526 | ETH_ALEN); |
| 5527 | |
Michal Kazior | a6aa5da | 2014-09-18 15:21:27 +0200 | [diff] [blame] | 5528 | ptr += sizeof(*bssids); |
| 5529 | ptr += sizeof(struct wmi_mac_addr) * arg->n_bssids; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5530 | } |
| 5531 | |
| 5532 | if (arg->ie_len) { |
Michal Kazior | a6aa5da | 2014-09-18 15:21:27 +0200 | [diff] [blame] | 5533 | ie = ptr; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5534 | ie->tag = __cpu_to_le32(WMI_IE_TAG); |
| 5535 | ie->ie_len = __cpu_to_le32(arg->ie_len); |
| 5536 | memcpy(ie->ie_data, arg->ie, arg->ie_len); |
| 5537 | |
Michal Kazior | a6aa5da | 2014-09-18 15:21:27 +0200 | [diff] [blame] | 5538 | ptr += sizeof(*ie); |
| 5539 | ptr += roundup(arg->ie_len, 4); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5540 | } |
Michal Kazior | a6aa5da | 2014-09-18 15:21:27 +0200 | [diff] [blame] | 5541 | } |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5542 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5543 | static struct sk_buff * |
| 5544 | ath10k_wmi_op_gen_start_scan(struct ath10k *ar, |
| 5545 | const struct wmi_start_scan_arg *arg) |
Michal Kazior | a6aa5da | 2014-09-18 15:21:27 +0200 | [diff] [blame] | 5546 | { |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5547 | struct wmi_start_scan_cmd *cmd; |
Michal Kazior | a6aa5da | 2014-09-18 15:21:27 +0200 | [diff] [blame] | 5548 | struct sk_buff *skb; |
| 5549 | size_t len; |
| 5550 | int ret; |
| 5551 | |
| 5552 | ret = ath10k_wmi_start_scan_verify(arg); |
| 5553 | if (ret) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5554 | return ERR_PTR(ret); |
Michal Kazior | a6aa5da | 2014-09-18 15:21:27 +0200 | [diff] [blame] | 5555 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5556 | len = sizeof(*cmd) + ath10k_wmi_start_scan_tlvs_len(arg); |
Michal Kazior | a6aa5da | 2014-09-18 15:21:27 +0200 | [diff] [blame] | 5557 | skb = ath10k_wmi_alloc_skb(ar, len); |
| 5558 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5559 | return ERR_PTR(-ENOMEM); |
Michal Kazior | a6aa5da | 2014-09-18 15:21:27 +0200 | [diff] [blame] | 5560 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5561 | cmd = (struct wmi_start_scan_cmd *)skb->data; |
Michal Kazior | a6aa5da | 2014-09-18 15:21:27 +0200 | [diff] [blame] | 5562 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5563 | ath10k_wmi_put_start_scan_common(&cmd->common, arg); |
| 5564 | ath10k_wmi_put_start_scan_tlvs(&cmd->tlvs, arg); |
Michal Kazior | a6aa5da | 2014-09-18 15:21:27 +0200 | [diff] [blame] | 5565 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5566 | cmd->burst_duration_ms = __cpu_to_le32(0); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5567 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5568 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi start scan\n"); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5569 | return skb; |
| 5570 | } |
| 5571 | |
| 5572 | static struct sk_buff * |
| 5573 | ath10k_wmi_10x_op_gen_start_scan(struct ath10k *ar, |
| 5574 | const struct wmi_start_scan_arg *arg) |
| 5575 | { |
| 5576 | struct wmi_10x_start_scan_cmd *cmd; |
| 5577 | struct sk_buff *skb; |
| 5578 | size_t len; |
| 5579 | int ret; |
| 5580 | |
| 5581 | ret = ath10k_wmi_start_scan_verify(arg); |
| 5582 | if (ret) |
| 5583 | return ERR_PTR(ret); |
| 5584 | |
| 5585 | len = sizeof(*cmd) + ath10k_wmi_start_scan_tlvs_len(arg); |
| 5586 | skb = ath10k_wmi_alloc_skb(ar, len); |
| 5587 | if (!skb) |
| 5588 | return ERR_PTR(-ENOMEM); |
| 5589 | |
| 5590 | cmd = (struct wmi_10x_start_scan_cmd *)skb->data; |
| 5591 | |
| 5592 | ath10k_wmi_put_start_scan_common(&cmd->common, arg); |
| 5593 | ath10k_wmi_put_start_scan_tlvs(&cmd->tlvs, arg); |
| 5594 | |
| 5595 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi 10x start scan\n"); |
| 5596 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5597 | } |
| 5598 | |
| 5599 | void ath10k_wmi_start_scan_init(struct ath10k *ar, |
| 5600 | struct wmi_start_scan_arg *arg) |
| 5601 | { |
| 5602 | /* setup commonly used values */ |
| 5603 | arg->scan_req_id = 1; |
| 5604 | arg->scan_priority = WMI_SCAN_PRIORITY_LOW; |
| 5605 | arg->dwell_time_active = 50; |
| 5606 | arg->dwell_time_passive = 150; |
| 5607 | arg->min_rest_time = 50; |
| 5608 | arg->max_rest_time = 500; |
| 5609 | arg->repeat_probe_time = 0; |
| 5610 | arg->probe_spacing_time = 0; |
| 5611 | arg->idle_time = 0; |
Bartosz Markowski | c322892 | 2013-10-02 08:48:52 +0200 | [diff] [blame] | 5612 | arg->max_scan_time = 20000; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5613 | arg->probe_delay = 5; |
| 5614 | arg->notify_scan_events = WMI_SCAN_EVENT_STARTED |
| 5615 | | WMI_SCAN_EVENT_COMPLETED |
| 5616 | | WMI_SCAN_EVENT_BSS_CHANNEL |
| 5617 | | WMI_SCAN_EVENT_FOREIGN_CHANNEL |
| 5618 | | WMI_SCAN_EVENT_DEQUEUED; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5619 | arg->scan_ctrl_flags |= WMI_SCAN_CHAN_STAT_EVENT; |
| 5620 | arg->n_bssids = 1; |
| 5621 | arg->bssids[0].bssid = "\xFF\xFF\xFF\xFF\xFF\xFF"; |
| 5622 | } |
| 5623 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5624 | static struct sk_buff * |
| 5625 | ath10k_wmi_op_gen_stop_scan(struct ath10k *ar, |
| 5626 | const struct wmi_stop_scan_arg *arg) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5627 | { |
| 5628 | struct wmi_stop_scan_cmd *cmd; |
| 5629 | struct sk_buff *skb; |
| 5630 | u32 scan_id; |
| 5631 | u32 req_id; |
| 5632 | |
| 5633 | if (arg->req_id > 0xFFF) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5634 | return ERR_PTR(-EINVAL); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5635 | if (arg->req_type == WMI_SCAN_STOP_ONE && arg->u.scan_id > 0xFFF) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5636 | return ERR_PTR(-EINVAL); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5637 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5638 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5639 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5640 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5641 | |
| 5642 | scan_id = arg->u.scan_id; |
| 5643 | scan_id |= WMI_HOST_SCAN_REQ_ID_PREFIX; |
| 5644 | |
| 5645 | req_id = arg->req_id; |
| 5646 | req_id |= WMI_HOST_SCAN_REQUESTOR_ID_PREFIX; |
| 5647 | |
| 5648 | cmd = (struct wmi_stop_scan_cmd *)skb->data; |
| 5649 | cmd->req_type = __cpu_to_le32(arg->req_type); |
| 5650 | cmd->vdev_id = __cpu_to_le32(arg->u.vdev_id); |
| 5651 | cmd->scan_id = __cpu_to_le32(scan_id); |
| 5652 | cmd->scan_req_id = __cpu_to_le32(req_id); |
| 5653 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5654 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5655 | "wmi stop scan reqid %d req_type %d vdev/scan_id %d\n", |
| 5656 | arg->req_id, arg->req_type, arg->u.scan_id); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5657 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5658 | } |
| 5659 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5660 | static struct sk_buff * |
| 5661 | ath10k_wmi_op_gen_vdev_create(struct ath10k *ar, u32 vdev_id, |
| 5662 | enum wmi_vdev_type type, |
| 5663 | enum wmi_vdev_subtype subtype, |
| 5664 | const u8 macaddr[ETH_ALEN]) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5665 | { |
| 5666 | struct wmi_vdev_create_cmd *cmd; |
| 5667 | struct sk_buff *skb; |
| 5668 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5669 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5670 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5671 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5672 | |
| 5673 | cmd = (struct wmi_vdev_create_cmd *)skb->data; |
| 5674 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
| 5675 | cmd->vdev_type = __cpu_to_le32(type); |
| 5676 | cmd->vdev_subtype = __cpu_to_le32(subtype); |
Kalle Valo | b25f32c | 2014-09-14 12:50:49 +0300 | [diff] [blame] | 5677 | ether_addr_copy(cmd->vdev_macaddr.addr, macaddr); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5678 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5679 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5680 | "WMI vdev create: id %d type %d subtype %d macaddr %pM\n", |
| 5681 | vdev_id, type, subtype, macaddr); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5682 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5683 | } |
| 5684 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5685 | static struct sk_buff * |
| 5686 | ath10k_wmi_op_gen_vdev_delete(struct ath10k *ar, u32 vdev_id) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5687 | { |
| 5688 | struct wmi_vdev_delete_cmd *cmd; |
| 5689 | struct sk_buff *skb; |
| 5690 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5691 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5692 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5693 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5694 | |
| 5695 | cmd = (struct wmi_vdev_delete_cmd *)skb->data; |
| 5696 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
| 5697 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5698 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5699 | "WMI vdev delete id %d\n", vdev_id); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5700 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5701 | } |
| 5702 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5703 | static struct sk_buff * |
| 5704 | ath10k_wmi_op_gen_vdev_start(struct ath10k *ar, |
| 5705 | const struct wmi_vdev_start_request_arg *arg, |
| 5706 | bool restart) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5707 | { |
| 5708 | struct wmi_vdev_start_request_cmd *cmd; |
| 5709 | struct sk_buff *skb; |
| 5710 | const char *cmdname; |
| 5711 | u32 flags = 0; |
| 5712 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5713 | if (WARN_ON(arg->hidden_ssid && !arg->ssid)) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5714 | return ERR_PTR(-EINVAL); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5715 | if (WARN_ON(arg->ssid_len > sizeof(cmd->ssid.ssid))) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5716 | return ERR_PTR(-EINVAL); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5717 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5718 | if (restart) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5719 | cmdname = "restart"; |
| 5720 | else |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5721 | cmdname = "start"; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5722 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5723 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5724 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5725 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5726 | |
| 5727 | if (arg->hidden_ssid) |
| 5728 | flags |= WMI_VDEV_START_HIDDEN_SSID; |
| 5729 | if (arg->pmf_enabled) |
| 5730 | flags |= WMI_VDEV_START_PMF_ENABLED; |
| 5731 | |
| 5732 | cmd = (struct wmi_vdev_start_request_cmd *)skb->data; |
| 5733 | cmd->vdev_id = __cpu_to_le32(arg->vdev_id); |
| 5734 | cmd->disable_hw_ack = __cpu_to_le32(arg->disable_hw_ack); |
| 5735 | cmd->beacon_interval = __cpu_to_le32(arg->bcn_intval); |
| 5736 | cmd->dtim_period = __cpu_to_le32(arg->dtim_period); |
| 5737 | cmd->flags = __cpu_to_le32(flags); |
| 5738 | cmd->bcn_tx_rate = __cpu_to_le32(arg->bcn_tx_rate); |
| 5739 | cmd->bcn_tx_power = __cpu_to_le32(arg->bcn_tx_power); |
| 5740 | |
| 5741 | if (arg->ssid) { |
| 5742 | cmd->ssid.ssid_len = __cpu_to_le32(arg->ssid_len); |
| 5743 | memcpy(cmd->ssid.ssid, arg->ssid, arg->ssid_len); |
| 5744 | } |
| 5745 | |
Michal Kazior | 2d66721 | 2014-09-18 15:21:21 +0200 | [diff] [blame] | 5746 | ath10k_wmi_put_wmi_channel(&cmd->chan, &arg->channel); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5747 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5748 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Kalle Valo | 8cc7f26 | 2014-09-14 12:50:39 +0300 | [diff] [blame] | 5749 | "wmi vdev %s id 0x%x flags: 0x%0X, freq %d, mode %d, ch_flags: 0x%0X, max_power: %d\n", |
| 5750 | cmdname, arg->vdev_id, |
Marek Puzyniak | e8a50f8 | 2013-11-20 09:59:47 +0200 | [diff] [blame] | 5751 | flags, arg->channel.freq, arg->channel.mode, |
| 5752 | cmd->chan.flags, arg->channel.max_power); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5753 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5754 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5755 | } |
| 5756 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5757 | static struct sk_buff * |
| 5758 | ath10k_wmi_op_gen_vdev_stop(struct ath10k *ar, u32 vdev_id) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5759 | { |
| 5760 | struct wmi_vdev_stop_cmd *cmd; |
| 5761 | struct sk_buff *skb; |
| 5762 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5763 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5764 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5765 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5766 | |
| 5767 | cmd = (struct wmi_vdev_stop_cmd *)skb->data; |
| 5768 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
| 5769 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5770 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi vdev stop id 0x%x\n", vdev_id); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5771 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5772 | } |
| 5773 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5774 | static struct sk_buff * |
| 5775 | ath10k_wmi_op_gen_vdev_up(struct ath10k *ar, u32 vdev_id, u32 aid, |
| 5776 | const u8 *bssid) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5777 | { |
| 5778 | struct wmi_vdev_up_cmd *cmd; |
| 5779 | struct sk_buff *skb; |
| 5780 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5781 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5782 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5783 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5784 | |
| 5785 | cmd = (struct wmi_vdev_up_cmd *)skb->data; |
| 5786 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
| 5787 | cmd->vdev_assoc_id = __cpu_to_le32(aid); |
Kalle Valo | b25f32c | 2014-09-14 12:50:49 +0300 | [diff] [blame] | 5788 | ether_addr_copy(cmd->vdev_bssid.addr, bssid); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5789 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5790 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5791 | "wmi mgmt vdev up id 0x%x assoc id %d bssid %pM\n", |
| 5792 | vdev_id, aid, bssid); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5793 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5794 | } |
| 5795 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5796 | static struct sk_buff * |
| 5797 | ath10k_wmi_op_gen_vdev_down(struct ath10k *ar, u32 vdev_id) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5798 | { |
| 5799 | struct wmi_vdev_down_cmd *cmd; |
| 5800 | struct sk_buff *skb; |
| 5801 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5802 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5803 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5804 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5805 | |
| 5806 | cmd = (struct wmi_vdev_down_cmd *)skb->data; |
| 5807 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
| 5808 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5809 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5810 | "wmi mgmt vdev down id 0x%x\n", vdev_id); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5811 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5812 | } |
| 5813 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5814 | static struct sk_buff * |
| 5815 | ath10k_wmi_op_gen_vdev_set_param(struct ath10k *ar, u32 vdev_id, |
| 5816 | u32 param_id, u32 param_value) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5817 | { |
| 5818 | struct wmi_vdev_set_param_cmd *cmd; |
| 5819 | struct sk_buff *skb; |
| 5820 | |
Bartosz Markowski | 6d1506e | 2013-09-26 17:47:15 +0200 | [diff] [blame] | 5821 | if (param_id == WMI_VDEV_PARAM_UNSUPPORTED) { |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5822 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Bartosz Markowski | 6d1506e | 2013-09-26 17:47:15 +0200 | [diff] [blame] | 5823 | "vdev param %d not supported by firmware\n", |
| 5824 | param_id); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5825 | return ERR_PTR(-EOPNOTSUPP); |
Bartosz Markowski | 6d1506e | 2013-09-26 17:47:15 +0200 | [diff] [blame] | 5826 | } |
| 5827 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5828 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5829 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5830 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5831 | |
| 5832 | cmd = (struct wmi_vdev_set_param_cmd *)skb->data; |
| 5833 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
| 5834 | cmd->param_id = __cpu_to_le32(param_id); |
| 5835 | cmd->param_value = __cpu_to_le32(param_value); |
| 5836 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5837 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5838 | "wmi vdev id 0x%x set param %d value %d\n", |
| 5839 | vdev_id, param_id, param_value); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5840 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5841 | } |
| 5842 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5843 | static struct sk_buff * |
| 5844 | ath10k_wmi_op_gen_vdev_install_key(struct ath10k *ar, |
| 5845 | const struct wmi_vdev_install_key_arg *arg) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5846 | { |
| 5847 | struct wmi_vdev_install_key_cmd *cmd; |
| 5848 | struct sk_buff *skb; |
| 5849 | |
| 5850 | if (arg->key_cipher == WMI_CIPHER_NONE && arg->key_data != NULL) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5851 | return ERR_PTR(-EINVAL); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5852 | if (arg->key_cipher != WMI_CIPHER_NONE && arg->key_data == NULL) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5853 | return ERR_PTR(-EINVAL); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5854 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5855 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd) + arg->key_len); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5856 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5857 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5858 | |
| 5859 | cmd = (struct wmi_vdev_install_key_cmd *)skb->data; |
| 5860 | cmd->vdev_id = __cpu_to_le32(arg->vdev_id); |
| 5861 | cmd->key_idx = __cpu_to_le32(arg->key_idx); |
| 5862 | cmd->key_flags = __cpu_to_le32(arg->key_flags); |
| 5863 | cmd->key_cipher = __cpu_to_le32(arg->key_cipher); |
| 5864 | cmd->key_len = __cpu_to_le32(arg->key_len); |
| 5865 | cmd->key_txmic_len = __cpu_to_le32(arg->key_txmic_len); |
| 5866 | cmd->key_rxmic_len = __cpu_to_le32(arg->key_rxmic_len); |
| 5867 | |
| 5868 | if (arg->macaddr) |
Kalle Valo | b25f32c | 2014-09-14 12:50:49 +0300 | [diff] [blame] | 5869 | ether_addr_copy(cmd->peer_macaddr.addr, arg->macaddr); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5870 | if (arg->key_data) |
| 5871 | memcpy(cmd->key_data, arg->key_data, arg->key_len); |
| 5872 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5873 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Michal Kazior | e0c508a | 2013-07-05 16:15:17 +0300 | [diff] [blame] | 5874 | "wmi vdev install key idx %d cipher %d len %d\n", |
| 5875 | arg->key_idx, arg->key_cipher, arg->key_len); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5876 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5877 | } |
| 5878 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5879 | static struct sk_buff * |
| 5880 | ath10k_wmi_op_gen_vdev_spectral_conf(struct ath10k *ar, |
| 5881 | const struct wmi_vdev_spectral_conf_arg *arg) |
Simon Wunderlich | 855aed1 | 2014-08-02 09:12:54 +0300 | [diff] [blame] | 5882 | { |
| 5883 | struct wmi_vdev_spectral_conf_cmd *cmd; |
| 5884 | struct sk_buff *skb; |
Simon Wunderlich | 855aed1 | 2014-08-02 09:12:54 +0300 | [diff] [blame] | 5885 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5886 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Simon Wunderlich | 855aed1 | 2014-08-02 09:12:54 +0300 | [diff] [blame] | 5887 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5888 | return ERR_PTR(-ENOMEM); |
Simon Wunderlich | 855aed1 | 2014-08-02 09:12:54 +0300 | [diff] [blame] | 5889 | |
| 5890 | cmd = (struct wmi_vdev_spectral_conf_cmd *)skb->data; |
| 5891 | cmd->vdev_id = __cpu_to_le32(arg->vdev_id); |
| 5892 | cmd->scan_count = __cpu_to_le32(arg->scan_count); |
| 5893 | cmd->scan_period = __cpu_to_le32(arg->scan_period); |
| 5894 | cmd->scan_priority = __cpu_to_le32(arg->scan_priority); |
| 5895 | cmd->scan_fft_size = __cpu_to_le32(arg->scan_fft_size); |
| 5896 | cmd->scan_gc_ena = __cpu_to_le32(arg->scan_gc_ena); |
| 5897 | cmd->scan_restart_ena = __cpu_to_le32(arg->scan_restart_ena); |
| 5898 | cmd->scan_noise_floor_ref = __cpu_to_le32(arg->scan_noise_floor_ref); |
| 5899 | cmd->scan_init_delay = __cpu_to_le32(arg->scan_init_delay); |
| 5900 | cmd->scan_nb_tone_thr = __cpu_to_le32(arg->scan_nb_tone_thr); |
| 5901 | cmd->scan_str_bin_thr = __cpu_to_le32(arg->scan_str_bin_thr); |
| 5902 | cmd->scan_wb_rpt_mode = __cpu_to_le32(arg->scan_wb_rpt_mode); |
| 5903 | cmd->scan_rssi_rpt_mode = __cpu_to_le32(arg->scan_rssi_rpt_mode); |
| 5904 | cmd->scan_rssi_thr = __cpu_to_le32(arg->scan_rssi_thr); |
| 5905 | cmd->scan_pwr_format = __cpu_to_le32(arg->scan_pwr_format); |
| 5906 | cmd->scan_rpt_mode = __cpu_to_le32(arg->scan_rpt_mode); |
| 5907 | cmd->scan_bin_scale = __cpu_to_le32(arg->scan_bin_scale); |
| 5908 | cmd->scan_dbm_adj = __cpu_to_le32(arg->scan_dbm_adj); |
| 5909 | cmd->scan_chn_mask = __cpu_to_le32(arg->scan_chn_mask); |
| 5910 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5911 | return skb; |
Simon Wunderlich | 855aed1 | 2014-08-02 09:12:54 +0300 | [diff] [blame] | 5912 | } |
| 5913 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5914 | static struct sk_buff * |
| 5915 | ath10k_wmi_op_gen_vdev_spectral_enable(struct ath10k *ar, u32 vdev_id, |
| 5916 | u32 trigger, u32 enable) |
Simon Wunderlich | 855aed1 | 2014-08-02 09:12:54 +0300 | [diff] [blame] | 5917 | { |
| 5918 | struct wmi_vdev_spectral_enable_cmd *cmd; |
| 5919 | struct sk_buff *skb; |
Simon Wunderlich | 855aed1 | 2014-08-02 09:12:54 +0300 | [diff] [blame] | 5920 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5921 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Simon Wunderlich | 855aed1 | 2014-08-02 09:12:54 +0300 | [diff] [blame] | 5922 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5923 | return ERR_PTR(-ENOMEM); |
Simon Wunderlich | 855aed1 | 2014-08-02 09:12:54 +0300 | [diff] [blame] | 5924 | |
| 5925 | cmd = (struct wmi_vdev_spectral_enable_cmd *)skb->data; |
| 5926 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
| 5927 | cmd->trigger_cmd = __cpu_to_le32(trigger); |
| 5928 | cmd->enable_cmd = __cpu_to_le32(enable); |
| 5929 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5930 | return skb; |
Simon Wunderlich | 855aed1 | 2014-08-02 09:12:54 +0300 | [diff] [blame] | 5931 | } |
| 5932 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5933 | static struct sk_buff * |
| 5934 | ath10k_wmi_op_gen_peer_create(struct ath10k *ar, u32 vdev_id, |
Marek Puzyniak | 7390ed3 | 2015-03-30 09:51:52 +0300 | [diff] [blame] | 5935 | const u8 peer_addr[ETH_ALEN], |
| 5936 | enum wmi_peer_type peer_type) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5937 | { |
| 5938 | struct wmi_peer_create_cmd *cmd; |
| 5939 | struct sk_buff *skb; |
| 5940 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5941 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5942 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5943 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5944 | |
| 5945 | cmd = (struct wmi_peer_create_cmd *)skb->data; |
| 5946 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
Kalle Valo | b25f32c | 2014-09-14 12:50:49 +0300 | [diff] [blame] | 5947 | ether_addr_copy(cmd->peer_macaddr.addr, peer_addr); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5948 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5949 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5950 | "wmi peer create vdev_id %d peer_addr %pM\n", |
| 5951 | vdev_id, peer_addr); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5952 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5953 | } |
| 5954 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5955 | static struct sk_buff * |
| 5956 | ath10k_wmi_op_gen_peer_delete(struct ath10k *ar, u32 vdev_id, |
| 5957 | const u8 peer_addr[ETH_ALEN]) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5958 | { |
| 5959 | struct wmi_peer_delete_cmd *cmd; |
| 5960 | struct sk_buff *skb; |
| 5961 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5962 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5963 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5964 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5965 | |
| 5966 | cmd = (struct wmi_peer_delete_cmd *)skb->data; |
| 5967 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
Kalle Valo | b25f32c | 2014-09-14 12:50:49 +0300 | [diff] [blame] | 5968 | ether_addr_copy(cmd->peer_macaddr.addr, peer_addr); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5969 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5970 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5971 | "wmi peer delete vdev_id %d peer_addr %pM\n", |
| 5972 | vdev_id, peer_addr); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5973 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5974 | } |
| 5975 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5976 | static struct sk_buff * |
| 5977 | ath10k_wmi_op_gen_peer_flush(struct ath10k *ar, u32 vdev_id, |
| 5978 | const u8 peer_addr[ETH_ALEN], u32 tid_bitmap) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5979 | { |
| 5980 | struct wmi_peer_flush_tids_cmd *cmd; |
| 5981 | struct sk_buff *skb; |
| 5982 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5983 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5984 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5985 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5986 | |
| 5987 | cmd = (struct wmi_peer_flush_tids_cmd *)skb->data; |
| 5988 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
| 5989 | cmd->peer_tid_bitmap = __cpu_to_le32(tid_bitmap); |
Kalle Valo | b25f32c | 2014-09-14 12:50:49 +0300 | [diff] [blame] | 5990 | ether_addr_copy(cmd->peer_macaddr.addr, peer_addr); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5991 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 5992 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5993 | "wmi peer flush vdev_id %d peer_addr %pM tids %08x\n", |
| 5994 | vdev_id, peer_addr, tid_bitmap); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5995 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 5996 | } |
| 5997 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 5998 | static struct sk_buff * |
| 5999 | ath10k_wmi_op_gen_peer_set_param(struct ath10k *ar, u32 vdev_id, |
| 6000 | const u8 *peer_addr, |
| 6001 | enum wmi_peer_param param_id, |
| 6002 | u32 param_value) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6003 | { |
| 6004 | struct wmi_peer_set_param_cmd *cmd; |
| 6005 | struct sk_buff *skb; |
| 6006 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 6007 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6008 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6009 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6010 | |
| 6011 | cmd = (struct wmi_peer_set_param_cmd *)skb->data; |
| 6012 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
| 6013 | cmd->param_id = __cpu_to_le32(param_id); |
| 6014 | cmd->param_value = __cpu_to_le32(param_value); |
Kalle Valo | b25f32c | 2014-09-14 12:50:49 +0300 | [diff] [blame] | 6015 | ether_addr_copy(cmd->peer_macaddr.addr, peer_addr); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6016 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 6017 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6018 | "wmi vdev %d peer 0x%pM set param %d value %d\n", |
| 6019 | vdev_id, peer_addr, param_id, param_value); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6020 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6021 | } |
| 6022 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6023 | static struct sk_buff * |
| 6024 | ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id, |
| 6025 | enum wmi_sta_ps_mode psmode) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6026 | { |
| 6027 | struct wmi_sta_powersave_mode_cmd *cmd; |
| 6028 | struct sk_buff *skb; |
| 6029 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 6030 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6031 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6032 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6033 | |
| 6034 | cmd = (struct wmi_sta_powersave_mode_cmd *)skb->data; |
| 6035 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
| 6036 | cmd->sta_ps_mode = __cpu_to_le32(psmode); |
| 6037 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 6038 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6039 | "wmi set powersave id 0x%x mode %d\n", |
| 6040 | vdev_id, psmode); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6041 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6042 | } |
| 6043 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6044 | static struct sk_buff * |
| 6045 | ath10k_wmi_op_gen_set_sta_ps(struct ath10k *ar, u32 vdev_id, |
| 6046 | enum wmi_sta_powersave_param param_id, |
| 6047 | u32 value) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6048 | { |
| 6049 | struct wmi_sta_powersave_param_cmd *cmd; |
| 6050 | struct sk_buff *skb; |
| 6051 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 6052 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6053 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6054 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6055 | |
| 6056 | cmd = (struct wmi_sta_powersave_param_cmd *)skb->data; |
| 6057 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
| 6058 | cmd->param_id = __cpu_to_le32(param_id); |
| 6059 | cmd->param_value = __cpu_to_le32(value); |
| 6060 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 6061 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6062 | "wmi sta ps param vdev_id 0x%x param %d value %d\n", |
| 6063 | vdev_id, param_id, value); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6064 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6065 | } |
| 6066 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6067 | static struct sk_buff * |
| 6068 | ath10k_wmi_op_gen_set_ap_ps(struct ath10k *ar, u32 vdev_id, const u8 *mac, |
| 6069 | enum wmi_ap_ps_peer_param param_id, u32 value) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6070 | { |
| 6071 | struct wmi_ap_ps_peer_cmd *cmd; |
| 6072 | struct sk_buff *skb; |
| 6073 | |
| 6074 | if (!mac) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6075 | return ERR_PTR(-EINVAL); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6076 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 6077 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6078 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6079 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6080 | |
| 6081 | cmd = (struct wmi_ap_ps_peer_cmd *)skb->data; |
| 6082 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
| 6083 | cmd->param_id = __cpu_to_le32(param_id); |
| 6084 | cmd->param_value = __cpu_to_le32(value); |
Kalle Valo | b25f32c | 2014-09-14 12:50:49 +0300 | [diff] [blame] | 6085 | ether_addr_copy(cmd->peer_macaddr.addr, mac); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6086 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 6087 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6088 | "wmi ap ps param vdev_id 0x%X param %d value %d mac_addr %pM\n", |
| 6089 | vdev_id, param_id, value, mac); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6090 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6091 | } |
| 6092 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6093 | static struct sk_buff * |
| 6094 | ath10k_wmi_op_gen_scan_chan_list(struct ath10k *ar, |
| 6095 | const struct wmi_scan_chan_list_arg *arg) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6096 | { |
| 6097 | struct wmi_scan_chan_list_cmd *cmd; |
| 6098 | struct sk_buff *skb; |
| 6099 | struct wmi_channel_arg *ch; |
| 6100 | struct wmi_channel *ci; |
| 6101 | int len; |
| 6102 | int i; |
| 6103 | |
| 6104 | len = sizeof(*cmd) + arg->n_channels * sizeof(struct wmi_channel); |
| 6105 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 6106 | skb = ath10k_wmi_alloc_skb(ar, len); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6107 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6108 | return ERR_PTR(-EINVAL); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6109 | |
| 6110 | cmd = (struct wmi_scan_chan_list_cmd *)skb->data; |
| 6111 | cmd->num_scan_chans = __cpu_to_le32(arg->n_channels); |
| 6112 | |
| 6113 | for (i = 0; i < arg->n_channels; i++) { |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6114 | ch = &arg->channels[i]; |
| 6115 | ci = &cmd->chan_info[i]; |
| 6116 | |
Michal Kazior | 2d66721 | 2014-09-18 15:21:21 +0200 | [diff] [blame] | 6117 | ath10k_wmi_put_wmi_channel(ci, ch); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6118 | } |
| 6119 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6120 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6121 | } |
| 6122 | |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 6123 | static void |
| 6124 | ath10k_wmi_peer_assoc_fill(struct ath10k *ar, void *buf, |
| 6125 | const struct wmi_peer_assoc_complete_arg *arg) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6126 | { |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 6127 | struct wmi_common_peer_assoc_complete_cmd *cmd = buf; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6128 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6129 | cmd->vdev_id = __cpu_to_le32(arg->vdev_id); |
| 6130 | cmd->peer_new_assoc = __cpu_to_le32(arg->peer_reassoc ? 0 : 1); |
| 6131 | cmd->peer_associd = __cpu_to_le32(arg->peer_aid); |
| 6132 | cmd->peer_flags = __cpu_to_le32(arg->peer_flags); |
| 6133 | cmd->peer_caps = __cpu_to_le32(arg->peer_caps); |
| 6134 | cmd->peer_listen_intval = __cpu_to_le32(arg->peer_listen_intval); |
| 6135 | cmd->peer_ht_caps = __cpu_to_le32(arg->peer_ht_caps); |
| 6136 | cmd->peer_max_mpdu = __cpu_to_le32(arg->peer_max_mpdu); |
| 6137 | cmd->peer_mpdu_density = __cpu_to_le32(arg->peer_mpdu_density); |
| 6138 | cmd->peer_rate_caps = __cpu_to_le32(arg->peer_rate_caps); |
| 6139 | cmd->peer_nss = __cpu_to_le32(arg->peer_num_spatial_streams); |
| 6140 | cmd->peer_vht_caps = __cpu_to_le32(arg->peer_vht_caps); |
| 6141 | cmd->peer_phymode = __cpu_to_le32(arg->peer_phymode); |
| 6142 | |
Kalle Valo | b25f32c | 2014-09-14 12:50:49 +0300 | [diff] [blame] | 6143 | ether_addr_copy(cmd->peer_macaddr.addr, arg->addr); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6144 | |
| 6145 | cmd->peer_legacy_rates.num_rates = |
| 6146 | __cpu_to_le32(arg->peer_legacy_rates.num_rates); |
| 6147 | memcpy(cmd->peer_legacy_rates.rates, arg->peer_legacy_rates.rates, |
| 6148 | arg->peer_legacy_rates.num_rates); |
| 6149 | |
| 6150 | cmd->peer_ht_rates.num_rates = |
| 6151 | __cpu_to_le32(arg->peer_ht_rates.num_rates); |
| 6152 | memcpy(cmd->peer_ht_rates.rates, arg->peer_ht_rates.rates, |
| 6153 | arg->peer_ht_rates.num_rates); |
| 6154 | |
| 6155 | cmd->peer_vht_rates.rx_max_rate = |
| 6156 | __cpu_to_le32(arg->peer_vht_rates.rx_max_rate); |
| 6157 | cmd->peer_vht_rates.rx_mcs_set = |
| 6158 | __cpu_to_le32(arg->peer_vht_rates.rx_mcs_set); |
| 6159 | cmd->peer_vht_rates.tx_max_rate = |
| 6160 | __cpu_to_le32(arg->peer_vht_rates.tx_max_rate); |
| 6161 | cmd->peer_vht_rates.tx_mcs_set = |
| 6162 | __cpu_to_le32(arg->peer_vht_rates.tx_mcs_set); |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 6163 | } |
| 6164 | |
| 6165 | static void |
| 6166 | ath10k_wmi_peer_assoc_fill_main(struct ath10k *ar, void *buf, |
| 6167 | const struct wmi_peer_assoc_complete_arg *arg) |
| 6168 | { |
| 6169 | struct wmi_main_peer_assoc_complete_cmd *cmd = buf; |
| 6170 | |
| 6171 | ath10k_wmi_peer_assoc_fill(ar, buf, arg); |
| 6172 | memset(cmd->peer_ht_info, 0, sizeof(cmd->peer_ht_info)); |
| 6173 | } |
| 6174 | |
| 6175 | static void |
| 6176 | ath10k_wmi_peer_assoc_fill_10_1(struct ath10k *ar, void *buf, |
| 6177 | const struct wmi_peer_assoc_complete_arg *arg) |
| 6178 | { |
| 6179 | ath10k_wmi_peer_assoc_fill(ar, buf, arg); |
| 6180 | } |
| 6181 | |
| 6182 | static void |
| 6183 | ath10k_wmi_peer_assoc_fill_10_2(struct ath10k *ar, void *buf, |
| 6184 | const struct wmi_peer_assoc_complete_arg *arg) |
| 6185 | { |
| 6186 | struct wmi_10_2_peer_assoc_complete_cmd *cmd = buf; |
| 6187 | int max_mcs, max_nss; |
| 6188 | u32 info0; |
| 6189 | |
| 6190 | /* TODO: Is using max values okay with firmware? */ |
| 6191 | max_mcs = 0xf; |
| 6192 | max_nss = 0xf; |
| 6193 | |
| 6194 | info0 = SM(max_mcs, WMI_PEER_ASSOC_INFO0_MAX_MCS_IDX) | |
| 6195 | SM(max_nss, WMI_PEER_ASSOC_INFO0_MAX_NSS); |
| 6196 | |
| 6197 | ath10k_wmi_peer_assoc_fill(ar, buf, arg); |
| 6198 | cmd->info0 = __cpu_to_le32(info0); |
| 6199 | } |
| 6200 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6201 | static int |
| 6202 | ath10k_wmi_peer_assoc_check_arg(const struct wmi_peer_assoc_complete_arg *arg) |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 6203 | { |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 6204 | if (arg->peer_mpdu_density > 16) |
| 6205 | return -EINVAL; |
| 6206 | if (arg->peer_legacy_rates.num_rates > MAX_SUPPORTED_RATES) |
| 6207 | return -EINVAL; |
| 6208 | if (arg->peer_ht_rates.num_rates > MAX_SUPPORTED_RATES) |
| 6209 | return -EINVAL; |
| 6210 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6211 | return 0; |
| 6212 | } |
| 6213 | |
| 6214 | static struct sk_buff * |
| 6215 | ath10k_wmi_op_gen_peer_assoc(struct ath10k *ar, |
| 6216 | const struct wmi_peer_assoc_complete_arg *arg) |
| 6217 | { |
| 6218 | size_t len = sizeof(struct wmi_main_peer_assoc_complete_cmd); |
| 6219 | struct sk_buff *skb; |
| 6220 | int ret; |
| 6221 | |
| 6222 | ret = ath10k_wmi_peer_assoc_check_arg(arg); |
| 6223 | if (ret) |
| 6224 | return ERR_PTR(ret); |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 6225 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 6226 | skb = ath10k_wmi_alloc_skb(ar, len); |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 6227 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6228 | return ERR_PTR(-ENOMEM); |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 6229 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6230 | ath10k_wmi_peer_assoc_fill_main(ar, skb->data, arg); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6231 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 6232 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Chun-Yeow Yeoh | 44d6fa9 | 2014-03-07 10:19:30 +0200 | [diff] [blame] | 6233 | "wmi peer assoc vdev %d addr %pM (%s)\n", |
| 6234 | arg->vdev_id, arg->addr, |
| 6235 | arg->peer_reassoc ? "reassociate" : "new"); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6236 | return skb; |
| 6237 | } |
| 6238 | |
| 6239 | static struct sk_buff * |
| 6240 | ath10k_wmi_10_1_op_gen_peer_assoc(struct ath10k *ar, |
| 6241 | const struct wmi_peer_assoc_complete_arg *arg) |
| 6242 | { |
| 6243 | size_t len = sizeof(struct wmi_10_1_peer_assoc_complete_cmd); |
| 6244 | struct sk_buff *skb; |
| 6245 | int ret; |
| 6246 | |
| 6247 | ret = ath10k_wmi_peer_assoc_check_arg(arg); |
| 6248 | if (ret) |
| 6249 | return ERR_PTR(ret); |
| 6250 | |
| 6251 | skb = ath10k_wmi_alloc_skb(ar, len); |
| 6252 | if (!skb) |
| 6253 | return ERR_PTR(-ENOMEM); |
| 6254 | |
| 6255 | ath10k_wmi_peer_assoc_fill_10_1(ar, skb->data, arg); |
| 6256 | |
| 6257 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
| 6258 | "wmi peer assoc vdev %d addr %pM (%s)\n", |
| 6259 | arg->vdev_id, arg->addr, |
| 6260 | arg->peer_reassoc ? "reassociate" : "new"); |
| 6261 | return skb; |
| 6262 | } |
| 6263 | |
| 6264 | static struct sk_buff * |
| 6265 | ath10k_wmi_10_2_op_gen_peer_assoc(struct ath10k *ar, |
| 6266 | const struct wmi_peer_assoc_complete_arg *arg) |
| 6267 | { |
| 6268 | size_t len = sizeof(struct wmi_10_2_peer_assoc_complete_cmd); |
| 6269 | struct sk_buff *skb; |
| 6270 | int ret; |
| 6271 | |
| 6272 | ret = ath10k_wmi_peer_assoc_check_arg(arg); |
| 6273 | if (ret) |
| 6274 | return ERR_PTR(ret); |
| 6275 | |
| 6276 | skb = ath10k_wmi_alloc_skb(ar, len); |
| 6277 | if (!skb) |
| 6278 | return ERR_PTR(-ENOMEM); |
| 6279 | |
| 6280 | ath10k_wmi_peer_assoc_fill_10_2(ar, skb->data, arg); |
| 6281 | |
| 6282 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
| 6283 | "wmi peer assoc vdev %d addr %pM (%s)\n", |
| 6284 | arg->vdev_id, arg->addr, |
| 6285 | arg->peer_reassoc ? "reassociate" : "new"); |
| 6286 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6287 | } |
| 6288 | |
Rajkumar Manoharan | a57a6a2 | 2014-12-17 12:22:17 +0200 | [diff] [blame] | 6289 | static struct sk_buff * |
| 6290 | ath10k_wmi_10_2_op_gen_pdev_get_temperature(struct ath10k *ar) |
| 6291 | { |
| 6292 | struct sk_buff *skb; |
| 6293 | |
| 6294 | skb = ath10k_wmi_alloc_skb(ar, 0); |
| 6295 | if (!skb) |
| 6296 | return ERR_PTR(-ENOMEM); |
| 6297 | |
| 6298 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi pdev get temperature\n"); |
| 6299 | return skb; |
| 6300 | } |
| 6301 | |
Michal Kazior | 748afc4 | 2014-01-23 12:48:21 +0100 | [diff] [blame] | 6302 | /* This function assumes the beacon is already DMA mapped */ |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6303 | static struct sk_buff * |
Michal Kazior | 9ad5018 | 2015-01-29 14:29:47 +0200 | [diff] [blame] | 6304 | ath10k_wmi_op_gen_beacon_dma(struct ath10k *ar, u32 vdev_id, const void *bcn, |
| 6305 | size_t bcn_len, u32 bcn_paddr, bool dtim_zero, |
| 6306 | bool deliver_cab) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6307 | { |
Michal Kazior | 748afc4 | 2014-01-23 12:48:21 +0100 | [diff] [blame] | 6308 | struct wmi_bcn_tx_ref_cmd *cmd; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6309 | struct sk_buff *skb; |
Michal Kazior | 748afc4 | 2014-01-23 12:48:21 +0100 | [diff] [blame] | 6310 | struct ieee80211_hdr *hdr; |
Michal Kazior | 748afc4 | 2014-01-23 12:48:21 +0100 | [diff] [blame] | 6311 | u16 fc; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6312 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 6313 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6314 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6315 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6316 | |
Michal Kazior | 9ad5018 | 2015-01-29 14:29:47 +0200 | [diff] [blame] | 6317 | hdr = (struct ieee80211_hdr *)bcn; |
Michal Kazior | 748afc4 | 2014-01-23 12:48:21 +0100 | [diff] [blame] | 6318 | fc = le16_to_cpu(hdr->frame_control); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6319 | |
Michal Kazior | 748afc4 | 2014-01-23 12:48:21 +0100 | [diff] [blame] | 6320 | cmd = (struct wmi_bcn_tx_ref_cmd *)skb->data; |
Michal Kazior | 9ad5018 | 2015-01-29 14:29:47 +0200 | [diff] [blame] | 6321 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
| 6322 | cmd->data_len = __cpu_to_le32(bcn_len); |
| 6323 | cmd->data_ptr = __cpu_to_le32(bcn_paddr); |
Michal Kazior | 748afc4 | 2014-01-23 12:48:21 +0100 | [diff] [blame] | 6324 | cmd->msdu_id = 0; |
| 6325 | cmd->frame_control = __cpu_to_le32(fc); |
| 6326 | cmd->flags = 0; |
Michal Kazior | 24c88f7 | 2014-07-25 13:32:17 +0200 | [diff] [blame] | 6327 | cmd->antenna_mask = __cpu_to_le32(WMI_BCN_TX_REF_DEF_ANTENNA); |
Michal Kazior | 748afc4 | 2014-01-23 12:48:21 +0100 | [diff] [blame] | 6328 | |
Michal Kazior | 9ad5018 | 2015-01-29 14:29:47 +0200 | [diff] [blame] | 6329 | if (dtim_zero) |
Michal Kazior | 748afc4 | 2014-01-23 12:48:21 +0100 | [diff] [blame] | 6330 | cmd->flags |= __cpu_to_le32(WMI_BCN_TX_REF_FLAG_DTIM_ZERO); |
| 6331 | |
Michal Kazior | 9ad5018 | 2015-01-29 14:29:47 +0200 | [diff] [blame] | 6332 | if (deliver_cab) |
Michal Kazior | 748afc4 | 2014-01-23 12:48:21 +0100 | [diff] [blame] | 6333 | cmd->flags |= __cpu_to_le32(WMI_BCN_TX_REF_FLAG_DELIVER_CAB); |
| 6334 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6335 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6336 | } |
| 6337 | |
Michal Kazior | 5e752e4 | 2015-01-19 09:53:41 +0100 | [diff] [blame] | 6338 | void ath10k_wmi_set_wmm_param(struct wmi_wmm_params *params, |
| 6339 | const struct wmi_wmm_params_arg *arg) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6340 | { |
| 6341 | params->cwmin = __cpu_to_le32(arg->cwmin); |
| 6342 | params->cwmax = __cpu_to_le32(arg->cwmax); |
| 6343 | params->aifs = __cpu_to_le32(arg->aifs); |
| 6344 | params->txop = __cpu_to_le32(arg->txop); |
| 6345 | params->acm = __cpu_to_le32(arg->acm); |
| 6346 | params->no_ack = __cpu_to_le32(arg->no_ack); |
| 6347 | } |
| 6348 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6349 | static struct sk_buff * |
| 6350 | ath10k_wmi_op_gen_pdev_set_wmm(struct ath10k *ar, |
Michal Kazior | 5e752e4 | 2015-01-19 09:53:41 +0100 | [diff] [blame] | 6351 | const struct wmi_wmm_params_all_arg *arg) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6352 | { |
| 6353 | struct wmi_pdev_set_wmm_params *cmd; |
| 6354 | struct sk_buff *skb; |
| 6355 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 6356 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6357 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6358 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6359 | |
| 6360 | cmd = (struct wmi_pdev_set_wmm_params *)skb->data; |
Michal Kazior | 5e752e4 | 2015-01-19 09:53:41 +0100 | [diff] [blame] | 6361 | ath10k_wmi_set_wmm_param(&cmd->ac_be, &arg->ac_be); |
| 6362 | ath10k_wmi_set_wmm_param(&cmd->ac_bk, &arg->ac_bk); |
| 6363 | ath10k_wmi_set_wmm_param(&cmd->ac_vi, &arg->ac_vi); |
| 6364 | ath10k_wmi_set_wmm_param(&cmd->ac_vo, &arg->ac_vo); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6365 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 6366 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi pdev set wmm params\n"); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6367 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6368 | } |
| 6369 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6370 | static struct sk_buff * |
Michal Kazior | de23d3e | 2015-02-15 16:50:41 +0200 | [diff] [blame] | 6371 | ath10k_wmi_op_gen_request_stats(struct ath10k *ar, u32 stats_mask) |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6372 | { |
| 6373 | struct wmi_request_stats_cmd *cmd; |
| 6374 | struct sk_buff *skb; |
| 6375 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 6376 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6377 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6378 | return ERR_PTR(-ENOMEM); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6379 | |
| 6380 | cmd = (struct wmi_request_stats_cmd *)skb->data; |
Michal Kazior | de23d3e | 2015-02-15 16:50:41 +0200 | [diff] [blame] | 6381 | cmd->stats_id = __cpu_to_le32(stats_mask); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6382 | |
Michal Kazior | de23d3e | 2015-02-15 16:50:41 +0200 | [diff] [blame] | 6383 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi request stats 0x%08x\n", |
| 6384 | stats_mask); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6385 | return skb; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 6386 | } |
Michal Kazior | 9cfbce7 | 2013-07-16 09:54:36 +0200 | [diff] [blame] | 6387 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6388 | static struct sk_buff * |
| 6389 | ath10k_wmi_op_gen_force_fw_hang(struct ath10k *ar, |
| 6390 | enum wmi_force_fw_hang_type type, u32 delay_ms) |
Michal Kazior | 9cfbce7 | 2013-07-16 09:54:36 +0200 | [diff] [blame] | 6391 | { |
| 6392 | struct wmi_force_fw_hang_cmd *cmd; |
| 6393 | struct sk_buff *skb; |
| 6394 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 6395 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Michal Kazior | 9cfbce7 | 2013-07-16 09:54:36 +0200 | [diff] [blame] | 6396 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6397 | return ERR_PTR(-ENOMEM); |
Michal Kazior | 9cfbce7 | 2013-07-16 09:54:36 +0200 | [diff] [blame] | 6398 | |
| 6399 | cmd = (struct wmi_force_fw_hang_cmd *)skb->data; |
| 6400 | cmd->type = __cpu_to_le32(type); |
| 6401 | cmd->delay_ms = __cpu_to_le32(delay_ms); |
| 6402 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 6403 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi force fw hang %d delay %d\n", |
Michal Kazior | 9cfbce7 | 2013-07-16 09:54:36 +0200 | [diff] [blame] | 6404 | type, delay_ms); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6405 | return skb; |
Michal Kazior | 9cfbce7 | 2013-07-16 09:54:36 +0200 | [diff] [blame] | 6406 | } |
Kalle Valo | f118a3e | 2014-01-03 12:59:31 +0200 | [diff] [blame] | 6407 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6408 | static struct sk_buff * |
SenthilKumar Jegadeesan | 467210a | 2015-01-29 14:36:52 +0530 | [diff] [blame] | 6409 | ath10k_wmi_op_gen_dbglog_cfg(struct ath10k *ar, u32 module_enable, |
| 6410 | u32 log_level) |
Kalle Valo | f118a3e | 2014-01-03 12:59:31 +0200 | [diff] [blame] | 6411 | { |
| 6412 | struct wmi_dbglog_cfg_cmd *cmd; |
| 6413 | struct sk_buff *skb; |
| 6414 | u32 cfg; |
| 6415 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 6416 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
Kalle Valo | f118a3e | 2014-01-03 12:59:31 +0200 | [diff] [blame] | 6417 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6418 | return ERR_PTR(-ENOMEM); |
Kalle Valo | f118a3e | 2014-01-03 12:59:31 +0200 | [diff] [blame] | 6419 | |
| 6420 | cmd = (struct wmi_dbglog_cfg_cmd *)skb->data; |
| 6421 | |
| 6422 | if (module_enable) { |
SenthilKumar Jegadeesan | 467210a | 2015-01-29 14:36:52 +0530 | [diff] [blame] | 6423 | cfg = SM(log_level, |
Kalle Valo | f118a3e | 2014-01-03 12:59:31 +0200 | [diff] [blame] | 6424 | ATH10K_DBGLOG_CFG_LOG_LVL); |
| 6425 | } else { |
| 6426 | /* set back defaults, all modules with WARN level */ |
| 6427 | cfg = SM(ATH10K_DBGLOG_LEVEL_WARN, |
| 6428 | ATH10K_DBGLOG_CFG_LOG_LVL); |
| 6429 | module_enable = ~0; |
| 6430 | } |
| 6431 | |
| 6432 | cmd->module_enable = __cpu_to_le32(module_enable); |
| 6433 | cmd->module_valid = __cpu_to_le32(~0); |
| 6434 | cmd->config_enable = __cpu_to_le32(cfg); |
| 6435 | cmd->config_valid = __cpu_to_le32(ATH10K_DBGLOG_CFG_LOG_LVL_MASK); |
| 6436 | |
Michal Kazior | 7aa7a72 | 2014-08-25 12:09:38 +0200 | [diff] [blame] | 6437 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
Kalle Valo | f118a3e | 2014-01-03 12:59:31 +0200 | [diff] [blame] | 6438 | "wmi dbglog cfg modules %08x %08x config %08x %08x\n", |
| 6439 | __le32_to_cpu(cmd->module_enable), |
| 6440 | __le32_to_cpu(cmd->module_valid), |
| 6441 | __le32_to_cpu(cmd->config_enable), |
| 6442 | __le32_to_cpu(cmd->config_valid)); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6443 | return skb; |
Kalle Valo | f118a3e | 2014-01-03 12:59:31 +0200 | [diff] [blame] | 6444 | } |
Michal Kazior | b79b9ba | 2014-09-18 15:21:23 +0200 | [diff] [blame] | 6445 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6446 | static struct sk_buff * |
| 6447 | ath10k_wmi_op_gen_pktlog_enable(struct ath10k *ar, u32 ev_bitmap) |
Rajkumar Manoharan | 9017445 | 2014-10-03 08:02:33 +0300 | [diff] [blame] | 6448 | { |
| 6449 | struct wmi_pdev_pktlog_enable_cmd *cmd; |
| 6450 | struct sk_buff *skb; |
| 6451 | |
| 6452 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
| 6453 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6454 | return ERR_PTR(-ENOMEM); |
Rajkumar Manoharan | 9017445 | 2014-10-03 08:02:33 +0300 | [diff] [blame] | 6455 | |
| 6456 | ev_bitmap &= ATH10K_PKTLOG_ANY; |
Rajkumar Manoharan | 9017445 | 2014-10-03 08:02:33 +0300 | [diff] [blame] | 6457 | |
| 6458 | cmd = (struct wmi_pdev_pktlog_enable_cmd *)skb->data; |
| 6459 | cmd->ev_bitmap = __cpu_to_le32(ev_bitmap); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6460 | |
| 6461 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi enable pktlog filter 0x%08x\n", |
| 6462 | ev_bitmap); |
| 6463 | return skb; |
Rajkumar Manoharan | 9017445 | 2014-10-03 08:02:33 +0300 | [diff] [blame] | 6464 | } |
| 6465 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6466 | static struct sk_buff * |
| 6467 | ath10k_wmi_op_gen_pktlog_disable(struct ath10k *ar) |
Rajkumar Manoharan | 9017445 | 2014-10-03 08:02:33 +0300 | [diff] [blame] | 6468 | { |
| 6469 | struct sk_buff *skb; |
| 6470 | |
| 6471 | skb = ath10k_wmi_alloc_skb(ar, 0); |
| 6472 | if (!skb) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6473 | return ERR_PTR(-ENOMEM); |
Rajkumar Manoharan | 9017445 | 2014-10-03 08:02:33 +0300 | [diff] [blame] | 6474 | |
| 6475 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi disable pktlog\n"); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6476 | return skb; |
Rajkumar Manoharan | 9017445 | 2014-10-03 08:02:33 +0300 | [diff] [blame] | 6477 | } |
| 6478 | |
Rajkumar Manoharan | ffdd738 | 2014-12-17 12:21:40 +0200 | [diff] [blame] | 6479 | static struct sk_buff * |
| 6480 | ath10k_wmi_op_gen_pdev_set_quiet_mode(struct ath10k *ar, u32 period, |
| 6481 | u32 duration, u32 next_offset, |
| 6482 | u32 enabled) |
| 6483 | { |
| 6484 | struct wmi_pdev_set_quiet_cmd *cmd; |
| 6485 | struct sk_buff *skb; |
| 6486 | |
| 6487 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
| 6488 | if (!skb) |
| 6489 | return ERR_PTR(-ENOMEM); |
| 6490 | |
| 6491 | cmd = (struct wmi_pdev_set_quiet_cmd *)skb->data; |
| 6492 | cmd->period = __cpu_to_le32(period); |
| 6493 | cmd->duration = __cpu_to_le32(duration); |
| 6494 | cmd->next_start = __cpu_to_le32(next_offset); |
| 6495 | cmd->enabled = __cpu_to_le32(enabled); |
| 6496 | |
| 6497 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
| 6498 | "wmi quiet param: period %u duration %u enabled %d\n", |
| 6499 | period, duration, enabled); |
| 6500 | return skb; |
| 6501 | } |
| 6502 | |
Rajkumar Manoharan | dc8ab27 | 2015-01-12 14:07:25 +0200 | [diff] [blame] | 6503 | static struct sk_buff * |
| 6504 | ath10k_wmi_op_gen_addba_clear_resp(struct ath10k *ar, u32 vdev_id, |
| 6505 | const u8 *mac) |
| 6506 | { |
| 6507 | struct wmi_addba_clear_resp_cmd *cmd; |
| 6508 | struct sk_buff *skb; |
| 6509 | |
| 6510 | if (!mac) |
| 6511 | return ERR_PTR(-EINVAL); |
| 6512 | |
| 6513 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
| 6514 | if (!skb) |
| 6515 | return ERR_PTR(-ENOMEM); |
| 6516 | |
| 6517 | cmd = (struct wmi_addba_clear_resp_cmd *)skb->data; |
| 6518 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
| 6519 | ether_addr_copy(cmd->peer_macaddr.addr, mac); |
| 6520 | |
| 6521 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
| 6522 | "wmi addba clear resp vdev_id 0x%X mac_addr %pM\n", |
| 6523 | vdev_id, mac); |
| 6524 | return skb; |
| 6525 | } |
| 6526 | |
Rajkumar Manoharan | 65c0893 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 6527 | static struct sk_buff * |
| 6528 | ath10k_wmi_op_gen_addba_send(struct ath10k *ar, u32 vdev_id, const u8 *mac, |
| 6529 | u32 tid, u32 buf_size) |
| 6530 | { |
| 6531 | struct wmi_addba_send_cmd *cmd; |
| 6532 | struct sk_buff *skb; |
| 6533 | |
| 6534 | if (!mac) |
| 6535 | return ERR_PTR(-EINVAL); |
| 6536 | |
| 6537 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
| 6538 | if (!skb) |
| 6539 | return ERR_PTR(-ENOMEM); |
| 6540 | |
| 6541 | cmd = (struct wmi_addba_send_cmd *)skb->data; |
| 6542 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
| 6543 | ether_addr_copy(cmd->peer_macaddr.addr, mac); |
| 6544 | cmd->tid = __cpu_to_le32(tid); |
| 6545 | cmd->buffersize = __cpu_to_le32(buf_size); |
| 6546 | |
| 6547 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
| 6548 | "wmi addba send vdev_id 0x%X mac_addr %pM tid %u bufsize %u\n", |
| 6549 | vdev_id, mac, tid, buf_size); |
| 6550 | return skb; |
| 6551 | } |
| 6552 | |
Rajkumar Manoharan | 1159741 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 6553 | static struct sk_buff * |
| 6554 | ath10k_wmi_op_gen_addba_set_resp(struct ath10k *ar, u32 vdev_id, const u8 *mac, |
| 6555 | u32 tid, u32 status) |
| 6556 | { |
| 6557 | struct wmi_addba_setresponse_cmd *cmd; |
| 6558 | struct sk_buff *skb; |
| 6559 | |
| 6560 | if (!mac) |
| 6561 | return ERR_PTR(-EINVAL); |
| 6562 | |
| 6563 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
| 6564 | if (!skb) |
| 6565 | return ERR_PTR(-ENOMEM); |
| 6566 | |
| 6567 | cmd = (struct wmi_addba_setresponse_cmd *)skb->data; |
| 6568 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
| 6569 | ether_addr_copy(cmd->peer_macaddr.addr, mac); |
| 6570 | cmd->tid = __cpu_to_le32(tid); |
| 6571 | cmd->statuscode = __cpu_to_le32(status); |
| 6572 | |
| 6573 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
| 6574 | "wmi addba set resp vdev_id 0x%X mac_addr %pM tid %u status %u\n", |
| 6575 | vdev_id, mac, tid, status); |
| 6576 | return skb; |
| 6577 | } |
| 6578 | |
Rajkumar Manoharan | 50abef8 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 6579 | static struct sk_buff * |
| 6580 | ath10k_wmi_op_gen_delba_send(struct ath10k *ar, u32 vdev_id, const u8 *mac, |
| 6581 | u32 tid, u32 initiator, u32 reason) |
| 6582 | { |
| 6583 | struct wmi_delba_send_cmd *cmd; |
| 6584 | struct sk_buff *skb; |
| 6585 | |
| 6586 | if (!mac) |
| 6587 | return ERR_PTR(-EINVAL); |
| 6588 | |
| 6589 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
| 6590 | if (!skb) |
| 6591 | return ERR_PTR(-ENOMEM); |
| 6592 | |
| 6593 | cmd = (struct wmi_delba_send_cmd *)skb->data; |
| 6594 | cmd->vdev_id = __cpu_to_le32(vdev_id); |
| 6595 | ether_addr_copy(cmd->peer_macaddr.addr, mac); |
| 6596 | cmd->tid = __cpu_to_le32(tid); |
| 6597 | cmd->initiator = __cpu_to_le32(initiator); |
| 6598 | cmd->reasoncode = __cpu_to_le32(reason); |
| 6599 | |
| 6600 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
| 6601 | "wmi delba send vdev_id 0x%X mac_addr %pM tid %u initiator %u reason %u\n", |
| 6602 | vdev_id, mac, tid, initiator, reason); |
| 6603 | return skb; |
| 6604 | } |
| 6605 | |
Maharaja Kennadyrajan | 2954266 | 2015-10-05 17:56:38 +0300 | [diff] [blame] | 6606 | static struct sk_buff * |
| 6607 | ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config(struct ath10k *ar, u32 param) |
| 6608 | { |
| 6609 | struct wmi_pdev_get_tpc_config_cmd *cmd; |
| 6610 | struct sk_buff *skb; |
| 6611 | |
| 6612 | skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); |
| 6613 | if (!skb) |
| 6614 | return ERR_PTR(-ENOMEM); |
| 6615 | |
| 6616 | cmd = (struct wmi_pdev_get_tpc_config_cmd *)skb->data; |
| 6617 | cmd->param = __cpu_to_le32(param); |
| 6618 | |
| 6619 | ath10k_dbg(ar, ATH10K_DBG_WMI, |
| 6620 | "wmi pdev get tcp config param:%d\n", param); |
| 6621 | return skb; |
| 6622 | } |
| 6623 | |
Manikanta Pubbisetty | bc6f9ae | 2015-10-16 15:54:52 +0300 | [diff] [blame] | 6624 | size_t ath10k_wmi_fw_stats_num_peers(struct list_head *head) |
| 6625 | { |
| 6626 | struct ath10k_fw_stats_peer *i; |
| 6627 | size_t num = 0; |
| 6628 | |
| 6629 | list_for_each_entry(i, head, list) |
| 6630 | ++num; |
| 6631 | |
| 6632 | return num; |
| 6633 | } |
| 6634 | |
| 6635 | size_t ath10k_wmi_fw_stats_num_vdevs(struct list_head *head) |
| 6636 | { |
| 6637 | struct ath10k_fw_stats_vdev *i; |
| 6638 | size_t num = 0; |
| 6639 | |
| 6640 | list_for_each_entry(i, head, list) |
| 6641 | ++num; |
| 6642 | |
| 6643 | return num; |
| 6644 | } |
| 6645 | |
| 6646 | static void |
| 6647 | ath10k_wmi_fw_pdev_base_stats_fill(const struct ath10k_fw_stats_pdev *pdev, |
| 6648 | char *buf, u32 *length) |
| 6649 | { |
| 6650 | u32 len = *length; |
| 6651 | u32 buf_len = ATH10K_FW_STATS_BUF_SIZE; |
| 6652 | |
| 6653 | len += scnprintf(buf + len, buf_len - len, "\n"); |
| 6654 | len += scnprintf(buf + len, buf_len - len, "%30s\n", |
| 6655 | "ath10k PDEV stats"); |
| 6656 | len += scnprintf(buf + len, buf_len - len, "%30s\n\n", |
| 6657 | "================="); |
| 6658 | |
| 6659 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6660 | "Channel noise floor", pdev->ch_noise_floor); |
| 6661 | len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", |
| 6662 | "Channel TX power", pdev->chan_tx_power); |
| 6663 | len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", |
| 6664 | "TX frame count", pdev->tx_frame_count); |
| 6665 | len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", |
| 6666 | "RX frame count", pdev->rx_frame_count); |
| 6667 | len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", |
| 6668 | "RX clear count", pdev->rx_clear_count); |
| 6669 | len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", |
| 6670 | "Cycle count", pdev->cycle_count); |
| 6671 | len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", |
| 6672 | "PHY error count", pdev->phy_err_count); |
| 6673 | |
| 6674 | *length = len; |
| 6675 | } |
| 6676 | |
| 6677 | static void |
| 6678 | ath10k_wmi_fw_pdev_extra_stats_fill(const struct ath10k_fw_stats_pdev *pdev, |
| 6679 | char *buf, u32 *length) |
| 6680 | { |
| 6681 | u32 len = *length; |
| 6682 | u32 buf_len = ATH10K_FW_STATS_BUF_SIZE; |
| 6683 | |
| 6684 | len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", |
| 6685 | "RTS bad count", pdev->rts_bad); |
| 6686 | len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", |
| 6687 | "RTS good count", pdev->rts_good); |
| 6688 | len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", |
| 6689 | "FCS bad count", pdev->fcs_bad); |
| 6690 | len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", |
| 6691 | "No beacon count", pdev->no_beacons); |
| 6692 | len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", |
| 6693 | "MIB int count", pdev->mib_int_count); |
| 6694 | |
| 6695 | len += scnprintf(buf + len, buf_len - len, "\n"); |
| 6696 | *length = len; |
| 6697 | } |
| 6698 | |
| 6699 | static void |
| 6700 | ath10k_wmi_fw_pdev_tx_stats_fill(const struct ath10k_fw_stats_pdev *pdev, |
| 6701 | char *buf, u32 *length) |
| 6702 | { |
| 6703 | u32 len = *length; |
| 6704 | u32 buf_len = ATH10K_FW_STATS_BUF_SIZE; |
| 6705 | |
| 6706 | len += scnprintf(buf + len, buf_len - len, "\n%30s\n", |
| 6707 | "ath10k PDEV TX stats"); |
| 6708 | len += scnprintf(buf + len, buf_len - len, "%30s\n\n", |
| 6709 | "================="); |
| 6710 | |
| 6711 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6712 | "HTT cookies queued", pdev->comp_queued); |
| 6713 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6714 | "HTT cookies disp.", pdev->comp_delivered); |
| 6715 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6716 | "MSDU queued", pdev->msdu_enqued); |
| 6717 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6718 | "MPDU queued", pdev->mpdu_enqued); |
| 6719 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6720 | "MSDUs dropped", pdev->wmm_drop); |
| 6721 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6722 | "Local enqued", pdev->local_enqued); |
| 6723 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6724 | "Local freed", pdev->local_freed); |
| 6725 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6726 | "HW queued", pdev->hw_queued); |
| 6727 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6728 | "PPDUs reaped", pdev->hw_reaped); |
| 6729 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6730 | "Num underruns", pdev->underrun); |
| 6731 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6732 | "PPDUs cleaned", pdev->tx_abort); |
| 6733 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6734 | "MPDUs requed", pdev->mpdus_requed); |
| 6735 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6736 | "Excessive retries", pdev->tx_ko); |
| 6737 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6738 | "HW rate", pdev->data_rc); |
| 6739 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6740 | "Sched self tiggers", pdev->self_triggers); |
| 6741 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6742 | "Dropped due to SW retries", |
| 6743 | pdev->sw_retry_failure); |
| 6744 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6745 | "Illegal rate phy errors", |
| 6746 | pdev->illgl_rate_phy_err); |
| 6747 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6748 | "Pdev continuous xretry", pdev->pdev_cont_xretry); |
| 6749 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6750 | "TX timeout", pdev->pdev_tx_timeout); |
| 6751 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6752 | "PDEV resets", pdev->pdev_resets); |
| 6753 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6754 | "PHY underrun", pdev->phy_underrun); |
| 6755 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6756 | "MPDU is more than txop limit", pdev->txop_ovf); |
| 6757 | *length = len; |
| 6758 | } |
| 6759 | |
| 6760 | static void |
| 6761 | ath10k_wmi_fw_pdev_rx_stats_fill(const struct ath10k_fw_stats_pdev *pdev, |
| 6762 | char *buf, u32 *length) |
| 6763 | { |
| 6764 | u32 len = *length; |
| 6765 | u32 buf_len = ATH10K_FW_STATS_BUF_SIZE; |
| 6766 | |
| 6767 | len += scnprintf(buf + len, buf_len - len, "\n%30s\n", |
| 6768 | "ath10k PDEV RX stats"); |
| 6769 | len += scnprintf(buf + len, buf_len - len, "%30s\n\n", |
| 6770 | "================="); |
| 6771 | |
| 6772 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6773 | "Mid PPDU route change", |
| 6774 | pdev->mid_ppdu_route_change); |
| 6775 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6776 | "Tot. number of statuses", pdev->status_rcvd); |
| 6777 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6778 | "Extra frags on rings 0", pdev->r0_frags); |
| 6779 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6780 | "Extra frags on rings 1", pdev->r1_frags); |
| 6781 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6782 | "Extra frags on rings 2", pdev->r2_frags); |
| 6783 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6784 | "Extra frags on rings 3", pdev->r3_frags); |
| 6785 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6786 | "MSDUs delivered to HTT", pdev->htt_msdus); |
| 6787 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6788 | "MPDUs delivered to HTT", pdev->htt_mpdus); |
| 6789 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6790 | "MSDUs delivered to stack", pdev->loc_msdus); |
| 6791 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6792 | "MPDUs delivered to stack", pdev->loc_mpdus); |
| 6793 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6794 | "Oversized AMSUs", pdev->oversize_amsdu); |
| 6795 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6796 | "PHY errors", pdev->phy_errs); |
| 6797 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6798 | "PHY errors drops", pdev->phy_err_drop); |
| 6799 | len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", |
| 6800 | "MPDU errors (FCS, MIC, ENC)", pdev->mpdu_errs); |
| 6801 | *length = len; |
| 6802 | } |
| 6803 | |
| 6804 | static void |
| 6805 | ath10k_wmi_fw_vdev_stats_fill(const struct ath10k_fw_stats_vdev *vdev, |
| 6806 | char *buf, u32 *length) |
| 6807 | { |
| 6808 | u32 len = *length; |
| 6809 | u32 buf_len = ATH10K_FW_STATS_BUF_SIZE; |
| 6810 | int i; |
| 6811 | |
| 6812 | len += scnprintf(buf + len, buf_len - len, "%30s %u\n", |
| 6813 | "vdev id", vdev->vdev_id); |
| 6814 | len += scnprintf(buf + len, buf_len - len, "%30s %u\n", |
| 6815 | "beacon snr", vdev->beacon_snr); |
| 6816 | len += scnprintf(buf + len, buf_len - len, "%30s %u\n", |
| 6817 | "data snr", vdev->data_snr); |
| 6818 | len += scnprintf(buf + len, buf_len - len, "%30s %u\n", |
| 6819 | "num rx frames", vdev->num_rx_frames); |
| 6820 | len += scnprintf(buf + len, buf_len - len, "%30s %u\n", |
| 6821 | "num rts fail", vdev->num_rts_fail); |
| 6822 | len += scnprintf(buf + len, buf_len - len, "%30s %u\n", |
| 6823 | "num rts success", vdev->num_rts_success); |
| 6824 | len += scnprintf(buf + len, buf_len - len, "%30s %u\n", |
| 6825 | "num rx err", vdev->num_rx_err); |
| 6826 | len += scnprintf(buf + len, buf_len - len, "%30s %u\n", |
| 6827 | "num rx discard", vdev->num_rx_discard); |
| 6828 | len += scnprintf(buf + len, buf_len - len, "%30s %u\n", |
| 6829 | "num tx not acked", vdev->num_tx_not_acked); |
| 6830 | |
| 6831 | for (i = 0 ; i < ARRAY_SIZE(vdev->num_tx_frames); i++) |
| 6832 | len += scnprintf(buf + len, buf_len - len, |
| 6833 | "%25s [%02d] %u\n", |
| 6834 | "num tx frames", i, |
| 6835 | vdev->num_tx_frames[i]); |
| 6836 | |
| 6837 | for (i = 0 ; i < ARRAY_SIZE(vdev->num_tx_frames_retries); i++) |
| 6838 | len += scnprintf(buf + len, buf_len - len, |
| 6839 | "%25s [%02d] %u\n", |
| 6840 | "num tx frames retries", i, |
| 6841 | vdev->num_tx_frames_retries[i]); |
| 6842 | |
| 6843 | for (i = 0 ; i < ARRAY_SIZE(vdev->num_tx_frames_failures); i++) |
| 6844 | len += scnprintf(buf + len, buf_len - len, |
| 6845 | "%25s [%02d] %u\n", |
| 6846 | "num tx frames failures", i, |
| 6847 | vdev->num_tx_frames_failures[i]); |
| 6848 | |
| 6849 | for (i = 0 ; i < ARRAY_SIZE(vdev->tx_rate_history); i++) |
| 6850 | len += scnprintf(buf + len, buf_len - len, |
| 6851 | "%25s [%02d] 0x%08x\n", |
| 6852 | "tx rate history", i, |
| 6853 | vdev->tx_rate_history[i]); |
| 6854 | |
| 6855 | for (i = 0 ; i < ARRAY_SIZE(vdev->beacon_rssi_history); i++) |
| 6856 | len += scnprintf(buf + len, buf_len - len, |
| 6857 | "%25s [%02d] %u\n", |
| 6858 | "beacon rssi history", i, |
| 6859 | vdev->beacon_rssi_history[i]); |
| 6860 | |
| 6861 | len += scnprintf(buf + len, buf_len - len, "\n"); |
| 6862 | *length = len; |
| 6863 | } |
| 6864 | |
| 6865 | static void |
| 6866 | ath10k_wmi_fw_peer_stats_fill(const struct ath10k_fw_stats_peer *peer, |
| 6867 | char *buf, u32 *length) |
| 6868 | { |
| 6869 | u32 len = *length; |
| 6870 | u32 buf_len = ATH10K_FW_STATS_BUF_SIZE; |
| 6871 | |
| 6872 | len += scnprintf(buf + len, buf_len - len, "%30s %pM\n", |
| 6873 | "Peer MAC address", peer->peer_macaddr); |
| 6874 | len += scnprintf(buf + len, buf_len - len, "%30s %u\n", |
| 6875 | "Peer RSSI", peer->peer_rssi); |
| 6876 | len += scnprintf(buf + len, buf_len - len, "%30s %u\n", |
| 6877 | "Peer TX rate", peer->peer_tx_rate); |
| 6878 | len += scnprintf(buf + len, buf_len - len, "%30s %u\n", |
| 6879 | "Peer RX rate", peer->peer_rx_rate); |
| 6880 | len += scnprintf(buf + len, buf_len - len, "\n"); |
| 6881 | *length = len; |
| 6882 | } |
| 6883 | |
| 6884 | void ath10k_wmi_main_op_fw_stats_fill(struct ath10k *ar, |
| 6885 | struct ath10k_fw_stats *fw_stats, |
| 6886 | char *buf) |
| 6887 | { |
| 6888 | u32 len = 0; |
| 6889 | u32 buf_len = ATH10K_FW_STATS_BUF_SIZE; |
| 6890 | const struct ath10k_fw_stats_pdev *pdev; |
| 6891 | const struct ath10k_fw_stats_vdev *vdev; |
| 6892 | const struct ath10k_fw_stats_peer *peer; |
| 6893 | size_t num_peers; |
| 6894 | size_t num_vdevs; |
| 6895 | |
| 6896 | spin_lock_bh(&ar->data_lock); |
| 6897 | |
| 6898 | pdev = list_first_entry_or_null(&fw_stats->pdevs, |
| 6899 | struct ath10k_fw_stats_pdev, list); |
| 6900 | if (!pdev) { |
| 6901 | ath10k_warn(ar, "failed to get pdev stats\n"); |
| 6902 | goto unlock; |
| 6903 | } |
| 6904 | |
| 6905 | num_peers = ath10k_wmi_fw_stats_num_peers(&fw_stats->peers); |
| 6906 | num_vdevs = ath10k_wmi_fw_stats_num_vdevs(&fw_stats->vdevs); |
| 6907 | |
| 6908 | ath10k_wmi_fw_pdev_base_stats_fill(pdev, buf, &len); |
| 6909 | ath10k_wmi_fw_pdev_tx_stats_fill(pdev, buf, &len); |
| 6910 | ath10k_wmi_fw_pdev_rx_stats_fill(pdev, buf, &len); |
| 6911 | |
| 6912 | len += scnprintf(buf + len, buf_len - len, "\n"); |
| 6913 | len += scnprintf(buf + len, buf_len - len, "%30s (%zu)\n", |
| 6914 | "ath10k VDEV stats", num_vdevs); |
| 6915 | len += scnprintf(buf + len, buf_len - len, "%30s\n\n", |
| 6916 | "================="); |
| 6917 | |
| 6918 | list_for_each_entry(vdev, &fw_stats->vdevs, list) { |
| 6919 | ath10k_wmi_fw_vdev_stats_fill(vdev, buf, &len); |
| 6920 | } |
| 6921 | |
| 6922 | len += scnprintf(buf + len, buf_len - len, "\n"); |
| 6923 | len += scnprintf(buf + len, buf_len - len, "%30s (%zu)\n", |
| 6924 | "ath10k PEER stats", num_peers); |
| 6925 | len += scnprintf(buf + len, buf_len - len, "%30s\n\n", |
| 6926 | "================="); |
| 6927 | |
| 6928 | list_for_each_entry(peer, &fw_stats->peers, list) { |
| 6929 | ath10k_wmi_fw_peer_stats_fill(peer, buf, &len); |
| 6930 | } |
| 6931 | |
| 6932 | unlock: |
| 6933 | spin_unlock_bh(&ar->data_lock); |
| 6934 | |
| 6935 | if (len >= buf_len) |
| 6936 | buf[len - 1] = 0; |
| 6937 | else |
| 6938 | buf[len] = 0; |
| 6939 | } |
| 6940 | |
| 6941 | void ath10k_wmi_10x_op_fw_stats_fill(struct ath10k *ar, |
| 6942 | struct ath10k_fw_stats *fw_stats, |
| 6943 | char *buf) |
| 6944 | { |
| 6945 | unsigned int len = 0; |
| 6946 | unsigned int buf_len = ATH10K_FW_STATS_BUF_SIZE; |
| 6947 | const struct ath10k_fw_stats_pdev *pdev; |
| 6948 | const struct ath10k_fw_stats_vdev *vdev; |
| 6949 | const struct ath10k_fw_stats_peer *peer; |
| 6950 | size_t num_peers; |
| 6951 | size_t num_vdevs; |
| 6952 | |
| 6953 | spin_lock_bh(&ar->data_lock); |
| 6954 | |
| 6955 | pdev = list_first_entry_or_null(&fw_stats->pdevs, |
| 6956 | struct ath10k_fw_stats_pdev, list); |
| 6957 | if (!pdev) { |
| 6958 | ath10k_warn(ar, "failed to get pdev stats\n"); |
| 6959 | goto unlock; |
| 6960 | } |
| 6961 | |
| 6962 | num_peers = ath10k_wmi_fw_stats_num_peers(&fw_stats->peers); |
| 6963 | num_vdevs = ath10k_wmi_fw_stats_num_vdevs(&fw_stats->vdevs); |
| 6964 | |
| 6965 | ath10k_wmi_fw_pdev_base_stats_fill(pdev, buf, &len); |
| 6966 | ath10k_wmi_fw_pdev_extra_stats_fill(pdev, buf, &len); |
| 6967 | ath10k_wmi_fw_pdev_tx_stats_fill(pdev, buf, &len); |
| 6968 | ath10k_wmi_fw_pdev_rx_stats_fill(pdev, buf, &len); |
| 6969 | |
| 6970 | len += scnprintf(buf + len, buf_len - len, "\n"); |
| 6971 | len += scnprintf(buf + len, buf_len - len, "%30s (%zu)\n", |
| 6972 | "ath10k VDEV stats", num_vdevs); |
| 6973 | len += scnprintf(buf + len, buf_len - len, "%30s\n\n", |
| 6974 | "================="); |
| 6975 | |
| 6976 | list_for_each_entry(vdev, &fw_stats->vdevs, list) { |
| 6977 | ath10k_wmi_fw_vdev_stats_fill(vdev, buf, &len); |
| 6978 | } |
| 6979 | |
| 6980 | len += scnprintf(buf + len, buf_len - len, "\n"); |
| 6981 | len += scnprintf(buf + len, buf_len - len, "%30s (%zu)\n", |
| 6982 | "ath10k PEER stats", num_peers); |
| 6983 | len += scnprintf(buf + len, buf_len - len, "%30s\n\n", |
| 6984 | "================="); |
| 6985 | |
| 6986 | list_for_each_entry(peer, &fw_stats->peers, list) { |
| 6987 | ath10k_wmi_fw_peer_stats_fill(peer, buf, &len); |
| 6988 | } |
| 6989 | |
| 6990 | unlock: |
| 6991 | spin_unlock_bh(&ar->data_lock); |
| 6992 | |
| 6993 | if (len >= buf_len) |
| 6994 | buf[len - 1] = 0; |
| 6995 | else |
| 6996 | buf[len] = 0; |
| 6997 | } |
| 6998 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 6999 | static const struct wmi_ops wmi_ops = { |
| 7000 | .rx = ath10k_wmi_op_rx, |
| 7001 | .map_svc = wmi_main_svc_map, |
| 7002 | |
| 7003 | .pull_scan = ath10k_wmi_op_pull_scan_ev, |
| 7004 | .pull_mgmt_rx = ath10k_wmi_op_pull_mgmt_rx_ev, |
| 7005 | .pull_ch_info = ath10k_wmi_op_pull_ch_info_ev, |
| 7006 | .pull_vdev_start = ath10k_wmi_op_pull_vdev_start_ev, |
| 7007 | .pull_peer_kick = ath10k_wmi_op_pull_peer_kick_ev, |
| 7008 | .pull_swba = ath10k_wmi_op_pull_swba_ev, |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 7009 | .pull_phyerr_hdr = ath10k_wmi_op_pull_phyerr_ev_hdr, |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7010 | .pull_phyerr = ath10k_wmi_op_pull_phyerr_ev, |
| 7011 | .pull_svc_rdy = ath10k_wmi_main_op_pull_svc_rdy_ev, |
| 7012 | .pull_rdy = ath10k_wmi_op_pull_rdy_ev, |
| 7013 | .pull_fw_stats = ath10k_wmi_main_op_pull_fw_stats, |
Michal Kazior | c1a4654 | 2015-03-10 16:21:54 +0200 | [diff] [blame] | 7014 | .pull_roam_ev = ath10k_wmi_op_pull_roam_ev, |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7015 | |
| 7016 | .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend, |
| 7017 | .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume, |
| 7018 | .gen_pdev_set_rd = ath10k_wmi_op_gen_pdev_set_rd, |
| 7019 | .gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param, |
| 7020 | .gen_init = ath10k_wmi_op_gen_init, |
| 7021 | .gen_start_scan = ath10k_wmi_op_gen_start_scan, |
| 7022 | .gen_stop_scan = ath10k_wmi_op_gen_stop_scan, |
| 7023 | .gen_vdev_create = ath10k_wmi_op_gen_vdev_create, |
| 7024 | .gen_vdev_delete = ath10k_wmi_op_gen_vdev_delete, |
| 7025 | .gen_vdev_start = ath10k_wmi_op_gen_vdev_start, |
| 7026 | .gen_vdev_stop = ath10k_wmi_op_gen_vdev_stop, |
| 7027 | .gen_vdev_up = ath10k_wmi_op_gen_vdev_up, |
| 7028 | .gen_vdev_down = ath10k_wmi_op_gen_vdev_down, |
| 7029 | .gen_vdev_set_param = ath10k_wmi_op_gen_vdev_set_param, |
| 7030 | .gen_vdev_install_key = ath10k_wmi_op_gen_vdev_install_key, |
| 7031 | .gen_vdev_spectral_conf = ath10k_wmi_op_gen_vdev_spectral_conf, |
| 7032 | .gen_vdev_spectral_enable = ath10k_wmi_op_gen_vdev_spectral_enable, |
Michal Kazior | 6d492fe | 2015-01-28 09:57:22 +0200 | [diff] [blame] | 7033 | /* .gen_vdev_wmm_conf not implemented */ |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7034 | .gen_peer_create = ath10k_wmi_op_gen_peer_create, |
| 7035 | .gen_peer_delete = ath10k_wmi_op_gen_peer_delete, |
| 7036 | .gen_peer_flush = ath10k_wmi_op_gen_peer_flush, |
| 7037 | .gen_peer_set_param = ath10k_wmi_op_gen_peer_set_param, |
| 7038 | .gen_peer_assoc = ath10k_wmi_op_gen_peer_assoc, |
| 7039 | .gen_set_psmode = ath10k_wmi_op_gen_set_psmode, |
| 7040 | .gen_set_sta_ps = ath10k_wmi_op_gen_set_sta_ps, |
| 7041 | .gen_set_ap_ps = ath10k_wmi_op_gen_set_ap_ps, |
| 7042 | .gen_scan_chan_list = ath10k_wmi_op_gen_scan_chan_list, |
| 7043 | .gen_beacon_dma = ath10k_wmi_op_gen_beacon_dma, |
| 7044 | .gen_pdev_set_wmm = ath10k_wmi_op_gen_pdev_set_wmm, |
| 7045 | .gen_request_stats = ath10k_wmi_op_gen_request_stats, |
| 7046 | .gen_force_fw_hang = ath10k_wmi_op_gen_force_fw_hang, |
| 7047 | .gen_mgmt_tx = ath10k_wmi_op_gen_mgmt_tx, |
| 7048 | .gen_dbglog_cfg = ath10k_wmi_op_gen_dbglog_cfg, |
| 7049 | .gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable, |
| 7050 | .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable, |
Rajkumar Manoharan | ffdd738 | 2014-12-17 12:21:40 +0200 | [diff] [blame] | 7051 | .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode, |
Rajkumar Manoharan | a57a6a2 | 2014-12-17 12:22:17 +0200 | [diff] [blame] | 7052 | /* .gen_pdev_get_temperature not implemented */ |
Rajkumar Manoharan | dc8ab27 | 2015-01-12 14:07:25 +0200 | [diff] [blame] | 7053 | .gen_addba_clear_resp = ath10k_wmi_op_gen_addba_clear_resp, |
Rajkumar Manoharan | 65c0893 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 7054 | .gen_addba_send = ath10k_wmi_op_gen_addba_send, |
Rajkumar Manoharan | 1159741 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 7055 | .gen_addba_set_resp = ath10k_wmi_op_gen_addba_set_resp, |
Rajkumar Manoharan | 50abef8 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 7056 | .gen_delba_send = ath10k_wmi_op_gen_delba_send, |
Manikanta Pubbisetty | bc6f9ae | 2015-10-16 15:54:52 +0300 | [diff] [blame] | 7057 | .fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill, |
Michal Kazior | be9ce9d | 2015-01-13 16:30:11 +0200 | [diff] [blame] | 7058 | /* .gen_bcn_tmpl not implemented */ |
Michal Kazior | 4c4955f | 2015-01-13 16:30:11 +0200 | [diff] [blame] | 7059 | /* .gen_prb_tmpl not implemented */ |
Michal Kazior | 369242b4e | 2015-01-13 16:30:11 +0200 | [diff] [blame] | 7060 | /* .gen_p2p_go_bcn_ie not implemented */ |
Michal Kazior | 5b272e3 | 2015-03-31 10:26:22 +0000 | [diff] [blame] | 7061 | /* .gen_adaptive_qcs not implemented */ |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7062 | }; |
| 7063 | |
| 7064 | static const struct wmi_ops wmi_10_1_ops = { |
| 7065 | .rx = ath10k_wmi_10_1_op_rx, |
| 7066 | .map_svc = wmi_10x_svc_map, |
| 7067 | .pull_svc_rdy = ath10k_wmi_10x_op_pull_svc_rdy_ev, |
| 7068 | .pull_fw_stats = ath10k_wmi_10x_op_pull_fw_stats, |
| 7069 | .gen_init = ath10k_wmi_10_1_op_gen_init, |
| 7070 | .gen_pdev_set_rd = ath10k_wmi_10x_op_gen_pdev_set_rd, |
| 7071 | .gen_start_scan = ath10k_wmi_10x_op_gen_start_scan, |
| 7072 | .gen_peer_assoc = ath10k_wmi_10_1_op_gen_peer_assoc, |
Rajkumar Manoharan | a57a6a2 | 2014-12-17 12:22:17 +0200 | [diff] [blame] | 7073 | /* .gen_pdev_get_temperature not implemented */ |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7074 | |
| 7075 | /* shared with main branch */ |
| 7076 | .pull_scan = ath10k_wmi_op_pull_scan_ev, |
| 7077 | .pull_mgmt_rx = ath10k_wmi_op_pull_mgmt_rx_ev, |
| 7078 | .pull_ch_info = ath10k_wmi_op_pull_ch_info_ev, |
| 7079 | .pull_vdev_start = ath10k_wmi_op_pull_vdev_start_ev, |
| 7080 | .pull_peer_kick = ath10k_wmi_op_pull_peer_kick_ev, |
| 7081 | .pull_swba = ath10k_wmi_op_pull_swba_ev, |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 7082 | .pull_phyerr_hdr = ath10k_wmi_op_pull_phyerr_ev_hdr, |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7083 | .pull_phyerr = ath10k_wmi_op_pull_phyerr_ev, |
| 7084 | .pull_rdy = ath10k_wmi_op_pull_rdy_ev, |
Michal Kazior | c1a4654 | 2015-03-10 16:21:54 +0200 | [diff] [blame] | 7085 | .pull_roam_ev = ath10k_wmi_op_pull_roam_ev, |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7086 | |
| 7087 | .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend, |
| 7088 | .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume, |
| 7089 | .gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param, |
| 7090 | .gen_stop_scan = ath10k_wmi_op_gen_stop_scan, |
| 7091 | .gen_vdev_create = ath10k_wmi_op_gen_vdev_create, |
| 7092 | .gen_vdev_delete = ath10k_wmi_op_gen_vdev_delete, |
| 7093 | .gen_vdev_start = ath10k_wmi_op_gen_vdev_start, |
| 7094 | .gen_vdev_stop = ath10k_wmi_op_gen_vdev_stop, |
| 7095 | .gen_vdev_up = ath10k_wmi_op_gen_vdev_up, |
| 7096 | .gen_vdev_down = ath10k_wmi_op_gen_vdev_down, |
| 7097 | .gen_vdev_set_param = ath10k_wmi_op_gen_vdev_set_param, |
| 7098 | .gen_vdev_install_key = ath10k_wmi_op_gen_vdev_install_key, |
| 7099 | .gen_vdev_spectral_conf = ath10k_wmi_op_gen_vdev_spectral_conf, |
| 7100 | .gen_vdev_spectral_enable = ath10k_wmi_op_gen_vdev_spectral_enable, |
Michal Kazior | 6d492fe | 2015-01-28 09:57:22 +0200 | [diff] [blame] | 7101 | /* .gen_vdev_wmm_conf not implemented */ |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7102 | .gen_peer_create = ath10k_wmi_op_gen_peer_create, |
| 7103 | .gen_peer_delete = ath10k_wmi_op_gen_peer_delete, |
| 7104 | .gen_peer_flush = ath10k_wmi_op_gen_peer_flush, |
| 7105 | .gen_peer_set_param = ath10k_wmi_op_gen_peer_set_param, |
| 7106 | .gen_set_psmode = ath10k_wmi_op_gen_set_psmode, |
| 7107 | .gen_set_sta_ps = ath10k_wmi_op_gen_set_sta_ps, |
| 7108 | .gen_set_ap_ps = ath10k_wmi_op_gen_set_ap_ps, |
| 7109 | .gen_scan_chan_list = ath10k_wmi_op_gen_scan_chan_list, |
| 7110 | .gen_beacon_dma = ath10k_wmi_op_gen_beacon_dma, |
| 7111 | .gen_pdev_set_wmm = ath10k_wmi_op_gen_pdev_set_wmm, |
| 7112 | .gen_request_stats = ath10k_wmi_op_gen_request_stats, |
| 7113 | .gen_force_fw_hang = ath10k_wmi_op_gen_force_fw_hang, |
| 7114 | .gen_mgmt_tx = ath10k_wmi_op_gen_mgmt_tx, |
| 7115 | .gen_dbglog_cfg = ath10k_wmi_op_gen_dbglog_cfg, |
| 7116 | .gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable, |
| 7117 | .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable, |
Rajkumar Manoharan | ffdd738 | 2014-12-17 12:21:40 +0200 | [diff] [blame] | 7118 | .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode, |
Rajkumar Manoharan | dc8ab27 | 2015-01-12 14:07:25 +0200 | [diff] [blame] | 7119 | .gen_addba_clear_resp = ath10k_wmi_op_gen_addba_clear_resp, |
Rajkumar Manoharan | 65c0893 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 7120 | .gen_addba_send = ath10k_wmi_op_gen_addba_send, |
Rajkumar Manoharan | 1159741 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 7121 | .gen_addba_set_resp = ath10k_wmi_op_gen_addba_set_resp, |
Rajkumar Manoharan | 50abef8 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 7122 | .gen_delba_send = ath10k_wmi_op_gen_delba_send, |
Manikanta Pubbisetty | bc6f9ae | 2015-10-16 15:54:52 +0300 | [diff] [blame] | 7123 | .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, |
Michal Kazior | be9ce9d | 2015-01-13 16:30:11 +0200 | [diff] [blame] | 7124 | /* .gen_bcn_tmpl not implemented */ |
Michal Kazior | 4c4955f | 2015-01-13 16:30:11 +0200 | [diff] [blame] | 7125 | /* .gen_prb_tmpl not implemented */ |
Michal Kazior | 369242b4e | 2015-01-13 16:30:11 +0200 | [diff] [blame] | 7126 | /* .gen_p2p_go_bcn_ie not implemented */ |
Michal Kazior | 5b272e3 | 2015-03-31 10:26:22 +0000 | [diff] [blame] | 7127 | /* .gen_adaptive_qcs not implemented */ |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7128 | }; |
| 7129 | |
| 7130 | static const struct wmi_ops wmi_10_2_ops = { |
| 7131 | .rx = ath10k_wmi_10_2_op_rx, |
Michal Kazior | 20de222 | 2015-01-24 12:14:49 +0200 | [diff] [blame] | 7132 | .pull_fw_stats = ath10k_wmi_10_2_op_pull_fw_stats, |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7133 | .gen_init = ath10k_wmi_10_2_op_gen_init, |
| 7134 | .gen_peer_assoc = ath10k_wmi_10_2_op_gen_peer_assoc, |
Rajkumar Manoharan | a57a6a2 | 2014-12-17 12:22:17 +0200 | [diff] [blame] | 7135 | /* .gen_pdev_get_temperature not implemented */ |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7136 | |
| 7137 | /* shared with 10.1 */ |
| 7138 | .map_svc = wmi_10x_svc_map, |
| 7139 | .pull_svc_rdy = ath10k_wmi_10x_op_pull_svc_rdy_ev, |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7140 | .gen_pdev_set_rd = ath10k_wmi_10x_op_gen_pdev_set_rd, |
| 7141 | .gen_start_scan = ath10k_wmi_10x_op_gen_start_scan, |
| 7142 | |
| 7143 | .pull_scan = ath10k_wmi_op_pull_scan_ev, |
| 7144 | .pull_mgmt_rx = ath10k_wmi_op_pull_mgmt_rx_ev, |
| 7145 | .pull_ch_info = ath10k_wmi_op_pull_ch_info_ev, |
| 7146 | .pull_vdev_start = ath10k_wmi_op_pull_vdev_start_ev, |
| 7147 | .pull_peer_kick = ath10k_wmi_op_pull_peer_kick_ev, |
| 7148 | .pull_swba = ath10k_wmi_op_pull_swba_ev, |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 7149 | .pull_phyerr_hdr = ath10k_wmi_op_pull_phyerr_ev_hdr, |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7150 | .pull_phyerr = ath10k_wmi_op_pull_phyerr_ev, |
| 7151 | .pull_rdy = ath10k_wmi_op_pull_rdy_ev, |
Michal Kazior | c1a4654 | 2015-03-10 16:21:54 +0200 | [diff] [blame] | 7152 | .pull_roam_ev = ath10k_wmi_op_pull_roam_ev, |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7153 | |
| 7154 | .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend, |
| 7155 | .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume, |
| 7156 | .gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param, |
| 7157 | .gen_stop_scan = ath10k_wmi_op_gen_stop_scan, |
| 7158 | .gen_vdev_create = ath10k_wmi_op_gen_vdev_create, |
| 7159 | .gen_vdev_delete = ath10k_wmi_op_gen_vdev_delete, |
| 7160 | .gen_vdev_start = ath10k_wmi_op_gen_vdev_start, |
| 7161 | .gen_vdev_stop = ath10k_wmi_op_gen_vdev_stop, |
| 7162 | .gen_vdev_up = ath10k_wmi_op_gen_vdev_up, |
| 7163 | .gen_vdev_down = ath10k_wmi_op_gen_vdev_down, |
| 7164 | .gen_vdev_set_param = ath10k_wmi_op_gen_vdev_set_param, |
| 7165 | .gen_vdev_install_key = ath10k_wmi_op_gen_vdev_install_key, |
| 7166 | .gen_vdev_spectral_conf = ath10k_wmi_op_gen_vdev_spectral_conf, |
| 7167 | .gen_vdev_spectral_enable = ath10k_wmi_op_gen_vdev_spectral_enable, |
Michal Kazior | 6d492fe | 2015-01-28 09:57:22 +0200 | [diff] [blame] | 7168 | /* .gen_vdev_wmm_conf not implemented */ |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7169 | .gen_peer_create = ath10k_wmi_op_gen_peer_create, |
| 7170 | .gen_peer_delete = ath10k_wmi_op_gen_peer_delete, |
| 7171 | .gen_peer_flush = ath10k_wmi_op_gen_peer_flush, |
| 7172 | .gen_peer_set_param = ath10k_wmi_op_gen_peer_set_param, |
| 7173 | .gen_set_psmode = ath10k_wmi_op_gen_set_psmode, |
| 7174 | .gen_set_sta_ps = ath10k_wmi_op_gen_set_sta_ps, |
| 7175 | .gen_set_ap_ps = ath10k_wmi_op_gen_set_ap_ps, |
| 7176 | .gen_scan_chan_list = ath10k_wmi_op_gen_scan_chan_list, |
| 7177 | .gen_beacon_dma = ath10k_wmi_op_gen_beacon_dma, |
| 7178 | .gen_pdev_set_wmm = ath10k_wmi_op_gen_pdev_set_wmm, |
| 7179 | .gen_request_stats = ath10k_wmi_op_gen_request_stats, |
| 7180 | .gen_force_fw_hang = ath10k_wmi_op_gen_force_fw_hang, |
| 7181 | .gen_mgmt_tx = ath10k_wmi_op_gen_mgmt_tx, |
| 7182 | .gen_dbglog_cfg = ath10k_wmi_op_gen_dbglog_cfg, |
| 7183 | .gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable, |
| 7184 | .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable, |
Rajkumar Manoharan | ffdd738 | 2014-12-17 12:21:40 +0200 | [diff] [blame] | 7185 | .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode, |
Rajkumar Manoharan | dc8ab27 | 2015-01-12 14:07:25 +0200 | [diff] [blame] | 7186 | .gen_addba_clear_resp = ath10k_wmi_op_gen_addba_clear_resp, |
Rajkumar Manoharan | 65c0893 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 7187 | .gen_addba_send = ath10k_wmi_op_gen_addba_send, |
Rajkumar Manoharan | 1159741 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 7188 | .gen_addba_set_resp = ath10k_wmi_op_gen_addba_set_resp, |
Rajkumar Manoharan | 50abef8 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 7189 | .gen_delba_send = ath10k_wmi_op_gen_delba_send, |
Manikanta Pubbisetty | bc6f9ae | 2015-10-16 15:54:52 +0300 | [diff] [blame] | 7190 | .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7191 | }; |
| 7192 | |
Rajkumar Manoharan | 4a16fbe | 2014-12-17 12:21:12 +0200 | [diff] [blame] | 7193 | static const struct wmi_ops wmi_10_2_4_ops = { |
| 7194 | .rx = ath10k_wmi_10_2_op_rx, |
Michal Kazior | 20de222 | 2015-01-24 12:14:49 +0200 | [diff] [blame] | 7195 | .pull_fw_stats = ath10k_wmi_10_2_4_op_pull_fw_stats, |
Rajkumar Manoharan | 4a16fbe | 2014-12-17 12:21:12 +0200 | [diff] [blame] | 7196 | .gen_init = ath10k_wmi_10_2_op_gen_init, |
| 7197 | .gen_peer_assoc = ath10k_wmi_10_2_op_gen_peer_assoc, |
Rajkumar Manoharan | a57a6a2 | 2014-12-17 12:22:17 +0200 | [diff] [blame] | 7198 | .gen_pdev_get_temperature = ath10k_wmi_10_2_op_gen_pdev_get_temperature, |
Rajkumar Manoharan | 4a16fbe | 2014-12-17 12:21:12 +0200 | [diff] [blame] | 7199 | |
| 7200 | /* shared with 10.1 */ |
| 7201 | .map_svc = wmi_10x_svc_map, |
| 7202 | .pull_svc_rdy = ath10k_wmi_10x_op_pull_svc_rdy_ev, |
Rajkumar Manoharan | 4a16fbe | 2014-12-17 12:21:12 +0200 | [diff] [blame] | 7203 | .gen_pdev_set_rd = ath10k_wmi_10x_op_gen_pdev_set_rd, |
| 7204 | .gen_start_scan = ath10k_wmi_10x_op_gen_start_scan, |
| 7205 | |
| 7206 | .pull_scan = ath10k_wmi_op_pull_scan_ev, |
| 7207 | .pull_mgmt_rx = ath10k_wmi_op_pull_mgmt_rx_ev, |
| 7208 | .pull_ch_info = ath10k_wmi_op_pull_ch_info_ev, |
| 7209 | .pull_vdev_start = ath10k_wmi_op_pull_vdev_start_ev, |
| 7210 | .pull_peer_kick = ath10k_wmi_op_pull_peer_kick_ev, |
| 7211 | .pull_swba = ath10k_wmi_op_pull_swba_ev, |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 7212 | .pull_phyerr_hdr = ath10k_wmi_op_pull_phyerr_ev_hdr, |
Rajkumar Manoharan | 4a16fbe | 2014-12-17 12:21:12 +0200 | [diff] [blame] | 7213 | .pull_phyerr = ath10k_wmi_op_pull_phyerr_ev, |
| 7214 | .pull_rdy = ath10k_wmi_op_pull_rdy_ev, |
Michal Kazior | c1a4654 | 2015-03-10 16:21:54 +0200 | [diff] [blame] | 7215 | .pull_roam_ev = ath10k_wmi_op_pull_roam_ev, |
Rajkumar Manoharan | 4a16fbe | 2014-12-17 12:21:12 +0200 | [diff] [blame] | 7216 | |
| 7217 | .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend, |
| 7218 | .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume, |
| 7219 | .gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param, |
| 7220 | .gen_stop_scan = ath10k_wmi_op_gen_stop_scan, |
| 7221 | .gen_vdev_create = ath10k_wmi_op_gen_vdev_create, |
| 7222 | .gen_vdev_delete = ath10k_wmi_op_gen_vdev_delete, |
| 7223 | .gen_vdev_start = ath10k_wmi_op_gen_vdev_start, |
| 7224 | .gen_vdev_stop = ath10k_wmi_op_gen_vdev_stop, |
| 7225 | .gen_vdev_up = ath10k_wmi_op_gen_vdev_up, |
| 7226 | .gen_vdev_down = ath10k_wmi_op_gen_vdev_down, |
| 7227 | .gen_vdev_set_param = ath10k_wmi_op_gen_vdev_set_param, |
| 7228 | .gen_vdev_install_key = ath10k_wmi_op_gen_vdev_install_key, |
| 7229 | .gen_vdev_spectral_conf = ath10k_wmi_op_gen_vdev_spectral_conf, |
| 7230 | .gen_vdev_spectral_enable = ath10k_wmi_op_gen_vdev_spectral_enable, |
| 7231 | .gen_peer_create = ath10k_wmi_op_gen_peer_create, |
| 7232 | .gen_peer_delete = ath10k_wmi_op_gen_peer_delete, |
| 7233 | .gen_peer_flush = ath10k_wmi_op_gen_peer_flush, |
| 7234 | .gen_peer_set_param = ath10k_wmi_op_gen_peer_set_param, |
| 7235 | .gen_set_psmode = ath10k_wmi_op_gen_set_psmode, |
| 7236 | .gen_set_sta_ps = ath10k_wmi_op_gen_set_sta_ps, |
| 7237 | .gen_set_ap_ps = ath10k_wmi_op_gen_set_ap_ps, |
| 7238 | .gen_scan_chan_list = ath10k_wmi_op_gen_scan_chan_list, |
| 7239 | .gen_beacon_dma = ath10k_wmi_op_gen_beacon_dma, |
| 7240 | .gen_pdev_set_wmm = ath10k_wmi_op_gen_pdev_set_wmm, |
| 7241 | .gen_request_stats = ath10k_wmi_op_gen_request_stats, |
| 7242 | .gen_force_fw_hang = ath10k_wmi_op_gen_force_fw_hang, |
| 7243 | .gen_mgmt_tx = ath10k_wmi_op_gen_mgmt_tx, |
| 7244 | .gen_dbglog_cfg = ath10k_wmi_op_gen_dbglog_cfg, |
| 7245 | .gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable, |
| 7246 | .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable, |
Rajkumar Manoharan | ffdd738 | 2014-12-17 12:21:40 +0200 | [diff] [blame] | 7247 | .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode, |
Rajkumar Manoharan | dc8ab27 | 2015-01-12 14:07:25 +0200 | [diff] [blame] | 7248 | .gen_addba_clear_resp = ath10k_wmi_op_gen_addba_clear_resp, |
Rajkumar Manoharan | 65c0893 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 7249 | .gen_addba_send = ath10k_wmi_op_gen_addba_send, |
Rajkumar Manoharan | 1159741 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 7250 | .gen_addba_set_resp = ath10k_wmi_op_gen_addba_set_resp, |
Rajkumar Manoharan | 50abef8 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 7251 | .gen_delba_send = ath10k_wmi_op_gen_delba_send, |
Maharaja Kennadyrajan | 2954266 | 2015-10-05 17:56:38 +0300 | [diff] [blame] | 7252 | .gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config, |
Manikanta Pubbisetty | bc6f9ae | 2015-10-16 15:54:52 +0300 | [diff] [blame] | 7253 | .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, |
Michal Kazior | be9ce9d | 2015-01-13 16:30:11 +0200 | [diff] [blame] | 7254 | /* .gen_bcn_tmpl not implemented */ |
Michal Kazior | 4c4955f | 2015-01-13 16:30:11 +0200 | [diff] [blame] | 7255 | /* .gen_prb_tmpl not implemented */ |
Michal Kazior | 369242b4e | 2015-01-13 16:30:11 +0200 | [diff] [blame] | 7256 | /* .gen_p2p_go_bcn_ie not implemented */ |
Michal Kazior | 5b272e3 | 2015-03-31 10:26:22 +0000 | [diff] [blame] | 7257 | /* .gen_adaptive_qcs not implemented */ |
Rajkumar Manoharan | 4a16fbe | 2014-12-17 12:21:12 +0200 | [diff] [blame] | 7258 | }; |
| 7259 | |
Raja Mani | 840357c | 2015-06-22 20:10:10 +0530 | [diff] [blame] | 7260 | static const struct wmi_ops wmi_10_4_ops = { |
Raja Mani | 1c09296 | 2015-06-22 20:10:16 +0530 | [diff] [blame] | 7261 | .rx = ath10k_wmi_10_4_op_rx, |
Raja Mani | 840357c | 2015-06-22 20:10:10 +0530 | [diff] [blame] | 7262 | .map_svc = wmi_10_4_svc_map, |
Raja Mani | b2297ba | 2015-06-22 20:22:23 +0530 | [diff] [blame] | 7263 | |
| 7264 | .pull_scan = ath10k_wmi_op_pull_scan_ev, |
Raja Mani | 1c09296 | 2015-06-22 20:10:16 +0530 | [diff] [blame] | 7265 | .pull_mgmt_rx = ath10k_wmi_10_4_op_pull_mgmt_rx_ev, |
Raja Mani | b2297ba | 2015-06-22 20:22:23 +0530 | [diff] [blame] | 7266 | .pull_ch_info = ath10k_wmi_10_4_op_pull_ch_info_ev, |
Raja Mani | 373b48c | 2015-06-22 20:22:22 +0530 | [diff] [blame] | 7267 | .pull_vdev_start = ath10k_wmi_op_pull_vdev_start_ev, |
| 7268 | .pull_peer_kick = ath10k_wmi_op_pull_peer_kick_ev, |
Raja Mani | 3cec3be | 2015-06-22 20:22:21 +0530 | [diff] [blame] | 7269 | .pull_swba = ath10k_wmi_10_4_op_pull_swba_ev, |
Raja Mani | 2b0a2e0 | 2015-08-14 11:13:34 +0300 | [diff] [blame] | 7270 | .pull_phyerr_hdr = ath10k_wmi_10_4_op_pull_phyerr_ev_hdr, |
| 7271 | .pull_phyerr = ath10k_wmi_10_4_op_pull_phyerr_ev, |
Raja Mani | 1c09296 | 2015-06-22 20:10:16 +0530 | [diff] [blame] | 7272 | .pull_svc_rdy = ath10k_wmi_main_op_pull_svc_rdy_ev, |
Raja Mani | d02e752 | 2015-06-22 20:10:18 +0530 | [diff] [blame] | 7273 | .pull_rdy = ath10k_wmi_op_pull_rdy_ev, |
Vivek Natarajan | 08e75ea | 2015-08-04 10:45:11 +0530 | [diff] [blame] | 7274 | .get_txbf_conf_scheme = ath10k_wmi_10_4_txbf_conf_scheme, |
Raja Mani | 373b48c | 2015-06-22 20:22:22 +0530 | [diff] [blame] | 7275 | |
| 7276 | .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend, |
| 7277 | .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume, |
| 7278 | .gen_pdev_set_rd = ath10k_wmi_10x_op_gen_pdev_set_rd, |
| 7279 | .gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param, |
Raja Mani | d1e52a8 | 2015-06-22 20:10:15 +0530 | [diff] [blame] | 7280 | .gen_init = ath10k_wmi_10_4_op_gen_init, |
Raja Mani | b2297ba | 2015-06-22 20:22:23 +0530 | [diff] [blame] | 7281 | .gen_start_scan = ath10k_wmi_op_gen_start_scan, |
| 7282 | .gen_stop_scan = ath10k_wmi_op_gen_stop_scan, |
Raja Mani | 373b48c | 2015-06-22 20:22:22 +0530 | [diff] [blame] | 7283 | .gen_vdev_create = ath10k_wmi_op_gen_vdev_create, |
| 7284 | .gen_vdev_delete = ath10k_wmi_op_gen_vdev_delete, |
| 7285 | .gen_vdev_start = ath10k_wmi_op_gen_vdev_start, |
| 7286 | .gen_vdev_stop = ath10k_wmi_op_gen_vdev_stop, |
| 7287 | .gen_vdev_up = ath10k_wmi_op_gen_vdev_up, |
| 7288 | .gen_vdev_down = ath10k_wmi_op_gen_vdev_down, |
| 7289 | .gen_vdev_set_param = ath10k_wmi_op_gen_vdev_set_param, |
| 7290 | .gen_vdev_install_key = ath10k_wmi_op_gen_vdev_install_key, |
Raja Mani | 4535edb | 2015-08-20 10:29:05 +0530 | [diff] [blame] | 7291 | .gen_vdev_spectral_conf = ath10k_wmi_op_gen_vdev_spectral_conf, |
| 7292 | .gen_vdev_spectral_enable = ath10k_wmi_op_gen_vdev_spectral_enable, |
Raja Mani | 373b48c | 2015-06-22 20:22:22 +0530 | [diff] [blame] | 7293 | .gen_peer_create = ath10k_wmi_op_gen_peer_create, |
| 7294 | .gen_peer_delete = ath10k_wmi_op_gen_peer_delete, |
| 7295 | .gen_peer_flush = ath10k_wmi_op_gen_peer_flush, |
| 7296 | .gen_peer_set_param = ath10k_wmi_op_gen_peer_set_param, |
| 7297 | .gen_set_psmode = ath10k_wmi_op_gen_set_psmode, |
| 7298 | .gen_set_sta_ps = ath10k_wmi_op_gen_set_sta_ps, |
| 7299 | .gen_set_ap_ps = ath10k_wmi_op_gen_set_ap_ps, |
| 7300 | .gen_scan_chan_list = ath10k_wmi_op_gen_scan_chan_list, |
| 7301 | .gen_beacon_dma = ath10k_wmi_op_gen_beacon_dma, |
| 7302 | .gen_pdev_set_wmm = ath10k_wmi_op_gen_pdev_set_wmm, |
| 7303 | .gen_force_fw_hang = ath10k_wmi_op_gen_force_fw_hang, |
| 7304 | .gen_mgmt_tx = ath10k_wmi_op_gen_mgmt_tx, |
| 7305 | .gen_dbglog_cfg = ath10k_wmi_op_gen_dbglog_cfg, |
| 7306 | .gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable, |
| 7307 | .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable, |
| 7308 | .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode, |
Vasanthakumar Thiagarajan | b288741 | 2015-08-13 21:10:54 +0530 | [diff] [blame] | 7309 | .gen_addba_clear_resp = ath10k_wmi_op_gen_addba_clear_resp, |
| 7310 | .gen_addba_send = ath10k_wmi_op_gen_addba_send, |
| 7311 | .gen_addba_set_resp = ath10k_wmi_op_gen_addba_set_resp, |
| 7312 | .gen_delba_send = ath10k_wmi_op_gen_delba_send, |
Raja Mani | 373b48c | 2015-06-22 20:22:22 +0530 | [diff] [blame] | 7313 | |
| 7314 | /* shared with 10.2 */ |
| 7315 | .gen_peer_assoc = ath10k_wmi_10_2_op_gen_peer_assoc, |
Raja Mani | 840357c | 2015-06-22 20:10:10 +0530 | [diff] [blame] | 7316 | }; |
| 7317 | |
Michal Kazior | b79b9ba | 2014-09-18 15:21:23 +0200 | [diff] [blame] | 7318 | int ath10k_wmi_attach(struct ath10k *ar) |
| 7319 | { |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7320 | switch (ar->wmi.op_version) { |
Raja Mani | 9bd2132 | 2015-06-22 20:10:09 +0530 | [diff] [blame] | 7321 | case ATH10K_FW_WMI_OP_VERSION_10_4: |
Raja Mani | 840357c | 2015-06-22 20:10:10 +0530 | [diff] [blame] | 7322 | ar->wmi.ops = &wmi_10_4_ops; |
Raja Mani | 2d491e6 | 2015-06-22 20:10:11 +0530 | [diff] [blame] | 7323 | ar->wmi.cmd = &wmi_10_4_cmd_map; |
Raja Mani | 93841a1 | 2015-06-22 20:10:13 +0530 | [diff] [blame] | 7324 | ar->wmi.vdev_param = &wmi_10_4_vdev_param_map; |
Raja Mani | d86561f | 2015-06-22 20:10:14 +0530 | [diff] [blame] | 7325 | ar->wmi.pdev_param = &wmi_10_4_pdev_param_map; |
Raja Mani | 9bd2132 | 2015-06-22 20:10:09 +0530 | [diff] [blame] | 7326 | break; |
Rajkumar Manoharan | 4a16fbe | 2014-12-17 12:21:12 +0200 | [diff] [blame] | 7327 | case ATH10K_FW_WMI_OP_VERSION_10_2_4: |
| 7328 | ar->wmi.cmd = &wmi_10_2_4_cmd_map; |
| 7329 | ar->wmi.ops = &wmi_10_2_4_ops; |
| 7330 | ar->wmi.vdev_param = &wmi_10_2_4_vdev_param_map; |
| 7331 | ar->wmi.pdev_param = &wmi_10_2_4_pdev_param_map; |
| 7332 | break; |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7333 | case ATH10K_FW_WMI_OP_VERSION_10_2: |
| 7334 | ar->wmi.cmd = &wmi_10_2_cmd_map; |
| 7335 | ar->wmi.ops = &wmi_10_2_ops; |
Michal Kazior | b79b9ba | 2014-09-18 15:21:23 +0200 | [diff] [blame] | 7336 | ar->wmi.vdev_param = &wmi_10x_vdev_param_map; |
| 7337 | ar->wmi.pdev_param = &wmi_10x_pdev_param_map; |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7338 | break; |
| 7339 | case ATH10K_FW_WMI_OP_VERSION_10_1: |
| 7340 | ar->wmi.cmd = &wmi_10x_cmd_map; |
| 7341 | ar->wmi.ops = &wmi_10_1_ops; |
| 7342 | ar->wmi.vdev_param = &wmi_10x_vdev_param_map; |
| 7343 | ar->wmi.pdev_param = &wmi_10x_pdev_param_map; |
| 7344 | break; |
| 7345 | case ATH10K_FW_WMI_OP_VERSION_MAIN: |
Michal Kazior | b79b9ba | 2014-09-18 15:21:23 +0200 | [diff] [blame] | 7346 | ar->wmi.cmd = &wmi_cmd_map; |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7347 | ar->wmi.ops = &wmi_ops; |
Michal Kazior | b79b9ba | 2014-09-18 15:21:23 +0200 | [diff] [blame] | 7348 | ar->wmi.vdev_param = &wmi_vdev_param_map; |
| 7349 | ar->wmi.pdev_param = &wmi_pdev_param_map; |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7350 | break; |
Michal Kazior | ca996ec | 2014-12-03 10:11:32 +0200 | [diff] [blame] | 7351 | case ATH10K_FW_WMI_OP_VERSION_TLV: |
| 7352 | ath10k_wmi_tlv_attach(ar); |
| 7353 | break; |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 7354 | case ATH10K_FW_WMI_OP_VERSION_UNSET: |
| 7355 | case ATH10K_FW_WMI_OP_VERSION_MAX: |
| 7356 | ath10k_err(ar, "unsupported WMI op version: %d\n", |
| 7357 | ar->wmi.op_version); |
| 7358 | return -EINVAL; |
Michal Kazior | b79b9ba | 2014-09-18 15:21:23 +0200 | [diff] [blame] | 7359 | } |
| 7360 | |
| 7361 | init_completion(&ar->wmi.service_ready); |
| 7362 | init_completion(&ar->wmi.unified_ready); |
Michal Kazior | b79b9ba | 2014-09-18 15:21:23 +0200 | [diff] [blame] | 7363 | |
Raja Mani | c8ecfc1 | 2015-07-29 11:40:38 +0300 | [diff] [blame] | 7364 | INIT_WORK(&ar->svc_rdy_work, ath10k_wmi_event_service_ready_work); |
| 7365 | |
Michal Kazior | b79b9ba | 2014-09-18 15:21:23 +0200 | [diff] [blame] | 7366 | return 0; |
| 7367 | } |
| 7368 | |
Vasanthakumar Thiagarajan | a925a37 | 2015-08-28 17:21:34 +0530 | [diff] [blame] | 7369 | void ath10k_wmi_free_host_mem(struct ath10k *ar) |
Michal Kazior | b79b9ba | 2014-09-18 15:21:23 +0200 | [diff] [blame] | 7370 | { |
| 7371 | int i; |
| 7372 | |
| 7373 | /* free the host memory chunks requested by firmware */ |
| 7374 | for (i = 0; i < ar->wmi.num_mem_chunks; i++) { |
| 7375 | dma_free_coherent(ar->dev, |
| 7376 | ar->wmi.mem_chunks[i].len, |
| 7377 | ar->wmi.mem_chunks[i].vaddr, |
| 7378 | ar->wmi.mem_chunks[i].paddr); |
| 7379 | } |
| 7380 | |
| 7381 | ar->wmi.num_mem_chunks = 0; |
| 7382 | } |
Vasanthakumar Thiagarajan | a925a37 | 2015-08-28 17:21:34 +0530 | [diff] [blame] | 7383 | |
| 7384 | void ath10k_wmi_detach(struct ath10k *ar) |
| 7385 | { |
| 7386 | cancel_work_sync(&ar->svc_rdy_work); |
| 7387 | |
| 7388 | if (ar->svc_rdy_skb) |
| 7389 | dev_kfree_skb(ar->svc_rdy_skb); |
| 7390 | } |