Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Jeff Johnson | 797280e | 2017-09-19 08:36:01 -0700 | [diff] [blame] | 2 | * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. |
Kiet Lam | 0fb93dd | 2014-02-19 00:32:59 -0800 | [diff] [blame] | 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 Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 20 | */ |
Kiet Lam | 0fb93dd | 2014-02-19 00:32:59 -0800 | [diff] [blame] | 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 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 28 | /*=========================================================================== |
| 29 | |
| 30 | s a p M o d u l e . C |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 31 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 32 | OVERVIEW: |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 33 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 34 | This software unit holds the implementation of the WLAN SAP modules |
| 35 | functions providing EXTERNAL APIs. It is also where the global SAP module |
| 36 | context gets initialised |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 37 | |
| 38 | DEPENDENCIES: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 39 | |
| 40 | Are listed for each API below. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 41 | ===========================================================================*/ |
| 42 | |
| 43 | /*=========================================================================== |
| 44 | |
| 45 | EDIT HISTORY FOR FILE |
| 46 | |
| 47 | |
| 48 | This section contains comments describing changes made to the module. |
| 49 | Notice that changes are listed in reverse chronological order. |
| 50 | |
| 51 | |
| 52 | |
| 53 | when who what, where, why |
| 54 | ---------- --- -------------------------------------------------------- |
| 55 | 03/15/10 SOFTAP team Created module |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 56 | 06/03/10 js Added support to hostapd driven |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 57 | * deauth/disassoc/mic failure |
| 58 | |
| 59 | ===========================================================================*/ |
| 60 | |
| 61 | /* $Header$ */ |
| 62 | |
| 63 | /*---------------------------------------------------------------------------- |
| 64 | * Include Files |
| 65 | * -------------------------------------------------------------------------*/ |
| 66 | #include "wlan_qct_tl.h" |
| 67 | #include "vos_trace.h" |
| 68 | |
| 69 | // Pick up the sme callback registration API |
| 70 | #include "sme_Api.h" |
| 71 | |
| 72 | // SAP API header file |
| 73 | |
| 74 | #include "sapInternal.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 75 | #include "smeInside.h" |
| 76 | |
| 77 | /*---------------------------------------------------------------------------- |
| 78 | * Preprocessor Definitions and Constants |
| 79 | * -------------------------------------------------------------------------*/ |
| 80 | #define SAP_DEBUG |
| 81 | |
| 82 | /*---------------------------------------------------------------------------- |
| 83 | * Type Declarations |
| 84 | * -------------------------------------------------------------------------*/ |
| 85 | |
| 86 | |
| 87 | /*---------------------------------------------------------------------------- |
| 88 | * Global Data Definitions |
| 89 | * -------------------------------------------------------------------------*/ |
| 90 | |
| 91 | /*---------------------------------------------------------------------------- |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 92 | * External declarations for global context |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 93 | * -------------------------------------------------------------------------*/ |
| 94 | // No! Get this from VOS. |
| 95 | // The main per-Physical Link (per WLAN association) context. |
Madan Mohan Koyyalamudi | dfd6aa8 | 2012-10-18 20:18:43 -0700 | [diff] [blame] | 96 | ptSapContext gpSapCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 97 | |
| 98 | /*---------------------------------------------------------------------------- |
| 99 | * Static Variable Definitions |
| 100 | * -------------------------------------------------------------------------*/ |
| 101 | |
| 102 | /*---------------------------------------------------------------------------- |
| 103 | * Static Function Declarations and Definitions |
| 104 | * -------------------------------------------------------------------------*/ |
| 105 | |
| 106 | /*---------------------------------------------------------------------------- |
| 107 | * Externalized Function Definitions |
| 108 | * -------------------------------------------------------------------------*/ |
| 109 | |
| 110 | /*---------------------------------------------------------------------------- |
| 111 | * Function Declarations and Documentation |
| 112 | * -------------------------------------------------------------------------*/ |
| 113 | |
| 114 | /*========================================================================== |
| 115 | FUNCTION WLANSAP_Open |
| 116 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 117 | DESCRIPTION |
| 118 | Called at driver initialization (vos_open). SAP will initialize |
| 119 | all its internal resources and will wait for the call to start to |
| 120 | register with the other modules. |
| 121 | |
| 122 | DEPENDENCIES |
| 123 | |
| 124 | PARAMETERS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 125 | |
| 126 | IN |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 127 | pvosGCtx : Pointer to the global vos context; a handle to SAP's |
| 128 | control block can be extracted from its context |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 129 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 130 | RETURN VALUE |
| 131 | The result code associated with performing the operation |
| 132 | |
| 133 | VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page |
| 134 | fault |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 135 | VOS_STATUS_SUCCESS: Success |
| 136 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 137 | SIDE EFFECTS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 138 | ============================================================================*/ |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 139 | VOS_STATUS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 140 | WLANSAP_Open |
| 141 | ( |
| 142 | v_PVOID_t pvosGCtx |
| 143 | ) |
| 144 | { |
| 145 | |
| 146 | ptSapContext pSapCtx = NULL; |
| 147 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 148 | VOS_ASSERT(pvosGCtx); |
| 149 | /*------------------------------------------------------------------------ |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 150 | Allocate (and sanity check?!) SAP control block |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 151 | ------------------------------------------------------------------------*/ |
| 152 | vos_alloc_context(pvosGCtx, VOS_MODULE_ID_SAP, (v_VOID_t **)&pSapCtx, sizeof(tSapContext)); |
| 153 | |
| 154 | if (NULL == pSapCtx) |
| 155 | { |
| 156 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 157 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 158 | return VOS_STATUS_E_FAULT; |
| 159 | } |
| 160 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 161 | /*------------------------------------------------------------------------ |
| 162 | Clean up SAP control block, initialize all values |
| 163 | ------------------------------------------------------------------------*/ |
| 164 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANSAP_Open"); |
| 165 | |
| 166 | WLANSAP_CleanCB(pSapCtx, 0 /*do not empty*/); |
| 167 | |
Hanumantha Reddy Pothula | f30a298 | 2015-05-15 15:02:30 +0530 | [diff] [blame] | 168 | if (!VOS_IS_STATUS_SUCCESS(vos_spin_lock_init(&pSapCtx->staInfo_lock))) |
| 169 | { |
| 170 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 171 | "WLANSAP_Start failed init staInfo_lock"); |
| 172 | vos_free_context(pvosGCtx, VOS_MODULE_ID_SAP, pSapCtx); |
| 173 | return VOS_STATUS_E_FAULT; |
| 174 | } |
| 175 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 176 | // Setup the "link back" to the VOSS context |
| 177 | pSapCtx->pvosGCtx = pvosGCtx; |
| 178 | |
| 179 | // Store a pointer to the SAP context provided by VOSS |
| 180 | gpSapCtx = pSapCtx; |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 181 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 182 | /*------------------------------------------------------------------------ |
| 183 | Allocate internal resources |
| 184 | ------------------------------------------------------------------------*/ |
| 185 | |
| 186 | return VOS_STATUS_SUCCESS; |
| 187 | }// WLANSAP_Open |
| 188 | |
| 189 | /*========================================================================== |
| 190 | FUNCTION WLANSAP_Start |
| 191 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 192 | DESCRIPTION |
| 193 | Called as part of the overall start procedure (vos_start). SAP will |
| 194 | use this call to register with TL as the SAP entity for |
| 195 | SAP RSN frames. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 196 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 197 | DEPENDENCIES |
| 198 | |
| 199 | PARAMETERS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 200 | |
| 201 | IN |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 202 | pvosGCtx : Pointer to the global vos context; a handle to SAP's |
| 203 | control block can be extracted from its context |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 204 | |
| 205 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 206 | The result code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 207 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 208 | VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page |
| 209 | fault |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 210 | VOS_STATUS_SUCCESS: Success |
| 211 | |
| 212 | SIDE EFFECTS |
| 213 | ============================================================================*/ |
| 214 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 215 | VOS_STATUS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 216 | WLANSAP_Start |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 217 | ( |
| 218 | v_PVOID_t pvosGCtx |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 219 | ) |
| 220 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 221 | ptSapContext pSapCtx = NULL; |
| 222 | |
| 223 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 224 | |
| 225 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, |
| 226 | "WLANSAP_Start invoked successfully\n"); |
| 227 | /*------------------------------------------------------------------------ |
| 228 | Sanity check |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 229 | Extract SAP control block |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 230 | ------------------------------------------------------------------------*/ |
| 231 | pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 232 | if ( NULL == pSapCtx ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 233 | { |
| 234 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 235 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 236 | return VOS_STATUS_E_FAULT; |
| 237 | } |
| 238 | |
| 239 | /*------------------------------------------------------------------------ |
| 240 | For now, presume security is not enabled. |
| 241 | -----------------------------------------------------------------------*/ |
| 242 | pSapCtx->ucSecEnabled = WLANSAP_SECURITY_ENABLED_STATE; |
| 243 | |
| 244 | |
| 245 | /*------------------------------------------------------------------------ |
| 246 | Now configure the roaming profile links. To SSID and bssid. |
| 247 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 248 | // We have room for two SSIDs. |
| 249 | pSapCtx->csrRoamProfile.SSIDs.numOfSSIDs = 1; // This is true for now. |
| 250 | pSapCtx->csrRoamProfile.SSIDs.SSIDList = pSapCtx->SSIDList; //Array of two |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 251 | pSapCtx->csrRoamProfile.SSIDs.SSIDList[0].SSID.length = 0; |
| 252 | pSapCtx->csrRoamProfile.SSIDs.SSIDList[0].handoffPermitted = VOS_FALSE; |
| 253 | pSapCtx->csrRoamProfile.SSIDs.SSIDList[0].ssidHidden = pSapCtx->SSIDList[0].ssidHidden; |
| 254 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 255 | pSapCtx->csrRoamProfile.BSSIDs.numOfBSSIDs = 1; // This is true for now. |
| 256 | pSapCtx->csrRoamProfile.BSSIDs.bssid = &pSapCtx->bssid; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 257 | |
| 258 | // Now configure the auth type in the roaming profile. To open. |
| 259 | pSapCtx->csrRoamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; // open is the default |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 260 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 261 | if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pSapCtx->SapGlobalLock))) |
| 262 | { |
| 263 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 264 | "WLANSAP_Start failed init lock\n"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 265 | return VOS_STATUS_E_FAULT; |
| 266 | } |
| 267 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 268 | return VOS_STATUS_SUCCESS; |
| 269 | }/* WLANSAP_Start */ |
| 270 | |
| 271 | /*========================================================================== |
| 272 | |
| 273 | FUNCTION WLANSAP_Stop |
| 274 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 275 | DESCRIPTION |
| 276 | Called by vos_stop to stop operation in SAP, before close. SAP will suspend all |
| 277 | BT-AMP Protocol Adaption Layer operation and will wait for the close |
| 278 | request to clean up its resources. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 279 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 280 | DEPENDENCIES |
| 281 | |
| 282 | PARAMETERS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 283 | |
| 284 | IN |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 285 | pvosGCtx : Pointer to the global vos context; a handle to SAP's |
| 286 | control block can be extracted from its context |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 287 | |
| 288 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 289 | The result code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 290 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 291 | VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page |
| 292 | fault |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 293 | VOS_STATUS_SUCCESS: Success |
| 294 | |
| 295 | SIDE EFFECTS |
| 296 | ============================================================================*/ |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 297 | VOS_STATUS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 298 | WLANSAP_Stop |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 299 | ( |
| 300 | v_PVOID_t pvosGCtx |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 301 | ) |
| 302 | { |
| 303 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 304 | ptSapContext pSapCtx = NULL; |
| 305 | |
| 306 | /*------------------------------------------------------------------------ |
| 307 | Sanity check |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 308 | Extract SAP control block |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 309 | ------------------------------------------------------------------------*/ |
| 310 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, |
| 311 | "WLANSAP_Stop invoked successfully "); |
| 312 | |
| 313 | pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 314 | if (NULL == pSapCtx) |
| 315 | { |
| 316 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 317 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 318 | return VOS_STATUS_E_FAULT; |
| 319 | } |
| 320 | |
| 321 | sapFreeRoamProfile(&pSapCtx->csrRoamProfile); |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 322 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 323 | if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pSapCtx->SapGlobalLock ) ) ) |
| 324 | { |
| 325 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 326 | "WLANSAP_Stop failed destroy lock\n"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 327 | return VOS_STATUS_E_FAULT; |
| 328 | } |
| 329 | /*------------------------------------------------------------------------ |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 330 | Stop SAP (de-register RSN handler!?) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 331 | ------------------------------------------------------------------------*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 332 | |
| 333 | return VOS_STATUS_SUCCESS; |
| 334 | }/* WLANSAP_Stop */ |
| 335 | |
| 336 | /*========================================================================== |
| 337 | FUNCTION WLANSAP_Close |
| 338 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 339 | DESCRIPTION |
| 340 | Called by vos_close during general driver close procedure. SAP will clean up |
| 341 | all the internal resources. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 342 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 343 | DEPENDENCIES |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 344 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 345 | PARAMETERS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 346 | |
| 347 | IN |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 348 | pvosGCtx : Pointer to the global vos context; a handle to SAP's |
| 349 | control block can be extracted from its context |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 350 | |
| 351 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 352 | The result code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 353 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 354 | VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page |
| 355 | fault |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 356 | VOS_STATUS_SUCCESS: Success |
| 357 | |
| 358 | SIDE EFFECTS |
| 359 | ============================================================================*/ |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 360 | VOS_STATUS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 361 | WLANSAP_Close |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 362 | ( |
| 363 | v_PVOID_t pvosGCtx |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 364 | ) |
| 365 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 366 | ptSapContext pSapCtx = NULL; |
| 367 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 368 | |
| 369 | /*------------------------------------------------------------------------ |
| 370 | Sanity check |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 371 | Extract SAP control block |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 372 | ------------------------------------------------------------------------*/ |
| 373 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, |
| 374 | "WLANSAP_Close invoked"); |
| 375 | |
| 376 | pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 377 | if (NULL == pSapCtx) |
| 378 | { |
| 379 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 380 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 381 | return VOS_STATUS_E_FAULT; |
| 382 | } |
| 383 | |
| 384 | /*------------------------------------------------------------------------ |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 385 | Cleanup SAP control block. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 386 | ------------------------------------------------------------------------*/ |
| 387 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANSAP_Close"); |
| 388 | WLANSAP_CleanCB(pSapCtx, VOS_TRUE /* empty queues/lists/pkts if any*/); |
| 389 | |
| 390 | /*------------------------------------------------------------------------ |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 391 | Free SAP context from VOSS global |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 392 | ------------------------------------------------------------------------*/ |
| 393 | vos_free_context(pvosGCtx, VOS_MODULE_ID_SAP, pSapCtx); |
| 394 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 395 | return VOS_STATUS_SUCCESS; |
| 396 | }/* WLANSAP_Close */ |
| 397 | |
| 398 | /*---------------------------------------------------------------------------- |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 399 | * Utility Function implementations |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 400 | * -------------------------------------------------------------------------*/ |
| 401 | |
| 402 | /*========================================================================== |
| 403 | |
| 404 | FUNCTION WLANSAP_CleanCB |
| 405 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 406 | DESCRIPTION |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 407 | Clear out all fields in the SAP context. |
| 408 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 409 | DEPENDENCIES |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 410 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 411 | PARAMETERS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 412 | |
| 413 | IN |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 414 | pvosGCtx : Pointer to the global vos context; a handle to SAP's |
| 415 | control block can be extracted from its context |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 416 | |
| 417 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 418 | The result code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 419 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 420 | VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page |
| 421 | fault |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 422 | VOS_STATUS_SUCCESS: Success |
| 423 | |
| 424 | SIDE EFFECTS |
| 425 | ============================================================================*/ |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 426 | VOS_STATUS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 427 | WLANSAP_CleanCB |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 428 | ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 429 | ptSapContext pSapCtx, |
| 430 | v_U32_t freeFlag // 0 /*do not empty*/); |
| 431 | ) |
| 432 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 433 | /*------------------------------------------------------------------------ |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 434 | Sanity check SAP control block |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 435 | ------------------------------------------------------------------------*/ |
| 436 | |
| 437 | if (NULL == pSapCtx) |
| 438 | { |
| 439 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 440 | "%s: Invalid SAP pointer", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 441 | return VOS_STATUS_E_FAULT; |
| 442 | } |
| 443 | |
| 444 | /*------------------------------------------------------------------------ |
| 445 | Clean up SAP control block, initialize all values |
| 446 | ------------------------------------------------------------------------*/ |
| 447 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANSAP_CleanCB"); |
| 448 | |
| 449 | vos_mem_zero( pSapCtx, sizeof(tSapContext)); |
| 450 | |
| 451 | pSapCtx->pvosGCtx = NULL; |
| 452 | |
| 453 | pSapCtx->sapsMachine= eSAP_DISCONNECTED; |
| 454 | |
Jeff Johnson | 797280e | 2017-09-19 08:36:01 -0700 | [diff] [blame] | 455 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: Initializing State: %d, sapContext value = %pK", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 456 | __func__, pSapCtx->sapsMachine, pSapCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 457 | pSapCtx->sessionId = 0; |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 458 | pSapCtx->channel = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 459 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 460 | return VOS_STATUS_SUCCESS; |
| 461 | }// WLANSAP_CleanCB |
| 462 | |
| 463 | /*========================================================================== |
| 464 | FUNCTION WLANSAP_pmcFullPwrReqCB |
| 465 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 466 | DESCRIPTION |
| 467 | Callback provide to PMC in the pmcRequestFullPower API. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 468 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 469 | DEPENDENCIES |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 470 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 471 | PARAMETERS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 472 | |
| 473 | IN |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 474 | callbackContext: The user passed in a context to identify |
| 475 | status: The halStatus |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 476 | |
| 477 | RETURN VALUE |
| 478 | None |
| 479 | |
| 480 | SIDE EFFECTS |
| 481 | ============================================================================*/ |
| 482 | void |
| 483 | WLANSAP_pmcFullPwrReqCB |
| 484 | ( |
| 485 | void *callbackContext, |
| 486 | eHalStatus status |
| 487 | ) |
| 488 | { |
| 489 | if(HAL_STATUS_SUCCESS(status)) |
| 490 | { |
| 491 | //If success what else to be handled??? |
| 492 | } |
| 493 | else |
| 494 | { |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 495 | VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_FATAL, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 496 | "WLANSAP_pmcFullPwrReqCB: PMC failed to put the chip in Full power\n"); |
| 497 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 498 | } |
| 499 | |
| 500 | }// WLANSAP_pmcFullPwrReqCB |
| 501 | /*========================================================================== |
| 502 | FUNCTION WLANSAP_getState |
| 503 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 504 | DESCRIPTION |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 505 | This api returns the current SAP state to the caller. |
| 506 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 507 | DEPENDENCIES |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 508 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 509 | PARAMETERS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 510 | |
| 511 | IN |
| 512 | pContext : Pointer to Sap Context structure |
| 513 | |
| 514 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 515 | Returns the SAP FSM state. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 516 | ============================================================================*/ |
| 517 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 518 | v_U8_t WLANSAP_getState |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 519 | ( |
| 520 | v_PVOID_t pvosGCtx |
| 521 | ) |
| 522 | { |
| 523 | ptSapContext pSapCtx = NULL; |
| 524 | |
| 525 | pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 526 | |
| 527 | if ( NULL == pSapCtx ) |
| 528 | { |
| 529 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 530 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 531 | return VOS_STATUS_E_FAULT; |
| 532 | } |
| 533 | return pSapCtx->sapsMachine; |
| 534 | } |
Nishank Aggarwal | c11826c | 2016-12-15 18:54:10 +0530 | [diff] [blame] | 535 | /*========================================================================== |
| 536 | FUNCTION WLANSAP_get_sessionId |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 537 | |
Nishank Aggarwal | c11826c | 2016-12-15 18:54:10 +0530 | [diff] [blame] | 538 | DESCRIPTION |
| 539 | This api returns the current SAP sessionId to the caller. |
| 540 | |
| 541 | DEPENDENCIES |
| 542 | |
| 543 | PARAMETERS |
| 544 | |
| 545 | IN |
| 546 | pContext : Pointer to Sap Context structure |
| 547 | v_U8_t : Pointer to sessionID |
| 548 | |
| 549 | RETURN VALUE |
| 550 | VOS_STATUS_SUCCESS on success. |
| 551 | |
| 552 | VOS_STATUS_E_INVAL: Pointer to SAP cb is NULL ; access would cause a page |
| 553 | fault |
| 554 | ============================================================================*/ |
| 555 | VOS_STATUS WLANSAP_get_sessionId |
| 556 | ( |
| 557 | v_PVOID_t pvosGCtx, v_U8_t *sessionId |
| 558 | ) |
| 559 | { |
| 560 | ptSapContext pSapCtx = NULL; |
| 561 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 562 | |
| 563 | pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 564 | |
| 565 | if ( NULL == pSapCtx ) |
| 566 | { |
| 567 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, |
| 568 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
| 569 | status = VOS_STATUS_E_INVAL; |
| 570 | } |
| 571 | |
| 572 | if (pSapCtx->sapsMachine == eSAP_STARTED) { |
| 573 | *sessionId = pSapCtx->sessionId; |
| 574 | status = VOS_STATUS_SUCCESS; |
| 575 | } |
| 576 | else |
| 577 | status = VOS_STATUS_E_FAILURE; |
| 578 | |
| 579 | return status; |
| 580 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 581 | /*========================================================================== |
| 582 | FUNCTION WLANSAP_StartBss |
| 583 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 584 | DESCRIPTION |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 585 | This api function provides SAP FSM event eWLAN_SAP_PHYSICAL_LINK_CREATE for |
| 586 | starting AP BSS |
| 587 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 588 | DEPENDENCIES |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 589 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 590 | PARAMETERS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 591 | |
| 592 | IN |
| 593 | pContext : Pointer to Sap Context structure |
| 594 | pQctCommitConfig : Pointer to configuration structure passed down from HDD(HostApd for Android) |
| 595 | hdd_SapEventCallback: Callback function in HDD called by SAP to inform HDD about SAP results |
| 596 | pUsrContext : Parameter that will be passed back in all the SAP callback events. |
| 597 | |
| 598 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 599 | The result code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 600 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 601 | VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page |
| 602 | fault |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 603 | VOS_STATUS_SUCCESS: Success |
| 604 | |
| 605 | SIDE EFFECTS |
| 606 | ============================================================================*/ |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 607 | VOS_STATUS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 608 | WLANSAP_StartBss |
| 609 | ( |
| 610 | v_PVOID_t pvosGCtx,//pwextCtx |
| 611 | tpWLAN_SAPEventCB pSapEventCallback, |
| 612 | tsap_Config_t *pConfig, |
| 613 | v_PVOID_t pUsrContext |
| 614 | ) |
| 615 | { |
| 616 | tWLAN_SAPEvent sapEvent; /* State machine event*/ |
| 617 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 618 | ptSapContext pSapCtx = NULL; |
| 619 | tANI_BOOLEAN restartNeeded; |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 620 | tHalHandle hHal; |
| 621 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 622 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 623 | |
| 624 | /*------------------------------------------------------------------------ |
| 625 | Sanity check |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 626 | Extract SAP control block |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 627 | ------------------------------------------------------------------------*/ |
| 628 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, |
| 629 | "WLANSAP_StartBss"); |
| 630 | |
| 631 | if (VOS_STA_SAP_MODE == vos_get_conparam ()) |
| 632 | { |
| 633 | pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 634 | if ( NULL == pSapCtx ) |
| 635 | { |
| 636 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 637 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 638 | return VOS_STATUS_E_FAULT; |
| 639 | } |
| 640 | pSapCtx->sapsMachine = eSAP_DISCONNECTED; |
| 641 | |
| 642 | /* Channel selection is auto or configured */ |
| 643 | pSapCtx->channel = pConfig->channel; |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 644 | pSapCtx->scanBandPreference = pConfig->scanBandPreference; |
Peng Xu | afc34e3 | 2014-09-25 13:23:55 +0530 | [diff] [blame] | 645 | pSapCtx->acsBandSwitchThreshold = pConfig->acsBandSwitchThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 646 | pSapCtx->pUsrContext = pUsrContext; |
| 647 | |
| 648 | //Set the BSSID to your "self MAC Addr" read the mac address from Configuation ITEM received from HDD |
| 649 | pSapCtx->csrRoamProfile.BSSIDs.numOfBSSIDs = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 650 | |
| 651 | //Save a copy to SAP context |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 652 | vos_mem_copy(pSapCtx->csrRoamProfile.BSSIDs.bssid, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 653 | pConfig->self_macaddr.bytes, sizeof(v_MACADDR_t)); |
| 654 | vos_mem_copy(pSapCtx->self_mac_addr, |
| 655 | pConfig->self_macaddr.bytes, sizeof(v_MACADDR_t)); |
| 656 | |
| 657 | //copy the configuration items to csrProfile |
| 658 | sapconvertToCsrProfile( pConfig, eCSR_BSS_TYPE_INFRA_AP, &pSapCtx->csrRoamProfile); |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 659 | hHal = (tHalHandle)VOS_GET_HAL_CB(pvosGCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 660 | if (NULL == hHal) |
| 661 | { |
| 662 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 663 | "%s: Invalid MAC context from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 664 | } |
| 665 | else |
| 666 | { |
| 667 | //If concurrent session is running that is already associated |
| 668 | //then we just follow that sessions country info (whether |
| 669 | //present or not doesn't maater as we have to follow whatever |
| 670 | //STA session does) |
Rajkumar Manoharan | ed6fd54 | 2013-11-26 22:55:16 +0530 | [diff] [blame] | 671 | if ((0 == sme_GetConcurrentOperationChannel(hHal)) && |
| 672 | pConfig->ieee80211d) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 673 | { |
| 674 | /* Setting the region/country information */ |
| 675 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 676 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
| 677 | } |
| 678 | } |
| 679 | |
| 680 | // Copy MAC filtering settings to sap context |
| 681 | pSapCtx->eSapMacAddrAclMode = pConfig->SapMacaddr_acl; |
| 682 | vos_mem_copy(pSapCtx->acceptMacList, pConfig->accept_mac, sizeof(pConfig->accept_mac)); |
| 683 | pSapCtx->nAcceptMac = pConfig->num_accept_mac; |
| 684 | sapSortMacList(pSapCtx->acceptMacList, pSapCtx->nAcceptMac); |
| 685 | vos_mem_copy(pSapCtx->denyMacList, pConfig->deny_mac, sizeof(pConfig->deny_mac)); |
| 686 | pSapCtx->nDenyMac = pConfig->num_deny_mac; |
| 687 | sapSortMacList(pSapCtx->denyMacList, pSapCtx->nDenyMac); |
| 688 | |
| 689 | /* Fill in the event structure for FSM */ |
| 690 | sapEvent.event = eSAP_HDD_START_INFRA_BSS; |
| 691 | sapEvent.params = 0;//pSapPhysLinkCreate |
| 692 | |
| 693 | /* Store the HDD callback in SAP context */ |
| 694 | pSapCtx->pfnSapEventCallback = pSapEventCallback; |
| 695 | |
| 696 | /* Handle event*/ |
| 697 | vosStatus = sapFsm(pSapCtx, &sapEvent); |
| 698 | } |
| 699 | else |
| 700 | { |
| 701 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 702 | "SoftAp role has not been enabled"); |
| 703 | } |
| 704 | |
| 705 | return vosStatus; |
| 706 | }// WLANSAP_StartBss |
| 707 | |
| 708 | /*========================================================================== |
Gopichand Nakkala | cb9f219 | 2013-06-25 16:10:38 -0700 | [diff] [blame] | 709 | FUNCTION WLANSAP_SetMacACL |
| 710 | |
| 711 | DESCRIPTION |
| 712 | This api function provides SAP to set mac list entry in accept list as well |
| 713 | as deny list |
| 714 | |
| 715 | DEPENDENCIES |
| 716 | |
| 717 | PARAMETERS |
| 718 | |
| 719 | IN |
| 720 | pContext : Pointer to Sap Context structure |
| 721 | pQctCommitConfig : Pointer to configuration structure passed down from |
| 722 | HDD(HostApd for Android) |
| 723 | |
| 724 | RETURN VALUE |
| 725 | The result code associated with performing the operation |
| 726 | |
| 727 | VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page |
| 728 | fault |
| 729 | VOS_STATUS_SUCCESS: Success |
| 730 | |
| 731 | SIDE EFFECTS |
| 732 | ============================================================================*/ |
| 733 | VOS_STATUS |
| 734 | WLANSAP_SetMacACL |
| 735 | ( |
| 736 | v_PVOID_t pvosGCtx, //pwextCtx |
| 737 | tsap_Config_t *pConfig |
| 738 | ) |
| 739 | { |
| 740 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 741 | ptSapContext pSapCtx = NULL; |
| 742 | |
| 743 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, |
| 744 | "WLANSAP_SetMacACL"); |
| 745 | |
| 746 | if (VOS_STA_SAP_MODE == vos_get_conparam ()) |
| 747 | { |
| 748 | pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 749 | if ( NULL == pSapCtx ) |
| 750 | { |
| 751 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, |
| 752 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
| 753 | return VOS_STATUS_E_FAULT; |
| 754 | } |
| 755 | |
| 756 | // Copy MAC filtering settings to sap context |
| 757 | pSapCtx->eSapMacAddrAclMode = pConfig->SapMacaddr_acl; |
| 758 | |
| 759 | if (eSAP_DENY_UNLESS_ACCEPTED == pSapCtx->eSapMacAddrAclMode) |
| 760 | { |
| 761 | vos_mem_copy(pSapCtx->acceptMacList, pConfig->accept_mac, |
| 762 | sizeof(pConfig->accept_mac)); |
| 763 | pSapCtx->nAcceptMac = pConfig->num_accept_mac; |
| 764 | sapSortMacList(pSapCtx->acceptMacList, pSapCtx->nAcceptMac); |
| 765 | } |
| 766 | else if (eSAP_ACCEPT_UNLESS_DENIED == pSapCtx->eSapMacAddrAclMode) |
| 767 | { |
| 768 | vos_mem_copy(pSapCtx->denyMacList, pConfig->deny_mac, |
| 769 | sizeof(pConfig->deny_mac)); |
| 770 | pSapCtx->nDenyMac = pConfig->num_deny_mac; |
| 771 | sapSortMacList(pSapCtx->denyMacList, pSapCtx->nDenyMac); |
| 772 | } |
| 773 | } |
| 774 | else |
| 775 | { |
| 776 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 777 | "%s : SoftAp role has not been enabled", __func__); |
| 778 | return VOS_STATUS_E_FAULT; |
| 779 | } |
| 780 | |
| 781 | return vosStatus; |
| 782 | }//WLANSAP_SetMacACL |
| 783 | |
| 784 | /*========================================================================== |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 785 | FUNCTION WLANSAP_StopBss |
| 786 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 787 | DESCRIPTION |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 788 | This api function provides SAP FSM event eSAP_HDD_STOP_INFRA_BSS for |
| 789 | stopping AP BSS |
| 790 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 791 | DEPENDENCIES |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 792 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 793 | PARAMETERS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 794 | |
| 795 | IN |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 796 | pvosGCtx : Pointer to the global vos context; a handle to SAP's |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 797 | control block can be extracted from its contexe |
| 798 | |
| 799 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 800 | The result code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 801 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 802 | VOS_STATUS_E_FAULT: Pointer to VOSS GC is NULL ; access would cause a page |
| 803 | fault |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 804 | VOS_STATUS_SUCCESS: Success |
| 805 | |
| 806 | SIDE EFFECTS |
| 807 | ============================================================================*/ |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 808 | VOS_STATUS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 809 | WLANSAP_StopBss |
| 810 | ( |
| 811 | v_PVOID_t pvosGCtx |
| 812 | ) |
| 813 | { |
| 814 | tWLAN_SAPEvent sapEvent; /* State machine event*/ |
| 815 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 816 | ptSapContext pSapCtx = NULL; |
| 817 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 818 | |
| 819 | /*------------------------------------------------------------------------ |
| 820 | Sanity check |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 821 | Extract SAP control block |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 822 | ------------------------------------------------------------------------*/ |
| 823 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, |
| 824 | "WLANSAP_StopBss"); |
| 825 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 826 | if ( NULL == pvosGCtx ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 827 | { |
| 828 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 829 | "%s: Invalid Global VOSS handle", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 830 | return VOS_STATUS_E_FAULT; |
| 831 | } |
| 832 | |
| 833 | pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 834 | |
| 835 | if (NULL == pSapCtx ) |
| 836 | { |
| 837 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 838 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 839 | return VOS_STATUS_E_FAULT; |
| 840 | } |
| 841 | |
| 842 | /* Fill in the event structure for FSM */ |
| 843 | sapEvent.event = eSAP_HDD_STOP_INFRA_BSS; |
| 844 | sapEvent.params = 0; |
| 845 | |
| 846 | /* Handle event*/ |
| 847 | vosStatus = sapFsm(pSapCtx, &sapEvent); |
| 848 | |
| 849 | return vosStatus; |
| 850 | } |
| 851 | |
| 852 | /*========================================================================== |
| 853 | FUNCTION WLANSAP_GetAssocStations |
| 854 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 855 | DESCRIPTION |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 856 | This api function is used to probe the list of associated stations from various modules of CORE stack |
| 857 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 858 | DEPENDENCIES |
| 859 | NA. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 860 | |
| 861 | PARAMETERS |
| 862 | |
| 863 | IN |
| 864 | pvosGCtx : Pointer to vos global context structure |
| 865 | modId : Module from whom list of associtated stations is supposed to be probed. If an invalid module is passed |
| 866 | then by default VOS_MODULE_ID_PE will be probed |
| 867 | IN/OUT |
| 868 | pAssocStas : Pointer to list of associated stations that are known to the module specified in mod parameter |
| 869 | |
| 870 | NOTE: The memory for this list will be allocated by the caller of this API |
| 871 | |
| 872 | RETURN VALUE |
| 873 | The VOS_STATUS code associated with performing the operation |
| 874 | |
| 875 | VOS_STATUS_SUCCESS: Success |
| 876 | |
| 877 | SIDE EFFECTS |
| 878 | ============================================================================*/ |
| 879 | VOS_STATUS |
| 880 | WLANSAP_GetAssocStations |
| 881 | ( |
| 882 | v_PVOID_t pvosGCtx, |
| 883 | VOS_MODULE_ID modId, |
| 884 | tpSap_AssocMacAddr pAssocStas |
| 885 | ) |
| 886 | { |
| 887 | ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 888 | |
| 889 | /*------------------------------------------------------------------------ |
| 890 | Sanity check |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 891 | Extract SAP control block |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 892 | ------------------------------------------------------------------------*/ |
| 893 | if (NULL == pSapCtx) |
| 894 | { |
| 895 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 896 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 897 | return VOS_STATUS_E_FAULT; |
| 898 | } |
| 899 | |
| 900 | sme_RoamGetAssociatedStas( VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId, |
| 901 | modId, |
| 902 | pSapCtx->pUsrContext, |
| 903 | (v_PVOID_t *)pSapCtx->pfnSapEventCallback, |
| 904 | (v_U8_t *)pAssocStas ); |
| 905 | |
| 906 | return VOS_STATUS_SUCCESS; |
| 907 | } |
| 908 | |
| 909 | |
| 910 | /*========================================================================== |
| 911 | FUNCTION WLANSAP_RemoveWpsSessionOverlap |
| 912 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 913 | DESCRIPTION |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 914 | This api function provides for Ap App/HDD to remove an entry from session session overlap info. |
| 915 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 916 | DEPENDENCIES |
| 917 | NA. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 918 | |
| 919 | PARAMETERS |
| 920 | |
| 921 | IN |
| 922 | pvosGCtx: Pointer to vos global context structure |
| 923 | pRemoveMac: pointer to v_MACADDR_t for session MAC address |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 924 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 925 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 926 | The VOS_STATUS code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 927 | |
| 928 | VOS_STATUS_SUCCESS: Success |
| 929 | VOS_STATUS_E_FAULT: Session is not dectected. The parameter is function not valid. |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 930 | |
| 931 | SIDE EFFECTS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 932 | ============================================================================*/ |
| 933 | VOS_STATUS |
| 934 | WLANSAP_RemoveWpsSessionOverlap |
| 935 | |
| 936 | ( |
| 937 | v_PVOID_t pvosGCtx, |
| 938 | v_MACADDR_t pRemoveMac |
| 939 | ) |
| 940 | { |
| 941 | ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 942 | |
| 943 | /*------------------------------------------------------------------------ |
| 944 | Sanity check |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 945 | Extract SAP control block |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 946 | ------------------------------------------------------------------------*/ |
| 947 | if (NULL == pSapCtx) |
| 948 | { |
| 949 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 950 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 951 | return VOS_STATUS_E_FAULT; |
| 952 | } |
| 953 | |
| 954 | sme_RoamGetWpsSessionOverlap( VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId, |
| 955 | pSapCtx->pUsrContext, |
| 956 | (v_PVOID_t *)pSapCtx->pfnSapEventCallback, |
| 957 | pRemoveMac); |
| 958 | |
| 959 | return VOS_STATUS_SUCCESS; |
| 960 | } |
| 961 | |
| 962 | /*========================================================================== |
| 963 | FUNCTION WLANSAP_getWpsSessionOverlap |
| 964 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 965 | DESCRIPTION |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 966 | This api function provides for Ap App/HDD to get WPS session overlap info. |
| 967 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 968 | DEPENDENCIES |
| 969 | NA. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 970 | |
| 971 | PARAMETERS |
| 972 | |
| 973 | IN |
| 974 | pvosGCtx: Pointer to vos global context structure |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 975 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 976 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 977 | The VOS_STATUS code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 978 | |
| 979 | VOS_STATUS_SUCCESS: Success |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 980 | |
| 981 | SIDE EFFECTS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 982 | ============================================================================*/ |
| 983 | VOS_STATUS |
| 984 | WLANSAP_getWpsSessionOverlap |
| 985 | ( |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 986 | v_PVOID_t pvosGCtx |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 987 | ) |
| 988 | { |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 989 | v_MACADDR_t pRemoveMac = VOS_MAC_ADDR_ZERO_INITIALIZER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 990 | |
| 991 | ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 992 | |
| 993 | /*------------------------------------------------------------------------ |
| 994 | Sanity check |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 995 | Extract SAP control block |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 996 | ------------------------------------------------------------------------*/ |
| 997 | if (NULL == pSapCtx) |
| 998 | { |
| 999 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1000 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1001 | return VOS_STATUS_E_FAULT; |
| 1002 | } |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1003 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1004 | sme_RoamGetWpsSessionOverlap( VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId, |
| 1005 | pSapCtx->pUsrContext, |
| 1006 | (v_PVOID_t *)pSapCtx->pfnSapEventCallback, |
| 1007 | pRemoveMac); |
| 1008 | |
| 1009 | return VOS_STATUS_SUCCESS; |
| 1010 | } |
| 1011 | |
| 1012 | |
| 1013 | /* This routine will set the mode of operation for ACL dynamically*/ |
| 1014 | VOS_STATUS |
| 1015 | WLANSAP_SetMode ( v_PVOID_t pvosGCtx, v_U32_t mode) |
| 1016 | { |
| 1017 | ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 1018 | |
| 1019 | if (NULL == pSapCtx) |
| 1020 | { |
| 1021 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1022 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1023 | return VOS_STATUS_E_FAULT; |
| 1024 | } |
| 1025 | |
| 1026 | pSapCtx->eSapMacAddrAclMode = (eSapMacAddrACL)mode; |
| 1027 | return VOS_STATUS_SUCCESS; |
| 1028 | } |
| 1029 | |
| 1030 | /* This routine will clear all the entries in accept list as well as deny list */ |
| 1031 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1032 | VOS_STATUS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1033 | WLANSAP_ClearACL( v_PVOID_t pvosGCtx) |
| 1034 | { |
| 1035 | ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 1036 | v_U8_t i; |
| 1037 | |
| 1038 | if (NULL == pSapCtx) |
| 1039 | { |
| 1040 | return VOS_STATUS_E_RESOURCES; |
| 1041 | } |
| 1042 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1043 | if (pSapCtx->denyMacList != NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1044 | { |
| 1045 | for (i = 0; i < (pSapCtx->nDenyMac-1); i++) |
| 1046 | { |
| 1047 | vos_mem_zero((pSapCtx->denyMacList+i)->bytes, sizeof(v_MACADDR_t)); |
| 1048 | |
| 1049 | } |
| 1050 | } |
| 1051 | sapPrintACL(pSapCtx->denyMacList, pSapCtx->nDenyMac); |
| 1052 | pSapCtx->nDenyMac = 0; |
| 1053 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1054 | if (pSapCtx->acceptMacList!=NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1055 | { |
| 1056 | for (i = 0; i < (pSapCtx->nAcceptMac-1); i++) |
| 1057 | { |
| 1058 | vos_mem_zero((pSapCtx->acceptMacList+i)->bytes, sizeof(v_MACADDR_t)); |
| 1059 | |
| 1060 | } |
| 1061 | } |
| 1062 | sapPrintACL(pSapCtx->acceptMacList, pSapCtx->nAcceptMac); |
| 1063 | pSapCtx->nAcceptMac = 0; |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1064 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1065 | return VOS_STATUS_SUCCESS; |
| 1066 | } |
| 1067 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1068 | VOS_STATUS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1069 | WLANSAP_ModifyACL |
| 1070 | ( |
| 1071 | v_PVOID_t pvosGCtx, |
| 1072 | v_U8_t *pPeerStaMac, |
| 1073 | eSapACLType listType, |
| 1074 | eSapACLCmdType cmd |
| 1075 | ) |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1076 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1077 | eSapBool staInWhiteList=eSAP_FALSE, staInBlackList=eSAP_FALSE; |
| 1078 | v_U8_t staWLIndex, staBLIndex; |
| 1079 | ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 1080 | |
| 1081 | if (NULL == pSapCtx) |
| 1082 | { |
| 1083 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1084 | "%s: Invalid SAP Context", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1085 | return VOS_STATUS_E_FAULT; |
| 1086 | } |
| 1087 | |
| 1088 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,"Modify ACL entered\n" |
| 1089 | "Before modification of ACL\n" |
| 1090 | "size of accept and deny lists %d %d", |
| 1091 | pSapCtx->nAcceptMac, pSapCtx->nDenyMac); |
| 1092 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"*** WHITE LIST ***"); |
| 1093 | sapPrintACL(pSapCtx->acceptMacList, pSapCtx->nAcceptMac); |
| 1094 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"*** BLACK LIST ***"); |
| 1095 | sapPrintACL(pSapCtx->denyMacList, pSapCtx->nDenyMac); |
| 1096 | |
| 1097 | /* the expectation is a mac addr will not be in both the lists at the same time. |
| 1098 | It is the responsiblity of userspace to ensure this */ |
| 1099 | staInWhiteList = sapSearchMacList(pSapCtx->acceptMacList, pSapCtx->nAcceptMac, pPeerStaMac, &staWLIndex); |
| 1100 | staInBlackList = sapSearchMacList(pSapCtx->denyMacList, pSapCtx->nDenyMac, pPeerStaMac, &staBLIndex); |
| 1101 | |
| 1102 | if (staInWhiteList && staInBlackList) |
| 1103 | { |
| 1104 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 1105 | "Peer mac "MAC_ADDRESS_STR" found in white and black lists." |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1106 | "Initial lists passed incorrect. Cannot execute this command.", |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 1107 | MAC_ADDR_ARRAY(pPeerStaMac)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1108 | return VOS_STATUS_E_FAILURE; |
| 1109 | |
| 1110 | } |
| 1111 | |
| 1112 | switch(listType) |
| 1113 | { |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1114 | case eSAP_WHITE_LIST: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1115 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW, "cmd %d", cmd); |
| 1116 | if (cmd == ADD_STA_TO_ACL) |
| 1117 | { |
| 1118 | //error check |
| 1119 | // if list is already at max, return failure |
Gopichand Nakkala | cb9f219 | 2013-06-25 16:10:38 -0700 | [diff] [blame] | 1120 | if (pSapCtx->nAcceptMac == MAX_ACL_MAC_ADDRESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1121 | { |
| 1122 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 1123 | "White list is already maxed out. Cannot accept "MAC_ADDRESS_STR, |
| 1124 | MAC_ADDR_ARRAY(pPeerStaMac)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1125 | return VOS_STATUS_E_FAILURE; |
| 1126 | } |
| 1127 | if (staInWhiteList) |
| 1128 | { |
| 1129 | //Do nothing if already present in white list. Just print a warning |
| 1130 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 1131 | "MAC address already present in white list "MAC_ADDRESS_STR, |
| 1132 | MAC_ADDR_ARRAY(pPeerStaMac)); |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1133 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1134 | { |
| 1135 | if (staInBlackList) |
| 1136 | { |
| 1137 | //remove it from black list before adding to the white list |
| 1138 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN, |
| 1139 | "STA present in black list so first remove from it"); |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1140 | sapRemoveMacFromACL(pSapCtx->denyMacList, &pSapCtx->nDenyMac, staBLIndex); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1141 | } |
| 1142 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1143 | "... Now add to the white list"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1144 | sapAddMacToACL(pSapCtx->acceptMacList, &pSapCtx->nAcceptMac, pPeerStaMac); |
| 1145 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW, "size of accept and deny lists %d %d", |
| 1146 | pSapCtx->nAcceptMac, pSapCtx->nDenyMac); |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1147 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1148 | } |
| 1149 | else if (cmd == DELETE_STA_FROM_ACL) |
| 1150 | { |
| 1151 | if (staInWhiteList) |
| 1152 | { |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1153 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, "Delete from white list"); |
| 1154 | sapRemoveMacFromACL(pSapCtx->acceptMacList, &pSapCtx->nAcceptMac, staWLIndex); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1155 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW, "size of accept and deny lists %d %d", |
| 1156 | pSapCtx->nAcceptMac, pSapCtx->nDenyMac); |
| 1157 | } |
| 1158 | else |
| 1159 | { |
| 1160 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 1161 | "MAC address to be deleted is not present in the white list "MAC_ADDRESS_STR, |
| 1162 | MAC_ADDR_ARRAY(pPeerStaMac)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1163 | return VOS_STATUS_E_FAILURE; |
| 1164 | } |
| 1165 | } |
| 1166 | else |
| 1167 | { |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1168 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "Invalid cmd type passed"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1169 | return VOS_STATUS_E_FAILURE; |
| 1170 | } |
| 1171 | break; |
| 1172 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1173 | case eSAP_BLACK_LIST: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1174 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW, |
| 1175 | "cmd %d", cmd); |
| 1176 | if (cmd == ADD_STA_TO_ACL) |
| 1177 | { |
| 1178 | //error check |
| 1179 | // if list is already at max, return failure |
Gopichand Nakkala | cb9f219 | 2013-06-25 16:10:38 -0700 | [diff] [blame] | 1180 | if (pSapCtx->nDenyMac == MAX_ACL_MAC_ADDRESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1181 | { |
| 1182 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 1183 | "Black list is already maxed out. Cannot accept "MAC_ADDRESS_STR, |
| 1184 | MAC_ADDR_ARRAY(pPeerStaMac)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1185 | return VOS_STATUS_E_FAILURE; |
| 1186 | } |
| 1187 | if (staInBlackList) |
| 1188 | { |
| 1189 | //Do nothing if already present in white list |
| 1190 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 1191 | "MAC address already present in black list "MAC_ADDRESS_STR, |
| 1192 | MAC_ADDR_ARRAY(pPeerStaMac)); |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1193 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1194 | { |
| 1195 | if (staInWhiteList) |
| 1196 | { |
| 1197 | //remove it from white list before adding to the white list |
| 1198 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN, |
| 1199 | "Present in white list so first remove from it"); |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1200 | sapRemoveMacFromACL(pSapCtx->acceptMacList, &pSapCtx->nAcceptMac, staWLIndex); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1201 | } |
| 1202 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1203 | "... Now add to black list"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1204 | sapAddMacToACL(pSapCtx->denyMacList, &pSapCtx->nDenyMac, pPeerStaMac); |
| 1205 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,"size of accept and deny lists %d %d", |
| 1206 | pSapCtx->nAcceptMac, pSapCtx->nDenyMac); |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1207 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1208 | } |
| 1209 | else if (cmd == DELETE_STA_FROM_ACL) |
| 1210 | { |
| 1211 | if (staInBlackList) |
| 1212 | { |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1213 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, "Delete from black list"); |
| 1214 | sapRemoveMacFromACL(pSapCtx->denyMacList, &pSapCtx->nDenyMac, staBLIndex); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1215 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,"no accept and deny mac %d %d", |
| 1216 | pSapCtx->nAcceptMac, pSapCtx->nDenyMac); |
| 1217 | } |
| 1218 | else |
| 1219 | { |
| 1220 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 1221 | "MAC address to be deleted is not present in the black list "MAC_ADDRESS_STR, |
| 1222 | MAC_ADDR_ARRAY(pPeerStaMac)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1223 | return VOS_STATUS_E_FAILURE; |
| 1224 | } |
| 1225 | } |
| 1226 | else |
| 1227 | { |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1228 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "Invalid cmd type passed"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1229 | return VOS_STATUS_E_FAILURE; |
| 1230 | } |
| 1231 | break; |
| 1232 | |
| 1233 | default: |
| 1234 | { |
| 1235 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 1236 | "Invalid list type passed %d",listType); |
| 1237 | return VOS_STATUS_E_FAILURE; |
| 1238 | } |
| 1239 | } |
| 1240 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,"After modification of ACL"); |
| 1241 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"*** WHITE LIST ***"); |
| 1242 | sapPrintACL(pSapCtx->acceptMacList, pSapCtx->nAcceptMac); |
| 1243 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"*** BLACK LIST ***"); |
| 1244 | sapPrintACL(pSapCtx->denyMacList, pSapCtx->nDenyMac); |
| 1245 | return VOS_STATUS_SUCCESS; |
| 1246 | } |
| 1247 | |
| 1248 | /*========================================================================== |
| 1249 | FUNCTION WLANSAP_DisassocSta |
| 1250 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1251 | DESCRIPTION |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1252 | This api function provides for Ap App/HDD initiated disassociation of station |
| 1253 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1254 | DEPENDENCIES |
| 1255 | NA. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1256 | |
| 1257 | PARAMETERS |
| 1258 | |
| 1259 | IN |
| 1260 | pvosGCtx : Pointer to vos global context structure |
| 1261 | pPeerStaMac : Mac address of the station to disassociate |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1262 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1263 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1264 | The VOS_STATUS code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1265 | |
| 1266 | VOS_STATUS_SUCCESS: Success |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1267 | |
| 1268 | SIDE EFFECTS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1269 | ============================================================================*/ |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1270 | VOS_STATUS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1271 | WLANSAP_DisassocSta |
| 1272 | ( |
| 1273 | v_PVOID_t pvosGCtx, |
Anand N Sunkad | c205d95 | 2015-07-30 15:36:03 +0530 | [diff] [blame] | 1274 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 1275 | const v_U8_t *pPeerStaMac |
| 1276 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1277 | v_U8_t *pPeerStaMac |
Anand N Sunkad | c205d95 | 2015-07-30 15:36:03 +0530 | [diff] [blame] | 1278 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1279 | ) |
| 1280 | { |
| 1281 | ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 1282 | |
| 1283 | /*------------------------------------------------------------------------ |
| 1284 | Sanity check |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1285 | Extract SAP control block |
| 1286 | ------------------------------------------------------------------------*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1287 | if (NULL == pSapCtx) |
| 1288 | { |
| 1289 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1290 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1291 | return VOS_STATUS_E_FAULT; |
| 1292 | } |
| 1293 | |
| 1294 | sme_RoamDisconnectSta(VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId, |
| 1295 | pPeerStaMac); |
| 1296 | |
| 1297 | return VOS_STATUS_SUCCESS; |
| 1298 | } |
| 1299 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1300 | /*========================================================================== |
| 1301 | FUNCTION WLANSAP_DeauthSta |
| 1302 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1303 | DESCRIPTION |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1304 | This api function provides for Ap App/HDD initiated deauthentication of station |
| 1305 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1306 | DEPENDENCIES |
| 1307 | NA. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1308 | |
| 1309 | PARAMETERS |
| 1310 | |
| 1311 | IN |
| 1312 | pvosGCtx : Pointer to vos global context structure |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 1313 | pDelStaParams : Pointer to parameters of the station to |
| 1314 | deauthenticate |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1315 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1316 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1317 | The VOS_STATUS code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1318 | |
| 1319 | VOS_STATUS_SUCCESS: Success |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1320 | |
| 1321 | SIDE EFFECTS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1322 | ============================================================================*/ |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1323 | VOS_STATUS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1324 | WLANSAP_DeauthSta |
| 1325 | ( |
| 1326 | v_PVOID_t pvosGCtx, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 1327 | struct tagCsrDelStaParams *pDelStaParams |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1328 | ) |
| 1329 | { |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 1330 | eHalStatus halStatus = eHAL_STATUS_FAILURE; |
| 1331 | VOS_STATUS vosStatus = VOS_STATUS_E_FAULT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1332 | ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 1333 | |
| 1334 | /*------------------------------------------------------------------------ |
| 1335 | Sanity check |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1336 | Extract SAP control block |
| 1337 | ------------------------------------------------------------------------*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1338 | if (NULL == pSapCtx) |
| 1339 | { |
| 1340 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1341 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 1342 | return vosStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1343 | } |
| 1344 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 1345 | halStatus = sme_RoamDeauthSta(VOS_GET_HAL_CB(pSapCtx->pvosGCtx), |
| 1346 | pSapCtx->sessionId, pDelStaParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1347 | |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 1348 | if (halStatus == eHAL_STATUS_SUCCESS) |
| 1349 | { |
| 1350 | vosStatus = VOS_STATUS_SUCCESS; |
| 1351 | } |
| 1352 | return vosStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1353 | } |
| 1354 | /*========================================================================== |
| 1355 | FUNCTION WLANSAP_SetChannelRange |
| 1356 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1357 | DESCRIPTION |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1358 | This api function sets the range of channels for AP. |
| 1359 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1360 | DEPENDENCIES |
| 1361 | NA. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1362 | |
| 1363 | PARAMETERS |
| 1364 | |
| 1365 | IN |
| 1366 | startChannel : start channel |
| 1367 | endChannel : End channel |
| 1368 | operatingBand : Operating band (2.4GHz/5GHz) |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1369 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1370 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1371 | The VOS_STATUS code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1372 | |
| 1373 | VOS_STATUS_SUCCESS: Success |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1374 | |
| 1375 | SIDE EFFECTS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1376 | ============================================================================*/ |
| 1377 | VOS_STATUS |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1378 | WLANSAP_SetChannelRange(tHalHandle hHal,v_U8_t startChannel, v_U8_t endChannel, |
Leela Venkata Kiran Kumar Reddy Chirala | 9f6566c | 2014-09-05 19:06:58 +0530 | [diff] [blame] | 1379 | eSapOperatingBand operatingBand) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1380 | { |
| 1381 | |
| 1382 | v_U8_t validChannelFlag =0; |
| 1383 | v_U8_t loopStartCount =0; |
| 1384 | v_U8_t loopEndCount =0; |
| 1385 | v_U8_t bandStartChannel =0; |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1386 | v_U8_t bandEndChannel =0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1387 | |
| 1388 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, |
| 1389 | "WLANSAP_SetChannelRange:startChannel %d,EndChannel %d,Operatingband:%d", |
| 1390 | startChannel,endChannel,operatingBand); |
| 1391 | |
| 1392 | /*------------------------------------------------------------------------ |
| 1393 | Sanity check |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1394 | ------------------------------------------------------------------------*/ |
Jeff Johnson | bacdbcc | 2013-02-26 21:23:41 -0800 | [diff] [blame] | 1395 | if (( WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_STAMIN > operatingBand) || |
| 1396 | (WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_STAMAX < operatingBand)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1397 | { |
| 1398 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 1399 | "Invalid operatingBand on WLANSAP_SetChannelRange"); |
| 1400 | return VOS_STATUS_E_FAULT; |
| 1401 | } |
Jeff Johnson | bacdbcc | 2013-02-26 21:23:41 -0800 | [diff] [blame] | 1402 | if (( WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_STAMIN > startChannel) || |
| 1403 | (WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_STAMAX < startChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1404 | { |
| 1405 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 1406 | "Invalid startChannel value on WLANSAP_SetChannelRange"); |
| 1407 | return VOS_STATUS_E_FAULT; |
| 1408 | } |
Jeff Johnson | bacdbcc | 2013-02-26 21:23:41 -0800 | [diff] [blame] | 1409 | if (( WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_STAMIN > endChannel) || |
| 1410 | (WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_STAMAX < endChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1411 | { |
| 1412 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 1413 | "Invalid endChannel value on WLANSAP_SetChannelRange"); |
| 1414 | return VOS_STATUS_E_FAULT; |
| 1415 | } |
| 1416 | switch(operatingBand) |
| 1417 | { |
Deepthi Gowri | 7db41f3 | 2014-10-13 17:02:29 +0530 | [diff] [blame] | 1418 | case eSAP_RF_SUBBAND_2_4_GHZ: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1419 | bandStartChannel = RF_CHAN_1; |
| 1420 | bandEndChannel = RF_CHAN_14; |
| 1421 | break; |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1422 | |
Deepthi Gowri | 7db41f3 | 2014-10-13 17:02:29 +0530 | [diff] [blame] | 1423 | case eSAP_RF_SUBBAND_5_LOW_GHZ: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1424 | bandStartChannel = RF_CHAN_36; |
| 1425 | bandEndChannel = RF_CHAN_64; |
| 1426 | break; |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1427 | |
Deepthi Gowri | 7db41f3 | 2014-10-13 17:02:29 +0530 | [diff] [blame] | 1428 | case eSAP_RF_SUBBAND_5_MID_GHZ: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1429 | bandStartChannel = RF_CHAN_100; |
Leo Chang | 80de3c2 | 2013-11-26 10:52:12 -0800 | [diff] [blame] | 1430 | #ifndef FEATURE_WLAN_CH144 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1431 | bandEndChannel = RF_CHAN_140; |
Leo Chang | 80de3c2 | 2013-11-26 10:52:12 -0800 | [diff] [blame] | 1432 | #else |
| 1433 | bandEndChannel = RF_CHAN_144; |
| 1434 | #endif /* FEATURE_WLAN_CH144 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1435 | break; |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1436 | |
Deepthi Gowri | 7db41f3 | 2014-10-13 17:02:29 +0530 | [diff] [blame] | 1437 | case eSAP_RF_SUBBAND_5_HIGH_GHZ: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1438 | bandStartChannel = RF_CHAN_149; |
| 1439 | bandEndChannel = RF_CHAN_165; |
| 1440 | break; |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1441 | |
Deepthi Gowri | 7db41f3 | 2014-10-13 17:02:29 +0530 | [diff] [blame] | 1442 | case eSAP_RF_SUBBAND_5_ALL_GHZ: |
| 1443 | bandStartChannel = RF_CHAN_36; |
| 1444 | bandEndChannel = RF_CHAN_165; |
| 1445 | break; |
| 1446 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1447 | default: |
| 1448 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 1449 | "Invalid operatingBand value on WLANSAP_SetChannelRange"); |
| 1450 | break; |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1451 | } |
| 1452 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1453 | /* Validating the start channel is in range or not*/ |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1454 | for(loopStartCount = bandStartChannel ; loopStartCount <= bandEndChannel ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1455 | loopStartCount++) |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1456 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1457 | if(rfChannels[loopStartCount].channelNum == startChannel ) |
| 1458 | { |
| 1459 | /* start channel is in the range */ |
| 1460 | break; |
| 1461 | } |
| 1462 | } |
| 1463 | /* Validating the End channel is in range or not*/ |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1464 | for(loopEndCount = bandStartChannel ; loopEndCount <= bandEndChannel ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1465 | loopEndCount++) |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1466 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1467 | if(rfChannels[loopEndCount].channelNum == endChannel ) |
| 1468 | { |
| 1469 | /* End channel is in the range */ |
| 1470 | break; |
| 1471 | } |
| 1472 | } |
| 1473 | if((loopStartCount > bandEndChannel)||(loopEndCount > bandEndChannel)) |
| 1474 | { |
| 1475 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 1476 | "%s: Invalid startChannel-%d or EndChannel-%d for band -%d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1477 | __func__,startChannel,endChannel,operatingBand); |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1478 | /* Supplied channels are nt in the operating band so set the default |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1479 | channels for the given operating band */ |
| 1480 | startChannel = rfChannels[bandStartChannel].channelNum; |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 1481 | endChannel = rfChannels[bandEndChannel].channelNum; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1482 | } |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1483 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1484 | /*Search for the Active channels in the given range */ |
| 1485 | for( loopStartCount = bandStartChannel; loopStartCount <= bandEndChannel; loopStartCount++ ) |
| 1486 | { |
| 1487 | if((startChannel <= rfChannels[loopStartCount].channelNum)&& |
| 1488 | (endChannel >= rfChannels[loopStartCount].channelNum )) |
| 1489 | { |
| 1490 | if( regChannels[loopStartCount].enabled ) |
| 1491 | { |
| 1492 | validChannelFlag = 1; |
| 1493 | break; |
| 1494 | } |
| 1495 | } |
| 1496 | } |
| 1497 | if(0 == validChannelFlag) |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1498 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1499 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 1500 | "%s-No active channels present in the given range for the current region", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1501 | __func__); |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1502 | /* There is no active channel in the supplied range.Updating the config |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1503 | with the default channels in the given band so that we can select the best channel in the sub-band*/ |
| 1504 | startChannel = rfChannels[bandStartChannel].channelNum; |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 1505 | endChannel = rfChannels[bandEndChannel].channelNum; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1506 | } |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1507 | |
| 1508 | if (ccmCfgSetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1509 | operatingBand, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 1510 | { |
| 1511 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 1512 | "Could not pass on WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND to CCn"); |
| 1513 | return VOS_STATUS_E_FAULT; |
| 1514 | } |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1515 | if (ccmCfgSetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1516 | startChannel, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 1517 | { |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1518 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1519 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 1520 | "Could not pass on WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL to CCM"); |
| 1521 | return VOS_STATUS_E_FAULT; |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1522 | |
| 1523 | } |
| 1524 | if (ccmCfgSetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1525 | endChannel, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 1526 | { |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1527 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1528 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 1529 | "Could not pass on WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL to CCM"); |
| 1530 | return VOS_STATUS_E_FAULT; |
| 1531 | } |
| 1532 | return VOS_STATUS_SUCCESS; |
| 1533 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1534 | |
| 1535 | /*========================================================================== |
| 1536 | FUNCTION WLANSAP_SetCounterMeasure |
| 1537 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1538 | DESCRIPTION |
| 1539 | This api function is used to disassociate all the stations and prevent |
| 1540 | association for any other station.Whenever Authenticator receives 2 mic failures |
| 1541 | within 60 seconds, Authenticator will enable counter measure at SAP Layer. |
| 1542 | Authenticator will start the 60 seconds timer. Core stack will not allow any |
| 1543 | STA to associate till HDD disables counter meassure. Core stack shall kick out all the |
| 1544 | STA which are currently associated and DIASSOC Event will be propogated to HDD for |
| 1545 | each STA to clean up the HDD STA table.Once the 60 seconds timer expires, Authenticator |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1546 | will disable the counter meassure at core stack. Now core stack can allow STAs to associate. |
| 1547 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1548 | DEPENDENCIES |
| 1549 | NA. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1550 | |
| 1551 | PARAMETERS |
| 1552 | |
| 1553 | IN |
| 1554 | pvosGCtx: Pointer to vos global context structure |
| 1555 | bEnable: If TRUE than all stations will be disassociated and no more will be allowed to associate. If FALSE than CORE |
| 1556 | will come out of this state. |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1557 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1558 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1559 | The VOS_STATUS code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1560 | |
| 1561 | VOS_STATUS_SUCCESS: Success |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1562 | |
| 1563 | SIDE EFFECTS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1564 | ============================================================================*/ |
| 1565 | VOS_STATUS |
| 1566 | WLANSAP_SetCounterMeasure |
| 1567 | ( |
| 1568 | v_PVOID_t pvosGCtx, |
| 1569 | v_BOOL_t bEnable |
| 1570 | ) |
| 1571 | { |
| 1572 | ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 1573 | |
| 1574 | /*------------------------------------------------------------------------ |
| 1575 | Sanity check |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1576 | Extract SAP control block |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1577 | ------------------------------------------------------------------------*/ |
| 1578 | if (NULL == pSapCtx) |
| 1579 | { |
| 1580 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1581 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1582 | return VOS_STATUS_E_FAULT; |
| 1583 | } |
| 1584 | |
| 1585 | sme_RoamTKIPCounterMeasures(VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId, bEnable); |
| 1586 | |
| 1587 | return VOS_STATUS_SUCCESS; |
| 1588 | } |
| 1589 | |
| 1590 | /*========================================================================== |
| 1591 | |
| 1592 | FUNCTION WLANSAP_SetKeysSta |
| 1593 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1594 | DESCRIPTION |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1595 | This api function provides for Ap App/HDD to set key for a station. |
| 1596 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1597 | DEPENDENCIES |
| 1598 | NA. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1599 | |
| 1600 | PARAMETERS |
| 1601 | |
| 1602 | IN |
| 1603 | pvosGCtx: Pointer to vos global context structure |
| 1604 | pSetKeyInfo: tCsrRoamSetKey structure for the station |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1605 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1606 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1607 | The VOS_STATUS code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1608 | |
| 1609 | VOS_STATUS_SUCCESS: Success |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1610 | |
| 1611 | SIDE EFFECTS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1612 | ============================================================================*/ |
| 1613 | VOS_STATUS |
| 1614 | WLANSAP_SetKeySta |
| 1615 | ( |
| 1616 | v_PVOID_t pvosGCtx, tCsrRoamSetKey *pSetKeyInfo |
| 1617 | ) |
| 1618 | { |
| 1619 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 1620 | ptSapContext pSapCtx = NULL; |
| 1621 | v_PVOID_t hHal = NULL; |
| 1622 | eHalStatus halStatus = eHAL_STATUS_FAILURE; |
| 1623 | v_U32_t roamId=0xFF; |
| 1624 | |
| 1625 | if (VOS_STA_SAP_MODE == vos_get_conparam ( )) |
| 1626 | { |
| 1627 | pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 1628 | if (NULL == pSapCtx) |
| 1629 | { |
| 1630 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1631 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1632 | return VOS_STATUS_E_FAULT; |
| 1633 | } |
| 1634 | hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx); |
| 1635 | if (NULL == hHal) |
| 1636 | { |
| 1637 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1638 | "%s: Invalid HAL pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1639 | return VOS_STATUS_E_FAULT; |
| 1640 | } |
| 1641 | halStatus = sme_RoamSetKey(hHal, pSapCtx->sessionId, pSetKeyInfo, &roamId); |
| 1642 | |
| 1643 | if (halStatus == eHAL_STATUS_SUCCESS) |
| 1644 | { |
| 1645 | vosStatus = VOS_STATUS_SUCCESS; |
| 1646 | } else |
| 1647 | { |
| 1648 | vosStatus = VOS_STATUS_E_FAULT; |
| 1649 | } |
| 1650 | } |
| 1651 | else |
| 1652 | vosStatus = VOS_STATUS_E_FAULT; |
| 1653 | |
| 1654 | return vosStatus; |
| 1655 | } |
| 1656 | |
| 1657 | /*========================================================================== |
| 1658 | FUNCTION WLANSAP_DelKeySta |
| 1659 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1660 | DESCRIPTION |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1661 | This api function provides for Ap App/HDD to delete key for a station. |
| 1662 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1663 | DEPENDENCIES |
| 1664 | NA. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1665 | |
| 1666 | PARAMETERS |
| 1667 | |
| 1668 | IN |
| 1669 | pvosGCtx: Pointer to vos global context structure |
| 1670 | pSetKeyInfo: tCsrRoamRemoveKey structure for the station |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1671 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1672 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1673 | The VOS_STATUS code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1674 | |
| 1675 | VOS_STATUS_SUCCESS: Success |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1676 | |
| 1677 | SIDE EFFECTS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1678 | ============================================================================*/ |
| 1679 | VOS_STATUS |
| 1680 | WLANSAP_DelKeySta |
| 1681 | ( |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1682 | v_PVOID_t pvosGCtx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1683 | tCsrRoamRemoveKey *pRemoveKeyInfo |
| 1684 | ) |
| 1685 | { |
| 1686 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 1687 | ptSapContext pSapCtx = NULL; |
| 1688 | v_PVOID_t hHal = NULL; |
| 1689 | eHalStatus halStatus = eHAL_STATUS_FAILURE; |
| 1690 | v_U32_t roamId=0xFF; |
| 1691 | tCsrRoamRemoveKey RemoveKeyInfo; |
| 1692 | |
| 1693 | if (VOS_STA_SAP_MODE == vos_get_conparam ( )) |
| 1694 | { |
| 1695 | pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 1696 | if (NULL == pSapCtx) |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1697 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1698 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1699 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1700 | return VOS_STATUS_E_FAULT; |
| 1701 | } |
| 1702 | |
| 1703 | hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx); |
| 1704 | if (NULL == hHal) |
| 1705 | { |
| 1706 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1707 | "%s: Invalid HAL pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1708 | return VOS_STATUS_E_FAULT; |
| 1709 | } |
| 1710 | |
| 1711 | vos_mem_zero(&RemoveKeyInfo, sizeof(RemoveKeyInfo)); |
| 1712 | RemoveKeyInfo.encType = pRemoveKeyInfo->encType; |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1713 | vos_mem_copy(RemoveKeyInfo.peerMac, pRemoveKeyInfo->peerMac, WNI_CFG_BSSID_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1714 | RemoveKeyInfo.keyId = pRemoveKeyInfo->keyId; |
| 1715 | |
| 1716 | halStatus = sme_RoamRemoveKey(hHal, pSapCtx->sessionId, &RemoveKeyInfo, &roamId); |
| 1717 | |
| 1718 | if (HAL_STATUS_SUCCESS(halStatus)) |
| 1719 | { |
| 1720 | vosStatus = VOS_STATUS_SUCCESS; |
| 1721 | } |
| 1722 | else |
| 1723 | { |
| 1724 | vosStatus = VOS_STATUS_E_FAULT; |
| 1725 | } |
| 1726 | } |
| 1727 | else |
| 1728 | vosStatus = VOS_STATUS_E_FAULT; |
| 1729 | |
| 1730 | return vosStatus; |
| 1731 | } |
| 1732 | |
| 1733 | VOS_STATUS |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1734 | WLANSap_getstationIE_information(v_PVOID_t pvosGCtx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1735 | v_U32_t *pLen, |
| 1736 | v_U8_t *pBuf) |
| 1737 | { |
| 1738 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 1739 | ptSapContext pSapCtx = NULL; |
| 1740 | v_U32_t len = 0; |
| 1741 | |
| 1742 | if (VOS_STA_SAP_MODE == vos_get_conparam ( )){ |
| 1743 | pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 1744 | if (NULL == pSapCtx) |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1745 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1746 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1747 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1748 | return VOS_STATUS_E_FAULT; |
| 1749 | } |
| 1750 | if (pLen) |
| 1751 | { |
| 1752 | len = *pLen; |
| 1753 | *pLen = pSapCtx->nStaWPARSnReqIeLength; |
| 1754 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1755 | "%s: WPAIE len : %x", __func__, *pLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1756 | if(pBuf) |
| 1757 | { |
| 1758 | if(len >= pSapCtx->nStaWPARSnReqIeLength) |
| 1759 | { |
| 1760 | vos_mem_copy( pBuf, pSapCtx->pStaWpaRsnReqIE, pSapCtx->nStaWPARSnReqIeLength); |
| 1761 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, |
| 1762 | "%s: WPAIE: %02x:%02x:%02x:%02x:%02x:%02x", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1763 | __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1764 | pBuf[0], pBuf[1], pBuf[2], |
| 1765 | pBuf[3], pBuf[4], pBuf[5]); |
| 1766 | vosStatus = VOS_STATUS_SUCCESS; |
| 1767 | } |
| 1768 | } |
| 1769 | } |
| 1770 | } |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1771 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1772 | if( VOS_STATUS_E_FAILURE == vosStatus) |
| 1773 | { |
| 1774 | VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 1775 | "%s: Error unable to populate the RSNWPAIE", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1776 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1777 | } |
| 1778 | |
| 1779 | return vosStatus; |
| 1780 | |
| 1781 | } |
| 1782 | |
| 1783 | /*========================================================================== |
| 1784 | FUNCTION WLANSAP_Set_WpsIe |
| 1785 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1786 | DESCRIPTION |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1787 | This api function provides for Ap App/HDD to set WPS IE. |
| 1788 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1789 | DEPENDENCIES |
| 1790 | NA. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1791 | |
| 1792 | PARAMETERS |
| 1793 | |
| 1794 | IN |
| 1795 | pvosGCtx: Pointer to vos global context structure |
| 1796 | pWPSIE: tSap_WPSIE structure that include WPS IEs |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1797 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1798 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1799 | The VOS_STATUS code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1800 | |
| 1801 | VOS_STATUS_SUCCESS: Success |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1802 | |
| 1803 | SIDE EFFECTS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1804 | ============================================================================*/ |
| 1805 | VOS_STATUS |
| 1806 | WLANSAP_Set_WpsIe |
| 1807 | ( |
| 1808 | v_PVOID_t pvosGCtx, tSap_WPSIE *pSap_WPSIe |
| 1809 | ) |
| 1810 | { |
| 1811 | ptSapContext pSapCtx = NULL; |
| 1812 | v_PVOID_t hHal = NULL; |
| 1813 | |
| 1814 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1815 | "%s, %d", __func__, __LINE__); |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1816 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1817 | if(VOS_STA_SAP_MODE == vos_get_conparam ( )) { |
| 1818 | pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 1819 | if ( NULL == pSapCtx ) |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1820 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1821 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1822 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1823 | return VOS_STATUS_E_FAULT; |
| 1824 | } |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1825 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1826 | hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx); |
| 1827 | if ( NULL == hHal ){ |
| 1828 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1829 | "%s: Invalid HAL pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1830 | return VOS_STATUS_E_FAULT; |
| 1831 | } |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1832 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1833 | if ( sap_AcquireGlobalLock( pSapCtx ) == VOS_STATUS_SUCCESS ) |
| 1834 | { |
| 1835 | if (pSap_WPSIe->sapWPSIECode == eSAP_WPS_BEACON_IE) |
| 1836 | { |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1837 | vos_mem_copy(&pSapCtx->APWPSIEs.SirWPSBeaconIE, &pSap_WPSIe->sapwpsie.sapWPSBeaconIE, sizeof(tSap_WPSBeaconIE)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1838 | } |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1839 | else if (pSap_WPSIe->sapWPSIECode == eSAP_WPS_PROBE_RSP_IE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1840 | { |
| 1841 | vos_mem_copy(&pSapCtx->APWPSIEs.SirWPSProbeRspIE, &pSap_WPSIe->sapwpsie.sapWPSProbeRspIE, sizeof(tSap_WPSProbeRspIE)); |
| 1842 | } |
| 1843 | else |
| 1844 | { |
| 1845 | sap_ReleaseGlobalLock( pSapCtx ); |
| 1846 | return VOS_STATUS_E_FAULT; |
| 1847 | } |
| 1848 | sap_ReleaseGlobalLock( pSapCtx ); |
| 1849 | return VOS_STATUS_SUCCESS; |
| 1850 | } |
| 1851 | else |
| 1852 | return VOS_STATUS_E_FAULT; |
| 1853 | } |
| 1854 | else |
| 1855 | return VOS_STATUS_E_FAULT; |
| 1856 | } |
| 1857 | |
| 1858 | /*========================================================================== |
| 1859 | FUNCTION WLANSAP_Update_WpsIe |
| 1860 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1861 | DESCRIPTION |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1862 | This api function provides for Ap App/HDD to update WPS IEs. |
| 1863 | |
| 1864 | DEPENDENCIES |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1865 | NA. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1866 | |
| 1867 | PARAMETERS |
| 1868 | |
| 1869 | IN |
| 1870 | pvosGCtx: Pointer to vos global context structure |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1871 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1872 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1873 | The VOS_STATUS code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1874 | |
| 1875 | VOS_STATUS_SUCCESS: Success |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1876 | |
| 1877 | SIDE EFFECTS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1878 | ============================================================================*/ |
| 1879 | VOS_STATUS |
| 1880 | WLANSAP_Update_WpsIe |
| 1881 | ( |
| 1882 | v_PVOID_t pvosGCtx |
| 1883 | ) |
| 1884 | { |
| 1885 | VOS_STATUS vosStatus = VOS_STATUS_E_FAULT; |
| 1886 | ptSapContext pSapCtx = NULL; |
| 1887 | eHalStatus halStatus = eHAL_STATUS_FAILURE; |
| 1888 | v_PVOID_t hHal = NULL; |
| 1889 | |
| 1890 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1891 | "%s, %d", __func__, __LINE__); |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1892 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1893 | if(VOS_STA_SAP_MODE == vos_get_conparam ( )){ |
| 1894 | pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 1895 | if ( NULL == pSapCtx ) |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1896 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1897 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1898 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1899 | return VOS_STATUS_E_FAULT; |
| 1900 | } |
| 1901 | |
| 1902 | hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx); |
| 1903 | if ( NULL == hHal ){ |
| 1904 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1905 | "%s: Invalid HAL pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1906 | return VOS_STATUS_E_FAULT; |
| 1907 | } |
| 1908 | |
| 1909 | halStatus = sme_RoamUpdateAPWPSIE( hHal, pSapCtx->sessionId, &pSapCtx->APWPSIEs); |
| 1910 | |
| 1911 | if(halStatus == eHAL_STATUS_SUCCESS) { |
| 1912 | vosStatus = VOS_STATUS_SUCCESS; |
| 1913 | } else |
| 1914 | { |
| 1915 | vosStatus = VOS_STATUS_E_FAULT; |
| 1916 | } |
| 1917 | |
| 1918 | } |
| 1919 | |
| 1920 | return vosStatus; |
| 1921 | } |
| 1922 | |
| 1923 | /*========================================================================== |
| 1924 | FUNCTION WLANSAP_Get_WPS_State |
| 1925 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1926 | DESCRIPTION |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1927 | This api function provides for Ap App/HDD to check if WPS session in process. |
| 1928 | |
| 1929 | DEPENDENCIES |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1930 | NA. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1931 | |
| 1932 | PARAMETERS |
| 1933 | |
| 1934 | IN |
| 1935 | pvosGCtx: Pointer to vos global context structure |
| 1936 | |
| 1937 | OUT |
| 1938 | pbWPSState: Pointer to variable to indicate if it is in WPS Registration state |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1939 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1940 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1941 | The VOS_STATUS code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1942 | |
| 1943 | VOS_STATUS_SUCCESS: Success |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1944 | |
| 1945 | SIDE EFFECTS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1946 | ============================================================================*/ |
| 1947 | VOS_STATUS |
| 1948 | WLANSAP_Get_WPS_State |
| 1949 | ( |
| 1950 | v_PVOID_t pvosGCtx, v_BOOL_t *bWPSState |
| 1951 | ) |
| 1952 | { |
| 1953 | ptSapContext pSapCtx = NULL; |
| 1954 | v_PVOID_t hHal = NULL; |
| 1955 | |
| 1956 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1957 | "%s, %d", __func__, __LINE__); |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1958 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1959 | if(VOS_STA_SAP_MODE == vos_get_conparam ( )){ |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1960 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1961 | pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 1962 | if ( NULL == pSapCtx ) |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1963 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1964 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1965 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1966 | return VOS_STATUS_E_FAULT; |
| 1967 | } |
| 1968 | |
| 1969 | hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx); |
| 1970 | if ( NULL == hHal ){ |
| 1971 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1972 | "%s: Invalid HAL pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1973 | return VOS_STATUS_E_FAULT; |
| 1974 | } |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1975 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1976 | if ( sap_AcquireGlobalLock(pSapCtx ) == VOS_STATUS_SUCCESS ) |
| 1977 | { |
| 1978 | if(pSapCtx->APWPSIEs.SirWPSProbeRspIE.FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT) |
| 1979 | *bWPSState = eANI_BOOLEAN_TRUE; |
| 1980 | else |
| 1981 | *bWPSState = eANI_BOOLEAN_FALSE; |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1982 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1983 | sap_ReleaseGlobalLock( pSapCtx ); |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1984 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1985 | return VOS_STATUS_SUCCESS; |
| 1986 | } |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1987 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1988 | return VOS_STATUS_E_FAULT; |
| 1989 | } |
| 1990 | else |
| 1991 | return VOS_STATUS_E_FAULT; |
| 1992 | |
| 1993 | } |
| 1994 | |
| 1995 | VOS_STATUS |
| 1996 | sap_AcquireGlobalLock |
| 1997 | ( |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 1998 | ptSapContext pSapCtx |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1999 | ) |
| 2000 | { |
| 2001 | VOS_STATUS vosStatus = VOS_STATUS_E_FAULT; |
| 2002 | |
| 2003 | if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &pSapCtx->SapGlobalLock) ) ) |
| 2004 | { |
| 2005 | vosStatus = VOS_STATUS_SUCCESS; |
| 2006 | } |
| 2007 | |
| 2008 | return (vosStatus); |
| 2009 | } |
| 2010 | |
| 2011 | VOS_STATUS |
| 2012 | sap_ReleaseGlobalLock |
| 2013 | ( |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2014 | ptSapContext pSapCtx |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2015 | ) |
| 2016 | { |
| 2017 | VOS_STATUS vosStatus = VOS_STATUS_E_FAULT; |
| 2018 | |
| 2019 | if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &pSapCtx->SapGlobalLock) ) ) |
| 2020 | { |
| 2021 | vosStatus = VOS_STATUS_SUCCESS; |
| 2022 | } |
| 2023 | |
| 2024 | return (vosStatus); |
| 2025 | } |
| 2026 | |
| 2027 | /*========================================================================== |
| 2028 | FUNCTION WLANSAP_Set_WPARSNIes |
| 2029 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2030 | DESCRIPTION |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2031 | This api function provides for Ap App/HDD to set AP WPA and RSN IE in its beacon and probe response. |
| 2032 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2033 | DEPENDENCIES |
| 2034 | NA. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2035 | |
| 2036 | PARAMETERS |
| 2037 | |
| 2038 | IN |
| 2039 | pvosGCtx: Pointer to vos global context structure |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2040 | pWPARSNIEs: buffer to the WPA/RSN IEs |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2041 | WPARSNIEsLen: length of WPA/RSN IEs |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2042 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2043 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2044 | The VOS_STATUS code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2045 | |
| 2046 | VOS_STATUS_SUCCESS: Success |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2047 | |
| 2048 | SIDE EFFECTS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2049 | ============================================================================*/ |
| 2050 | VOS_STATUS WLANSAP_Set_WPARSNIes(v_PVOID_t pvosGCtx, v_U8_t *pWPARSNIEs, v_U32_t WPARSNIEsLen) |
| 2051 | { |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2052 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2053 | ptSapContext pSapCtx = NULL; |
| 2054 | eHalStatus halStatus = eHAL_STATUS_FAILURE; |
| 2055 | v_PVOID_t hHal = NULL; |
| 2056 | |
| 2057 | if(VOS_STA_SAP_MODE == vos_get_conparam ( )){ |
| 2058 | pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 2059 | if ( NULL == pSapCtx ) |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2060 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2061 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2062 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2063 | return VOS_STATUS_E_FAULT; |
| 2064 | } |
| 2065 | |
| 2066 | hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx); |
| 2067 | if ( NULL == hHal ){ |
| 2068 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2069 | "%s: Invalid HAL pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2070 | return VOS_STATUS_E_FAULT; |
| 2071 | } |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2072 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2073 | pSapCtx->APWPARSNIEs.length = (tANI_U16)WPARSNIEsLen; |
| 2074 | vos_mem_copy(pSapCtx->APWPARSNIEs.rsnIEdata, pWPARSNIEs, WPARSNIEsLen); |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2075 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2076 | halStatus = sme_RoamUpdateAPWPARSNIEs( hHal, pSapCtx->sessionId, &pSapCtx->APWPARSNIEs); |
| 2077 | |
| 2078 | if(halStatus == eHAL_STATUS_SUCCESS) { |
| 2079 | return VOS_STATUS_SUCCESS; |
| 2080 | } else |
| 2081 | { |
| 2082 | return VOS_STATUS_E_FAULT; |
| 2083 | } |
| 2084 | } |
| 2085 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2086 | return VOS_STATUS_E_FAULT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2087 | } |
| 2088 | |
| 2089 | VOS_STATUS WLANSAP_GetStatistics(v_PVOID_t pvosGCtx, tSap_SoftapStats *statBuf, v_BOOL_t bReset) |
| 2090 | { |
| 2091 | if (NULL == pvosGCtx) |
| 2092 | { |
| 2093 | return VOS_STATUS_E_FAULT; |
| 2094 | } |
| 2095 | |
| 2096 | return (WLANTL_GetSoftAPStatistics(pvosGCtx, statBuf, bReset)); |
| 2097 | } |
| 2098 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2099 | /*========================================================================== |
| 2100 | |
| 2101 | FUNCTION WLANSAP_SendAction |
| 2102 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2103 | DESCRIPTION |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2104 | This api function provides to send action frame sent by upper layer. |
| 2105 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2106 | DEPENDENCIES |
| 2107 | NA. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2108 | |
| 2109 | PARAMETERS |
| 2110 | |
| 2111 | IN |
| 2112 | pvosGCtx: Pointer to vos global context structure |
| 2113 | pBuf: Pointer of the action frame to be transmitted |
| 2114 | len: Length of the action frame |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2115 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2116 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2117 | The VOS_STATUS code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2118 | |
| 2119 | VOS_STATUS_SUCCESS: Success |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2120 | |
| 2121 | SIDE EFFECTS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2122 | ============================================================================*/ |
| 2123 | VOS_STATUS WLANSAP_SendAction( v_PVOID_t pvosGCtx, const tANI_U8 *pBuf, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2124 | tANI_U32 len, tANI_U16 wait ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2125 | { |
| 2126 | ptSapContext pSapCtx = NULL; |
| 2127 | v_PVOID_t hHal = NULL; |
| 2128 | eHalStatus halStatus = eHAL_STATUS_FAILURE; |
| 2129 | |
| 2130 | if( VOS_STA_SAP_MODE == vos_get_conparam ( ) ) |
| 2131 | { |
| 2132 | pSapCtx = VOS_GET_SAP_CB( pvosGCtx ); |
| 2133 | if (NULL == pSapCtx) |
| 2134 | { |
| 2135 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2136 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2137 | return VOS_STATUS_E_FAULT; |
| 2138 | } |
| 2139 | hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx); |
| 2140 | if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) ) |
| 2141 | { |
| 2142 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 797280e | 2017-09-19 08:36:01 -0700 | [diff] [blame] | 2143 | "%s: HAL pointer (%pK) NULL OR SME session is not open (%d)", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2144 | __func__, hHal, pSapCtx->isSapSessionOpen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2145 | return VOS_STATUS_E_FAULT; |
| 2146 | } |
| 2147 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2148 | halStatus = sme_sendAction( hHal, pSapCtx->sessionId, pBuf, len, 0 , 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2149 | |
| 2150 | if ( eHAL_STATUS_SUCCESS == halStatus ) |
| 2151 | { |
| 2152 | return VOS_STATUS_SUCCESS; |
| 2153 | } |
| 2154 | } |
| 2155 | |
| 2156 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 2157 | "Failed to Send Action Frame"); |
| 2158 | |
| 2159 | return VOS_STATUS_E_FAULT; |
| 2160 | } |
| 2161 | |
| 2162 | /*========================================================================== |
| 2163 | |
| 2164 | FUNCTION WLANSAP_RemainOnChannel |
| 2165 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2166 | DESCRIPTION |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2167 | This api function provides to set Remain On channel on specified channel |
| 2168 | for specified duration. |
| 2169 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2170 | DEPENDENCIES |
| 2171 | NA. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2172 | |
| 2173 | PARAMETERS |
| 2174 | |
| 2175 | IN |
| 2176 | pvosGCtx: Pointer to vos global context structure |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2177 | channel: Channel on which driver has to listen |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2178 | duration: Duration for which driver has to listen on specified channel |
| 2179 | callback: Callback function to be called once Listen is done. |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2180 | pContext: Context needs to be called in callback function. |
| 2181 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2182 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2183 | The VOS_STATUS code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2184 | |
| 2185 | VOS_STATUS_SUCCESS: Success |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2186 | |
| 2187 | SIDE EFFECTS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2188 | ============================================================================*/ |
| 2189 | VOS_STATUS WLANSAP_RemainOnChannel( v_PVOID_t pvosGCtx, |
| 2190 | tANI_U8 channel, tANI_U32 duration, |
| 2191 | remainOnChanCallback callback, |
| 2192 | void *pContext ) |
| 2193 | { |
| 2194 | ptSapContext pSapCtx = NULL; |
| 2195 | v_PVOID_t hHal = NULL; |
| 2196 | eHalStatus halStatus = eHAL_STATUS_FAILURE; |
| 2197 | |
| 2198 | if( VOS_STA_SAP_MODE == vos_get_conparam ( ) ) |
| 2199 | { |
| 2200 | pSapCtx = VOS_GET_SAP_CB( pvosGCtx ); |
| 2201 | if (NULL == pSapCtx) |
| 2202 | { |
| 2203 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2204 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2205 | return VOS_STATUS_E_FAULT; |
| 2206 | } |
| 2207 | hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx); |
| 2208 | if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) ) |
| 2209 | { |
| 2210 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 797280e | 2017-09-19 08:36:01 -0700 | [diff] [blame] | 2211 | "%s: HAL pointer (%pK) NULL OR SME session is not open (%d)", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2212 | __func__, hHal, pSapCtx->isSapSessionOpen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2213 | return VOS_STATUS_E_FAULT; |
| 2214 | } |
| 2215 | |
| 2216 | halStatus = sme_RemainOnChannel( hHal, pSapCtx->sessionId, |
Gopichand Nakkala | 924e455 | 2013-05-08 19:18:14 +0530 | [diff] [blame] | 2217 | channel, duration, callback, pContext, TRUE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2218 | |
| 2219 | if( eHAL_STATUS_SUCCESS == halStatus ) |
| 2220 | { |
| 2221 | return VOS_STATUS_SUCCESS; |
| 2222 | } |
| 2223 | } |
| 2224 | |
| 2225 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 2226 | "Failed to Set Remain on Channel"); |
| 2227 | |
| 2228 | return VOS_STATUS_E_FAULT; |
| 2229 | } |
| 2230 | |
| 2231 | /*========================================================================== |
| 2232 | |
| 2233 | FUNCTION WLANSAP_CancelRemainOnChannel |
| 2234 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2235 | DESCRIPTION |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2236 | This api cancel previous remain on channel request. |
| 2237 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2238 | DEPENDENCIES |
| 2239 | NA. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2240 | |
| 2241 | PARAMETERS |
| 2242 | |
| 2243 | IN |
| 2244 | pvosGCtx: Pointer to vos global context structure |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2245 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2246 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2247 | The VOS_STATUS code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2248 | |
| 2249 | VOS_STATUS_SUCCESS: Success |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2250 | |
| 2251 | SIDE EFFECTS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2252 | ============================================================================*/ |
| 2253 | VOS_STATUS WLANSAP_CancelRemainOnChannel( v_PVOID_t pvosGCtx ) |
| 2254 | { |
| 2255 | ptSapContext pSapCtx = NULL; |
| 2256 | v_PVOID_t hHal = NULL; |
| 2257 | eHalStatus halStatus = eHAL_STATUS_FAILURE; |
| 2258 | |
Agrawal Ashish | 9d12660 | 2016-09-29 14:22:16 +0530 | [diff] [blame] | 2259 | pSapCtx = VOS_GET_SAP_CB(pvosGCtx); |
| 2260 | if (NULL == pSapCtx) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2261 | { |
Agrawal Ashish | 9d12660 | 2016-09-29 14:22:16 +0530 | [diff] [blame] | 2262 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 2263 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
| 2264 | return VOS_STATUS_E_FAULT; |
| 2265 | } |
| 2266 | hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx); |
| 2267 | if ((NULL == hHal) || (eSAP_TRUE != pSapCtx->isSapSessionOpen)) |
| 2268 | { |
| 2269 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 797280e | 2017-09-19 08:36:01 -0700 | [diff] [blame] | 2270 | "%s: HAL pointer (%pK) NULL OR SME session is not open (%d)", |
Agrawal Ashish | 9d12660 | 2016-09-29 14:22:16 +0530 | [diff] [blame] | 2271 | __func__, hHal, pSapCtx->isSapSessionOpen ); |
| 2272 | return VOS_STATUS_E_FAULT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2273 | } |
| 2274 | |
Agrawal Ashish | 9d12660 | 2016-09-29 14:22:16 +0530 | [diff] [blame] | 2275 | halStatus = sme_CancelRemainOnChannel(hHal, pSapCtx->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2276 | |
Agrawal Ashish | 9d12660 | 2016-09-29 14:22:16 +0530 | [diff] [blame] | 2277 | if (eHAL_STATUS_SUCCESS != halStatus) |
| 2278 | { |
| 2279 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 2280 | "Failed to Cancel Remain on Channel"); |
| 2281 | return VOS_STATUS_E_FAULT; |
| 2282 | } |
| 2283 | return VOS_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2284 | } |
| 2285 | |
| 2286 | /*========================================================================== |
| 2287 | |
| 2288 | FUNCTION WLANSAP_RegisterMgmtFrame |
| 2289 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2290 | DESCRIPTION |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2291 | HDD use this API to register specified type of frame with CORE stack. |
| 2292 | On receiving such kind of frame CORE stack should pass this frame to HDD |
| 2293 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2294 | DEPENDENCIES |
| 2295 | NA. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2296 | |
| 2297 | PARAMETERS |
| 2298 | |
| 2299 | IN |
| 2300 | pvosGCtx: Pointer to vos global context structure |
| 2301 | frameType: frameType that needs to be registered with PE. |
| 2302 | matchData: Data pointer which should be matched after frame type is matched. |
| 2303 | matchLen: Length of the matchData |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2304 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2305 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2306 | The VOS_STATUS code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2307 | |
| 2308 | VOS_STATUS_SUCCESS: Success |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2309 | |
| 2310 | SIDE EFFECTS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2311 | ============================================================================*/ |
| 2312 | VOS_STATUS WLANSAP_RegisterMgmtFrame( v_PVOID_t pvosGCtx, tANI_U16 frameType, |
| 2313 | tANI_U8* matchData, tANI_U16 matchLen ) |
| 2314 | { |
| 2315 | ptSapContext pSapCtx = NULL; |
| 2316 | v_PVOID_t hHal = NULL; |
| 2317 | eHalStatus halStatus = eHAL_STATUS_FAILURE; |
| 2318 | |
| 2319 | if( VOS_STA_SAP_MODE == vos_get_conparam ( ) ) |
| 2320 | { |
| 2321 | pSapCtx = VOS_GET_SAP_CB( pvosGCtx ); |
| 2322 | if (NULL == pSapCtx) |
| 2323 | { |
| 2324 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2325 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2326 | return VOS_STATUS_E_FAULT; |
| 2327 | } |
| 2328 | hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx); |
| 2329 | if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) ) |
| 2330 | { |
| 2331 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 797280e | 2017-09-19 08:36:01 -0700 | [diff] [blame] | 2332 | "%s: HAL pointer (%pK) NULL OR SME session is not open (%d)", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2333 | __func__, hHal, pSapCtx->isSapSessionOpen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2334 | return VOS_STATUS_E_FAULT; |
| 2335 | } |
| 2336 | |
| 2337 | halStatus = sme_RegisterMgmtFrame(hHal, pSapCtx->sessionId, |
| 2338 | frameType, matchData, matchLen); |
| 2339 | |
| 2340 | if( eHAL_STATUS_SUCCESS == halStatus ) |
| 2341 | { |
| 2342 | return VOS_STATUS_SUCCESS; |
| 2343 | } |
| 2344 | } |
| 2345 | |
| 2346 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 2347 | "Failed to Register MGMT frame"); |
| 2348 | |
| 2349 | return VOS_STATUS_E_FAULT; |
| 2350 | } |
| 2351 | |
| 2352 | /*========================================================================== |
| 2353 | |
| 2354 | FUNCTION WLANSAP_DeRegisterMgmtFrame |
| 2355 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2356 | DESCRIPTION |
| 2357 | This API is used to deregister previously registered frame. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2358 | |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2359 | DEPENDENCIES |
| 2360 | NA. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2361 | |
| 2362 | PARAMETERS |
| 2363 | |
| 2364 | IN |
| 2365 | pvosGCtx: Pointer to vos global context structure |
| 2366 | frameType: frameType that needs to be De-registered with PE. |
| 2367 | matchData: Data pointer which should be matched after frame type is matched. |
| 2368 | matchLen: Length of the matchData |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2369 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2370 | RETURN VALUE |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2371 | The VOS_STATUS code associated with performing the operation |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2372 | |
| 2373 | VOS_STATUS_SUCCESS: Success |
Madan Mohan Koyyalamudi | 33a178c | 2012-09-18 18:17:13 -0700 | [diff] [blame] | 2374 | |
| 2375 | SIDE EFFECTS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2376 | ============================================================================*/ |
| 2377 | VOS_STATUS WLANSAP_DeRegisterMgmtFrame( v_PVOID_t pvosGCtx, tANI_U16 frameType, |
| 2378 | tANI_U8* matchData, tANI_U16 matchLen ) |
| 2379 | { |
| 2380 | ptSapContext pSapCtx = NULL; |
| 2381 | v_PVOID_t hHal = NULL; |
| 2382 | eHalStatus halStatus = eHAL_STATUS_FAILURE; |
| 2383 | |
| 2384 | if( VOS_STA_SAP_MODE == vos_get_conparam ( ) ) |
| 2385 | { |
| 2386 | pSapCtx = VOS_GET_SAP_CB( pvosGCtx ); |
| 2387 | if (NULL == pSapCtx) |
| 2388 | { |
| 2389 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2390 | "%s: Invalid SAP pointer from pvosGCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2391 | return VOS_STATUS_E_FAULT; |
| 2392 | } |
| 2393 | hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx); |
| 2394 | if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) ) |
| 2395 | { |
| 2396 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 797280e | 2017-09-19 08:36:01 -0700 | [diff] [blame] | 2397 | "%s: HAL pointer (%pK) NULL OR SME session is not open (%d)", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2398 | __func__, hHal, pSapCtx->isSapSessionOpen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2399 | return VOS_STATUS_E_FAULT; |
| 2400 | } |
| 2401 | |
| 2402 | halStatus = sme_DeregisterMgmtFrame( hHal, pSapCtx->sessionId, |
| 2403 | frameType, matchData, matchLen ); |
| 2404 | |
| 2405 | if( eHAL_STATUS_SUCCESS == halStatus ) |
| 2406 | { |
| 2407 | return VOS_STATUS_SUCCESS; |
| 2408 | } |
| 2409 | } |
| 2410 | |
| 2411 | VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 2412 | "Failed to Deregister MGMT frame"); |
| 2413 | |
| 2414 | return VOS_STATUS_E_FAULT; |
| 2415 | } |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 2416 | |
| 2417 | /*========================================================================== |
| 2418 | FUNCTION WLANSAP_PopulateDelStaParams |
| 2419 | |
| 2420 | DESCRIPTION |
| 2421 | This API is used to populate del station parameters |
| 2422 | DEPENDENCIES |
| 2423 | NA. |
| 2424 | |
| 2425 | PARAMETERS |
| 2426 | IN |
| 2427 | mac: pointer to peer mac address. |
| 2428 | reason_code: Reason code for the disassoc/deauth. |
| 2429 | subtype: subtype points to either disassoc/deauth frame. |
| 2430 | pDelStaParams: address where parameters to be populated. |
| 2431 | |
| 2432 | RETURN VALUE NONE |
| 2433 | |
| 2434 | SIDE EFFECTS |
| 2435 | ============================================================================*/ |
| 2436 | void WLANSAP_PopulateDelStaParams(const v_U8_t *mac, |
| 2437 | v_U16_t reason_code, |
| 2438 | v_U8_t subtype, |
| 2439 | struct tagCsrDelStaParams *pDelStaParams) |
| 2440 | { |
| 2441 | if (NULL == mac) |
| 2442 | memset(pDelStaParams->peerMacAddr, 0xff, VOS_MAC_ADDR_SIZE); |
| 2443 | else |
| 2444 | vos_mem_copy(pDelStaParams->peerMacAddr, mac, VOS_MAC_ADDR_SIZE); |
| 2445 | |
| 2446 | if (reason_code == 0) |
Sushant Kaushik | 4cd28f6 | 2014-12-26 14:23:50 +0530 | [diff] [blame] | 2447 | pDelStaParams->reason_code = eSIR_MAC_DEAUTH_LEAVING_BSS_REASON; |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 2448 | else |
| 2449 | pDelStaParams->reason_code = reason_code; |
| 2450 | |
| 2451 | if (subtype == (SIR_MAC_MGMT_DEAUTH >> 4) || |
| 2452 | subtype == (SIR_MAC_MGMT_DISASSOC >> 4)) |
| 2453 | pDelStaParams->subtype = subtype; |
| 2454 | else |
| 2455 | pDelStaParams->subtype = (SIR_MAC_MGMT_DEAUTH >> 4); |
| 2456 | |
| 2457 | VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, |
| 2458 | FL("Delete STA with RC:%hu subtype:%hhu MAC::" MAC_ADDRESS_STR), |
| 2459 | pDelStaParams->reason_code, pDelStaParams->subtype, |
| 2460 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
| 2461 | } |
Abhishek Singh | 0260509 | 2017-10-25 14:06:12 +0530 | [diff] [blame] | 2462 | |
| 2463 | /** |
| 2464 | * wlansap_validate_phy_mode() - |
| 2465 | * validate if the phymode allow the channel to set. |
| 2466 | * |
| 2467 | * @phy_mode: current phymode |
| 2468 | * @channel: target channel number. |
| 2469 | * |
| 2470 | * Return: true if channel is allowed else false |
| 2471 | */ |
| 2472 | static bool wlansap_validate_phy_mode(uint32_t phy_mode, uint32_t channel) |
| 2473 | { |
| 2474 | switch (phy_mode) { |
| 2475 | case eSAP_DOT11_MODE_11a: |
| 2476 | if (channel <= SIR_11B_CHANNEL_END) |
| 2477 | return false; |
| 2478 | case eSAP_DOT11_MODE_11b: |
| 2479 | case eSAP_DOT11_MODE_11g: |
| 2480 | case eSAP_DOT11_MODE_11g_ONLY: |
| 2481 | case eSAP_DOT11_MODE_11b_ONLY: |
| 2482 | if (channel > SIR_11B_CHANNEL_END) |
| 2483 | return false; |
| 2484 | default: |
| 2485 | return true; |
| 2486 | } |
| 2487 | |
| 2488 | return true; |
| 2489 | } |
| 2490 | |
Abhishek Singh | ceb6fe2 | 2017-11-27 13:53:18 +0530 | [diff] [blame] | 2491 | int wlansap_set_channel_change(v_PVOID_t vos_ctx, |
| 2492 | uint32_t new_channel, bool allow_dfs_chan) |
Abhishek Singh | 0260509 | 2017-10-25 14:06:12 +0530 | [diff] [blame] | 2493 | { |
| 2494 | ptSapContext sap_ctx; |
| 2495 | tWLAN_SAPEvent sap_event = {0}; |
| 2496 | v_PVOID_t hal; |
| 2497 | tpAniSirGlobal mac_ctx; |
Abhishek Singh | ceb6fe2 | 2017-11-27 13:53:18 +0530 | [diff] [blame] | 2498 | eNVChannelEnabledType chan_state; |
Abhishek Singh | 0260509 | 2017-10-25 14:06:12 +0530 | [diff] [blame] | 2499 | |
| 2500 | sap_ctx = VOS_GET_SAP_CB(vos_ctx); |
| 2501 | |
| 2502 | if (!sap_ctx) { |
| 2503 | hddLog(LOGE, FL("sap_ctx is NULL")); |
| 2504 | return -EINVAL; |
| 2505 | } |
| 2506 | |
| 2507 | hal = VOS_GET_HAL_CB(sap_ctx->pvosGCtx); |
| 2508 | if (!hal) { |
| 2509 | hddLog(LOGE, FL("hal is NULL")); |
| 2510 | return -EINVAL; |
| 2511 | } |
| 2512 | mac_ctx = PMAC_STRUCT(hal); |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame^] | 2513 | |
| 2514 | if (eSAP_STARTED != sap_ctx->sapsMachine) { |
| 2515 | hddLog(LOGE, FL("SAP is not in eSAP_STARTED state ")); |
| 2516 | return -EINVAL; |
| 2517 | } |
| 2518 | |
Abhishek Singh | 0260509 | 2017-10-25 14:06:12 +0530 | [diff] [blame] | 2519 | if (sap_ctx->channel == new_channel) { |
| 2520 | hddLog(LOGE, FL("channel %d already set"), new_channel); |
| 2521 | return -EALREADY; |
| 2522 | } |
| 2523 | if (sap_ctx->ecsa_info.channel_switch_in_progress) { |
| 2524 | hddLog(LOGE, FL("channel switch already in progress ignore")); |
| 2525 | return -EALREADY; |
| 2526 | } |
Abhishek Singh | ceb6fe2 | 2017-11-27 13:53:18 +0530 | [diff] [blame] | 2527 | chan_state = vos_nv_getChannelEnabledState(new_channel); |
| 2528 | if ((chan_state == NV_CHANNEL_DISABLE) || |
| 2529 | (chan_state == NV_CHANNEL_INVALID)) { |
| 2530 | hddLog(LOGE, |
| 2531 | FL("Channel is disabled, Ignore channel switch ")); |
| 2532 | return -EINVAL; |
| 2533 | } else if (!allow_dfs_chan && (chan_state == NV_CHANNEL_DFS)) { |
| 2534 | hddLog(LOGE, |
| 2535 | FL("DFS channel ignore channel switch as allow_dfs_chan is false")); |
Abhishek Singh | 0260509 | 2017-10-25 14:06:12 +0530 | [diff] [blame] | 2536 | return -EINVAL; |
| 2537 | } |
Abhishek Singh | 0260509 | 2017-10-25 14:06:12 +0530 | [diff] [blame] | 2538 | if (!wlansap_validate_phy_mode(sap_ctx->csrRoamProfile.phyMode, |
| 2539 | new_channel)) { |
| 2540 | hddLog(LOGE, FL("Channel %d not valid for phyMode %d"), new_channel, |
| 2541 | sap_ctx->csrRoamProfile.phyMode); |
| 2542 | return -EINVAL; |
| 2543 | } |
| 2544 | |
| 2545 | sap_ctx->ecsa_info.new_channel = new_channel; |
| 2546 | sap_ctx->ecsa_info.channel_switch_in_progress = true; |
| 2547 | /* |
| 2548 | * Post the eSAP_CHANNEL_SWITCH_ANNOUNCEMENT_START |
| 2549 | * to SAP state machine to process the channel |
| 2550 | * request with CSA IE set in the beacons. |
| 2551 | */ |
| 2552 | sap_event.event = eSAP_CHANNEL_SWITCH_ANNOUNCEMENT_START; |
| 2553 | sapFsm(sap_ctx, &sap_event); |
| 2554 | |
| 2555 | return 0; |
| 2556 | } |
| 2557 | |