blob: 1d1d1c8bfd8de413860cef494eedb8b447f9a25c [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Abhishek Singh5432c352019-01-02 17:11:44 +05302 * 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
19/*
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080020 * This file lim_utils.h contains the utility definitions
21 * LIM uses.
22 * Author: Chandra Modumudi
23 * Date: 02/13/02
24 * History:-
25 * Date Modified by Modification Information
26 * --------------------------------------------------------------------
27 */
28#ifndef __LIM_UTILS_H
29#define __LIM_UTILS_H
30
31#include "sir_api.h"
32#include "sir_debug.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080033
34#include "lim_types.h"
35#include "lim_scan_result_utils.h"
36#include "lim_timer_utils.h"
37#include "lim_trace.h"
Abhishek Singh3d30a3b2018-09-12 15:49:18 +053038#include "include/wlan_vdev_mlme.h"
Abhishek Singh20a8e442018-09-12 15:50:44 +053039#include "wlan_mlme_vdev_mgr_interface.h"
Jeff Johnsonb07230f2019-02-19 17:47:39 -080040#include "wlan_qct_sys.h"
Abhishek Singh3d30a3b2018-09-12 15:49:18 +053041
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080042typedef enum {
43 ONE_BYTE = 1,
44 TWO_BYTE = 2
45} eSizeOfLenField;
46
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080047#define LIM_AID_MASK 0xC000
48#define LIM_SPECTRUM_MANAGEMENT_BIT_MASK 0x0100
49#define LIM_RRM_BIT_MASK 0x1000
50#define LIM_SHORT_PREAMBLE_BIT_MASK 0x0020
51#define LIM_IMMEDIATE_BLOCK_ACK_MASK 0x8000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080052#define LIM_MAX_REASSOC_RETRY_LIMIT 2
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080053
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080054#define VHT_MCS_3x3_MASK 0x30
55#define VHT_MCS_2x2_MASK 0x0C
56
Kiran Kumar Lokeree38f4d22016-10-20 17:30:59 -070057#define CENTER_FREQ_DIFF_160MHz 8
58#define CENTER_FREQ_DIFF_80P80MHz 16
59
Kiran Kumar Lokere05a0658a2018-02-01 21:34:27 -080060#define CH_TO_CNTR_FREQ_DIFF_160MHz 14
61#define CH_TO_CNTR_FREQ_DIFF_80MHz 6
62
Kiran Kumar Lokere9e58d232016-08-23 18:49:16 -070063#define IS_VHT_NSS_1x1(__mcs_map) ((__mcs_map & 0xFFFC) == 0xFFFC)
64
Sreelakshmi Konamki6d478cd2017-03-28 11:59:25 +053065#define MGMT_RX_PACKETS_THRESHOLD 200
66
Arif Hussain1513cb22018-01-05 19:56:31 -080067/* 11B AP detection bit position */
68#define OBSS_DETECTION_11B_AP_BIT_MASK 0x0001
69/* 11B STA detection bit position */
70#define OBSS_DETECTION_11B_STA_BIT_MASK 0x0002
71/* 11G AP detection bit position */
72#define OBSS_DETECTION_11G_AP_BIT_MASK 0x0004
73/* 11A AP detection bit position */
74#define OBSS_DETECTION_11A_BIT_MASK 0x0008
75/* HT legacy detection bit position */
76#define OBSS_DETECTION_HT_LEGACY_BIT_MASK 0x0010
77/* HT mixed detection bit position */
78#define OBSS_DETECTION_HT_MIXED_BIT_MASK 0x0020
79/* HT 20mhz detection bit position */
80#define OBSS_DETECTION_HT_20MHZ_BIT_MASK 0x0040
81
82/**
83 * OBSS detection period in ms, used by firmware to decide
84 * absent detection and also gap between same detection ind.
85 */
86#define OBSS_DETECTION_PERIOD_MS 4000
87
88/* To check if 11B AP detection bit set */
89#define OBSS_DETECTION_IS_11B_AP(_m) ((_m) & OBSS_DETECTION_11B_AP_BIT_MASK)
90/* To check if 11B STA detection bit set */
91#define OBSS_DETECTION_IS_11B_STA(_m) ((_m) & OBSS_DETECTION_11B_STA_BIT_MASK)
92/* To check if 11G AP detection bit set */
93#define OBSS_DETECTION_IS_11G_AP(_m) ((_m) & OBSS_DETECTION_11G_AP_BIT_MASK)
94/* To check if 11A AP detection bit set */
95#define OBSS_DETECTION_IS_11A(_m) ((_m) & OBSS_DETECTION_11A_BIT_MASK)
96/* To check if HT legacy detection bit set */
97#define OBSS_DETECTION_IS_HT_LEGACY(_m) \
98 ((_m) & OBSS_DETECTION_HT_LEGACY_BIT_MASK)
99/* To check if HT mixed detection bit set */
100#define OBSS_DETECTION_IS_HT_MIXED(_m) ((_m) & OBSS_DETECTION_HT_MIXED_BIT_MASK)
101/* To check if HT 20mhz detection bit set */
102#define OBSS_DETECTION_IS_HT_20MHZ(_m) ((_m) & OBSS_DETECTION_HT_20MHZ_BIT_MASK)
103
Abhishek Singh8c54e382019-03-19 17:43:43 +0530104#define MAX_WAIT_FOR_BCN_TX_COMPLETE 4000
105
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800106#ifdef WLAN_FEATURE_11W
107typedef union uPmfSaQueryTimerId {
108 struct {
109 uint8_t sessionId;
110 uint16_t peerIdx;
111 } fields;
112 uint32_t value;
113} tPmfSaQueryTimerId, *tpPmfSaQueryTimerId;
114#endif
115
Arif Hussain776ee7a2016-11-10 20:28:50 -0800116typedef struct last_processed_frame {
117 tSirMacAddr sa;
118 uint16_t seq_num;
119} last_processed_msg;
120
Rajeev Kumar Sirasanagandla1a21bf62019-04-08 15:28:57 +0530121/**
122 * struct lim_max_tx_pwr_attr - List of tx powers from various sources
123 * @reg_max: power from regulatory database
124 * @ap_tx_power: local power constraint adjusted value
125 * @ini_tx_power: Max tx power from ini config
126 * @frequency: current operating frequency for which above powers are defined
127 */
128struct lim_max_tx_pwr_attr {
129 int8_t reg_max;
130 int8_t ap_tx_power;
131 uint8_t ini_tx_power;
132 uint32_t frequency;
133};
134
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800135/* LIM utility functions */
Arif Hussain776ee7a2016-11-10 20:28:50 -0800136bool lim_is_valid_frame(last_processed_msg *last_processed_frm,
137 uint8_t *pRxPacketInfo);
138void lim_update_last_processed_frame(last_processed_msg *last_processed_frm,
139 uint8_t *pRxPacketInfo);
Jeff Johnsonc1847232018-12-27 16:49:31 -0800140
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800141char *lim_dot11_reason_str(uint16_t reasonCode);
142char *lim_mlm_state_str(tLimMlmStates state);
143char *lim_sme_state_str(tLimSmeStates state);
144char *lim_msg_str(uint32_t msgType);
145char *lim_result_code_str(tSirResultCodes resultCode);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800146char *lim_dot11_mode_str(struct mac_context *mac, uint8_t dot11Mode);
147void lim_print_mlm_state(struct mac_context *mac, uint16_t logLevel,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800148 tLimMlmStates state);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800149void lim_print_sme_state(struct mac_context *mac, uint16_t logLevel,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800150 tLimSmeStates state);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800151void lim_print_msg_name(struct mac_context *mac, uint16_t logLevel, uint32_t msgType);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800152
Jeff Johnson47498452019-03-07 10:32:49 -0800153QDF_STATUS lim_send_set_max_tx_power_req(struct mac_context *mac,
Amar Singhala297bfa2015-10-15 15:07:29 -0700154 int8_t txPower,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800155 struct pe_session *pe_session);
Rajeev Kumar Sirasanagandla1a21bf62019-04-08 15:28:57 +0530156
157/**
158 * lim_get_max_tx_power() - Utility to get maximum tx power
159 * @mac: mac handle
160 * @attr: pointer to buffer containing list of tx powers
161 *
162 * This function is used to get the maximum possible tx power from the list
163 * of tx powers mentioned in @attr.
164 *
165 * Return: Max tx power
166 */
167uint8_t lim_get_max_tx_power(struct mac_context *mac,
168 struct lim_max_tx_pwr_attr *attr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800169
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800170/* AID pool management functions */
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800171void lim_init_peer_idxpool(struct mac_context *, struct pe_session *);
172uint16_t lim_assign_peer_idx(struct mac_context *, struct pe_session *);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800173
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800174void lim_enable_overlap11g_protection(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800175 tpUpdateBeaconParams pBeaconParams,
176 tpSirMacMgmtHdr pMh,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800177 struct pe_session *pe_session);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800178void lim_update_overlap_sta_param(struct mac_context *mac, tSirMacAddr bssId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800179 tpLimProtStaParams pStaParams);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800180void lim_update_short_preamble(struct mac_context *mac, tSirMacAddr peerMacAddr,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800181 tpUpdateBeaconParams pBeaconParams,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800182 struct pe_session *pe_session);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800183void lim_update_short_slot_time(struct mac_context *mac, tSirMacAddr peerMacAddr,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800184 tpUpdateBeaconParams pBeaconParams,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800185 struct pe_session *pe_session);
Abhinav Kumar49d08a72018-02-14 17:36:12 +0530186
187/*
188 * lim_send_sme_mgmt_frame_ind() - Function to send mgmt frame ind to HDD
Srinivas Dasariea1c1332019-02-18 12:43:23 +0530189 * @mac_ctx: Pointer to Global MAC structure
190 * @frame_type: Type of mgmt frame
191 * @frame: Frame pointer
192 * @frame_len: Length og mgmt frame
193 * @session_id: session id
194 * @psession_entry: PE Session Entry
195 * @rx_channel: Channel of where packet is received
196 * @rx_rssi: rssi value
197 * @rx_flags: RXMGMT flags to be set for the frame. Defined in enum rxmgmt_flags
Abhinav Kumar49d08a72018-02-14 17:36:12 +0530198 *
199 * Indicate the Mgmt Frame received to SME to HDD callback
200 * handle Probe_req/Action frame currently
201 *
202 * Return: None
203*/
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800204void lim_send_sme_mgmt_frame_ind(struct mac_context *mac_ctx, uint8_t frame_type,
Abhinav Kumar49d08a72018-02-14 17:36:12 +0530205 uint8_t *frame, uint32_t frame_len,
206 uint16_t session_id, uint32_t rx_channel,
Srinivas Dasariea1c1332019-02-18 12:43:23 +0530207 struct pe_session *psession_entry,
208 int8_t rx_rssi, enum rxmgmt_flags rx_flags);
Abhinav Kumar49d08a72018-02-14 17:36:12 +0530209
210/*
yeshwanth sriram guntuka7112fad2017-07-27 19:00:08 +0530211 * lim_deactivate_timers() - Function to deactivate lim timers
212 * @mac_ctx: Pointer to global mac structure
213 *
214 * This function is used to deactivate lim timers
215 *
216 * Return: None
217 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800218void lim_deactivate_timers(struct mac_context *mac_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800219
220/*
221 * The below 'product' check tobe removed if 'Association' is
222 * allowed in IBSS.
223 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800224void lim_release_peer_idx(struct mac_context *, uint16_t, struct pe_session *);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800225
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800226void lim_decide_ap_protection(struct mac_context *mac, tSirMacAddr peerMacAddr,
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800227 tpUpdateBeaconParams pBeaconParams, struct pe_session *);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800228void lim_decide_ap_protection_on_delete(struct mac_context *mac,
Jeff Johnsonbddc03e2019-01-17 15:37:09 -0800229 tpDphHashNode sta,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800230 tpUpdateBeaconParams pBeaconParams,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800231 struct pe_session *pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800232
Jeff Johnson47498452019-03-07 10:32:49 -0800233QDF_STATUS lim_update_11a_protection(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800234 uint8_t enable,
235 uint8_t overlap,
236 tpUpdateBeaconParams pBeaconParams,
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800237 struct pe_session *);
Jeff Johnson47498452019-03-07 10:32:49 -0800238QDF_STATUS lim_enable11g_protection(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800239 uint8_t enable,
240 uint8_t overlap,
241 tpUpdateBeaconParams pBeaconParams,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800242 struct pe_session *pe_session);
Jeff Johnson47498452019-03-07 10:32:49 -0800243QDF_STATUS lim_enable_ht_protection_from11g(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800244 uint8_t enable,
245 uint8_t overlap,
246 tpUpdateBeaconParams
247 pBeaconParams,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800248 struct pe_session *pe_session);
Jeff Johnson47498452019-03-07 10:32:49 -0800249QDF_STATUS lim_enable_ht20_protection(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800250 uint8_t enable, uint8_t overlap,
251 tpUpdateBeaconParams pBeaconParams,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800252 struct pe_session *pe_session);
Jeff Johnson47498452019-03-07 10:32:49 -0800253QDF_STATUS lim_enable_ht_non_gf_protection(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800254 uint8_t enable, uint8_t overlap,
255 tpUpdateBeaconParams
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800256 pBeaconParams, struct pe_session *);
Jeff Johnson47498452019-03-07 10:32:49 -0800257QDF_STATUS lim_enable_ht_rifs_protection(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800258 uint8_t enable, uint8_t overlap,
259 tpUpdateBeaconParams
260 pBeaconParams,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800261 struct pe_session *pe_session);
Jeff Johnson47498452019-03-07 10:32:49 -0800262QDF_STATUS lim_enable_ht_lsig_txop_protection(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800263 uint8_t enable,
264 uint8_t overlap,
265 tpUpdateBeaconParams
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800266 pBeaconParams, struct pe_session *);
Jeff Johnson47498452019-03-07 10:32:49 -0800267QDF_STATUS lim_enable_short_preamble(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800268 uint8_t enable,
269 tpUpdateBeaconParams pBeaconParams,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800270 struct pe_session *pe_session);
Jeff Johnson47498452019-03-07 10:32:49 -0800271QDF_STATUS lim_enable_ht_obss_protection(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800272 uint8_t enable, uint8_t overlap,
273 tpUpdateBeaconParams
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800274 pBeaconParams, struct pe_session *);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800275void lim_decide_sta_protection(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800276 tpSchBeaconStruct pBeaconStruct,
277 tpUpdateBeaconParams pBeaconParams,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800278 struct pe_session *pe_session);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800279void lim_decide_sta_protection_on_assoc(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800280 tpSchBeaconStruct pBeaconStruct,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800281 struct pe_session *pe_session);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800282void lim_update_sta_run_time_ht_switch_chnl_params(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800283 tDot11fIEHTInfo *pHTInfo,
Pragaspathi Thilagaraje05162d2019-05-23 13:10:46 +0530284 uint8_t bss_idx,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800285 struct pe_session *pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800286/* Print MAC address utility function */
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800287void lim_print_mac_addr(struct mac_context *, tSirMacAddr, uint8_t);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800288
289/* Deferred Message Queue read/write */
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800290uint8_t lim_write_deferred_msg_q(struct mac_context *mac,
Rajeev Kumarfeb96382017-01-22 19:42:09 -0800291 struct scheduler_msg *limMsg);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800292struct scheduler_msg *lim_read_deferred_msg_q(struct mac_context *mac);
293void lim_handle_defer_msg_error(struct mac_context *mac,
Rajeev Kumarfeb96382017-01-22 19:42:09 -0800294 struct scheduler_msg *pLimMsg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800295
296/* Deferred Message Queue Reset */
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800297void lim_reset_deferred_msg_q(struct mac_context *mac);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800298
Harprit Chhabadae20b5562019-03-11 14:13:42 -0700299static inline void lim_sys_process_mmh_msg_api(struct mac_context *mac,
300 struct scheduler_msg *msg)
Jeff Johnsona5abe272019-01-06 12:52:02 -0800301{
302 sys_process_mmh_msg(mac, msg);
Jeff Johnsona5abe272019-01-06 12:52:02 -0800303}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800304
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800305void lim_handle_update_olbc_cache(struct mac_context *mac);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800306
307uint8_t lim_is_null_ssid(tSirMacSSid *pSsid);
308
309/* 11h Support */
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800310void lim_stop_tx_and_switch_channel(struct mac_context *mac, uint8_t sessionId);
Jianmin Zhua9005b32018-12-06 21:30:45 +0800311
312/**
313 * lim_process_channel_switch_timeout() - Process chanel switch timeout
314 * @mac: pointer to Global MAC structure
315 *
316 * Return: none
317 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800318void lim_process_channel_switch_timeout(struct mac_context *);
319QDF_STATUS lim_start_channel_switch(struct mac_context *mac,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800320 struct pe_session *pe_session);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800321void lim_update_channel_switch(struct mac_context *, tpSirProbeRespBeacon,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800322 struct pe_session *pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800323
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800324void lim_switch_primary_channel(struct mac_context *, uint8_t, struct pe_session *);
325void lim_switch_primary_secondary_channel(struct mac_context *mac,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800326 struct pe_session *pe_session,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800327 uint8_t newChannel,
328 uint8_t ch_center_freq_seg0,
329 uint8_t ch_center_freq_seg1,
Kiran Kumar Lokere13644672016-02-29 15:40:10 -0800330 enum phy_ch_width ch_width);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800331void lim_update_sta_run_time_ht_capability(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800332 tDot11fIEHTCaps *pHTCaps);
Jeff Johnson0a0f42a2018-11-21 20:42:36 -0800333void lim_update_sta_run_time_ht_info(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800334 tDot11fIEHTInfo *pRcvdHTInfo,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800335 struct pe_session *pe_session);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800336void lim_cancel_dot11h_channel_switch(struct mac_context *mac,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800337 struct pe_session *pe_session);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800338bool lim_is_channel_valid_for_channel_switch(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800339 uint8_t channel);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800340QDF_STATUS lim_restore_pre_channel_switch_state(struct mac_context *mac,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800341 struct pe_session *pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800342
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800343void lim_prepare_for11h_channel_switch(struct mac_context *mac,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800344 struct pe_session *pe_session);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800345void lim_switch_channel_cback(struct mac_context *mac, QDF_STATUS status,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800346 uint32_t *data, struct pe_session *pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800347
Arif Hussain7631afa2017-02-08 14:35:00 -0800348/**
Pragaspathi Thilagaraj30251ec2018-12-18 17:22:57 +0530349 * lim_assoc_rej_get_remaining_delta() - Get remaining time delta for
350 * the rssi based disallowed list entry
351 * @node: rssi based disallowed list entry
352 *
353 * Return: remaining delta, can be -ve if time has already expired.
354 */
355int
356lim_assoc_rej_get_remaining_delta(struct sir_rssi_disallow_lst *node);
357
358/**
359 * lim_rem_blacklist_entry_with_lowest_delta() - Remove the entry with lowest
360 * time delta
361 * @list: rssi based rejected BSSID list
362 *
363 * Return: QDF_STATUS
364 */
365QDF_STATUS
366lim_rem_blacklist_entry_with_lowest_delta(qdf_list_t *list);
367
368/**
Arif Hussain7631afa2017-02-08 14:35:00 -0800369 * lim_get_session_by_macaddr() - api to find session based on MAC
370 * @mac_ctx: Pointer to global mac structure.
371 * @self_mac: MAC address.
372 *
373 * This function is used to get session for given MAC address.
374 *
375 * Return: session pointer if exists, NULL otherwise.
376 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800377struct csr_roam_session *lim_get_session_by_macaddr(struct mac_context *mac_ctx,
Arif Hussain7631afa2017-02-08 14:35:00 -0800378 tSirMacAddr self_mac);
379
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -0800380static inline enum band_info lim_get_rf_band(uint8_t channel)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800381{
382 if ((channel >= SIR_11A_CHANNEL_BEGIN) &&
383 (channel <= SIR_11A_CHANNEL_END))
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -0800384 return BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800385
386 if ((channel >= SIR_11B_CHANNEL_BEGIN) &&
387 (channel <= SIR_11B_CHANNEL_END))
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -0800388 return BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800389
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -0800390 return BAND_UNKNOWN;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800391}
392
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700393static inline QDF_STATUS
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800394lim_get_mgmt_staid(struct mac_context *mac, uint16_t *staid,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800395 struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800396{
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800397 if (LIM_IS_AP_ROLE(pe_session))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800398 *staid = 1;
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800399 else if (LIM_IS_STA_ROLE(pe_session))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800400 *staid = 0;
401 else
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700402 return QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800403
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700404 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800405}
406
Jeff Johnsonbddc03e2019-01-17 15:37:09 -0800407static inline int lim_select_cb_mode(tDphHashNode *sta,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800408 struct pe_session *pe_session, uint8_t channel,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800409 uint8_t chan_bw)
410{
Jeff Johnsonbddc03e2019-01-17 15:37:09 -0800411 if (sta->mlmStaContext.vhtCapability && chan_bw) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800412 if (channel == 36 || channel == 52 || channel == 100 ||
413 channel == 116 || channel == 149) {
414 return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1;
415 } else if (channel == 40 || channel == 56 || channel == 104 ||
416 channel == 120 || channel == 153) {
417 return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW - 1;
418 } else if (channel == 44 || channel == 60 || channel == 108 ||
419 channel == 124 || channel == 157) {
420 return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH - 1;
421 } else if (channel == 48 || channel == 64 || channel == 112 ||
422 channel == 128 || channel == 161) {
423 return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH - 1;
424 } else if (channel == 165) {
425 return PHY_SINGLE_CHANNEL_CENTERED;
426 }
Jeff Johnsonbddc03e2019-01-17 15:37:09 -0800427 } else if (sta->mlmStaContext.htCapability) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800428 if (channel == 40 || channel == 48 || channel == 56 ||
429 channel == 64 || channel == 104 || channel == 112 ||
430 channel == 120 || channel == 128 || channel == 136 ||
431 channel == 144 || channel == 153 || channel == 161) {
432 return PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
433 } else if (channel == 36 || channel == 44 || channel == 52 ||
434 channel == 60 || channel == 100 ||
435 channel == 108 || channel == 116 ||
436 channel == 124 || channel == 132 ||
437 channel == 140 || channel == 149 ||
438 channel == 157) {
439 return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
440 } else if (channel == 165) {
441 return PHY_SINGLE_CHANNEL_CENTERED;
442 }
443 }
444 return PHY_SINGLE_CHANNEL_CENTERED;
445}
446
447/* ANI peer station count management and associated actions */
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800448void lim_util_count_sta_add(struct mac_context *mac, tpDphHashNode pSta,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800449 struct pe_session *pe_session);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800450void lim_util_count_sta_del(struct mac_context *mac, tpDphHashNode pSta,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800451 struct pe_session *pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800452
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800453uint8_t lim_get_ht_capability(struct mac_context *, uint32_t, struct pe_session *);
Jeff Johnson8390fe22018-06-09 21:59:32 -0700454QDF_STATUS lim_tx_complete(void *context, qdf_nbuf_t buf, bool free);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800455
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800456QDF_STATUS lim_validate_delts_req(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800457 tpSirDeltsReq pDeltsReq,
458 tSirMacAddr peerMacAddr,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800459 struct pe_session *pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800460
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800461void lim_pkt_free(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800462 eFrameType frmType, uint8_t *pBD, void *body);
463
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800464void lim_get_b_dfrom_rx_packet(struct mac_context *mac, void *body, uint32_t **pBD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800465
466/**
467 * utils_power_xy() - calc result of base raised to power
468 * @base: Base value
469 * @power: Base raised to this Power value
470 *
471 * Given a base(X) and power(Y), this API will return
472 * the result of base raised to power - (X ^ Y)
473 *
474 * Return: Result of X^Y
475 *
476 */
477static inline uint32_t utils_power_xy(uint16_t base, uint16_t power)
478{
479 uint32_t result = 1, i;
480
481 for (i = 0; i < power; i++)
482 result *= base;
483
484 return result;
485}
486
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800487QDF_STATUS lim_post_sm_state_update(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800488 uint16_t StaIdx,
489 tSirMacHTMIMOPowerSaveState MIMOPSState,
490 uint8_t *pPeerStaMac, uint8_t sessionId);
491
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800492void lim_delete_sta_context(struct mac_context *mac, struct scheduler_msg *limMsg);
493void lim_delete_dialogue_token_list(struct mac_context *mac);
gaoleze5108942017-03-31 16:56:42 +0800494
495/**
496 * lim_add_channel_status_info() - store
497 * chan status info into Global MAC structure
498 * @p_mac: Pointer to Global MAC structure
499 * @channel_stat: Pointer to chan status info reported by firmware
500 * @channel_id: current channel id
501 *
502 * Return: None
503 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800504void lim_add_channel_status_info(struct mac_context *p_mac,
gaoleze5108942017-03-31 16:56:42 +0800505 struct lim_channel_status *channel_stat,
506 uint8_t channel_id);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800507uint8_t lim_get_channel_from_beacon(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800508 tpSchBeaconStruct pBeacon);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800509tSirNwType lim_get_nw_type(struct mac_context *mac, uint8_t channelNum,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800510 uint32_t type, tpSchBeaconStruct pBeacon);
511
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800512void lim_set_tspec_uapsd_mask_per_session(struct mac_context *mac,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800513 struct pe_session *pe_session,
Jeff Johnson312348f2018-12-22 13:33:54 -0800514 struct mac_ts_info *pTsInfo, uint32_t action);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800515
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800516void lim_handle_heart_beat_timeout_for_session(struct mac_context *mac,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800517 struct pe_session *pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800518
Jeff Johnson579fcdc2018-12-29 20:32:26 -0800519/**
520 * lim_process_add_sta_rsp() - process WDA_ADD_STA_RSP from WMA
521 * @mac_ctx: Pointer to Global MAC structure
522 * @msg: msg from WMA
523 *
524 * Return: void
525 */
526void lim_process_add_sta_rsp(struct mac_context *mac_ctx,
527 struct scheduler_msg *msg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800528
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800529void lim_update_beacon(struct mac_context *mac);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800530
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800531void lim_process_ap_mlm_add_sta_rsp(struct mac_context *mac,
Rajeev Kumarfeb96382017-01-22 19:42:09 -0800532 struct scheduler_msg *limMsgQ,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800533 struct pe_session *pe_session);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800534void lim_process_ap_mlm_del_bss_rsp(struct mac_context *mac,
Rajeev Kumar416b73f2017-01-21 16:45:21 -0800535 struct scheduler_msg *limMsgQ,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800536 struct pe_session *pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800537
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800538void lim_process_ap_mlm_del_sta_rsp(struct mac_context *mac,
Rajeev Kumar416b73f2017-01-21 16:45:21 -0800539 struct scheduler_msg *limMsgQ,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800540 struct pe_session *pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800541
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800542struct pe_session *lim_is_ibss_session_active(struct mac_context *mac);
543struct pe_session *lim_is_ap_session_active(struct mac_context *mac);
544void lim_handle_heart_beat_failure_timeout(struct mac_context *mac);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800545
Jeff Johnson0a0f42a2018-11-21 20:42:36 -0800546#define limGetWscIEPtr(mac, ie, ie_len) \
Naveen Rawat08db88f2017-09-08 15:07:48 -0700547 wlan_get_vendor_ie_ptr_from_oui(SIR_MAC_WSC_OUI, \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800548 SIR_MAC_WSC_OUI_SIZE, ie, ie_len)
549
Jeff Johnson0a0f42a2018-11-21 20:42:36 -0800550#define limGetP2pIEPtr(mac, ie, ie_len) \
Naveen Rawat08db88f2017-09-08 15:07:48 -0700551 wlan_get_vendor_ie_ptr_from_oui(SIR_MAC_P2P_OUI, \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800552 SIR_MAC_P2P_OUI_SIZE, ie, ie_len)
553
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800554uint8_t lim_get_noa_attr_stream(struct mac_context *mac, uint8_t *pNoaStream,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800555 struct pe_session *pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800556
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800557uint8_t lim_build_p2p_ie(struct mac_context *mac, uint8_t *ie, uint8_t *data,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800558 uint8_t ie_len);
Jeff Johnson47ead062018-12-16 15:01:06 -0800559
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800560bool lim_isconnected_on_dfs_channel(struct mac_context *mac_ctx,
Jeff Johnson81b60652018-12-16 14:40:42 -0800561 uint8_t currentChannel);
562
563uint32_t lim_get_max_rate_flags(struct mac_context *mac_ctx,
564 tpDphHashNode sta_ds);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800565
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800566bool lim_check_vht_op_mode_change(struct mac_context *mac,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800567 struct pe_session *pe_session,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800568 uint8_t chanWidth, uint8_t staId,
569 uint8_t *peerMac);
Krunal Sonib7f20432017-04-27 13:01:02 -0700570#ifdef WLAN_FEATURE_11AX_BSS_COLOR
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800571bool lim_send_he_ie_update(struct mac_context *mac_ctx, struct pe_session *pe_session);
Krunal Sonib7f20432017-04-27 13:01:02 -0700572#endif
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800573bool lim_set_nss_change(struct mac_context *mac, struct pe_session *pe_session,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800574 uint8_t rxNss, uint8_t staId, uint8_t *peerMac);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800575bool lim_check_membership_user_position(struct mac_context *mac,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800576 struct pe_session *pe_session,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800577 uint32_t membership, uint32_t userPosition,
578 uint8_t staId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800579
Abhishek Singhdd2cb572017-08-11 11:10:19 +0530580/**
581 * enum ack_status - Indicate TX status of ASSOC/AUTH
582 * @ACKED : Ack is received.
583 * @NOT_ACKED : No Ack received.
584 * @SENT_FAIL : Failure while sending.
585 *
586 * Indicate if driver is waiting for ACK status of assoc/auth or ACK received
587 * for ASSOC/AUTH OR NO ACK is received for the assoc/auth sent or assoc/auth
588 * sent failed.
589 */
590enum assoc_ack_status {
591 ACKED,
592 NOT_ACKED,
593 SENT_FAIL,
594};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800595
596typedef enum {
597 WLAN_PE_DIAG_SCAN_REQ_EVENT = 0,
598 WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT,
599 WLAN_PE_DIAG_SCAN_RSP_EVENT,
600 WLAN_PE_DIAG_JOIN_REQ_EVENT,
601 WLAN_PE_DIAG_JOIN_RSP_EVENT,
602 WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT,
603 WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT,
604 WLAN_PE_DIAG_REASSOC_REQ_EVENT,
605 WLAN_PE_DIAG_REASSOC_RSP_EVENT,
606 WLAN_PE_DIAG_AUTH_REQ_EVENT,
607 WLAN_PE_DIAG_AUTH_RSP_EVENT = 10,
608 WLAN_PE_DIAG_DISASSOC_REQ_EVENT,
609 WLAN_PE_DIAG_DISASSOC_RSP_EVENT,
610 WLAN_PE_DIAG_DISASSOC_IND_EVENT,
611 WLAN_PE_DIAG_DISASSOC_CNF_EVENT,
612 WLAN_PE_DIAG_DEAUTH_REQ_EVENT,
613 WLAN_PE_DIAG_DEAUTH_RSP_EVENT,
614 WLAN_PE_DIAG_DEAUTH_IND_EVENT,
615 WLAN_PE_DIAG_START_BSS_REQ_EVENT,
616 WLAN_PE_DIAG_START_BSS_RSP_EVENT,
617 WLAN_PE_DIAG_AUTH_IND_EVENT = 20,
618 WLAN_PE_DIAG_ASSOC_IND_EVENT,
619 WLAN_PE_DIAG_ASSOC_CNF_EVENT,
620 WLAN_PE_DIAG_REASSOC_IND_EVENT,
621 WLAN_PE_DIAG_SWITCH_CHL_IND_EVENT,
Prakash Dhavalid8e666c2016-11-24 16:36:57 +0530622 WLAN_PE_DIAG_SWITCH_CHL_RSP_EVENT,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800623 WLAN_PE_DIAG_STOP_BSS_REQ_EVENT,
624 WLAN_PE_DIAG_STOP_BSS_RSP_EVENT,
625 WLAN_PE_DIAG_DEAUTH_CNF_EVENT,
626 WLAN_PE_DIAG_ADDTS_REQ_EVENT,
Prakash Dhavalid8e666c2016-11-24 16:36:57 +0530627 WLAN_PE_DIAG_ADDTS_RSP_EVENT = 30,
Jeff Johnson66ebf152017-10-11 14:17:55 -0700628 WLAN_PE_DIAG_DELTS_REQ_EVENT,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800629 WLAN_PE_DIAG_DELTS_RSP_EVENT,
630 WLAN_PE_DIAG_DELTS_IND_EVENT,
631 WLAN_PE_DIAG_ENTER_BMPS_REQ_EVENT,
632 WLAN_PE_DIAG_ENTER_BMPS_RSP_EVENT,
633 WLAN_PE_DIAG_EXIT_BMPS_REQ_EVENT,
634 WLAN_PE_DIAG_EXIT_BMPS_RSP_EVENT,
635 WLAN_PE_DIAG_EXIT_BMPS_IND_EVENT,
Prakash Dhavalid8e666c2016-11-24 16:36:57 +0530636 WLAN_PE_DIAG_ENTER_IMPS_REQ_EVENT,
637 WLAN_PE_DIAG_ENTER_IMPS_RSP_EVENT = 40,
638 WLAN_PE_DIAG_EXIT_IMPS_REQ_EVENT,
639 WLAN_PE_DIAG_EXIT_IMPS_RSP_EVENT,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800640 WLAN_PE_DIAG_ENTER_UAPSD_REQ_EVENT,
641 WLAN_PE_DIAG_ENTER_UAPSD_RSP_EVENT,
Jeff Johnson66ebf152017-10-11 14:17:55 -0700642 WLAN_PE_DIAG_EXIT_UAPSD_REQ_EVENT,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800643 WLAN_PE_DIAG_EXIT_UAPSD_RSP_EVENT,
644 WLAN_PE_DIAG_WOWL_ADD_BCAST_PTRN_EVENT,
645 WLAN_PE_DIAG_WOWL_DEL_BCAST_PTRN_EVENT,
646 WLAN_PE_DIAG_ENTER_WOWL_REQ_EVENT,
Prakash Dhavalid8e666c2016-11-24 16:36:57 +0530647 WLAN_PE_DIAG_ENTER_WOWL_RSP_EVENT = 50,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800648 WLAN_PE_DIAG_EXIT_WOWL_REQ_EVENT,
649 WLAN_PE_DIAG_EXIT_WOWL_RSP_EVENT,
Prakash Dhavalid8e666c2016-11-24 16:36:57 +0530650 WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT,
651 WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT,
652 WLAN_PE_DIAG_HAL_DELBA_IND_EVENT,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800653 WLAN_PE_DIAG_HB_FAILURE_TIMEOUT,
654 WLAN_PE_DIAG_PRE_AUTH_REQ_EVENT,
Prakash Dhavalid8e666c2016-11-24 16:36:57 +0530655 WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800656 WLAN_PE_DIAG_PREAUTH_DONE,
Prakash Dhavalid8e666c2016-11-24 16:36:57 +0530657 WLAN_PE_DIAG_REASSOCIATING = 60,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800658 WLAN_PE_DIAG_CONNECTED,
659 WLAN_PE_DIAG_ASSOC_REQ_EVENT,
660 WLAN_PE_DIAG_AUTH_COMP_EVENT,
661 WLAN_PE_DIAG_ASSOC_COMP_EVENT,
662 WLAN_PE_DIAG_AUTH_START_EVENT,
663 WLAN_PE_DIAG_ASSOC_START_EVENT,
664 WLAN_PE_DIAG_REASSOC_START_EVENT,
Prakash Dhavalid8e666c2016-11-24 16:36:57 +0530665 WLAN_PE_DIAG_ROAM_AUTH_START_EVENT,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800666 WLAN_PE_DIAG_ROAM_AUTH_COMP_EVENT,
Prakash Dhavalid8e666c2016-11-24 16:36:57 +0530667 WLAN_PE_DIAG_ROAM_ASSOC_START_EVENT = 70,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800668 WLAN_PE_DIAG_ROAM_ASSOC_COMP_EVENT,
Sreelakshmi Konamki1bb6f312016-12-08 12:32:01 +0530669 WLAN_PE_DIAG_SCAN_COMPLETE_EVENT,
670 WLAN_PE_DIAG_SCAN_RESULT_FOUND_EVENT,
Padma, Santhosh Kumare7835652016-08-10 19:11:40 +0530671 WLAN_PE_DIAG_ASSOC_TIMEOUT,
672 WLAN_PE_DIAG_AUTH_TIMEOUT,
Sen, Devendra154b3c42017-02-13 20:44:15 +0530673 WLAN_PE_DIAG_DEAUTH_FRAME_EVENT,
674 WLAN_PE_DIAG_DISASSOC_FRAME_EVENT,
Abhishek Singhdd2cb572017-08-11 11:10:19 +0530675 WLAN_PE_DIAG_AUTH_ACK_EVENT,
676 WLAN_PE_DIAG_ASSOC_ACK_EVENT,
Abhinav Kumar85561672018-04-17 12:48:51 +0530677 WLAN_PE_DIAG_AUTH_ALGO_NUM,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800678} WLAN_PE_DIAG_EVENT_TYPE;
679
Abhishek Singhdd2cb572017-08-11 11:10:19 +0530680#ifdef FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800681void lim_diag_event_report(struct mac_context *mac, uint16_t eventType,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800682 struct pe_session *pe_session, uint16_t status,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800683 uint16_t reasonCode);
Krunal Sonic65fc492018-03-09 15:53:28 -0800684/**
685 * lim_diag_mgmt_tx_event_report() - to log TX event to external application
686 * @mac_ctx: mac context
687 * @mgmt_hdr: 802.11 mgmt header of given frame
688 * @session: PE session for given frame
689 * @result_code: result code of to be populated in TX frame
690 * @reason_code: reason code if TX OTA status
691 *
692 * Anytime driver sends some mgmt frame down to firmware for OTA delivery,
693 * log mgmt frame through DIAG utility. Don't log frames which come too
694 * excessively.
695 *
696 * Return: void
697 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800698void lim_diag_mgmt_tx_event_report(struct mac_context *mac_ctx, void *mgmt_hdr,
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800699 struct pe_session *session, uint16_t result_code,
Krunal Sonic65fc492018-03-09 15:53:28 -0800700 uint16_t reason_code);
701/**
702 * lim_diag_mgmt_rx_event_report() - to log RX event to external application
703 * @mac_ctx: mac context
704 * @mgmt_hdr: 802.11 mgmt header of given frame
705 * @session: PE session for given frame
706 * @result_code: result code given in RX frame
707 * @reason_code: reason code for RX OTA status
708 *
709 * Anytime driver receives some mgmt frame from firmware OTA,
710 * log mgmt frame through DIAG utility. Don't log frames which come too
711 * excessively.
712 *
713 * Return: void
714 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800715void lim_diag_mgmt_rx_event_report(struct mac_context *mac_ctx, void *mgmt_hdr,
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800716 struct pe_session *session, uint16_t result_code,
Krunal Sonic65fc492018-03-09 15:53:28 -0800717 uint16_t reason_code);
Abhishek Singhdd2cb572017-08-11 11:10:19 +0530718#else
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800719static inline void lim_diag_event_report(struct mac_context *mac, uint16_t
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800720 eventType, struct pe_session *pe_session, uint16_t status,
Abhishek Singhdd2cb572017-08-11 11:10:19 +0530721 uint16_t reasonCode) {}
Qiwei Caiba95ce62018-08-23 10:43:16 +0800722static inline
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800723void lim_diag_mgmt_tx_event_report(struct mac_context *mac_ctx, void *mgmt_hdr,
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800724 struct pe_session *session, uint16_t result_code,
Krunal Sonic65fc492018-03-09 15:53:28 -0800725 uint16_t reason_code) {}
Qiwei Caiba95ce62018-08-23 10:43:16 +0800726static inline
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800727void lim_diag_mgmt_rx_event_report(struct mac_context *mac_ctx, void *mgmt_hdr,
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800728 struct pe_session *session, uint16_t result_code,
Krunal Sonic65fc492018-03-09 15:53:28 -0800729 uint16_t reason_code) {}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800730#endif /* FEATURE_WLAN_DIAG_SUPPORT */
731
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800732void pe_set_resume_channel(struct mac_context *mac, uint16_t channel,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800733 ePhyChanBondState cbState);
734
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800735void lim_get_short_slot_from_phy_mode(struct mac_context *mac,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800736 struct pe_session *pe_session,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800737 uint32_t phyMode, uint8_t *pShortSlotEnable);
738
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800739void lim_clean_up_disassoc_deauth_req(struct mac_context *mac, uint8_t *staMac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800740 bool cleanRxPath);
741
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800742bool lim_check_disassoc_deauth_ack_pending(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800743 uint8_t *staMac);
744
745#ifdef WLAN_FEATURE_11W
746void lim_pmf_sa_query_timer_handler(void *pMacGlobal, uint32_t param);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800747void lim_set_protected_bit(struct mac_context *mac,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800748 struct pe_session *pe_session,
Abhishek Singhcfb44482017-03-10 12:42:37 +0530749 tSirMacAddr peer, tpSirMacMgmtHdr pMacHdr);
750#else
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800751static inline void lim_set_protected_bit(struct mac_context *mac,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800752 struct pe_session *pe_session,
Abhishek Singhcfb44482017-03-10 12:42:37 +0530753 tSirMacAddr peer, tpSirMacMgmtHdr pMacHdr) {}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800754#endif /* WLAN_FEATURE_11W */
755
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800756void lim_set_ht_caps(struct mac_context *p_mac,
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800757 struct pe_session *p_session_ntry,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800758 uint8_t *p_ie_start,
759 uint32_t num_bytes);
760
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800761void lim_set_vht_caps(struct mac_context *p_mac,
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800762 struct pe_session *p_session_entry,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800763 uint8_t *p_ie_start,
764 uint32_t num_bytes);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800765bool lim_validate_received_frame_a1_addr(struct mac_context *mac_ctx,
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800766 tSirMacAddr a1, struct pe_session *session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800767void lim_set_stads_rtt_cap(tpDphHashNode sta_ds, struct s_ext_cap *ext_cap,
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800768 struct mac_context *mac_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800769
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800770void lim_check_and_reset_protection_params(struct mac_context *mac_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800771
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800772QDF_STATUS lim_send_ext_cap_ie(struct mac_context *mac_ctx, uint32_t session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800773 tDot11fIEExtCap *extracted_extcap, bool merge);
774
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800775QDF_STATUS lim_send_ies_per_band(struct mac_context *mac_ctx,
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800776 struct pe_session *session, uint8_t vdev_id);
Naveen Rawat03e8d952016-08-01 15:22:20 -0700777
Kiran Kumar Lokereee205772018-09-27 00:27:27 -0700778/**
779 * lim_send_action_frm_tb_ppdu_cfg() - sets action frame in TB PPDU cfg to FW
780 * @mac_ctx: global MAC context
781 * @session_id: SME session id
782 * @cfg: config setting
783 *
784 * Preapres the vendor action frame and send action frame in HE TB PPDU
785 * configuration to FW.
786 *
787 * Return: QDF_STATUS
788 */
789QDF_STATUS lim_send_action_frm_tb_ppdu_cfg(struct mac_context *mac_ctx,
790 uint32_t session_id,
791 uint8_t cfg);
792
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800793void lim_update_extcap_struct(struct mac_context *mac_ctx, uint8_t *buf,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800794 tDot11fIEExtCap *ext_cap);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800795QDF_STATUS lim_strip_extcap_update_struct(struct mac_context *mac_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800796 uint8_t *addn_ie, uint16_t *addn_ielen, tDot11fIEExtCap *dst);
Hu Wangfbd279d2016-10-31 18:24:34 +0800797void lim_merge_extcap_struct(tDot11fIEExtCap *dst, tDot11fIEExtCap *src,
798 bool add);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800799
Krunal Sonid3c86d42017-10-19 12:12:21 -0700800#ifdef WLAN_FEATURE_11W
801/**
802 * lim_del_pmf_sa_query_timer() - This function deletes SA query timer
803 * @mac_ctx: pointer to mac context
804 * @pe_session: pointer to PE session
805 *
806 * This API is to delete the PMF SA query timer created for each associated STA
807 *
808 * Return: none
809 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800810void lim_del_pmf_sa_query_timer(struct mac_context *mac_ctx, struct pe_session *pe_session);
Krunal Sonid3c86d42017-10-19 12:12:21 -0700811#else
812/**
813 * lim_del_pmf_sa_query_timer() - This function deletes SA query timer
814 * @mac_ctx: pointer to mac context
815 * @pe_session: pointer to PE session
816 *
817 * This API is to delete the PMF SA query timer created for each associated STA
818 *
819 * Return: none
820 */
821static inline void
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800822lim_del_pmf_sa_query_timer(struct mac_context *mac_ctx, struct pe_session *pe_session)
Krunal Sonid3c86d42017-10-19 12:12:21 -0700823{
824}
825#endif
826
Arif Hussain6cec6bc2017-02-14 13:46:26 -0800827/**
gaurank kathpalia3ebc17b2019-05-29 10:25:09 +0530828 * lim_add_bssid_to_reject_list:- Add rssi reject Ap info to blacklist mgr.
829 * @pdev: pdev
830 * @entry: info of the BSSID to be put in rssi reject list.
831 *
832 * This API will add the passed ap info to the rssi reject list.
833 *
834 */
835void
836lim_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev,
837 struct sir_rssi_disallow_lst *entry);
838
839/**
Arif Hussain6cec6bc2017-02-14 13:46:26 -0800840 * lim_strip_op_class_update_struct - strip sup op class IE and populate
841 * the dot11f structure
842 * @mac_ctx: global MAC context
843 * @addn_ie: Additional IE buffer
844 * @addn_ielen: Length of additional IE
845 * @dst: Supp operating class IE structure to be updated
846 *
847 * This function is used to strip supp op class IE from IE buffer and
848 * update the passed structure.
849 *
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700850 * Return: QDF_STATUS
Arif Hussain6cec6bc2017-02-14 13:46:26 -0800851 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800852QDF_STATUS lim_strip_supp_op_class_update_struct(struct mac_context *mac_ctx,
Arif Hussain6cec6bc2017-02-14 13:46:26 -0800853 uint8_t *addn_ie, uint16_t *addn_ielen,
854 tDot11fIESuppOperatingClasses *dst);
855
Naveen Rawatc0c91cd2015-11-05 14:27:37 -0800856uint8_t lim_get_80Mhz_center_channel(uint8_t primary_channel);
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800857void lim_update_obss_scanparams(struct pe_session *session,
Sandeep Puligillae0875662016-02-12 16:09:21 -0800858 tDot11fIEOBSSScanParameters *scan_params);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800859void lim_init_obss_params(struct mac_context *mac_ctx, struct pe_session *session);
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -0800860#ifdef WLAN_FEATURE_HOST_ROAM
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800861uint32_t lim_create_timers_host_roam(struct mac_context *mac_ctx);
Abhishek Singh748d8a22017-08-21 15:19:37 +0530862/**
863 * lim_delete_timers_host_roam() - Delete timers used in host based roaming
864 * @mac_ctx: Global MAC context
865 *
866 * Delete reassoc and preauth timers
867 *
868 * Return: none
869 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800870void lim_delete_timers_host_roam(struct mac_context *mac_ctx);
Abhishek Singh748d8a22017-08-21 15:19:37 +0530871/**
872 * lim_deactivate_timers_host_roam() - deactivate timers used in host based
873 * roaming
874 * @mac_ctx: Global MAC context
875 *
876 * Delete reassoc and preauth timers
877 *
878 * Return: none
879 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800880void lim_deactivate_timers_host_roam(struct mac_context *mac_ctx);
881void lim_deactivate_and_change_timer_host_roam(struct mac_context *mac_ctx,
Varun Reddy Yeturu32de0e42016-04-15 14:25:59 +0530882 uint32_t timer_id);
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -0800883#else
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800884static inline uint32_t lim_create_timers_host_roam(struct mac_context *mac_ctx)
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -0800885{
886 return 0;
887}
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800888static inline void lim_delete_timers_host_roam(struct mac_context *mac_ctx)
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -0800889{}
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800890static inline void lim_deactivate_timers_host_roam(struct mac_context *mac_ctx) {}
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -0800891static inline void lim_deactivate_and_change_timer_host_roam(
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800892 struct mac_context *mac_ctx, uint32_t timer_id)
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -0800893{}
894#endif
Sandeep Puligillae0875662016-02-12 16:09:21 -0800895
Rajeev Kumar03200802016-04-15 13:59:36 -0700896bool lim_is_robust_mgmt_action_frame(uint8_t action_category);
Hu Wang411e0cc2016-10-28 14:56:01 +0800897uint8_t lim_compute_ext_cap_ie_length(tDot11fIEExtCap *ext_cap);
Himanshu Agarwal2fdf77a2016-12-29 11:41:00 +0530898
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800899void lim_update_caps_info_for_bss(struct mac_context *mac_ctx,
Selvaraj, Sridharaf54e2e2016-06-24 12:25:02 +0530900 uint16_t *caps, uint16_t bss_caps);
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800901void lim_send_set_dtim_period(struct mac_context *mac_ctx, uint8_t dtim_period,
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800902 struct pe_session *session);
Naveen Rawat30b84502016-10-13 17:44:48 -0700903
Jeff Johnsond01da6b2018-12-02 12:10:22 -0800904QDF_STATUS lim_strip_ie(struct mac_context *mac_ctx,
Naveen Rawat30b84502016-10-13 17:44:48 -0700905 uint8_t *addn_ie, uint16_t *addn_ielen,
906 uint8_t eid, eSizeOfLenField size_of_len_field,
Arif Hussain6cec6bc2017-02-14 13:46:26 -0800907 uint8_t *oui, uint8_t out_len, uint8_t *extracted_ie,
908 uint32_t eid_max_len);
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -0800909
Krishna Kumaar Natarajand1cd56e2016-09-30 08:43:03 -0700910#define MCSMAPMASK1x1 0x3
911#define MCSMAPMASK2x2 0xC
912
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -0800913#ifdef WLAN_FEATURE_11AX
Krishna Kumaar Natarajand1cd56e2016-09-30 08:43:03 -0700914
Krishna Kumaar Natarajan6677ed92017-03-23 11:52:38 -0700915/**
916 * lim_intersect_ap_he_caps() - Intersect AP capability with self STA capability
917 * @session: pointer to PE session
918 * @add_bss: pointer to ADD BSS params
919 * @beacon: pointer to beacon
920 * @assoc_rsp: pointer to assoc response
921 *
922 * Return: None
923 */
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800924void lim_intersect_ap_he_caps(struct pe_session *session, tpAddBssParams add_bss,
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -0800925 tSchBeaconStruct *pBeaconStruct, tpSirAssocRsp assoc_rsp);
Krishna Kumaar Natarajan6677ed92017-03-23 11:52:38 -0700926
927/**
928 * lim_intersect_sta_he_caps() - Intersect STA capability with SAP capability
929 * @assoc_req: pointer to assoc request
930 * @session: pointer to PE session
931 * @sta_ds: pointer to STA dph hash table entry
932 *
933 * Return: None
934 */
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800935void lim_intersect_sta_he_caps(tpSirAssocReq assoc_req, struct pe_session *session,
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -0800936 tpDphHashNode sta_ds);
Krishna Kumaar Natarajan6677ed92017-03-23 11:52:38 -0700937
938/**
939 * lim_add_he_cap() - Copy HE capability into Add sta params
940 * @add_sta_params: pointer to add sta params
941 * @assoc_req: pointer to Assoc request
942 *
943 * Return: None
944 */
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -0800945void lim_add_he_cap(tpAddStaParams add_sta_params, tpSirAssocReq assoc_req);
Krishna Kumaar Natarajan6677ed92017-03-23 11:52:38 -0700946
947/**
948 * lim_add_self_he_cap() - Copy HE capability into add sta from PE session
949 * @add_sta_params: pointer to add sta params
950 * @session: pointer to PE Session
951 *
952 * Return: None
953 */
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800954void lim_add_self_he_cap(tpAddStaParams add_sta_params, struct pe_session *session);
Krishna Kumaar Natarajan6677ed92017-03-23 11:52:38 -0700955
956/**
957 * lim_add_bss_he_cap() - Copy HE capability into ADD BSS params
958 * @add_bss: pointer to add bss params
959 * @assoc_rsp: pointer to assoc response
960 *
961 * Return: None
962 */
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -0800963void lim_add_bss_he_cap(tpAddBssParams add_bss, tpSirAssocRsp assoc_rsp);
Krishna Kumaar Natarajan6677ed92017-03-23 11:52:38 -0700964
965/**
Manikandan Mohan39accff2017-05-02 16:09:00 -0700966 * lim_add_bss_he_cfg() - Set HE config to BSS params
967 * @add_bss: pointer to add bss params
968 * @session: Pointer to Session entry struct
969 *
970 * Return: None
971 */
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800972void lim_add_bss_he_cfg(tpAddBssParams add_bss, struct pe_session *session);
Manikandan Mohan39accff2017-05-02 16:09:00 -0700973
974/**
Krishna Kumaar Natarajan6677ed92017-03-23 11:52:38 -0700975 * lim_copy_bss_he_cap() - Copy HE capability into PE session from start bss
976 * @session: pointer to PE session
977 * @sme_start_bss_req: pointer to start BSS request
978 *
979 * Return: None
980 */
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800981void lim_copy_bss_he_cap(struct pe_session *session,
Jeff Johnson704b8912019-02-02 14:38:14 -0800982 struct start_bss_req *sme_start_bss_req);
Krishna Kumaar Natarajan6677ed92017-03-23 11:52:38 -0700983
984/**
985 * lim_copy_join_req_he_cap() - Copy HE capability to PE session from Join req
Naveen Rawataeca1b92017-10-16 16:55:31 -0700986 * and update as per bandwidth supported
Krishna Kumaar Natarajan6677ed92017-03-23 11:52:38 -0700987 * @session: pointer to PE session
988 * @sme_join_req: pointer to SME join request
989 *
990 * Return: None
991 */
Jeff Johnsonc8baa902018-11-18 21:59:07 -0800992void lim_copy_join_req_he_cap(struct pe_session *session,
Jeff Johnson701444f2019-02-02 22:35:13 -0800993 struct join_req *sme_join_req);
Krishna Kumaar Natarajan6677ed92017-03-23 11:52:38 -0700994
995/**
996 * lim_log_he_op() - Print HE Operation
997 * @mac: pointer to MAC context
998 * @he_op: pointer to HE Operation
999 *
1000 * Print HE operation stored as dot11f structure
1001 *
1002 * Return: None
1003 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001004void lim_log_he_op(struct mac_context *mac, tDot11fIEhe_op *he_ops);
Krishna Kumaar Natarajan6677ed92017-03-23 11:52:38 -07001005
Peng Xu6363ec62017-05-15 11:06:33 -07001006#ifdef WLAN_FEATURE_11AX_BSS_COLOR
1007/**
1008 * lim_log_he_bss_color() - Print HE bss color
1009 * @mac: pointer to MAC context
1010 * @he_bss_color: pointer to HE bss color
1011 *
1012 * Print HE bss color IE
1013 *
1014 * Return: None
1015 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001016void lim_log_he_bss_color(struct mac_context *mac,
Peng Xu6363ec62017-05-15 11:06:33 -07001017 tDot11fIEbss_color_change *he_bss_color);
1018#endif
1019
Krishna Kumaar Natarajan6677ed92017-03-23 11:52:38 -07001020/**
1021 * lim_log_he_cap() - Print HE capabilities
1022 * @mac: pointer to MAC context
1023 * @he_cap: pointer to HE Capability
1024 *
1025 * Received HE capabilities are converted into dot11f structure.
1026 * This function will print all the HE capabilities as stored
1027 * in the dot11f structure.
1028 *
1029 * Return: None
1030 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001031void lim_log_he_cap(struct mac_context *mac, tDot11fIEhe_cap *he_cap);
Krishna Kumaar Natarajan6677ed92017-03-23 11:52:38 -07001032
1033/**
1034 * lim_update_stads_he_caps() - Copy HE capability into STA DPH hash table entry
1035 * @sta_ds: pointer to sta dph hash table entry
1036 * @assoc_rsp: pointer to assoc response
1037 * @session_entry: pointer to PE session
1038 *
1039 * Return: None
1040 */
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001041void lim_update_stads_he_caps(tpDphHashNode sta_ds, tpSirAssocRsp assoc_rsp,
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001042 struct pe_session *session_entry);
Krishna Kumaar Natarajan6677ed92017-03-23 11:52:38 -07001043
1044/**
1045 * lim_update_usr_he_cap() - Update HE capability based on userspace
1046 * @mac_ctx: global mac context
1047 * @session: PE session entry
1048 *
1049 * Parse the HE Capability IE and populate the fields to be
1050 * sent to FW as part of add bss and update PE session.
1051 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001052void lim_update_usr_he_cap(struct mac_context *mac_ctx, struct pe_session *session);
Krishna Kumaar Natarajan6677ed92017-03-23 11:52:38 -07001053
1054/**
1055 * lim_decide_he_op() - Determine HE operation elements
1056 * @mac_ctx: global mac context
1057 * @he_ops: pointer to HE operation IE
1058 * @session: PE session entry
1059 *
1060 * Parse the HE Operation IE and populate the fields to be
1061 * sent to FW as part of add bss.
1062 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001063void lim_decide_he_op(struct mac_context *mac_ctx, tpAddBssParams add_bss,
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001064 struct pe_session *session);
Krishna Kumaar Natarajan6677ed92017-03-23 11:52:38 -07001065
1066/**
1067 * lim_update_sta_he_capable(): Update he_capable in add sta params
1068 * @mac: pointer to MAC context
1069 * @add_sta_params: pointer to add sta params
1070 * @sta_ds: pointer to dph hash table entry
1071 * @session_entry: pointer to PE session
1072 *
1073 * Return: None
1074 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001075void lim_update_sta_he_capable(struct mac_context *mac,
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001076 tpAddStaParams add_sta_params, tpDphHashNode sta_ds,
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001077 struct pe_session *session_entry);
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001078
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001079static inline bool lim_is_session_he_capable(struct pe_session *session)
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001080{
1081 return session->he_capable;
1082}
1083
Kiran Kumar Lokere40875852018-01-15 12:36:19 -08001084/**
1085 * lim_get_session_he_frag_cap(): Get session HE fragmentation cap
1086 * @session: pointer to session
1087 *
1088 * Return: HE fragmentation value
1089 */
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001090static inline uint8_t lim_get_session_he_frag_cap(struct pe_session *session)
Kiran Kumar Lokere40875852018-01-15 12:36:19 -08001091{
1092 return session->he_config.fragmentation;
1093}
1094
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001095static inline bool lim_is_sta_he_capable(tpDphHashNode sta_ds)
1096{
1097 return sta_ds->mlmStaContext.he_capable;
1098}
1099
Krishna Kumaar Natarajan6677ed92017-03-23 11:52:38 -07001100/**
1101 * lim_update_bss_he_capable(): Update he_capable in add BSS params
1102 * @mac: pointer to MAC context
1103 * @add_bss: pointer to add BSS params
1104 *
1105 * Return: None
1106 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001107void lim_update_bss_he_capable(struct mac_context *mac, tpAddBssParams add_bss);
Krishna Kumaar Natarajan6677ed92017-03-23 11:52:38 -07001108
1109/**
1110 * lim_update_stads_he_capable() - Update he_capable in sta ds context
1111 * @sta_ds: pointer to sta ds
1112 * @assoc_req: pointer to assoc request
1113 *
1114 * Return: None
1115 */
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001116void lim_update_stads_he_capable(tpDphHashNode sta_ds, tpSirAssocReq assoc_req);
Krishna Kumaar Natarajan6677ed92017-03-23 11:52:38 -07001117
1118/**
1119 * lim_update_session_he_capable(): Update he_capable in PE session
1120 * @mac: pointer to MAC context
1121 * @session: pointer to PE session
1122 *
1123 * Return: None
1124 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001125void lim_update_session_he_capable(struct mac_context *mac, struct pe_session *session);
Krishna Kumaar Natarajan6677ed92017-03-23 11:52:38 -07001126
1127/**
1128 * lim_update_chan_he_capable(): Update he_capable in chan switch params
1129 * @mac: pointer to MAC context
1130 * @chan: pointer to channel switch params
1131 *
1132 * Return: None
1133 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001134void lim_update_chan_he_capable(struct mac_context *mac, tpSwitchChannelParams chan);
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001135
Krishna Kumaar Natarajan1cd73ae2017-02-22 15:56:00 -08001136/**
1137 * lim_set_he_caps() - update HE caps to be sent to FW as part of scan IE
1138 * @mac: pointer to MAC
1139 * @session: pointer to PE session
1140 * @ie_start: pointer to start of IE buffer
1141 * @num_bytes: length of IE buffer
1142 *
1143 * Return: None
1144 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001145void lim_set_he_caps(struct mac_context *mac, struct pe_session *session,
Krishna Kumaar Natarajan1cd73ae2017-02-22 15:56:00 -08001146 uint8_t *ie_start, uint32_t num_bytes);
1147
1148/**
1149 * lim_send_he_caps_ie() - gets HE capability and send to firmware via wma
1150 * @mac_ctx: global mac context
1151 * @session: pe session. This can be NULL. In that case self cap will be sent
1152 * @vdev_id: vdev for which IE is targeted
1153 *
1154 * This function gets HE capability and send to firmware via wma
1155 *
1156 * Return: QDF_STATUS
1157 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001158QDF_STATUS lim_send_he_caps_ie(struct mac_context *mac_ctx, struct pe_session *session,
Krishna Kumaar Natarajan1cd73ae2017-02-22 15:56:00 -08001159 uint8_t vdev_id);
Krishna Kumaar Natarajand1cd56e2016-09-30 08:43:03 -07001160
1161/**
Jeff Johnsonecd4f212019-02-01 19:36:34 -08001162 * lim_populate_he_mcs_set() - function to populate HE mcs rate set
Krishna Kumaar Natarajand1cd56e2016-09-30 08:43:03 -07001163 * @mac_ctx: pointer to global mac structure
1164 * @rates: pointer to supported rate set
1165 * @peer_vht_caps: pointer to peer HE capabilities
1166 * @session_entry: pe session entry
Jeff Johnsonecd4f212019-02-01 19:36:34 -08001167 * @nss: number of spatial streams
Krishna Kumaar Natarajand1cd56e2016-09-30 08:43:03 -07001168 *
1169 * Populates HE mcs rate set based on peer and self capabilities
1170 *
1171 * Return: QDF_STATUS
1172 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001173QDF_STATUS lim_populate_he_mcs_set(struct mac_context *mac_ctx,
Jeff Johnsonecd4f212019-02-01 19:36:34 -08001174 struct supported_rates *rates,
1175 tDot11fIEhe_cap *peer_he_caps,
1176 struct pe_session *session_entry,
1177 uint8_t nss);
Krishna Kumaar Natarajand1cd56e2016-09-30 08:43:03 -07001178
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001179#else
1180static inline void lim_add_he_cap(tpAddStaParams add_sta_params,
1181 tpSirAssocReq assoc_req)
1182{
1183}
1184
1185static inline void lim_add_self_he_cap(tpAddStaParams add_sta_params,
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001186 struct pe_session *session)
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001187{
1188}
1189
1190static inline void lim_add_bss_he_cap(tpAddBssParams add_bss,
1191 tpSirAssocRsp assoc_rsp)
1192{
1193 return;
1194}
1195
Manikandan Mohan39accff2017-05-02 16:09:00 -07001196static inline void lim_add_bss_he_cfg(tpAddBssParams add_bss,
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001197 struct pe_session *session)
Manikandan Mohan39accff2017-05-02 16:09:00 -07001198{
1199}
1200
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001201static inline void lim_intersect_ap_he_caps(struct pe_session *session,
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001202 tpAddBssParams add_bss, tSchBeaconStruct *pBeaconStruct,
1203 tpSirAssocRsp assoc_rsp)
1204{
1205 return;
1206}
1207
1208static inline void lim_intersect_sta_he_caps(tpSirAssocReq assoc_req,
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001209 struct pe_session *session, tpDphHashNode sta_ds)
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001210{
1211}
1212
1213static inline void lim_update_stads_he_caps(tpDphHashNode sta_ds, tpSirAssocRsp assoc_rsp,
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001214 struct pe_session *session_entry)
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001215{
1216 return;
1217}
1218
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001219static inline void lim_update_usr_he_cap(struct mac_context *mac_ctx,
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001220 struct pe_session *session)
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001221{
1222}
1223
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001224static inline void lim_decide_he_op(struct mac_context *mac_ctx,
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001225 tpAddBssParams add_bss, struct pe_session *session)
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001226{
1227}
1228
Jeff Johnson704b8912019-02-02 14:38:14 -08001229static inline
1230void lim_copy_bss_he_cap(struct pe_session *session,
1231 struct start_bss_req *sme_start_bss_req)
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001232{
1233}
Krishna Kumaar Natarajand1cd56e2016-09-30 08:43:03 -07001234
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001235static inline void lim_copy_join_req_he_cap(struct pe_session *session,
Jeff Johnson701444f2019-02-02 22:35:13 -08001236 struct join_req *sme_join_req)
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001237{
1238}
1239
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001240static inline void lim_log_he_op(struct mac_context *mac,
Naveen Rawatd8feac12017-09-08 15:08:39 -07001241 tDot11fIEhe_op *he_ops)
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001242{
1243}
1244
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001245static inline void lim_log_he_cap(struct mac_context *mac,
Naveen Rawatd8feac12017-09-08 15:08:39 -07001246 tDot11fIEhe_cap *he_cap)
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001247{
1248}
1249
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001250static inline void lim_update_sta_he_capable(struct mac_context *mac,
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001251 tpAddStaParams add_sta_params,
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001252 tpDphHashNode sta_ds, struct pe_session *session_entry)
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001253{
1254}
1255
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001256static inline bool lim_is_session_he_capable(struct pe_session *session)
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001257{
1258 return false;
1259}
1260
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001261static inline uint8_t lim_get_session_he_frag_cap(struct pe_session *session)
Kiran Kumar Lokere40875852018-01-15 12:36:19 -08001262{
1263 return 0;
1264}
1265
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001266static inline bool lim_is_sta_he_capable(tpDphHashNode sta_ds)
1267{
1268 return false;
1269}
1270
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001271static inline void lim_update_bss_he_capable(struct mac_context *mac,
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001272 tpAddBssParams add_bss)
1273{
1274}
1275
1276static inline void lim_update_stads_he_capable(tpDphHashNode sta_ds,
1277 tpSirAssocReq assoc_req)
1278{
1279}
1280
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001281static inline void lim_update_session_he_capable(struct mac_context *mac,
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001282 struct pe_session *session)
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001283{
1284}
1285
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001286static inline void lim_update_chan_he_capable(struct mac_context *mac,
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001287 tpSwitchChannelParams chan)
1288{
1289}
Krishna Kumaar Natarajan1cd73ae2017-02-22 15:56:00 -08001290
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001291static inline void lim_set_he_caps(struct mac_context *mac, struct pe_session *session,
Krishna Kumaar Natarajan1cd73ae2017-02-22 15:56:00 -08001292 uint8_t *ie_start, uint32_t num_bytes)
1293{
1294}
1295
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001296static inline QDF_STATUS lim_send_he_caps_ie(struct mac_context *mac_ctx,
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001297 struct pe_session *session,
Krishna Kumaar Natarajan1cd73ae2017-02-22 15:56:00 -08001298 uint8_t vdev_id)
1299{
1300 return QDF_STATUS_SUCCESS;
1301}
1302
Jeff Johnsonecd4f212019-02-01 19:36:34 -08001303static inline
1304QDF_STATUS lim_populate_he_mcs_set(struct mac_context *mac_ctx,
1305 struct supported_rates *rates,
1306 tDot11fIEhe_cap *peer_he_caps,
1307 struct pe_session *session_entry,
1308 uint8_t nss)
Krishna Kumaar Natarajand1cd56e2016-09-30 08:43:03 -07001309{
1310 return QDF_STATUS_SUCCESS;
1311}
1312
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001313#endif
Sreelakshmi Konamki6d478cd2017-03-28 11:59:25 +05301314
1315/**
1316 * lim_decrement_pending_mgmt_count: Decrement mgmt frame count
1317 * @mac_ctx: Pointer to global MAC structure
1318 *
1319 * This function is used to decrement pe mgmt count once frame
1320 * removed from queue
1321 *
1322 * Return: None
1323 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001324void lim_decrement_pending_mgmt_count(struct mac_context *mac_ctx);
Sridhar Selvaraj0d5d2c72017-08-17 17:30:01 +05301325
1326/**
1327 * lim_check_if_vendor_oui_match() - Check if the given OUI match in IE buffer
1328 * @mac_ctx: MAC context
1329 * @ie: IE buffer
1330 * @ie_len: length of @ie
1331 *
1332 * This API is used to check if given vendor OUI
1333 * matches in given IE buffer
1334 *
1335 * Return: True, if mataches. False otherwise
1336 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001337bool lim_check_if_vendor_oui_match(struct mac_context *mac_ctx,
Sridhar Selvaraj0d5d2c72017-08-17 17:30:01 +05301338 uint8_t *oui, uint8_t oui_len,
1339 uint8_t *ie, uint8_t ie_len);
Naveen Rawat296a5182017-09-25 14:02:48 -07001340
Sandeep Puligillad9f88ce2017-04-11 19:41:57 -07001341QDF_STATUS lim_util_get_type_subtype(void *pkt, uint8_t *type,
1342 uint8_t *subtype);
1343
Naveen Rawat296a5182017-09-25 14:02:48 -07001344/**
1345 * lim_get_min_session_txrate() - Get the minimum rate supported in the session
1346 * @session: Pointer to PE session
1347 *
1348 * This API will find the minimum rate supported by the given PE session and
1349 * return the enum rateid corresponding to the rate.
1350 *
1351 * Return: enum rateid
1352 */
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001353enum rateid lim_get_min_session_txrate(struct pe_session *session);
Naveen Rawat296a5182017-09-25 14:02:48 -07001354
lifeng1c16b6b2017-09-25 13:59:55 +08001355/**
Pragaspathi Thilagaraj934275c2018-08-07 14:55:35 +05301356 * lim_send_dfs_chan_sw_ie_update() - updates the channel switch IE in beacon
1357 * template
1358 *
1359 * @mac_ctx - pointer to global mac context
1360 * @session - A pointer to pesession
1361 * Return None
1362 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001363void lim_send_dfs_chan_sw_ie_update(struct mac_context *mac_ctx,
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001364 struct pe_session *session);
Pragaspathi Thilagaraj934275c2018-08-07 14:55:35 +05301365
1366/**
1367 * lim_process_ap_ecsa_timeout() -process ECSA timeout which decrement csa count
1368 * in beacon and update beacon template in firmware
1369 *
1370 * @data - A pointer to pesession
1371 * Return None
1372 */
1373void lim_process_ap_ecsa_timeout(void *session);
1374
1375/**
Rajeev Kumar Sirasanagandla2f17f8d2018-10-03 17:24:20 +05301376 * lim_send_stop_bss_failure_resp() -send failure delete bss resp to sme
1377 * @mac_ctx: mac ctx
1378 * @session: session pointer
1379 *
1380 * Return None
1381 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001382void lim_send_stop_bss_failure_resp(struct mac_context *mac_ctx,
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001383 struct pe_session *session);
Rajeev Kumar Sirasanagandla2f17f8d2018-10-03 17:24:20 +05301384
1385/**
Abhishek Singh2904a6a2018-08-30 17:45:59 +05301386 * lim_delete_all_peers() -delete all connected peers
1387 * @session: session pointer
1388 *
1389 * Return None
1390 */
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001391void lim_delete_all_peers(struct pe_session *session);
Abhishek Singh2904a6a2018-08-30 17:45:59 +05301392
1393/**
1394 * lim_send_vdev_stop() -send delete bss/stop vdev req
1395 * @session: session pointer
1396 *
Abhishek Singhcaa61852018-09-12 15:50:04 +05301397 * Return QDF_STATUS
Abhishek Singh2904a6a2018-08-30 17:45:59 +05301398 */
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001399QDF_STATUS lim_send_vdev_stop(struct pe_session *session);
Abhishek Singh2904a6a2018-08-30 17:45:59 +05301400
Abhishek Singh1df50882018-08-30 18:04:29 +05301401/**
Sandeep Puligilla30bb8402018-09-23 22:01:08 -07001402 * lim_send_vdev_stop() -send delete bss/stop vdev req for STA
1403 * @session: session pointer
1404 *
1405 * Return QDF_STATUS
1406 */
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001407QDF_STATUS lim_sta_send_del_bss(struct pe_session *session);
Sandeep Puligilla30bb8402018-09-23 22:01:08 -07001408
1409/**
Abhishek Singh1df50882018-08-30 18:04:29 +05301410 * lim_send_start_bss_confirm() -send start bss confirm req
1411 * @mac_ctx: pointer to global mac structure
1412 * @start_cnf: start confirm structure pointer
1413 *
1414 * Return None
1415 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001416void lim_send_start_bss_confirm(struct mac_context *mac_ctx,
Abhishek Singh1df50882018-08-30 18:04:29 +05301417 tLimMlmStartCnf *start_cnf);
Abhishek Singh2904a6a2018-08-30 17:45:59 +05301418
1419/**
lifeng1c16b6b2017-09-25 13:59:55 +08001420 * lim_send_chan_switch_action_frame()- Send an action frame
1421 * containing CSA IE or ECSA IE depending on the connected
1422 * sta capability.
1423 *
1424 * @mac_ctx: pointer to global mac structure
1425 * @new_channel: new channel to switch to.
1426 * @ch_bandwidth: BW of channel to calculate op_class
1427 * @session_entry: pe session
1428 *
1429 * Return: void
1430 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001431void lim_send_chan_switch_action_frame(struct mac_context *mac_ctx,
lifeng1c16b6b2017-09-25 13:59:55 +08001432 uint16_t new_channel,
1433 uint8_t ch_bandwidth,
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001434 struct pe_session *session_entry);
lifeng1c16b6b2017-09-25 13:59:55 +08001435
Arif Hussain1513cb22018-01-05 19:56:31 -08001436/**
1437 * lim_process_obss_detection_ind() - Process obss detection indication
1438 * @mac_ctx: Pointer to Global MAC structure.
1439 * @obss_detection: obss detection info.
1440 *
1441 * Process obss detection indication and apply necessary protection for
1442 * the given AP session.
1443 *
1444 * Return: QDF_STATUS
1445 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001446QDF_STATUS lim_process_obss_detection_ind(struct mac_context *mac_ctx,
Arif Hussain1513cb22018-01-05 19:56:31 -08001447 struct wmi_obss_detect_info
1448 *obss_detection);
1449
1450/**
1451 * lim_obss_send_detection_cfg() - Send obss detection configuration to firmware
1452 * @mac_ctx: Pointer to Global MAC structure
1453 * @session: Pointer to session
1454 * @force: Force to send new configuration even if new cfg same as old
1455 *
1456 * Generate new cfg based on current protection status and send new cfg to
1457 * firmware.
1458 *
1459 * Return: QDF_STATUS
1460 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001461QDF_STATUS lim_obss_send_detection_cfg(struct mac_context *mac_ctx,
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001462 struct pe_session *session,
Arif Hussain1513cb22018-01-05 19:56:31 -08001463 bool force);
1464
1465/**
1466 * lim_obss_generate_detection_config() - get new obss offload detection cfg
1467 * @mac_ctx: Pointer to Global MAC structure
1468 * @session: Pointer to session
1469 * @cfg: Obss detection cfg buffer pointer
1470 *
1471 * Generate new cfg based on current protection status.
1472 *
1473 * Return: QDF_STATUS
1474 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001475QDF_STATUS lim_obss_generate_detection_config(struct mac_context *mac_ctx,
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001476 struct pe_session *session,
Arif Hussain1513cb22018-01-05 19:56:31 -08001477 struct obss_detection_cfg *cfg);
1478
1479/**
1480 * lim_enable_obss_detection_config() - Enable obss detection
1481 * @mac_ctx: Pointer to Global MAC structure
1482 * @session: Pointer to session
1483 *
1484 * This function will enable legacy obss detection (by starting timer)
1485 * or also offload based detection based on support.
1486 *
1487 * Return: None
1488 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001489void lim_enable_obss_detection_config(struct mac_context *mac_ctx,
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001490 struct pe_session *session);
Arif Hussain1513cb22018-01-05 19:56:31 -08001491
Varun Reddy Yeturu4f849e52018-06-15 18:08:37 -07001492#ifdef WLAN_SUPPORT_TWT
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001493void lim_set_peer_twt_cap(struct pe_session *session, struct s_ext_cap *ext_cap);
Varun Reddy Yeturu4f849e52018-06-15 18:08:37 -07001494#else
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001495static inline void lim_set_peer_twt_cap(struct pe_session *session,
Varun Reddy Yeturu4f849e52018-06-15 18:08:37 -07001496 struct s_ext_cap *ext_cap)
1497{
1498}
1499#endif
1500
Jinwei Chen1850d9c2018-08-20 15:59:06 +08001501/**
1502 * lim_rx_invalid_peer_process() - process rx invalid peer indication
1503 * @mac_ctx: Pointer to Global MAC structure
1504 * @lim_msg: Pointer to scheduler message
1505 *
1506 * This function will process the rx data invalid peer indication,
1507 * if the vdev operation mode is SAP, then send the deauth mgmt frame
1508 * to STA.
1509 *
1510 * Return: None
1511 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001512void lim_rx_invalid_peer_process(struct mac_context *mac_ctx,
Jinwei Chen1850d9c2018-08-20 15:59:06 +08001513 struct scheduler_msg *lim_msg);
Abhishek Singh3d30a3b2018-09-12 15:49:18 +05301514
1515/**
1516 * lim_send_beacon() - send beacon indication to firmware
1517 * @mac_ctx: Pointer to Global MAC structure
1518 * @session: session pointer
1519 *
1520 * Return: None
1521 */
Jeff Johnsond01da6b2018-12-02 12:10:22 -08001522void lim_send_beacon(struct mac_context *mac_ctx, struct pe_session *session);
Abhishek Singh3d30a3b2018-09-12 15:49:18 +05301523
Manikandan Mohan4cc1c5a2018-10-09 13:25:30 -07001524/**
1525 * lim_ndi_mlme_vdev_up_transition() - Send event to transistion NDI VDEV to UP
1526 * @session: session pointer
1527 *
1528 * Return: None
1529 */
Jeff Johnsonc8baa902018-11-18 21:59:07 -08001530void lim_ndi_mlme_vdev_up_transition(struct pe_session *session);
Manikandan Mohan4cc1c5a2018-10-09 13:25:30 -07001531
Jianmin Zhua9005b32018-12-06 21:30:45 +08001532/**
1533 * lim_disconnect_complete - Deliver vdev disconnect complete event or
1534 * STA send deleting bss
1535 * @session: PE session pointer
1536 * @del_bss: Whether to call lim_sta_send_del_bss
1537 *
1538 * API delivers vdev disconnect complete event
1539 *
1540 * Return: None
1541 */
1542void lim_disconnect_complete(struct pe_session *session, bool del_bss);
1543
Abhishek Singh3d30a3b2018-09-12 15:49:18 +05301544/**
Sandeep Puligilla30bb8402018-09-23 22:01:08 -07001545 * lim_sta_mlme_vdev_stop_send() - send VDEV stop
1546 * @vdev_mlme_obj: VDEV MLME comp object
1547 * @data_len: data size
1548 * @data: event data
1549 *
1550 * API invokes vdev stop
1551 *
1552 * Return: SUCCESS on successful completion of vdev stop
1553 * FAILURE, if it fails due to any
1554 */
1555QDF_STATUS lim_sta_mlme_vdev_stop_send(struct vdev_mlme_obj *vdev_mlme,
1556 uint16_t data_len, void *data);
1557
1558/**
Jianmin Zhu69e7bf32018-11-22 11:56:10 +08001559 * lim_sta_mlme_vdev_start_send() - send VDEV start
1560 * @vdev_mlme_obj: VDEV MLME comp object
1561 * @data_len: data size
1562 * @data: event data
1563 *
1564 * API invokes vdev start
1565 *
1566 * Return: SUCCESS on successful completion of vdev start
1567 * FAILURE, if it fails due to any
1568 */
1569QDF_STATUS lim_sta_mlme_vdev_start_send(struct vdev_mlme_obj *vdev_mlme,
1570 uint16_t data_len, void *data);
1571
1572/**
1573 * lim_sta_mlme_vdev_restart_send() - send VDEV restart
1574 * @vdev_mlme_obj: VDEV MLME comp object
1575 * @data_len: data size
1576 * @data: event data
1577 *
1578 * API invokes vdev restart
1579 *
1580 * Return: SUCCESS on successful completion of vdev restart
1581 * FAILURE, if it fails due to any
1582 */
1583QDF_STATUS lim_sta_mlme_vdev_restart_send(struct vdev_mlme_obj *vdev_mlme,
1584 uint16_t data_len, void *data);
1585
1586/**
Abhishek Singh3d30a3b2018-09-12 15:49:18 +05301587 * lim_ap_mlme_vdev_start_send() - Invokes VDEV start operation
1588 * @vdev_mlme_obj: VDEV MLME comp object
1589 * @data_len: data size
1590 * @data: event data
1591 *
1592 * API invokes VDEV start operation
1593 *
1594 * Return: SUCCESS on successful completion of start operation
1595 * FAILURE, if it fails due to any
1596 */
1597QDF_STATUS lim_ap_mlme_vdev_start_send(struct vdev_mlme_obj *vdev_mlme,
1598 uint16_t data_len, void *event);
1599/*
1600 * lim_ap_mlme_vdev_update_beacon() - Updates beacon
1601 * @vdev_mlme_obj: VDEV MLME comp object
1602 * @op: beacon update type
1603 * @data_len: data size
1604 * @data: event data
1605 *
1606 * API updates/allocates/frees the beacon
1607 *
1608 * Return: SUCCESS on successful update of beacon
1609 * FAILURE, if it fails due to any
1610 */
1611QDF_STATUS lim_ap_mlme_vdev_update_beacon(struct vdev_mlme_obj *vdev_mlme,
1612 enum beacon_update_op op,
1613 uint16_t data_len, void *data);
1614
1615/**
1616 * lim_ap_mlme_vdev_up_send() - VDEV up operation
1617 * @vdev_mlme_obj: VDEV MLME comp object
1618 * @data_len: data size
1619 * @data: event data
1620 *
1621 * API invokes VDEV up operations
1622 *
1623 * Return: SUCCESS on successful completion of up operation
1624 * FAILURE, if it fails due to any
1625 */
1626QDF_STATUS lim_ap_mlme_vdev_up_send(struct vdev_mlme_obj *vdev_mlme,
1627 uint16_t data_len, void *data);
1628
Abhishek Singhcaa61852018-09-12 15:50:04 +05301629/**
1630 * lim_ap_mlme_vdev_disconnect_peers - Disconnect peers
1631 * @vdev_mlme_obj: VDEV MLME comp object
1632 * @data_len: data size
1633 * @data: event data
1634 *
1635 * API trigger stations disconnection connected with AP
1636 *
1637 * Return: SUCCESS on successful invocation of station disconnection
1638 * FAILURE, if it fails due to any
1639 */
1640QDF_STATUS lim_ap_mlme_vdev_disconnect_peers(struct vdev_mlme_obj *vdev_mlme,
1641 uint16_t data_len, void *data);
1642
1643/**
1644 * lim_ap_mlme_vdev_stop_send - Invokes VDEV stop operation
1645 * @vdev_mlme_obj: VDEV MLME comp object
1646 * @data_len: data size
1647 * @data: event data
1648 *
1649 * API invokes VDEV stop operation
1650 *
1651 * Return: SUCCESS on successful completion of stop operation
1652 * FAILURE, if it fails due to any
1653 */
1654QDF_STATUS lim_ap_mlme_vdev_stop_send(struct vdev_mlme_obj *vdev_mlme,
1655 uint16_t data_len, void *data);
Abhishek Singh20a8e442018-09-12 15:50:44 +05301656
1657/**
1658 * lim_ap_mlme_vdev_restart_send - Invokes VDEV restart operation
1659 * @vdev_mlme_obj: VDEV MLME comp object
1660 * @data_len: data size
1661 * @data: event data
1662 *
1663 * API invokes VDEV restart operation
1664 *
1665 * Return: SUCCESS on successful completion of restart operation
1666 * FAILURE, if it fails due to any
1667 */
1668QDF_STATUS lim_ap_mlme_vdev_restart_send(struct vdev_mlme_obj *vdev_mlme,
1669 uint16_t data_len, void *data);
1670
Abhishek Singhc5a54082018-09-12 16:08:03 +05301671/**
1672 * lim_ap_mlme_vdev_start_req_failed - handle vdev start req failure
1673 * @vdev_mlme_obj: VDEV MLME comp object
1674 * @data_len: data size
1675 * @data: event data
1676 *
1677 * API invokes on START fail response
1678 *
1679 * Return: SUCCESS on successful invocation of callback
1680 * FAILURE, if it fails due to any
1681 */
1682QDF_STATUS lim_ap_mlme_vdev_start_req_failed(struct vdev_mlme_obj *vdev_mlme,
1683 uint16_t data_len, void *data);
1684
Kiran Kumar Lokere7d6e4c92018-09-19 13:45:47 -07001685#ifdef CRYPTO_SET_KEY_CONVERGED
1686static inline bool lim_is_set_key_req_converged(void)
1687{
1688 return true;
1689}
1690
1691static inline void lim_copy_set_key_req_mac_addr(struct qdf_mac_addr *dst,
1692 struct qdf_mac_addr *src)
1693{
1694 qdf_copy_macaddr(dst, src);
1695}
1696#else
1697static inline bool lim_is_set_key_req_converged(void)
1698{
1699 return false;
1700}
1701
1702static inline void lim_copy_set_key_req_mac_addr(struct qdf_mac_addr *dst,
1703 struct qdf_mac_addr *src)
1704{
1705}
1706#endif
Wu Gao5c3d94b2019-01-17 21:15:54 +08001707
1708/**
1709 * lim_get_regulatory_max_transmit_power() - Get regulatory max transmit
1710 * power on given channel
1711 * @mac: pointer to mac data
1712 * @channel: channel number
1713 *
1714 * Return: int8_t - power
1715 */
1716int8_t lim_get_regulatory_max_transmit_power(struct mac_context *mac,
1717 uint8_t channel);
1718
1719/**
1720 * lim_get_capability_info() - Get capability information
1721 * @mac: pointer to mac data
1722 * @pcap: pointer to return capability information
1723 * @pe_session: pointer to pe session
1724 *
1725 * Return: SUCCESS on successful get capability information
1726 * FAILURE, if it fails due to any
1727 */
1728QDF_STATUS lim_get_capability_info(struct mac_context *mac, uint16_t *pCap,
1729 struct pe_session *pe_session);
1730
Abhishek Singhecc2c752019-03-18 11:05:39 +05301731/**
1732 * lim_flush_bssid() - flush bssid from scan cache
1733 * @mac_ctx: pointer to mac data
1734 * @bssid: bssid to be flushed
1735 *
1736 * Return: void
1737 */
1738void lim_flush_bssid(struct mac_context *mac_ctx, uint8_t *bssid);
1739
Pragaspathi Thilagaraj0bd369d2019-04-08 00:07:53 +05301740/**
1741 * lim_is_sha384_akm() - Function to check if the negotiated AKM for the
1742 * current session is based on sha384 key derivation function.
1743 * @mac_ctx: pointer to mac data
1744 * @akm: negotiated AKM for the current session
1745 *
1746 * Return: true if akm is sha384 based kdf or false
1747 */
1748bool lim_is_sha384_akm(enum ani_akm_type akm);
1749
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001750#endif /* __LIM_UTILS_H */