blob: 57317b3a4e58b1badbad73470050b518ec0afa80 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam0fb93dd2014-02-19 00:32:59 -08002 * Copyright (c) 2012-2013 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.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam0fb93dd2014-02-19 00:32:59 -080021
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
Jeff Johnson295189b2012-06-20 16:38:30 -070028/*===========================================================================
29
30 s a p F s m . C
31
32 OVERVIEW:
33
34 This software unit holds the implementation of the WLAN SAP Finite
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -070035 State Machine modules
Jeff Johnson295189b2012-06-20 16:38:30 -070036
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -070037 DEPENDENCIES:
Jeff Johnson295189b2012-06-20 16:38:30 -070038
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -070039 Are listed for each API below.
Jeff Johnson295189b2012-06-20 16:38:30 -070040
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -070041
Jeff Johnson295189b2012-06-20 16:38:30 -070042 Copyright (c) 2010 QUALCOMM Incorporated.
43 All Rights Reserved.
44 Qualcomm Confidential and Proprietary
45===========================================================================*/
46
47/*===========================================================================
48
49 EDIT HISTORY FOR FILE
50
51
52 This section contains comments describing changes made to the module.
53 Notice that changes are listed in reverse chronological order.
54
55
56
57 when who what, where, why
58---------- --- --------------------------------------------------------
592010-03-15 Created module
60
61===========================================================================*/
62
63
64/*----------------------------------------------------------------------------
65 * Include Files
66 * -------------------------------------------------------------------------*/
67#include "sapInternal.h"
68// Pick up the SME API definitions
69#include "sme_Api.h"
70// Pick up the PMC API definitions
71#include "pmcApi.h"
72#include "wlan_nv.h"
73
74/*----------------------------------------------------------------------------
75 * Preprocessor Definitions and Constants
76 * -------------------------------------------------------------------------*/
77
78/*----------------------------------------------------------------------------
79 * Type Declarations
80 * -------------------------------------------------------------------------*/
81
82/*----------------------------------------------------------------------------
83 * Global Data Definitions
84 * -------------------------------------------------------------------------*/
85
86/*----------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -070087 * External declarations for global context
Jeff Johnson295189b2012-06-20 16:38:30 -070088 * -------------------------------------------------------------------------*/
Abhishek Singhb51853c2014-03-13 18:26:41 +053089#ifdef FEATURE_WLAN_CH_AVOID
90extern safeChannelType safeChannels[];
91#endif /* FEATURE_WLAN_CH_AVOID */
Jeff Johnson295189b2012-06-20 16:38:30 -070092/*----------------------------------------------------------------------------
93 * Static Variable Definitions
94 * -------------------------------------------------------------------------*/
95
96/*----------------------------------------------------------------------------
97 * Static Function Declarations and Definitions
98 * -------------------------------------------------------------------------*/
99#ifdef SOFTAP_CHANNEL_RANGE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700100static VOS_STATUS sapGetChannelList(ptSapContext sapContext, v_U8_t **channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700101 v_U8_t *numberOfChannels);
102#endif
103/*----------------------------------------------------------------------------
104 * Externalized Function Definitions
105* -------------------------------------------------------------------------*/
106
107/*----------------------------------------------------------------------------
108 * Function Declarations and Documentation
109 * -------------------------------------------------------------------------*/
110
111/*==========================================================================
112 FUNCTION sapEventInit
113
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700114 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700115 Function for initializing sWLAN_SAPEvent structure
116
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700117 DEPENDENCIES
118 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -0700119
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700120 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700121
122 IN
123 sapEvent : State machine event
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700124
Jeff Johnson295189b2012-06-20 16:38:30 -0700125 RETURN VALUE
126
127 None
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700128
129 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -0700130============================================================================*/
131static inline void sapEventInit(ptWLAN_SAPEvent sapEvent)
132{
133 sapEvent->event = eSAP_MAC_SCAN_COMPLETE;
134 sapEvent->params = 0;
135 sapEvent->u1 = 0;
136 sapEvent->u2 = 0;
137}
138
139/*==========================================================================
140 FUNCTION sapGotoChannelSel
141
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700142 DESCRIPTION
143 Function for initiating scan request for SME
Jeff Johnson295189b2012-06-20 16:38:30 -0700144
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700145 DEPENDENCIES
146 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -0700147
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700148 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700149
150 IN
151 sapContext : Sap Context value
152 sapEvent : State machine event
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700153
Jeff Johnson295189b2012-06-20 16:38:30 -0700154 RETURN VALUE
155 The VOS_STATUS code associated with performing the operation
156
157 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700158
159 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -0700160============================================================================*/
161VOS_STATUS
162sapGotoChannelSel
163(
164 ptSapContext sapContext,
165 ptWLAN_SAPEvent sapEvent
166)
167{
168 /* Initiate a SCAN request */
Jeff Johnson43971f52012-07-17 12:26:56 -0700169 eHalStatus halStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -0700170 tCsrScanRequest scanRequest;/* To be initialised if scan is required */
171 v_U32_t scanRequestID = 0;
172 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
173
174#ifdef SOFTAP_CHANNEL_RANGE
175 v_U8_t *channelList = NULL;
176 v_U8_t numOfChannels = 0 ;
177#endif
178 tHalHandle hHal;
179 tANI_U8 channel;
180
181 hHal = (tHalHandle)vos_get_context( VOS_MODULE_ID_SME, sapContext->pvosGCtx);
182 if (NULL == hHal)
183 {
184 /* we have a serious problem */
185 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_FATAL,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700186 "In %s, invalid hHal", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700187 return VOS_STATUS_E_FAULT;
188 }
189
190 /*If STA-AP concurrency is enabled take the concurrent connected channel first. In other cases wpa_supplicant should take care */
191 if (vos_get_concurrency_mode() == VOS_STA_SAP)
192 {
193 channel = sme_GetConcurrentOperationChannel(hHal);
194
195 if (channel)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700196 { /*if a valid channel is returned then use concurrent channel.
Jeff Johnson295189b2012-06-20 16:38:30 -0700197 Else take whatever comes from configuartion*/
198 sapContext->channel = channel;
Kiet Lamef0b0352013-11-12 11:01:08 +0530199 sme_SelectCBMode(hHal,
200 sapConvertSapPhyModeToCsrPhyMode(sapContext->csrRoamProfile.phyMode),
201 channel);
Jeff Johnson295189b2012-06-20 16:38:30 -0700202 }
203 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700204
205 if (sapContext->channel == AUTO_CHANNEL_SELECT)
Jeff Johnson295189b2012-06-20 16:38:30 -0700206 {
207 vos_mem_zero(&scanRequest, sizeof(scanRequest));
208
209 /* Set scanType to Passive scan */
210 scanRequest.scanType = eSIR_PASSIVE_SCAN;
211
212 /* Set min and max channel time to zero */
213 scanRequest.minChnTime = 0;
214 scanRequest.maxChnTime = 0;
215
216 /* Set BSSType to default type */
217 scanRequest.BSSType = eCSR_BSS_TYPE_ANY;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700218
219#ifndef SOFTAP_CHANNEL_RANGE
Jeff Johnson295189b2012-06-20 16:38:30 -0700220 /*Scan all the channels */
221 scanRequest.ChannelInfo.numOfChannels = 0;
222
223 scanRequest.ChannelInfo.ChannelList = NULL;
224
225 scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN;//eCSR_SCAN_REQUEST_11D_SCAN;
226
227#else
228
229 sapGetChannelList(sapContext, &channelList, &numOfChannels);
230
231 /*Scan the channels in the list*/
232 scanRequest.ChannelInfo.numOfChannels = numOfChannels;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700233
Jeff Johnson295189b2012-06-20 16:38:30 -0700234 scanRequest.ChannelInfo.ChannelList = channelList;
235
236 scanRequest.requestType = eCSR_SCAN_SOFTAP_CHANNEL_RANGE;
237
238 sapContext->channelList = channelList;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700239
Jeff Johnson295189b2012-06-20 16:38:30 -0700240#endif
241 /* Set requestType to Full scan */
242
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700243 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, calling sme_ScanRequest", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700244
Jeff Johnson43971f52012-07-17 12:26:56 -0700245 halStatus = sme_ScanRequest(hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -0700246 0,//Not used in csrScanRequest
247 &scanRequest,
248 &scanRequestID,//, when ID == 0 11D scan/active scan with callback, min-maxChntime set in csrScanRequest()?
249 &WLANSAP_ScanCallback,//csrScanCompleteCallback callback,
250 sapContext);//void * pContext scanRequestID filled up
Jeff Johnson43971f52012-07-17 12:26:56 -0700251 if (eHAL_STATUS_SUCCESS != halStatus)
Jeff Johnson295189b2012-06-20 16:38:30 -0700252 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700253 VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "%s:sme_ScanRequest fail %d!!!", __func__, halStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700254 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "SoftAP Configuring for default channel, Ch= %d", sapContext->channel);
255 /* In case of error, switch to default channel */
256 sapContext->channel = SAP_DEFAULT_CHANNEL;
257
258#ifdef SOFTAP_CHANNEL_RANGE
259 if(sapContext->channelList != NULL)
260 {
261 sapContext->channel = sapContext->channelList[0];
262 vos_mem_free(sapContext->channelList);
263 sapContext->channelList = NULL;
264 }
265#endif
266 /* Fill in the event structure */
267 sapEventInit(sapEvent);
268 /* Handle event */
269 vosStatus = sapFsm(sapContext, sapEvent);
270 }
271 else
272 {
273 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, return from sme_ScanRequest, scanRequestID=%d, Ch= %d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700274 __func__, scanRequestID, sapContext->channel);
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 }
276
277 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700278 else
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700280 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, for configured channel, Ch= %d", __func__, sapContext->channel);
Jeff Johnson295189b2012-06-20 16:38:30 -0700281 /* Fill in the event structure */
282 // Eventhough scan was not done, means a user set channel was chosen
283 sapEventInit(sapEvent);
284 /* Handle event */
285 vosStatus = sapFsm(sapContext, sapEvent);
286 }
287
288 /* If scan failed, get default channel and advance state machine as success with default channel */
289 /* Have to wait for the call back to be called to get the channel cannot advance state machine here as said above */
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700290 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, before exiting sapGotoChannelSel channel=%d", __func__, sapContext->channel);
Jeff Johnson295189b2012-06-20 16:38:30 -0700291
292 return VOS_STATUS_SUCCESS;
293}// sapGotoChannelSel
294
295/*==========================================================================
296 FUNCTION sapGotoStarting
297
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700298 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 Function for initiating start bss request for SME
300
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700301 DEPENDENCIES
302 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -0700303
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700304 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700305
306 IN
307 sapContext : Sap Context value
308 sapEvent : State machine event
309 bssType : Type of bss to start, INRA AP
310 status : Return the SAP status here
311
312 RETURN VALUE
313 The VOS_STATUS code associated with performing the operation
314
315 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700316
317 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -0700318============================================================================*/
319VOS_STATUS
320sapGotoStarting
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700321(
Jeff Johnson295189b2012-06-20 16:38:30 -0700322 ptSapContext sapContext,
323 ptWLAN_SAPEvent sapEvent,
324 eCsrRoamBssType bssType
325)
326{
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700327 /* tHalHandle */
Jeff Johnson295189b2012-06-20 16:38:30 -0700328 tHalHandle hHal = VOS_GET_HAL_CB(sapContext->pvosGCtx);
329 eHalStatus halStatus;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700330
Jeff Johnson295189b2012-06-20 16:38:30 -0700331 /*- - - - - - - - TODO:once configs from hdd available - - - - - - - - -*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700332 char key_material[32]={ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,};
Jeff Johnson295189b2012-06-20 16:38:30 -0700333 sapContext->key_type = 0x05;
334 sapContext->key_length = 32;
335 vos_mem_copy(sapContext->key_material, key_material, sizeof(key_material)); /* Need a key size define */
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700336
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700337 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700338 if (NULL == hHal)
339 {
340 /* we have a serious problem */
341 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_FATAL,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700342 "In %s, invalid hHal", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700343 return VOS_STATUS_E_FAULT;
344 }
345
346 //TODO: What shall we do if failure????
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700347 halStatus = pmcRequestFullPower( hHal,
348 WLANSAP_pmcFullPwrReqCB,
Jeff Johnson295189b2012-06-20 16:38:30 -0700349 sapContext,
350 eSME_REASON_OTHER);
351
352 /* Open SME Session for Softap */
353 halStatus = sme_OpenSession(hHal,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700354 &WLANSAP_RoamCallback,
Jeff Johnson295189b2012-06-20 16:38:30 -0700355 sapContext,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700356 sapContext->self_mac_addr,
Jeff Johnson295189b2012-06-20 16:38:30 -0700357 &sapContext->sessionId);
358
359 if(eHAL_STATUS_SUCCESS != halStatus )
360 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700361 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "Error: In %s calling sme_RoamConnect status = %d", __func__, halStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700362 return VOS_STATUS_E_FAILURE;
363 }
364
365 return VOS_STATUS_SUCCESS;
366}// sapGotoStarting
367
368/*==========================================================================
369 FUNCTION sapGotoDisconnecting
370
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700371 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700372 Processing of SAP FSM Disconnecting state
373
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700374 DEPENDENCIES
375 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -0700376
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700377 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700378
379 IN
380 sapContext : Sap Context value
381 status : Return the SAP status here
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700382
Jeff Johnson295189b2012-06-20 16:38:30 -0700383 RETURN VALUE
384 The VOS_STATUS code associated with performing the operation
385
386 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700387
388 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -0700389============================================================================*/
390VOS_STATUS
391sapGotoDisconnecting
392(
393 ptSapContext sapContext
394)
395{
396 eHalStatus halStatus;
397 tHalHandle hHal;
398
399 hHal = VOS_GET_HAL_CB(sapContext->pvosGCtx);
400 if (NULL == hHal)
401 {
402 /* we have a serious problem */
403 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700404 "In %s, invalid hHal", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700405 return VOS_STATUS_E_FAULT;
406 }
407
408 sapFreeRoamProfile(&sapContext->csrRoamProfile);
409 halStatus = sme_RoamStopBss(hHal, sapContext->sessionId);
410 if(eHAL_STATUS_SUCCESS != halStatus )
411 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700412 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "Error: In %s calling sme_RoamStopBss status = %d", __func__, halStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700413 return VOS_STATUS_E_FAILURE;
414 }
415
416 return VOS_STATUS_SUCCESS;
417}
418
419static eHalStatus sapRoamSessionCloseCallback(void *pContext)
420{
421 ptSapContext sapContext = (ptSapContext)pContext;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700422 return sapSignalHDDevent(sapContext, NULL,
Jeff Johnson295189b2012-06-20 16:38:30 -0700423 eSAP_STOP_BSS_EVENT, (v_PVOID_t) eSAP_STATUS_SUCCESS);
424}
425
426/*==========================================================================
427 FUNCTION sapGotoDisconnected
428
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700429 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700430 Function for setting the SAP FSM to Disconnection state
431
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700432 DEPENDENCIES
433 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -0700434
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700435 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700436
437 IN
438 sapContext : Sap Context value
439 sapEvent : State machine event
440 status : Return the SAP status here
441
442 RETURN VALUE
443 The VOS_STATUS code associated with performing the operation
444
445 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700446
447 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -0700448============================================================================*/
449VOS_STATUS
450sapGotoDisconnected
451(
452 ptSapContext sapContext
453)
454{
455 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
456 tWLAN_SAPEvent sapEvent;
457 // Processing has to be coded
458 // Clean up stations from TL etc as AP BSS is shut down then set event
459 sapEvent.event = eSAP_MAC_READY_FOR_CONNECTIONS;// hardcoded
460 sapEvent.params = 0;
461 sapEvent.u1 = 0;
462 sapEvent.u2 = 0;
463 /* Handle event */
464 vosStatus = sapFsm(sapContext, &sapEvent);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700465
Jeff Johnson295189b2012-06-20 16:38:30 -0700466 return vosStatus;
467}
468
469/*==========================================================================
470 FUNCTION sapSignalHDDevent
471
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700472 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 Function for HDD to send the event notification using callback
474
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700475 DEPENDENCIES
476 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -0700477
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700478 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700479
480 IN
481 sapContext : Sap Context value
482 pCsrRoamInfo : Pointer to CSR roam information
483 sapHddevent : SAP HDD event
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700484 context : to pass the element for future support
485
Jeff Johnson295189b2012-06-20 16:38:30 -0700486 RETURN VALUE
487 The VOS_STATUS code associated with performing the operation
488
489 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700490
491 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -0700492============================================================================*/
493VOS_STATUS
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700494sapSignalHDDevent
495(
Jeff Johnson295189b2012-06-20 16:38:30 -0700496 ptSapContext sapContext, /* sapContext value */
497 tCsrRoamInfo *pCsrRoamInfo,
498 eSapHddEvent sapHddevent,
499 void *context
500)
501{
502 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
503 tSap_Event sapApAppEvent; /* This now encodes ALL event types */
504 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
505
506 /* Format the Start BSS Complete event to return... */
Siddharth Bhal8d921e72014-05-03 12:52:43 +0530507 if (NULL == sapContext->pfnSapEventCallback)
508 {
509 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "%s: HDD Event"
510 " callaback invalid", __func__);
511 return VOS_STATUS_E_INVAL;
512 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700513
514 switch (sapHddevent)
515 {
516 case eSAP_STA_ASSOC_IND:
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700517 // TODO - Indicate the assoc request indication to OS
Jeff Johnson295189b2012-06-20 16:38:30 -0700518 sapApAppEvent.sapHddEventCode = eSAP_STA_ASSOC_IND;
519
520 vos_mem_copy( &sapApAppEvent.sapevt.sapAssocIndication.staMac, pCsrRoamInfo->peerMac,sizeof(tSirMacAddr));
521 sapApAppEvent.sapevt.sapAssocIndication.staId = pCsrRoamInfo->staId;
522 sapApAppEvent.sapevt.sapAssocIndication.status = 0;
523 // Required for indicating the frames to upper layer
524 sapApAppEvent.sapevt.sapAssocIndication.beaconLength = pCsrRoamInfo->beaconLength;
525 sapApAppEvent.sapevt.sapAssocIndication.beaconPtr = pCsrRoamInfo->beaconPtr;
526 sapApAppEvent.sapevt.sapAssocIndication.assocReqLength = pCsrRoamInfo->assocReqLength;
527 sapApAppEvent.sapevt.sapAssocIndication.assocReqPtr = pCsrRoamInfo->assocReqPtr;
528 sapApAppEvent.sapevt.sapAssocIndication.fWmmEnabled = pCsrRoamInfo->wmmEnabledSta;
529 if ( pCsrRoamInfo->u.pConnectedProfile != NULL )
530 {
531 sapApAppEvent.sapevt.sapAssocIndication.negotiatedAuthType = pCsrRoamInfo->u.pConnectedProfile->AuthType;
532 sapApAppEvent.sapevt.sapAssocIndication.negotiatedUCEncryptionType = pCsrRoamInfo->u.pConnectedProfile->EncryptionType;
533 sapApAppEvent.sapevt.sapAssocIndication.negotiatedMCEncryptionType = pCsrRoamInfo->u.pConnectedProfile->mcEncryptionType;
534 sapApAppEvent.sapevt.sapAssocIndication.fAuthRequired = pCsrRoamInfo->fAuthRequired;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700535 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700536 break;
537 case eSAP_START_BSS_EVENT:
538 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700539 __func__, "eSAP_START_BSS_EVENT");
Jeff Johnson295189b2012-06-20 16:38:30 -0700540 sapApAppEvent.sapHddEventCode = eSAP_START_BSS_EVENT;
541 sapApAppEvent.sapevt.sapStartBssCompleteEvent.status = (eSapStatus )context;
542 if(pCsrRoamInfo != NULL ){
543 sapApAppEvent.sapevt.sapStartBssCompleteEvent.staId = pCsrRoamInfo->staId;
544 }
545 else
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700546 sapApAppEvent.sapevt.sapStartBssCompleteEvent.staId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 sapApAppEvent.sapevt.sapStartBssCompleteEvent.operatingChannel = (v_U8_t)sapContext->channel;
548 break;
549
550 case eSAP_STOP_BSS_EVENT:
551 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700552 __func__, "eSAP_STOP_BSS_EVENT");
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 sapApAppEvent.sapHddEventCode = eSAP_STOP_BSS_EVENT;
554 sapApAppEvent.sapevt.sapStopBssCompleteEvent.status = (eSapStatus )context;
555 break;
556
557 case eSAP_STA_ASSOC_EVENT:
558 {
559 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700560 __func__, "eSAP_STA_ASSOC_EVENT");
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 if (pCsrRoamInfo->fReassocReq)
562 sapApAppEvent.sapHddEventCode = eSAP_STA_REASSOC_EVENT;
563 else
564 sapApAppEvent.sapHddEventCode = eSAP_STA_ASSOC_EVENT;
565
566 //TODO: Need to fill the SET KEY information and pass to HDD
567 vos_mem_copy( &sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.staMac,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700568 pCsrRoamInfo->peerMac,sizeof(tSirMacAddr));
569 sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.staId = pCsrRoamInfo->staId ;
Jeff Johnson295189b2012-06-20 16:38:30 -0700570 sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.statusCode = pCsrRoamInfo->statusCode;
571 sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.iesLen = pCsrRoamInfo->rsnIELen;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700572 vos_mem_copy(sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.ies, pCsrRoamInfo->prsnIE,
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 pCsrRoamInfo->rsnIELen);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700574
575 if(pCsrRoamInfo->addIELen)
Jeff Johnson295189b2012-06-20 16:38:30 -0700576 {
577 v_U8_t len = sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.iesLen;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700578 sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.iesLen
Jeff Johnson295189b2012-06-20 16:38:30 -0700579 += pCsrRoamInfo->addIELen;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700580 vos_mem_copy(&sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.ies[len], pCsrRoamInfo->paddIE,
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 pCsrRoamInfo->addIELen);
582 }
583
584 sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.wmmEnabled = pCsrRoamInfo->wmmEnabledSta;
585 sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.status = (eSapStatus )context;
586 //TODO: Need to fill sapAuthType
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700587 //sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.SapAuthType = pCsrRoamInfo->pProfile->negotiatedAuthType;
Jeff Johnson295189b2012-06-20 16:38:30 -0700588 break;
589 }
590
591 case eSAP_STA_DISASSOC_EVENT:
592 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700593 __func__, "eSAP_STA_DISASSOC_EVENT");
Jeff Johnson295189b2012-06-20 16:38:30 -0700594 sapApAppEvent.sapHddEventCode = eSAP_STA_DISASSOC_EVENT;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700595
Jeff Johnson295189b2012-06-20 16:38:30 -0700596 vos_mem_copy( &sapApAppEvent.sapevt.sapStationDisassocCompleteEvent.staMac,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700597 pCsrRoamInfo->peerMac, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700598 sapApAppEvent.sapevt.sapStationDisassocCompleteEvent.staId = pCsrRoamInfo->staId;
599 if (pCsrRoamInfo->reasonCode == eCSR_ROAM_RESULT_FORCED)
600 sapApAppEvent.sapevt.sapStationDisassocCompleteEvent.reason = eSAP_USR_INITATED_DISASSOC;
601 else
602 sapApAppEvent.sapevt.sapStationDisassocCompleteEvent.reason = eSAP_MAC_INITATED_DISASSOC;
603
604 sapApAppEvent.sapevt.sapStationDisassocCompleteEvent.statusCode = pCsrRoamInfo->statusCode;
605 sapApAppEvent.sapevt.sapStationDisassocCompleteEvent.status = (eSapStatus )context;
606 break;
607
608 case eSAP_STA_SET_KEY_EVENT:
609 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700610 __func__, "eSAP_STA_SET_KEY_EVENT");
Jeff Johnson295189b2012-06-20 16:38:30 -0700611 sapApAppEvent.sapHddEventCode = eSAP_STA_SET_KEY_EVENT;
612 sapApAppEvent.sapevt.sapStationSetKeyCompleteEvent.status = (eSapStatus )context;
613 vos_mem_copy(&sapApAppEvent.sapevt.sapStationSetKeyCompleteEvent.peerMacAddr,
614 pCsrRoamInfo->peerMac,sizeof(tSirMacAddr));
615 break;
616
617 case eSAP_STA_DEL_KEY_EVENT :
618 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700619 __func__, "eSAP_STA_DEL_KEY_EVENT");
Jeff Johnson295189b2012-06-20 16:38:30 -0700620 sapApAppEvent.sapHddEventCode = eSAP_STA_DEL_KEY_EVENT;
621 sapApAppEvent.sapevt.sapStationDeleteKeyCompleteEvent.status = (eSapStatus )context;
622 //TODO: Should we need to send the key information
623 //sapApAppEvent.sapevt.sapStationDeleteKeyCompleteEvent.keyId = ;
624 break;
625
626 case eSAP_STA_MIC_FAILURE_EVENT :
627 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700628 __func__, "eSAP_STA_MIC_FAILURE_EVENT");
Jeff Johnson295189b2012-06-20 16:38:30 -0700629 sapApAppEvent.sapHddEventCode = eSAP_STA_MIC_FAILURE_EVENT;
630 vos_mem_copy( &sapApAppEvent.sapevt.sapStationMICFailureEvent.srcMacAddr,
631 pCsrRoamInfo->u.pMICFailureInfo->srcMacAddr,
632 sizeof(tSirMacAddr));
633 vos_mem_copy( &sapApAppEvent.sapevt.sapStationMICFailureEvent.staMac,
634 pCsrRoamInfo->u.pMICFailureInfo->taMacAddr,
635 sizeof(tSirMacAddr));
636 vos_mem_copy( &sapApAppEvent.sapevt.sapStationMICFailureEvent.dstMacAddr,
637 pCsrRoamInfo->u.pMICFailureInfo->dstMacAddr,
638 sizeof(tSirMacAddr));
639 sapApAppEvent.sapevt.sapStationMICFailureEvent.multicast = pCsrRoamInfo->u.pMICFailureInfo->multicast;
640 sapApAppEvent.sapevt.sapStationMICFailureEvent.IV1 = pCsrRoamInfo->u.pMICFailureInfo->IV1;
641 sapApAppEvent.sapevt.sapStationMICFailureEvent.keyId = pCsrRoamInfo->u.pMICFailureInfo->keyId;
642 vos_mem_copy( sapApAppEvent.sapevt.sapStationMICFailureEvent.TSC,
643 pCsrRoamInfo->u.pMICFailureInfo->TSC,
644 SIR_CIPHER_SEQ_CTR_SIZE);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700645 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700646
647 case eSAP_ASSOC_STA_CALLBACK_EVENT:
648 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700649 __func__, "eSAP_ASSOC_STA_CALLBACK_EVENT");
Jeff Johnson295189b2012-06-20 16:38:30 -0700650 break;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700651
Jeff Johnson295189b2012-06-20 16:38:30 -0700652 case eSAP_WPS_PBC_PROBE_REQ_EVENT:
653 sapApAppEvent.sapHddEventCode = eSAP_WPS_PBC_PROBE_REQ_EVENT;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700654
Jeff Johnson295189b2012-06-20 16:38:30 -0700655 vos_mem_copy( &sapApAppEvent.sapevt.sapPBCProbeReqEvent.WPSPBCProbeReq,
656 pCsrRoamInfo->u.pWPSPBCProbeReq,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700657 sizeof(tSirWPSPBCProbeReq));
Jeff Johnson295189b2012-06-20 16:38:30 -0700658 break;
659
Jeff Johnson295189b2012-06-20 16:38:30 -0700660 case eSAP_INDICATE_MGMT_FRAME:
661 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
662 "In %s, SAP event callback event = %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700663 __func__, "eSAP_INDICATE_MGMT_FRAME");
Jeff Johnson295189b2012-06-20 16:38:30 -0700664 sapApAppEvent.sapHddEventCode = eSAP_INDICATE_MGMT_FRAME;
665 sapApAppEvent.sapevt.sapManagementFrameInfo.nFrameLength
666 = pCsrRoamInfo->nFrameLength;
667 sapApAppEvent.sapevt.sapManagementFrameInfo.pbFrames
668 = pCsrRoamInfo->pbFrames;
669 sapApAppEvent.sapevt.sapManagementFrameInfo.frameType
670 = pCsrRoamInfo->frameType;
671 sapApAppEvent.sapevt.sapManagementFrameInfo.rxChan
672 = pCsrRoamInfo->rxChan;
673
674 break;
675 case eSAP_REMAIN_CHAN_READY:
676 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
677 "In %s, SAP event callback event = %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700678 __func__, "eSAP_REMAIN_CHAN_READY");
Jeff Johnson295189b2012-06-20 16:38:30 -0700679 sapApAppEvent.sapHddEventCode = eSAP_REMAIN_CHAN_READY;
680 break;
681 case eSAP_SEND_ACTION_CNF:
682 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
683 "In %s, SAP event callback event = %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700684 __func__, "eSAP_SEND_ACTION_CNF");
Jeff Johnson295189b2012-06-20 16:38:30 -0700685 sapApAppEvent.sapHddEventCode = eSAP_SEND_ACTION_CNF;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700686 sapApAppEvent.sapevt.sapActionCnf.actionSendSuccess = (eSapStatus)context;
Jeff Johnson295189b2012-06-20 16:38:30 -0700687 break;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -0800688
689 case eSAP_DISCONNECT_ALL_P2P_CLIENT:
690 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
691 "In %s, SAP event callback event = %s",
692 __func__, "eSAP_DISCONNECT_ALL_P2P_CLIENT");
693 sapApAppEvent.sapHddEventCode = eSAP_DISCONNECT_ALL_P2P_CLIENT;
694 sapApAppEvent.sapevt.sapActionCnf.actionSendSuccess = (eSapStatus)context;
695 break;
696
697 case eSAP_MAC_TRIG_STOP_BSS_EVENT :
698 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
699 "In %s, SAP event callback event = %s",
700 __func__, "eSAP_MAC_TRIG_STOP_BSS_EVENT");
701 sapApAppEvent.sapHddEventCode = eSAP_MAC_TRIG_STOP_BSS_EVENT;
702 sapApAppEvent.sapevt.sapActionCnf.actionSendSuccess = (eSapStatus)context;
703 break;
704
Jeff Johnson295189b2012-06-20 16:38:30 -0700705
706 case eSAP_UNKNOWN_STA_JOIN:
707 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
708 "In %s, SAP event callback event = %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700709 __func__, "eSAP_UNKNOWN_STA_JOIN");
Jeff Johnson295189b2012-06-20 16:38:30 -0700710 sapApAppEvent.sapHddEventCode = eSAP_UNKNOWN_STA_JOIN;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700711 vos_mem_copy((v_PVOID_t)sapApAppEvent.sapevt.sapUnknownSTAJoin.macaddr.bytes,
Jeff Johnson295189b2012-06-20 16:38:30 -0700712 (v_PVOID_t)context, sizeof(v_MACADDR_t));
713 break;
714
715 case eSAP_MAX_ASSOC_EXCEEDED:
716 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
717 "In %s, SAP event callback event = %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700718 __func__, "eSAP_MAX_ASSOC_EXCEEDED");
Jeff Johnson295189b2012-06-20 16:38:30 -0700719 sapApAppEvent.sapHddEventCode = eSAP_MAX_ASSOC_EXCEEDED;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700720 vos_mem_copy((v_PVOID_t)sapApAppEvent.sapevt.sapMaxAssocExceeded.macaddr.bytes,
Jeff Johnson295189b2012-06-20 16:38:30 -0700721 (v_PVOID_t)pCsrRoamInfo->peerMac, sizeof(v_MACADDR_t));
722 break;
723
724 default:
725 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, SAP Unknown callback event = %d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700726 __func__,sapHddevent);
Jeff Johnson295189b2012-06-20 16:38:30 -0700727 break;
728 }
729 vosStatus = (*sapContext->pfnSapEventCallback)
730 (
731 &sapApAppEvent,
732 sapContext->pUsrContext//userdataforcallback - hdd opaque handle
733 );
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700734
Jeff Johnson295189b2012-06-20 16:38:30 -0700735 return vosStatus;
736
737} /* sapSignalApAppStartBssEvent */
738
739/*==========================================================================
740 FUNCTION sapFsm
741
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700742 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700743 SAP State machine entry function
744
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700745 DEPENDENCIES
746 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -0700747
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700748 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700749
750 IN
751 sapContext : Sap Context value
752 sapEvent : State machine event
753 status : Return the SAP status here
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700754
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 RETURN VALUE
756 The VOS_STATUS code associated with performing the operation
757
758 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700759
760 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -0700761============================================================================*/
762VOS_STATUS
763sapFsm
764(
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700765 ptSapContext sapContext, /* sapContext value */
Jeff Johnson295189b2012-06-20 16:38:30 -0700766 ptWLAN_SAPEvent sapEvent /* State machine event */
767)
768{
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700769 /* Retrieve the phy link state machine structure
Jeff Johnson295189b2012-06-20 16:38:30 -0700770 * from the sapContext value
771 */
772 eSapFsmStates_t stateVar = sapContext->sapsMachine; /*state var that keeps track of state machine*/
773 tCsrRoamInfo *roamInfo = (tCsrRoamInfo *)(sapEvent->params);
774 v_U32_t msg = sapEvent->event; /* State machine input event message */
775 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
776
777 switch (stateVar)
778 {
779 case eSAP_DISCONNECTED:
780 if ((msg == eSAP_HDD_START_INFRA_BSS))
781 {
782 /* Transition from eSAP_DISCONNECTED to eSAP_CH_SELECT (both without substates) */
783 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, new from state %s => %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700784 __func__, "eSAP_DISCONNECTED", "eSAP_CH_SELECT");
Jeff Johnson295189b2012-06-20 16:38:30 -0700785
786 /* There can be one SAP Session for softap */
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700787 if (sapContext->isSapSessionOpen == eSAP_TRUE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700788 {
789 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_FATAL,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700790 "%s:SME Session is already opened\n",__func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700791 return VOS_STATUS_E_EXISTS;
792 }
793
794 sapContext->sessionId = 0xff;
795
796 /* Set SAP device role */
797 sapContext->sapsMachine = eSAP_CH_SELECT;
798
799 /* Perform sme_ScanRequest */
800 vosStatus = sapGotoChannelSel(sapContext, sapEvent);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700801
Jeff Johnson295189b2012-06-20 16:38:30 -0700802 /* Transition from eSAP_DISCONNECTED to eSAP_CH_SELECT (both without substates) */
803 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700804 __func__, "eSAP_DISCONNECTED", "eSAP_CH_SELECT");
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700805 }
806 else
Jeff Johnson295189b2012-06-20 16:38:30 -0700807 {
808 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, in state %s, event msg %d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700809 __func__, "eSAP_DISCONNECTED", msg);
Jeff Johnson295189b2012-06-20 16:38:30 -0700810 }
811 break;
812
813 case eSAP_CH_SELECT:
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700814 if (msg == eSAP_MAC_SCAN_COMPLETE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700815 {
816 /* Transition from eSAP_CH_SELECT to eSAP_STARTING (both without substates) */
817 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700818 __func__, "eSAP_CH_SELECT", "eSAP_STARTING");
Jeff Johnson295189b2012-06-20 16:38:30 -0700819 // Channel selected. Now can sapGotoStarting
820 sapContext->sapsMachine = eSAP_STARTING;
821 // Specify the channel
822 sapContext->csrRoamProfile.ChannelInfo.numOfChannels = 1;
823 sapContext->csrRoamProfile.ChannelInfo.ChannelList = &sapContext->csrRoamProfile.operationChannel;
824 sapContext->csrRoamProfile.operationChannel = (tANI_U8)sapContext->channel;
825 vosStatus = sapGotoStarting( sapContext, sapEvent, eCSR_BSS_TYPE_INFRA_AP);
826 /* Transition from eSAP_CH_SELECT to eSAP_STARTING (both without substates) */
827 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700828 __func__, "eSAP_CH_SELECT", "eSAP_STARTING");
Jeff Johnson295189b2012-06-20 16:38:30 -0700829 }
830 else
831 {
832 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, in state %s, invalid event msg %d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700833 __func__, "eSAP_CH_SELECT", msg);
Jeff Johnson295189b2012-06-20 16:38:30 -0700834 }
835 break;
836
837 case eSAP_STARTING:
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700838 if (msg == eSAP_MAC_START_BSS_SUCCESS )
Jeff Johnson295189b2012-06-20 16:38:30 -0700839 {
840 /* Transition from eSAP_STARTING to eSAP_STARTED (both without substates) */
841 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state channel = %d %s => %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700842 __func__,sapContext->channel, "eSAP_STARTING", "eSAP_STARTED");
Jeff Johnson295189b2012-06-20 16:38:30 -0700843
844 sapContext->sapsMachine = eSAP_STARTED;
845 /*Action code for transition */
846 vosStatus = sapSignalHDDevent( sapContext, roamInfo, eSAP_START_BSS_EVENT, (v_PVOID_t)eSAP_STATUS_SUCCESS);
847
848 /* Transition from eSAP_STARTING to eSAP_STARTED (both without substates) */
849 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700850 __func__, "eSAP_STARTING", "eSAP_STARTED");
Jeff Johnson295189b2012-06-20 16:38:30 -0700851 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700852 else if (msg == eSAP_MAC_START_FAILS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700853 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700854 /*Transition from STARTING to DISCONNECTED (both without substates)*/
Deepthi Gowri6649f6a2014-02-18 17:31:23 +0530855 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, from state %s => %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700856 __func__, "eSAP_STARTING", "eSAP_DISCONNECTED");
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700857
Jeff Johnson295189b2012-06-20 16:38:30 -0700858 /*Action code for transition */
859 vosStatus = sapSignalHDDevent( sapContext, NULL, eSAP_START_BSS_EVENT,(v_PVOID_t) eSAP_STATUS_FAILURE);
860 vosStatus = sapGotoDisconnected(sapContext);
861
862 /*Advance outer statevar */
863 sapContext->sapsMachine = eSAP_DISCONNECTED;
864 }
865 else if (msg == eSAP_HDD_STOP_INFRA_BSS)
866 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700867 /*Transition from eSAP_STARTING to eSAP_DISCONNECTING (both without substates)*/
Jeff Johnson295189b2012-06-20 16:38:30 -0700868 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700869 __func__, "eSAP_STARTING", "eSAP_DISCONNECTING");
Jeff Johnson295189b2012-06-20 16:38:30 -0700870
871 /*Advance outer statevar */
872 sapContext->sapsMachine = eSAP_DISCONNECTED;
873 vosStatus = sapSignalHDDevent( sapContext, NULL, eSAP_START_BSS_EVENT, (v_PVOID_t)eSAP_STATUS_FAILURE);
874 vosStatus = sapGotoDisconnected(sapContext);
875 /* Close the SME session*/
876
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700877 if (eSAP_TRUE == sapContext->isSapSessionOpen)
Jeff Johnson295189b2012-06-20 16:38:30 -0700878 {
879 tHalHandle hHal = VOS_GET_HAL_CB(sapContext->pvosGCtx);
880 if (NULL == hHal)
881 {
882 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
883 "In %s, NULL hHal in state %s, msg %d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700884 __func__, "eSAP_STARTING", msg);
Jeff Johnson295189b2012-06-20 16:38:30 -0700885 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700886 else if (eHAL_STATUS_SUCCESS ==
Jeff Johnson295189b2012-06-20 16:38:30 -0700887 sme_CloseSession(hHal,
888 sapContext->sessionId, NULL, NULL))
889 {
890 sapContext->isSapSessionOpen = eSAP_FALSE;
891 }
892 }
893 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700894 else
Jeff Johnson295189b2012-06-20 16:38:30 -0700895 {
896 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
897 "In %s, in state %s, invalid event msg %d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700898 __func__, "eSAP_STARTING", msg);
Jeff Johnson295189b2012-06-20 16:38:30 -0700899 /* Intentionally left blank */
900 }
901 break;
902
903 case eSAP_STARTED:
904 if (msg == eSAP_HDD_STOP_INFRA_BSS)
905 {
906 /* Transition from eSAP_STARTED to eSAP_DISCONNECTING (both without substates) */
907 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700908 __func__, "eSAP_STARTED", "eSAP_DISCONNECTING");
Jeff Johnson295189b2012-06-20 16:38:30 -0700909 sapContext->sapsMachine = eSAP_DISCONNECTING;
910 vosStatus = sapGotoDisconnecting(sapContext);
911 }
912 else
913 {
914 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, in state %s, invalid event msg %d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700915 __func__, "eSAP_STARTED", msg);
Jeff Johnson295189b2012-06-20 16:38:30 -0700916 }
917 break;
918
919 case eSAP_DISCONNECTING:
920 if (msg == eSAP_MAC_READY_FOR_CONNECTIONS)
921 {
922 /* Transition from eSAP_DISCONNECTING to eSAP_DISCONNECTED (both without substates) */
923 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700924 __func__, "eSAP_DISCONNECTING", "eSAP_DISCONNECTED");
Jeff Johnson295189b2012-06-20 16:38:30 -0700925
926 sapContext->sapsMachine = eSAP_DISCONNECTED;
927 /* Close the SME session*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700928 if (eSAP_TRUE == sapContext->isSapSessionOpen)
Jeff Johnson295189b2012-06-20 16:38:30 -0700929 {
930 tHalHandle hHal = VOS_GET_HAL_CB(sapContext->pvosGCtx);
931
932 if (NULL == hHal)
933 {
934 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
935 "In %s, NULL hHal in state %s, msg %d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700936 __func__, "eSAP_DISCONNECTING", msg);
Jeff Johnson295189b2012-06-20 16:38:30 -0700937 }
938 else
939 {
940 sapContext->isSapSessionOpen = eSAP_FALSE;
941 if (!HAL_STATUS_SUCCESS(
942 sme_CloseSession(hHal,
943 sapContext->sessionId,
944 sapRoamSessionCloseCallback, sapContext)))
945 {
946 vosStatus = sapSignalHDDevent(sapContext, NULL,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700947 eSAP_STOP_BSS_EVENT,
Jeff Johnson295189b2012-06-20 16:38:30 -0700948 (v_PVOID_t) eSAP_STATUS_SUCCESS);
949 }
950 }
951 }
952 }
Peng Xu2446a892014-09-05 17:21:18 +0530953 if (msg == eSAP_CHANNEL_SELECTION_FAILED)
954 {
955 /* Set SAP device role */
956 sapContext->sapsMachine = eSAP_CH_SELECT;
957
958 /* Perform sme_ScanRequest */
959 vosStatus = sapGotoChannelSel(sapContext, sapEvent);
960 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700961 else
Jeff Johnson295189b2012-06-20 16:38:30 -0700962 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700963 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Jeff Johnson295189b2012-06-20 16:38:30 -0700964 "In %s, in state %s, invalid event msg %d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700965 __func__, "eSAP_DISCONNECTING", msg);
Jeff Johnson295189b2012-06-20 16:38:30 -0700966 }
967 break;
968 }
969 return vosStatus;
970}// sapFsm
971
972
973eSapStatus
974sapconvertToCsrProfile(tsap_Config_t *pconfig_params, eCsrRoamBssType bssType, tCsrRoamProfile *profile)
975{
976 //Create Roam profile for SoftAP to connect
977 profile->BSSType = eCSR_BSS_TYPE_INFRA_AP;
978 profile->SSIDs.numOfSSIDs = 1;
979 profile->csrPersona = pconfig_params->persona;
980
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700981 vos_mem_zero(profile->SSIDs.SSIDList[0].SSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700982 sizeof(profile->SSIDs.SSIDList[0].SSID.ssId));
983
984 //Flag to not broadcast the SSID information
985 profile->SSIDs.SSIDList[0].ssidHidden = pconfig_params->SSIDinfo.ssidHidden;
986
987 profile->SSIDs.SSIDList[0].SSID.length = pconfig_params->SSIDinfo.ssid.length;
988 vos_mem_copy(&profile->SSIDs.SSIDList[0].SSID.ssId, pconfig_params->SSIDinfo.ssid.ssId,
989 sizeof(pconfig_params->SSIDinfo.ssid.ssId));
990
991 profile->negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
992
993 if (pconfig_params->authType == eSAP_OPEN_SYSTEM)
994 {
995 profile->negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
996 }
997 else if (pconfig_params->authType == eSAP_SHARED_KEY)
998 {
999 profile->negotiatedAuthType = eCSR_AUTH_TYPE_SHARED_KEY;
1000 }
1001 else
1002 {
1003 profile->negotiatedAuthType = eCSR_AUTH_TYPE_AUTOSWITCH;
1004 }
1005
1006 profile->AuthType.numEntries = 1;
1007 profile->AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM;
1008
1009 //Always set the Encryption Type
1010 profile->EncryptionType.numEntries = 1;
1011 profile->EncryptionType.encryptionType[0] = pconfig_params->RSNEncryptType;
1012
1013 profile->mcEncryptionType.numEntries = 1;
1014 profile->mcEncryptionType.encryptionType[0] = pconfig_params->mcRSNEncryptType;
1015
1016 if (pconfig_params->privacy & eSAP_SHARED_KEY)
1017 {
1018 profile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY;
1019 }
1020
1021 profile->privacy = pconfig_params->privacy;
1022 profile->fwdWPSPBCProbeReq = pconfig_params->fwdWPSPBCProbeReq;
1023
1024 if (pconfig_params->authType == eSAP_SHARED_KEY)
1025 {
1026 profile->csr80211AuthType = eSIR_SHARED_KEY;
1027 }
1028 else if (pconfig_params->authType == eSAP_OPEN_SYSTEM)
1029 {
1030 profile->csr80211AuthType = eSIR_OPEN_SYSTEM;
1031 }
1032 else
1033 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001034 profile->csr80211AuthType = eSIR_AUTO_SWITCH;
Jeff Johnson295189b2012-06-20 16:38:30 -07001035 }
1036
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001037 //Initialize we are not going to use it
Jeff Johnson295189b2012-06-20 16:38:30 -07001038 profile->pWPAReqIE = NULL;
1039 profile->nWPAReqIELength = 0;
1040
1041 //set the RSN/WPA IE
1042 profile->pRSNReqIE = NULL;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001043 profile->nRSNReqIELength = pconfig_params->RSNWPAReqIELength;
Jeff Johnson295189b2012-06-20 16:38:30 -07001044 if (pconfig_params->RSNWPAReqIELength)
1045 {
1046 profile->pRSNReqIE = vos_mem_malloc(pconfig_params->RSNWPAReqIELength);
1047 if( NULL == profile->pRSNReqIE )
1048 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001049 VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, " %s Fail to alloc memory", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001050 return eSAP_STATUS_FAILURE;
1051 }
1052 vos_mem_copy(profile->pRSNReqIE, pconfig_params->pRSNWPAReqIE, pconfig_params->RSNWPAReqIELength);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001053 profile->nRSNReqIELength = pconfig_params->RSNWPAReqIELength;
Jeff Johnson295189b2012-06-20 16:38:30 -07001054 }
1055
1056 // Turn off CB mode
1057 profile->CBMode = eCSR_CB_OFF;
1058
1059 //set the phyMode to accept anything
1060 //Best means everything because it covers all the things we support
1061 profile->phyMode = pconfig_params->SapHw_mode; /*eCSR_DOT11_MODE_BEST*/
1062
1063 //Configure beaconInterval
1064 profile->beaconInterval = (tANI_U16)pconfig_params->beacon_int;
1065
1066 // set DTIM period
1067 profile->dtimPeriod = pconfig_params->dtim_period;
1068
1069 //set Uapsd enable bit
1070 profile->ApUapsdEnable = pconfig_params->UapsdEnable;
1071
1072 //Enable protection parameters
1073 profile->protEnabled = pconfig_params->protEnabled;
1074 profile->obssProtEnabled = pconfig_params->obssProtEnabled;
1075 profile->cfg_protection = pconfig_params->ht_capab;
1076
1077 //country code
1078 if (pconfig_params->countryCode[0])
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001079 vos_mem_copy(profile->countryCode, pconfig_params->countryCode, WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07001080 profile->ieee80211d = pconfig_params->ieee80211d;
Jeff Johnson295189b2012-06-20 16:38:30 -07001081 //wps config info
1082 profile->wps_state = pconfig_params->wps_state;
1083
Chet Lanctot8cecea22014-02-11 19:09:36 -08001084#ifdef WLAN_FEATURE_11W
1085 // MFP capable/required
1086 profile->MFPCapable = pconfig_params->mfpCapable ? 1 : 0;
1087 profile->MFPRequired = pconfig_params->mfpRequired ? 1 : 0;
1088#endif
1089
Jeff Johnson295189b2012-06-20 16:38:30 -07001090 return eSAP_STATUS_SUCCESS; /* Success. */
1091}
1092
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07001093/**
1094 * FUNCTION: sapConvertSapPhyModeToCsrPhyMode
1095 * Called internally by SAP
1096 */
1097eCsrPhyMode sapConvertSapPhyModeToCsrPhyMode( eSapPhyMode sapPhyMode )
1098{
1099 switch (sapPhyMode)
1100 {
1101 case (eSAP_DOT11_MODE_abg):
1102 return eCSR_DOT11_MODE_abg;
1103 case (eSAP_DOT11_MODE_11b):
1104 return eCSR_DOT11_MODE_11b;
1105 case (eSAP_DOT11_MODE_11g):
1106 return eCSR_DOT11_MODE_11g;
1107 case (eSAP_DOT11_MODE_11n):
1108 return eCSR_DOT11_MODE_11n;
1109 case (eSAP_DOT11_MODE_11g_ONLY):
1110 return eCSR_DOT11_MODE_11g_ONLY;
1111 case (eSAP_DOT11_MODE_11n_ONLY):
1112 return eCSR_DOT11_MODE_11n_ONLY;
1113 case (eSAP_DOT11_MODE_11b_ONLY):
1114 return eCSR_DOT11_MODE_11b_ONLY;
1115#ifdef WLAN_FEATURE_11AC
1116 case (eSAP_DOT11_MODE_11ac_ONLY):
1117 return eCSR_DOT11_MODE_11ac_ONLY;
1118 case (eSAP_DOT11_MODE_11ac):
1119 return eCSR_DOT11_MODE_11ac;
1120#endif
1121 default:
1122 return eCSR_DOT11_MODE_AUTO;
1123 }
1124}
Jeff Johnson295189b2012-06-20 16:38:30 -07001125
1126void sapFreeRoamProfile(tCsrRoamProfile *profile)
1127{
1128 if(profile->pRSNReqIE)
1129 {
1130 vos_mem_free(profile->pRSNReqIE);
1131 profile->pRSNReqIE = NULL;
1132 }
1133}
1134
1135
1136void
1137sapSortMacList(v_MACADDR_t *macList, v_U8_t size)
1138{
1139 v_U8_t outer, inner;
1140 v_MACADDR_t temp;
1141 v_SINT_t nRes = -1;
1142
Padma, Santhosh Kumar307003d2014-04-21 17:09:29 +05301143 if ((NULL == macList) || (size >= MAX_ACL_MAC_ADDRESS))
1144 {
1145 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
1146 "In %s, either buffer is NULL or size = %d is more."
1147 ,__func__, size);
1148 return;
1149 }
1150
Jeff Johnson295189b2012-06-20 16:38:30 -07001151 for(outer = 0; outer < size; outer++)
1152 {
1153 for(inner = 0; inner < size - 1; inner++)
1154 {
1155 nRes = vos_mem_compare2((macList + inner)->bytes, (macList + inner + 1)->bytes, sizeof(v_MACADDR_t));
1156 if (nRes > 0)
1157 {
1158 vos_mem_copy(temp.bytes, (macList + inner + 1)->bytes, sizeof(v_MACADDR_t));
1159 vos_mem_copy((macList + inner + 1)->bytes, (macList + inner)->bytes, sizeof(v_MACADDR_t));
1160 vos_mem_copy((macList + inner)->bytes, temp.bytes, sizeof(v_MACADDR_t));
1161 }
1162 }
1163 }
1164}
1165
1166eSapBool
1167sapSearchMacList(v_MACADDR_t *macList, v_U8_t num_mac, v_U8_t *peerMac, v_U8_t *index)
1168{
1169 v_SINT_t nRes = -1;
1170 v_S7_t nStart = 0, nEnd, nMiddle;
1171 nEnd = num_mac - 1;
1172
1173 while (nStart <= nEnd)
1174 {
1175 nMiddle = (nStart + nEnd) / 2;
1176 nRes = vos_mem_compare2(&macList[nMiddle], peerMac, sizeof(v_MACADDR_t));
1177
1178 if (0 == nRes)
1179 {
1180 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
1181 "search SUCC");
1182 // "index equals NULL" means the caller does not need the
1183 // index value of the peerMac being searched
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001184 if (index != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07001185 {
1186 *index = (v_U8_t) nMiddle;
1187 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
1188 "index %d", *index);
1189 }
1190 return eSAP_TRUE;
1191 }
1192 if (nRes < 0)
1193 nStart = nMiddle + 1;
1194 else
1195 nEnd = nMiddle - 1;
1196 }
1197
1198 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
1199 "search not succ");
1200 return eSAP_FALSE;
1201}
1202
1203void
1204sapAddMacToACL(v_MACADDR_t *macList, v_U8_t *size, v_U8_t *peerMac)
1205{
1206 v_SINT_t nRes = -1;
1207 int i;
1208 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"add acl entered");
Padma, Santhosh Kumarb8bc08a2014-05-26 19:11:20 +05301209
Mahesh A Saptasagarbeb0ba02014-08-01 12:23:59 +05301210 if ((NULL == macList) || (*size >= MAX_ACL_MAC_ADDRESS))
Padma, Santhosh Kumarb8bc08a2014-05-26 19:11:20 +05301211 {
1212 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
1213 "In %s, either buffer is NULL or size %d is incorrect."
1214 , __func__, *size);
1215 return;
1216 }
1217
Jeff Johnson295189b2012-06-20 16:38:30 -07001218 for (i=((*size)-1); i>=0; i--)
1219 {
1220 nRes = vos_mem_compare2(&macList[i], peerMac, sizeof(v_MACADDR_t));
1221 if (nRes > 0)
1222 {
1223 /* Move alphabetically greater mac addresses one index down to allow for insertion
1224 of new mac in sorted order */
1225 vos_mem_copy((macList+i+1)->bytes,(macList+i)->bytes, sizeof(v_MACADDR_t));
1226 }
1227 else
1228 {
1229 break;
1230 }
1231 }
1232 //This should also take care of if the element is the first to be added in the list
1233 vos_mem_copy((macList+i+1)->bytes, peerMac, sizeof(v_MACADDR_t));
1234 // increment the list size
1235 (*size)++;
1236}
1237
1238void
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001239sapRemoveMacFromACL(v_MACADDR_t *macList, v_U8_t *size, v_U8_t index)
Jeff Johnson295189b2012-06-20 16:38:30 -07001240{
1241 int i;
1242 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"remove acl entered");
1243 /* return if the list passed is empty. Ideally this should never happen since this funcn is always
1244 called after sapSearchMacList to get the index of the mac addr to be removed and this will
1245 only get called if the search is successful. Still no harm in having the check */
Padma, Santhosh Kumar72c28472014-05-15 21:18:11 +05301246 if ((macList==NULL) || (*size == 0) || (*size > MAX_ACL_MAC_ADDRESS))
1247 {
1248 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
1249 "In %s, either buffer is NULL or size %d is incorrect."
1250 , __func__, *size);
1251 return;
1252 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001253 for (i=index; i<((*size)-1); i++)
1254 {
1255 /* Move mac addresses starting from "index" passed one index up to delete the void
1256 created by deletion of a mac address in ACL */
1257 vos_mem_copy((macList+i)->bytes,(macList+i+1)->bytes, sizeof(v_MACADDR_t));
1258 }
1259 // The last space should be made empty since all mac addesses moved one step up
1260 vos_mem_zero((macList+(*size)-1)->bytes, sizeof(v_MACADDR_t));
1261 //reduce the list size by 1
1262 (*size)--;
1263}
1264
1265void sapPrintACL(v_MACADDR_t *macList, v_U8_t size)
1266{
1267 int i;
Arif Hussain24bafea2013-11-15 15:10:03 -08001268 v_BYTE_t *macArray;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001269 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"print acl entered");
Padma, Santhosh Kumar307003d2014-04-21 17:09:29 +05301270
1271 if ((NULL == macList) || (size == 0) || (size >= MAX_ACL_MAC_ADDRESS))
1272 {
1273 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
1274 "In %s, either buffer is NULL or size %d is incorrect."
1275 , __func__, size);
1276 return;
1277 }
1278
Jeff Johnson295189b2012-06-20 16:38:30 -07001279 for (i=0; i<size; i++)
1280 {
Arif Hussain24bafea2013-11-15 15:10:03 -08001281 macArray = (macList+i)->bytes;
Jeff Johnson295189b2012-06-20 16:38:30 -07001282 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussain24bafea2013-11-15 15:10:03 -08001283 "** ACL entry %i - "MAC_ADDRESS_STR, i,
1284 MAC_ADDR_ARRAY(macArray));
Jeff Johnson295189b2012-06-20 16:38:30 -07001285 }
1286 return;
1287}
1288
1289VOS_STATUS
1290sapIsPeerMacAllowed(ptSapContext sapContext, v_U8_t *peerMac)
1291{
1292 if (eSAP_ALLOW_ALL == sapContext->eSapMacAddrAclMode)
1293 return VOS_STATUS_SUCCESS;
1294
1295 if (sapSearchMacList(sapContext->acceptMacList, sapContext->nAcceptMac, peerMac, NULL))
1296 return VOS_STATUS_SUCCESS;
1297
1298 if (sapSearchMacList(sapContext->denyMacList, sapContext->nDenyMac, peerMac, NULL))
1299 {
Arif Hussain24bafea2013-11-15 15:10:03 -08001300 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
1301 "In %s, Peer "MAC_ADDRESS_STR" in deny list",
1302 __func__, MAC_ADDR_ARRAY(peerMac));
Jeff Johnson295189b2012-06-20 16:38:30 -07001303 return VOS_STATUS_E_FAILURE;
1304 }
1305
1306 // A new station CAN associate, unless in deny list. Less stringent mode
1307 if (eSAP_ACCEPT_UNLESS_DENIED == sapContext->eSapMacAddrAclMode)
1308 return VOS_STATUS_SUCCESS;
1309
1310 // A new station CANNOT associate, unless in accept list. More stringent mode
1311 if (eSAP_DENY_UNLESS_ACCEPTED == sapContext->eSapMacAddrAclMode)
1312 {
Arif Hussain24bafea2013-11-15 15:10:03 -08001313 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
1314 "In %s, Peer "MAC_ADDRESS_STR" denied, Mac filter mode is eSAP_DENY_UNLESS_ACCEPTED",
1315 __func__, MAC_ADDR_ARRAY(peerMac));
Jeff Johnson295189b2012-06-20 16:38:30 -07001316 return VOS_STATUS_E_FAILURE;
1317 }
1318
1319 /* The new STA is neither in accept list nor in deny list. In this case, deny the association
1320 * but send a wifi event notification indicating the mac address being denied
1321 */
1322 if (eSAP_SUPPORT_ACCEPT_AND_DENY == sapContext->eSapMacAddrAclMode)
1323 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001324 sapSignalHDDevent(sapContext, NULL, eSAP_UNKNOWN_STA_JOIN, (v_PVOID_t)peerMac);
Arif Hussain24bafea2013-11-15 15:10:03 -08001325 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
1326 "In %s, Peer "MAC_ADDRESS_STR" denied, Mac filter mode is eSAP_SUPPORT_ACCEPT_AND_DENY",
1327 __func__, MAC_ADDR_ARRAY(peerMac));
Jeff Johnson295189b2012-06-20 16:38:30 -07001328 return VOS_STATUS_E_FAILURE;
1329 }
1330 return VOS_STATUS_SUCCESS;
1331}
1332
1333#ifdef SOFTAP_CHANNEL_RANGE
1334static VOS_STATUS sapGetChannelList(ptSapContext sapContext,
1335 v_U8_t **channelList, v_U8_t *numberOfChannels)
1336{
1337 v_U32_t startChannelNum;
1338 v_U32_t endChannelNum;
1339 v_U32_t operatingBand;
1340 v_U8_t loopCount;
1341 v_U8_t *list;
1342 v_U8_t channelCount;
1343 v_U8_t bandStartChannel;
1344 v_U8_t bandEndChannel ;
1345 v_U32_t enableLTECoex;
1346 tHalHandle hHal = VOS_GET_HAL_CB(sapContext->pvosGCtx);
Abhishek Singhb51853c2014-03-13 18:26:41 +05301347#ifdef FEATURE_WLAN_CH_AVOID
1348 v_U8_t i;
1349#endif
1350
Jeff Johnson295189b2012-06-20 16:38:30 -07001351
1352 if (NULL == hHal)
1353 {
1354 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1355 "Invalid HAL pointer from pvosGCtx on sapGetChannelList");
1356 *numberOfChannels = 0;
1357 *channelList = NULL;
1358 return VOS_STATUS_E_FAULT;
1359 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001360
Peng Xu2446a892014-09-05 17:21:18 +05301361 if ( eCSR_BAND_ALL == sapContext->scanBandPreference)
Jeff Johnson295189b2012-06-20 16:38:30 -07001362 {
Peng Xu2446a892014-09-05 17:21:18 +05301363
1364 ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL, &startChannelNum);
1365 ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL, &endChannelNum);
1366 ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, &operatingBand);
1367
1368 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
1369 "%s:sapGetChannelList: startChannel %d,EndChannel %d,Operatingband:%d",
1370 __func__,startChannelNum,endChannelNum,operatingBand);
1371
1372 switch(operatingBand)
1373 {
Leela Venkata Kiran Kumar Reddy Chirala9f6566c2014-09-05 19:06:58 +05301374 case eSAP_RF_SUBBAND_2_4_GHZ:
Peng Xu2446a892014-09-05 17:21:18 +05301375 bandStartChannel = RF_CHAN_1;
1376 bandEndChannel = RF_CHAN_14;
1377 break;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001378
Leela Venkata Kiran Kumar Reddy Chirala9f6566c2014-09-05 19:06:58 +05301379 case eSAP_RF_SUBBAND_5_LOW_GHZ:
Peng Xu2446a892014-09-05 17:21:18 +05301380 bandStartChannel = RF_CHAN_36;
1381 bandEndChannel = RF_CHAN_64;
1382 break;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001383
Leela Venkata Kiran Kumar Reddy Chirala9f6566c2014-09-05 19:06:58 +05301384 case eSAP_RF_SUBBAND_5_MID_GHZ:
Peng Xu2446a892014-09-05 17:21:18 +05301385 bandStartChannel = RF_CHAN_100;
1386 bandEndChannel = RF_CHAN_140;
1387 break;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001388
Leela Venkata Kiran Kumar Reddy Chirala9f6566c2014-09-05 19:06:58 +05301389 case eSAP_RF_SUBBAND_5_HIGH_GHZ:
Peng Xu2446a892014-09-05 17:21:18 +05301390 bandStartChannel = RF_CHAN_149;
1391 bandEndChannel = RF_CHAN_165;
1392 break;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001393
Leela Venkata Kiran Kumar Reddy Chirala9f6566c2014-09-05 19:06:58 +05301394 case eSAP_RF_SUBBAND_5_ALL_GHZ:
1395 bandStartChannel = RF_CHAN_36;
1396 bandEndChannel = RF_CHAN_165;
1397 break;
1398
Jeff Johnson295189b2012-06-20 16:38:30 -07001399 default:
Peng Xu2446a892014-09-05 17:21:18 +05301400 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1401 "sapGetChannelList:OperatingBand not valid ");
1402 /* assume 2.4 GHz */
1403 bandStartChannel = RF_CHAN_1;
1404 bandEndChannel = RF_CHAN_14;
1405 break;
1406 }
1407 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
1408 "%s: expanded startChannel %d,EndChannel %d,Operatingband:%d",
1409 __func__,startChannelNum,endChannelNum,operatingBand);
Jeff Johnson295189b2012-06-20 16:38:30 -07001410 }
Peng Xu2446a892014-09-05 17:21:18 +05301411 else
1412 {
1413 if ( sapContext->allBandScanned == eSAP_FALSE )
1414 {
1415 //first band scan
1416 sapContext->currentPreferredBand = sapContext->scanBandPreference;
1417 }
1418 else
1419 {
1420 //scan next band
1421 if ( eCSR_BAND_24 == sapContext->scanBandPreference )
1422 sapContext->currentPreferredBand = eCSR_BAND_5G;
1423 else
1424 sapContext->currentPreferredBand = eCSR_BAND_24;
1425 }
1426 switch(sapContext->currentPreferredBand)
1427 {
1428 case eCSR_BAND_24:
1429 bandStartChannel = RF_CHAN_1;
1430 bandEndChannel = RF_CHAN_14;
1431 startChannelNum = 1;
1432 endChannelNum = 14;
1433 break;
1434
1435 case eCSR_BAND_5G:
1436 bandStartChannel = RF_CHAN_36;
1437 bandEndChannel = RF_CHAN_165;
1438 startChannelNum = 36;
1439 endChannelNum = 165;
1440 break;
1441
1442 default:
1443 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1444 "sapGetChannelList:bandPreference not valid ");
1445 /* assume 2.4 GHz */
1446 bandStartChannel = RF_CHAN_1;
1447 bandEndChannel = RF_CHAN_14;
1448 startChannelNum = 1;
1449 endChannelNum = 14;
1450 break;
1451 }
1452 }
1453
1454 ccmCfgGetInt(hHal, WNI_CFG_ENABLE_LTE_COEX, &enableLTECoex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001455 /*Check if LTE coex is enabled and 2.4GHz is selected*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001456 if (enableLTECoex && (bandStartChannel == RF_CHAN_1)
Jeff Johnson295189b2012-06-20 16:38:30 -07001457 && (bandEndChannel == RF_CHAN_14))
1458 {
1459 /*Set 2.4GHz upper limit to channel 9 for LTE COEX*/
1460 bandEndChannel = RF_CHAN_9;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001461 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001462 /* Allocate the max number of channel supported */
1463 list = (v_U8_t *)vos_mem_malloc(NUM_5GHZ_CHANNELS);
1464 if (NULL == list)
1465 {
1466 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001467 "%s: Unable to allocate channel list", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001468 *numberOfChannels = 0;
1469 *channelList = NULL;
1470 return VOS_STATUS_E_RESOURCES;
1471 }
1472
1473 /*Search for the Active channels in the given range */
1474 channelCount = 0;
1475 for( loopCount = bandStartChannel; loopCount <= bandEndChannel; loopCount++ )
1476 {
1477 if((startChannelNum <= rfChannels[loopCount].channelNum)&&
1478 (endChannelNum >= rfChannels[loopCount].channelNum ))
1479 {
1480 if( regChannels[loopCount].enabled )
1481 {
Abhishek Singhb51853c2014-03-13 18:26:41 +05301482#ifdef FEATURE_WLAN_CH_AVOID
1483 for( i = 0; i < NUM_20MHZ_RF_CHANNELS; i++ )
1484 {
1485 if( (safeChannels[i].channelNumber ==
1486 rfChannels[loopCount].channelNum) )
1487 {
1488 /* Check if channel is safe */
1489 if(VOS_TRUE == safeChannels[i].isSafe)
1490 {
1491#endif
1492 list[channelCount] =
1493 rfChannels[loopCount].channelNum;
1494 channelCount++;
1495#ifdef FEATURE_WLAN_CH_AVOID
1496 }
1497 break;
1498 }
1499 }
1500#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001501 }
1502 }
1503 }
1504 if (0 == channelCount)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001505 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001506 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1507 "sapGetChannelList:No active channels present in the given range for the current region");
1508 /*LTE COEX: channel range outside the restricted 2.4GHz band limits*/
1509 if (enableLTECoex && (startChannelNum > bandEndChannel))
1510 {
1511 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_FATAL,
1512 "sapGetChannelList:SAP cannot be started as LTE COEX restricted 2.4GHz limits");
1513 }
1514 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001515
Jeff Johnson295189b2012-06-20 16:38:30 -07001516 /* return the channel list and number of channels to scan*/
1517 *numberOfChannels = channelCount;
1518 if(channelCount != 0)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001519 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001520 *channelList = list;
1521 }
1522 else
1523 {
1524 *channelList = NULL;
1525 vos_mem_free(list);
1526 }
Peng Xu2446a892014-09-05 17:21:18 +05301527
1528 for (loopCount = 0; loopCount <channelCount; loopCount ++ )
1529 {
1530 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_DEBUG,
1531 "%s: channel number: %d",
1532 __func__,list[loopCount]);
1533 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001534 return VOS_STATUS_SUCCESS;
1535}
1536#endif