blob: 16797840820aa7007dd5a593e3a657ff0bdbbf2c [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
2 * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28/** ------------------------------------------------------------------------- *
29 ------------------------------------------------------------------------- *
30
31 \file csr_inside_api.h
32
33 Define interface only used by CSR.
34 ========================================================================== */
35#ifndef CSR_INSIDE_API_H__
36#define CSR_INSIDE_API_H__
37
38#include "csr_support.h"
39#include "sme_inside.h"
40#include "cds_reg_service.h"
41
42#define CSR_PASSIVE_MAX_CHANNEL_TIME 110
43#define CSR_PASSIVE_MIN_CHANNEL_TIME 60
44
45#define CSR_ACTIVE_MAX_CHANNEL_TIME 40
46#define CSR_ACTIVE_MIN_CHANNEL_TIME 20
47
48#ifdef WLAN_AP_STA_CONCURRENCY
49#define CSR_PASSIVE_MAX_CHANNEL_TIME_CONC 110
50#define CSR_PASSIVE_MIN_CHANNEL_TIME_CONC 60
51
52#define CSR_ACTIVE_MAX_CHANNEL_TIME_CONC 27
53#define CSR_ACTIVE_MIN_CHANNEL_TIME_CONC 20
54
55#define CSR_REST_TIME_CONC 100
56
57#define CSR_NUM_STA_CHAN_COMBINED_CONC 3
58#define CSR_NUM_P2P_CHAN_COMBINED_CONC 1
59#endif
60
61#define CSR_MAX_NUM_SUPPORTED_CHANNELS 55
62
63#define CSR_MAX_2_4_GHZ_SUPPORTED_CHANNELS 14
64
65#define CSR_MAX_BSS_SUPPORT 300
66#define SYSTEM_TIME_MSEC_TO_USEC 1000
67
68/* This number minus 1 means the number of times a channel is scanned before a BSS is remvoed from */
69/* cache scan result */
70#define CSR_AGING_COUNT 3
71#define CSR_SCAN_GET_RESULT_INTERVAL (5 * CDF_MC_TIMER_TO_SEC_UNIT) /* 5 seconds */
72#define CSR_MIC_ERROR_TIMEOUT (60 * CDF_MC_TIMER_TO_SEC_UNIT) /* 60 seconds */
73#define CSR_TKIP_COUNTER_MEASURE_TIMEOUT (60 * CDF_MC_TIMER_TO_SEC_UNIT) /* 60 seconds */
74
75#define CSR_SCAN_RESULT_CFG_AGING_INTERVAL (CDF_MC_TIMER_TO_SEC_UNIT) /* 1 second */
76/* the following defines are NOT used by palTimer */
77#define CSR_SCAN_AGING_TIME_NOT_CONNECT_NO_PS 50 /* 50 seconds */
78#define CSR_SCAN_AGING_TIME_NOT_CONNECT_W_PS 300 /* 300 seconds */
79#define CSR_SCAN_AGING_TIME_CONNECT_NO_PS 150 /* 150 seconds */
80#define CSR_SCAN_AGING_TIME_CONNECT_W_PS 600 /* 600 seconds */
81#define CSR_JOIN_FAILURE_TIMEOUT_DEFAULT (3000)
82#define CSR_JOIN_FAILURE_TIMEOUT_MIN (1000) /* minimal value */
83/* These are going against the signed RSSI (int8_t) so it is between -+127 */
84#define CSR_BEST_RSSI_VALUE (-30) /* RSSI >= this is in CAT4 */
85#define CSR_DEFAULT_RSSI_DB_GAP 30 /* every 30 dbm for one category */
86#define CSR_BSS_CAP_VALUE_NONE 0 /* not much value */
87#define CSR_BSS_CAP_VALUE_HT 1
88#define CSR_BSS_CAP_VALUE_VHT 2
89#define CSR_BSS_CAP_VALUE_WMM 1
90#define CSR_BSS_CAP_VALUE_UAPSD 1
91#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
92#define CSR_BSS_CAP_VALUE_5GHZ 2
93#endif
94#define CSR_DEFAULT_ROAMING_TIME 10 /* 10 seconds */
95
96#define CSR_ROAMING_DFS_CHANNEL_DISABLED (0)
97#define CSR_ROAMING_DFS_CHANNEL_ENABLED_NORMAL (1)
98#define CSR_ROAMING_DFS_CHANNEL_ENABLED_ACTIVE (2)
99
100/* ***************************************************************************
101 * The MAX BSSID Count should be lower than the command timeout value and it
102 * can be of a fraction of 3/4 of the total command timeout value.
103 * ***************************************************************************/
104#define CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE (1000*30*4)
105#define CSR_ACTIVE_SCAN_LIST_CMD_TIMEOUT (1000*30)
106
107#define CSR_MAX_BSSID_COUNT ((CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE/4000) * 3)
108#define CSR_CUSTOM_CONC_GO_BI 100
109#define MIN_11P_CHANNEL (rf_channels[MIN_5_9GHZ_CHANNEL].channelNum)
110
111typedef enum {
112 eCsrNextScanNothing,
113 eCsrNextLostLinkScan1Success,
114 eCsrNextLostLinkScan1Failed,
115 eCsrNextLostLinkScan2Success,
116 eCsrNextLostLinkScan2Failed,
117 eCsrNextLostLinkScan3Success,
118 eCsrNexteScanForSsidSuccess,
119 eCsrNextLostLinkScan3Failed,
120 eCsrNext11dScan1Failure,
121 eCsrNext11dScan1Success,
122 eCsrNext11dScan2Failure,
123 eCsrNext11dScan2Success,
124 eCsrNext11dScanComplete,
125 eCsrNexteScanForSsidFailure,
126
127} eCsrScanCompleteNextCommand;
128
129typedef enum {
130 eCsrJoinSuccess,
131 eCsrJoinFailure,
132 eCsrReassocSuccess,
133 eCsrReassocFailure,
134 eCsrNothingToJoin,
135 eCsrStartBssSuccess,
136 eCsrStartBssFailure,
137 eCsrSilentlyStopRoaming,
138 eCsrSilentlyStopRoamingSaveState,
139 eCsrJoinWdsFailure,
140 eCsrJoinFailureDueToConcurrency,
141
142} eCsrRoamCompleteResult;
143
144typedef struct tagScanReqParam {
145 uint8_t bReturnAfter1stMatch;
146 uint8_t fUniqueResult;
147 uint8_t freshScan;
148 uint8_t hiddenSsid;
149 uint8_t reserved;
150} tScanReqParam;
151
152typedef struct tagCsrScanResult {
153 tListElem Link;
154 int32_t AgingCount; /* This BSS is removed when it reaches 0 or less */
155 uint32_t preferValue; /* The bigger the number, the better the BSS. This value override capValue */
156 uint32_t capValue; /* The biggger the better. This value is in use only if we have equal preferValue */
157 /* This member must be the last in the structure because the end of tSirBssDescription (inside) is an */
158 /* array with nonknown size at this time */
159
160 eCsrEncryptionType ucEncryptionType; /* Preferred Encryption type that matched with profile. */
161 eCsrEncryptionType mcEncryptionType;
162 eCsrAuthType authType; /* Preferred auth type that matched with the profile. */
163
164 tCsrScanResultInfo Result;
165} tCsrScanResult;
166
167typedef struct {
168 tDblLinkList List;
169 tListElem *pCurEntry;
170} tScanResultList;
171
172#define CSR_IS_ROAM_REASON(pCmd, reason) ((reason) == (pCmd)->roamCmd.roamReason)
173#define CSR_IS_BETTER_PREFER_VALUE(v1, v2) ((v1) > (v2))
174#define CSR_IS_EQUAL_PREFER_VALUE(v1, v2) ((v1) == (v2))
175#define CSR_IS_BETTER_CAP_VALUE(v1, v2) ((v1) > (v2))
176#define CSR_IS_EQUAL_CAP_VALUE(v1, v2) ((v1) == (v2))
177#define CSR_IS_BETTER_RSSI(v1, v2) ((v1) > (v2))
178#define CSR_IS_ENC_TYPE_STATIC(encType) ((eCSR_ENCRYPT_TYPE_NONE == (encType)) || \
179 (eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == (encType)) || \
180 (eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == (encType)))
181#define CSR_IS_WAIT_FOR_KEY(pMac, sessionId) \
182 (CSR_IS_ROAM_JOINED(pMac, sessionId) && \
183 CSR_IS_ROAM_SUBSTATE_WAITFORKEY(pMac, sessionId))
184/* WIFI has a test case for not using HT rates with TKIP as encryption */
185/* We may need to add WEP but for now, TKIP only. */
186
187#define CSR_IS_11n_ALLOWED(encType) ((eCSR_ENCRYPT_TYPE_TKIP != (encType)) && \
188 (eCSR_ENCRYPT_TYPE_WEP40_STATICKEY != (encType)) && \
189 (eCSR_ENCRYPT_TYPE_WEP104_STATICKEY != (encType)) && \
190 (eCSR_ENCRYPT_TYPE_WEP40 != (encType)) && \
191 (eCSR_ENCRYPT_TYPE_WEP104 != (encType)))
192
193#define CSR_IS_DISCONNECT_COMMAND(pCommand) ((eSmeCommandRoam == (pCommand)->command) && \
194 ((eCsrForcedDisassoc == (pCommand)->u.roamCmd.roamReason) || \
195 (eCsrForcedDeauth == (pCommand)->u.roamCmd.roamReason) || \
196 (eCsrSmeIssuedDisassocForHandoff == \
197 (pCommand)->u.roamCmd.roamReason) || \
198 (eCsrForcedDisassocMICFailure == \
199 (pCommand)->u.roamCmd.roamReason)))
200
201extern const tRfChannelProps rf_channels[NUM_RF_CHANNELS];
202eCsrRoamState csr_roam_state_change(tpAniSirGlobal pMac,
203 eCsrRoamState NewRoamState, uint8_t sessionId);
204CDF_STATUS csr_scanning_state_msg_processor(tpAniSirGlobal pMac, void *pMsgBuf);
205void csr_roaming_state_msg_processor(tpAniSirGlobal pMac, void *pMsgBuf);
206void csr_roam_joined_state_msg_processor(tpAniSirGlobal pMac, void *pMsgBuf);
207bool csr_scan_complete(tpAniSirGlobal pMac, tSirSmeScanRsp *pScanRsp);
208void csr_release_command_roam(tpAniSirGlobal pMac, tSmeCmd *pCommand);
209void csr_release_command_scan(tpAniSirGlobal pMac, tSmeCmd *pCommand);
210void csr_release_command_wm_status_change(tpAniSirGlobal pMac, tSmeCmd *pCommand);
211extern void csr_release_roc_req_cmd(tpAniSirGlobal mac_ctx);
212
213bool csr_is_duplicate_bss_description(tpAniSirGlobal pMac,
214 tSirBssDescription *pSirBssDesc1,
215 tSirBssDescription *pSirBssDesc2,
216 tDot11fBeaconIEs *pIes2, bool fForced);
217CDF_STATUS csr_roam_save_connected_bss_desc(tpAniSirGlobal pMac, uint32_t sessionId,
218 tSirBssDescription *pBssDesc);
219bool csr_is_network_type_equal(tSirBssDescription *pSirBssDesc1,
220 tSirBssDescription *pSirBssDesc2);
221CDF_STATUS csr_scan_sme_scan_response(tpAniSirGlobal pMac, void *pMsgBuf);
222/*
223 Prepare a filter base on a profile for parsing the scan results.
224 Upon successful return, caller MUST call csr_free_scan_filter on
225 pScanFilter when it is done with the filter.
226 */
227CDF_STATUS csr_roam_prepare_filter_from_profile(tpAniSirGlobal pMac,
228 tCsrRoamProfile *pProfile,
229 tCsrScanResultFilter *pScanFilter);
230CDF_STATUS csr_roam_copy_profile(tpAniSirGlobal pMac,
231 tCsrRoamProfile *pDstProfile,
232 tCsrRoamProfile *pSrcProfile);
233CDF_STATUS csr_roam_start(tpAniSirGlobal pMac);
234void csr_roam_stop(tpAniSirGlobal pMac, uint32_t sessionId);
235void csr_roam_startMICFailureTimer(tpAniSirGlobal pMac);
236void csr_roam_stopMICFailureTimer(tpAniSirGlobal pMac);
237void csr_roam_startTKIPCounterMeasureTimer(tpAniSirGlobal pMac);
238void csr_roam_stopTKIPCounterMeasureTimer(tpAniSirGlobal pMac);
239
240CDF_STATUS csr_scan_open(tpAniSirGlobal pMac);
241CDF_STATUS csr_scan_close(tpAniSirGlobal pMac);
242CDF_STATUS csr_scan_request_lost_link1(tpAniSirGlobal pMac, uint32_t sessionId);
243CDF_STATUS csr_scan_request_lost_link2(tpAniSirGlobal pMac, uint32_t sessionId);
244CDF_STATUS csr_scan_request_lost_link3(tpAniSirGlobal pMac, uint32_t sessionId);
245CDF_STATUS csr_scan_handle_failed_lostlink1(tpAniSirGlobal pMac,
246 uint32_t sessionId);
247CDF_STATUS csr_scan_handle_failed_lostlink2(tpAniSirGlobal pMac,
248 uint32_t sessionId);
249CDF_STATUS csr_scan_handle_failed_lostlink3(tpAniSirGlobal pMac,
250 uint32_t sessionId);
251tCsrScanResult *csr_scan_append_bss_description(tpAniSirGlobal pMac,
252 tSirBssDescription *
253 pSirBssDescription,
254 tDot11fBeaconIEs *pIes,
255 bool fForced, uint8_t sessionId);
256void csr_scan_call_callback(tpAniSirGlobal pMac, tSmeCmd *pCommand,
257 eCsrScanStatus scanStatus);
258CDF_STATUS csr_scan_copy_request(tpAniSirGlobal pMac, tCsrScanRequest *pDstReq,
259 tCsrScanRequest *pSrcReq);
260CDF_STATUS csr_scan_free_request(tpAniSirGlobal pMac, tCsrScanRequest *pReq);
261CDF_STATUS csr_scan_copy_result_list(tpAniSirGlobal pMac, tScanResultHandle hIn,
262 tScanResultHandle *phResult);
263CDF_STATUS csr_scan_for_ssid(tpAniSirGlobal pMac, uint32_t sessionId,
264 tCsrRoamProfile *pProfile, uint32_t roamId,
265 bool notify);
266CDF_STATUS csr_scan_start_result_cfg_aging_timer(tpAniSirGlobal pMac);
267CDF_STATUS csr_scan_stop_result_cfg_aging_timer(tpAniSirGlobal pMac);
268void csr_scan_stop_timers(tpAniSirGlobal pMac);
269/* To remove fresh scan commands from the pending queue */
270bool csr_scan_remove_fresh_scan_command(tpAniSirGlobal pMac, uint8_t sessionId);
271CDF_STATUS csr_scan_abort_mac_scan(tpAniSirGlobal pMac, uint8_t sessionId,
272 eCsrAbortReason reason);
273void csr_remove_cmd_from_pending_list(tpAniSirGlobal pMac, tDblLinkList *pList,
274 eSmeCommandType commandType);
275void csr_remove_cmd_with_session_id_from_pending_list(tpAniSirGlobal pMac,
276 uint8_t sessionId,
277 tDblLinkList *pList,
278 eSmeCommandType commandType);
279CDF_STATUS csr_scan_abort_mac_scan_not_for_connect(tpAniSirGlobal pMac,
280 uint8_t sessionId);
281CDF_STATUS csr_scan_abort_scan_for_ssid(tpAniSirGlobal pMac, uint32_t sessionId);
282void csr_remove_scan_for_ssid_from_pending_list(tpAniSirGlobal pMac,
283 tDblLinkList *pList,
284 uint32_t sessionId);
285
286CDF_STATUS csr_abort_scan_from_active_list(tpAniSirGlobal pMac,
287 tDblLinkList *pList, uint32_t sessionId,
288 eSmeCommandType scan_cmd_type, eCsrAbortReason abort_reason);
289
290/* To age out scan results base. tSmeGetScanChnRsp is a pointer returned by LIM that */
291/* has the information regarding scanned channels. */
292/* The logic is that whenever CSR add a BSS to scan result, it set the age count to */
293/* a value. This function deduct the age count if channelId matches the BSS' channelId */
294/* The BSS is remove if the count reaches 0. */
295CDF_STATUS csr_scan_age_results(tpAniSirGlobal pMac,
296 tSmeGetScanChnRsp *pScanChnInfo);
297
298/* If fForce is true we will save the new String that is learn't. */
299/* Typically it will be true in case of Join or user initiated ioctl */
300bool csr_learn_11dcountry_information(tpAniSirGlobal pMac,
301 tSirBssDescription *pSirBssDesc,
302 tDot11fBeaconIEs *pIes, bool fForce);
303void csr_apply_country_information(tpAniSirGlobal pMac);
304void csr_set_cfg_scan_control_list(tpAniSirGlobal pMac, uint8_t *countryCode,
305 tCsrChannel *pChannelList);
306void csr_reinit_scan_cmd(tpAniSirGlobal pMac, tSmeCmd *pCommand);
307void csr_free_scan_result_entry(tpAniSirGlobal pMac, tCsrScanResult *pResult);
308
309CDF_STATUS csr_roam_call_callback(tpAniSirGlobal pMac, uint32_t sessionId,
310 tCsrRoamInfo *pRoamInfo, uint32_t roamId,
311 eRoamCmdStatus u1, eCsrRoamResult u2);
312CDF_STATUS csr_roam_issue_connect(tpAniSirGlobal pMac, uint32_t sessionId,
313 tCsrRoamProfile *pProfile,
314 tScanResultHandle hBSSList,
315 eCsrRoamReason reason, uint32_t roamId,
316 bool fImediate, bool fClearScan);
317CDF_STATUS csr_roam_issue_reassoc(tpAniSirGlobal pMac, uint32_t sessionId,
318 tCsrRoamProfile *pProfile,
319 tCsrRoamModifyProfileFields *pModProfileFields,
320 eCsrRoamReason reason, uint32_t roamId,
321 bool fImediate);
322void csr_roam_complete(tpAniSirGlobal pMac, eCsrRoamCompleteResult Result,
323 void *Context);
324CDF_STATUS csr_roam_issue_set_context_req(tpAniSirGlobal pMac, uint32_t sessionId,
325 eCsrEncryptionType EncryptType,
326 tSirBssDescription *pBssDescription,
327 tSirMacAddr *bssId, bool addKey,
328 bool fUnicast,
329 tAniKeyDirection aniKeyDirection,
330 uint8_t keyId, uint16_t keyLength,
331 uint8_t *pKey, uint8_t paeRole);
332CDF_STATUS csr_roam_process_disassoc_deauth(tpAniSirGlobal pMac, tSmeCmd *pCommand,
333 bool fDisassoc, bool fMICFailure);
334CDF_STATUS csr_roam_save_connected_infomation(tpAniSirGlobal pMac,
335 uint32_t sessionId,
336 tCsrRoamProfile *pProfile,
337 tSirBssDescription *pSirBssDesc,
338 tDot11fBeaconIEs *pIes);
339void csr_roam_check_for_link_status_change(tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg);
340void csr_roam_stats_rsp_processor(tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg);
341CDF_STATUS csr_roam_issue_start_bss(tpAniSirGlobal pMac, uint32_t sessionId,
342 tCsrRoamStartBssParams *pParam,
343 tCsrRoamProfile *pProfile,
344 tSirBssDescription *pBssDesc, uint32_t roamId);
345CDF_STATUS csr_roam_issue_stop_bss(tpAniSirGlobal pMac, uint32_t sessionId,
346 eCsrRoamSubState NewSubstate);
347bool csr_is_same_profile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile1,
348 tCsrRoamProfile *pProfile2);
349bool csr_is_roam_command_waiting(tpAniSirGlobal pMac);
350bool csr_is_roam_command_waiting_for_session(tpAniSirGlobal pMac, uint32_t sessionId);
351bool csr_is_scan_for_roam_command_active(tpAniSirGlobal pMac);
352eRoamCmdStatus csr_get_roam_complete_status(tpAniSirGlobal pMac,
353 uint32_t sessionId);
354/* pBand can be NULL if caller doesn't need to get it */
355CDF_STATUS csr_roam_issue_disassociate_cmd(tpAniSirGlobal pMac, uint32_t sessionId,
356 eCsrRoamDisconnectReason reason);
357CDF_STATUS csr_roam_disconnect_internal(tpAniSirGlobal pMac, uint32_t sessionId,
358 eCsrRoamDisconnectReason reason);
359/* pCommand may be NULL */
360void csr_roam_remove_duplicate_command(tpAniSirGlobal pMac, uint32_t sessionId,
361 tSmeCmd *pCommand,
362 eCsrRoamReason eRoamReason);
363
364CDF_STATUS csr_send_join_req_msg(tpAniSirGlobal pMac, uint32_t sessionId,
365 tSirBssDescription *pBssDescription,
366 tCsrRoamProfile *pProfile,
367 tDot11fBeaconIEs *pIes, uint16_t messageType);
368CDF_STATUS csr_send_mb_disassoc_req_msg(tpAniSirGlobal pMac, uint32_t sessionId,
369 tSirMacAddr bssId, uint16_t reasonCode);
370CDF_STATUS csr_send_mb_deauth_req_msg(tpAniSirGlobal pMac, uint32_t sessionId,
371 tSirMacAddr bssId, uint16_t reasonCode);
372CDF_STATUS csr_send_mb_disassoc_cnf_msg(tpAniSirGlobal pMac,
373 tpSirSmeDisassocInd pDisassocInd);
374CDF_STATUS csr_send_mb_deauth_cnf_msg(tpAniSirGlobal pMac,
375 tpSirSmeDeauthInd pDeauthInd);
376CDF_STATUS csr_send_assoc_cnf_msg(tpAniSirGlobal pMac, tpSirSmeAssocInd pAssocInd,
377 CDF_STATUS status);
378CDF_STATUS csr_send_assoc_ind_to_upper_layer_cnf_msg(tpAniSirGlobal pMac,
379 tpSirSmeAssocInd pAssocInd,
380 CDF_STATUS Halstatus,
381 uint8_t sessionId);
382CDF_STATUS csr_send_mb_start_bss_req_msg(tpAniSirGlobal pMac, uint32_t sessionId,
383 eCsrRoamBssType bssType,
384 tCsrRoamStartBssParams *pParam,
385 tSirBssDescription *pBssDesc);
386CDF_STATUS csr_send_mb_stop_bss_req_msg(tpAniSirGlobal pMac, uint32_t sessionId);
387
388/* Caller should put the BSS' ssid to fiedl bssSsid when comparing SSID for a BSS. */
389bool csr_is_ssid_match(tpAniSirGlobal pMac, uint8_t *ssid1, uint8_t ssid1Len,
390 uint8_t *bssSsid, uint8_t bssSsidLen, bool fSsidRequired);
391bool csr_is_phy_mode_match(tpAniSirGlobal pMac, uint32_t phyMode,
392 tSirBssDescription *pSirBssDesc,
393 tCsrRoamProfile *pProfile,
394 eCsrCfgDot11Mode *pReturnCfgDot11Mode,
395 tDot11fBeaconIEs *pIes);
396bool csr_roam_is_channel_valid(tpAniSirGlobal pMac, uint8_t channel);
397
398/* pNumChan is a caller allocated space with the sizeof pChannels */
399CDF_STATUS csr_get_cfg_valid_channels(tpAniSirGlobal pMac, uint8_t *pChannels,
400 uint32_t *pNumChan);
401void csr_roam_ccm_cfg_set_callback(tpAniSirGlobal pMac, int32_t result);
402
403tPowerdBm csr_get_cfg_max_tx_power(tpAniSirGlobal pMac, uint8_t channel);
404
405/* To free the last roaming profile */
406void csr_free_roam_profile(tpAniSirGlobal pMac, uint32_t sessionId);
407void csr_free_connect_bss_desc(tpAniSirGlobal pMac, uint32_t sessionId);
408CDF_STATUS csr_move_bss_to_head_from_bssid(tpAniSirGlobal pMac,
409 struct cdf_mac_addr *bssid,
410 tScanResultHandle hScanResult);
411bool csr_check_ps_ready(void *pv);
412bool csr_check_ps_offload_ready(void *pv, uint32_t sessionId);
413
414/* to free memory allocated inside the profile structure */
415void csr_release_profile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile);
416/* To free memory allocated inside scanFilter */
417void csr_free_scan_filter(tpAniSirGlobal pMac, tCsrScanResultFilter *pScanFilter);
418eCsrCfgDot11Mode csr_get_cfg_dot11_mode_from_csr_phy_mode(tCsrRoamProfile *pProfile,
419 eCsrPhyMode phyMode,
420 bool fProprietary);
421uint32_t csr_translate_to_wni_cfg_dot11_mode(tpAniSirGlobal pMac,
422 eCsrCfgDot11Mode csrDot11Mode);
423void csr_save_channel_power_for_band(tpAniSirGlobal pMac, bool fPopulate5GBand);
424void csr_apply_channel_power_info_to_fw(tpAniSirGlobal pMac,
425 tCsrChannel *pChannelList,
426 uint8_t *countryCode);
427void csr_apply_power2_current(tpAniSirGlobal pMac);
428void csr_assign_rssi_for_category(tpAniSirGlobal pMac, int8_t bestApRssi,
429 uint8_t catOffset);
430CDF_STATUS csr_roam_remove_connected_bss_from_scan_cache(tpAniSirGlobal pMac,
431 tCsrRoamConnectedProfile *
432 pConnProfile);
433CDF_STATUS csr_roam_start_roaming(tpAniSirGlobal pMac, uint32_t sessionId,
434 eCsrRoamingReason roamingReason);
435/* return a bool to indicate whether roaming completed or continue. */
436bool csr_roam_complete_roaming(tpAniSirGlobal pMac, uint32_t sessionId,
437 bool fForce, eCsrRoamResult roamResult);
438void csr_roam_completion(tpAniSirGlobal pMac, uint32_t sessionId,
439 tCsrRoamInfo *pRoamInfo, tSmeCmd *pCommand,
440 eCsrRoamResult roamResult, bool fSuccess);
441void csr_roam_cancel_roaming(tpAniSirGlobal pMac, uint32_t sessionId);
442void csr_apply_channel_power_info_wrapper(tpAniSirGlobal pMac);
443void csr_reset_pmkid_candidate_list(tpAniSirGlobal pMac, uint32_t sessionId);
444#ifdef FEATURE_WLAN_WAPI
445void csr_reset_bkid_candidate_list(tpAniSirGlobal pMac, uint32_t sessionId);
446#endif /* FEATURE_WLAN_WAPI */
447CDF_STATUS csr_save_to_channel_power2_g_5_g(tpAniSirGlobal pMac, uint32_t tableSize,
448 tSirMacChanInfo *channelTable);
449
450/* To check whether a country code matches the one in the IE */
451/* Only check the first two characters, ignoring in/outdoor */
452/* pCountry -- caller allocated buffer contain the country code that is checking against */
453/* the one in pIes. It can be NULL. */
454/* caller must provide pIes, it cannot be NULL */
455/* This function always return true if 11d support is not turned on. */
456/* pIes cannot be NULL */
457bool csr_match_country_code(tpAniSirGlobal pMac, uint8_t *pCountry,
458 tDot11fBeaconIEs *pIes);
459CDF_STATUS csr_roam_set_key(tpAniSirGlobal pMac, uint32_t sessionId,
460 tCsrRoamSetKey *pSetKey, uint32_t roamId);
461CDF_STATUS csr_roam_open_session(tpAniSirGlobal pMac,
462 csr_roam_completeCallback callback, void *pContext,
463 uint8_t *pSelfMacAddr, uint8_t *pbSessionId,
464 uint32_t type, uint32_t subType);
465/* fSync: true means cleanupneeds to handle synchronously. */
466CDF_STATUS csr_roam_close_session(tpAniSirGlobal pMac, uint32_t sessionId,
467 bool fSync,
468 csr_roamSessionCloseCallback callback,
469 void *pContext);
470void csr_cleanup_session(tpAniSirGlobal pMac, uint32_t sessionId);
471CDF_STATUS csr_roam_get_session_id_from_bssid(tpAniSirGlobal pMac, struct cdf_mac_addr *bssid,
472 uint32_t *pSessionId);
473eCsrCfgDot11Mode csr_find_best_phy_mode(tpAniSirGlobal pMac, uint32_t phyMode);
474
475/* ---------------------------------------------------------------------------
476 \fn csr_scan_enable
477 \brief Enable the scanning feature of CSR. It must be called before any scan request can be performed.
478 \param tHalHandle - HAL context handle
479 \return CDF_STATUS
480 -------------------------------------------------------------------------------*/
481CDF_STATUS csr_scan_enable(tpAniSirGlobal);
482
483/* ---------------------------------------------------------------------------
484 \fn csr_scan_disable
485 \brief Disableing the scanning feature of CSR. After this function return success, no scan is performed until
486 a successfull to csr_scan_enable
487 \param tHalHandle - HAL context handle
488 \return CDF_STATUS
489 -------------------------------------------------------------------------------*/
490CDF_STATUS csr_scan_disable(tpAniSirGlobal);
491/* ---------------------------------------------------------------------------
492 \fn csr_scan_request
493 \brief Request a 11d or full scan.
494 \param callback - a callback function that scan calls upon finish, will not be called if csr_scan_request returns error
495 \param pContext - a pointer passed in for the callback
496 \return CDF_STATUS
497 -------------------------------------------------------------------------------*/
498CDF_STATUS csr_scan_request(tpAniSirGlobal, uint16_t, tCsrScanRequest *,
499 csr_scan_completeCallback callback, void *pContext);
500
501/* ---------------------------------------------------------------------------
502 \fn csrScanAbort
503 \brief If a scan request is abort, the scan complete callback will be called first before csrScanAbort returns.
504 \param pScanRequestID - The request ID returned from csr_scan_request
505 \return CDF_STATUS
506 -------------------------------------------------------------------------------*/
507CDF_STATUS csrScanAbort(tpAniSirGlobal, uint32_t scanRequestID);
508
509/* ---------------------------------------------------------------------------
510 \fn csr_scan_get_result
511 \brief Return scan results.
512 \param pFilter - If pFilter is NULL, all cached results are returned
513 \param phResult - an object for the result.
514 \return CDF_STATUS
515 -------------------------------------------------------------------------------*/
516CDF_STATUS csr_scan_get_result(tpAniSirGlobal, tCsrScanResultFilter *pFilter,
517 tScanResultHandle *phResult);
518
519/* ---------------------------------------------------------------------------
520 \fn csr_scan_flush_result
521 \brief Clear scan results.
522 \param pMac - pMac global pointer
523 \param sessionId - Session Identifier
524 \return CDF_STATUS
525 -------------------------------------------------------------------------------*/
526CDF_STATUS csr_scan_flush_result(tpAniSirGlobal);
527/* ---------------------------------------------------------------------------
528 * \fn csr_scan_filter_results
529 * \brief Filter scan results based on valid channel list.
530 * \param pMac - Pointer to Global MAC structure
531 * \return CDF_STATUS
532 ***-------------------------------------------------------------------------------
533 */
534CDF_STATUS csr_scan_filter_results(tpAniSirGlobal pMac);
535
536void csr_save_scan_results(tpAniSirGlobal pMac, uint8_t reason,
537 uint8_t sessionId);
538
539CDF_STATUS csr_scan_flush_selective_result(tpAniSirGlobal, bool flushP2P);
540
541/* ---------------------------------------------------------------------------
542 \fn csr_scan_result_get_first
543 \brief Returns the first element of scan result.
544 \param hScanResult - returned from csr_scan_get_result
545 \return tCsrScanResultInfo * - NULL if no result
546 -------------------------------------------------------------------------------*/
547tCsrScanResultInfo *csr_scan_result_get_first(tpAniSirGlobal,
548 tScanResultHandle hScanResult);
549/* ---------------------------------------------------------------------------
550 \fn csr_scan_result_get_next
551 \brief Returns the next element of scan result. It can be called without calling csr_scan_result_get_first first
552 \param hScanResult - returned from csr_scan_get_result
553 \return Null if no result or reach the end
554 -------------------------------------------------------------------------------*/
555tCsrScanResultInfo *csr_scan_result_get_next(tpAniSirGlobal,
556 tScanResultHandle hScanResult);
557
558/* ---------------------------------------------------------------------------
559 \fn csr_get_country_code
560 \brief this function is to get the country code current being used
561 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return, this has the country code
562 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
563 this contains the length of the data in pBuf
564 \return CDF_STATUS
565 -------------------------------------------------------------------------------*/
566CDF_STATUS csr_get_country_code(tpAniSirGlobal pMac, uint8_t *pBuf,
567 uint8_t *pbLen);
568
569/* ---------------------------------------------------------------------------
570 \fn csr_set_country_code
571 \brief this function is to set the country code so channel/power setting matches the countrycode and
572 the domain it belongs to.
573 \param pCountry - Caller allocated buffer with at least 3 bytes specifying the country code
574 \return CDF_STATUS
575 -------------------------------------------------------------------------------*/
576CDF_STATUS csr_set_country_code(tpAniSirGlobal pMac, uint8_t *pCountry);
577
578/* ---------------------------------------------------------------------------
579 \fn csr_get_regulatory_domain_for_country
580 \brief this function is to get the regulatory domain for a country.
581 This function must be called after CFG is downloaded and all the band/mode setting already passed into
582 CSR.
583 \param pCountry - Caller allocated buffer with at least 3 bytes specifying the country code
584 \param pDomainId - Caller allocated buffer to get the return domain ID upon success return. Can be NULL.
585 \param source - the source of country information.
586 \return CDF_STATUS
587 -------------------------------------------------------------------------------*/
588CDF_STATUS csr_get_regulatory_domain_for_country(tpAniSirGlobal pMac,
589 uint8_t *pCountry,
590 v_REGDOMAIN_t *pDomainId,
591 v_CountryInfoSource_t source);
592
593/* some support functions */
594bool csr_is11d_supported(tpAniSirGlobal pMac);
595bool csr_is11h_supported(tpAniSirGlobal pMac);
596bool csr_is11e_supported(tpAniSirGlobal pMac);
597bool csr_is_wmm_supported(tpAniSirGlobal pMac);
598bool csr_is_mcc_supported(tpAniSirGlobal pMac);
599
600/* Return SUCCESS is the command is queued, failed */
601CDF_STATUS csr_queue_sme_command(tpAniSirGlobal pMac, tSmeCmd *pCommand,
602 bool fHighPriority);
603tSmeCmd *csr_get_command_buffer(tpAniSirGlobal pMac);
604void csr_release_command(tpAniSirGlobal pMac, tSmeCmd *pCommand);
605void csr_scan_flush_bss_entry(tpAniSirGlobal pMac,
606 tpSmeCsaOffloadInd pCsaOffloadInd);
607CDF_STATUS csr_get_active_scan_entry(tpAniSirGlobal mac, uint32_t scan_id,
608 tListElem **entry);
609
610#ifdef FEATURE_WLAN_WAPI
611bool csr_is_profile_wapi(tCsrRoamProfile *pProfile);
612#endif /* FEATURE_WLAN_WAPI */
613
614#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
615
616/* Security */
617#define WLAN_SECURITY_EVENT_SET_PTK_REQ 1
618#define WLAN_SECURITY_EVENT_SET_PTK_RSP 2
619#define WLAN_SECURITY_EVENT_SET_GTK_REQ 3
620#define WLAN_SECURITY_EVENT_SET_GTK_RSP 4
621#define WLAN_SECURITY_EVENT_REMOVE_KEY_REQ 5
622#define WLAN_SECURITY_EVENT_REMOVE_KEY_RSP 6
623#define WLAN_SECURITY_EVENT_PMKID_CANDIDATE_FOUND 7
624#define WLAN_SECURITY_EVENT_PMKID_UPDATE 8
625#define WLAN_SECURITY_EVENT_MIC_ERROR 9
626
627#define AUTH_OPEN 0
628#define AUTH_SHARED 1
629#define AUTH_WPA_EAP 2
630#define AUTH_WPA_PSK 3
631#define AUTH_WPA2_EAP 4
632#define AUTH_WPA2_PSK 5
633#ifdef FEATURE_WLAN_WAPI
634#define AUTH_WAPI_CERT 6
635#define AUTH_WAPI_PSK 7
636#endif /* FEATURE_WLAN_WAPI */
637
638#define ENC_MODE_OPEN 0
639#define ENC_MODE_WEP40 1
640#define ENC_MODE_WEP104 2
641#define ENC_MODE_TKIP 3
642#define ENC_MODE_AES 4
643#ifdef FEATURE_WLAN_WAPI
644#define ENC_MODE_SMS4 5 /* WAPI */
645#endif /* FEATURE_WLAN_WAPI */
646
647#define NO_MATCH 0
648#define MATCH 1
649
650#define WLAN_SECURITY_STATUS_SUCCESS 0
651#define WLAN_SECURITY_STATUS_FAILURE 1
652
653/* Scan */
654#define WLAN_SCAN_EVENT_ACTIVE_SCAN_REQ 1
655#define WLAN_SCAN_EVENT_ACTIVE_SCAN_RSP 2
656#define WLAN_SCAN_EVENT_PASSIVE_SCAN_REQ 3
657#define WLAN_SCAN_EVENT_PASSIVE_SCAN_RSP 4
658#define WLAN_SCAN_EVENT_HO_SCAN_REQ 5
659#define WLAN_SCAN_EVENT_HO_SCAN_RSP 6
660
661#define WLAN_SCAN_STATUS_SUCCESS 0
662#define WLAN_SCAN_STATUS_FAILURE 1
663#define WLAN_SCAN_STATUS_ABORT 2
664
665/* Ibss */
666#define WLAN_IBSS_EVENT_START_IBSS_REQ 0
667#define WLAN_IBSS_EVENT_START_IBSS_RSP 1
668#define WLAN_IBSS_EVENT_JOIN_IBSS_REQ 2
669#define WLAN_IBSS_EVENT_JOIN_IBSS_RSP 3
670#define WLAN_IBSS_EVENT_COALESCING 4
671#define WLAN_IBSS_EVENT_PEER_JOIN 5
672#define WLAN_IBSS_EVENT_PEER_LEAVE 6
673#define WLAN_IBSS_EVENT_STOP_REQ 7
674#define WLAN_IBSS_EVENT_STOP_RSP 8
675
676#define AUTO_PICK 0
677#define SPECIFIED 1
678
679#define WLAN_IBSS_STATUS_SUCCESS 0
680#define WLAN_IBSS_STATUS_FAILURE 1
681
682/* 11d */
683#define WLAN_80211D_EVENT_COUNTRY_SET 0
684#define WLAN_80211D_EVENT_RESET 1
685
686#define WLAN_80211D_DISABLED 0
687#define WLAN_80211D_SUPPORT_MULTI_DOMAIN 1
688#define WLAN_80211D_NOT_SUPPORT_MULTI_DOMAIN 2
689
690int diag_auth_type_from_csr_type(eCsrAuthType authType);
691int diag_enc_type_from_csr_type(eCsrEncryptionType encType);
692#endif /* #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR */
693/* ---------------------------------------------------------------------------
694 \fn csr_scan_result_purge
695 \brief remove all items(tCsrScanResult) in the list and free memory for each item
696 \param hScanResult - returned from csr_scan_get_result. hScanResult is considered gone by
697 calling this function and even before this function reutrns.
698 \return CDF_STATUS
699 -------------------------------------------------------------------------------*/
700CDF_STATUS csr_scan_result_purge(tpAniSirGlobal pMac,
701 tScanResultHandle hScanResult);
702
703/* /////////////////////////////////////////Common Scan ends */
704
705/* ---------------------------------------------------------------------------
706 \fn csr_roam_connect
707 \brief To inititiate an association
708 \param pProfile - can be NULL to join to any open ones
709 \param pRoamId - to get back the request ID
710 \return CDF_STATUS
711 -------------------------------------------------------------------------------*/
712CDF_STATUS csr_roam_connect(tpAniSirGlobal pMac, uint32_t sessionId,
713 tCsrRoamProfile *pProfile,
714 uint32_t *pRoamId);
715
716/* ---------------------------------------------------------------------------
717 \fn csr_roam_reassoc
718 \brief To inititiate a re-association
719 \param pProfile - can be NULL to join the currently connected AP. In that
720 case modProfileFields should carry the modified field(s) which could trigger
721 reassoc
722 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
723 that might need modification dynamically once STA is up & running and this
724 could trigger a reassoc
725 \param pRoamId - to get back the request ID
726 \return CDF_STATUS
727 -------------------------------------------------------------------------------*/
728CDF_STATUS csr_roam_reassoc(tpAniSirGlobal pMac, uint32_t sessionId,
729 tCsrRoamProfile *pProfile,
730 tCsrRoamModifyProfileFields modProfileFields,
731 uint32_t *pRoamId);
732
733/* ---------------------------------------------------------------------------
734 \fn csr_roam_reconnect
735 \brief To disconnect and reconnect with the same profile
736 \return CDF_STATUS. It returns fail if currently not connected
737 -------------------------------------------------------------------------------*/
738CDF_STATUS csr_roam_reconnect(tpAniSirGlobal pMac, uint32_t sessionId);
739
740/* ---------------------------------------------------------------------------
741 \fn csr_roam_set_pmkid_cache
742 \brief return the PMKID candidate list
743 \param pPMKIDCache - caller allocated buffer point to an array of tPmkidCacheInfo
744 \param numItems - a variable that has the number of tPmkidCacheInfo allocated
745 when retruning, this is either the number needed or number of items put into pPMKIDCache
746 \return CDF_STATUS - when fail, it usually means the buffer allocated is not big enough and pNumItems
747 has the number of tPmkidCacheInfo.
748 \Note: pNumItems is a number of tPmkidCacheInfo, not sizeof(tPmkidCacheInfo) * something
749 -------------------------------------------------------------------------------*/
750CDF_STATUS csr_roam_set_pmkid_cache(tpAniSirGlobal pMac, uint32_t sessionId,
751 tPmkidCacheInfo *pPMKIDCache,
752 uint32_t numItems, bool update_entire_cache);
753
754#ifdef WLAN_FEATURE_ROAM_OFFLOAD
755/* ---------------------------------------------------------------------------
756 *\fn csr_roam_set_psk_pmk
757 *\brief store PSK/PMK
758 *\param pMac - pointer to global structure for MAC
759 *\param sessionId - Sme session id
760 *\param pPSK_PMK - pointer to an array of Psk/Pmk
761 *\return CDF_STATUS - usually it succeed unless sessionId is not found
762 *\Note:
763 *-------------------------------------------------------------------------------*/
764CDF_STATUS csr_roam_set_psk_pmk(tpAniSirGlobal pMac, uint32_t sessionId,
765 uint8_t *pPSK_PMK, size_t pmk_len);
766
767/* ---------------------------------------------------------------------------
768 *\fn csr_roam_set_key_mgmt_offload
769 *\brief sets nRoamKeyMgmtOffloadEnabled
770 *\param pMac - pointer to global structure for MAC
771 *\param sessionId - Sme session id
772 *\param nRoamKeyMgmtOffloadEnabled - value of key mgmt offload enable
773 *\return CDF_STATUS - usually it succeed unless sessionId is not found
774 *\Note:
775 *-------------------------------------------------------------------------------*/
776CDF_STATUS csr_roam_set_key_mgmt_offload(tpAniSirGlobal pMac,
777 uint32_t sessionId,
778 bool nRoamKeyMgmtOffloadEnabled);
779#endif
780/* ---------------------------------------------------------------------------
781 \fn csr_roam_get_wpa_rsn_req_ie
782 \brief return the WPA or RSN IE CSR passes to PE to JOIN request or START_BSS request
783 \param pLen - caller allocated memory that has the length of pBuf as input. Upon returned, *pLen has the
784 needed or IE length in pBuf.
785 \param pBuf - Caller allocated memory that contain the IE field, if any, upon return
786 \return CDF_STATUS - when fail, it usually means the buffer allocated is not big enough
787 -------------------------------------------------------------------------------*/
788CDF_STATUS csr_roam_get_wpa_rsn_req_ie(tpAniSirGlobal pMac, uint32_t sessionId,
789 uint32_t *pLen, uint8_t *pBuf);
790
791/* ---------------------------------------------------------------------------
792 \fn csr_roam_get_wpa_rsn_rsp_ie
793 \brief return the WPA or RSN IE from the beacon or probe rsp if connected
794 \param pLen - caller allocated memory that has the length of pBuf as input. Upon returned, *pLen has the
795 needed or IE length in pBuf.
796 \param pBuf - Caller allocated memory that contain the IE field, if any, upon return
797 \return CDF_STATUS - when fail, it usually means the buffer allocated is not big enough
798 -------------------------------------------------------------------------------*/
799CDF_STATUS csr_roam_get_wpa_rsn_rsp_ie(tpAniSirGlobal pMac, uint32_t sessionId,
800 uint32_t *pLen, uint8_t *pBuf);
801
802/* ---------------------------------------------------------------------------
803 \fn csr_roam_get_num_pmkid_cache
804 \brief return number of PMKID cache entries
805 \return uint32_t - the number of PMKID cache entries
806 -------------------------------------------------------------------------------*/
807uint32_t csr_roam_get_num_pmkid_cache(tpAniSirGlobal pMac, uint32_t sessionId);
808
809/* ---------------------------------------------------------------------------
810 \fn csr_roam_get_pmkid_cache
811 \brief return PMKID cache from CSR
812 \param pNum - caller allocated memory that has the space of the number of pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
813 needed or actually number in tPmkidCacheInfo.
814 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if any, upon return
815 \return CDF_STATUS - when fail, it usually means the buffer allocated is not big enough
816 -------------------------------------------------------------------------------*/
817CDF_STATUS csr_roam_get_pmkid_cache(tpAniSirGlobal pMac, uint32_t sessionId,
818 uint32_t *pNum, tPmkidCacheInfo *pPmkidCache);
819
820/**
821 * csr_roam_get_connect_profile() - To return the current connect profile,
822 * caller must call csr_roam_free_connect_profile after it is done and before
823 * reuse for another csr_roam_get_connect_profile call.
824 *
825 * @pMac: pointer to global adapter context
826 * @sessionId: session ID
827 * @pProfile: pointer to a caller allocated structure
828 * tCsrRoamConnectedProfile
829 *
830 * Return: CDF_STATUS. Failure if not connected, success otherwise
831 */
832CDF_STATUS csr_roam_get_connect_profile(tpAniSirGlobal pMac, uint32_t sessionId,
833 tCsrRoamConnectedProfile *pProfile);
834
835/* ---------------------------------------------------------------------------
836 \fn csr_roam_get_connect_state
837 \brief To return the current connect state of Roaming
838 \return CDF_STATUS
839 -------------------------------------------------------------------------------*/
840CDF_STATUS csr_roam_get_connect_state(tpAniSirGlobal pMac, uint32_t sessionId,
841 eCsrConnectState *pState);
842
843/* ---------------------------------------------------------------------------
844 \fn csr_roam_free_connect_profile
845 \brief To free and reinitialize the profile return previous by csr_roam_get_connect_profile.
846 \param pProfile - pointer to a caller allocated structure tCsrRoamConnectedProfile
847 \return CDF_STATUS.
848 -------------------------------------------------------------------------------*/
849CDF_STATUS csr_roam_free_connect_profile(tpAniSirGlobal pMac,
850 tCsrRoamConnectedProfile *pProfile);
851
852/* ---------------------------------------------------------------------------
853 \fn csr_apply_channel_and_power_list
854 \brief HDD calls this function to set the WNI_CFG_VALID_CHANNEL_LIST base on the band/mode settings.
855 This function must be called after CFG is downloaded and all the band/mode setting already passed into
856 CSR.
857 \return CDF_STATUS
858 -------------------------------------------------------------------------------*/
859CDF_STATUS csr_apply_channel_and_power_list(tpAniSirGlobal pMac);
860
861/**
862 * csr_change_config_params() - The CSR API exposed for HDD to provide config
863 * params to CSR during SMEs stop -> start sequence.
864 *
865 * @pMac: pointer to global adapter context
866 * @pUpdateConfigParam: a pointer to a structure (tCsrUpdateConfigParam) that
867 * currently provides 11d related information like country code, Regulatory
868 * domain, valid channel list, Tx power per channel, a list with active/passive
869 * scan allowed per valid channel.
870 *
871 * If HDD changed the domain that will cause a reset. This function will
872 * provide the new set of 11d information for the new domain. Currrently this
873 * API provides info regarding 11d only at reset but we can extend this for
874 * other params (PMC, QoS) which needs to be initialized again at reset.
875 *
876 * Return: CDF_STATUS. status of operation
877 */
878CDF_STATUS csr_change_config_params(tpAniSirGlobal pMac,
879 tCsrUpdateConfigParam *pUpdateConfigParam);
880
881/* ---------------------------------------------------------------------------
882 \fn csr_roam_connect_to_last_profile
883 \brief To disconnect and reconnect with the same profile
884 \return CDF_STATUS. It returns fail if currently connected
885 -------------------------------------------------------------------------------*/
886CDF_STATUS csr_roam_connect_to_last_profile(tpAniSirGlobal pMac, uint32_t sessionId);
887
888/* ---------------------------------------------------------------------------
889 \fn csr_roam_disconnect
890 \brief To disconnect from a network
891 \param reason -- To indicate the reason for disconnecting. Currently, only eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
892 \return CDF_STATUS
893 -------------------------------------------------------------------------------*/
894CDF_STATUS csr_roam_disconnect(tpAniSirGlobal pMac, uint32_t sessionId,
895 eCsrRoamDisconnectReason reason);
896
897/* ---------------------------------------------------------------------------
898 \fn csr_scan_get_pmkid_candidate_list
899 \brief return the PMKID candidate list
900 \param pPmkidList - caller allocated buffer point to an array of tPmkidCandidateInfo
901 \param pNumItems - pointer to a variable that has the number of tPmkidCandidateInfo allocated
902 when retruning, this is either the number needed or number of items put into pPmkidList
903 \return CDF_STATUS - when fail, it usually means the buffer allocated is not big enough and pNumItems
904 has the number of tPmkidCandidateInfo.
905 \Note: pNumItems is a number of tPmkidCandidateInfo, not sizeof(tPmkidCandidateInfo) * something
906 -------------------------------------------------------------------------------*/
907CDF_STATUS csr_scan_get_pmkid_candidate_list(tpAniSirGlobal pMac, uint32_t sessionId,
908 tPmkidCandidateInfo *pPmkidList,
909 uint32_t *pNumItems);
910
911/* This function is used to stop a BSS. It is similar of csr_roamIssueDisconnect but this function */
912/* doesn't have any logic other than blindly trying to stop BSS */
913CDF_STATUS csr_roam_issue_stop_bss_cmd(tpAniSirGlobal pMac, uint32_t sessionId,
914 bool fHighPriority);
915
916void csr_call_roaming_completion_callback(tpAniSirGlobal pMac,
917 tCsrRoamSession *pSession,
918 tCsrRoamInfo *pRoamInfo, uint32_t roamId,
919 eCsrRoamResult roamResult);
920
921/* ---------------------------------------------------------------------------
922 \fn csr_roam_issue_disassociate_sta_cmd
923 \brief csr function that HDD calls to disassociate a associated station
924 \param sessionId - session Id for Soft AP
925 \param pPeerMacAddr - MAC of associated station to delete
926 \param reason - reason code, be one of the tSirMacReasonCodes
927 \return CDF_STATUS
928 ---------------------------------------------------------------------------*/
929CDF_STATUS csr_roam_issue_disassociate_sta_cmd(tpAniSirGlobal pMac,
930 uint32_t sessionId,
931 const uint8_t *pPeerMacAddr,
932 uint32_t reason);
933
934/**
935 * csr_roam_issue_deauth_sta_cmd() - issue deauthenticate station command
936 * @pMac: Pointer to global structure for MAC
937 * @sessionId: Session Id for Soft AP
938 * @pDelStaParams: Pointer to parameters of the station to deauthenticate
939 *
940 * CSR function that HDD calls to issue a deauthenticate station command
941 *
942 * Return: CDF_STATUS_SUCCESS on success or another CDF_STATUS_* on error
943 */
944CDF_STATUS csr_roam_issue_deauth_sta_cmd(tpAniSirGlobal pMac,
945 uint32_t sessionId,
946 struct tagCsrDelStaParams *pDelStaParams);
947
948/* ---------------------------------------------------------------------------
949 \fn csr_roam_issue_tkip_counter_measures
950 \brief csr function that HDD calls to start and stop tkip countermeasures
951 \param sessionId - session Id for Soft AP
952 \param bEnable - Flag to start/stop countermeasures
953 \return CDF_STATUS
954 ---------------------------------------------------------------------------*/
955CDF_STATUS csr_roam_issue_tkip_counter_measures(tpAniSirGlobal pMac,
956 uint32_t sessionId, bool bEnable);
957
958CDF_STATUS csr_send_mb_tkip_counter_measures_req_msg(tpAniSirGlobal pMac,
959 uint32_t sessinId, bool bEnable,
960 tSirMacAddr bssId);
961
962/* ---------------------------------------------------------------------------
963 \fn csr_roam_get_associated_stas
964 \brief csr function that HDD calls to get list of associated stations based on module ID
965 \param sessionId - session Id for Soft AP
966 \param modId - module ID - PE/HAL/TL
967 \param pUsrContext - Opaque HDD context
968 \param pfnSapEventCallback - Sap event callback in HDD
969 \param pAssocStasBuf - Caller allocated memory to be filled with associatd stations info
970 \return CDF_STATUS
971 ---------------------------------------------------------------------------*/
972CDF_STATUS csr_roam_get_associated_stas(tpAniSirGlobal pMac, uint32_t sessionId,
973 CDF_MODULE_ID modId, void *pUsrContext,
974 void *pfnSapEventCallback,
975 uint8_t *pAssocStasBuf);
976
977CDF_STATUS csr_send_mb_get_associated_stas_req_msg(tpAniSirGlobal pMac,
978 uint32_t sessionId,
979 CDF_MODULE_ID modId,
980 tSirMacAddr bssId,
981 void *pUsrContext,
982 void *pfnSapEventCallback,
983 uint8_t *pAssocStasBuf);
984
985/* ---------------------------------------------------------------------------
986 \fn csr_roam_get_wps_session_overlap
987 \brief csr function that HDD calls to get WPS PBC session overlap information
988 \param sessionId - session Id for Soft AP
989 \param pUsrContext - Opaque HDD context
990 \param pfnSapEventCallback - Sap event callback in HDD
991 \param pRemoveMac - pointer to MAC address of session to be removed
992 \return CDF_STATUS
993 ---------------------------------------------------------------------------*/
994CDF_STATUS csr_roam_get_wps_session_overlap(tpAniSirGlobal pMac, uint32_t sessionId,
995 void *pUsrContext,
996 void *pfnSapEventCallback,
997 struct cdf_mac_addr pRemoveMac);
998
999CDF_STATUS csr_send_mb_get_wpspbc_sessions(tpAniSirGlobal pMac, uint32_t sessionId,
1000 tSirMacAddr bssId, void *pUsrContext,
1001 void *pfnSapEventCallback,
1002 struct cdf_mac_addr pRemoveMac);
1003
1004/* ---------------------------------------------------------------------------
1005 \fn csr_send_chng_mcc_beacon_interval
1006 \brief csr function that HDD calls to send Update beacon interval
1007 \param sessionId - session Id for Soft AP
1008 \return CDF_STATUS
1009 ---------------------------------------------------------------------------*/
1010CDF_STATUS
1011csr_send_chng_mcc_beacon_interval(tpAniSirGlobal pMac, uint32_t sessionId);
1012
1013#ifdef WLAN_FEATURE_VOWIFI_11R
1014/* ---------------------------------------------------------------------------
1015 \fn csr_roam_ft_pre_auth_rsp_processor
1016 \brief csr function that handles pre auth response from LIM
1017 ---------------------------------------------------------------------------*/
1018void csr_roam_ft_pre_auth_rsp_processor(tHalHandle hHal,
1019 tpSirFTPreAuthRsp pFTPreAuthRsp);
1020#endif
1021
1022
1023#if defined(FEATURE_WLAN_ESE)
1024void update_cckmtsf(uint32_t *timeStamp0, uint32_t *timeStamp1,
1025 uint32_t *incr);
1026#endif
1027
1028CDF_STATUS csr_roam_enqueue_preauth(tpAniSirGlobal pMac, uint32_t sessionId,
1029 tpSirBssDescription pBssDescription,
1030 eCsrRoamReason reason, bool fImmediate);
1031CDF_STATUS csr_dequeue_roam_command(tpAniSirGlobal pMac, eCsrRoamReason reason);
1032#ifdef FEATURE_WLAN_LFR
1033void csr_init_occupied_channels_list(tpAniSirGlobal pMac, uint8_t sessionId);
1034bool csr_neighbor_roam_is_new_connected_profile(tpAniSirGlobal pMac,
1035 uint8_t sessionId);
1036bool csr_neighbor_roam_connected_profile_match(tpAniSirGlobal pMac,
1037 uint8_t sessionId,
1038 tCsrScanResult *pResult,
1039 tDot11fBeaconIEs *pIes);
1040#endif
1041
1042CDF_STATUS csr_scan_create_entry_in_scan_cache(tpAniSirGlobal pMac,
1043 uint32_t sessionId,
1044 struct cdf_mac_addr bssid,
1045 uint8_t channel);
1046
1047CDF_STATUS csr_update_channel_list(tpAniSirGlobal pMac);
1048CDF_STATUS csr_roam_del_pmkid_from_cache(tpAniSirGlobal pMac,
1049 uint32_t sessionId,
1050 const uint8_t *pBSSId,
1051 bool flush_cache);
1052
1053bool csr_elected_country_info(tpAniSirGlobal pMac);
1054void csr_add_vote_for_country_info(tpAniSirGlobal pMac, uint8_t *pCountryCode);
1055void csr_clear_votes_for_country_info(tpAniSirGlobal pMac);
1056
1057#endif
1058
1059#ifdef QCA_HT_2040_COEX
1060CDF_STATUS csr_set_ht2040_mode(tpAniSirGlobal pMac, uint32_t sessionId,
1061 ePhyChanBondState cbMode, bool obssEnabled);
1062#endif
1063tSirBssDescription*
1064csr_get_bssdescr_from_scan_handle(tScanResultHandle result_handle,
1065 tSirBssDescription *bss_descr);
1066void csr_release_scan_command(tpAniSirGlobal pMac, tSmeCmd *pCommand,
1067 eCsrScanStatus scanStatus);
1068void csr_scan_active_list_timeout_handle(void *userData);
1069CDF_STATUS csr_prepare_disconnect_command(tpAniSirGlobal mac,
1070 uint32_t session_id, tSmeCmd **sme_cmd);