blob: 53928c7009b9b63698929b1743bcba5e57f4707e [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Sandeep Puligilla43b6d1a2018-12-03 09:16:13 -08002 * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080019#if !defined(HDD_CONFIG_H__)
20#define HDD_CONFIG_H__
21
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>
Anurag Chouhan6d760662016-02-20 16:05:43 +053034#include <qdf_types.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080035#include <csr_api.h>
36#include <sap_api.h>
Govind Singh5b486202016-06-09 18:29:42 +053037#include "osapi_linux.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080038#include <wmi_unified.h>
Dustin Brown1224e212017-05-12 14:02:12 -070039#include "wlan_pmo_hw_filter_public_struct.h"
Rajeev Kumar Sirasanagandla4725ae42018-05-24 22:33:34 +053040#include "wlan_action_oui_public_struct.h"
Dundi Raviteja8e338282018-09-25 17:16:04 +053041#include "hdd_config.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080042
Jeff Johnsonb6909be2017-08-28 12:07:19 -070043struct hdd_context;
44
jitiphil869b9f72018-09-25 17:14:01 +053045#define CFG_DP_RPS_RX_QUEUE_CPU_MAP_LIST_LEN 30
46
Jiachao Wu6e9b9f92018-01-03 13:35:40 +080047#define FW_MODULE_LOG_LEVEL_STRING_LENGTH (512)
gbian62edd7e2017-03-07 13:12:13 +080048#define TX_SCHED_WRR_PARAMS_NUM (5)
Nirav Shahbd36b062016-07-18 11:12:59 +053049
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080050/* Number of items that can be configured */
Srinivas Girigowdaba3091c2015-11-16 17:18:40 -080051#define MAX_CFG_INI_ITEMS 1024
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080052
53/* Defines for all of the things we read from the configuration (registry). */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080054
Nirav Shahd21a2e32018-04-20 16:34:43 +053055#ifdef CONFIG_DP_TRACE
Mohit Khannaf8f96822017-05-17 17:11:59 -070056/* Max length of gDptraceConfig string. e.g.- "1, 6, 1, 62" */
57#define DP_TRACE_CONFIG_STRING_LENGTH (20)
58
59/* At max 4 DP Trace config parameters are allowed. Refer - gDptraceConfig */
60#define DP_TRACE_CONFIG_NUM_PARAMS (4)
61
62/*
63 * Default value of live mode in case it cannot be determined from cfg string
64 * gDptraceConfig
65 */
66#define DP_TRACE_CONFIG_DEFAULT_LIVE_MODE (1)
67
68/*
69 * Default value of thresh (packets/second) beyond which DP Trace is disabled.
70 * Use this default in case the value cannot be determined from cfg string
71 * gDptraceConfig
72 */
Mohit Khannaf7562c32018-07-05 17:42:36 -070073#define DP_TRACE_CONFIG_DEFAULT_THRESH (6)
Mohit Khannaf8f96822017-05-17 17:11:59 -070074
75/*
76 * Number of intervals of BW timer to wait before enabling/disabling DP Trace.
77 * Since throughput threshold to disable live logging for DP Trace is very low,
78 * we calculate throughput based on # packets received in a second.
Mohit Khannaf7562c32018-07-05 17:42:36 -070079 * For example assuming bandwidth timer interval is 100ms, and if more than 6
80 * prints are received in 10 * 100 ms interval, we want to disable DP Trace
Mohit Khannaf8f96822017-05-17 17:11:59 -070081 * live logging. DP_TRACE_CONFIG_DEFAULT_THRESH_TIME_LIMIT is the default
82 * value, to be used in case the real value cannot be derived from
83 * bw timer interval
84 */
85#define DP_TRACE_CONFIG_DEFAULT_THRESH_TIME_LIMIT (10)
86
87/* Default proto bitmap in case its missing in gDptraceConfig string */
88#define DP_TRACE_CONFIG_DEFAULT_BITMAP \
89 (QDF_NBUF_PKT_TRAC_TYPE_EAPOL |\
90 QDF_NBUF_PKT_TRAC_TYPE_DHCP |\
91 QDF_NBUF_PKT_TRAC_TYPE_MGMT_ACTION |\
92 QDF_NBUF_PKT_TRAC_TYPE_ARP |\
Poddar, Siddarth44aa5aa2017-07-10 17:30:22 +053093 QDF_NBUF_PKT_TRAC_TYPE_ICMP |\
94 QDF_NBUF_PKT_TRAC_TYPE_ICMPv6)\
Mohit Khannaf8f96822017-05-17 17:11:59 -070095
96/* Default verbosity, in case its missing in gDptraceConfig string*/
97#define DP_TRACE_CONFIG_DEFAULT_VERBOSTY QDF_DP_TRACE_VERBOSITY_LOW
jitiphilb03ae082018-11-09 17:41:59 +053098
Nirav Shahd21a2e32018-04-20 16:34:43 +053099#endif
Mohit Khannaf8f96822017-05-17 17:11:59 -0700100
Gupta, Kapil96c7f2f2016-04-25 19:13:41 +0530101/*
Ashish Kumar Dhanotiyacb14b112018-01-19 19:26:44 +0530102 * Type declarations
103 */
Naveen Rawat2b430892018-03-13 13:58:18 -0700104
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800105struct hdd_config {
106 /* Bitmap to track what is explicitly configured */
107 DECLARE_BITMAP(bExplicitCfg, MAX_CFG_INI_ITEMS);
108
109 /* Config parameters */
Srinivas Girigowda2fb677c2017-03-25 15:35:34 -0700110 enum hdd_dot11_mode dot11Mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800111
Rachit Kankanef6834c42018-08-02 18:47:50 +0530112#ifdef FEATURE_WLAN_DYNAMIC_CVM
Nachiket Kukade8983cf62017-10-12 18:14:48 +0530113 /* Bitmap for operating voltage corner mode */
114 uint32_t vc_mode_cfg_bitmap;
Rachit Kankanef6834c42018-08-02 18:47:50 +0530115#endif
Ashish Kumar Dhanotiya12f68212018-09-04 22:00:14 +0530116#ifdef ENABLE_MTRACE_LOG
117 bool enable_mtrace;
118#endif
Jeff Johnsona8fef4e2019-03-11 14:38:49 -0700119 bool enable_snr_monitoring;
Jeff Johnson15a88ac2019-03-11 14:35:25 -0700120 bool advertise_concurrent_operation;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800121#ifdef DHCP_SERVER_OFFLOAD
gaurank kathpalia566c81b2019-02-20 14:31:45 +0530122 struct dhcp_server dhcp_server_ip;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800123#endif /* DHCP_SERVER_OFFLOAD */
Nachiket Kukadee547a482018-05-22 16:43:30 +0530124 bool apf_enabled;
Yingying Tangb4832f72016-10-20 13:44:55 +0800125 uint16_t sap_tx_leakage_threshold;
Arun Khandavallicc544b32017-01-30 19:52:16 +0530126 bool sap_internal_restart;
Manjunathappa Prakashdab74fa2017-06-19 12:11:03 -0700127 bool tx_orphan_enable;
Rachit Kankane0106e382018-05-16 18:59:28 +0530128 bool is_11k_offload_supported;
Rajeev Kumar Sirasanagandla4725ae42018-05-24 22:33:34 +0530129 bool action_oui_enable;
130 uint8_t action_oui_str[ACTION_OUI_MAXIMUM_ID][ACTION_OUI_MAX_STR_LEN];
Rajeev Kumar15b40a22018-04-12 11:45:24 -0700131 bool is_unit_test_framework_enabled;
Ashish Kumar Dhanotiyad63d6862019-03-14 18:54:10 +0530132 bool disable_channel;
Dundi Raviteja8e338282018-09-25 17:16:04 +0530133
134 /* HDD converged ini items are listed below this*/
135 bool bug_on_reinit_failure;
136 bool is_ramdump_enabled;
137 uint32_t iface_change_wait_time;
138 uint8_t multicast_host_fw_msgs;
139 enum hdd_wext_control private_wext_control;
Dundi Raviteja8e338282018-09-25 17:16:04 +0530140 bool enablefwprint;
141 uint8_t enable_fw_log;
142
143#ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
144 /* WLAN Logging */
145 bool wlan_logging_enable;
146 bool wlan_logging_to_console;
147#endif /* WLAN_LOGGING_SOCK_SVC_ENABLE */
148
149#ifdef FEATURE_WLAN_AUTO_SHUTDOWN
150 uint32_t wlan_auto_shutdown;
151#endif
152
153#ifndef REMOVE_PKT_LOG
154 bool enable_packet_log;
155#endif
jitiphil869b9f72018-09-25 17:14:01 +0530156 uint32_t rx_mode;
Mohit Khannaa8c9f562019-03-25 22:17:02 -0700157 uint32_t tx_comp_loop_pkt_limit;
158 uint32_t rx_reap_loop_pkt_limit;
159 uint32_t rx_hp_oos_update_limit;
160 uint64_t rx_softirq_max_yield_duration_ns;
Tiger Yu8b119e92019-04-09 13:55:07 +0800161#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
jitiphil869b9f72018-09-25 17:14:01 +0530162 uint32_t bus_bw_high_threshold;
163 uint32_t bus_bw_medium_threshold;
164 uint32_t bus_bw_low_threshold;
165 uint32_t bus_bw_compute_interval;
166 uint32_t enable_tcp_delack;
167 bool enable_tcp_limit_output;
168 uint32_t enable_tcp_adv_win_scale;
169 uint32_t tcp_delack_thres_high;
170 uint32_t tcp_delack_thres_low;
171 uint32_t tcp_tx_high_tput_thres;
172 uint32_t tcp_delack_timer_count;
Alok Kumar2fad6442018-11-08 19:19:28 +0530173 bool enable_tcp_param_update;
Tiger Yu8b119e92019-04-09 13:55:07 +0800174#endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/
175
Tiger Yue40e7832019-04-25 10:46:53 +0800176#ifdef QCA_SUPPORT_TXRX_DRIVER_TCP_DEL_ACK
177 bool del_ack_enable;
178 uint32_t del_ack_threshold_high;
179 uint32_t del_ack_threshold_low;
180 uint16_t del_ack_timer_value;
181 uint16_t del_ack_pkt_count;
182#endif
183
jitiphil869b9f72018-09-25 17:14:01 +0530184#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
185 uint32_t tx_flow_low_watermark;
186 uint32_t tx_flow_hi_watermark_offset;
187 uint32_t tx_flow_max_queue_depth;
188 uint32_t tx_lbw_flow_low_watermark;
189 uint32_t tx_lbw_flow_hi_watermark_offset;
190 uint32_t tx_lbw_flow_max_queue_depth;
191 uint32_t tx_hbw_flow_low_watermark;
192 uint32_t tx_hbw_flow_hi_watermark_offset;
193 uint32_t tx_hbw_flow_max_queue_depth;
194#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
195 uint32_t napi_cpu_affinity_mask;
196 /* CPU affinity mask for rx_thread */
197 uint32_t rx_thread_affinity_mask;
198 uint8_t cpu_map_list[CFG_DP_RPS_RX_QUEUE_CPU_MAP_LIST_LEN];
jitiphil296c23e2018-11-15 16:26:14 +0530199 bool multicast_replay_filter;
200 uint32_t rx_wakelock_timeout;
201 uint8_t num_dp_rx_threads;
jitiphilb03ae082018-11-09 17:41:59 +0530202#ifdef CONFIG_DP_TRACE
203 bool enable_dp_trace;
204 uint8_t dp_trace_config[DP_TRACE_CONFIG_STRING_LENGTH];
205#endif
206#ifdef WLAN_NUD_TRACKING
207 bool enable_nud_tracking;
208#endif
Vignesh Viswanathana0358ff2018-11-27 09:53:07 +0530209 uint8_t operating_channel;
210 uint8_t num_vdevs;
211 uint8_t enable_concurrent_sta[CFG_CONCURRENT_IFACE_MAX_LEN];
212 uint8_t dbs_scan_selection[CFG_DBS_SCAN_PARAM_LENGTH];
Sourav Mohapatra0dfe5552018-11-16 11:29:54 +0530213#ifdef FEATURE_RUNTIME_PM
214 bool runtime_pm;
215#endif
Sourav Mohapatra0dfe5552018-11-16 11:29:54 +0530216 uint8_t inform_bss_rssi_raw;
Ashish Kumar Dhanotiya7a11e272018-11-28 13:16:55 +0530217
218 bool mac_provision;
219 uint32_t provisioned_intf_pool;
220 uint32_t derived_intf_pool;
Sourav Mohapatra9e014cf2018-12-11 09:39:33 +0530221 uint8_t enable_rtt_support;
Manjunathappa Prakashf5b6f5f2019-03-27 15:17:41 -0700222 uint32_t cfg_wmi_credit_cnt;
Ashish Kumar Dhanotiya95498182019-04-29 13:59:20 +0530223 uint32_t sar_version;
Rajeev Kumar3a7c3402019-05-02 16:02:20 -0700224 bool is_wow_disabled;
Jiani Liu6d3b6a12019-05-08 15:15:06 +0800225#ifdef WLAN_FEATURE_TSF_PLUS
226 uint8_t tsf_ptp_options;
227#endif /* WLAN_FEATURE_TSF_PLUS */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800228};
229
Krunal Soni707eb782018-01-18 12:04:19 -0800230/**
231 * hdd_to_csr_wmm_mode() - Utility function to convert HDD to CSR WMM mode
232 *
Abhinav Kumar7d6f1ac2018-09-01 18:33:56 +0530233 * @uint8_t mode - hdd WMM user mode
Krunal Soni707eb782018-01-18 12:04:19 -0800234 *
235 * Return: CSR WMM mode
236 */
Abhinav Kumar7d6f1ac2018-09-01 18:33:56 +0530237eCsrRoamWmmUserModeType hdd_to_csr_wmm_mode(uint8_t mode);
Krunal Soni707eb782018-01-18 12:04:19 -0800238
Jeff Johnson723234b2017-09-03 08:49:15 -0700239QDF_STATUS hdd_update_mac_config(struct hdd_context *hdd_ctx);
240QDF_STATUS hdd_set_sme_config(struct hdd_context *hdd_ctx);
241QDF_STATUS hdd_set_policy_mgr_user_cfg(struct hdd_context *hdd_ctx);
Jeff Johnsonb6909be2017-08-28 12:07:19 -0700242QDF_STATUS hdd_set_sme_chan_list(struct hdd_context *hdd_ctx);
Jeff Johnson723234b2017-09-03 08:49:15 -0700243bool hdd_update_config_cfg(struct hdd_context *hdd_ctx);
Nirav Shah5c083da2018-08-03 13:46:02 +0530244void hdd_cfg_get_global_config(struct hdd_context *hdd_ctx, char *buf,
245 int buflen);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800246
Srinivas Girigowda2fb677c2017-03-25 15:35:34 -0700247eCsrPhyMode hdd_cfg_xlate_to_csr_phy_mode(enum hdd_dot11_mode dot11Mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800248
Arunk Khandavalli847969d2017-09-25 15:15:36 +0530249QDF_STATUS hdd_set_idle_ps_config(struct hdd_context *hdd_ctx, bool val);
Jeff Johnson723234b2017-09-03 08:49:15 -0700250void hdd_get_pmkid_modes(struct hdd_context *hdd_ctx,
Deepak Dhamdhere828f1892017-02-09 11:51:19 -0800251 struct pmkid_mode_bits *pmkid_modes);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800252
Arun Kumar Khandavallia4234582019-03-20 16:16:05 +0530253int hdd_update_tgt_cfg(hdd_handle_t hdd_handle, struct wma_tgt_cfg *cfg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800254
Jeff Johnson9268e092017-11-03 08:18:24 -0700255/**
256 * hdd_string_to_u8_array() - used to convert decimal string into u8 array
257 * @str: Decimal string
258 * @array: Array where converted value is stored
259 * @len: Length of the populated array
260 * @array_max_len: Maximum length of the array
261 *
262 * This API is called to convert decimal string (each byte separated by
263 * a comma) into an u8 array
264 *
265 * Return: QDF_STATUS
266 */
267QDF_STATUS hdd_string_to_u8_array(char *str, uint8_t *array,
Jiachao Wu6e9b9f92018-01-03 13:35:40 +0800268 uint8_t *len, uint16_t array_max_len);
Jeff Johnson9268e092017-11-03 08:18:24 -0700269
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530270QDF_STATUS hdd_hex_string_to_u16_array(char *str, uint16_t *int_array,
Krishna Kumaar Natarajanf599c6e2015-11-03 11:44:03 -0800271 uint8_t *len, uint8_t int_array_max_len);
272
Nirav Shah5c083da2018-08-03 13:46:02 +0530273void hdd_cfg_print_global_config(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800274
Kiran Kumar Lokere44a29432018-01-24 16:10:30 -0800275QDF_STATUS hdd_update_nss(struct hdd_adapter *adapter, uint8_t nss);
Arif Hussaincd151632017-02-11 16:57:19 -0800276
277/**
278 * hdd_dfs_indicate_radar() - Block tx as radar found on the channel
279 * @hdd_ctxt: HDD context pointer
280 *
281 * This function is invoked in atomic context when a radar
282 * is found on the SAP current operating channel and Data Tx
283 * from netif has to be stopped to honor the DFS regulations.
284 * Actions: Stop the netif Tx queues,Indicate Radar present
285 * in HDD context for future usage.
286 *
287 * Return: true on success, else false
288 */
Jeff Johnsonb6909be2017-08-28 12:07:19 -0700289bool hdd_dfs_indicate_radar(struct hdd_context *hdd_ctx);
Will Huang14b120f2019-01-14 17:26:14 +0800290
291/**
292 * hdd_override_all_ps() - overrides to disables all the powersave features.
293 * @hdd_ctx: Pointer to HDD context.
294 * Overrides below powersave ini configurations.
295 * gEnableImps=0
296 * gEnableBmps=0
297 * gRuntimePM=0
298 * gWlanAutoShutdown = 0
299 * gEnableSuspend=0
300 * gEnablePowerSaveOffload=0
301 * gEnableWoW=0
302 *
303 * Return: None
304 */
305void hdd_override_all_ps(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800306#endif