1 /* 2 * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 #if !defined(HDD_CONFIG_H__) 21 #define HDD_CONFIG_H__ 22 23 /** 24 * DOC: wlan_hdd_config.h 25 * 26 * WLAN Adapter Configuration functions 27 */ 28 29 /* $HEADER$ */ 30 31 /* Include files */ 32 #include <wlan_hdd_includes.h> 33 #include <wlan_hdd_wmm.h> 34 #include <qdf_types.h> 35 #include <csr_api.h> 36 #include <sap_api.h> 37 #include <sir_mac_prot_def.h> 38 #include "osapi_linux.h" 39 #include <wmi_unified.h> 40 #include "wlan_pmo_hw_filter_public_struct.h" 41 #include "wlan_action_oui_public_struct.h" 42 #include "hdd_config.h" 43 44 struct hdd_context; 45 46 #define CFG_DP_RPS_RX_QUEUE_CPU_MAP_LIST_LEN 30 47 48 #define FW_MODULE_LOG_LEVEL_STRING_LENGTH (512) 49 #define TX_SCHED_WRR_PARAMS_NUM (5) 50 51 /* Defines for all of the things we read from the configuration (registry). */ 52 53 #ifdef CONFIG_DP_TRACE 54 /* Max length of gDptraceConfig string. e.g.- "1, 6, 1, 62" */ 55 #define DP_TRACE_CONFIG_STRING_LENGTH (20) 56 57 /* At max 4 DP Trace config parameters are allowed. Refer - gDptraceConfig */ 58 #define DP_TRACE_CONFIG_NUM_PARAMS (4) 59 60 /* 61 * Default value of live mode in case it cannot be determined from cfg string 62 * gDptraceConfig 63 */ 64 #define DP_TRACE_CONFIG_DEFAULT_LIVE_MODE (1) 65 66 /* 67 * Default value of thresh (packets/second) beyond which DP Trace is disabled. 68 * Use this default in case the value cannot be determined from cfg string 69 * gDptraceConfig 70 */ 71 #define DP_TRACE_CONFIG_DEFAULT_THRESH (6) 72 73 /* 74 * Number of intervals of BW timer to wait before enabling/disabling DP Trace. 75 * Since throughput threshold to disable live logging for DP Trace is very low, 76 * we calculate throughput based on # packets received in a second. 77 * For example assuming bandwidth timer interval is 100ms, and if more than 6 78 * prints are received in 10 * 100 ms interval, we want to disable DP Trace 79 * live logging. DP_TRACE_CONFIG_DEFAULT_THRESH_TIME_LIMIT is the default 80 * value, to be used in case the real value cannot be derived from 81 * bw timer interval 82 */ 83 #define DP_TRACE_CONFIG_DEFAULT_THRESH_TIME_LIMIT (10) 84 85 /* Default proto bitmap in case its missing in gDptraceConfig string */ 86 #define DP_TRACE_CONFIG_DEFAULT_BITMAP \ 87 (QDF_NBUF_PKT_TRAC_TYPE_EAPOL |\ 88 QDF_NBUF_PKT_TRAC_TYPE_DHCP |\ 89 QDF_NBUF_PKT_TRAC_TYPE_MGMT_ACTION |\ 90 QDF_NBUF_PKT_TRAC_TYPE_ARP |\ 91 QDF_NBUF_PKT_TRAC_TYPE_ICMP |\ 92 QDF_NBUF_PKT_TRAC_TYPE_ICMPv6)\ 93 94 /* Default verbosity, in case its missing in gDptraceConfig string*/ 95 #define DP_TRACE_CONFIG_DEFAULT_VERBOSTY QDF_DP_TRACE_VERBOSITY_LOW 96 97 #endif 98 99 /* 100 * Type declarations 101 */ 102 103 struct hdd_config { 104 /* Config parameters */ 105 enum hdd_dot11_mode dot11Mode; 106 107 #ifdef FEATURE_WLAN_DYNAMIC_CVM 108 /* Bitmap for operating voltage corner mode */ 109 uint32_t vc_mode_cfg_bitmap; 110 #endif 111 #ifdef ENABLE_MTRACE_LOG 112 bool enable_mtrace; 113 #endif 114 bool advertise_concurrent_operation; 115 #ifdef DHCP_SERVER_OFFLOAD 116 struct dhcp_server dhcp_server_ip; 117 #endif /* DHCP_SERVER_OFFLOAD */ 118 bool apf_enabled; 119 uint16_t sap_tx_leakage_threshold; 120 bool sap_internal_restart; 121 bool is_11k_offload_supported; 122 bool is_unit_test_framework_enabled; 123 bool disable_channel; 124 125 /* HDD converged ini items are listed below this*/ 126 bool bug_on_reinit_failure; 127 bool is_ramdump_enabled; 128 uint32_t iface_change_wait_time; 129 uint8_t multicast_host_fw_msgs; 130 enum hdd_wext_control private_wext_control; 131 bool enablefwprint; 132 uint8_t enable_fw_log; 133 134 #ifdef WLAN_LOGGING_SOCK_SVC_ENABLE 135 /* WLAN Logging */ 136 bool wlan_logging_enable; 137 uint32_t wlan_console_log_levels; 138 uint8_t host_log_custom_nl_proto; 139 #endif /* WLAN_LOGGING_SOCK_SVC_ENABLE */ 140 141 #ifdef FEATURE_WLAN_AUTO_SHUTDOWN 142 uint32_t wlan_auto_shutdown; 143 #endif 144 145 #ifndef REMOVE_PKT_LOG 146 bool enable_packet_log; 147 #endif 148 149 #ifdef WLAN_FEATURE_MSCS 150 uint32_t mscs_pkt_threshold; 151 uint32_t mscs_voice_interval; 152 #endif /* WLAN_FEATURE_MSCS */ 153 154 #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL 155 uint32_t tx_flow_low_watermark; 156 uint32_t tx_flow_hi_watermark_offset; 157 uint32_t tx_flow_max_queue_depth; 158 uint32_t tx_lbw_flow_low_watermark; 159 uint32_t tx_lbw_flow_hi_watermark_offset; 160 uint32_t tx_lbw_flow_max_queue_depth; 161 uint32_t tx_hbw_flow_low_watermark; 162 uint32_t tx_hbw_flow_hi_watermark_offset; 163 uint32_t tx_hbw_flow_max_queue_depth; 164 #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */ 165 uint32_t napi_cpu_affinity_mask; 166 uint32_t operating_chan_freq; 167 uint8_t num_vdevs; 168 uint8_t enable_concurrent_sta[CFG_CONCURRENT_IFACE_MAX_LEN]; 169 uint8_t dbs_scan_selection[CFG_DBS_SCAN_PARAM_LENGTH]; 170 #ifdef FEATURE_RUNTIME_PM 171 uint8_t runtime_pm; 172 #endif 173 #ifdef WLAN_FEATURE_WMI_SEND_RECV_QMI 174 bool is_qmi_stats_enabled; 175 #endif 176 uint8_t inform_bss_rssi_raw; 177 178 bool mac_provision; 179 uint32_t provisioned_intf_pool; 180 uint32_t derived_intf_pool; 181 uint32_t cfg_wmi_credit_cnt; 182 uint32_t enable_sar_conversion; 183 #ifdef WLAN_FEATURE_TSF_PLUS 184 uint8_t tsf_ptp_options; 185 #endif /* WLAN_FEATURE_TSF_PLUS */ 186 187 #ifdef SAR_SAFETY_FEATURE 188 uint32_t sar_safety_timeout; 189 uint32_t sar_safety_unsolicited_timeout; 190 uint32_t sar_safety_req_resp_timeout; 191 uint32_t sar_safety_req_resp_retry; 192 uint32_t sar_safety_index; 193 uint32_t sar_safety_sleep_index; 194 uint8_t enable_sar_safety; 195 bool config_sar_safety_sleep_index; 196 #endif 197 uint8_t nb_commands_interval; 198 199 #ifdef FEATURE_CLUB_LL_STATS_AND_GET_STATION 200 uint32_t sta_stats_cache_expiry_time; 201 #endif 202 bool read_mac_addr_from_mac_file; 203 #ifdef FEATURE_SET 204 bool get_wifi_features; 205 #endif 206 #ifdef FEATURE_RUNTIME_PM 207 uint16_t cpu_cxpc_threshold; 208 #endif 209 bool exclude_selftx_from_cca_busy; 210 }; 211 212 /** 213 * hdd_to_csr_wmm_mode() - Utility function to convert HDD to CSR WMM mode 214 * 215 * @mode: hdd WMM user mode 216 * 217 * Return: CSR WMM mode 218 */ 219 enum wmm_user_mode hdd_to_csr_wmm_mode(uint8_t mode); 220 221 QDF_STATUS hdd_update_mac_config(struct hdd_context *hdd_ctx); 222 QDF_STATUS hdd_set_sme_config(struct hdd_context *hdd_ctx); 223 QDF_STATUS hdd_set_policy_mgr_user_cfg(struct hdd_context *hdd_ctx); 224 QDF_STATUS hdd_set_sme_chan_list(struct hdd_context *hdd_ctx); 225 bool hdd_update_config_cfg(struct hdd_context *hdd_ctx); 226 void hdd_cfg_get_global_config(struct hdd_context *hdd_ctx, char *buf, 227 int buflen); 228 229 eCsrPhyMode hdd_cfg_xlate_to_csr_phy_mode(enum hdd_dot11_mode dot11Mode); 230 231 QDF_STATUS hdd_set_idle_ps_config(struct hdd_context *hdd_ctx, bool val); 232 void hdd_get_pmkid_modes(struct hdd_context *hdd_ctx, 233 struct pmkid_mode_bits *pmkid_modes); 234 235 int hdd_update_tgt_cfg(hdd_handle_t hdd_handle, struct wma_tgt_cfg *cfg); 236 237 /** 238 * hdd_string_to_u8_array() - used to convert decimal string into u8 array 239 * @str: Decimal string 240 * @array: Array where converted value is stored 241 * @len: Length of the populated array 242 * @array_max_len: Maximum length of the array 243 * 244 * This API is called to convert decimal string (each byte separated by 245 * a comma) into an u8 array 246 * 247 * Return: QDF_STATUS 248 */ 249 QDF_STATUS hdd_string_to_u8_array(char *str, uint8_t *array, 250 uint8_t *len, uint16_t array_max_len); 251 252 QDF_STATUS hdd_hex_string_to_u16_array(char *str, uint16_t *int_array, 253 uint8_t *len, uint8_t int_array_max_len); 254 255 void hdd_cfg_print_global_config(struct hdd_context *hdd_ctx); 256 257 /** 258 * hdd_update_nss() - Update the number of spatial streams supported. 259 * @link_info: Link info pointer in HDD adapter 260 * @tx_nss: the number of Tx spatial streams to be updated 261 * @rx_nss: the number of Rx spatial streams to be updated 262 * 263 * This function is used to modify the number of spatial streams 264 * supported when not in connected state. 265 * 266 * Return: QDF_STATUS_SUCCESS if nss is correctly updated, 267 * otherwise QDF_STATUS_E_FAILURE would be returned 268 */ 269 QDF_STATUS hdd_update_nss(struct wlan_hdd_link_info *link_info, 270 uint8_t tx_nss, uint8_t rx_nss); 271 272 /** 273 * hdd_get_nss() - Get the number of spatial streams supported by the adapter 274 * 275 * @adapter: the pointer to adapter 276 * @nss: the number of spatial streams supported by the adapter 277 * 278 * This function is used to get the number of spatial streams supported by 279 * the adapter. 280 * 281 * Return: QDF_STATUS 282 */ 283 QDF_STATUS hdd_get_nss(struct hdd_adapter *adapter, uint8_t *nss); 284 285 /** 286 * hdd_get_num_tx_chains() - Get the number of tx chains supported by the 287 * adapter 288 * @link_info: Link info pointer in HDD adapter 289 * @tx_chains: the number of Tx chains supported by the adapter 290 * 291 * This function is used to get the number of Tx chains supported by 292 * the adapter. 293 * 294 * Return: QDF_STATUS 295 */ 296 QDF_STATUS hdd_get_num_tx_chains(struct wlan_hdd_link_info *link_info, 297 uint8_t *tx_chains); 298 299 /** 300 * hdd_get_tx_nss() - Get the number of spatial streams supported by the adapter 301 * @link_info: Link info pointer in HDD adapter 302 * @tx_nss: the number Tx of spatial streams supported by the adapter 303 * 304 * This function is used to get the number of Tx spatial streams supported by 305 * the adapter. 306 * 307 * Return: QDF_STATUS 308 */ 309 QDF_STATUS hdd_get_tx_nss(struct wlan_hdd_link_info *link_info, 310 uint8_t *tx_nss); 311 312 /** 313 * hdd_get_num_rx_chains() - Get the number of chains supported by the adapter 314 * @link_info: Link info pointer in HDD adapter 315 * @rx_chains: the number of Rx chains supported by the adapter 316 * 317 * This function is used to get the number of Rx chains supported by 318 * the adapter. 319 * 320 * Return: QDF_STATUS 321 */ 322 QDF_STATUS hdd_get_num_rx_chains(struct wlan_hdd_link_info *link_info, 323 uint8_t *rx_chains); 324 325 /** 326 * hdd_get_rx_nss() - Get the number of spatial streams supported by the adapter 327 * @link_info: Link info pointer in HDD adapter 328 * @rx_nss: the number Rx of spatial streams supported by the adapter 329 * 330 * This function is used to get the number of Rx spatial streams supported by 331 * the adapter. 332 * 333 * Return: QDF_STATUS 334 */ 335 QDF_STATUS hdd_get_rx_nss(struct wlan_hdd_link_info *link_info, 336 uint8_t *rx_nss); 337 338 339 /** 340 * hdd_dfs_indicate_radar() - Block tx as radar found on the channel 341 * @hdd_ctx: HDD context pointer 342 * 343 * This function is invoked in atomic context when a radar 344 * is found on the SAP current operating channel and Data Tx 345 * from netif has to be stopped to honor the DFS regulations. 346 * Actions: Stop the netif Tx queues,Indicate Radar present 347 * in HDD context for future usage. 348 * 349 * Return: true on success, else false 350 */ 351 bool hdd_dfs_indicate_radar(struct hdd_context *hdd_ctx); 352 353 /** 354 * hdd_restore_all_ps() - Restore all the powersave configuration overwritten 355 * by hdd_override_all_ps. 356 * @hdd_ctx: Pointer to HDD context. 357 * 358 * Return: None 359 */ 360 void hdd_restore_all_ps(struct hdd_context *hdd_ctx); 361 362 /** 363 * hdd_override_all_ps() - overrides to disables all the powersave features. 364 * @hdd_ctx: Pointer to HDD context. 365 * Overrides below powersave ini configurations. 366 * gEnableImps=0 367 * gEnableBmps=0 368 * gRuntimePM=0 369 * gWlanAutoShutdown = 0 370 * gEnableWoW=0 371 * 372 * Return: None 373 */ 374 void hdd_override_all_ps(struct hdd_context *hdd_ctx); 375 376 /** 377 * hdd_vendor_mode_to_phymode() - Get eCsrPhyMode according to vendor phy mode 378 * @vendor_phy_mode: vendor phy mode 379 * @csr_phy_mode: phy mode of eCsrPhyMode 380 * 381 * Return: 0 on success, negative errno value on error 382 */ 383 int hdd_vendor_mode_to_phymode(enum qca_wlan_vendor_phy_mode vendor_phy_mode, 384 eCsrPhyMode *csr_phy_mode); 385 386 /** 387 * hdd_vendor_mode_to_band() - Get band_info according to vendor phy mode 388 * @vendor_phy_mode: vendor phy mode 389 * @supported_band: supported band bitmap 390 * @is_6ghz_supported: whether 6ghz is supported 391 * 392 * Return: 0 on success, negative errno value on error 393 */ 394 int hdd_vendor_mode_to_band(enum qca_wlan_vendor_phy_mode vendor_phy_mode, 395 uint8_t *supported_band, bool is_6ghz_supported); 396 397 /** 398 * hdd_vendor_mode_to_bonding_mode() - Get channel bonding mode according to 399 * vendor phy mode 400 * @vendor_phy_mode: vendor phy mode 401 * @bonding_mode: channel bonding mode 402 * 403 * Return: 0 on success, negative errno value on error 404 */ 405 int 406 hdd_vendor_mode_to_bonding_mode(enum qca_wlan_vendor_phy_mode vendor_phy_mode, 407 uint32_t *bonding_mode); 408 409 /** 410 * hdd_phymode_to_dot11_mode() - Mapping phymode to dot11mode 411 * @phymode: phy mode 412 * @dot11_mode: dot11 mode 413 * 414 * Return: 0 on success, negative errno value on error 415 */ 416 int hdd_phymode_to_dot11_mode(eCsrPhyMode phymode, 417 enum hdd_dot11_mode *dot11_mode); 418 419 /** 420 * hdd_update_phymode() - update the PHY mode of the adapter 421 * @adapter: adapter being modified 422 * @phymode: new PHY mode for the adapter 423 * @supported_band: supported band bitmap for the adapter 424 * @bonding_mode: new channel bonding mode for the adapter 425 * 426 * This function is called when the adapter is set to a new PHY mode. 427 * It takes a holistic look at the desired PHY mode along with the 428 * configured capabilities of the driver and the reported capabilities 429 * of the hardware in order to correctly configure all PHY-related 430 * parameters. 431 * 432 * Return: 0 on success, negative errno value on error 433 */ 434 int hdd_update_phymode(struct hdd_adapter *adapter, eCsrPhyMode phymode, 435 uint8_t supported_band, uint32_t bonding_mode); 436 437 /** 438 * hdd_get_ldpc() - Get adapter LDPC 439 * @adapter: adapter being queried 440 * @value: where to store the value 441 * 442 * Return: 0 on success, negative errno on failure 443 */ 444 int hdd_get_ldpc(struct hdd_adapter *adapter, int *value); 445 446 /** 447 * hdd_set_ldpc() - Set adapter LDPC 448 * @link_info: Link info pointer in adapter 449 * @value: new LDPC value 450 * 451 * Return: 0 on success, negative errno on failure 452 */ 453 int hdd_set_ldpc(struct wlan_hdd_link_info *link_info, int value); 454 455 /** 456 * hdd_get_tx_stbc() - Get adapter TX STBC 457 * @adapter: adapter being queried 458 * @value: where to store the value 459 * 460 * Return: 0 on success, negative errno on failure 461 */ 462 int hdd_get_tx_stbc(struct hdd_adapter *adapter, int *value); 463 464 /** 465 * hdd_set_tx_stbc() - Set adapter TX STBC 466 * @link_info: Link info pointer in HDD adapter 467 * @value: new TX STBC value 468 * 469 * Return: 0 on success, negative errno on failure 470 */ 471 int hdd_set_tx_stbc(struct wlan_hdd_link_info *link_info, int value); 472 473 /** 474 * hdd_get_rx_stbc() - Get adapter RX STBC 475 * @adapter: adapter being queried 476 * @value: where to store the value 477 * 478 * Return: 0 on success, negative errno on failure 479 */ 480 int hdd_get_rx_stbc(struct hdd_adapter *adapter, int *value); 481 482 /** 483 * hdd_set_rx_stbc() - Set adapter RX STBC 484 * @link_info: Link info pointer in HDD adapter 485 * @value: new RX STBC value 486 * 487 * Return: 0 on success, negative errno on failure 488 */ 489 int hdd_set_rx_stbc(struct wlan_hdd_link_info *link_info, int value); 490 491 /** 492 * hdd_update_channel_width() - Update adapter channel width settings 493 * @link_info: Link info in HDD adapter 494 * @chwidth: new channel width of enum eSirMacHTChannelWidth 495 * @bonding_mode: channel bonding mode of the new channel width 496 * @link_id: mlo link id 497 * @is_restore: is restore 498 * 499 * Return: 0 on success, negative errno on failure 500 */ 501 int hdd_update_channel_width(struct wlan_hdd_link_info *link_info, 502 enum eSirMacHTChannelWidth chwidth, 503 uint32_t bonding_mode, uint8_t link_id, 504 bool is_restore); 505 #endif /* end #if !defined(HDD_CONFIG_H__) */ 506