Sourav Mohapatra | 113685f | 2018-08-29 14:21:55 +0530 | [diff] [blame] | 1 | /* |
Arun Kumar Khandavalli | a0bb689 | 2020-01-20 12:02:42 +0530 | [diff] [blame] | 2 | * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved. |
Sourav Mohapatra | 113685f | 2018-08-29 14:21:55 +0530 | [diff] [blame] | 3 | * |
| 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: define internal APIs related to the fwol component |
| 20 | */ |
| 21 | |
| 22 | #include "wlan_fw_offload_main.h" |
Harprit Chhabada | d59ae76 | 2019-01-08 16:40:43 -0800 | [diff] [blame] | 23 | #include "cds_api.h" |
| 24 | #include "wma.h" |
Sourav Mohapatra | 113685f | 2018-08-29 14:21:55 +0530 | [diff] [blame] | 25 | |
| 26 | struct wlan_fwol_psoc_obj *fwol_get_psoc_obj(struct wlan_objmgr_psoc *psoc) |
| 27 | { |
| 28 | return wlan_objmgr_psoc_get_comp_private_obj(psoc, |
| 29 | WLAN_UMAC_COMP_FWOL); |
| 30 | } |
| 31 | |
stonez | c9936cb | 2019-03-11 16:41:22 +0800 | [diff] [blame] | 32 | /** |
| 33 | * fwol_mpta_helper_config_get: Populate btc_mpta_helper_enable from cfg |
| 34 | * @psoc: The global psoc handler |
| 35 | * @coex_config: The cfg structure |
| 36 | * |
| 37 | * Return: none |
| 38 | */ |
| 39 | #ifdef FEATURE_MPTA_HELPER |
| 40 | static void |
| 41 | fwol_mpta_helper_config_get(struct wlan_objmgr_psoc *psoc, |
| 42 | struct wlan_fwol_coex_config *coex_config) |
| 43 | { |
| 44 | coex_config->btc_mpta_helper_enable = |
| 45 | cfg_get(psoc, CFG_COEX_MPTA_HELPER); |
| 46 | } |
| 47 | #else |
| 48 | static void |
| 49 | fwol_mpta_helper_config_get(struct wlan_objmgr_psoc *psoc, |
| 50 | struct wlan_fwol_coex_config *coex_config) |
| 51 | { |
| 52 | } |
| 53 | #endif |
| 54 | |
guangde | 963710d | 2019-07-02 15:51:15 +0800 | [diff] [blame] | 55 | /** |
| 56 | * fwol_three_way_coex_config_legacy_config_get: Populate |
| 57 | * btc_three_way_coex_config_legacy_enable from cfg |
| 58 | * @psoc: The global psoc handler |
| 59 | * @coex_config: The cfg structure |
| 60 | * |
| 61 | * Return: none |
| 62 | */ |
| 63 | #ifdef FEATURE_COEX_CONFIG |
| 64 | static void |
| 65 | fwol_three_way_coex_config_legacy_config_get( |
| 66 | struct wlan_objmgr_psoc *psoc, |
| 67 | struct wlan_fwol_coex_config *coex_config) |
| 68 | { |
| 69 | coex_config->btc_three_way_coex_config_legacy_enable = |
| 70 | cfg_get(psoc, CFG_THREE_WAY_COEX_CONFIG_LEGACY); |
| 71 | } |
| 72 | #else |
| 73 | static void |
| 74 | fwol_three_way_coex_config_legacy_config_get( |
| 75 | struct wlan_objmgr_psoc *psoc, |
| 76 | struct wlan_fwol_coex_config *coex_config) |
| 77 | { |
| 78 | } |
| 79 | #endif |
| 80 | |
Dundi Raviteja | 3b63709 | 2018-09-12 13:42:50 +0530 | [diff] [blame] | 81 | static void |
Dundi Raviteja | 85a240a | 2018-09-10 15:03:07 +0530 | [diff] [blame] | 82 | fwol_init_coex_config_in_cfg(struct wlan_objmgr_psoc *psoc, |
| 83 | struct wlan_fwol_coex_config *coex_config) |
Dundi Raviteja | 3b63709 | 2018-09-12 13:42:50 +0530 | [diff] [blame] | 84 | { |
| 85 | coex_config->btc_mode = cfg_get(psoc, CFG_BTC_MODE); |
| 86 | coex_config->antenna_isolation = cfg_get(psoc, CFG_ANTENNA_ISOLATION); |
| 87 | coex_config->max_tx_power_for_btc = |
| 88 | cfg_get(psoc, CFG_MAX_TX_POWER_FOR_BTC); |
| 89 | coex_config->wlan_low_rssi_threshold = |
| 90 | cfg_get(psoc, CFG_WLAN_LOW_RSSI_THRESHOLD); |
| 91 | coex_config->bt_low_rssi_threshold = |
| 92 | cfg_get(psoc, CFG_BT_LOW_RSSI_THRESHOLD); |
| 93 | coex_config->bt_interference_low_ll = |
| 94 | cfg_get(psoc, CFG_BT_INTERFERENCE_LOW_LL); |
| 95 | coex_config->bt_interference_low_ul = |
| 96 | cfg_get(psoc, CFG_BT_INTERFERENCE_LOW_UL); |
| 97 | coex_config->bt_interference_medium_ll = |
| 98 | cfg_get(psoc, CFG_BT_INTERFERENCE_MEDIUM_LL); |
| 99 | coex_config->bt_interference_medium_ul = |
| 100 | cfg_get(psoc, CFG_BT_INTERFERENCE_MEDIUM_UL); |
| 101 | coex_config->bt_interference_high_ll = |
| 102 | cfg_get(psoc, CFG_BT_INTERFERENCE_HIGH_LL); |
| 103 | coex_config->bt_interference_high_ul = |
| 104 | cfg_get(psoc, CFG_BT_INTERFERENCE_HIGH_UL); |
stonez | c9936cb | 2019-03-11 16:41:22 +0800 | [diff] [blame] | 105 | fwol_mpta_helper_config_get(psoc, coex_config); |
hqu | 1dd504a | 2019-06-04 11:24:11 +0800 | [diff] [blame] | 106 | coex_config->bt_sco_allow_wlan_2g_scan = |
| 107 | cfg_get(psoc, CFG_BT_SCO_ALLOW_WLAN_2G_SCAN); |
guangde | 963710d | 2019-07-02 15:51:15 +0800 | [diff] [blame] | 108 | fwol_three_way_coex_config_legacy_config_get(psoc, coex_config); |
Dundi Raviteja | 3b63709 | 2018-09-12 13:42:50 +0530 | [diff] [blame] | 109 | } |
| 110 | |
Dundi Raviteja | 47ac709 | 2018-09-07 10:40:28 +0530 | [diff] [blame] | 111 | static void |
Dundi Raviteja | 85a240a | 2018-09-10 15:03:07 +0530 | [diff] [blame] | 112 | fwol_init_thermal_temp_in_cfg(struct wlan_objmgr_psoc *psoc, |
| 113 | struct wlan_fwol_thermal_temp *thermal_temp) |
Dundi Raviteja | 47ac709 | 2018-09-07 10:40:28 +0530 | [diff] [blame] | 114 | { |
Manikandan Mohan | 9045e2e | 2018-11-26 16:44:19 -0800 | [diff] [blame] | 115 | thermal_temp->thermal_temp_min_level[0] = |
Dundi Raviteja | 47ac709 | 2018-09-07 10:40:28 +0530 | [diff] [blame] | 116 | cfg_get(psoc, CFG_THERMAL_TEMP_MIN_LEVEL0); |
Manikandan Mohan | 9045e2e | 2018-11-26 16:44:19 -0800 | [diff] [blame] | 117 | thermal_temp->thermal_temp_max_level[0] = |
Dundi Raviteja | 47ac709 | 2018-09-07 10:40:28 +0530 | [diff] [blame] | 118 | cfg_get(psoc, CFG_THERMAL_TEMP_MAX_LEVEL0); |
Manikandan Mohan | 9045e2e | 2018-11-26 16:44:19 -0800 | [diff] [blame] | 119 | thermal_temp->thermal_temp_min_level[1] = |
Dundi Raviteja | 47ac709 | 2018-09-07 10:40:28 +0530 | [diff] [blame] | 120 | cfg_get(psoc, CFG_THERMAL_TEMP_MIN_LEVEL1); |
Manikandan Mohan | 9045e2e | 2018-11-26 16:44:19 -0800 | [diff] [blame] | 121 | thermal_temp->thermal_temp_max_level[1] = |
Dundi Raviteja | 47ac709 | 2018-09-07 10:40:28 +0530 | [diff] [blame] | 122 | cfg_get(psoc, CFG_THERMAL_TEMP_MAX_LEVEL1); |
Manikandan Mohan | 9045e2e | 2018-11-26 16:44:19 -0800 | [diff] [blame] | 123 | thermal_temp->thermal_temp_min_level[2] = |
Dundi Raviteja | 47ac709 | 2018-09-07 10:40:28 +0530 | [diff] [blame] | 124 | cfg_get(psoc, CFG_THERMAL_TEMP_MIN_LEVEL2); |
Manikandan Mohan | 9045e2e | 2018-11-26 16:44:19 -0800 | [diff] [blame] | 125 | thermal_temp->thermal_temp_max_level[2] = |
Dundi Raviteja | 47ac709 | 2018-09-07 10:40:28 +0530 | [diff] [blame] | 126 | cfg_get(psoc, CFG_THERMAL_TEMP_MAX_LEVEL2); |
Manikandan Mohan | 9045e2e | 2018-11-26 16:44:19 -0800 | [diff] [blame] | 127 | thermal_temp->thermal_temp_min_level[3] = |
Dundi Raviteja | 47ac709 | 2018-09-07 10:40:28 +0530 | [diff] [blame] | 128 | cfg_get(psoc, CFG_THERMAL_TEMP_MIN_LEVEL3); |
Manikandan Mohan | 9045e2e | 2018-11-26 16:44:19 -0800 | [diff] [blame] | 129 | thermal_temp->thermal_temp_max_level[3] = |
Dundi Raviteja | 47ac709 | 2018-09-07 10:40:28 +0530 | [diff] [blame] | 130 | cfg_get(psoc, CFG_THERMAL_TEMP_MAX_LEVEL3); |
Manikandan Mohan | 9045e2e | 2018-11-26 16:44:19 -0800 | [diff] [blame] | 131 | |
| 132 | thermal_temp->thermal_mitigation_enable = |
| 133 | cfg_get(psoc, CFG_THERMAL_MITIGATION_ENABLE); |
| 134 | thermal_temp->throttle_period = cfg_get(psoc, CFG_THROTTLE_PERIOD); |
Pankaj Singh | 50e4042 | 2020-01-09 15:29:35 +0530 | [diff] [blame^] | 135 | thermal_temp->thermal_sampling_time = |
| 136 | cfg_get(psoc, CFG_THERMAL_SAMPLING_TIME); |
Manikandan Mohan | 9045e2e | 2018-11-26 16:44:19 -0800 | [diff] [blame] | 137 | thermal_temp->throttle_dutycycle_level[0] = |
| 138 | cfg_get(psoc, CFG_THROTTLE_DUTY_CYCLE_LEVEL0); |
Pankaj Singh | 50e4042 | 2020-01-09 15:29:35 +0530 | [diff] [blame^] | 139 | thermal_temp->throttle_dutycycle_level[1] = |
Manikandan Mohan | 9045e2e | 2018-11-26 16:44:19 -0800 | [diff] [blame] | 140 | cfg_get(psoc, CFG_THROTTLE_DUTY_CYCLE_LEVEL1); |
Pankaj Singh | 50e4042 | 2020-01-09 15:29:35 +0530 | [diff] [blame^] | 141 | thermal_temp->throttle_dutycycle_level[2] = |
Manikandan Mohan | 9045e2e | 2018-11-26 16:44:19 -0800 | [diff] [blame] | 142 | cfg_get(psoc, CFG_THROTTLE_DUTY_CYCLE_LEVEL2); |
Pankaj Singh | 50e4042 | 2020-01-09 15:29:35 +0530 | [diff] [blame^] | 143 | thermal_temp->throttle_dutycycle_level[3] = |
Manikandan Mohan | 9045e2e | 2018-11-26 16:44:19 -0800 | [diff] [blame] | 144 | cfg_get(psoc, CFG_THROTTLE_DUTY_CYCLE_LEVEL3); |
Pankaj Singh | 50e4042 | 2020-01-09 15:29:35 +0530 | [diff] [blame^] | 145 | thermal_temp->throttle_dutycycle_level[4] = |
| 146 | cfg_get(psoc, CFG_THROTTLE_DUTY_CYCLE_LEVEL4); |
| 147 | thermal_temp->throttle_dutycycle_level[5] = |
| 148 | cfg_get(psoc, CFG_THROTTLE_DUTY_CYCLE_LEVEL5); |
Dundi Raviteja | 47ac709 | 2018-09-07 10:40:28 +0530 | [diff] [blame] | 149 | } |
| 150 | |
Manikandan Mohan | 06d38d8 | 2018-11-26 18:36:58 -0800 | [diff] [blame] | 151 | QDF_STATUS fwol_init_neighbor_report_cfg(struct wlan_objmgr_psoc *psoc, |
| 152 | struct wlan_fwol_neighbor_report_cfg |
| 153 | *fwol_neighbor_report_cfg) |
| 154 | { |
| 155 | if (!fwol_neighbor_report_cfg) { |
| 156 | fwol_err("Neighbor report config pointer null"); |
| 157 | return QDF_STATUS_E_FAILURE; |
| 158 | } |
| 159 | |
| 160 | fwol_neighbor_report_cfg->enable_bitmask = |
| 161 | cfg_get(psoc, CFG_OFFLOAD_11K_ENABLE_BITMASK); |
| 162 | fwol_neighbor_report_cfg->params_bitmask = |
| 163 | cfg_get(psoc, CFG_OFFLOAD_NEIGHBOR_REPORT_PARAMS_BITMASK); |
| 164 | fwol_neighbor_report_cfg->time_offset = |
| 165 | cfg_get(psoc, CFG_OFFLOAD_NEIGHBOR_REPORT_TIME_OFFSET); |
| 166 | fwol_neighbor_report_cfg->low_rssi_offset = |
| 167 | cfg_get(psoc, CFG_OFFLOAD_NEIGHBOR_REPORT_LOW_RSSI_OFFSET); |
| 168 | fwol_neighbor_report_cfg->bmiss_count_trigger = |
| 169 | cfg_get(psoc, CFG_OFFLOAD_NEIGHBOR_REPORT_BMISS_COUNT_TRIGGER); |
| 170 | fwol_neighbor_report_cfg->per_threshold_offset = |
| 171 | cfg_get(psoc, CFG_OFFLOAD_NEIGHBOR_REPORT_PER_THRESHOLD_OFFSET); |
| 172 | fwol_neighbor_report_cfg->cache_timeout = |
| 173 | cfg_get(psoc, CFG_OFFLOAD_NEIGHBOR_REPORT_CACHE_TIMEOUT); |
| 174 | fwol_neighbor_report_cfg->max_req_cap = |
| 175 | cfg_get(psoc, CFG_OFFLOAD_NEIGHBOR_REPORT_MAX_REQ_CAP); |
| 176 | |
| 177 | return QDF_STATUS_SUCCESS; |
| 178 | } |
| 179 | |
Harprit Chhabada | d59ae76 | 2019-01-08 16:40:43 -0800 | [diff] [blame] | 180 | QDF_STATUS |
| 181 | fwol_init_adapt_dwelltime_in_cfg( |
| 182 | struct wlan_objmgr_psoc *psoc, |
| 183 | struct adaptive_dwelltime_params *dwelltime_params) |
| 184 | { |
| 185 | if (!dwelltime_params) { |
| 186 | fwol_err("dwelltime params config pointer null"); |
| 187 | return QDF_STATUS_E_FAILURE; |
| 188 | } |
| 189 | dwelltime_params->is_enabled = |
| 190 | cfg_get(psoc, CFG_ADAPTIVE_DWELL_MODE_ENABLED); |
| 191 | dwelltime_params->dwelltime_mode = |
| 192 | cfg_get(psoc, CFG_GLOBAL_ADAPTIVE_DWELL_MODE); |
| 193 | dwelltime_params->lpf_weight = |
| 194 | cfg_get(psoc, CFG_ADAPT_DWELL_LPF_WEIGHT); |
| 195 | dwelltime_params->passive_mon_intval = |
| 196 | cfg_get(psoc, CFG_ADAPT_DWELL_PASMON_INTVAL); |
| 197 | dwelltime_params->wifi_act_threshold = |
| 198 | cfg_get(psoc, CFG_ADAPT_DWELL_WIFI_THRESH); |
| 199 | |
| 200 | return QDF_STATUS_SUCCESS; |
| 201 | } |
| 202 | |
| 203 | QDF_STATUS |
| 204 | fwol_set_adaptive_dwelltime_config( |
| 205 | struct adaptive_dwelltime_params *dwelltime_params) |
| 206 | { |
| 207 | tp_wma_handle wma_handle; |
| 208 | QDF_STATUS status; |
| 209 | |
| 210 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 211 | if (!wma_handle) { |
| 212 | fwol_err("wma handle is null"); |
| 213 | return QDF_STATUS_E_FAILURE; |
| 214 | } |
| 215 | status = wma_send_adapt_dwelltime_params(wma_handle, |
| 216 | dwelltime_params); |
| 217 | return status; |
| 218 | } |
Dundi Raviteja | 9ab4e7b | 2018-09-28 14:18:28 +0530 | [diff] [blame] | 219 | /** |
| 220 | * fwol_parse_probe_req_ouis - form ouis from ini gProbeReqOUIs |
| 221 | * @psoc: Pointer to struct wlan_objmgr_psoc context |
| 222 | * @whitelist: Pointer to struct wlan_fwol_ie_whitelist |
| 223 | * |
| 224 | * This function parses the ini string gProbeReqOUIs which needs be to in the |
| 225 | * following format: |
| 226 | * "<8 characters of [0-9] or [A-F]>space<8 characters from [0-9] etc.," |
| 227 | * example: "AABBCCDD 1122EEFF" |
| 228 | * and the logic counts the number of OUIS and allocates the memory |
| 229 | * for every valid OUI and is stored in struct hdd_context |
| 230 | * |
| 231 | * Return: None |
| 232 | */ |
| 233 | static void fwol_parse_probe_req_ouis(struct wlan_objmgr_psoc *psoc, |
| 234 | struct wlan_fwol_ie_whitelist *whitelist) |
| 235 | { |
| 236 | uint8_t probe_req_ouis[MAX_PRB_REQ_VENDOR_OUI_INI_LEN] = {0}; |
| 237 | uint32_t *voui = whitelist->probe_req_voui; |
| 238 | char *str; |
| 239 | uint8_t *token; |
| 240 | uint32_t oui_indx = 0; |
| 241 | int ret; |
| 242 | uint32_t hex_value; |
| 243 | |
| 244 | qdf_str_lcopy(probe_req_ouis, cfg_get(psoc, CFG_PROBE_REQ_OUI), |
| 245 | MAX_PRB_REQ_VENDOR_OUI_INI_LEN); |
| 246 | str = probe_req_ouis; |
| 247 | whitelist->no_of_probe_req_ouis = 0; |
| 248 | |
| 249 | if (!qdf_str_len(str)) { |
Arun Kumar Khandavalli | a0bb689 | 2020-01-20 12:02:42 +0530 | [diff] [blame] | 250 | fwol_debug("NO OUIs to parse"); |
Dundi Raviteja | 9ab4e7b | 2018-09-28 14:18:28 +0530 | [diff] [blame] | 251 | return; |
| 252 | } |
| 253 | |
| 254 | token = strsep(&str, " "); |
| 255 | while (token) { |
| 256 | if (qdf_str_len(token) != 8) |
| 257 | goto next_token; |
| 258 | |
| 259 | ret = qdf_kstrtouint(token, 16, &hex_value); |
| 260 | if (ret) |
| 261 | goto next_token; |
| 262 | |
| 263 | voui[oui_indx++] = cpu_to_be32(hex_value); |
| 264 | if (oui_indx >= MAX_PROBE_REQ_OUIS) |
| 265 | break; |
| 266 | next_token: |
| 267 | token = strsep(&str, " "); |
| 268 | } |
| 269 | |
| 270 | if (!oui_indx) { |
| 271 | whitelist->ie_whitelist = false; |
| 272 | return; |
| 273 | } |
| 274 | |
| 275 | whitelist->no_of_probe_req_ouis = oui_indx; |
| 276 | } |
| 277 | |
| 278 | /** |
| 279 | * fwol_validate_ie_bitmaps() - Validate all IE whitelist bitmap param values |
| 280 | * @psoc: Pointer to struct wlan_objmgr_psoc |
| 281 | * @whitelist: Pointer to struct wlan_fwol_ie_whitelist |
| 282 | * |
| 283 | * Return: True if all bitmap values are valid, else false |
| 284 | */ |
| 285 | static bool fwol_validate_ie_bitmaps(struct wlan_objmgr_psoc *psoc, |
| 286 | struct wlan_fwol_ie_whitelist *whitelist) |
| 287 | { |
| 288 | if (!(whitelist->ie_bitmap_0 && whitelist->ie_bitmap_1 && |
| 289 | whitelist->ie_bitmap_2 && whitelist->ie_bitmap_3 && |
| 290 | whitelist->ie_bitmap_4 && whitelist->ie_bitmap_5 && |
| 291 | whitelist->ie_bitmap_6 && whitelist->ie_bitmap_7)) |
| 292 | return false; |
| 293 | |
| 294 | /* |
| 295 | * check whether vendor oui IE is set and OUIs are present, each OUI |
| 296 | * is entered in the form of string of 8 characters from ini, therefore, |
| 297 | * for atleast one OUI, minimum length is 8 and hence this string length |
| 298 | * is checked for minimum of 8 |
| 299 | */ |
| 300 | if ((whitelist->ie_bitmap_6 & VENDOR_SPECIFIC_IE_BITMAP) && |
| 301 | (qdf_str_len(cfg_get(psoc, CFG_PROBE_REQ_OUI)) < 8)) |
| 302 | return false; |
| 303 | |
| 304 | /* check whether vendor oui IE is not set but OUIs are present */ |
| 305 | if (!(whitelist->ie_bitmap_6 & VENDOR_SPECIFIC_IE_BITMAP) && |
| 306 | (qdf_str_len(cfg_get(psoc, CFG_PROBE_REQ_OUI)) > 0)) |
| 307 | return false; |
| 308 | |
| 309 | return true; |
| 310 | } |
| 311 | |
Dundi Raviteja | 85a240a | 2018-09-10 15:03:07 +0530 | [diff] [blame] | 312 | static void |
| 313 | fwol_init_ie_whiltelist_in_cfg(struct wlan_objmgr_psoc *psoc, |
| 314 | struct wlan_fwol_ie_whitelist *whitelist) |
| 315 | { |
| 316 | whitelist->ie_whitelist = cfg_get(psoc, CFG_PROBE_REQ_IE_WHITELIST); |
| 317 | whitelist->ie_bitmap_0 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP0); |
| 318 | whitelist->ie_bitmap_1 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP1); |
| 319 | whitelist->ie_bitmap_2 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP2); |
| 320 | whitelist->ie_bitmap_3 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP3); |
| 321 | whitelist->ie_bitmap_4 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP4); |
| 322 | whitelist->ie_bitmap_5 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP5); |
| 323 | whitelist->ie_bitmap_6 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP6); |
| 324 | whitelist->ie_bitmap_7 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP7); |
Dundi Raviteja | 9ab4e7b | 2018-09-28 14:18:28 +0530 | [diff] [blame] | 325 | if (!fwol_validate_ie_bitmaps(psoc, whitelist)) |
| 326 | whitelist->ie_whitelist = false; |
| 327 | fwol_parse_probe_req_ouis(psoc, whitelist); |
Dundi Raviteja | 85a240a | 2018-09-10 15:03:07 +0530 | [diff] [blame] | 328 | } |
| 329 | |
Sourav Mohapatra | 0f3b857 | 2018-09-12 10:03:51 +0530 | [diff] [blame] | 330 | /** |
| 331 | * ucfg_fwol_fetch_dhcp_server_settings: Populate the enable_dhcp_server_offload |
| 332 | * and dhcp_max_num_clients from cfg |
| 333 | * @psoc: The global psoc handler |
| 334 | * @fwol_cfg: The cfg structure |
| 335 | * |
| 336 | * Return: none |
| 337 | */ |
| 338 | #ifdef DHCP_SERVER_OFFLOAD |
| 339 | static void ucfg_fwol_fetch_dhcp_server_settings(struct wlan_objmgr_psoc *psoc, |
| 340 | struct wlan_fwol_cfg *fwol_cfg) |
| 341 | { |
| 342 | fwol_cfg->enable_dhcp_server_offload = |
| 343 | cfg_get(psoc, CFG_DHCP_SERVER_OFFLOAD_SUPPORT); |
| 344 | fwol_cfg->dhcp_max_num_clients = |
| 345 | cfg_get(psoc, CFG_DHCP_SERVER_OFFLOAD_NUM_CLIENT); |
| 346 | } |
| 347 | #else |
| 348 | static void ucfg_fwol_fetch_dhcp_server_settings(struct wlan_objmgr_psoc *psoc, |
| 349 | struct wlan_fwol_cfg *fwol_cfg) |
| 350 | { |
| 351 | } |
| 352 | #endif |
| 353 | |
| 354 | /** |
| 355 | * ucfg_fwol_fetch_tsf_gpio_pin: Populate the tsf_gpio_pin from cfg |
| 356 | * @psoc: The global psoc handler |
| 357 | * @fwol_cfg: The cfg structure |
| 358 | * |
| 359 | * Return: none |
| 360 | */ |
| 361 | #ifdef WLAN_FEATURE_TSF |
| 362 | static void ucfg_fwol_fetch_tsf_gpio_pin(struct wlan_objmgr_psoc *psoc, |
| 363 | struct wlan_fwol_cfg *fwol_cfg) |
| 364 | { |
| 365 | fwol_cfg->tsf_gpio_pin = cfg_get(psoc, CFG_SET_TSF_GPIO_PIN); |
| 366 | } |
| 367 | #else |
| 368 | static void ucfg_fwol_fetch_tsf_gpio_pin(struct wlan_objmgr_psoc *psoc, |
| 369 | struct wlan_fwol_cfg *fwol_cfg) |
| 370 | { |
| 371 | } |
| 372 | #endif |
| 373 | |
| 374 | /** |
Manikandan Mohan | d350c19 | 2018-11-29 14:01:12 -0800 | [diff] [blame] | 375 | * ucfg_fwol_init_tsf_ptp_options: Populate the tsf_ptp_options from cfg |
| 376 | * @psoc: The global psoc handler |
| 377 | * @fwol_cfg: The cfg structure |
| 378 | * |
| 379 | * Return: none |
| 380 | */ |
| 381 | #if defined(WLAN_FEATURE_TSF) && defined(WLAN_FEATURE_TSF_PLUS) |
| 382 | static void ucfg_fwol_init_tsf_ptp_options(struct wlan_objmgr_psoc *psoc, |
| 383 | struct wlan_fwol_cfg *fwol_cfg) |
| 384 | { |
| 385 | fwol_cfg->tsf_ptp_options = cfg_get(psoc, CFG_SET_TSF_PTP_OPT); |
| 386 | } |
| 387 | #else |
| 388 | static void ucfg_fwol_init_tsf_ptp_options(struct wlan_objmgr_psoc *psoc, |
| 389 | struct wlan_fwol_cfg *fwol_cfg) |
| 390 | { |
| 391 | } |
| 392 | #endif |
| 393 | |
Subrat Dash | 5f36fbe | 2019-02-12 16:28:14 +0530 | [diff] [blame] | 394 | #ifdef WLAN_FEATURE_TSF_PLUS_EXT_GPIO_IRQ |
| 395 | /** |
| 396 | * ucfg_fwol_fetch_tsf_irq_host_gpio_pin: Populate the |
| 397 | * tsf_irq_host_gpio_pin from cfg |
| 398 | * @psoc: The global psoc handler |
| 399 | * @fwol_cfg: The cfg structure |
| 400 | * |
| 401 | * This function is used to populate the cfg value of host platform |
| 402 | * gpio pin configured to receive tsf interrupt from fw. |
| 403 | * |
| 404 | * Return: none |
| 405 | */ |
| 406 | static void |
| 407 | ucfg_fwol_fetch_tsf_irq_host_gpio_pin(struct wlan_objmgr_psoc *psoc, |
| 408 | struct wlan_fwol_cfg *fwol_cfg) |
| 409 | { |
| 410 | fwol_cfg->tsf_irq_host_gpio_pin = |
| 411 | cfg_get(psoc, CFG_SET_TSF_IRQ_HOST_GPIO_PIN); |
| 412 | } |
| 413 | #else |
| 414 | static void |
| 415 | ucfg_fwol_fetch_tsf_irq_host_gpio_pin(struct wlan_objmgr_psoc *psoc, |
| 416 | struct wlan_fwol_cfg *fwol_cfg) |
| 417 | { |
| 418 | } |
| 419 | #endif |
Subrat Dash | b1e61b2 | 2019-07-22 14:09:34 +0530 | [diff] [blame] | 420 | |
| 421 | #ifdef WLAN_FEATURE_TSF_PLUS_EXT_GPIO_SYNC |
| 422 | /** |
| 423 | * ucfg_fwol_fetch_tsf_sync_host_gpio_pin: Populate the |
| 424 | * tsf_sync_host_gpio_pin from cfg |
| 425 | * @psoc: The global psoc handler |
| 426 | * @fwol_cfg: The cfg structure |
| 427 | * |
| 428 | * This function is used to populate the cfg value of host platform |
| 429 | * gpio pin configured to drive tsf sync interrupt pin on wlan chip. |
| 430 | * |
| 431 | * Return: none |
| 432 | */ |
| 433 | static void |
| 434 | ucfg_fwol_fetch_tsf_sync_host_gpio_pin(struct wlan_objmgr_psoc *psoc, |
| 435 | struct wlan_fwol_cfg *fwol_cfg) |
| 436 | { |
| 437 | fwol_cfg->tsf_sync_host_gpio_pin = |
| 438 | cfg_get(psoc, CFG_SET_TSF_SYNC_HOST_GPIO_PIN); |
| 439 | } |
| 440 | #else |
| 441 | static void |
| 442 | ucfg_fwol_fetch_tsf_sync_host_gpio_pin(struct wlan_objmgr_psoc *psoc, |
| 443 | struct wlan_fwol_cfg *fwol_cfg) |
| 444 | { |
| 445 | } |
| 446 | #endif |
Manikandan Mohan | d350c19 | 2018-11-29 14:01:12 -0800 | [diff] [blame] | 447 | /** |
| 448 | * ucfg_fwol_init_sae_cfg: Populate the sae control config from cfg |
| 449 | * @psoc: The global psoc handler |
| 450 | * @fwol_cfg: The cfg structure |
| 451 | * |
| 452 | * Return: none |
| 453 | */ |
| 454 | #ifdef WLAN_FEATURE_SAE |
| 455 | static void ucfg_fwol_init_sae_cfg(struct wlan_objmgr_psoc *psoc, |
| 456 | struct wlan_fwol_cfg *fwol_cfg) |
| 457 | { |
| 458 | fwol_cfg->sae_enable = cfg_get(psoc, CFG_IS_SAE_ENABLED); |
| 459 | } |
| 460 | #else |
| 461 | static void ucfg_fwol_init_sae_cfg(struct wlan_objmgr_psoc *psoc, |
| 462 | struct wlan_fwol_cfg *fwol_cfg) |
| 463 | { |
| 464 | } |
| 465 | #endif |
| 466 | |
| 467 | /** |
Sourav Mohapatra | 0f3b857 | 2018-09-12 10:03:51 +0530 | [diff] [blame] | 468 | * ucfg_fwol_fetch_ra_filter: Populate the RA filter enabled or not from cfg |
| 469 | * @psoc: The global psoc handler |
| 470 | * @fwol_cfg: The cfg structure |
| 471 | * |
| 472 | * Return: none |
| 473 | */ |
| 474 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 475 | static void ucfg_fwol_fetch_ra_filter(struct wlan_objmgr_psoc *psoc, |
| 476 | struct wlan_fwol_cfg *fwol_cfg) |
| 477 | { |
| 478 | fwol_cfg->is_rate_limit_enabled = cfg_get(psoc, CFG_RA_FILTER_ENABLE); |
| 479 | } |
| 480 | #else |
| 481 | static void ucfg_fwol_fetch_ra_filter(struct wlan_objmgr_psoc *psoc, |
| 482 | struct wlan_fwol_cfg *fwol_cfg) |
| 483 | { |
| 484 | } |
| 485 | #endif |
| 486 | |
Sourav Mohapatra | 113685f | 2018-08-29 14:21:55 +0530 | [diff] [blame] | 487 | QDF_STATUS fwol_cfg_on_psoc_enable(struct wlan_objmgr_psoc *psoc) |
| 488 | { |
| 489 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 490 | struct wlan_fwol_psoc_obj *fwol_obj; |
| 491 | struct wlan_fwol_cfg *fwol_cfg; |
lifeng | faa83cb | 2018-11-24 01:53:56 +0800 | [diff] [blame] | 492 | qdf_size_t enable_fw_module_log_level_num; |
Sourav Mohapatra | 113685f | 2018-08-29 14:21:55 +0530 | [diff] [blame] | 493 | |
| 494 | fwol_obj = fwol_get_psoc_obj(psoc); |
| 495 | if (!fwol_obj) { |
| 496 | fwol_err("Failed to get FWOL Obj"); |
| 497 | return QDF_STATUS_E_FAILURE; |
| 498 | } |
| 499 | |
| 500 | fwol_cfg = &fwol_obj->cfg; |
Dundi Raviteja | 3b63709 | 2018-09-12 13:42:50 +0530 | [diff] [blame] | 501 | |
Dundi Raviteja | 85a240a | 2018-09-10 15:03:07 +0530 | [diff] [blame] | 502 | fwol_init_coex_config_in_cfg(psoc, &fwol_cfg->coex_config); |
| 503 | fwol_init_thermal_temp_in_cfg(psoc, &fwol_cfg->thermal_temp_cfg); |
| 504 | fwol_init_ie_whiltelist_in_cfg(psoc, &fwol_cfg->ie_whitelist_cfg); |
Manikandan Mohan | 06d38d8 | 2018-11-26 18:36:58 -0800 | [diff] [blame] | 505 | fwol_init_neighbor_report_cfg(psoc, &fwol_cfg->neighbor_report_cfg); |
Sourav Mohapatra | d9387d8 | 2018-09-07 12:28:52 +0530 | [diff] [blame] | 506 | fwol_cfg->ani_enabled = cfg_get(psoc, CFG_ENABLE_ANI); |
| 507 | fwol_cfg->enable_rts_sifsbursting = |
| 508 | cfg_get(psoc, CFG_SET_RTS_FOR_SIFS_BURSTING); |
Qun Zhang | 1b3c85c | 2019-08-27 16:31:49 +0800 | [diff] [blame] | 509 | fwol_cfg->enable_sifs_burst = cfg_get(psoc, CFG_SET_SIFS_BURST); |
Sourav Mohapatra | d9387d8 | 2018-09-07 12:28:52 +0530 | [diff] [blame] | 510 | fwol_cfg->max_mpdus_inampdu = cfg_get(psoc, CFG_MAX_MPDUS_IN_AMPDU); |
Sourav Mohapatra | d9387d8 | 2018-09-07 12:28:52 +0530 | [diff] [blame] | 511 | fwol_cfg->enable_phy_reg_retention = cfg_get(psoc, CFG_ENABLE_PHY_REG); |
| 512 | fwol_cfg->upper_brssi_thresh = cfg_get(psoc, CFG_UPPER_BRSSI_THRESH); |
| 513 | fwol_cfg->lower_brssi_thresh = cfg_get(psoc, CFG_LOWER_BRSSI_THRESH); |
| 514 | fwol_cfg->enable_dtim_1chrx = cfg_get(psoc, CFG_DTIM_1CHRX_ENABLE); |
| 515 | fwol_cfg->alternative_chainmask_enabled = |
| 516 | cfg_get(psoc, CFG_ENABLE_COEX_ALT_CHAINMASK); |
Sourav Mohapatra | 0f3b857 | 2018-09-12 10:03:51 +0530 | [diff] [blame] | 517 | fwol_cfg->smart_chainmask_enabled = |
| 518 | cfg_get(psoc, CFG_ENABLE_SMART_CHAINMASK); |
| 519 | fwol_cfg->get_rts_profile = cfg_get(psoc, CFG_ENABLE_FW_RTS_PROFILE); |
| 520 | fwol_cfg->enable_fw_log_level = |
| 521 | cfg_get(psoc, CFG_ENABLE_FW_DEBUG_LOG_LEVEL); |
| 522 | fwol_cfg->enable_fw_log_type = cfg_get(psoc, CFG_ENABLE_FW_LOG_TYPE); |
lifeng | faa83cb | 2018-11-24 01:53:56 +0800 | [diff] [blame] | 523 | qdf_uint8_array_parse(cfg_get(psoc, CFG_ENABLE_FW_MODULE_LOG_LEVEL), |
| 524 | fwol_cfg->enable_fw_module_log_level, |
| 525 | FW_MODULE_LOG_LEVEL_STRING_LENGTH, |
| 526 | &enable_fw_module_log_level_num); |
| 527 | fwol_cfg->enable_fw_module_log_level_num = |
| 528 | (uint8_t)enable_fw_module_log_level_num; |
Manikandan Mohan | d350c19 | 2018-11-29 14:01:12 -0800 | [diff] [blame] | 529 | ucfg_fwol_init_tsf_ptp_options(psoc, fwol_cfg); |
| 530 | ucfg_fwol_init_sae_cfg(psoc, fwol_cfg); |
| 531 | fwol_cfg->lprx_enable = cfg_get(psoc, CFG_LPRX); |
| 532 | fwol_cfg->gcmp_enable = cfg_get(psoc, CFG_ENABLE_GCMP); |
| 533 | fwol_cfg->enable_tx_sch_delay = cfg_get(psoc, CFG_TX_SCH_DELAY); |
| 534 | fwol_cfg->enable_secondary_rate = cfg_get(psoc, |
| 535 | CFG_ENABLE_SECONDARY_RATE); |
Harprit Chhabada | d59ae76 | 2019-01-08 16:40:43 -0800 | [diff] [blame] | 536 | fwol_init_adapt_dwelltime_in_cfg(psoc, &fwol_cfg->dwelltime_params); |
Sourav Mohapatra | 0f3b857 | 2018-09-12 10:03:51 +0530 | [diff] [blame] | 537 | ucfg_fwol_fetch_ra_filter(psoc, fwol_cfg); |
| 538 | ucfg_fwol_fetch_tsf_gpio_pin(psoc, fwol_cfg); |
Subrat Dash | 5f36fbe | 2019-02-12 16:28:14 +0530 | [diff] [blame] | 539 | ucfg_fwol_fetch_tsf_irq_host_gpio_pin(psoc, fwol_cfg); |
Subrat Dash | b1e61b2 | 2019-07-22 14:09:34 +0530 | [diff] [blame] | 540 | ucfg_fwol_fetch_tsf_sync_host_gpio_pin(psoc, fwol_cfg); |
Sourav Mohapatra | 0f3b857 | 2018-09-12 10:03:51 +0530 | [diff] [blame] | 541 | ucfg_fwol_fetch_dhcp_server_settings(psoc, fwol_cfg); |
Sourav Mohapatra | 113685f | 2018-08-29 14:21:55 +0530 | [diff] [blame] | 542 | |
| 543 | return status; |
| 544 | } |
| 545 | |
| 546 | QDF_STATUS fwol_cfg_on_psoc_disable(struct wlan_objmgr_psoc *psoc) |
| 547 | { |
| 548 | /* Clear the CFG structure */ |
| 549 | return QDF_STATUS_SUCCESS; |
| 550 | } |
Paul Zhang | c9dbaee | 2019-06-23 22:07:31 +0800 | [diff] [blame] | 551 | |
| 552 | #ifdef WLAN_FEATURE_ELNA |
| 553 | /** |
| 554 | * fwol_process_get_elna_bypass_resp() - Process get eLNA bypass response |
| 555 | * @event: response event |
| 556 | * |
| 557 | * Return: QDF_STATUS_SUCCESS on success |
| 558 | */ |
| 559 | static QDF_STATUS |
| 560 | fwol_process_get_elna_bypass_resp(struct wlan_fwol_rx_event *event) |
| 561 | { |
| 562 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 563 | struct wlan_objmgr_psoc *psoc; |
| 564 | struct wlan_fwol_psoc_obj *fwol_obj; |
| 565 | struct wlan_fwol_callbacks *cbs; |
| 566 | struct get_elna_bypass_response *resp; |
| 567 | |
| 568 | if (!event) { |
| 569 | fwol_err("Event buffer is NULL"); |
| 570 | return QDF_STATUS_E_FAILURE; |
| 571 | } |
| 572 | |
| 573 | psoc = event->psoc; |
| 574 | if (!psoc) { |
| 575 | fwol_err("psoc is NULL"); |
| 576 | return QDF_STATUS_E_INVAL; |
| 577 | } |
| 578 | |
| 579 | fwol_obj = fwol_get_psoc_obj(psoc); |
| 580 | if (!fwol_obj) { |
| 581 | fwol_err("Failed to get FWOL Obj"); |
| 582 | return QDF_STATUS_E_INVAL; |
| 583 | } |
| 584 | |
| 585 | cbs = &fwol_obj->cbs; |
| 586 | if (cbs->get_elna_bypass_callback) { |
| 587 | resp = &event->get_elna_bypass_response; |
| 588 | cbs->get_elna_bypass_callback(cbs->get_elna_bypass_context, |
| 589 | resp); |
| 590 | } else { |
| 591 | fwol_err("NULL pointer for callback"); |
| 592 | status = QDF_STATUS_E_IO; |
| 593 | } |
| 594 | |
| 595 | return status; |
| 596 | } |
| 597 | #else |
| 598 | static QDF_STATUS |
| 599 | fwol_process_get_elna_bypass_resp(struct wlan_fwol_rx_event *event) |
| 600 | { |
| 601 | return QDF_STATUS_SUCCESS; |
| 602 | } |
| 603 | #endif /* WLAN_FEATURE_ELNA */ |
| 604 | |
| 605 | QDF_STATUS fwol_process_event(struct scheduler_msg *msg) |
| 606 | { |
| 607 | QDF_STATUS status; |
| 608 | struct wlan_fwol_rx_event *event; |
| 609 | |
| 610 | fwol_debug("msg type %d", msg->type); |
| 611 | |
| 612 | if (!(msg->bodyptr)) { |
| 613 | fwol_err("Invalid message body"); |
| 614 | return QDF_STATUS_E_INVAL; |
| 615 | } |
| 616 | |
| 617 | event = msg->bodyptr; |
| 618 | msg->bodyptr = NULL; |
| 619 | |
| 620 | switch (msg->type) { |
| 621 | case WLAN_FWOL_EVT_GET_ELNA_BYPASS_RESPONSE: |
| 622 | status = fwol_process_get_elna_bypass_resp(event); |
| 623 | break; |
| 624 | default: |
| 625 | status = QDF_STATUS_E_INVAL; |
| 626 | break; |
| 627 | } |
| 628 | |
| 629 | fwol_release_rx_event(event); |
| 630 | |
| 631 | return status; |
| 632 | } |
| 633 | |
| 634 | void fwol_release_rx_event(struct wlan_fwol_rx_event *event) |
| 635 | { |
| 636 | if (!event) { |
| 637 | fwol_err("event is NULL"); |
| 638 | return; |
| 639 | } |
| 640 | |
| 641 | if (event->psoc) |
| 642 | wlan_objmgr_psoc_release_ref(event->psoc, WLAN_FWOL_SB_ID); |
| 643 | qdf_mem_free(event); |
| 644 | } |