blob: 4609b7d1fb4c1ab77a533731539a7506ba56fcd1 [file] [log] [blame]
Sourav Mohapatra113685f2018-08-29 14:21:55 +05301/*
Pankaj Singh50e40422020-01-09 15:29:35 +05302 * Copyright (c) 2012 - 2020 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>
Paul Zhangc9dbaee2019-06-23 22:07:31 +080029#include <scheduler_api.h>
Sourav Mohapatra113685f2018-08-29 14:21:55 +053030
Pragaspathi Thilagaraj3cf0f652018-10-29 16:40:35 +053031#include "cfg_ucfg_api.h"
Paul Zhangc9dbaee2019-06-23 22:07:31 +080032#include "wlan_fwol_public_structs.h"
Dundi Raviteja9ab4e7b2018-09-28 14:18:28 +053033
Sourav Mohapatra113685f2018-08-29 14:21:55 +053034#define fwol_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_FWOL, params)
35#define fwol_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_FWOL, params)
36#define fwol_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_FWOL, params)
37#define fwol_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_FWOL, params)
38#define fwol_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_FWOL, params)
39
Nirav Shah0b332192019-03-05 23:13:21 +053040#define fwol_nofl_alert(params...) \
41 QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_FWOL, params)
42#define fwol_nofl_err(params...) \
43 QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_FWOL, params)
44#define fwol_nofl_warn(params...) \
45 QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_FWOL, params)
46#define fwol_nofl_info(params...) \
47 QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_FWOL, params)
48#define fwol_nofl_debug(params...) \
49 QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_FWOL, params)
50
Sourav Mohapatra113685f2018-08-29 14:21:55 +053051/**
Paul Zhangc9dbaee2019-06-23 22:07:31 +080052 * enum wlan_fwol_southbound_event - fw offload south bound event type
53 * @WLAN_FWOL_EVT_GET_ELNA_BYPASS_RESPONSE: get eLNA bypass response
54 */
55enum wlan_fwol_southbound_event {
56 WLAN_FWOL_EVT_INVALID = 0,
57 WLAN_FWOL_EVT_GET_ELNA_BYPASS_RESPONSE,
58 WLAN_FWOL_EVT_LAST,
59 WLAN_FWOL_EVT_MAX = WLAN_FWOL_EVT_LAST - 1
60};
61
62/**
Dundi Raviteja3b637092018-09-12 13:42:50 +053063 * struct wlan_fwol_three_antenna_btc - Three antenna BTC config items
64 * @btc_mode: Config BTC mode
65 * @antenna_isolation: Antenna isolation
66 * @max_tx_power_for_btc: Max wlan tx power in co-ex scenario
67 * @wlan_low_rssi_threshold: Wlan low rssi threshold for BTC mode switching
68 * @bt_low_rssi_threshold: BT low rssi threshold for BTC mode switching
69 * @bt_interference_low_ll: Lower limit of low level BT interference
70 * @bt_interference_low_ul: Upper limit of low level BT interference
71 * @bt_interference_medium_ll: Lower limit of medium level BT interference
72 * @bt_interference_medium_ul: Upper limit of medium level BT interference
73 * @bt_interference_high_ll: Lower limit of high level BT interference
74 * @bt_interference_high_ul: Upper limit of high level BT interference
stonezc9936cb2019-03-11 16:41:22 +080075 * @btc_mpta_helper_enable: Enable/Disable tri-radio MPTA helper
hqu1dd504a2019-06-04 11:24:11 +080076 * @bt_sco_allow_wlan_2g_scan: Enable/Disble wlan 2g scan when
77 * BT SCO connection is on
guangde963710d2019-07-02 15:51:15 +080078 * @btc_three_way_coex_config_legacy_enable: Enable/Disable tri-radio coex
79 * config legacy feature
Dundi Raviteja3b637092018-09-12 13:42:50 +053080 */
81struct wlan_fwol_coex_config {
82 uint8_t btc_mode;
83 uint8_t antenna_isolation;
84 uint8_t max_tx_power_for_btc;
85 int16_t wlan_low_rssi_threshold;
86 int16_t bt_low_rssi_threshold;
87 int16_t bt_interference_low_ll;
88 int16_t bt_interference_low_ul;
89 int16_t bt_interference_medium_ll;
90 int16_t bt_interference_medium_ul;
91 int16_t bt_interference_high_ll;
92 int16_t bt_interference_high_ul;
stonezc9936cb2019-03-11 16:41:22 +080093#ifdef FEATURE_MPTA_HELPER
94 bool btc_mpta_helper_enable;
95#endif
hqu1dd504a2019-06-04 11:24:11 +080096 bool bt_sco_allow_wlan_2g_scan;
guangde963710d2019-07-02 15:51:15 +080097#ifdef FEATURE_COEX_CONFIG
98 bool btc_three_way_coex_config_legacy_enable;
99#endif
Dundi Raviteja3b637092018-09-12 13:42:50 +0530100};
101
Manikandan Mohan9045e2e2018-11-26 16:44:19 -0800102#define FWOL_THERMAL_LEVEL_MAX 4
Pankaj Singh50e40422020-01-09 15:29:35 +0530103#define FWOL_THERMAL_THROTTLE_LEVEL_MAX 6
Dundi Raviteja47ac7092018-09-07 10:40:28 +0530104/*
105 * struct wlan_fwol_thermal_temp - Thermal temperature config items
Manikandan Mohan9045e2e2018-11-26 16:44:19 -0800106 * @thermal_temp_min_level: Array of temperature minimum levels
107 * @thermal_temp_max_level: Array of temperature maximum levels
108 * @thermal_mitigation_enable: Control for Thermal mitigation feature
109 * @throttle_period: Thermal throttle period value
110 * @throttle_dutycycle_level: Array of throttle duty cycle levels
Pankaj Singh50e40422020-01-09 15:29:35 +0530111 * @thermal_sampling_time: sampling time for thermal mitigation in ms
Dundi Raviteja47ac7092018-09-07 10:40:28 +0530112 */
113struct wlan_fwol_thermal_temp {
Manikandan Mohan9045e2e2018-11-26 16:44:19 -0800114 bool thermal_mitigation_enable;
115 uint32_t throttle_period;
116 uint16_t thermal_temp_min_level[FWOL_THERMAL_LEVEL_MAX];
117 uint16_t thermal_temp_max_level[FWOL_THERMAL_LEVEL_MAX];
118 uint32_t throttle_dutycycle_level[FWOL_THERMAL_THROTTLE_LEVEL_MAX];
Pankaj Singh50e40422020-01-09 15:29:35 +0530119 uint16_t thermal_sampling_time;
Dundi Raviteja47ac7092018-09-07 10:40:28 +0530120};
121
Dundi Raviteja3b637092018-09-12 13:42:50 +0530122/**
Dundi Raviteja85a240a2018-09-10 15:03:07 +0530123 * struct wlan_fwol_ie_whitelist - Probe request IE whitelist config items
Dundi Raviteja9ab4e7b2018-09-28 14:18:28 +0530124 * @ie_whitelist: IE whitelist flag
125 * @ie_bitmap_0: IE bitmap 0
126 * @ie_bitmap_1: IE bitmap 1
127 * @ie_bitmap_2: IE bitmap 2
128 * @ie_bitmap_3: IE bitmap 3
129 * @ie_bitmap_4: IE bitmap 4
130 * @ie_bitmap_5: IE bitmap 5
131 * @ie_bitmap_6: IE bitmap 6
132 * @ie_bitmap_7: IE bitmap 7
133 * @no_of_probe_req_ouis: Total number of ouis present in probe req
134 * @probe_req_voui: Stores oui values after parsing probe req ouis
Dundi Raviteja85a240a2018-09-10 15:03:07 +0530135 */
136struct wlan_fwol_ie_whitelist {
137 bool ie_whitelist;
138 uint32_t ie_bitmap_0;
139 uint32_t ie_bitmap_1;
140 uint32_t ie_bitmap_2;
141 uint32_t ie_bitmap_3;
142 uint32_t ie_bitmap_4;
143 uint32_t ie_bitmap_5;
144 uint32_t ie_bitmap_6;
145 uint32_t ie_bitmap_7;
Dundi Raviteja9ab4e7b2018-09-28 14:18:28 +0530146 uint32_t no_of_probe_req_ouis;
147 uint32_t probe_req_voui[MAX_PROBE_REQ_OUIS];
Dundi Raviteja85a240a2018-09-10 15:03:07 +0530148};
149
150/**
Manikandan Mohan06d38d82018-11-26 18:36:58 -0800151 * struct wlan_fwol_neighbor_report_cfg - Neighbor report config params
152 * @enable_bitmask: Neighbor report offload bitmask control
153 * @params_bitmask: Param validity bitmask
154 * @time_offset: Neighbor report frame time offset
155 * @low_rssi_offset: Low RSSI offset
156 * @bmiss_count_trigger: Beacon miss trigger count
157 * @per_threshold_offset: PER Threshold offset
158 * @cache_timeout: Cache timeout
159 * @max_req_cap: Max request per peer
160 */
161struct wlan_fwol_neighbor_report_cfg {
162 uint32_t enable_bitmask;
163 uint32_t params_bitmask;
164 uint32_t time_offset;
165 uint32_t low_rssi_offset;
166 uint32_t bmiss_count_trigger;
167 uint32_t per_threshold_offset;
168 uint32_t cache_timeout;
169 uint32_t max_req_cap;
170};
171
172/**
Sourav Mohapatra113685f2018-08-29 14:21:55 +0530173 * struct wlan_fwol_cfg - fwol config items
Manikandan Mohan06d38d82018-11-26 18:36:58 -0800174 * @coex_config: coex config items
175 * @thermal_temp_cfg: Thermal temperature related config items
176 * @ie_whitelist_cfg: IE Whitelist related config items
177 * @neighbor_report_cfg: 11K neighbor report config
Sourav Mohapatrad9387d82018-09-07 12:28:52 +0530178 * @ani_enabled: ANI enable/disable
179 * @enable_rts_sifsbursting: Enable RTS SIFS Bursting
Qun Zhang1b3c85c2019-08-27 16:31:49 +0800180 * @enable_sifs_burst: Enable SIFS burst
Sourav Mohapatrad9387d82018-09-07 12:28:52 +0530181 * @max_mpdus_inampdu: Max number of MPDUS
Sourav Mohapatrad9387d82018-09-07 12:28:52 +0530182 * @enable_phy_reg_retention: Enable PHY reg retention
183 * @upper_brssi_thresh: Upper BRSSI threshold
184 * @lower_brssi_thresh: Lower BRSSI threshold
185 * @enable_dtim_1chrx: Enable/disable DTIM 1 CHRX
186 * @alternative_chainmask_enabled: Alternate chainmask
Sourav Mohapatra0f3b8572018-09-12 10:03:51 +0530187 * @smart_chainmask_enabled: Enable/disable chainmask
188 * @get_rts_profile: Set the RTS profile
189 * @enable_fw_log_level: Set the FW log level
190 * @enable_fw_log_type: Set the FW log type
lifengfaa83cb2018-11-24 01:53:56 +0800191 * @enable_fw_module_log_level: enable fw module log level
192 * @enable_fw_module_log_level_num: enablefw module log level num
Sourav Mohapatra0f3b8572018-09-12 10:03:51 +0530193 * @is_rate_limit_enabled: Enable/disable RA rate limited
194 * @tsf_gpio_pin: TSF GPIO Pin config
Subrat Dash5f36fbe2019-02-12 16:28:14 +0530195 * @tsf_irq_host_gpio_pin: TSF GPIO Pin config
Subrat Dashb1e61b22019-07-22 14:09:34 +0530196 * @tsf_sync_host_gpio_pin: TSF Sync GPIO Pin config
Manikandan Mohand350c192018-11-29 14:01:12 -0800197 * @tsf_ptp_options: TSF Plus feature options config
198 * @lprx_enable: LPRx feature enable config
199 * @sae_enable: SAE feature enable config
200 * @gcmp_enable: GCMP feature enable config
201 * @enable_tx_sch_delay: Enable TX SCH delay value config
202 * @enable_secondary_rate: Enable secondary retry rate config
Sourav Mohapatra0f3b8572018-09-12 10:03:51 +0530203 * @enable_dhcp_server_offload: DHCP Offload is enabled or not
204 * @dhcp_max_num_clients: Max number of DHCP client supported
Harprit Chhabadad59ae762019-01-08 16:40:43 -0800205 * @dwelltime_params: adaptive dwell time parameters
Sourav Mohapatra113685f2018-08-29 14:21:55 +0530206 */
207struct wlan_fwol_cfg {
Sourav Mohapatrad9387d82018-09-07 12:28:52 +0530208 /* Add CFG and INI items here */
Dundi Raviteja3b637092018-09-12 13:42:50 +0530209 struct wlan_fwol_coex_config coex_config;
Dundi Raviteja47ac7092018-09-07 10:40:28 +0530210 struct wlan_fwol_thermal_temp thermal_temp_cfg;
Dundi Raviteja85a240a2018-09-10 15:03:07 +0530211 struct wlan_fwol_ie_whitelist ie_whitelist_cfg;
Manikandan Mohan06d38d82018-11-26 18:36:58 -0800212 struct wlan_fwol_neighbor_report_cfg neighbor_report_cfg;
Sourav Mohapatrad9387d82018-09-07 12:28:52 +0530213 bool ani_enabled;
214 bool enable_rts_sifsbursting;
Qun Zhang1b3c85c2019-08-27 16:31:49 +0800215 uint8_t enable_sifs_burst;
Sourav Mohapatrad9387d82018-09-07 12:28:52 +0530216 uint8_t max_mpdus_inampdu;
Sourav Mohapatrad9387d82018-09-07 12:28:52 +0530217 uint8_t enable_phy_reg_retention;
218 uint16_t upper_brssi_thresh;
219 uint16_t lower_brssi_thresh;
220 bool enable_dtim_1chrx;
221 bool alternative_chainmask_enabled;
Sourav Mohapatra0f3b8572018-09-12 10:03:51 +0530222 bool smart_chainmask_enabled;
223 uint16_t get_rts_profile;
224 uint16_t enable_fw_log_level;
225 uint16_t enable_fw_log_type;
lifengfaa83cb2018-11-24 01:53:56 +0800226 uint8_t enable_fw_module_log_level[FW_MODULE_LOG_LEVEL_STRING_LENGTH];
227 uint8_t enable_fw_module_log_level_num;
Sourav Mohapatra0f3b8572018-09-12 10:03:51 +0530228#ifdef FEATURE_WLAN_RA_FILTERING
229 bool is_rate_limit_enabled;
230#endif
231#ifdef WLAN_FEATURE_TSF
232 uint32_t tsf_gpio_pin;
Manikandan Mohand350c192018-11-29 14:01:12 -0800233#ifdef WLAN_FEATURE_TSF_PLUS
234 uint32_t tsf_ptp_options;
Subrat Dash5f36fbe2019-02-12 16:28:14 +0530235#ifdef WLAN_FEATURE_TSF_PLUS_EXT_GPIO_IRQ
236 uint32_t tsf_irq_host_gpio_pin;
237#endif
Subrat Dashb1e61b22019-07-22 14:09:34 +0530238#ifdef WLAN_FEATURE_TSF_PLUS_EXT_GPIO_SYNC
239 uint32_t tsf_sync_host_gpio_pin;
240#endif
Sourav Mohapatra0f3b8572018-09-12 10:03:51 +0530241#endif
Manikandan Mohand350c192018-11-29 14:01:12 -0800242#endif
243 bool lprx_enable;
244#ifdef WLAN_FEATURE_SAE
245 bool sae_enable;
246#endif
247 bool gcmp_enable;
248 uint8_t enable_tx_sch_delay;
249 uint32_t enable_secondary_rate;
Sourav Mohapatra0f3b8572018-09-12 10:03:51 +0530250#ifdef DHCP_SERVER_OFFLOAD
251 bool enable_dhcp_server_offload;
252 uint32_t dhcp_max_num_clients;
253#endif
Harprit Chhabadad59ae762019-01-08 16:40:43 -0800254 struct adaptive_dwelltime_params dwelltime_params;
Sourav Mohapatra113685f2018-08-29 14:21:55 +0530255};
256
257/**
258 * struct wlan_fwol_psoc_obj - FW offload psoc priv object
259 * @cfg: cfg items
Paul Zhangc9dbaee2019-06-23 22:07:31 +0800260 * @cbs: callback functions
261 * @tx_ops: tx operations for target interface
262 * @rx_ops: rx operations for target interface
Sourav Mohapatra113685f2018-08-29 14:21:55 +0530263 */
264struct wlan_fwol_psoc_obj {
265 struct wlan_fwol_cfg cfg;
Paul Zhangc9dbaee2019-06-23 22:07:31 +0800266 struct wlan_fwol_callbacks cbs;
267 struct wlan_fwol_tx_ops tx_ops;
268 struct wlan_fwol_rx_ops rx_ops;
269};
270
271/**
272 * struct wlan_fwol_rx_event - event from south bound
273 * @psoc: psoc handle
274 * @event_id: event ID
275 * @get_elna_bypass_response: get eLNA bypass response
276 */
277struct wlan_fwol_rx_event {
278 struct wlan_objmgr_psoc *psoc;
279 enum wlan_fwol_southbound_event event_id;
280 union {
281#ifdef WLAN_FEATURE_ELNA
282 struct get_elna_bypass_response get_elna_bypass_response;
283#endif
284 };
Sourav Mohapatra113685f2018-08-29 14:21:55 +0530285};
286
287/**
288 * wlan_psoc_get_fwol_obj() - private API to get fwol object from psoc
289 * @psoc: psoc object
290 *
291 * Return: fwol object
292 */
293struct wlan_fwol_psoc_obj *fwol_get_psoc_obj(struct wlan_objmgr_psoc *psoc);
294
295/*
296 * fwol_cfg_on_psoc_enable() - Populate FWOL structure from CFG and INI
297 * @psoc: pointer to the psoc object
298 *
299 * Populate the FWOL CFG structure from CFG and INI values using CFG APIs
300 *
301 * Return: QDF_STATUS
302 */
303QDF_STATUS fwol_cfg_on_psoc_enable(struct wlan_objmgr_psoc *psoc);
304
305/*
306 * fwol_cfg_on_psoc_disable() - Clear the CFG structure on psoc disable
307 * @psoc: pointer to the psoc object
308 *
309 * Clear the FWOL CFG structure on psoc disable
310 *
311 * Return: QDF_STATUS
312 */
313QDF_STATUS fwol_cfg_on_psoc_disable(struct wlan_objmgr_psoc *psoc);
Manikandan Mohan06d38d82018-11-26 18:36:58 -0800314
Paul Zhangc9dbaee2019-06-23 22:07:31 +0800315/**
316 * fwol_process_event() - API to process event from south bound
317 * @msg: south bound message
318 *
319 * Return: QDF_STATUS_SUCCESS on success
320 */
321QDF_STATUS fwol_process_event(struct scheduler_msg *msg);
322
323/*
324 * fwol_release_rx_event() - Release fw offload RX event
325 * @event: fw offload RX event
326 *
327 * Return: none
328 */
329void fwol_release_rx_event(struct wlan_fwol_rx_event *event);
330
Manikandan Mohan06d38d82018-11-26 18:36:58 -0800331/*
332 * fwol_init_neighbor_report_cfg() - Populate default neighbor report CFG values
333 * @psoc: pointer to the psoc object
334 * @fwol_neighbor_report_cfg: Pointer to Neighbor report config data structure
335 *
336 * Return: QDF_STATUS
337 */
338QDF_STATUS fwol_init_neighbor_report_cfg(struct wlan_objmgr_psoc *psoc,
339 struct wlan_fwol_neighbor_report_cfg
340 *fwol_neighbor_report_cfg);
Harprit Chhabadad59ae762019-01-08 16:40:43 -0800341
342/**
343 * wlan_fwol_init_adapt_dwelltime_in_cfg - initialize adaptive dwell time params
344 * @psoc: Pointer to struct wlan_objmgr_psoc context
345 * @dwelltime_params: Pointer to dwell time params
346 *
347 * This function parses initialize the adaptive dwell params from ini.
348 *
349 * Return: QDF_STATUS
350 */
351QDF_STATUS
352fwol_init_adapt_dwelltime_in_cfg(
353 struct wlan_objmgr_psoc *psoc,
354 struct adaptive_dwelltime_params *dwelltime_params);
355
356/**
357 * fwol_set_adaptive_dwelltime_config - API to set adaptive dwell params config
358 *
359 * @adaptive_dwelltime_params: adaptive_dwelltime_params structure
360 *
361 * Return: QDF Status
362 */
363QDF_STATUS
364fwol_set_adaptive_dwelltime_config(
365 struct adaptive_dwelltime_params *dwelltime_params);
Sourav Mohapatra113685f2018-08-29 14:21:55 +0530366#endif