blob: 1047966cf2547dd1a89164063aad16c0d0c714ed [file] [log] [blame]
Sourav Mohapatra113685f2018-08-29 14:21:55 +05301/*
Harprit Chhabadad59ae762019-01-08 16:40:43 -08002 * Copyright (c) 2012 - 2019 The Linux Foundation. All rights reserved.
Sourav Mohapatra113685f2018-08-29 14:21:55 +05303 *
4 * 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/**
19 * DOC: declare utility API related to the fw_offload component
20 * called by other components
21 */
22
23#ifndef _WLAN_FW_OFFLOAD_MAIN_H_
24#define _WLAN_FW_OFFLOAD_MAIN_H_
25
26#include <wlan_objmgr_psoc_obj.h>
27#include <wlan_objmgr_global_obj.h>
28#include <wlan_cmn.h>
29
Pragaspathi Thilagaraj3cf0f652018-10-29 16:40:35 +053030#include "cfg_ucfg_api.h"
Dundi Raviteja9ab4e7b2018-09-28 14:18:28 +053031
Sourav Mohapatra113685f2018-08-29 14:21:55 +053032#define fwol_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_FWOL, params)
33#define fwol_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_FWOL, params)
34#define fwol_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_FWOL, params)
35#define fwol_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_FWOL, params)
36#define fwol_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_FWOL, params)
37
Nirav Shah0b332192019-03-05 23:13:21 +053038#define fwol_nofl_alert(params...) \
39 QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_FWOL, params)
40#define fwol_nofl_err(params...) \
41 QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_FWOL, params)
42#define fwol_nofl_warn(params...) \
43 QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_FWOL, params)
44#define fwol_nofl_info(params...) \
45 QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_FWOL, params)
46#define fwol_nofl_debug(params...) \
47 QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_FWOL, params)
48
Sourav Mohapatra113685f2018-08-29 14:21:55 +053049/**
Dundi Raviteja3b637092018-09-12 13:42:50 +053050 * struct wlan_fwol_three_antenna_btc - Three antenna BTC config items
51 * @btc_mode: Config BTC mode
52 * @antenna_isolation: Antenna isolation
53 * @max_tx_power_for_btc: Max wlan tx power in co-ex scenario
54 * @wlan_low_rssi_threshold: Wlan low rssi threshold for BTC mode switching
55 * @bt_low_rssi_threshold: BT low rssi threshold for BTC mode switching
56 * @bt_interference_low_ll: Lower limit of low level BT interference
57 * @bt_interference_low_ul: Upper limit of low level BT interference
58 * @bt_interference_medium_ll: Lower limit of medium level BT interference
59 * @bt_interference_medium_ul: Upper limit of medium level BT interference
60 * @bt_interference_high_ll: Lower limit of high level BT interference
61 * @bt_interference_high_ul: Upper limit of high level BT interference
stonezc9936cb2019-03-11 16:41:22 +080062 * @btc_mpta_helper_enable: Enable/Disable tri-radio MPTA helper
hqu1dd504a2019-06-04 11:24:11 +080063 * @bt_sco_allow_wlan_2g_scan: Enable/Disble wlan 2g scan when
64 * BT SCO connection is on
Dundi Raviteja3b637092018-09-12 13:42:50 +053065 */
66struct wlan_fwol_coex_config {
67 uint8_t btc_mode;
68 uint8_t antenna_isolation;
69 uint8_t max_tx_power_for_btc;
70 int16_t wlan_low_rssi_threshold;
71 int16_t bt_low_rssi_threshold;
72 int16_t bt_interference_low_ll;
73 int16_t bt_interference_low_ul;
74 int16_t bt_interference_medium_ll;
75 int16_t bt_interference_medium_ul;
76 int16_t bt_interference_high_ll;
77 int16_t bt_interference_high_ul;
stonezc9936cb2019-03-11 16:41:22 +080078#ifdef FEATURE_MPTA_HELPER
79 bool btc_mpta_helper_enable;
80#endif
hqu1dd504a2019-06-04 11:24:11 +080081 bool bt_sco_allow_wlan_2g_scan;
Dundi Raviteja3b637092018-09-12 13:42:50 +053082};
83
Manikandan Mohan9045e2e2018-11-26 16:44:19 -080084#define FWOL_THERMAL_LEVEL_MAX 4
85#define FWOL_THERMAL_THROTTLE_LEVEL_MAX 4
Dundi Raviteja47ac7092018-09-07 10:40:28 +053086/*
87 * struct wlan_fwol_thermal_temp - Thermal temperature config items
Manikandan Mohan9045e2e2018-11-26 16:44:19 -080088 * @thermal_temp_min_level: Array of temperature minimum levels
89 * @thermal_temp_max_level: Array of temperature maximum levels
90 * @thermal_mitigation_enable: Control for Thermal mitigation feature
91 * @throttle_period: Thermal throttle period value
92 * @throttle_dutycycle_level: Array of throttle duty cycle levels
Dundi Raviteja47ac7092018-09-07 10:40:28 +053093 */
94struct wlan_fwol_thermal_temp {
Manikandan Mohan9045e2e2018-11-26 16:44:19 -080095 bool thermal_mitigation_enable;
96 uint32_t throttle_period;
97 uint16_t thermal_temp_min_level[FWOL_THERMAL_LEVEL_MAX];
98 uint16_t thermal_temp_max_level[FWOL_THERMAL_LEVEL_MAX];
99 uint32_t throttle_dutycycle_level[FWOL_THERMAL_THROTTLE_LEVEL_MAX];
Dundi Raviteja47ac7092018-09-07 10:40:28 +0530100};
101
Dundi Raviteja3b637092018-09-12 13:42:50 +0530102/**
Dundi Raviteja85a240a2018-09-10 15:03:07 +0530103 * struct wlan_fwol_ie_whitelist - Probe request IE whitelist config items
Dundi Raviteja9ab4e7b2018-09-28 14:18:28 +0530104 * @ie_whitelist: IE whitelist flag
105 * @ie_bitmap_0: IE bitmap 0
106 * @ie_bitmap_1: IE bitmap 1
107 * @ie_bitmap_2: IE bitmap 2
108 * @ie_bitmap_3: IE bitmap 3
109 * @ie_bitmap_4: IE bitmap 4
110 * @ie_bitmap_5: IE bitmap 5
111 * @ie_bitmap_6: IE bitmap 6
112 * @ie_bitmap_7: IE bitmap 7
113 * @no_of_probe_req_ouis: Total number of ouis present in probe req
114 * @probe_req_voui: Stores oui values after parsing probe req ouis
Dundi Raviteja85a240a2018-09-10 15:03:07 +0530115 */
116struct wlan_fwol_ie_whitelist {
117 bool ie_whitelist;
118 uint32_t ie_bitmap_0;
119 uint32_t ie_bitmap_1;
120 uint32_t ie_bitmap_2;
121 uint32_t ie_bitmap_3;
122 uint32_t ie_bitmap_4;
123 uint32_t ie_bitmap_5;
124 uint32_t ie_bitmap_6;
125 uint32_t ie_bitmap_7;
Dundi Raviteja9ab4e7b2018-09-28 14:18:28 +0530126 uint32_t no_of_probe_req_ouis;
127 uint32_t probe_req_voui[MAX_PROBE_REQ_OUIS];
Dundi Raviteja85a240a2018-09-10 15:03:07 +0530128};
129
130/**
Manikandan Mohan06d38d82018-11-26 18:36:58 -0800131 * struct wlan_fwol_neighbor_report_cfg - Neighbor report config params
132 * @enable_bitmask: Neighbor report offload bitmask control
133 * @params_bitmask: Param validity bitmask
134 * @time_offset: Neighbor report frame time offset
135 * @low_rssi_offset: Low RSSI offset
136 * @bmiss_count_trigger: Beacon miss trigger count
137 * @per_threshold_offset: PER Threshold offset
138 * @cache_timeout: Cache timeout
139 * @max_req_cap: Max request per peer
140 */
141struct wlan_fwol_neighbor_report_cfg {
142 uint32_t enable_bitmask;
143 uint32_t params_bitmask;
144 uint32_t time_offset;
145 uint32_t low_rssi_offset;
146 uint32_t bmiss_count_trigger;
147 uint32_t per_threshold_offset;
148 uint32_t cache_timeout;
149 uint32_t max_req_cap;
150};
151
152/**
Sourav Mohapatra113685f2018-08-29 14:21:55 +0530153 * struct wlan_fwol_cfg - fwol config items
Manikandan Mohan06d38d82018-11-26 18:36:58 -0800154 * @coex_config: coex config items
155 * @thermal_temp_cfg: Thermal temperature related config items
156 * @ie_whitelist_cfg: IE Whitelist related config items
157 * @neighbor_report_cfg: 11K neighbor report config
Sourav Mohapatrad9387d82018-09-07 12:28:52 +0530158 * @ani_enabled: ANI enable/disable
159 * @enable_rts_sifsbursting: Enable RTS SIFS Bursting
160 * @max_mpdus_inampdu: Max number of MPDUS
161 * @arp_ac_category: ARP AC category
162 * @enable_phy_reg_retention: Enable PHY reg retention
163 * @upper_brssi_thresh: Upper BRSSI threshold
164 * @lower_brssi_thresh: Lower BRSSI threshold
165 * @enable_dtim_1chrx: Enable/disable DTIM 1 CHRX
166 * @alternative_chainmask_enabled: Alternate chainmask
Sourav Mohapatra0f3b8572018-09-12 10:03:51 +0530167 * @smart_chainmask_enabled: Enable/disable chainmask
168 * @get_rts_profile: Set the RTS profile
169 * @enable_fw_log_level: Set the FW log level
170 * @enable_fw_log_type: Set the FW log type
lifengfaa83cb2018-11-24 01:53:56 +0800171 * @enable_fw_module_log_level: enable fw module log level
172 * @enable_fw_module_log_level_num: enablefw module log level num
Sourav Mohapatra0f3b8572018-09-12 10:03:51 +0530173 * @is_rate_limit_enabled: Enable/disable RA rate limited
174 * @tsf_gpio_pin: TSF GPIO Pin config
Subrat Dash5f36fbe2019-02-12 16:28:14 +0530175 * @tsf_irq_host_gpio_pin: TSF GPIO Pin config
Manikandan Mohand350c192018-11-29 14:01:12 -0800176 * @tsf_ptp_options: TSF Plus feature options config
177 * @lprx_enable: LPRx feature enable config
178 * @sae_enable: SAE feature enable config
179 * @gcmp_enable: GCMP feature enable config
180 * @enable_tx_sch_delay: Enable TX SCH delay value config
181 * @enable_secondary_rate: Enable secondary retry rate config
Sourav Mohapatra0f3b8572018-09-12 10:03:51 +0530182 * @enable_dhcp_server_offload: DHCP Offload is enabled or not
183 * @dhcp_max_num_clients: Max number of DHCP client supported
Harprit Chhabadad59ae762019-01-08 16:40:43 -0800184 * @dwelltime_params: adaptive dwell time parameters
Sourav Mohapatra113685f2018-08-29 14:21:55 +0530185 */
186struct wlan_fwol_cfg {
Sourav Mohapatrad9387d82018-09-07 12:28:52 +0530187 /* Add CFG and INI items here */
Dundi Raviteja3b637092018-09-12 13:42:50 +0530188 struct wlan_fwol_coex_config coex_config;
Dundi Raviteja47ac7092018-09-07 10:40:28 +0530189 struct wlan_fwol_thermal_temp thermal_temp_cfg;
Dundi Raviteja85a240a2018-09-10 15:03:07 +0530190 struct wlan_fwol_ie_whitelist ie_whitelist_cfg;
Manikandan Mohan06d38d82018-11-26 18:36:58 -0800191 struct wlan_fwol_neighbor_report_cfg neighbor_report_cfg;
Sourav Mohapatrad9387d82018-09-07 12:28:52 +0530192 bool ani_enabled;
193 bool enable_rts_sifsbursting;
194 uint8_t max_mpdus_inampdu;
195 uint32_t arp_ac_category;
196 uint8_t enable_phy_reg_retention;
197 uint16_t upper_brssi_thresh;
198 uint16_t lower_brssi_thresh;
199 bool enable_dtim_1chrx;
200 bool alternative_chainmask_enabled;
Sourav Mohapatra0f3b8572018-09-12 10:03:51 +0530201 bool smart_chainmask_enabled;
202 uint16_t get_rts_profile;
203 uint16_t enable_fw_log_level;
204 uint16_t enable_fw_log_type;
lifengfaa83cb2018-11-24 01:53:56 +0800205 uint8_t enable_fw_module_log_level[FW_MODULE_LOG_LEVEL_STRING_LENGTH];
206 uint8_t enable_fw_module_log_level_num;
Sourav Mohapatra0f3b8572018-09-12 10:03:51 +0530207#ifdef FEATURE_WLAN_RA_FILTERING
208 bool is_rate_limit_enabled;
209#endif
210#ifdef WLAN_FEATURE_TSF
211 uint32_t tsf_gpio_pin;
Manikandan Mohand350c192018-11-29 14:01:12 -0800212#ifdef WLAN_FEATURE_TSF_PLUS
213 uint32_t tsf_ptp_options;
Subrat Dash5f36fbe2019-02-12 16:28:14 +0530214#ifdef WLAN_FEATURE_TSF_PLUS_EXT_GPIO_IRQ
215 uint32_t tsf_irq_host_gpio_pin;
216#endif
Sourav Mohapatra0f3b8572018-09-12 10:03:51 +0530217#endif
Manikandan Mohand350c192018-11-29 14:01:12 -0800218#endif
219 bool lprx_enable;
220#ifdef WLAN_FEATURE_SAE
221 bool sae_enable;
222#endif
223 bool gcmp_enable;
224 uint8_t enable_tx_sch_delay;
225 uint32_t enable_secondary_rate;
Sourav Mohapatra0f3b8572018-09-12 10:03:51 +0530226#ifdef DHCP_SERVER_OFFLOAD
227 bool enable_dhcp_server_offload;
228 uint32_t dhcp_max_num_clients;
229#endif
Harprit Chhabadad59ae762019-01-08 16:40:43 -0800230 struct adaptive_dwelltime_params dwelltime_params;
Sourav Mohapatra113685f2018-08-29 14:21:55 +0530231};
232
233/**
234 * struct wlan_fwol_psoc_obj - FW offload psoc priv object
235 * @cfg: cfg items
236 */
237struct wlan_fwol_psoc_obj {
238 struct wlan_fwol_cfg cfg;
239};
240
241/**
242 * wlan_psoc_get_fwol_obj() - private API to get fwol object from psoc
243 * @psoc: psoc object
244 *
245 * Return: fwol object
246 */
247struct wlan_fwol_psoc_obj *fwol_get_psoc_obj(struct wlan_objmgr_psoc *psoc);
248
249/*
250 * fwol_cfg_on_psoc_enable() - Populate FWOL structure from CFG and INI
251 * @psoc: pointer to the psoc object
252 *
253 * Populate the FWOL CFG structure from CFG and INI values using CFG APIs
254 *
255 * Return: QDF_STATUS
256 */
257QDF_STATUS fwol_cfg_on_psoc_enable(struct wlan_objmgr_psoc *psoc);
258
259/*
260 * fwol_cfg_on_psoc_disable() - Clear the CFG structure on psoc disable
261 * @psoc: pointer to the psoc object
262 *
263 * Clear the FWOL CFG structure on psoc disable
264 *
265 * Return: QDF_STATUS
266 */
267QDF_STATUS fwol_cfg_on_psoc_disable(struct wlan_objmgr_psoc *psoc);
Manikandan Mohan06d38d82018-11-26 18:36:58 -0800268
269/*
270 * fwol_init_neighbor_report_cfg() - Populate default neighbor report CFG values
271 * @psoc: pointer to the psoc object
272 * @fwol_neighbor_report_cfg: Pointer to Neighbor report config data structure
273 *
274 * Return: QDF_STATUS
275 */
276QDF_STATUS fwol_init_neighbor_report_cfg(struct wlan_objmgr_psoc *psoc,
277 struct wlan_fwol_neighbor_report_cfg
278 *fwol_neighbor_report_cfg);
Harprit Chhabadad59ae762019-01-08 16:40:43 -0800279
280/**
281 * wlan_fwol_init_adapt_dwelltime_in_cfg - initialize adaptive dwell time params
282 * @psoc: Pointer to struct wlan_objmgr_psoc context
283 * @dwelltime_params: Pointer to dwell time params
284 *
285 * This function parses initialize the adaptive dwell params from ini.
286 *
287 * Return: QDF_STATUS
288 */
289QDF_STATUS
290fwol_init_adapt_dwelltime_in_cfg(
291 struct wlan_objmgr_psoc *psoc,
292 struct adaptive_dwelltime_params *dwelltime_params);
293
294/**
295 * fwol_set_adaptive_dwelltime_config - API to set adaptive dwell params config
296 *
297 * @adaptive_dwelltime_params: adaptive_dwelltime_params structure
298 *
299 * Return: QDF Status
300 */
301QDF_STATUS
302fwol_set_adaptive_dwelltime_config(
303 struct adaptive_dwelltime_params *dwelltime_params);
Sourav Mohapatra113685f2018-08-29 14:21:55 +0530304#endif