Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 22 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 23 | * |
| 24 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 25 | * |
| 26 | * |
| 27 | * Permission to use, copy, modify, and/or distribute this software for |
| 28 | * any purpose with or without fee is hereby granted, provided that the |
| 29 | * above copyright notice and this permission notice appear in all |
| 30 | * copies. |
| 31 | * |
| 32 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 33 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 35 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 36 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 37 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 38 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 39 | * PERFORMANCE OF THIS SOFTWARE. |
| 40 | */ |
| 41 | |
| 42 | /*=========================================================================== |
| 43 | |
| 44 | |
| 45 | W L A N _ Q C T _ T L . C |
| 46 | |
| 47 | OVERVIEW: |
| 48 | |
| 49 | This software unit holds the implementation of the WLAN Transport Layer. |
| 50 | |
| 51 | The functions externalized by this module are to be called ONLY by other |
| 52 | WLAN modules that properly register with the Transport Layer initially. |
| 53 | |
| 54 | DEPENDENCIES: |
| 55 | |
| 56 | Are listed for each API below. |
| 57 | |
| 58 | |
| 59 | Copyright (c) 2008 QUALCOMM Incorporated. |
| 60 | All Rights Reserved. |
| 61 | Qualcomm Confidential and Proprietary |
| 62 | ===========================================================================*/ |
| 63 | |
| 64 | /*=========================================================================== |
| 65 | |
| 66 | EDIT HISTORY FOR FILE |
| 67 | |
| 68 | |
| 69 | This section contains comments describing changes made to the module. |
| 70 | Notice that changes are listed in reverse chronological order. |
| 71 | |
| 72 | |
| 73 | $Header$$DateTime$$Author$ |
| 74 | |
| 75 | |
| 76 | when who what, where, why |
| 77 | ---------- --- -------------------------------------------------------- |
| 78 | 2010-07-13 c_shinde Fixed an issue where WAPI rekeying was failing because |
| 79 | WAI frame sent out during rekeying had the protected bit |
| 80 | set to 1. |
| 81 | 2010-05-06 rnair Changed name of variable from usLlcType to usEtherType |
| 82 | Changed function name from GetLLCType to GetEtherType |
| 83 | Fixed 802.3 to 802.11 frame translation issue where two |
| 84 | bytes of the LLC header was getting overwritten in the |
| 85 | non-Qos path |
| 86 | 2010-05-06 rnair RxAuth path fix for modifying the header before ether |
| 87 | type is retreived (Detected while testing rekeying |
| 88 | in WAPI Volans) |
| 89 | 2010-02-19 bad Fixed 802.11 to 802.3 ft issues with WAPI |
| 90 | 2010-02-19 rnair WAPI: If frame is a WAI frame in TxConn and TxAuth, TL |
| 91 | does frame translation. |
| 92 | 2010-02-01 rnair WAPI: Fixed a bug where the value of ucIsWapiSta was not |
| 93 | being set in the TL control block in the RegisterSTA func. |
| 94 | 2010-01-08 lti Added TL Data Caching |
| 95 | 2009-11-04 rnair WAPI: Moving common functionality to a seperate function |
| 96 | called WLANTL_GetLLCType |
| 97 | 2009-10-15 rnair WAPI: Featurizing WAPI code |
| 98 | 2009-10-09 rnair WAPI: Modifications to authenticated state handling of Rx data |
| 99 | 2009-10-06 rnair Adding support for WAPI |
| 100 | 2009-09-22 lti Add deregistration API for management client |
| 101 | 2009-07-16 rnair Temporary fix to let TL fetch packets when multiple |
| 102 | peers exist in an IBSS |
| 103 | 2009-06-10 lti Fix for checking TID value of meta info on TX - prevent |
| 104 | memory overwrite |
| 105 | Fix for properly checking the sta id for resuming trigger |
| 106 | frame generation |
| 107 | 2009-05-14 lti Fix for sending out trigger frames |
| 108 | 2009-05-15 lti Addr3 filtering |
| 109 | 2009-04-13 lti Assert if packet larger then allowed |
| 110 | Drop packet that fails flatten |
| 111 | 2009-04-02 lti Performance fixes for TL |
| 112 | 2009-02-19 lti Added fix for LLC management on Rx Connect |
| 113 | 2009-01-16 lti Replaced peek data with extract data for non BD opertions |
| 114 | Extracted frame control in Tl and pass to HAL for frame |
| 115 | type evaluation |
| 116 | 2009-02-02 sch Add handoff support |
| 117 | 2008-12-09 lti Fixes for AMSS compilation |
| 118 | Removed assert on receive when there is no station |
| 119 | 2008-12-02 lti Fix fo trigger frame generation |
| 120 | 2008-10-31 lti Fix fo TL tx suspend |
| 121 | 2008-10-01 lti Merged in fixes from reordering |
| 122 | Disabled part of UAPSD functionality in TL |
| 123 | (will be re-enabled once UAPSD is tested) |
| 124 | Fix for UAPSD multiple enable |
| 125 | 2008-08-10 lti Fixes following UAPSD testing |
| 126 | Fixed infinite loop on mask computation when STA no reg |
| 127 | 2008-08-06 lti Fixes after QOS unit testing |
| 128 | 2008-08-06 lti Added QOS support |
| 129 | 2008-07-23 lti Fix for vos packet draining |
| 130 | 2008-07-17 lti Fix for data type value |
| 131 | Added frame translation code in TL |
| 132 | Avoid returning failure to PE in case previous frame is |
| 133 | still pending; fail previous and cache new one for tx |
| 134 | Get frames returning boolean true if more frames are pending |
| 135 | 2008-07-03 lti Fixes following pre-integration testing |
| 136 | 2008-06-26 lti Fixes following unit testing |
| 137 | Added alloc and free for TL context |
| 138 | Using atomic set u8 instead of u32 |
| 139 | 2008-05-16 lti Created module |
| 140 | |
| 141 | ===========================================================================*/ |
| 142 | |
| 143 | /*---------------------------------------------------------------------------- |
| 144 | * Include Files |
| 145 | * -------------------------------------------------------------------------*/ |
| 146 | #include "wlan_qct_tl.h" |
| 147 | #include "wlan_qct_wda.h" |
| 148 | #include "wlan_qct_tli.h" |
| 149 | #include "wlan_qct_tli_ba.h" |
| 150 | #include "wlan_qct_tl_hosupport.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 151 | #include "tlDebug.h" |
| 152 | #ifdef FEATURE_WLAN_WAPI |
| 153 | /*Included to access WDI_RxBdType */ |
| 154 | #include "wlan_qct_wdi_bd.h" |
| 155 | #endif |
| 156 | /*Enables debugging behavior in TL*/ |
| 157 | #define TL_DEBUG |
| 158 | //#define WLAN_SOFTAP_FLOWCTRL_EN |
| 159 | |
| 160 | //#define BTAMP_TEST |
| 161 | /*---------------------------------------------------------------------------- |
| 162 | * Preprocessor Definitions and Constants |
| 163 | * -------------------------------------------------------------------------*/ |
| 164 | /*LLC header value*/ |
| 165 | static v_U8_t WLANTL_LLC_HEADER[] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00 }; |
| 166 | |
| 167 | #ifdef FEATURE_WLAN_CCX |
| 168 | /*Aironet SNAP header value*/ |
| 169 | static v_U8_t WLANTL_AIRONET_SNAP_HEADER[] = {0xAA, 0xAA, 0x03, 0x00, 0x40, 0x96, 0x00, 0x00 }; |
| 170 | #endif //FEATURE_WLAN_CCX |
| 171 | |
| 172 | /*BT-AMP packet LLC OUI value*/ |
| 173 | const v_U8_t WLANTL_BT_AMP_OUI[] = {0x00, 0x19, 0x58 }; |
| 174 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 175 | |
| 176 | #ifdef VOLANS_PERF |
| 177 | #define WLANTL_BD_PDU_INTERRUPT_ENABLE_THRESHOLD 120 |
| 178 | #define WLANTL_BD_PDU_INTERRUPT_GET_THRESHOLD 120 |
| 179 | |
| 180 | /* TL BD/PDU threshold to enable interrupt */ |
| 181 | int bdPduInterruptEnableThreshold = WLANTL_BD_PDU_INTERRUPT_ENABLE_THRESHOLD; |
| 182 | int bdPduInterruptGetThreshold = WLANTL_BD_PDU_INTERRUPT_GET_THRESHOLD; |
| 183 | #endif /* VOLANS_PERF */ |
| 184 | |
| 185 | /*-----------------------------------* |
| 186 | | Type(2b) | Sub-type(4b) | |
| 187 | *-----------------------------------*/ |
| 188 | #define WLANTL_IS_DATA_FRAME(_type_sub) \ |
| 189 | ( WLANTL_DATA_FRAME_TYPE == ( (_type_sub) & 0x30 )) |
| 190 | |
| 191 | #define WLANTL_IS_QOS_DATA_FRAME(_type_sub) \ |
| 192 | (( WLANTL_DATA_FRAME_TYPE == ( (_type_sub) & 0x30 )) && \ |
| 193 | ( WLANTL_80211_DATA_QOS_SUBTYPE == ( (_type_sub) & 0xF ))) |
| 194 | |
| 195 | #define WLANTL_IS_MGMT_FRAME(_type_sub) \ |
| 196 | ( WLANTL_MGMT_FRAME_TYPE == ( (_type_sub) & 0x30 )) |
| 197 | |
| 198 | #define WLANTL_IS_CTRL_FRAME(_type_sub) \ |
| 199 | ( WLANTL_CTRL_FRAME_TYPE == ( (_type_sub) & 0x30 )) |
| 200 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 201 | #ifdef FEATURE_WLAN_TDLS |
| 202 | #define WLANTL_IS_TDLS_FRAME(_eth_type) \ |
| 203 | ( WLANTL_LLC_TDLS_TYPE == ( _eth_type)) |
| 204 | #endif |
| 205 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 206 | /*MAX Allowed len processed by TL - MAx MTU + 802.3 header + BD+DXE+XTL*/ |
Madan Mohan Koyyalamudi | a53c4dc | 2012-11-13 10:35:42 -0800 | [diff] [blame] | 207 | #define WLANTL_MAX_ALLOWED_LEN (1514 + 100) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 208 | |
| 209 | #define WLANTL_MASK_AC 0x03 |
| 210 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 211 | //some flow_control define |
| 212 | //LWM mode will be enabled for this station if the egress/ingress falls below this ratio |
| 213 | #define WLANTL_LWM_EGRESS_INGRESS_THRESHOLD (0.75) |
| 214 | |
| 215 | //Get enough sample to do the LWM related calculation |
| 216 | #define WLANTL_LWM_INGRESS_SAMPLE_THRESHOLD (64) |
| 217 | |
| 218 | //Maximal on-fly packet per station in LWM mode |
| 219 | #define WLANTL_STA_BMU_THRESHOLD_MAX (256) |
| 220 | |
| 221 | #define WLANTL_AC_MASK (0x7) |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 222 | #define WLANTL_STAID_OFFSET (0x6) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 223 | |
| 224 | /* UINT32 type endian swap */ |
| 225 | #define SWAP_ENDIAN_UINT32(a) ((a) = ((a) >> 0x18 ) |(((a) & 0xFF0000) >> 0x08) | \ |
| 226 | (((a) & 0xFF00) << 0x08) | (((a) & 0xFF) << 0x18)) |
| 227 | |
| 228 | |
| 229 | |
| 230 | /*-------------------------------------------------------------------------- |
| 231 | TID to AC mapping in TL |
| 232 | --------------------------------------------------------------------------*/ |
| 233 | const v_U8_t WLANTL_TID_2_AC[WLAN_MAX_TID] = { WLANTL_AC_BE, |
| 234 | WLANTL_AC_BK, |
| 235 | WLANTL_AC_BK, |
| 236 | WLANTL_AC_BE, |
| 237 | WLANTL_AC_VI, |
| 238 | WLANTL_AC_VI, |
| 239 | WLANTL_AC_VO, |
| 240 | WLANTL_AC_VO }; |
| 241 | |
| 242 | /*---------------------------------------------------------------------------- |
| 243 | * Type Declarations |
| 244 | * -------------------------------------------------------------------------*/ |
| 245 | #define TL_LITTLE_BIT_ENDIAN |
| 246 | |
| 247 | typedef struct |
| 248 | { |
| 249 | |
| 250 | #ifndef TL_LITTLE_BIT_ENDIAN |
| 251 | |
| 252 | v_U8_t subType :4; |
| 253 | v_U8_t type :2; |
| 254 | v_U8_t protVer :2; |
| 255 | |
| 256 | v_U8_t order :1; |
| 257 | v_U8_t wep :1; |
| 258 | v_U8_t moreData :1; |
| 259 | v_U8_t powerMgmt :1; |
| 260 | v_U8_t retry :1; |
| 261 | v_U8_t moreFrag :1; |
| 262 | v_U8_t fromDS :1; |
| 263 | v_U8_t toDS :1; |
| 264 | |
| 265 | #else |
| 266 | |
| 267 | v_U8_t protVer :2; |
| 268 | v_U8_t type :2; |
| 269 | v_U8_t subType :4; |
| 270 | |
| 271 | v_U8_t toDS :1; |
| 272 | v_U8_t fromDS :1; |
| 273 | v_U8_t moreFrag :1; |
| 274 | v_U8_t retry :1; |
| 275 | v_U8_t powerMgmt :1; |
| 276 | v_U8_t moreData :1; |
| 277 | v_U8_t wep :1; |
| 278 | v_U8_t order :1; |
| 279 | |
| 280 | #endif |
| 281 | |
| 282 | } WLANTL_MACFCType; |
| 283 | |
| 284 | /* 802.11 header */ |
| 285 | typedef struct |
| 286 | { |
| 287 | /* Frame control field */ |
| 288 | WLANTL_MACFCType wFrmCtrl; |
| 289 | |
| 290 | /* Duration ID */ |
| 291 | v_U16_t usDurationId; |
| 292 | |
| 293 | /* Address 1 field */ |
| 294 | v_U8_t vA1[VOS_MAC_ADDR_SIZE]; |
| 295 | |
| 296 | /* Address 2 field */ |
| 297 | v_U8_t vA2[VOS_MAC_ADDR_SIZE]; |
| 298 | |
| 299 | /* Address 3 field */ |
| 300 | v_U8_t vA3[VOS_MAC_ADDR_SIZE]; |
| 301 | |
| 302 | /* Sequence control field */ |
| 303 | v_U16_t usSeqCtrl; |
| 304 | |
| 305 | // Find the size of the mandatory header size. |
| 306 | #define WLAN80211_MANDATORY_HEADER_SIZE \ |
| 307 | (sizeof(WLANTL_MACFCType) + sizeof(v_U16_t) + \ |
| 308 | (3 * (sizeof(v_U8_t) * VOS_MAC_ADDR_SIZE)) + \ |
| 309 | sizeof(v_U16_t)) |
| 310 | |
| 311 | /* Optional A4 address */ |
| 312 | v_U8_t optvA4[VOS_MAC_ADDR_SIZE]; |
| 313 | |
| 314 | /* Optional QOS control field */ |
| 315 | v_U16_t usQosCtrl; |
| 316 | }WLANTL_80211HeaderType; |
| 317 | |
| 318 | /* 802.3 header */ |
| 319 | typedef struct |
| 320 | { |
| 321 | /* Destination address field */ |
| 322 | v_U8_t vDA[VOS_MAC_ADDR_SIZE]; |
| 323 | |
| 324 | /* Source address field */ |
| 325 | v_U8_t vSA[VOS_MAC_ADDR_SIZE]; |
| 326 | |
| 327 | /* Length field */ |
| 328 | v_U16_t usLenType; |
| 329 | }WLANTL_8023HeaderType; |
| 330 | |
| 331 | /*---------------------------------------------------------------------------- |
| 332 | * Global Data Definitions |
| 333 | * -------------------------------------------------------------------------*/ |
| 334 | #define WLAN_TL_INVALID_U_SIG 255 |
| 335 | #define WLAN_TL_INVALID_B_SIG 255 |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 336 | #define ENTER() VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, "Enter:%s", __func__) |
| 337 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 338 | |
| 339 | #define WLAN_TL_AC_ARRAY_2_MASK( _pSTA, _ucACMask, i ) \ |
| 340 | do\ |
| 341 | {\ |
| 342 | _ucACMask = 0; \ |
| 343 | for ( i = 0; i < WLANTL_MAX_AC; i++ ) \ |
| 344 | { \ |
| 345 | if ( 0 != (_pSTA)->aucACMask[i] ) \ |
| 346 | { \ |
| 347 | _ucACMask |= ( 1 << i ); \ |
| 348 | } \ |
| 349 | } \ |
| 350 | } while (0); |
| 351 | |
| 352 | /*---------------------------------------------------------------------------- |
| 353 | * Static Variable Definitions |
| 354 | * -------------------------------------------------------------------------*/ |
| 355 | |
| 356 | /*---------------------------------------------------------------------------- |
| 357 | * Static Function Declarations and Definitions |
| 358 | * -------------------------------------------------------------------------*/ |
| 359 | |
| 360 | static VOS_STATUS |
| 361 | WLANTL_GetEtherType |
| 362 | ( |
| 363 | v_U8_t * aucBDHeader, |
| 364 | vos_pkt_t * vosDataBuff, |
| 365 | v_U8_t ucMPDUHLen, |
| 366 | v_U16_t * usEtherType |
| 367 | ); |
| 368 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 369 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 370 | /* FIXME_MUST: during TDLS integration to main/latest, WLANTL_GetEtherType() conflicts. |
| 371 | But there is difference. existing WLANTL_GetEtherType() expects vosDataBuff->offset points to MPDU Header, |
| 372 | wherease TDLS expect vosDataBuff->offset should still points to RxBd. |
| 373 | So far, data frmae stripped RxBD and passed to data frame handler. |
| 374 | (RxBd should not be stripped in case TDLS, because it will be eventually routed to mgmt packet |
| 375 | handler, where RX BD should be preserved) |
| 376 | To avoid breaking existing functionality, for now, I temporarily rename to |
| 377 | WLANTL_GetEtherType_2(). Eventually this function should be removed and merged to WLANTL_GetEtherType() |
| 378 | */ |
| 379 | static VOS_STATUS |
| 380 | WLANTL_GetEtherType_2 |
| 381 | ( |
| 382 | v_U8_t * aucBDHeader, |
| 383 | vos_pkt_t * vosDataBuff, |
| 384 | v_U8_t ucMPDUHLen, |
| 385 | v_U16_t * usEtherType |
| 386 | ); |
| 387 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 388 | #ifdef FEATURE_WLAN_WAPI |
| 389 | /*--------------------------------------------------------------------------- |
| 390 | * Adding a global variable to be used when doing frame translation in TxAuth |
| 391 | * state so as to not set the protected bit to 1 in the case of WAI frames |
| 392 | *---------------------------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | dfd6aa8 | 2012-10-18 20:18:43 -0700 | [diff] [blame] | 393 | v_U8_t gUcIsWai; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 394 | #endif |
| 395 | |
| 396 | /*---------------------------------------------------------------------------- |
| 397 | * Externalized Function Definitions |
| 398 | * -------------------------------------------------------------------------*/ |
| 399 | |
| 400 | /*---------------------------------------------------------------------------- |
| 401 | * Function Declarations and Documentation |
| 402 | * -------------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 403 | /*========================================================================== |
| 404 | |
| 405 | FUNCTION WLANTL_FreeClientMemory |
| 406 | |
| 407 | DESCRIPTION |
| 408 | It frees up the memory allocated to all the STA clients in TLCB block |
| 409 | Can be called inside Close, Stop or when some FAULT occurs |
| 410 | |
| 411 | DEPENDENCIES |
| 412 | |
| 413 | PARAMETERS |
| 414 | |
| 415 | IN |
| 416 | pClientSTA: Pointer to the global client pointer array |
| 417 | |
| 418 | RETURN VALUE |
| 419 | |
| 420 | SIDE EFFECTS |
| 421 | |
| 422 | ============================================================================*/ |
| 423 | void WLANTL_FreeClientMemory |
| 424 | (WLANTL_STAClientType* pClientSTA[WLAN_MAX_STA_COUNT]) |
| 425 | { |
| 426 | v_U32_t i = 0; |
| 427 | for(i =0; i < WLAN_MAX_STA_COUNT; i++) |
| 428 | { |
| 429 | if( NULL != pClientSTA[i] ) |
| 430 | { |
| 431 | vos_mem_free(pClientSTA[i]); |
| 432 | } |
| 433 | pClientSTA[i] = NULL; |
| 434 | } |
| 435 | return; |
| 436 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 437 | |
| 438 | /*========================================================================== |
| 439 | |
| 440 | FUNCTION WLANTL_Open |
| 441 | |
| 442 | DESCRIPTION |
| 443 | Called by HDD at driver initialization. TL will initialize all its |
| 444 | internal resources and will wait for the call to start to register |
| 445 | with the other modules. |
| 446 | |
| 447 | DEPENDENCIES |
| 448 | |
| 449 | PARAMETERS |
| 450 | |
| 451 | IN |
| 452 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 453 | control block can be extracted from its context |
| 454 | pTLConfig: TL Configuration |
| 455 | |
| 456 | RETURN VALUE |
| 457 | The result code associated with performing the operation |
| 458 | |
| 459 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a page |
| 460 | fault |
| 461 | VOS_STATUS_SUCCESS: Everything is good :) |
| 462 | |
| 463 | SIDE EFFECTS |
| 464 | |
| 465 | ============================================================================*/ |
| 466 | VOS_STATUS |
| 467 | WLANTL_Open |
| 468 | ( |
| 469 | v_PVOID_t pvosGCtx, |
| 470 | WLANTL_ConfigInfoType* pTLConfig |
| 471 | ) |
| 472 | { |
| 473 | WLANTL_CbType* pTLCb = NULL; |
| 474 | v_U8_t ucIndex; |
| 475 | tHalHandle smeContext; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 476 | v_U32_t i = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 477 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 478 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 479 | #endif |
| 480 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 481 | |
| 482 | /*------------------------------------------------------------------------ |
| 483 | Sanity check |
| 484 | Extract TL control block |
| 485 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 486 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 487 | vos_alloc_context( pvosGCtx, VOS_MODULE_ID_TL, |
| 488 | (void*)&pTLCb, sizeof(WLANTL_CbType)); |
| 489 | |
| 490 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 491 | if (( NULL == pTLCb ) || ( NULL == pTLConfig ) ) |
| 492 | { |
Madan Mohan Koyyalamudi | c0e5bd8 | 2012-09-18 17:12:27 -0700 | [diff] [blame] | 493 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 494 | "WLAN TL: Invalid input pointer on WLANTL_Open TL %x Config %x", pTLCb, pTLConfig )); |
| 495 | return VOS_STATUS_E_FAULT; |
| 496 | } |
| 497 | |
Madan Mohan Koyyalamudi | c0e5bd8 | 2012-09-18 17:12:27 -0700 | [diff] [blame] | 498 | /* Set the default log level to VOS_TRACE_LEVEL_ERROR */ |
| 499 | vos_trace_setLevel(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR); |
| 500 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 501 | smeContext = vos_get_context(VOS_MODULE_ID_SME, pvosGCtx); |
| 502 | if ( NULL == smeContext ) |
| 503 | { |
| 504 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 505 | "%s: Invalid smeContext", __func__)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 506 | return VOS_STATUS_E_FAULT; |
| 507 | } |
| 508 | |
| 509 | /* Zero out the memory so we are OK, when CleanCB is called.*/ |
| 510 | vos_mem_zero((v_VOID_t *)pTLCb, sizeof(WLANTL_CbType)); |
| 511 | |
| 512 | /*------------------------------------------------------------------------ |
| 513 | Clean up TL control block, initialize all values |
| 514 | ------------------------------------------------------------------------*/ |
| 515 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 516 | "WLAN TL:WLANTL_Open")); |
| 517 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 518 | for ( i =0; i<WLAN_MAX_STA_COUNT; i++ ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 519 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 520 | if ( i < WLAN_NON32_STA_COUNT ) |
| 521 | { |
| 522 | pTLCb->atlSTAClients[i] = vos_mem_malloc(sizeof(WLANTL_STAClientType)); |
| 523 | /* Allocating memory for LEGACY STA COUNT so as to avoid regression issues. */ |
| 524 | if ( NULL == pTLCb->atlSTAClients[i] ) |
| 525 | { |
| 526 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "WLAN TL: StaClient allocation failed")); |
| 527 | WLANTL_FreeClientMemory(pTLCb->atlSTAClients); |
| 528 | vos_free_context(pvosGCtx, VOS_MODULE_ID_TL, pTLCb); |
| 529 | return VOS_STATUS_E_FAULT; |
| 530 | } |
| 531 | vos_mem_zero((v_VOID_t *) pTLCb->atlSTAClients[i], sizeof(WLANTL_STAClientType)); |
| 532 | } |
| 533 | else |
| 534 | { |
| 535 | pTLCb->atlSTAClients[i] = NULL; |
| 536 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 537 | } |
| 538 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 539 | pTLCb->reorderBufferPool = vos_mem_malloc(sizeof(WLANTL_REORDER_BUFFER_T) * WLANTL_MAX_BA_SESSION); |
| 540 | if (NULL == pTLCb->reorderBufferPool) |
| 541 | { |
| 542 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "WLAN TL: Reorder buffer allocation failed\n")); |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 543 | WLANTL_FreeClientMemory(pTLCb->atlSTAClients); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 544 | vos_free_context(pvosGCtx, VOS_MODULE_ID_TL, pTLCb); |
| 545 | return VOS_STATUS_E_FAULT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 546 | } |
| 547 | |
| 548 | vos_mem_zero((v_VOID_t *)pTLCb->reorderBufferPool, sizeof(WLANTL_REORDER_BUFFER_T) * WLANTL_MAX_BA_SESSION); |
| 549 | |
| 550 | WLANTL_CleanCB(pTLCb, 0 /*do not empty*/); |
| 551 | |
| 552 | for ( ucIndex = 0; ucIndex < WLANTL_MAX_AC ; ucIndex++) |
| 553 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 554 | pTLCb->tlConfigInfo.ucAcWeights[ucIndex] = pTLConfig->ucAcWeights[ucIndex]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 555 | } |
| 556 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 557 | // scheduling init to be the last one of previous round |
| 558 | pTLCb->uCurServedAC = WLANTL_AC_BK; |
| 559 | pTLCb->ucCurLeftWeight = 1; |
| 560 | pTLCb->ucCurrentSTA = WLAN_MAX_STA_COUNT-1; |
| 561 | |
| 562 | #if 0 |
| 563 | //flow control field init |
| 564 | vos_mem_zero(&pTLCb->tlFCInfo, sizeof(tFcTxParams_type)); |
| 565 | //bit 0: set (Bd/pdu count) bit 1: set (request station PS change notification) |
| 566 | pTLCb->tlFCInfo.fcConfig = 0x1; |
| 567 | #endif |
| 568 | |
| 569 | pTLCb->vosTxFCBuf = NULL; |
| 570 | pTLCb->tlConfigInfo.uMinFramesProcThres = |
| 571 | pTLConfig->uMinFramesProcThres; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 572 | |
Sunil Ravi | d5406f2 | 2013-01-22 00:18:31 -0800 | [diff] [blame] | 573 | #ifdef FEATURE_WLAN_TDLS |
| 574 | pTLCb->ucTdlsPeerCount = 0; |
| 575 | #endif |
| 576 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 577 | pTLCb->tlConfigInfo.uDelayedTriggerFrmInt = |
| 578 | pTLConfig->uDelayedTriggerFrmInt; |
| 579 | |
| 580 | /*------------------------------------------------------------------------ |
| 581 | Allocate internal resources |
| 582 | ------------------------------------------------------------------------*/ |
| 583 | vos_pkt_get_packet(&pTLCb->vosDummyBuf, VOS_PKT_TYPE_RX_RAW, 1, 1, |
| 584 | 1/*true*/,NULL, NULL); |
| 585 | |
| 586 | WLANTL_InitBAReorderBuffer(pvosGCtx); |
| 587 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 588 | /* Initialize Handoff support modue |
| 589 | * RSSI measure and Traffic state monitoring */ |
| 590 | status = WLANTL_HSInit(pvosGCtx); |
| 591 | if(!VOS_IS_STATUS_SUCCESS(status)) |
| 592 | { |
| 593 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 594 | "Handoff support module init fail")); |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 595 | WLANTL_FreeClientMemory(pTLCb->atlSTAClients); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 596 | vos_mem_free(pTLCb->reorderBufferPool); |
| 597 | vos_free_context(pvosGCtx, VOS_MODULE_ID_TL, pTLCb); |
| 598 | return status; |
| 599 | } |
| 600 | #endif |
| 601 | |
| 602 | pTLCb->isBMPS = VOS_FALSE; |
| 603 | pmcRegisterDeviceStateUpdateInd( smeContext, |
| 604 | WLANTL_PowerStateChangedCB, pvosGCtx ); |
| 605 | |
| 606 | return VOS_STATUS_SUCCESS; |
| 607 | }/* WLANTL_Open */ |
| 608 | |
| 609 | /*========================================================================== |
| 610 | |
| 611 | FUNCTION WLANTL_Start |
| 612 | |
| 613 | DESCRIPTION |
| 614 | Called by HDD as part of the overall start procedure. TL will use this |
| 615 | call to register with BAL as a transport layer entity. |
| 616 | |
| 617 | DEPENDENCIES |
| 618 | |
| 619 | PARAMETERS |
| 620 | |
| 621 | IN |
| 622 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 623 | control block can be extracted from its context |
| 624 | |
| 625 | RETURN VALUE |
| 626 | The result code associated with performing the operation |
| 627 | |
| 628 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a page |
| 629 | fault |
| 630 | VOS_STATUS_SUCCESS: Everything is good :) |
| 631 | |
| 632 | Other codes can be returned as a result of a BAL failure; see BAL API |
| 633 | for more info |
| 634 | |
| 635 | SIDE EFFECTS |
| 636 | |
| 637 | ============================================================================*/ |
| 638 | VOS_STATUS |
| 639 | WLANTL_Start |
| 640 | ( |
| 641 | v_PVOID_t pvosGCtx |
| 642 | ) |
| 643 | { |
| 644 | WLANTL_CbType* pTLCb = NULL; |
| 645 | v_U32_t uResCount = WDA_TLI_MIN_RES_DATA; |
| 646 | VOS_STATUS vosStatus; |
| 647 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 648 | |
| 649 | /*------------------------------------------------------------------------ |
| 650 | Sanity check |
| 651 | Extract TL control block |
| 652 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 653 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 654 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 655 | if ( NULL == pTLCb ) |
| 656 | { |
| 657 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 658 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_Start")); |
| 659 | return VOS_STATUS_E_FAULT; |
| 660 | } |
| 661 | |
| 662 | /*------------------------------------------------------------------------ |
| 663 | Register with WDA as transport layer client |
| 664 | Request resources for tx from bus |
| 665 | ------------------------------------------------------------------------*/ |
| 666 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 667 | "WLAN TL:WLAN TL:WLANTL_Start")); |
| 668 | |
| 669 | vosStatus = WDA_DS_Register( pvosGCtx, |
| 670 | WLANTL_TxComp, |
| 671 | WLANTL_RxFrames, |
| 672 | WLANTL_GetFrames, |
| 673 | WLANTL_ResourceCB, |
| 674 | WDA_TLI_MIN_RES_DATA, |
| 675 | pvosGCtx, |
| 676 | &uResCount ); |
| 677 | |
| 678 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 679 | { |
| 680 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 681 | "WLAN TL:TL failed to register with BAL/WDA, Err: %d", |
| 682 | vosStatus)); |
| 683 | return vosStatus; |
| 684 | } |
| 685 | |
| 686 | /* Enable transmission */ |
| 687 | vos_atomic_set_U8( &pTLCb->ucTxSuspended, 0); |
| 688 | |
| 689 | pTLCb->uResCount = uResCount; |
| 690 | |
| 691 | return VOS_STATUS_SUCCESS; |
| 692 | }/* WLANTL_Start */ |
| 693 | |
| 694 | /*========================================================================== |
| 695 | |
| 696 | FUNCTION WLANTL_Stop |
| 697 | |
| 698 | DESCRIPTION |
| 699 | Called by HDD to stop operation in TL, before close. TL will suspend all |
| 700 | frame transfer operation and will wait for the close request to clean up |
| 701 | its resources. |
| 702 | |
| 703 | DEPENDENCIES |
| 704 | |
| 705 | PARAMETERS |
| 706 | |
| 707 | IN |
| 708 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 709 | control block can be extracted from its context |
| 710 | |
| 711 | RETURN VALUE |
| 712 | The result code associated with performing the operation |
| 713 | |
| 714 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a page |
| 715 | fault |
| 716 | VOS_STATUS_SUCCESS: Everything is good :) |
| 717 | |
| 718 | SIDE EFFECTS |
| 719 | |
| 720 | ============================================================================*/ |
| 721 | VOS_STATUS |
| 722 | WLANTL_Stop |
| 723 | ( |
| 724 | v_PVOID_t pvosGCtx |
| 725 | ) |
| 726 | { |
| 727 | WLANTL_CbType* pTLCb = NULL; |
| 728 | v_U8_t ucIndex; |
| 729 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 730 | |
| 731 | /*------------------------------------------------------------------------ |
| 732 | Sanity check |
| 733 | Extract TL control block |
| 734 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 735 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 736 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 737 | if ( NULL == pTLCb ) |
| 738 | { |
| 739 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 740 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState")); |
| 741 | return VOS_STATUS_E_FAULT; |
| 742 | } |
| 743 | |
| 744 | /*------------------------------------------------------------------------ |
| 745 | Stop TL and empty Station list |
| 746 | ------------------------------------------------------------------------*/ |
| 747 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 748 | "WLAN TL:WLANTL_Stop")); |
| 749 | |
| 750 | /* Disable transmission */ |
| 751 | vos_atomic_set_U8( &pTLCb->ucTxSuspended, 1); |
| 752 | |
| 753 | if ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff ) |
| 754 | { |
| 755 | vos_pkt_return_packet(pTLCb->tlMgmtFrmClient.vosPendingDataBuff); |
| 756 | pTLCb->tlMgmtFrmClient.vosPendingDataBuff = NULL; |
| 757 | } |
| 758 | |
| 759 | if ( NULL != pTLCb->tlBAPClient.vosPendingDataBuff ) |
| 760 | { |
| 761 | vos_pkt_return_packet(pTLCb->tlBAPClient.vosPendingDataBuff); |
| 762 | pTLCb->tlBAPClient.vosPendingDataBuff = NULL; |
| 763 | } |
| 764 | |
| 765 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 766 | if(VOS_STATUS_SUCCESS != WLANTL_HSStop(pvosGCtx)) |
| 767 | { |
| 768 | TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, |
| 769 | "Handoff Support module stop fail")); |
| 770 | } |
| 771 | #endif |
| 772 | |
| 773 | /*------------------------------------------------------------------------- |
| 774 | Clean client stations |
| 775 | -------------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 776 | for ( ucIndex = 0; ucIndex < WLAN_MAX_STA_COUNT; ucIndex++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 777 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 778 | if ( NULL != pTLCb->atlSTAClients[ucIndex] ) |
| 779 | { |
| 780 | WLANTL_CleanSTA(pTLCb->atlSTAClients[ucIndex], 1 /*empty all queues*/); |
| 781 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 782 | } |
| 783 | |
| 784 | |
| 785 | return VOS_STATUS_SUCCESS; |
| 786 | }/* WLANTL_Stop */ |
| 787 | |
| 788 | /*========================================================================== |
| 789 | |
| 790 | FUNCTION WLANTL_Close |
| 791 | |
| 792 | DESCRIPTION |
| 793 | Called by HDD during general driver close procedure. TL will clean up |
| 794 | all the internal resources. |
| 795 | |
| 796 | DEPENDENCIES |
| 797 | |
| 798 | PARAMETERS |
| 799 | |
| 800 | IN |
| 801 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 802 | control block can be extracted from its context |
| 803 | |
| 804 | RETURN VALUE |
| 805 | The result code associated with performing the operation |
| 806 | |
| 807 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a page |
| 808 | fault |
| 809 | VOS_STATUS_SUCCESS: Everything is good :) |
| 810 | |
| 811 | SIDE EFFECTS |
| 812 | |
| 813 | ============================================================================*/ |
| 814 | VOS_STATUS |
| 815 | WLANTL_Close |
| 816 | ( |
| 817 | v_PVOID_t pvosGCtx |
| 818 | ) |
| 819 | { |
| 820 | WLANTL_CbType* pTLCb = NULL; |
| 821 | tHalHandle smeContext; |
| 822 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 823 | |
| 824 | /*------------------------------------------------------------------------ |
| 825 | Sanity check |
| 826 | Extract TL control block |
| 827 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 828 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 829 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 830 | if ( NULL == pTLCb ) |
| 831 | { |
| 832 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 833 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState")); |
| 834 | return VOS_STATUS_E_FAULT; |
| 835 | } |
| 836 | /*------------------------------------------------------------------------ |
| 837 | Deregister from PMC |
| 838 | ------------------------------------------------------------------------*/ |
| 839 | smeContext = vos_get_context(VOS_MODULE_ID_SME, pvosGCtx); |
| 840 | if ( NULL == smeContext ) |
| 841 | { |
| 842 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 843 | "%s: Invalid smeContext", __func__)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 844 | // continue so that we can cleanup as much as possible |
| 845 | } |
| 846 | else |
| 847 | { |
| 848 | pmcDeregisterDeviceStateUpdateInd( smeContext, WLANTL_PowerStateChangedCB ); |
| 849 | } |
| 850 | |
| 851 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 852 | if(VOS_STATUS_SUCCESS != WLANTL_HSDeInit(pvosGCtx)) |
| 853 | { |
| 854 | TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, |
| 855 | "Handoff Support module DeInit fail")); |
| 856 | } |
| 857 | #endif |
| 858 | |
| 859 | /*------------------------------------------------------------------------ |
| 860 | Cleanup TL control block. |
| 861 | ------------------------------------------------------------------------*/ |
| 862 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 863 | "WLAN TL: WLANTL_Close")); |
| 864 | WLANTL_CleanCB(pTLCb, 1 /* empty queues/lists/pkts if any*/); |
| 865 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 866 | WLANTL_FreeClientMemory(pTLCb->atlSTAClients); |
| 867 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 868 | vos_mem_free(pTLCb->reorderBufferPool); |
| 869 | |
| 870 | /*------------------------------------------------------------------------ |
| 871 | Free TL context from VOSS global |
| 872 | ------------------------------------------------------------------------*/ |
| 873 | vos_free_context(pvosGCtx, VOS_MODULE_ID_TL, pTLCb); |
| 874 | return VOS_STATUS_SUCCESS; |
| 875 | }/* WLANTL_Close */ |
| 876 | |
| 877 | /*---------------------------------------------------------------------------- |
| 878 | INTERACTION WITH HDD |
| 879 | ---------------------------------------------------------------------------*/ |
| 880 | /*========================================================================== |
| 881 | |
| 882 | FUNCTION WLANTL_ConfigureSwFrameTXXlationForAll |
| 883 | |
| 884 | DESCRIPTION |
| 885 | Function to disable/enable frame translation for all association stations. |
| 886 | |
| 887 | DEPENDENCIES |
| 888 | |
| 889 | PARAMETERS |
| 890 | IN |
| 891 | pvosGCtx: VOS context |
| 892 | EnableFrameXlation TRUE means enable SW translation for all stations. |
| 893 | . |
| 894 | |
| 895 | RETURN VALUE |
| 896 | |
| 897 | void. |
| 898 | |
| 899 | ============================================================================*/ |
| 900 | void |
| 901 | WLANTL_ConfigureSwFrameTXXlationForAll |
| 902 | ( |
| 903 | v_PVOID_t pvosGCtx, |
| 904 | v_BOOL_t enableFrameXlation |
| 905 | ) |
| 906 | { |
| 907 | v_U8_t ucIndex; |
| 908 | /*------------------------------------------------------------------------ |
| 909 | Extract TL control block |
| 910 | ------------------------------------------------------------------------*/ |
| 911 | WLANTL_CbType* pTLCb = VOS_GET_TL_CB(pvosGCtx); |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 912 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 913 | if ( NULL == pTLCb ) |
| 914 | { |
| 915 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 916 | "WLAN TL:Invalid TL pointer from pvosGCtx on " |
| 917 | "WLANTL_ConfigureSwFrameTXXlationForAll")); |
| 918 | return; |
| 919 | } |
| 920 | |
| 921 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, |
| 922 | "WLANTL_ConfigureSwFrameTXXlationForAll: Configure SW frameXlation %d", |
| 923 | enableFrameXlation)); |
| 924 | |
| 925 | for ( ucIndex = 0; ucIndex < WLAN_MAX_TID; ucIndex++) |
| 926 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 927 | pClientSTA = pTLCb->atlSTAClients[ucIndex]; |
| 928 | if ( NULL != pClientSTA && 0 != pClientSTA->ucExists ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 929 | { |
| 930 | #ifdef WLAN_SOFTAP_VSTA_FEATURE |
| 931 | // if this station was not allocated resources to perform HW-based |
| 932 | // TX frame translation then force SW-based TX frame translation |
| 933 | // otherwise use the frame translation supplied by the client |
| 934 | if (!WDA_IsHwFrameTxTranslationCapable(pvosGCtx, ucIndex)) |
| 935 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 936 | pClientSTA->wSTADesc.ucSwFrameTXXlation = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 937 | } |
| 938 | else |
| 939 | #endif |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 940 | pClientSTA->wSTADesc.ucSwFrameTXXlation = enableFrameXlation; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 941 | } |
| 942 | } |
| 943 | } |
| 944 | |
| 945 | /*=========================================================================== |
| 946 | |
| 947 | FUNCTION WLANTL_StartForwarding |
| 948 | |
| 949 | DESCRIPTION |
| 950 | |
| 951 | This function is used to ask serialization through TX thread of the |
| 952 | cached frame forwarding (if statation has been registered in the mean while) |
| 953 | or flushing (if station has not been registered by the time) |
| 954 | |
| 955 | In case of forwarding, upper layer is only required to call WLANTL_RegisterSTAClient() |
| 956 | and doesn't need to call this function explicitly. TL will handle this inside |
| 957 | WLANTL_RegisterSTAClient(). |
| 958 | |
| 959 | In case of flushing, upper layer is required to call this function explicitly |
| 960 | |
| 961 | DEPENDENCIES |
| 962 | |
| 963 | TL must have been initialized before this gets called. |
| 964 | |
| 965 | |
| 966 | PARAMETERS |
| 967 | |
| 968 | ucSTAId: station id |
| 969 | |
| 970 | RETURN VALUE |
| 971 | |
| 972 | The result code associated with performing the operation |
| 973 | Please check return values of vos_tx_mq_serialize. |
| 974 | |
| 975 | SIDE EFFECTS |
| 976 | If TL was asked to perform WLANTL_CacheSTAFrame() in WLANTL_RxFrames(), |
| 977 | either WLANTL_RegisterSTAClient() or this function must be called |
| 978 | within reasonable time. Otherwise, TL will keep cached vos buffer until |
| 979 | one of this function is called, and may end up with system buffer exhasution. |
| 980 | |
| 981 | It's an upper layer's responsibility to call this function in case of |
| 982 | flushing |
| 983 | |
| 984 | ============================================================================*/ |
| 985 | |
| 986 | VOS_STATUS |
| 987 | WLANTL_StartForwarding |
| 988 | ( |
| 989 | v_U8_t ucSTAId, |
| 990 | v_U8_t ucUcastSig, |
| 991 | v_U8_t ucBcastSig |
| 992 | ) |
| 993 | { |
| 994 | vos_msg_t sMessage; |
| 995 | v_U32_t uData; |
| 996 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ |
| 997 | |
| 998 | /* Signal the OS to serialize our event */ |
| 999 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, |
| 1000 | "Serializing TL Start Forwarding Cached for control STA %d", |
| 1001 | ucSTAId ); |
| 1002 | |
| 1003 | vos_mem_zero( &sMessage, sizeof(vos_msg_t) ); |
| 1004 | |
| 1005 | uData = ucSTAId | (ucUcastSig << 8 ) | (ucBcastSig << 16); |
| 1006 | sMessage.bodyptr = (v_PVOID_t)uData; |
| 1007 | sMessage.type = WLANTL_TX_FWD_CACHED; |
| 1008 | |
| 1009 | return vos_tx_mq_serialize(VOS_MQ_ID_TL, &sMessage); |
| 1010 | |
| 1011 | } /* WLANTL_StartForwarding() */ |
| 1012 | |
| 1013 | /*=========================================================================== |
| 1014 | |
| 1015 | FUNCTION WLANTL_AssocFailed |
| 1016 | |
| 1017 | DESCRIPTION |
| 1018 | |
| 1019 | This function is used by PE to notify TL that cache needs to flushed' |
| 1020 | when association is not successfully completed |
| 1021 | |
| 1022 | Internally, TL post a message to TX_Thread to serialize the request to |
| 1023 | keep lock-free mechanism. |
| 1024 | |
| 1025 | |
| 1026 | DEPENDENCIES |
| 1027 | |
| 1028 | TL must have been initialized before this gets called. |
| 1029 | |
| 1030 | |
| 1031 | PARAMETERS |
| 1032 | |
| 1033 | ucSTAId: station id |
| 1034 | |
| 1035 | RETURN VALUE |
| 1036 | |
| 1037 | none |
| 1038 | |
| 1039 | SIDE EFFECTS |
| 1040 | There may be race condition that PE call this API and send another association |
| 1041 | request immediately with same staId before TX_thread can process the message. |
| 1042 | |
| 1043 | To avoid this, we might need PE to wait for TX_thread process the message, |
| 1044 | but this is not currently implemented. |
| 1045 | |
| 1046 | ============================================================================*/ |
| 1047 | void WLANTL_AssocFailed(v_U8_t staId) |
| 1048 | { |
| 1049 | // flushing frames and forwarding frames uses the same message |
| 1050 | // the only difference is what happens when the message is processed |
| 1051 | // if the STA exist, the frames will be forwarded |
| 1052 | // and if it doesn't exist, the frames will be flushed |
| 1053 | // in this case we know it won't exist so the DPU index signature values don't matter |
| 1054 | if(!VOS_IS_STATUS_SUCCESS(WLANTL_StartForwarding(staId,0,0))) |
| 1055 | { |
| 1056 | VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1057 | " %s fails to start forwarding", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1058 | } |
| 1059 | } |
| 1060 | |
| 1061 | /*=========================================================================== |
| 1062 | |
| 1063 | FUNCTION WLANTL_Finish_ULA |
| 1064 | |
| 1065 | DESCRIPTION |
| 1066 | This function is used by HDD to notify TL to finish Upper layer authentication |
| 1067 | incase the last EAPOL packet is pending in the TL queue. |
| 1068 | To avoid the race condition between sme set key and the last EAPOL packet |
| 1069 | the HDD module calls this function just before calling the sme_RoamSetKey. |
| 1070 | |
| 1071 | DEPENDENCIES |
| 1072 | |
| 1073 | TL must have been initialized before this gets called. |
| 1074 | |
| 1075 | PARAMETERS |
| 1076 | |
| 1077 | callbackRoutine: HDD Callback function. |
| 1078 | callbackContext : HDD userdata context. |
| 1079 | |
| 1080 | RETURN VALUE |
| 1081 | |
| 1082 | VOS_STATUS_SUCCESS/VOS_STATUS_FAILURE |
| 1083 | |
| 1084 | SIDE EFFECTS |
| 1085 | |
| 1086 | ============================================================================*/ |
| 1087 | |
| 1088 | VOS_STATUS WLANTL_Finish_ULA( void (*callbackRoutine) (void *callbackContext), |
Tushnim Bhattacharyya | 39a8f18 | 2013-02-20 18:10:30 -0800 | [diff] [blame] | 1089 | void *callbackContext) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1090 | { |
Tushnim Bhattacharyya | 39a8f18 | 2013-02-20 18:10:30 -0800 | [diff] [blame] | 1091 | return WDA_DS_FinishULA( callbackRoutine, callbackContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1092 | } |
| 1093 | |
| 1094 | |
| 1095 | /*=========================================================================== |
| 1096 | |
| 1097 | FUNCTION WLANTL_RegisterSTAClient |
| 1098 | |
| 1099 | DESCRIPTION |
| 1100 | |
| 1101 | This function is used by HDD to register as a client for data services |
| 1102 | with TL. HDD will call this API for each new station that it adds, |
| 1103 | thus having the flexibility of registering different callback for each |
| 1104 | STA it services. |
| 1105 | |
| 1106 | DEPENDENCIES |
| 1107 | |
| 1108 | TL must have been initialized before this gets called. |
| 1109 | |
| 1110 | Restriction: |
| 1111 | Main thread will have higher priority that Tx and Rx threads thus |
| 1112 | guaranteeing that a station will be added before any data can be |
| 1113 | received for it. (This enables TL to be lock free) |
| 1114 | |
| 1115 | PARAMETERS |
| 1116 | |
| 1117 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 1118 | control block can be extracted from its context |
| 1119 | pfnStARx: function pointer to the receive packet handler from HDD |
| 1120 | pfnSTATxComp: function pointer to the transmit complete confirmation |
| 1121 | handler from HDD |
| 1122 | pfnSTAFetchPkt: function pointer to the packet retrieval routine in HDD |
| 1123 | wSTADescType: STA Descriptor, contains information related to the |
| 1124 | new added STA |
| 1125 | |
| 1126 | RETURN VALUE |
| 1127 | |
| 1128 | The result code associated with performing the operation |
| 1129 | |
| 1130 | VOS_STATUS_E_INVAL: Input parameters are invalid |
| 1131 | VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to |
| 1132 | TL cb is NULL ; access would cause a page fault |
| 1133 | VOS_STATUS_E_EXISTS: Station was already registered |
| 1134 | VOS_STATUS_SUCCESS: Everything is good :) |
| 1135 | |
| 1136 | SIDE EFFECTS |
| 1137 | |
| 1138 | ============================================================================*/ |
| 1139 | VOS_STATUS |
| 1140 | WLANTL_RegisterSTAClient |
| 1141 | ( |
| 1142 | v_PVOID_t pvosGCtx, |
| 1143 | WLANTL_STARxCBType pfnSTARx, |
| 1144 | WLANTL_TxCompCBType pfnSTATxComp, |
| 1145 | WLANTL_STAFetchPktCBType pfnSTAFetchPkt, |
| 1146 | WLAN_STADescType* pwSTADescType, |
| 1147 | v_S7_t rssi |
| 1148 | ) |
| 1149 | { |
| 1150 | WLANTL_CbType* pTLCb = NULL; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1151 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1152 | v_U8_t ucTid = 0;/*Local variable to clear previous replay counters of STA on all TIDs*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1153 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 1154 | |
| 1155 | /*------------------------------------------------------------------------ |
| 1156 | Sanity check |
| 1157 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1158 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1159 | if (( NULL == pwSTADescType ) || ( NULL == pfnSTARx ) || |
| 1160 | ( NULL == pfnSTAFetchPkt )) |
| 1161 | { |
| 1162 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1163 | "WLAN TL:Invalid parameter sent on WLANTL_RegisterSTAClient")); |
| 1164 | return VOS_STATUS_E_INVAL; |
| 1165 | } |
| 1166 | |
| 1167 | if ( WLANTL_STA_ID_INVALID( pwSTADescType->ucSTAId ) ) |
| 1168 | { |
| 1169 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1170 | "WLAN TL:Invalid station id requested on WLANTL_RegisterSTAClient")); |
| 1171 | return VOS_STATUS_E_FAULT; |
| 1172 | } |
| 1173 | |
| 1174 | /*------------------------------------------------------------------------ |
| 1175 | Extract TL control block |
| 1176 | ------------------------------------------------------------------------*/ |
| 1177 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 1178 | if ( NULL == pTLCb ) |
| 1179 | { |
| 1180 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1181 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_RegisterSTAClient")); |
| 1182 | return VOS_STATUS_E_FAULT; |
| 1183 | } |
| 1184 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1185 | //Code for checking and allocating memory for new STA |
| 1186 | if ( NULL == pTLCb->atlSTAClients[pwSTADescType->ucSTAId] ){ |
| 1187 | pTLCb->atlSTAClients[pwSTADescType->ucSTAId] = vos_mem_malloc(sizeof(WLANTL_STAClientType)); |
| 1188 | if ( NULL == pTLCb->atlSTAClients[pwSTADescType->ucSTAId] ){ |
| 1189 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1190 | "WLAN TL: STA Client memory allocation failed in WLANTL_RegisterSTAClient")); |
| 1191 | return VOS_STATUS_E_FAILURE; |
| 1192 | } |
| 1193 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, |
| 1194 | "WLAN TL: STA Client memory allocation in WLANTL_RegisterSTAClient")); |
| 1195 | vos_mem_zero((v_VOID_t *) pTLCb->atlSTAClients[pwSTADescType->ucSTAId],sizeof(WLANTL_STAClientType)); |
| 1196 | } |
| 1197 | |
| 1198 | //Assigning the pointer to local variable for easy access in future |
| 1199 | pClientSTA = pTLCb->atlSTAClients[pwSTADescType->ucSTAId]; |
| 1200 | if ( 0 != pClientSTA->ucExists ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1201 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1202 | pClientSTA->ucExists++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1203 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1204 | "WLAN TL:Station was already registered on WLANTL_RegisterSTAClient")); |
| 1205 | return VOS_STATUS_E_EXISTS; |
| 1206 | } |
| 1207 | |
| 1208 | /*------------------------------------------------------------------------ |
| 1209 | Register station with TL |
| 1210 | ------------------------------------------------------------------------*/ |
| 1211 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 1212 | "WLAN TL:Registering STA Client ID: %d", pwSTADescType->ucSTAId )); |
| 1213 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1214 | pClientSTA->pfnSTARx = pfnSTARx; |
| 1215 | pClientSTA->pfnSTAFetchPkt = pfnSTAFetchPkt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1216 | |
| 1217 | /* Only register if different from NULL - TL default Tx Comp Cb will |
| 1218 | release the vos packet */ |
| 1219 | if ( NULL != pfnSTATxComp ) |
| 1220 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1221 | pClientSTA->pfnSTATxComp = pfnSTATxComp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1222 | } |
| 1223 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1224 | pClientSTA->tlState = WLANTL_STA_INIT; |
| 1225 | pClientSTA->tlPri = WLANTL_STA_PRI_NORMAL; |
| 1226 | pClientSTA->wSTADesc.ucSTAId = pwSTADescType->ucSTAId; |
Gopichand Nakkala | 8b54e91 | 2013-03-11 10:44:21 +0530 | [diff] [blame] | 1227 | pClientSTA->ptkInstalled = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1228 | |
| 1229 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 1230 | "WLAN TL:Registering STA Client ID: %d with UC %d and BC %d", |
| 1231 | pwSTADescType->ucSTAId, |
| 1232 | pwSTADescType->ucUcastSig, pwSTADescType->ucBcastSig)); |
| 1233 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1234 | pClientSTA->wSTADesc.wSTAType = pwSTADescType->wSTAType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1235 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1236 | pClientSTA->wSTADesc.ucQosEnabled = pwSTADescType->ucQosEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1237 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1238 | pClientSTA->wSTADesc.ucAddRmvLLC = pwSTADescType->ucAddRmvLLC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1239 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1240 | pClientSTA->wSTADesc.ucProtectedFrame = pwSTADescType->ucProtectedFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1241 | |
| 1242 | #ifdef FEATURE_WLAN_CCX |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1243 | pClientSTA->wSTADesc.ucIsCcxSta = pwSTADescType->ucIsCcxSta; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1244 | |
| 1245 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 1246 | "WLAN TL:Registering STA Client ID: %d QoS %d Add LLC %d ProtFrame %d CcxSta %d", |
| 1247 | pwSTADescType->ucSTAId, |
| 1248 | pwSTADescType->ucQosEnabled, |
| 1249 | pwSTADescType->ucAddRmvLLC, |
| 1250 | pwSTADescType->ucProtectedFrame, |
| 1251 | pwSTADescType->ucIsCcxSta)); |
| 1252 | #else |
| 1253 | |
| 1254 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 1255 | "WLAN TL:Registering STA Client ID: %d QoS %d Add LLC %d ProtFrame %d", |
| 1256 | pwSTADescType->ucSTAId, |
| 1257 | pwSTADescType->ucQosEnabled, |
| 1258 | pwSTADescType->ucAddRmvLLC, |
| 1259 | pwSTADescType->ucProtectedFrame)); |
| 1260 | |
| 1261 | #endif //FEATURE_WLAN_CCX |
| 1262 | #ifdef WLAN_SOFTAP_VSTA_FEATURE |
| 1263 | // if this station was not allocated resources to perform HW-based |
| 1264 | // TX frame translation then force SW-based TX frame translation |
| 1265 | // otherwise use the frame translation supplied by the client |
| 1266 | |
| 1267 | if (!WDA_IsHwFrameTxTranslationCapable(pvosGCtx, pwSTADescType->ucSTAId) |
| 1268 | || ( WLAN_STA_BT_AMP == pwSTADescType->wSTAType)) |
| 1269 | { |
| 1270 | pwSTADescType->ucSwFrameTXXlation = 1; |
| 1271 | } |
| 1272 | #endif |
| 1273 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1274 | pClientSTA->wSTADesc.ucSwFrameTXXlation = pwSTADescType->ucSwFrameTXXlation; |
| 1275 | pClientSTA->wSTADesc.ucSwFrameRXXlation = pwSTADescType->ucSwFrameRXXlation; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1276 | |
| 1277 | #ifdef FEATURE_WLAN_WAPI |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1278 | pClientSTA->wSTADesc.ucIsWapiSta = pwSTADescType->ucIsWapiSta; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1279 | #endif /* FEATURE_WLAN_WAPI */ |
| 1280 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1281 | vos_copy_macaddr( &pClientSTA->wSTADesc.vSTAMACAddress, &pwSTADescType->vSTAMACAddress); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1282 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1283 | vos_copy_macaddr( &pClientSTA->wSTADesc.vBSSIDforIBSS, &pwSTADescType->vBSSIDforIBSS); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1284 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1285 | vos_copy_macaddr( &pClientSTA->wSTADesc.vSelfMACAddress, &pwSTADescType->vSelfMACAddress); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1286 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1287 | /* In volans release L replay check is done at TL */ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1288 | pClientSTA->ucIsReplayCheckValid = pwSTADescType->ucIsReplayCheckValid; |
| 1289 | pClientSTA->ulTotalReplayPacketsDetected = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1290 | /*Clear replay counters of the STA on all TIDs*/ |
| 1291 | for(ucTid = 0; ucTid < WLANTL_MAX_TID ; ucTid++) |
| 1292 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1293 | pClientSTA->ullReplayCounter[ucTid] = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1294 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1295 | |
| 1296 | /*-------------------------------------------------------------------- |
| 1297 | Set the AC for the registered station to the highest priority AC |
| 1298 | Even if this AC is not supported by the station, correction will be |
| 1299 | made in the main TL loop after the supported mask is properly |
| 1300 | updated in the pending packets call |
| 1301 | --------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1302 | pClientSTA->ucCurrentAC = WLANTL_AC_VO; |
| 1303 | pClientSTA->ucCurrentWeight = 0; |
| 1304 | pClientSTA->ucServicedAC = WLANTL_AC_BK; |
| 1305 | pClientSTA->ucEapolPktPending = 0; |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 1306 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1307 | vos_mem_zero( pClientSTA->aucACMask, sizeof(pClientSTA->aucACMask)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1308 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1309 | vos_mem_zero( &pClientSTA->wUAPSDInfo, sizeof(pClientSTA->wUAPSDInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1310 | |
| 1311 | /*-------------------------------------------------------------------- |
| 1312 | Reordering info and AMSDU de-aggregation |
| 1313 | --------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1314 | vos_mem_zero( pClientSTA->atlBAReorderInfo, |
| 1315 | sizeof(pClientSTA->atlBAReorderInfo[0])* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1316 | WLAN_MAX_TID); |
| 1317 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1318 | vos_mem_zero( pClientSTA->aucMPDUHeader, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1319 | WLANTL_MPDU_HEADER_LEN); |
| 1320 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1321 | pClientSTA->ucMPDUHeaderLen = 0; |
| 1322 | pClientSTA->vosAMSDUChain = NULL; |
| 1323 | pClientSTA->vosAMSDUChainRoot = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1324 | |
| 1325 | |
| 1326 | /*-------------------------------------------------------------------- |
| 1327 | Stats info |
| 1328 | --------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1329 | vos_mem_zero( pClientSTA->auRxCount, |
| 1330 | sizeof(pClientSTA->auRxCount[0])* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1331 | WLAN_MAX_TID); |
| 1332 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1333 | vos_mem_zero( pClientSTA->auTxCount, |
| 1334 | sizeof(pClientSTA->auRxCount[0])* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1335 | WLAN_MAX_TID); |
| 1336 | /* Initial RSSI is always reported as zero because TL doesnt have enough |
| 1337 | data to calculate RSSI. So to avoid reporting zero, we are initializing |
| 1338 | RSSI with RSSI saved in BssDescription during scanning. */ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1339 | pClientSTA->rssiAvg = rssi; |
Shailender Karmuchi | 13c0d08 | 2013-03-26 14:41:39 -0700 | [diff] [blame^] | 1340 | #ifdef FEATURE_WLAN_TDLS |
| 1341 | if(WLAN_STA_TDLS == pClientSTA->wSTADesc.wSTAType) |
| 1342 | { |
| 1343 | /* If client is TDLS, use TDLS specific alpha */ |
| 1344 | pClientSTA->rssiAlpha = WLANTL_HO_TDLS_ALPHA; |
| 1345 | } |
| 1346 | else |
| 1347 | { |
| 1348 | pClientSTA->rssiAlpha = WLANTL_HO_DEFAULT_ALPHA; |
| 1349 | } |
| 1350 | #else |
| 1351 | pClientSTA->rssiAlpha = WLANTL_HO_DEFAULT_ALPHA; |
| 1352 | #endif /* FEATURE_WLAN_TDLS */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1353 | |
| 1354 | /*Tx not suspended and station fully registered*/ |
| 1355 | vos_atomic_set_U8( |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1356 | &pClientSTA->ucTxSuspended, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1357 | |
| 1358 | /* Used until multiple station support will be added*/ |
| 1359 | pTLCb->ucRegisteredStaId = pwSTADescType->ucSTAId; |
| 1360 | |
| 1361 | /* Save the BAP station ID for future usage */ |
| 1362 | if ( WLAN_STA_BT_AMP == pwSTADescType->wSTAType ) |
| 1363 | { |
| 1364 | pTLCb->tlBAPClient.ucBAPSTAId = pwSTADescType->ucSTAId; |
| 1365 | } |
| 1366 | |
| 1367 | /*------------------------------------------------------------------------ |
| 1368 | Statistics info |
| 1369 | -----------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1370 | memset(&pClientSTA->trafficStatistics, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1371 | 0, sizeof(WLANTL_TRANSFER_STA_TYPE)); |
| 1372 | |
| 1373 | |
| 1374 | /*------------------------------------------------------------------------ |
| 1375 | Start with the state suggested by client caller |
| 1376 | -----------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 6425822 | 2013-01-30 14:35:10 +0530 | [diff] [blame] | 1377 | pClientSTA->tlState = pwSTADescType->ucInitState; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1378 | pClientSTA->ucRxBlocked = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1379 | /*----------------------------------------------------------------------- |
| 1380 | After all the init is complete we can mark the existance flag |
| 1381 | ----------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1382 | pClientSTA->ucExists++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1383 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1384 | //flow control fields init |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1385 | pClientSTA->ucLwmModeEnabled = FALSE; |
| 1386 | pClientSTA->ucLwmEventReported = FALSE; |
| 1387 | pClientSTA->bmuMemConsumed = 0; |
| 1388 | pClientSTA->uIngress_length = 0; |
| 1389 | pClientSTA->uBuffThresholdMax = WLANTL_STA_BMU_THRESHOLD_MAX; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1390 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1391 | pClientSTA->uLwmThreshold = WLANTL_STA_BMU_THRESHOLD_MAX / 3; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1392 | |
| 1393 | //@@@ HDDSOFTAP does not queue unregistered packet for now |
| 1394 | if ( WLAN_STA_SOFTAP != pwSTADescType->wSTAType ) |
| 1395 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1396 | /*------------------------------------------------------------------------ |
| 1397 | Forward received frames while STA was not yet registered |
| 1398 | - ----------------------------------------------------------------------*/ |
| 1399 | if(!VOS_IS_STATUS_SUCCESS(WLANTL_StartForwarding( pwSTADescType->ucSTAId, |
| 1400 | pwSTADescType->ucUcastSig, |
| 1401 | pwSTADescType->ucBcastSig))) |
| 1402 | { |
| 1403 | VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1404 | " %s fails to start forwarding", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1405 | } |
Sunil Ravi | d5406f2 | 2013-01-22 00:18:31 -0800 | [diff] [blame] | 1406 | #ifdef FEATURE_WLAN_TDLS |
| 1407 | if( WLAN_STA_TDLS == pwSTADescType->wSTAType ) |
| 1408 | pTLCb->ucTdlsPeerCount++; |
| 1409 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1410 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1411 | return VOS_STATUS_SUCCESS; |
| 1412 | }/* WLANTL_RegisterSTAClient */ |
| 1413 | |
| 1414 | /*=========================================================================== |
| 1415 | |
| 1416 | FUNCTION WLANTL_ClearSTAClient |
| 1417 | |
| 1418 | DESCRIPTION |
| 1419 | |
| 1420 | HDD will call this API when it no longer needs data services for the |
| 1421 | particular station. |
| 1422 | |
| 1423 | DEPENDENCIES |
| 1424 | |
| 1425 | A station must have been registered before the clear registration is |
| 1426 | called. |
| 1427 | |
| 1428 | PARAMETERS |
| 1429 | |
| 1430 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 1431 | control block can be extracted from its context |
| 1432 | ucSTAId: identifier for the STA to be cleared |
| 1433 | |
| 1434 | RETURN VALUE |
| 1435 | |
| 1436 | The result code associated with performing the operation |
| 1437 | |
| 1438 | VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to |
| 1439 | TL cb is NULL ; access would cause a page fault |
| 1440 | VOS_STATUS_E_EXISTS: Station was not registered |
| 1441 | VOS_STATUS_SUCCESS: Everything is good :) |
| 1442 | |
| 1443 | SIDE EFFECTS |
| 1444 | |
| 1445 | ============================================================================*/ |
| 1446 | VOS_STATUS |
| 1447 | WLANTL_ClearSTAClient |
| 1448 | ( |
| 1449 | v_PVOID_t pvosGCtx, |
| 1450 | v_U8_t ucSTAId |
| 1451 | ) |
| 1452 | { |
| 1453 | WLANTL_CbType* pTLCb = NULL; |
| 1454 | v_U8_t ucIndex; |
| 1455 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 1456 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1457 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1458 | /*------------------------------------------------------------------------ |
| 1459 | Sanity check |
| 1460 | ------------------------------------------------------------------------*/ |
| 1461 | if ( WLANTL_STA_ID_INVALID( ucSTAId ) ) |
| 1462 | { |
| 1463 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1464 | "WLAN TL:Invalid station id requested on WLANTL_ClearSTAClient")); |
| 1465 | return VOS_STATUS_E_FAULT; |
| 1466 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1467 | /*------------------------------------------------------------------------ |
| 1468 | Extract TL control block |
| 1469 | ------------------------------------------------------------------------*/ |
| 1470 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 1471 | if ( NULL == pTLCb ) |
| 1472 | { |
| 1473 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1474 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ClearSTAClient")); |
| 1475 | return VOS_STATUS_E_FAULT; |
| 1476 | } |
| 1477 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1478 | if ( NULL == pTLCb->atlSTAClients[ucSTAId] ) |
| 1479 | { |
| 1480 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1481 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 1482 | return VOS_STATUS_E_FAILURE; |
| 1483 | } |
| 1484 | |
| 1485 | if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1486 | { |
| 1487 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1488 | "WLAN TL:Station was not previously registered on WLANTL_ClearSTAClient")); |
| 1489 | return VOS_STATUS_E_EXISTS; |
| 1490 | } |
| 1491 | |
| 1492 | /* Delete BA sessions on all TID's */ |
| 1493 | for ( ucIndex = 0; ucIndex < WLAN_MAX_TID ; ucIndex++) |
| 1494 | { |
| 1495 | WLANTL_BaSessionDel (pvosGCtx, ucSTAId, ucIndex); |
| 1496 | } |
| 1497 | |
Sunil Ravi | d5406f2 | 2013-01-22 00:18:31 -0800 | [diff] [blame] | 1498 | #ifdef FEATURE_WLAN_TDLS |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1499 | /* decrement ucTdlsPeerCount only if it is non-zero */ |
| 1500 | if(WLAN_STA_TDLS == pTLCb->atlSTAClients[ucSTAId]->wSTADesc.wSTAType |
Sunil Ravi | d5406f2 | 2013-01-22 00:18:31 -0800 | [diff] [blame] | 1501 | && pTLCb->ucTdlsPeerCount) |
| 1502 | pTLCb->ucTdlsPeerCount--; |
| 1503 | #endif |
| 1504 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1505 | /*------------------------------------------------------------------------ |
| 1506 | Clear station |
| 1507 | ------------------------------------------------------------------------*/ |
| 1508 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 1509 | "WLAN TL:Clearing STA Client ID: %d", ucSTAId )); |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1510 | WLANTL_CleanSTA(pTLCb->atlSTAClients[ucSTAId], 1 /*empty packets*/); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1511 | |
| 1512 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 1513 | "WLAN TL:Clearing STA Reset History RSSI and Region number")); |
| 1514 | pTLCb->hoSupport.currentHOState.historyRSSI = 0; |
| 1515 | pTLCb->hoSupport.currentHOState.regionNumber = 0; |
| 1516 | |
| 1517 | return VOS_STATUS_SUCCESS; |
| 1518 | }/* WLANTL_ClearSTAClient */ |
| 1519 | |
| 1520 | /*=========================================================================== |
| 1521 | |
| 1522 | FUNCTION WLANTL_ChangeSTAState |
| 1523 | |
| 1524 | DESCRIPTION |
| 1525 | |
| 1526 | HDD will make this notification whenever a change occurs in the |
| 1527 | connectivity state of a particular STA. |
| 1528 | |
| 1529 | DEPENDENCIES |
| 1530 | |
| 1531 | A station must have been registered before the change state can be |
| 1532 | called. |
| 1533 | |
| 1534 | RESTRICTION: A station is being notified as authenticated before the |
| 1535 | keys are installed in HW. This way if a frame is received |
| 1536 | before the keys are installed DPU will drop that frame. |
| 1537 | |
| 1538 | Main thread has higher priority that Tx and Rx threads thus guaranteeing |
| 1539 | the following: |
| 1540 | - a station will be in assoc state in TL before TL receives any data |
| 1541 | for it |
| 1542 | |
| 1543 | PARAMETERS |
| 1544 | |
| 1545 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 1546 | control block can be extracted from its context |
| 1547 | ucSTAId: identifier for the STA that is pending transmission |
| 1548 | tlSTAState: the new state of the connection to the given station |
| 1549 | |
| 1550 | |
| 1551 | RETURN VALUE |
| 1552 | |
| 1553 | The result code associated with performing the operation |
| 1554 | |
| 1555 | VOS_STATUS_E_INVAL: Input parameters are invalid |
| 1556 | VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to |
| 1557 | TL cb is NULL ; access would cause a page fault |
| 1558 | VOS_STATUS_E_EXISTS: Station was not registered |
| 1559 | VOS_STATUS_SUCCESS: Everything is good :) |
| 1560 | |
| 1561 | SIDE EFFECTS |
| 1562 | |
| 1563 | ============================================================================*/ |
| 1564 | VOS_STATUS |
| 1565 | WLANTL_ChangeSTAState |
| 1566 | ( |
| 1567 | v_PVOID_t pvosGCtx, |
| 1568 | v_U8_t ucSTAId, |
| 1569 | WLANTL_STAStateType tlSTAState |
| 1570 | ) |
| 1571 | { |
| 1572 | WLANTL_CbType* pTLCb = NULL; |
| 1573 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 1574 | |
| 1575 | /*------------------------------------------------------------------------ |
| 1576 | Sanity check |
| 1577 | ------------------------------------------------------------------------*/ |
| 1578 | if ( tlSTAState >= WLANTL_STA_MAX_STATE ) |
| 1579 | { |
| 1580 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1581 | "WLAN TL:Invalid parameter sent on WLANTL_ChangeSTAState")); |
| 1582 | return VOS_STATUS_E_INVAL; |
| 1583 | } |
| 1584 | |
| 1585 | if ( WLANTL_STA_ID_INVALID( ucSTAId ) ) |
| 1586 | { |
| 1587 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1588 | "WLAN TL:Invalid station id requested on WLANTL_ChangeSTAState")); |
| 1589 | return VOS_STATUS_E_FAULT; |
| 1590 | } |
| 1591 | |
| 1592 | /*------------------------------------------------------------------------ |
| 1593 | Extract TL control block and check existance |
| 1594 | ------------------------------------------------------------------------*/ |
| 1595 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 1596 | if ( NULL == pTLCb ) |
| 1597 | { |
| 1598 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1599 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState")); |
| 1600 | return VOS_STATUS_E_FAULT; |
| 1601 | } |
| 1602 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1603 | if ( NULL == pTLCb->atlSTAClients[ucSTAId] ) |
| 1604 | { |
| 1605 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1606 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 1607 | return VOS_STATUS_E_FAILURE; |
| 1608 | } |
| 1609 | |
| 1610 | if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1611 | { |
| 1612 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1613 | "WLAN TL:Station was not previously registered on WLANTL_ChangeSTAState")); |
| 1614 | return VOS_STATUS_E_EXISTS; |
| 1615 | } |
| 1616 | |
| 1617 | /*------------------------------------------------------------------------ |
| 1618 | Change STA state |
| 1619 | No need to lock this operation, see restrictions above |
| 1620 | ------------------------------------------------------------------------*/ |
| 1621 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 1622 | "WLAN TL:Changing state for STA Client ID: %d from %d to %d", |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1623 | ucSTAId, pTLCb->atlSTAClients[ucSTAId]->tlState, tlSTAState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1624 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1625 | pTLCb->atlSTAClients[ucSTAId]->tlState = tlSTAState; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1626 | |
| 1627 | return VOS_STATUS_SUCCESS; |
| 1628 | }/* WLANTL_ChangeSTAState */ |
| 1629 | |
| 1630 | /*=========================================================================== |
| 1631 | |
Gopichand Nakkala | 8b54e91 | 2013-03-11 10:44:21 +0530 | [diff] [blame] | 1632 | FUNCTION WLANTL_STAPtkInstalled |
| 1633 | |
| 1634 | DESCRIPTION |
| 1635 | |
| 1636 | HDD will make this notification whenever PTK is installed for the STA |
| 1637 | |
| 1638 | DEPENDENCIES |
| 1639 | |
| 1640 | A station must have been registered before the change state can be |
| 1641 | called. |
| 1642 | |
| 1643 | PARAMETERS |
| 1644 | |
| 1645 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 1646 | control block can be extracted from its context |
| 1647 | ucSTAId: identifier for the STA for which Pairwise key is |
| 1648 | installed |
| 1649 | |
| 1650 | RETURN VALUE |
| 1651 | |
| 1652 | The result code associated with performing the operation |
| 1653 | |
| 1654 | VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to |
| 1655 | TL cb is NULL ; access would cause a page fault |
| 1656 | VOS_STATUS_E_EXISTS: Station was not registered |
| 1657 | VOS_STATUS_SUCCESS: Everything is good :) |
| 1658 | |
| 1659 | SIDE EFFECTS |
| 1660 | |
| 1661 | ============================================================================*/ |
| 1662 | VOS_STATUS |
| 1663 | WLANTL_STAPtkInstalled |
| 1664 | ( |
| 1665 | v_PVOID_t pvosGCtx, |
| 1666 | v_U8_t ucSTAId |
| 1667 | ) |
| 1668 | { |
| 1669 | WLANTL_CbType* pTLCb = NULL; |
| 1670 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 1671 | |
| 1672 | /*------------------------------------------------------------------------ |
| 1673 | Sanity check |
| 1674 | ------------------------------------------------------------------------*/ |
| 1675 | |
| 1676 | if ( WLANTL_STA_ID_INVALID( ucSTAId ) ) |
| 1677 | { |
| 1678 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1679 | "WLAN TL:Invalid station id requested on WLANTL_ChangeSTAState")); |
| 1680 | return VOS_STATUS_E_FAULT; |
| 1681 | } |
| 1682 | |
| 1683 | /*------------------------------------------------------------------------ |
| 1684 | Extract TL control block and check existance |
| 1685 | ------------------------------------------------------------------------*/ |
| 1686 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 1687 | if ( NULL == pTLCb ) |
| 1688 | { |
| 1689 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1690 | FL("WLAN TL:Invalid TL pointer from pvosGCtx"))); |
| 1691 | return VOS_STATUS_E_FAULT; |
| 1692 | } |
| 1693 | |
| 1694 | if ( NULL == pTLCb->atlSTAClients[ucSTAId] ) |
| 1695 | { |
| 1696 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1697 | FL("WLAN TL:Client Memory was not allocated"))); |
| 1698 | return VOS_STATUS_E_FAILURE; |
| 1699 | } |
| 1700 | |
| 1701 | if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists ) |
| 1702 | { |
| 1703 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1704 | FL("WLAN TL:Station was not previously registered"))); |
| 1705 | return VOS_STATUS_E_EXISTS; |
| 1706 | } |
| 1707 | |
| 1708 | pTLCb->atlSTAClients[ucSTAId]->ptkInstalled = 1; |
| 1709 | |
| 1710 | return VOS_STATUS_SUCCESS; |
| 1711 | }/* WLANTL_STAPtkInstalled */ |
| 1712 | |
| 1713 | /*=========================================================================== |
| 1714 | |
Madan Mohan Koyyalamudi | fc1d1fe | 2012-10-18 15:07:12 -0700 | [diff] [blame] | 1715 | FUNCTION WLANTL_GetSTAState |
| 1716 | |
| 1717 | DESCRIPTION |
| 1718 | |
| 1719 | Returns connectivity state of a particular STA. |
| 1720 | |
| 1721 | DEPENDENCIES |
| 1722 | |
| 1723 | A station must have been registered before its state can be retrieved. |
| 1724 | |
| 1725 | |
| 1726 | PARAMETERS |
| 1727 | |
| 1728 | IN |
| 1729 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 1730 | control block can be extracted from its context |
| 1731 | ucSTAId: identifier of the station |
| 1732 | |
| 1733 | OUT |
| 1734 | ptlSTAState: the current state of the connection to the given station |
| 1735 | |
| 1736 | |
| 1737 | RETURN VALUE |
| 1738 | |
| 1739 | The result code associated with performing the operation |
| 1740 | |
| 1741 | VOS_STATUS_E_INVAL: Input parameters are invalid |
| 1742 | VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to |
| 1743 | TL cb is NULL ; access would cause a page fault |
| 1744 | VOS_STATUS_E_EXISTS: Station was not registered |
| 1745 | VOS_STATUS_SUCCESS: Everything is good :) |
| 1746 | |
| 1747 | SIDE EFFECTS |
| 1748 | |
| 1749 | ============================================================================*/ |
| 1750 | VOS_STATUS |
| 1751 | WLANTL_GetSTAState |
| 1752 | ( |
| 1753 | v_PVOID_t pvosGCtx, |
| 1754 | v_U8_t ucSTAId, |
| 1755 | WLANTL_STAStateType *ptlSTAState |
| 1756 | ) |
| 1757 | { |
| 1758 | WLANTL_CbType* pTLCb = NULL; |
| 1759 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 1760 | |
| 1761 | /*------------------------------------------------------------------------ |
| 1762 | Sanity check |
| 1763 | ------------------------------------------------------------------------*/ |
| 1764 | if ( NULL == ptlSTAState ) |
| 1765 | { |
| 1766 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1767 | "WLAN TL:Invalid parameter sent on WLANTL_GetSTAState")); |
| 1768 | return VOS_STATUS_E_INVAL; |
| 1769 | } |
| 1770 | |
| 1771 | if ( WLANTL_STA_ID_INVALID( ucSTAId ) ) |
| 1772 | { |
| 1773 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1774 | "WLAN TL:Invalid station id requested on WLANTL_GetSTAState")); |
| 1775 | return VOS_STATUS_E_FAULT; |
| 1776 | } |
| 1777 | |
| 1778 | /*------------------------------------------------------------------------ |
| 1779 | Extract TL control block and check existance |
| 1780 | ------------------------------------------------------------------------*/ |
| 1781 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 1782 | if ( NULL == pTLCb ) |
| 1783 | { |
| 1784 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1785 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetSTAState")); |
| 1786 | return VOS_STATUS_E_FAULT; |
| 1787 | } |
| 1788 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1789 | if ( NULL == pTLCb->atlSTAClients[ucSTAId] ) |
| 1790 | { |
| 1791 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1792 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 1793 | return VOS_STATUS_E_FAILURE; |
| 1794 | } |
| 1795 | |
| 1796 | if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists ) |
Madan Mohan Koyyalamudi | fc1d1fe | 2012-10-18 15:07:12 -0700 | [diff] [blame] | 1797 | { |
Sunil Ravi | d5406f2 | 2013-01-22 00:18:31 -0800 | [diff] [blame] | 1798 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, |
Madan Mohan Koyyalamudi | fc1d1fe | 2012-10-18 15:07:12 -0700 | [diff] [blame] | 1799 | "WLAN TL:Station was not previously registered on WLANTL_GetSTAState")); |
| 1800 | return VOS_STATUS_E_EXISTS; |
| 1801 | } |
| 1802 | |
| 1803 | /*------------------------------------------------------------------------ |
| 1804 | Get STA state |
| 1805 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1806 | *ptlSTAState = pTLCb->atlSTAClients[ucSTAId]->tlState; |
Madan Mohan Koyyalamudi | fc1d1fe | 2012-10-18 15:07:12 -0700 | [diff] [blame] | 1807 | |
| 1808 | return VOS_STATUS_SUCCESS; |
| 1809 | }/* WLANTL_GetSTAState */ |
| 1810 | |
| 1811 | /*=========================================================================== |
| 1812 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1813 | FUNCTION WLANTL_STAPktPending |
| 1814 | |
| 1815 | DESCRIPTION |
| 1816 | |
| 1817 | HDD will call this API when a packet is pending transmission in its |
| 1818 | queues. |
| 1819 | |
| 1820 | DEPENDENCIES |
| 1821 | |
| 1822 | A station must have been registered before the packet pending |
| 1823 | notification can be sent. |
| 1824 | |
| 1825 | RESTRICTION: TL will not count packets for pending notification. |
| 1826 | HDD is expected to send the notification only when |
| 1827 | non-empty event gets triggered. Worst case scenario |
| 1828 | is that TL might end up making a call when Hdds |
| 1829 | queues are actually empty. |
| 1830 | |
| 1831 | PARAMETERS |
| 1832 | |
| 1833 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 1834 | control block can be extracted from its context |
| 1835 | ucSTAId: identifier for the STA that is pending transmission |
| 1836 | |
| 1837 | RETURN VALUE |
| 1838 | |
| 1839 | The result code associated with performing the operation |
| 1840 | |
| 1841 | VOS_STATUS_E_INVAL: Input parameters are invalid |
| 1842 | VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer |
| 1843 | to TL cb is NULL ; access would cause a page fault |
| 1844 | VOS_STATUS_E_EXISTS: Station was not registered |
| 1845 | VOS_STATUS_SUCCESS: Everything is good :) |
| 1846 | |
| 1847 | SIDE EFFECTS |
| 1848 | |
| 1849 | ============================================================================*/ |
| 1850 | VOS_STATUS |
| 1851 | WLANTL_STAPktPending |
| 1852 | ( |
| 1853 | v_PVOID_t pvosGCtx, |
| 1854 | v_U8_t ucSTAId, |
| 1855 | WLANTL_ACEnumType ucAc |
| 1856 | ) |
| 1857 | { |
| 1858 | WLANTL_CbType* pTLCb = NULL; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1859 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1860 | vos_msg_t vosMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1861 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 1862 | |
| 1863 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, |
| 1864 | "WLAN TL:Packet pending indication for STA: %d AC: %d", ucSTAId, ucAc); |
| 1865 | |
| 1866 | /*------------------------------------------------------------------------ |
| 1867 | Sanity check |
| 1868 | ------------------------------------------------------------------------*/ |
| 1869 | if ( WLANTL_STA_ID_INVALID( ucSTAId ) ) |
| 1870 | { |
| 1871 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1872 | "WLAN TL:Invalid station id requested on WLANTL_STAPktPending")); |
| 1873 | return VOS_STATUS_E_FAULT; |
| 1874 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1875 | /*------------------------------------------------------------------------ |
| 1876 | Extract TL control block and check existance |
| 1877 | ------------------------------------------------------------------------*/ |
| 1878 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 1879 | if ( NULL == pTLCb ) |
| 1880 | { |
| 1881 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1882 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STAPktPending")); |
| 1883 | return VOS_STATUS_E_FAULT; |
| 1884 | } |
| 1885 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1886 | pClientSTA = pTLCb->atlSTAClients[ucSTAId]; |
| 1887 | |
| 1888 | if ( NULL == pClientSTA ) |
| 1889 | { |
| 1890 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1891 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 1892 | return VOS_STATUS_E_FAILURE; |
| 1893 | } |
| 1894 | |
| 1895 | if ( 0 == pClientSTA->ucExists ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1896 | { |
| 1897 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 1898 | "WLAN TL:Station was not previously registered on WLANTL_STAPktPending")); |
| 1899 | return VOS_STATUS_E_EXISTS; |
| 1900 | } |
| 1901 | |
| 1902 | /*--------------------------------------------------------------------- |
| 1903 | Temporary fix to enable TL to fetch packets when multiple peers join |
| 1904 | an IBSS. To fix CR177301. Needs to go away when the actual fix of |
| 1905 | going through all STA's in round robin fashion gets merged in from |
| 1906 | BT AMP branch. |
| 1907 | --------------------------------------------------------------------*/ |
| 1908 | pTLCb->ucRegisteredStaId = ucSTAId; |
| 1909 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1910 | if( WLANTL_STA_CONNECTED == pClientSTA->tlState ) |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 1911 | { /* EAPOL_HI_PRIORITY : need to find out whether EAPOL is pending before |
| 1912 | WLANTL_FetchPacket()/WLANTL_TxConn() is called. |
| 1913 | change STA_AUTHENTICATED != tlState to CONNECTED == tlState |
| 1914 | to make sure TL is indeed waiting for EAPOL. |
| 1915 | Just in the case when STA got disconnected shortly after connectection */ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1916 | pClientSTA->ucEapolPktPending = 1; |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 1917 | |
| 1918 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 1919 | "WLAN TL:Packet pending indication for STA: %d AC: %d State: %d", |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1920 | ucSTAId, ucAc, pClientSTA->tlState); |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 1921 | } |
| 1922 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1923 | /*----------------------------------------------------------------------- |
| 1924 | Enable this AC in the AC mask in order for TL to start servicing it |
| 1925 | Set packet pending flag |
| 1926 | To avoid race condition, serialize the updation of AC and AC mask |
| 1927 | through WLANTL_TX_STAID_AC_IND message. |
| 1928 | -----------------------------------------------------------------------*/ |
Sunil Ravi | d5406f2 | 2013-01-22 00:18:31 -0800 | [diff] [blame] | 1929 | #ifdef FETURE_WLAN_TDLS |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1930 | if ((WLAN_STA_SOFTAP != pClientSTA->wSTADesc.wSTAType) && |
Sunil Ravi | d5406f2 | 2013-01-22 00:18:31 -0800 | [diff] [blame] | 1931 | !(vos_concurrent_sessions_running()) && |
| 1932 | !pTLCb->ucTdlsPeerCount) |
| 1933 | { |
| 1934 | #else |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1935 | if ((WLAN_STA_SOFTAP != pClientSTA->wSTADesc.wSTAType) && |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 1936 | !(vos_concurrent_sessions_running())) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1937 | { |
| 1938 | #endif |
| 1939 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1940 | pClientSTA->aucACMask[ucAc] = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1941 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 1942 | vos_atomic_set_U8( &pClientSTA->ucPktPending, 1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1943 | |
| 1944 | /*------------------------------------------------------------------------ |
| 1945 | Check if there are enough resources for transmission and tx is not |
| 1946 | suspended. |
| 1947 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | 24a00f9 | 2012-10-22 15:21:02 -0700 | [diff] [blame] | 1948 | if (( pTLCb->uResCount >= WDA_TLI_MIN_RES_DATA ) && |
| 1949 | ( 0 == pTLCb->ucTxSuspended )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1950 | { |
| 1951 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 1952 | "Issuing Xmit start request to BAL")); |
| 1953 | WDA_DS_StartXmit(pvosGCtx); |
| 1954 | } |
| 1955 | else |
| 1956 | { |
| 1957 | /*--------------------------------------------------------------------- |
| 1958 | No error code is sent because TL will resume tx autonomously if |
| 1959 | resources become available or tx gets resumed |
| 1960 | ---------------------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | 179e6fe | 2012-10-15 15:31:08 -0700 | [diff] [blame] | 1961 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1962 | "WLAN TL:Request to send but condition not met. Res: %d,Suspend: %d", |
Madan Mohan Koyyalamudi | 48139e3 | 2012-10-11 14:43:56 -0700 | [diff] [blame] | 1963 | pTLCb->uResCount, pTLCb->ucTxSuspended ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1964 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1965 | } |
| 1966 | else |
| 1967 | { |
| 1968 | vosMsg.reserved = 0; |
| 1969 | vosMsg.bodyval = 0; |
| 1970 | vosMsg.bodyval = (ucAc | (ucSTAId << WLANTL_STAID_OFFSET)); |
| 1971 | vosMsg.type = WLANTL_TX_STAID_AC_IND; |
| 1972 | return vos_tx_mq_serialize( VOS_MQ_ID_TL, &vosMsg); |
| 1973 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1974 | return VOS_STATUS_SUCCESS; |
| 1975 | }/* WLANTL_STAPktPending */ |
| 1976 | |
| 1977 | /*========================================================================== |
| 1978 | |
| 1979 | FUNCTION WLANTL_SetSTAPriority |
| 1980 | |
| 1981 | DESCRIPTION |
| 1982 | |
| 1983 | TL exposes this API to allow upper layers a rough control over the |
| 1984 | priority of transmission for a given station when supporting multiple |
| 1985 | connections. |
| 1986 | |
| 1987 | DEPENDENCIES |
| 1988 | |
| 1989 | A station must have been registered before the change in priority can be |
| 1990 | called. |
| 1991 | |
| 1992 | PARAMETERS |
| 1993 | |
| 1994 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 1995 | control block can be extracted from its context |
| 1996 | ucSTAId: identifier for the STA that has to change priority |
| 1997 | |
| 1998 | RETURN VALUE |
| 1999 | |
| 2000 | The result code associated with performing the operation |
| 2001 | |
| 2002 | VOS_STATUS_E_INVAL: Input parameters are invalid |
| 2003 | VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer |
| 2004 | to TL cb is NULL ; access would cause a page fault |
| 2005 | VOS_STATUS_E_EXISTS: Station was not registered |
| 2006 | VOS_STATUS_SUCCESS: Everything is good :) |
| 2007 | |
| 2008 | SIDE EFFECTS |
| 2009 | |
| 2010 | ============================================================================*/ |
| 2011 | VOS_STATUS |
| 2012 | WLANTL_SetSTAPriority |
| 2013 | ( |
| 2014 | v_PVOID_t pvosGCtx, |
| 2015 | v_U8_t ucSTAId, |
| 2016 | WLANTL_STAPriorityType tlSTAPri |
| 2017 | ) |
| 2018 | { |
| 2019 | WLANTL_CbType* pTLCb = NULL; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 2020 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2021 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 2022 | |
| 2023 | /*------------------------------------------------------------------------ |
| 2024 | Sanity check |
| 2025 | ------------------------------------------------------------------------*/ |
| 2026 | if ( WLANTL_STA_ID_INVALID( ucSTAId ) ) |
| 2027 | { |
| 2028 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2029 | "WLAN TL:Invalid station id requested on WLANTL_SetSTAPriority")); |
| 2030 | return VOS_STATUS_E_FAULT; |
| 2031 | } |
| 2032 | |
| 2033 | /*------------------------------------------------------------------------ |
| 2034 | Extract TL control block |
| 2035 | ------------------------------------------------------------------------*/ |
| 2036 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 2037 | if ( NULL == pTLCb ) |
| 2038 | { |
| 2039 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2040 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SetSTAPriority")); |
| 2041 | return VOS_STATUS_E_FAULT; |
| 2042 | } |
| 2043 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 2044 | pClientSTA = pTLCb->atlSTAClients[ucSTAId]; |
| 2045 | |
| 2046 | if ( NULL == pClientSTA ) |
| 2047 | { |
| 2048 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2049 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 2050 | return VOS_STATUS_E_FAILURE; |
| 2051 | } |
| 2052 | |
| 2053 | if ( 0 == pClientSTA->ucExists ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2054 | { |
| 2055 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2056 | "WLAN TL:Station was not previously registered on WLANTL_SetSTAPriority")); |
| 2057 | return VOS_STATUS_E_EXISTS; |
| 2058 | } |
| 2059 | |
| 2060 | /*------------------------------------------------------------------------ |
| 2061 | Re-analize if lock is needed when adding multiple stations |
| 2062 | ------------------------------------------------------------------------*/ |
| 2063 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 2064 | "WLAN TL:Changing state for STA Pri ID: %d from %d to %d", |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 2065 | ucSTAId, pClientSTA->tlPri, tlSTAPri)); |
| 2066 | pClientSTA->tlPri = tlSTAPri; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2067 | |
| 2068 | return VOS_STATUS_SUCCESS; |
| 2069 | }/* WLANTL_SetSTAPriority */ |
| 2070 | |
| 2071 | |
| 2072 | /*---------------------------------------------------------------------------- |
| 2073 | INTERACTION WITH BAP |
| 2074 | ---------------------------------------------------------------------------*/ |
| 2075 | |
| 2076 | /*========================================================================== |
| 2077 | |
| 2078 | FUNCTION WLANTL_RegisterBAPClient |
| 2079 | |
| 2080 | DESCRIPTION |
| 2081 | Called by SME to register itself as client for non-data BT-AMP packets. |
| 2082 | |
| 2083 | DEPENDENCIES |
| 2084 | TL must be initialized before this function can be called. |
| 2085 | |
| 2086 | PARAMETERS |
| 2087 | |
| 2088 | IN |
| 2089 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 2090 | or SME's control block can be extracted from its context |
| 2091 | pfnTlBAPRxFrm: pointer to the receive processing routine for non-data |
| 2092 | BT-AMP packets |
| 2093 | pfnFlushOpCompleteCb: |
| 2094 | pointer to the call back function, for the Flush operation |
| 2095 | completion. |
| 2096 | |
| 2097 | |
| 2098 | RETURN VALUE |
| 2099 | |
| 2100 | The result code associated with performing the operation |
| 2101 | |
| 2102 | VOS_STATUS_E_INVAL: Input parameters are invalid |
| 2103 | VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer |
| 2104 | to TL cb is NULL ; access would cause a page fault |
| 2105 | VOS_STATUS_E_EXISTS: BAL client was already registered |
| 2106 | VOS_STATUS_SUCCESS: Everything is good :) |
| 2107 | |
| 2108 | SIDE EFFECTS |
| 2109 | |
| 2110 | ============================================================================*/ |
| 2111 | VOS_STATUS |
| 2112 | WLANTL_RegisterBAPClient |
| 2113 | ( |
| 2114 | v_PVOID_t pvosGCtx, |
| 2115 | WLANTL_BAPRxCBType pfnTlBAPRxFrm, |
| 2116 | WLANTL_FlushOpCompCBType pfnFlushOpCompleteCb |
| 2117 | ) |
| 2118 | { |
| 2119 | WLANTL_CbType* pTLCb = NULL; |
| 2120 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 2121 | |
| 2122 | /*------------------------------------------------------------------------ |
| 2123 | Sanity check |
| 2124 | ------------------------------------------------------------------------*/ |
| 2125 | if ( NULL == pfnTlBAPRxFrm ) |
| 2126 | { |
| 2127 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2128 | "WLAN TL:Invalid parameter sent on WLANTL_RegisterBAPClient")); |
| 2129 | return VOS_STATUS_E_INVAL; |
| 2130 | } |
| 2131 | |
| 2132 | if ( NULL == pfnFlushOpCompleteCb ) |
| 2133 | { |
| 2134 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2135 | "Invalid Flush Complete Cb parameter sent on WLANTL_RegisterBAPClient")); |
| 2136 | return VOS_STATUS_E_INVAL; |
| 2137 | } |
| 2138 | |
| 2139 | /*------------------------------------------------------------------------ |
| 2140 | Extract TL control block |
| 2141 | ------------------------------------------------------------------------*/ |
| 2142 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 2143 | if ( NULL == pTLCb ) |
| 2144 | { |
| 2145 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2146 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_RegisterBAPClient")); |
| 2147 | return VOS_STATUS_E_FAULT; |
| 2148 | } |
| 2149 | |
| 2150 | /*------------------------------------------------------------------------ |
| 2151 | Make sure this is the first registration attempt |
| 2152 | ------------------------------------------------------------------------*/ |
| 2153 | if ( 0 != pTLCb->tlBAPClient.ucExists ) |
| 2154 | { |
| 2155 | pTLCb->tlBAPClient.ucExists++; |
| 2156 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2157 | "WLAN TL:BAP client was already registered")); |
| 2158 | return VOS_STATUS_E_EXISTS; |
| 2159 | } |
| 2160 | |
| 2161 | /*------------------------------------------------------------------------ |
| 2162 | Register station with TL |
| 2163 | ------------------------------------------------------------------------*/ |
| 2164 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 2165 | "WLAN TL:Registering BAP Client" )); |
| 2166 | |
| 2167 | pTLCb->tlBAPClient.ucExists++; |
| 2168 | |
| 2169 | if ( NULL != pfnTlBAPRxFrm ) |
| 2170 | { |
| 2171 | pTLCb->tlBAPClient.pfnTlBAPRx = pfnTlBAPRxFrm; |
| 2172 | } |
| 2173 | |
| 2174 | pTLCb->tlBAPClient.pfnFlushOpCompleteCb = pfnFlushOpCompleteCb; |
| 2175 | |
| 2176 | pTLCb->tlBAPClient.vosPendingDataBuff = NULL; |
| 2177 | |
| 2178 | return VOS_STATUS_SUCCESS; |
| 2179 | }/* WLANTL_RegisterBAPClient */ |
| 2180 | |
| 2181 | |
| 2182 | /*========================================================================== |
| 2183 | |
| 2184 | FUNCTION WLANTL_TxBAPFrm |
| 2185 | |
| 2186 | DESCRIPTION |
| 2187 | BAP calls this when it wants to send a frame to the module |
| 2188 | |
| 2189 | DEPENDENCIES |
| 2190 | BAP must be registered with TL before this function can be called. |
| 2191 | |
| 2192 | RESTRICTION: BAP CANNOT push any packets to TL until it did not receive |
| 2193 | a tx complete from the previous packet, that means BAP |
| 2194 | sends one packet, wait for tx complete and then |
| 2195 | sends another one |
| 2196 | |
| 2197 | If BAP sends another packet before TL manages to process the |
| 2198 | previously sent packet call will end in failure |
| 2199 | |
| 2200 | PARAMETERS |
| 2201 | |
| 2202 | IN |
| 2203 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 2204 | or BAP's control block can be extracted from its context |
| 2205 | vosDataBuff: pointer to the vOSS buffer containing the packet to be |
| 2206 | transmitted |
| 2207 | pMetaInfo: meta information about the packet |
| 2208 | pfnTlBAPTxComp: pointer to a transmit complete routine for notifying |
| 2209 | the result of the operation over the bus |
| 2210 | |
| 2211 | RETURN VALUE |
| 2212 | The result code associated with performing the operation |
| 2213 | |
| 2214 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 2215 | page fault |
| 2216 | VOS_STATUS_E_EXISTS: BAL client was not yet registered |
| 2217 | VOS_STATUS_E_BUSY: The previous BT-AMP packet was not yet transmitted |
| 2218 | VOS_STATUS_SUCCESS: Everything is good :) |
| 2219 | |
| 2220 | Other failure messages may be returned from the BD header handling |
| 2221 | routines, please check apropriate API for more info. |
| 2222 | |
| 2223 | SIDE EFFECTS |
| 2224 | |
| 2225 | ============================================================================*/ |
| 2226 | VOS_STATUS |
| 2227 | WLANTL_TxBAPFrm |
| 2228 | ( |
| 2229 | v_PVOID_t pvosGCtx, |
| 2230 | vos_pkt_t* vosDataBuff, |
| 2231 | WLANTL_MetaInfoType* pMetaInfo, |
| 2232 | WLANTL_TxCompCBType pfnTlBAPTxComp |
| 2233 | ) |
| 2234 | { |
| 2235 | WLANTL_CbType* pTLCb = NULL; |
| 2236 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 2237 | v_MACADDR_t vDestMacAddr; |
| 2238 | v_U16_t usPktLen; |
| 2239 | v_U8_t ucStaId = 0; |
| 2240 | v_U8_t extraHeadSpace = 0; |
| 2241 | v_U8_t ucWDSEnabled = 0; |
| 2242 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 2243 | |
| 2244 | /*------------------------------------------------------------------------ |
| 2245 | Sanity check |
| 2246 | Extract TL control block |
| 2247 | ------------------------------------------------------------------------*/ |
| 2248 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 2249 | if ( NULL == pTLCb ) |
| 2250 | { |
| 2251 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2252 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_TxBAPFrm")); |
| 2253 | return VOS_STATUS_E_FAULT; |
| 2254 | } |
| 2255 | |
| 2256 | /*------------------------------------------------------------------------ |
| 2257 | Ensure that BAP client was registered previously |
| 2258 | ------------------------------------------------------------------------*/ |
| 2259 | if (( 0 == pTLCb->tlBAPClient.ucExists ) || |
| 2260 | ( WLANTL_STA_ID_INVALID(pTLCb->tlBAPClient.ucBAPSTAId) )) |
| 2261 | { |
| 2262 | pTLCb->tlBAPClient.ucExists++; |
| 2263 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2264 | "WLAN TL:BAP client not register on WLANTL_TxBAPFrm")); |
| 2265 | return VOS_STATUS_E_EXISTS; |
| 2266 | } |
| 2267 | |
| 2268 | /*------------------------------------------------------------------------ |
| 2269 | Check if any BT-AMP Frm is pending |
| 2270 | ------------------------------------------------------------------------*/ |
| 2271 | if ( NULL != pTLCb->tlBAPClient.vosPendingDataBuff ) |
| 2272 | { |
| 2273 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2274 | "WLAN TL:BT-AMP Frame already pending tx in TL on WLANTL_TxBAPFrm")); |
| 2275 | return VOS_STATUS_E_BUSY; |
| 2276 | } |
| 2277 | |
| 2278 | /*------------------------------------------------------------------------ |
| 2279 | Save buffer and notify BAL; no lock is needed if the above restriction |
| 2280 | is met |
| 2281 | Save the tx complete fnct pointer as tl specific data in the vos buffer |
| 2282 | ------------------------------------------------------------------------*/ |
| 2283 | |
| 2284 | /*------------------------------------------------------------------------ |
| 2285 | Translate 802.3 frame to 802.11 |
| 2286 | ------------------------------------------------------------------------*/ |
| 2287 | ucStaId = pTLCb->tlBAPClient.ucBAPSTAId; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 2288 | if ( NULL == pTLCb->atlSTAClients[ucStaId] ) |
| 2289 | { |
| 2290 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2291 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 2292 | return VOS_STATUS_E_FAILURE; |
| 2293 | } |
| 2294 | if (( 0 == pMetaInfo->ucDisableFrmXtl ) && |
| 2295 | ( 0 != pTLCb->atlSTAClients[ucStaId]->wSTADesc.ucSwFrameTXXlation )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2296 | { |
Kiran Venkatappa | cab0d35 | 2012-12-17 13:09:22 -0800 | [diff] [blame] | 2297 | vosStatus = WLANTL_Translate8023To80211Header( vosDataBuff, &vosStatus, |
| 2298 | pTLCb, &ucStaId, |
| 2299 | pMetaInfo->ucUP, &ucWDSEnabled, &extraHeadSpace); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2300 | |
| 2301 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 2302 | { |
| 2303 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2304 | "WLAN TL:Error when translating header WLANTL_TxBAPFrm")); |
| 2305 | |
| 2306 | return vosStatus; |
| 2307 | } |
| 2308 | |
| 2309 | pMetaInfo->ucDisableFrmXtl = 1; |
| 2310 | } |
| 2311 | |
| 2312 | /*------------------------------------------------------------------------- |
| 2313 | Call HAL to fill BD header |
| 2314 | -------------------------------------------------------------------------*/ |
| 2315 | |
| 2316 | /* Adding Type, SubType which was missing for EAPOL from BAP */ |
| 2317 | pMetaInfo->ucType |= (WLANTL_80211_DATA_TYPE << 4); |
| 2318 | pMetaInfo->ucType |= (WLANTL_80211_DATA_QOS_SUBTYPE); |
| 2319 | |
| 2320 | vosStatus = WDA_DS_BuildTxPacketInfo( pvosGCtx, vosDataBuff , |
| 2321 | &vDestMacAddr, pMetaInfo->ucDisableFrmXtl, |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 2322 | &usPktLen, pTLCb->atlSTAClients[ucStaId]->wSTADesc.ucQosEnabled, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2323 | ucWDSEnabled, extraHeadSpace, pMetaInfo->ucType, |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 2324 | &pTLCb->atlSTAClients[ucStaId]->wSTADesc.vSelfMACAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2325 | pMetaInfo->ucTID, 0 /* No ACK */, pMetaInfo->usTimeStamp, |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 2326 | pMetaInfo->ucIsEapol || pMetaInfo->ucIsWai, pMetaInfo->ucUP ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2327 | |
| 2328 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 2329 | { |
| 2330 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2331 | "WLAN TL:Failed while building TX header %d", vosStatus)); |
| 2332 | return vosStatus; |
| 2333 | } |
| 2334 | |
| 2335 | if ( NULL != pfnTlBAPTxComp ) |
| 2336 | { |
| 2337 | vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL, |
| 2338 | (v_PVOID_t)pfnTlBAPTxComp); |
| 2339 | } |
| 2340 | else |
| 2341 | { |
| 2342 | vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL, |
| 2343 | (v_PVOID_t)WLANTL_TxCompDefaultCb); |
| 2344 | |
| 2345 | } |
| 2346 | |
| 2347 | vos_atomic_set_U32( (v_U32_t*)&pTLCb->tlBAPClient.vosPendingDataBuff, |
| 2348 | (v_U32_t)vosDataBuff); |
| 2349 | |
| 2350 | /*------------------------------------------------------------------------ |
| 2351 | Check if thre are enough resources for transmission and tx is not |
| 2352 | suspended. |
| 2353 | ------------------------------------------------------------------------*/ |
| 2354 | if (( pTLCb->uResCount >= WDA_TLI_MIN_RES_BAP ) && |
| 2355 | ( 0 == pTLCb->ucTxSuspended )) |
| 2356 | { |
| 2357 | WDA_DS_StartXmit(pvosGCtx); |
| 2358 | } |
| 2359 | else |
| 2360 | { |
| 2361 | /*--------------------------------------------------------------------- |
| 2362 | No error code is sent because TL will resume tx autonomously if |
| 2363 | resources become available or tx gets resumed |
| 2364 | ---------------------------------------------------------------------*/ |
| 2365 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 2366 | "WLAN TL:Request to send from BAP but condition not met.Res: %d," |
| 2367 | "Suspend: %d", pTLCb->uResCount, pTLCb->ucTxSuspended )); |
| 2368 | } |
| 2369 | |
| 2370 | return VOS_STATUS_SUCCESS; |
| 2371 | }/* WLANTL_TxBAPFrm */ |
| 2372 | |
| 2373 | |
| 2374 | /*---------------------------------------------------------------------------- |
| 2375 | INTERACTION WITH SME |
| 2376 | ---------------------------------------------------------------------------*/ |
| 2377 | |
| 2378 | /*========================================================================== |
| 2379 | |
| 2380 | FUNCTION WLANTL_GetRssi |
| 2381 | |
| 2382 | DESCRIPTION |
| 2383 | TL will extract the RSSI information from every data packet from the |
| 2384 | ongoing traffic and will store it. It will provide the result to SME |
| 2385 | upon request. |
| 2386 | |
| 2387 | DEPENDENCIES |
| 2388 | |
| 2389 | WARNING: the read and write of this value will not be protected |
| 2390 | by locks, therefore the information obtained after a read |
| 2391 | might not always be consistent. |
| 2392 | |
| 2393 | PARAMETERS |
| 2394 | |
| 2395 | IN |
| 2396 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 2397 | or SME's control block can be extracted from its context |
| 2398 | ucSTAId: station identifier for the requested value |
| 2399 | |
| 2400 | OUT |
| 2401 | puRssi: the average value of the RSSI |
| 2402 | |
| 2403 | |
| 2404 | RETURN VALUE |
| 2405 | The result code associated with performing the operation |
| 2406 | |
| 2407 | VOS_STATUS_E_INVAL: Input parameters are invalid |
| 2408 | VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer |
| 2409 | to TL cb is NULL ; access would cause a page fault |
| 2410 | VOS_STATUS_E_EXISTS: STA was not yet registered |
| 2411 | VOS_STATUS_SUCCESS: Everything is good :) |
| 2412 | |
| 2413 | SIDE EFFECTS |
| 2414 | |
| 2415 | ============================================================================*/ |
| 2416 | VOS_STATUS |
| 2417 | WLANTL_GetRssi |
| 2418 | ( |
| 2419 | v_PVOID_t pvosGCtx, |
| 2420 | v_U8_t ucSTAId, |
| 2421 | v_S7_t* pRssi |
| 2422 | ) |
| 2423 | { |
| 2424 | WLANTL_CbType* pTLCb = NULL; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 2425 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2426 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 2427 | |
| 2428 | /*------------------------------------------------------------------------ |
| 2429 | Sanity check |
| 2430 | ------------------------------------------------------------------------*/ |
| 2431 | if ( NULL == pRssi ) |
| 2432 | { |
| 2433 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2434 | "WLAN TL:Invalid parameter sent on WLANTL_GetRssi")); |
| 2435 | return VOS_STATUS_E_INVAL; |
| 2436 | } |
| 2437 | |
| 2438 | if ( WLANTL_STA_ID_INVALID( ucSTAId ) ) |
| 2439 | { |
| 2440 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2441 | "WLAN TL:Invalid station id requested on WLANTL_GetRssi")); |
| 2442 | return VOS_STATUS_E_FAULT; |
| 2443 | } |
| 2444 | |
| 2445 | /*------------------------------------------------------------------------ |
| 2446 | Extract TL control block and check existance |
| 2447 | ------------------------------------------------------------------------*/ |
| 2448 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 2449 | if ( NULL == pTLCb ) |
| 2450 | { |
| 2451 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2452 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetRssi")); |
| 2453 | return VOS_STATUS_E_FAULT; |
| 2454 | } |
| 2455 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 2456 | pClientSTA = pTLCb->atlSTAClients[ucSTAId]; |
| 2457 | |
| 2458 | if ( NULL == pClientSTA ) |
| 2459 | { |
| 2460 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2461 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 2462 | return VOS_STATUS_E_FAILURE; |
| 2463 | } |
| 2464 | |
| 2465 | if ( 0 == pClientSTA->ucExists ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2466 | { |
| 2467 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2468 | "WLAN TL:Station was not previously registered on WLANTL_GetRssi")); |
| 2469 | return VOS_STATUS_E_EXISTS; |
| 2470 | } |
| 2471 | |
| 2472 | /*------------------------------------------------------------------------ |
| 2473 | Copy will not be locked; please read restriction |
| 2474 | ------------------------------------------------------------------------*/ |
| 2475 | if(pTLCb->isBMPS) |
| 2476 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 2477 | *pRssi = pClientSTA->rssiAvgBmps; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2478 | /* Check If RSSI is zero because we are reading rssAvgBmps updated by HAL in |
| 2479 | previous GetStatsRequest. It may be updated as zero by Hal because EnterBmps |
| 2480 | might not have happend by that time. Hence reading the most recent Rssi |
| 2481 | calcluated by TL*/ |
| 2482 | if(0 == *pRssi) |
| 2483 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 2484 | *pRssi = pClientSTA->rssiAvg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2485 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2486 | } |
| 2487 | else |
| 2488 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 2489 | *pRssi = pClientSTA->rssiAvg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2490 | } |
| 2491 | |
| 2492 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2493 | "WLAN TL:WLANTL_GetRssi for STA: %d RSSI: %d%s", |
| 2494 | ucSTAId, *pRssi, |
| 2495 | pTLCb->isBMPS ? " in BMPS" : "")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2496 | |
| 2497 | return VOS_STATUS_SUCCESS; |
| 2498 | }/* WLANTL_GetRssi */ |
| 2499 | |
| 2500 | /*========================================================================== |
| 2501 | |
| 2502 | FUNCTION WLANTL_GetLinkQuality |
| 2503 | |
| 2504 | DESCRIPTION |
| 2505 | TL will extract the SNR information from every data packet from the |
| 2506 | ongoing traffic and will store it. It will provide the result to SME |
| 2507 | upon request. |
| 2508 | |
| 2509 | DEPENDENCIES |
| 2510 | |
| 2511 | WARNING: the read and write of this value will not be protected |
| 2512 | by locks, therefore the information obtained after a read |
| 2513 | might not always be consistent. |
| 2514 | |
| 2515 | PARAMETERS |
| 2516 | |
| 2517 | IN |
| 2518 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 2519 | or SME's control block can be extracted from its context |
| 2520 | ucSTAId: station identifier for the requested value |
| 2521 | |
| 2522 | OUT |
| 2523 | puLinkQuality: the average value of the SNR |
| 2524 | |
| 2525 | |
| 2526 | RETURN VALUE |
| 2527 | The result code associated with performing the operation |
| 2528 | |
| 2529 | VOS_STATUS_E_INVAL: Input parameters are invalid |
| 2530 | VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer |
| 2531 | to TL cb is NULL ; access would cause a page fault |
| 2532 | VOS_STATUS_E_EXISTS: STA was not yet registered |
| 2533 | VOS_STATUS_SUCCESS: Everything is good :) |
| 2534 | |
| 2535 | SIDE EFFECTS |
| 2536 | |
| 2537 | ============================================================================*/ |
| 2538 | VOS_STATUS |
| 2539 | WLANTL_GetLinkQuality |
| 2540 | ( |
| 2541 | v_PVOID_t pvosGCtx, |
| 2542 | v_U8_t ucSTAId, |
| 2543 | v_U32_t* puLinkQuality |
| 2544 | ) |
| 2545 | { |
| 2546 | WLANTL_CbType* pTLCb = NULL; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 2547 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2548 | |
| 2549 | /*------------------------------------------------------------------------ |
| 2550 | Sanity check |
| 2551 | ------------------------------------------------------------------------*/ |
| 2552 | if ( NULL == puLinkQuality ) |
| 2553 | { |
| 2554 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2555 | "Invalid parameter sent on WLANTL_GetLinkQuality")); |
| 2556 | return VOS_STATUS_E_INVAL; |
| 2557 | } |
| 2558 | |
| 2559 | if ( WLANTL_STA_ID_INVALID( ucSTAId ) ) |
| 2560 | { |
| 2561 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2562 | "Invalid station id requested on WLANTL_GetLinkQuality")); |
| 2563 | return VOS_STATUS_E_FAULT; |
| 2564 | } |
| 2565 | |
| 2566 | /*------------------------------------------------------------------------ |
| 2567 | Extract TL control block and check existance |
| 2568 | ------------------------------------------------------------------------*/ |
| 2569 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 2570 | if ( NULL == pTLCb ) |
| 2571 | { |
| 2572 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2573 | "Invalid TL pointer from pvosGCtx on WLANTL_GetLinkQuality")); |
| 2574 | return VOS_STATUS_E_FAULT; |
| 2575 | } |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 2576 | pClientSTA = pTLCb->atlSTAClients[ucSTAId]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2577 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 2578 | if ( NULL == pClientSTA ) |
| 2579 | { |
| 2580 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2581 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 2582 | return VOS_STATUS_E_FAILURE; |
| 2583 | } |
| 2584 | |
| 2585 | if ( 0 == pClientSTA->ucExists ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2586 | { |
| 2587 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2588 | "Station was not previously registered on WLANTL_GetLinkQuality")); |
| 2589 | return VOS_STATUS_E_EXISTS; |
| 2590 | } |
| 2591 | |
| 2592 | /*------------------------------------------------------------------------ |
| 2593 | Copy will not be locked; please read restriction |
| 2594 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 2595 | *puLinkQuality = pClientSTA->uLinkQualityAvg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2596 | |
| 2597 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 2598 | "WLANTL_GetLinkQuality for STA: %d LinkQuality: %d", ucSTAId, *puLinkQuality)); |
| 2599 | |
| 2600 | return VOS_STATUS_SUCCESS; |
| 2601 | }/* WLANTL_GetLinkQuality */ |
| 2602 | |
| 2603 | /*========================================================================== |
| 2604 | |
| 2605 | FUNCTION WLANTL_FlushStaTID |
| 2606 | |
| 2607 | DESCRIPTION |
| 2608 | TL provides this API as an interface to SME (BAP) layer. TL inturn posts a |
| 2609 | message to HAL. This API is called by the SME inorder to perform a flush |
| 2610 | operation. |
| 2611 | |
| 2612 | DEPENDENCIES |
| 2613 | |
| 2614 | PARAMETERS |
| 2615 | |
| 2616 | IN |
| 2617 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 2618 | or SME's control block can be extracted from its context |
| 2619 | ucSTAId: station identifier for the requested value |
| 2620 | ucTid: Tspec ID for the new BA session |
| 2621 | |
| 2622 | OUT |
| 2623 | The response for this post is received in the main thread, via a response |
| 2624 | message from HAL to TL. |
| 2625 | |
| 2626 | RETURN VALUE |
| 2627 | VOS_STATUS_SUCCESS: Everything is good :) |
| 2628 | |
| 2629 | SIDE EFFECTS |
| 2630 | ============================================================================*/ |
| 2631 | VOS_STATUS |
| 2632 | WLANTL_FlushStaTID |
| 2633 | ( |
| 2634 | v_PVOID_t pvosGCtx, |
| 2635 | v_U8_t ucSTAId, |
| 2636 | v_U8_t ucTid |
| 2637 | ) |
| 2638 | { |
| 2639 | WLANTL_CbType* pTLCb = NULL; |
| 2640 | tpFlushACReq FlushACReqPtr = NULL; |
| 2641 | vos_msg_t vosMessage; |
| 2642 | |
| 2643 | |
| 2644 | if ( WLANTL_STA_ID_INVALID( ucSTAId ) ) |
| 2645 | { |
| 2646 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2647 | "Invalid station id requested on WLANTL_FlushStaTID")); |
| 2648 | return VOS_STATUS_E_FAULT; |
| 2649 | } |
| 2650 | |
| 2651 | /*------------------------------------------------------------------------ |
| 2652 | Extract TL control block and check existance |
| 2653 | ------------------------------------------------------------------------*/ |
| 2654 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 2655 | if ( NULL == pTLCb ) |
| 2656 | { |
| 2657 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2658 | "Invalid TL pointer from pvosGCtx on WLANTL_FlushStaTID")); |
| 2659 | return VOS_STATUS_E_FAULT; |
| 2660 | } |
| 2661 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 2662 | if ( NULL == pTLCb->atlSTAClients[ucSTAId] ) |
| 2663 | { |
| 2664 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2665 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 2666 | return VOS_STATUS_E_FAILURE; |
| 2667 | } |
| 2668 | |
| 2669 | if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2670 | { |
| 2671 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2672 | "Station was not previously registered on WLANTL_FlushStaTID")); |
| 2673 | return VOS_STATUS_E_EXISTS; |
| 2674 | } |
| 2675 | |
| 2676 | /*------------------------------------------------------------------------ |
| 2677 | We need to post a message with the STA, TID value to HAL. HAL performs the flush |
| 2678 | ------------------------------------------------------------------------*/ |
| 2679 | FlushACReqPtr = vos_mem_malloc(sizeof(tFlushACReq)); |
| 2680 | |
| 2681 | if ( NULL == FlushACReqPtr ) |
| 2682 | { |
| 2683 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2684 | "WLAN TL: fatal failure, cannot allocate Flush Req structure")); |
| 2685 | VOS_ASSERT(0); |
| 2686 | return VOS_STATUS_E_NOMEM; |
| 2687 | } |
| 2688 | |
| 2689 | // Start constructing the message for HAL |
| 2690 | FlushACReqPtr->mesgType = SIR_TL_HAL_FLUSH_AC_REQ; |
| 2691 | FlushACReqPtr->mesgLen = sizeof(tFlushACReq); |
| 2692 | FlushACReqPtr->mesgLen = sizeof(tFlushACReq); |
| 2693 | FlushACReqPtr->ucSTAId = ucSTAId; |
| 2694 | FlushACReqPtr->ucTid = ucTid; |
| 2695 | |
| 2696 | vosMessage.type = WDA_TL_FLUSH_AC_REQ; |
| 2697 | vosMessage.bodyptr = (void *)FlushACReqPtr; |
| 2698 | |
| 2699 | vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage); |
| 2700 | return VOS_STATUS_SUCCESS; |
| 2701 | } |
| 2702 | |
| 2703 | |
| 2704 | /*---------------------------------------------------------------------------- |
| 2705 | INTERACTION WITH PE |
| 2706 | ---------------------------------------------------------------------------*/ |
| 2707 | |
| 2708 | /*========================================================================== |
| 2709 | |
| 2710 | FUNCTION WLANTL_RegisterMgmtFrmClient |
| 2711 | |
| 2712 | DESCRIPTION |
| 2713 | Called by PE to register as a client for management frames delivery. |
| 2714 | |
| 2715 | DEPENDENCIES |
| 2716 | TL must be initialized before this API can be called. |
| 2717 | |
| 2718 | PARAMETERS |
| 2719 | |
| 2720 | IN |
| 2721 | pvosGCtx: pointer to the global vos context; a handle to |
| 2722 | TL's control block can be extracted from its context |
| 2723 | pfnTlMgmtFrmRx: pointer to the receive processing routine for |
| 2724 | management frames |
| 2725 | |
| 2726 | RETURN VALUE |
| 2727 | The result code associated with performing the operation |
| 2728 | |
| 2729 | VOS_STATUS_E_INVAL: Input parameters are invalid |
| 2730 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 2731 | page fault |
| 2732 | VOS_STATUS_E_EXISTS: Mgmt Frame client was already registered |
| 2733 | VOS_STATUS_SUCCESS: Everything is good :) |
| 2734 | |
| 2735 | SIDE EFFECTS |
| 2736 | |
| 2737 | ============================================================================*/ |
| 2738 | VOS_STATUS |
| 2739 | WLANTL_RegisterMgmtFrmClient |
| 2740 | ( |
| 2741 | v_PVOID_t pvosGCtx, |
| 2742 | WLANTL_MgmtFrmRxCBType pfnTlMgmtFrmRx |
| 2743 | ) |
| 2744 | { |
| 2745 | WLANTL_CbType* pTLCb = NULL; |
| 2746 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 2747 | |
| 2748 | /*------------------------------------------------------------------------ |
| 2749 | Sanity check |
| 2750 | ------------------------------------------------------------------------*/ |
| 2751 | if ( NULL == pfnTlMgmtFrmRx ) |
| 2752 | { |
| 2753 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2754 | "WLAN TL:Invalid parameter sent on WLANTL_RegisterMgmtFrmClient")); |
| 2755 | return VOS_STATUS_E_INVAL; |
| 2756 | } |
| 2757 | |
| 2758 | /*------------------------------------------------------------------------ |
| 2759 | Extract TL control block |
| 2760 | ------------------------------------------------------------------------*/ |
| 2761 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 2762 | if ( NULL == pTLCb ) |
| 2763 | { |
| 2764 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2765 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState")); |
| 2766 | return VOS_STATUS_E_FAULT; |
| 2767 | } |
| 2768 | |
| 2769 | /*------------------------------------------------------------------------ |
| 2770 | Make sure this is the first registration attempt |
| 2771 | ------------------------------------------------------------------------*/ |
| 2772 | if ( 0 != pTLCb->tlMgmtFrmClient.ucExists ) |
| 2773 | { |
| 2774 | pTLCb->tlMgmtFrmClient.ucExists++; |
| 2775 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2776 | "WLAN TL:Management frame client was already registered")); |
| 2777 | return VOS_STATUS_E_EXISTS; |
| 2778 | } |
| 2779 | |
| 2780 | /*------------------------------------------------------------------------ |
| 2781 | Register station with TL |
| 2782 | ------------------------------------------------------------------------*/ |
| 2783 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 2784 | "WLAN TL:Registering Management Frame Client" )); |
| 2785 | |
| 2786 | pTLCb->tlMgmtFrmClient.ucExists++; |
| 2787 | |
| 2788 | if ( NULL != pfnTlMgmtFrmRx ) |
| 2789 | { |
| 2790 | pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx = pfnTlMgmtFrmRx; |
| 2791 | } |
| 2792 | |
| 2793 | pTLCb->tlMgmtFrmClient.vosPendingDataBuff = NULL; |
| 2794 | |
| 2795 | return VOS_STATUS_SUCCESS; |
| 2796 | }/* WLANTL_RegisterMgmtFrmClient */ |
| 2797 | |
| 2798 | /*========================================================================== |
| 2799 | |
| 2800 | FUNCTION WLANTL_DeRegisterMgmtFrmClient |
| 2801 | |
| 2802 | DESCRIPTION |
| 2803 | Called by PE to deregister as a client for management frames delivery. |
| 2804 | |
| 2805 | DEPENDENCIES |
| 2806 | TL must be initialized before this API can be called. |
| 2807 | |
| 2808 | PARAMETERS |
| 2809 | |
| 2810 | IN |
| 2811 | pvosGCtx: pointer to the global vos context; a handle to |
| 2812 | TL's control block can be extracted from its context |
| 2813 | RETURN VALUE |
| 2814 | The result code associated with performing the operation |
| 2815 | |
| 2816 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 2817 | page fault |
| 2818 | VOS_STATUS_E_EXISTS: Mgmt Frame client was never registered |
| 2819 | VOS_STATUS_SUCCESS: Everything is good :) |
| 2820 | |
| 2821 | SIDE EFFECTS |
| 2822 | |
| 2823 | ============================================================================*/ |
| 2824 | VOS_STATUS |
| 2825 | WLANTL_DeRegisterMgmtFrmClient |
| 2826 | ( |
| 2827 | v_PVOID_t pvosGCtx |
| 2828 | ) |
| 2829 | { |
| 2830 | WLANTL_CbType* pTLCb = NULL; |
| 2831 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 2832 | |
| 2833 | /*------------------------------------------------------------------------ |
| 2834 | Extract TL control block |
| 2835 | ------------------------------------------------------------------------*/ |
| 2836 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 2837 | if ( NULL == pTLCb ) |
| 2838 | { |
| 2839 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2840 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState")); |
| 2841 | return VOS_STATUS_E_FAULT; |
| 2842 | } |
| 2843 | |
| 2844 | /*------------------------------------------------------------------------ |
| 2845 | Make sure this is the first registration attempt |
| 2846 | ------------------------------------------------------------------------*/ |
| 2847 | if ( 0 == pTLCb->tlMgmtFrmClient.ucExists ) |
| 2848 | { |
| 2849 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2850 | "WLAN TL:Management frame client was never registered")); |
| 2851 | return VOS_STATUS_E_EXISTS; |
| 2852 | } |
| 2853 | |
| 2854 | /*------------------------------------------------------------------------ |
| 2855 | Clear registration with TL |
| 2856 | ------------------------------------------------------------------------*/ |
| 2857 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 2858 | "WLAN TL:Deregistering Management Frame Client" )); |
| 2859 | |
| 2860 | pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx = WLANTL_MgmtFrmRxDefaultCb; |
| 2861 | if ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff) |
| 2862 | { |
| 2863 | TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, |
| 2864 | "WLAN TL:Management cache buffer not empty on deregistering" |
| 2865 | " - dropping packet" )); |
| 2866 | vos_pkt_return_packet(pTLCb->tlMgmtFrmClient.vosPendingDataBuff); |
| 2867 | |
| 2868 | pTLCb->tlMgmtFrmClient.vosPendingDataBuff = NULL; |
| 2869 | } |
| 2870 | |
| 2871 | pTLCb->tlMgmtFrmClient.ucExists = 0; |
| 2872 | |
| 2873 | return VOS_STATUS_SUCCESS; |
| 2874 | }/* WLANTL_RegisterMgmtFrmClient */ |
| 2875 | |
| 2876 | /*========================================================================== |
| 2877 | |
| 2878 | FUNCTION WLANTL_TxMgmtFrm |
| 2879 | |
| 2880 | DESCRIPTION |
| 2881 | Called by PE when it want to send out a management frame. |
| 2882 | HAL will also use this API for the few frames it sends out, they are not |
| 2883 | management frames howevere it is accepted that an exception will be |
| 2884 | allowed ONLY for the usage of HAL. |
| 2885 | Generic data frames SHOULD NOT travel through this function. |
| 2886 | |
| 2887 | DEPENDENCIES |
| 2888 | TL must be initialized before this API can be called. |
| 2889 | |
| 2890 | RESTRICTION: If PE sends another packet before TL manages to process the |
| 2891 | previously sent packet call will end in failure |
| 2892 | |
| 2893 | Frames comming through here must be 802.11 frames, frame |
| 2894 | translation in UMA will be automatically disabled. |
| 2895 | |
| 2896 | PARAMETERS |
| 2897 | |
| 2898 | IN |
| 2899 | pvosGCtx: pointer to the global vos context;a handle to TL's |
| 2900 | control block can be extracted from its context |
| 2901 | vosFrmBuf: pointer to a vOSS buffer containing the management |
| 2902 | frame to be transmitted |
| 2903 | usFrmLen: the length of the frame to be transmitted; information |
| 2904 | is already included in the vOSS buffer |
| 2905 | wFrmType: the type of the frame being transmitted |
| 2906 | tid: tid used to transmit this frame |
| 2907 | pfnCompTxFunc: function pointer to the transmit complete routine |
| 2908 | pvBDHeader: pointer to the BD header, if NULL it means it was not |
| 2909 | yet constructed and it lies within TL's responsibility |
| 2910 | to do so; if not NULL it is expected that it was |
| 2911 | already packed inside the vos packet |
| 2912 | ucAckResponse: flag notifying it an interrupt is needed for the |
| 2913 | acknowledgement received when the frame is sent out |
| 2914 | the air and ; the interrupt will be processed by HAL, |
| 2915 | only one such frame can be pending in the system at |
| 2916 | one time. |
| 2917 | |
| 2918 | |
| 2919 | RETURN VALUE |
| 2920 | The result code associated with performing the operation |
| 2921 | |
| 2922 | VOS_STATUS_E_INVAL: Input parameters are invalid |
| 2923 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 2924 | page fault |
| 2925 | VOS_STATUS_E_EXISTS: Mgmt Frame client was not yet registered |
| 2926 | VOS_STATUS_E_BUSY: The previous Mgmt packet was not yet transmitted |
| 2927 | VOS_STATUS_SUCCESS: Everything is good :) |
| 2928 | |
| 2929 | Other failure messages may be returned from the BD header handling |
| 2930 | routines, please check apropriate API for more info. |
| 2931 | |
| 2932 | SIDE EFFECTS |
| 2933 | |
| 2934 | ============================================================================*/ |
| 2935 | VOS_STATUS |
| 2936 | WLANTL_TxMgmtFrm |
| 2937 | ( |
| 2938 | v_PVOID_t pvosGCtx, |
| 2939 | vos_pkt_t* vosFrmBuf, |
| 2940 | v_U16_t usFrmLen, |
| 2941 | v_U8_t wFrmType, |
| 2942 | v_U8_t ucTid, |
| 2943 | WLANTL_TxCompCBType pfnCompTxFunc, |
| 2944 | v_PVOID_t pvBDHeader, |
| 2945 | v_U8_t ucAckResponse |
| 2946 | ) |
| 2947 | { |
| 2948 | WLANTL_CbType* pTLCb = NULL; |
| 2949 | v_MACADDR_t vDestMacAddr; |
| 2950 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 2951 | v_U16_t usPktLen; |
| 2952 | v_U32_t usTimeStamp = 0; |
| 2953 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 2954 | |
| 2955 | /*------------------------------------------------------------------------ |
| 2956 | Sanity check |
| 2957 | ------------------------------------------------------------------------*/ |
| 2958 | if ( NULL == vosFrmBuf ) |
| 2959 | { |
| 2960 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 2961 | "WLAN TL:Invalid parameter sent on WLANTL_TxMgmtFrm")); |
| 2962 | return VOS_STATUS_E_INVAL; |
| 2963 | } |
| 2964 | |
| 2965 | /*------------------------------------------------------------------------ |
| 2966 | Extract TL control block |
| 2967 | ------------------------------------------------------------------------*/ |
| 2968 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 2969 | if ( NULL == pTLCb ) |
| 2970 | { |
| 2971 | TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL, |
| 2972 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_TxMgmtFrm")); |
| 2973 | return VOS_STATUS_E_FAULT; |
| 2974 | } |
| 2975 | |
| 2976 | /*------------------------------------------------------------------------ |
| 2977 | Ensure that management frame client was previously registered |
| 2978 | ------------------------------------------------------------------------*/ |
| 2979 | if ( 0 == pTLCb->tlMgmtFrmClient.ucExists ) |
| 2980 | { |
| 2981 | pTLCb->tlMgmtFrmClient.ucExists++; |
| 2982 | TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL, |
| 2983 | "WLAN TL:Management Frame client not register on WLANTL_TxMgmtFrm")); |
| 2984 | return VOS_STATUS_E_EXISTS; |
| 2985 | } |
| 2986 | |
| 2987 | /*------------------------------------------------------------------------ |
| 2988 | Check if any Mgmt Frm is pending |
| 2989 | ------------------------------------------------------------------------*/ |
| 2990 | //vosTempBuff = pTLCb->tlMgmtFrmClient.vosPendingDataBuff; |
| 2991 | if ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff ) |
| 2992 | { |
| 2993 | |
| 2994 | TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL, |
| 2995 | "WLAN TL:Management Frame already pending tx in TL: failing old one")); |
| 2996 | |
| 2997 | |
| 2998 | /*Failing the tx for the previous packet enqued by PE*/ |
| 2999 | //vos_atomic_set_U32( (v_U32_t*)&pTLCb->tlMgmtFrmClient.vosPendingDataBuff, |
| 3000 | // (v_U32_t)NULL); |
| 3001 | |
| 3002 | //vos_pkt_get_user_data_ptr( vosTempBuff, VOS_PKT_USER_DATA_ID_TL, |
| 3003 | // (v_PVOID_t)&pfnTxComp); |
| 3004 | |
| 3005 | /*it should never be NULL - default handler should be registered if none*/ |
| 3006 | //if ( NULL == pfnTxComp ) |
| 3007 | //{ |
| 3008 | // VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3009 | // "NULL pointer to Tx Complete on WLANTL_TxMgmtFrm"); |
| 3010 | // VOS_ASSERT(0); |
| 3011 | // return VOS_STATUS_E_FAULT; |
| 3012 | //} |
| 3013 | |
| 3014 | //pfnTxComp( pvosGCtx, vosTempBuff, VOS_STATUS_E_RESOURCES ); |
| 3015 | //return VOS_STATUS_E_BUSY; |
| 3016 | |
| 3017 | |
| 3018 | //pfnCompTxFunc( pvosGCtx, vosFrmBuf, VOS_STATUS_E_RESOURCES); |
| 3019 | return VOS_STATUS_E_RESOURCES; |
| 3020 | } |
| 3021 | |
| 3022 | |
| 3023 | /*------------------------------------------------------------------------ |
| 3024 | Check if BD header was build, if not construct |
| 3025 | ------------------------------------------------------------------------*/ |
| 3026 | if ( NULL == pvBDHeader ) |
| 3027 | { |
| 3028 | v_MACADDR_t* pvAddr2MacAddr; |
| 3029 | v_U8_t uQosHdr = VOS_FALSE; |
| 3030 | |
| 3031 | /* Get address 2 of Mangement Frame to give to WLANHAL_FillTxBd */ |
| 3032 | vosStatus = vos_pkt_peek_data( vosFrmBuf, |
| 3033 | WLANTL_MAC_ADDR_ALIGN(1) + VOS_MAC_ADDR_SIZE, |
| 3034 | (v_PVOID_t)&pvAddr2MacAddr, VOS_MAC_ADDR_SIZE); |
| 3035 | |
| 3036 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 3037 | { |
| 3038 | TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL, |
| 3039 | "WLAN TL:Failed while attempting to get addr2 %d", vosStatus)); |
| 3040 | return vosStatus; |
| 3041 | } |
| 3042 | #ifdef FEATURE_WLAN_CCX |
| 3043 | /* CCX IAPP Frame which are data frames but technically used |
| 3044 | * for management functionality comes through route. |
| 3045 | */ |
| 3046 | if (WLANTL_IS_QOS_DATA_FRAME(wFrmType)) \ |
| 3047 | { |
| 3048 | uQosHdr = VOS_TRUE; |
| 3049 | } |
| 3050 | #endif |
| 3051 | /*---------------------------------------------------------------------- |
| 3052 | Call WDA to build TX header |
| 3053 | ----------------------------------------------------------------------*/ |
| 3054 | vosStatus = WDA_DS_BuildTxPacketInfo( pvosGCtx, vosFrmBuf , &vDestMacAddr, |
| 3055 | 1 /* always 802.11 frames*/, &usPktLen, uQosHdr /*qos not enabled !!!*/, |
| 3056 | 0 /* WDS off */, 0, wFrmType, pvAddr2MacAddr, ucTid, |
| 3057 | ucAckResponse, usTimeStamp, 0, 0 ); |
| 3058 | |
| 3059 | |
| 3060 | if ( !VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 3061 | { |
| 3062 | TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL, |
| 3063 | "WLAN TL:Failed while attempting to build TX header %d", vosStatus)); |
| 3064 | return vosStatus; |
| 3065 | } |
| 3066 | }/* if BD header not present */ |
| 3067 | |
| 3068 | /*------------------------------------------------------------------------ |
| 3069 | Save buffer and notify BAL; no lock is needed if the above restriction |
| 3070 | is met |
| 3071 | Save the tx complete fnct pointer as tl specific data in the vos buffer |
| 3072 | ------------------------------------------------------------------------*/ |
| 3073 | if ( NULL != pfnCompTxFunc ) |
| 3074 | { |
| 3075 | vos_pkt_set_user_data_ptr( vosFrmBuf, VOS_PKT_USER_DATA_ID_TL, |
| 3076 | (v_PVOID_t)pfnCompTxFunc); |
| 3077 | } |
| 3078 | else |
| 3079 | { |
| 3080 | vos_pkt_set_user_data_ptr( vosFrmBuf, VOS_PKT_USER_DATA_ID_TL, |
| 3081 | (v_PVOID_t)WLANTL_TxCompDefaultCb); |
| 3082 | |
| 3083 | } |
| 3084 | |
| 3085 | vos_atomic_set_U32( (v_U32_t*)&pTLCb->tlMgmtFrmClient.vosPendingDataBuff, |
| 3086 | (v_U32_t)vosFrmBuf); |
| 3087 | |
| 3088 | /*------------------------------------------------------------------------ |
| 3089 | Check if thre are enough resources for transmission and tx is not |
| 3090 | suspended. |
| 3091 | ------------------------------------------------------------------------*/ |
| 3092 | if ( pTLCb->uResCount >= WDA_TLI_MIN_RES_MF ) |
| 3093 | { |
| 3094 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3095 | "WLAN TL:Issuing Xmit start request to BAL for MGMT")); |
| 3096 | vosStatus = WDA_DS_StartXmit(pvosGCtx); |
| 3097 | if(VOS_STATUS_SUCCESS != vosStatus) |
| 3098 | { |
| 3099 | TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL, |
| 3100 | "WLAN TL:WDA_DS_StartXmit fails. vosStatus %d", vosStatus)); |
| 3101 | vos_atomic_set_U32( (v_U32_t*)&pTLCb->tlMgmtFrmClient.vosPendingDataBuff,0); |
| 3102 | } |
| 3103 | return vosStatus; |
| 3104 | |
| 3105 | } |
| 3106 | else |
| 3107 | { |
| 3108 | /*--------------------------------------------------------------------- |
| 3109 | No error code is sent because TL will resume tx autonomously if |
| 3110 | resources become available or tx gets resumed |
| 3111 | ---------------------------------------------------------------------*/ |
| 3112 | TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, |
| 3113 | "WLAN TL:Request to send for Mgmt Frm but condition not met. Res: %d", |
| 3114 | pTLCb->uResCount)); |
| 3115 | } |
| 3116 | |
| 3117 | return VOS_STATUS_SUCCESS; |
| 3118 | }/* WLANTL_TxMgmtFrm */ |
| 3119 | |
| 3120 | /*---------------------------------------------------------------------------- |
| 3121 | INTERACTION WITH HAL |
| 3122 | ---------------------------------------------------------------------------*/ |
| 3123 | |
| 3124 | /*========================================================================== |
| 3125 | |
| 3126 | FUNCTION WLANTL_ResetNotification |
| 3127 | |
| 3128 | DESCRIPTION |
| 3129 | HAL notifies TL when the module is being reset. |
| 3130 | Currently not used. |
| 3131 | |
| 3132 | DEPENDENCIES |
| 3133 | |
| 3134 | PARAMETERS |
| 3135 | |
| 3136 | IN |
| 3137 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 3138 | control block can be extracted from its context |
| 3139 | |
| 3140 | |
| 3141 | RETURN VALUE |
| 3142 | The result code associated with performing the operation |
| 3143 | |
| 3144 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 3145 | page fault |
| 3146 | VOS_STATUS_SUCCESS: Everything is good :) |
| 3147 | |
| 3148 | SIDE EFFECTS |
| 3149 | |
| 3150 | ============================================================================*/ |
| 3151 | VOS_STATUS |
| 3152 | WLANTL_ResetNotification |
| 3153 | ( |
| 3154 | v_PVOID_t pvosGCtx |
| 3155 | ) |
| 3156 | { |
| 3157 | WLANTL_CbType* pTLCb = NULL; |
| 3158 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 3159 | |
| 3160 | /*------------------------------------------------------------------------ |
| 3161 | Sanity check |
| 3162 | Extract TL control block |
| 3163 | ------------------------------------------------------------------------*/ |
| 3164 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 3165 | if ( NULL == pTLCb ) |
| 3166 | { |
| 3167 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3168 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ResetNotification")); |
| 3169 | return VOS_STATUS_E_FAULT; |
| 3170 | } |
| 3171 | |
| 3172 | WLANTL_CleanCB(pTLCb, 1 /*empty all queues and pending packets*/); |
| 3173 | return VOS_STATUS_SUCCESS; |
| 3174 | }/* WLANTL_ResetNotification */ |
| 3175 | |
| 3176 | /*========================================================================== |
| 3177 | |
| 3178 | FUNCTION WLANTL_SuspendDataTx |
| 3179 | |
| 3180 | DESCRIPTION |
| 3181 | HAL calls this API when it wishes to suspend transmission for a |
| 3182 | particular STA. |
| 3183 | |
| 3184 | DEPENDENCIES |
| 3185 | The STA for which the request is made must be first registered with |
| 3186 | TL by HDD. |
| 3187 | |
| 3188 | RESTRICTION: In case of a suspend, the flag write and read will not be |
| 3189 | locked: worst case scenario one more packet can get |
| 3190 | through before the flag gets updated (we can make this |
| 3191 | write atomic as well to guarantee consistency) |
| 3192 | |
| 3193 | PARAMETERS |
| 3194 | |
| 3195 | IN |
| 3196 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 3197 | control block can be extracted from its context |
| 3198 | pucSTAId: identifier of the station for which the request is made; |
| 3199 | a value of NULL assumes suspend on all active station |
| 3200 | pfnSuspendTxCB: pointer to the suspend result notification in case the |
| 3201 | call is asynchronous |
| 3202 | |
| 3203 | |
| 3204 | RETURN VALUE |
| 3205 | The result code associated with performing the operation |
| 3206 | |
| 3207 | VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer |
| 3208 | to TL cb is NULL ; access would cause a page fault |
| 3209 | VOS_STATUS_E_EXISTS: Station was not registered |
| 3210 | VOS_STATUS_SUCCESS: Everything is good :) |
| 3211 | |
| 3212 | SIDE EFFECTS |
| 3213 | |
| 3214 | ============================================================================*/ |
| 3215 | |
| 3216 | VOS_STATUS |
| 3217 | WLANTL_SuspendDataTx |
| 3218 | ( |
| 3219 | v_PVOID_t pvosGCtx, |
| 3220 | v_U8_t* pucSTAId, |
| 3221 | WLANTL_SuspendCBType pfnSuspendTx |
| 3222 | ) |
| 3223 | { |
| 3224 | WLANTL_CbType* pTLCb = NULL; |
| 3225 | vos_msg_t vosMsg; |
| 3226 | v_U8_t ucTxSuspendReq, ucTxSuspended; |
| 3227 | v_U32_t STAId = 0; |
| 3228 | |
| 3229 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 3230 | |
| 3231 | /*------------------------------------------------------------------------ |
| 3232 | Sanity check |
| 3233 | Extract TL control block |
| 3234 | ------------------------------------------------------------------------*/ |
| 3235 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 3236 | if ( NULL == pTLCb || NULL == pucSTAId ) |
| 3237 | { |
| 3238 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3239 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SuspendDataTx")); |
| 3240 | return VOS_STATUS_E_FAULT; |
| 3241 | } |
| 3242 | |
| 3243 | /*------------------------------------------------------------------------ |
| 3244 | Check the type of request: generic suspend, or per station suspend |
| 3245 | ------------------------------------------------------------------------*/ |
| 3246 | /* Station IDs for Suspend request are received as bitmap */ |
| 3247 | ucTxSuspendReq = *pucSTAId; |
| 3248 | ucTxSuspended = pTLCb->ucTxSuspended; |
| 3249 | |
| 3250 | if (WLAN_ALL_STA == ucTxSuspended) |
| 3251 | { |
| 3252 | /* All Stations are in Suspend mode. Nothing to do */ |
| 3253 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3254 | "WLAN TL:All stations already suspended")); |
| 3255 | return VOS_STATUS_E_EXISTS; |
| 3256 | } |
| 3257 | |
| 3258 | if (WLAN_ALL_STA == *pucSTAId) |
| 3259 | { |
| 3260 | /* General Suspend Request received */ |
| 3261 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3262 | "WLAN TL:General suspend requested")); |
| 3263 | vos_atomic_set_U8( &pTLCb->ucTxSuspended, WLAN_ALL_STA); |
| 3264 | vosMsg.reserved = WLAN_MAX_STA_COUNT; |
| 3265 | } |
| 3266 | else |
| 3267 | { |
| 3268 | /* Station specific Suspend Request received */ |
| 3269 | /* Update Station Id Bit map for suspend request */ |
| 3270 | do |
| 3271 | { |
| 3272 | /* If Bit set for this station with STAId */ |
| 3273 | if (ucTxSuspendReq >> (STAId +1) ) |
| 3274 | { |
| 3275 | /* If it is Not a valid station ID */ |
| 3276 | if ( WLANTL_STA_ID_INVALID( STAId ) ) |
| 3277 | { |
| 3278 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3279 | "WLAN TL:Invalid station id requested on WLANTL_SuspendDataTx")); |
| 3280 | STAId++; |
| 3281 | continue; |
| 3282 | } |
| 3283 | /* If this station is Not registered with TL */ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 3284 | if( NULL == pTLCb->atlSTAClients[STAId] ) |
| 3285 | { |
| 3286 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3287 | "WLAN TL:Station memory was not previously allocated on WLANTL_SuspendDataTx")); |
| 3288 | STAId++; |
| 3289 | continue; |
| 3290 | } |
| 3291 | if ( 0 == pTLCb->atlSTAClients[STAId]->ucExists ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3292 | { |
| 3293 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3294 | "WLAN TL:Station was not previously registered on WLANTL_SuspendDataTx")); |
| 3295 | STAId++; |
| 3296 | continue; |
| 3297 | } |
| 3298 | |
| 3299 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3300 | "WLAN TL:Suspend request for station: %d", STAId)); |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 3301 | vos_atomic_set_U8( &pTLCb->atlSTAClients[STAId]->ucTxSuspended, 1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3302 | } |
| 3303 | STAId++; |
| 3304 | } while ( STAId < WLAN_MAX_STA_COUNT ); |
| 3305 | vosMsg.reserved = *pucSTAId; |
| 3306 | } |
| 3307 | |
| 3308 | /*------------------------------------------------------------------------ |
| 3309 | Serialize request through TX thread |
| 3310 | ------------------------------------------------------------------------*/ |
| 3311 | vosMsg.type = WLANTL_TX_SIG_SUSPEND; |
| 3312 | vosMsg.bodyptr = (v_PVOID_t)pfnSuspendTx; |
| 3313 | |
| 3314 | if(!VOS_IS_STATUS_SUCCESS(vos_tx_mq_serialize( VOS_MQ_ID_TL, &vosMsg))) |
| 3315 | { |
| 3316 | VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3317 | " %s fails to post message", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3318 | } |
| 3319 | |
| 3320 | return VOS_STATUS_SUCCESS; |
| 3321 | }/* WLANTL_SuspendDataTx */ |
| 3322 | |
| 3323 | /*========================================================================== |
| 3324 | |
| 3325 | FUNCTION WLANTL_ResumeDataTx |
| 3326 | |
| 3327 | DESCRIPTION |
| 3328 | Called by HAL to resume data transmission for a given STA. |
| 3329 | |
| 3330 | WARNING: If a station was individually suspended a global resume will |
| 3331 | not resume that station |
| 3332 | |
| 3333 | DEPENDENCIES |
| 3334 | |
| 3335 | PARAMETERS |
| 3336 | |
| 3337 | IN |
| 3338 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 3339 | control block can be extracted from its context |
| 3340 | pucSTAId: identifier of the station which is being resumed; NULL |
| 3341 | translates into global resume |
| 3342 | |
| 3343 | RETURN VALUE |
| 3344 | The result code associated with performing the operation |
| 3345 | |
| 3346 | VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer |
| 3347 | to TL cb is NULL ; access would cause a page fault |
| 3348 | VOS_STATUS_E_EXISTS: Station was not registered |
| 3349 | VOS_STATUS_SUCCESS: Everything is good :) |
| 3350 | |
| 3351 | SIDE EFFECTS |
| 3352 | |
| 3353 | ============================================================================*/ |
| 3354 | |
| 3355 | VOS_STATUS |
| 3356 | WLANTL_ResumeDataTx |
| 3357 | ( |
| 3358 | v_PVOID_t pvosGCtx, |
| 3359 | v_U8_t* pucSTAId |
| 3360 | ) |
| 3361 | { |
| 3362 | WLANTL_CbType* pTLCb = NULL; |
| 3363 | v_U8_t ucTxResumeReq; |
| 3364 | v_U32_t STAId = 0; |
| 3365 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 3366 | |
| 3367 | /*------------------------------------------------------------------------ |
| 3368 | Sanity check |
| 3369 | Extract TL control block |
| 3370 | ------------------------------------------------------------------------*/ |
| 3371 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 3372 | if ( NULL == pTLCb || NULL == pucSTAId) |
| 3373 | { |
| 3374 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3375 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ResumeDataTx")); |
| 3376 | return VOS_STATUS_E_FAULT; |
| 3377 | } |
| 3378 | |
| 3379 | ucTxResumeReq = *pucSTAId; |
| 3380 | /*------------------------------------------------------------------------ |
| 3381 | Check to see the type of resume |
| 3382 | ------------------------------------------------------------------------*/ |
| 3383 | if ( WLAN_ALL_STA == *pucSTAId) |
| 3384 | { |
| 3385 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3386 | "WLAN TL:General resume requested")); |
| 3387 | vos_atomic_set_U8( &pTLCb->ucTxSuspended, 0); |
| 3388 | |
| 3389 | /* Set to Resume for all stations */ |
| 3390 | for (STAId = 0; STAId < WLAN_MAX_STA_COUNT; STAId++) |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 3391 | { |
| 3392 | if( NULL != pTLCb->atlSTAClients[STAId] ) |
| 3393 | { |
| 3394 | vos_atomic_set_U8( &pTLCb->atlSTAClients[STAId]->ucTxSuspended, 0); |
| 3395 | } |
| 3396 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3397 | } |
| 3398 | else |
| 3399 | { |
| 3400 | do |
| 3401 | { |
| 3402 | /* If Bit Set for this station with STAId */ |
| 3403 | if (ucTxResumeReq >> (STAId + 1)) |
| 3404 | { |
| 3405 | /* If it is Not a valid station ID */ |
| 3406 | if ( WLANTL_STA_ID_INVALID( STAId )) |
| 3407 | { |
| 3408 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3409 | "WLAN TL:Invalid station id requested on WLANTL_ResumeDataTx")); |
| 3410 | STAId++; |
| 3411 | continue; |
| 3412 | } |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 3413 | if ( NULL == pTLCb->atlSTAClients[STAId]) |
| 3414 | { |
| 3415 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3416 | "WLAN TL:Station was not allocated memory on WLANTL_ResumeDataTx")); |
| 3417 | STAId++; |
| 3418 | continue; |
| 3419 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3420 | /* If this station is Not registered with TL */ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 3421 | if ( 0 == pTLCb->atlSTAClients[STAId]->ucExists ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3422 | { |
| 3423 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3424 | "WLAN TL:Station was not previously registered on WLANTL_ResumeDataTx")); |
| 3425 | STAId++; |
| 3426 | continue; |
| 3427 | } |
| 3428 | |
| 3429 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3430 | "WLAN TL:Resume request for station: %d", STAId)); |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 3431 | vos_atomic_set_U8( &pTLCb->atlSTAClients[STAId]->ucTxSuspended, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3432 | } |
| 3433 | STAId++; |
| 3434 | } while ( STAId < WLAN_MAX_STA_COUNT ); |
| 3435 | } |
| 3436 | |
| 3437 | /*------------------------------------------------------------------------ |
| 3438 | Resuming transmission |
| 3439 | ------------------------------------------------------------------------*/ |
| 3440 | if ( pTLCb->uResCount >= WDA_TLI_MIN_RES_MF ) |
| 3441 | { |
| 3442 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3443 | "WLAN TL:Resuming transmission")); |
| 3444 | return WDA_DS_StartXmit(pvosGCtx); |
| 3445 | } |
| 3446 | |
| 3447 | return VOS_STATUS_SUCCESS; |
| 3448 | }/* WLANTL_ResumeDataTx */ |
| 3449 | |
| 3450 | /*========================================================================== |
| 3451 | FUNCTION WLANTL_SuspendCB |
| 3452 | |
| 3453 | DESCRIPTION |
| 3454 | Callback function for serializing Suspend signal through Tx thread |
| 3455 | |
| 3456 | DEPENDENCIES |
| 3457 | Just notify HAL that suspend in TL is complete. |
| 3458 | |
| 3459 | PARAMETERS |
| 3460 | |
| 3461 | IN |
| 3462 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 3463 | control block can be extracted from its context |
| 3464 | pUserData: user data sent with the callback |
| 3465 | |
| 3466 | RETURN VALUE |
| 3467 | The result code associated with performing the operation |
| 3468 | |
| 3469 | VOS_STATUS_E_INVAL: invalid input parameters |
| 3470 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 3471 | page fault |
| 3472 | VOS_STATUS_SUCCESS: Everything is good :) |
| 3473 | |
| 3474 | |
| 3475 | SIDE EFFECTS |
| 3476 | |
| 3477 | ============================================================================*/ |
| 3478 | VOS_STATUS |
| 3479 | WLANTL_SuspendCB |
| 3480 | ( |
| 3481 | v_PVOID_t pvosGCtx, |
| 3482 | WLANTL_SuspendCBType pfnSuspendCB, |
| 3483 | v_U16_t usReserved |
| 3484 | ) |
| 3485 | { |
| 3486 | WLANTL_CbType* pTLCb = NULL; |
| 3487 | v_U8_t ucSTAId = (v_U8_t)usReserved; |
| 3488 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 3489 | |
| 3490 | /*------------------------------------------------------------------------ |
| 3491 | Sanity check |
| 3492 | ------------------------------------------------------------------------*/ |
| 3493 | if ( NULL == pfnSuspendCB ) |
| 3494 | { |
| 3495 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, |
| 3496 | "WLAN TL: No Call back processing requested WLANTL_SuspendCB")); |
| 3497 | return VOS_STATUS_SUCCESS; |
| 3498 | } |
| 3499 | |
| 3500 | /*------------------------------------------------------------------------ |
| 3501 | Extract TL control block |
| 3502 | ------------------------------------------------------------------------*/ |
| 3503 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 3504 | if ( NULL == pTLCb ) |
| 3505 | { |
| 3506 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3507 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SuspendCB")); |
| 3508 | return VOS_STATUS_E_FAULT; |
| 3509 | } |
| 3510 | |
| 3511 | if ( WLANTL_STA_ID_INVALID( ucSTAId ) ) |
| 3512 | { |
| 3513 | pfnSuspendCB(pvosGCtx, NULL, VOS_STATUS_SUCCESS); |
| 3514 | } |
| 3515 | else |
| 3516 | { |
| 3517 | pfnSuspendCB(pvosGCtx, &ucSTAId, VOS_STATUS_SUCCESS); |
| 3518 | } |
| 3519 | |
| 3520 | return VOS_STATUS_SUCCESS; |
| 3521 | }/*WLANTL_SuspendCB*/ |
| 3522 | |
| 3523 | |
| 3524 | /*---------------------------------------------------------------------------- |
| 3525 | CLIENT INDEPENDENT INTERFACE |
| 3526 | ---------------------------------------------------------------------------*/ |
| 3527 | |
| 3528 | /*========================================================================== |
| 3529 | |
| 3530 | FUNCTION WLANTL_GetTxPktCount |
| 3531 | |
| 3532 | DESCRIPTION |
| 3533 | TL will provide the number of transmitted packets counted per |
| 3534 | STA per TID. |
| 3535 | |
| 3536 | DEPENDENCIES |
| 3537 | |
| 3538 | PARAMETERS |
| 3539 | |
| 3540 | IN |
| 3541 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 3542 | control block can be extracted from its context |
| 3543 | ucSTAId: identifier of the station |
| 3544 | ucTid: identifier of the tspec |
| 3545 | |
| 3546 | OUT |
| 3547 | puTxPktCount: the number of packets tx packet for this STA and TID |
| 3548 | |
| 3549 | RETURN VALUE |
| 3550 | The result code associated with performing the operation |
| 3551 | |
| 3552 | VOS_STATUS_E_INVAL: Input parameters are invalid |
| 3553 | VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer |
| 3554 | to TL cb is NULL ; access would cause a page fault |
| 3555 | VOS_STATUS_E_EXISTS: Station was not registered |
| 3556 | VOS_STATUS_SUCCESS: Everything is good :) |
| 3557 | |
| 3558 | SIDE EFFECTS |
| 3559 | |
| 3560 | ============================================================================*/ |
| 3561 | VOS_STATUS |
| 3562 | WLANTL_GetTxPktCount |
| 3563 | ( |
| 3564 | v_PVOID_t pvosGCtx, |
| 3565 | v_U8_t ucSTAId, |
| 3566 | v_U8_t ucTid, |
| 3567 | v_U32_t* puTxPktCount |
| 3568 | ) |
| 3569 | { |
| 3570 | WLANTL_CbType* pTLCb = NULL; |
| 3571 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 3572 | |
| 3573 | /*------------------------------------------------------------------------ |
| 3574 | Sanity check |
| 3575 | ------------------------------------------------------------------------*/ |
| 3576 | if ( NULL == puTxPktCount ) |
| 3577 | { |
| 3578 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3579 | "WLAN TL:Invalid parameter sent on WLANTL_GetTxPktCount")); |
| 3580 | return VOS_STATUS_E_INVAL; |
| 3581 | } |
| 3582 | |
| 3583 | if ( WLANTL_STA_ID_INVALID( ucSTAId ) || WLANTL_TID_INVALID( ucTid) ) |
| 3584 | { |
| 3585 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3586 | "WLAN TL:Invalid station id %d/tid %d requested on WLANTL_GetTxPktCount", |
| 3587 | ucSTAId, ucTid)); |
| 3588 | return VOS_STATUS_E_FAULT; |
| 3589 | } |
| 3590 | |
| 3591 | /*------------------------------------------------------------------------ |
| 3592 | Extract TL control block and check if station exists |
| 3593 | ------------------------------------------------------------------------*/ |
| 3594 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 3595 | if ( NULL == pTLCb ) |
| 3596 | { |
| 3597 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3598 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetTxPktCount")); |
| 3599 | return VOS_STATUS_E_FAULT; |
| 3600 | } |
| 3601 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 3602 | if ( NULL == pTLCb->atlSTAClients[ucSTAId] ) |
| 3603 | { |
| 3604 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3605 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 3606 | return VOS_STATUS_E_FAILURE; |
| 3607 | } |
| 3608 | |
| 3609 | if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3610 | { |
| 3611 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3612 | "WLAN TL:Station was not previously registered on WLANTL_GetTxPktCount %d", |
| 3613 | ucSTAId)); |
| 3614 | return VOS_STATUS_E_EXISTS; |
| 3615 | } |
| 3616 | |
| 3617 | /*------------------------------------------------------------------------ |
| 3618 | Return data |
| 3619 | ------------------------------------------------------------------------*/ |
| 3620 | //VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_MED, |
| 3621 | // "WLAN TL:Requested tx packet count for STA: %d, TID: %d", |
| 3622 | // ucSTAId, ucTid); |
| 3623 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 3624 | *puTxPktCount = pTLCb->atlSTAClients[ucSTAId]->auTxCount[ucTid]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3625 | |
| 3626 | return VOS_STATUS_SUCCESS; |
| 3627 | }/* WLANTL_GetTxPktCount */ |
| 3628 | |
| 3629 | /*========================================================================== |
| 3630 | |
| 3631 | FUNCTION WLANTL_GetRxPktCount |
| 3632 | |
| 3633 | DESCRIPTION |
| 3634 | TL will provide the number of received packets counted per |
| 3635 | STA per TID. |
| 3636 | |
| 3637 | DEPENDENCIES |
| 3638 | |
| 3639 | PARAMETERS |
| 3640 | |
| 3641 | IN |
| 3642 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 3643 | control block can be extracted from its context |
| 3644 | ucSTAId: identifier of the station |
| 3645 | ucTid: identifier of the tspec |
| 3646 | |
| 3647 | OUT |
| 3648 | puTxPktCount: the number of packets rx packet for this STA and TID |
| 3649 | |
| 3650 | RETURN VALUE |
| 3651 | The result code associated with performing the operation |
| 3652 | |
| 3653 | VOS_STATUS_E_INVAL: Input parameters are invalid |
| 3654 | VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer |
| 3655 | to TL cb is NULL ; access would cause a page fault |
| 3656 | VOS_STATUS_E_EXISTS: Station was not registered |
| 3657 | VOS_STATUS_SUCCESS: Everything is good :) |
| 3658 | |
| 3659 | SIDE EFFECTS |
| 3660 | |
| 3661 | ============================================================================*/ |
| 3662 | VOS_STATUS |
| 3663 | WLANTL_GetRxPktCount |
| 3664 | ( |
| 3665 | v_PVOID_t pvosGCtx, |
| 3666 | v_U8_t ucSTAId, |
| 3667 | v_U8_t ucTid, |
| 3668 | v_U32_t* puRxPktCount |
| 3669 | ) |
| 3670 | { |
| 3671 | WLANTL_CbType* pTLCb = NULL; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 3672 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3673 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 3674 | |
| 3675 | /*------------------------------------------------------------------------ |
| 3676 | Sanity check |
| 3677 | ------------------------------------------------------------------------*/ |
| 3678 | if ( NULL == puRxPktCount ) |
| 3679 | { |
| 3680 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3681 | "WLAN TL:Invalid parameter sent on WLANTL_GetRxPktCount")); |
| 3682 | return VOS_STATUS_E_INVAL; |
| 3683 | } |
| 3684 | |
| 3685 | if ( WLANTL_STA_ID_INVALID( ucSTAId ) || WLANTL_TID_INVALID( ucTid) ) |
| 3686 | { |
| 3687 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3688 | "WLAN TL:Invalid station id %d/tid %d requested on WLANTL_GetRxPktCount", |
| 3689 | ucSTAId, ucTid)); |
| 3690 | return VOS_STATUS_E_FAULT; |
| 3691 | } |
| 3692 | |
| 3693 | /*------------------------------------------------------------------------ |
| 3694 | Extract TL control block and existance |
| 3695 | ------------------------------------------------------------------------*/ |
| 3696 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 3697 | if ( NULL == pTLCb ) |
| 3698 | { |
| 3699 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3700 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetRxPktCount")); |
| 3701 | return VOS_STATUS_E_FAULT; |
| 3702 | } |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 3703 | pClientSTA = pTLCb->atlSTAClients[ucSTAId]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3704 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 3705 | if ( NULL == pClientSTA ) |
| 3706 | { |
| 3707 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3708 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 3709 | return VOS_STATUS_E_FAILURE; |
| 3710 | } |
| 3711 | |
| 3712 | if ( 0 == pClientSTA->ucExists ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3713 | { |
| 3714 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3715 | "WLAN TL:Station was not previously registered on WLANTL_GetRxPktCount")); |
| 3716 | return VOS_STATUS_E_EXISTS; |
| 3717 | } |
| 3718 | |
| 3719 | /*------------------------------------------------------------------------ |
| 3720 | Return data |
| 3721 | ------------------------------------------------------------------------*/ |
| 3722 | TLLOG3(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_MED, |
| 3723 | "WLAN TL:Requested rx packet count for STA: %d, TID: %d", |
| 3724 | ucSTAId, ucTid)); |
| 3725 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 3726 | *puRxPktCount = pClientSTA->auRxCount[ucTid]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3727 | |
| 3728 | return VOS_STATUS_SUCCESS; |
| 3729 | }/* WLANTL_GetRxPktCount */ |
| 3730 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3731 | VOS_STATUS |
| 3732 | WLANTL_TxFCFrame |
| 3733 | ( |
| 3734 | v_PVOID_t pvosGCtx |
| 3735 | ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3736 | /*============================================================================ |
| 3737 | TL INTERNAL API DEFINITION |
| 3738 | ============================================================================*/ |
| 3739 | |
| 3740 | /*========================================================================== |
| 3741 | |
| 3742 | FUNCTION WLANTL_GetFrames |
| 3743 | |
| 3744 | DESCRIPTION |
| 3745 | |
| 3746 | BAL calls this function at the request of the lower bus interface. |
| 3747 | When this request is being received TL will retrieve packets from HDD |
| 3748 | in accordance with the priority rules and the count supplied by BAL. |
| 3749 | |
| 3750 | DEPENDENCIES |
| 3751 | |
| 3752 | HDD must have registered with TL at least one STA before this function |
| 3753 | can be called. |
| 3754 | |
| 3755 | PARAMETERS |
| 3756 | |
| 3757 | IN |
| 3758 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 3759 | or BAL's control block can be extracted from its context |
| 3760 | uSize: maximum size accepted by the lower layer |
| 3761 | uFlowMask TX flow control mask for Prima. Each bit is defined as |
| 3762 | WDA_TXFlowEnumType |
| 3763 | |
| 3764 | OUT |
| 3765 | vosDataBuff: it will contain a pointer to the first buffer supplied |
| 3766 | by TL, if there is more than one packet supplied, TL |
| 3767 | will chain them through vOSS buffers |
| 3768 | |
| 3769 | RETURN VALUE |
| 3770 | |
| 3771 | The result code associated with performing the operation |
| 3772 | |
| 3773 | 1 or more: number of required resources if there are still frames to fetch |
| 3774 | 0 : error or HDD queues are drained |
| 3775 | |
| 3776 | SIDE EFFECTS |
| 3777 | |
| 3778 | NOTE |
| 3779 | |
| 3780 | Featurized uFlowMask. If we want to remove featurization, we need to change |
| 3781 | BAL on Volans. |
| 3782 | |
| 3783 | ============================================================================*/ |
| 3784 | v_U32_t |
| 3785 | WLANTL_GetFrames |
| 3786 | ( |
| 3787 | v_PVOID_t pvosGCtx, |
| 3788 | vos_pkt_t **ppFrameDataBuff, |
| 3789 | v_U32_t uSize, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3790 | v_U8_t uFlowMask, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3791 | v_BOOL_t* pbUrgent |
| 3792 | ) |
| 3793 | { |
| 3794 | vos_pkt_t** pvosDataBuff = (vos_pkt_t**)ppFrameDataBuff; |
| 3795 | WLANTL_CbType* pTLCb = NULL; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 3796 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3797 | v_U32_t uRemaining = uSize; |
| 3798 | vos_pkt_t* vosRoot; |
| 3799 | vos_pkt_t* vosTempBuf; |
| 3800 | WLANTL_STAFuncType pfnSTAFsm; |
| 3801 | v_U16_t usPktLen; |
| 3802 | v_U32_t uResLen; |
| 3803 | v_U8_t ucSTAId; |
| 3804 | v_U8_t ucAC; |
| 3805 | vos_pkt_t* vosDataBuff; |
| 3806 | v_U32_t uTotalPktLen; |
| 3807 | v_U32_t i=0; |
Tushnim Bhattacharyya | 39a8f18 | 2013-02-20 18:10:30 -0800 | [diff] [blame] | 3808 | v_U32_t j=0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3809 | v_U32_t ucResult = 0; |
| 3810 | VOS_STATUS vosStatus; |
| 3811 | WLANTL_STAEventType wSTAEvent; |
| 3812 | tBssSystemRole systemRole; |
| 3813 | tpAniSirGlobal pMac; |
| 3814 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 3815 | |
| 3816 | /*------------------------------------------------------------------------ |
| 3817 | Sanity check |
| 3818 | Extract TL control block |
| 3819 | ------------------------------------------------------------------------*/ |
| 3820 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 3821 | if (( NULL == pTLCb ) || ( NULL == pvosDataBuff )) |
| 3822 | { |
| 3823 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 3824 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState")); |
| 3825 | return ucResult; |
| 3826 | } |
| 3827 | |
| 3828 | pMac = vos_get_context(VOS_MODULE_ID_PE, pvosGCtx); |
| 3829 | if ( NULL == pMac ) |
| 3830 | { |
| 3831 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3832 | "%s: Invalid pMac", __func__)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3833 | return ucResult; |
| 3834 | } |
| 3835 | |
| 3836 | vosDataBuff = pTLCb->vosDummyBuf; /* Just to avoid checking for NULL at |
| 3837 | each iteration */ |
| 3838 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3839 | pTLCb->uResCount = uSize; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3840 | |
| 3841 | /*----------------------------------------------------------------------- |
| 3842 | Save the root as we will walk this chain as we fill it |
| 3843 | -----------------------------------------------------------------------*/ |
| 3844 | vosRoot = vosDataBuff; |
| 3845 | |
| 3846 | /*----------------------------------------------------------------------- |
| 3847 | There is still data - until FSM function says otherwise |
| 3848 | -----------------------------------------------------------------------*/ |
| 3849 | pTLCb->bUrgent = FALSE; |
| 3850 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3851 | while (( pTLCb->tlConfigInfo.uMinFramesProcThres < pTLCb->uResCount ) && |
| 3852 | ( 0 < uRemaining )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3853 | { |
| 3854 | systemRole = wdaGetGlobalSystemRole(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3855 | #ifdef WLAN_SOFTAP_FLOWCTRL_EN |
| 3856 | /* FIXME: The code has been disabled since it is creating issues in power save */ |
| 3857 | if (eSYSTEM_AP_ROLE == systemRole) |
| 3858 | { |
| 3859 | if (pTLCb->done_once == 0 && NULL == pTLCb->vosTxFCBuf) |
| 3860 | { |
| 3861 | WLANTL_TxFCFrame (pvosGCtx); |
| 3862 | pTLCb->done_once ++; |
| 3863 | } |
| 3864 | } |
| 3865 | if ( NULL != pTLCb->vosTxFCBuf ) |
| 3866 | { |
| 3867 | //there is flow control packet waiting to be sent |
| 3868 | WDA_TLI_PROCESS_FRAME_LEN( pTLCb->vosTxFCBuf, usPktLen, uResLen, uTotalPktLen); |
| 3869 | |
| 3870 | if ( ( pTLCb->uResCount > uResLen ) && |
Jeff Johnson | 9b5dc4d | 2013-02-22 21:28:47 -0800 | [diff] [blame] | 3871 | ( uRemaining > uTotalPktLen ) && |
| 3872 | ( uFlowMask & ( 1 << WDA_TXFLOW_FC ) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3873 | { |
| 3874 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3875 | "WLAN TL:Chaining FC frame first on GetFrame")); |
| 3876 | |
| 3877 | vos_pkt_chain_packet( vosDataBuff, pTLCb->vosTxFCBuf, 1 /*true*/ ); |
| 3878 | |
| 3879 | vos_atomic_set_U32( (v_U32_t*)&pTLCb->vosTxFCBuf, (v_U32_t)NULL); |
| 3880 | |
| 3881 | /*FC frames cannot be delayed*/ |
| 3882 | pTLCb->bUrgent = TRUE; |
| 3883 | |
| 3884 | /*Update remaining len from SSC */ |
| 3885 | uRemaining -= (usPktLen + WDA_DXE_HEADER_SIZE); |
| 3886 | |
| 3887 | /*Update resource count */ |
| 3888 | pTLCb->uResCount -= uResLen; |
| 3889 | } |
| 3890 | else |
| 3891 | { |
| 3892 | TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3893 | "WLAN TL:send fc out of source %s", __func__)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3894 | ucResult = ( pTLCb->uResCount > uResLen )?VOS_TRUE:VOS_FALSE; |
| 3895 | break; /* Out of resources or reached max len */ |
| 3896 | } |
| 3897 | } |
| 3898 | else |
| 3899 | #endif //WLAN_SOFTAP_FLOWCTRL_EN |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3900 | |
Jeff Johnson | 9b5dc4d | 2013-02-22 21:28:47 -0800 | [diff] [blame] | 3901 | if (( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff ) && |
| 3902 | ( uFlowMask & ( 1 << WDA_TXFLOW_MGMT ) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3903 | { |
| 3904 | WDA_TLI_PROCESS_FRAME_LEN( pTLCb->tlMgmtFrmClient.vosPendingDataBuff, |
| 3905 | usPktLen, uResLen, uTotalPktLen); |
| 3906 | |
| 3907 | VOS_ASSERT(usPktLen <= WLANTL_MAX_ALLOWED_LEN); |
| 3908 | |
| 3909 | if ( ( pTLCb->uResCount > uResLen ) && |
Jeff Johnson | 9b5dc4d | 2013-02-22 21:28:47 -0800 | [diff] [blame] | 3910 | ( uRemaining > uTotalPktLen ) && |
| 3911 | ( uFlowMask & ( 1 << WDA_TXFLOW_MGMT ) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3912 | { |
| 3913 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3914 | "WLAN TL:Chaining management frame on GetFrame")); |
| 3915 | |
| 3916 | vos_pkt_chain_packet( vosDataBuff, |
| 3917 | pTLCb->tlMgmtFrmClient.vosPendingDataBuff, |
| 3918 | 1 /*true*/ ); |
| 3919 | |
| 3920 | vos_atomic_set_U32( (v_U32_t*)&pTLCb->tlMgmtFrmClient. |
| 3921 | vosPendingDataBuff, (v_U32_t)NULL); |
| 3922 | |
| 3923 | /*management frames cannot be delayed*/ |
| 3924 | pTLCb->bUrgent = TRUE; |
| 3925 | |
| 3926 | /*Update remaining len from SSC */ |
| 3927 | uRemaining -= (usPktLen + WDA_DXE_HEADER_SIZE); |
| 3928 | |
| 3929 | /*Update resource count */ |
| 3930 | pTLCb->uResCount -= uResLen; |
| 3931 | } |
| 3932 | else |
| 3933 | { |
| 3934 | ucResult = ( pTLCb->uResCount > uResLen )?VOS_TRUE:VOS_FALSE; |
| 3935 | break; /* Out of resources or reached max len */ |
| 3936 | } |
| 3937 | } |
| 3938 | else if (( pTLCb->tlBAPClient.vosPendingDataBuff ) && |
| 3939 | ( WDA_TLI_MIN_RES_BAP <= pTLCb->uResCount ) && |
Gopichand Nakkala | 7e48ca7 | 2012-12-31 14:15:07 -0800 | [diff] [blame] | 3940 | ( 0 == pTLCb->ucTxSuspended ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3941 | { |
| 3942 | WDA_TLI_PROCESS_FRAME_LEN( pTLCb->tlBAPClient.vosPendingDataBuff, |
| 3943 | usPktLen, uResLen, uTotalPktLen); |
| 3944 | |
| 3945 | VOS_ASSERT(usPktLen <= WLANTL_MAX_ALLOWED_LEN); |
| 3946 | |
| 3947 | if ( ( pTLCb->uResCount > (uResLen + WDA_TLI_MIN_RES_MF ) ) && |
| 3948 | ( uRemaining > uTotalPktLen )) |
| 3949 | { |
| 3950 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3951 | "WLAN TL:Chaining BT-AMP frame on GetFrame")); |
| 3952 | |
| 3953 | vos_pkt_chain_packet( vosDataBuff, |
| 3954 | pTLCb->tlBAPClient.vosPendingDataBuff, |
| 3955 | 1 /*true*/ ); |
| 3956 | |
| 3957 | /*BAP frames cannot be delayed*/ |
| 3958 | pTLCb->bUrgent = TRUE; |
| 3959 | |
| 3960 | vos_atomic_set_U32( (v_U32_t*)&pTLCb->tlBAPClient.vosPendingDataBuff, |
| 3961 | (v_U32_t)NULL); |
| 3962 | |
| 3963 | /*Update remaining len from SSC */ |
| 3964 | uRemaining -= (usPktLen + WDA_DXE_HEADER_SIZE); |
| 3965 | |
| 3966 | /*Update resource count */ |
| 3967 | pTLCb->uResCount -= uResLen; |
| 3968 | } |
| 3969 | else |
| 3970 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3971 | ucResult = uResLen + WDA_TLI_MIN_RES_MF; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3972 | break; /* Out of resources or reached max len */ |
| 3973 | } |
| 3974 | } |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 3975 | /* note: this feature implemented only after WLAN_INGETRATED_SOC */ |
| 3976 | /* search 'EAPOL_HI_PRIORITY' will show EAPOL HI_PRIORITY change in TL and WDI |
| 3977 | by default, EAPOL will be treated as higher priority, which means |
| 3978 | use mgmt_pool and DXE_TX_HI prority channel. |
| 3979 | this is introduced to address EAPOL failure under high background traffic |
| 3980 | with multi-channel concurrent mode. But this change works in SCC or standalone, too. |
| 3981 | see CR#387009 and WCNSOS-8 |
| 3982 | */ |
| 3983 | else if (( WDA_TLI_MIN_RES_MF <= pTLCb->uResCount )&& |
| 3984 | ( 0 == pTLCb->ucTxSuspended ) && |
| 3985 | ( uFlowMask & ( 1 << WDA_TXFLOW_MGMT ) ) |
| 3986 | ) |
| 3987 | { |
| 3988 | vosTempBuf = NULL; |
| 3989 | /*--------------------------------------------------------------------- |
| 3990 | Check to see if there was any EAPOL packet is pending |
| 3991 | *--------------------------------------------------------------------*/ |
| 3992 | for ( i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 3993 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 3994 | if ((NULL != pTLCb->atlSTAClients[i]) && |
| 3995 | (pTLCb->atlSTAClients[i]->ucExists) && |
| 3996 | (0 == pTLCb->atlSTAClients[i]->ucTxSuspended) && |
Tushnim Bhattacharyya | 39a8f18 | 2013-02-20 18:10:30 -0800 | [diff] [blame] | 3997 | (WLANTL_STA_CONNECTED == pTLCb->atlSTAClients[i]->tlState) && |
| 3998 | (pTLCb->atlSTAClients[i]->ucPktPending) |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 3999 | ) |
| 4000 | break; |
| 4001 | } |
| 4002 | |
| 4003 | if (i >= WLAN_MAX_STA_COUNT) |
| 4004 | { |
| 4005 | /* No More to Serve Exit Get Frames */ |
| 4006 | break; |
| 4007 | } |
| 4008 | /* Serve EAPOL frame with HI_FLOW_MASK */ |
| 4009 | ucSTAId = i; |
| 4010 | |
Tushnim Bhattacharyya | 39a8f18 | 2013-02-20 18:10:30 -0800 | [diff] [blame] | 4011 | for (j = WLANTL_MAX_AC ; j > 0; j--) |
| 4012 | { |
| 4013 | if (0 != pTLCb->atlSTAClients[ucSTAId]->aucACMask[j-1]) |
| 4014 | { |
| 4015 | pTLCb->atlSTAClients[ucSTAId]->ucCurrentAC = j-1; |
| 4016 | pTLCb->uCurServedAC = j-1; |
| 4017 | } |
| 4018 | } |
| 4019 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4020 | pClientSTA = pTLCb->atlSTAClients[ucSTAId]; |
| 4021 | |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 4022 | wSTAEvent = WLANTL_TX_EVENT; |
| 4023 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4024 | pfnSTAFsm = tlSTAFsm[pClientSTA->tlState]. |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 4025 | pfnSTATbl[wSTAEvent]; |
| 4026 | |
| 4027 | if ( NULL != pfnSTAFsm ) |
| 4028 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4029 | pClientSTA->ucNoMoreData = 0; |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 4030 | vosStatus = pfnSTAFsm( pvosGCtx, ucSTAId, &vosTempBuf); |
| 4031 | |
| 4032 | if (( VOS_STATUS_SUCCESS != vosStatus ) && |
| 4033 | ( NULL != vosTempBuf )) |
| 4034 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4035 | pClientSTA->pfnSTATxComp( pvosGCtx, vosTempBuf, vosStatus ); |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 4036 | vosTempBuf = NULL; |
| 4037 | break; |
| 4038 | }/* status success*/ |
| 4039 | } |
| 4040 | |
| 4041 | if (NULL != vosTempBuf) |
| 4042 | { |
| 4043 | WDA_TLI_PROCESS_FRAME_LEN( vosTempBuf, usPktLen, uResLen, uTotalPktLen); |
| 4044 | |
| 4045 | VOS_ASSERT( usPktLen <= WLANTL_MAX_ALLOWED_LEN); |
| 4046 | |
| 4047 | TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW, |
| 4048 | "WLAN TL:Resources needed by frame: %d", uResLen)); |
| 4049 | |
| 4050 | if ( ( pTLCb->uResCount >= (uResLen + WDA_TLI_MIN_RES_MF ) ) && |
| 4051 | ( uRemaining > uTotalPktLen ) |
| 4052 | ) |
| 4053 | { |
| 4054 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 4055 | "WLAN TL:Chaining data frame on GetFrame")); |
| 4056 | |
| 4057 | vos_pkt_chain_packet( vosDataBuff, vosTempBuf, 1 /*true*/ ); |
| 4058 | |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 4059 | /*EAPOL frame cannot be delayed*/ |
| 4060 | pTLCb->bUrgent = TRUE; |
| 4061 | |
| 4062 | vosTempBuf = NULL; |
| 4063 | |
| 4064 | /*Update remaining len from SSC */ |
| 4065 | uRemaining -= (usPktLen + WDA_DXE_HEADER_SIZE); |
| 4066 | |
| 4067 | /*Update resource count */ |
| 4068 | pTLCb->uResCount -= uResLen; |
| 4069 | |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 4070 | //fow control update |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4071 | pClientSTA->uIngress_length += uResLen; |
| 4072 | pClientSTA->uBuffThresholdMax = (pClientSTA->uBuffThresholdMax >= uResLen) ? |
| 4073 | (pClientSTA->uBuffThresholdMax - uResLen) : 0; |
Tushnim Bhattacharyya | 39a8f18 | 2013-02-20 18:10:30 -0800 | [diff] [blame] | 4074 | pClientSTA->ucEapolPktPending = 0; |
| 4075 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 4076 | "WLAN TL:GetFrames STA: %d EAPOLPktPending %d", |
| 4077 | ucSTAId, pClientSTA->ucEapolPktPending); |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 4078 | } |
| 4079 | } |
| 4080 | else |
| 4081 | { // no EAPOL frames exit Get frames |
Tushnim Bhattacharyya | 39a8f18 | 2013-02-20 18:10:30 -0800 | [diff] [blame] | 4082 | TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 4083 | "WLAN TL:GetFrames STA: %d, no EAPOL frame, continue.", |
| 4084 | ucSTAId)); |
| 4085 | continue; |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 4086 | } |
| 4087 | } |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 4088 | |
Jeff Johnson | 9b5dc4d | 2013-02-22 21:28:47 -0800 | [diff] [blame] | 4089 | else if (( WDA_TLI_MIN_RES_DATA <= pTLCb->uResCount ) && |
| 4090 | ( 0 == pTLCb->ucTxSuspended ) && |
| 4091 | (( uFlowMask & ( 1 << WDA_TXFLOW_AC_BK ) ) || |
| 4092 | ( uFlowMask & ( 1 << WDA_TXFLOW_AC_BE ) ) || |
| 4093 | ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VI ) ) || |
| 4094 | ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VO ) )) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4095 | { |
| 4096 | /*--------------------------------------------------------------------- |
| 4097 | Check to see if there was any packet left behind previously due to |
| 4098 | size constraints |
| 4099 | ---------------------------------------------------------------------*/ |
| 4100 | vosTempBuf = NULL; |
| 4101 | |
| 4102 | if ( NULL != pTLCb->vosTempBuf ) |
| 4103 | { |
| 4104 | vosTempBuf = pTLCb->vosTempBuf; |
| 4105 | pTLCb->vosTempBuf = NULL; |
| 4106 | ucSTAId = pTLCb->ucCachedSTAId; |
| 4107 | ucAC = pTLCb->ucCachedAC; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4108 | |
| 4109 | if ( NULL == pTLCb->atlSTAClients[ucSTAId] ) |
| 4110 | { |
| 4111 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 4112 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
Madan Mohan Koyylamudi | 6425822 | 2013-01-30 14:35:10 +0530 | [diff] [blame] | 4113 | continue; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4114 | } |
| 4115 | |
| 4116 | pTLCb->atlSTAClients[ucSTAId]->ucNoMoreData = 0; |
Madan Mohan Koyylamudi | 6425822 | 2013-01-30 14:35:10 +0530 | [diff] [blame] | 4117 | pClientSTA = pTLCb->atlSTAClients[ucSTAId]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4118 | |
| 4119 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 4120 | "WLAN TL:Chaining cached data frame on GetFrame")); |
| 4121 | } |
| 4122 | else |
| 4123 | { |
| 4124 | WLAN_TLGetNextTxIds( pvosGCtx, &ucSTAId); |
| 4125 | if (ucSTAId >= WLAN_MAX_STA_COUNT) |
| 4126 | { |
| 4127 | /* Packets start coming in even after insmod Without * |
| 4128 | starting Hostapd or Interface being up * |
| 4129 | During which cases STAID is invaled and hence |
| 4130 | the check. HalMsg_ScnaComplete Triggers */ |
| 4131 | |
| 4132 | break; |
| 4133 | } |
| 4134 | /* ucCurrentAC should have correct AC to be served by calling |
| 4135 | WLAN_TLGetNextTxIds */ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4136 | pClientSTA = pTLCb->atlSTAClients[ucSTAId]; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4137 | if ( NULL == pClientSTA ) |
| 4138 | { |
| 4139 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 4140 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
Madan Mohan Koyylamudi | 6425822 | 2013-01-30 14:35:10 +0530 | [diff] [blame] | 4141 | continue; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4142 | } |
| 4143 | |
| 4144 | ucAC = pClientSTA->ucCurrentAC; |
| 4145 | |
| 4146 | pClientSTA->ucNoMoreData = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4147 | TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4148 | "WLAN TL: %s get one data frame, station ID %d ", __func__, ucSTAId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4149 | /*------------------------------------------------------------------- |
| 4150 | Check to see that STA is valid and tx is not suspended |
| 4151 | -------------------------------------------------------------------*/ |
| 4152 | if ( ( ! WLANTL_STA_ID_INVALID( ucSTAId ) ) && |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4153 | ( 0 == pClientSTA->ucTxSuspended ) && |
| 4154 | ( 0 == pClientSTA->fcStaTxDisabled) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4155 | { |
| 4156 | TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4157 | "WLAN TL: %s sta id valid and not suspended ",__func__)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4158 | wSTAEvent = WLANTL_TX_EVENT; |
| 4159 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4160 | pfnSTAFsm = tlSTAFsm[pClientSTA->tlState]. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4161 | pfnSTATbl[wSTAEvent]; |
| 4162 | |
| 4163 | if ( NULL != pfnSTAFsm ) |
| 4164 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4165 | pClientSTA->ucNoMoreData = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4166 | vosStatus = pfnSTAFsm( pvosGCtx, ucSTAId, &vosTempBuf); |
| 4167 | |
| 4168 | if (( VOS_STATUS_SUCCESS != vosStatus ) && |
| 4169 | ( NULL != vosTempBuf )) |
| 4170 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4171 | pClientSTA->pfnSTATxComp( pvosGCtx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4172 | vosTempBuf, |
| 4173 | vosStatus ); |
| 4174 | vosTempBuf = NULL; |
| 4175 | }/* status success*/ |
| 4176 | }/*NULL function state*/ |
| 4177 | }/* valid STA id and ! suspended*/ |
| 4178 | else |
| 4179 | { |
| 4180 | if ( ! WLANTL_STA_ID_INVALID( ucSTAId ) ) |
| 4181 | { |
| 4182 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 4183 | "WLAN TL:Not fetching frame because suspended for sta ID %d", |
| 4184 | ucSTAId)); |
| 4185 | } |
| 4186 | } |
| 4187 | }/* data */ |
| 4188 | |
| 4189 | if ( NULL != vosTempBuf ) |
| 4190 | { |
| 4191 | WDA_TLI_PROCESS_FRAME_LEN( vosTempBuf, usPktLen, uResLen, uTotalPktLen); |
| 4192 | |
| 4193 | VOS_ASSERT( usPktLen <= WLANTL_MAX_ALLOWED_LEN); |
| 4194 | |
| 4195 | TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW, |
| 4196 | "WLAN TL:Resources needed by frame: %d", uResLen)); |
| 4197 | |
| 4198 | if ( ( pTLCb->uResCount >= (uResLen + WDA_TLI_MIN_RES_BAP ) ) && |
Jeff Johnson | 9b5dc4d | 2013-02-22 21:28:47 -0800 | [diff] [blame] | 4199 | ( uRemaining > uTotalPktLen ) && |
| 4200 | ( uFlowMask & ( 1 << ucAC ) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4201 | { |
| 4202 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 4203 | "WLAN TL:Chaining data frame on GetFrame")); |
| 4204 | |
| 4205 | vos_pkt_chain_packet( vosDataBuff, vosTempBuf, 1 /*true*/ ); |
| 4206 | vosTempBuf = NULL; |
| 4207 | |
| 4208 | /*Update remaining len from SSC */ |
| 4209 | uRemaining -= (usPktLen + WDA_DXE_HEADER_SIZE); |
| 4210 | |
| 4211 | /*Update resource count */ |
| 4212 | pTLCb->uResCount -= uResLen; |
| 4213 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4214 | //fow control update |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4215 | pClientSTA->uIngress_length += uResLen; |
| 4216 | pClientSTA->uBuffThresholdMax = (pClientSTA->uBuffThresholdMax >= uResLen) ? |
| 4217 | (pClientSTA->uBuffThresholdMax - uResLen) : 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4218 | |
| 4219 | } |
| 4220 | else |
| 4221 | { |
| 4222 | /* Store this for later tx - already fetched from HDD */ |
| 4223 | pTLCb->vosTempBuf = vosTempBuf; |
| 4224 | pTLCb->ucCachedSTAId = ucSTAId; |
| 4225 | pTLCb->ucCachedAC = ucAC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4226 | ucResult = uResLen + WDA_TLI_MIN_RES_BAP; |
| 4227 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 4228 | "min %d res required by TL.", ucResult )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4229 | break; /* Out of resources or reached max len */ |
| 4230 | } |
| 4231 | } |
| 4232 | else |
| 4233 | { |
| 4234 | for ( i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 4235 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4236 | if (NULL != pTLCb->atlSTAClients[i] && (pTLCb->atlSTAClients[i]->ucExists) && |
| 4237 | (pTLCb->atlSTAClients[i]->ucPktPending)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4238 | { |
| 4239 | /* There is station to be Served */ |
| 4240 | break; |
| 4241 | } |
| 4242 | } |
| 4243 | if (i >= WLAN_MAX_STA_COUNT) |
| 4244 | { |
| 4245 | /* No More to Serve Exit Get Frames */ |
| 4246 | break; |
| 4247 | } |
| 4248 | else |
| 4249 | { |
| 4250 | /* More to be Served */ |
| 4251 | continue; |
| 4252 | } |
| 4253 | } |
| 4254 | } |
| 4255 | else |
| 4256 | { |
| 4257 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 4258 | "WLAN TL:Returning from GetFrame: resources = %d suspended = %d", |
| 4259 | pTLCb->uResCount, pTLCb->ucTxSuspended)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4260 | /* TL is starving even when DXE is not in low resource condition |
| 4261 | Return min resource number required and Let DXE deceide what to do */ |
| 4262 | if(( 0 == pTLCb->ucTxSuspended ) && |
| 4263 | (( uFlowMask & ( 1 << WDA_TXFLOW_AC_BK ) ) || |
| 4264 | ( uFlowMask & ( 1 << WDA_TXFLOW_AC_BE ) ) || |
| 4265 | ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VI ) ) || |
| 4266 | ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VO ) ))) |
| 4267 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 4268 | TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4269 | "WLAN TL:Returning from GetFrame: resources = %d", |
| 4270 | pTLCb->uResCount)); |
| 4271 | ucResult = WDA_TLI_MIN_RES_DATA; |
| 4272 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4273 | break; /*out of min data resources*/ |
| 4274 | } |
| 4275 | |
| 4276 | pTLCb->usPendingTxCompleteCount++; |
| 4277 | /* Move data buffer up one packet */ |
| 4278 | vos_pkt_walk_packet_chain( vosDataBuff, &vosDataBuff, 0/*false*/ ); |
| 4279 | } |
| 4280 | |
| 4281 | /*---------------------------------------------------------------------- |
| 4282 | Packet chain starts at root + 1 |
| 4283 | ----------------------------------------------------------------------*/ |
| 4284 | vos_pkt_walk_packet_chain( vosRoot, &vosDataBuff, 1/*true*/ ); |
| 4285 | |
| 4286 | *pvosDataBuff = vosDataBuff; |
| 4287 | VOS_ASSERT( pbUrgent ); |
| 4288 | *pbUrgent = pTLCb->bUrgent; |
| 4289 | return ucResult; |
| 4290 | }/* WLANTL_GetFrames */ |
| 4291 | |
| 4292 | |
| 4293 | /*========================================================================== |
| 4294 | |
| 4295 | FUNCTION WLANTL_TxComp |
| 4296 | |
| 4297 | DESCRIPTION |
| 4298 | It is being called by BAL upon asynchronous notification of the packet |
| 4299 | or packets being sent over the bus. |
| 4300 | |
| 4301 | DEPENDENCIES |
| 4302 | Tx complete cannot be called without a previous transmit. |
| 4303 | |
| 4304 | PARAMETERS |
| 4305 | |
| 4306 | IN |
| 4307 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 4308 | or BAL's control block can be extracted from its context |
| 4309 | vosDataBuff: it will contain a pointer to the first buffer for which |
| 4310 | the BAL report is being made, if there is more then one |
| 4311 | packet they will be chained using vOSS buffers. |
| 4312 | wTxStatus: the status of the transmitted packet, see above chapter |
| 4313 | on HDD interaction for a list of possible values |
| 4314 | |
| 4315 | RETURN VALUE |
| 4316 | The result code associated with performing the operation |
| 4317 | |
| 4318 | VOS_STATUS_E_INVAL: Input parameters are invalid |
| 4319 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 4320 | page fault |
| 4321 | VOS_STATUS_E_EXISTS: Station was not registered |
| 4322 | VOS_STATUS_SUCCESS: Everything is good :) |
| 4323 | |
| 4324 | SIDE EFFECTS |
| 4325 | |
| 4326 | ============================================================================*/ |
| 4327 | VOS_STATUS |
| 4328 | WLANTL_TxComp |
| 4329 | ( |
| 4330 | v_PVOID_t pvosGCtx, |
| 4331 | vos_pkt_t *pFrameDataBuff, |
| 4332 | VOS_STATUS wTxStatus |
| 4333 | ) |
| 4334 | { |
| 4335 | vos_pkt_t* vosDataBuff = (vos_pkt_t*)pFrameDataBuff; |
| 4336 | WLANTL_CbType* pTLCb = NULL; |
| 4337 | WLANTL_TxCompCBType pfnTxComp = NULL; |
| 4338 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4339 | vos_pkt_t* vosTempTx = NULL; |
| 4340 | |
| 4341 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 4342 | |
| 4343 | /*------------------------------------------------------------------------ |
| 4344 | Sanity check |
| 4345 | ------------------------------------------------------------------------*/ |
| 4346 | if ( NULL == vosDataBuff ) |
| 4347 | { |
| 4348 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 4349 | "WLAN TL:Extraneous NULL data pointer on WLANTL_TxComp")); |
| 4350 | return VOS_STATUS_E_INVAL; |
| 4351 | } |
| 4352 | |
| 4353 | /*------------------------------------------------------------------------ |
| 4354 | Extract TL control block |
| 4355 | ------------------------------------------------------------------------*/ |
| 4356 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 4357 | if ( NULL == pTLCb ) |
| 4358 | { |
| 4359 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 4360 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_TxComp")); |
| 4361 | return VOS_STATUS_E_FAULT; |
| 4362 | } |
| 4363 | |
| 4364 | while ((0 < pTLCb->usPendingTxCompleteCount) && |
| 4365 | ( VOS_STATUS_SUCCESS == vosStatus ) && |
| 4366 | ( NULL != vosDataBuff)) |
| 4367 | { |
| 4368 | vos_pkt_get_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL, |
| 4369 | (v_PVOID_t)&pfnTxComp); |
| 4370 | |
| 4371 | /*it should never be NULL - default handler should be registered if none*/ |
| 4372 | if ( NULL == pfnTxComp ) |
| 4373 | { |
| 4374 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 4375 | "WLAN TL:NULL pointer to Tx Complete on WLANTL_TxComp")); |
| 4376 | VOS_ASSERT(0); |
| 4377 | return VOS_STATUS_E_FAULT; |
| 4378 | } |
| 4379 | |
| 4380 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 4381 | "WLAN TL:Calling Tx complete for pkt %x in function %x", |
| 4382 | vosDataBuff, pfnTxComp)); |
| 4383 | |
| 4384 | vosTempTx = vosDataBuff; |
| 4385 | vosStatus = vos_pkt_walk_packet_chain( vosDataBuff, |
| 4386 | &vosDataBuff, 1/*true*/); |
| 4387 | |
| 4388 | pfnTxComp( pvosGCtx, vosTempTx, wTxStatus ); |
| 4389 | |
| 4390 | pTLCb->usPendingTxCompleteCount--; |
| 4391 | } |
| 4392 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4393 | |
| 4394 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 4395 | "WLAN TL: current TL values are: resources = %d " |
| 4396 | "pTLCb->usPendingTxCompleteCount = %d", |
| 4397 | pTLCb->uResCount, pTLCb->usPendingTxCompleteCount)); |
| 4398 | |
| 4399 | return VOS_STATUS_SUCCESS; |
| 4400 | }/* WLANTL_TxComp */ |
| 4401 | |
| 4402 | /*========================================================================== |
| 4403 | |
| 4404 | FUNCTION WLANTL_CacheSTAFrame |
| 4405 | |
| 4406 | DESCRIPTION |
| 4407 | Internal utility function for for caching incoming data frames that do |
| 4408 | not have a registered station yet. |
| 4409 | |
| 4410 | DEPENDENCIES |
| 4411 | TL must be initiailized before this function gets called. |
| 4412 | In order to benefit from thsi caching, the components must ensure that |
| 4413 | they will only register with TL at the moment when they are fully setup |
| 4414 | and ready to receive incoming data |
| 4415 | |
| 4416 | PARAMETERS |
| 4417 | |
| 4418 | IN |
| 4419 | |
| 4420 | pTLCb: TL control block |
| 4421 | ucSTAId: station id |
| 4422 | vosTempBuff: the data packet |
| 4423 | uDPUSig: DPU signature of the incoming packet |
| 4424 | bBcast: true if packet had the MC/BC bit set |
| 4425 | |
| 4426 | RETURN VALUE |
| 4427 | The result code associated with performing the operation |
| 4428 | |
| 4429 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL or STA Id invalid ; access |
| 4430 | would cause a page fault |
| 4431 | VOS_STATUS_SUCCESS: Everything is good :) |
| 4432 | |
| 4433 | SIDE EFFECTS |
| 4434 | |
| 4435 | ============================================================================*/ |
| 4436 | static VOS_STATUS |
| 4437 | WLANTL_CacheSTAFrame |
| 4438 | ( |
| 4439 | WLANTL_CbType* pTLCb, |
| 4440 | v_U8_t ucSTAId, |
| 4441 | vos_pkt_t* vosTempBuff, |
| 4442 | v_U32_t uDPUSig, |
| 4443 | v_U8_t bBcast, |
| 4444 | v_U8_t ucFrmType |
| 4445 | ) |
| 4446 | { |
| 4447 | v_U8_t ucUcastSig; |
| 4448 | v_U8_t ucBcastSig; |
| 4449 | v_BOOL_t bOldSTAPkt; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4450 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4451 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ |
| 4452 | |
| 4453 | /*------------------------------------------------------------------------- |
| 4454 | Sanity check |
| 4455 | -------------------------------------------------------------------------*/ |
| 4456 | if (( NULL == pTLCb ) || ( NULL == vosTempBuff ) ) |
| 4457 | { |
| 4458 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 4459 | "WLAN TL: Invalid input pointer on WLANTL_CacheSTAFrame TL %x" |
| 4460 | " Packet %x", pTLCb, vosTempBuff )); |
| 4461 | return VOS_STATUS_E_FAULT; |
| 4462 | } |
| 4463 | |
| 4464 | if ( WLANTL_STA_ID_INVALID( ucSTAId ) ) |
| 4465 | { |
| 4466 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 4467 | "WLAN TL:Invalid station id requested on WLANTL_CacheSTAFrame")); |
| 4468 | return VOS_STATUS_E_FAULT; |
| 4469 | } |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4470 | pClientSTA = pTLCb->atlSTAClients[ucSTAId]; |
| 4471 | |
| 4472 | if ( NULL == pClientSTA ) |
| 4473 | { |
| 4474 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 4475 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 4476 | return VOS_STATUS_E_FAILURE; |
| 4477 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4478 | |
| 4479 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 4480 | "WLAN TL:Attempting to cache pkt for STA %d, BD DPU Sig: %d with sig UC: %d, BC: %d", |
| 4481 | ucSTAId, uDPUSig, |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4482 | pClientSTA->wSTADesc.ucUcastSig, |
| 4483 | pClientSTA->wSTADesc.ucBcastSig)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4484 | |
| 4485 | if(WLANTL_IS_CTRL_FRAME(ucFrmType)) |
| 4486 | { |
| 4487 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 4488 | "WLAN TL: No need to cache CTRL frame. Dropping")); |
| 4489 | vos_pkt_return_packet(vosTempBuff); |
| 4490 | return VOS_STATUS_SUCCESS; |
| 4491 | } |
| 4492 | |
| 4493 | /*------------------------------------------------------------------------- |
| 4494 | Check if the packet that we are trying to cache belongs to the old |
| 4495 | registered station (if any) or the new (potentially)upcoming station |
| 4496 | |
| 4497 | - If the STA with this Id was never registered with TL - the signature |
| 4498 | will be invalid; |
| 4499 | - If the STA was previously registered TL will have cached the former |
| 4500 | set of DPU signatures |
| 4501 | -------------------------------------------------------------------------*/ |
| 4502 | if ( bBcast ) |
| 4503 | { |
| 4504 | ucBcastSig = (v_U8_t)uDPUSig; |
| 4505 | bOldSTAPkt = (( WLAN_TL_INVALID_B_SIG != |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4506 | pClientSTA->wSTADesc.ucBcastSig ) && |
| 4507 | ( ucBcastSig == pClientSTA->wSTADesc.ucBcastSig )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4508 | } |
| 4509 | else |
| 4510 | { |
| 4511 | ucUcastSig = (v_U8_t)uDPUSig; |
| 4512 | bOldSTAPkt = (( WLAN_TL_INVALID_U_SIG != |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4513 | pClientSTA->wSTADesc.ucUcastSig ) && |
| 4514 | ( ucUcastSig == pClientSTA->wSTADesc.ucUcastSig )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4515 | } |
| 4516 | |
| 4517 | /*------------------------------------------------------------------------ |
| 4518 | If the value of the DPU SIG matches the old, this packet will not |
| 4519 | be cached as it belonged to the former association |
| 4520 | In case the SIG does not match - this is a packet for a potentially new |
| 4521 | associated station |
| 4522 | -------------------------------------------------------------------------*/ |
Varun Reddy Yeturu | a39b990 | 2013-01-18 15:48:32 -0800 | [diff] [blame] | 4523 | if ( bOldSTAPkt || bBcast ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4524 | { |
| 4525 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 4526 | "WLAN TL:Data packet matches old sig for sig DPU: %d UC: %d, " |
| 4527 | "BC: %d - dropping", |
| 4528 | uDPUSig, |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4529 | pClientSTA->wSTADesc.ucUcastSig, |
| 4530 | pClientSTA->wSTADesc.ucBcastSig)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4531 | vos_pkt_return_packet(vosTempBuff); |
| 4532 | } |
| 4533 | else |
| 4534 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4535 | if ( NULL == pClientSTA->vosBegCachedFrame ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4536 | { |
| 4537 | /*this is the first frame that we are caching */ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4538 | pClientSTA->vosBegCachedFrame = vosTempBuff; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4539 | } |
| 4540 | else |
| 4541 | { |
| 4542 | /*this is a subsequent frame that we are caching: chain to the end */ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4543 | vos_pkt_chain_packet(pClientSTA->vosEndCachedFrame, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4544 | vosTempBuff, VOS_TRUE); |
| 4545 | } |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4546 | pClientSTA->vosEndCachedFrame = vosTempBuff; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4547 | }/*else new packet*/ |
| 4548 | |
| 4549 | return VOS_STATUS_SUCCESS; |
| 4550 | }/*WLANTL_CacheSTAFrame*/ |
| 4551 | |
| 4552 | /*========================================================================== |
| 4553 | |
| 4554 | FUNCTION WLANTL_FlushCachedFrames |
| 4555 | |
| 4556 | DESCRIPTION |
| 4557 | Internal utility function used by TL to flush the station cache |
| 4558 | |
| 4559 | DEPENDENCIES |
| 4560 | TL must be initiailized before this function gets called. |
| 4561 | |
| 4562 | PARAMETERS |
| 4563 | |
| 4564 | IN |
| 4565 | |
| 4566 | vosDataBuff: it will contain a pointer to the first cached buffer |
| 4567 | received, |
| 4568 | |
| 4569 | RETURN VALUE |
| 4570 | The result code associated with performing the operation |
| 4571 | |
| 4572 | VOS_STATUS_SUCCESS: Everything is good :) |
| 4573 | |
| 4574 | SIDE EFFECTS |
| 4575 | |
| 4576 | NOTE |
| 4577 | This function doesn't re-initialize vosDataBuff to NULL. It's caller's |
| 4578 | responsibility to do so, if required, after this function call. |
| 4579 | Because of this restriction, we decide to make this function to static |
| 4580 | so that upper layer doesn't need to be aware of this restriction. |
| 4581 | |
| 4582 | ============================================================================*/ |
| 4583 | static VOS_STATUS |
| 4584 | WLANTL_FlushCachedFrames |
| 4585 | ( |
| 4586 | vos_pkt_t* vosDataBuff |
| 4587 | ) |
| 4588 | { |
| 4589 | /*---------------------------------------------------------------------- |
| 4590 | Return the entire chain to vos if there are indeed cache frames |
| 4591 | ----------------------------------------------------------------------*/ |
| 4592 | if ( NULL != vosDataBuff ) |
| 4593 | { |
| 4594 | vos_pkt_return_packet(vosDataBuff); |
| 4595 | } |
| 4596 | |
| 4597 | return VOS_STATUS_SUCCESS; |
| 4598 | }/*WLANTL_FlushCachedFrames*/ |
| 4599 | |
| 4600 | /*========================================================================== |
| 4601 | |
| 4602 | FUNCTION WLANTL_ForwardSTAFrames |
| 4603 | |
| 4604 | DESCRIPTION |
| 4605 | Internal utility function for either forwarding cached data to the station after |
| 4606 | the station has been registered, or flushing cached data if the station has not |
| 4607 | been registered. |
| 4608 | |
| 4609 | |
| 4610 | DEPENDENCIES |
| 4611 | TL must be initiailized before this function gets called. |
| 4612 | |
| 4613 | PARAMETERS |
| 4614 | |
| 4615 | IN |
| 4616 | |
| 4617 | pTLCb: TL control block |
| 4618 | ucSTAId: station id |
| 4619 | |
| 4620 | RETURN VALUE |
| 4621 | The result code associated with performing the operation |
| 4622 | |
| 4623 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 4624 | page fault |
| 4625 | VOS_STATUS_SUCCESS: Everything is good :) |
| 4626 | |
| 4627 | SIDE EFFECTS |
| 4628 | This function doesn't re-initialize vosDataBuff to NULL. It's caller's |
| 4629 | responsibility to do so, if required, after this function call. |
| 4630 | Because of this restriction, we decide to make this function to static |
| 4631 | so that upper layer doesn't need to be aware of this restriction. |
| 4632 | |
| 4633 | ============================================================================*/ |
| 4634 | static VOS_STATUS |
| 4635 | WLANTL_ForwardSTAFrames |
| 4636 | ( |
| 4637 | void* pvosGCtx, |
| 4638 | v_U8_t ucSTAId, |
| 4639 | v_U8_t ucUcastSig, |
| 4640 | v_U8_t ucBcastSig |
| 4641 | ) |
| 4642 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4643 | WLANTL_CbType* pTLCb = NULL; |
| 4644 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4645 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ |
| 4646 | |
| 4647 | /*------------------------------------------------------------------------- |
| 4648 | Sanity check |
| 4649 | -------------------------------------------------------------------------*/ |
| 4650 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 4651 | if ( NULL == pTLCb ) |
| 4652 | { |
| 4653 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 4654 | "WLAN TL: Invalid input pointer on WLANTL_ForwardSTAFrames TL %x", |
| 4655 | pTLCb )); |
| 4656 | return VOS_STATUS_E_FAULT; |
| 4657 | } |
| 4658 | |
| 4659 | if ( WLANTL_STA_ID_INVALID( ucSTAId ) ) |
| 4660 | { |
| 4661 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 4662 | "WLAN TL:Invalid station id requested on WLANTL_ForwardSTAFrames")); |
| 4663 | return VOS_STATUS_E_FAULT; |
| 4664 | } |
| 4665 | |
| 4666 | //WLAN_TL_LOCK_STA_CACHE(pTLCb->atlSTAClients[ucSTAId]); |
| 4667 | |
| 4668 | /*------------------------------------------------------------------------ |
| 4669 | Check if station has not been registered in the mean while |
| 4670 | if not registered, flush cached frames. |
| 4671 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4672 | pClientSTA = pTLCb->atlSTAClients[ucSTAId]; |
| 4673 | |
| 4674 | if ( NULL == pClientSTA ) |
| 4675 | { |
| 4676 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 4677 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 4678 | return VOS_STATUS_E_FAILURE; |
| 4679 | } |
| 4680 | |
| 4681 | if ( 0 == pClientSTA->ucExists ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4682 | { |
| 4683 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 4684 | "WLAN TL:Station has been deleted for STA %d - flushing cache", ucSTAId)); |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4685 | WLANTL_FlushCachedFrames(pClientSTA->vosBegCachedFrame); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4686 | goto done; |
| 4687 | } |
| 4688 | |
| 4689 | /*------------------------------------------------------------------------ |
| 4690 | Forwarding cache frames received while the station was in the process |
| 4691 | of being registered with the rest of the SW components |
| 4692 | |
| 4693 | Access to the cache must be locked; similarly updating the signature and |
| 4694 | the existence flag must be synchronized because these values are checked |
| 4695 | during cached |
| 4696 | ------------------------------------------------------------------------*/ |
| 4697 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 4698 | "WLAN TL:Preparing to fwd packets for STA %d", ucSTAId)); |
| 4699 | |
| 4700 | /*----------------------------------------------------------------------- |
| 4701 | Save the new signature values |
| 4702 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4703 | pClientSTA->wSTADesc.ucUcastSig = ucUcastSig; |
| 4704 | pClientSTA->wSTADesc.ucBcastSig = ucBcastSig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4705 | |
| 4706 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 4707 | "WLAN TL:Fwd-ing packets for STA %d UC %d BC %d", |
| 4708 | ucSTAId, ucUcastSig, ucBcastSig)); |
| 4709 | |
| 4710 | /*------------------------------------------------------------------------- |
| 4711 | Check to see if we have any cached data to forward |
| 4712 | -------------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4713 | if ( NULL != pClientSTA->vosBegCachedFrame ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4714 | { |
| 4715 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 4716 | "WLAN TL: Fwd-ing Cached packets for station %d", ucSTAId )); |
| 4717 | |
| 4718 | WLANTL_RxCachedFrames( pTLCb, |
| 4719 | ucSTAId, |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4720 | pClientSTA->vosBegCachedFrame); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4721 | } |
| 4722 | else |
| 4723 | { |
| 4724 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 4725 | "WLAN TL: NO cached packets for station %d", ucSTAId )); |
| 4726 | } |
| 4727 | |
| 4728 | done: |
| 4729 | /*------------------------------------------------------------------------- |
| 4730 | Clear the station cache |
| 4731 | -------------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4732 | pClientSTA->vosBegCachedFrame = NULL; |
| 4733 | pClientSTA->vosEndCachedFrame = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4734 | |
| 4735 | /*----------------------------------------------------------------------- |
| 4736 | After all the init is complete we can mark the existance flag |
| 4737 | ----------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 4738 | pClientSTA->ucRxBlocked = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4739 | |
| 4740 | //WLAN_TL_UNLOCK_STA_CACHE(pTLCb->atlSTAClients[ucSTAId]); |
| 4741 | return VOS_STATUS_SUCCESS; |
| 4742 | |
| 4743 | }/*WLANTL_ForwardSTAFrames*/ |
| 4744 | |
| 4745 | |
| 4746 | #ifdef FEATURE_WLAN_CCX |
| 4747 | /*========================================================================== |
| 4748 | |
| 4749 | FUNCTION WLANTL_IsIAPPFrame |
| 4750 | |
| 4751 | DESCRIPTION |
| 4752 | Internal utility function for detecting incoming CCX IAPP frames |
| 4753 | |
| 4754 | DEPENDENCIES |
| 4755 | |
| 4756 | PARAMETERS |
| 4757 | |
| 4758 | IN |
| 4759 | |
| 4760 | pvBDHeader: pointer to the BD header |
| 4761 | vosTempBuff: the data packet |
| 4762 | |
| 4763 | IN/OUT |
| 4764 | pFirstDataPktArrived: static from caller function; used for rssi |
| 4765 | computation |
| 4766 | RETURN VALUE |
| 4767 | The result code associated with performing the operation |
| 4768 | |
| 4769 | VOS_TRUE: It is a IAPP frame |
| 4770 | VOS_FALSE: It is NOT IAPP frame |
| 4771 | |
| 4772 | SIDE EFFECTS |
| 4773 | |
| 4774 | ============================================================================*/ |
| 4775 | v_BOOL_t |
| 4776 | WLANTL_IsIAPPFrame |
| 4777 | ( |
| 4778 | v_PVOID_t pvBDHeader, |
| 4779 | vos_pkt_t* vosTempBuff |
| 4780 | ) |
| 4781 | { |
| 4782 | v_U16_t usMPDUDOffset; |
| 4783 | v_U8_t ucOffset; |
| 4784 | v_U8_t ucSnapHdr[WLANTL_LLC_SNAP_SIZE]; |
| 4785 | v_SIZE_t usSnapHdrSize = WLANTL_LLC_SNAP_SIZE; |
| 4786 | VOS_STATUS vosStatus; |
| 4787 | |
| 4788 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 4789 | |
| 4790 | /*------------------------------------------------------------------------ |
| 4791 | Check if OUI field is present. |
| 4792 | -------------------------------------------------------------------------*/ |
| 4793 | if ( VOS_FALSE == WDA_IS_RX_LLC_PRESENT(pvBDHeader) ) |
| 4794 | { |
| 4795 | TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, |
| 4796 | "WLAN TL:LLC header removed, cannot determine BT-AMP type -" |
| 4797 | "dropping pkt")); |
| 4798 | /* Drop packet */ |
| 4799 | vos_pkt_return_packet(vosTempBuff); |
| 4800 | return VOS_TRUE; |
| 4801 | } |
| 4802 | usMPDUDOffset = (v_U8_t)WDA_GET_RX_MPDU_DATA_OFFSET(pvBDHeader); |
| 4803 | ucOffset = (v_U8_t)usMPDUDOffset + WLANTL_LLC_SNAP_OFFSET; |
| 4804 | |
| 4805 | vosStatus = vos_pkt_extract_data( vosTempBuff, ucOffset, |
| 4806 | (v_PVOID_t)ucSnapHdr, &usSnapHdrSize); |
| 4807 | |
| 4808 | if (( VOS_STATUS_SUCCESS != vosStatus)) |
| 4809 | { |
| 4810 | TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, |
| 4811 | "Unable to extract Snap Hdr of data packet -" |
| 4812 | "dropping pkt")); |
| 4813 | return VOS_FALSE; |
| 4814 | } |
| 4815 | |
| 4816 | /*------------------------------------------------------------------------ |
| 4817 | Check if this is IAPP frame by matching Aironet Snap hdr. |
| 4818 | -------------------------------------------------------------------------*/ |
| 4819 | // Compare returns 1 if values are same and 0 |
| 4820 | // if not the same. |
| 4821 | if (( WLANTL_LLC_SNAP_SIZE != usSnapHdrSize ) || |
| 4822 | ( 0 == vos_mem_compare(ucSnapHdr, (v_PVOID_t)WLANTL_AIRONET_SNAP_HEADER, |
| 4823 | WLANTL_LLC_SNAP_SIZE ) )) |
| 4824 | { |
| 4825 | return VOS_FALSE; |
| 4826 | } |
| 4827 | |
| 4828 | return VOS_TRUE; |
| 4829 | |
| 4830 | } |
| 4831 | #endif //FEATURE_WLAN_CCX |
| 4832 | |
| 4833 | /*========================================================================== |
| 4834 | |
| 4835 | FUNCTION WLANTL_ProcessBAPFrame |
| 4836 | |
| 4837 | DESCRIPTION |
| 4838 | Internal utility function for processing incoming BT-AMP frames |
| 4839 | |
| 4840 | DEPENDENCIES |
| 4841 | TL must be initiailized before this function gets called. |
| 4842 | Bothe the BT-AMP station and the BAP Ctrl path must have been previously |
| 4843 | registered with TL. |
| 4844 | |
| 4845 | PARAMETERS |
| 4846 | |
| 4847 | IN |
| 4848 | |
| 4849 | pvBDHeader: pointer to the BD header |
| 4850 | vosTempBuff: the data packet |
| 4851 | pTLCb: TL control block |
| 4852 | ucSTAId: station id |
| 4853 | |
| 4854 | IN/OUT |
| 4855 | pFirstDataPktArrived: static from caller function; used for rssi |
| 4856 | computation |
| 4857 | RETURN VALUE |
| 4858 | The result code associated with performing the operation |
| 4859 | |
| 4860 | VOS_STATUS_E_INVAL: Input parameters are invalid |
| 4861 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 4862 | page fault |
| 4863 | VOS_STATUS_SUCCESS: Everything is good :) |
| 4864 | |
| 4865 | SIDE EFFECTS |
| 4866 | |
| 4867 | ============================================================================*/ |
| 4868 | v_BOOL_t |
| 4869 | WLANTL_ProcessBAPFrame |
| 4870 | ( |
| 4871 | v_PVOID_t pvBDHeader, |
| 4872 | vos_pkt_t* vosTempBuff, |
| 4873 | WLANTL_CbType* pTLCb, |
| 4874 | v_U8_t* pFirstDataPktArrived, |
| 4875 | v_U8_t ucSTAId |
| 4876 | ) |
| 4877 | { |
| 4878 | v_U16_t usMPDUDOffset; |
| 4879 | v_U8_t ucOffset; |
| 4880 | v_U8_t ucOUI[WLANTL_LLC_OUI_SIZE]; |
| 4881 | v_SIZE_t usOUISize = WLANTL_LLC_OUI_SIZE; |
| 4882 | VOS_STATUS vosStatus; |
| 4883 | v_U16_t usType; |
| 4884 | v_SIZE_t usTypeLen = sizeof(usType); |
| 4885 | v_U8_t ucMPDUHOffset; |
| 4886 | v_U8_t ucMPDUHLen = 0; |
| 4887 | v_U16_t usActualHLen = 0; |
| 4888 | |
| 4889 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 4890 | |
| 4891 | /*------------------------------------------------------------------------ |
| 4892 | Extract OUI and type from LLC and validate; if non-data send to BAP |
| 4893 | -------------------------------------------------------------------------*/ |
| 4894 | if ( VOS_FALSE == WDA_IS_RX_LLC_PRESENT(pvBDHeader) ) |
| 4895 | { |
| 4896 | TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, |
| 4897 | "WLAN TL:LLC header removed, cannot determine BT-AMP type -" |
| 4898 | "dropping pkt")); |
| 4899 | /* Drop packet */ |
| 4900 | vos_pkt_return_packet(vosTempBuff); |
| 4901 | return VOS_TRUE; |
| 4902 | } |
| 4903 | |
| 4904 | usMPDUDOffset = (v_U8_t)WDA_GET_RX_MPDU_DATA_OFFSET(pvBDHeader); |
| 4905 | ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(pvBDHeader); |
| 4906 | ucMPDUHLen = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(pvBDHeader); |
| 4907 | ucOffset = (v_U8_t)usMPDUDOffset + WLANTL_LLC_OUI_OFFSET; |
| 4908 | |
| 4909 | vosStatus = vos_pkt_extract_data( vosTempBuff, ucOffset, |
| 4910 | (v_PVOID_t)ucOUI, &usOUISize); |
| 4911 | |
| 4912 | #if 0 |
| 4913 | // Compare returns 1 if values are same and 0 |
| 4914 | // if not the same. |
| 4915 | if (( WLANTL_LLC_OUI_SIZE != usOUISize ) || |
| 4916 | ( 0 == vos_mem_compare(ucOUI, (v_PVOID_t)WLANTL_BT_AMP_OUI, |
| 4917 | WLANTL_LLC_OUI_SIZE ) )) |
| 4918 | { |
| 4919 | TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, |
| 4920 | "LLC header points to diff OUI in BT-AMP station -" |
| 4921 | "dropping pkt")); |
| 4922 | /* Drop packet */ |
| 4923 | vos_pkt_return_packet(vosTempBuff); |
| 4924 | return VOS_TRUE; |
| 4925 | } |
| 4926 | #endif |
| 4927 | /*------------------------------------------------------------------------ |
| 4928 | Extract LLC OUI and ensure that this is indeed a BT-AMP frame |
| 4929 | ------------------------------------------------------------------------*/ |
| 4930 | vosStatus = vos_pkt_extract_data( vosTempBuff, |
| 4931 | ucOffset + WLANTL_LLC_OUI_SIZE, |
| 4932 | (v_PVOID_t)&usType, &usTypeLen); |
| 4933 | |
| 4934 | if (( VOS_STATUS_SUCCESS != vosStatus) || |
| 4935 | ( sizeof(usType) != usTypeLen )) |
| 4936 | { |
| 4937 | TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, |
| 4938 | "Unable to extract type on incoming BAP packet -" |
| 4939 | "dropping pkt")); |
| 4940 | /* Drop packet */ |
| 4941 | vos_pkt_return_packet(vosTempBuff); |
| 4942 | return VOS_TRUE; |
| 4943 | } |
| 4944 | |
| 4945 | /*------------------------------------------------------------------------ |
| 4946 | Check if this is BT-AMP data or ctrl packet(RSN, LinkSvision, ActivityR) |
| 4947 | ------------------------------------------------------------------------*/ |
| 4948 | usType = vos_be16_to_cpu(usType); |
| 4949 | |
| 4950 | if (WLANTL_BAP_IS_NON_DATA_PKT_TYPE(usType)) |
| 4951 | { |
| 4952 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 4953 | "WLAN TL:Non-data packet received over BT-AMP link: %d, => BAP", |
| 4954 | usType)); |
| 4955 | |
| 4956 | /*Flatten packet as BAP expects to be able to peek*/ |
| 4957 | if ( VOS_STATUS_SUCCESS != vos_pkt_flatten_rx_pkt(&vosTempBuff)) |
| 4958 | { |
| 4959 | TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, |
| 4960 | "WLAN TL:Cannot flatten BT-AMP packet - dropping")); |
| 4961 | /* Drop packet */ |
| 4962 | vos_pkt_return_packet(vosTempBuff); |
| 4963 | return VOS_TRUE; |
| 4964 | } |
| 4965 | |
| 4966 | /* Send packet to BAP client*/ |
| 4967 | |
| 4968 | VOS_ASSERT(pTLCb->tlBAPClient.pfnTlBAPRx != NULL); |
| 4969 | |
| 4970 | if ( VOS_STATUS_SUCCESS != WDA_DS_TrimRxPacketInfo( vosTempBuff ) ) |
| 4971 | { |
| 4972 | TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, |
| 4973 | "WLAN TL:BD header corrupted - dropping packet")); |
| 4974 | /* Drop packet */ |
| 4975 | vos_pkt_return_packet(vosTempBuff); |
| 4976 | return VOS_TRUE; |
| 4977 | } |
| 4978 | |
| 4979 | if ( 0 == WDA_GET_RX_FT_DONE(pvBDHeader) ) |
| 4980 | { |
| 4981 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 4982 | "Non-data packet received over BT-AMP link: Sending it for " |
| 4983 | "frame Translation")); |
| 4984 | |
| 4985 | if (usMPDUDOffset > ucMPDUHOffset) |
| 4986 | { |
| 4987 | usActualHLen = usMPDUDOffset - ucMPDUHOffset; |
| 4988 | } |
| 4989 | |
| 4990 | /* software frame translation for BTAMP WDS.*/ |
| 4991 | WLANTL_Translate80211To8023Header( vosTempBuff, &vosStatus, usActualHLen, |
| 4992 | ucMPDUHLen, pTLCb,ucSTAId ); |
| 4993 | |
| 4994 | } |
| 4995 | if (pTLCb->tlBAPClient.pfnTlBAPRx) |
| 4996 | pTLCb->tlBAPClient.pfnTlBAPRx( vos_get_global_context(VOS_MODULE_ID_TL,pTLCb), |
| 4997 | vosTempBuff, |
| 4998 | (WLANTL_BAPFrameEnumType)usType ); |
| 4999 | |
| 5000 | return VOS_TRUE; |
| 5001 | } |
| 5002 | else |
| 5003 | { |
| 5004 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 5005 | "WLAN TL: BAP DATA packet received over BT-AMP link: %d, => BAP", |
| 5006 | usType)); |
| 5007 | /*!!!FIX ME!!*/ |
| 5008 | #if 0 |
| 5009 | /*-------------------------------------------------------------------- |
| 5010 | For data packet collect phy stats RSSI and Link Quality |
| 5011 | Calculate the RSSI average and save it. Continuous average is done. |
| 5012 | --------------------------------------------------------------------*/ |
| 5013 | if ( *pFirstDataPktArrived == 0) |
| 5014 | { |
| 5015 | pTLCb->atlSTAClients[ucSTAId].rssiAvg = |
| 5016 | WLANHAL_GET_RSSI_AVERAGE( pvBDHeader ); |
| 5017 | pTLCb->atlSTAClients[ucSTAId].uLinkQualityAvg = |
| 5018 | WLANHAL_RX_BD_GET_SNR( pvBDHeader ); |
| 5019 | |
| 5020 | // Rcvd 1st pkt, start average from next time |
| 5021 | *pFirstDataPktArrived = 1; |
| 5022 | } |
| 5023 | else |
| 5024 | { |
| 5025 | pTLCb->atlSTAClients[ucSTAId].rssiAvg = |
| 5026 | (WLANHAL_GET_RSSI_AVERAGE( pvBDHeader ) + |
| 5027 | pTLCb->atlSTAClients[ucSTAId].rssiAvg)/2; |
| 5028 | pTLCb->atlSTAClients[ucSTAId].uLinkQualityAvg = |
| 5029 | (WLANHAL_RX_BD_GET_SNR( pvBDHeader ) + |
| 5030 | pTLCb->atlSTAClients[ucSTAId].uLinkQualityAvg)/2; |
| 5031 | }/*Else, first data packet*/ |
| 5032 | #endif |
| 5033 | }/*BT-AMP data packet*/ |
| 5034 | |
| 5035 | return VOS_FALSE; |
| 5036 | }/*WLANTL_ProcessBAPFrame*/ |
| 5037 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5038 | |
| 5039 | /*========================================================================== |
| 5040 | |
| 5041 | FUNCTION WLANTL_ProcessFCFrame |
| 5042 | |
| 5043 | DESCRIPTION |
| 5044 | Internal utility function for processing incoming Flow Control frames. Enable |
| 5045 | or disable LWM mode based on the information. |
| 5046 | |
| 5047 | DEPENDENCIES |
| 5048 | TL must be initiailized before this function gets called. |
| 5049 | FW sends up special flow control frame. |
| 5050 | |
| 5051 | PARAMETERS |
| 5052 | |
| 5053 | IN |
| 5054 | pvosGCtx pointer to vos global context |
| 5055 | pvBDHeader: pointer to the BD header |
| 5056 | pTLCb: TL control block |
| 5057 | pvBDHeader pointer to BD header. |
| 5058 | |
| 5059 | IN/OUT |
| 5060 | pFirstDataPktArrived: static from caller function; used for rssi |
| 5061 | computation |
| 5062 | RETURN VALUE |
| 5063 | The result code associated with performing the operation |
| 5064 | |
| 5065 | VOS_STATUS_E_INVAL: Input frame are invalid |
| 5066 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 5067 | page fault |
| 5068 | VOS_STATUS_SUCCESS: Everything is good :) |
| 5069 | |
| 5070 | SIDE EFFECTS |
| 5071 | The ingress and egress of each station will be updated. If needed, LWM mode will |
| 5072 | be enabled or disabled based on the flow control algorithm. |
| 5073 | |
| 5074 | ============================================================================*/ |
| 5075 | v_BOOL_t |
| 5076 | WLANTL_ProcessFCFrame |
| 5077 | ( |
| 5078 | v_PVOID_t pvosGCtx, |
| 5079 | vos_pkt_t* pvosDataBuff, |
| 5080 | v_PVOID_t pvBDHeader |
| 5081 | ) |
| 5082 | { |
| 5083 | #if 1 //enable processing of only fcStaTxDisabled bitmap for now. the else part is old better qos code. |
| 5084 | // need to revisit the old code for full implementation. |
| 5085 | v_U8_t ucTxSuspended = 0, ucTxSuspendReq = 0, ucTxResumeReq = 0; |
| 5086 | WLANTL_CbType* pTLCb = NULL; |
| 5087 | |
| 5088 | /*------------------------------------------------------------------------ |
| 5089 | Extract TL control block |
| 5090 | ------------------------------------------------------------------------*/ |
| 5091 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 5092 | if ( NULL == pTLCb ) |
| 5093 | { |
| 5094 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 5095 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SuspendDataTx")); |
| 5096 | return VOS_STATUS_E_FAULT; |
| 5097 | } |
| 5098 | |
| 5099 | /* Existing Stations with Tx suspended */ |
| 5100 | ucTxSuspended = pTLCb->ucTxSuspended; |
| 5101 | |
| 5102 | /* Suspend Request Received */ |
| 5103 | ucTxSuspendReq = (v_U8_t) WDA_GET_RX_FC_STA_TX_DISABLED_BITMAP(pvBDHeader); |
| 5104 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 5105 | "WLANTL_ProcessFCFrame called for Stations:: Current: %x Requested: %x ", ucTxSuspended, ucTxSuspendReq)); |
| 5106 | |
| 5107 | ucTxResumeReq = ucTxSuspendReq ^ ( ucTxSuspended | ucTxSuspendReq ); |
| 5108 | ucTxSuspendReq = ucTxSuspendReq ^ ( ucTxSuspended & ucTxSuspendReq ); |
| 5109 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 5110 | "Station Suspend request processed :: Suspend: %x :Resume: %x ", ucTxSuspendReq, ucTxResumeReq)); |
| 5111 | |
| 5112 | if ( 0 != ucTxSuspendReq ) |
| 5113 | { |
| 5114 | WLANTL_SuspendDataTx(pvosGCtx, &ucTxSuspendReq, NULL); |
| 5115 | } |
| 5116 | if ( 0 != ucTxResumeReq ) |
| 5117 | { |
| 5118 | WLANTL_ResumeDataTx(pvosGCtx, &ucTxResumeReq); |
| 5119 | } |
| 5120 | |
| 5121 | #else |
| 5122 | VOS_STATUS vosStatus; |
| 5123 | tpHalFcRxBd pvFcRxBd = NULL; |
| 5124 | v_U8_t ucBitCheck = 0x1; |
| 5125 | v_U8_t ucStaValid = 0; |
| 5126 | v_U8_t ucSTAId = 0; |
| 5127 | |
| 5128 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, |
| 5129 | "Received FC Response"); |
| 5130 | if ( (NULL == pTLCb) || (NULL == pvosDataBuff)) |
| 5131 | { |
| 5132 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5133 | "WLAN TL:Invalid pointer in %s \n", __func__)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5134 | return VOS_STATUS_E_FAULT; |
| 5135 | } |
| 5136 | vosStatus = vos_pkt_peek_data( pvosDataBuff, 0, (v_PVOID_t)&pvFcRxBd, |
| 5137 | sizeof(tHalFcRxBd)); |
| 5138 | |
| 5139 | if ( (VOS_STATUS_SUCCESS != vosStatus) || (NULL == pvFcRxBd) ) |
| 5140 | { |
| 5141 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 5142 | "WLAN TL:wrong FC Rx packet")); |
| 5143 | return VOS_STATUS_E_INVAL; |
| 5144 | } |
| 5145 | |
| 5146 | // need to swap bytes in the FC contents. |
| 5147 | WLANHAL_SwapFcRxBd(&pvFcRxBd->fcSTATxQLen[0]); |
| 5148 | |
| 5149 | //logic to enable/disable LWM mode for each station |
| 5150 | for( ucStaValid = (v_U8_t)pvFcRxBd->fcSTAValidMask; ucStaValid; ucStaValid >>= 1, ucBitCheck <<= 1, ucSTAId ++) |
| 5151 | { |
| 5152 | if ( (0 == (ucStaValid & 0x1)) || (0 == pTLCb->atlSTAClients[ucSTAId].ucExists) ) |
| 5153 | { |
| 5154 | continue; |
| 5155 | } |
| 5156 | |
| 5157 | if ( pvFcRxBd->fcSTAThreshIndMask & ucBitCheck ) |
| 5158 | { |
| 5159 | //LWM event is reported by FW. Able to fetch more packet |
| 5160 | if( pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled ) |
| 5161 | { |
| 5162 | //Now memory usage is below LWM. Station can send more packets. |
| 5163 | pTLCb->atlSTAClients[ucSTAId].ucLwmEventReported = TRUE; |
| 5164 | } |
| 5165 | else |
| 5166 | { |
| 5167 | TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW, |
| 5168 | "WLAN TL: FW report LWM event but the station %d is not in LWM mode \n", ucSTAId)); |
| 5169 | } |
| 5170 | } |
| 5171 | |
| 5172 | //calculate uEgress_length/uIngress_length only after receiving enough packets |
| 5173 | if (WLANTL_LWM_INGRESS_SAMPLE_THRESHOLD <= pTLCb->atlSTAClients[ucSTAId].uIngress_length) |
| 5174 | { |
| 5175 | //check memory usage info to see whether LWM mode should be enabled for the station |
| 5176 | v_U32_t uEgress_length = pTLCb->atlSTAClients[ucSTAId].uIngress_length + |
| 5177 | pTLCb->atlSTAClients[ucSTAId].bmuMemConsumed - pvFcRxBd->fcSTATxQLen[ucSTAId]; |
| 5178 | |
| 5179 | //if ((float)uEgress_length/(float)pTLCb->atlSTAClients[ucSTAId].uIngress_length |
| 5180 | // <= WLANTL_LWM_EGRESS_INGRESS_THRESHOLD) |
| 5181 | if ( (pTLCb->atlSTAClients[ucSTAId].uIngress_length > uEgress_length) && |
| 5182 | ((pTLCb->atlSTAClients[ucSTAId].uIngress_length - uEgress_length ) >= |
| 5183 | (pTLCb->atlSTAClients[ucSTAId].uIngress_length >> 2)) |
| 5184 | ) |
| 5185 | { |
| 5186 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 5187 | "WLAN TL:Enable LWM mode for station %d\n", ucSTAId)); |
| 5188 | pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled = TRUE; |
| 5189 | } |
| 5190 | else |
| 5191 | { |
| 5192 | if( pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled ) |
| 5193 | { |
| 5194 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 5195 | "WLAN TL:Disable LWM mode for station %d\n", ucSTAId)); |
| 5196 | pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled = FALSE; |
| 5197 | } |
| 5198 | |
| 5199 | } |
| 5200 | |
| 5201 | //remember memory usage in FW starting from this round |
| 5202 | pTLCb->atlSTAClients[ucSTAId].bmuMemConsumed = pvFcRxBd->fcSTATxQLen[ucSTAId]; |
| 5203 | pTLCb->atlSTAClients[ucSTAId].uIngress_length = 0; |
| 5204 | } //(WLANTL_LWM_INGRESS_SAMPLE_THRESHOLD <= pTLCb->atlSTAClients[ucSTAId].uIngress_length) |
| 5205 | |
| 5206 | if( pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled ) |
| 5207 | { |
| 5208 | //always update current maximum allowed memeory usage |
| 5209 | pTLCb->atlSTAClients[ucSTAId].uBuffThresholdMax = WLANTL_STA_BMU_THRESHOLD_MAX - |
| 5210 | pvFcRxBd->fcSTATxQLen[ucSTAId]; |
| 5211 | } |
| 5212 | |
| 5213 | } |
| 5214 | #endif |
| 5215 | |
| 5216 | return VOS_STATUS_SUCCESS; |
| 5217 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5218 | |
| 5219 | |
| 5220 | /*========================================================================== |
| 5221 | |
| 5222 | FUNCTION WLANTL_RxFrames |
| 5223 | |
| 5224 | DESCRIPTION |
| 5225 | Callback registered by TL and called by BAL when a packet is received |
| 5226 | over the bus. Upon the call of this function TL will make the necessary |
| 5227 | decision with regards to the forwarding or queuing of this packet and |
| 5228 | the layer it needs to be delivered to. |
| 5229 | |
| 5230 | DEPENDENCIES |
| 5231 | TL must be initiailized before this function gets called. |
| 5232 | If the frame carried is a data frame then the station for which it is |
| 5233 | destined to must have been previously registered with TL. |
| 5234 | |
| 5235 | PARAMETERS |
| 5236 | |
| 5237 | IN |
| 5238 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 5239 | or BAL's control block can be extracted from its context |
| 5240 | |
| 5241 | vosDataBuff: it will contain a pointer to the first buffer received, |
| 5242 | if there is more then one packet they will be chained |
| 5243 | using vOSS buffers. |
| 5244 | |
| 5245 | RETURN VALUE |
| 5246 | The result code associated with performing the operation |
| 5247 | |
| 5248 | VOS_STATUS_E_INVAL: Input parameters are invalid |
| 5249 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 5250 | page fault |
| 5251 | VOS_STATUS_SUCCESS: Everything is good :) |
| 5252 | |
| 5253 | SIDE EFFECTS |
| 5254 | |
| 5255 | ============================================================================*/ |
| 5256 | VOS_STATUS |
| 5257 | WLANTL_RxFrames |
| 5258 | ( |
| 5259 | v_PVOID_t pvosGCtx, |
| 5260 | vos_pkt_t *pFrameDataBuff |
| 5261 | ) |
| 5262 | { |
| 5263 | vos_pkt_t* vosDataBuff = (vos_pkt_t*)pFrameDataBuff; |
| 5264 | WLANTL_CbType* pTLCb = NULL; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 5265 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5266 | WLANTL_STAFuncType pfnSTAFsm; |
| 5267 | vos_pkt_t* vosTempBuff; |
| 5268 | v_U8_t ucSTAId; |
| 5269 | VOS_STATUS vosStatus; |
| 5270 | v_U8_t ucFrmType; |
| 5271 | v_PVOID_t pvBDHeader = NULL; |
| 5272 | WLANTL_STAEventType wSTAEvent = WLANTL_RX_EVENT; |
| 5273 | v_U8_t ucTid = 0; |
| 5274 | v_BOOL_t broadcast = VOS_FALSE; |
| 5275 | v_BOOL_t selfBcastLoopback = VOS_FALSE; |
Madan Mohan Koyyalamudi | dfd6aa8 | 2012-10-18 20:18:43 -0700 | [diff] [blame] | 5276 | static v_U8_t first_data_pkt_arrived; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5277 | v_U32_t uDPUSig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5278 | v_U16_t usPktLen; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5279 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 5280 | v_U8_t ucMPDUHLen = 0 ; |
| 5281 | v_U16_t usEtherType = 0; |
| 5282 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5283 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 5284 | |
| 5285 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 5286 | "WLAN TL:TL Receive Frames called")); |
| 5287 | |
| 5288 | /*------------------------------------------------------------------------ |
| 5289 | Sanity check |
| 5290 | ------------------------------------------------------------------------*/ |
| 5291 | if ( NULL == vosDataBuff ) |
| 5292 | { |
| 5293 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 5294 | "WLAN TL:Invalid parameter sent on WLANTL_RxFrames")); |
| 5295 | return VOS_STATUS_E_INVAL; |
| 5296 | } |
| 5297 | |
| 5298 | /*------------------------------------------------------------------------ |
| 5299 | Extract TL control block |
| 5300 | ------------------------------------------------------------------------*/ |
| 5301 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 5302 | if ( NULL == pTLCb ) |
| 5303 | { |
| 5304 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 5305 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState")); |
| 5306 | return VOS_STATUS_E_FAULT; |
| 5307 | } |
| 5308 | |
| 5309 | /*--------------------------------------------------------------------- |
| 5310 | Save the initial buffer - this is the first received buffer |
| 5311 | ---------------------------------------------------------------------*/ |
| 5312 | vosTempBuff = vosDataBuff; |
| 5313 | |
| 5314 | while ( NULL != vosTempBuff ) |
| 5315 | { |
Madan Mohan Koyyalamudi | a148e1e | 2012-11-30 14:52:59 -0800 | [diff] [blame] | 5316 | broadcast = VOS_FALSE; |
| 5317 | selfBcastLoopback = VOS_FALSE; |
| 5318 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5319 | vos_pkt_walk_packet_chain( vosDataBuff, &vosDataBuff, 1/*true*/ ); |
| 5320 | |
| 5321 | /*--------------------------------------------------------------------- |
| 5322 | Peek at BD header - do not remove |
| 5323 | !!! Optimize me: only part of header is needed; not entire one |
| 5324 | ---------------------------------------------------------------------*/ |
| 5325 | vosStatus = WDA_DS_PeekRxPacketInfo( vosTempBuff, (v_PVOID_t)&pvBDHeader, 1/*Swap BD*/ ); |
| 5326 | |
| 5327 | if ( NULL == pvBDHeader ) |
| 5328 | { |
| 5329 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 5330 | "WLAN TL:Cannot extract BD header")); |
| 5331 | /* Drop packet */ |
| 5332 | vos_pkt_return_packet(vosTempBuff); |
| 5333 | vosTempBuff = vosDataBuff; |
| 5334 | continue; |
| 5335 | } |
| 5336 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5337 | /*--------------------------------------------------------------------- |
| 5338 | Check if FC frame reported from FW |
| 5339 | ---------------------------------------------------------------------*/ |
| 5340 | if(WDA_IS_RX_FC(pvBDHeader)) |
| 5341 | { |
| 5342 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 5343 | "WLAN TL:receive one FC frame")); |
| 5344 | |
| 5345 | WLANTL_ProcessFCFrame(pvosGCtx, vosTempBuff, pvBDHeader); |
| 5346 | /* Drop packet */ |
| 5347 | vos_pkt_return_packet(vosTempBuff); |
| 5348 | vosTempBuff = vosDataBuff; |
| 5349 | continue; |
| 5350 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5351 | |
| 5352 | /* AMSDU HW bug fix |
| 5353 | * After 2nd AMSDU subframe HW could not handle BD correctly |
| 5354 | * HAL workaround is needed */ |
| 5355 | if(WDA_GET_RX_ASF(pvBDHeader)) |
| 5356 | { |
| 5357 | WDA_DS_RxAmsduBdFix(pvosGCtx, pvBDHeader); |
| 5358 | } |
| 5359 | |
| 5360 | /*--------------------------------------------------------------------- |
| 5361 | Extract frame control field from 802.11 header if present |
| 5362 | (frame translation not done) |
| 5363 | ---------------------------------------------------------------------*/ |
| 5364 | |
| 5365 | vosStatus = WDA_DS_GetFrameTypeSubType( pvosGCtx, vosTempBuff, |
| 5366 | pvBDHeader, &ucFrmType ); |
| 5367 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 5368 | { |
| 5369 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 5370 | "WLAN TL:Cannot extract Frame Control Field")); |
| 5371 | /* Drop packet */ |
| 5372 | vos_pkt_return_packet(vosTempBuff); |
| 5373 | vosTempBuff = vosDataBuff; |
| 5374 | continue; |
| 5375 | } |
| 5376 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5377 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 5378 | if ( WLANTL_IS_DATA_FRAME(ucFrmType)) |
| 5379 | { |
| 5380 | ucMPDUHLen = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(pvBDHeader); |
| 5381 | WLANTL_GetEtherType_2(pvBDHeader, vosTempBuff, ucMPDUHLen, &usEtherType) ; |
| 5382 | } |
| 5383 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5384 | vos_pkt_get_packet_length(vosTempBuff, &usPktLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5385 | |
| 5386 | /*--------------------------------------------------------------------- |
| 5387 | Check if management and send to PE |
| 5388 | ---------------------------------------------------------------------*/ |
| 5389 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5390 | if ( WLANTL_IS_MGMT_FRAME(ucFrmType) |
| 5391 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 5392 | || (WLANTL_IS_TDLS_FRAME(usEtherType)) |
| 5393 | #endif |
| 5394 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5395 | { |
| 5396 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 5397 | "WLAN TL:Sending packet to management client")); |
| 5398 | if ( VOS_STATUS_SUCCESS != vos_pkt_flatten_rx_pkt(&vosTempBuff)) |
| 5399 | { |
| 5400 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 5401 | "WLAN TL:Cannot flatten packet - dropping")); |
| 5402 | /* Drop packet */ |
| 5403 | vos_pkt_return_packet(vosTempBuff); |
| 5404 | vosTempBuff = vosDataBuff; |
| 5405 | continue; |
| 5406 | } |
| 5407 | ucSTAId = (v_U8_t)WDA_GET_RX_STAID( pvBDHeader ); |
| 5408 | /* Read RSSI and update */ |
| 5409 | if(!WLANTL_STA_ID_INVALID(ucSTAId)) |
| 5410 | { |
| 5411 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 5412 | /* Read RSSI and update */ |
| 5413 | vosStatus = WLANTL_HSHandleRXFrame(pvosGCtx, |
| 5414 | WLANTL_MGMT_FRAME_TYPE, |
| 5415 | pvBDHeader, |
| 5416 | ucSTAId, |
| 5417 | VOS_FALSE, |
| 5418 | NULL); |
| 5419 | #else |
| 5420 | vosStatus = WLANTL_ReadRSSI(pvosGCtx, pvBDHeader, ucSTAId); |
| 5421 | #endif |
| 5422 | } |
| 5423 | |
| 5424 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 5425 | { |
| 5426 | TLLOGW(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, |
| 5427 | "Handle RX Management Frame fail within Handoff support module")); |
| 5428 | /* Do Not Drop packet at here |
| 5429 | * Revisit why HO module return fail |
| 5430 | vos_pkt_return_packet(vosTempBuff); |
| 5431 | vosTempBuff = vosDataBuff; |
| 5432 | continue; |
| 5433 | */ |
| 5434 | } |
| 5435 | pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx( pvosGCtx, vosTempBuff); |
| 5436 | } |
| 5437 | else /* Data Frame */ |
| 5438 | { |
| 5439 | ucSTAId = (v_U8_t)WDA_GET_RX_STAID( pvBDHeader ); |
| 5440 | ucTid = (v_U8_t)WDA_GET_RX_TID( pvBDHeader ); |
| 5441 | |
| 5442 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 5443 | "WLAN TL:Data packet received for STA %d", ucSTAId)); |
| 5444 | |
| 5445 | /*------------------------------------------------------------------ |
| 5446 | This should be corrected when multipe sta support is added !!! |
| 5447 | for now bcast frames will be sent to the last registered STA |
| 5448 | ------------------------------------------------------------------*/ |
| 5449 | if ( WDA_IS_RX_BCAST(pvBDHeader)) |
| 5450 | { |
| 5451 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 5452 | "WLAN TL:TL rx Bcast frame - sending to last registered station")); |
| 5453 | broadcast = VOS_TRUE; |
| 5454 | |
| 5455 | /*------------------------------------------------------------------- |
| 5456 | If Addr1 is b/mcast, but Addr3 is our own self MAC, it is a b/mcast |
| 5457 | pkt we sent looping back to us. To be dropped if we are non BTAMP |
| 5458 | -------------------------------------------------------------------*/ |
| 5459 | if( WLANHAL_RX_BD_ADDR3_SELF_IDX == |
| 5460 | (v_U8_t)WDA_GET_RX_ADDR3_IDX( pvBDHeader )) |
| 5461 | { |
| 5462 | selfBcastLoopback = VOS_TRUE; |
| 5463 | } |
| 5464 | }/*if bcast*/ |
| 5465 | |
| 5466 | if ( WLANTL_STA_ID_INVALID(ucSTAId) ) |
| 5467 | { |
| 5468 | TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, |
| 5469 | "WLAN TL:STA ID invalid - dropping pkt")); |
| 5470 | /* Drop packet */ |
| 5471 | vos_pkt_return_packet(vosTempBuff); |
| 5472 | vosTempBuff = vosDataBuff; |
| 5473 | continue; |
| 5474 | } |
| 5475 | |
| 5476 | /*---------------------------------------------------------------------- |
| 5477 | No need to lock cache access because cache manipulation only happens |
| 5478 | in the transport thread/task context |
| 5479 | - These frames are to be forwarded to the station upon registration |
| 5480 | which happens in the main thread context |
| 5481 | The caching here can happen in either Tx or Rx thread depending |
| 5482 | on the current SSC scheduling |
| 5483 | - also we need to make sure that the frames in the cache are fwd-ed to |
| 5484 | the station before the new incoming ones |
| 5485 | -----------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 5486 | pClientSTA = pTLCb->atlSTAClients[ucSTAId]; |
| 5487 | if (NULL == pClientSTA) |
| 5488 | { |
| 5489 | TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, |
| 5490 | "WLAN TL:STA not allocated memory. Dropping packet")); |
| 5491 | vos_pkt_return_packet(vosTempBuff); |
| 5492 | vosTempBuff = vosDataBuff; |
| 5493 | continue; |
| 5494 | } |
| 5495 | |
| 5496 | if ((( 0 == pClientSTA->ucExists ) || |
| 5497 | ( (0 != pClientSTA->ucRxBlocked) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5498 | ///@@@: xg: no checking in SOFTAP for now, will revisit later |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 5499 | && (WLAN_STA_SOFTAP != pClientSTA->wSTADesc.wSTAType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5500 | ) || |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 5501 | ( WLANTL_STA_DISCONNECTED == pClientSTA->tlState)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5502 | /*Dont buffer Broadcast/Multicast frames. If AP transmits bursts of Broadcast/Multicast data frames, |
| 5503 | * libra buffers all Broadcast/Multicast packets after authentication with AP, |
| 5504 | * So it will lead to low resource condition in Rx Data Path.*/ |
| 5505 | ((WDA_IS_RX_BCAST(pvBDHeader) == 0))) |
| 5506 | { |
| 5507 | uDPUSig = WDA_GET_RX_DPUSIG( pvBDHeader ); |
| 5508 | //Station has not yet been registered with TL - cache the frame |
| 5509 | WLANTL_CacheSTAFrame( pTLCb, ucSTAId, vosTempBuff, uDPUSig, broadcast, ucFrmType); |
| 5510 | vosTempBuff = vosDataBuff; |
| 5511 | continue; |
| 5512 | } |
| 5513 | |
| 5514 | |
| 5515 | #ifdef FEATURE_WLAN_CCX |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 5516 | if ((pClientSTA->wSTADesc.ucIsCcxSta)|| broadcast) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5517 | { |
| 5518 | /*-------------------------------------------------------------------- |
| 5519 | Filter the IAPP frames for CCX connection; |
| 5520 | if data it will return false and it |
| 5521 | will be routed through the regular data path |
| 5522 | --------------------------------------------------------------------*/ |
| 5523 | if ( WLANTL_IsIAPPFrame(pvBDHeader, |
| 5524 | vosTempBuff)) |
| 5525 | { |
| 5526 | if ( VOS_STATUS_SUCCESS != vos_pkt_flatten_rx_pkt(&vosTempBuff)) |
| 5527 | { |
| 5528 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 5529 | "WLAN TL:Cannot flatten packet - dropping")); |
| 5530 | /* Drop packet */ |
| 5531 | vos_pkt_return_packet(vosTempBuff); |
| 5532 | } else { |
| 5533 | |
| 5534 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, |
| 5535 | "WLAN TL: Received CCX IAPP Frame")); |
| 5536 | |
| 5537 | pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx( pvosGCtx, vosTempBuff); |
| 5538 | } |
| 5539 | vosTempBuff = vosDataBuff; |
| 5540 | continue; |
| 5541 | } |
| 5542 | } |
| 5543 | #endif |
| 5544 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 5545 | if ( WLAN_STA_BT_AMP == pClientSTA->wSTADesc.wSTAType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5546 | { |
| 5547 | /*-------------------------------------------------------------------- |
| 5548 | Process the ctrl BAP frame; if data it will return false and it |
| 5549 | will be routed through the regular data path |
| 5550 | --------------------------------------------------------------------*/ |
| 5551 | if ( WLANTL_ProcessBAPFrame( pvBDHeader, |
| 5552 | vosTempBuff, |
| 5553 | pTLCb, |
| 5554 | &first_data_pkt_arrived, |
| 5555 | ucSTAId)) |
| 5556 | { |
| 5557 | vosTempBuff = vosDataBuff; |
| 5558 | continue; |
| 5559 | } |
| 5560 | }/*if BT-AMP station*/ |
| 5561 | else if(selfBcastLoopback == VOS_TRUE) |
| 5562 | { |
| 5563 | /* Drop packet */ |
| 5564 | vos_pkt_return_packet(vosTempBuff); |
| 5565 | vosTempBuff = vosDataBuff; |
| 5566 | continue; |
| 5567 | } |
| 5568 | |
| 5569 | /*--------------------------------------------------------------------- |
| 5570 | Data packet received, send to state machine |
| 5571 | ---------------------------------------------------------------------*/ |
| 5572 | wSTAEvent = WLANTL_RX_EVENT; |
| 5573 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 5574 | pfnSTAFsm = tlSTAFsm[pClientSTA->tlState]. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5575 | pfnSTATbl[wSTAEvent]; |
| 5576 | |
| 5577 | if ( NULL != pfnSTAFsm ) |
| 5578 | { |
| 5579 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 5580 | /* Read RSSI and update */ |
| 5581 | vosStatus = WLANTL_HSHandleRXFrame(pvosGCtx, |
| 5582 | WLANTL_DATA_FRAME_TYPE, |
| 5583 | pvBDHeader, |
| 5584 | ucSTAId, |
| 5585 | broadcast, |
| 5586 | vosTempBuff); |
| 5587 | broadcast = VOS_FALSE; |
| 5588 | #else |
| 5589 | vosStatus = WLANTL_ReadRSSI(pvosGCtx, pvBDHeader, ucSTAId); |
| 5590 | #endif /*FEATURE_WLAN_GEN6_ROAMING*/ |
| 5591 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 5592 | { |
| 5593 | TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, |
| 5594 | "Handle RX Data Frame fail within Handoff support module")); |
| 5595 | /* Do Not Drop packet at here |
| 5596 | * Revisit why HO module return fail |
| 5597 | vos_pkt_return_packet(vosTempBuff); |
| 5598 | vosTempBuff = vosDataBuff; |
| 5599 | continue; |
| 5600 | */ |
| 5601 | } |
| 5602 | pfnSTAFsm( pvosGCtx, ucSTAId, &vosTempBuff); |
| 5603 | } |
| 5604 | else |
| 5605 | { |
| 5606 | TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, |
| 5607 | "WLAN TL:NULL state function, STA:%d, State: %d- dropping packet", |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 5608 | ucSTAId, pClientSTA->tlState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5609 | /* Drop packet */ |
| 5610 | vos_pkt_return_packet(vosTempBuff); |
| 5611 | vosTempBuff = vosDataBuff; |
| 5612 | continue; |
| 5613 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5614 | }/* else data frame*/ |
| 5615 | |
| 5616 | vosTempBuff = vosDataBuff; |
| 5617 | }/*while chain*/ |
| 5618 | |
| 5619 | return VOS_STATUS_SUCCESS; |
| 5620 | }/* WLANTL_RxFrames */ |
| 5621 | |
| 5622 | |
| 5623 | /*========================================================================== |
| 5624 | |
| 5625 | FUNCTION WLANTL_RxCachedFrames |
| 5626 | |
| 5627 | DESCRIPTION |
| 5628 | Utility function used by TL to forward the cached frames to a particular |
| 5629 | station; |
| 5630 | |
| 5631 | DEPENDENCIES |
| 5632 | TL must be initiailized before this function gets called. |
| 5633 | If the frame carried is a data frame then the station for which it is |
| 5634 | destined to must have been previously registered with TL. |
| 5635 | |
| 5636 | PARAMETERS |
| 5637 | |
| 5638 | IN |
| 5639 | pTLCb: pointer to TL handle |
| 5640 | |
| 5641 | ucSTAId: station for which we need to forward the packets |
| 5642 | |
| 5643 | vosDataBuff: it will contain a pointer to the first cached buffer |
| 5644 | received, if there is more then one packet they will be |
| 5645 | chained using vOSS buffers. |
| 5646 | |
| 5647 | RETURN VALUE |
| 5648 | The result code associated with performing the operation |
| 5649 | |
| 5650 | VOS_STATUS_E_INVAL: Input parameters are invalid |
| 5651 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 5652 | page fault |
| 5653 | VOS_STATUS_SUCCESS: Everything is good :) |
| 5654 | |
| 5655 | SIDE EFFECTS |
| 5656 | |
| 5657 | ============================================================================*/ |
| 5658 | VOS_STATUS |
| 5659 | WLANTL_RxCachedFrames |
| 5660 | ( |
| 5661 | WLANTL_CbType* pTLCb, |
| 5662 | v_U8_t ucSTAId, |
| 5663 | vos_pkt_t* vosDataBuff |
| 5664 | ) |
| 5665 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 5666 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5667 | WLANTL_STAFuncType pfnSTAFsm; |
| 5668 | vos_pkt_t* vosTempBuff; |
| 5669 | VOS_STATUS vosStatus; |
| 5670 | v_PVOID_t pvBDHeader = NULL; |
| 5671 | WLANTL_STAEventType wSTAEvent = WLANTL_RX_EVENT; |
| 5672 | v_U8_t ucTid = 0; |
| 5673 | v_BOOL_t broadcast = VOS_FALSE; |
| 5674 | v_BOOL_t bSigMatch = VOS_FALSE; |
| 5675 | v_BOOL_t selfBcastLoopback = VOS_FALSE; |
Madan Mohan Koyyalamudi | dfd6aa8 | 2012-10-18 20:18:43 -0700 | [diff] [blame] | 5676 | static v_U8_t first_data_pkt_arrived; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5677 | v_U32_t uDPUSig; |
| 5678 | v_U8_t ucUcastSig; |
| 5679 | v_U8_t ucBcastSig; |
| 5680 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 5681 | |
| 5682 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 5683 | "WLAN TL:TL Receive Cached Frames called")); |
| 5684 | |
| 5685 | /*------------------------------------------------------------------------ |
| 5686 | Sanity check |
| 5687 | ------------------------------------------------------------------------*/ |
| 5688 | if ( NULL == vosDataBuff ) |
| 5689 | { |
| 5690 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 5691 | "WLAN TL:Invalid parameter sent on WLANTL_RxFrames")); |
| 5692 | return VOS_STATUS_E_INVAL; |
| 5693 | } |
| 5694 | |
| 5695 | /*--------------------------------------------------------------------- |
| 5696 | Save the initial buffer - this is the first received buffer |
| 5697 | ---------------------------------------------------------------------*/ |
| 5698 | vosTempBuff = vosDataBuff; |
| 5699 | |
| 5700 | while ( NULL != vosTempBuff ) |
| 5701 | { |
Madan Mohan Koyyalamudi | a148e1e | 2012-11-30 14:52:59 -0800 | [diff] [blame] | 5702 | broadcast = VOS_FALSE; |
| 5703 | selfBcastLoopback = VOS_FALSE; |
| 5704 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5705 | vos_pkt_walk_packet_chain( vosDataBuff, &vosDataBuff, 1/*true*/ ); |
| 5706 | |
| 5707 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 5708 | "WLAN TL:Sending new cached packet to station %d", ucSTAId)); |
| 5709 | /*--------------------------------------------------------------------- |
| 5710 | Peek at BD header - do not remove |
| 5711 | !!! Optimize me: only part of header is needed; not entire one |
| 5712 | ---------------------------------------------------------------------*/ |
| 5713 | vosStatus = WDA_DS_PeekRxPacketInfo( vosTempBuff, (v_PVOID_t)&pvBDHeader, 0 ); |
| 5714 | |
| 5715 | if ( NULL == pvBDHeader ) |
| 5716 | { |
| 5717 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 5718 | "WLAN TL:Cannot extract BD header")); |
| 5719 | /* Drop packet */ |
| 5720 | vos_pkt_return_packet(vosTempBuff); |
| 5721 | vosTempBuff = vosDataBuff; |
| 5722 | continue; |
| 5723 | } |
| 5724 | |
| 5725 | uDPUSig = WDA_GET_RX_DPUSIG( pvBDHeader ); |
| 5726 | |
| 5727 | /* AMSDU HW bug fix |
| 5728 | * After 2nd AMSDU subframe HW could not handle BD correctly |
| 5729 | * HAL workaround is needed */ |
| 5730 | if(WDA_GET_RX_ASF(pvBDHeader)) |
| 5731 | { |
| 5732 | WDA_DS_RxAmsduBdFix(vos_get_global_context(VOS_MODULE_ID_TL,pTLCb), |
| 5733 | pvBDHeader); |
| 5734 | } |
| 5735 | |
| 5736 | ucTid = (v_U8_t)WDA_GET_RX_TID( pvBDHeader ); |
| 5737 | |
| 5738 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 5739 | "WLAN TL:Data packet cached for STA %d", ucSTAId); |
| 5740 | |
| 5741 | /*------------------------------------------------------------------ |
| 5742 | This should be corrected when multipe sta support is added !!! |
| 5743 | for now bcast frames will be sent to the last registered STA |
| 5744 | ------------------------------------------------------------------*/ |
| 5745 | if ( WDA_IS_RX_BCAST(pvBDHeader)) |
| 5746 | { |
| 5747 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 5748 | "WLAN TL:TL rx Bcast frame ")); |
| 5749 | broadcast = VOS_TRUE; |
| 5750 | |
| 5751 | /* If Addr1 is b/mcast, but Addr3 is our own self MAC, it is a b/mcast |
| 5752 | * pkt we sent looping back to us. To be dropped if we are non BTAMP |
| 5753 | */ |
| 5754 | if( WLANHAL_RX_BD_ADDR3_SELF_IDX == |
| 5755 | (v_U8_t)WDA_GET_RX_ADDR3_IDX( pvBDHeader )) |
| 5756 | { |
| 5757 | selfBcastLoopback = VOS_TRUE; |
| 5758 | } |
| 5759 | }/*if bcast*/ |
| 5760 | |
| 5761 | /*------------------------------------------------------------------------- |
| 5762 | Check if the packet that we cached matches the DPU signature of the |
| 5763 | newly added station |
| 5764 | -------------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 5765 | pClientSTA = pTLCb->atlSTAClients[ucSTAId]; |
| 5766 | |
| 5767 | |
| 5768 | if ( NULL == pClientSTA ) |
| 5769 | { |
| 5770 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 5771 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 5772 | return VOS_STATUS_E_FAILURE; |
| 5773 | } |
| 5774 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5775 | if ( broadcast ) |
| 5776 | { |
| 5777 | ucBcastSig = (v_U8_t)uDPUSig; |
| 5778 | bSigMatch = (( WLAN_TL_INVALID_B_SIG != |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 5779 | pClientSTA->wSTADesc.ucBcastSig ) && |
| 5780 | ( ucBcastSig == pClientSTA->wSTADesc.ucBcastSig )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5781 | } |
| 5782 | else |
| 5783 | { |
| 5784 | ucUcastSig = (v_U8_t)uDPUSig; |
| 5785 | bSigMatch = (( WLAN_TL_INVALID_U_SIG != |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 5786 | pClientSTA->wSTADesc.ucUcastSig ) && |
| 5787 | ( ucUcastSig == pClientSTA->wSTADesc.ucUcastSig )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5788 | } |
| 5789 | |
| 5790 | /*------------------------------------------------------------------------- |
| 5791 | If the packet doesn't match - drop it |
| 5792 | -------------------------------------------------------------------------*/ |
| 5793 | if ( !bSigMatch ) |
| 5794 | { |
| 5795 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 5796 | "WLAN TL: Cached packet does not match DPU Sig of the new STA - drop " |
| 5797 | " DPU Sig %d UC %d BC %d B %d", |
| 5798 | uDPUSig, |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 5799 | pClientSTA->wSTADesc.ucUcastSig, |
| 5800 | pClientSTA->wSTADesc.ucUcastSig, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5801 | broadcast)); |
| 5802 | |
| 5803 | /* Drop packet */ |
| 5804 | vos_pkt_return_packet(vosTempBuff); |
| 5805 | vosTempBuff = vosDataBuff; |
| 5806 | continue; |
| 5807 | |
| 5808 | }/*if signature mismatch*/ |
| 5809 | |
| 5810 | /*------------------------------------------------------------------------ |
| 5811 | Check if BT-AMP frame: |
| 5812 | - additional processing needed in this case to separate BT-AMP date |
| 5813 | from BT-AMP Ctrl path |
| 5814 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 5815 | if ( WLAN_STA_BT_AMP == pClientSTA->wSTADesc.wSTAType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5816 | { |
| 5817 | /*-------------------------------------------------------------------- |
| 5818 | Process the ctrl BAP frame; if data it will return false and it |
| 5819 | will be routed through the regular data path |
| 5820 | --------------------------------------------------------------------*/ |
| 5821 | if ( WLANTL_ProcessBAPFrame( pvBDHeader, |
| 5822 | vosTempBuff, |
| 5823 | pTLCb, |
| 5824 | &first_data_pkt_arrived, |
| 5825 | ucSTAId)) |
| 5826 | { |
| 5827 | vosTempBuff = vosDataBuff; |
| 5828 | continue; |
| 5829 | } |
| 5830 | }/*if BT-AMP station*/ |
| 5831 | else if(selfBcastLoopback == VOS_TRUE) |
| 5832 | { |
| 5833 | /* Drop packet */ |
| 5834 | vos_pkt_return_packet(vosTempBuff); |
| 5835 | vosTempBuff = vosDataBuff; |
| 5836 | continue; |
| 5837 | } |
| 5838 | |
| 5839 | /*--------------------------------------------------------------------- |
| 5840 | Data packet received, send to state machine |
| 5841 | ---------------------------------------------------------------------*/ |
| 5842 | wSTAEvent = WLANTL_RX_EVENT; |
| 5843 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 5844 | pfnSTAFsm = tlSTAFsm[pClientSTA->tlState]. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5845 | pfnSTATbl[wSTAEvent]; |
| 5846 | |
| 5847 | if ( NULL != pfnSTAFsm ) |
| 5848 | { |
| 5849 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 5850 | /* Read RSSI and update */ |
| 5851 | vosStatus = WLANTL_HSHandleRXFrame(vos_get_global_context( |
| 5852 | VOS_MODULE_ID_TL,pTLCb), |
| 5853 | WLANTL_DATA_FRAME_TYPE, |
| 5854 | pvBDHeader, |
| 5855 | ucSTAId, |
| 5856 | broadcast, |
| 5857 | vosTempBuff); |
| 5858 | broadcast = VOS_FALSE; |
| 5859 | #else |
| 5860 | vosStatus = WLANTL_ReadRSSI(vos_get_global_context(VOS_MODULE_ID_TL,pTLCb), pvBDHeader, ucSTAId); |
| 5861 | #endif /*FEATURE_WLAN_GEN6_ROAMING*/ |
| 5862 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 5863 | { |
| 5864 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 5865 | "Handle RX Data Frame fail within Handoff support module")); |
| 5866 | /* Do Not Drop packet at here |
| 5867 | * Revisit why HO module return fail |
| 5868 | vos_pkt_return_packet(vosTempBuff); |
| 5869 | vosTempBuff = vosDataBuff; |
| 5870 | continue; |
| 5871 | */ |
| 5872 | } |
| 5873 | pfnSTAFsm( vos_get_global_context(VOS_MODULE_ID_TL,pTLCb), ucSTAId, |
| 5874 | &vosTempBuff); |
| 5875 | } |
| 5876 | else |
| 5877 | { |
| 5878 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 5879 | "WLAN TL:NULL state function, STA:%d, State: %d- dropping packet", |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 5880 | ucSTAId, pClientSTA->tlState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5881 | /* Drop packet */ |
| 5882 | vos_pkt_return_packet(vosTempBuff); |
| 5883 | vosTempBuff = vosDataBuff; |
| 5884 | continue; |
| 5885 | } |
| 5886 | |
| 5887 | vosTempBuff = vosDataBuff; |
| 5888 | }/*while chain*/ |
| 5889 | |
| 5890 | return VOS_STATUS_SUCCESS; |
| 5891 | }/* WLANTL_RxCachedFrames */ |
| 5892 | |
| 5893 | /*========================================================================== |
| 5894 | FUNCTION WLANTL_ResourceCB |
| 5895 | |
| 5896 | DESCRIPTION |
| 5897 | Called by the TL when it has packets available for transmission. |
| 5898 | |
| 5899 | DEPENDENCIES |
| 5900 | The TL must be registered with BAL before this function can be called. |
| 5901 | |
| 5902 | PARAMETERS |
| 5903 | |
| 5904 | IN |
| 5905 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 5906 | or BAL's control block can be extracted from its context |
| 5907 | |
| 5908 | RETURN VALUE |
| 5909 | The result code associated with performing the operation |
| 5910 | |
| 5911 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 5912 | page fault |
| 5913 | VOS_STATUS_SUCCESS: Everything is good :) |
| 5914 | |
| 5915 | SIDE EFFECTS |
| 5916 | |
| 5917 | ============================================================================*/ |
| 5918 | VOS_STATUS |
| 5919 | WLANTL_ResourceCB |
| 5920 | ( |
| 5921 | v_PVOID_t pvosGCtx, |
| 5922 | v_U32_t uCount |
| 5923 | ) |
| 5924 | { |
| 5925 | WLANTL_CbType* pTLCb = NULL; |
| 5926 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 5927 | |
| 5928 | /*------------------------------------------------------------------------ |
| 5929 | Sanity check |
| 5930 | Extract TL control block |
| 5931 | ------------------------------------------------------------------------*/ |
| 5932 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 5933 | if ( NULL == pTLCb ) |
| 5934 | { |
| 5935 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 5936 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState")); |
| 5937 | return VOS_STATUS_E_FAULT; |
| 5938 | } |
| 5939 | |
| 5940 | pTLCb->uResCount = uCount; |
| 5941 | |
| 5942 | |
| 5943 | /*----------------------------------------------------------------------- |
| 5944 | Resume Tx if enough res and not suspended |
| 5945 | -----------------------------------------------------------------------*/ |
| 5946 | if (( pTLCb->uResCount >= WDA_TLI_MIN_RES_MF ) && |
| 5947 | ( 0 == pTLCb->ucTxSuspended )) |
| 5948 | { |
| 5949 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 5950 | "WLAN TL:Issuing Xmit start request to BAL for avail res ASYNC")); |
| 5951 | return WDA_DS_StartXmit(pvosGCtx); |
| 5952 | } |
| 5953 | |
| 5954 | return VOS_STATUS_SUCCESS; |
| 5955 | }/* WLANTL_ResourceCB */ |
| 5956 | |
| 5957 | |
Gopichand Nakkala | 11acd11 | 2012-12-31 16:04:04 -0800 | [diff] [blame] | 5958 | /*========================================================================== |
| 5959 | FUNCTION WLANTL_IsTxXmitPending |
| 5960 | |
| 5961 | DESCRIPTION |
| 5962 | Called by the WDA when it wants to know whether WDA_DS_TX_START_XMIT msg |
| 5963 | is pending in TL msg queue |
| 5964 | |
| 5965 | DEPENDENCIES |
| 5966 | The TL must be registered with WDA before this function can be called. |
| 5967 | |
| 5968 | PARAMETERS |
| 5969 | |
| 5970 | IN |
| 5971 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 5972 | or WDA's control block can be extracted from its context |
| 5973 | |
| 5974 | RETURN VALUE |
| 5975 | The result code associated with performing the operation |
| 5976 | |
| 5977 | 0: No WDA_DS_TX_START_XMIT msg pending |
| 5978 | 1: Msg WDA_DS_TX_START_XMIT already pending in TL msg queue |
| 5979 | |
| 5980 | SIDE EFFECTS |
| 5981 | |
| 5982 | ============================================================================*/ |
| 5983 | v_BOOL_t |
| 5984 | WLANTL_IsTxXmitPending |
| 5985 | ( |
| 5986 | v_PVOID_t pvosGCtx |
| 5987 | ) |
| 5988 | { |
| 5989 | |
| 5990 | WLANTL_CbType* pTLCb = NULL; |
| 5991 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 5992 | |
| 5993 | /*------------------------------------------------------------------------ |
| 5994 | Sanity check |
| 5995 | Extract TL control block |
| 5996 | ------------------------------------------------------------------------*/ |
| 5997 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 5998 | if ( NULL == pTLCb ) |
| 5999 | { |
| 6000 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL, |
| 6001 | "WLAN TL:Invalid TL pointer from pvosGCtx in WLANTL_IsTxXmitPending ")); |
| 6002 | return FALSE; |
| 6003 | } |
| 6004 | |
| 6005 | return pTLCb->isTxTranmitMsgPending; |
| 6006 | |
| 6007 | }/*WLANTL_IsTxXmitPending */ |
| 6008 | |
| 6009 | /*========================================================================== |
| 6010 | FUNCTION WLANTL_SetTxXmitPending |
| 6011 | |
| 6012 | DESCRIPTION |
| 6013 | Called by the WDA when it wants to indicate that WDA_DS_TX_START_XMIT msg |
| 6014 | is pending in TL msg queue |
| 6015 | |
| 6016 | DEPENDENCIES |
| 6017 | The TL must be registered with WDA before this function can be called. |
| 6018 | |
| 6019 | PARAMETERS |
| 6020 | |
| 6021 | IN |
| 6022 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 6023 | or WDA's control block can be extracted from its context |
| 6024 | |
| 6025 | RETURN VALUE None |
| 6026 | |
| 6027 | SIDE EFFECTS |
| 6028 | |
| 6029 | ============================================================================*/ |
| 6030 | |
| 6031 | v_VOID_t |
| 6032 | WLANTL_SetTxXmitPending |
| 6033 | ( |
| 6034 | v_PVOID_t pvosGCtx |
| 6035 | ) |
| 6036 | { |
| 6037 | |
| 6038 | WLANTL_CbType* pTLCb = NULL; |
| 6039 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 6040 | |
| 6041 | /*------------------------------------------------------------------------ |
| 6042 | Sanity check |
| 6043 | Extract TL control block |
| 6044 | ------------------------------------------------------------------------*/ |
| 6045 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 6046 | if ( NULL == pTLCb ) |
| 6047 | { |
| 6048 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL, |
| 6049 | "WLAN TL:Invalid TL pointer from pvosGCtx in WLANTL_SetTxXmitPending")); |
| 6050 | return; |
| 6051 | } |
| 6052 | |
| 6053 | pTLCb->isTxTranmitMsgPending = 1; |
| 6054 | return; |
| 6055 | |
| 6056 | }/*WLANTL_SetTxXmitPending */ |
| 6057 | |
| 6058 | /*========================================================================== |
| 6059 | FUNCTION WLANTL_ClearTxXmitPending |
| 6060 | |
| 6061 | DESCRIPTION |
| 6062 | Called by the WDA when it wants to indicate that no WDA_DS_TX_START_XMIT msg |
| 6063 | is pending in TL msg queue |
| 6064 | |
| 6065 | DEPENDENCIES |
| 6066 | The TL must be registered with WDA before this function can be called. |
| 6067 | |
| 6068 | PARAMETERS |
| 6069 | |
| 6070 | IN |
| 6071 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 6072 | or WDA's control block can be extracted from its context |
| 6073 | |
| 6074 | RETURN VALUE None |
| 6075 | |
| 6076 | SIDE EFFECTS |
| 6077 | |
| 6078 | ============================================================================*/ |
| 6079 | |
| 6080 | v_VOID_t |
| 6081 | WLANTL_ClearTxXmitPending |
| 6082 | ( |
| 6083 | v_PVOID_t pvosGCtx |
| 6084 | ) |
| 6085 | { |
| 6086 | |
| 6087 | WLANTL_CbType* pTLCb = NULL; |
| 6088 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 6089 | |
| 6090 | /*------------------------------------------------------------------------ |
| 6091 | Sanity check |
| 6092 | Extract TL control block |
| 6093 | ------------------------------------------------------------------------*/ |
| 6094 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 6095 | if ( NULL == pTLCb ) |
| 6096 | { |
| 6097 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL, |
| 6098 | "WLAN TL:Invalid TL pointer from pvosGCtx in WLANTL_ClearTxXmitPending ")); |
| 6099 | return; |
| 6100 | } |
| 6101 | |
| 6102 | pTLCb->isTxTranmitMsgPending = 0; |
| 6103 | return; |
| 6104 | }/*WLANTL_ClearTxXmitPending */ |
| 6105 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6106 | |
| 6107 | /*============================================================================ |
| 6108 | TL STATE MACHINE |
| 6109 | ============================================================================*/ |
| 6110 | |
| 6111 | /*========================================================================== |
| 6112 | FUNCTION WLANTL_STATxConn |
| 6113 | |
| 6114 | DESCRIPTION |
| 6115 | Transmit in connected state - only EAPOL and WAI packets allowed |
| 6116 | |
| 6117 | DEPENDENCIES |
| 6118 | The STA must be registered with TL before this function can be called. |
| 6119 | |
| 6120 | PARAMETERS |
| 6121 | |
| 6122 | IN |
| 6123 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 6124 | control block can be extracted from its context |
| 6125 | ucSTAId: identifier of the station being processed |
| 6126 | vosDataBuff: pointer to the tx vos buffer |
| 6127 | |
| 6128 | RETURN VALUE |
| 6129 | The result code associated with performing the operation |
| 6130 | |
| 6131 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 6132 | page fault |
| 6133 | VOS_STATUS_SUCCESS: Everything is good :) |
| 6134 | |
| 6135 | Other return values are possible coming from the called functions. |
| 6136 | Please check API for additional info. |
| 6137 | |
| 6138 | SIDE EFFECTS |
| 6139 | |
| 6140 | ============================================================================*/ |
| 6141 | VOS_STATUS |
| 6142 | WLANTL_STATxConn |
| 6143 | ( |
| 6144 | v_PVOID_t pvosGCtx, |
| 6145 | v_U8_t ucSTAId, |
| 6146 | vos_pkt_t** pvosDataBuff |
| 6147 | ) |
| 6148 | { |
| 6149 | v_U16_t usPktLen; |
| 6150 | VOS_STATUS vosStatus; |
| 6151 | v_MACADDR_t vDestMacAddr; |
| 6152 | vos_pkt_t* vosDataBuff = NULL; |
| 6153 | WLANTL_CbType* pTLCb = NULL; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6154 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6155 | WLANTL_MetaInfoType tlMetaInfo; |
| 6156 | v_U8_t ucTypeSubtype = 0; |
| 6157 | v_U8_t ucTid; |
| 6158 | v_U8_t extraHeadSpace = 0; |
| 6159 | v_U8_t ucWDSEnabled = 0; |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 6160 | v_U8_t ucAC, ucACMask, i; |
Gopichand Nakkala | 8b54e91 | 2013-03-11 10:44:21 +0530 | [diff] [blame] | 6161 | v_U8_t txFlag = HAL_TX_NO_ENCRYPTION_MASK; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6162 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 6163 | |
| 6164 | /*------------------------------------------------------------------------ |
| 6165 | Sanity check |
| 6166 | Extract TL control block |
| 6167 | ------------------------------------------------------------------------*/ |
| 6168 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 6169 | if ( NULL == pTLCb ) |
| 6170 | { |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 6171 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 6172 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STATxConn"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6173 | *pvosDataBuff = NULL; |
| 6174 | return VOS_STATUS_E_FAULT; |
| 6175 | } |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6176 | pClientSTA = pTLCb->atlSTAClients[ucSTAId]; |
| 6177 | |
| 6178 | if ( NULL == pClientSTA ) |
| 6179 | { |
| 6180 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 6181 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 6182 | return VOS_STATUS_E_FAILURE; |
| 6183 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6184 | |
| 6185 | /*------------------------------------------------------------------- |
| 6186 | Disable AC temporary - if successfull retrieve re-enable |
| 6187 | The order is justified because of the possible scenario |
| 6188 | - TL tryes to fetch packet for AC and it returns NULL |
| 6189 | - TL analyzes the data it has received to see if there are |
| 6190 | any more pkts available for AC -> if not TL will disable AC |
| 6191 | - however it is possible that while analyzing results TL got |
| 6192 | preempted by a pending indication where the mask was again set |
| 6193 | TL will not check again and as a result when it resumes |
| 6194 | execution it will disable AC |
| 6195 | To prevent this the AC will be disabled here and if retrieve |
| 6196 | is successfull it will be re-enabled |
| 6197 | -------------------------------------------------------------------*/ |
| 6198 | |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 6199 | |
| 6200 | //LTI:pTLCb->atlSTAClients[ucSTAId]. |
| 6201 | //LTI: aucACMask[pTLCb->atlSTAClients[ucSTAId].ucCurrentAC] = 0; |
| 6202 | |
| 6203 | /*------------------------------------------------------------------------ |
| 6204 | Fetch packet from HDD |
| 6205 | ------------------------------------------------------------------------*/ |
Sunil Ravi | d5406f2 | 2013-01-22 00:18:31 -0800 | [diff] [blame] | 6206 | #ifdef FEATURE_WLAN_TDLS |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6207 | if ((WLAN_STA_SOFTAP != pClientSTA->wSTADesc.wSTAType) && |
Sunil Ravi | d5406f2 | 2013-01-22 00:18:31 -0800 | [diff] [blame] | 6208 | (!vos_concurrent_sessions_running()) && |
| 6209 | !pTLCb->ucTdlsPeerCount) |
| 6210 | { |
| 6211 | #else |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6212 | if ((WLAN_STA_SOFTAP != pClientSTA->wSTADesc.wSTAType) && |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 6213 | (!vos_concurrent_sessions_running())) |
| 6214 | { |
Sunil Ravi | d5406f2 | 2013-01-22 00:18:31 -0800 | [diff] [blame] | 6215 | #endif |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6216 | ucAC = pClientSTA->ucCurrentAC; |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 6217 | |
| 6218 | /*------------------------------------------------------------------- |
| 6219 | Disable AC temporary - if successfull retrieve re-enable |
| 6220 | The order is justified because of the possible scenario |
| 6221 | - TL tryes to fetch packet for AC and it returns NULL |
| 6222 | - TL analyzes the data it has received to see if there are |
| 6223 | any more pkts available for AC -> if not TL will disable AC |
| 6224 | - however it is possible that while analyzing results TL got |
| 6225 | preempted by a pending indication where the mask was again set |
| 6226 | TL will not check again and as a result when it resumes |
| 6227 | execution it will disable AC |
| 6228 | To prevent this the AC will be disabled here and if retrieve |
| 6229 | is successfull it will be re-enabled |
| 6230 | -------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6231 | pClientSTA->aucACMask[ucAC] = 0; |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 6232 | } |
| 6233 | else |
| 6234 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6235 | //softap case |
| 6236 | ucAC = pTLCb->uCurServedAC; |
| 6237 | pClientSTA->aucACMask[ucAC] = 0; |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 6238 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6239 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6240 | /*You make an initial assumption that HDD has no more data and if the |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6241 | assumption was wrong you reset the flags to their original state |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6242 | This will prevent from exposing a race condition between checking with HDD |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6243 | for packets and setting the flags to false*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6244 | //LTI: vos_atomic_set_U8( &pTLCb->atlSTAClients[ucSTAId].ucPktPending, 0); |
| 6245 | //LTI: pTLCb->atlSTAClients[ucSTAId].ucNoMoreData = 1; |
| 6246 | vos_atomic_set_U8( &pClientSTA->ucPktPending, 0); |
| 6247 | WLAN_TL_AC_ARRAY_2_MASK( pClientSTA, ucACMask, i); |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6248 | /*You make an initial assumption that HDD has no more data and if the |
| 6249 | assumption was wrong you reset the flags to their original state |
| 6250 | This will prevent from exposing a race condition between checking with HDD |
| 6251 | for packets and setting the flags to false*/ |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 6252 | if ( 0 == ucACMask ) |
| 6253 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6254 | pClientSTA->ucNoMoreData = 1; |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 6255 | } |
| 6256 | else |
| 6257 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6258 | vos_atomic_set_U8( &pClientSTA->ucPktPending, 1); |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 6259 | } |
| 6260 | |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 6261 | |
Madan Mohan Koyyalamudi | d93f494 | 2012-10-05 15:05:40 -0700 | [diff] [blame] | 6262 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 6263 | "WLAN TL: WLANTL_STATxConn fetching packet from HDD for AC: %d AC Mask: %d Pkt Pending: %d", |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6264 | ucAC, ucACMask, pClientSTA->ucPktPending); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6265 | |
| 6266 | /*------------------------------------------------------------------------ |
| 6267 | Fetch tx packet from HDD |
| 6268 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 6269 | //LTI |
| 6270 | #if 0 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6271 | if (WLAN_STA_SOFTAP != pTLCb->atlSTAClients[ucSTAId].wSTADesc.wSTAType && |
| 6272 | (!vos_concurrent_sessions_running())) |
| 6273 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6274 | // don't set 0. |
| 6275 | //vos_atomic_set_U8( &pTLCb->atlSTAClients[ucSTAId].ucPktPending, 0); |
| 6276 | vosStatus = pTLCb->atlSTAClients[ucSTAId].pfnSTAFetchPkt( pvosGCtx, |
| 6277 | &ucSTAId, |
| 6278 | pTLCb->atlSTAClients[ucSTAId].ucCurrentAC, |
| 6279 | &vosDataBuff, &tlMetaInfo ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6280 | } |
| 6281 | else |
| 6282 | { |
| 6283 | //softap case |
| 6284 | WLANTL_ACEnumType ucAC = pTLCb->uCurServedAC; |
| 6285 | vosStatus = pTLCb->atlSTAClients[ucSTAId].pfnSTAFetchPkt( pvosGCtx, |
| 6286 | &ucSTAId, |
| 6287 | ucAC, |
| 6288 | &vosDataBuff, &tlMetaInfo ); |
| 6289 | } |
| 6290 | #endif |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 6291 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6292 | vosStatus = pClientSTA->pfnSTAFetchPkt( pvosGCtx, |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 6293 | &ucSTAId, |
| 6294 | ucAC, |
| 6295 | &vosDataBuff, &tlMetaInfo ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6296 | |
| 6297 | if (( VOS_STATUS_SUCCESS != vosStatus ) || ( NULL == vosDataBuff )) |
| 6298 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 6299 | TLLOG1(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6300 | "WLAN TL:No more data at HDD status %d", vosStatus)); |
| 6301 | *pvosDataBuff = NULL; |
| 6302 | |
| 6303 | /*-------------------------------------------------------------------- |
| 6304 | Reset AC for the serviced station to the highest priority AC |
| 6305 | -> due to no more data at the station |
| 6306 | Even if this AC is not supported by the station, correction will be |
| 6307 | made in the main TL loop |
| 6308 | --------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6309 | pClientSTA->ucCurrentAC = WLANTL_AC_VO; |
| 6310 | pClientSTA->ucCurrentWeight = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6311 | |
Madan Mohan Koyyalamudi | d800034 | 2012-11-08 14:55:26 -0800 | [diff] [blame] | 6312 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 6313 | "WLAN TL: WLANTL_STATxConn no more packets in HDD for AC: %d AC Mask: %d", |
| 6314 | ucAC, ucACMask); |
| 6315 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6316 | return vosStatus; |
| 6317 | } |
| 6318 | |
| 6319 | /*There are still packets in HDD - set back the pending packets and |
| 6320 | the no more data assumption*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6321 | vos_atomic_set_U8( &pClientSTA->ucPktPending, 1); |
| 6322 | pClientSTA->ucNoMoreData = 0; |
| 6323 | pClientSTA->aucACMask[ucAC] = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6324 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6325 | #ifdef WLAN_PERF |
| 6326 | vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAL, |
| 6327 | (v_PVOID_t)0); |
| 6328 | |
| 6329 | #endif /*WLAN_PERF*/ |
| 6330 | |
| 6331 | |
| 6332 | #ifdef FEATURE_WLAN_WAPI |
| 6333 | /*------------------------------------------------------------------------ |
| 6334 | If the packet is neither an Eapol packet nor a WAI packet then drop it |
| 6335 | ------------------------------------------------------------------------*/ |
| 6336 | if ( 0 == tlMetaInfo.ucIsEapol && 0 == tlMetaInfo.ucIsWai ) |
| 6337 | { |
Madan Mohan Koyyalamudi | d93f494 | 2012-10-05 15:05:40 -0700 | [diff] [blame] | 6338 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6339 | "WLAN TL:Only EAPOL or WAI packets allowed before authentication")); |
| 6340 | |
| 6341 | /* Fail tx for packet */ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6342 | pClientSTA->pfnSTATxComp( pvosGCtx, vosDataBuff, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6343 | VOS_STATUS_E_BADMSG); |
| 6344 | vosDataBuff = NULL; |
| 6345 | *pvosDataBuff = NULL; |
| 6346 | return VOS_STATUS_SUCCESS; |
| 6347 | } |
| 6348 | #else |
| 6349 | if ( 0 == tlMetaInfo.ucIsEapol ) |
| 6350 | { |
| 6351 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 6352 | "WLAN TL:Received non EAPOL packet before authentication")); |
| 6353 | |
| 6354 | /* Fail tx for packet */ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6355 | pClientSTA->pfnSTATxComp( pvosGCtx, vosDataBuff, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6356 | VOS_STATUS_E_BADMSG); |
| 6357 | vosDataBuff = NULL; |
| 6358 | *pvosDataBuff = NULL; |
| 6359 | return VOS_STATUS_SUCCESS; |
| 6360 | } |
| 6361 | #endif /* FEATURE_WLAN_WAPI */ |
| 6362 | |
| 6363 | /*------------------------------------------------------------------------- |
| 6364 | Check TID |
| 6365 | -------------------------------------------------------------------------*/ |
| 6366 | ucTid = tlMetaInfo.ucTID; |
| 6367 | |
| 6368 | /*Make sure TID is valid*/ |
| 6369 | if ( WLANTL_TID_INVALID(ucTid)) |
| 6370 | { |
| 6371 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 6372 | "WLAN TL:Invalid TID sent in meta info %d - defaulting to 0 (BE)", |
| 6373 | ucTid)); |
| 6374 | ucTid = 0; |
| 6375 | } |
| 6376 | |
| 6377 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 6378 | "WLAN TL:Attaching BD header to pkt on WLANTL_STATxConn")); |
| 6379 | |
| 6380 | #ifdef FEATURE_WLAN_WAPI |
| 6381 | /*------------------------------------------------------------------------ |
| 6382 | Translate 802.3 frame to 802.11 if Frame translation is enabled or if |
| 6383 | frame is a WAI frame. |
| 6384 | ------------------------------------------------------------------------*/ |
| 6385 | if ( ( 1 == tlMetaInfo.ucIsWai ) || |
| 6386 | ( 0 == tlMetaInfo.ucDisableFrmXtl ) ) |
| 6387 | #else |
| 6388 | /*------------------------------------------------------------------------ |
| 6389 | Translate 802.3 frame to 802.11 if Frame translation is enabled |
| 6390 | ------------------------------------------------------------------------*/ |
| 6391 | if ( ( 0 == tlMetaInfo.ucDisableFrmXtl ) && |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6392 | ( 0 != pClientSTA->wSTADesc.ucSwFrameTXXlation) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6393 | #endif //#ifdef FEATURE_WLAN_WAPI |
| 6394 | { |
Kiran Venkatappa | cab0d35 | 2012-12-17 13:09:22 -0800 | [diff] [blame] | 6395 | vosStatus = WLANTL_Translate8023To80211Header( vosDataBuff, &vosStatus, |
| 6396 | pTLCb, &ucSTAId, |
| 6397 | tlMetaInfo.ucUP, &ucWDSEnabled, &extraHeadSpace); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6398 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 6399 | { |
| 6400 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 6401 | "WLAN TL:Error when translating header WLANTL_STATxConn")); |
| 6402 | |
| 6403 | return vosStatus; |
| 6404 | } |
| 6405 | |
| 6406 | tlMetaInfo.ucDisableFrmXtl = 1; |
| 6407 | } |
| 6408 | |
| 6409 | /*------------------------------------------------------------------------- |
| 6410 | Call HAL to fill BD header |
| 6411 | -------------------------------------------------------------------------*/ |
| 6412 | ucTypeSubtype |= (WLANTL_80211_DATA_TYPE << 4); |
| 6413 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6414 | if ( pClientSTA->wSTADesc.ucQosEnabled ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6415 | { |
| 6416 | ucTypeSubtype |= (WLANTL_80211_DATA_QOS_SUBTYPE); |
| 6417 | } |
| 6418 | |
Gopichand Nakkala | 8b54e91 | 2013-03-11 10:44:21 +0530 | [diff] [blame] | 6419 | #ifdef FEATURE_WLAN_WAPI |
| 6420 | /* TL State does not transition to AUTHENTICATED till GTK is installed, So in |
| 6421 | * case of WPA where GTK handshake is done after the 4 way handshake, the |
| 6422 | * unicast 2/2 EAPOL packet from the STA->AP has to be encrypted even before |
| 6423 | * the TL is in authenticated state. Since the PTK has been installed |
| 6424 | * already (after the 4 way handshake) we make sure that all traffic |
| 6425 | * is encrypted henceforth.(Note: TL is still not in AUTHENTICATED state so |
| 6426 | * we will only allow EAPOL data or WAI in case of WAPI) |
| 6427 | */ |
| 6428 | if (tlMetaInfo.ucIsEapol && pClientSTA->ptkInstalled) |
| 6429 | { |
| 6430 | txFlag = 0; |
| 6431 | } |
| 6432 | #else |
| 6433 | if (pClientSTA->ptkInstalled) |
| 6434 | { |
| 6435 | txFlag = 0; |
| 6436 | } |
| 6437 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6438 | |
| 6439 | vosStatus = (VOS_STATUS)WDA_DS_BuildTxPacketInfo( pvosGCtx, vosDataBuff , &vDestMacAddr, |
| 6440 | tlMetaInfo.ucDisableFrmXtl, &usPktLen, |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6441 | pClientSTA->wSTADesc.ucQosEnabled, ucWDSEnabled, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6442 | extraHeadSpace, |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6443 | ucTypeSubtype, &pClientSTA->wSTADesc.vSelfMACAddress, |
Gopichand Nakkala | 8b54e91 | 2013-03-11 10:44:21 +0530 | [diff] [blame] | 6444 | ucTid, txFlag, |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 6445 | tlMetaInfo.usTimeStamp, tlMetaInfo.ucIsEapol || tlMetaInfo.ucIsWai, tlMetaInfo.ucUP ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6446 | |
| 6447 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 6448 | { |
| 6449 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 6450 | "WLAN TL:Failed while attempting to fill BD %d", vosStatus)); |
| 6451 | *pvosDataBuff = NULL; |
| 6452 | return vosStatus; |
| 6453 | } |
| 6454 | |
| 6455 | /*----------------------------------------------------------------------- |
| 6456 | Update tx counter for BA session query for tx side |
| 6457 | !1 - should this be done for EAPOL frames? |
| 6458 | -----------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6459 | pClientSTA->auTxCount[ucTid]++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6460 | |
| 6461 | vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL, |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6462 | (v_PVOID_t)pClientSTA->pfnSTATxComp ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6463 | |
| 6464 | /*------------------------------------------------------------------------ |
| 6465 | Save data to input pointer for TL core |
| 6466 | ------------------------------------------------------------------------*/ |
| 6467 | *pvosDataBuff = vosDataBuff; |
| 6468 | /*security frames cannot be delayed*/ |
| 6469 | pTLCb->bUrgent = TRUE; |
| 6470 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6471 | /* TX Statistics */ |
| 6472 | if (!(tlMetaInfo.ucBcast || tlMetaInfo.ucMcast)) |
| 6473 | { |
| 6474 | /* This is TX UC frame */ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6475 | pClientSTA->trafficStatistics.txUCFcnt++; |
| 6476 | pClientSTA->trafficStatistics.txUCBcnt += usPktLen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6477 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6478 | |
| 6479 | return VOS_STATUS_SUCCESS; |
| 6480 | }/* WLANTL_STATxConn */ |
| 6481 | |
| 6482 | |
| 6483 | /*========================================================================== |
| 6484 | FUNCTION WLANTL_STATxAuth |
| 6485 | |
| 6486 | DESCRIPTION |
| 6487 | Transmit in authenticated state - all data allowed |
| 6488 | |
| 6489 | DEPENDENCIES |
| 6490 | The STA must be registered with TL before this function can be called. |
| 6491 | |
| 6492 | PARAMETERS |
| 6493 | |
| 6494 | IN |
| 6495 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 6496 | control block can be extracted from its context |
| 6497 | ucSTAId: identifier of the station being processed |
| 6498 | vosDataBuff: pointer to the tx vos buffer |
| 6499 | |
| 6500 | RETURN VALUE |
| 6501 | The result code associated with performing the operation |
| 6502 | |
| 6503 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 6504 | page fault |
| 6505 | VOS_STATUS_SUCCESS: Everything is good :) |
| 6506 | |
| 6507 | Other return values are possible coming from the called functions. |
| 6508 | Please check API for additional info. |
| 6509 | |
| 6510 | SIDE EFFECTS |
| 6511 | |
| 6512 | ============================================================================*/ |
| 6513 | VOS_STATUS |
| 6514 | WLANTL_STATxAuth |
| 6515 | ( |
| 6516 | v_PVOID_t pvosGCtx, |
| 6517 | v_U8_t ucSTAId, |
| 6518 | vos_pkt_t** pvosDataBuff |
| 6519 | ) |
| 6520 | { |
| 6521 | v_U16_t usPktLen; |
| 6522 | VOS_STATUS vosStatus; |
| 6523 | v_MACADDR_t vDestMacAddr; |
| 6524 | vos_pkt_t* vosDataBuff = NULL; |
| 6525 | WLANTL_CbType* pTLCb = NULL; |
| 6526 | WLANTL_MetaInfoType tlMetaInfo; |
| 6527 | v_U8_t ucTypeSubtype = 0; |
| 6528 | WLANTL_ACEnumType ucAC; |
| 6529 | WLANTL_ACEnumType ucNextAC; |
| 6530 | v_U8_t ucTid; |
| 6531 | v_U8_t ucSwFrmXtl = 0; |
| 6532 | v_U8_t extraHeadSpace = 0; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6533 | WLANTL_STAClientType *pStaClient = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6534 | v_U8_t ucWDSEnabled = 0; |
| 6535 | v_U8_t ucTxFlag = 0; |
| 6536 | v_U8_t ucACMask, i; |
| 6537 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 6538 | |
| 6539 | /*------------------------------------------------------------------------ |
| 6540 | Sanity check |
| 6541 | Extract TL control block |
| 6542 | ------------------------------------------------------------------------*/ |
| 6543 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 6544 | if (( NULL == pTLCb ) || ( NULL == pvosDataBuff )) |
| 6545 | { |
| 6546 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 6547 | "WLAN TL:Invalid input params on WLANTL_STATxAuth TL %x DB %x", |
| 6548 | pTLCb, pvosDataBuff)); |
| 6549 | if (NULL != pvosDataBuff) |
| 6550 | { |
| 6551 | *pvosDataBuff = NULL; |
| 6552 | } |
| 6553 | if(NULL != pTLCb) |
| 6554 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6555 | if ( NULL == pTLCb->atlSTAClients[ucSTAId] ) |
| 6556 | { |
| 6557 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 6558 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 6559 | return VOS_STATUS_E_FAILURE; |
| 6560 | } |
| 6561 | pTLCb->atlSTAClients[ucSTAId]->ucNoMoreData = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6562 | } |
| 6563 | return VOS_STATUS_E_FAULT; |
| 6564 | } |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6565 | pStaClient = pTLCb->atlSTAClients[ucSTAId]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6566 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6567 | if ( NULL == pStaClient ) |
| 6568 | { |
| 6569 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 6570 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 6571 | return VOS_STATUS_E_FAILURE; |
| 6572 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6573 | |
| 6574 | vos_mem_zero(&tlMetaInfo, sizeof(tlMetaInfo)); |
| 6575 | /*------------------------------------------------------------------------ |
| 6576 | Fetch packet from HDD |
| 6577 | ------------------------------------------------------------------------*/ |
Sunil Ravi | d5406f2 | 2013-01-22 00:18:31 -0800 | [diff] [blame] | 6578 | #ifdef FEATURE_WLAN_TDLS |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6579 | if ((WLAN_STA_SOFTAP != pStaClient->wSTADesc.wSTAType) && |
Sunil Ravi | d5406f2 | 2013-01-22 00:18:31 -0800 | [diff] [blame] | 6580 | (!vos_concurrent_sessions_running()) && |
| 6581 | !pTLCb->ucTdlsPeerCount) |
| 6582 | { |
| 6583 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6584 | if ((WLAN_STA_SOFTAP != pStaClient->wSTADesc.wSTAType) && |
| 6585 | (!vos_concurrent_sessions_running())) |
| 6586 | { |
| 6587 | #endif |
| 6588 | ucAC = pStaClient->ucCurrentAC; |
| 6589 | |
| 6590 | /*------------------------------------------------------------------- |
| 6591 | Disable AC temporary - if successfull retrieve re-enable |
| 6592 | The order is justified because of the possible scenario |
| 6593 | - TL tryes to fetch packet for AC and it returns NULL |
| 6594 | - TL analyzes the data it has received to see if there are |
| 6595 | any more pkts available for AC -> if not TL will disable AC |
| 6596 | - however it is possible that while analyzing results TL got |
| 6597 | preempted by a pending indication where the mask was again set |
| 6598 | TL will not check again and as a result when it resumes |
| 6599 | execution it will disable AC |
| 6600 | To prevent this the AC will be disabled here and if retrieve |
| 6601 | is successfull it will be re-enabled |
| 6602 | -------------------------------------------------------------------*/ |
| 6603 | pStaClient->aucACMask[pStaClient->ucCurrentAC] = 0; |
| 6604 | |
| 6605 | // don't reset it, as other AC queues in HDD may have packets |
| 6606 | //vos_atomic_set_U8( &pStaClient->ucPktPending, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6607 | } |
| 6608 | else |
| 6609 | { |
| 6610 | //softap case |
| 6611 | ucAC = pTLCb->uCurServedAC; |
| 6612 | pStaClient->aucACMask[ucAC] = 0; |
| 6613 | |
| 6614 | //vos_atomic_set_U8( &pStaClient->ucPktPending, 0); |
| 6615 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6616 | |
| 6617 | WLAN_TL_AC_ARRAY_2_MASK( pStaClient, ucACMask, i); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6618 | /*You make an initial assumption that HDD has no more data and if the |
| 6619 | assumption was wrong you reset the flags to their original state |
| 6620 | This will prevent from exposing a race condition between checking with HDD |
| 6621 | for packets and setting the flags to false*/ |
| 6622 | if ( 0 == ucACMask ) |
| 6623 | { |
| 6624 | vos_atomic_set_U8( &pStaClient->ucPktPending, 0); |
| 6625 | pStaClient->ucNoMoreData = 1; |
| 6626 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6627 | |
| 6628 | vosStatus = pStaClient->pfnSTAFetchPkt( pvosGCtx, |
| 6629 | &ucSTAId, |
| 6630 | ucAC, |
| 6631 | &vosDataBuff, &tlMetaInfo ); |
| 6632 | |
| 6633 | |
| 6634 | if (( VOS_STATUS_SUCCESS != vosStatus ) || ( NULL == vosDataBuff )) |
| 6635 | { |
| 6636 | |
| 6637 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, |
| 6638 | "WLAN TL:Failed while attempting to fetch pkt from HDD %d", |
| 6639 | vosStatus); |
| 6640 | *pvosDataBuff = NULL; |
| 6641 | /*-------------------------------------------------------------------- |
| 6642 | Reset AC for the serviced station to the highest priority AC |
| 6643 | -> due to no more data at the station |
| 6644 | Even if this AC is not supported by the station, correction will be |
| 6645 | made in the main TL loop |
| 6646 | --------------------------------------------------------------------*/ |
| 6647 | pStaClient->ucCurrentAC = WLANTL_AC_VO; |
| 6648 | pStaClient->ucCurrentWeight = 0; |
| 6649 | |
| 6650 | return vosStatus; |
| 6651 | } |
| 6652 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6653 | WLANTL_StatHandleTXFrame(pvosGCtx, ucSTAId, vosDataBuff, NULL, &tlMetaInfo); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6654 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6655 | /*There are still packets in HDD - set back the pending packets and |
| 6656 | the no more data assumption*/ |
| 6657 | vos_atomic_set_U8( &pStaClient->ucPktPending, 1); |
| 6658 | pStaClient->ucNoMoreData = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6659 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6660 | if (WLAN_STA_SOFTAP != pStaClient->wSTADesc.wSTAType) |
| 6661 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6662 | // don't need to set it, as we don't reset it in this function. |
| 6663 | //vos_atomic_set_U8( &pTLCb->atlSTAClients[ucSTAId].ucPktPending, 1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6664 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6665 | |
| 6666 | #ifdef WLAN_PERF |
| 6667 | vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAL, |
| 6668 | (v_PVOID_t)0); |
| 6669 | #endif /*WLAN_PERF*/ |
| 6670 | |
| 6671 | /*------------------------------------------------------------------------- |
| 6672 | Check TID |
| 6673 | -------------------------------------------------------------------------*/ |
| 6674 | ucTid = tlMetaInfo.ucTID; |
| 6675 | |
| 6676 | /*Make sure TID is valid*/ |
| 6677 | if ( WLANTL_TID_INVALID(ucTid)) |
| 6678 | { |
| 6679 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 6680 | "WLAN TL:Invalid TID sent in meta info %d - defaulting to 0 (BE)", |
| 6681 | ucTid)); |
| 6682 | ucTid = 0; |
| 6683 | } |
| 6684 | |
| 6685 | /*Save for UAPSD timer consideration*/ |
| 6686 | pStaClient->ucServicedAC = ucAC; |
| 6687 | |
| 6688 | if ( ucAC == pStaClient->ucCurrentAC ) |
| 6689 | { |
| 6690 | pStaClient->aucACMask[pStaClient->ucCurrentAC] = 1; |
| 6691 | pStaClient->ucCurrentWeight--; |
| 6692 | } |
| 6693 | else |
| 6694 | { |
| 6695 | pStaClient->ucCurrentAC = ucAC; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6696 | pStaClient->ucCurrentWeight = pTLCb->tlConfigInfo.ucAcWeights[ucAC] - 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6697 | |
| 6698 | pStaClient->aucACMask[pStaClient->ucCurrentAC] = 1; |
| 6699 | |
| 6700 | } |
| 6701 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6702 | if (WLAN_STA_SOFTAP != pStaClient->wSTADesc.wSTAType) |
| 6703 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6704 | if ( 0 == pStaClient->ucCurrentWeight ) |
| 6705 | { |
| 6706 | WLANTL_ACEnumType tempAC = ucAC; |
| 6707 | /*----------------------------------------------------------------------- |
| 6708 | Choose next AC - !!! optimize me |
| 6709 | -----------------------------------------------------------------------*/ |
| 6710 | while ( 0 != ucACMask ) |
| 6711 | { |
| 6712 | ucNextAC = (WLANTL_ACEnumType)(( tempAC - 1 ) & WLANTL_MASK_AC); |
| 6713 | if ( 0 != pStaClient->aucACMask[ucNextAC] ) |
| 6714 | { |
| 6715 | pStaClient->ucCurrentAC = ucNextAC; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6716 | pStaClient->ucCurrentWeight = pTLCb->tlConfigInfo.ucAcWeights[ucNextAC]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6717 | |
| 6718 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 6719 | "WLAN TL: Changing serviced AC to: %d with Weight: %d", |
| 6720 | pStaClient->ucCurrentAC , |
| 6721 | pStaClient->ucCurrentWeight)); |
| 6722 | break; |
| 6723 | } |
| 6724 | tempAC = ucNextAC; |
| 6725 | } |
| 6726 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6727 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6728 | |
| 6729 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 6730 | "WLAN TL:Attaching BD header to pkt on WLANTL_STATxAuth")); |
| 6731 | |
| 6732 | /*------------------------------------------------------------------------ |
| 6733 | Translate 802.3 frame to 802.11 |
| 6734 | ------------------------------------------------------------------------*/ |
| 6735 | if ( 0 == tlMetaInfo.ucDisableFrmXtl ) |
| 6736 | { |
| 6737 | /* Needs frame translation */ |
| 6738 | // if the client has not enabled SW-only frame translation |
| 6739 | // and if the frame is a unicast frame |
| 6740 | // (HW frame translation does not support multiple broadcast domains |
| 6741 | // so we use SW frame translation for broadcast/multicast frames) |
| 6742 | #ifdef FEATURE_WLAN_WAPI |
| 6743 | // and if the frame is not a WAPI frame |
| 6744 | #endif |
| 6745 | // then use HW_based frame translation |
| 6746 | |
| 6747 | if ( ( 0 == pStaClient->wSTADesc.ucSwFrameTXXlation ) && |
| 6748 | ( 0 == tlMetaInfo.ucBcast ) && |
| 6749 | ( 0 == tlMetaInfo.ucMcast ) |
| 6750 | #ifdef FEATURE_WLAN_WAPI |
| 6751 | && ( tlMetaInfo.ucIsWai != 1 ) |
| 6752 | #endif |
| 6753 | ) |
| 6754 | { |
| 6755 | #ifdef WLAN_PERF |
| 6756 | v_U32_t uFastFwdOK = 0; |
| 6757 | |
| 6758 | /* HW based translation. See if the frame could be fast forwarded */ |
| 6759 | WDA_TLI_FastHwFwdDataFrame( pvosGCtx, vosDataBuff , &vosStatus, |
| 6760 | &uFastFwdOK, &tlMetaInfo, &pStaClient->wSTADesc); |
| 6761 | |
| 6762 | if( VOS_STATUS_SUCCESS == vosStatus ) |
| 6763 | { |
| 6764 | if(uFastFwdOK) |
| 6765 | { |
| 6766 | /* Packet could be fast forwarded now */ |
| 6767 | vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL, |
| 6768 | (v_PVOID_t)pStaClient->pfnSTATxComp ); |
| 6769 | |
| 6770 | *pvosDataBuff = vosDataBuff; |
| 6771 | |
| 6772 | /* TODO: Do we really need to update WLANTL_HSHandleTXFrame() |
| 6773 | stats for every pkt? */ |
| 6774 | pStaClient->auTxCount[tlMetaInfo.ucTID]++; |
| 6775 | return vosStatus; |
| 6776 | } |
| 6777 | /* can't be fast forwarded, fall through normal (slow) path. */ |
| 6778 | } |
| 6779 | else |
| 6780 | { |
| 6781 | |
| 6782 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 6783 | "WLAN TL:Failed while attempting to fastFwd BD %d", vosStatus)); |
| 6784 | *pvosDataBuff = NULL; |
| 6785 | return vosStatus; |
| 6786 | } |
| 6787 | #endif /*WLAN_PERF*/ |
| 6788 | } |
| 6789 | else |
| 6790 | { |
| 6791 | /* SW based translation */ |
| 6792 | |
| 6793 | #ifdef FEATURE_WLAN_WAPI |
| 6794 | gUcIsWai = tlMetaInfo.ucIsWai, |
| 6795 | #endif |
| 6796 | |
Kiran Venkatappa | cab0d35 | 2012-12-17 13:09:22 -0800 | [diff] [blame] | 6797 | vosStatus = WLANTL_Translate8023To80211Header( vosDataBuff, &vosStatus, |
| 6798 | pTLCb, &ucSTAId, |
| 6799 | tlMetaInfo.ucUP, &ucWDSEnabled, &extraHeadSpace); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6800 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 6801 | { |
| 6802 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 6803 | "WLAN TL:Error when translating header WLANTL_STATxAuth")); |
| 6804 | return vosStatus; |
| 6805 | } |
| 6806 | |
| 6807 | TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW, |
| 6808 | "WLAN TL software translation success \n")); |
| 6809 | ucSwFrmXtl = 1; |
| 6810 | tlMetaInfo.ucDisableFrmXtl = 1; |
| 6811 | } |
| 6812 | } |
| 6813 | |
| 6814 | /*------------------------------------------------------------------------- |
| 6815 | Call HAL to fill BD header |
| 6816 | -------------------------------------------------------------------------*/ |
| 6817 | ucTypeSubtype |= (WLANTL_80211_DATA_TYPE << 4); |
| 6818 | |
| 6819 | if ( pStaClient->wSTADesc.ucQosEnabled ) |
| 6820 | { |
| 6821 | ucTypeSubtype |= (WLANTL_80211_DATA_QOS_SUBTYPE); |
| 6822 | } |
| 6823 | |
| 6824 | ucTxFlag = (0 != pStaClient->wUAPSDInfo[ucAC].ucSet)? |
| 6825 | HAL_TRIGGER_ENABLED_AC_MASK:0; |
| 6826 | |
| 6827 | #ifdef FEATURE_WLAN_WAPI |
| 6828 | if ( pStaClient->wSTADesc.ucIsWapiSta == 1 ) |
| 6829 | { |
| 6830 | #ifdef LIBRA_WAPI_SUPPORT |
| 6831 | ucTxFlag = ucTxFlag | HAL_WAPI_STA_MASK; |
| 6832 | #endif //LIBRA_WAPI_SUPPORT |
| 6833 | if ( tlMetaInfo.ucIsWai == 1 ) |
| 6834 | { |
| 6835 | ucTxFlag = ucTxFlag | HAL_TX_NO_ENCRYPTION_MASK; |
| 6836 | } |
| 6837 | } |
| 6838 | #endif /* FEATURE_WLAN_WAPI */ |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 6839 | #ifdef FEATURE_WLAN_TDLS |
| 6840 | if ( pStaClient->wSTADesc.wSTAType == WLAN_STA_TDLS ) |
| 6841 | { |
| 6842 | ucTxFlag = ucTxFlag | HAL_TDLS_PEER_STA_MASK; |
| 6843 | } |
| 6844 | #endif /* FEATURE_WLAN_TDLS */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6845 | |
| 6846 | vosStatus = (VOS_STATUS)WDA_DS_BuildTxPacketInfo( pvosGCtx, |
| 6847 | vosDataBuff , &vDestMacAddr, |
| 6848 | tlMetaInfo.ucDisableFrmXtl, &usPktLen, |
| 6849 | pStaClient->wSTADesc.ucQosEnabled, ucWDSEnabled, |
| 6850 | extraHeadSpace, |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6851 | ucTypeSubtype, &pStaClient->wSTADesc.vSelfMACAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6852 | ucTid, ucTxFlag, tlMetaInfo.usTimeStamp, |
| 6853 | tlMetaInfo.ucIsEapol, tlMetaInfo.ucUP ); |
| 6854 | |
| 6855 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 6856 | { |
| 6857 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 6858 | "Fill TX BD Error status %d", vosStatus)); |
| 6859 | |
| 6860 | return vosStatus; |
| 6861 | } |
| 6862 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6863 | /* TX Statistics */ |
| 6864 | if (!(tlMetaInfo.ucBcast || tlMetaInfo.ucMcast)) |
| 6865 | { |
| 6866 | /* This is TX UC frame */ |
| 6867 | pStaClient->trafficStatistics.txUCFcnt++; |
| 6868 | pStaClient->trafficStatistics.txUCBcnt += usPktLen; |
| 6869 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6870 | |
Kiran Venkatappa | cab0d35 | 2012-12-17 13:09:22 -0800 | [diff] [blame] | 6871 | #ifndef FEATURE_WLAN_TDLS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6872 | /*----------------------------------------------------------------------- |
| 6873 | Update tx counter for BA session query for tx side |
| 6874 | -----------------------------------------------------------------------*/ |
| 6875 | pStaClient->auTxCount[ucTid]++; |
Kiran Venkatappa | cab0d35 | 2012-12-17 13:09:22 -0800 | [diff] [blame] | 6876 | #else |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6877 | pTLCb->atlSTAClients[ucSTAId]->auTxCount[ucTid]++; |
Kiran Venkatappa | cab0d35 | 2012-12-17 13:09:22 -0800 | [diff] [blame] | 6878 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6879 | |
| 6880 | /* This code is to send traffic with lower priority AC when we does not |
| 6881 | get admitted to send it. Today HAL does not downgrade AC so this code |
| 6882 | does not get executed.(In other words, HAL doesnÂ’t change tid. The if |
| 6883 | statement is always false.) |
| 6884 | NOTE: In the case of LA downgrade occurs in HDD (that was the change |
| 6885 | Phani made during WMM-AC plugfest). If WM & BMP also took this approach, |
| 6886 | then there will be no need for any AC downgrade logic in TL/WDI. */ |
| 6887 | #if 0 |
| 6888 | if (( ucTid != tlMetaInfo.ucTID ) && |
| 6889 | ( 0 != pStaClient->wSTADesc.ucQosEnabled ) && |
| 6890 | ( 0 != ucSwFrmXtl )) |
| 6891 | { |
| 6892 | /*--------------------------------------------------------------------- |
| 6893 | !! FIX me: Once downgrading is clear put in the proper change |
| 6894 | ---------------------------------------------------------------------*/ |
| 6895 | ucQCOffset = WLANHAL_TX_BD_HEADER_SIZE + WLANTL_802_11_HEADER_LEN; |
| 6896 | |
| 6897 | //!!!Fix this replace peek with extract |
| 6898 | vos_pkt_peek_data( vosDataBuff, ucQCOffset,(v_PVOID_t)&pucQosCtrl, |
| 6899 | sizeof(*pucQosCtrl)); |
| 6900 | *pucQosCtrl = ucTid; //? proper byte order |
| 6901 | } |
| 6902 | #endif |
| 6903 | |
| 6904 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 6905 | { |
| 6906 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 6907 | "WLAN TL:Failed while attempting to fill BD %d", vosStatus)); |
| 6908 | *pvosDataBuff = NULL; |
| 6909 | return vosStatus; |
| 6910 | } |
| 6911 | |
| 6912 | vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL, |
| 6913 | (v_PVOID_t)pStaClient->pfnSTATxComp ); |
| 6914 | |
| 6915 | *pvosDataBuff = vosDataBuff; |
| 6916 | |
| 6917 | /*BE & BK can be delayed, VO and VI not frames cannot be delayed*/ |
| 6918 | if ( pStaClient->ucServicedAC > WLANTL_AC_BE ) |
| 6919 | { |
| 6920 | pTLCb->bUrgent= TRUE; |
| 6921 | } |
| 6922 | |
| 6923 | return VOS_STATUS_SUCCESS; |
| 6924 | }/* WLANTL_STATxAuth */ |
| 6925 | |
| 6926 | /*========================================================================== |
| 6927 | FUNCTION WLANTL_STATxDisc |
| 6928 | |
| 6929 | DESCRIPTION |
| 6930 | Transmit in disconnected state - no data allowed |
| 6931 | |
| 6932 | DEPENDENCIES |
| 6933 | The STA must be registered with TL before this function can be called. |
| 6934 | |
| 6935 | PARAMETERS |
| 6936 | |
| 6937 | IN |
| 6938 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 6939 | control block can be extracted from its context |
| 6940 | ucSTAId: identifier of the station being processed |
| 6941 | vosDataBuff: pointer to the tx vos buffer |
| 6942 | |
| 6943 | RETURN VALUE |
| 6944 | The result code associated with performing the operation |
| 6945 | |
| 6946 | VOS_STATUS_SUCCESS: Everything is good :) |
| 6947 | |
| 6948 | SIDE EFFECTS |
| 6949 | |
| 6950 | ============================================================================*/ |
| 6951 | VOS_STATUS |
| 6952 | WLANTL_STATxDisc |
| 6953 | ( |
| 6954 | v_PVOID_t pvosGCtx, |
| 6955 | v_U8_t ucSTAId, |
| 6956 | vos_pkt_t** pvosDataBuff |
| 6957 | ) |
| 6958 | { |
| 6959 | WLANTL_CbType* pTLCb = NULL; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6960 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6961 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 6962 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6963 | /*------------------------------------------------------------------------ |
| 6964 | Sanity check |
| 6965 | Extract TL control block |
| 6966 | ------------------------------------------------------------------------*/ |
| 6967 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 6968 | if ( NULL == pTLCb ) |
| 6969 | { |
| 6970 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 6971 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STATxAuth")); |
| 6972 | *pvosDataBuff = NULL; |
| 6973 | return VOS_STATUS_E_FAULT; |
| 6974 | } |
| 6975 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6976 | pClientSTA = pTLCb->atlSTAClients[ucSTAId]; |
| 6977 | |
| 6978 | if ( NULL == pClientSTA ) |
| 6979 | { |
| 6980 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 6981 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 6982 | return VOS_STATUS_E_FAILURE; |
| 6983 | } |
| 6984 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6985 | /*------------------------------------------------------------------------ |
| 6986 | Error |
| 6987 | ------------------------------------------------------------------------*/ |
| 6988 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 6989 | "WLAN TL:Packet should not be transmitted in state disconnected ignoring" |
| 6990 | " request")); |
| 6991 | |
| 6992 | *pvosDataBuff = NULL; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6993 | pClientSTA->ucNoMoreData = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6994 | |
| 6995 | //Should not be anything pending in disconnect state |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 6996 | vos_atomic_set_U8( &pClientSTA->ucPktPending, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6997 | |
| 6998 | return VOS_STATUS_SUCCESS; |
| 6999 | }/* WLANTL_STATxDisc */ |
| 7000 | |
| 7001 | /*========================================================================== |
| 7002 | FUNCTION WLANTL_STARxConn |
| 7003 | |
| 7004 | DESCRIPTION |
| 7005 | Receive in connected state - only EAPOL |
| 7006 | |
| 7007 | DEPENDENCIES |
| 7008 | The STA must be registered with TL before this function can be called. |
| 7009 | |
| 7010 | PARAMETERS |
| 7011 | |
| 7012 | IN |
| 7013 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 7014 | control block can be extracted from its context |
| 7015 | ucSTAId: identifier of the station being processed |
| 7016 | vosDataBuff: pointer to the tx/rx vos buffer |
| 7017 | |
| 7018 | RETURN VALUE |
| 7019 | The result code associated with performing the operation |
| 7020 | |
| 7021 | VOS_STATUS_E_INVAL: invalid input parameters |
| 7022 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 7023 | page fault |
| 7024 | VOS_STATUS_SUCCESS: Everything is good :) |
| 7025 | |
| 7026 | SIDE EFFECTS |
| 7027 | |
| 7028 | ============================================================================*/ |
| 7029 | VOS_STATUS |
| 7030 | WLANTL_STARxConn |
| 7031 | ( |
| 7032 | v_PVOID_t pvosGCtx, |
| 7033 | v_U8_t ucSTAId, |
| 7034 | vos_pkt_t** pvosDataBuff |
| 7035 | ) |
| 7036 | { |
| 7037 | WLANTL_CbType* pTLCb = NULL; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7038 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7039 | v_U16_t usEtherType = 0; |
| 7040 | v_U16_t usPktLen; |
| 7041 | v_U8_t ucMPDUHOffset; |
| 7042 | v_U16_t usMPDUDOffset; |
| 7043 | v_U16_t usMPDULen; |
| 7044 | v_U8_t ucMPDUHLen; |
| 7045 | v_U16_t usActualHLen = 0; |
| 7046 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 7047 | vos_pkt_t* vosDataBuff; |
| 7048 | v_PVOID_t aucBDHeader; |
| 7049 | v_U8_t ucTid; |
| 7050 | WLANTL_RxMetaInfoType wRxMetaInfo; |
| 7051 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 7052 | |
| 7053 | /*------------------------------------------------------------------------ |
| 7054 | Sanity check |
| 7055 | ------------------------------------------------------------------------*/ |
| 7056 | if (( NULL == pvosDataBuff ) || ( NULL == ( vosDataBuff = *pvosDataBuff ))) |
| 7057 | { |
| 7058 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7059 | "WLAN TL:Invalid parameter sent on WLANTL_STARxConn")); |
| 7060 | return VOS_STATUS_E_INVAL; |
| 7061 | } |
| 7062 | |
| 7063 | /*------------------------------------------------------------------------ |
| 7064 | Extract TL control block |
| 7065 | ------------------------------------------------------------------------*/ |
| 7066 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 7067 | if ( NULL == pTLCb ) |
| 7068 | { |
| 7069 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7070 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState")); |
| 7071 | return VOS_STATUS_E_FAULT; |
| 7072 | } |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7073 | pClientSTA = pTLCb->atlSTAClients[ucSTAId]; |
| 7074 | |
| 7075 | if ( NULL == pClientSTA ) |
| 7076 | { |
| 7077 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7078 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 7079 | return VOS_STATUS_E_FAILURE; |
| 7080 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7081 | |
| 7082 | /*------------------------------------------------------------------------ |
| 7083 | Extract BD header and check if valid |
| 7084 | ------------------------------------------------------------------------*/ |
| 7085 | vosStatus = WDA_DS_PeekRxPacketInfo( vosDataBuff, (v_PVOID_t)&aucBDHeader, 0/*Swap BD*/ ); |
| 7086 | |
| 7087 | if ( NULL == aucBDHeader ) |
| 7088 | { |
| 7089 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7090 | "WLAN TL:Cannot extract BD header")); |
| 7091 | VOS_ASSERT( 0 ); |
| 7092 | return VOS_STATUS_E_FAULT; |
| 7093 | } |
| 7094 | |
| 7095 | |
| 7096 | ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(aucBDHeader); |
| 7097 | usMPDUDOffset = (v_U16_t)WDA_GET_RX_MPDU_DATA_OFFSET(aucBDHeader); |
| 7098 | usMPDULen = (v_U16_t)WDA_GET_RX_MPDU_LEN(aucBDHeader); |
| 7099 | ucMPDUHLen = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(aucBDHeader); |
| 7100 | ucTid = (v_U8_t)WDA_GET_RX_TID(aucBDHeader); |
| 7101 | |
| 7102 | vos_pkt_get_packet_length( vosDataBuff, &usPktLen); |
| 7103 | |
| 7104 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 7105 | "WLAN TL:BD header processing data: HO %d DO %d Len %d HLen %d", |
| 7106 | ucMPDUHOffset, usMPDUDOffset, usMPDULen, ucMPDUHLen)); |
| 7107 | |
| 7108 | /*It will cut out the 802.11 header if not used*/ |
| 7109 | if ( VOS_STATUS_SUCCESS != WDA_DS_TrimRxPacketInfo( vosDataBuff ) ) |
| 7110 | { |
| 7111 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 7112 | "WLAN TL:BD header corrupted - dropping packet")); |
| 7113 | /* Drop packet */ |
| 7114 | vos_pkt_return_packet(vosDataBuff); |
| 7115 | return VOS_STATUS_SUCCESS; |
| 7116 | } |
| 7117 | |
| 7118 | vosStatus = WLANTL_GetEtherType(aucBDHeader,vosDataBuff,ucMPDUHLen,&usEtherType); |
| 7119 | |
| 7120 | if( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 7121 | { |
| 7122 | #ifdef FEATURE_WLAN_WAPI |
| 7123 | /* If frame is neither an EAPOL frame nor a WAI frame then we drop the frame*/ |
| 7124 | /* TODO: Do we need a check to see if we are in WAPI mode? If not is it possible */ |
| 7125 | /* that we get an EAPOL packet in WAPI mode or vice versa? */ |
| 7126 | if ( WLANTL_LLC_8021X_TYPE != usEtherType && WLANTL_LLC_WAI_TYPE != usEtherType ) |
| 7127 | { |
Sunil Ravi | d5406f2 | 2013-01-22 00:18:31 -0800 | [diff] [blame] | 7128 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 7129 | "WLAN TL:RX Frame not EAPOL or WAI EtherType %d - dropping", usEtherType ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7130 | /* Drop packet */ |
| 7131 | vos_pkt_return_packet(vosDataBuff); |
| 7132 | } |
| 7133 | #else |
| 7134 | if ( WLANTL_LLC_8021X_TYPE != usEtherType ) |
| 7135 | { |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 7136 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7137 | "WLAN TL:RX Frame not EAPOL EtherType %d - dropping", usEtherType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7138 | /* Drop packet */ |
| 7139 | vos_pkt_return_packet(vosDataBuff); |
| 7140 | } |
| 7141 | #endif /* FEATURE_WLAN_WAPI */ |
| 7142 | else /* Frame is an EAPOL frame or a WAI frame*/ |
| 7143 | { |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 7144 | |
Madan Mohan Koyyalamudi | d800034 | 2012-11-08 14:55:26 -0800 | [diff] [blame] | 7145 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, |
Madan Mohan Koyyalamudi | 546e3f5 | 2012-10-05 12:17:57 -0700 | [diff] [blame] | 7146 | "WLAN TL:RX Frame EAPOL EtherType %d - processing", usEtherType); |
| 7147 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7148 | if (( 0 == WDA_GET_RX_FT_DONE(aucBDHeader) ) && |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7149 | ( 0 != pClientSTA->wSTADesc.ucSwFrameRXXlation)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7150 | { |
| 7151 | if (usMPDUDOffset > ucMPDUHOffset) |
| 7152 | { |
| 7153 | usActualHLen = usMPDUDOffset - ucMPDUHOffset; |
| 7154 | } |
| 7155 | |
| 7156 | vosStatus = WLANTL_Translate80211To8023Header( vosDataBuff, &vosStatus, usActualHLen, |
| 7157 | ucMPDUHLen, pTLCb, ucSTAId); |
| 7158 | |
| 7159 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 7160 | { |
| 7161 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7162 | "WLAN TL:Failed to translate from 802.11 to 802.3 - dropping")); |
| 7163 | /* Drop packet */ |
| 7164 | vos_pkt_return_packet(vosDataBuff); |
| 7165 | return vosStatus; |
| 7166 | } |
| 7167 | } |
| 7168 | /*------------------------------------------------------------------- |
| 7169 | Increment receive counter |
| 7170 | -------------------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | c0e5bd8 | 2012-09-18 17:12:27 -0700 | [diff] [blame] | 7171 | if ( !WLANTL_TID_INVALID( ucTid) ) |
| 7172 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7173 | pClientSTA->auRxCount[ucTid]++; |
Madan Mohan Koyyalamudi | c0e5bd8 | 2012-09-18 17:12:27 -0700 | [diff] [blame] | 7174 | } |
| 7175 | else |
| 7176 | { |
| 7177 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7178 | "WLAN TL:Invalid tid %d (Station ID %d) on %s", |
| 7179 | ucTid, ucSTAId, __func__)); |
| 7180 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7181 | |
| 7182 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 7183 | "WLAN TL:Sending EAPoL frame to station %d AC %d", ucSTAId, ucTid)); |
| 7184 | |
| 7185 | /*------------------------------------------------------------------- |
| 7186 | !!!Assuming TID = UP mapping |
| 7187 | -------------------------------------------------------------------*/ |
| 7188 | wRxMetaInfo.ucUP = ucTid; |
| 7189 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7190 | TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7191 | "WLAN TL %s:Sending data chain to station \n", __func__)); |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7192 | if ( WLAN_STA_SOFTAP == pClientSTA->wSTADesc.wSTAType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7193 | { |
| 7194 | wRxMetaInfo.ucDesSTAId = WLAN_RX_SAP_SELF_STA_ID; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7195 | pClientSTA->pfnSTARx( pvosGCtx, vosDataBuff, ucSTAId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7196 | &wRxMetaInfo ); |
| 7197 | } |
| 7198 | else |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7199 | pClientSTA->pfnSTARx( pvosGCtx, vosDataBuff, ucSTAId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7200 | &wRxMetaInfo ); |
| 7201 | }/*EAPOL frame or WAI frame*/ |
| 7202 | }/*vos status success*/ |
| 7203 | |
| 7204 | return VOS_STATUS_SUCCESS; |
| 7205 | }/* WLANTL_STARxConn */ |
| 7206 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7207 | /*========================================================================== |
| 7208 | FUNCTION WLANTL_FwdPktToHDD |
| 7209 | |
| 7210 | DESCRIPTION |
| 7211 | Determine the Destation Station ID and route the Frame to Upper Layer |
| 7212 | |
| 7213 | DEPENDENCIES |
| 7214 | |
| 7215 | PARAMETERS |
| 7216 | |
| 7217 | IN |
| 7218 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 7219 | control block can be extracted from its context |
| 7220 | ucSTAId: identifier of the station being processed |
| 7221 | vosDataBuff: pointer to the rx vos buffer |
| 7222 | |
| 7223 | RETURN VALUE |
| 7224 | The result code associated with performing the operation |
| 7225 | |
| 7226 | VOS_STATUS_E_INVAL: invalid input parameters |
| 7227 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 7228 | page fault |
| 7229 | VOS_STATUS_SUCCESS: Everything is good :) |
| 7230 | |
| 7231 | SIDE EFFECTS |
| 7232 | |
| 7233 | ============================================================================*/ |
| 7234 | |
| 7235 | VOS_STATUS |
| 7236 | WLANTL_FwdPktToHDD |
| 7237 | ( |
| 7238 | v_PVOID_t pvosGCtx, |
| 7239 | vos_pkt_t* pvosDataBuff, |
| 7240 | v_U8_t ucSTAId |
| 7241 | ) |
| 7242 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7243 | v_MACADDR_t DestMacAddress; |
| 7244 | v_MACADDR_t *pDestMacAddress = &DestMacAddress; |
| 7245 | v_SIZE_t usMacAddSize = VOS_MAC_ADDR_SIZE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7246 | WLANTL_CbType* pTLCb = NULL; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7247 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7248 | vos_pkt_t* vosDataBuff ; |
| 7249 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7250 | v_U32_t STAMetaInfo; |
| 7251 | vos_pkt_t* vosNextDataBuff ; |
| 7252 | v_U8_t ucDesSTAId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7253 | WLANTL_RxMetaInfoType wRxMetaInfo; |
| 7254 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7255 | /*------------------------------------------------------------------------ |
| 7256 | Sanity check |
| 7257 | ------------------------------------------------------------------------*/ |
| 7258 | if (( NULL == pvosDataBuff ) || ( NULL == ( vosDataBuff = pvosDataBuff ))) |
| 7259 | { |
| 7260 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7261 | "WLAN TL:Invalid parameter sent on WLANTL_FwdPktToHdd")); |
| 7262 | return VOS_STATUS_E_INVAL; |
| 7263 | } |
| 7264 | |
| 7265 | /*------------------------------------------------------------------------ |
| 7266 | Extract TL control block |
| 7267 | ------------------------------------------------------------------------*/ |
| 7268 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 7269 | if ( NULL == pTLCb ) |
| 7270 | { |
| 7271 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7272 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_FwdPktToHdd")); |
| 7273 | return VOS_STATUS_E_FAULT; |
| 7274 | } |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7275 | |
Tushnim Bhattacharyya | 5dd9456 | 2013-03-20 20:15:03 -0700 | [diff] [blame] | 7276 | if(WLANTL_STA_ID_INVALID(ucSTAId)) |
| 7277 | { |
| 7278 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"ucSTAId %d is not valid", |
| 7279 | ucSTAId)); |
| 7280 | return VOS_STATUS_E_INVAL; |
| 7281 | } |
| 7282 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7283 | pClientSTA = pTLCb->atlSTAClients[ucSTAId]; |
| 7284 | |
| 7285 | if ( NULL == pClientSTA ) |
| 7286 | { |
| 7287 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7288 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 7289 | return VOS_STATUS_E_FAILURE; |
| 7290 | } |
| 7291 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7292 | /* This the change required for SoftAp to handle Reordered Buffer. Since a STA |
| 7293 | may have packets destined to multiple destinations we have to process each packet |
| 7294 | at a time and determine its Destination. So the Voschain provided by Reorder code |
| 7295 | is unchain and forwarded to Upper Layer after Determining the Destination */ |
| 7296 | |
| 7297 | vosDataBuff = pvosDataBuff; |
| 7298 | while (vosDataBuff != NULL) |
| 7299 | { |
| 7300 | vos_pkt_walk_packet_chain( vosDataBuff, &vosNextDataBuff, 1/*true*/ ); |
| 7301 | vos_pkt_get_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL, |
| 7302 | (v_PVOID_t *)&STAMetaInfo ); |
| 7303 | wRxMetaInfo.ucUP = (v_U8_t)(STAMetaInfo & WLANTL_AC_MASK); |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 7304 | ucDesSTAId = (v_U8_t)((STAMetaInfo) >> WLANTL_STAID_OFFSET); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7305 | |
| 7306 | vosStatus = vos_pkt_extract_data( vosDataBuff, 0, (v_VOID_t *)pDestMacAddress, &usMacAddSize); |
| 7307 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 7308 | { |
| 7309 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7310 | "WLAN TL: recv corrupted data packet\n")); |
| 7311 | vos_pkt_return_packet(vosDataBuff); |
| 7312 | return vosStatus; |
| 7313 | } |
| 7314 | |
| 7315 | TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"station mac 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x \n", |
| 7316 | pDestMacAddress->bytes[0], pDestMacAddress->bytes[1], pDestMacAddress->bytes[2], |
| 7317 | pDestMacAddress->bytes[3], pDestMacAddress->bytes[4], pDestMacAddress->bytes[5])); |
| 7318 | |
| 7319 | if (vos_is_macaddr_broadcast( pDestMacAddress ) || vos_is_macaddr_group(pDestMacAddress)) |
| 7320 | { |
| 7321 | // destination is mc/bc station |
| 7322 | ucDesSTAId = WLAN_RX_BCMC_STA_ID; |
| 7323 | TLLOG4(VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO_LOW, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7324 | "%s: BC/MC packet, id %d\n", __func__, WLAN_RX_BCMC_STA_ID)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7325 | } |
| 7326 | else |
| 7327 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7328 | if (vos_is_macaddr_equal(pDestMacAddress, &pClientSTA->wSTADesc.vSelfMACAddress)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7329 | { |
| 7330 | // destination is AP itself |
| 7331 | ucDesSTAId = WLAN_RX_SAP_SELF_STA_ID; |
| 7332 | TLLOG4(VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO_LOW, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7333 | "%s: packet to AP itself, id %d\n", __func__, WLAN_RX_SAP_SELF_STA_ID)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7334 | } |
Madan Mohan Koyylamudi | 6425822 | 2013-01-30 14:35:10 +0530 | [diff] [blame] | 7335 | else if (( WLAN_MAX_STA_COUNT <= ucDesSTAId ) || (NULL != pTLCb->atlSTAClients[ucDesSTAId] && pTLCb->atlSTAClients[ucDesSTAId]->ucExists == 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7336 | { |
| 7337 | // destination station is something else |
| 7338 | TLLOG4(VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO_LOW, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7339 | "%s: get an station index larger than WLAN_MAX_STA_COUNT %d\n", __func__, ucDesSTAId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7340 | ucDesSTAId = WLAN_RX_SAP_SELF_STA_ID; |
| 7341 | } |
| 7342 | |
| 7343 | |
| 7344 | //loopback unicast station comes here |
| 7345 | } |
| 7346 | |
| 7347 | wRxMetaInfo.ucUP = (v_U8_t)(STAMetaInfo & WLANTL_AC_MASK); |
| 7348 | wRxMetaInfo.ucDesSTAId = ucDesSTAId; |
| 7349 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7350 | vosStatus = pClientSTA->pfnSTARx( pvosGCtx, vosDataBuff, ucDesSTAId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7351 | &wRxMetaInfo ); |
| 7352 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 7353 | { |
| 7354 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7355 | "WLAN TL: failed to send pkt to HDD \n")); |
| 7356 | vos_pkt_return_packet(vosDataBuff); |
| 7357 | return vosStatus; |
| 7358 | } |
| 7359 | vosDataBuff = vosNextDataBuff; |
| 7360 | } |
| 7361 | return VOS_STATUS_SUCCESS; |
| 7362 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7363 | |
| 7364 | /*========================================================================== |
| 7365 | FUNCTION WLANTL_STARxAuth |
| 7366 | |
| 7367 | DESCRIPTION |
| 7368 | Receive in authenticated state - all data allowed |
| 7369 | |
| 7370 | DEPENDENCIES |
| 7371 | The STA must be registered with TL before this function can be called. |
| 7372 | |
| 7373 | PARAMETERS |
| 7374 | |
| 7375 | IN |
| 7376 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 7377 | control block can be extracted from its context |
| 7378 | ucSTAId: identifier of the station being processed |
| 7379 | vosDataBuff: pointer to the rx vos buffer |
| 7380 | |
| 7381 | RETURN VALUE |
| 7382 | The result code associated with performing the operation |
| 7383 | |
| 7384 | VOS_STATUS_E_INVAL: invalid input parameters |
| 7385 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 7386 | page fault |
| 7387 | VOS_STATUS_SUCCESS: Everything is good :) |
| 7388 | |
| 7389 | SIDE EFFECTS |
| 7390 | |
| 7391 | ============================================================================*/ |
| 7392 | VOS_STATUS |
| 7393 | WLANTL_STARxAuth |
| 7394 | ( |
| 7395 | v_PVOID_t pvosGCtx, |
| 7396 | v_U8_t ucSTAId, |
| 7397 | vos_pkt_t** pvosDataBuff |
| 7398 | ) |
| 7399 | { |
| 7400 | WLANTL_CbType* pTLCb = NULL; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7401 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7402 | v_U8_t ucAsf; /* AMSDU sub frame */ |
| 7403 | v_U16_t usMPDUDOffset; |
| 7404 | v_U8_t ucMPDUHOffset; |
| 7405 | v_U16_t usMPDULen; |
| 7406 | v_U8_t ucMPDUHLen; |
| 7407 | v_U16_t usActualHLen = 0; |
| 7408 | v_U8_t ucTid; |
| 7409 | #ifdef FEATURE_WLAN_WAPI |
| 7410 | v_U16_t usEtherType; |
| 7411 | #endif |
| 7412 | v_U16_t usPktLen; |
| 7413 | vos_pkt_t* vosDataBuff ; |
| 7414 | v_PVOID_t aucBDHeader; |
| 7415 | VOS_STATUS vosStatus; |
| 7416 | WLANTL_RxMetaInfoType wRxMetaInfo; |
Madan Mohan Koyyalamudi | dfd6aa8 | 2012-10-18 20:18:43 -0700 | [diff] [blame] | 7417 | static v_U8_t ucPMPDUHLen; |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 7418 | v_U32_t* STAMetaInfoPtr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7419 | v_U8_t ucEsf=0; /* first subframe of AMSDU flag */ |
| 7420 | v_U64_t ullcurrentReplayCounter=0; /*current replay counter*/ |
| 7421 | v_U64_t ullpreviousReplayCounter=0; /*previous replay counter*/ |
| 7422 | v_U16_t ucUnicastBroadcastType=0; /*It denotes whether received frame is UC or BC*/ |
Madan Mohan Koyyalamudi | 4fe3017 | 2012-10-18 20:13:40 -0700 | [diff] [blame] | 7423 | struct _BARFrmStruct *pBarFrame = NULL; |
| 7424 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7425 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 7426 | |
| 7427 | /*------------------------------------------------------------------------ |
| 7428 | Sanity check |
| 7429 | ------------------------------------------------------------------------*/ |
| 7430 | if (( NULL == pvosDataBuff ) || ( NULL == ( vosDataBuff = *pvosDataBuff ))) |
| 7431 | { |
| 7432 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7433 | "WLAN TL:Invalid parameter sent on WLANTL_STARxAuth")); |
| 7434 | return VOS_STATUS_E_INVAL; |
| 7435 | } |
| 7436 | |
| 7437 | /*------------------------------------------------------------------------ |
| 7438 | Extract TL control block |
| 7439 | ------------------------------------------------------------------------*/ |
| 7440 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 7441 | if ( NULL == pTLCb ) |
| 7442 | { |
| 7443 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7444 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STARxAuth")); |
| 7445 | return VOS_STATUS_E_FAULT; |
| 7446 | } |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7447 | pClientSTA = pTLCb->atlSTAClients[ucSTAId]; |
| 7448 | |
| 7449 | if ( NULL == pClientSTA ) |
| 7450 | { |
| 7451 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7452 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 7453 | return VOS_STATUS_E_FAILURE; |
| 7454 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7455 | |
| 7456 | /*------------------------------------------------------------------------ |
| 7457 | Extract BD header and check if valid |
| 7458 | ------------------------------------------------------------------------*/ |
| 7459 | WDA_DS_PeekRxPacketInfo( vosDataBuff, (v_PVOID_t)&aucBDHeader, 0 ); |
| 7460 | |
| 7461 | ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(aucBDHeader); |
| 7462 | usMPDUDOffset = (v_U16_t)WDA_GET_RX_MPDU_DATA_OFFSET(aucBDHeader); |
| 7463 | usMPDULen = (v_U16_t)WDA_GET_RX_MPDU_LEN(aucBDHeader); |
| 7464 | ucMPDUHLen = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(aucBDHeader); |
| 7465 | ucTid = (v_U8_t)WDA_GET_RX_TID(aucBDHeader); |
| 7466 | |
Madan Mohan Koyyalamudi | 4fe3017 | 2012-10-18 20:13:40 -0700 | [diff] [blame] | 7467 | /* Fix for a hardware bug. |
| 7468 | * H/W does not update the tid field in BD header for BAR frames. |
| 7469 | * Fix is to read the tid field from MAC header of BAR frame */ |
| 7470 | if( (WDA_GET_RX_TYPE(aucBDHeader) == SIR_MAC_CTRL_FRAME) && |
| 7471 | (WDA_GET_RX_SUBTYPE(aucBDHeader) == SIR_MAC_CTRL_BAR)) |
| 7472 | { |
| 7473 | pBarFrame = (struct _BARFrmStruct *)(WDA_GET_RX_MAC_HEADER(aucBDHeader)); |
| 7474 | ucTid = pBarFrame->barControl.numTID; |
| 7475 | } |
| 7476 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7477 | /*Host based replay check is needed for unicast data frames*/ |
| 7478 | ucUnicastBroadcastType = (v_U16_t)WDA_IS_RX_BCAST(aucBDHeader); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7479 | if(0 != ucMPDUHLen) |
| 7480 | { |
| 7481 | ucPMPDUHLen = ucMPDUHLen; |
| 7482 | } |
| 7483 | |
| 7484 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 7485 | "WLAN TL:BD header processing data: HO %d DO %d Len %d HLen %d" |
| 7486 | " Tid %d BD %d", |
| 7487 | ucMPDUHOffset, usMPDUDOffset, usMPDULen, ucMPDUHLen, ucTid, |
| 7488 | WLANHAL_RX_BD_HEADER_SIZE)); |
| 7489 | |
| 7490 | vos_pkt_get_packet_length( vosDataBuff, &usPktLen); |
| 7491 | |
| 7492 | if ( VOS_STATUS_SUCCESS != WDA_DS_TrimRxPacketInfo( vosDataBuff ) ) |
| 7493 | { |
| 7494 | if((WDA_GET_RX_ASF(aucBDHeader) && !WDA_GET_RX_ESF(aucBDHeader))) |
| 7495 | { |
| 7496 | /* AMSDU case, ucMPDUHOffset = 0 |
| 7497 | * it should be hancdled seperatly */ |
| 7498 | if(( usMPDUDOffset > ucMPDUHOffset ) && |
| 7499 | ( usMPDULen >= ucMPDUHLen ) && ( usPktLen >= usMPDULen ) && |
| 7500 | ( !WLANTL_TID_INVALID(ucTid) )) |
| 7501 | { |
| 7502 | ucMPDUHOffset = usMPDUDOffset - WLANTL_MPDU_HEADER_LEN; |
| 7503 | } |
| 7504 | else |
| 7505 | { |
| 7506 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 7507 | "WLAN TL:BD header corrupted - dropping packet")); |
| 7508 | /* Drop packet */ |
| 7509 | vos_pkt_return_packet(vosDataBuff); |
| 7510 | return VOS_STATUS_SUCCESS; |
| 7511 | } |
| 7512 | } |
| 7513 | else |
| 7514 | { |
| 7515 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 7516 | "WLAN TL:BD header corrupted - dropping packet")); |
| 7517 | /* Drop packet */ |
| 7518 | vos_pkt_return_packet(vosDataBuff); |
| 7519 | return VOS_STATUS_SUCCESS; |
| 7520 | } |
| 7521 | } |
| 7522 | |
| 7523 | #ifdef FEATURE_WLAN_WAPI |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7524 | if ( pClientSTA->wSTADesc.ucIsWapiSta ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7525 | { |
| 7526 | vosStatus = WLANTL_GetEtherType(aucBDHeader, vosDataBuff, ucMPDUHLen, &usEtherType); |
| 7527 | if( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 7528 | { |
| 7529 | if ( WLANTL_LLC_WAI_TYPE == usEtherType ) |
| 7530 | { |
| 7531 | if ( !( WLANHAL_RX_IS_UNPROTECTED_WPI_FRAME(aucBDHeader)) ) |
| 7532 | { |
| 7533 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7534 | "WLAN TL:WAI frame was received encrypted - dropping")); |
| 7535 | /* Drop packet */ |
| 7536 | /*Temporary fix added to fix wapi rekey issue*/ |
| 7537 | //vos_pkt_return_packet(vosDataBuff); |
| 7538 | //return vosStatus; //returning success |
| 7539 | } |
| 7540 | } |
| 7541 | else |
| 7542 | { |
| 7543 | if ( WLANHAL_RX_IS_UNPROTECTED_WPI_FRAME(aucBDHeader) ) |
| 7544 | { |
| 7545 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7546 | "WLAN TL:Non-WAI frame was received unencrypted - dropping")); |
| 7547 | /* Drop packet */ |
| 7548 | vos_pkt_return_packet(vosDataBuff); |
| 7549 | return vosStatus; //returning success |
| 7550 | } |
| 7551 | } |
| 7552 | } |
| 7553 | else //could not extract EtherType - this should not happen |
| 7554 | { |
| 7555 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7556 | "WLAN TL:Could not extract EtherType")); |
| 7557 | //Packet is already freed |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7558 | return vosStatus; //returning failure |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7559 | } |
| 7560 | } |
| 7561 | #endif /* FEATURE_WLAN_WAPI */ |
| 7562 | |
| 7563 | /*---------------------------------------------------------------------- |
| 7564 | Increment receive counter |
| 7565 | !! not sure this is the best place to increase this - pkt might be |
| 7566 | dropped below or delayed in TL's queues |
| 7567 | - will leave it here for now |
| 7568 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | c0e5bd8 | 2012-09-18 17:12:27 -0700 | [diff] [blame] | 7569 | if ( !WLANTL_TID_INVALID( ucTid) ) |
| 7570 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7571 | pClientSTA->auRxCount[ucTid]++; |
Madan Mohan Koyyalamudi | c0e5bd8 | 2012-09-18 17:12:27 -0700 | [diff] [blame] | 7572 | } |
| 7573 | else |
| 7574 | { |
| 7575 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7576 | "WLAN TL:Invalid tid %d (Station ID %d) on %s", |
| 7577 | ucTid, ucSTAId, __func__)); |
| 7578 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7579 | |
| 7580 | /*------------------------------------------------------------------------ |
| 7581 | Check if AMSDU and send for processing if so |
| 7582 | ------------------------------------------------------------------------*/ |
| 7583 | ucAsf = (v_U8_t)WDA_GET_RX_ASF(aucBDHeader); |
| 7584 | |
| 7585 | if ( 0 != ucAsf ) |
| 7586 | { |
| 7587 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 7588 | "WLAN TL:Packet is AMSDU sub frame - sending for completion")); |
| 7589 | vosStatus = WLANTL_AMSDUProcess( pvosGCtx, &vosDataBuff, aucBDHeader, ucSTAId, |
| 7590 | ucMPDUHLen, usMPDULen ); |
| 7591 | if(NULL == vosDataBuff) |
| 7592 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7593 | //Packet is already freed |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7594 | return VOS_STATUS_SUCCESS; |
| 7595 | } |
| 7596 | } |
| 7597 | /* After AMSDU header handled |
| 7598 | * AMSDU frame just same with normal frames */ |
| 7599 | /*------------------------------------------------------------------- |
| 7600 | Translating header if necesary |
| 7601 | !! Fix me: rmv comments below |
| 7602 | ----------------------------------------------------------------------*/ |
| 7603 | if (( 0 == WDA_GET_RX_FT_DONE(aucBDHeader) ) && |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7604 | ( 0 != pClientSTA->wSTADesc.ucSwFrameRXXlation) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7605 | ( WLANTL_IS_DATA_FRAME(WDA_GET_RX_TYPE_SUBTYPE(aucBDHeader)) )) |
| 7606 | { |
| 7607 | if(0 == ucMPDUHLen) |
| 7608 | { |
| 7609 | ucMPDUHLen = ucPMPDUHLen; |
| 7610 | } |
| 7611 | if (usMPDUDOffset > ucMPDUHOffset) |
| 7612 | { |
| 7613 | usActualHLen = usMPDUDOffset - ucMPDUHOffset; |
| 7614 | } |
| 7615 | vosStatus = WLANTL_Translate80211To8023Header( vosDataBuff, &vosStatus, usActualHLen, |
| 7616 | ucMPDUHLen, pTLCb, ucSTAId); |
| 7617 | |
| 7618 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 7619 | { |
| 7620 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7621 | "WLAN TL:Failed to translate from 802.11 to 802.3 - dropping")); |
| 7622 | /* Drop packet */ |
| 7623 | vos_pkt_return_packet(vosDataBuff); |
| 7624 | return vosStatus; |
| 7625 | } |
| 7626 | } |
| 7627 | /* Softap requires additional Info such as Destination STAID and Access |
| 7628 | Category. Voschain or Buffer returned by BA would be unchain and this |
| 7629 | Meta Data would help in routing the packets to appropriate Destination */ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7630 | if( WLAN_STA_SOFTAP == pClientSTA->wSTADesc.wSTAType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7631 | { |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 7632 | STAMetaInfoPtr = (v_U32_t *)(ucTid | (WDA_GET_RX_ADDR3_IDX(aucBDHeader) << WLANTL_STAID_OFFSET)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7633 | vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL, |
| 7634 | (v_PVOID_t)STAMetaInfoPtr); |
| 7635 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7636 | |
| 7637 | /*------------------------------------------------------------------------ |
| 7638 | Check to see if re-ordering session is in place |
| 7639 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7640 | if ( 0 != pClientSTA->atlBAReorderInfo[ucTid].ucExists ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7641 | { |
| 7642 | WLANTL_MSDUReorder( pTLCb, &vosDataBuff, aucBDHeader, ucSTAId, ucTid ); |
| 7643 | } |
| 7644 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7645 | if(0 == ucUnicastBroadcastType |
| 7646 | #ifdef FEATURE_ON_CHIP_REORDERING |
| 7647 | && (WLANHAL_IsOnChipReorderingEnabledForTID(pvosGCtx, ucSTAId, ucTid) != TRUE) |
| 7648 | #endif |
| 7649 | ) |
| 7650 | { |
| 7651 | /* replay check code : check whether replay check is needed or not */ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7652 | if(VOS_TRUE == pClientSTA->ucIsReplayCheckValid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7653 | { |
| 7654 | /* replay check is needed for the station */ |
| 7655 | |
| 7656 | /* check whether frame is AMSDU frame */ |
| 7657 | if ( 0 != ucAsf ) |
| 7658 | { |
| 7659 | /* Since virgo can't send AMSDU frames this leg of the code |
| 7660 | was not tested properly, it needs to be tested properly*/ |
| 7661 | /* Frame is AMSDU frame. As per 802.11n only first |
| 7662 | subframe will have replay counter */ |
| 7663 | ucEsf = WDA_GET_RX_ESF( aucBDHeader ); |
| 7664 | if( 0 != ucEsf ) |
| 7665 | { |
| 7666 | v_BOOL_t status; |
| 7667 | /* Getting 48-bit replay counter from the RX BD */ |
| 7668 | ullcurrentReplayCounter = WDA_DS_GetReplayCounter(aucBDHeader); |
| 7669 | |
| 7670 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, |
| 7671 | "WLAN TL: AMSDU currentReplayCounter [0x%llX]\n",ullcurrentReplayCounter); |
| 7672 | |
| 7673 | /* Getting 48-bit previous replay counter from TL control block */ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7674 | ullpreviousReplayCounter = pClientSTA->ullReplayCounter[ucTid]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7675 | |
| 7676 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, |
| 7677 | "WLAN TL: AMSDU previousReplayCounter [0x%llX]\n",ullpreviousReplayCounter); |
| 7678 | |
| 7679 | /* It is first subframe of AMSDU thus it |
| 7680 | conatains replay counter perform the |
| 7681 | replay check for this first subframe*/ |
| 7682 | status = WLANTL_IsReplayPacket( ullcurrentReplayCounter, ullpreviousReplayCounter); |
| 7683 | if(VOS_FALSE == status) |
| 7684 | { |
| 7685 | /* Not a replay paket, update previous replay counter in TL CB */ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7686 | pClientSTA->ullReplayCounter[ucTid] = ullcurrentReplayCounter; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7687 | } |
| 7688 | else |
| 7689 | { |
| 7690 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7691 | "WLAN TL: AMSDU Drop the replay packet with PN : [0x%llX]\n",ullcurrentReplayCounter); |
| 7692 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7693 | pClientSTA->ulTotalReplayPacketsDetected++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7694 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7695 | "WLAN TL: AMSDU total dropped replay packets on STA ID %X is [0x%lX]\n", |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7696 | ucSTAId, pClientSTA->ulTotalReplayPacketsDetected); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7697 | |
| 7698 | /* Drop the packet */ |
| 7699 | vos_pkt_return_packet(vosDataBuff); |
| 7700 | return VOS_STATUS_SUCCESS; |
| 7701 | } |
| 7702 | } |
| 7703 | } |
| 7704 | else |
| 7705 | { |
| 7706 | v_BOOL_t status; |
| 7707 | |
| 7708 | /* Getting 48-bit replay counter from the RX BD */ |
| 7709 | ullcurrentReplayCounter = WDA_DS_GetReplayCounter(aucBDHeader); |
| 7710 | |
| 7711 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, |
| 7712 | "WLAN TL: Non-AMSDU currentReplayCounter [0x%llX]\n",ullcurrentReplayCounter); |
| 7713 | |
| 7714 | /* Getting 48-bit previous replay counter from TL control block */ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7715 | ullpreviousReplayCounter = pClientSTA->ullReplayCounter[ucTid]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7716 | |
| 7717 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, |
| 7718 | "WLAN TL: Non-AMSDU previousReplayCounter [0x%llX]\n",ullpreviousReplayCounter); |
| 7719 | |
| 7720 | /* It is not AMSDU frame so perform |
| 7721 | reaply check for each packet, as |
| 7722 | each packet contains valid replay counter*/ |
| 7723 | status = WLANTL_IsReplayPacket( ullcurrentReplayCounter, ullpreviousReplayCounter); |
| 7724 | if(VOS_FALSE == status) |
| 7725 | { |
| 7726 | /* Not a replay paket, update previous replay counter in TL CB */ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7727 | pClientSTA->ullReplayCounter[ucTid] = ullcurrentReplayCounter; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7728 | } |
| 7729 | else |
| 7730 | { |
| 7731 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7732 | "WLAN TL: Non-AMSDU Drop the replay packet with PN : [0x%llX]\n",ullcurrentReplayCounter); |
| 7733 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7734 | pClientSTA->ulTotalReplayPacketsDetected++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7735 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7736 | "WLAN TL: Non-AMSDU total dropped replay packets on STA ID %X is [0x%lX]\n", |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7737 | ucSTAId, pClientSTA->ulTotalReplayPacketsDetected); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7738 | |
| 7739 | /* Repaly packet, drop the packet */ |
| 7740 | vos_pkt_return_packet(vosDataBuff); |
| 7741 | return VOS_STATUS_SUCCESS; |
| 7742 | } |
| 7743 | } |
| 7744 | } |
| 7745 | } |
| 7746 | /*It is a broadast packet DPU has already done replay check for |
| 7747 | broadcast packets no need to do replay check of these packets*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7748 | |
| 7749 | if ( NULL != vosDataBuff ) |
| 7750 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7751 | if( WLAN_STA_SOFTAP == pClientSTA->wSTADesc.wSTAType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7752 | { |
| 7753 | WLANTL_FwdPktToHDD( pvosGCtx, vosDataBuff, ucSTAId ); |
| 7754 | } |
| 7755 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7756 | { |
| 7757 | wRxMetaInfo.ucUP = ucTid; |
Shailender Karmuchi | 13c0d08 | 2013-03-26 14:41:39 -0700 | [diff] [blame^] | 7758 | wRxMetaInfo.rssiAvg = pClientSTA->rssiAvg; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 7759 | pClientSTA->pfnSTARx( pvosGCtx, vosDataBuff, ucSTAId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7760 | &wRxMetaInfo ); |
| 7761 | } |
| 7762 | }/* if not NULL */ |
| 7763 | |
| 7764 | return VOS_STATUS_SUCCESS; |
| 7765 | }/* WLANTL_STARxAuth */ |
| 7766 | |
| 7767 | |
| 7768 | /*========================================================================== |
| 7769 | FUNCTION WLANTL_STARxDisc |
| 7770 | |
| 7771 | DESCRIPTION |
| 7772 | Receive in disconnected state - no data allowed |
| 7773 | |
| 7774 | DEPENDENCIES |
| 7775 | The STA must be registered with TL before this function can be called. |
| 7776 | |
| 7777 | PARAMETERS |
| 7778 | |
| 7779 | IN |
| 7780 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 7781 | control block can be extracted from its context |
| 7782 | ucSTAId: identifier of the station being processed |
| 7783 | vosDataBuff: pointer to the rx vos buffer |
| 7784 | |
| 7785 | RETURN VALUE |
| 7786 | The result code associated with performing the operation |
| 7787 | |
| 7788 | VOS_STATUS_SUCCESS: Everything is good :) |
| 7789 | |
| 7790 | SIDE EFFECTS |
| 7791 | |
| 7792 | ============================================================================*/ |
| 7793 | VOS_STATUS |
| 7794 | WLANTL_STARxDisc |
| 7795 | ( |
| 7796 | v_PVOID_t pvosGCtx, |
| 7797 | v_U8_t ucSTAId, |
| 7798 | vos_pkt_t** pvosDataBuff |
| 7799 | ) |
| 7800 | { |
| 7801 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 7802 | |
| 7803 | /*------------------------------------------------------------------------ |
| 7804 | Sanity check |
| 7805 | ------------------------------------------------------------------------*/ |
| 7806 | if (( NULL == pvosDataBuff ) || ( NULL == *pvosDataBuff )) |
| 7807 | { |
| 7808 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7809 | "WLAN TL:Invalid parameter sent on WLANTL_STARxDisc")); |
| 7810 | return VOS_STATUS_E_INVAL; |
| 7811 | } |
| 7812 | |
| 7813 | /*------------------------------------------------------------------------ |
| 7814 | Error - drop packet |
| 7815 | ------------------------------------------------------------------------*/ |
| 7816 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7817 | "WLAN TL:Packet should not be received in state disconnected" |
| 7818 | " - dropping")); |
| 7819 | vos_pkt_return_packet(*pvosDataBuff); |
| 7820 | *pvosDataBuff = NULL; |
| 7821 | |
| 7822 | return VOS_STATUS_SUCCESS; |
| 7823 | }/* WLANTL_STARxDisc */ |
| 7824 | |
| 7825 | /*========================================================================== |
| 7826 | Processing main loops for MAIN and TX threads |
| 7827 | ==========================================================================*/ |
| 7828 | |
| 7829 | /*========================================================================== |
| 7830 | FUNCTION WLANTL_McProcessMsg |
| 7831 | |
| 7832 | DESCRIPTION |
| 7833 | Called by VOSS when a message was serialized for TL through the |
| 7834 | main thread/task. |
| 7835 | |
| 7836 | DEPENDENCIES |
| 7837 | The TL must be initialized before this function can be called. |
| 7838 | |
| 7839 | PARAMETERS |
| 7840 | |
| 7841 | IN |
| 7842 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 7843 | control block can be extracted from its context |
| 7844 | message: type and content of the message |
| 7845 | |
| 7846 | |
| 7847 | RETURN VALUE |
| 7848 | The result code associated with performing the operation |
| 7849 | |
| 7850 | VOS_STATUS_E_INVAL: invalid input parameters |
| 7851 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 7852 | page fault |
| 7853 | VOS_STATUS_SUCCESS: Everything is good :) |
| 7854 | |
| 7855 | SIDE EFFECTS |
| 7856 | |
| 7857 | ============================================================================*/ |
| 7858 | VOS_STATUS |
| 7859 | WLANTL_McProcessMsg |
| 7860 | ( |
| 7861 | v_PVOID_t pvosGCtx, |
| 7862 | vos_msg_t* message |
| 7863 | ) |
| 7864 | { |
| 7865 | WLANTL_CbType* pTLCb = NULL; |
| 7866 | tAddBAInd* ptAddBaInd = NULL; |
| 7867 | tDelBAInd* ptDelBaInd = NULL; |
| 7868 | tAddBARsp* ptAddBaRsp = NULL; |
| 7869 | vos_msg_t vosMessage; |
| 7870 | VOS_STATUS vosStatus; |
| 7871 | tpFlushACRsp FlushACRspPtr; |
| 7872 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 7873 | |
| 7874 | /*------------------------------------------------------------------------ |
| 7875 | Sanity check |
| 7876 | ------------------------------------------------------------------------*/ |
| 7877 | if ( NULL == message ) |
| 7878 | { |
| 7879 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7880 | "WLAN TL:Invalid parameter sent on WLANTL_ProcessMainMessage")); |
| 7881 | return VOS_STATUS_E_INVAL; |
| 7882 | } |
| 7883 | |
| 7884 | /*------------------------------------------------------------------------ |
| 7885 | Extract TL control block |
| 7886 | ------------------------------------------------------------------------*/ |
| 7887 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 7888 | if ( NULL == pTLCb ) |
| 7889 | { |
| 7890 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7891 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ProcessMainMessage")); |
| 7892 | return VOS_STATUS_E_FAULT; |
| 7893 | } |
| 7894 | |
| 7895 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 7896 | "WLAN TL:Received message: %d through main flow", message->type)); |
| 7897 | |
| 7898 | switch( message->type ) |
| 7899 | { |
| 7900 | case WDA_TL_FLUSH_AC_RSP: |
| 7901 | // Extract the message from the message body |
| 7902 | FlushACRspPtr = (tpFlushACRsp)(message->bodyptr); |
| 7903 | // Make sure the call back function is not null. |
Tushnim Bhattacharyya | 5dd9456 | 2013-03-20 20:15:03 -0700 | [diff] [blame] | 7904 | if ( NULL == pTLCb->tlBAPClient.pfnFlushOpCompleteCb ) |
| 7905 | { |
| 7906 | VOS_ASSERT(0); |
| 7907 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7908 | "WLAN TL:Invalid TL pointer pfnFlushOpCompleteCb")); |
| 7909 | return VOS_STATUS_E_FAULT; |
| 7910 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7911 | |
| 7912 | TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 7913 | "Received message: Flush complete received by TL")); |
| 7914 | |
| 7915 | // Since we have the response back from HAL, just call the BAP client |
| 7916 | // registered call back from TL. There is only 1 possible |
| 7917 | // BAP client. So directly reference tlBAPClient |
| 7918 | pTLCb->tlBAPClient.pfnFlushOpCompleteCb( pvosGCtx, |
| 7919 | FlushACRspPtr->ucSTAId, |
| 7920 | FlushACRspPtr->ucTid, FlushACRspPtr->status ); |
| 7921 | |
| 7922 | // Free the PAL memory, we are done with it. |
| 7923 | TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 7924 | "Flush complete received by TL: Freeing %p", FlushACRspPtr)); |
| 7925 | vos_mem_free((v_VOID_t *)FlushACRspPtr); |
| 7926 | break; |
| 7927 | |
| 7928 | case WDA_HDD_ADDBA_REQ: |
| 7929 | ptAddBaInd = (tAddBAInd*)(message->bodyptr); |
| 7930 | vosStatus = WLANTL_BaSessionAdd( pvosGCtx, |
| 7931 | ptAddBaInd->baSession.baSessionID, |
| 7932 | ptAddBaInd->baSession.STAID, |
| 7933 | ptAddBaInd->baSession.baTID, |
| 7934 | (v_U32_t)ptAddBaInd->baSession.baBufferSize, |
| 7935 | ptAddBaInd->baSession.winSize, |
| 7936 | ptAddBaInd->baSession.SSN); |
| 7937 | ptAddBaRsp = vos_mem_malloc(sizeof(*ptAddBaRsp)); |
| 7938 | |
| 7939 | if ( NULL == ptAddBaRsp ) |
| 7940 | { |
| 7941 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7942 | "WLAN TL: fatal failure, cannot allocate BA Rsp structure")); |
| 7943 | VOS_ASSERT(0); |
| 7944 | return VOS_STATUS_E_NOMEM; |
| 7945 | } |
| 7946 | |
| 7947 | if ( VOS_STATUS_SUCCESS == vosStatus ) |
| 7948 | { |
| 7949 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 7950 | "WLAN TL: Sending success indication to HAL for ADD BA")); |
| 7951 | /*Send success*/ |
| 7952 | ptAddBaRsp->mesgType = WDA_HDD_ADDBA_RSP; |
| 7953 | vosMessage.type = WDA_HDD_ADDBA_RSP; |
| 7954 | } |
| 7955 | else |
| 7956 | { |
| 7957 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 7958 | "WLAN TL: Sending failure indication to HAL for ADD BA")); |
| 7959 | |
| 7960 | /*Send failure*/ |
| 7961 | ptAddBaRsp->mesgType = WDA_BA_FAIL_IND; |
| 7962 | vosMessage.type = WDA_BA_FAIL_IND; |
| 7963 | } |
| 7964 | |
| 7965 | ptAddBaRsp->mesgLen = sizeof(tAddBARsp); |
| 7966 | ptAddBaRsp->baSessionID = ptAddBaInd->baSession.baSessionID; |
| 7967 | /* This is default, reply win size has to be handled BA module, FIX THIS */ |
| 7968 | ptAddBaRsp->replyWinSize = WLANTL_MAX_WINSIZE; |
| 7969 | vosMessage.bodyptr = ptAddBaRsp; |
| 7970 | |
| 7971 | vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage ); |
| 7972 | WLANTL_McFreeMsg (pvosGCtx, message); |
| 7973 | break; |
| 7974 | case WDA_DELETEBA_IND: |
| 7975 | ptDelBaInd = (tDelBAInd*)(message->bodyptr); |
| 7976 | vosStatus = WLANTL_BaSessionDel(pvosGCtx, |
| 7977 | ptDelBaInd->staIdx, |
| 7978 | ptDelBaInd->baTID); |
| 7979 | |
| 7980 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 7981 | { |
| 7982 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 7983 | "WLAN TL: Failed to del BA session STA:%d TID:%d Status :%d", |
| 7984 | ptDelBaInd->staIdx, |
| 7985 | ptDelBaInd->baTID, |
| 7986 | vosStatus)); |
| 7987 | } |
| 7988 | WLANTL_McFreeMsg (pvosGCtx, message); |
| 7989 | break; |
| 7990 | default: |
| 7991 | /*no processing for now*/ |
| 7992 | break; |
| 7993 | } |
| 7994 | |
| 7995 | return VOS_STATUS_SUCCESS; |
| 7996 | }/* WLANTL_ProcessMainMessage */ |
| 7997 | |
| 7998 | /*========================================================================== |
| 7999 | FUNCTION WLANTL_McFreeMsg |
| 8000 | |
| 8001 | DESCRIPTION |
| 8002 | Called by VOSS to free a given TL message on the Main thread when there |
| 8003 | are messages pending in the queue when the whole system is been reset. |
| 8004 | For now, TL does not allocate any body so this function shout translate |
| 8005 | into a NOOP |
| 8006 | |
| 8007 | DEPENDENCIES |
| 8008 | The TL must be initialized before this function can be called. |
| 8009 | |
| 8010 | PARAMETERS |
| 8011 | |
| 8012 | IN |
| 8013 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 8014 | control block can be extracted from its context |
| 8015 | message: type and content of the message |
| 8016 | |
| 8017 | |
| 8018 | RETURN VALUE |
| 8019 | The result code associated with performing the operation |
| 8020 | |
| 8021 | VOS_STATUS_SUCCESS: Everything is good :) |
| 8022 | |
| 8023 | SIDE EFFECTS |
| 8024 | |
| 8025 | ============================================================================*/ |
| 8026 | VOS_STATUS |
| 8027 | WLANTL_McFreeMsg |
| 8028 | ( |
| 8029 | v_PVOID_t pvosGCtx, |
| 8030 | vos_msg_t* message |
| 8031 | ) |
| 8032 | { |
| 8033 | WLANTL_CbType* pTLCb = NULL; |
| 8034 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 8035 | |
| 8036 | /*------------------------------------------------------------------------ |
| 8037 | Sanity check |
| 8038 | ------------------------------------------------------------------------*/ |
| 8039 | if ( NULL == message ) |
| 8040 | { |
| 8041 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 8042 | "WLAN TL:Invalid parameter sent on WLANTL_McFreeMsg")); |
| 8043 | return VOS_STATUS_E_INVAL; |
| 8044 | } |
| 8045 | |
| 8046 | /*------------------------------------------------------------------------ |
| 8047 | Extract TL control block |
| 8048 | ------------------------------------------------------------------------*/ |
| 8049 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 8050 | if ( NULL == pTLCb ) |
| 8051 | { |
| 8052 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 8053 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_McFreeMsg")); |
| 8054 | return VOS_STATUS_E_FAULT; |
| 8055 | } |
| 8056 | |
| 8057 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 8058 | "WLAN TL:Received message: %d through main free", message->type)); |
| 8059 | |
| 8060 | switch( message->type ) |
| 8061 | { |
| 8062 | case WDA_HDD_ADDBA_REQ: |
| 8063 | case WDA_DELETEBA_IND: |
| 8064 | /*vos free body pointer*/ |
| 8065 | vos_mem_free(message->bodyptr); |
| 8066 | message->bodyptr = NULL; |
| 8067 | break; |
| 8068 | default: |
| 8069 | /*no processing for now*/ |
| 8070 | break; |
| 8071 | } |
| 8072 | |
| 8073 | return VOS_STATUS_SUCCESS; |
| 8074 | }/*WLANTL_McFreeMsg*/ |
| 8075 | |
| 8076 | /*========================================================================== |
| 8077 | FUNCTION WLANTL_TxProcessMsg |
| 8078 | |
| 8079 | DESCRIPTION |
| 8080 | Called by VOSS when a message was serialized for TL through the |
| 8081 | tx thread/task. |
| 8082 | |
| 8083 | DEPENDENCIES |
| 8084 | The TL must be initialized before this function can be called. |
| 8085 | |
| 8086 | PARAMETERS |
| 8087 | |
| 8088 | IN |
| 8089 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 8090 | control block can be extracted from its context |
| 8091 | message: type and content of the message |
| 8092 | |
| 8093 | |
| 8094 | RETURN VALUE |
| 8095 | The result code associated with performing the operation |
| 8096 | |
| 8097 | VOS_STATUS_E_INVAL: invalid input parameters |
| 8098 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 8099 | page fault |
| 8100 | VOS_STATUS_SUCCESS: Everything is good :) |
| 8101 | |
| 8102 | Other values can be returned as a result of a function call, please check |
| 8103 | corresponding API for more info. |
| 8104 | SIDE EFFECTS |
| 8105 | |
| 8106 | ============================================================================*/ |
| 8107 | VOS_STATUS |
| 8108 | WLANTL_TxProcessMsg |
| 8109 | ( |
| 8110 | v_PVOID_t pvosGCtx, |
| 8111 | vos_msg_t* message |
| 8112 | ) |
| 8113 | { |
| 8114 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 8115 | v_U32_t uData; |
| 8116 | v_U8_t ucSTAId; |
| 8117 | v_U8_t ucUcastSig; |
| 8118 | v_U8_t ucBcastSig; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 8119 | WLANTL_CbType* pTLCb = NULL; |
| 8120 | WLANTL_STAClientType* pClientSTA = NULL; |
| 8121 | WLANTL_ACEnumType ucAC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8122 | void (*callbackRoutine) (void *callbackContext); |
| 8123 | void *callbackContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8124 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 8125 | |
| 8126 | /*------------------------------------------------------------------------ |
| 8127 | Sanity check |
| 8128 | ------------------------------------------------------------------------*/ |
| 8129 | if ( NULL == message ) |
| 8130 | { |
| 8131 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 8132 | "WLAN TL:Invalid parameter sent on WLANTL_ProcessTxMessage")); |
| 8133 | return VOS_STATUS_E_INVAL; |
| 8134 | } |
| 8135 | |
| 8136 | /*------------------------------------------------------------------------ |
| 8137 | Process message |
| 8138 | ------------------------------------------------------------------------*/ |
| 8139 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 8140 | "WLAN TL:Received message: %d through tx flow", message->type)); |
| 8141 | |
| 8142 | switch( message->type ) |
| 8143 | { |
| 8144 | case WLANTL_TX_SIG_SUSPEND: |
| 8145 | vosStatus = WLANTL_SuspendCB( pvosGCtx, |
| 8146 | (WLANTL_SuspendCBType)message->bodyptr, |
| 8147 | message->reserved); |
| 8148 | break; |
| 8149 | case WLANTL_TX_RES_NEEDED: |
| 8150 | vosStatus = WLANTL_GetTxResourcesCB( pvosGCtx ); |
| 8151 | break; |
| 8152 | |
| 8153 | case WLANTL_TX_FWD_CACHED: |
| 8154 | /*--------------------------------------------------------------------- |
| 8155 | The data sent with the message has the following structure: |
| 8156 | | 00 | ucBcastSignature | ucUcastSignature | ucSTAID | |
| 8157 | each field above is one byte |
| 8158 | ---------------------------------------------------------------------*/ |
| 8159 | uData = (v_U32_t)message->bodyptr; |
| 8160 | ucSTAId = ( uData & 0x000000FF); |
| 8161 | ucUcastSig = ( uData & 0x0000FF00)>>8; |
| 8162 | ucBcastSig = (v_U8_t)(( uData & 0x00FF0000)>>16); |
| 8163 | vosStatus = WLANTL_ForwardSTAFrames( pvosGCtx, ucSTAId, |
| 8164 | ucUcastSig, ucBcastSig); |
| 8165 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8166 | case WLANTL_TX_STAID_AC_IND: |
| 8167 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 8168 | if ( NULL == pTLCb ) |
| 8169 | { |
| 8170 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 8171 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STAPktPending")); |
| 8172 | return VOS_STATUS_E_FAULT; |
| 8173 | } |
| 8174 | |
| 8175 | ucAC = message->bodyval & WLANTL_AC_MASK; |
Gopichand Nakkala | 976e325 | 2013-01-03 15:45:56 -0800 | [diff] [blame] | 8176 | ucSTAId = (v_U8_t)(message->bodyval >> WLANTL_STAID_OFFSET); |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 8177 | pClientSTA = pTLCb->atlSTAClients[ucSTAId]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8178 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 8179 | if ( NULL == pClientSTA ) |
| 8180 | { |
| 8181 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 8182 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 8183 | return VOS_STATUS_E_FAILURE; |
| 8184 | } |
| 8185 | |
| 8186 | pClientSTA->aucACMask[ucAC] = 1; |
| 8187 | |
| 8188 | vos_atomic_set_U8( &pClientSTA->ucPktPending, 1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8189 | vosStatus = WDA_DS_StartXmit(pvosGCtx); |
| 8190 | break; |
Jeff Johnson | 017fdc3 | 2013-02-27 09:22:30 -0800 | [diff] [blame] | 8191 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8192 | case WDA_DS_TX_START_XMIT: |
| 8193 | |
Gopichand Nakkala | 11acd11 | 2012-12-31 16:04:04 -0800 | [diff] [blame] | 8194 | WLANTL_ClearTxXmitPending(pvosGCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8195 | vosStatus = WDA_DS_TxFrames( pvosGCtx ); |
| 8196 | |
| 8197 | break; |
| 8198 | |
| 8199 | case WDA_DS_FINISH_ULA: |
Tushnim Bhattacharyya | 39a8f18 | 2013-02-20 18:10:30 -0800 | [diff] [blame] | 8200 | callbackContext = (void *)message->bodyval; |
| 8201 | callbackRoutine = message->bodyptr; |
| 8202 | callbackRoutine(callbackContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8203 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8204 | |
| 8205 | default: |
| 8206 | /*no processing for now*/ |
| 8207 | break; |
| 8208 | } |
| 8209 | |
| 8210 | return vosStatus; |
| 8211 | }/* WLANTL_TxProcessMsg */ |
| 8212 | |
| 8213 | /*========================================================================== |
| 8214 | FUNCTION WLANTL_McFreeMsg |
| 8215 | |
| 8216 | DESCRIPTION |
| 8217 | Called by VOSS to free a given TL message on the Main thread when there |
| 8218 | are messages pending in the queue when the whole system is been reset. |
| 8219 | For now, TL does not allocate any body so this function shout translate |
| 8220 | into a NOOP |
| 8221 | |
| 8222 | DEPENDENCIES |
| 8223 | The TL must be initialized before this function can be called. |
| 8224 | |
| 8225 | PARAMETERS |
| 8226 | |
| 8227 | IN |
| 8228 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 8229 | control block can be extracted from its context |
| 8230 | message: type and content of the message |
| 8231 | |
| 8232 | |
| 8233 | RETURN VALUE |
| 8234 | The result code associated with performing the operation |
| 8235 | |
| 8236 | VOS_STATUS_SUCCESS: Everything is good :) |
| 8237 | |
| 8238 | SIDE EFFECTS |
| 8239 | |
| 8240 | ============================================================================*/ |
| 8241 | VOS_STATUS |
| 8242 | WLANTL_TxFreeMsg |
| 8243 | ( |
| 8244 | v_PVOID_t pvosGCtx, |
| 8245 | vos_msg_t* message |
| 8246 | ) |
| 8247 | { |
| 8248 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 8249 | |
| 8250 | /*Nothing to do for now!!!*/ |
| 8251 | return VOS_STATUS_SUCCESS; |
| 8252 | }/*WLANTL_TxFreeMsg*/ |
| 8253 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8254 | /*========================================================================== |
| 8255 | |
| 8256 | FUNCTION WLANTL_TxFCFrame |
| 8257 | |
| 8258 | DESCRIPTION |
| 8259 | Internal utility function to send FC frame. Enable |
| 8260 | or disable LWM mode based on the information. |
| 8261 | |
| 8262 | DEPENDENCIES |
| 8263 | TL must be initiailized before this function gets called. |
| 8264 | FW sends up special flow control frame. |
| 8265 | |
| 8266 | PARAMETERS |
| 8267 | |
| 8268 | IN |
| 8269 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 8270 | control block can be extracted from its context |
| 8271 | |
| 8272 | RETURN VALUE |
| 8273 | The result code associated with performing the operation |
| 8274 | |
| 8275 | VOS_STATUS_E_INVAL: Input pointers are NULL. |
| 8276 | VOS_STATUS_E_FAULT: Something is wrong. |
| 8277 | VOS_STATUS_SUCCESS: Everything is good. |
| 8278 | |
| 8279 | SIDE EFFECTS |
| 8280 | Newly formed FC frame is generated and waits to be transmitted. Previously unsent frame will |
| 8281 | be released. |
| 8282 | |
| 8283 | ============================================================================*/ |
| 8284 | VOS_STATUS |
| 8285 | WLANTL_TxFCFrame |
| 8286 | ( |
| 8287 | v_PVOID_t pvosGCtx |
| 8288 | ) |
| 8289 | { |
| 8290 | #if 0 |
| 8291 | WLANTL_CbType* pTLCb = NULL; |
| 8292 | VOS_STATUS vosStatus; |
| 8293 | tpHalFcTxBd pvFcTxBd = NULL; |
| 8294 | vos_pkt_t * pPacket = NULL; |
| 8295 | v_U8_t ucSTAId = 0; |
| 8296 | v_U8_t ucBitCheck = 1; |
| 8297 | |
| 8298 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 8299 | "WLAN TL: Send FC frame %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8300 | |
| 8301 | /*------------------------------------------------------------------------ |
| 8302 | Sanity check |
| 8303 | ------------------------------------------------------------------------*/ |
| 8304 | if ( NULL == pvosGCtx ) |
| 8305 | { |
| 8306 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 8307 | "WLAN TL:Invalid parameter %s", __func__)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8308 | return VOS_STATUS_E_INVAL; |
| 8309 | } |
| 8310 | /*------------------------------------------------------------------------ |
| 8311 | Extract TL control block |
| 8312 | ------------------------------------------------------------------------*/ |
| 8313 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 8314 | |
| 8315 | if (NULL == pTLCb) |
| 8316 | { |
| 8317 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 8318 | "WLAN TL:Invalid pointer in %s \n", __func__)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8319 | return VOS_STATUS_E_INVAL; |
| 8320 | } |
| 8321 | |
| 8322 | //Get one voss packet |
| 8323 | vosStatus = vos_pkt_get_packet( &pPacket, VOS_PKT_TYPE_TX_802_11_MGMT, sizeof(tHalFcTxBd), 1, |
| 8324 | VOS_FALSE, NULL, NULL ); |
| 8325 | |
| 8326 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 8327 | { |
| 8328 | return VOS_STATUS_E_INVAL; |
| 8329 | } |
| 8330 | |
| 8331 | vosStatus = vos_pkt_reserve_head( pPacket, (void *)&pvFcTxBd, sizeof(tHalFcTxBd)); |
| 8332 | |
| 8333 | if( VOS_STATUS_SUCCESS != vosStatus ) |
| 8334 | { |
| 8335 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 8336 | "%s: failed to reserve FC TX BD %d\n",__func__, sizeof(tHalFcTxBd))); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8337 | vos_pkt_return_packet( pPacket ); |
| 8338 | return VOS_STATUS_E_FAULT; |
| 8339 | } |
| 8340 | |
| 8341 | //Generate most recent tlFCInfo. Most fields are correct. |
| 8342 | pTLCb->tlFCInfo.fcSTAThreshEnabledMask = 0; |
| 8343 | pTLCb->tlFCInfo.fcSTATxMoreDataMask = 0; |
| 8344 | for( ucSTAId = 0, ucBitCheck = 1 ; ucSTAId < WLAN_MAX_STA_COUNT; ucBitCheck <<= 1, ucSTAId ++) |
| 8345 | { |
| 8346 | if (0 == pTLCb->atlSTAClients[ucSTAId].ucExists) |
| 8347 | { |
| 8348 | continue; |
| 8349 | } |
| 8350 | |
| 8351 | if (pTLCb->atlSTAClients[ucSTAId].ucPktPending) |
| 8352 | { |
| 8353 | pTLCb->tlFCInfo.fcSTATxMoreDataMask |= ucBitCheck; |
| 8354 | } |
| 8355 | |
| 8356 | if ( (pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled) && |
| 8357 | (pTLCb->atlSTAClients[ucSTAId].bmuMemConsumed > pTLCb->atlSTAClients[ucSTAId].uLwmThreshold)) |
| 8358 | { |
| 8359 | pTLCb->tlFCInfo.fcSTAThreshEnabledMask |= ucBitCheck; |
| 8360 | |
| 8361 | pTLCb->tlFCInfo.fcSTAThresh[ucSTAId] = (tANI_U8)pTLCb->atlSTAClients[ucSTAId].uLwmThreshold; |
| 8362 | |
| 8363 | pTLCb->atlSTAClients[ucSTAId].ucLwmEventReported = FALSE; |
| 8364 | } |
| 8365 | |
| 8366 | } |
| 8367 | |
| 8368 | //request immediate feedback |
| 8369 | pTLCb->tlFCInfo.fcConfig |= 0x4; |
| 8370 | |
| 8371 | //fill in BD to sent |
| 8372 | vosStatus = WLANHAL_FillFcTxBd(pvosGCtx, &pTLCb->tlFCInfo, (void *)pvFcTxBd); |
| 8373 | |
| 8374 | if( VOS_STATUS_SUCCESS != vosStatus ) |
| 8375 | { |
| 8376 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 8377 | "%s: Fill FC TX BD unsuccessful\n", __func__)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8378 | vos_pkt_return_packet( pPacket ); |
| 8379 | return VOS_STATUS_E_FAULT; |
| 8380 | } |
| 8381 | |
| 8382 | if (NULL != pTLCb->vosTxFCBuf) |
| 8383 | { |
| 8384 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 8385 | "%s: Previous FC TX BD not sent\n", __func__)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8386 | vos_pkt_return_packet(pTLCb->vosTxFCBuf); |
| 8387 | } |
| 8388 | |
| 8389 | pTLCb->vosTxFCBuf = pPacket; |
| 8390 | |
| 8391 | vos_pkt_set_user_data_ptr( pPacket, VOS_PKT_USER_DATA_ID_TL, |
| 8392 | (v_PVOID_t)WLANTL_TxCompDefaultCb); |
| 8393 | vosStatus = WDA_DS_StartXmit(pvosGCtx); |
| 8394 | |
| 8395 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 8396 | "WLAN TL: send FC frame leave %s", __func__)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8397 | #endif |
| 8398 | return VOS_STATUS_SUCCESS; |
| 8399 | } |
| 8400 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8401 | |
| 8402 | /*========================================================================== |
| 8403 | FUNCTION WLANTL_GetTxResourcesCB |
| 8404 | |
| 8405 | DESCRIPTION |
| 8406 | Processing function for Resource needed signal. A request will be issued |
| 8407 | to BAL to get more tx resources. |
| 8408 | |
| 8409 | DEPENDENCIES |
| 8410 | The TL must be initialized before this function can be called. |
| 8411 | |
| 8412 | PARAMETERS |
| 8413 | |
| 8414 | IN |
| 8415 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 8416 | control block can be extracted from its context |
| 8417 | |
| 8418 | |
| 8419 | RETURN VALUE |
| 8420 | The result code associated with performing the operation |
| 8421 | |
| 8422 | VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a |
| 8423 | page fault |
| 8424 | VOS_STATUS_SUCCESS: Everything is good :) |
| 8425 | |
| 8426 | Other values can be returned as a result of a function call, please check |
| 8427 | corresponding API for more info. |
| 8428 | SIDE EFFECTS |
| 8429 | |
| 8430 | ============================================================================*/ |
| 8431 | VOS_STATUS |
| 8432 | WLANTL_GetTxResourcesCB |
| 8433 | ( |
| 8434 | v_PVOID_t pvosGCtx |
| 8435 | ) |
| 8436 | { |
| 8437 | WLANTL_CbType* pTLCb = NULL; |
| 8438 | v_U32_t uResCount = WDA_TLI_MIN_RES_DATA; |
| 8439 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 8440 | v_U8_t ucMgmt = 0; |
| 8441 | v_U8_t ucBAP = 0; |
| 8442 | v_U8_t ucData = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8443 | #ifdef WLAN_SOFTAP_FLOWCTRL_EN |
| 8444 | tBssSystemRole systemRole; |
| 8445 | tpAniSirGlobal pMac; |
| 8446 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8447 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 8448 | /*------------------------------------------------------------------------ |
| 8449 | Extract TL control block |
| 8450 | ------------------------------------------------------------------------*/ |
| 8451 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 8452 | if ( NULL == pTLCb ) |
| 8453 | { |
| 8454 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 8455 | "WLAN TL:Invalid TL pointer from pvosGCtx on" |
| 8456 | " WLANTL_ProcessTxMessage")); |
| 8457 | return VOS_STATUS_E_FAULT; |
| 8458 | } |
| 8459 | |
| 8460 | /*------------------------------------------------------------------------ |
| 8461 | Get tx resources from BAL |
| 8462 | ------------------------------------------------------------------------*/ |
| 8463 | vosStatus = WDA_DS_GetTxResources( pvosGCtx, &uResCount ); |
| 8464 | |
| 8465 | if ( (VOS_STATUS_SUCCESS != vosStatus) && (VOS_STATUS_E_RESOURCES != vosStatus)) |
| 8466 | { |
| 8467 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 8468 | "WLAN TL:TL failed to get resources from BAL, Err: %d", |
| 8469 | vosStatus)); |
| 8470 | return vosStatus; |
| 8471 | } |
| 8472 | |
| 8473 | /* Currently only Linux BAL returns the E_RESOURCES error code when it is running |
| 8474 | out of BD/PDUs. To make use of this interrupt for throughput enhancement, similar |
| 8475 | changes should be done in BAL code of AMSS and WM */ |
| 8476 | if (VOS_STATUS_E_RESOURCES == vosStatus) |
| 8477 | { |
| 8478 | #ifdef VOLANS_PERF |
| 8479 | WLANHAL_EnableIdleBdPduInterrupt(pvosGCtx, (tANI_U8)bdPduInterruptGetThreshold); |
| 8480 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 8481 | "WLAN TL: Enabling Idle BD/PDU interrupt, Current resources = %d", uResCount); |
| 8482 | #else |
| 8483 | return VOS_STATUS_E_FAILURE; |
| 8484 | #endif |
| 8485 | } |
| 8486 | |
| 8487 | pTLCb->uResCount = uResCount; |
| 8488 | |
| 8489 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8490 | #ifdef WLAN_SOFTAP_FLOWCTRL_EN |
| 8491 | /* FIXME: disabled since creating issues in power-save, needs to be addressed */ |
| 8492 | pTLCb->sendFCFrame ++; |
| 8493 | pMac = vos_get_context(VOS_MODULE_ID_WDA, pvosGCtx); |
| 8494 | systemRole = wdaGetGlobalSystemRole(pMac); |
| 8495 | if (eSYSTEM_AP_ROLE == systemRole) |
| 8496 | { |
| 8497 | if (pTLCb->sendFCFrame % 16 == 0) |
| 8498 | { |
| 8499 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 8500 | "Transmit FC")); |
| 8501 | WLANTL_TxFCFrame (pvosGCtx); |
| 8502 | } |
| 8503 | } |
| 8504 | #endif //WLAN_SOFTAP_FLOWCTRL_EN |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8505 | |
| 8506 | ucData = ( pTLCb->uResCount >= WDA_TLI_MIN_RES_DATA ); |
| 8507 | ucBAP = ( pTLCb->uResCount >= WDA_TLI_MIN_RES_BAP ) && |
| 8508 | ( NULL != pTLCb->tlBAPClient.vosPendingDataBuff ); |
| 8509 | ucMgmt = ( pTLCb->uResCount >= WDA_TLI_MIN_RES_MF ) && |
| 8510 | ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff ); |
| 8511 | |
| 8512 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 8513 | "WLAN TL: Eval Resume tx Res: %d DATA: %d BAP: %d MGMT: %d", |
| 8514 | pTLCb->uResCount, ucData, ucBAP, ucMgmt)); |
| 8515 | |
| 8516 | if (( 0 == pTLCb->ucTxSuspended ) && |
| 8517 | (( 0 != ucData ) || ( 0 != ucMgmt ) || ( 0 != ucBAP ) ) ) |
| 8518 | { |
| 8519 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 8520 | "Issuing Xmit start request to BAL for avail res SYNC")); |
| 8521 | vosStatus =WDA_DS_StartXmit(pvosGCtx); |
| 8522 | } |
| 8523 | return vosStatus; |
| 8524 | }/*WLANTL_GetTxResourcesCB*/ |
| 8525 | |
| 8526 | /*========================================================================== |
| 8527 | Utility functions |
| 8528 | ==========================================================================*/ |
| 8529 | |
| 8530 | /*========================================================================== |
| 8531 | FUNCTION WLANTL_Translate8023To80211Header |
| 8532 | |
| 8533 | DESCRIPTION |
| 8534 | Inline function for translating and 802.11 header into an 802.3 header. |
| 8535 | |
| 8536 | DEPENDENCIES |
| 8537 | |
| 8538 | |
| 8539 | PARAMETERS |
| 8540 | |
| 8541 | IN |
| 8542 | pTLCb: TL control block |
Kiran Venkatappa | a044eb9 | 2012-12-17 15:48:49 -0800 | [diff] [blame] | 8543 | IN/OUT |
| 8544 | ucStaId: station ID. Incase of TDLS, this returns actual TDLS |
| 8545 | station ID used |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8546 | |
| 8547 | IN/OUT |
| 8548 | vosDataBuff: vos data buffer, will contain the new header on output |
| 8549 | |
| 8550 | OUT |
| 8551 | pvosStatus: status of the operation |
| 8552 | |
| 8553 | RETURN VALUE |
| 8554 | |
| 8555 | VOS_STATUS_SUCCESS: Everything is good :) |
| 8556 | |
| 8557 | Other error codes might be returned from the vos api used in the function |
| 8558 | please check those return values. |
| 8559 | |
| 8560 | SIDE EFFECTS |
| 8561 | |
| 8562 | ============================================================================*/ |
Kiran Venkatappa | cab0d35 | 2012-12-17 13:09:22 -0800 | [diff] [blame] | 8563 | VOS_STATUS |
| 8564 | WLANTL_Translate8023To80211Header |
| 8565 | ( |
| 8566 | vos_pkt_t* vosDataBuff, |
| 8567 | VOS_STATUS* pvosStatus, |
| 8568 | WLANTL_CbType* pTLCb, |
| 8569 | v_U8_t *pucStaId, |
| 8570 | v_U8_t ucUP, |
| 8571 | v_U8_t *ucWDSEnabled, |
| 8572 | v_U8_t *extraHeadSpace |
| 8573 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8574 | { |
| 8575 | WLANTL_8023HeaderType w8023Header; |
| 8576 | WLANTL_80211HeaderType *pw80211Header; // Allocate an aligned BD and then fill it. |
| 8577 | VOS_STATUS vosStatus; |
| 8578 | v_U8_t MandatoryucHeaderSize = WLAN80211_MANDATORY_HEADER_SIZE; |
| 8579 | v_U8_t ucHeaderSize = 0; |
| 8580 | v_VOID_t *ppvBDHeader = NULL; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 8581 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8582 | v_U8_t ucQoSOffset = WLAN80211_MANDATORY_HEADER_SIZE; |
Kiran Venkatappa | cab0d35 | 2012-12-17 13:09:22 -0800 | [diff] [blame] | 8583 | v_U8_t ucStaId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8584 | |
| 8585 | *ucWDSEnabled = 0; // default WDS off. |
| 8586 | vosStatus = vos_pkt_pop_head( vosDataBuff, &w8023Header, |
| 8587 | sizeof(w8023Header)); |
| 8588 | |
| 8589 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 8590 | { |
| 8591 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 8592 | "WLAN TL: Packet pop header fails on WLANTL_Translate8023To80211Header")); |
| 8593 | return vosStatus; |
| 8594 | } |
| 8595 | |
Kiran Venkatappa | cab0d35 | 2012-12-17 13:09:22 -0800 | [diff] [blame] | 8596 | if( NULL == pucStaId ) |
| 8597 | { |
| 8598 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 8599 | "WLAN TL: Invalid pointer for StaId")); |
| 8600 | return VOS_STATUS_E_INVAL; |
| 8601 | } |
| 8602 | ucStaId = *pucStaId; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 8603 | pClientSTA = pTLCb->atlSTAClients[ucStaId]; |
| 8604 | |
| 8605 | if ( NULL == pClientSTA ) |
| 8606 | { |
| 8607 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 8608 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 8609 | return VOS_STATUS_E_FAILURE; |
| 8610 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8611 | |
Kiran Venkatappa | a044eb9 | 2012-12-17 15:48:49 -0800 | [diff] [blame] | 8612 | #ifdef FEATURE_WLAN_TDLS |
| 8613 | |
Madan Mohan Koyylamudi | 6425822 | 2013-01-30 14:35:10 +0530 | [diff] [blame] | 8614 | if ( WLAN_STA_INFRA == pTLCb->atlSTAClients[ucStaId]->wSTADesc.wSTAType |
| 8615 | && pTLCb->ucTdlsPeerCount ) |
Kiran Venkatappa | cab0d35 | 2012-12-17 13:09:22 -0800 | [diff] [blame] | 8616 | { |
| 8617 | v_U8_t ucIndex = 0; |
| 8618 | for ( ucIndex = 0; ucIndex < WLAN_MAX_STA_COUNT ; ucIndex++) |
| 8619 | { |
Madan Mohan Koyylamudi | 6425822 | 2013-01-30 14:35:10 +0530 | [diff] [blame] | 8620 | if ( ucIndex != ucStaId && pTLCb->atlSTAClients[ucIndex] && pTLCb->atlSTAClients[ucIndex]->ucExists && |
| 8621 | vos_mem_compare( (void*)pTLCb->atlSTAClients[ucIndex]->wSTADesc.vSTAMACAddress.bytes, |
Kiran Venkatappa | cab0d35 | 2012-12-17 13:09:22 -0800 | [diff] [blame] | 8622 | (void*)w8023Header.vDA, 6) ) |
| 8623 | { |
| 8624 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW, |
| 8625 | "WLAN TL: Got a TDLS station. Using that index")); |
| 8626 | ucStaId = ucIndex; |
| 8627 | *pucStaId = ucStaId; |
Madan Mohan Koyylamudi | 6425822 | 2013-01-30 14:35:10 +0530 | [diff] [blame] | 8628 | pClientSTA = pTLCb->atlSTAClients[ucStaId]; |
| 8629 | if ( NULL == pClientSTA ) |
| 8630 | { |
| 8631 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 8632 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 8633 | return VOS_STATUS_E_FAILURE; |
| 8634 | } |
Kiran Venkatappa | cab0d35 | 2012-12-17 13:09:22 -0800 | [diff] [blame] | 8635 | break; |
| 8636 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8637 | } |
Kiran Venkatappa | cab0d35 | 2012-12-17 13:09:22 -0800 | [diff] [blame] | 8638 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8639 | #endif |
| 8640 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8641 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 8642 | if ( 0 != pClientSTA->wSTADesc.ucAddRmvLLC ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8643 | { |
| 8644 | /* Push the length */ |
| 8645 | vosStatus = vos_pkt_push_head(vosDataBuff, |
| 8646 | &w8023Header.usLenType, sizeof(w8023Header.usLenType)); |
| 8647 | |
| 8648 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 8649 | { |
| 8650 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 8651 | "WLAN TL: Packet push ether type fails on" |
| 8652 | " WLANTL_Translate8023To80211Header")); |
| 8653 | return vosStatus; |
| 8654 | } |
| 8655 | |
| 8656 | #ifdef BTAMP_TEST |
| 8657 | // The STA side will execute this, a hack to test BTAMP by using the |
| 8658 | // infra setup. On real BTAMP this will come from BAP itself. |
| 8659 | { |
| 8660 | static v_U8_t WLANTL_BT_AMP_LLC_HEADER[] = {0xAA, 0xAA, 0x03, 0x00, 0x19, 0x58 }; |
| 8661 | vosStatus = vos_pkt_push_head(vosDataBuff, WLANTL_BT_AMP_LLC_HEADER, |
| 8662 | sizeof(WLANTL_BT_AMP_LLC_HEADER)); |
| 8663 | |
| 8664 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 8665 | { |
| 8666 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 8667 | "WLAN TL: Packet push LLC header fails on" |
| 8668 | " WLANTL_Translate8023To80211Header")); |
| 8669 | return vosStatus; |
| 8670 | } |
| 8671 | } |
| 8672 | #else |
| 8673 | vosStatus = vos_pkt_push_head(vosDataBuff, WLANTL_LLC_HEADER, |
| 8674 | sizeof(WLANTL_LLC_HEADER)); |
| 8675 | |
| 8676 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 8677 | { |
| 8678 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 8679 | "WLAN TL: Packet push LLC header fails on" |
| 8680 | " WLANTL_Translate8023To80211Header")); |
| 8681 | return vosStatus; |
| 8682 | } |
| 8683 | #endif |
| 8684 | }/*If add LLC is enabled*/ |
| 8685 | else |
| 8686 | { |
| 8687 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 8688 | "WLAN TL: STA Client registered to not remove LLC" |
| 8689 | " WLANTL_Translate8023To80211Header")); |
| 8690 | } |
| 8691 | |
| 8692 | #ifdef BTAMP_TEST |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 8693 | pClientSTA->wSTADesc.wSTAType = WLAN_STA_BT_AMP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8694 | #endif |
| 8695 | |
| 8696 | // Find the space required for the 802.11 header format |
| 8697 | // based on the frame control fields. |
| 8698 | ucHeaderSize = MandatoryucHeaderSize; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 8699 | if (pClientSTA->wSTADesc.ucQosEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8700 | { |
| 8701 | ucHeaderSize += sizeof(pw80211Header->usQosCtrl); |
| 8702 | } |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 8703 | if (pClientSTA->wSTADesc.wSTAType == WLAN_STA_BT_AMP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8704 | { |
| 8705 | ucHeaderSize += sizeof(pw80211Header->optvA4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8706 | ucQoSOffset += sizeof(pw80211Header->optvA4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8707 | } |
| 8708 | |
| 8709 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 8710 | " WLANTL_Translate8023To80211Header : Header size = %d ", ucHeaderSize)); |
| 8711 | |
| 8712 | vos_pkt_reserve_head( vosDataBuff, &ppvBDHeader, ucHeaderSize ); |
| 8713 | if ( NULL == ppvBDHeader ) |
| 8714 | { |
| 8715 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 8716 | "WLAN TL:VOSS packet corrupted ")); |
| 8717 | *pvosStatus = VOS_STATUS_E_INVAL; |
| 8718 | return *pvosStatus; |
| 8719 | } |
| 8720 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8721 | |
| 8722 | // OK now we have the space. Fill the 80211 header |
| 8723 | /* Fill A2 */ |
| 8724 | pw80211Header = (WLANTL_80211HeaderType *)(ppvBDHeader); |
| 8725 | // only clear the required space. |
| 8726 | vos_mem_set( pw80211Header, ucHeaderSize, 0 ); |
| 8727 | vos_mem_copy( pw80211Header->vA2, w8023Header.vSA, VOS_MAC_ADDR_SIZE); |
| 8728 | |
| 8729 | |
| 8730 | #ifdef FEATURE_WLAN_WAPI |
Gopichand Nakkala | 8b54e91 | 2013-03-11 10:44:21 +0530 | [diff] [blame] | 8731 | if (( WLANTL_STA_AUTHENTICATED == pClientSTA->tlState || |
| 8732 | pClientSTA->ptkInstalled ) && gUcIsWai != 1) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8733 | #else |
Gopichand Nakkala | 8b54e91 | 2013-03-11 10:44:21 +0530 | [diff] [blame] | 8734 | if ( WLANTL_STA_AUTHENTICATED == pClientSTA->tlState || |
| 8735 | pClientSTA->ptkInstalled ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8736 | #endif |
| 8737 | { |
| 8738 | pw80211Header->wFrmCtrl.wep = |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 8739 | pClientSTA->wSTADesc.ucProtectedFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8740 | } |
| 8741 | |
| 8742 | pw80211Header->usDurationId = 0; |
| 8743 | pw80211Header->usSeqCtrl = 0; |
| 8744 | |
| 8745 | pw80211Header->wFrmCtrl.type = WLANTL_80211_DATA_TYPE; |
| 8746 | |
| 8747 | |
| 8748 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 8749 | if(pClientSTA->wSTADesc.ucQosEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8750 | { |
| 8751 | pw80211Header->wFrmCtrl.subType = WLANTL_80211_DATA_QOS_SUBTYPE; |
| 8752 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8753 | *((v_U16_t *)((v_U8_t *)ppvBDHeader + ucQoSOffset)) = ucUP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8754 | |
| 8755 | } |
| 8756 | else |
| 8757 | { |
| 8758 | pw80211Header->wFrmCtrl.subType = 0; |
| 8759 | |
| 8760 | // NO NO NO - there is not enough memory allocated to write the QOS ctrl |
| 8761 | // field, it will overwrite the first 2 bytes of the data packet(LLC header) |
| 8762 | // pw80211Header->usQosCtrl = 0; |
| 8763 | } |
| 8764 | |
| 8765 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 8766 | switch( pClientSTA->wSTADesc.wSTAType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8767 | { |
| 8768 | case WLAN_STA_IBSS: |
| 8769 | pw80211Header->wFrmCtrl.toDS = 0; |
| 8770 | pw80211Header->wFrmCtrl.fromDS = 0; |
| 8771 | /*Fix me*/ |
| 8772 | vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1, |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 8773 | &pClientSTA->wSTADesc.vSTAMACAddress); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8774 | vos_mem_copy( pw80211Header->vA3, |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 8775 | &pClientSTA->wSTADesc.vBSSIDforIBSS , |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8776 | VOS_MAC_ADDR_SIZE); |
| 8777 | break; |
| 8778 | |
| 8779 | case WLAN_STA_BT_AMP: |
| 8780 | *ucWDSEnabled = 1; // WDS on. |
| 8781 | pw80211Header->wFrmCtrl.toDS = 1; |
| 8782 | pw80211Header->wFrmCtrl.fromDS = 1; |
| 8783 | vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1, |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 8784 | &pClientSTA->wSTADesc.vSTAMACAddress); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8785 | vos_mem_copy( pw80211Header->vA2, |
| 8786 | w8023Header.vSA, VOS_MAC_ADDR_SIZE); |
| 8787 | vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA3, |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 8788 | &pClientSTA->wSTADesc.vSTAMACAddress); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8789 | /* fill the optional A4 header */ |
| 8790 | vos_mem_copy( pw80211Header->optvA4, |
| 8791 | w8023Header.vSA, VOS_MAC_ADDR_SIZE); |
| 8792 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 8793 | "BTAMP CASE NOW ---------staid=%d\n", |
| 8794 | ucStaId)); |
| 8795 | break; |
| 8796 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8797 | case WLAN_STA_SOFTAP: |
| 8798 | *ucWDSEnabled = 0; // WDS off. |
| 8799 | pw80211Header->wFrmCtrl.toDS = 0; |
| 8800 | pw80211Header->wFrmCtrl.fromDS = 1; |
| 8801 | /*Copy the DA to A1*/ |
| 8802 | vos_mem_copy( pw80211Header->vA1, w8023Header.vDA , VOS_MAC_ADDR_SIZE); |
| 8803 | vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA2, |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 8804 | &pClientSTA->wSTADesc.vSelfMACAddress); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8805 | vos_mem_copy( pw80211Header->vA3, |
| 8806 | w8023Header.vSA, VOS_MAC_ADDR_SIZE); |
| 8807 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 8808 | "sw 802 to 80211 softap case ---------staid=%d\n", |
| 8809 | ucStaId)); |
| 8810 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8811 | #ifdef FEATURE_WLAN_TDLS |
| 8812 | case WLAN_STA_TDLS: |
| 8813 | pw80211Header->wFrmCtrl.toDS = 0; |
| 8814 | pw80211Header->wFrmCtrl.fromDS = 0; |
| 8815 | /*Fix me*/ |
| 8816 | vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1, |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 8817 | &pClientSTA->wSTADesc.vSTAMACAddress); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8818 | vos_mem_copy( pw80211Header->vA3, |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 8819 | &pClientSTA->wSTADesc.vBSSIDforIBSS , |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8820 | VOS_MAC_ADDR_SIZE); |
| 8821 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 8822 | ("TL:TDLS CASE NOW ---------staid=%d\n"), ucStaId); |
| 8823 | break; |
| 8824 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8825 | case WLAN_STA_INFRA: |
| 8826 | default: |
| 8827 | pw80211Header->wFrmCtrl.toDS = 1; |
| 8828 | pw80211Header->wFrmCtrl.fromDS = 0; |
| 8829 | vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1, |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 8830 | &pClientSTA->wSTADesc.vSTAMACAddress); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8831 | vos_mem_copy( pw80211Header->vA3, w8023Header.vDA , VOS_MAC_ADDR_SIZE); |
| 8832 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 8833 | "REGULAR INFRA LINK CASE---------staid=%d\n", |
| 8834 | ucStaId)); |
| 8835 | break; |
| 8836 | } |
| 8837 | // OK now we have the space. Fill the 80211 header |
| 8838 | /* Fill A2 */ |
| 8839 | pw80211Header = (WLANTL_80211HeaderType *)(ppvBDHeader); |
| 8840 | return VOS_STATUS_SUCCESS; |
| 8841 | }/*WLANTL_Translate8023To80211Header*/ |
| 8842 | |
| 8843 | |
| 8844 | /*============================================================================= |
| 8845 | BEGIN LOG FUNCTION !!! Remove me or clean me |
| 8846 | =============================================================================*/ |
Ravi Kumar Vaishnav | b765240 | 2013-01-18 19:05:15 -0800 | [diff] [blame] | 8847 | #if 0 //def WLANTL_DEBUG |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8848 | |
| 8849 | #define WLANTL_DEBUG_FRAME_BYTE_PER_LINE 16 |
| 8850 | #define WLANTL_DEBUG_FRAME_BYTE_PER_BYTE 4 |
| 8851 | |
| 8852 | static v_VOID_t WLANTL_DebugFrame |
| 8853 | ( |
| 8854 | v_PVOID_t dataPointer, |
| 8855 | v_U32_t dataSize |
| 8856 | ) |
| 8857 | { |
| 8858 | v_U8_t lineBuffer[WLANTL_DEBUG_FRAME_BYTE_PER_LINE]; |
| 8859 | v_U32_t numLines; |
| 8860 | v_U32_t numBytes; |
| 8861 | v_U32_t idx; |
| 8862 | v_U8_t *linePointer; |
| 8863 | |
| 8864 | numLines = dataSize / WLANTL_DEBUG_FRAME_BYTE_PER_LINE; |
| 8865 | numBytes = dataSize % WLANTL_DEBUG_FRAME_BYTE_PER_LINE; |
| 8866 | linePointer = (v_U8_t *)dataPointer; |
| 8867 | |
| 8868 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR, "WLAN TL:Frame Debug Frame Size %d, Pointer 0x%p", dataSize, dataPointer)); |
| 8869 | for(idx = 0; idx < numLines; idx++) |
| 8870 | { |
| 8871 | memset(lineBuffer, 0, WLANTL_DEBUG_FRAME_BYTE_PER_LINE); |
| 8872 | memcpy(lineBuffer, linePointer, WLANTL_DEBUG_FRAME_BYTE_PER_LINE); |
| 8873 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR, |
| 8874 | "WLAN TL:0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x 0x%2x", |
| 8875 | lineBuffer[0], lineBuffer[1], lineBuffer[2], lineBuffer[3], lineBuffer[4], lineBuffer[5], lineBuffer[6], lineBuffer[7], |
| 8876 | lineBuffer[8], lineBuffer[9], lineBuffer[10], lineBuffer[11], lineBuffer[12], lineBuffer[13], lineBuffer[14], lineBuffer[15])); |
| 8877 | linePointer += WLANTL_DEBUG_FRAME_BYTE_PER_LINE; |
| 8878 | } |
| 8879 | |
| 8880 | if(0 == numBytes) |
| 8881 | return; |
| 8882 | |
| 8883 | memset(lineBuffer, 0, WLANTL_DEBUG_FRAME_BYTE_PER_LINE); |
| 8884 | memcpy(lineBuffer, linePointer, numBytes); |
| 8885 | for(idx = 0; idx < WLANTL_DEBUG_FRAME_BYTE_PER_LINE / WLANTL_DEBUG_FRAME_BYTE_PER_BYTE; idx++) |
| 8886 | { |
| 8887 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR, "WLAN TL:0x%2x 0x%2x 0x%2x 0x%2x", |
| 8888 | lineBuffer[idx * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE], lineBuffer[1 + idx * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE], |
| 8889 | lineBuffer[2 + idx * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE], lineBuffer[3 + idx * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE])); |
| 8890 | if(((idx + 1) * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE) >= numBytes) |
| 8891 | break; |
| 8892 | } |
| 8893 | |
| 8894 | return; |
| 8895 | } |
| 8896 | #endif |
| 8897 | |
| 8898 | /*============================================================================= |
| 8899 | END LOG FUNCTION |
| 8900 | =============================================================================*/ |
| 8901 | |
| 8902 | /*========================================================================== |
| 8903 | FUNCTION WLANTL_Translate80211To8023Header |
| 8904 | |
| 8905 | DESCRIPTION |
| 8906 | Inline function for translating and 802.11 header into an 802.3 header. |
| 8907 | |
| 8908 | DEPENDENCIES |
| 8909 | |
| 8910 | |
| 8911 | PARAMETERS |
| 8912 | |
| 8913 | IN |
| 8914 | pTLCb: TL control block |
| 8915 | ucStaId: station ID |
| 8916 | ucHeaderLen: Length of the header from BD |
| 8917 | ucActualHLen: Length of header including padding or any other trailers |
| 8918 | |
| 8919 | IN/OUT |
| 8920 | vosDataBuff: vos data buffer, will contain the new header on output |
| 8921 | |
| 8922 | OUT |
| 8923 | pvosStatus: status of the operation |
| 8924 | |
| 8925 | RETURN VALUE |
| 8926 | |
| 8927 | The result code associated with performing the operation |
| 8928 | VOS_STATUS_SUCCESS: Everything is good :) |
| 8929 | |
| 8930 | SIDE EFFECTS |
| 8931 | |
| 8932 | ============================================================================*/ |
| 8933 | VOS_STATUS |
| 8934 | WLANTL_Translate80211To8023Header |
| 8935 | ( |
| 8936 | vos_pkt_t* vosDataBuff, |
| 8937 | VOS_STATUS* pvosStatus, |
| 8938 | v_U16_t usActualHLen, |
| 8939 | v_U8_t ucHeaderLen, |
| 8940 | WLANTL_CbType* pTLCb, |
| 8941 | v_U8_t ucSTAId |
| 8942 | ) |
| 8943 | { |
| 8944 | WLANTL_8023HeaderType w8023Header; |
| 8945 | WLANTL_80211HeaderType w80211Header; |
| 8946 | v_U8_t aucLLCHeader[WLANTL_LLC_HEADER_LEN]; |
| 8947 | VOS_STATUS vosStatus; |
| 8948 | v_U16_t usDataStartOffset = 0; |
| 8949 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 8950 | |
| 8951 | if ( sizeof(w80211Header) < ucHeaderLen ) |
| 8952 | { |
| 8953 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 8954 | "Warning !: Check the header size for the Rx frame structure=%d received=%dn", |
| 8955 | sizeof(w80211Header), ucHeaderLen)); |
| 8956 | ucHeaderLen = sizeof(w80211Header); |
| 8957 | } |
| 8958 | |
| 8959 | // This will take care of headers of all sizes, 3 address, 3 addr QOS, |
| 8960 | // WDS non-QOS and WDS QoS etc. We have space for all in the 802.11 header structure. |
| 8961 | vosStatus = vos_pkt_pop_head( vosDataBuff, &w80211Header, ucHeaderLen); |
| 8962 | |
| 8963 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 8964 | { |
| 8965 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 8966 | "WLAN TL: Failed to pop 80211 header from packet %d", |
| 8967 | vosStatus)); |
| 8968 | |
| 8969 | return vosStatus; |
| 8970 | } |
| 8971 | |
| 8972 | switch ( w80211Header.wFrmCtrl.fromDS ) |
| 8973 | { |
| 8974 | case 0: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8975 | if ( w80211Header.wFrmCtrl.toDS ) |
| 8976 | { |
| 8977 | //SoftAP AP mode |
| 8978 | vos_mem_copy( w8023Header.vDA, w80211Header.vA3, VOS_MAC_ADDR_SIZE); |
| 8979 | vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE); |
| 8980 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 8981 | "WLAN TL SoftAP: 802 3 DA %08x SA %08x \n", |
| 8982 | w8023Header.vDA, w8023Header.vSA)); |
| 8983 | } |
| 8984 | else |
| 8985 | { |
| 8986 | /* IBSS */ |
| 8987 | vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE); |
| 8988 | vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE); |
| 8989 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8990 | break; |
| 8991 | case 1: |
| 8992 | if ( w80211Header.wFrmCtrl.toDS ) |
| 8993 | { |
| 8994 | /* BT-AMP case */ |
| 8995 | vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE); |
| 8996 | vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE); |
| 8997 | } |
| 8998 | else |
| 8999 | { /* Infra */ |
| 9000 | vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE); |
| 9001 | vos_mem_copy( w8023Header.vSA, w80211Header.vA3, VOS_MAC_ADDR_SIZE); |
| 9002 | } |
| 9003 | break; |
| 9004 | } |
| 9005 | |
| 9006 | if( usActualHLen > ucHeaderLen ) |
| 9007 | { |
| 9008 | usDataStartOffset = usActualHLen - ucHeaderLen; |
| 9009 | } |
| 9010 | |
| 9011 | if ( 0 < usDataStartOffset ) |
| 9012 | { |
| 9013 | vosStatus = vos_pkt_trim_head( vosDataBuff, usDataStartOffset ); |
| 9014 | |
| 9015 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 9016 | { |
| 9017 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 9018 | "WLAN TL: Failed to trim header from packet %d", |
| 9019 | vosStatus)); |
| 9020 | return vosStatus; |
| 9021 | } |
| 9022 | } |
| 9023 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 9024 | if ( NULL == pTLCb->atlSTAClients[ucSTAId] ) |
| 9025 | { |
| 9026 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 9027 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 9028 | return VOS_STATUS_E_FAILURE; |
| 9029 | } |
| 9030 | |
| 9031 | if ( 0 != pTLCb->atlSTAClients[ucSTAId]->wSTADesc.ucAddRmvLLC ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9032 | { |
| 9033 | // Extract the LLC header |
| 9034 | vosStatus = vos_pkt_pop_head( vosDataBuff, aucLLCHeader, |
| 9035 | WLANTL_LLC_HEADER_LEN); |
| 9036 | |
| 9037 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 9038 | { |
| 9039 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 9040 | "WLAN TL: Failed to pop LLC header from packet %d", |
| 9041 | vosStatus)); |
| 9042 | |
| 9043 | return vosStatus; |
| 9044 | } |
| 9045 | |
| 9046 | //Extract the length |
| 9047 | vos_mem_copy(&w8023Header.usLenType, |
| 9048 | &aucLLCHeader[WLANTL_LLC_HEADER_LEN - sizeof(w8023Header.usLenType)], |
| 9049 | sizeof(w8023Header.usLenType) ); |
| 9050 | } |
| 9051 | else |
| 9052 | { |
| 9053 | vosStatus = vos_pkt_get_packet_length(vosDataBuff, |
| 9054 | &w8023Header.usLenType); |
| 9055 | |
| 9056 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 9057 | { |
| 9058 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 9059 | "WLAN TL: Failed to get packet length %d", |
| 9060 | vosStatus)); |
| 9061 | |
| 9062 | return vosStatus; |
| 9063 | } |
| 9064 | |
| 9065 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 9066 | "WLAN TL: BTAMP len (ethertype) fld = %d", |
| 9067 | w8023Header.usLenType)); |
| 9068 | w8023Header.usLenType = vos_cpu_to_be16(w8023Header.usLenType); |
| 9069 | } |
| 9070 | |
| 9071 | vos_pkt_push_head(vosDataBuff, &w8023Header, sizeof(w8023Header)); |
| 9072 | |
| 9073 | #ifdef BTAMP_TEST |
| 9074 | { |
| 9075 | // AP side will execute this. |
| 9076 | v_U8_t *temp_w8023Header = NULL; |
| 9077 | vosStatus = vos_pkt_peek_data( vosDataBuff, 0, |
| 9078 | &temp_w8023Header, sizeof(w8023Header) ); |
| 9079 | } |
| 9080 | #endif |
| 9081 | #if 0 /*TL_DEBUG*/ |
| 9082 | vos_pkt_get_packet_length(vosDataBuff, &usLen); |
| 9083 | vos_pkt_pop_head( vosDataBuff, aucData, usLen); |
| 9084 | |
| 9085 | WLANTL_DebugFrame(aucData, usLen); |
| 9086 | |
| 9087 | vos_pkt_push_head(vosDataBuff, aucData, usLen); |
| 9088 | |
| 9089 | #endif |
| 9090 | |
| 9091 | *pvosStatus = VOS_STATUS_SUCCESS; |
| 9092 | |
| 9093 | return VOS_STATUS_SUCCESS; |
| 9094 | }/*WLANTL_Translate80211To8023Header*/ |
| 9095 | |
Madan Mohan Koyyalamudi | a148e1e | 2012-11-30 14:52:59 -0800 | [diff] [blame] | 9096 | /*========================================================================== |
| 9097 | FUNCTION WLANTL_FindFrameTypeBcMcUc |
| 9098 | |
| 9099 | DESCRIPTION |
| 9100 | Utility function to find whether received frame is broadcast, multicast |
| 9101 | or unicast. |
| 9102 | |
| 9103 | DEPENDENCIES |
| 9104 | The STA must be registered with TL before this function can be called. |
| 9105 | |
| 9106 | PARAMETERS |
| 9107 | |
| 9108 | IN |
| 9109 | pTLCb: pointer to the TL's control block |
| 9110 | ucSTAId: identifier of the station being processed |
| 9111 | vosDataBuff: pointer to the vos buffer |
| 9112 | |
| 9113 | IN/OUT |
| 9114 | pucBcMcUc: pointer to buffer, will contain frame type on return |
| 9115 | |
| 9116 | RETURN VALUE |
| 9117 | The result code associated with performing the operation |
| 9118 | |
| 9119 | VOS_STATUS_E_INVAL: invalid input parameters |
| 9120 | VOS_STATUS_E_BADMSG: failed to extract info from data buffer |
| 9121 | VOS_STATUS_SUCCESS: success |
| 9122 | |
| 9123 | SIDE EFFECTS |
| 9124 | None. |
| 9125 | ============================================================================*/ |
| 9126 | VOS_STATUS |
| 9127 | WLANTL_FindFrameTypeBcMcUc |
| 9128 | ( |
| 9129 | WLANTL_CbType *pTLCb, |
| 9130 | v_U8_t ucSTAId, |
| 9131 | vos_pkt_t *vosDataBuff, |
| 9132 | v_U8_t *pucBcMcUc |
| 9133 | ) |
| 9134 | { |
| 9135 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 9136 | v_PVOID_t aucBDHeader; |
| 9137 | v_PVOID_t pvPeekData; |
| 9138 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 9139 | |
| 9140 | /*------------------------------------------------------------------------ |
| 9141 | Sanity check |
| 9142 | ------------------------------------------------------------------------*/ |
| 9143 | if ((NULL == pTLCb) || |
| 9144 | (NULL == vosDataBuff) || |
| 9145 | (NULL == pucBcMcUc)) |
| 9146 | { |
| 9147 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 9148 | "WLAN TL:Invalid parameter in WLANTL_FindFrameTypeBcMcUc")); |
| 9149 | return VOS_STATUS_E_INVAL; |
| 9150 | } |
| 9151 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 9152 | if ( NULL == pTLCb->atlSTAClients[ucSTAId] ) |
| 9153 | { |
| 9154 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 9155 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 9156 | return VOS_STATUS_E_FAILURE; |
| 9157 | } |
| 9158 | |
Madan Mohan Koyyalamudi | a148e1e | 2012-11-30 14:52:59 -0800 | [diff] [blame] | 9159 | /*------------------------------------------------------------------------ |
| 9160 | Extract BD header and check if valid |
| 9161 | ------------------------------------------------------------------------*/ |
| 9162 | vosStatus = WDA_DS_PeekRxPacketInfo(vosDataBuff, (v_PVOID_t)&aucBDHeader, 0/*Swap BD*/ ); |
| 9163 | |
| 9164 | if (NULL == aucBDHeader) |
| 9165 | { |
| 9166 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 9167 | "WLAN TL:WLANTL_FindFrameTypeBcMcUc - Cannot extract BD header")); |
| 9168 | VOS_ASSERT(0); |
| 9169 | return VOS_STATUS_E_BADMSG; |
| 9170 | } |
| 9171 | |
| 9172 | if ((0 == WDA_GET_RX_FT_DONE(aucBDHeader)) && |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 9173 | (0 != pTLCb->atlSTAClients[ucSTAId]->wSTADesc.ucSwFrameRXXlation)) |
Madan Mohan Koyyalamudi | a148e1e | 2012-11-30 14:52:59 -0800 | [diff] [blame] | 9174 | { |
| 9175 | /* Its an 802.11 frame, extract MAC address 1 */ |
| 9176 | TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 9177 | "WLAN TL:WLANTL_FindFrameTypeBcMcUc - 802.11 frame, peeking Addr1")); |
| 9178 | vosStatus = vos_pkt_peek_data(vosDataBuff, WLANTL_MAC_ADDR_ALIGN(1), |
| 9179 | (v_PVOID_t)&pvPeekData, VOS_MAC_ADDR_SIZE); |
| 9180 | } |
| 9181 | else |
| 9182 | { |
| 9183 | /* Its an 802.3 frame, extract Destination MAC address */ |
| 9184 | TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 9185 | "WLAN TL:WLANTL_FindFrameTypeBcMcUc - 802.3 frame, peeking DA")); |
| 9186 | vosStatus = vos_pkt_peek_data(vosDataBuff, WLANTL_MAC_ADDR_ALIGN(0), |
| 9187 | (v_PVOID_t)&pvPeekData, VOS_MAC_ADDR_SIZE); |
| 9188 | } |
| 9189 | |
| 9190 | if (VOS_STATUS_SUCCESS != vosStatus) |
| 9191 | { |
| 9192 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 9193 | "WLAN TL:WLANTL_FindFrameTypeBcMcUc - Failed to peek MAC address")); |
| 9194 | return vosStatus; |
| 9195 | } |
| 9196 | |
| 9197 | if (((tANI_U8 *)pvPeekData)[0] == 0xff) |
| 9198 | { |
| 9199 | *pucBcMcUc = WLANTL_FRAME_TYPE_BCAST; |
| 9200 | } |
| 9201 | else |
| 9202 | { |
| 9203 | if ((((tANI_U8 *)pvPeekData)[0] & 0x01) == 0x01) |
| 9204 | *pucBcMcUc = WLANTL_FRAME_TYPE_MCAST; |
| 9205 | else |
| 9206 | *pucBcMcUc = WLANTL_FRAME_TYPE_UCAST; |
| 9207 | } |
| 9208 | |
| 9209 | TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 9210 | "WLAN TL:WLANTL_FindFrameTypeBcMcUc - Addr1Byte1 is: %x", |
| 9211 | ((tANI_U8 *)pvPeekData)[0])); |
| 9212 | |
| 9213 | return VOS_STATUS_SUCCESS; |
| 9214 | } |
| 9215 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9216 | #if 0 |
| 9217 | #ifdef WLAN_PERF |
| 9218 | /*========================================================================== |
| 9219 | FUNCTION WLANTL_FastHwFwdDataFrame |
| 9220 | |
| 9221 | DESCRIPTION |
| 9222 | Fast path function to quickly forward a data frame if HAL determines BD |
| 9223 | signature computed here matches the signature inside current VOSS packet. |
| 9224 | If there is a match, HAL and TL fills in the swapped packet length into |
| 9225 | BD header and DxE header, respectively. Otherwise, packet goes back to |
| 9226 | normal (slow) path and a new BD signature would be tagged into BD in this |
| 9227 | VOSS packet later by the WLANHAL_FillTxBd() function. |
| 9228 | |
| 9229 | DEPENDENCIES |
| 9230 | |
| 9231 | PARAMETERS |
| 9232 | |
| 9233 | IN |
| 9234 | pvosGCtx VOS context |
| 9235 | vosDataBuff Ptr to VOSS packet |
| 9236 | pMetaInfo For getting frame's TID |
| 9237 | pStaInfo For checking STA type |
| 9238 | |
| 9239 | OUT |
| 9240 | pvosStatus returned status |
| 9241 | puFastFwdOK Flag to indicate whether frame could be fast forwarded |
| 9242 | |
| 9243 | RETURN VALUE |
| 9244 | No return. |
| 9245 | |
| 9246 | SIDE EFFECTS |
| 9247 | |
| 9248 | ============================================================================*/ |
| 9249 | static void |
| 9250 | WLANTL_FastHwFwdDataFrame |
| 9251 | ( |
| 9252 | v_PVOID_t pvosGCtx, |
| 9253 | vos_pkt_t* vosDataBuff, |
| 9254 | VOS_STATUS* pvosStatus, |
| 9255 | v_U32_t* puFastFwdOK, |
| 9256 | WLANTL_MetaInfoType* pMetaInfo, |
| 9257 | WLAN_STADescType* pStaInfo |
| 9258 | |
| 9259 | ) |
| 9260 | { |
| 9261 | v_PVOID_t pvPeekData; |
| 9262 | v_U8_t ucDxEBDWLANHeaderLen = WLANTL_BD_HEADER_LEN(0) + sizeof(WLANBAL_sDXEHeaderType); |
| 9263 | v_U8_t ucIsUnicast; |
| 9264 | WLANBAL_sDXEHeaderType *pDxEHeader; |
| 9265 | v_PVOID_t pvBDHeader; |
| 9266 | v_PVOID_t pucBuffPtr; |
| 9267 | v_U16_t usPktLen; |
| 9268 | |
| 9269 | /*----------------------------------------------------------------------- |
| 9270 | Extract packet length |
| 9271 | -----------------------------------------------------------------------*/ |
| 9272 | |
| 9273 | vos_pkt_get_packet_length( vosDataBuff, &usPktLen); |
| 9274 | |
| 9275 | /*----------------------------------------------------------------------- |
| 9276 | Extract MAC address |
| 9277 | -----------------------------------------------------------------------*/ |
| 9278 | *pvosStatus = vos_pkt_peek_data( vosDataBuff, |
| 9279 | WLANTL_MAC_ADDR_ALIGN(0), |
| 9280 | (v_PVOID_t)&pvPeekData, |
| 9281 | VOS_MAC_ADDR_SIZE ); |
| 9282 | |
| 9283 | if ( VOS_STATUS_SUCCESS != *pvosStatus ) |
| 9284 | { |
| 9285 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 9286 | "WLAN TL:Failed while attempting to extract MAC Addr %d", |
| 9287 | *pvosStatus)); |
| 9288 | *pvosStatus = VOS_STATUS_E_INVAL; |
| 9289 | return; |
| 9290 | } |
| 9291 | |
| 9292 | /*----------------------------------------------------------------------- |
| 9293 | Reserve head room for DxE header, BD, and WLAN header |
| 9294 | -----------------------------------------------------------------------*/ |
| 9295 | |
| 9296 | vos_pkt_reserve_head( vosDataBuff, &pucBuffPtr, |
| 9297 | ucDxEBDWLANHeaderLen ); |
| 9298 | if ( NULL == pucBuffPtr ) |
| 9299 | { |
| 9300 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 9301 | "WLAN TL:No enough space in VOSS packet %p for DxE/BD/WLAN header", vosDataBuff)); |
| 9302 | *pvosStatus = VOS_STATUS_E_INVAL; |
| 9303 | return; |
| 9304 | } |
| 9305 | pDxEHeader = (WLANBAL_sDXEHeaderType *)pucBuffPtr; |
| 9306 | pvBDHeader = (v_PVOID_t) &pDxEHeader[1]; |
| 9307 | |
| 9308 | /* UMA Tx acceleration is enabled. |
| 9309 | * UMA would help convert frames to 802.11, fill partial BD fields and |
| 9310 | * construct LLC header. To further accelerate this kind of frames, |
| 9311 | * HAL would attempt to reuse the BD descriptor if the BD signature |
| 9312 | * matches to the saved BD descriptor. |
| 9313 | */ |
| 9314 | if(pStaInfo->wSTAType == WLAN_STA_IBSS) |
| 9315 | ucIsUnicast = !(((tANI_U8 *)pvPeekData)[0] & 0x01); |
| 9316 | else |
| 9317 | ucIsUnicast = 1; |
| 9318 | |
| 9319 | *puFastFwdOK = (v_U32_t) WLANHAL_TxBdFastFwd(pvosGCtx, pvPeekData, pMetaInfo->ucTID, ucIsUnicast, pvBDHeader, usPktLen ); |
| 9320 | |
| 9321 | /* Can't be fast forwarded. Trim the VOS head back to original location. */ |
| 9322 | if(! *puFastFwdOK){ |
| 9323 | vos_pkt_trim_head(vosDataBuff, ucDxEBDWLANHeaderLen); |
| 9324 | }else{ |
| 9325 | /* could be fast forwarded. Now notify BAL DxE header filling could be completely skipped |
| 9326 | */ |
| 9327 | v_U32_t uPacketSize = WLANTL_BD_HEADER_LEN(0) + usPktLen; |
| 9328 | vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAL, |
| 9329 | (v_PVOID_t)uPacketSize); |
| 9330 | pDxEHeader->size = SWAP_ENDIAN_UINT32(uPacketSize); |
| 9331 | } |
| 9332 | *pvosStatus = VOS_STATUS_SUCCESS; |
| 9333 | return; |
| 9334 | } |
| 9335 | #endif /*WLAN_PERF*/ |
| 9336 | #endif |
| 9337 | |
| 9338 | #if 0 |
| 9339 | /*========================================================================== |
| 9340 | FUNCTION WLANTL_PrepareBDHeader |
| 9341 | |
| 9342 | DESCRIPTION |
| 9343 | Inline function for preparing BD header before HAL processing. |
| 9344 | |
| 9345 | DEPENDENCIES |
| 9346 | Just notify HAL that suspend in TL is complete. |
| 9347 | |
| 9348 | PARAMETERS |
| 9349 | |
| 9350 | IN |
| 9351 | vosDataBuff: vos data buffer |
| 9352 | ucDisableFrmXtl: is frame xtl disabled |
| 9353 | |
| 9354 | OUT |
| 9355 | ppvBDHeader: it will contain the BD header |
| 9356 | pvDestMacAdddr: it will contain the destination MAC address |
| 9357 | pvosStatus: status of the combined processing |
| 9358 | pusPktLen: packet len. |
| 9359 | |
| 9360 | RETURN VALUE |
| 9361 | No return. |
| 9362 | |
| 9363 | SIDE EFFECTS |
| 9364 | |
| 9365 | ============================================================================*/ |
| 9366 | void |
| 9367 | WLANTL_PrepareBDHeader |
| 9368 | ( |
| 9369 | vos_pkt_t* vosDataBuff, |
| 9370 | v_PVOID_t* ppvBDHeader, |
| 9371 | v_MACADDR_t* pvDestMacAdddr, |
| 9372 | v_U8_t ucDisableFrmXtl, |
| 9373 | VOS_STATUS* pvosStatus, |
| 9374 | v_U16_t* pusPktLen, |
| 9375 | v_U8_t ucQosEnabled, |
| 9376 | v_U8_t ucWDSEnabled, |
| 9377 | v_U8_t extraHeadSpace |
| 9378 | ) |
| 9379 | { |
| 9380 | v_U8_t ucHeaderOffset; |
| 9381 | v_U8_t ucHeaderLen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9382 | v_U8_t ucBDHeaderLen = WLANTL_BD_HEADER_LEN(ucDisableFrmXtl); |
| 9383 | |
| 9384 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 9385 | /*------------------------------------------------------------------------- |
| 9386 | Get header pointer from VOSS |
| 9387 | !!! make sure reserve head zeros out the memory |
| 9388 | -------------------------------------------------------------------------*/ |
| 9389 | vos_pkt_get_packet_length( vosDataBuff, pusPktLen); |
| 9390 | |
| 9391 | if ( WLANTL_MAC_HEADER_LEN(ucDisableFrmXtl) > *pusPktLen ) |
| 9392 | { |
| 9393 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 9394 | "WLAN TL: Length of the packet smaller than expected network" |
| 9395 | " header %d", *pusPktLen )); |
| 9396 | |
| 9397 | *pvosStatus = VOS_STATUS_E_INVAL; |
| 9398 | return; |
| 9399 | } |
| 9400 | |
| 9401 | vos_pkt_reserve_head( vosDataBuff, ppvBDHeader, |
| 9402 | ucBDHeaderLen ); |
| 9403 | if ( NULL == *ppvBDHeader ) |
| 9404 | { |
| 9405 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 9406 | "WLAN TL:VOSS packet corrupted on Attach BD header")); |
| 9407 | *pvosStatus = VOS_STATUS_E_INVAL; |
| 9408 | return; |
| 9409 | } |
| 9410 | |
| 9411 | /*----------------------------------------------------------------------- |
| 9412 | Extract MAC address |
| 9413 | -----------------------------------------------------------------------*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9414 | { |
| 9415 | v_SIZE_t usMacAddrSize = VOS_MAC_ADDR_SIZE; |
| 9416 | *pvosStatus = vos_pkt_extract_data( vosDataBuff, |
| 9417 | ucBDHeaderLen + |
| 9418 | WLANTL_MAC_ADDR_ALIGN(ucDisableFrmXtl), |
| 9419 | (v_PVOID_t)pvDestMacAdddr, |
| 9420 | &usMacAddrSize ); |
| 9421 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9422 | if ( VOS_STATUS_SUCCESS != *pvosStatus ) |
| 9423 | { |
| 9424 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 9425 | "WLAN TL:Failed while attempting to extract MAC Addr %d", |
| 9426 | *pvosStatus)); |
| 9427 | } |
| 9428 | else |
| 9429 | { |
| 9430 | /*--------------------------------------------------------------------- |
| 9431 | Fill MPDU info fields: |
| 9432 | - MPDU data start offset |
| 9433 | - MPDU header start offset |
| 9434 | - MPDU header length |
| 9435 | - MPDU length - this is a 16b field - needs swapping |
| 9436 | --------------------------------------------------------------------*/ |
| 9437 | ucHeaderOffset = ucBDHeaderLen; |
| 9438 | ucHeaderLen = WLANTL_MAC_HEADER_LEN(ucDisableFrmXtl); |
| 9439 | |
| 9440 | if ( 0 != ucDisableFrmXtl ) |
| 9441 | { |
| 9442 | if ( 0 != ucQosEnabled ) |
| 9443 | { |
| 9444 | ucHeaderLen += WLANTL_802_11_HEADER_QOS_CTL; |
| 9445 | } |
| 9446 | |
| 9447 | // Similar to Qos we need something for WDS format ! |
| 9448 | if ( ucWDSEnabled != 0 ) |
| 9449 | { |
| 9450 | // If we have frame translation enabled |
| 9451 | ucHeaderLen += WLANTL_802_11_HEADER_ADDR4_LEN; |
| 9452 | } |
| 9453 | if ( extraHeadSpace != 0 ) |
| 9454 | { |
| 9455 | // Decrease the packet length with the extra padding after the header |
| 9456 | *pusPktLen = *pusPktLen - extraHeadSpace; |
| 9457 | } |
| 9458 | } |
| 9459 | |
| 9460 | WLANHAL_TX_BD_SET_MPDU_HEADER_LEN( *ppvBDHeader, ucHeaderLen); |
| 9461 | WLANHAL_TX_BD_SET_MPDU_HEADER_OFFSET( *ppvBDHeader, ucHeaderOffset); |
| 9462 | WLANHAL_TX_BD_SET_MPDU_DATA_OFFSET( *ppvBDHeader, |
| 9463 | ucHeaderOffset + ucHeaderLen + extraHeadSpace); |
| 9464 | WLANHAL_TX_BD_SET_MPDU_LEN( *ppvBDHeader, *pusPktLen); |
| 9465 | |
| 9466 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 9467 | "WLAN TL: VALUES ARE HLen=%x Hoff=%x doff=%x len=%x ex=%d", |
| 9468 | ucHeaderLen, ucHeaderOffset, |
| 9469 | (ucHeaderOffset + ucHeaderLen + extraHeadSpace), |
| 9470 | *pusPktLen, extraHeadSpace)); |
| 9471 | }/* if peek MAC success*/ |
| 9472 | |
| 9473 | }/* WLANTL_PrepareBDHeader */ |
| 9474 | #endif |
| 9475 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9476 | //THIS IS A HACK AND NEEDS TO BE FIXED FOR CONCURRENCY |
| 9477 | /*========================================================================== |
| 9478 | FUNCTION WLAN_TLGetNextTxIds |
| 9479 | |
| 9480 | DESCRIPTION |
| 9481 | Gets the next station and next AC in the list that should be served by the TL. |
| 9482 | |
| 9483 | Multiple Station Scheduling and TL queue management. |
| 9484 | |
| 9485 | 4 HDD BC/MC data packet queue status is specified as Station 0's status. Weights used |
| 9486 | in WFQ algorith are initialized in WLANTL_OPEN and contained in tlConfigInfo field. |
| 9487 | Each station has fields of ucPktPending and AC mask to tell whether a AC has traffic |
| 9488 | or not. |
| 9489 | |
| 9490 | Stations are served in a round-robin fashion from highest priority to lowest priority. |
| 9491 | The number of round-robin times of each prioirty equals to the WFQ weights and differetiates |
| 9492 | the traffic of different prioirty. As such, stations can not provide low priority packets if |
| 9493 | high priority packets are all served. |
| 9494 | |
| 9495 | DEPENDENCIES |
| 9496 | |
| 9497 | PARAMETERS |
| 9498 | |
| 9499 | IN |
| 9500 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 9501 | control block can be extracted from its context |
| 9502 | |
| 9503 | OUT |
| 9504 | pucSTAId: Station ID |
| 9505 | |
| 9506 | RETURN VALUE |
| 9507 | The result code associated with performing the operation |
| 9508 | |
| 9509 | VOS_STATUS_SUCCESS: Everything is good |
| 9510 | |
| 9511 | SIDE EFFECTS |
| 9512 | |
| 9513 | TL context contains currently served station ID in ucCurrentSTA field, currently served AC |
| 9514 | in uCurServedAC field, and unserved weights of current AC in uCurLeftWeight. |
| 9515 | When existing from the function, these three fields are changed accordingly. |
| 9516 | |
| 9517 | ============================================================================*/ |
| 9518 | VOS_STATUS |
| 9519 | WLAN_TLAPGetNextTxIds |
| 9520 | ( |
| 9521 | v_PVOID_t pvosGCtx, |
| 9522 | v_U8_t* pucSTAId |
| 9523 | ) |
| 9524 | { |
| 9525 | WLANTL_CbType* pTLCb; |
| 9526 | v_U8_t ucACFilter = 1; |
| 9527 | v_U8_t ucNextSTA ; |
| 9528 | v_BOOL_t isServed = TRUE; //current round has find a packet or not |
| 9529 | v_U8_t ucACLoopNum = WLANTL_AC_VO + 1; //number of loop to go |
| 9530 | v_U8_t uFlowMask; // TX FlowMask from WDA |
| 9531 | uint8 ucACMask; |
Gopichand Nakkala | 96237bc | 2013-01-04 12:20:29 -0800 | [diff] [blame] | 9532 | uint8 i = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9533 | /*------------------------------------------------------------------------ |
| 9534 | Extract TL control block |
| 9535 | ------------------------------------------------------------------------*/ |
| 9536 | //ENTER(); |
| 9537 | |
| 9538 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 9539 | if ( NULL == pTLCb ) |
| 9540 | { |
| 9541 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 9542 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLAN_TLAPGetNextTxIds")); |
| 9543 | return VOS_STATUS_E_FAULT; |
| 9544 | } |
| 9545 | |
| 9546 | if ( VOS_STATUS_SUCCESS != WDA_DS_GetTxFlowMask( pvosGCtx, &uFlowMask ) ) |
| 9547 | { |
| 9548 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 9549 | "WLAN TL:Failed to retrieve Flow control mask from WDA")); |
| 9550 | return VOS_STATUS_E_FAULT; |
| 9551 | } |
| 9552 | |
| 9553 | ucNextSTA = pTLCb->ucCurrentSTA; |
| 9554 | |
| 9555 | ++ucNextSTA; |
| 9556 | |
| 9557 | if ( WLAN_MAX_STA_COUNT <= ucNextSTA ) |
| 9558 | { |
| 9559 | //one round is done. |
| 9560 | ucNextSTA = 0; |
| 9561 | pTLCb->ucCurLeftWeight--; |
| 9562 | isServed = FALSE; |
| 9563 | if ( 0 == pTLCb->ucCurLeftWeight ) |
| 9564 | { |
| 9565 | //current prioirty is done |
| 9566 | if ( WLANTL_AC_BK == (WLANTL_ACEnumType)pTLCb->uCurServedAC ) |
| 9567 | { |
| 9568 | //end of current VO, VI, BE, BK loop. Reset priority. |
| 9569 | pTLCb->uCurServedAC = WLANTL_AC_VO; |
| 9570 | } |
| 9571 | else |
| 9572 | { |
| 9573 | pTLCb->uCurServedAC --; |
| 9574 | } |
| 9575 | |
| 9576 | pTLCb->ucCurLeftWeight = pTLCb->tlConfigInfo.ucAcWeights[pTLCb->uCurServedAC]; |
| 9577 | |
| 9578 | } // (0 == pTLCb->ucCurLeftWeight) |
| 9579 | } //( WLAN_MAX_STA_COUNT == ucNextSTA ) |
| 9580 | |
| 9581 | //decide how many loops to go. if current loop is partial, do one extra to make sure |
| 9582 | //we cover every station |
| 9583 | if ((1 == pTLCb->ucCurLeftWeight) && (ucNextSTA != 0)) |
| 9584 | { |
| 9585 | ucACLoopNum ++; // now is 5 loops |
| 9586 | } |
| 9587 | |
| 9588 | /* Start with highest priority. ucNextSTA, pTLCb->uCurServedAC, pTLCb->ucCurLeftWeight |
| 9589 | all have previous values.*/ |
| 9590 | for (; ucACLoopNum > 0; ucACLoopNum--) |
| 9591 | { |
| 9592 | |
| 9593 | ucACFilter = 1 << pTLCb->uCurServedAC; |
| 9594 | |
| 9595 | // pTLCb->ucCurLeftWeight keeps previous results. |
| 9596 | for (; (pTLCb->ucCurLeftWeight > 0) && (uFlowMask & ucACFilter); pTLCb->ucCurLeftWeight-- ) |
| 9597 | { |
| 9598 | |
| 9599 | for ( ; ucNextSTA < WLAN_MAX_STA_COUNT; ucNextSTA ++ ) |
| 9600 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 9601 | if(NULL == pTLCb->atlSTAClients[ucNextSTA]) |
| 9602 | { |
| 9603 | continue; |
| 9604 | } |
| 9605 | WLAN_TL_AC_ARRAY_2_MASK (pTLCb->atlSTAClients[ucNextSTA], ucACMask, i); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9606 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 9607 | if ( (0 == pTLCb->atlSTAClients[ucNextSTA]->ucExists) || |
| 9608 | ((0 == pTLCb->atlSTAClients[ucNextSTA]->ucPktPending) && !(ucACMask)) || |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9609 | (0 == (ucACMask & ucACFilter)) ) |
| 9610 | |
| 9611 | { |
Tushnim Bhattacharyya | 39a8f18 | 2013-02-20 18:10:30 -0800 | [diff] [blame] | 9612 | //current station does not exist or have any packet to serve. |
| 9613 | continue; |
| 9614 | } |
| 9615 | |
| 9616 | if (WLANTL_STA_AUTHENTICATED != pTLCb->atlSTAClients[ucNextSTA]->tlState) |
| 9617 | { |
| 9618 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 9619 | "%s Sta %d not in auth state so skipping it.", |
| 9620 | __func__, ucNextSTA)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9621 | continue; |
| 9622 | } |
| 9623 | |
| 9624 | //go to next station if current station can't send due to flow control |
| 9625 | //Station is allowed to send when it is not in LWM mode. When station is in LWM mode, |
| 9626 | //station is allowed to send only after FW reports FW memory is below threshold and on-fly |
| 9627 | //packets are less then allowed value |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 9628 | if ( (TRUE == pTLCb->atlSTAClients[ucNextSTA]->ucLwmModeEnabled) && |
| 9629 | ((FALSE == pTLCb->atlSTAClients[ucNextSTA]->ucLwmEventReported) || |
| 9630 | (0 < pTLCb->atlSTAClients[ucNextSTA]->uBuffThresholdMax)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9631 | ) |
| 9632 | { |
| 9633 | continue; |
| 9634 | } |
| 9635 | |
| 9636 | |
| 9637 | // Find a station. Weight is updated already. |
| 9638 | *pucSTAId = ucNextSTA; |
| 9639 | pTLCb->ucCurrentSTA = ucNextSTA; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 9640 | pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC = pTLCb->uCurServedAC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9641 | |
| 9642 | TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW, |
| 9643 | " TL serve one station AC: %d W: %d StaId: %d", |
| 9644 | pTLCb->uCurServedAC, pTLCb->ucCurLeftWeight, pTLCb->ucCurrentSTA )); |
| 9645 | |
| 9646 | return VOS_STATUS_SUCCESS; |
| 9647 | } //STA loop |
| 9648 | |
| 9649 | ucNextSTA = 0; |
| 9650 | if ( FALSE == isServed ) |
| 9651 | { |
| 9652 | //current loop finds no packet.no need to repeat for the same priority |
| 9653 | break; |
| 9654 | } |
| 9655 | //current loop is partial loop. go for one more loop. |
| 9656 | isServed = FALSE; |
| 9657 | |
| 9658 | } //Weight loop |
| 9659 | |
| 9660 | if (WLANTL_AC_BK == pTLCb->uCurServedAC) |
| 9661 | { |
| 9662 | pTLCb->uCurServedAC = WLANTL_AC_VO; |
| 9663 | } |
| 9664 | else |
| 9665 | { |
| 9666 | pTLCb->uCurServedAC--; |
| 9667 | } |
| 9668 | pTLCb->ucCurLeftWeight = pTLCb->tlConfigInfo.ucAcWeights[pTLCb->uCurServedAC]; |
| 9669 | |
| 9670 | }// AC loop |
| 9671 | |
| 9672 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 9673 | " TL can't find one station to serve \n" )); |
| 9674 | |
| 9675 | pTLCb->uCurServedAC = WLANTL_AC_BK; |
| 9676 | pTLCb->ucCurLeftWeight = 1; |
| 9677 | //invalid number will be captured by caller |
| 9678 | pTLCb->ucCurrentSTA = WLAN_MAX_STA_COUNT; |
| 9679 | |
| 9680 | *pucSTAId = pTLCb->ucCurrentSTA; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9681 | return VOS_STATUS_E_FAULT; |
| 9682 | } |
| 9683 | |
| 9684 | |
| 9685 | /*========================================================================== |
| 9686 | FUNCTION WLAN_TLGetNextTxIds |
| 9687 | |
| 9688 | DESCRIPTION |
| 9689 | Gets the next station and next AC in the list |
| 9690 | |
| 9691 | DEPENDENCIES |
| 9692 | |
| 9693 | PARAMETERS |
| 9694 | |
| 9695 | IN |
| 9696 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 9697 | control block can be extracted from its context |
| 9698 | |
| 9699 | OUT |
| 9700 | pucSTAId: Station ID |
| 9701 | |
| 9702 | |
| 9703 | RETURN VALUE |
| 9704 | The result code associated with performing the operation |
| 9705 | |
| 9706 | VOS_STATUS_SUCCESS: Everything is good :) |
| 9707 | |
| 9708 | SIDE EFFECTS |
| 9709 | |
| 9710 | ============================================================================*/ |
| 9711 | VOS_STATUS |
| 9712 | WLAN_TLGetNextTxIds |
| 9713 | ( |
| 9714 | v_PVOID_t pvosGCtx, |
| 9715 | v_U8_t* pucSTAId |
| 9716 | ) |
| 9717 | { |
| 9718 | WLANTL_CbType* pTLCb; |
| 9719 | v_U8_t ucNextAC; |
| 9720 | v_U8_t ucNextSTA; |
| 9721 | v_U8_t ucCount; |
| 9722 | v_U8_t uFlowMask; // TX FlowMask from WDA |
| 9723 | v_U8_t ucACMask = 0; |
| 9724 | v_U8_t i = 0; |
| 9725 | |
| 9726 | tBssSystemRole systemRole; //RG HACK to be removed |
| 9727 | tpAniSirGlobal pMac; |
| 9728 | |
| 9729 | pMac = vos_get_context(VOS_MODULE_ID_PE, pvosGCtx); |
| 9730 | if ( NULL == pMac ) |
| 9731 | { |
| 9732 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9733 | "%s: Invalid pMac", __func__)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9734 | return VOS_STATUS_E_FAULT; |
| 9735 | } |
| 9736 | |
| 9737 | systemRole = wdaGetGlobalSystemRole(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9738 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9739 | /*------------------------------------------------------------------------ |
| 9740 | Extract TL control block |
| 9741 | ------------------------------------------------------------------------*/ |
| 9742 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 9743 | if ( NULL == pTLCb ) |
| 9744 | { |
| 9745 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 9746 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLAN_TLGetNextTxIds")); |
| 9747 | return VOS_STATUS_E_FAULT; |
| 9748 | } |
| 9749 | |
Sunil Ravi | d5406f2 | 2013-01-22 00:18:31 -0800 | [diff] [blame] | 9750 | #ifdef FEATURE_WLAN_TDLS |
| 9751 | if ((eSYSTEM_AP_ROLE == systemRole) || (vos_concurrent_sessions_running()) || pTLCb->ucTdlsPeerCount) |
| 9752 | #else |
| 9753 | if ((eSYSTEM_AP_ROLE == systemRole) || (vos_concurrent_sessions_running())) |
| 9754 | #endif |
| 9755 | { |
| 9756 | return WLAN_TLAPGetNextTxIds(pvosGCtx,pucSTAId); |
| 9757 | } |
| 9758 | |
| 9759 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9760 | if ( VOS_STATUS_SUCCESS != WDA_DS_GetTxFlowMask( pvosGCtx, &uFlowMask ) ) |
| 9761 | { |
| 9762 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 9763 | "WLAN TL:Failed to retrieve Flow control mask from WDA")); |
| 9764 | return VOS_STATUS_E_FAULT; |
| 9765 | } |
| 9766 | |
| 9767 | /*STA id - no priority yet implemented */ |
| 9768 | /*----------------------------------------------------------------------- |
| 9769 | Choose the next STA for tx - for now go in a round robin fashion |
| 9770 | through all the stations that have pending packets |
| 9771 | -------------------------------------------------------------------------*/ |
| 9772 | ucNextSTA = pTLCb->ucCurrentSTA; |
| 9773 | |
| 9774 | pTLCb->ucCurrentSTA = WLAN_MAX_STA_COUNT; |
| 9775 | for ( ucCount = 0; |
| 9776 | ucCount < WLAN_MAX_STA_COUNT; |
| 9777 | ucCount++ ) |
| 9778 | { |
| 9779 | ucNextSTA = ( (ucNextSTA+1) >= WLAN_MAX_STA_COUNT )?0:(ucNextSTA+1); |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 9780 | if(NULL == pTLCb->atlSTAClients[ucNextSTA]) |
| 9781 | { |
| 9782 | continue; |
| 9783 | } |
| 9784 | if (( pTLCb->atlSTAClients[ucNextSTA]->ucExists ) && |
| 9785 | ( pTLCb->atlSTAClients[ucNextSTA]->ucPktPending )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9786 | { |
Tushnim Bhattacharyya | 39a8f18 | 2013-02-20 18:10:30 -0800 | [diff] [blame] | 9787 | if (WLANTL_STA_AUTHENTICATED == pTLCb->atlSTAClients[ucNextSTA]->tlState) |
| 9788 | { |
| 9789 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 9790 | "STA ID: %d on WLAN_TLGetNextTxIds", *pucSTAId)); |
| 9791 | pTLCb->ucCurrentSTA = ucNextSTA; |
| 9792 | break; |
Tushnim Bhattacharyya | 5dd9456 | 2013-03-20 20:15:03 -0700 | [diff] [blame] | 9793 | } |
| 9794 | else |
| 9795 | { |
Tushnim Bhattacharyya | 39a8f18 | 2013-02-20 18:10:30 -0800 | [diff] [blame] | 9796 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 9797 | "%s Sta %d is not in auth state, skipping this sta.", |
| 9798 | __func__, ucNextSTA)); |
Tushnim Bhattacharyya | 5dd9456 | 2013-03-20 20:15:03 -0700 | [diff] [blame] | 9799 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9800 | } |
| 9801 | } |
| 9802 | |
| 9803 | *pucSTAId = pTLCb->ucCurrentSTA; |
| 9804 | |
| 9805 | if ( WLANTL_STA_ID_INVALID( *pucSTAId ) ) |
| 9806 | { |
| 9807 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 9808 | "WLAN TL:No station registered with TL at this point")); |
| 9809 | |
| 9810 | return VOS_STATUS_E_FAULT; |
| 9811 | |
| 9812 | } |
| 9813 | |
| 9814 | /*Convert the array to a mask for easier operation*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 9815 | WLAN_TL_AC_ARRAY_2_MASK( pTLCb->atlSTAClients[*pucSTAId], ucACMask, i); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9816 | |
| 9817 | if ( 0 == ucACMask ) |
| 9818 | { |
| 9819 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 9820 | "WLAN TL: Mask 0 " |
| 9821 | "STA ID: %d on WLAN_TLGetNextTxIds", *pucSTAId)); |
| 9822 | |
| 9823 | /*setting STA id to invalid if mask is 0*/ |
| 9824 | *pucSTAId = WLAN_MAX_STA_COUNT; |
| 9825 | |
| 9826 | return VOS_STATUS_E_FAULT; |
| 9827 | } |
| 9828 | |
| 9829 | /*----------------------------------------------------------------------- |
| 9830 | AC is updated whenever a packet is fetched from HDD -> the current |
| 9831 | weight of such an AC cannot be 0 -> in this case TL is expected to |
| 9832 | exit this function at this point during the main Tx loop |
| 9833 | -----------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 9834 | if ( 0 < pTLCb->atlSTAClients[*pucSTAId]->ucCurrentWeight ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9835 | { |
| 9836 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 9837 | "WLAN TL: Maintaining serviced AC to: %d for Weight: %d", |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 9838 | pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC , |
| 9839 | pTLCb->atlSTAClients[*pucSTAId]->ucCurrentWeight)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9840 | return VOS_STATUS_SUCCESS; |
| 9841 | } |
| 9842 | |
| 9843 | /*----------------------------------------------------------------------- |
| 9844 | Choose highest priority AC - !!! optimize me |
| 9845 | -----------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 9846 | ucNextAC = pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9847 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 9848 | "Next AC: %d", ucNextAC)); |
| 9849 | |
| 9850 | while ( 0 != ucACMask ) |
| 9851 | { |
| 9852 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 9853 | " AC Mask: %d Next: %d Res : %d", |
| 9854 | ucACMask, ( 1 << ucNextAC ), ( ucACMask & ( 1 << ucNextAC )))); |
| 9855 | |
| 9856 | if ( 0 != ( ucACMask & ( 1 << ucNextAC ) & uFlowMask )) |
| 9857 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 9858 | pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9859 | (WLANTL_ACEnumType)ucNextAC; |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 9860 | pTLCb->atlSTAClients[*pucSTAId]->ucCurrentWeight = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9861 | pTLCb->tlConfigInfo.ucAcWeights[ucNextAC]; |
| 9862 | |
| 9863 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 9864 | "WLAN TL: Switching serviced AC to: %d with Weight: %d", |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 9865 | pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC , |
| 9866 | pTLCb->atlSTAClients[*pucSTAId]->ucCurrentWeight)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9867 | break; |
| 9868 | } |
| 9869 | |
| 9870 | ucNextAC = ( ucNextAC - 1 ) & WLANTL_MASK_AC; |
| 9871 | |
| 9872 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 9873 | "Next AC %d", ucNextAC)); |
| 9874 | |
| 9875 | } |
| 9876 | |
| 9877 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 9878 | " C AC: %d C W: %d", |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 9879 | pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC, |
| 9880 | pTLCb->atlSTAClients[*pucSTAId]->ucCurrentWeight)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9881 | |
| 9882 | return VOS_STATUS_SUCCESS; |
| 9883 | }/* WLAN_TLGetNextTxIds */ |
| 9884 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9885 | |
| 9886 | |
| 9887 | /*========================================================================== |
| 9888 | DEFAULT HANDLERS: Registered at initialization with TL |
| 9889 | ==========================================================================*/ |
| 9890 | |
| 9891 | /*========================================================================== |
| 9892 | |
| 9893 | FUNCTION WLANTL_MgmtFrmRxDefaultCb |
| 9894 | |
| 9895 | DESCRIPTION |
| 9896 | Default Mgmt Frm rx callback: asserts all the time. If this function gets |
| 9897 | called it means there is no registered rx cb pointer for Mgmt Frm. |
| 9898 | |
| 9899 | DEPENDENCIES |
| 9900 | |
| 9901 | PARAMETERS |
| 9902 | Not used. |
| 9903 | |
| 9904 | RETURN VALUE |
| 9905 | |
| 9906 | VOS_STATUS_E_FAILURE: Always FAILURE. |
| 9907 | |
| 9908 | ============================================================================*/ |
| 9909 | VOS_STATUS |
| 9910 | WLANTL_MgmtFrmRxDefaultCb |
| 9911 | ( |
| 9912 | v_PVOID_t pvosGCtx, |
| 9913 | v_PVOID_t vosBuff |
| 9914 | ) |
| 9915 | { |
| 9916 | if ( NULL != vosBuff ) |
| 9917 | { |
| 9918 | TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL, |
| 9919 | "WLAN TL:Fatal failure: No registered Mgmt Frm client on pkt RX")); |
| 9920 | /* Drop packet */ |
| 9921 | vos_pkt_return_packet((vos_pkt_t *)vosBuff); |
| 9922 | } |
| 9923 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9924 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 9925 | "WLAN TL: No registered Mgmt Frm client on pkt RX. Load/Unload in progress, Ignore")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9926 | |
| 9927 | return VOS_STATUS_E_FAILURE; |
| 9928 | }/*WLANTL_MgmtFrmRxDefaultCb*/ |
| 9929 | |
| 9930 | /*========================================================================== |
| 9931 | |
| 9932 | FUNCTION WLANTL_STARxDefaultCb |
| 9933 | |
| 9934 | DESCRIPTION |
| 9935 | Default BAP rx callback: asserts all the time. If this function gets |
| 9936 | called it means there is no registered rx cb pointer for BAP. |
| 9937 | |
| 9938 | DEPENDENCIES |
| 9939 | |
| 9940 | PARAMETERS |
| 9941 | Not used. |
| 9942 | |
| 9943 | RETURN VALUE |
| 9944 | |
| 9945 | VOS_STATUS_E_FAILURE: Always FAILURE. |
| 9946 | |
| 9947 | ============================================================================*/ |
| 9948 | VOS_STATUS |
| 9949 | WLANTL_BAPRxDefaultCb |
| 9950 | ( |
| 9951 | v_PVOID_t pvosGCtx, |
| 9952 | vos_pkt_t* vosDataBuff, |
| 9953 | WLANTL_BAPFrameEnumType frameType |
| 9954 | ) |
| 9955 | { |
| 9956 | TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL, |
| 9957 | "WLAN TL:Fatal failure: No registered BAP client on BAP pkt RX")); |
| 9958 | #ifndef BTAMP_TEST |
| 9959 | VOS_ASSERT(0); |
| 9960 | #endif |
| 9961 | return VOS_STATUS_E_FAILURE; |
| 9962 | }/*WLANTL_MgmtFrmRxDefaultCb*/ |
| 9963 | |
| 9964 | /*========================================================================== |
| 9965 | |
| 9966 | FUNCTION WLANTL_STARxDefaultCb |
| 9967 | |
| 9968 | DESCRIPTION |
| 9969 | Default STA rx callback: asserts all the time. If this function gets |
| 9970 | called it means there is no registered rx cb pointer for station. |
| 9971 | (Mem corruption most likely, it should never happen) |
| 9972 | |
| 9973 | DEPENDENCIES |
| 9974 | |
| 9975 | PARAMETERS |
| 9976 | Not used. |
| 9977 | |
| 9978 | RETURN VALUE |
| 9979 | |
| 9980 | VOS_STATUS_E_FAILURE: Always FAILURE. |
| 9981 | |
| 9982 | ============================================================================*/ |
| 9983 | VOS_STATUS |
| 9984 | WLANTL_STARxDefaultCb |
| 9985 | ( |
| 9986 | v_PVOID_t pvosGCtx, |
| 9987 | vos_pkt_t* vosDataBuff, |
| 9988 | v_U8_t ucSTAId, |
| 9989 | WLANTL_RxMetaInfoType* pRxMetaInfo |
| 9990 | ) |
| 9991 | { |
| 9992 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 9993 | "WLAN TL: No registered STA client rx cb for STAID: %d dropping pkt", |
| 9994 | ucSTAId)); |
| 9995 | vos_pkt_return_packet(vosDataBuff); |
| 9996 | return VOS_STATUS_E_FAILURE; |
| 9997 | }/*WLANTL_MgmtFrmRxDefaultCb*/ |
| 9998 | |
| 9999 | |
| 10000 | /*========================================================================== |
| 10001 | |
| 10002 | FUNCTION WLANTL_STAFetchPktDefaultCb |
| 10003 | |
| 10004 | DESCRIPTION |
| 10005 | Default fetch callback: asserts all the time. If this function gets |
| 10006 | called it means there is no registered fetch cb pointer for station. |
| 10007 | (Mem corruption most likely, it should never happen) |
| 10008 | |
| 10009 | DEPENDENCIES |
| 10010 | |
| 10011 | PARAMETERS |
| 10012 | Not used. |
| 10013 | |
| 10014 | RETURN VALUE |
| 10015 | |
| 10016 | VOS_STATUS_E_FAILURE: Always FAILURE. |
| 10017 | |
| 10018 | ============================================================================*/ |
| 10019 | VOS_STATUS |
| 10020 | WLANTL_STAFetchPktDefaultCb |
| 10021 | ( |
| 10022 | v_PVOID_t pvosGCtx, |
| 10023 | v_U8_t* pucSTAId, |
| 10024 | WLANTL_ACEnumType ucAC, |
| 10025 | vos_pkt_t** vosDataBuff, |
| 10026 | WLANTL_MetaInfoType* tlMetaInfo |
| 10027 | ) |
| 10028 | { |
| 10029 | TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL, |
| 10030 | "WLAN TL:Fatal failure: No registered STA client on data pkt RX")); |
| 10031 | VOS_ASSERT(0); |
| 10032 | return VOS_STATUS_E_FAILURE; |
| 10033 | }/*WLANTL_MgmtFrmRxDefaultCb*/ |
| 10034 | |
| 10035 | /*========================================================================== |
| 10036 | |
| 10037 | FUNCTION WLANTL_TxCompDefaultCb |
| 10038 | |
| 10039 | DESCRIPTION |
| 10040 | Default tx complete handler. It will release the completed pkt to |
| 10041 | prevent memory leaks. |
| 10042 | |
| 10043 | PARAMETERS |
| 10044 | |
| 10045 | IN |
| 10046 | pvosGCtx: pointer to the global vos context; a handle to |
| 10047 | TL/HAL/PE/BAP/HDD control block can be extracted from |
| 10048 | its context |
| 10049 | vosDataBuff: pointer to the VOSS data buffer that was transmitted |
| 10050 | wTxSTAtus: status of the transmission |
| 10051 | |
| 10052 | |
| 10053 | RETURN VALUE |
| 10054 | The result code associated with performing the operation; please |
| 10055 | check vos_pkt_return_packet for possible error codes. |
| 10056 | |
| 10057 | Please check vos_pkt_return_packet API for possible return values. |
| 10058 | |
| 10059 | ============================================================================*/ |
| 10060 | VOS_STATUS |
| 10061 | WLANTL_TxCompDefaultCb |
| 10062 | ( |
| 10063 | v_PVOID_t pvosGCtx, |
| 10064 | vos_pkt_t* vosDataBuff, |
| 10065 | VOS_STATUS wTxSTAtus |
| 10066 | ) |
| 10067 | { |
| 10068 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 10069 | "WLAN TL:TXComp not registered, releasing pkt to prevent mem leak")); |
| 10070 | return vos_pkt_return_packet(vosDataBuff); |
| 10071 | }/*WLANTL_TxCompDefaultCb*/ |
| 10072 | |
| 10073 | |
| 10074 | /*========================================================================== |
| 10075 | Cleanup functions |
| 10076 | ==========================================================================*/ |
| 10077 | |
| 10078 | /*========================================================================== |
| 10079 | |
| 10080 | FUNCTION WLANTL_CleanCB |
| 10081 | |
| 10082 | DESCRIPTION |
| 10083 | Cleans TL control block |
| 10084 | |
| 10085 | DEPENDENCIES |
| 10086 | |
| 10087 | PARAMETERS |
| 10088 | |
| 10089 | IN |
| 10090 | pTLCb: pointer to TL's control block |
| 10091 | ucEmpty: set if TL has to clean up the queues and release pedning pkts |
| 10092 | |
| 10093 | RETURN VALUE |
| 10094 | The result code associated with performing the operation |
| 10095 | |
| 10096 | VOS_STATUS_E_INVAL: invalid input parameters |
| 10097 | VOS_STATUS_SUCCESS: Everything is good :) |
| 10098 | |
| 10099 | SIDE EFFECTS |
| 10100 | |
| 10101 | ============================================================================*/ |
| 10102 | VOS_STATUS |
| 10103 | WLANTL_CleanCB |
| 10104 | ( |
| 10105 | WLANTL_CbType* pTLCb, |
| 10106 | v_U8_t ucEmpty |
| 10107 | ) |
| 10108 | { |
| 10109 | v_U8_t ucIndex; |
| 10110 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 10111 | |
| 10112 | /*------------------------------------------------------------------------- |
| 10113 | Sanity check |
| 10114 | -------------------------------------------------------------------------*/ |
| 10115 | if ( NULL == pTLCb ) |
| 10116 | { |
| 10117 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 10118 | "WLAN TL:Invalid parameter sent on WLANTL_CleanCB")); |
| 10119 | return VOS_STATUS_E_INVAL; |
| 10120 | } |
| 10121 | |
| 10122 | /* number of packets sent to BAL waiting for tx complete confirmation */ |
| 10123 | pTLCb->usPendingTxCompleteCount = 0; |
| 10124 | |
| 10125 | /* global suspend flag */ |
| 10126 | vos_atomic_set_U8( &pTLCb->ucTxSuspended, 1); |
| 10127 | |
| 10128 | /* resource flag */ |
| 10129 | pTLCb->uResCount = 0; |
| 10130 | |
| 10131 | |
| 10132 | /*------------------------------------------------------------------------- |
| 10133 | Client stations |
| 10134 | -------------------------------------------------------------------------*/ |
| 10135 | for ( ucIndex = 0; ucIndex < WLAN_MAX_STA_COUNT ; ucIndex++) |
| 10136 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 10137 | if(NULL != pTLCb->atlSTAClients[ucIndex]) |
| 10138 | { |
| 10139 | WLANTL_CleanSTA( pTLCb->atlSTAClients[ucIndex], ucEmpty); |
| 10140 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10141 | } |
| 10142 | |
| 10143 | /*------------------------------------------------------------------------- |
| 10144 | Management Frame client |
| 10145 | -------------------------------------------------------------------------*/ |
| 10146 | pTLCb->tlMgmtFrmClient.ucExists = 0; |
| 10147 | |
| 10148 | if ( ( 0 != ucEmpty) && |
| 10149 | ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff )) |
| 10150 | { |
| 10151 | vos_pkt_return_packet(pTLCb->tlMgmtFrmClient.vosPendingDataBuff); |
| 10152 | } |
| 10153 | |
| 10154 | pTLCb->tlMgmtFrmClient.vosPendingDataBuff = NULL; |
| 10155 | |
| 10156 | /* set to a default cb in order to prevent constant checking for NULL */ |
| 10157 | pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx = WLANTL_MgmtFrmRxDefaultCb; |
| 10158 | |
| 10159 | /*------------------------------------------------------------------------- |
| 10160 | BT AMP client |
| 10161 | -------------------------------------------------------------------------*/ |
| 10162 | pTLCb->tlBAPClient.ucExists = 0; |
| 10163 | |
| 10164 | if (( 0 != ucEmpty) && |
| 10165 | ( NULL != pTLCb->tlBAPClient.vosPendingDataBuff )) |
| 10166 | { |
| 10167 | vos_pkt_return_packet(pTLCb->tlBAPClient.vosPendingDataBuff); |
| 10168 | } |
| 10169 | |
| 10170 | if (( 0 != ucEmpty) && |
| 10171 | ( NULL != pTLCb->vosDummyBuf )) |
| 10172 | { |
| 10173 | vos_pkt_return_packet(pTLCb->vosDummyBuf); |
| 10174 | } |
| 10175 | |
| 10176 | pTLCb->tlBAPClient.vosPendingDataBuff = NULL; |
| 10177 | |
| 10178 | pTLCb->vosDummyBuf = NULL; |
| 10179 | pTLCb->vosTempBuf = NULL; |
| 10180 | pTLCb->ucCachedSTAId = WLAN_MAX_STA_COUNT; |
| 10181 | |
| 10182 | /* set to a default cb in order to prevent constant checking for NULL */ |
| 10183 | pTLCb->tlBAPClient.pfnTlBAPRx = WLANTL_BAPRxDefaultCb; |
| 10184 | |
| 10185 | pTLCb->ucRegisteredStaId = WLAN_MAX_STA_COUNT; |
| 10186 | |
| 10187 | return VOS_STATUS_SUCCESS; |
| 10188 | |
| 10189 | }/* WLANTL_CleanCB*/ |
| 10190 | |
| 10191 | /*========================================================================== |
| 10192 | |
| 10193 | FUNCTION WLANTL_CleanSTA |
| 10194 | |
| 10195 | DESCRIPTION |
| 10196 | Cleans a station control block. |
| 10197 | |
| 10198 | DEPENDENCIES |
| 10199 | |
| 10200 | PARAMETERS |
| 10201 | |
| 10202 | IN |
| 10203 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 10204 | control block can be extracted from its context |
| 10205 | ucEmpty: if set the queues and pending pkts will be emptyed |
| 10206 | |
| 10207 | RETURN VALUE |
| 10208 | The result code associated with performing the operation |
| 10209 | |
| 10210 | VOS_STATUS_E_INVAL: invalid input parameters |
| 10211 | VOS_STATUS_SUCCESS: Everything is good :) |
| 10212 | |
| 10213 | SIDE EFFECTS |
| 10214 | |
| 10215 | ============================================================================*/ |
| 10216 | VOS_STATUS |
| 10217 | WLANTL_CleanSTA |
| 10218 | ( |
| 10219 | WLANTL_STAClientType* ptlSTAClient, |
| 10220 | v_U8_t ucEmpty |
| 10221 | ) |
| 10222 | { |
| 10223 | v_U8_t ucIndex; |
| 10224 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 10225 | |
| 10226 | /*------------------------------------------------------------------------- |
| 10227 | Sanity check |
| 10228 | -------------------------------------------------------------------------*/ |
| 10229 | if ( NULL == ptlSTAClient ) |
| 10230 | { |
| 10231 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 10232 | "WLAN TL:Invalid parameter sent on WLANTL_CleanSTA")); |
| 10233 | return VOS_STATUS_E_INVAL; |
| 10234 | } |
| 10235 | |
| 10236 | /*------------------------------------------------------------------------ |
| 10237 | Clear station from TL |
| 10238 | ------------------------------------------------------------------------*/ |
| 10239 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 10240 | "WLAN TL: Clearing STA Client ID: %d, Empty flag: %d", |
| 10241 | ptlSTAClient->wSTADesc.ucSTAId, ucEmpty )); |
| 10242 | |
| 10243 | ptlSTAClient->pfnSTARx = WLANTL_STARxDefaultCb; |
| 10244 | ptlSTAClient->pfnSTATxComp = WLANTL_TxCompDefaultCb; |
| 10245 | ptlSTAClient->pfnSTAFetchPkt = WLANTL_STAFetchPktDefaultCb; |
| 10246 | |
| 10247 | ptlSTAClient->tlState = WLANTL_STA_INIT; |
| 10248 | ptlSTAClient->tlPri = WLANTL_STA_PRI_NORMAL; |
| 10249 | |
| 10250 | vos_zero_macaddr( &ptlSTAClient->wSTADesc.vSTAMACAddress ); |
| 10251 | vos_zero_macaddr( &ptlSTAClient->wSTADesc.vBSSIDforIBSS ); |
| 10252 | vos_zero_macaddr( &ptlSTAClient->wSTADesc.vSelfMACAddress ); |
| 10253 | |
| 10254 | ptlSTAClient->wSTADesc.ucSTAId = 0; |
| 10255 | ptlSTAClient->wSTADesc.wSTAType = WLAN_STA_MAX; |
| 10256 | |
| 10257 | ptlSTAClient->wSTADesc.ucQosEnabled = 0; |
| 10258 | ptlSTAClient->wSTADesc.ucAddRmvLLC = 0; |
| 10259 | ptlSTAClient->wSTADesc.ucSwFrameTXXlation = 0; |
| 10260 | ptlSTAClient->wSTADesc.ucSwFrameRXXlation = 0; |
| 10261 | ptlSTAClient->wSTADesc.ucProtectedFrame = 0; |
| 10262 | |
| 10263 | /*------------------------------------------------------------------------- |
| 10264 | AMSDU information for the STA |
| 10265 | -------------------------------------------------------------------------*/ |
| 10266 | if ( ( 0 != ucEmpty ) && |
| 10267 | ( NULL != ptlSTAClient->vosAMSDUChainRoot )) |
| 10268 | { |
Madan Mohan Koyyalamudi | c0e5bd8 | 2012-09-18 17:12:27 -0700 | [diff] [blame] | 10269 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL, |
| 10270 | "WLAN TL:Non NULL vosAMSDUChainRoot (=%x) on WLANTL_CleanSTA," |
| 10271 | "suspecting a memory corruption")); |
| 10272 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10273 | } |
| 10274 | |
| 10275 | ptlSTAClient->vosAMSDUChain = NULL; |
| 10276 | ptlSTAClient->vosAMSDUChainRoot = NULL; |
| 10277 | |
| 10278 | vos_mem_zero( (v_PVOID_t)ptlSTAClient->aucMPDUHeader, |
| 10279 | WLANTL_MPDU_HEADER_LEN); |
| 10280 | ptlSTAClient->ucMPDUHeaderLen = 0; |
| 10281 | |
| 10282 | /*------------------------------------------------------------------------- |
| 10283 | Reordering information for the STA |
| 10284 | -------------------------------------------------------------------------*/ |
| 10285 | for ( ucIndex = 0; ucIndex < WLAN_MAX_TID ; ucIndex++) |
| 10286 | { |
| 10287 | if(0 == ptlSTAClient->atlBAReorderInfo[ucIndex].ucExists) |
| 10288 | { |
| 10289 | continue; |
| 10290 | } |
| 10291 | if(NULL != ptlSTAClient->atlBAReorderInfo[ucIndex].reorderBuffer) |
| 10292 | { |
| 10293 | ptlSTAClient->atlBAReorderInfo[ucIndex].reorderBuffer->isAvailable = VOS_TRUE; |
| 10294 | memset(&ptlSTAClient->atlBAReorderInfo[ucIndex].reorderBuffer->arrayBuffer[0], 0, WLANTL_MAX_WINSIZE * sizeof(v_PVOID_t)); |
| 10295 | } |
| 10296 | vos_timer_destroy(&ptlSTAClient->atlBAReorderInfo[ucIndex].agingTimer); |
| 10297 | memset(&ptlSTAClient->atlBAReorderInfo[ucIndex], 0, sizeof(WLANTL_BAReorderType)); |
| 10298 | } |
| 10299 | |
| 10300 | /*------------------------------------------------------------------------- |
| 10301 | QOS information for the STA |
| 10302 | -------------------------------------------------------------------------*/ |
| 10303 | ptlSTAClient->ucCurrentAC = WLANTL_AC_VO; |
| 10304 | ptlSTAClient->ucCurrentWeight = 0; |
| 10305 | ptlSTAClient->ucServicedAC = WLANTL_AC_BK; |
| 10306 | |
| 10307 | vos_mem_zero( ptlSTAClient->aucACMask, sizeof(ptlSTAClient->aucACMask)); |
| 10308 | vos_mem_zero( &ptlSTAClient->wUAPSDInfo, sizeof(ptlSTAClient->wUAPSDInfo)); |
| 10309 | |
| 10310 | |
| 10311 | /*-------------------------------------------------------------------- |
| 10312 | Stats info |
| 10313 | --------------------------------------------------------------------*/ |
| 10314 | vos_mem_zero( ptlSTAClient->auRxCount, |
| 10315 | sizeof(ptlSTAClient->auRxCount[0])* WLAN_MAX_TID); |
| 10316 | vos_mem_zero( ptlSTAClient->auTxCount, |
| 10317 | sizeof(ptlSTAClient->auTxCount[0])* WLAN_MAX_TID); |
| 10318 | ptlSTAClient->rssiAvg = 0; |
| 10319 | |
| 10320 | /*Tx not suspended and station fully registered*/ |
| 10321 | vos_atomic_set_U8( &ptlSTAClient->ucTxSuspended, 0); |
| 10322 | vos_atomic_set_U8( &ptlSTAClient->ucNoMoreData, 1); |
| 10323 | |
| 10324 | if ( 0 == ucEmpty ) |
| 10325 | { |
| 10326 | ptlSTAClient->wSTADesc.ucUcastSig = WLAN_TL_INVALID_U_SIG; |
| 10327 | ptlSTAClient->wSTADesc.ucBcastSig = WLAN_TL_INVALID_B_SIG; |
| 10328 | } |
| 10329 | |
| 10330 | ptlSTAClient->ucExists = 0; |
| 10331 | |
| 10332 | /*-------------------------------------------------------------------- |
| 10333 | Statistics info |
| 10334 | --------------------------------------------------------------------*/ |
| 10335 | memset(&ptlSTAClient->trafficStatistics, |
| 10336 | 0, |
| 10337 | sizeof(WLANTL_TRANSFER_STA_TYPE)); |
| 10338 | |
| 10339 | /*fix me!!: add new values from the TL Cb for cleanup */ |
| 10340 | return VOS_STATUS_SUCCESS; |
| 10341 | }/* WLANTL_CleanSTA */ |
| 10342 | |
| 10343 | |
| 10344 | /*========================================================================== |
| 10345 | FUNCTION WLANTL_EnableUAPSDForAC |
| 10346 | |
| 10347 | DESCRIPTION |
| 10348 | Called by HDD to enable UAPSD. TL in turn calls WDA API to enable the |
| 10349 | logic in FW/SLM to start sending trigger frames. Previously TL had the |
| 10350 | trigger frame logic which later moved down to FW. Hence |
| 10351 | HDD -> TL -> WDA -> FW call flow. |
| 10352 | |
| 10353 | DEPENDENCIES |
| 10354 | The TL must be initialized before this function can be called. |
| 10355 | |
| 10356 | PARAMETERS |
| 10357 | |
| 10358 | IN |
| 10359 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 10360 | control block can be extracted from its context |
| 10361 | ucSTAId: station Id |
| 10362 | ucAC: AC for which U-APSD is being enabled |
| 10363 | ucTid: TID for which U-APSD is setup |
| 10364 | ucUP: used to place in the trigger frame generation |
| 10365 | ucServiceInt: service interval used by TL to send trigger frames |
| 10366 | ucSuspendInt: suspend interval used by TL to determine that an |
| 10367 | app is idle and should start sending trigg frms less often |
| 10368 | wTSDir: direction of TSpec |
| 10369 | |
| 10370 | RETURN VALUE |
| 10371 | The result code associated with performing the operation |
| 10372 | |
| 10373 | VOS_STATUS_SUCCESS: Everything is good :) |
| 10374 | |
| 10375 | SIDE EFFECTS |
| 10376 | |
| 10377 | ============================================================================*/ |
| 10378 | VOS_STATUS |
| 10379 | WLANTL_EnableUAPSDForAC |
| 10380 | ( |
| 10381 | v_PVOID_t pvosGCtx, |
| 10382 | v_U8_t ucSTAId, |
| 10383 | WLANTL_ACEnumType ucAC, |
| 10384 | v_U8_t ucTid, |
| 10385 | v_U8_t ucUP, |
| 10386 | v_U32_t uServiceInt, |
| 10387 | v_U32_t uSuspendInt, |
| 10388 | WLANTL_TSDirType wTSDir |
| 10389 | ) |
| 10390 | { |
| 10391 | |
| 10392 | WLANTL_CbType* pTLCb = NULL; |
| 10393 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 10394 | tUapsdInfo halUAPSDInfo; |
| 10395 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 10396 | |
| 10397 | /*------------------------------------------------------------------------ |
| 10398 | Sanity check |
| 10399 | Extract TL control block |
| 10400 | ------------------------------------------------------------------------*/ |
| 10401 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 10402 | if (( NULL == pTLCb ) || WLANTL_STA_ID_INVALID( ucSTAId ) |
| 10403 | || WLANTL_AC_INVALID(ucAC) || ( 0 == uServiceInt ) ) |
| 10404 | { |
| 10405 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 10406 | "WLAN TL:Invalid input params on WLANTL_EnableUAPSDForAC" |
| 10407 | " TL: %x STA: %d AC: %d SI: %d", |
| 10408 | pTLCb, ucSTAId, ucAC, uServiceInt )); |
| 10409 | return VOS_STATUS_E_FAULT; |
| 10410 | } |
| 10411 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 10412 | if ( NULL == pTLCb->atlSTAClients[ucSTAId] ) |
| 10413 | { |
| 10414 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 10415 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 10416 | return VOS_STATUS_E_FAILURE; |
| 10417 | } |
| 10418 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10419 | /*Set this flag in order to remember that this is a trigger enabled AC*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 10420 | pTLCb->atlSTAClients[ucSTAId]->wUAPSDInfo[ucAC].ucSet = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10421 | |
| 10422 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 10423 | "WLAN TL:Enabling U-APSD in FW for STA: %d AC: %d SI: %d SPI: %d " |
| 10424 | "DI: %d", |
| 10425 | ucSTAId, ucAC, uServiceInt, uSuspendInt, |
| 10426 | pTLCb->tlConfigInfo.uDelayedTriggerFrmInt)); |
| 10427 | |
| 10428 | /*Save all info for HAL*/ |
| 10429 | halUAPSDInfo.staidx = ucSTAId; |
| 10430 | halUAPSDInfo.ac = ucAC; |
| 10431 | halUAPSDInfo.up = ucUP; |
| 10432 | halUAPSDInfo.srvInterval = uServiceInt; |
| 10433 | halUAPSDInfo.susInterval = uSuspendInt; |
| 10434 | halUAPSDInfo.delayInterval = pTLCb->tlConfigInfo.uDelayedTriggerFrmInt; |
| 10435 | |
| 10436 | /*Notify HAL*/ |
| 10437 | vosStatus = WDA_EnableUapsdAcParams(pvosGCtx, ucSTAId, &halUAPSDInfo); |
| 10438 | |
| 10439 | return vosStatus; |
| 10440 | |
| 10441 | }/*WLANTL_EnableUAPSDForAC*/ |
| 10442 | |
| 10443 | |
| 10444 | /*========================================================================== |
| 10445 | FUNCTION WLANTL_DisableUAPSDForAC |
| 10446 | |
| 10447 | DESCRIPTION |
| 10448 | Called by HDD to disable UAPSD. TL in turn calls WDA API to disable the |
| 10449 | logic in FW/SLM to stop sending trigger frames. Previously TL had the |
| 10450 | trigger frame logic which later moved down to FW. Hence |
| 10451 | HDD -> TL -> WDA -> FW call flow. |
| 10452 | |
| 10453 | DEPENDENCIES |
| 10454 | The TL must be initialized before this function can be called. |
| 10455 | |
| 10456 | PARAMETERS |
| 10457 | |
| 10458 | IN |
| 10459 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 10460 | control block can be extracted from its context |
| 10461 | ucSTAId: station Id |
| 10462 | ucAC: AC for which U-APSD is being enabled |
| 10463 | |
| 10464 | |
| 10465 | RETURN VALUE |
| 10466 | The result code associated with performing the operation |
| 10467 | |
| 10468 | VOS_STATUS_SUCCESS: Everything is good :) |
| 10469 | |
| 10470 | SIDE EFFECTS |
| 10471 | |
| 10472 | ============================================================================*/ |
| 10473 | VOS_STATUS |
| 10474 | WLANTL_DisableUAPSDForAC |
| 10475 | ( |
| 10476 | v_PVOID_t pvosGCtx, |
| 10477 | v_U8_t ucSTAId, |
| 10478 | WLANTL_ACEnumType ucAC |
| 10479 | ) |
| 10480 | { |
| 10481 | WLANTL_CbType* pTLCb; |
| 10482 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 10483 | |
| 10484 | /*------------------------------------------------------------------------ |
| 10485 | Sanity check |
| 10486 | Extract TL control block |
| 10487 | ------------------------------------------------------------------------*/ |
| 10488 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 10489 | if (( NULL == pTLCb ) || WLANTL_STA_ID_INVALID( ucSTAId ) |
| 10490 | || WLANTL_AC_INVALID(ucAC) ) |
| 10491 | { |
| 10492 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 10493 | "WLAN TL:Invalid input params on WLANTL_DisableUAPSDForAC" |
| 10494 | " TL: %x STA: %d AC: %d", pTLCb, ucSTAId, ucAC )); |
| 10495 | return VOS_STATUS_E_FAULT; |
| 10496 | } |
| 10497 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 10498 | if ( NULL == pTLCb->atlSTAClients[ucSTAId] ) |
| 10499 | { |
| 10500 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 10501 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 10502 | return VOS_STATUS_E_FAILURE; |
| 10503 | } |
| 10504 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10505 | /*Reset this flag as this is no longer a trigger enabled AC*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 10506 | pTLCb->atlSTAClients[ucSTAId]->wUAPSDInfo[ucAC].ucSet = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10507 | |
| 10508 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 10509 | "WLAN TL:Disabling U-APSD in FW for STA: %d AC: %d ", |
| 10510 | ucSTAId, ucAC)); |
| 10511 | |
| 10512 | /*Notify HAL*/ |
| 10513 | WDA_DisableUapsdAcParams(pvosGCtx, ucSTAId, ucAC); |
| 10514 | |
| 10515 | return VOS_STATUS_SUCCESS; |
| 10516 | }/* WLANTL_DisableUAPSDForAC */ |
| 10517 | |
| 10518 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 10519 | /*========================================================================== |
| 10520 | FUNCTION WLANTL_RegRSSIIndicationCB |
| 10521 | |
| 10522 | DESCRIPTION Registration function to get notification if RSSI cross |
| 10523 | threshold. |
| 10524 | Client should register threshold, direction, and notification |
| 10525 | callback function pointer |
| 10526 | |
| 10527 | DEPENDENCIES NONE |
| 10528 | |
| 10529 | PARAMETERS in pAdapter - Global handle |
| 10530 | in rssiValue - RSSI threshold value |
| 10531 | in triggerEvent - Cross direction should be notified |
| 10532 | UP, DOWN, and CROSS |
| 10533 | in crossCBFunction - Notification CB Function |
| 10534 | in usrCtxt - user context |
| 10535 | |
| 10536 | RETURN VALUE VOS_STATUS |
| 10537 | |
| 10538 | SIDE EFFECTS NONE |
| 10539 | |
| 10540 | ============================================================================*/ |
| 10541 | VOS_STATUS WLANTL_RegRSSIIndicationCB |
| 10542 | ( |
| 10543 | v_PVOID_t pAdapter, |
| 10544 | v_S7_t rssiValue, |
| 10545 | v_U8_t triggerEvent, |
| 10546 | WLANTL_RSSICrossThresholdCBType crossCBFunction, |
| 10547 | VOS_MODULE_ID moduleID, |
| 10548 | v_PVOID_t usrCtxt |
| 10549 | ) |
| 10550 | { |
| 10551 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 10552 | |
| 10553 | status = WLANTL_HSRegRSSIIndicationCB(pAdapter, |
| 10554 | rssiValue, |
| 10555 | triggerEvent, |
| 10556 | crossCBFunction, |
| 10557 | moduleID, |
| 10558 | usrCtxt); |
| 10559 | |
| 10560 | return status; |
| 10561 | } |
| 10562 | |
| 10563 | /*========================================================================== |
| 10564 | FUNCTION WLANTL_DeregRSSIIndicationCB |
| 10565 | |
| 10566 | DESCRIPTION Remove specific threshold from list |
| 10567 | |
| 10568 | DEPENDENCIES NONE |
| 10569 | |
| 10570 | PARAMETERS in pAdapter - Global handle |
| 10571 | in rssiValue - RSSI threshold value |
| 10572 | in triggerEvent - Cross direction should be notified |
| 10573 | UP, DOWN, and CROSS |
| 10574 | |
| 10575 | RETURN VALUE VOS_STATUS |
| 10576 | |
| 10577 | SIDE EFFECTS NONE |
| 10578 | |
| 10579 | ============================================================================*/ |
| 10580 | VOS_STATUS WLANTL_DeregRSSIIndicationCB |
| 10581 | ( |
| 10582 | v_PVOID_t pAdapter, |
| 10583 | v_S7_t rssiValue, |
| 10584 | v_U8_t triggerEvent, |
| 10585 | WLANTL_RSSICrossThresholdCBType crossCBFunction, |
| 10586 | VOS_MODULE_ID moduleID |
| 10587 | ) |
| 10588 | { |
| 10589 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 10590 | |
| 10591 | status = WLANTL_HSDeregRSSIIndicationCB(pAdapter, |
| 10592 | rssiValue, |
| 10593 | triggerEvent, |
| 10594 | crossCBFunction, |
| 10595 | moduleID); |
| 10596 | return status; |
| 10597 | } |
| 10598 | |
| 10599 | /*========================================================================== |
| 10600 | FUNCTION WLANTL_SetAlpha |
| 10601 | |
| 10602 | DESCRIPTION ALPLA is weight value to calculate AVG RSSI |
| 10603 | avgRSSI = (ALPHA * historyRSSI) + ((10 - ALPHA) * newRSSI) |
| 10604 | avgRSSI has (ALPHA * 10)% of history RSSI weight and |
| 10605 | (10 - ALPHA)% of newRSSI weight |
| 10606 | This portion is dynamically configurable. |
| 10607 | Default is ? |
| 10608 | |
| 10609 | DEPENDENCIES NONE |
| 10610 | |
| 10611 | PARAMETERS in pAdapter - Global handle |
| 10612 | in valueAlpah - ALPHA |
| 10613 | |
| 10614 | RETURN VALUE VOS_STATUS |
| 10615 | |
| 10616 | SIDE EFFECTS NONE |
| 10617 | |
| 10618 | ============================================================================*/ |
| 10619 | VOS_STATUS WLANTL_SetAlpha |
| 10620 | ( |
| 10621 | v_PVOID_t pAdapter, |
| 10622 | v_U8_t valueAlpha |
| 10623 | ) |
| 10624 | { |
| 10625 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 10626 | |
| 10627 | status = WLANTL_HSSetAlpha(pAdapter, valueAlpha); |
| 10628 | return status; |
| 10629 | } |
| 10630 | |
| 10631 | /*========================================================================== |
| 10632 | |
| 10633 | FUNCTION |
| 10634 | |
| 10635 | DESCRIPTION |
| 10636 | |
| 10637 | PARAMETERS |
| 10638 | |
| 10639 | RETURN VALUE |
| 10640 | |
| 10641 | ============================================================================*/ |
| 10642 | VOS_STATUS WLANTL_BMPSRSSIRegionChangedNotification |
| 10643 | ( |
| 10644 | v_PVOID_t pAdapter, |
| 10645 | tpSirRSSINotification pRSSINotification |
| 10646 | ) |
| 10647 | { |
| 10648 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 10649 | |
| 10650 | status = WLANTL_HSBMPSRSSIRegionChangedNotification(pAdapter, pRSSINotification); |
| 10651 | return status; |
| 10652 | } |
| 10653 | |
| 10654 | /*========================================================================== |
| 10655 | FUNCTION WLANTL_RegGetTrafficStatus |
| 10656 | |
| 10657 | DESCRIPTION Registration function for traffic status monitoring |
| 10658 | During measure period count data frames. |
| 10659 | If frame count is larger then IDLE threshold set as traffic ON |
| 10660 | or OFF. |
| 10661 | And traffic status is changed send report to client with |
| 10662 | registered callback function |
| 10663 | |
| 10664 | DEPENDENCIES NONE |
| 10665 | |
| 10666 | PARAMETERS in pAdapter - Global handle |
| 10667 | in idleThreshold - Traffic on or off threshold |
| 10668 | in measurePeriod - Traffic state check period |
| 10669 | in trfficStatusCB - traffic status changed notification |
| 10670 | CB function |
| 10671 | in usrCtxt - user context |
| 10672 | |
| 10673 | RETURN VALUE VOS_STATUS |
| 10674 | |
| 10675 | SIDE EFFECTS NONE |
| 10676 | |
| 10677 | ============================================================================*/ |
| 10678 | VOS_STATUS WLANTL_RegGetTrafficStatus |
| 10679 | ( |
| 10680 | v_PVOID_t pAdapter, |
| 10681 | v_U32_t idleThreshold, |
| 10682 | v_U32_t measurePeriod, |
| 10683 | WLANTL_TrafficStatusChangedCBType trfficStatusCB, |
| 10684 | v_PVOID_t usrCtxt |
| 10685 | ) |
| 10686 | { |
| 10687 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 10688 | |
| 10689 | status = WLANTL_HSRegGetTrafficStatus(pAdapter, |
| 10690 | idleThreshold, |
| 10691 | measurePeriod, |
| 10692 | trfficStatusCB, |
| 10693 | usrCtxt); |
| 10694 | return status; |
| 10695 | } |
| 10696 | #endif |
| 10697 | /*========================================================================== |
| 10698 | FUNCTION WLANTL_GetStatistics |
| 10699 | |
| 10700 | DESCRIPTION Get traffic statistics for identified station |
| 10701 | |
| 10702 | DEPENDENCIES NONE |
| 10703 | |
| 10704 | PARAMETERS in pAdapter - Global handle |
| 10705 | in statType - specific statistics field to reset |
| 10706 | out statBuffer - traffic statistics buffer |
| 10707 | |
| 10708 | RETURN VALUE VOS_STATUS |
| 10709 | |
| 10710 | SIDE EFFECTS NONE |
| 10711 | |
| 10712 | ============================================================================*/ |
| 10713 | VOS_STATUS WLANTL_GetStatistics |
| 10714 | ( |
| 10715 | v_PVOID_t pAdapter, |
| 10716 | WLANTL_TRANSFER_STA_TYPE *statBuffer, |
| 10717 | v_U8_t STAid |
| 10718 | ) |
| 10719 | { |
| 10720 | WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter); |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 10721 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10722 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 10723 | WLANTL_TRANSFER_STA_TYPE *statistics = NULL; |
| 10724 | |
| 10725 | /*------------------------------------------------------------------------ |
| 10726 | Sanity check |
| 10727 | Extract TL control block |
| 10728 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 10729 | if ( NULL == pTLCb ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10730 | { |
| 10731 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 10732 | "WLAN TL:Invalid TL pointer on WLANTL_GetStatistics")); |
| 10733 | return VOS_STATUS_E_FAULT; |
| 10734 | } |
| 10735 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 10736 | pClientSTA = pTLCb->atlSTAClients[STAid]; |
| 10737 | |
| 10738 | if ( NULL == pClientSTA ) |
| 10739 | { |
| 10740 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 10741 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 10742 | return VOS_STATUS_E_FAILURE; |
| 10743 | } |
| 10744 | |
| 10745 | if(0 == pClientSTA->ucExists) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10746 | { |
| 10747 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 10748 | "WLAN TL: %d STA ID does not exist", STAid)); |
| 10749 | return VOS_STATUS_E_INVAL; |
| 10750 | } |
| 10751 | |
| 10752 | if(NULL == statBuffer) |
| 10753 | { |
| 10754 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 10755 | "WLAN TL:Invalid TL statistics buffer pointer on WLANTL_GetStatistics")); |
| 10756 | return VOS_STATUS_E_INVAL; |
| 10757 | } |
| 10758 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 10759 | statistics = &pClientSTA->trafficStatistics; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10760 | memcpy(statBuffer, statistics, sizeof(WLANTL_TRANSFER_STA_TYPE)); |
| 10761 | |
| 10762 | return status; |
| 10763 | } |
| 10764 | |
| 10765 | /*========================================================================== |
| 10766 | FUNCTION WLANTL_ResetStatistics |
| 10767 | |
| 10768 | DESCRIPTION Reset statistics structure for identified station ID |
| 10769 | Reset means set values as 0 |
| 10770 | |
| 10771 | DEPENDENCIES NONE |
| 10772 | |
| 10773 | PARAMETERS in pAdapter - Global handle |
| 10774 | in statType - specific statistics field to reset |
| 10775 | |
| 10776 | RETURN VALUE VOS_STATUS |
| 10777 | |
| 10778 | SIDE EFFECTS NONE |
| 10779 | |
| 10780 | ============================================================================*/ |
| 10781 | VOS_STATUS WLANTL_ResetStatistics |
| 10782 | ( |
| 10783 | v_PVOID_t pAdapter, |
| 10784 | v_U8_t STAid |
| 10785 | ) |
| 10786 | { |
| 10787 | WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter); |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 10788 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10789 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 10790 | WLANTL_TRANSFER_STA_TYPE *statistics = NULL; |
| 10791 | |
| 10792 | /*------------------------------------------------------------------------ |
| 10793 | Sanity check |
| 10794 | Extract TL control block |
| 10795 | ------------------------------------------------------------------------*/ |
| 10796 | if (NULL == pTLCb) |
| 10797 | { |
| 10798 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 10799 | "WLAN TL:Invalid TL pointer on WLANTL_GetStatistics")); |
| 10800 | return VOS_STATUS_E_FAULT; |
| 10801 | } |
| 10802 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 10803 | pClientSTA = pTLCb->atlSTAClients[STAid]; |
| 10804 | |
| 10805 | if ( NULL == pClientSTA ) |
| 10806 | { |
| 10807 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 10808 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 10809 | return VOS_STATUS_E_FAILURE; |
| 10810 | } |
| 10811 | |
| 10812 | if(0 == pClientSTA->ucExists) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10813 | { |
| 10814 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 10815 | "WLAN TL: %d STA ID does not exist", STAid)); |
| 10816 | return VOS_STATUS_E_INVAL; |
| 10817 | } |
| 10818 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 10819 | statistics = &pClientSTA->trafficStatistics; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10820 | vos_mem_zero((v_VOID_t *)statistics, sizeof(WLANTL_TRANSFER_STA_TYPE)); |
| 10821 | |
| 10822 | return status; |
| 10823 | } |
| 10824 | |
| 10825 | /*========================================================================== |
| 10826 | FUNCTION WLANTL_GetSpecStatistic |
| 10827 | |
| 10828 | DESCRIPTION Get specific field within statistics structure for |
| 10829 | identified station ID |
| 10830 | |
| 10831 | DEPENDENCIES NONE |
| 10832 | |
| 10833 | PARAMETERS in pAdapter - Global handle |
| 10834 | in statType - specific statistics field to reset |
| 10835 | in STAid - Station ID |
| 10836 | out buffer - Statistic value |
| 10837 | |
| 10838 | RETURN VALUE VOS_STATUS |
| 10839 | |
| 10840 | SIDE EFFECTS NONE |
| 10841 | |
| 10842 | ============================================================================*/ |
| 10843 | VOS_STATUS WLANTL_GetSpecStatistic |
| 10844 | ( |
| 10845 | v_PVOID_t pAdapter, |
| 10846 | WLANTL_TRANSFER_STATIC_TYPE statType, |
| 10847 | v_U32_t *buffer, |
| 10848 | v_U8_t STAid |
| 10849 | ) |
| 10850 | { |
| 10851 | WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter); |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 10852 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10853 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 10854 | WLANTL_TRANSFER_STA_TYPE *statistics = NULL; |
| 10855 | |
| 10856 | /*------------------------------------------------------------------------ |
| 10857 | Sanity check |
| 10858 | Extract TL control block |
| 10859 | ------------------------------------------------------------------------*/ |
| 10860 | if (NULL == pTLCb) |
| 10861 | { |
| 10862 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 10863 | "WLAN TL:Invalid TL pointer on WLANTL_GetStatistics")); |
| 10864 | return VOS_STATUS_E_FAULT; |
| 10865 | } |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 10866 | pClientSTA = pTLCb->atlSTAClients[STAid]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10867 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 10868 | if ( NULL == pClientSTA ) |
| 10869 | { |
| 10870 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 10871 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 10872 | return VOS_STATUS_E_FAILURE; |
| 10873 | } |
| 10874 | |
| 10875 | if(0 == pClientSTA->ucExists) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10876 | { |
| 10877 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 10878 | "WLAN TL: %d STA ID does not exist", STAid)); |
| 10879 | return VOS_STATUS_E_INVAL; |
| 10880 | } |
| 10881 | |
| 10882 | if(NULL == buffer) |
| 10883 | { |
| 10884 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 10885 | "WLAN TL:Invalid TL statistic buffer pointer on WLANTL_GetStatistics")); |
| 10886 | return VOS_STATUS_E_INVAL; |
| 10887 | } |
| 10888 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 10889 | statistics = &pClientSTA->trafficStatistics; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10890 | switch(statType) |
| 10891 | { |
| 10892 | case WLANTL_STATIC_TX_UC_FCNT: |
| 10893 | *buffer = statistics->txUCFcnt; |
| 10894 | break; |
| 10895 | |
| 10896 | case WLANTL_STATIC_TX_MC_FCNT: |
| 10897 | *buffer = statistics->txMCFcnt; |
| 10898 | break; |
| 10899 | |
| 10900 | case WLANTL_STATIC_TX_BC_FCNT: |
| 10901 | *buffer = statistics->txBCFcnt; |
| 10902 | break; |
| 10903 | |
| 10904 | case WLANTL_STATIC_TX_UC_BCNT: |
| 10905 | *buffer = statistics->txUCBcnt; |
| 10906 | break; |
| 10907 | |
| 10908 | case WLANTL_STATIC_TX_MC_BCNT: |
| 10909 | *buffer = statistics->txMCBcnt; |
| 10910 | break; |
| 10911 | |
| 10912 | case WLANTL_STATIC_TX_BC_BCNT: |
| 10913 | *buffer = statistics->txBCBcnt; |
| 10914 | break; |
| 10915 | |
| 10916 | case WLANTL_STATIC_RX_UC_FCNT: |
| 10917 | *buffer = statistics->rxUCFcnt; |
| 10918 | break; |
| 10919 | |
| 10920 | case WLANTL_STATIC_RX_MC_FCNT: |
| 10921 | *buffer = statistics->rxMCFcnt; |
| 10922 | break; |
| 10923 | |
| 10924 | case WLANTL_STATIC_RX_BC_FCNT: |
| 10925 | *buffer = statistics->rxBCFcnt; |
| 10926 | break; |
| 10927 | |
| 10928 | case WLANTL_STATIC_RX_UC_BCNT: |
| 10929 | *buffer = statistics->rxUCBcnt; |
| 10930 | break; |
| 10931 | |
| 10932 | case WLANTL_STATIC_RX_MC_BCNT: |
| 10933 | *buffer = statistics->rxMCBcnt; |
| 10934 | break; |
| 10935 | |
| 10936 | case WLANTL_STATIC_RX_BC_BCNT: |
| 10937 | *buffer = statistics->rxBCBcnt; |
| 10938 | break; |
| 10939 | |
| 10940 | case WLANTL_STATIC_RX_BCNT: |
| 10941 | *buffer = statistics->rxBcnt; |
| 10942 | break; |
| 10943 | |
| 10944 | case WLANTL_STATIC_RX_BCNT_CRC_OK: |
| 10945 | *buffer = statistics->rxBcntCRCok; |
| 10946 | break; |
| 10947 | |
| 10948 | case WLANTL_STATIC_RX_RATE: |
| 10949 | *buffer = statistics->rxRate; |
| 10950 | break; |
| 10951 | |
| 10952 | default: |
| 10953 | *buffer = 0; |
| 10954 | status = VOS_STATUS_E_INVAL; |
| 10955 | break; |
| 10956 | } |
| 10957 | |
| 10958 | |
| 10959 | return status; |
| 10960 | } |
| 10961 | |
| 10962 | /*========================================================================== |
| 10963 | FUNCTION WLANTL_ResetSpecStatistic |
| 10964 | |
| 10965 | DESCRIPTION Reset specific field within statistics structure for |
| 10966 | identified station ID |
| 10967 | Reset means set as 0 |
| 10968 | |
| 10969 | DEPENDENCIES NONE |
| 10970 | |
| 10971 | PARAMETERS in pAdapter - Global handle |
| 10972 | in statType - specific statistics field to reset |
| 10973 | in STAid - Station ID |
| 10974 | |
| 10975 | RETURN VALUE VOS_STATUS |
| 10976 | |
| 10977 | SIDE EFFECTS NONE |
| 10978 | |
| 10979 | ============================================================================*/ |
| 10980 | VOS_STATUS WLANTL_ResetSpecStatistic |
| 10981 | ( |
| 10982 | v_PVOID_t pAdapter, |
| 10983 | WLANTL_TRANSFER_STATIC_TYPE statType, |
| 10984 | v_U8_t STAid |
| 10985 | ) |
| 10986 | { |
| 10987 | WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter); |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 10988 | WLANTL_STAClientType* pClientSTA = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10989 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 10990 | WLANTL_TRANSFER_STA_TYPE *statistics = NULL; |
| 10991 | |
| 10992 | /*------------------------------------------------------------------------ |
| 10993 | Sanity check |
| 10994 | Extract TL control block |
| 10995 | ------------------------------------------------------------------------*/ |
| 10996 | if (NULL == pTLCb) |
| 10997 | { |
| 10998 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 10999 | "WLAN TL:Invalid TL pointer on WLANTL_GetStatistics")); |
| 11000 | return VOS_STATUS_E_FAULT; |
| 11001 | } |
| 11002 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 11003 | pClientSTA = pTLCb->atlSTAClients[STAid]; |
| 11004 | |
| 11005 | if ( NULL == pClientSTA ) |
| 11006 | { |
| 11007 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 11008 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 11009 | return VOS_STATUS_E_FAILURE; |
| 11010 | } |
| 11011 | |
| 11012 | if(0 == pClientSTA->ucExists) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11013 | { |
| 11014 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 11015 | "WLAN TL: %d STA ID does not exist", STAid)); |
| 11016 | return VOS_STATUS_E_INVAL; |
| 11017 | } |
| 11018 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 11019 | statistics = &pClientSTA->trafficStatistics; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11020 | switch(statType) |
| 11021 | { |
| 11022 | case WLANTL_STATIC_TX_UC_FCNT: |
| 11023 | statistics->txUCFcnt = 0; |
| 11024 | break; |
| 11025 | |
| 11026 | case WLANTL_STATIC_TX_MC_FCNT: |
| 11027 | statistics->txMCFcnt = 0; |
| 11028 | break; |
| 11029 | |
| 11030 | case WLANTL_STATIC_TX_BC_FCNT: |
| 11031 | statistics->txBCFcnt = 0; |
| 11032 | break; |
| 11033 | |
| 11034 | case WLANTL_STATIC_TX_UC_BCNT: |
| 11035 | statistics->txUCBcnt = 0; |
| 11036 | break; |
| 11037 | |
| 11038 | case WLANTL_STATIC_TX_MC_BCNT: |
| 11039 | statistics->txMCBcnt = 0; |
| 11040 | break; |
| 11041 | |
| 11042 | case WLANTL_STATIC_TX_BC_BCNT: |
| 11043 | statistics->txBCBcnt = 0; |
| 11044 | break; |
| 11045 | |
| 11046 | case WLANTL_STATIC_RX_UC_FCNT: |
| 11047 | statistics->rxUCFcnt = 0; |
| 11048 | break; |
| 11049 | |
| 11050 | case WLANTL_STATIC_RX_MC_FCNT: |
| 11051 | statistics->rxMCFcnt = 0; |
| 11052 | break; |
| 11053 | |
| 11054 | case WLANTL_STATIC_RX_BC_FCNT: |
| 11055 | statistics->rxBCFcnt = 0; |
| 11056 | break; |
| 11057 | |
| 11058 | case WLANTL_STATIC_RX_UC_BCNT: |
| 11059 | statistics->rxUCBcnt = 0; |
| 11060 | break; |
| 11061 | |
| 11062 | case WLANTL_STATIC_RX_MC_BCNT: |
| 11063 | statistics->rxMCBcnt = 0; |
| 11064 | break; |
| 11065 | |
| 11066 | case WLANTL_STATIC_RX_BC_BCNT: |
| 11067 | statistics->rxBCBcnt = 0; |
| 11068 | break; |
| 11069 | |
| 11070 | case WLANTL_STATIC_RX_BCNT: |
| 11071 | statistics->rxBcnt = 0; |
| 11072 | break; |
| 11073 | |
| 11074 | case WLANTL_STATIC_RX_BCNT_CRC_OK: |
| 11075 | statistics->rxBcntCRCok = 0; |
| 11076 | break; |
| 11077 | |
| 11078 | case WLANTL_STATIC_RX_RATE: |
| 11079 | statistics->rxRate = 0; |
| 11080 | break; |
| 11081 | |
| 11082 | default: |
| 11083 | status = VOS_STATUS_E_INVAL; |
| 11084 | break; |
| 11085 | } |
| 11086 | |
| 11087 | return status; |
| 11088 | } |
| 11089 | |
| 11090 | |
| 11091 | /*========================================================================== |
| 11092 | |
| 11093 | FUNCTION |
| 11094 | |
| 11095 | DESCRIPTION Read RSSI value out of a RX BD |
| 11096 | |
| 11097 | PARAMETERS: Caller must validate all parameters |
| 11098 | |
| 11099 | RETURN VALUE |
| 11100 | |
| 11101 | ============================================================================*/ |
| 11102 | VOS_STATUS WLANTL_ReadRSSI |
| 11103 | ( |
| 11104 | v_PVOID_t pAdapter, |
| 11105 | v_PVOID_t pBDHeader, |
| 11106 | v_U8_t STAid |
| 11107 | ) |
| 11108 | { |
| 11109 | WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter); |
| 11110 | v_S7_t currentRSSI, currentRSSI0, currentRSSI1; |
| 11111 | |
| 11112 | |
| 11113 | if(NULL == tlCtxt) |
| 11114 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11115 | TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "%s Invalid TL handle", __func__)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11116 | return VOS_STATUS_E_INVAL; |
| 11117 | } |
| 11118 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 11119 | if ( NULL == tlCtxt->atlSTAClients[STAid] ) |
| 11120 | { |
| 11121 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 11122 | "WLAN TL:Client Memory was not allocated on %s", __func__)); |
| 11123 | return VOS_STATUS_E_FAILURE; |
| 11124 | } |
| 11125 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11126 | currentRSSI0 = WLANTL_GETRSSI0(pBDHeader); |
| 11127 | currentRSSI1 = WLANTL_GETRSSI1(pBDHeader); |
| 11128 | currentRSSI = (currentRSSI0 > currentRSSI1) ? currentRSSI0 : currentRSSI1; |
| 11129 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 11130 | tlCtxt->atlSTAClients[STAid]->rssiAvg = currentRSSI; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11131 | |
| 11132 | return VOS_STATUS_SUCCESS; |
| 11133 | } |
| 11134 | |
| 11135 | |
| 11136 | /* |
| 11137 | DESCRIPTION |
| 11138 | TL returns the weight currently maintained in TL. |
| 11139 | IN |
| 11140 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 11141 | or SME's control block can be extracted from its context |
| 11142 | |
| 11143 | OUT |
| 11144 | pACWeights: Caller allocated memory for filling in weights |
| 11145 | |
| 11146 | RETURN VALUE VOS_STATUS |
| 11147 | */ |
| 11148 | VOS_STATUS |
| 11149 | WLANTL_GetACWeights |
| 11150 | ( |
| 11151 | v_PVOID_t pvosGCtx, |
| 11152 | v_U8_t* pACWeights |
| 11153 | ) |
| 11154 | { |
| 11155 | WLANTL_CbType* pTLCb = NULL; |
| 11156 | v_U8_t ucIndex; |
| 11157 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 11158 | |
| 11159 | /*------------------------------------------------------------------------ |
| 11160 | Sanity check |
| 11161 | ------------------------------------------------------------------------*/ |
| 11162 | if ( NULL == pACWeights ) |
| 11163 | { |
| 11164 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 11165 | "WLAN TL:Invalid parameter sent on WLANTL_GetACWeights")); |
| 11166 | return VOS_STATUS_E_INVAL; |
| 11167 | } |
| 11168 | |
| 11169 | /*------------------------------------------------------------------------ |
| 11170 | Extract TL control block and check existance |
| 11171 | ------------------------------------------------------------------------*/ |
| 11172 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 11173 | if ( NULL == pTLCb ) |
| 11174 | { |
| 11175 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 11176 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetACWeights")); |
| 11177 | return VOS_STATUS_E_FAULT; |
| 11178 | } |
| 11179 | for ( ucIndex = 0; ucIndex < WLANTL_MAX_AC ; ucIndex++) |
| 11180 | { |
| 11181 | pACWeights[ucIndex] = pTLCb->tlConfigInfo.ucAcWeights[ucIndex]; |
| 11182 | } |
| 11183 | |
| 11184 | return VOS_STATUS_SUCCESS; |
| 11185 | } |
| 11186 | |
| 11187 | |
| 11188 | |
| 11189 | /* |
| 11190 | DESCRIPTION |
| 11191 | Change the weight currently maintained by TL. |
| 11192 | IN |
| 11193 | pvosGCtx: pointer to the global vos context; a handle to TL's |
| 11194 | or SME's control block can be extracted from its context |
| 11195 | pACWeights: Caller allocated memory contain the weights to use |
| 11196 | |
| 11197 | |
| 11198 | RETURN VALUE VOS_STATUS |
| 11199 | */ |
| 11200 | VOS_STATUS |
| 11201 | WLANTL_SetACWeights |
| 11202 | ( |
| 11203 | v_PVOID_t pvosGCtx, |
| 11204 | v_U8_t* pACWeights |
| 11205 | ) |
| 11206 | { |
| 11207 | WLANTL_CbType* pTLCb = NULL; |
| 11208 | v_U8_t ucIndex; |
| 11209 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 11210 | |
| 11211 | /*------------------------------------------------------------------------ |
| 11212 | Sanity check |
| 11213 | ------------------------------------------------------------------------*/ |
| 11214 | if ( NULL == pACWeights ) |
| 11215 | { |
| 11216 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 11217 | "WLAN TL:Invalid parameter sent on WLANTL_GetACWeights")); |
| 11218 | return VOS_STATUS_E_INVAL; |
| 11219 | } |
| 11220 | |
| 11221 | /*------------------------------------------------------------------------ |
| 11222 | Extract TL control block and check existance |
| 11223 | ------------------------------------------------------------------------*/ |
| 11224 | pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 11225 | if ( NULL == pTLCb ) |
| 11226 | { |
| 11227 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 11228 | "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetACWeights")); |
| 11229 | return VOS_STATUS_E_FAULT; |
| 11230 | } |
| 11231 | for ( ucIndex = 0; ucIndex < WLANTL_MAX_AC ; ucIndex++) |
| 11232 | { |
| 11233 | pTLCb->tlConfigInfo.ucAcWeights[ucIndex] = pACWeights[ucIndex]; |
| 11234 | } |
| 11235 | |
| 11236 | return VOS_STATUS_SUCCESS; |
| 11237 | } |
| 11238 | |
| 11239 | |
| 11240 | /*========================================================================== |
| 11241 | |
| 11242 | FUNCTION |
| 11243 | |
| 11244 | DESCRIPTION |
| 11245 | |
| 11246 | PARAMETERS |
| 11247 | |
| 11248 | RETURN VALUE |
| 11249 | |
| 11250 | ============================================================================*/ |
| 11251 | void WLANTL_PowerStateChangedCB |
| 11252 | ( |
| 11253 | v_PVOID_t pAdapter, |
| 11254 | tPmcState newState |
| 11255 | ) |
| 11256 | { |
| 11257 | WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter); |
| 11258 | |
| 11259 | if (NULL == tlCtxt) |
| 11260 | { |
| 11261 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11262 | "Invalid TL Control Block", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11263 | return; |
| 11264 | } |
| 11265 | |
| 11266 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, "Power state changed, new state is %d", newState ); |
| 11267 | switch(newState) |
| 11268 | { |
| 11269 | case FULL_POWER: |
| 11270 | tlCtxt->isBMPS = VOS_FALSE; |
| 11271 | break; |
| 11272 | |
| 11273 | case BMPS: |
| 11274 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 11275 | WLANTL_SetFWRSSIThresholds(pAdapter); |
| 11276 | #endif |
| 11277 | |
| 11278 | tlCtxt->isBMPS = VOS_TRUE; |
| 11279 | break; |
| 11280 | |
| 11281 | case IMPS: |
| 11282 | case LOW_POWER: |
| 11283 | case REQUEST_BMPS: |
| 11284 | case REQUEST_FULL_POWER: |
| 11285 | case REQUEST_IMPS: |
| 11286 | case STOPPED: |
| 11287 | case REQUEST_START_UAPSD: |
| 11288 | case REQUEST_STOP_UAPSD: |
| 11289 | case UAPSD: |
| 11290 | case REQUEST_STANDBY: |
| 11291 | case STANDBY: |
| 11292 | case REQUEST_ENTER_WOWL: |
| 11293 | case REQUEST_EXIT_WOWL: |
| 11294 | case WOWL: |
| 11295 | TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, "Not handle this events %d", newState )); |
| 11296 | break; |
| 11297 | |
| 11298 | default: |
| 11299 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "Not a valid event %d", newState )); |
| 11300 | break; |
| 11301 | } |
| 11302 | |
| 11303 | return; |
| 11304 | } |
| 11305 | /*========================================================================== |
| 11306 | FUNCTION WLANTL_GetEtherType |
| 11307 | |
| 11308 | DESCRIPTION Extract Ether type information from the BD |
| 11309 | |
| 11310 | DEPENDENCIES NONE |
| 11311 | |
| 11312 | PARAMETERS in aucBDHeader - BD header |
| 11313 | in vosDataBuff - data buffer |
| 11314 | in ucMPDUHLen - MPDU header length |
| 11315 | out pUsEtherType - pointer to Ethertype |
| 11316 | |
| 11317 | RETURN VALUE VOS_STATUS_SUCCESS : if the EtherType is successfully extracted |
| 11318 | VOS_STATUS_FAILURE : if the EtherType extraction failed and |
| 11319 | the packet was dropped |
| 11320 | |
| 11321 | SIDE EFFECTS NONE |
| 11322 | |
| 11323 | ============================================================================*/ |
| 11324 | static VOS_STATUS WLANTL_GetEtherType |
| 11325 | ( |
| 11326 | v_U8_t * aucBDHeader, |
| 11327 | vos_pkt_t * vosDataBuff, |
| 11328 | v_U8_t ucMPDUHLen, |
| 11329 | v_U16_t * pUsEtherType |
| 11330 | ) |
| 11331 | { |
| 11332 | v_U8_t ucOffset; |
| 11333 | v_U16_t usEtherType = *pUsEtherType; |
| 11334 | v_SIZE_t usLLCSize = sizeof(usEtherType); |
| 11335 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 11336 | |
| 11337 | /*------------------------------------------------------------------------ |
| 11338 | Check if LLC is present - if not, TL is unable to determine type |
| 11339 | ------------------------------------------------------------------------*/ |
| 11340 | if ( VOS_FALSE == WDA_IS_RX_LLC_PRESENT( aucBDHeader ) ) |
| 11341 | { |
| 11342 | ucOffset = WLANTL_802_3_HEADER_LEN - sizeof(usEtherType); |
| 11343 | } |
| 11344 | else |
| 11345 | { |
| 11346 | ucOffset = ucMPDUHLen + WLANTL_LLC_PROTO_TYPE_OFFSET; |
| 11347 | } |
| 11348 | |
| 11349 | /*------------------------------------------------------------------------ |
| 11350 | Extract LLC type |
| 11351 | ------------------------------------------------------------------------*/ |
| 11352 | vosStatus = vos_pkt_extract_data( vosDataBuff, ucOffset, |
| 11353 | (v_PVOID_t)&usEtherType, &usLLCSize); |
| 11354 | |
| 11355 | if (( VOS_STATUS_SUCCESS != vosStatus ) || |
| 11356 | ( sizeof(usEtherType) != usLLCSize )) |
| 11357 | |
| 11358 | { |
| 11359 | TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 11360 | "WLAN TL:Error extracting Ether type from data packet")); |
| 11361 | /* Drop packet */ |
| 11362 | vos_pkt_return_packet(vosDataBuff); |
| 11363 | vosStatus = VOS_STATUS_E_FAILURE; |
| 11364 | } |
| 11365 | else |
| 11366 | { |
| 11367 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 11368 | "WLAN TL:Ether type retrieved before endianess conv: %d", |
| 11369 | usEtherType)); |
| 11370 | |
| 11371 | usEtherType = vos_be16_to_cpu(usEtherType); |
| 11372 | *pUsEtherType = usEtherType; |
| 11373 | |
| 11374 | TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 11375 | "WLAN TL:Ether type retrieved: %d", usEtherType)); |
| 11376 | } |
| 11377 | |
| 11378 | return vosStatus; |
| 11379 | } |
| 11380 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11381 | /*========================================================================== |
| 11382 | FUNCTION WLANTL_GetSoftAPStatistics |
| 11383 | |
| 11384 | DESCRIPTION Collect the cumulative statistics for all Softap stations |
| 11385 | |
| 11386 | DEPENDENCIES NONE |
| 11387 | |
| 11388 | PARAMETERS in pvosGCtx - Pointer to the global vos context |
| 11389 | bReset - If set TL statistics will be cleared after reading |
| 11390 | out statsSum - pointer to collected statistics |
| 11391 | |
| 11392 | RETURN VALUE VOS_STATUS_SUCCESS : if the Statistics are successfully extracted |
| 11393 | |
| 11394 | SIDE EFFECTS NONE |
| 11395 | |
| 11396 | ============================================================================*/ |
| 11397 | VOS_STATUS WLANTL_GetSoftAPStatistics(v_PVOID_t pAdapter, WLANTL_TRANSFER_STA_TYPE *statsSum, v_BOOL_t bReset) |
| 11398 | { |
| 11399 | v_U8_t i = 0; |
| 11400 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 11401 | WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter); |
| 11402 | WLANTL_TRANSFER_STA_TYPE statBufferTemp; |
| 11403 | vos_mem_zero((v_VOID_t *)&statBufferTemp, sizeof(WLANTL_TRANSFER_STA_TYPE)); |
| 11404 | vos_mem_zero((v_VOID_t *)statsSum, sizeof(WLANTL_TRANSFER_STA_TYPE)); |
| 11405 | |
| 11406 | |
| 11407 | if ( NULL == pTLCb ) |
| 11408 | { |
| 11409 | return VOS_STATUS_E_FAULT; |
| 11410 | } |
| 11411 | |
| 11412 | // Sum up all the statistics for stations of Soft AP from TL |
| 11413 | for (i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 11414 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 11415 | if ( NULL == pTLCb->atlSTAClients[i]) |
| 11416 | { |
| 11417 | continue; |
| 11418 | } |
| 11419 | if (pTLCb->atlSTAClients[i]->wSTADesc.wSTAType == WLAN_STA_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11420 | { |
| 11421 | vosStatus = WLANTL_GetStatistics(pAdapter, &statBufferTemp, i);// Can include staId 1 because statistics not collected for it |
| 11422 | |
| 11423 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 11424 | return VOS_STATUS_E_FAULT; |
| 11425 | |
| 11426 | // Add to the counters |
| 11427 | statsSum->txUCFcnt += statBufferTemp.txUCFcnt; |
| 11428 | statsSum->txMCFcnt += statBufferTemp.txMCFcnt; |
| 11429 | statsSum->txBCFcnt += statBufferTemp.txBCFcnt; |
| 11430 | statsSum->txUCBcnt += statBufferTemp.txUCBcnt; |
| 11431 | statsSum->txMCBcnt += statBufferTemp.txMCBcnt; |
| 11432 | statsSum->txBCBcnt += statBufferTemp.txBCBcnt; |
| 11433 | statsSum->rxUCFcnt += statBufferTemp.rxUCFcnt; |
| 11434 | statsSum->rxMCFcnt += statBufferTemp.rxMCFcnt; |
| 11435 | statsSum->rxBCFcnt += statBufferTemp.rxBCFcnt; |
| 11436 | statsSum->rxUCBcnt += statBufferTemp.rxUCBcnt; |
| 11437 | statsSum->rxMCBcnt += statBufferTemp.rxMCBcnt; |
| 11438 | statsSum->rxBCBcnt += statBufferTemp.rxBCBcnt; |
| 11439 | |
| 11440 | if (bReset) |
| 11441 | { |
| 11442 | vosStatus = WLANTL_ResetStatistics(pAdapter, i); |
| 11443 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 11444 | return VOS_STATUS_E_FAULT; |
| 11445 | } |
| 11446 | } |
| 11447 | } |
| 11448 | |
| 11449 | return vosStatus; |
| 11450 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 11451 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 11452 | /*========================================================================== |
| 11453 | FUNCTION WLANTL_GetEtherType_2 |
| 11454 | |
| 11455 | DESCRIPTION Extract Ether type information from the BD |
| 11456 | |
| 11457 | DEPENDENCIES NONE |
| 11458 | |
| 11459 | PARAMETERS in aucBDHeader - BD header |
| 11460 | in vosDataBuff - data buffer |
| 11461 | in ucMPDUHLen - MPDU header length |
| 11462 | out pUsEtherType - pointer to Ethertype |
| 11463 | |
| 11464 | RETURN VALUE VOS_STATUS_SUCCESS : if the EtherType is successfully extracted |
| 11465 | VOS_STATUS_FAILURE : if the EtherType extraction failed and |
| 11466 | the packet was dropped |
| 11467 | |
| 11468 | SIDE EFFECTS NONE |
| 11469 | |
| 11470 | ============================================================================*/ |
| 11471 | static VOS_STATUS WLANTL_GetEtherType_2 |
| 11472 | ( |
| 11473 | v_U8_t * aucBDHeader, |
| 11474 | vos_pkt_t * vosDataBuff, |
| 11475 | v_U8_t ucMPDUHLen, |
| 11476 | v_U16_t * pUsEtherType |
| 11477 | ) |
| 11478 | { |
| 11479 | v_U8_t ucOffset; |
| 11480 | v_U16_t usEtherType = *pUsEtherType; |
| 11481 | v_SIZE_t usLLCSize = sizeof(usEtherType); |
| 11482 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 11483 | //v_U8_t ucLLCHeader; |
| 11484 | v_U8_t ucMPDUHOffset ; |
| 11485 | /*------------------------------------------------------------------------ |
| 11486 | Check if LLC is present - if not, TL is unable to determine type |
| 11487 | ------------------------------------------------------------------------*/ |
| 11488 | //ucMPDUHOffset = (v_U8_t)WLANHAL_RX_BD_GET_MPDU_H_OFFSET(aucBDHeader) ; |
| 11489 | //ucLLCHeader = (v_U8_t)WLANHAL_RX_BD_GET_LLC(aucBDHeader); |
| 11490 | ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(aucBDHeader); |
| 11491 | |
| 11492 | if ( VOS_TRUE == WDA_IS_RX_LLC_PRESENT(aucBDHeader) ) |
| 11493 | { |
| 11494 | ucOffset = ucMPDUHOffset + WLANTL_802_3_HEADER_LEN - sizeof(usEtherType); |
| 11495 | } |
| 11496 | else |
| 11497 | { |
| 11498 | ucOffset = WLANHAL_RX_BD_HEADER_SIZE + ucMPDUHLen |
| 11499 | + WLANTL_LLC_PROTO_TYPE_OFFSET; |
| 11500 | } |
| 11501 | |
| 11502 | /*------------------------------------------------------------------------ |
| 11503 | Extract LLC type |
| 11504 | ------------------------------------------------------------------------*/ |
| 11505 | vosStatus = vos_pkt_extract_data( vosDataBuff, ucOffset, |
| 11506 | (v_PVOID_t)&usEtherType, &usLLCSize); |
| 11507 | |
| 11508 | /* TODO: Do it in better way */ |
| 11509 | if(vos_be16_to_cpu(usEtherType) == 0x890d) |
| 11510 | { |
| 11511 | VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 11512 | ("TDLS frame llc %x \n"), vos_be16_to_cpu(usEtherType)) ; |
| 11513 | } |
| 11514 | |
| 11515 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 11516 | "WLAN TL:Ether type retrieved before endianess conv: %d", |
| 11517 | usEtherType); |
| 11518 | |
| 11519 | usEtherType = vos_be16_to_cpu(usEtherType); |
| 11520 | *pUsEtherType = usEtherType; |
| 11521 | |
| 11522 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 11523 | "WLAN TL:Ether type retrieved: %d", usEtherType); |
| 11524 | |
| 11525 | return vosStatus; |
| 11526 | } |
| 11527 | #endif /* FEATURE_WLAN_TDLS */ |
| 11528 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11529 | /*=============================================================================== |
| 11530 | FUNCTION WLANTL_IsReplayPacket |
| 11531 | |
| 11532 | DESCRIPTION This function does replay check for valid stations |
| 11533 | |
| 11534 | DEPENDENCIES Validity of replay check must be done before the function |
| 11535 | is called |
| 11536 | |
| 11537 | PARAMETERS currentReplayCounter current replay counter taken from RX BD |
| 11538 | previousReplayCounter previous replay counter taken from TL CB |
| 11539 | |
| 11540 | RETRUN VOS_TRUE packet is a replay packet |
| 11541 | VOS_FALSE packet is not a replay packet |
| 11542 | |
| 11543 | SIDE EFFECTS none |
| 11544 | ===============================================================================*/ |
| 11545 | v_BOOL_t |
| 11546 | WLANTL_IsReplayPacket |
| 11547 | ( |
| 11548 | v_U64_t ullcurrentReplayCounter, |
| 11549 | v_U64_t ullpreviousReplayCounter |
| 11550 | ) |
| 11551 | { |
| 11552 | /* Do the replay check by comparing previous received replay counter with |
| 11553 | current received replay counter*/ |
| 11554 | if(ullpreviousReplayCounter < ullcurrentReplayCounter) |
| 11555 | { |
| 11556 | /* Valid packet not replay */ |
| 11557 | return VOS_FALSE; |
| 11558 | } |
| 11559 | else |
| 11560 | { |
| 11561 | |
| 11562 | /* Current packet number is less than or equal to previuos received |
| 11563 | packet no, this means current packet is replay packet */ |
| 11564 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
| 11565 | "WLAN TL: Replay packet found with replay counter :[0x%llX]",ullcurrentReplayCounter); |
| 11566 | |
| 11567 | return VOS_TRUE; |
| 11568 | } |
| 11569 | } |
| 11570 | |
| 11571 | #if 0 |
| 11572 | /*=============================================================================== |
| 11573 | FUNCTION WLANTL_GetReplayCounterFromRxBD |
| 11574 | |
| 11575 | DESCRIPTION This function extracts 48-bit replay packet number from RX BD |
| 11576 | |
| 11577 | DEPENDENCIES Validity of replay check must be done before the function |
| 11578 | is called |
| 11579 | |
| 11580 | PARAMETERS pucRxHeader pointer to RX BD header |
| 11581 | |
| 11582 | RETRUN v_U64_t Packet number extarcted from RX BD |
| 11583 | |
| 11584 | SIDE EFFECTS none |
| 11585 | ===============================================================================*/ |
| 11586 | v_U64_t |
| 11587 | WLANTL_GetReplayCounterFromRxBD |
| 11588 | ( |
| 11589 | v_U8_t *pucRxBDHeader |
| 11590 | ) |
| 11591 | { |
| 11592 | /* 48-bit replay counter is created as follows |
| 11593 | from RX BD 6 byte PMI command: |
| 11594 | Addr : AES/TKIP |
| 11595 | 0x38 : pn3/tsc3 |
| 11596 | 0x39 : pn2/tsc2 |
| 11597 | 0x3a : pn1/tsc1 |
| 11598 | 0x3b : pn0/tsc0 |
| 11599 | |
| 11600 | 0x3c : pn5/tsc5 |
| 11601 | 0x3d : pn4/tsc4 */ |
| 11602 | |
| 11603 | #ifdef ANI_BIG_BYTE_ENDIAN |
| 11604 | v_U64_t ullcurrentReplayCounter = 0; |
| 11605 | /* Getting 48-bit replay counter from the RX BD */ |
| 11606 | ullcurrentReplayCounter = WLANHAL_RX_BD_GET_PMICMD_20TO23(pucRxBDHeader); |
| 11607 | ullcurrentReplayCounter <<= 16; |
| 11608 | ullcurrentReplayCounter |= (( WLANHAL_RX_BD_GET_PMICMD_24TO25(pucRxBDHeader) & 0xFFFF0000) >> 16); |
| 11609 | return ullcurrentReplayCounter; |
| 11610 | #else |
| 11611 | v_U64_t ullcurrentReplayCounter = 0; |
| 11612 | /* Getting 48-bit replay counter from the RX BD */ |
| 11613 | ullcurrentReplayCounter = (WLANHAL_RX_BD_GET_PMICMD_24TO25(pucRxBDHeader) & 0x0000FFFF); |
| 11614 | ullcurrentReplayCounter <<= 32; |
| 11615 | ullcurrentReplayCounter |= WLANHAL_RX_BD_GET_PMICMD_20TO23(pucRxBDHeader); |
| 11616 | return ullcurrentReplayCounter; |
| 11617 | #endif |
| 11618 | } |
| 11619 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11620 | |
| 11621 | /*=============================================================================== |
| 11622 | FUNCTION WLANTL_PostResNeeded |
| 11623 | |
| 11624 | DESCRIPTION This function posts message to TL to reserve BD/PDU memory |
| 11625 | |
| 11626 | DEPENDENCIES None |
| 11627 | |
| 11628 | PARAMETERS pvosGCtx |
| 11629 | |
| 11630 | RETURN None |
| 11631 | |
| 11632 | SIDE EFFECTS none |
| 11633 | ===============================================================================*/ |
| 11634 | |
| 11635 | void WLANTL_PostResNeeded(v_PVOID_t pvosGCtx) |
| 11636 | { |
| 11637 | vos_msg_t vosMsg; |
| 11638 | |
| 11639 | vosMsg.reserved = 0; |
| 11640 | vosMsg.bodyptr = NULL; |
| 11641 | vosMsg.type = WLANTL_TX_RES_NEEDED; |
| 11642 | VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 11643 | "WLAN TL: BD/PDU available interrupt received, Posting message to TL"); |
| 11644 | if(!VOS_IS_STATUS_SUCCESS(vos_tx_mq_serialize( VOS_MQ_ID_TL, &vosMsg))) |
| 11645 | { |
| 11646 | VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11647 | " %s fails to post message", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11648 | } |
| 11649 | } |
| 11650 | |
| 11651 | /*=============================================================================== |
| 11652 | FUNCTION WLANTL_UpdateRssiBmps |
| 11653 | |
| 11654 | DESCRIPTION This function updates the TL's RSSI (in BMPS mode) |
| 11655 | |
| 11656 | DEPENDENCIES None |
| 11657 | |
| 11658 | PARAMETERS |
| 11659 | |
| 11660 | pvosGCtx VOS context VOS Global context |
| 11661 | staId Station ID Station ID |
| 11662 | rssi RSSI (BMPS mode) RSSI in BMPS mode |
| 11663 | |
| 11664 | RETURN None |
| 11665 | |
| 11666 | SIDE EFFECTS none |
| 11667 | ===============================================================================*/ |
| 11668 | |
| 11669 | void WLANTL_UpdateRssiBmps(v_PVOID_t pvosGCtx, v_U8_t staId, v_S7_t rssi) |
| 11670 | { |
| 11671 | WLANTL_CbType* pTLCb = VOS_GET_TL_CB(pvosGCtx); |
| 11672 | |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 11673 | if (NULL != pTLCb && NULL != pTLCb->atlSTAClients[staId]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11674 | { |
Madan Mohan Koyylamudi | 3b8400c | 2013-01-24 17:47:01 +0530 | [diff] [blame] | 11675 | pTLCb->atlSTAClients[staId]->rssiAvgBmps = rssi; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11676 | } |
| 11677 | } |