blob: ade1a2c7759b3e1bc1f5d8634128eebd34c935ed [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam1ed83fc2014-02-19 01:15:45 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
Kiet Lama7f454d2014-07-24 12:04:06 -070023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080026 */
Kiet Lam1ed83fc2014-02-19 01:15:45 -080027
28
Kiet Lama7f454d2014-07-24 12:04:06 -070029
30
Jeff Johnson295189b2012-06-20 16:38:30 -070031/*===========================================================================
32
33
34 W L A N _ Q C T _ T L . C
35
36 OVERVIEW:
37
38 This software unit holds the implementation of the WLAN Transport Layer.
39
40 The functions externalized by this module are to be called ONLY by other
41 WLAN modules that properly register with the Transport Layer initially.
42
43 DEPENDENCIES:
44
45 Are listed for each API below.
46
47
Kiet Lamaa8e15a2014-02-11 23:30:06 -080048 Copyright (c) 2008 QUALCOMM Incorporated.
49 All Rights Reserved.
50 Qualcomm Confidential and Proprietary
Jeff Johnson295189b2012-06-20 16:38:30 -070051===========================================================================*/
52
53/*===========================================================================
54
55 EDIT HISTORY FOR FILE
56
57
58 This section contains comments describing changes made to the module.
59 Notice that changes are listed in reverse chronological order.
60
61
62 $Header$$DateTime$$Author$
63
64
65 when who what, where, why
66---------- --- --------------------------------------------------------
672010-07-13 c_shinde Fixed an issue where WAPI rekeying was failing because
68 WAI frame sent out during rekeying had the protected bit
69 set to 1.
702010-05-06 rnair Changed name of variable from usLlcType to usEtherType
71 Changed function name from GetLLCType to GetEtherType
72 Fixed 802.3 to 802.11 frame translation issue where two
73 bytes of the LLC header was getting overwritten in the
74 non-Qos path
752010-05-06 rnair RxAuth path fix for modifying the header before ether
76 type is retreived (Detected while testing rekeying
77 in WAPI Volans)
782010-02-19 bad Fixed 802.11 to 802.3 ft issues with WAPI
792010-02-19 rnair WAPI: If frame is a WAI frame in TxConn and TxAuth, TL
80 does frame translation.
812010-02-01 rnair WAPI: Fixed a bug where the value of ucIsWapiSta was not
82 being set in the TL control block in the RegisterSTA func.
832010-01-08 lti Added TL Data Caching
842009-11-04 rnair WAPI: Moving common functionality to a seperate function
85 called WLANTL_GetLLCType
862009-10-15 rnair WAPI: Featurizing WAPI code
872009-10-09 rnair WAPI: Modifications to authenticated state handling of Rx data
882009-10-06 rnair Adding support for WAPI
892009-09-22 lti Add deregistration API for management client
902009-07-16 rnair Temporary fix to let TL fetch packets when multiple
91 peers exist in an IBSS
922009-06-10 lti Fix for checking TID value of meta info on TX - prevent
93 memory overwrite
94 Fix for properly checking the sta id for resuming trigger
95 frame generation
962009-05-14 lti Fix for sending out trigger frames
972009-05-15 lti Addr3 filtering
982009-04-13 lti Assert if packet larger then allowed
99 Drop packet that fails flatten
1002009-04-02 lti Performance fixes for TL
1012009-02-19 lti Added fix for LLC management on Rx Connect
1022009-01-16 lti Replaced peek data with extract data for non BD opertions
103 Extracted frame control in Tl and pass to HAL for frame
104 type evaluation
1052009-02-02 sch Add handoff support
1062008-12-09 lti Fixes for AMSS compilation
107 Removed assert on receive when there is no station
1082008-12-02 lti Fix fo trigger frame generation
1092008-10-31 lti Fix fo TL tx suspend
1102008-10-01 lti Merged in fixes from reordering
111 Disabled part of UAPSD functionality in TL
112 (will be re-enabled once UAPSD is tested)
113 Fix for UAPSD multiple enable
1142008-08-10 lti Fixes following UAPSD testing
115 Fixed infinite loop on mask computation when STA no reg
1162008-08-06 lti Fixes after QOS unit testing
1172008-08-06 lti Added QOS support
1182008-07-23 lti Fix for vos packet draining
1192008-07-17 lti Fix for data type value
120 Added frame translation code in TL
121 Avoid returning failure to PE in case previous frame is
122 still pending; fail previous and cache new one for tx
123 Get frames returning boolean true if more frames are pending
1242008-07-03 lti Fixes following pre-integration testing
1252008-06-26 lti Fixes following unit testing
126 Added alloc and free for TL context
127 Using atomic set u8 instead of u32
1282008-05-16 lti Created module
129
130===========================================================================*/
131
132/*----------------------------------------------------------------------------
133 * Include Files
134 * -------------------------------------------------------------------------*/
135#include "wlan_qct_tl.h"
136#include "wlan_qct_wda.h"
137#include "wlan_qct_tli.h"
138#include "wlan_qct_tli_ba.h"
139#include "wlan_qct_tl_hosupport.h"
Katya Nigam42e16e82014-02-04 16:28:55 +0530140#include "vos_types.h"
141#include "vos_trace.h"
142#include "wlan_qct_tl_trace.h"
Jeff Johnson295189b2012-06-20 16:38:30 -0700143#include "tlDebug.h"
144#ifdef FEATURE_WLAN_WAPI
145/*Included to access WDI_RxBdType */
146#include "wlan_qct_wdi_bd.h"
147#endif
148/*Enables debugging behavior in TL*/
149#define TL_DEBUG
Hoonki Lee14621352013-04-16 17:51:19 -0700150/*Enables debugging FC control frame in TL*/
151//#define TL_DEBUG_FC
Jeff Johnson295189b2012-06-20 16:38:30 -0700152//#define WLAN_SOFTAP_FLOWCTRL_EN
Jeff Johnson295189b2012-06-20 16:38:30 -0700153//#define BTAMP_TEST
Hoonki Lee14621352013-04-16 17:51:19 -0700154#ifdef TL_DEBUG_FC
155#include <wlan_qct_pal_status.h>
156#include <wlan_qct_pal_device.h> // wpalReadRegister
157#endif
158
Jeff Johnson295189b2012-06-20 16:38:30 -0700159/*----------------------------------------------------------------------------
160 * Preprocessor Definitions and Constants
161 * -------------------------------------------------------------------------*/
162/*LLC header value*/
163static v_U8_t WLANTL_LLC_HEADER[] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00 };
164
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800165#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700166/*Aironet SNAP header value*/
167static v_U8_t WLANTL_AIRONET_SNAP_HEADER[] = {0xAA, 0xAA, 0x03, 0x00, 0x40, 0x96, 0x00, 0x00 };
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800168#endif //FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700169
170/*BT-AMP packet LLC OUI value*/
171const v_U8_t WLANTL_BT_AMP_OUI[] = {0x00, 0x19, 0x58 };
172
Dino Mycle3b9536d2014-07-09 22:05:24 +0530173#ifdef WLAN_FEATURE_LINK_LAYER_STATS
174extern const v_U8_t WLANTL_TID_2_AC[WLAN_MAX_TID];
175
176#endif
177
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +0530178#define WLANTL_MAX_SNR_DATA_SAMPLES 20
Jeff Johnson295189b2012-06-20 16:38:30 -0700179
180#ifdef VOLANS_PERF
181#define WLANTL_BD_PDU_INTERRUPT_ENABLE_THRESHOLD 120
182#define WLANTL_BD_PDU_INTERRUPT_GET_THRESHOLD 120
183
184/* TL BD/PDU threshold to enable interrupt */
185int bdPduInterruptEnableThreshold = WLANTL_BD_PDU_INTERRUPT_ENABLE_THRESHOLD;
186int bdPduInterruptGetThreshold = WLANTL_BD_PDU_INTERRUPT_GET_THRESHOLD;
187#endif /* VOLANS_PERF */
188
189/*-----------------------------------*
190 | Type(2b) | Sub-type(4b) |
191 *-----------------------------------*/
192#define WLANTL_IS_DATA_FRAME(_type_sub) \
193 ( WLANTL_DATA_FRAME_TYPE == ( (_type_sub) & 0x30 ))
194
195#define WLANTL_IS_QOS_DATA_FRAME(_type_sub) \
196 (( WLANTL_DATA_FRAME_TYPE == ( (_type_sub) & 0x30 )) && \
197 ( WLANTL_80211_DATA_QOS_SUBTYPE == ( (_type_sub) & 0xF )))
198
199#define WLANTL_IS_MGMT_FRAME(_type_sub) \
200 ( WLANTL_MGMT_FRAME_TYPE == ( (_type_sub) & 0x30 ))
201
Dino Mycle3b9536d2014-07-09 22:05:24 +0530202#define WLANTL_IS_MGMT_ACTION_FRAME(_type_sub) \
203 (( WLANTL_MGMT_FRAME_TYPE == ( (_type_sub) & 0x30 )) && \
204 ( ( WLANTL_80211_MGMT_ACTION_SUBTYPE == ( (_type_sub) & 0xF )) || \
205 ( WLANTL_80211_MGMT_ACTION_NO_ACK_SUBTYPE == ( (_type_sub) & 0xF ))))
206
Siddharth Bhal4551b102014-10-09 21:36:36 +0530207#define WLANTL_IS_PROBE_REQ(_type_sub) \
208 ( WLANTL_MGMT_PROBE_REQ_FRAME_TYPE == ( (_type_sub) & 0x3F ))
209
Jeff Johnson295189b2012-06-20 16:38:30 -0700210#define WLANTL_IS_CTRL_FRAME(_type_sub) \
211 ( WLANTL_CTRL_FRAME_TYPE == ( (_type_sub) & 0x30 ))
212
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800213#ifdef FEATURE_WLAN_TDLS
214#define WLANTL_IS_TDLS_FRAME(_eth_type) \
215 ( WLANTL_LLC_TDLS_TYPE == ( _eth_type))
216#endif
217
Jeff Johnson295189b2012-06-20 16:38:30 -0700218/*MAX Allowed len processed by TL - MAx MTU + 802.3 header + BD+DXE+XTL*/
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -0800219#define WLANTL_MAX_ALLOWED_LEN (1514 + 100)
Jeff Johnson295189b2012-06-20 16:38:30 -0700220
221#define WLANTL_MASK_AC 0x03
222
Jeff Johnson295189b2012-06-20 16:38:30 -0700223//some flow_control define
224//LWM mode will be enabled for this station if the egress/ingress falls below this ratio
225#define WLANTL_LWM_EGRESS_INGRESS_THRESHOLD (0.75)
226
227//Get enough sample to do the LWM related calculation
228#define WLANTL_LWM_INGRESS_SAMPLE_THRESHOLD (64)
229
230//Maximal on-fly packet per station in LWM mode
231#define WLANTL_STA_BMU_THRESHOLD_MAX (256)
232
233#define WLANTL_AC_MASK (0x7)
Gopichand Nakkala976e3252013-01-03 15:45:56 -0800234#define WLANTL_STAID_OFFSET (0x6)
Jeff Johnson295189b2012-06-20 16:38:30 -0700235
236/* UINT32 type endian swap */
237#define SWAP_ENDIAN_UINT32(a) ((a) = ((a) >> 0x18 ) |(((a) & 0xFF0000) >> 0x08) | \
238 (((a) & 0xFF00) << 0x08) | (((a) & 0xFF) << 0x18))
239
Madan Mohan Koyyalamudi43acf032013-09-27 04:33:28 +0530240/* Maximum value of SNR that can be calculated by the HW */
241#define WLANTL_MAX_HW_SNR 35
Jeff Johnson295189b2012-06-20 16:38:30 -0700242
Jeff Johnson295189b2012-06-20 16:38:30 -0700243/*----------------------------------------------------------------------------
244 * Type Declarations
245 * -------------------------------------------------------------------------*/
246#define TL_LITTLE_BIT_ENDIAN
247
248typedef struct
249{
250
Jeff Johnson295189b2012-06-20 16:38:30 -0700251
252 v_U8_t protVer :2;
253 v_U8_t type :2;
254 v_U8_t subType :4;
255
256 v_U8_t toDS :1;
257 v_U8_t fromDS :1;
258 v_U8_t moreFrag :1;
259 v_U8_t retry :1;
260 v_U8_t powerMgmt :1;
261 v_U8_t moreData :1;
262 v_U8_t wep :1;
263 v_U8_t order :1;
264
Jeff Johnson295189b2012-06-20 16:38:30 -0700265
266} WLANTL_MACFCType;
267
268/* 802.11 header */
269typedef struct
270{
271 /* Frame control field */
272 WLANTL_MACFCType wFrmCtrl;
273
274 /* Duration ID */
275 v_U16_t usDurationId;
276
277 /* Address 1 field */
278 v_U8_t vA1[VOS_MAC_ADDR_SIZE];
279
280 /* Address 2 field */
281 v_U8_t vA2[VOS_MAC_ADDR_SIZE];
282
283 /* Address 3 field */
284 v_U8_t vA3[VOS_MAC_ADDR_SIZE];
285
286 /* Sequence control field */
287 v_U16_t usSeqCtrl;
288
289 // Find the size of the mandatory header size.
290#define WLAN80211_MANDATORY_HEADER_SIZE \
291 (sizeof(WLANTL_MACFCType) + sizeof(v_U16_t) + \
292 (3 * (sizeof(v_U8_t) * VOS_MAC_ADDR_SIZE)) + \
293 sizeof(v_U16_t))
294
295 /* Optional A4 address */
296 v_U8_t optvA4[VOS_MAC_ADDR_SIZE];
297
298 /* Optional QOS control field */
299 v_U16_t usQosCtrl;
300}WLANTL_80211HeaderType;
301
302/* 802.3 header */
303typedef struct
304{
305 /* Destination address field */
306 v_U8_t vDA[VOS_MAC_ADDR_SIZE];
307
308 /* Source address field */
309 v_U8_t vSA[VOS_MAC_ADDR_SIZE];
310
311 /* Length field */
312 v_U16_t usLenType;
313}WLANTL_8023HeaderType;
314
315/*----------------------------------------------------------------------------
316 * Global Data Definitions
317 * -------------------------------------------------------------------------*/
318#define WLAN_TL_INVALID_U_SIG 255
319#define WLAN_TL_INVALID_B_SIG 255
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530320#define ENTER() VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, "Enter:%s", __func__)
321
Jeff Johnson295189b2012-06-20 16:38:30 -0700322#define WLAN_TL_AC_ARRAY_2_MASK( _pSTA, _ucACMask, i ) \
323 do\
324 {\
325 _ucACMask = 0; \
326 for ( i = 0; i < WLANTL_MAX_AC; i++ ) \
327 { \
328 if ( 0 != (_pSTA)->aucACMask[i] ) \
329 { \
330 _ucACMask |= ( 1 << i ); \
331 } \
332 } \
333 } while (0);
334
335/*----------------------------------------------------------------------------
336 * Static Variable Definitions
337 * -------------------------------------------------------------------------*/
338
339/*----------------------------------------------------------------------------
340 * Static Function Declarations and Definitions
341 * -------------------------------------------------------------------------*/
342
343static VOS_STATUS
344WLANTL_GetEtherType
345(
346 v_U8_t * aucBDHeader,
347 vos_pkt_t * vosDataBuff,
348 v_U8_t ucMPDUHLen,
349 v_U16_t * usEtherType
350);
351
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800352#ifdef FEATURE_WLAN_TDLS_INTERNAL
353/* FIXME_MUST: during TDLS integration to main/latest, WLANTL_GetEtherType() conflicts.
354But there is difference. existing WLANTL_GetEtherType() expects vosDataBuff->offset points to MPDU Header,
355wherease TDLS expect vosDataBuff->offset should still points to RxBd.
356So far, data frmae stripped RxBD and passed to data frame handler.
357(RxBd should not be stripped in case TDLS, because it will be eventually routed to mgmt packet
358handler, where RX BD should be preserved)
359To avoid breaking existing functionality, for now, I temporarily rename to
360WLANTL_GetEtherType_2(). Eventually this function should be removed and merged to WLANTL_GetEtherType()
361*/
362static VOS_STATUS
363WLANTL_GetEtherType_2
364(
365 v_U8_t * aucBDHeader,
366 vos_pkt_t * vosDataBuff,
367 v_U8_t ucMPDUHLen,
368 v_U16_t * usEtherType
369);
370#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700371#ifdef FEATURE_WLAN_WAPI
372/*---------------------------------------------------------------------------
373 * Adding a global variable to be used when doing frame translation in TxAuth
374 * state so as to not set the protected bit to 1 in the case of WAI frames
375 *---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -0700376v_U8_t gUcIsWai;
Jeff Johnson295189b2012-06-20 16:38:30 -0700377#endif
378
379/*----------------------------------------------------------------------------
380 * Externalized Function Definitions
381* -------------------------------------------------------------------------*/
382
383/*----------------------------------------------------------------------------
384 * Function Declarations and Documentation
385 * -------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530386/*==========================================================================
387
388 FUNCTION WLANTL_FreeClientMemory
389
390 DESCRIPTION
391 It frees up the memory allocated to all the STA clients in TLCB block
392 Can be called inside Close, Stop or when some FAULT occurs
393
394 DEPENDENCIES
395
396 PARAMETERS
397
398 IN
399 pClientSTA: Pointer to the global client pointer array
400
401 RETURN VALUE
402
403 SIDE EFFECTS
404
405============================================================================*/
406void WLANTL_FreeClientMemory
407(WLANTL_STAClientType* pClientSTA[WLAN_MAX_STA_COUNT])
408{
409 v_U32_t i = 0;
410 for(i =0; i < WLAN_MAX_STA_COUNT; i++)
411 {
412 if( NULL != pClientSTA[i] )
413 {
414 vos_mem_free(pClientSTA[i]);
415 }
416 pClientSTA[i] = NULL;
417 }
418 return;
419}
Jeff Johnson295189b2012-06-20 16:38:30 -0700420
421/*==========================================================================
422
423 FUNCTION WLANTL_Open
424
425 DESCRIPTION
426 Called by HDD at driver initialization. TL will initialize all its
427 internal resources and will wait for the call to start to register
428 with the other modules.
429
430 DEPENDENCIES
431
432 PARAMETERS
433
434 IN
435 pvosGCtx: pointer to the global vos context; a handle to TL's
436 control block can be extracted from its context
437 pTLConfig: TL Configuration
438
439 RETURN VALUE
440 The result code associated with performing the operation
441
442 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a page
443 fault
444 VOS_STATUS_SUCCESS: Everything is good :)
445
446 SIDE EFFECTS
447
448============================================================================*/
449VOS_STATUS
450WLANTL_Open
451(
452 v_PVOID_t pvosGCtx,
453 WLANTL_ConfigInfoType* pTLConfig
454)
455{
456 WLANTL_CbType* pTLCb = NULL;
457 v_U8_t ucIndex;
458 tHalHandle smeContext;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530459 v_U32_t i = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700460#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
461 VOS_STATUS status = VOS_STATUS_SUCCESS;
462#endif
463 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
464
465 /*------------------------------------------------------------------------
466 Sanity check
467 Extract TL control block
468 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530469 ENTER();
Jeff Johnson295189b2012-06-20 16:38:30 -0700470 vos_alloc_context( pvosGCtx, VOS_MODULE_ID_TL,
471 (void*)&pTLCb, sizeof(WLANTL_CbType));
472
473 pTLCb = VOS_GET_TL_CB(pvosGCtx);
474 if (( NULL == pTLCb ) || ( NULL == pTLConfig ) )
475 {
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -0700476 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +0530477 "WLAN TL: Invalid input pointer on WLANTL_Open TL %p Config %p", pTLCb, pTLConfig ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700478 return VOS_STATUS_E_FAULT;
479 }
480
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -0700481 /* Set the default log level to VOS_TRACE_LEVEL_ERROR */
482 vos_trace_setLevel(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR);
483
Jeff Johnson295189b2012-06-20 16:38:30 -0700484 smeContext = vos_get_context(VOS_MODULE_ID_SME, pvosGCtx);
485 if ( NULL == smeContext )
486 {
487 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700488 "%s: Invalid smeContext", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -0700489 return VOS_STATUS_E_FAULT;
490 }
491
492 /* Zero out the memory so we are OK, when CleanCB is called.*/
493 vos_mem_zero((v_VOID_t *)pTLCb, sizeof(WLANTL_CbType));
494
495 /*------------------------------------------------------------------------
496 Clean up TL control block, initialize all values
497 ------------------------------------------------------------------------*/
498 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
499 "WLAN TL:WLANTL_Open"));
500
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530501 for ( i =0; i<WLAN_MAX_STA_COUNT; i++ )
Jeff Johnson295189b2012-06-20 16:38:30 -0700502 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530503 if ( i < WLAN_NON32_STA_COUNT )
504 {
505 pTLCb->atlSTAClients[i] = vos_mem_malloc(sizeof(WLANTL_STAClientType));
506 /* Allocating memory for LEGACY STA COUNT so as to avoid regression issues. */
507 if ( NULL == pTLCb->atlSTAClients[i] )
508 {
509 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "WLAN TL: StaClient allocation failed"));
510 WLANTL_FreeClientMemory(pTLCb->atlSTAClients);
511 vos_free_context(pvosGCtx, VOS_MODULE_ID_TL, pTLCb);
512 return VOS_STATUS_E_FAULT;
513 }
514 vos_mem_zero((v_VOID_t *) pTLCb->atlSTAClients[i], sizeof(WLANTL_STAClientType));
515 }
516 else
517 {
518 pTLCb->atlSTAClients[i] = NULL;
519 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700520 }
521
Jeff Johnson295189b2012-06-20 16:38:30 -0700522 pTLCb->reorderBufferPool = vos_mem_malloc(sizeof(WLANTL_REORDER_BUFFER_T) * WLANTL_MAX_BA_SESSION);
523 if (NULL == pTLCb->reorderBufferPool)
524 {
Arif Hussainf2b00992013-11-17 21:46:15 -0800525 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "WLAN TL: Reorder buffer allocation failed"));
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530526 WLANTL_FreeClientMemory(pTLCb->atlSTAClients);
Jeff Johnson295189b2012-06-20 16:38:30 -0700527 vos_free_context(pvosGCtx, VOS_MODULE_ID_TL, pTLCb);
528 return VOS_STATUS_E_FAULT;
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 }
530
531 vos_mem_zero((v_VOID_t *)pTLCb->reorderBufferPool, sizeof(WLANTL_REORDER_BUFFER_T) * WLANTL_MAX_BA_SESSION);
532
533 WLANTL_CleanCB(pTLCb, 0 /*do not empty*/);
534
535 for ( ucIndex = 0; ucIndex < WLANTL_MAX_AC ; ucIndex++)
536 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530537 pTLCb->tlConfigInfo.ucAcWeights[ucIndex] = pTLConfig->ucAcWeights[ucIndex];
Jeff Johnson295189b2012-06-20 16:38:30 -0700538 }
539
Dhanashri Atred8c20a32014-01-03 17:20:55 -0800540 for ( ucIndex = 0; ucIndex < WLANTL_MAX_AC ; ucIndex++)
541 {
542 pTLCb->tlConfigInfo.ucReorderAgingTime[ucIndex] = pTLConfig->ucReorderAgingTime[ucIndex];
543 }
544
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 // scheduling init to be the last one of previous round
546 pTLCb->uCurServedAC = WLANTL_AC_BK;
547 pTLCb->ucCurLeftWeight = 1;
548 pTLCb->ucCurrentSTA = WLAN_MAX_STA_COUNT-1;
549
550#if 0
551 //flow control field init
552 vos_mem_zero(&pTLCb->tlFCInfo, sizeof(tFcTxParams_type));
553 //bit 0: set (Bd/pdu count) bit 1: set (request station PS change notification)
554 pTLCb->tlFCInfo.fcConfig = 0x1;
555#endif
556
557 pTLCb->vosTxFCBuf = NULL;
558 pTLCb->tlConfigInfo.uMinFramesProcThres =
559 pTLConfig->uMinFramesProcThres;
Jeff Johnson295189b2012-06-20 16:38:30 -0700560
Sunil Ravid5406f22013-01-22 00:18:31 -0800561#ifdef FEATURE_WLAN_TDLS
562 pTLCb->ucTdlsPeerCount = 0;
563#endif
564
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 pTLCb->tlConfigInfo.uDelayedTriggerFrmInt =
566 pTLConfig->uDelayedTriggerFrmInt;
567
568 /*------------------------------------------------------------------------
569 Allocate internal resources
570 ------------------------------------------------------------------------*/
571 vos_pkt_get_packet(&pTLCb->vosDummyBuf, VOS_PKT_TYPE_RX_RAW, 1, 1,
572 1/*true*/,NULL, NULL);
573
574 WLANTL_InitBAReorderBuffer(pvosGCtx);
575#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
576 /* Initialize Handoff support modue
577 * RSSI measure and Traffic state monitoring */
578 status = WLANTL_HSInit(pvosGCtx);
579 if(!VOS_IS_STATUS_SUCCESS(status))
580 {
581 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
582 "Handoff support module init fail"));
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530583 WLANTL_FreeClientMemory(pTLCb->atlSTAClients);
Jeff Johnson295189b2012-06-20 16:38:30 -0700584 vos_mem_free(pTLCb->reorderBufferPool);
585 vos_free_context(pvosGCtx, VOS_MODULE_ID_TL, pTLCb);
586 return status;
587 }
588#endif
589
590 pTLCb->isBMPS = VOS_FALSE;
591 pmcRegisterDeviceStateUpdateInd( smeContext,
592 WLANTL_PowerStateChangedCB, pvosGCtx );
593
594 return VOS_STATUS_SUCCESS;
595}/* WLANTL_Open */
596
597/*==========================================================================
598
599 FUNCTION WLANTL_Start
600
601 DESCRIPTION
602 Called by HDD as part of the overall start procedure. TL will use this
603 call to register with BAL as a transport layer entity.
604
605 DEPENDENCIES
606
607 PARAMETERS
608
609 IN
610 pvosGCtx: pointer to the global vos context; a handle to TL's
611 control block can be extracted from its context
612
613 RETURN VALUE
614 The result code associated with performing the operation
615
616 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a page
617 fault
618 VOS_STATUS_SUCCESS: Everything is good :)
619
620 Other codes can be returned as a result of a BAL failure; see BAL API
621 for more info
622
623 SIDE EFFECTS
624
625============================================================================*/
626VOS_STATUS
627WLANTL_Start
628(
629 v_PVOID_t pvosGCtx
630)
631{
632 WLANTL_CbType* pTLCb = NULL;
633 v_U32_t uResCount = WDA_TLI_MIN_RES_DATA;
634 VOS_STATUS vosStatus;
635 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
636
637 /*------------------------------------------------------------------------
638 Sanity check
639 Extract TL control block
640 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530641 ENTER();
Jeff Johnson295189b2012-06-20 16:38:30 -0700642 pTLCb = VOS_GET_TL_CB(pvosGCtx);
643 if ( NULL == pTLCb )
644 {
645 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
646 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_Start"));
647 return VOS_STATUS_E_FAULT;
648 }
649
650 /*------------------------------------------------------------------------
651 Register with WDA as transport layer client
652 Request resources for tx from bus
653 ------------------------------------------------------------------------*/
654 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
655 "WLAN TL:WLAN TL:WLANTL_Start"));
656
Katya Nigam42e16e82014-02-04 16:28:55 +0530657 tlTraceInit();
Jeff Johnson295189b2012-06-20 16:38:30 -0700658 vosStatus = WDA_DS_Register( pvosGCtx,
659 WLANTL_TxComp,
660 WLANTL_RxFrames,
661 WLANTL_GetFrames,
662 WLANTL_ResourceCB,
663 WDA_TLI_MIN_RES_DATA,
664 pvosGCtx,
665 &uResCount );
666
667 if ( VOS_STATUS_SUCCESS != vosStatus )
668 {
669 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
670 "WLAN TL:TL failed to register with BAL/WDA, Err: %d",
671 vosStatus));
672 return vosStatus;
673 }
674
675 /* Enable transmission */
676 vos_atomic_set_U8( &pTLCb->ucTxSuspended, 0);
677
678 pTLCb->uResCount = uResCount;
Jeff Johnson295189b2012-06-20 16:38:30 -0700679 return VOS_STATUS_SUCCESS;
680}/* WLANTL_Start */
681
682/*==========================================================================
683
684 FUNCTION WLANTL_Stop
685
686 DESCRIPTION
687 Called by HDD to stop operation in TL, before close. TL will suspend all
688 frame transfer operation and will wait for the close request to clean up
689 its resources.
690
691 DEPENDENCIES
692
693 PARAMETERS
694
695 IN
696 pvosGCtx: pointer to the global vos context; a handle to TL's
697 control block can be extracted from its context
698
699 RETURN VALUE
700 The result code associated with performing the operation
701
702 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a page
703 fault
704 VOS_STATUS_SUCCESS: Everything is good :)
705
706 SIDE EFFECTS
707
708============================================================================*/
709VOS_STATUS
710WLANTL_Stop
711(
712 v_PVOID_t pvosGCtx
713)
714{
715 WLANTL_CbType* pTLCb = NULL;
716 v_U8_t ucIndex;
717 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
718
719 /*------------------------------------------------------------------------
720 Sanity check
721 Extract TL control block
722 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530723 ENTER();
Jeff Johnson295189b2012-06-20 16:38:30 -0700724 pTLCb = VOS_GET_TL_CB(pvosGCtx);
725 if ( NULL == pTLCb )
726 {
727 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
728 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
729 return VOS_STATUS_E_FAULT;
730 }
731
732 /*------------------------------------------------------------------------
733 Stop TL and empty Station list
734 ------------------------------------------------------------------------*/
735 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
736 "WLAN TL:WLANTL_Stop"));
737
738 /* Disable transmission */
739 vos_atomic_set_U8( &pTLCb->ucTxSuspended, 1);
740
741 if ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff )
742 {
743 vos_pkt_return_packet(pTLCb->tlMgmtFrmClient.vosPendingDataBuff);
744 pTLCb->tlMgmtFrmClient.vosPendingDataBuff = NULL;
745 }
746
747 if ( NULL != pTLCb->tlBAPClient.vosPendingDataBuff )
748 {
749 vos_pkt_return_packet(pTLCb->tlBAPClient.vosPendingDataBuff);
750 pTLCb->tlBAPClient.vosPendingDataBuff = NULL;
751 }
752
753#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
754 if(VOS_STATUS_SUCCESS != WLANTL_HSStop(pvosGCtx))
755 {
756 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
757 "Handoff Support module stop fail"));
758 }
759#endif
760
761 /*-------------------------------------------------------------------------
762 Clean client stations
763 -------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530764 for ( ucIndex = 0; ucIndex < WLAN_MAX_STA_COUNT; ucIndex++)
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530766 if ( NULL != pTLCb->atlSTAClients[ucIndex] )
767 {
768 WLANTL_CleanSTA(pTLCb->atlSTAClients[ucIndex], 1 /*empty all queues*/);
769 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700770 }
771
772
773 return VOS_STATUS_SUCCESS;
774}/* WLANTL_Stop */
775
776/*==========================================================================
777
778 FUNCTION WLANTL_Close
779
780 DESCRIPTION
781 Called by HDD during general driver close procedure. TL will clean up
782 all the internal resources.
783
784 DEPENDENCIES
785
786 PARAMETERS
787
788 IN
789 pvosGCtx: pointer to the global vos context; a handle to TL's
790 control block can be extracted from its context
791
792 RETURN VALUE
793 The result code associated with performing the operation
794
795 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a page
796 fault
797 VOS_STATUS_SUCCESS: Everything is good :)
798
799 SIDE EFFECTS
800
801============================================================================*/
802VOS_STATUS
803WLANTL_Close
804(
805 v_PVOID_t pvosGCtx
806)
807{
808 WLANTL_CbType* pTLCb = NULL;
809 tHalHandle smeContext;
810 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
811
812 /*------------------------------------------------------------------------
813 Sanity check
814 Extract TL control block
815 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530816 ENTER();
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 pTLCb = VOS_GET_TL_CB(pvosGCtx);
818 if ( NULL == pTLCb )
819 {
820 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
821 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
822 return VOS_STATUS_E_FAULT;
823 }
824 /*------------------------------------------------------------------------
825 Deregister from PMC
826 ------------------------------------------------------------------------*/
827 smeContext = vos_get_context(VOS_MODULE_ID_SME, pvosGCtx);
828 if ( NULL == smeContext )
829 {
830 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700831 "%s: Invalid smeContext", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -0700832 // continue so that we can cleanup as much as possible
833 }
834 else
835 {
836 pmcDeregisterDeviceStateUpdateInd( smeContext, WLANTL_PowerStateChangedCB );
837 }
838
839#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
840 if(VOS_STATUS_SUCCESS != WLANTL_HSDeInit(pvosGCtx))
841 {
842 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
843 "Handoff Support module DeInit fail"));
844 }
845#endif
846
847 /*------------------------------------------------------------------------
848 Cleanup TL control block.
849 ------------------------------------------------------------------------*/
850 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
851 "WLAN TL: WLANTL_Close"));
852 WLANTL_CleanCB(pTLCb, 1 /* empty queues/lists/pkts if any*/);
853
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530854 WLANTL_FreeClientMemory(pTLCb->atlSTAClients);
855
Jeff Johnson295189b2012-06-20 16:38:30 -0700856 vos_mem_free(pTLCb->reorderBufferPool);
857
858 /*------------------------------------------------------------------------
859 Free TL context from VOSS global
860 ------------------------------------------------------------------------*/
861 vos_free_context(pvosGCtx, VOS_MODULE_ID_TL, pTLCb);
862 return VOS_STATUS_SUCCESS;
863}/* WLANTL_Close */
864
865/*----------------------------------------------------------------------------
866 INTERACTION WITH HDD
867 ---------------------------------------------------------------------------*/
868/*==========================================================================
869
870 FUNCTION WLANTL_ConfigureSwFrameTXXlationForAll
871
872 DESCRIPTION
873 Function to disable/enable frame translation for all association stations.
874
875 DEPENDENCIES
876
877 PARAMETERS
878 IN
879 pvosGCtx: VOS context
880 EnableFrameXlation TRUE means enable SW translation for all stations.
881 .
882
883 RETURN VALUE
884
885 void.
886
887============================================================================*/
888void
889WLANTL_ConfigureSwFrameTXXlationForAll
890(
891 v_PVOID_t pvosGCtx,
892 v_BOOL_t enableFrameXlation
893)
894{
895 v_U8_t ucIndex;
896 /*------------------------------------------------------------------------
897 Extract TL control block
898 ------------------------------------------------------------------------*/
899 WLANTL_CbType* pTLCb = VOS_GET_TL_CB(pvosGCtx);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530900 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700901 if ( NULL == pTLCb )
902 {
903 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
904 "WLAN TL:Invalid TL pointer from pvosGCtx on "
905 "WLANTL_ConfigureSwFrameTXXlationForAll"));
906 return;
907 }
908
909 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
910 "WLANTL_ConfigureSwFrameTXXlationForAll: Configure SW frameXlation %d",
911 enableFrameXlation));
912
913 for ( ucIndex = 0; ucIndex < WLAN_MAX_TID; ucIndex++)
914 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530915 pClientSTA = pTLCb->atlSTAClients[ucIndex];
916 if ( NULL != pClientSTA && 0 != pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -0700917 {
918#ifdef WLAN_SOFTAP_VSTA_FEATURE
919 // if this station was not allocated resources to perform HW-based
920 // TX frame translation then force SW-based TX frame translation
921 // otherwise use the frame translation supplied by the client
922 if (!WDA_IsHwFrameTxTranslationCapable(pvosGCtx, ucIndex))
923 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530924 pClientSTA->wSTADesc.ucSwFrameTXXlation = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -0700925 }
926 else
927#endif
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530928 pClientSTA->wSTADesc.ucSwFrameTXXlation = enableFrameXlation;
Jeff Johnson295189b2012-06-20 16:38:30 -0700929 }
930 }
931}
932
933/*===========================================================================
934
935 FUNCTION WLANTL_StartForwarding
936
937 DESCRIPTION
938
939 This function is used to ask serialization through TX thread of the
940 cached frame forwarding (if statation has been registered in the mean while)
941 or flushing (if station has not been registered by the time)
942
943 In case of forwarding, upper layer is only required to call WLANTL_RegisterSTAClient()
944 and doesn't need to call this function explicitly. TL will handle this inside
945 WLANTL_RegisterSTAClient().
946
947 In case of flushing, upper layer is required to call this function explicitly
948
949 DEPENDENCIES
950
951 TL must have been initialized before this gets called.
952
953
954 PARAMETERS
955
956 ucSTAId: station id
957
958 RETURN VALUE
959
960 The result code associated with performing the operation
961 Please check return values of vos_tx_mq_serialize.
962
963 SIDE EFFECTS
964 If TL was asked to perform WLANTL_CacheSTAFrame() in WLANTL_RxFrames(),
965 either WLANTL_RegisterSTAClient() or this function must be called
966 within reasonable time. Otherwise, TL will keep cached vos buffer until
967 one of this function is called, and may end up with system buffer exhasution.
968
969 It's an upper layer's responsibility to call this function in case of
970 flushing
971
972============================================================================*/
973
974VOS_STATUS
975WLANTL_StartForwarding
976(
977 v_U8_t ucSTAId,
978 v_U8_t ucUcastSig,
979 v_U8_t ucBcastSig
980)
981{
982 vos_msg_t sMessage;
983 v_U32_t uData;
984 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
985
986 /* Signal the OS to serialize our event */
987 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
988 "Serializing TL Start Forwarding Cached for control STA %d",
989 ucSTAId );
990
991 vos_mem_zero( &sMessage, sizeof(vos_msg_t) );
992
993 uData = ucSTAId | (ucUcastSig << 8 ) | (ucBcastSig << 16);
Jeff Johnsond86c05a2013-11-10 18:50:34 -0800994 sMessage.bodyval = uData;
Katya Nigam664f5032014-05-05 12:24:32 +0530995 sMessage.type = WLANTL_RX_FWD_CACHED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700996
Katya Nigam664f5032014-05-05 12:24:32 +0530997 return vos_rx_mq_serialize(VOS_MQ_ID_TL, &sMessage);
Jeff Johnson295189b2012-06-20 16:38:30 -0700998
999} /* WLANTL_StartForwarding() */
1000
1001/*===========================================================================
1002
Katya Nigam63902932014-06-26 19:04:23 +05301003 FUNCTION WLANTL_EnableCaching
1004
1005 DESCRIPTION
1006
1007 This function is used to enable caching only when assoc/reassoc req is send.
1008 that is cache packets only for such STA ID.
1009
1010
1011 DEPENDENCIES
1012
1013 TL must have been initialized before this gets called.
1014
1015
1016 PARAMETERS
1017
1018 staId: station id
1019
1020 RETURN VALUE
1021
1022 none
1023
1024============================================================================*/
1025void WLANTL_EnableCaching(v_U8_t staId)
1026{
1027 v_PVOID_t pvosGCtx= vos_get_global_context(VOS_MODULE_ID_TL,NULL);
1028 WLANTL_CbType* pTLCb = VOS_GET_TL_CB(pvosGCtx);
1029 if ( NULL == pTLCb )
1030 {
1031 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1032 "WLAN TL:Invalid TL pointer from pvosGCtx on "
1033 "WLANTL_EnableCaching"));
1034 return;
1035 }
1036 pTLCb->atlSTAClients[staId]->enableCaching = 1;
1037}
1038
1039/*===========================================================================
1040
Jeff Johnson295189b2012-06-20 16:38:30 -07001041 FUNCTION WLANTL_AssocFailed
1042
1043 DESCRIPTION
1044
1045 This function is used by PE to notify TL that cache needs to flushed'
1046 when association is not successfully completed
1047
1048 Internally, TL post a message to TX_Thread to serialize the request to
1049 keep lock-free mechanism.
1050
1051
1052 DEPENDENCIES
1053
1054 TL must have been initialized before this gets called.
1055
1056
1057 PARAMETERS
1058
1059 ucSTAId: station id
1060
1061 RETURN VALUE
1062
1063 none
1064
1065 SIDE EFFECTS
1066 There may be race condition that PE call this API and send another association
1067 request immediately with same staId before TX_thread can process the message.
1068
1069 To avoid this, we might need PE to wait for TX_thread process the message,
1070 but this is not currently implemented.
1071
1072============================================================================*/
1073void WLANTL_AssocFailed(v_U8_t staId)
1074{
1075 // flushing frames and forwarding frames uses the same message
1076 // the only difference is what happens when the message is processed
1077 // if the STA exist, the frames will be forwarded
1078 // and if it doesn't exist, the frames will be flushed
1079 // in this case we know it won't exist so the DPU index signature values don't matter
Mihir Sheteae6f02b2014-04-11 19:49:21 +05301080 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_ASSOC_FAILED,
1081 staId, 0));
1082
Jeff Johnson295189b2012-06-20 16:38:30 -07001083 if(!VOS_IS_STATUS_SUCCESS(WLANTL_StartForwarding(staId,0,0)))
1084 {
1085 VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Mihir Sheteb7337272014-04-11 15:53:08 +05301086 " %s fails to start forwarding (staId %d)", __func__, staId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001087 }
1088}
1089
1090 /*===========================================================================
1091
1092 FUNCTION WLANTL_Finish_ULA
1093
1094 DESCRIPTION
1095 This function is used by HDD to notify TL to finish Upper layer authentication
1096 incase the last EAPOL packet is pending in the TL queue.
1097 To avoid the race condition between sme set key and the last EAPOL packet
1098 the HDD module calls this function just before calling the sme_RoamSetKey.
1099
1100 DEPENDENCIES
1101
1102 TL must have been initialized before this gets called.
1103
1104 PARAMETERS
1105
1106 callbackRoutine: HDD Callback function.
1107 callbackContext : HDD userdata context.
1108
1109 RETURN VALUE
1110
1111 VOS_STATUS_SUCCESS/VOS_STATUS_FAILURE
1112
1113 SIDE EFFECTS
1114
1115============================================================================*/
1116
1117VOS_STATUS WLANTL_Finish_ULA( void (*callbackRoutine) (void *callbackContext),
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -08001118 void *callbackContext)
Jeff Johnson295189b2012-06-20 16:38:30 -07001119{
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -08001120 return WDA_DS_FinishULA( callbackRoutine, callbackContext);
Jeff Johnson295189b2012-06-20 16:38:30 -07001121}
1122
1123
1124/*===========================================================================
1125
1126 FUNCTION WLANTL_RegisterSTAClient
1127
1128 DESCRIPTION
1129
1130 This function is used by HDD to register as a client for data services
1131 with TL. HDD will call this API for each new station that it adds,
1132 thus having the flexibility of registering different callback for each
1133 STA it services.
1134
1135 DEPENDENCIES
1136
1137 TL must have been initialized before this gets called.
1138
1139 Restriction:
1140 Main thread will have higher priority that Tx and Rx threads thus
1141 guaranteeing that a station will be added before any data can be
1142 received for it. (This enables TL to be lock free)
1143
1144 PARAMETERS
1145
1146 pvosGCtx: pointer to the global vos context; a handle to TL's
1147 control block can be extracted from its context
1148 pfnStARx: function pointer to the receive packet handler from HDD
1149 pfnSTATxComp: function pointer to the transmit complete confirmation
1150 handler from HDD
1151 pfnSTAFetchPkt: function pointer to the packet retrieval routine in HDD
1152 wSTADescType: STA Descriptor, contains information related to the
1153 new added STA
1154
1155 RETURN VALUE
1156
1157 The result code associated with performing the operation
1158
1159 VOS_STATUS_E_INVAL: Input parameters are invalid
1160 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
1161 TL cb is NULL ; access would cause a page fault
1162 VOS_STATUS_E_EXISTS: Station was already registered
1163 VOS_STATUS_SUCCESS: Everything is good :)
1164
1165 SIDE EFFECTS
1166
1167============================================================================*/
1168VOS_STATUS
1169WLANTL_RegisterSTAClient
1170(
1171 v_PVOID_t pvosGCtx,
1172 WLANTL_STARxCBType pfnSTARx,
1173 WLANTL_TxCompCBType pfnSTATxComp,
1174 WLANTL_STAFetchPktCBType pfnSTAFetchPkt,
1175 WLAN_STADescType* pwSTADescType,
1176 v_S7_t rssi
1177)
1178{
1179 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301180 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001181 v_U8_t ucTid = 0;/*Local variable to clear previous replay counters of STA on all TIDs*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001182 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
1183
1184 /*------------------------------------------------------------------------
1185 Sanity check
1186 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301187 ENTER();
Jeff Johnson295189b2012-06-20 16:38:30 -07001188 if (( NULL == pwSTADescType ) || ( NULL == pfnSTARx ) ||
1189 ( NULL == pfnSTAFetchPkt ))
1190 {
1191 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1192 "WLAN TL:Invalid parameter sent on WLANTL_RegisterSTAClient"));
1193 return VOS_STATUS_E_INVAL;
1194 }
1195
1196 if ( WLANTL_STA_ID_INVALID( pwSTADescType->ucSTAId ) )
1197 {
1198 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1199 "WLAN TL:Invalid station id requested on WLANTL_RegisterSTAClient"));
1200 return VOS_STATUS_E_FAULT;
1201 }
1202
1203 /*------------------------------------------------------------------------
1204 Extract TL control block
1205 ------------------------------------------------------------------------*/
1206 pTLCb = VOS_GET_TL_CB(pvosGCtx);
1207 if ( NULL == pTLCb )
1208 {
1209 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1210 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_RegisterSTAClient"));
1211 return VOS_STATUS_E_FAULT;
1212 }
1213
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301214 //Code for checking and allocating memory for new STA
1215 if ( NULL == pTLCb->atlSTAClients[pwSTADescType->ucSTAId] ){
1216 pTLCb->atlSTAClients[pwSTADescType->ucSTAId] = vos_mem_malloc(sizeof(WLANTL_STAClientType));
1217 if ( NULL == pTLCb->atlSTAClients[pwSTADescType->ucSTAId] ){
1218 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1219 "WLAN TL: STA Client memory allocation failed in WLANTL_RegisterSTAClient"));
1220 return VOS_STATUS_E_FAILURE;
1221 }
1222 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
1223 "WLAN TL: STA Client memory allocation in WLANTL_RegisterSTAClient"));
1224 vos_mem_zero((v_VOID_t *) pTLCb->atlSTAClients[pwSTADescType->ucSTAId],sizeof(WLANTL_STAClientType));
1225 }
1226
1227 //Assigning the pointer to local variable for easy access in future
1228 pClientSTA = pTLCb->atlSTAClients[pwSTADescType->ucSTAId];
1229 if ( 0 != pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07001230 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301231 pClientSTA->ucExists++;
Jeff Johnson295189b2012-06-20 16:38:30 -07001232 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1233 "WLAN TL:Station was already registered on WLANTL_RegisterSTAClient"));
1234 return VOS_STATUS_E_EXISTS;
1235 }
1236
1237 /*------------------------------------------------------------------------
1238 Register station with TL
1239 ------------------------------------------------------------------------*/
Katya Nigam42e16e82014-02-04 16:28:55 +05301240 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_REGISTER_STA_CLIENT,
1241 pwSTADescType->ucSTAId, (unsigned )
1242 (*(pwSTADescType->vSTAMACAddress.bytes+2)<<24 |
1243 *(pwSTADescType->vSTAMACAddress.bytes+3)<<16 |
1244 *(pwSTADescType->vSTAMACAddress.bytes+4)<<8 |
1245 *(pwSTADescType->vSTAMACAddress.bytes+5))));
1246
Jeff Johnson295189b2012-06-20 16:38:30 -07001247 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
1248 "WLAN TL:Registering STA Client ID: %d", pwSTADescType->ucSTAId ));
1249
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301250 pClientSTA->pfnSTARx = pfnSTARx;
1251 pClientSTA->pfnSTAFetchPkt = pfnSTAFetchPkt;
Jeff Johnson295189b2012-06-20 16:38:30 -07001252
1253 /* Only register if different from NULL - TL default Tx Comp Cb will
1254 release the vos packet */
1255 if ( NULL != pfnSTATxComp )
1256 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301257 pClientSTA->pfnSTATxComp = pfnSTATxComp;
Jeff Johnson295189b2012-06-20 16:38:30 -07001258 }
1259
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301260 pClientSTA->tlState = WLANTL_STA_INIT;
1261 pClientSTA->tlPri = WLANTL_STA_PRI_NORMAL;
1262 pClientSTA->wSTADesc.ucSTAId = pwSTADescType->ucSTAId;
Gopichand Nakkala8b54e912013-03-11 10:44:21 +05301263 pClientSTA->ptkInstalled = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001264
1265 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
1266 "WLAN TL:Registering STA Client ID: %d with UC %d and BC %d",
1267 pwSTADescType->ucSTAId,
1268 pwSTADescType->ucUcastSig, pwSTADescType->ucBcastSig));
1269
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301270 pClientSTA->wSTADesc.wSTAType = pwSTADescType->wSTAType;
Jeff Johnson295189b2012-06-20 16:38:30 -07001271
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301272 pClientSTA->wSTADesc.ucQosEnabled = pwSTADescType->ucQosEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07001273
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301274 pClientSTA->wSTADesc.ucAddRmvLLC = pwSTADescType->ucAddRmvLLC;
Jeff Johnson295189b2012-06-20 16:38:30 -07001275
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301276 pClientSTA->wSTADesc.ucProtectedFrame = pwSTADescType->ucProtectedFrame;
Jeff Johnson295189b2012-06-20 16:38:30 -07001277
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001278#ifdef FEATURE_WLAN_ESE
1279 pClientSTA->wSTADesc.ucIsEseSta = pwSTADescType->ucIsEseSta;
Jeff Johnson295189b2012-06-20 16:38:30 -07001280
1281 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001282 "WLAN TL:Registering STA Client ID: %d QoS %d Add LLC %d ProtFrame %d EseSta %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001283 pwSTADescType->ucSTAId,
1284 pwSTADescType->ucQosEnabled,
1285 pwSTADescType->ucAddRmvLLC,
1286 pwSTADescType->ucProtectedFrame,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001287 pwSTADescType->ucIsEseSta));
Jeff Johnson295189b2012-06-20 16:38:30 -07001288#else
1289
1290 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
1291 "WLAN TL:Registering STA Client ID: %d QoS %d Add LLC %d ProtFrame %d",
1292 pwSTADescType->ucSTAId,
1293 pwSTADescType->ucQosEnabled,
1294 pwSTADescType->ucAddRmvLLC,
1295 pwSTADescType->ucProtectedFrame));
1296
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001297#endif //FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001298#ifdef WLAN_SOFTAP_VSTA_FEATURE
1299 // if this station was not allocated resources to perform HW-based
1300 // TX frame translation then force SW-based TX frame translation
1301 // otherwise use the frame translation supplied by the client
1302
1303 if (!WDA_IsHwFrameTxTranslationCapable(pvosGCtx, pwSTADescType->ucSTAId)
1304 || ( WLAN_STA_BT_AMP == pwSTADescType->wSTAType))
1305 {
1306 pwSTADescType->ucSwFrameTXXlation = 1;
1307 }
1308#endif
1309
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301310 pClientSTA->wSTADesc.ucSwFrameTXXlation = pwSTADescType->ucSwFrameTXXlation;
1311 pClientSTA->wSTADesc.ucSwFrameRXXlation = pwSTADescType->ucSwFrameRXXlation;
Jeff Johnson295189b2012-06-20 16:38:30 -07001312
1313#ifdef FEATURE_WLAN_WAPI
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301314 pClientSTA->wSTADesc.ucIsWapiSta = pwSTADescType->ucIsWapiSta;
Jeff Johnson295189b2012-06-20 16:38:30 -07001315#endif /* FEATURE_WLAN_WAPI */
1316
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301317 vos_copy_macaddr( &pClientSTA->wSTADesc.vSTAMACAddress, &pwSTADescType->vSTAMACAddress);
Jeff Johnson295189b2012-06-20 16:38:30 -07001318
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301319 vos_copy_macaddr( &pClientSTA->wSTADesc.vBSSIDforIBSS, &pwSTADescType->vBSSIDforIBSS);
Jeff Johnson295189b2012-06-20 16:38:30 -07001320
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301321 vos_copy_macaddr( &pClientSTA->wSTADesc.vSelfMACAddress, &pwSTADescType->vSelfMACAddress);
Jeff Johnson295189b2012-06-20 16:38:30 -07001322
Jeff Johnson295189b2012-06-20 16:38:30 -07001323 /* In volans release L replay check is done at TL */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301324 pClientSTA->ucIsReplayCheckValid = pwSTADescType->ucIsReplayCheckValid;
1325 pClientSTA->ulTotalReplayPacketsDetected = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001326/*Clear replay counters of the STA on all TIDs*/
1327 for(ucTid = 0; ucTid < WLANTL_MAX_TID ; ucTid++)
1328 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301329 pClientSTA->ullReplayCounter[ucTid] = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001330 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001331
1332 /*--------------------------------------------------------------------
1333 Set the AC for the registered station to the highest priority AC
1334 Even if this AC is not supported by the station, correction will be
1335 made in the main TL loop after the supported mask is properly
1336 updated in the pending packets call
1337 --------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301338 pClientSTA->ucCurrentAC = WLANTL_AC_VO;
1339 pClientSTA->ucCurrentWeight = 0;
1340 pClientSTA->ucServicedAC = WLANTL_AC_BK;
1341 pClientSTA->ucEapolPktPending = 0;
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07001342
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301343 vos_mem_zero( pClientSTA->aucACMask, sizeof(pClientSTA->aucACMask));
Jeff Johnson295189b2012-06-20 16:38:30 -07001344
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301345 vos_mem_zero( &pClientSTA->wUAPSDInfo, sizeof(pClientSTA->wUAPSDInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07001346
1347 /*--------------------------------------------------------------------
1348 Reordering info and AMSDU de-aggregation
1349 --------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301350 vos_mem_zero( pClientSTA->atlBAReorderInfo,
1351 sizeof(pClientSTA->atlBAReorderInfo[0])*
Jeff Johnson295189b2012-06-20 16:38:30 -07001352 WLAN_MAX_TID);
1353
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301354 vos_mem_zero( pClientSTA->aucMPDUHeader,
Jeff Johnson295189b2012-06-20 16:38:30 -07001355 WLANTL_MPDU_HEADER_LEN);
1356
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301357 pClientSTA->ucMPDUHeaderLen = 0;
1358 pClientSTA->vosAMSDUChain = NULL;
1359 pClientSTA->vosAMSDUChainRoot = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001360
1361
Leo Chang6b6faaf2014-01-24 21:21:26 -08001362 /* Reorder LOCK
1363 * During handle normal RX frame within RX thread,
1364 * if MC thread try to preempt, ADDBA, DELBA, TIMER
1365 * Context should be protected from race */
1366 for (ucTid = 0; ucTid < WLAN_MAX_TID ; ucTid++)
1367 {
1368 if (!VOS_IS_STATUS_SUCCESS(
1369 vos_lock_init(&pClientSTA->atlBAReorderInfo[ucTid].reorderLock)))
1370 {
1371 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1372 "Lock Init Fail"));
1373 return VOS_STATUS_E_FAILURE;
1374 }
1375 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001376 /*--------------------------------------------------------------------
1377 Stats info
1378 --------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301379 vos_mem_zero( pClientSTA->auRxCount,
1380 sizeof(pClientSTA->auRxCount[0])*
Jeff Johnson295189b2012-06-20 16:38:30 -07001381 WLAN_MAX_TID);
1382
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301383 vos_mem_zero( pClientSTA->auTxCount,
1384 sizeof(pClientSTA->auRxCount[0])*
Jeff Johnson295189b2012-06-20 16:38:30 -07001385 WLAN_MAX_TID);
1386 /* Initial RSSI is always reported as zero because TL doesnt have enough
1387 data to calculate RSSI. So to avoid reporting zero, we are initializing
1388 RSSI with RSSI saved in BssDescription during scanning. */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301389 pClientSTA->rssiAvg = rssi;
Shailender Karmuchi13c0d082013-03-26 14:41:39 -07001390#ifdef FEATURE_WLAN_TDLS
1391 if(WLAN_STA_TDLS == pClientSTA->wSTADesc.wSTAType)
1392 {
1393 /* If client is TDLS, use TDLS specific alpha */
1394 pClientSTA->rssiAlpha = WLANTL_HO_TDLS_ALPHA;
1395 }
1396 else
1397 {
1398 pClientSTA->rssiAlpha = WLANTL_HO_DEFAULT_ALPHA;
1399 }
1400#else
1401 pClientSTA->rssiAlpha = WLANTL_HO_DEFAULT_ALPHA;
1402#endif /* FEATURE_WLAN_TDLS */
Dino Mycle3b9536d2014-07-09 22:05:24 +05301403#ifdef WLAN_FEATURE_LINK_LAYER_STATS
1404 pClientSTA->rssiDataAlpha = WLANTL_HO_DEFAULT_ALPHA;
1405 pClientSTA->interfaceStats.accessCategoryStats[0].ac = WLANTL_AC_BK;
1406 pClientSTA->interfaceStats.accessCategoryStats[1].ac = WLANTL_AC_BE;
1407 pClientSTA->interfaceStats.accessCategoryStats[2].ac = WLANTL_AC_VI;
1408 pClientSTA->interfaceStats.accessCategoryStats[3].ac = WLANTL_AC_VO;
1409#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001410
1411 /*Tx not suspended and station fully registered*/
1412 vos_atomic_set_U8(
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301413 &pClientSTA->ucTxSuspended, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001414
1415 /* Used until multiple station support will be added*/
1416 pTLCb->ucRegisteredStaId = pwSTADescType->ucSTAId;
1417
1418 /* Save the BAP station ID for future usage */
1419 if ( WLAN_STA_BT_AMP == pwSTADescType->wSTAType )
1420 {
1421 pTLCb->tlBAPClient.ucBAPSTAId = pwSTADescType->ucSTAId;
1422 }
1423
1424 /*------------------------------------------------------------------------
1425 Statistics info
1426 -----------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301427 memset(&pClientSTA->trafficStatistics,
Jeff Johnson295189b2012-06-20 16:38:30 -07001428 0, sizeof(WLANTL_TRANSFER_STA_TYPE));
1429
1430
1431 /*------------------------------------------------------------------------
1432 Start with the state suggested by client caller
1433 -----------------------------------------------------------------------*/
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05301434 pClientSTA->tlState = pwSTADescType->ucInitState;
Jeff Johnson295189b2012-06-20 16:38:30 -07001435 /*-----------------------------------------------------------------------
1436 After all the init is complete we can mark the existance flag
1437 ----------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301438 pClientSTA->ucExists++;
Jeff Johnson295189b2012-06-20 16:38:30 -07001439
Jeff Johnson295189b2012-06-20 16:38:30 -07001440 //flow control fields init
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301441 pClientSTA->ucLwmModeEnabled = FALSE;
1442 pClientSTA->ucLwmEventReported = FALSE;
1443 pClientSTA->bmuMemConsumed = 0;
1444 pClientSTA->uIngress_length = 0;
1445 pClientSTA->uBuffThresholdMax = WLANTL_STA_BMU_THRESHOLD_MAX;
Jeff Johnson295189b2012-06-20 16:38:30 -07001446
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301447 pClientSTA->uLwmThreshold = WLANTL_STA_BMU_THRESHOLD_MAX / 3;
Jeff Johnson295189b2012-06-20 16:38:30 -07001448
1449 //@@@ HDDSOFTAP does not queue unregistered packet for now
1450 if ( WLAN_STA_SOFTAP != pwSTADescType->wSTAType )
1451 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001452 /*------------------------------------------------------------------------
1453 Forward received frames while STA was not yet registered
1454 - ----------------------------------------------------------------------*/
1455 if(!VOS_IS_STATUS_SUCCESS(WLANTL_StartForwarding( pwSTADescType->ucSTAId,
1456 pwSTADescType->ucUcastSig,
1457 pwSTADescType->ucBcastSig)))
1458 {
1459 VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001460 " %s fails to start forwarding", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001461 }
Sunil Ravid5406f22013-01-22 00:18:31 -08001462#ifdef FEATURE_WLAN_TDLS
1463 if( WLAN_STA_TDLS == pwSTADescType->wSTAType )
1464 pTLCb->ucTdlsPeerCount++;
1465#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001466 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001467 return VOS_STATUS_SUCCESS;
1468}/* WLANTL_RegisterSTAClient */
1469
1470/*===========================================================================
1471
1472 FUNCTION WLANTL_ClearSTAClient
1473
1474 DESCRIPTION
1475
1476 HDD will call this API when it no longer needs data services for the
1477 particular station.
1478
1479 DEPENDENCIES
1480
1481 A station must have been registered before the clear registration is
1482 called.
1483
1484 PARAMETERS
1485
1486 pvosGCtx: pointer to the global vos context; a handle to TL's
1487 control block can be extracted from its context
1488 ucSTAId: identifier for the STA to be cleared
1489
1490 RETURN VALUE
1491
1492 The result code associated with performing the operation
1493
1494 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
1495 TL cb is NULL ; access would cause a page fault
1496 VOS_STATUS_E_EXISTS: Station was not registered
1497 VOS_STATUS_SUCCESS: Everything is good :)
1498
1499 SIDE EFFECTS
1500
1501============================================================================*/
1502VOS_STATUS
1503WLANTL_ClearSTAClient
1504(
1505 v_PVOID_t pvosGCtx,
1506 v_U8_t ucSTAId
1507)
1508{
1509 WLANTL_CbType* pTLCb = NULL;
1510 v_U8_t ucIndex;
1511 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
1512
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301513 ENTER();
Jeff Johnson295189b2012-06-20 16:38:30 -07001514 /*------------------------------------------------------------------------
1515 Sanity check
1516 ------------------------------------------------------------------------*/
1517 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
1518 {
1519 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1520 "WLAN TL:Invalid station id requested on WLANTL_ClearSTAClient"));
1521 return VOS_STATUS_E_FAULT;
1522 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001523 /*------------------------------------------------------------------------
1524 Extract TL control block
1525 ------------------------------------------------------------------------*/
1526 pTLCb = VOS_GET_TL_CB(pvosGCtx);
1527 if ( NULL == pTLCb )
1528 {
1529 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1530 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ClearSTAClient"));
1531 return VOS_STATUS_E_FAULT;
1532 }
1533
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301534 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
1535 {
1536 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1537 "WLAN TL:Client Memory was not allocated on %s", __func__));
1538 return VOS_STATUS_E_FAILURE;
1539 }
1540
1541 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07001542 {
1543 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1544 "WLAN TL:Station was not previously registered on WLANTL_ClearSTAClient"));
Siddharth Bhalaef8ee12014-04-02 00:09:45 +05301545 /* Clean packets cached for the STA */
1546 WLANTL_StartForwarding(ucSTAId,0,0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001547 return VOS_STATUS_E_EXISTS;
1548 }
1549
1550 /* Delete BA sessions on all TID's */
Leo Chang6b6faaf2014-01-24 21:21:26 -08001551 for (ucIndex = 0; ucIndex < WLAN_MAX_TID ; ucIndex++)
Jeff Johnson295189b2012-06-20 16:38:30 -07001552 {
Leo Chang6b6faaf2014-01-24 21:21:26 -08001553 WLANTL_BaSessionDel(pvosGCtx, ucSTAId, ucIndex);
1554 vos_lock_destroy(&pTLCb->atlSTAClients[ucSTAId]->atlBAReorderInfo[ucIndex].reorderLock);
Jeff Johnson295189b2012-06-20 16:38:30 -07001555 }
1556
Sunil Ravid5406f22013-01-22 00:18:31 -08001557#ifdef FEATURE_WLAN_TDLS
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301558 /* decrement ucTdlsPeerCount only if it is non-zero */
1559 if(WLAN_STA_TDLS == pTLCb->atlSTAClients[ucSTAId]->wSTADesc.wSTAType
Sunil Ravid5406f22013-01-22 00:18:31 -08001560 && pTLCb->ucTdlsPeerCount)
1561 pTLCb->ucTdlsPeerCount--;
1562#endif
1563
Jeff Johnson295189b2012-06-20 16:38:30 -07001564 /*------------------------------------------------------------------------
1565 Clear station
1566 ------------------------------------------------------------------------*/
1567 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
1568 "WLAN TL:Clearing STA Client ID: %d", ucSTAId ));
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301569 WLANTL_CleanSTA(pTLCb->atlSTAClients[ucSTAId], 1 /*empty packets*/);
Jeff Johnson295189b2012-06-20 16:38:30 -07001570
1571 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
1572 "WLAN TL:Clearing STA Reset History RSSI and Region number"));
1573 pTLCb->hoSupport.currentHOState.historyRSSI = 0;
1574 pTLCb->hoSupport.currentHOState.regionNumber = 0;
1575
1576 return VOS_STATUS_SUCCESS;
1577}/* WLANTL_ClearSTAClient */
1578
1579/*===========================================================================
1580
1581 FUNCTION WLANTL_ChangeSTAState
1582
1583 DESCRIPTION
1584
1585 HDD will make this notification whenever a change occurs in the
1586 connectivity state of a particular STA.
1587
1588 DEPENDENCIES
1589
1590 A station must have been registered before the change state can be
1591 called.
1592
1593 RESTRICTION: A station is being notified as authenticated before the
1594 keys are installed in HW. This way if a frame is received
1595 before the keys are installed DPU will drop that frame.
1596
1597 Main thread has higher priority that Tx and Rx threads thus guaranteeing
1598 the following:
1599 - a station will be in assoc state in TL before TL receives any data
1600 for it
1601
1602 PARAMETERS
1603
1604 pvosGCtx: pointer to the global vos context; a handle to TL's
1605 control block can be extracted from its context
1606 ucSTAId: identifier for the STA that is pending transmission
1607 tlSTAState: the new state of the connection to the given station
1608
1609
1610 RETURN VALUE
1611
1612 The result code associated with performing the operation
1613
1614 VOS_STATUS_E_INVAL: Input parameters are invalid
1615 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
1616 TL cb is NULL ; access would cause a page fault
1617 VOS_STATUS_E_EXISTS: Station was not registered
1618 VOS_STATUS_SUCCESS: Everything is good :)
1619
1620 SIDE EFFECTS
1621
1622============================================================================*/
1623VOS_STATUS
1624WLANTL_ChangeSTAState
1625(
1626 v_PVOID_t pvosGCtx,
1627 v_U8_t ucSTAId,
1628 WLANTL_STAStateType tlSTAState
1629)
1630{
1631 WLANTL_CbType* pTLCb = NULL;
1632 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
1633
1634 /*------------------------------------------------------------------------
1635 Sanity check
1636 ------------------------------------------------------------------------*/
1637 if ( tlSTAState >= WLANTL_STA_MAX_STATE )
1638 {
1639 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1640 "WLAN TL:Invalid parameter sent on WLANTL_ChangeSTAState"));
1641 return VOS_STATUS_E_INVAL;
1642 }
1643
1644 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
1645 {
1646 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1647 "WLAN TL:Invalid station id requested on WLANTL_ChangeSTAState"));
1648 return VOS_STATUS_E_FAULT;
1649 }
1650
1651 /*------------------------------------------------------------------------
1652 Extract TL control block and check existance
1653 ------------------------------------------------------------------------*/
1654 pTLCb = VOS_GET_TL_CB(pvosGCtx);
1655 if ( NULL == pTLCb )
1656 {
1657 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1658 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
1659 return VOS_STATUS_E_FAULT;
1660 }
1661
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301662 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
1663 {
1664 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1665 "WLAN TL:Client Memory was not allocated on %s", __func__));
1666 return VOS_STATUS_E_FAILURE;
1667 }
1668
1669 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07001670 {
1671 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1672 "WLAN TL:Station was not previously registered on WLANTL_ChangeSTAState"));
1673 return VOS_STATUS_E_EXISTS;
1674 }
1675
1676 /*------------------------------------------------------------------------
1677 Change STA state
1678 No need to lock this operation, see restrictions above
1679 ------------------------------------------------------------------------*/
1680 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
1681 "WLAN TL:Changing state for STA Client ID: %d from %d to %d",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301682 ucSTAId, pTLCb->atlSTAClients[ucSTAId]->tlState, tlSTAState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001683
Katya Nigam42e16e82014-02-04 16:28:55 +05301684 MTRACE(vos_trace(VOS_MODULE_ID_TL,
1685 TRACE_CODE_TL_STA_STATE, ucSTAId,tlSTAState ));
1686
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301687 pTLCb->atlSTAClients[ucSTAId]->tlState = tlSTAState;
Jeff Johnson295189b2012-06-20 16:38:30 -07001688
1689 return VOS_STATUS_SUCCESS;
1690}/* WLANTL_ChangeSTAState */
1691
1692/*===========================================================================
1693
Gopichand Nakkala8b54e912013-03-11 10:44:21 +05301694 FUNCTION WLANTL_STAPtkInstalled
1695
1696 DESCRIPTION
1697
1698 HDD will make this notification whenever PTK is installed for the STA
1699
1700 DEPENDENCIES
1701
1702 A station must have been registered before the change state can be
1703 called.
1704
1705 PARAMETERS
1706
1707 pvosGCtx: pointer to the global vos context; a handle to TL's
1708 control block can be extracted from its context
1709 ucSTAId: identifier for the STA for which Pairwise key is
1710 installed
1711
1712 RETURN VALUE
1713
1714 The result code associated with performing the operation
1715
1716 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
1717 TL cb is NULL ; access would cause a page fault
1718 VOS_STATUS_E_EXISTS: Station was not registered
1719 VOS_STATUS_SUCCESS: Everything is good :)
1720
1721 SIDE EFFECTS
1722
1723============================================================================*/
1724VOS_STATUS
1725WLANTL_STAPtkInstalled
1726(
1727 v_PVOID_t pvosGCtx,
1728 v_U8_t ucSTAId
1729)
1730{
1731 WLANTL_CbType* pTLCb = NULL;
1732 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
1733
1734 /*------------------------------------------------------------------------
1735 Sanity check
1736 ------------------------------------------------------------------------*/
1737
1738 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
1739 {
1740 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1741 "WLAN TL:Invalid station id requested on WLANTL_ChangeSTAState"));
1742 return VOS_STATUS_E_FAULT;
1743 }
1744
1745 /*------------------------------------------------------------------------
1746 Extract TL control block and check existance
1747 ------------------------------------------------------------------------*/
1748 pTLCb = VOS_GET_TL_CB(pvosGCtx);
1749 if ( NULL == pTLCb )
1750 {
1751 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1752 FL("WLAN TL:Invalid TL pointer from pvosGCtx")));
1753 return VOS_STATUS_E_FAULT;
1754 }
1755
1756 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
1757 {
1758 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1759 FL("WLAN TL:Client Memory was not allocated")));
1760 return VOS_STATUS_E_FAILURE;
1761 }
1762
1763 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
1764 {
1765 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1766 FL("WLAN TL:Station was not previously registered")));
1767 return VOS_STATUS_E_EXISTS;
1768 }
1769
1770 pTLCb->atlSTAClients[ucSTAId]->ptkInstalled = 1;
1771
1772 return VOS_STATUS_SUCCESS;
1773}/* WLANTL_STAPtkInstalled */
1774
1775/*===========================================================================
1776
Madan Mohan Koyyalamudifc1d1fe2012-10-18 15:07:12 -07001777 FUNCTION WLANTL_GetSTAState
1778
1779 DESCRIPTION
1780
1781 Returns connectivity state of a particular STA.
1782
1783 DEPENDENCIES
1784
1785 A station must have been registered before its state can be retrieved.
1786
1787
1788 PARAMETERS
1789
1790 IN
1791 pvosGCtx: pointer to the global vos context; a handle to TL's
1792 control block can be extracted from its context
1793 ucSTAId: identifier of the station
1794
1795 OUT
1796 ptlSTAState: the current state of the connection to the given station
1797
1798
1799 RETURN VALUE
1800
1801 The result code associated with performing the operation
1802
1803 VOS_STATUS_E_INVAL: Input parameters are invalid
1804 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
1805 TL cb is NULL ; access would cause a page fault
1806 VOS_STATUS_E_EXISTS: Station was not registered
1807 VOS_STATUS_SUCCESS: Everything is good :)
1808
1809 SIDE EFFECTS
1810
1811============================================================================*/
1812VOS_STATUS
1813WLANTL_GetSTAState
1814(
1815 v_PVOID_t pvosGCtx,
1816 v_U8_t ucSTAId,
1817 WLANTL_STAStateType *ptlSTAState
1818)
1819{
1820 WLANTL_CbType* pTLCb = NULL;
1821 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
1822
1823 /*------------------------------------------------------------------------
1824 Sanity check
1825 ------------------------------------------------------------------------*/
1826 if ( NULL == ptlSTAState )
1827 {
1828 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1829 "WLAN TL:Invalid parameter sent on WLANTL_GetSTAState"));
1830 return VOS_STATUS_E_INVAL;
1831 }
1832
1833 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
1834 {
1835 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1836 "WLAN TL:Invalid station id requested on WLANTL_GetSTAState"));
1837 return VOS_STATUS_E_FAULT;
1838 }
1839
1840 /*------------------------------------------------------------------------
1841 Extract TL control block and check existance
1842 ------------------------------------------------------------------------*/
1843 pTLCb = VOS_GET_TL_CB(pvosGCtx);
1844 if ( NULL == pTLCb )
1845 {
1846 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1847 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetSTAState"));
1848 return VOS_STATUS_E_FAULT;
1849 }
1850
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301851 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
1852 {
1853 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1854 "WLAN TL:Client Memory was not allocated on %s", __func__));
1855 return VOS_STATUS_E_FAILURE;
1856 }
1857
1858 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
Madan Mohan Koyyalamudifc1d1fe2012-10-18 15:07:12 -07001859 {
Sunil Ravid5406f22013-01-22 00:18:31 -08001860 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Madan Mohan Koyyalamudifc1d1fe2012-10-18 15:07:12 -07001861 "WLAN TL:Station was not previously registered on WLANTL_GetSTAState"));
1862 return VOS_STATUS_E_EXISTS;
1863 }
1864
1865 /*------------------------------------------------------------------------
1866 Get STA state
1867 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301868 *ptlSTAState = pTLCb->atlSTAClients[ucSTAId]->tlState;
Madan Mohan Koyyalamudifc1d1fe2012-10-18 15:07:12 -07001869
1870 return VOS_STATUS_SUCCESS;
1871}/* WLANTL_GetSTAState */
1872
Shailender Karmuchia734f332013-04-19 14:02:48 -07001873/*==========================================================================
1874 FUNCTION WLANTL_UpdateSTABssIdforIBSS
1875
1876 DESCRIPTION
1877 HDD will call this API to update the BSSID for this Station.
1878
1879 DEPENDENCIES
1880 The HDD Should registered the staID with TL before calling this function.
1881
1882 PARAMETERS
1883
1884 IN
1885 pvosGCtx: Pointer to the global vos context; a handle to TL's
1886 or WDA's control block can be extracted from its context
1887 IN
1888 ucSTAId The Station ID for Bssid to be updated
1889 IN
1890 pBssid BSSID to be updated
1891
1892 RETURN VALUE
1893 The result code associated with performing the operation
1894
1895 VOS_STATUS_E_INVAL: Input parameters are invalid
1896 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
1897 TL cb is NULL ; access would cause a page fault
1898 VOS_STATUS_E_EXISTS: Station was not registered
1899 VOS_STATUS_SUCCESS: Everything is good :)
1900
1901 SIDE EFFECTS
1902============================================================================*/
1903
1904
1905VOS_STATUS
1906WLANTL_UpdateSTABssIdforIBSS
1907(
1908 v_PVOID_t pvosGCtx,
1909 v_U8_t ucSTAId,
1910 v_U8_t *pBssid
1911)
1912{
1913 WLANTL_CbType* pTLCb = NULL;
1914 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
1915
1916 /*------------------------------------------------------------------------
1917 Sanity check
1918 ------------------------------------------------------------------------*/
1919 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
1920 {
1921 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1922 "WLAN TL:Invalid station id requested %s", __func__));
1923 return VOS_STATUS_E_FAULT;
1924 }
1925
1926 /*------------------------------------------------------------------------
1927 Extract TL control block and check existance
1928 ------------------------------------------------------------------------*/
1929 pTLCb = VOS_GET_TL_CB(pvosGCtx);
1930 if ( NULL == pTLCb )
1931 {
1932 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1933 "WLAN TL:Invalid TL pointer from pvosGCtx %s", __func__));
1934 return VOS_STATUS_E_FAULT;
1935 }
1936
1937 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
1938 {
1939 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1940 "WLAN TL:Client Memory was not allocated on %s", __func__));
1941 return VOS_STATUS_E_FAILURE;
1942 }
1943
1944 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
1945 {
1946 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
1947 "WLAN TL:Station was not previously registered %s", __func__));
1948 return VOS_STATUS_E_EXISTS;
1949 }
1950
1951 /*------------------------------------------------------------------------
1952 Update the IBSS BSSID
1953 ------------------------------------------------------------------------*/
1954 vos_mem_copy( &pTLCb->atlSTAClients[ucSTAId]->wSTADesc.vBSSIDforIBSS,
1955 pBssid, sizeof(v_MACADDR_t));
1956
1957 return VOS_STATUS_SUCCESS;
1958}
1959
Madan Mohan Koyyalamudifc1d1fe2012-10-18 15:07:12 -07001960/*===========================================================================
1961
Jeff Johnson295189b2012-06-20 16:38:30 -07001962 FUNCTION WLANTL_STAPktPending
1963
1964 DESCRIPTION
1965
1966 HDD will call this API when a packet is pending transmission in its
1967 queues.
1968
1969 DEPENDENCIES
1970
1971 A station must have been registered before the packet pending
1972 notification can be sent.
1973
1974 RESTRICTION: TL will not count packets for pending notification.
1975 HDD is expected to send the notification only when
1976 non-empty event gets triggered. Worst case scenario
1977 is that TL might end up making a call when Hdds
1978 queues are actually empty.
1979
1980 PARAMETERS
1981
1982 pvosGCtx: pointer to the global vos context; a handle to TL's
1983 control block can be extracted from its context
1984 ucSTAId: identifier for the STA that is pending transmission
1985
1986 RETURN VALUE
1987
1988 The result code associated with performing the operation
1989
1990 VOS_STATUS_E_INVAL: Input parameters are invalid
1991 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
1992 to TL cb is NULL ; access would cause a page fault
1993 VOS_STATUS_E_EXISTS: Station was not registered
1994 VOS_STATUS_SUCCESS: Everything is good :)
1995
1996 SIDE EFFECTS
1997
1998============================================================================*/
1999VOS_STATUS
2000WLANTL_STAPktPending
2001(
2002 v_PVOID_t pvosGCtx,
2003 v_U8_t ucSTAId,
2004 WLANTL_ACEnumType ucAc
2005)
2006{
2007 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302008 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002009 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2010
2011 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
2012 "WLAN TL:Packet pending indication for STA: %d AC: %d", ucSTAId, ucAc);
2013
2014 /*------------------------------------------------------------------------
2015 Sanity check
2016 ------------------------------------------------------------------------*/
2017 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
2018 {
2019 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2020 "WLAN TL:Invalid station id requested on WLANTL_STAPktPending"));
2021 return VOS_STATUS_E_FAULT;
2022 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002023 /*------------------------------------------------------------------------
2024 Extract TL control block and check existance
2025 ------------------------------------------------------------------------*/
2026 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2027 if ( NULL == pTLCb )
2028 {
2029 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2030 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STAPktPending"));
2031 return VOS_STATUS_E_FAULT;
2032 }
2033
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302034 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
2035
2036 if ( NULL == pClientSTA )
2037 {
2038 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2039 "WLAN TL:Client Memory was not allocated on %s", __func__));
2040 return VOS_STATUS_E_FAILURE;
2041 }
2042
2043 if ( 0 == pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07002044 {
Mahesh A Saptasagara3d89912014-10-16 14:55:54 +05302045 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Jeff Johnson295189b2012-06-20 16:38:30 -07002046 "WLAN TL:Station was not previously registered on WLANTL_STAPktPending"));
2047 return VOS_STATUS_E_EXISTS;
2048 }
2049
2050 /*---------------------------------------------------------------------
2051 Temporary fix to enable TL to fetch packets when multiple peers join
2052 an IBSS. To fix CR177301. Needs to go away when the actual fix of
2053 going through all STA's in round robin fashion gets merged in from
2054 BT AMP branch.
2055 --------------------------------------------------------------------*/
2056 pTLCb->ucRegisteredStaId = ucSTAId;
2057
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302058 if( WLANTL_STA_CONNECTED == pClientSTA->tlState )
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07002059 { /* EAPOL_HI_PRIORITY : need to find out whether EAPOL is pending before
2060 WLANTL_FetchPacket()/WLANTL_TxConn() is called.
2061 change STA_AUTHENTICATED != tlState to CONNECTED == tlState
2062 to make sure TL is indeed waiting for EAPOL.
2063 Just in the case when STA got disconnected shortly after connectection */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302064 pClientSTA->ucEapolPktPending = 1;
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07002065
Katya Nigam42e16e82014-02-04 16:28:55 +05302066 MTRACE(vos_trace(VOS_MODULE_ID_TL,
2067 TRACE_CODE_TL_EAPOL_PKT_PENDING, ucSTAId, ucAc));
2068
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07002069 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07002070 "WLAN TL:Packet pending indication for STA: %d AC: %d State: %d",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302071 ucSTAId, ucAc, pClientSTA->tlState);
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07002072 }
2073
Jeff Johnson295189b2012-06-20 16:38:30 -07002074 /*-----------------------------------------------------------------------
2075 Enable this AC in the AC mask in order for TL to start servicing it
2076 Set packet pending flag
2077 To avoid race condition, serialize the updation of AC and AC mask
2078 through WLANTL_TX_STAID_AC_IND message.
2079 -----------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07002080
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302081 pClientSTA->aucACMask[ucAc] = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07002082
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302083 vos_atomic_set_U8( &pClientSTA->ucPktPending, 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07002084
2085 /*------------------------------------------------------------------------
2086 Check if there are enough resources for transmission and tx is not
2087 suspended.
2088 ------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi24a00f92012-10-22 15:21:02 -07002089 if (( pTLCb->uResCount >= WDA_TLI_MIN_RES_DATA ) &&
2090 ( 0 == pTLCb->ucTxSuspended ))
Jeff Johnson295189b2012-06-20 16:38:30 -07002091 {
Katya Nigam42e16e82014-02-04 16:28:55 +05302092 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_STA_PKT_PENDING,
2093 ucSTAId, pClientSTA->tlState ));
2094
Jeff Johnson295189b2012-06-20 16:38:30 -07002095 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
2096 "Issuing Xmit start request to BAL"));
2097 WDA_DS_StartXmit(pvosGCtx);
2098 }
2099 else
2100 {
2101 /*---------------------------------------------------------------------
2102 No error code is sent because TL will resume tx autonomously if
2103 resources become available or tx gets resumed
2104 ---------------------------------------------------------------------*/
Madan Mohan Koyyalamudi179e6fe2012-10-15 15:31:08 -07002105 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Jeff Johnson295189b2012-06-20 16:38:30 -07002106 "WLAN TL:Request to send but condition not met. Res: %d,Suspend: %d",
Madan Mohan Koyyalamudi48139e32012-10-11 14:43:56 -07002107 pTLCb->uResCount, pTLCb->ucTxSuspended );
Jeff Johnson295189b2012-06-20 16:38:30 -07002108 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002109 return VOS_STATUS_SUCCESS;
2110}/* WLANTL_STAPktPending */
2111
2112/*==========================================================================
2113
2114 FUNCTION WLANTL_SetSTAPriority
2115
2116 DESCRIPTION
2117
2118 TL exposes this API to allow upper layers a rough control over the
2119 priority of transmission for a given station when supporting multiple
2120 connections.
2121
2122 DEPENDENCIES
2123
2124 A station must have been registered before the change in priority can be
2125 called.
2126
2127 PARAMETERS
2128
2129 pvosGCtx: pointer to the global vos context; a handle to TL's
2130 control block can be extracted from its context
2131 ucSTAId: identifier for the STA that has to change priority
2132
2133 RETURN VALUE
2134
2135 The result code associated with performing the operation
2136
2137 VOS_STATUS_E_INVAL: Input parameters are invalid
2138 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
2139 to TL cb is NULL ; access would cause a page fault
2140 VOS_STATUS_E_EXISTS: Station was not registered
2141 VOS_STATUS_SUCCESS: Everything is good :)
2142
2143 SIDE EFFECTS
2144
2145============================================================================*/
2146VOS_STATUS
2147WLANTL_SetSTAPriority
2148(
2149 v_PVOID_t pvosGCtx,
2150 v_U8_t ucSTAId,
2151 WLANTL_STAPriorityType tlSTAPri
2152)
2153{
2154 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302155 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002156 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2157
2158 /*------------------------------------------------------------------------
2159 Sanity check
2160 ------------------------------------------------------------------------*/
2161 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
2162 {
2163 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2164 "WLAN TL:Invalid station id requested on WLANTL_SetSTAPriority"));
2165 return VOS_STATUS_E_FAULT;
2166 }
2167
2168 /*------------------------------------------------------------------------
2169 Extract TL control block
2170 ------------------------------------------------------------------------*/
2171 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2172 if ( NULL == pTLCb )
2173 {
2174 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2175 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SetSTAPriority"));
2176 return VOS_STATUS_E_FAULT;
2177 }
2178
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302179 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
2180
2181 if ( NULL == pClientSTA )
2182 {
2183 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2184 "WLAN TL:Client Memory was not allocated on %s", __func__));
2185 return VOS_STATUS_E_FAILURE;
2186 }
2187
2188 if ( 0 == pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07002189 {
2190 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2191 "WLAN TL:Station was not previously registered on WLANTL_SetSTAPriority"));
2192 return VOS_STATUS_E_EXISTS;
2193 }
2194
2195 /*------------------------------------------------------------------------
2196 Re-analize if lock is needed when adding multiple stations
2197 ------------------------------------------------------------------------*/
2198 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
2199 "WLAN TL:Changing state for STA Pri ID: %d from %d to %d",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302200 ucSTAId, pClientSTA->tlPri, tlSTAPri));
2201 pClientSTA->tlPri = tlSTAPri;
Jeff Johnson295189b2012-06-20 16:38:30 -07002202
2203 return VOS_STATUS_SUCCESS;
2204}/* WLANTL_SetSTAPriority */
2205
2206
2207/*----------------------------------------------------------------------------
2208 INTERACTION WITH BAP
2209 ---------------------------------------------------------------------------*/
2210
2211/*==========================================================================
2212
2213 FUNCTION WLANTL_RegisterBAPClient
2214
2215 DESCRIPTION
2216 Called by SME to register itself as client for non-data BT-AMP packets.
2217
2218 DEPENDENCIES
2219 TL must be initialized before this function can be called.
2220
2221 PARAMETERS
2222
2223 IN
2224 pvosGCtx: pointer to the global vos context; a handle to TL's
2225 or SME's control block can be extracted from its context
2226 pfnTlBAPRxFrm: pointer to the receive processing routine for non-data
2227 BT-AMP packets
2228 pfnFlushOpCompleteCb:
2229 pointer to the call back function, for the Flush operation
2230 completion.
2231
2232
2233 RETURN VALUE
2234
2235 The result code associated with performing the operation
2236
2237 VOS_STATUS_E_INVAL: Input parameters are invalid
2238 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
2239 to TL cb is NULL ; access would cause a page fault
2240 VOS_STATUS_E_EXISTS: BAL client was already registered
2241 VOS_STATUS_SUCCESS: Everything is good :)
2242
2243 SIDE EFFECTS
2244
2245============================================================================*/
2246VOS_STATUS
2247WLANTL_RegisterBAPClient
2248(
2249 v_PVOID_t pvosGCtx,
2250 WLANTL_BAPRxCBType pfnTlBAPRxFrm,
2251 WLANTL_FlushOpCompCBType pfnFlushOpCompleteCb
2252)
2253{
2254 WLANTL_CbType* pTLCb = NULL;
2255 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2256
2257 /*------------------------------------------------------------------------
2258 Sanity check
2259 ------------------------------------------------------------------------*/
2260 if ( NULL == pfnTlBAPRxFrm )
2261 {
2262 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2263 "WLAN TL:Invalid parameter sent on WLANTL_RegisterBAPClient"));
2264 return VOS_STATUS_E_INVAL;
2265 }
2266
2267 if ( NULL == pfnFlushOpCompleteCb )
2268 {
2269 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2270 "Invalid Flush Complete Cb parameter sent on WLANTL_RegisterBAPClient"));
2271 return VOS_STATUS_E_INVAL;
2272 }
2273
2274 /*------------------------------------------------------------------------
2275 Extract TL control block
2276 ------------------------------------------------------------------------*/
2277 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2278 if ( NULL == pTLCb )
2279 {
2280 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2281 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_RegisterBAPClient"));
2282 return VOS_STATUS_E_FAULT;
2283 }
2284
2285 /*------------------------------------------------------------------------
2286 Make sure this is the first registration attempt
2287 ------------------------------------------------------------------------*/
2288 if ( 0 != pTLCb->tlBAPClient.ucExists )
2289 {
2290 pTLCb->tlBAPClient.ucExists++;
2291 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2292 "WLAN TL:BAP client was already registered"));
2293 return VOS_STATUS_E_EXISTS;
2294 }
2295
2296 /*------------------------------------------------------------------------
2297 Register station with TL
2298 ------------------------------------------------------------------------*/
2299 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
2300 "WLAN TL:Registering BAP Client" ));
2301
2302 pTLCb->tlBAPClient.ucExists++;
2303
2304 if ( NULL != pfnTlBAPRxFrm )
2305 {
2306 pTLCb->tlBAPClient.pfnTlBAPRx = pfnTlBAPRxFrm;
2307 }
2308
2309 pTLCb->tlBAPClient.pfnFlushOpCompleteCb = pfnFlushOpCompleteCb;
2310
2311 pTLCb->tlBAPClient.vosPendingDataBuff = NULL;
2312
2313 return VOS_STATUS_SUCCESS;
2314}/* WLANTL_RegisterBAPClient */
2315
2316
2317/*==========================================================================
2318
2319 FUNCTION WLANTL_TxBAPFrm
2320
2321 DESCRIPTION
2322 BAP calls this when it wants to send a frame to the module
2323
2324 DEPENDENCIES
2325 BAP must be registered with TL before this function can be called.
2326
2327 RESTRICTION: BAP CANNOT push any packets to TL until it did not receive
2328 a tx complete from the previous packet, that means BAP
2329 sends one packet, wait for tx complete and then
2330 sends another one
2331
2332 If BAP sends another packet before TL manages to process the
2333 previously sent packet call will end in failure
2334
2335 PARAMETERS
2336
2337 IN
2338 pvosGCtx: pointer to the global vos context; a handle to TL's
2339 or BAP's control block can be extracted from its context
2340 vosDataBuff: pointer to the vOSS buffer containing the packet to be
2341 transmitted
2342 pMetaInfo: meta information about the packet
2343 pfnTlBAPTxComp: pointer to a transmit complete routine for notifying
2344 the result of the operation over the bus
2345
2346 RETURN VALUE
2347 The result code associated with performing the operation
2348
2349 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
2350 page fault
2351 VOS_STATUS_E_EXISTS: BAL client was not yet registered
2352 VOS_STATUS_E_BUSY: The previous BT-AMP packet was not yet transmitted
2353 VOS_STATUS_SUCCESS: Everything is good :)
2354
2355 Other failure messages may be returned from the BD header handling
2356 routines, please check apropriate API for more info.
2357
2358 SIDE EFFECTS
2359
2360============================================================================*/
2361VOS_STATUS
2362WLANTL_TxBAPFrm
2363(
2364 v_PVOID_t pvosGCtx,
2365 vos_pkt_t* vosDataBuff,
2366 WLANTL_MetaInfoType* pMetaInfo,
2367 WLANTL_TxCompCBType pfnTlBAPTxComp
2368)
2369{
2370 WLANTL_CbType* pTLCb = NULL;
2371 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
2372 v_MACADDR_t vDestMacAddr;
2373 v_U16_t usPktLen;
2374 v_U8_t ucStaId = 0;
2375 v_U8_t extraHeadSpace = 0;
2376 v_U8_t ucWDSEnabled = 0;
2377 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2378
2379 /*------------------------------------------------------------------------
2380 Sanity check
2381 Extract TL control block
2382 ------------------------------------------------------------------------*/
2383 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2384 if ( NULL == pTLCb )
2385 {
2386 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2387 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_TxBAPFrm"));
2388 return VOS_STATUS_E_FAULT;
2389 }
2390
2391 /*------------------------------------------------------------------------
2392 Ensure that BAP client was registered previously
2393 ------------------------------------------------------------------------*/
2394 if (( 0 == pTLCb->tlBAPClient.ucExists ) ||
2395 ( WLANTL_STA_ID_INVALID(pTLCb->tlBAPClient.ucBAPSTAId) ))
2396 {
2397 pTLCb->tlBAPClient.ucExists++;
2398 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2399 "WLAN TL:BAP client not register on WLANTL_TxBAPFrm"));
2400 return VOS_STATUS_E_EXISTS;
2401 }
2402
2403 /*------------------------------------------------------------------------
2404 Check if any BT-AMP Frm is pending
2405 ------------------------------------------------------------------------*/
2406 if ( NULL != pTLCb->tlBAPClient.vosPendingDataBuff )
2407 {
2408 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2409 "WLAN TL:BT-AMP Frame already pending tx in TL on WLANTL_TxBAPFrm"));
2410 return VOS_STATUS_E_BUSY;
2411 }
2412
2413 /*------------------------------------------------------------------------
2414 Save buffer and notify BAL; no lock is needed if the above restriction
2415 is met
2416 Save the tx complete fnct pointer as tl specific data in the vos buffer
2417 ------------------------------------------------------------------------*/
2418
2419 /*------------------------------------------------------------------------
2420 Translate 802.3 frame to 802.11
2421 ------------------------------------------------------------------------*/
2422 ucStaId = pTLCb->tlBAPClient.ucBAPSTAId;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302423 if ( NULL == pTLCb->atlSTAClients[ucStaId] )
2424 {
2425 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2426 "WLAN TL:Client Memory was not allocated on %s", __func__));
2427 return VOS_STATUS_E_FAILURE;
2428 }
2429 if (( 0 == pMetaInfo->ucDisableFrmXtl ) &&
2430 ( 0 != pTLCb->atlSTAClients[ucStaId]->wSTADesc.ucSwFrameTXXlation ))
Jeff Johnson295189b2012-06-20 16:38:30 -07002431 {
Kiran Venkatappacab0d352012-12-17 13:09:22 -08002432 vosStatus = WLANTL_Translate8023To80211Header( vosDataBuff, &vosStatus,
2433 pTLCb, &ucStaId,
Ravi Joshid0699502013-07-08 15:48:47 -07002434 pMetaInfo, &ucWDSEnabled,
2435 &extraHeadSpace);
Jeff Johnson295189b2012-06-20 16:38:30 -07002436
2437 if ( VOS_STATUS_SUCCESS != vosStatus )
2438 {
2439 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2440 "WLAN TL:Error when translating header WLANTL_TxBAPFrm"));
2441
2442 return vosStatus;
2443 }
2444
2445 pMetaInfo->ucDisableFrmXtl = 1;
2446 }
2447
2448 /*-------------------------------------------------------------------------
2449 Call HAL to fill BD header
2450 -------------------------------------------------------------------------*/
2451
2452 /* Adding Type, SubType which was missing for EAPOL from BAP */
2453 pMetaInfo->ucType |= (WLANTL_80211_DATA_TYPE << 4);
2454 pMetaInfo->ucType |= (WLANTL_80211_DATA_QOS_SUBTYPE);
2455
2456 vosStatus = WDA_DS_BuildTxPacketInfo( pvosGCtx, vosDataBuff ,
2457 &vDestMacAddr, pMetaInfo->ucDisableFrmXtl,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302458 &usPktLen, pTLCb->atlSTAClients[ucStaId]->wSTADesc.ucQosEnabled,
Jeff Johnson295189b2012-06-20 16:38:30 -07002459 ucWDSEnabled, extraHeadSpace, pMetaInfo->ucType,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302460 &pTLCb->atlSTAClients[ucStaId]->wSTADesc.vSelfMACAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07002461 pMetaInfo->ucTID, 0 /* No ACK */, pMetaInfo->usTimeStamp,
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07002462 pMetaInfo->ucIsEapol || pMetaInfo->ucIsWai, pMetaInfo->ucUP );
Jeff Johnson295189b2012-06-20 16:38:30 -07002463
2464 if ( VOS_STATUS_SUCCESS != vosStatus )
2465 {
2466 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2467 "WLAN TL:Failed while building TX header %d", vosStatus));
2468 return vosStatus;
2469 }
2470
2471 if ( NULL != pfnTlBAPTxComp )
2472 {
2473 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
2474 (v_PVOID_t)pfnTlBAPTxComp);
2475 }
2476 else
2477 {
2478 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
2479 (v_PVOID_t)WLANTL_TxCompDefaultCb);
2480
2481 }
2482
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05302483 vos_atomic_set( (uintptr_t*)&pTLCb->tlBAPClient.vosPendingDataBuff,
2484 (uintptr_t)vosDataBuff);
Jeff Johnson295189b2012-06-20 16:38:30 -07002485
2486 /*------------------------------------------------------------------------
2487 Check if thre are enough resources for transmission and tx is not
2488 suspended.
2489 ------------------------------------------------------------------------*/
2490 if (( pTLCb->uResCount >= WDA_TLI_MIN_RES_BAP ) &&
2491 ( 0 == pTLCb->ucTxSuspended ))
2492 {
2493 WDA_DS_StartXmit(pvosGCtx);
2494 }
2495 else
2496 {
2497 /*---------------------------------------------------------------------
2498 No error code is sent because TL will resume tx autonomously if
2499 resources become available or tx gets resumed
2500 ---------------------------------------------------------------------*/
2501 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
2502 "WLAN TL:Request to send from BAP but condition not met.Res: %d,"
2503 "Suspend: %d", pTLCb->uResCount, pTLCb->ucTxSuspended ));
2504 }
2505
2506 return VOS_STATUS_SUCCESS;
2507}/* WLANTL_TxBAPFrm */
2508
2509
2510/*----------------------------------------------------------------------------
2511 INTERACTION WITH SME
2512 ---------------------------------------------------------------------------*/
2513
2514/*==========================================================================
2515
2516 FUNCTION WLANTL_GetRssi
2517
2518 DESCRIPTION
2519 TL will extract the RSSI information from every data packet from the
2520 ongoing traffic and will store it. It will provide the result to SME
2521 upon request.
2522
2523 DEPENDENCIES
2524
2525 WARNING: the read and write of this value will not be protected
2526 by locks, therefore the information obtained after a read
2527 might not always be consistent.
2528
2529 PARAMETERS
2530
2531 IN
2532 pvosGCtx: pointer to the global vos context; a handle to TL's
2533 or SME's control block can be extracted from its context
2534 ucSTAId: station identifier for the requested value
2535
2536 OUT
2537 puRssi: the average value of the RSSI
2538
2539
2540 RETURN VALUE
2541 The result code associated with performing the operation
2542
2543 VOS_STATUS_E_INVAL: Input parameters are invalid
2544 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
2545 to TL cb is NULL ; access would cause a page fault
2546 VOS_STATUS_E_EXISTS: STA was not yet registered
2547 VOS_STATUS_SUCCESS: Everything is good :)
2548
2549 SIDE EFFECTS
2550
2551============================================================================*/
2552VOS_STATUS
2553WLANTL_GetRssi
2554(
2555 v_PVOID_t pvosGCtx,
2556 v_U8_t ucSTAId,
2557 v_S7_t* pRssi
2558)
2559{
2560 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302561 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002562 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2563
2564 /*------------------------------------------------------------------------
2565 Sanity check
2566 ------------------------------------------------------------------------*/
2567 if ( NULL == pRssi )
2568 {
2569 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2570 "WLAN TL:Invalid parameter sent on WLANTL_GetRssi"));
2571 return VOS_STATUS_E_INVAL;
2572 }
2573
2574 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
2575 {
2576 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2577 "WLAN TL:Invalid station id requested on WLANTL_GetRssi"));
2578 return VOS_STATUS_E_FAULT;
2579 }
2580
2581 /*------------------------------------------------------------------------
2582 Extract TL control block and check existance
2583 ------------------------------------------------------------------------*/
2584 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2585 if ( NULL == pTLCb )
2586 {
2587 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2588 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetRssi"));
2589 return VOS_STATUS_E_FAULT;
2590 }
2591
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302592 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
2593
2594 if ( NULL == pClientSTA )
2595 {
2596 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2597 "WLAN TL:Client Memory was not allocated on %s", __func__));
2598 return VOS_STATUS_E_FAILURE;
2599 }
2600
2601 if ( 0 == pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07002602 {
2603 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2604 "WLAN TL:Station was not previously registered on WLANTL_GetRssi"));
2605 return VOS_STATUS_E_EXISTS;
2606 }
2607
2608 /*------------------------------------------------------------------------
2609 Copy will not be locked; please read restriction
2610 ------------------------------------------------------------------------*/
Katya Nigam5c2e5f62013-11-15 19:19:11 +05302611 if(pTLCb->isBMPS || IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002612 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302613 *pRssi = pClientSTA->rssiAvgBmps;
Jeff Johnson295189b2012-06-20 16:38:30 -07002614 /* Check If RSSI is zero because we are reading rssAvgBmps updated by HAL in
2615 previous GetStatsRequest. It may be updated as zero by Hal because EnterBmps
2616 might not have happend by that time. Hence reading the most recent Rssi
2617 calcluated by TL*/
2618 if(0 == *pRssi)
2619 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302620 *pRssi = pClientSTA->rssiAvg;
Jeff Johnson295189b2012-06-20 16:38:30 -07002621 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002622 }
2623 else
2624 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302625 *pRssi = pClientSTA->rssiAvg;
Jeff Johnson295189b2012-06-20 16:38:30 -07002626 }
2627
2628 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Jeff Johnson32d95a32012-09-10 13:15:23 -07002629 "WLAN TL:WLANTL_GetRssi for STA: %d RSSI: %d%s",
2630 ucSTAId, *pRssi,
2631 pTLCb->isBMPS ? " in BMPS" : ""));
Jeff Johnson295189b2012-06-20 16:38:30 -07002632
2633 return VOS_STATUS_SUCCESS;
2634}/* WLANTL_GetRssi */
2635
2636/*==========================================================================
2637
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05302638 FUNCTION WLANTL_GetSnr
2639
2640 DESCRIPTION
2641 TL will extract the SNR information from every data packet from the
2642 ongoing traffic and will store it. It will provide the result to SME
2643 upon request.
2644
2645 DEPENDENCIES
2646
2647 WARNING: the read and write of this value will not be protected
2648 by locks, therefore the information obtained after a read
2649 might not always be consistent.
2650
2651 PARAMETERS
2652
2653 IN
2654 pvosGCtx: pointer to the global vos context; a handle to TL's
2655 or SME's control block can be extracted from its context
2656 ucSTAId: station identifier for the requested value
2657
2658 OUT
2659 pSnr: the average value of the SNR
2660
2661
2662 RETURN VALUE
2663 The result code associated with performing the operation
2664
2665 VOS_STATUS_E_INVAL: Input parameters are invalid
2666 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
2667 to TL cb is NULL ; access would cause a page fault
2668 VOS_STATUS_E_EXISTS: STA was not yet registered
2669 VOS_STATUS_SUCCESS: Everything is good :)
2670
2671 SIDE EFFECTS
2672
2673============================================================================*/
2674VOS_STATUS
2675WLANTL_GetSnr
2676(
2677 tANI_U8 ucSTAId,
2678 tANI_S8* pSnr
2679)
2680{
2681 WLANTL_CbType* pTLCb = NULL;
2682 WLANTL_STAClientType* pClientSTA = NULL;
2683 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2684
2685 /*------------------------------------------------------------------------
2686 Sanity check
2687 ------------------------------------------------------------------------*/
2688 if (NULL == pSnr)
2689 {
2690 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2691 "WLAN TL:Invalid parameter sent on %s", __func__));
2692 return VOS_STATUS_E_INVAL;
2693 }
2694
2695 if (WLANTL_STA_ID_INVALID(ucSTAId))
2696 {
2697 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2698 "WLAN TL:Invalid station id requested on %s", __func__));
2699 return VOS_STATUS_E_FAULT;
2700 }
2701
2702 /*------------------------------------------------------------------------
2703 Extract TL control block and check existance
2704 ------------------------------------------------------------------------*/
2705 pTLCb = VOS_GET_TL_CB(vos_get_global_context(VOS_MODULE_ID_TL, NULL));
2706 if (NULL == pTLCb)
2707 {
2708 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2709 "WLAN TL:Invalid TL pointer from pvosGCtx on %s", __func__));
2710 return VOS_STATUS_E_FAULT;
2711 }
2712
2713 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
2714
2715 if (NULL == pClientSTA)
2716 {
2717 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2718 "WLAN TL:Client Memory was not allocated on %s", __func__));
2719 return VOS_STATUS_E_FAILURE;
2720 }
2721
2722 if (0 == pClientSTA->ucExists)
2723 {
2724 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2725 "WLAN TL:Station was not previously registered on %s", __func__));
2726 return VOS_STATUS_E_EXISTS;
2727 }
2728
2729 /*------------------------------------------------------------------------
2730 Copy will not be locked; please read restriction
2731 ------------------------------------------------------------------------*/
2732 if (pTLCb->isBMPS)
2733 {
2734 *pSnr = pClientSTA->snrAvgBmps;
2735 }
2736 else
2737 {
2738 /* SNR is averaged over WLANTL_MAX_SNR_DATA_SAMPLES, if there are not enough
2739 * data samples (snridx) to calculate the average then return the
2740 * average for the window of prevoius 20 packets. And if there aren't
2741 * enough samples and the average for previous window of 20 packets is
2742 * not available then return a predefined value
2743 *
2744 * NOTE: the SNR_HACK_BMPS value is defined to 127, documents from HW
2745 * team reveal that the SNR value has a ceiling well below 127 dBm,
2746 * so if SNR has value of 127 the userspace applications can know that
2747 * the SNR has not been computed yet because enough data was not
2748 * available for SNR calculation
2749 */
2750 if (pClientSTA->snrIdx > (WLANTL_MAX_SNR_DATA_SAMPLES/2)
2751 || !(pClientSTA->prevSnrAvg))
2752 {
2753 *pSnr = pClientSTA->snrSum / pClientSTA->snrIdx;
2754 }
2755 else if (pClientSTA->prevSnrAvg)
2756 {
2757 *pSnr = pClientSTA->prevSnrAvg;
2758 }
2759 else
2760 {
2761 *pSnr = SNR_HACK_BMPS;
2762 }
2763 }
2764
2765 VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
2766 "WLAN TL:WLANTL_GetSnr for STA: %d SNR: %d%s",
2767 ucSTAId, *pSnr,
2768 pTLCb->isBMPS ? " in BMPS" : "");
2769
2770 return VOS_STATUS_SUCCESS;
2771}/* WLANTL_GetSnr */
2772/*==========================================================================
2773
Jeff Johnson295189b2012-06-20 16:38:30 -07002774 FUNCTION WLANTL_GetLinkQuality
2775
2776 DESCRIPTION
2777 TL will extract the SNR information from every data packet from the
2778 ongoing traffic and will store it. It will provide the result to SME
2779 upon request.
2780
2781 DEPENDENCIES
2782
2783 WARNING: the read and write of this value will not be protected
2784 by locks, therefore the information obtained after a read
2785 might not always be consistent.
2786
2787 PARAMETERS
2788
2789 IN
2790 pvosGCtx: pointer to the global vos context; a handle to TL's
2791 or SME's control block can be extracted from its context
2792 ucSTAId: station identifier for the requested value
2793
2794 OUT
2795 puLinkQuality: the average value of the SNR
2796
2797
2798 RETURN VALUE
2799 The result code associated with performing the operation
2800
2801 VOS_STATUS_E_INVAL: Input parameters are invalid
2802 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
2803 to TL cb is NULL ; access would cause a page fault
2804 VOS_STATUS_E_EXISTS: STA was not yet registered
2805 VOS_STATUS_SUCCESS: Everything is good :)
2806
2807 SIDE EFFECTS
2808
2809============================================================================*/
2810VOS_STATUS
2811WLANTL_GetLinkQuality
2812(
2813 v_PVOID_t pvosGCtx,
2814 v_U8_t ucSTAId,
2815 v_U32_t* puLinkQuality
2816)
2817{
2818 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302819 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002820
2821 /*------------------------------------------------------------------------
2822 Sanity check
2823 ------------------------------------------------------------------------*/
2824 if ( NULL == puLinkQuality )
2825 {
2826 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2827 "Invalid parameter sent on WLANTL_GetLinkQuality"));
2828 return VOS_STATUS_E_INVAL;
2829 }
2830
2831 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
2832 {
2833 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2834 "Invalid station id requested on WLANTL_GetLinkQuality"));
2835 return VOS_STATUS_E_FAULT;
2836 }
2837
2838 /*------------------------------------------------------------------------
2839 Extract TL control block and check existance
2840 ------------------------------------------------------------------------*/
2841 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2842 if ( NULL == pTLCb )
2843 {
2844 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2845 "Invalid TL pointer from pvosGCtx on WLANTL_GetLinkQuality"));
2846 return VOS_STATUS_E_FAULT;
2847 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302848 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
Jeff Johnson295189b2012-06-20 16:38:30 -07002849
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302850 if ( NULL == pClientSTA )
2851 {
2852 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2853 "WLAN TL:Client Memory was not allocated on %s", __func__));
2854 return VOS_STATUS_E_FAILURE;
2855 }
2856
2857 if ( 0 == pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07002858 {
2859 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2860 "Station was not previously registered on WLANTL_GetLinkQuality"));
2861 return VOS_STATUS_E_EXISTS;
2862 }
2863
2864 /*------------------------------------------------------------------------
2865 Copy will not be locked; please read restriction
2866 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302867 *puLinkQuality = pClientSTA->uLinkQualityAvg;
Jeff Johnson295189b2012-06-20 16:38:30 -07002868
2869 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
2870 "WLANTL_GetLinkQuality for STA: %d LinkQuality: %d", ucSTAId, *puLinkQuality));
2871
2872 return VOS_STATUS_SUCCESS;
2873}/* WLANTL_GetLinkQuality */
2874
2875/*==========================================================================
2876
2877 FUNCTION WLANTL_FlushStaTID
2878
2879 DESCRIPTION
2880 TL provides this API as an interface to SME (BAP) layer. TL inturn posts a
2881 message to HAL. This API is called by the SME inorder to perform a flush
2882 operation.
2883
2884 DEPENDENCIES
2885
2886 PARAMETERS
2887
2888 IN
2889 pvosGCtx: pointer to the global vos context; a handle to TL's
2890 or SME's control block can be extracted from its context
2891 ucSTAId: station identifier for the requested value
2892 ucTid: Tspec ID for the new BA session
2893
2894 OUT
2895 The response for this post is received in the main thread, via a response
2896 message from HAL to TL.
2897
2898 RETURN VALUE
2899 VOS_STATUS_SUCCESS: Everything is good :)
2900
2901 SIDE EFFECTS
2902============================================================================*/
2903VOS_STATUS
2904WLANTL_FlushStaTID
2905(
2906 v_PVOID_t pvosGCtx,
2907 v_U8_t ucSTAId,
2908 v_U8_t ucTid
2909)
2910{
2911 WLANTL_CbType* pTLCb = NULL;
2912 tpFlushACReq FlushACReqPtr = NULL;
2913 vos_msg_t vosMessage;
2914
2915
2916 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
2917 {
2918 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2919 "Invalid station id requested on WLANTL_FlushStaTID"));
2920 return VOS_STATUS_E_FAULT;
2921 }
2922
2923 /*------------------------------------------------------------------------
2924 Extract TL control block and check existance
2925 ------------------------------------------------------------------------*/
2926 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2927 if ( NULL == pTLCb )
2928 {
2929 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2930 "Invalid TL pointer from pvosGCtx on WLANTL_FlushStaTID"));
2931 return VOS_STATUS_E_FAULT;
2932 }
2933
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302934 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
2935 {
2936 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2937 "WLAN TL:Client Memory was not allocated on %s", __func__));
2938 return VOS_STATUS_E_FAILURE;
2939 }
2940
2941 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07002942 {
2943 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2944 "Station was not previously registered on WLANTL_FlushStaTID"));
2945 return VOS_STATUS_E_EXISTS;
2946 }
2947
2948 /*------------------------------------------------------------------------
2949 We need to post a message with the STA, TID value to HAL. HAL performs the flush
2950 ------------------------------------------------------------------------*/
2951 FlushACReqPtr = vos_mem_malloc(sizeof(tFlushACReq));
2952
2953 if ( NULL == FlushACReqPtr )
2954 {
2955 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2956 "WLAN TL: fatal failure, cannot allocate Flush Req structure"));
2957 VOS_ASSERT(0);
2958 return VOS_STATUS_E_NOMEM;
2959 }
2960
2961 // Start constructing the message for HAL
2962 FlushACReqPtr->mesgType = SIR_TL_HAL_FLUSH_AC_REQ;
2963 FlushACReqPtr->mesgLen = sizeof(tFlushACReq);
2964 FlushACReqPtr->mesgLen = sizeof(tFlushACReq);
2965 FlushACReqPtr->ucSTAId = ucSTAId;
2966 FlushACReqPtr->ucTid = ucTid;
2967
2968 vosMessage.type = WDA_TL_FLUSH_AC_REQ;
2969 vosMessage.bodyptr = (void *)FlushACReqPtr;
2970
2971 vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
2972 return VOS_STATUS_SUCCESS;
2973}
2974
2975
2976/*----------------------------------------------------------------------------
2977 INTERACTION WITH PE
2978 ---------------------------------------------------------------------------*/
Siddharth Bhal4551b102014-10-09 21:36:36 +05302979/*==========================================================================
Jeff Johnson295189b2012-06-20 16:38:30 -07002980
Siddharth Bhal4551b102014-10-09 21:36:36 +05302981 FUNCTION WLANTL_updateSpoofMacAddr
2982
2983 DESCRIPTION
2984 Called by HDD to update macaddr
2985
2986 DEPENDENCIES
2987 TL must be initialized before this API can be called.
2988
2989 PARAMETERS
2990
2991 IN
2992 pvosGCtx: pointer to the global vos context; a handle to
2993 TL's control block can be extracted from its context
2994 spoofMacAddr: spoofed mac adderess
2995 selfMacAddr: self Mac Address
2996
2997 RETURN VALUE
2998 The result code associated with performing the operation
2999
3000 VOS_STATUS_E_INVAL: Input parameters are invalid
3001 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
3002 page fault
3003 VOS_STATUS_SUCCESS: Everything is good :)
3004
3005 SIDE EFFECTS
3006
3007============================================================================*/
3008VOS_STATUS
3009WLANTL_updateSpoofMacAddr
3010(
3011 v_PVOID_t pvosGCtx,
3012 v_MACADDR_t* spoofMacAddr,
3013 v_MACADDR_t* selfMacAddr
3014)
3015{
3016 WLANTL_CbType* pTLCb = NULL;
3017 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3018
3019 /*------------------------------------------------------------------------
3020 Sanity check
3021 ------------------------------------------------------------------------*/
3022 if ( NULL == spoofMacAddr || NULL == selfMacAddr)
3023 {
3024 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3025 "WLAN TL:Invalid parameter sent on WLANTL_updateSpoofMacAddr");
3026 return VOS_STATUS_E_INVAL;
3027 }
3028
3029 /*------------------------------------------------------------------------
3030 Extract TL control block
3031 ------------------------------------------------------------------------*/
3032 pTLCb = VOS_GET_TL_CB(pvosGCtx);
3033 if ( NULL == pTLCb )
3034 {
3035 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3036 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState");
3037 return VOS_STATUS_E_FAULT;
3038 }
3039
3040 vos_mem_copy(pTLCb->spoofMacAddr.selfMac.bytes, selfMacAddr,
3041 VOS_MAC_ADDRESS_LEN);
3042 vos_mem_copy(pTLCb->spoofMacAddr.spoofMac.bytes, spoofMacAddr,
3043 VOS_MAC_ADDRESS_LEN);
3044
3045 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
3046 "TL: SelfSTA mac Addr for current Scan "MAC_ADDRESS_STR,
3047 MAC_ADDR_ARRAY(pTLCb->spoofMacAddr.selfMac.bytes));
3048
3049 return VOS_STATUS_SUCCESS;
3050}/* WLANTL_updateSpoofMacAddr */
Jeff Johnson295189b2012-06-20 16:38:30 -07003051/*==========================================================================
3052
3053 FUNCTION WLANTL_RegisterMgmtFrmClient
3054
3055 DESCRIPTION
3056 Called by PE to register as a client for management frames delivery.
3057
3058 DEPENDENCIES
3059 TL must be initialized before this API can be called.
3060
3061 PARAMETERS
3062
3063 IN
3064 pvosGCtx: pointer to the global vos context; a handle to
3065 TL's control block can be extracted from its context
3066 pfnTlMgmtFrmRx: pointer to the receive processing routine for
3067 management frames
3068
3069 RETURN VALUE
3070 The result code associated with performing the operation
3071
3072 VOS_STATUS_E_INVAL: Input parameters are invalid
3073 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
3074 page fault
3075 VOS_STATUS_E_EXISTS: Mgmt Frame client was already registered
3076 VOS_STATUS_SUCCESS: Everything is good :)
3077
3078 SIDE EFFECTS
3079
3080============================================================================*/
3081VOS_STATUS
3082WLANTL_RegisterMgmtFrmClient
3083(
3084 v_PVOID_t pvosGCtx,
3085 WLANTL_MgmtFrmRxCBType pfnTlMgmtFrmRx
3086)
3087{
3088 WLANTL_CbType* pTLCb = NULL;
3089 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3090
3091 /*------------------------------------------------------------------------
3092 Sanity check
3093 ------------------------------------------------------------------------*/
3094 if ( NULL == pfnTlMgmtFrmRx )
3095 {
3096 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3097 "WLAN TL:Invalid parameter sent on WLANTL_RegisterMgmtFrmClient"));
3098 return VOS_STATUS_E_INVAL;
3099 }
3100
3101 /*------------------------------------------------------------------------
3102 Extract TL control block
3103 ------------------------------------------------------------------------*/
3104 pTLCb = VOS_GET_TL_CB(pvosGCtx);
3105 if ( NULL == pTLCb )
3106 {
3107 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3108 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
3109 return VOS_STATUS_E_FAULT;
3110 }
3111
3112 /*------------------------------------------------------------------------
3113 Make sure this is the first registration attempt
3114 ------------------------------------------------------------------------*/
3115 if ( 0 != pTLCb->tlMgmtFrmClient.ucExists )
3116 {
3117 pTLCb->tlMgmtFrmClient.ucExists++;
3118 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3119 "WLAN TL:Management frame client was already registered"));
3120 return VOS_STATUS_E_EXISTS;
3121 }
3122
3123 /*------------------------------------------------------------------------
3124 Register station with TL
3125 ------------------------------------------------------------------------*/
3126 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3127 "WLAN TL:Registering Management Frame Client" ));
3128
3129 pTLCb->tlMgmtFrmClient.ucExists++;
3130
3131 if ( NULL != pfnTlMgmtFrmRx )
3132 {
3133 pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx = pfnTlMgmtFrmRx;
3134 }
3135
3136 pTLCb->tlMgmtFrmClient.vosPendingDataBuff = NULL;
3137
3138 return VOS_STATUS_SUCCESS;
3139}/* WLANTL_RegisterMgmtFrmClient */
3140
3141/*==========================================================================
3142
3143 FUNCTION WLANTL_DeRegisterMgmtFrmClient
3144
3145 DESCRIPTION
3146 Called by PE to deregister as a client for management frames delivery.
3147
3148 DEPENDENCIES
3149 TL must be initialized before this API can be called.
3150
3151 PARAMETERS
3152
3153 IN
3154 pvosGCtx: pointer to the global vos context; a handle to
3155 TL's control block can be extracted from its context
3156 RETURN VALUE
3157 The result code associated with performing the operation
3158
3159 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
3160 page fault
3161 VOS_STATUS_E_EXISTS: Mgmt Frame client was never registered
3162 VOS_STATUS_SUCCESS: Everything is good :)
3163
3164 SIDE EFFECTS
3165
3166============================================================================*/
3167VOS_STATUS
3168WLANTL_DeRegisterMgmtFrmClient
3169(
3170 v_PVOID_t pvosGCtx
3171)
3172{
3173 WLANTL_CbType* pTLCb = NULL;
3174 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3175
3176 /*------------------------------------------------------------------------
3177 Extract TL control block
3178 ------------------------------------------------------------------------*/
3179 pTLCb = VOS_GET_TL_CB(pvosGCtx);
3180 if ( NULL == pTLCb )
3181 {
3182 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3183 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
3184 return VOS_STATUS_E_FAULT;
3185 }
3186
3187 /*------------------------------------------------------------------------
3188 Make sure this is the first registration attempt
3189 ------------------------------------------------------------------------*/
3190 if ( 0 == pTLCb->tlMgmtFrmClient.ucExists )
3191 {
3192 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3193 "WLAN TL:Management frame client was never registered"));
3194 return VOS_STATUS_E_EXISTS;
3195 }
3196
3197 /*------------------------------------------------------------------------
3198 Clear registration with TL
3199 ------------------------------------------------------------------------*/
3200 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3201 "WLAN TL:Deregistering Management Frame Client" ));
3202
3203 pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx = WLANTL_MgmtFrmRxDefaultCb;
3204 if ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff)
3205 {
3206 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
3207 "WLAN TL:Management cache buffer not empty on deregistering"
3208 " - dropping packet" ));
3209 vos_pkt_return_packet(pTLCb->tlMgmtFrmClient.vosPendingDataBuff);
3210
3211 pTLCb->tlMgmtFrmClient.vosPendingDataBuff = NULL;
3212 }
3213
3214 pTLCb->tlMgmtFrmClient.ucExists = 0;
3215
3216 return VOS_STATUS_SUCCESS;
3217}/* WLANTL_RegisterMgmtFrmClient */
3218
3219/*==========================================================================
3220
3221 FUNCTION WLANTL_TxMgmtFrm
3222
3223 DESCRIPTION
3224 Called by PE when it want to send out a management frame.
3225 HAL will also use this API for the few frames it sends out, they are not
3226 management frames howevere it is accepted that an exception will be
3227 allowed ONLY for the usage of HAL.
3228 Generic data frames SHOULD NOT travel through this function.
3229
3230 DEPENDENCIES
3231 TL must be initialized before this API can be called.
3232
3233 RESTRICTION: If PE sends another packet before TL manages to process the
3234 previously sent packet call will end in failure
3235
3236 Frames comming through here must be 802.11 frames, frame
3237 translation in UMA will be automatically disabled.
3238
3239 PARAMETERS
3240
3241 IN
3242 pvosGCtx: pointer to the global vos context;a handle to TL's
3243 control block can be extracted from its context
3244 vosFrmBuf: pointer to a vOSS buffer containing the management
3245 frame to be transmitted
3246 usFrmLen: the length of the frame to be transmitted; information
3247 is already included in the vOSS buffer
3248 wFrmType: the type of the frame being transmitted
3249 tid: tid used to transmit this frame
3250 pfnCompTxFunc: function pointer to the transmit complete routine
3251 pvBDHeader: pointer to the BD header, if NULL it means it was not
3252 yet constructed and it lies within TL's responsibility
3253 to do so; if not NULL it is expected that it was
3254 already packed inside the vos packet
3255 ucAckResponse: flag notifying it an interrupt is needed for the
3256 acknowledgement received when the frame is sent out
3257 the air and ; the interrupt will be processed by HAL,
3258 only one such frame can be pending in the system at
3259 one time.
3260
3261
3262 RETURN VALUE
3263 The result code associated with performing the operation
3264
3265 VOS_STATUS_E_INVAL: Input parameters are invalid
3266 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
3267 page fault
3268 VOS_STATUS_E_EXISTS: Mgmt Frame client was not yet registered
3269 VOS_STATUS_E_BUSY: The previous Mgmt packet was not yet transmitted
3270 VOS_STATUS_SUCCESS: Everything is good :)
3271
3272 Other failure messages may be returned from the BD header handling
3273 routines, please check apropriate API for more info.
3274
3275 SIDE EFFECTS
3276
3277============================================================================*/
3278VOS_STATUS
3279WLANTL_TxMgmtFrm
3280(
3281 v_PVOID_t pvosGCtx,
3282 vos_pkt_t* vosFrmBuf,
3283 v_U16_t usFrmLen,
3284 v_U8_t wFrmType,
3285 v_U8_t ucTid,
3286 WLANTL_TxCompCBType pfnCompTxFunc,
3287 v_PVOID_t pvBDHeader,
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05303288 v_U32_t ucAckResponse
Jeff Johnson295189b2012-06-20 16:38:30 -07003289)
3290{
3291 WLANTL_CbType* pTLCb = NULL;
3292 v_MACADDR_t vDestMacAddr;
3293 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
3294 v_U16_t usPktLen;
3295 v_U32_t usTimeStamp = 0;
3296 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3297
3298 /*------------------------------------------------------------------------
3299 Sanity check
3300 ------------------------------------------------------------------------*/
3301 if ( NULL == vosFrmBuf )
3302 {
3303 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3304 "WLAN TL:Invalid parameter sent on WLANTL_TxMgmtFrm"));
3305 return VOS_STATUS_E_INVAL;
3306 }
3307
3308 /*------------------------------------------------------------------------
3309 Extract TL control block
3310 ------------------------------------------------------------------------*/
3311 pTLCb = VOS_GET_TL_CB(pvosGCtx);
3312 if ( NULL == pTLCb )
3313 {
3314 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
3315 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_TxMgmtFrm"));
3316 return VOS_STATUS_E_FAULT;
3317 }
3318
3319 /*------------------------------------------------------------------------
3320 Ensure that management frame client was previously registered
3321 ------------------------------------------------------------------------*/
3322 if ( 0 == pTLCb->tlMgmtFrmClient.ucExists )
3323 {
3324 pTLCb->tlMgmtFrmClient.ucExists++;
3325 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
3326 "WLAN TL:Management Frame client not register on WLANTL_TxMgmtFrm"));
3327 return VOS_STATUS_E_EXISTS;
3328 }
3329
3330 /*------------------------------------------------------------------------
3331 Check if any Mgmt Frm is pending
3332 ------------------------------------------------------------------------*/
3333 //vosTempBuff = pTLCb->tlMgmtFrmClient.vosPendingDataBuff;
3334 if ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff )
3335 {
3336
3337 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
3338 "WLAN TL:Management Frame already pending tx in TL: failing old one"));
3339
3340
3341 /*Failing the tx for the previous packet enqued by PE*/
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05303342 //vos_atomic_set( (uintptr_t*)&pTLCb->tlMgmtFrmClient.vosPendingDataBuff,
3343 // (uintptr_t)NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07003344
3345 //vos_pkt_get_user_data_ptr( vosTempBuff, VOS_PKT_USER_DATA_ID_TL,
3346 // (v_PVOID_t)&pfnTxComp);
3347
3348 /*it should never be NULL - default handler should be registered if none*/
3349 //if ( NULL == pfnTxComp )
3350 //{
3351 // VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3352 // "NULL pointer to Tx Complete on WLANTL_TxMgmtFrm");
3353 // VOS_ASSERT(0);
3354 // return VOS_STATUS_E_FAULT;
3355 //}
3356
3357 //pfnTxComp( pvosGCtx, vosTempBuff, VOS_STATUS_E_RESOURCES );
3358 //return VOS_STATUS_E_BUSY;
3359
3360
3361 //pfnCompTxFunc( pvosGCtx, vosFrmBuf, VOS_STATUS_E_RESOURCES);
3362 return VOS_STATUS_E_RESOURCES;
3363 }
3364
3365
3366 /*------------------------------------------------------------------------
3367 Check if BD header was build, if not construct
3368 ------------------------------------------------------------------------*/
3369 if ( NULL == pvBDHeader )
3370 {
3371 v_MACADDR_t* pvAddr2MacAddr;
3372 v_U8_t uQosHdr = VOS_FALSE;
3373
3374 /* Get address 2 of Mangement Frame to give to WLANHAL_FillTxBd */
3375 vosStatus = vos_pkt_peek_data( vosFrmBuf,
3376 WLANTL_MAC_ADDR_ALIGN(1) + VOS_MAC_ADDR_SIZE,
3377 (v_PVOID_t)&pvAddr2MacAddr, VOS_MAC_ADDR_SIZE);
3378
3379 if ( VOS_STATUS_SUCCESS != vosStatus )
3380 {
3381 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
3382 "WLAN TL:Failed while attempting to get addr2 %d", vosStatus));
3383 return vosStatus;
3384 }
Gopichand Nakkala0f3eb5c2013-05-07 16:48:38 +05303385
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003386 /* ESE IAPP/TDLS Frame which are data frames but technically used
Jeff Johnson295189b2012-06-20 16:38:30 -07003387 * for management functionality comes through route.
3388 */
3389 if (WLANTL_IS_QOS_DATA_FRAME(wFrmType)) \
3390 {
3391 uQosHdr = VOS_TRUE;
3392 }
Siddharth Bhal4551b102014-10-09 21:36:36 +05303393
3394 if (WLANTL_IS_PROBE_REQ(wFrmType))
3395 {
3396 if (VOS_TRUE == vos_mem_compare((v_VOID_t*) pvAddr2MacAddr,
3397 (v_VOID_t*) &pTLCb->spoofMacAddr.spoofMac, VOS_MAC_ADDRESS_LEN))
3398 {
3399 pvAddr2MacAddr = (v_PVOID_t)pTLCb->spoofMacAddr.selfMac.bytes;
3400 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
3401 "TL: using self sta addr to get staidx for spoofed probe req "
3402 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pvAddr2MacAddr->bytes));
3403 }
3404 }
3405
Jeff Johnson295189b2012-06-20 16:38:30 -07003406 /*----------------------------------------------------------------------
3407 Call WDA to build TX header
3408 ----------------------------------------------------------------------*/
3409 vosStatus = WDA_DS_BuildTxPacketInfo( pvosGCtx, vosFrmBuf , &vDestMacAddr,
3410 1 /* always 802.11 frames*/, &usPktLen, uQosHdr /*qos not enabled !!!*/,
Siddharth Bhal4551b102014-10-09 21:36:36 +05303411 0 /* WDS off */, 0, wFrmType, pvAddr2MacAddr, ucTid,
Jeff Johnson295189b2012-06-20 16:38:30 -07003412 ucAckResponse, usTimeStamp, 0, 0 );
3413
3414
3415 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
3416 {
3417 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
3418 "WLAN TL:Failed while attempting to build TX header %d", vosStatus));
3419 return vosStatus;
3420 }
3421 }/* if BD header not present */
3422
3423 /*------------------------------------------------------------------------
3424 Save buffer and notify BAL; no lock is needed if the above restriction
3425 is met
3426 Save the tx complete fnct pointer as tl specific data in the vos buffer
3427 ------------------------------------------------------------------------*/
3428 if ( NULL != pfnCompTxFunc )
3429 {
3430 vos_pkt_set_user_data_ptr( vosFrmBuf, VOS_PKT_USER_DATA_ID_TL,
3431 (v_PVOID_t)pfnCompTxFunc);
3432 }
3433 else
3434 {
3435 vos_pkt_set_user_data_ptr( vosFrmBuf, VOS_PKT_USER_DATA_ID_TL,
3436 (v_PVOID_t)WLANTL_TxCompDefaultCb);
3437
3438 }
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05303439 vos_atomic_set( (uintptr_t*)&pTLCb->tlMgmtFrmClient.vosPendingDataBuff,
3440 (uintptr_t)vosFrmBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003441
3442 /*------------------------------------------------------------------------
3443 Check if thre are enough resources for transmission and tx is not
3444 suspended.
3445 ------------------------------------------------------------------------*/
3446 if ( pTLCb->uResCount >= WDA_TLI_MIN_RES_MF )
3447 {
3448 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3449 "WLAN TL:Issuing Xmit start request to BAL for MGMT"));
3450 vosStatus = WDA_DS_StartXmit(pvosGCtx);
3451 if(VOS_STATUS_SUCCESS != vosStatus)
3452 {
3453 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
3454 "WLAN TL:WDA_DS_StartXmit fails. vosStatus %d", vosStatus));
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05303455 vos_atomic_set( (uintptr_t*)&pTLCb->tlMgmtFrmClient.vosPendingDataBuff,0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003456 }
3457 return vosStatus;
3458
3459 }
3460 else
3461 {
3462 /*---------------------------------------------------------------------
3463 No error code is sent because TL will resume tx autonomously if
3464 resources become available or tx gets resumed
3465 ---------------------------------------------------------------------*/
3466 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
3467 "WLAN TL:Request to send for Mgmt Frm but condition not met. Res: %d",
3468 pTLCb->uResCount));
3469 }
3470
3471 return VOS_STATUS_SUCCESS;
3472}/* WLANTL_TxMgmtFrm */
3473
3474/*----------------------------------------------------------------------------
3475 INTERACTION WITH HAL
3476 ---------------------------------------------------------------------------*/
3477
3478/*==========================================================================
3479
3480 FUNCTION WLANTL_ResetNotification
3481
3482 DESCRIPTION
3483 HAL notifies TL when the module is being reset.
3484 Currently not used.
3485
3486 DEPENDENCIES
3487
3488 PARAMETERS
3489
3490 IN
3491 pvosGCtx: pointer to the global vos context; a handle to TL's
3492 control block can be extracted from its context
3493
3494
3495 RETURN VALUE
3496 The result code associated with performing the operation
3497
3498 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
3499 page fault
3500 VOS_STATUS_SUCCESS: Everything is good :)
3501
3502 SIDE EFFECTS
3503
3504============================================================================*/
3505VOS_STATUS
3506WLANTL_ResetNotification
3507(
3508 v_PVOID_t pvosGCtx
3509)
3510{
3511 WLANTL_CbType* pTLCb = NULL;
3512 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3513
3514 /*------------------------------------------------------------------------
3515 Sanity check
3516 Extract TL control block
3517 ------------------------------------------------------------------------*/
3518 pTLCb = VOS_GET_TL_CB(pvosGCtx);
3519 if ( NULL == pTLCb )
3520 {
3521 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3522 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ResetNotification"));
3523 return VOS_STATUS_E_FAULT;
3524 }
3525
3526 WLANTL_CleanCB(pTLCb, 1 /*empty all queues and pending packets*/);
3527 return VOS_STATUS_SUCCESS;
3528}/* WLANTL_ResetNotification */
3529
3530/*==========================================================================
3531
3532 FUNCTION WLANTL_SuspendDataTx
3533
3534 DESCRIPTION
3535 HAL calls this API when it wishes to suspend transmission for a
3536 particular STA.
3537
3538 DEPENDENCIES
3539 The STA for which the request is made must be first registered with
3540 TL by HDD.
3541
3542 RESTRICTION: In case of a suspend, the flag write and read will not be
3543 locked: worst case scenario one more packet can get
3544 through before the flag gets updated (we can make this
3545 write atomic as well to guarantee consistency)
3546
3547 PARAMETERS
3548
3549 IN
3550 pvosGCtx: pointer to the global vos context; a handle to TL's
3551 control block can be extracted from its context
3552 pucSTAId: identifier of the station for which the request is made;
3553 a value of NULL assumes suspend on all active station
3554 pfnSuspendTxCB: pointer to the suspend result notification in case the
3555 call is asynchronous
3556
3557
3558 RETURN VALUE
3559 The result code associated with performing the operation
3560
3561 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
3562 to TL cb is NULL ; access would cause a page fault
3563 VOS_STATUS_E_EXISTS: Station was not registered
3564 VOS_STATUS_SUCCESS: Everything is good :)
3565
3566 SIDE EFFECTS
3567
3568============================================================================*/
3569
3570VOS_STATUS
3571WLANTL_SuspendDataTx
3572(
3573 v_PVOID_t pvosGCtx,
3574 v_U8_t* pucSTAId,
3575 WLANTL_SuspendCBType pfnSuspendTx
3576)
3577{
3578 WLANTL_CbType* pTLCb = NULL;
3579 vos_msg_t vosMsg;
Jeff Johnson295189b2012-06-20 16:38:30 -07003580
3581 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3582
3583 /*------------------------------------------------------------------------
3584 Sanity check
3585 Extract TL control block
3586 ------------------------------------------------------------------------*/
3587 pTLCb = VOS_GET_TL_CB(pvosGCtx);
Hoonki Lee14621352013-04-16 17:51:19 -07003588 if ( NULL == pTLCb )
Jeff Johnson295189b2012-06-20 16:38:30 -07003589 {
3590 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3591 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SuspendDataTx"));
3592 return VOS_STATUS_E_FAULT;
3593 }
3594
3595 /*------------------------------------------------------------------------
3596 Check the type of request: generic suspend, or per station suspend
3597 ------------------------------------------------------------------------*/
Hoonki Lee14621352013-04-16 17:51:19 -07003598 if (NULL == pucSTAId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003599 {
3600 /* General Suspend Request received */
3601 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3602 "WLAN TL:General suspend requested"));
Hoonki Lee14621352013-04-16 17:51:19 -07003603 vos_atomic_set_U8( &pTLCb->ucTxSuspended, 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07003604 vosMsg.reserved = WLAN_MAX_STA_COUNT;
3605 }
3606 else
3607 {
Hoonki Lee14621352013-04-16 17:51:19 -07003608 if ( WLANTL_STA_ID_INVALID( *pucSTAId ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07003609 {
Hoonki Lee14621352013-04-16 17:51:19 -07003610 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3611 "WLAN TL:Invalid station id %d requested on WLANTL_SuspendDataTx", *pucSTAId));
3612 return VOS_STATUS_E_FAULT;
3613 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003614
Gopichand Nakkalae5fef6c2013-06-19 18:04:23 +05303615 if ( NULL == pTLCb->atlSTAClients[*pucSTAId] )
3616 {
3617 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3618 "WLAN TL:Invalid pTLCb->atlSTAClients pointer for STA Id :%d on "
3619 "WLANTL_SuspendDataTx", *pucSTAId));
3620 return VOS_STATUS_E_FAULT;
3621 }
3622
3623 if ( 0 == pTLCb->atlSTAClients[*pucSTAId]->ucExists )
Hoonki Lee14621352013-04-16 17:51:19 -07003624 {
3625 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3626 "WLAN TL:Station %d was not previously registered on WLANTL_SuspendDataTx", *pucSTAId));
3627 return VOS_STATUS_E_EXISTS;
3628 }
3629
3630 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3631 "WLAN TL:Suspend request for station: %d", *pucSTAId));
3632 vos_atomic_set_U8( &pTLCb->atlSTAClients[*pucSTAId]->ucTxSuspended, 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07003633 vosMsg.reserved = *pucSTAId;
3634 }
3635
3636 /*------------------------------------------------------------------------
3637 Serialize request through TX thread
3638 ------------------------------------------------------------------------*/
3639 vosMsg.type = WLANTL_TX_SIG_SUSPEND;
3640 vosMsg.bodyptr = (v_PVOID_t)pfnSuspendTx;
3641
Katya Nigam42e16e82014-02-04 16:28:55 +05303642 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_SUSPEND_DATA_TX,
3643 vosMsg.reserved , 0 ));
3644
Jeff Johnson295189b2012-06-20 16:38:30 -07003645 if(!VOS_IS_STATUS_SUCCESS(vos_tx_mq_serialize( VOS_MQ_ID_TL, &vosMsg)))
3646 {
3647 VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003648 " %s fails to post message", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003649 }
3650
3651 return VOS_STATUS_SUCCESS;
3652}/* WLANTL_SuspendDataTx */
3653
3654/*==========================================================================
3655
3656 FUNCTION WLANTL_ResumeDataTx
3657
3658 DESCRIPTION
3659 Called by HAL to resume data transmission for a given STA.
3660
3661 WARNING: If a station was individually suspended a global resume will
3662 not resume that station
3663
3664 DEPENDENCIES
3665
3666 PARAMETERS
3667
3668 IN
3669 pvosGCtx: pointer to the global vos context; a handle to TL's
3670 control block can be extracted from its context
3671 pucSTAId: identifier of the station which is being resumed; NULL
3672 translates into global resume
3673
3674 RETURN VALUE
3675 The result code associated with performing the operation
3676
3677 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
3678 to TL cb is NULL ; access would cause a page fault
3679 VOS_STATUS_E_EXISTS: Station was not registered
3680 VOS_STATUS_SUCCESS: Everything is good :)
3681
3682 SIDE EFFECTS
3683
3684============================================================================*/
3685
3686VOS_STATUS
3687WLANTL_ResumeDataTx
3688(
3689 v_PVOID_t pvosGCtx,
3690 v_U8_t* pucSTAId
3691)
3692{
3693 WLANTL_CbType* pTLCb = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003694 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3695
3696 /*------------------------------------------------------------------------
3697 Sanity check
3698 Extract TL control block
3699 ------------------------------------------------------------------------*/
3700 pTLCb = VOS_GET_TL_CB(pvosGCtx);
Hoonki Lee14621352013-04-16 17:51:19 -07003701 if ( NULL == pTLCb )
Jeff Johnson295189b2012-06-20 16:38:30 -07003702 {
3703 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3704 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ResumeDataTx"));
3705 return VOS_STATUS_E_FAULT;
3706 }
3707
Jeff Johnson295189b2012-06-20 16:38:30 -07003708 /*------------------------------------------------------------------------
3709 Check to see the type of resume
3710 ------------------------------------------------------------------------*/
Hoonki Lee14621352013-04-16 17:51:19 -07003711 if ( NULL == pucSTAId )
Jeff Johnson295189b2012-06-20 16:38:30 -07003712 {
Katya Nigam42e16e82014-02-04 16:28:55 +05303713 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_RESUME_DATA_TX,
3714 41 , 0 ));
3715
Jeff Johnson295189b2012-06-20 16:38:30 -07003716 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3717 "WLAN TL:General resume requested"));
3718 vos_atomic_set_U8( &pTLCb->ucTxSuspended, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003719 }
3720 else
3721 {
Katya Nigam42e16e82014-02-04 16:28:55 +05303722 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_RESUME_DATA_TX,
3723 *pucSTAId , 0 ));
3724
Hoonki Lee14621352013-04-16 17:51:19 -07003725 if ( WLANTL_STA_ID_INVALID( *pucSTAId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07003726 {
Hoonki Lee14621352013-04-16 17:51:19 -07003727 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3728 "WLAN TL:Invalid station id %d requested on WLANTL_ResumeDataTx", *pucSTAId));
3729 return VOS_STATUS_E_FAULT;
3730 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003731
Gopichand Nakkalae5fef6c2013-06-19 18:04:23 +05303732 if ( NULL == pTLCb->atlSTAClients[*pucSTAId] )
3733 {
3734 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3735 "WLAN TL:Invalid pTLCb->atlSTAClients pointer for STA Id :%d on "
3736 "WLANTL_ResumeDataTx", *pucSTAId));
3737 return VOS_STATUS_E_FAULT;
3738 }
3739
3740 if ( 0 == pTLCb->atlSTAClients[*pucSTAId]->ucExists )
Hoonki Lee14621352013-04-16 17:51:19 -07003741 {
3742 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3743 "WLAN TL:Station %d was not previously registered on WLANTL_ResumeDataTx", *pucSTAId));
3744 return VOS_STATUS_E_EXISTS;
3745 }
3746
3747 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3748 "WLAN TL:Resume request for station: %d", *pucSTAId));
3749 vos_atomic_set_U8( &pTLCb->atlSTAClients[*pucSTAId]->ucTxSuspended, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003750 }
3751
3752 /*------------------------------------------------------------------------
3753 Resuming transmission
3754 ------------------------------------------------------------------------*/
Hoonki Lee14621352013-04-16 17:51:19 -07003755 if (( pTLCb->uResCount >= WDA_TLI_MIN_RES_MF ) &&
3756 ( 0 == pTLCb->ucTxSuspended ))
Jeff Johnson295189b2012-06-20 16:38:30 -07003757 {
3758 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3759 "WLAN TL:Resuming transmission"));
3760 return WDA_DS_StartXmit(pvosGCtx);
3761 }
3762
3763 return VOS_STATUS_SUCCESS;
3764}/* WLANTL_ResumeDataTx */
3765
3766/*==========================================================================
3767 FUNCTION WLANTL_SuspendCB
3768
3769 DESCRIPTION
3770 Callback function for serializing Suspend signal through Tx thread
3771
3772 DEPENDENCIES
3773 Just notify HAL that suspend in TL is complete.
3774
3775 PARAMETERS
3776
3777 IN
3778 pvosGCtx: pointer to the global vos context; a handle to TL's
3779 control block can be extracted from its context
3780 pUserData: user data sent with the callback
3781
3782 RETURN VALUE
3783 The result code associated with performing the operation
3784
3785 VOS_STATUS_E_INVAL: invalid input parameters
3786 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
3787 page fault
3788 VOS_STATUS_SUCCESS: Everything is good :)
3789
3790
3791 SIDE EFFECTS
3792
3793============================================================================*/
3794VOS_STATUS
3795WLANTL_SuspendCB
3796(
3797 v_PVOID_t pvosGCtx,
3798 WLANTL_SuspendCBType pfnSuspendCB,
3799 v_U16_t usReserved
3800)
3801{
3802 WLANTL_CbType* pTLCb = NULL;
3803 v_U8_t ucSTAId = (v_U8_t)usReserved;
3804 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3805
3806 /*------------------------------------------------------------------------
3807 Sanity check
3808 ------------------------------------------------------------------------*/
3809 if ( NULL == pfnSuspendCB )
3810 {
3811 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
3812 "WLAN TL: No Call back processing requested WLANTL_SuspendCB"));
3813 return VOS_STATUS_SUCCESS;
3814 }
3815
3816 /*------------------------------------------------------------------------
3817 Extract TL control block
3818 ------------------------------------------------------------------------*/
3819 pTLCb = VOS_GET_TL_CB(pvosGCtx);
3820 if ( NULL == pTLCb )
3821 {
3822 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3823 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SuspendCB"));
3824 return VOS_STATUS_E_FAULT;
3825 }
3826
3827 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
3828 {
3829 pfnSuspendCB(pvosGCtx, NULL, VOS_STATUS_SUCCESS);
3830 }
3831 else
3832 {
3833 pfnSuspendCB(pvosGCtx, &ucSTAId, VOS_STATUS_SUCCESS);
3834 }
3835
3836 return VOS_STATUS_SUCCESS;
3837}/*WLANTL_SuspendCB*/
3838
3839
3840/*----------------------------------------------------------------------------
3841 CLIENT INDEPENDENT INTERFACE
3842 ---------------------------------------------------------------------------*/
3843
3844/*==========================================================================
3845
3846 FUNCTION WLANTL_GetTxPktCount
3847
3848 DESCRIPTION
3849 TL will provide the number of transmitted packets counted per
3850 STA per TID.
3851
3852 DEPENDENCIES
3853
3854 PARAMETERS
3855
3856 IN
3857 pvosGCtx: pointer to the global vos context; a handle to TL's
3858 control block can be extracted from its context
3859 ucSTAId: identifier of the station
3860 ucTid: identifier of the tspec
3861
3862 OUT
3863 puTxPktCount: the number of packets tx packet for this STA and TID
3864
3865 RETURN VALUE
3866 The result code associated with performing the operation
3867
3868 VOS_STATUS_E_INVAL: Input parameters are invalid
3869 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
3870 to TL cb is NULL ; access would cause a page fault
3871 VOS_STATUS_E_EXISTS: Station was not registered
3872 VOS_STATUS_SUCCESS: Everything is good :)
3873
3874 SIDE EFFECTS
3875
3876============================================================================*/
3877VOS_STATUS
3878WLANTL_GetTxPktCount
3879(
3880 v_PVOID_t pvosGCtx,
3881 v_U8_t ucSTAId,
3882 v_U8_t ucTid,
3883 v_U32_t* puTxPktCount
3884)
3885{
3886 WLANTL_CbType* pTLCb = NULL;
3887 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3888
3889 /*------------------------------------------------------------------------
3890 Sanity check
3891 ------------------------------------------------------------------------*/
3892 if ( NULL == puTxPktCount )
3893 {
3894 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3895 "WLAN TL:Invalid parameter sent on WLANTL_GetTxPktCount"));
3896 return VOS_STATUS_E_INVAL;
3897 }
3898
3899 if ( WLANTL_STA_ID_INVALID( ucSTAId ) || WLANTL_TID_INVALID( ucTid) )
3900 {
3901 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3902 "WLAN TL:Invalid station id %d/tid %d requested on WLANTL_GetTxPktCount",
3903 ucSTAId, ucTid));
3904 return VOS_STATUS_E_FAULT;
3905 }
3906
3907 /*------------------------------------------------------------------------
3908 Extract TL control block and check if station exists
3909 ------------------------------------------------------------------------*/
3910 pTLCb = VOS_GET_TL_CB(pvosGCtx);
3911 if ( NULL == pTLCb )
3912 {
3913 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3914 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetTxPktCount"));
3915 return VOS_STATUS_E_FAULT;
3916 }
3917
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05303918 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
3919 {
3920 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3921 "WLAN TL:Client Memory was not allocated on %s", __func__));
3922 return VOS_STATUS_E_FAILURE;
3923 }
3924
3925 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07003926 {
3927 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3928 "WLAN TL:Station was not previously registered on WLANTL_GetTxPktCount %d",
3929 ucSTAId));
3930 return VOS_STATUS_E_EXISTS;
3931 }
3932
3933 /*------------------------------------------------------------------------
3934 Return data
3935 ------------------------------------------------------------------------*/
3936 //VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_MED,
3937 // "WLAN TL:Requested tx packet count for STA: %d, TID: %d",
3938 // ucSTAId, ucTid);
3939
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05303940 *puTxPktCount = pTLCb->atlSTAClients[ucSTAId]->auTxCount[ucTid];
Jeff Johnson295189b2012-06-20 16:38:30 -07003941
3942 return VOS_STATUS_SUCCESS;
3943}/* WLANTL_GetTxPktCount */
3944
3945/*==========================================================================
3946
3947 FUNCTION WLANTL_GetRxPktCount
3948
3949 DESCRIPTION
3950 TL will provide the number of received packets counted per
3951 STA per TID.
3952
3953 DEPENDENCIES
3954
3955 PARAMETERS
3956
3957 IN
3958 pvosGCtx: pointer to the global vos context; a handle to TL's
3959 control block can be extracted from its context
3960 ucSTAId: identifier of the station
3961 ucTid: identifier of the tspec
3962
3963 OUT
3964 puTxPktCount: the number of packets rx packet for this STA and TID
3965
3966 RETURN VALUE
3967 The result code associated with performing the operation
3968
3969 VOS_STATUS_E_INVAL: Input parameters are invalid
3970 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
3971 to TL cb is NULL ; access would cause a page fault
3972 VOS_STATUS_E_EXISTS: Station was not registered
3973 VOS_STATUS_SUCCESS: Everything is good :)
3974
3975 SIDE EFFECTS
3976
3977============================================================================*/
3978VOS_STATUS
3979WLANTL_GetRxPktCount
3980(
3981 v_PVOID_t pvosGCtx,
3982 v_U8_t ucSTAId,
3983 v_U8_t ucTid,
3984 v_U32_t* puRxPktCount
3985)
3986{
3987 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05303988 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003989 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3990
3991 /*------------------------------------------------------------------------
3992 Sanity check
3993 ------------------------------------------------------------------------*/
3994 if ( NULL == puRxPktCount )
3995 {
3996 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3997 "WLAN TL:Invalid parameter sent on WLANTL_GetRxPktCount"));
3998 return VOS_STATUS_E_INVAL;
3999 }
4000
4001 if ( WLANTL_STA_ID_INVALID( ucSTAId ) || WLANTL_TID_INVALID( ucTid) )
4002 {
4003 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4004 "WLAN TL:Invalid station id %d/tid %d requested on WLANTL_GetRxPktCount",
4005 ucSTAId, ucTid));
4006 return VOS_STATUS_E_FAULT;
4007 }
4008
4009 /*------------------------------------------------------------------------
4010 Extract TL control block and existance
4011 ------------------------------------------------------------------------*/
4012 pTLCb = VOS_GET_TL_CB(pvosGCtx);
4013 if ( NULL == pTLCb )
4014 {
4015 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4016 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetRxPktCount"));
4017 return VOS_STATUS_E_FAULT;
4018 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304019 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
Jeff Johnson295189b2012-06-20 16:38:30 -07004020
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304021 if ( NULL == pClientSTA )
4022 {
4023 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4024 "WLAN TL:Client Memory was not allocated on %s", __func__));
4025 return VOS_STATUS_E_FAILURE;
4026 }
4027
4028 if ( 0 == pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07004029 {
4030 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4031 "WLAN TL:Station was not previously registered on WLANTL_GetRxPktCount"));
4032 return VOS_STATUS_E_EXISTS;
4033 }
4034
4035 /*------------------------------------------------------------------------
4036 Return data
4037 ------------------------------------------------------------------------*/
4038 TLLOG3(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_MED,
4039 "WLAN TL:Requested rx packet count for STA: %d, TID: %d",
4040 ucSTAId, ucTid));
4041
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304042 *puRxPktCount = pClientSTA->auRxCount[ucTid];
Jeff Johnson295189b2012-06-20 16:38:30 -07004043
4044 return VOS_STATUS_SUCCESS;
4045}/* WLANTL_GetRxPktCount */
4046
Jeff Johnson295189b2012-06-20 16:38:30 -07004047VOS_STATUS
4048WLANTL_TxFCFrame
4049(
4050 v_PVOID_t pvosGCtx
4051);
Jeff Johnson295189b2012-06-20 16:38:30 -07004052/*============================================================================
4053 TL INTERNAL API DEFINITION
4054============================================================================*/
4055
4056/*==========================================================================
4057
4058 FUNCTION WLANTL_GetFrames
4059
4060 DESCRIPTION
4061
4062 BAL calls this function at the request of the lower bus interface.
4063 When this request is being received TL will retrieve packets from HDD
4064 in accordance with the priority rules and the count supplied by BAL.
4065
4066 DEPENDENCIES
4067
4068 HDD must have registered with TL at least one STA before this function
4069 can be called.
4070
4071 PARAMETERS
4072
4073 IN
4074 pvosGCtx: pointer to the global vos context; a handle to TL's
4075 or BAL's control block can be extracted from its context
4076 uSize: maximum size accepted by the lower layer
4077 uFlowMask TX flow control mask for Prima. Each bit is defined as
4078 WDA_TXFlowEnumType
4079
4080 OUT
4081 vosDataBuff: it will contain a pointer to the first buffer supplied
4082 by TL, if there is more than one packet supplied, TL
4083 will chain them through vOSS buffers
4084
4085 RETURN VALUE
4086
4087 The result code associated with performing the operation
4088
4089 1 or more: number of required resources if there are still frames to fetch
4090 0 : error or HDD queues are drained
4091
4092 SIDE EFFECTS
4093
4094 NOTE
4095
4096 Featurized uFlowMask. If we want to remove featurization, we need to change
4097 BAL on Volans.
4098
4099============================================================================*/
4100v_U32_t
4101WLANTL_GetFrames
4102(
4103 v_PVOID_t pvosGCtx,
4104 vos_pkt_t **ppFrameDataBuff,
4105 v_U32_t uSize,
Jeff Johnson295189b2012-06-20 16:38:30 -07004106 v_U8_t uFlowMask,
Jeff Johnson295189b2012-06-20 16:38:30 -07004107 v_BOOL_t* pbUrgent
4108)
4109{
4110 vos_pkt_t** pvosDataBuff = (vos_pkt_t**)ppFrameDataBuff;
4111 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304112 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004113 v_U32_t uRemaining = uSize;
4114 vos_pkt_t* vosRoot;
4115 vos_pkt_t* vosTempBuf;
4116 WLANTL_STAFuncType pfnSTAFsm;
4117 v_U16_t usPktLen;
4118 v_U32_t uResLen;
4119 v_U8_t ucSTAId;
4120 v_U8_t ucAC;
4121 vos_pkt_t* vosDataBuff;
4122 v_U32_t uTotalPktLen;
4123 v_U32_t i=0;
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -08004124 v_U32_t j=0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004125 v_U32_t ucResult = 0;
4126 VOS_STATUS vosStatus;
4127 WLANTL_STAEventType wSTAEvent;
4128 tBssSystemRole systemRole;
4129 tpAniSirGlobal pMac;
4130 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
4131
4132 /*------------------------------------------------------------------------
4133 Sanity check
4134 Extract TL control block
4135 ------------------------------------------------------------------------*/
4136 pTLCb = VOS_GET_TL_CB(pvosGCtx);
4137 if (( NULL == pTLCb ) || ( NULL == pvosDataBuff ))
4138 {
4139 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4140 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
4141 return ucResult;
4142 }
4143
4144 pMac = vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
4145 if ( NULL == pMac )
4146 {
4147 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004148 "%s: Invalid pMac", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07004149 return ucResult;
4150 }
4151
4152 vosDataBuff = pTLCb->vosDummyBuf; /* Just to avoid checking for NULL at
4153 each iteration */
4154
Jeff Johnson295189b2012-06-20 16:38:30 -07004155 pTLCb->uResCount = uSize;
Jeff Johnson295189b2012-06-20 16:38:30 -07004156
4157 /*-----------------------------------------------------------------------
4158 Save the root as we will walk this chain as we fill it
4159 -----------------------------------------------------------------------*/
4160 vosRoot = vosDataBuff;
4161
4162 /*-----------------------------------------------------------------------
4163 There is still data - until FSM function says otherwise
4164 -----------------------------------------------------------------------*/
4165 pTLCb->bUrgent = FALSE;
4166
Jeff Johnson295189b2012-06-20 16:38:30 -07004167 while (( pTLCb->tlConfigInfo.uMinFramesProcThres < pTLCb->uResCount ) &&
4168 ( 0 < uRemaining ))
Jeff Johnson295189b2012-06-20 16:38:30 -07004169 {
4170 systemRole = wdaGetGlobalSystemRole(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004171#ifdef WLAN_SOFTAP_FLOWCTRL_EN
4172/* FIXME: The code has been disabled since it is creating issues in power save */
4173 if (eSYSTEM_AP_ROLE == systemRole)
4174 {
4175 if (pTLCb->done_once == 0 && NULL == pTLCb->vosTxFCBuf)
4176 {
4177 WLANTL_TxFCFrame (pvosGCtx);
4178 pTLCb->done_once ++;
4179 }
4180 }
4181 if ( NULL != pTLCb->vosTxFCBuf )
4182 {
4183 //there is flow control packet waiting to be sent
4184 WDA_TLI_PROCESS_FRAME_LEN( pTLCb->vosTxFCBuf, usPktLen, uResLen, uTotalPktLen);
4185
4186 if ( ( pTLCb->uResCount > uResLen ) &&
Jeff Johnson9b5dc4d2013-02-22 21:28:47 -08004187 ( uRemaining > uTotalPktLen ) &&
4188 ( uFlowMask & ( 1 << WDA_TXFLOW_FC ) ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004189 {
4190 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4191 "WLAN TL:Chaining FC frame first on GetFrame"));
4192
4193 vos_pkt_chain_packet( vosDataBuff, pTLCb->vosTxFCBuf, 1 /*true*/ );
4194
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05304195 vos_atomic_set( (uintptr_t*)&pTLCb->vosTxFCBuf, (uintptr_t) NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07004196
4197 /*FC frames cannot be delayed*/
4198 pTLCb->bUrgent = TRUE;
4199
4200 /*Update remaining len from SSC */
4201 uRemaining -= (usPktLen + WDA_DXE_HEADER_SIZE);
4202
4203 /*Update resource count */
4204 pTLCb->uResCount -= uResLen;
4205 }
4206 else
4207 {
4208 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004209 "WLAN TL:send fc out of source %s", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07004210 ucResult = ( pTLCb->uResCount > uResLen )?VOS_TRUE:VOS_FALSE;
4211 break; /* Out of resources or reached max len */
4212 }
4213 }
4214 else
4215#endif //WLAN_SOFTAP_FLOWCTRL_EN
Jeff Johnson295189b2012-06-20 16:38:30 -07004216
Jeff Johnson9b5dc4d2013-02-22 21:28:47 -08004217 if (( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff ) &&
4218 ( uFlowMask & ( 1 << WDA_TXFLOW_MGMT ) ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004219 {
4220 WDA_TLI_PROCESS_FRAME_LEN( pTLCb->tlMgmtFrmClient.vosPendingDataBuff,
4221 usPktLen, uResLen, uTotalPktLen);
4222
Manjunathappa Prakashfb585462013-12-23 19:07:07 -08004223 if (usPktLen > WLANTL_MAX_ALLOWED_LEN)
4224 {
4225 usPktLen = WLANTL_MAX_ALLOWED_LEN;
4226 VOS_ASSERT(0);
4227 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004228
4229 if ( ( pTLCb->uResCount > uResLen ) &&
Jeff Johnson9b5dc4d2013-02-22 21:28:47 -08004230 ( uRemaining > uTotalPktLen ) &&
4231 ( uFlowMask & ( 1 << WDA_TXFLOW_MGMT ) ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004232 {
4233 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4234 "WLAN TL:Chaining management frame on GetFrame"));
4235
4236 vos_pkt_chain_packet( vosDataBuff,
4237 pTLCb->tlMgmtFrmClient.vosPendingDataBuff,
4238 1 /*true*/ );
4239
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05304240 vos_atomic_set( (uintptr_t*)&pTLCb->tlMgmtFrmClient.
4241 vosPendingDataBuff, (uintptr_t)NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07004242
4243 /*management frames cannot be delayed*/
4244 pTLCb->bUrgent = TRUE;
4245
4246 /*Update remaining len from SSC */
4247 uRemaining -= (usPktLen + WDA_DXE_HEADER_SIZE);
4248
4249 /*Update resource count */
4250 pTLCb->uResCount -= uResLen;
4251 }
4252 else
4253 {
4254 ucResult = ( pTLCb->uResCount > uResLen )?VOS_TRUE:VOS_FALSE;
4255 break; /* Out of resources or reached max len */
4256 }
4257 }
4258 else if (( pTLCb->tlBAPClient.vosPendingDataBuff ) &&
4259 ( WDA_TLI_MIN_RES_BAP <= pTLCb->uResCount ) &&
Gopichand Nakkala7e48ca72012-12-31 14:15:07 -08004260 ( 0 == pTLCb->ucTxSuspended ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004261 {
4262 WDA_TLI_PROCESS_FRAME_LEN( pTLCb->tlBAPClient.vosPendingDataBuff,
4263 usPktLen, uResLen, uTotalPktLen);
4264
Manjunathappa Prakashfb585462013-12-23 19:07:07 -08004265 if (usPktLen > WLANTL_MAX_ALLOWED_LEN)
4266 {
4267 usPktLen = WLANTL_MAX_ALLOWED_LEN;
4268 VOS_ASSERT(0);
4269 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004270
4271 if ( ( pTLCb->uResCount > (uResLen + WDA_TLI_MIN_RES_MF ) ) &&
4272 ( uRemaining > uTotalPktLen ))
4273 {
4274 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4275 "WLAN TL:Chaining BT-AMP frame on GetFrame"));
4276
4277 vos_pkt_chain_packet( vosDataBuff,
4278 pTLCb->tlBAPClient.vosPendingDataBuff,
4279 1 /*true*/ );
4280
4281 /*BAP frames cannot be delayed*/
4282 pTLCb->bUrgent = TRUE;
4283
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05304284 vos_atomic_set( (uintptr_t*)&pTLCb->tlBAPClient.vosPendingDataBuff,
4285 (uintptr_t) NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07004286
4287 /*Update remaining len from SSC */
4288 uRemaining -= (usPktLen + WDA_DXE_HEADER_SIZE);
4289
4290 /*Update resource count */
4291 pTLCb->uResCount -= uResLen;
4292 }
4293 else
4294 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004295 ucResult = uResLen + WDA_TLI_MIN_RES_MF;
Jeff Johnson295189b2012-06-20 16:38:30 -07004296 break; /* Out of resources or reached max len */
4297 }
4298 }
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004299 /* note: this feature implemented only after WLAN_INGETRATED_SOC */
4300 /* search 'EAPOL_HI_PRIORITY' will show EAPOL HI_PRIORITY change in TL and WDI
4301 by default, EAPOL will be treated as higher priority, which means
4302 use mgmt_pool and DXE_TX_HI prority channel.
4303 this is introduced to address EAPOL failure under high background traffic
4304 with multi-channel concurrent mode. But this change works in SCC or standalone, too.
4305 see CR#387009 and WCNSOS-8
4306 */
4307 else if (( WDA_TLI_MIN_RES_MF <= pTLCb->uResCount )&&
4308 ( 0 == pTLCb->ucTxSuspended ) &&
4309 ( uFlowMask & ( 1 << WDA_TXFLOW_MGMT ) )
4310 )
4311 {
4312 vosTempBuf = NULL;
4313 /*---------------------------------------------------------------------
4314 Check to see if there was any EAPOL packet is pending
4315 *--------------------------------------------------------------------*/
4316 for ( i = 0; i < WLAN_MAX_STA_COUNT; i++)
4317 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304318 if ((NULL != pTLCb->atlSTAClients[i]) &&
4319 (pTLCb->atlSTAClients[i]->ucExists) &&
4320 (0 == pTLCb->atlSTAClients[i]->ucTxSuspended) &&
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -08004321 (WLANTL_STA_CONNECTED == pTLCb->atlSTAClients[i]->tlState) &&
4322 (pTLCb->atlSTAClients[i]->ucPktPending)
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004323 )
4324 break;
4325 }
4326
4327 if (i >= WLAN_MAX_STA_COUNT)
4328 {
4329 /* No More to Serve Exit Get Frames */
4330 break;
4331 }
4332 /* Serve EAPOL frame with HI_FLOW_MASK */
4333 ucSTAId = i;
4334
Katya Nigam42e16e82014-02-04 16:28:55 +05304335 MTRACE(vos_trace(VOS_MODULE_ID_TL,
4336 TRACE_CODE_TL_GET_FRAMES_EAPOL, ucSTAId, pTLCb->atlSTAClients[i]->tlState));
4337
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -08004338 for (j = WLANTL_MAX_AC ; j > 0; j--)
4339 {
4340 if (0 != pTLCb->atlSTAClients[ucSTAId]->aucACMask[j-1])
4341 {
4342 pTLCb->atlSTAClients[ucSTAId]->ucCurrentAC = j-1;
4343 pTLCb->uCurServedAC = j-1;
4344 }
4345 }
4346
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304347 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
4348
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004349 wSTAEvent = WLANTL_TX_EVENT;
4350
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304351 pfnSTAFsm = tlSTAFsm[pClientSTA->tlState].
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004352 pfnSTATbl[wSTAEvent];
4353
4354 if ( NULL != pfnSTAFsm )
4355 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304356 pClientSTA->ucNoMoreData = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004357 vosStatus = pfnSTAFsm( pvosGCtx, ucSTAId, &vosTempBuf, VOS_FALSE);
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004358
4359 if (( VOS_STATUS_SUCCESS != vosStatus ) &&
4360 ( NULL != vosTempBuf ))
4361 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304362 pClientSTA->pfnSTATxComp( pvosGCtx, vosTempBuf, vosStatus );
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004363 vosTempBuf = NULL;
4364 break;
4365 }/* status success*/
4366 }
4367
4368 if (NULL != vosTempBuf)
4369 {
4370 WDA_TLI_PROCESS_FRAME_LEN( vosTempBuf, usPktLen, uResLen, uTotalPktLen);
4371
Manjunathappa Prakashfb585462013-12-23 19:07:07 -08004372 if (usPktLen > WLANTL_MAX_ALLOWED_LEN)
4373 {
4374 usPktLen = WLANTL_MAX_ALLOWED_LEN;
4375 VOS_ASSERT(0);
4376 }
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004377
4378 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
4379 "WLAN TL:Resources needed by frame: %d", uResLen));
4380
4381 if ( ( pTLCb->uResCount >= (uResLen + WDA_TLI_MIN_RES_MF ) ) &&
4382 ( uRemaining > uTotalPktLen )
4383 )
4384 {
4385 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4386 "WLAN TL:Chaining data frame on GetFrame"));
4387
4388 vos_pkt_chain_packet( vosDataBuff, vosTempBuf, 1 /*true*/ );
4389
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004390 /*EAPOL frame cannot be delayed*/
4391 pTLCb->bUrgent = TRUE;
4392
4393 vosTempBuf = NULL;
4394
4395 /*Update remaining len from SSC */
4396 uRemaining -= (usPktLen + WDA_DXE_HEADER_SIZE);
4397
4398 /*Update resource count */
4399 pTLCb->uResCount -= uResLen;
4400
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004401 //fow control update
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304402 pClientSTA->uIngress_length += uResLen;
4403 pClientSTA->uBuffThresholdMax = (pClientSTA->uBuffThresholdMax >= uResLen) ?
4404 (pClientSTA->uBuffThresholdMax - uResLen) : 0;
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -08004405 pClientSTA->ucEapolPktPending = 0;
4406 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4407 "WLAN TL:GetFrames STA: %d EAPOLPktPending %d",
4408 ucSTAId, pClientSTA->ucEapolPktPending);
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004409 }
4410 }
4411 else
4412 { // no EAPOL frames exit Get frames
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -08004413 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4414 "WLAN TL:GetFrames STA: %d, no EAPOL frame, continue.",
4415 ucSTAId));
4416 continue;
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004417 }
4418 }
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004419
Jeff Johnson9b5dc4d2013-02-22 21:28:47 -08004420 else if (( WDA_TLI_MIN_RES_DATA <= pTLCb->uResCount ) &&
4421 ( 0 == pTLCb->ucTxSuspended ) &&
4422 (( uFlowMask & ( 1 << WDA_TXFLOW_AC_BK ) ) ||
4423 ( uFlowMask & ( 1 << WDA_TXFLOW_AC_BE ) ) ||
4424 ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VI ) ) ||
4425 ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VO ) )) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004426 {
4427 /*---------------------------------------------------------------------
4428 Check to see if there was any packet left behind previously due to
4429 size constraints
4430 ---------------------------------------------------------------------*/
4431 vosTempBuf = NULL;
4432
4433 if ( NULL != pTLCb->vosTempBuf )
4434 {
4435 vosTempBuf = pTLCb->vosTempBuf;
4436 pTLCb->vosTempBuf = NULL;
4437 ucSTAId = pTLCb->ucCachedSTAId;
4438 ucAC = pTLCb->ucCachedAC;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304439
4440 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
4441 {
4442 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4443 "WLAN TL:Client Memory was not allocated on %s", __func__));
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05304444 continue;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304445 }
4446
4447 pTLCb->atlSTAClients[ucSTAId]->ucNoMoreData = 0;
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05304448 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
Jeff Johnson295189b2012-06-20 16:38:30 -07004449
4450 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4451 "WLAN TL:Chaining cached data frame on GetFrame"));
4452 }
4453 else
4454 {
4455 WLAN_TLGetNextTxIds( pvosGCtx, &ucSTAId);
4456 if (ucSTAId >= WLAN_MAX_STA_COUNT)
4457 {
4458 /* Packets start coming in even after insmod Without *
4459 starting Hostapd or Interface being up *
4460 During which cases STAID is invaled and hence
4461 the check. HalMsg_ScnaComplete Triggers */
4462
4463 break;
4464 }
4465 /* ucCurrentAC should have correct AC to be served by calling
4466 WLAN_TLGetNextTxIds */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304467 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304468 if ( NULL == pClientSTA )
4469 {
4470 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4471 "WLAN TL:Client Memory was not allocated on %s", __func__));
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05304472 continue;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304473 }
4474
4475 ucAC = pClientSTA->ucCurrentAC;
4476
4477 pClientSTA->ucNoMoreData = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07004478 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004479 "WLAN TL: %s get one data frame, station ID %d ", __func__, ucSTAId));
Jeff Johnson295189b2012-06-20 16:38:30 -07004480 /*-------------------------------------------------------------------
4481 Check to see that STA is valid and tx is not suspended
4482 -------------------------------------------------------------------*/
4483 if ( ( ! WLANTL_STA_ID_INVALID( ucSTAId ) ) &&
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304484 ( 0 == pClientSTA->ucTxSuspended ) &&
4485 ( 0 == pClientSTA->fcStaTxDisabled) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004486 {
4487 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004488 "WLAN TL: %s sta id valid and not suspended ",__func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07004489 wSTAEvent = WLANTL_TX_EVENT;
4490
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304491 pfnSTAFsm = tlSTAFsm[pClientSTA->tlState].
Jeff Johnson295189b2012-06-20 16:38:30 -07004492 pfnSTATbl[wSTAEvent];
4493
4494 if ( NULL != pfnSTAFsm )
4495 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304496 pClientSTA->ucNoMoreData = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004497 vosStatus = pfnSTAFsm( pvosGCtx, ucSTAId, &vosTempBuf, VOS_FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07004498
4499 if (( VOS_STATUS_SUCCESS != vosStatus ) &&
4500 ( NULL != vosTempBuf ))
4501 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304502 pClientSTA->pfnSTATxComp( pvosGCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -07004503 vosTempBuf,
4504 vosStatus );
4505 vosTempBuf = NULL;
4506 }/* status success*/
4507 }/*NULL function state*/
4508 }/* valid STA id and ! suspended*/
4509 else
4510 {
4511 if ( ! WLANTL_STA_ID_INVALID( ucSTAId ) )
4512 {
4513 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4514 "WLAN TL:Not fetching frame because suspended for sta ID %d",
4515 ucSTAId));
4516 }
4517 }
4518 }/* data */
4519
4520 if ( NULL != vosTempBuf )
4521 {
4522 WDA_TLI_PROCESS_FRAME_LEN( vosTempBuf, usPktLen, uResLen, uTotalPktLen);
4523
Manjunathappa Prakashfb585462013-12-23 19:07:07 -08004524 if (usPktLen > WLANTL_MAX_ALLOWED_LEN)
4525 {
4526 usPktLen = WLANTL_MAX_ALLOWED_LEN;
4527 VOS_ASSERT(0);
4528 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004529
4530 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
4531 "WLAN TL:Resources needed by frame: %d", uResLen));
4532
4533 if ( ( pTLCb->uResCount >= (uResLen + WDA_TLI_MIN_RES_BAP ) ) &&
Jeff Johnson9b5dc4d2013-02-22 21:28:47 -08004534 ( uRemaining > uTotalPktLen ) &&
4535 ( uFlowMask & ( 1 << ucAC ) ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004536 {
4537 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4538 "WLAN TL:Chaining data frame on GetFrame"));
4539
4540 vos_pkt_chain_packet( vosDataBuff, vosTempBuf, 1 /*true*/ );
4541 vosTempBuf = NULL;
4542
4543 /*Update remaining len from SSC */
4544 uRemaining -= (usPktLen + WDA_DXE_HEADER_SIZE);
4545
4546 /*Update resource count */
4547 pTLCb->uResCount -= uResLen;
4548
Jeff Johnson295189b2012-06-20 16:38:30 -07004549 //fow control update
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304550 pClientSTA->uIngress_length += uResLen;
4551 pClientSTA->uBuffThresholdMax = (pClientSTA->uBuffThresholdMax >= uResLen) ?
4552 (pClientSTA->uBuffThresholdMax - uResLen) : 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004553
4554 }
4555 else
4556 {
4557 /* Store this for later tx - already fetched from HDD */
4558 pTLCb->vosTempBuf = vosTempBuf;
4559 pTLCb->ucCachedSTAId = ucSTAId;
4560 pTLCb->ucCachedAC = ucAC;
Jeff Johnson295189b2012-06-20 16:38:30 -07004561 ucResult = uResLen + WDA_TLI_MIN_RES_BAP;
4562 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4563 "min %d res required by TL.", ucResult ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004564 break; /* Out of resources or reached max len */
4565 }
4566 }
4567 else
4568 {
4569 for ( i = 0; i < WLAN_MAX_STA_COUNT; i++)
4570 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304571 if (NULL != pTLCb->atlSTAClients[i] && (pTLCb->atlSTAClients[i]->ucExists) &&
4572 (pTLCb->atlSTAClients[i]->ucPktPending))
Jeff Johnson295189b2012-06-20 16:38:30 -07004573 {
4574 /* There is station to be Served */
4575 break;
4576 }
4577 }
4578 if (i >= WLAN_MAX_STA_COUNT)
4579 {
4580 /* No More to Serve Exit Get Frames */
4581 break;
4582 }
4583 else
4584 {
4585 /* More to be Served */
4586 continue;
4587 }
4588 }
4589 }
4590 else
4591 {
4592 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4593 "WLAN TL:Returning from GetFrame: resources = %d suspended = %d",
4594 pTLCb->uResCount, pTLCb->ucTxSuspended));
Jeff Johnson295189b2012-06-20 16:38:30 -07004595 /* TL is starving even when DXE is not in low resource condition
4596 Return min resource number required and Let DXE deceide what to do */
4597 if(( 0 == pTLCb->ucTxSuspended ) &&
4598 (( uFlowMask & ( 1 << WDA_TXFLOW_AC_BK ) ) ||
4599 ( uFlowMask & ( 1 << WDA_TXFLOW_AC_BE ) ) ||
4600 ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VI ) ) ||
4601 ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VO ) )))
4602 {
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07004603 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Jeff Johnson295189b2012-06-20 16:38:30 -07004604 "WLAN TL:Returning from GetFrame: resources = %d",
4605 pTLCb->uResCount));
4606 ucResult = WDA_TLI_MIN_RES_DATA;
4607 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004608 break; /*out of min data resources*/
4609 }
4610
4611 pTLCb->usPendingTxCompleteCount++;
4612 /* Move data buffer up one packet */
4613 vos_pkt_walk_packet_chain( vosDataBuff, &vosDataBuff, 0/*false*/ );
4614 }
4615
4616 /*----------------------------------------------------------------------
4617 Packet chain starts at root + 1
4618 ----------------------------------------------------------------------*/
4619 vos_pkt_walk_packet_chain( vosRoot, &vosDataBuff, 1/*true*/ );
4620
4621 *pvosDataBuff = vosDataBuff;
Manjunathappa Prakashfb585462013-12-23 19:07:07 -08004622 if (pbUrgent)
4623 {
4624 *pbUrgent = pTLCb->bUrgent;
4625 }
4626 else
4627 {
4628 VOS_ASSERT( pbUrgent );
4629 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004630 return ucResult;
4631}/* WLANTL_GetFrames */
4632
4633
4634/*==========================================================================
4635
4636 FUNCTION WLANTL_TxComp
4637
4638 DESCRIPTION
4639 It is being called by BAL upon asynchronous notification of the packet
4640 or packets being sent over the bus.
4641
4642 DEPENDENCIES
4643 Tx complete cannot be called without a previous transmit.
4644
4645 PARAMETERS
4646
4647 IN
4648 pvosGCtx: pointer to the global vos context; a handle to TL's
4649 or BAL's control block can be extracted from its context
4650 vosDataBuff: it will contain a pointer to the first buffer for which
4651 the BAL report is being made, if there is more then one
4652 packet they will be chained using vOSS buffers.
4653 wTxStatus: the status of the transmitted packet, see above chapter
4654 on HDD interaction for a list of possible values
4655
4656 RETURN VALUE
4657 The result code associated with performing the operation
4658
4659 VOS_STATUS_E_INVAL: Input parameters are invalid
4660 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
4661 page fault
4662 VOS_STATUS_E_EXISTS: Station was not registered
4663 VOS_STATUS_SUCCESS: Everything is good :)
4664
4665 SIDE EFFECTS
4666
4667============================================================================*/
4668VOS_STATUS
4669WLANTL_TxComp
4670(
4671 v_PVOID_t pvosGCtx,
4672 vos_pkt_t *pFrameDataBuff,
4673 VOS_STATUS wTxStatus
4674)
4675{
4676 vos_pkt_t* vosDataBuff = (vos_pkt_t*)pFrameDataBuff;
4677 WLANTL_CbType* pTLCb = NULL;
4678 WLANTL_TxCompCBType pfnTxComp = NULL;
4679 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07004680 vos_pkt_t* vosTempTx = NULL;
4681
4682 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
4683
4684 /*------------------------------------------------------------------------
4685 Sanity check
4686 ------------------------------------------------------------------------*/
4687 if ( NULL == vosDataBuff )
4688 {
4689 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4690 "WLAN TL:Extraneous NULL data pointer on WLANTL_TxComp"));
4691 return VOS_STATUS_E_INVAL;
4692 }
4693
4694 /*------------------------------------------------------------------------
4695 Extract TL control block
4696 ------------------------------------------------------------------------*/
4697 pTLCb = VOS_GET_TL_CB(pvosGCtx);
4698 if ( NULL == pTLCb )
4699 {
4700 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4701 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_TxComp"));
4702 return VOS_STATUS_E_FAULT;
4703 }
4704
4705 while ((0 < pTLCb->usPendingTxCompleteCount) &&
4706 ( VOS_STATUS_SUCCESS == vosStatus ) &&
4707 ( NULL != vosDataBuff))
4708 {
4709 vos_pkt_get_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
4710 (v_PVOID_t)&pfnTxComp);
4711
4712 /*it should never be NULL - default handler should be registered if none*/
4713 if ( NULL == pfnTxComp )
4714 {
4715 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4716 "WLAN TL:NULL pointer to Tx Complete on WLANTL_TxComp"));
4717 VOS_ASSERT(0);
4718 return VOS_STATUS_E_FAULT;
4719 }
4720
4721 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05304722 "WLAN TL:Calling Tx complete for pkt %p in function %p",
Jeff Johnson295189b2012-06-20 16:38:30 -07004723 vosDataBuff, pfnTxComp));
4724
4725 vosTempTx = vosDataBuff;
4726 vosStatus = vos_pkt_walk_packet_chain( vosDataBuff,
4727 &vosDataBuff, 1/*true*/);
4728
4729 pfnTxComp( pvosGCtx, vosTempTx, wTxStatus );
4730
4731 pTLCb->usPendingTxCompleteCount--;
4732 }
4733
Jeff Johnson295189b2012-06-20 16:38:30 -07004734
4735 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4736 "WLAN TL: current TL values are: resources = %d "
4737 "pTLCb->usPendingTxCompleteCount = %d",
4738 pTLCb->uResCount, pTLCb->usPendingTxCompleteCount));
4739
4740 return VOS_STATUS_SUCCESS;
4741}/* WLANTL_TxComp */
4742
4743/*==========================================================================
4744
4745 FUNCTION WLANTL_CacheSTAFrame
4746
4747 DESCRIPTION
4748 Internal utility function for for caching incoming data frames that do
4749 not have a registered station yet.
4750
4751 DEPENDENCIES
4752 TL must be initiailized before this function gets called.
4753 In order to benefit from thsi caching, the components must ensure that
4754 they will only register with TL at the moment when they are fully setup
4755 and ready to receive incoming data
4756
4757 PARAMETERS
4758
4759 IN
4760
4761 pTLCb: TL control block
4762 ucSTAId: station id
4763 vosTempBuff: the data packet
4764 uDPUSig: DPU signature of the incoming packet
4765 bBcast: true if packet had the MC/BC bit set
4766
4767 RETURN VALUE
4768 The result code associated with performing the operation
4769
4770 VOS_STATUS_E_FAULT: pointer to TL cb is NULL or STA Id invalid ; access
4771 would cause a page fault
4772 VOS_STATUS_SUCCESS: Everything is good :)
4773
4774 SIDE EFFECTS
4775
4776============================================================================*/
4777static VOS_STATUS
4778WLANTL_CacheSTAFrame
4779(
4780 WLANTL_CbType* pTLCb,
4781 v_U8_t ucSTAId,
4782 vos_pkt_t* vosTempBuff,
4783 v_U32_t uDPUSig,
4784 v_U8_t bBcast,
4785 v_U8_t ucFrmType
4786)
4787{
4788 v_U8_t ucUcastSig;
4789 v_U8_t ucBcastSig;
4790 v_BOOL_t bOldSTAPkt;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304791 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004792 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
4793
4794 /*-------------------------------------------------------------------------
4795 Sanity check
4796 -------------------------------------------------------------------------*/
4797 if (( NULL == pTLCb ) || ( NULL == vosTempBuff ) )
4798 {
4799 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05304800 "WLAN TL: Invalid input pointer on WLANTL_CacheSTAFrame TL %p"
4801 " Packet %p", pTLCb, vosTempBuff ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004802 return VOS_STATUS_E_FAULT;
4803 }
4804
4805 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
4806 {
4807 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4808 "WLAN TL:Invalid station id requested on WLANTL_CacheSTAFrame"));
4809 return VOS_STATUS_E_FAULT;
4810 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304811 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
4812
4813 if ( NULL == pClientSTA )
4814 {
4815 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4816 "WLAN TL:Client Memory was not allocated on %s", __func__));
4817 return VOS_STATUS_E_FAILURE;
4818 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004819
4820 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4821 "WLAN TL:Attempting to cache pkt for STA %d, BD DPU Sig: %d with sig UC: %d, BC: %d",
4822 ucSTAId, uDPUSig,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304823 pClientSTA->wSTADesc.ucUcastSig,
4824 pClientSTA->wSTADesc.ucBcastSig));
Jeff Johnson295189b2012-06-20 16:38:30 -07004825
4826 if(WLANTL_IS_CTRL_FRAME(ucFrmType))
4827 {
4828 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4829 "WLAN TL: No need to cache CTRL frame. Dropping"));
4830 vos_pkt_return_packet(vosTempBuff);
4831 return VOS_STATUS_SUCCESS;
4832 }
4833
4834 /*-------------------------------------------------------------------------
4835 Check if the packet that we are trying to cache belongs to the old
4836 registered station (if any) or the new (potentially)upcoming station
4837
4838 - If the STA with this Id was never registered with TL - the signature
4839 will be invalid;
4840 - If the STA was previously registered TL will have cached the former
4841 set of DPU signatures
4842 -------------------------------------------------------------------------*/
4843 if ( bBcast )
4844 {
4845 ucBcastSig = (v_U8_t)uDPUSig;
4846 bOldSTAPkt = (( WLAN_TL_INVALID_B_SIG !=
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304847 pClientSTA->wSTADesc.ucBcastSig ) &&
4848 ( ucBcastSig == pClientSTA->wSTADesc.ucBcastSig ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004849 }
4850 else
4851 {
4852 ucUcastSig = (v_U8_t)uDPUSig;
4853 bOldSTAPkt = (( WLAN_TL_INVALID_U_SIG !=
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304854 pClientSTA->wSTADesc.ucUcastSig ) &&
4855 ( ucUcastSig == pClientSTA->wSTADesc.ucUcastSig ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004856 }
4857
4858 /*------------------------------------------------------------------------
4859 If the value of the DPU SIG matches the old, this packet will not
4860 be cached as it belonged to the former association
4861 In case the SIG does not match - this is a packet for a potentially new
4862 associated station
4863 -------------------------------------------------------------------------*/
Varun Reddy Yeturua39b9902013-01-18 15:48:32 -08004864 if ( bOldSTAPkt || bBcast )
Jeff Johnson295189b2012-06-20 16:38:30 -07004865 {
4866 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4867 "WLAN TL:Data packet matches old sig for sig DPU: %d UC: %d, "
4868 "BC: %d - dropping",
4869 uDPUSig,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304870 pClientSTA->wSTADesc.ucUcastSig,
4871 pClientSTA->wSTADesc.ucBcastSig));
Jeff Johnson295189b2012-06-20 16:38:30 -07004872 vos_pkt_return_packet(vosTempBuff);
4873 }
4874 else
4875 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304876 if ( NULL == pClientSTA->vosBegCachedFrame )
Jeff Johnson295189b2012-06-20 16:38:30 -07004877 {
4878 /*this is the first frame that we are caching */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304879 pClientSTA->vosBegCachedFrame = vosTempBuff;
Mihir Sheteb7337272014-04-11 15:53:08 +05304880
4881 pClientSTA->tlCacheInfo.cacheInitTime = vos_timer_get_system_time();
4882 pClientSTA->tlCacheInfo.cacheDoneTime =
4883 pClientSTA->tlCacheInfo.cacheInitTime;
4884 pClientSTA->tlCacheInfo.cacheSize = 1;
4885
Mihir Sheteae6f02b2014-04-11 19:49:21 +05304886 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_CACHE_FRAME,
4887 ucSTAId, pClientSTA->tlCacheInfo.cacheSize));
4888
Jeff Johnson295189b2012-06-20 16:38:30 -07004889 }
4890 else
4891 {
4892 /*this is a subsequent frame that we are caching: chain to the end */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304893 vos_pkt_chain_packet(pClientSTA->vosEndCachedFrame,
Jeff Johnson295189b2012-06-20 16:38:30 -07004894 vosTempBuff, VOS_TRUE);
Mihir Sheteb7337272014-04-11 15:53:08 +05304895
4896 pClientSTA->tlCacheInfo.cacheDoneTime = vos_timer_get_system_time();
4897 pClientSTA->tlCacheInfo.cacheSize ++;
4898
4899 if (pClientSTA->tlCacheInfo.cacheSize % WLANTL_CACHE_TRACE_WATERMARK == 0)
4900 {
4901 VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4902 "%s: Cache High watermark for staid:%d (%d)",
4903 __func__,ucSTAId, pClientSTA->tlCacheInfo.cacheSize);
Mihir Sheteae6f02b2014-04-11 19:49:21 +05304904 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_CACHE_FRAME,
4905 ucSTAId, pClientSTA->tlCacheInfo.cacheSize));
Mihir Sheteb7337272014-04-11 15:53:08 +05304906 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004907 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304908 pClientSTA->vosEndCachedFrame = vosTempBuff;
Jeff Johnson295189b2012-06-20 16:38:30 -07004909 }/*else new packet*/
4910
4911 return VOS_STATUS_SUCCESS;
4912}/*WLANTL_CacheSTAFrame*/
4913
4914/*==========================================================================
4915
4916 FUNCTION WLANTL_FlushCachedFrames
4917
4918 DESCRIPTION
4919 Internal utility function used by TL to flush the station cache
4920
4921 DEPENDENCIES
4922 TL must be initiailized before this function gets called.
4923
4924 PARAMETERS
4925
4926 IN
4927
4928 vosDataBuff: it will contain a pointer to the first cached buffer
4929 received,
4930
4931 RETURN VALUE
4932 The result code associated with performing the operation
4933
4934 VOS_STATUS_SUCCESS: Everything is good :)
4935
4936 SIDE EFFECTS
4937
4938 NOTE
4939 This function doesn't re-initialize vosDataBuff to NULL. It's caller's
4940 responsibility to do so, if required, after this function call.
4941 Because of this restriction, we decide to make this function to static
4942 so that upper layer doesn't need to be aware of this restriction.
4943
4944============================================================================*/
4945static VOS_STATUS
4946WLANTL_FlushCachedFrames
4947(
4948 vos_pkt_t* vosDataBuff
4949)
4950{
4951 /*----------------------------------------------------------------------
4952 Return the entire chain to vos if there are indeed cache frames
4953 ----------------------------------------------------------------------*/
4954 if ( NULL != vosDataBuff )
4955 {
4956 vos_pkt_return_packet(vosDataBuff);
4957 }
4958
4959 return VOS_STATUS_SUCCESS;
4960}/*WLANTL_FlushCachedFrames*/
4961
4962/*==========================================================================
4963
4964 FUNCTION WLANTL_ForwardSTAFrames
4965
4966 DESCRIPTION
4967 Internal utility function for either forwarding cached data to the station after
4968 the station has been registered, or flushing cached data if the station has not
4969 been registered.
4970
4971
4972 DEPENDENCIES
4973 TL must be initiailized before this function gets called.
4974
4975 PARAMETERS
4976
4977 IN
4978
4979 pTLCb: TL control block
4980 ucSTAId: station id
4981
4982 RETURN VALUE
4983 The result code associated with performing the operation
4984
4985 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
4986 page fault
4987 VOS_STATUS_SUCCESS: Everything is good :)
4988
4989 SIDE EFFECTS
4990 This function doesn't re-initialize vosDataBuff to NULL. It's caller's
4991 responsibility to do so, if required, after this function call.
4992 Because of this restriction, we decide to make this function to static
4993 so that upper layer doesn't need to be aware of this restriction.
4994
4995============================================================================*/
4996static VOS_STATUS
4997WLANTL_ForwardSTAFrames
4998(
4999 void* pvosGCtx,
5000 v_U8_t ucSTAId,
5001 v_U8_t ucUcastSig,
5002 v_U8_t ucBcastSig
5003)
5004{
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305005 WLANTL_CbType* pTLCb = NULL;
5006 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005007 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
5008
5009 /*-------------------------------------------------------------------------
5010 Sanity check
5011 -------------------------------------------------------------------------*/
5012 pTLCb = VOS_GET_TL_CB(pvosGCtx);
5013 if ( NULL == pTLCb )
5014 {
5015 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05305016 "WLAN TL: Invalid input pointer on WLANTL_ForwardSTAFrames TL %p",
Jeff Johnson295189b2012-06-20 16:38:30 -07005017 pTLCb ));
5018 return VOS_STATUS_E_FAULT;
5019 }
5020
5021 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
5022 {
5023 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5024 "WLAN TL:Invalid station id requested on WLANTL_ForwardSTAFrames"));
5025 return VOS_STATUS_E_FAULT;
5026 }
5027
5028 //WLAN_TL_LOCK_STA_CACHE(pTLCb->atlSTAClients[ucSTAId]);
5029
5030 /*------------------------------------------------------------------------
5031 Check if station has not been registered in the mean while
5032 if not registered, flush cached frames.
5033 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305034 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
5035
5036 if ( NULL == pClientSTA )
5037 {
5038 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5039 "WLAN TL:Client Memory was not allocated on %s", __func__));
5040 return VOS_STATUS_E_FAILURE;
5041 }
5042
5043 if ( 0 == pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07005044 {
5045 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5046 "WLAN TL:Station has been deleted for STA %d - flushing cache", ucSTAId));
Mihir Sheteae6f02b2014-04-11 19:49:21 +05305047 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_FLUSH_CACHED_FRAMES,
5048 ucSTAId, pClientSTA->tlCacheInfo.cacheSize));
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305049 WLANTL_FlushCachedFrames(pClientSTA->vosBegCachedFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07005050 goto done;
5051 }
5052
5053 /*------------------------------------------------------------------------
5054 Forwarding cache frames received while the station was in the process
5055 of being registered with the rest of the SW components
5056
5057 Access to the cache must be locked; similarly updating the signature and
5058 the existence flag must be synchronized because these values are checked
5059 during cached
5060 ------------------------------------------------------------------------*/
5061 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5062 "WLAN TL:Preparing to fwd packets for STA %d", ucSTAId));
5063
5064 /*-----------------------------------------------------------------------
5065 Save the new signature values
5066 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305067 pClientSTA->wSTADesc.ucUcastSig = ucUcastSig;
5068 pClientSTA->wSTADesc.ucBcastSig = ucBcastSig;
Jeff Johnson295189b2012-06-20 16:38:30 -07005069
5070 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5071 "WLAN TL:Fwd-ing packets for STA %d UC %d BC %d",
5072 ucSTAId, ucUcastSig, ucBcastSig));
5073
5074 /*-------------------------------------------------------------------------
5075 Check to see if we have any cached data to forward
5076 -------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305077 if ( NULL != pClientSTA->vosBegCachedFrame )
Jeff Johnson295189b2012-06-20 16:38:30 -07005078 {
5079 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5080 "WLAN TL: Fwd-ing Cached packets for station %d", ucSTAId ));
5081
5082 WLANTL_RxCachedFrames( pTLCb,
5083 ucSTAId,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305084 pClientSTA->vosBegCachedFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07005085 }
5086 else
5087 {
5088 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5089 "WLAN TL: NO cached packets for station %d", ucSTAId ));
5090 }
5091
5092done:
5093 /*-------------------------------------------------------------------------
5094 Clear the station cache
5095 -------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305096 pClientSTA->vosBegCachedFrame = NULL;
5097 pClientSTA->vosEndCachedFrame = NULL;
Mihir Sheteb7337272014-04-11 15:53:08 +05305098 pClientSTA->tlCacheInfo.cacheSize = 0;
5099 pClientSTA->tlCacheInfo.cacheClearTime = vos_timer_get_system_time();
Jeff Johnson295189b2012-06-20 16:38:30 -07005100
5101 /*-----------------------------------------------------------------------
5102 After all the init is complete we can mark the existance flag
5103 ----------------------------------------------------------------------*/
Katya Nigam63902932014-06-26 19:04:23 +05305104 pClientSTA->enableCaching = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005105
5106 //WLAN_TL_UNLOCK_STA_CACHE(pTLCb->atlSTAClients[ucSTAId]);
5107 return VOS_STATUS_SUCCESS;
5108
5109}/*WLANTL_ForwardSTAFrames*/
5110
5111
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005112#if defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07005113/*==========================================================================
5114
5115 FUNCTION WLANTL_IsIAPPFrame
5116
5117 DESCRIPTION
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005118 Internal utility function for detecting incoming ESE IAPP frames
Jeff Johnson295189b2012-06-20 16:38:30 -07005119
5120 DEPENDENCIES
5121
5122 PARAMETERS
5123
5124 IN
5125
5126 pvBDHeader: pointer to the BD header
5127 vosTempBuff: the data packet
5128
5129 IN/OUT
5130 pFirstDataPktArrived: static from caller function; used for rssi
5131 computation
5132 RETURN VALUE
5133 The result code associated with performing the operation
5134
5135 VOS_TRUE: It is a IAPP frame
5136 VOS_FALSE: It is NOT IAPP frame
5137
5138 SIDE EFFECTS
5139
5140============================================================================*/
5141v_BOOL_t
5142WLANTL_IsIAPPFrame
5143(
5144 v_PVOID_t pvBDHeader,
5145 vos_pkt_t* vosTempBuff
5146)
5147{
5148 v_U16_t usMPDUDOffset;
5149 v_U8_t ucOffset;
5150 v_U8_t ucSnapHdr[WLANTL_LLC_SNAP_SIZE];
5151 v_SIZE_t usSnapHdrSize = WLANTL_LLC_SNAP_SIZE;
5152 VOS_STATUS vosStatus;
5153
5154 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
5155
5156 /*------------------------------------------------------------------------
5157 Check if OUI field is present.
5158 -------------------------------------------------------------------------*/
5159 if ( VOS_FALSE == WDA_IS_RX_LLC_PRESENT(pvBDHeader) )
5160 {
5161 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5162 "WLAN TL:LLC header removed, cannot determine BT-AMP type -"
5163 "dropping pkt"));
5164 /* Drop packet */
5165 vos_pkt_return_packet(vosTempBuff);
5166 return VOS_TRUE;
5167 }
5168 usMPDUDOffset = (v_U8_t)WDA_GET_RX_MPDU_DATA_OFFSET(pvBDHeader);
5169 ucOffset = (v_U8_t)usMPDUDOffset + WLANTL_LLC_SNAP_OFFSET;
5170
5171 vosStatus = vos_pkt_extract_data( vosTempBuff, ucOffset,
5172 (v_PVOID_t)ucSnapHdr, &usSnapHdrSize);
5173
5174 if (( VOS_STATUS_SUCCESS != vosStatus))
5175 {
5176 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5177 "Unable to extract Snap Hdr of data packet -"
5178 "dropping pkt"));
5179 return VOS_FALSE;
5180 }
5181
5182 /*------------------------------------------------------------------------
5183 Check if this is IAPP frame by matching Aironet Snap hdr.
5184 -------------------------------------------------------------------------*/
5185 // Compare returns 1 if values are same and 0
5186 // if not the same.
5187 if (( WLANTL_LLC_SNAP_SIZE != usSnapHdrSize ) ||
5188 ( 0 == vos_mem_compare(ucSnapHdr, (v_PVOID_t)WLANTL_AIRONET_SNAP_HEADER,
5189 WLANTL_LLC_SNAP_SIZE ) ))
5190 {
5191 return VOS_FALSE;
5192 }
5193
5194 return VOS_TRUE;
5195
5196}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005197#endif //FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07005198
5199/*==========================================================================
5200
5201 FUNCTION WLANTL_ProcessBAPFrame
5202
5203 DESCRIPTION
5204 Internal utility function for processing incoming BT-AMP frames
5205
5206 DEPENDENCIES
5207 TL must be initiailized before this function gets called.
5208 Bothe the BT-AMP station and the BAP Ctrl path must have been previously
5209 registered with TL.
5210
5211 PARAMETERS
5212
5213 IN
5214
5215 pvBDHeader: pointer to the BD header
5216 vosTempBuff: the data packet
5217 pTLCb: TL control block
5218 ucSTAId: station id
5219
5220 IN/OUT
5221 pFirstDataPktArrived: static from caller function; used for rssi
5222 computation
5223 RETURN VALUE
5224 The result code associated with performing the operation
5225
5226 VOS_STATUS_E_INVAL: Input parameters are invalid
5227 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
5228 page fault
5229 VOS_STATUS_SUCCESS: Everything is good :)
5230
5231 SIDE EFFECTS
5232
5233============================================================================*/
5234v_BOOL_t
5235WLANTL_ProcessBAPFrame
5236(
5237 v_PVOID_t pvBDHeader,
5238 vos_pkt_t* vosTempBuff,
5239 WLANTL_CbType* pTLCb,
5240 v_U8_t* pFirstDataPktArrived,
5241 v_U8_t ucSTAId
5242)
5243{
5244 v_U16_t usMPDUDOffset;
5245 v_U8_t ucOffset;
5246 v_U8_t ucOUI[WLANTL_LLC_OUI_SIZE];
5247 v_SIZE_t usOUISize = WLANTL_LLC_OUI_SIZE;
5248 VOS_STATUS vosStatus;
5249 v_U16_t usType;
5250 v_SIZE_t usTypeLen = sizeof(usType);
5251 v_U8_t ucMPDUHOffset;
5252 v_U8_t ucMPDUHLen = 0;
5253 v_U16_t usActualHLen = 0;
5254
5255 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
5256
5257 /*------------------------------------------------------------------------
5258 Extract OUI and type from LLC and validate; if non-data send to BAP
5259 -------------------------------------------------------------------------*/
5260 if ( VOS_FALSE == WDA_IS_RX_LLC_PRESENT(pvBDHeader) )
5261 {
5262 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5263 "WLAN TL:LLC header removed, cannot determine BT-AMP type -"
5264 "dropping pkt"));
5265 /* Drop packet */
5266 vos_pkt_return_packet(vosTempBuff);
5267 return VOS_TRUE;
5268 }
5269
5270 usMPDUDOffset = (v_U8_t)WDA_GET_RX_MPDU_DATA_OFFSET(pvBDHeader);
5271 ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(pvBDHeader);
5272 ucMPDUHLen = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(pvBDHeader);
5273 ucOffset = (v_U8_t)usMPDUDOffset + WLANTL_LLC_OUI_OFFSET;
5274
5275 vosStatus = vos_pkt_extract_data( vosTempBuff, ucOffset,
5276 (v_PVOID_t)ucOUI, &usOUISize);
5277
5278#if 0
5279 // Compare returns 1 if values are same and 0
5280 // if not the same.
5281 if (( WLANTL_LLC_OUI_SIZE != usOUISize ) ||
5282 ( 0 == vos_mem_compare(ucOUI, (v_PVOID_t)WLANTL_BT_AMP_OUI,
5283 WLANTL_LLC_OUI_SIZE ) ))
5284 {
5285 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5286 "LLC header points to diff OUI in BT-AMP station -"
5287 "dropping pkt"));
5288 /* Drop packet */
5289 vos_pkt_return_packet(vosTempBuff);
5290 return VOS_TRUE;
5291 }
5292#endif
5293 /*------------------------------------------------------------------------
5294 Extract LLC OUI and ensure that this is indeed a BT-AMP frame
5295 ------------------------------------------------------------------------*/
5296 vosStatus = vos_pkt_extract_data( vosTempBuff,
5297 ucOffset + WLANTL_LLC_OUI_SIZE,
5298 (v_PVOID_t)&usType, &usTypeLen);
5299
5300 if (( VOS_STATUS_SUCCESS != vosStatus) ||
5301 ( sizeof(usType) != usTypeLen ))
5302 {
5303 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5304 "Unable to extract type on incoming BAP packet -"
5305 "dropping pkt"));
5306 /* Drop packet */
5307 vos_pkt_return_packet(vosTempBuff);
5308 return VOS_TRUE;
5309 }
5310
5311 /*------------------------------------------------------------------------
5312 Check if this is BT-AMP data or ctrl packet(RSN, LinkSvision, ActivityR)
5313 ------------------------------------------------------------------------*/
5314 usType = vos_be16_to_cpu(usType);
5315
5316 if (WLANTL_BAP_IS_NON_DATA_PKT_TYPE(usType))
5317 {
5318 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5319 "WLAN TL:Non-data packet received over BT-AMP link: %d, => BAP",
5320 usType));
5321
5322 /*Flatten packet as BAP expects to be able to peek*/
5323 if ( VOS_STATUS_SUCCESS != vos_pkt_flatten_rx_pkt(&vosTempBuff))
5324 {
5325 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5326 "WLAN TL:Cannot flatten BT-AMP packet - dropping"));
5327 /* Drop packet */
5328 vos_pkt_return_packet(vosTempBuff);
5329 return VOS_TRUE;
5330 }
5331
5332 /* Send packet to BAP client*/
Jeff Johnson295189b2012-06-20 16:38:30 -07005333 if ( VOS_STATUS_SUCCESS != WDA_DS_TrimRxPacketInfo( vosTempBuff ) )
5334 {
5335 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5336 "WLAN TL:BD header corrupted - dropping packet"));
5337 /* Drop packet */
5338 vos_pkt_return_packet(vosTempBuff);
5339 return VOS_TRUE;
5340 }
5341
5342 if ( 0 == WDA_GET_RX_FT_DONE(pvBDHeader) )
5343 {
5344 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5345 "Non-data packet received over BT-AMP link: Sending it for "
5346 "frame Translation"));
5347
5348 if (usMPDUDOffset > ucMPDUHOffset)
5349 {
5350 usActualHLen = usMPDUDOffset - ucMPDUHOffset;
5351 }
5352
5353 /* software frame translation for BTAMP WDS.*/
5354 WLANTL_Translate80211To8023Header( vosTempBuff, &vosStatus, usActualHLen,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005355 ucMPDUHLen, pTLCb,ucSTAId, VOS_FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07005356
5357 }
5358 if (pTLCb->tlBAPClient.pfnTlBAPRx)
5359 pTLCb->tlBAPClient.pfnTlBAPRx( vos_get_global_context(VOS_MODULE_ID_TL,pTLCb),
5360 vosTempBuff,
5361 (WLANTL_BAPFrameEnumType)usType );
Manjunathappa Prakashfb585462013-12-23 19:07:07 -08005362 else
5363 {
5364 VOS_ASSERT(0);
5365 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005366
5367 return VOS_TRUE;
5368 }
5369 else
5370 {
5371 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5372 "WLAN TL: BAP DATA packet received over BT-AMP link: %d, => BAP",
5373 usType));
5374 /*!!!FIX ME!!*/
5375 #if 0
5376 /*--------------------------------------------------------------------
5377 For data packet collect phy stats RSSI and Link Quality
5378 Calculate the RSSI average and save it. Continuous average is done.
5379 --------------------------------------------------------------------*/
5380 if ( *pFirstDataPktArrived == 0)
5381 {
5382 pTLCb->atlSTAClients[ucSTAId].rssiAvg =
5383 WLANHAL_GET_RSSI_AVERAGE( pvBDHeader );
5384 pTLCb->atlSTAClients[ucSTAId].uLinkQualityAvg =
5385 WLANHAL_RX_BD_GET_SNR( pvBDHeader );
5386
5387 // Rcvd 1st pkt, start average from next time
5388 *pFirstDataPktArrived = 1;
5389 }
5390 else
5391 {
5392 pTLCb->atlSTAClients[ucSTAId].rssiAvg =
5393 (WLANHAL_GET_RSSI_AVERAGE( pvBDHeader ) +
5394 pTLCb->atlSTAClients[ucSTAId].rssiAvg)/2;
5395 pTLCb->atlSTAClients[ucSTAId].uLinkQualityAvg =
5396 (WLANHAL_RX_BD_GET_SNR( pvBDHeader ) +
5397 pTLCb->atlSTAClients[ucSTAId].uLinkQualityAvg)/2;
5398 }/*Else, first data packet*/
5399 #endif
5400 }/*BT-AMP data packet*/
5401
5402 return VOS_FALSE;
5403}/*WLANTL_ProcessBAPFrame*/
5404
Jeff Johnson295189b2012-06-20 16:38:30 -07005405
5406/*==========================================================================
5407
5408 FUNCTION WLANTL_ProcessFCFrame
5409
5410 DESCRIPTION
5411 Internal utility function for processing incoming Flow Control frames. Enable
5412 or disable LWM mode based on the information.
5413
5414 DEPENDENCIES
5415 TL must be initiailized before this function gets called.
5416 FW sends up special flow control frame.
5417
5418 PARAMETERS
5419
5420 IN
5421 pvosGCtx pointer to vos global context
5422 pvBDHeader: pointer to the BD header
5423 pTLCb: TL control block
5424 pvBDHeader pointer to BD header.
5425
5426 IN/OUT
5427 pFirstDataPktArrived: static from caller function; used for rssi
5428 computation
5429 RETURN VALUE
5430 The result code associated with performing the operation
5431
5432 VOS_STATUS_E_INVAL: Input frame are invalid
5433 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
5434 page fault
5435 VOS_STATUS_SUCCESS: Everything is good :)
5436
5437 SIDE EFFECTS
5438 The ingress and egress of each station will be updated. If needed, LWM mode will
5439 be enabled or disabled based on the flow control algorithm.
5440
5441============================================================================*/
5442v_BOOL_t
5443WLANTL_ProcessFCFrame
5444(
5445 v_PVOID_t pvosGCtx,
5446 vos_pkt_t* pvosDataBuff,
5447 v_PVOID_t pvBDHeader
5448)
5449{
5450#if 1 //enable processing of only fcStaTxDisabled bitmap for now. the else part is old better qos code.
5451 // need to revisit the old code for full implementation.
Hoonki Lee14621352013-04-16 17:51:19 -07005452 v_U8_t ucSTAId;
5453 v_U16_t ucStaValidBitmap;
5454 v_U16_t ucStaTxDisabledBitmap;
5455 WLANTL_CbType* pTLCb = NULL;
5456 #ifdef TL_DEBUG_FC
5457 v_U32_t rxTimeStamp;
5458 v_U32_t curTick;
5459 #endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005460 /*------------------------------------------------------------------------
Hoonki Lee14621352013-04-16 17:51:19 -07005461 Extract TL control block
Jeff Johnson295189b2012-06-20 16:38:30 -07005462 ------------------------------------------------------------------------*/
5463 pTLCb = VOS_GET_TL_CB(pvosGCtx);
5464 if ( NULL == pTLCb )
5465 {
5466 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5467 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SuspendDataTx"));
5468 return VOS_STATUS_E_FAULT;
5469 }
Hoonki Lee14621352013-04-16 17:51:19 -07005470 ucStaValidBitmap = WDA_GET_RX_FC_VALID_STA_MASK(pvBDHeader);
5471 ucStaTxDisabledBitmap = WDA_GET_RX_FC_STA_TX_DISABLED_BITMAP(pvBDHeader);
5472#ifdef TL_DEBUG_FC
5473 rxTimeStamp = WDA_GET_RX_TIMESTAMP(pvBDHeader);
5474 /* hard code of MTU_GLOBAL_TIMER_ADDR to calculate the time between generated and processed */
5475 wpalReadRegister(0x03081400+0x1D4, &curTick);
Jeff Johnson295189b2012-06-20 16:38:30 -07005476
Jeff Johnson295189b2012-06-20 16:38:30 -07005477 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08005478 "%ld (%ld-%ld): Disabled %x Valid %x", curTick > rxTimeStamp ? curTick - rxTimeStamp : rxTimeStamp - (0xFFFFFFFF - curTick),
Hoonki Lee14621352013-04-16 17:51:19 -07005479 curTick, rxTimeStamp, ucStaTxDisabledBitmap, ucStaValidBitmap));
5480#endif
5481 for(ucSTAId = 0; ucStaValidBitmap != 0; ucStaValidBitmap >>=1, ucStaTxDisabledBitmap >>= 1, ucSTAId ++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005482 {
Hoonki Lee14621352013-04-16 17:51:19 -07005483 if ( (0 == (ucStaValidBitmap & 0x1)) || (pTLCb->atlSTAClients[ucSTAId] && (0 == pTLCb->atlSTAClients[ucSTAId]->ucExists)) )
5484 continue;
5485
5486 if (ucStaTxDisabledBitmap & 0x1)
5487 {
5488 WLANTL_SuspendDataTx(pvosGCtx, &ucSTAId, NULL);
5489 }
5490 else
5491 {
5492 WLANTL_ResumeDataTx(pvosGCtx, &ucSTAId);
5493 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005494 }
5495
5496#else
5497 VOS_STATUS vosStatus;
5498 tpHalFcRxBd pvFcRxBd = NULL;
5499 v_U8_t ucBitCheck = 0x1;
5500 v_U8_t ucStaValid = 0;
5501 v_U8_t ucSTAId = 0;
5502
5503 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
5504 "Received FC Response");
5505 if ( (NULL == pTLCb) || (NULL == pvosDataBuff))
5506 {
5507 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08005508 "WLAN TL:Invalid pointer in %s", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07005509 return VOS_STATUS_E_FAULT;
5510 }
5511 vosStatus = vos_pkt_peek_data( pvosDataBuff, 0, (v_PVOID_t)&pvFcRxBd,
5512 sizeof(tHalFcRxBd));
5513
5514 if ( (VOS_STATUS_SUCCESS != vosStatus) || (NULL == pvFcRxBd) )
5515 {
5516 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5517 "WLAN TL:wrong FC Rx packet"));
5518 return VOS_STATUS_E_INVAL;
5519 }
5520
5521 // need to swap bytes in the FC contents.
5522 WLANHAL_SwapFcRxBd(&pvFcRxBd->fcSTATxQLen[0]);
5523
5524 //logic to enable/disable LWM mode for each station
5525 for( ucStaValid = (v_U8_t)pvFcRxBd->fcSTAValidMask; ucStaValid; ucStaValid >>= 1, ucBitCheck <<= 1, ucSTAId ++)
5526 {
5527 if ( (0 == (ucStaValid & 0x1)) || (0 == pTLCb->atlSTAClients[ucSTAId].ucExists) )
5528 {
5529 continue;
5530 }
5531
5532 if ( pvFcRxBd->fcSTAThreshIndMask & ucBitCheck )
5533 {
5534 //LWM event is reported by FW. Able to fetch more packet
5535 if( pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled )
5536 {
5537 //Now memory usage is below LWM. Station can send more packets.
5538 pTLCb->atlSTAClients[ucSTAId].ucLwmEventReported = TRUE;
5539 }
5540 else
5541 {
5542 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
Arif Hussainf2b00992013-11-17 21:46:15 -08005543 "WLAN TL: FW report LWM event but the station %d is not in LWM mode", ucSTAId));
Jeff Johnson295189b2012-06-20 16:38:30 -07005544 }
5545 }
5546
5547 //calculate uEgress_length/uIngress_length only after receiving enough packets
5548 if (WLANTL_LWM_INGRESS_SAMPLE_THRESHOLD <= pTLCb->atlSTAClients[ucSTAId].uIngress_length)
5549 {
5550 //check memory usage info to see whether LWM mode should be enabled for the station
5551 v_U32_t uEgress_length = pTLCb->atlSTAClients[ucSTAId].uIngress_length +
5552 pTLCb->atlSTAClients[ucSTAId].bmuMemConsumed - pvFcRxBd->fcSTATxQLen[ucSTAId];
5553
5554 //if ((float)uEgress_length/(float)pTLCb->atlSTAClients[ucSTAId].uIngress_length
5555 // <= WLANTL_LWM_EGRESS_INGRESS_THRESHOLD)
5556 if ( (pTLCb->atlSTAClients[ucSTAId].uIngress_length > uEgress_length) &&
5557 ((pTLCb->atlSTAClients[ucSTAId].uIngress_length - uEgress_length ) >=
5558 (pTLCb->atlSTAClients[ucSTAId].uIngress_length >> 2))
5559 )
5560 {
5561 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -08005562 "WLAN TL:Enable LWM mode for station %d", ucSTAId));
Jeff Johnson295189b2012-06-20 16:38:30 -07005563 pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled = TRUE;
5564 }
5565 else
5566 {
5567 if( pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled )
5568 {
5569 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -08005570 "WLAN TL:Disable LWM mode for station %d", ucSTAId));
Jeff Johnson295189b2012-06-20 16:38:30 -07005571 pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled = FALSE;
5572 }
5573
5574 }
5575
5576 //remember memory usage in FW starting from this round
5577 pTLCb->atlSTAClients[ucSTAId].bmuMemConsumed = pvFcRxBd->fcSTATxQLen[ucSTAId];
5578 pTLCb->atlSTAClients[ucSTAId].uIngress_length = 0;
5579 } //(WLANTL_LWM_INGRESS_SAMPLE_THRESHOLD <= pTLCb->atlSTAClients[ucSTAId].uIngress_length)
5580
5581 if( pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled )
5582 {
5583 //always update current maximum allowed memeory usage
5584 pTLCb->atlSTAClients[ucSTAId].uBuffThresholdMax = WLANTL_STA_BMU_THRESHOLD_MAX -
5585 pvFcRxBd->fcSTATxQLen[ucSTAId];
5586 }
5587
5588 }
5589#endif
5590
5591 return VOS_STATUS_SUCCESS;
5592}
Jeff Johnson295189b2012-06-20 16:38:30 -07005593
5594
5595/*==========================================================================
5596
5597 FUNCTION WLANTL_RxFrames
5598
5599 DESCRIPTION
5600 Callback registered by TL and called by BAL when a packet is received
5601 over the bus. Upon the call of this function TL will make the necessary
5602 decision with regards to the forwarding or queuing of this packet and
5603 the layer it needs to be delivered to.
5604
5605 DEPENDENCIES
5606 TL must be initiailized before this function gets called.
5607 If the frame carried is a data frame then the station for which it is
5608 destined to must have been previously registered with TL.
5609
5610 PARAMETERS
5611
5612 IN
5613 pvosGCtx: pointer to the global vos context; a handle to TL's
5614 or BAL's control block can be extracted from its context
5615
5616 vosDataBuff: it will contain a pointer to the first buffer received,
5617 if there is more then one packet they will be chained
5618 using vOSS buffers.
5619
5620 RETURN VALUE
5621 The result code associated with performing the operation
5622
5623 VOS_STATUS_E_INVAL: Input parameters are invalid
5624 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
5625 page fault
5626 VOS_STATUS_SUCCESS: Everything is good :)
5627
5628 SIDE EFFECTS
5629
5630============================================================================*/
5631VOS_STATUS
5632WLANTL_RxFrames
5633(
5634 v_PVOID_t pvosGCtx,
5635 vos_pkt_t *pFrameDataBuff
5636)
5637{
5638 vos_pkt_t* vosDataBuff = (vos_pkt_t*)pFrameDataBuff;
5639 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305640 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005641 WLANTL_STAFuncType pfnSTAFsm;
5642 vos_pkt_t* vosTempBuff;
5643 v_U8_t ucSTAId;
5644 VOS_STATUS vosStatus;
5645 v_U8_t ucFrmType;
5646 v_PVOID_t pvBDHeader = NULL;
5647 WLANTL_STAEventType wSTAEvent = WLANTL_RX_EVENT;
5648 v_U8_t ucTid = 0;
5649 v_BOOL_t broadcast = VOS_FALSE;
5650 v_BOOL_t selfBcastLoopback = VOS_FALSE;
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -07005651 static v_U8_t first_data_pkt_arrived;
Jeff Johnson295189b2012-06-20 16:38:30 -07005652 v_U32_t uDPUSig;
Jeff Johnson295189b2012-06-20 16:38:30 -07005653 v_U16_t usPktLen;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005654#ifdef FEATURE_WLAN_TDLS_INTERNAL
5655 v_U8_t ucMPDUHLen = 0 ;
5656 v_U16_t usEtherType = 0;
5657#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005658 v_BOOL_t bForwardIAPPwithLLC = VOS_FALSE;
Dino Mycle3b9536d2014-07-09 22:05:24 +05305659#ifdef WLAN_FEATURE_LINK_LAYER_STATS
5660 v_S7_t currentAvgRSSI = 0;
5661 v_U8_t ac;
5662
5663#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005664
Jeff Johnson295189b2012-06-20 16:38:30 -07005665 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
5666
5667 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5668 "WLAN TL:TL Receive Frames called"));
5669
5670 /*------------------------------------------------------------------------
5671 Sanity check
5672 ------------------------------------------------------------------------*/
5673 if ( NULL == vosDataBuff )
5674 {
5675 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5676 "WLAN TL:Invalid parameter sent on WLANTL_RxFrames"));
5677 return VOS_STATUS_E_INVAL;
5678 }
5679
Katya Nigam3802f202013-12-16 19:27:14 +05305680 /*------------------------------------------------------------------------
5681 Popolaute timestamp as the time when packet arrives
5682 ---------------------------------------------------------------------- */
5683 vosDataBuff->timestamp = vos_timer_get_system_ticks();
5684
Jeff Johnson295189b2012-06-20 16:38:30 -07005685 /*------------------------------------------------------------------------
5686 Extract TL control block
5687 ------------------------------------------------------------------------*/
5688 pTLCb = VOS_GET_TL_CB(pvosGCtx);
5689 if ( NULL == pTLCb )
5690 {
5691 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5692 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
5693 return VOS_STATUS_E_FAULT;
5694 }
5695
5696 /*---------------------------------------------------------------------
5697 Save the initial buffer - this is the first received buffer
5698 ---------------------------------------------------------------------*/
5699 vosTempBuff = vosDataBuff;
5700
5701 while ( NULL != vosTempBuff )
5702 {
Madan Mohan Koyyalamudia148e1e2012-11-30 14:52:59 -08005703 broadcast = VOS_FALSE;
5704 selfBcastLoopback = VOS_FALSE;
5705
Jeff Johnson295189b2012-06-20 16:38:30 -07005706 vos_pkt_walk_packet_chain( vosDataBuff, &vosDataBuff, 1/*true*/ );
5707
5708 /*---------------------------------------------------------------------
5709 Peek at BD header - do not remove
5710 !!! Optimize me: only part of header is needed; not entire one
5711 ---------------------------------------------------------------------*/
5712 vosStatus = WDA_DS_PeekRxPacketInfo( vosTempBuff, (v_PVOID_t)&pvBDHeader, 1/*Swap BD*/ );
5713
5714 if ( NULL == pvBDHeader )
5715 {
5716 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5717 "WLAN TL:Cannot extract BD header"));
5718 /* Drop packet */
5719 vos_pkt_return_packet(vosTempBuff);
5720 vosTempBuff = vosDataBuff;
5721 continue;
5722 }
5723
Jeff Johnson295189b2012-06-20 16:38:30 -07005724 /*---------------------------------------------------------------------
5725 Check if FC frame reported from FW
5726 ---------------------------------------------------------------------*/
5727 if(WDA_IS_RX_FC(pvBDHeader))
5728 {
5729 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5730 "WLAN TL:receive one FC frame"));
5731
5732 WLANTL_ProcessFCFrame(pvosGCtx, vosTempBuff, pvBDHeader);
5733 /* Drop packet */
5734 vos_pkt_return_packet(vosTempBuff);
5735 vosTempBuff = vosDataBuff;
5736 continue;
5737 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005738
5739 /* AMSDU HW bug fix
5740 * After 2nd AMSDU subframe HW could not handle BD correctly
5741 * HAL workaround is needed */
5742 if(WDA_GET_RX_ASF(pvBDHeader))
5743 {
5744 WDA_DS_RxAmsduBdFix(pvosGCtx, pvBDHeader);
5745 }
5746
5747 /*---------------------------------------------------------------------
5748 Extract frame control field from 802.11 header if present
5749 (frame translation not done)
5750 ---------------------------------------------------------------------*/
5751
5752 vosStatus = WDA_DS_GetFrameTypeSubType( pvosGCtx, vosTempBuff,
5753 pvBDHeader, &ucFrmType );
5754 if ( VOS_STATUS_SUCCESS != vosStatus )
5755 {
5756 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5757 "WLAN TL:Cannot extract Frame Control Field"));
5758 /* Drop packet */
5759 vos_pkt_return_packet(vosTempBuff);
5760 vosTempBuff = vosDataBuff;
5761 continue;
5762 }
5763
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005764#ifdef FEATURE_WLAN_TDLS_INTERNAL
5765 if ( WLANTL_IS_DATA_FRAME(ucFrmType))
5766 {
5767 ucMPDUHLen = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(pvBDHeader);
5768 WLANTL_GetEtherType_2(pvBDHeader, vosTempBuff, ucMPDUHLen, &usEtherType) ;
5769 }
5770#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005771 vos_pkt_get_packet_length(vosTempBuff, &usPktLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07005772
5773 /*---------------------------------------------------------------------
5774 Check if management and send to PE
5775 ---------------------------------------------------------------------*/
5776
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005777 if ( WLANTL_IS_MGMT_FRAME(ucFrmType)
5778#ifdef FEATURE_WLAN_TDLS_INTERNAL
5779 || (WLANTL_IS_TDLS_FRAME(usEtherType))
5780#endif
5781 )
Jeff Johnson295189b2012-06-20 16:38:30 -07005782 {
5783 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5784 "WLAN TL:Sending packet to management client"));
5785 if ( VOS_STATUS_SUCCESS != vos_pkt_flatten_rx_pkt(&vosTempBuff))
5786 {
5787 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5788 "WLAN TL:Cannot flatten packet - dropping"));
5789 /* Drop packet */
5790 vos_pkt_return_packet(vosTempBuff);
5791 vosTempBuff = vosDataBuff;
5792 continue;
5793 }
5794 ucSTAId = (v_U8_t)WDA_GET_RX_STAID( pvBDHeader );
5795 /* Read RSSI and update */
5796 if(!WLANTL_STA_ID_INVALID(ucSTAId))
5797 {
5798#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
5799 /* Read RSSI and update */
5800 vosStatus = WLANTL_HSHandleRXFrame(pvosGCtx,
5801 WLANTL_MGMT_FRAME_TYPE,
5802 pvBDHeader,
5803 ucSTAId,
5804 VOS_FALSE,
5805 NULL);
5806#else
5807 vosStatus = WLANTL_ReadRSSI(pvosGCtx, pvBDHeader, ucSTAId);
5808#endif
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05305809 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
5810 {
5811 TLLOGW(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5812 "Handle RX Management Frame fail within Handoff "
5813 "support module"));
5814 /* Do Not Drop packet at here
5815 * Revisit why HO module return fail
5816 * vos_pkt_return_packet(vosTempBuff);
5817 * vosTempBuff = vosDataBuff;
5818 * continue;
5819 */
5820 }
5821 vosStatus = WLANTL_ReadSNR(pvosGCtx, pvBDHeader, ucSTAId);
5822
5823 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
5824 {
5825 TLLOGW(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5826 FL("Failed to Read SNR")));
5827 }
Dino Mycle3b9536d2014-07-09 22:05:24 +05305828#ifdef WLAN_FEATURE_LINK_LAYER_STATS
5829 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
5830 if ( NULL != pClientSTA)
5831 {
5832 pClientSTA->interfaceStats.mgmtRx++;
Dino Mycle3b9536d2014-07-09 22:05:24 +05305833 }
5834#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005835 }
5836
Jeff Johnson295189b2012-06-20 16:38:30 -07005837 pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx( pvosGCtx, vosTempBuff);
5838 }
5839 else /* Data Frame */
5840 {
5841 ucSTAId = (v_U8_t)WDA_GET_RX_STAID( pvBDHeader );
5842 ucTid = (v_U8_t)WDA_GET_RX_TID( pvBDHeader );
Dino Mycle3b9536d2014-07-09 22:05:24 +05305843#ifdef WLAN_FEATURE_LINK_LAYER_STATS
5844 ac = WLANTL_TID_2_AC[ucTid];
5845#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005846
5847 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5848 "WLAN TL:Data packet received for STA %d", ucSTAId));
5849
5850 /*------------------------------------------------------------------
5851 This should be corrected when multipe sta support is added !!!
5852 for now bcast frames will be sent to the last registered STA
5853 ------------------------------------------------------------------*/
5854 if ( WDA_IS_RX_BCAST(pvBDHeader))
5855 {
5856 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5857 "WLAN TL:TL rx Bcast frame - sending to last registered station"));
5858 broadcast = VOS_TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005859 /*-------------------------------------------------------------------
5860 If Addr1 is b/mcast, but Addr3 is our own self MAC, it is a b/mcast
5861 pkt we sent looping back to us. To be dropped if we are non BTAMP
5862 -------------------------------------------------------------------*/
5863 if( WLANHAL_RX_BD_ADDR3_SELF_IDX ==
5864 (v_U8_t)WDA_GET_RX_ADDR3_IDX( pvBDHeader ))
5865 {
5866 selfBcastLoopback = VOS_TRUE;
5867 }
5868 }/*if bcast*/
5869
5870 if ( WLANTL_STA_ID_INVALID(ucSTAId) )
5871 {
5872 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5873 "WLAN TL:STA ID invalid - dropping pkt"));
5874 /* Drop packet */
5875 vos_pkt_return_packet(vosTempBuff);
5876 vosTempBuff = vosDataBuff;
5877 continue;
5878 }
5879
5880 /*----------------------------------------------------------------------
5881 No need to lock cache access because cache manipulation only happens
5882 in the transport thread/task context
5883 - These frames are to be forwarded to the station upon registration
5884 which happens in the main thread context
5885 The caching here can happen in either Tx or Rx thread depending
5886 on the current SSC scheduling
5887 - also we need to make sure that the frames in the cache are fwd-ed to
5888 the station before the new incoming ones
5889 -----------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305890 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
5891 if (NULL == pClientSTA)
5892 {
5893 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5894 "WLAN TL:STA not allocated memory. Dropping packet"));
5895 vos_pkt_return_packet(vosTempBuff);
5896 vosTempBuff = vosDataBuff;
5897 continue;
5898 }
5899
Hoonki Lee5305c3a2013-04-29 23:28:59 -07005900#ifdef FEATURE_WLAN_TDLS
5901 if (( pClientSTA->ucExists ) &&
5902 (WLAN_STA_TDLS == pClientSTA->wSTADesc.wSTAType) &&
5903 (pClientSTA->ucTxSuspended))
5904 vos_atomic_set_U8( &pClientSTA->ucTxSuspended, 0 );
5905 else if ( !broadcast && (pClientSTA->ucExists == 0 ) )
5906 {
5907 tpSirMacMgmtHdr pMacHeader = WDA_GET_RX_MAC_HEADER( pvBDHeader );
5908
5909 /* from the direct peer while it is not registered to TL yet */
5910 if ( (pMacHeader->fc.fromDS == 0) &&
5911 (pMacHeader->fc.toDS == 0) )
5912 {
5913 v_U8_t ucAddr3STAId;
5914
5915 ucAddr3STAId = WDA_GET_RX_ADDR3_IDX(pvBDHeader);
5916
5917 if ( WLANTL_STA_ID_INVALID(ucAddr3STAId) )
5918 {
5919 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5920 "WLAN TL:STA ID %d invalid - dropping pkt", ucAddr3STAId));
5921 /* Drop packet */
5922 vos_pkt_return_packet(vosTempBuff);
5923 vosTempBuff = vosDataBuff;
5924 continue;
5925 }
5926
5927 if (!(pTLCb->atlSTAClients[ucAddr3STAId] && pTLCb->atlSTAClients[ucAddr3STAId]->ucExists &&
5928 (WLAN_STA_INFRA == pTLCb->atlSTAClients[ucAddr3STAId]->wSTADesc.wSTAType) &&
5929 (WLANTL_STA_AUTHENTICATED == pTLCb->atlSTAClients[ucAddr3STAId]->tlState)))
5930 {
5931 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Arif Hussainf2b00992013-11-17 21:46:15 -08005932 "%s: staId %d addr3Id %d tlState %d. Unkown Receiver/Transmitter Dropping packet", __func__,
Hoonki Lee5305c3a2013-04-29 23:28:59 -07005933 ucSTAId, ucAddr3STAId, pTLCb->atlSTAClients[ucAddr3STAId]->tlState));
5934 vos_pkt_return_packet(vosTempBuff);
5935 vosTempBuff = vosDataBuff;
5936 continue;
5937 }
5938 else
5939 {
5940 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Arif Hussainf2b00992013-11-17 21:46:15 -08005941 "%s: staId %d doesn't exist, but mapped to AP staId %d", __func__,
Hoonki Lee5305c3a2013-04-29 23:28:59 -07005942 ucSTAId, ucAddr3STAId));
5943 ucSTAId = ucAddr3STAId;
5944 pClientSTA = pTLCb->atlSTAClients[ucAddr3STAId];
5945 }
5946 }
5947 }
5948#endif
5949
Katya Nigam63902932014-06-26 19:04:23 +05305950 if (( pClientSTA->enableCaching == 1 ) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005951 /*Dont buffer Broadcast/Multicast frames. If AP transmits bursts of Broadcast/Multicast data frames,
5952 * libra buffers all Broadcast/Multicast packets after authentication with AP,
5953 * So it will lead to low resource condition in Rx Data Path.*/
Katya Nigam63902932014-06-26 19:04:23 +05305954 ( WDA_IS_RX_BCAST(pvBDHeader) == 0 ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005955 {
Katya Nigam6201c3e2014-05-27 17:51:42 +05305956 if( WDA_IsSelfSTA(pvosGCtx,ucSTAId))
5957 {
5958 //drop packet for Self STA index
5959 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5960 "%s: Packet dropped for Self STA with staId %d ", __func__, ucSTAId ));
5961
5962 vos_pkt_return_packet(vosTempBuff);
5963 vosTempBuff = vosDataBuff;
5964 continue;
5965 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005966 uDPUSig = WDA_GET_RX_DPUSIG( pvBDHeader );
5967 //Station has not yet been registered with TL - cache the frame
Hoonki Lee5305c3a2013-04-29 23:28:59 -07005968 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Arif Hussainf2b00992013-11-17 21:46:15 -08005969 "%s: staId %d exist %d tlState %d cache rx frame", __func__, ucSTAId,
Hoonki Lee5305c3a2013-04-29 23:28:59 -07005970 pClientSTA->ucExists, pClientSTA->tlState));
Jeff Johnson295189b2012-06-20 16:38:30 -07005971 WLANTL_CacheSTAFrame( pTLCb, ucSTAId, vosTempBuff, uDPUSig, broadcast, ucFrmType);
5972 vosTempBuff = vosDataBuff;
5973 continue;
5974 }
5975
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005976#ifdef FEATURE_WLAN_ESE_UPLOAD
5977 if ((pClientSTA->wSTADesc.ucIsEseSta)|| broadcast)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005978 {
5979 /*--------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005980 Filter the IAPP frames for ESE connection;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005981 if data it will return false and it
5982 will be routed through the regular data path
5983 --------------------------------------------------------------------*/
5984 if ( WLANTL_IsIAPPFrame(pvBDHeader,
5985 vosTempBuff))
5986 {
5987 bForwardIAPPwithLLC = VOS_TRUE;
5988 }
5989 }
5990#endif
5991
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005992#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
5993 if ((pClientSTA->wSTADesc.ucIsEseSta)|| broadcast)
Jeff Johnson295189b2012-06-20 16:38:30 -07005994 {
5995 /*--------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005996 Filter the IAPP frames for ESE connection;
Jeff Johnson295189b2012-06-20 16:38:30 -07005997 if data it will return false and it
5998 will be routed through the regular data path
5999 --------------------------------------------------------------------*/
6000 if ( WLANTL_IsIAPPFrame(pvBDHeader,
6001 vosTempBuff))
6002 {
6003 if ( VOS_STATUS_SUCCESS != vos_pkt_flatten_rx_pkt(&vosTempBuff))
6004 {
6005 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6006 "WLAN TL:Cannot flatten packet - dropping"));
6007 /* Drop packet */
6008 vos_pkt_return_packet(vosTempBuff);
6009 } else {
6010
6011 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08006012 "WLAN TL: Received ESE IAPP Frame"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006013
6014 pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx( pvosGCtx, vosTempBuff);
6015 }
6016 vosTempBuff = vosDataBuff;
6017 continue;
6018 }
6019 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08006020#endif /* defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD) */
Jeff Johnson295189b2012-06-20 16:38:30 -07006021
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306022 if ( WLAN_STA_BT_AMP == pClientSTA->wSTADesc.wSTAType )
Jeff Johnson295189b2012-06-20 16:38:30 -07006023 {
6024 /*--------------------------------------------------------------------
6025 Process the ctrl BAP frame; if data it will return false and it
6026 will be routed through the regular data path
6027 --------------------------------------------------------------------*/
6028 if ( WLANTL_ProcessBAPFrame( pvBDHeader,
6029 vosTempBuff,
6030 pTLCb,
6031 &first_data_pkt_arrived,
6032 ucSTAId))
6033 {
6034 vosTempBuff = vosDataBuff;
6035 continue;
6036 }
6037 }/*if BT-AMP station*/
6038 else if(selfBcastLoopback == VOS_TRUE)
6039 {
6040 /* Drop packet */
6041 vos_pkt_return_packet(vosTempBuff);
6042 vosTempBuff = vosDataBuff;
6043 continue;
6044 }
6045
6046 /*---------------------------------------------------------------------
6047 Data packet received, send to state machine
6048 ---------------------------------------------------------------------*/
6049 wSTAEvent = WLANTL_RX_EVENT;
6050
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306051 pfnSTAFsm = tlSTAFsm[pClientSTA->tlState].
Jeff Johnson295189b2012-06-20 16:38:30 -07006052 pfnSTATbl[wSTAEvent];
6053
6054 if ( NULL != pfnSTAFsm )
6055 {
6056#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
6057 /* Read RSSI and update */
6058 vosStatus = WLANTL_HSHandleRXFrame(pvosGCtx,
6059 WLANTL_DATA_FRAME_TYPE,
6060 pvBDHeader,
6061 ucSTAId,
6062 broadcast,
6063 vosTempBuff);
6064 broadcast = VOS_FALSE;
6065#else
6066 vosStatus = WLANTL_ReadRSSI(pvosGCtx, pvBDHeader, ucSTAId);
Kiet Lam47325522014-03-10 11:50:46 -07006067#endif
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05306068 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
Jeff Johnson295189b2012-06-20 16:38:30 -07006069 {
6070 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
6071 "Handle RX Data Frame fail within Handoff support module"));
6072 /* Do Not Drop packet at here
6073 * Revisit why HO module return fail
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05306074 * vos_pkt_return_packet(vosTempBuff);
6075 * vosTempBuff = vosDataBuff;
6076 * continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07006077 */
6078 }
Dino Mycle3b9536d2014-07-09 22:05:24 +05306079#ifdef WLAN_FEATURE_LINK_LAYER_STATS
6080 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
6081 if ( NULL != pClientSTA)
6082 {
6083 tpSirMacMgmtHdr pMacHeader = WDA_GET_RX_MAC_HEADER( pvBDHeader );
Mahesh A Saptasagarbbdcf122014-10-28 20:57:11 +05306084 if (!IS_BROADCAST_ADD(pMacHeader->da) && IS_MULTICAST_ADD(pMacHeader->da))
Dino Mycle3b9536d2014-07-09 22:05:24 +05306085 {
6086 pClientSTA->interfaceStats.accessCategoryStats[ac].rxMcast++;
6087 }
6088
6089 WLANTL_HSGetDataRSSI(pvosGCtx, pvBDHeader, ucSTAId,
6090 &currentAvgRSSI);
6091 pClientSTA->interfaceStats.rssiData = currentAvgRSSI;
6092
6093 pClientSTA->interfaceStats.accessCategoryStats[ac].rxMpdu++;
6094 if (WDA_IS_RX_AN_AMPDU (pvBDHeader))
6095 {
6096 pClientSTA->interfaceStats.accessCategoryStats[ac].rxAmpdu++;
6097 }
6098 }
6099
6100
6101#endif
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05306102 vosStatus = WLANTL_ReadSNR(pvosGCtx, pvBDHeader, ucSTAId);
6103
6104 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
6105 {
6106 TLLOGW(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
6107 FL("Failed to Read SNR")));
6108 }
6109
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07006110 pfnSTAFsm( pvosGCtx, ucSTAId, &vosTempBuff, bForwardIAPPwithLLC);
Jeff Johnson295189b2012-06-20 16:38:30 -07006111 }
6112 else
6113 {
6114 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
6115 "WLAN TL:NULL state function, STA:%d, State: %d- dropping packet",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306116 ucSTAId, pClientSTA->tlState));
Jeff Johnson295189b2012-06-20 16:38:30 -07006117 /* Drop packet */
6118 vos_pkt_return_packet(vosTempBuff);
6119 vosTempBuff = vosDataBuff;
6120 continue;
6121 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006122 }/* else data frame*/
6123
6124 vosTempBuff = vosDataBuff;
6125 }/*while chain*/
6126
6127 return VOS_STATUS_SUCCESS;
6128}/* WLANTL_RxFrames */
6129
Dino Mycle3b9536d2014-07-09 22:05:24 +05306130#ifdef WLAN_FEATURE_LINK_LAYER_STATS
6131/*==========================================================================
6132
6133 FUNCTION WLANTL_CollectInterfaceStats
6134
6135 DESCRIPTION
6136 Utility function used by TL to send the statitics
6137
6138 DEPENDENCIES
6139
6140
6141 PARAMETERS
6142
6143 IN
6144
6145 ucSTAId: station for which the statistics need to collected
6146
6147 vosDataBuff: it will contain the pointer to the corresponding
6148 structure
6149
6150 RETURN VALUE
6151 The result code associated with performing the operation
6152
6153 VOS_STATUS_E_INVAL: Input parameters are invalid
6154 VOS_STATUS_SUCCESS: Everything is good :)
6155
6156 SIDE EFFECTS
6157
6158============================================================================*/
6159VOS_STATUS
6160WLANTL_CollectInterfaceStats
6161(
6162 v_PVOID_t pvosGCtx,
6163 v_U8_t ucSTAId,
6164 WLANTL_InterfaceStatsType *vosDataBuff
6165)
6166{
6167 WLANTL_CbType* pTLCb = NULL;
6168 /*------------------------------------------------------------------------
6169 Sanity check
6170 ------------------------------------------------------------------------*/
6171 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
6172 {
6173 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6174 "WLAN TL:Invalid station id requested on WLANTL_CollectStats"));
6175 return VOS_STATUS_E_FAULT;
6176 }
6177 /*------------------------------------------------------------------------
6178 Extract TL control block
6179 ------------------------------------------------------------------------*/
6180 pTLCb = VOS_GET_TL_CB(pvosGCtx);
6181 if ( NULL == pTLCb )
6182 {
6183 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6184 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_CollectStats"));
6185 return VOS_STATUS_E_FAULT;
6186 }
6187
6188 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
6189 {
6190 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6191 "WLAN TL:Client Memory was not allocated on %s", __func__));
6192 return VOS_STATUS_E_FAILURE;
6193 }
Srinivas Dasari98947432014-11-07 19:41:24 +05306194 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6195 "WLAN TL: collect WIFI_STATS_IFACE results"));
6196
Dino Mycle3b9536d2014-07-09 22:05:24 +05306197 vos_mem_copy(vosDataBuff, &pTLCb->atlSTAClients[ucSTAId]->interfaceStats,
6198 sizeof(WLANTL_InterfaceStatsType));
6199 return VOS_STATUS_SUCCESS;
6200}
6201
Srinivas Dasari98947432014-11-07 19:41:24 +05306202/*==========================================================================
6203
6204 FUNCTION WLANTL_ClearInterfaceStats
6205
6206 DESCRIPTION
6207 Utility function used by TL to clear the statitics
6208
6209 DEPENDENCIES
6210
6211
6212 PARAMETERS
6213
6214 IN
6215
6216 ucSTAId: station for which the statistics need to collected
6217
6218 RETURN VALUE
6219 The result code associated with performing the operation
6220
6221 VOS_STATUS_E_INVAL: Input parameters are invalid
6222 VOS_STATUS_SUCCESS: Everything is good :)
6223
6224 SIDE EFFECTS
6225
6226============================================================================*/
6227VOS_STATUS
6228WLANTL_ClearInterfaceStats
6229(
6230 v_PVOID_t pvosGCtx,
6231 v_U8_t ucSTAId,
6232 v_U8_t statsClearReqMask
6233)
6234{
6235 WLANTL_CbType* pTLCb = NULL;
6236 WLANTL_STAClientType* pClientSTA = NULL;
6237 /*------------------------------------------------------------------------
6238 Sanity check
6239 ------------------------------------------------------------------------*/
6240 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
6241 {
6242 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6243 "WLAN TL:Invalid station id requested on WLANTL_CollectStats"));
6244 return VOS_STATUS_E_FAULT;
6245 }
6246 /*------------------------------------------------------------------------
6247 Extract TL control block
6248 ------------------------------------------------------------------------*/
6249 pTLCb = VOS_GET_TL_CB(pvosGCtx);
6250 if ( NULL == pTLCb )
6251 {
6252 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6253 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_CollectStats"));
6254 return VOS_STATUS_E_FAULT;
6255 }
6256
6257 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
6258 if ( NULL == pClientSTA )
6259 {
6260 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6261 "WLAN TL:Client Memory was not allocated on %s", __func__));
6262 return VOS_STATUS_E_FAILURE;
6263 }
6264
6265 if ((statsClearReqMask & WIFI_STATS_IFACE_AC) ||
6266 (statsClearReqMask & WIFI_STATS_IFACE)) {
6267 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6268 "WLAN TL:cleared WIFI_STATS_IFACE_AC results"));
6269 pClientSTA->interfaceStats.accessCategoryStats[0].rxMcast = 0;
6270 pClientSTA->interfaceStats.accessCategoryStats[1].rxMcast = 0;
6271 pClientSTA->interfaceStats.accessCategoryStats[2].rxMcast = 0;
6272 pClientSTA->interfaceStats.accessCategoryStats[3].rxMcast = 0;
6273
6274 pClientSTA->interfaceStats.accessCategoryStats[0].rxMpdu = 0;
6275 pClientSTA->interfaceStats.accessCategoryStats[1].rxMpdu = 0;
6276 pClientSTA->interfaceStats.accessCategoryStats[2].rxMpdu = 0;
6277 pClientSTA->interfaceStats.accessCategoryStats[3].rxMpdu = 0;
6278
6279 pClientSTA->interfaceStats.accessCategoryStats[0].rxAmpdu = 0;
6280 pClientSTA->interfaceStats.accessCategoryStats[1].rxAmpdu = 0;
6281 pClientSTA->interfaceStats.accessCategoryStats[2].rxAmpdu = 0;
6282 pClientSTA->interfaceStats.accessCategoryStats[3].rxAmpdu = 0;
6283 }
6284
6285 if (statsClearReqMask & WIFI_STATS_IFACE) {
6286 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6287 "WLAN TL:cleared WIFI_STATS_IFACE results"));
6288 pClientSTA->interfaceStats.mgmtRx = 0;
6289 pClientSTA->interfaceStats.rssiData = 0;
6290 return VOS_STATUS_SUCCESS;
6291 }
6292
6293 return VOS_STATUS_SUCCESS;
6294}
6295
Dino Mycle3b9536d2014-07-09 22:05:24 +05306296#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
Jeff Johnson295189b2012-06-20 16:38:30 -07006297
6298/*==========================================================================
6299
6300 FUNCTION WLANTL_RxCachedFrames
6301
6302 DESCRIPTION
6303 Utility function used by TL to forward the cached frames to a particular
6304 station;
6305
6306 DEPENDENCIES
6307 TL must be initiailized before this function gets called.
6308 If the frame carried is a data frame then the station for which it is
6309 destined to must have been previously registered with TL.
6310
6311 PARAMETERS
6312
6313 IN
6314 pTLCb: pointer to TL handle
6315
6316 ucSTAId: station for which we need to forward the packets
6317
6318 vosDataBuff: it will contain a pointer to the first cached buffer
6319 received, if there is more then one packet they will be
6320 chained using vOSS buffers.
6321
6322 RETURN VALUE
6323 The result code associated with performing the operation
6324
6325 VOS_STATUS_E_INVAL: Input parameters are invalid
6326 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
6327 page fault
6328 VOS_STATUS_SUCCESS: Everything is good :)
6329
6330 SIDE EFFECTS
6331
6332============================================================================*/
6333VOS_STATUS
6334WLANTL_RxCachedFrames
6335(
6336 WLANTL_CbType* pTLCb,
6337 v_U8_t ucSTAId,
6338 vos_pkt_t* vosDataBuff
6339)
6340{
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306341 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006342 WLANTL_STAFuncType pfnSTAFsm;
6343 vos_pkt_t* vosTempBuff;
6344 VOS_STATUS vosStatus;
6345 v_PVOID_t pvBDHeader = NULL;
6346 WLANTL_STAEventType wSTAEvent = WLANTL_RX_EVENT;
6347 v_U8_t ucTid = 0;
6348 v_BOOL_t broadcast = VOS_FALSE;
6349 v_BOOL_t bSigMatch = VOS_FALSE;
6350 v_BOOL_t selfBcastLoopback = VOS_FALSE;
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -07006351 static v_U8_t first_data_pkt_arrived;
Jeff Johnson295189b2012-06-20 16:38:30 -07006352 v_U32_t uDPUSig;
6353 v_U8_t ucUcastSig;
6354 v_U8_t ucBcastSig;
6355 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
6356
6357 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6358 "WLAN TL:TL Receive Cached Frames called"));
6359
6360 /*------------------------------------------------------------------------
6361 Sanity check
6362 ------------------------------------------------------------------------*/
6363 if ( NULL == vosDataBuff )
6364 {
6365 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6366 "WLAN TL:Invalid parameter sent on WLANTL_RxFrames"));
6367 return VOS_STATUS_E_INVAL;
6368 }
6369
Mihir Sheteae6f02b2014-04-11 19:49:21 +05306370 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
6371
6372 if ( NULL == pClientSTA )
6373 {
6374 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6375 "WLAN TL:Client Memory was not allocated on %s", __func__));
6376 return VOS_STATUS_E_FAILURE;
6377 }
6378
6379 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_FORWARD_CACHED_FRAMES,
6380 ucSTAId, 1<<16 | pClientSTA->tlCacheInfo.cacheSize));
6381
Jeff Johnson295189b2012-06-20 16:38:30 -07006382 /*---------------------------------------------------------------------
6383 Save the initial buffer - this is the first received buffer
6384 ---------------------------------------------------------------------*/
6385 vosTempBuff = vosDataBuff;
6386
6387 while ( NULL != vosTempBuff )
6388 {
Madan Mohan Koyyalamudia148e1e2012-11-30 14:52:59 -08006389 broadcast = VOS_FALSE;
6390 selfBcastLoopback = VOS_FALSE;
6391
Jeff Johnson295189b2012-06-20 16:38:30 -07006392 vos_pkt_walk_packet_chain( vosDataBuff, &vosDataBuff, 1/*true*/ );
6393
6394 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6395 "WLAN TL:Sending new cached packet to station %d", ucSTAId));
6396 /*---------------------------------------------------------------------
6397 Peek at BD header - do not remove
6398 !!! Optimize me: only part of header is needed; not entire one
6399 ---------------------------------------------------------------------*/
6400 vosStatus = WDA_DS_PeekRxPacketInfo( vosTempBuff, (v_PVOID_t)&pvBDHeader, 0 );
6401
6402 if ( NULL == pvBDHeader )
6403 {
6404 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6405 "WLAN TL:Cannot extract BD header"));
6406 /* Drop packet */
6407 vos_pkt_return_packet(vosTempBuff);
6408 vosTempBuff = vosDataBuff;
6409 continue;
6410 }
6411
6412 uDPUSig = WDA_GET_RX_DPUSIG( pvBDHeader );
6413
6414 /* AMSDU HW bug fix
6415 * After 2nd AMSDU subframe HW could not handle BD correctly
6416 * HAL workaround is needed */
6417 if(WDA_GET_RX_ASF(pvBDHeader))
6418 {
6419 WDA_DS_RxAmsduBdFix(vos_get_global_context(VOS_MODULE_ID_TL,pTLCb),
6420 pvBDHeader);
6421 }
6422
6423 ucTid = (v_U8_t)WDA_GET_RX_TID( pvBDHeader );
6424
6425 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6426 "WLAN TL:Data packet cached for STA %d", ucSTAId);
6427
6428 /*------------------------------------------------------------------
6429 This should be corrected when multipe sta support is added !!!
6430 for now bcast frames will be sent to the last registered STA
6431 ------------------------------------------------------------------*/
6432 if ( WDA_IS_RX_BCAST(pvBDHeader))
6433 {
6434 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6435 "WLAN TL:TL rx Bcast frame "));
6436 broadcast = VOS_TRUE;
6437
6438 /* If Addr1 is b/mcast, but Addr3 is our own self MAC, it is a b/mcast
6439 * pkt we sent looping back to us. To be dropped if we are non BTAMP
6440 */
6441 if( WLANHAL_RX_BD_ADDR3_SELF_IDX ==
6442 (v_U8_t)WDA_GET_RX_ADDR3_IDX( pvBDHeader ))
6443 {
6444 selfBcastLoopback = VOS_TRUE;
6445 }
6446 }/*if bcast*/
6447
6448 /*-------------------------------------------------------------------------
6449 Check if the packet that we cached matches the DPU signature of the
6450 newly added station
6451 -------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306452 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
6453
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306454 if ( NULL == pClientSTA )
6455 {
6456 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6457 "WLAN TL:Client Memory was not allocated on %s", __func__));
6458 return VOS_STATUS_E_FAILURE;
6459 }
6460
Jeff Johnson295189b2012-06-20 16:38:30 -07006461 if ( broadcast )
6462 {
6463 ucBcastSig = (v_U8_t)uDPUSig;
6464 bSigMatch = (( WLAN_TL_INVALID_B_SIG !=
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306465 pClientSTA->wSTADesc.ucBcastSig ) &&
6466 ( ucBcastSig == pClientSTA->wSTADesc.ucBcastSig ));
Jeff Johnson295189b2012-06-20 16:38:30 -07006467 }
6468 else
6469 {
6470 ucUcastSig = (v_U8_t)uDPUSig;
6471 bSigMatch = (( WLAN_TL_INVALID_U_SIG !=
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306472 pClientSTA->wSTADesc.ucUcastSig ) &&
6473 ( ucUcastSig == pClientSTA->wSTADesc.ucUcastSig ));
Jeff Johnson295189b2012-06-20 16:38:30 -07006474 }
6475
6476 /*-------------------------------------------------------------------------
6477 If the packet doesn't match - drop it
6478 -------------------------------------------------------------------------*/
6479 if ( !bSigMatch )
6480 {
Rajesh Chauhana6b08f42013-06-18 19:01:26 -07006481 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_MED,
Jeff Johnson295189b2012-06-20 16:38:30 -07006482 "WLAN TL: Cached packet does not match DPU Sig of the new STA - drop "
6483 " DPU Sig %d UC %d BC %d B %d",
6484 uDPUSig,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306485 pClientSTA->wSTADesc.ucUcastSig,
Rajesh Chauhana6b08f42013-06-18 19:01:26 -07006486 pClientSTA->wSTADesc.ucBcastSig,
Jeff Johnson295189b2012-06-20 16:38:30 -07006487 broadcast));
6488
6489 /* Drop packet */
6490 vos_pkt_return_packet(vosTempBuff);
6491 vosTempBuff = vosDataBuff;
6492 continue;
6493
6494 }/*if signature mismatch*/
6495
6496 /*------------------------------------------------------------------------
6497 Check if BT-AMP frame:
6498 - additional processing needed in this case to separate BT-AMP date
6499 from BT-AMP Ctrl path
6500 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306501 if ( WLAN_STA_BT_AMP == pClientSTA->wSTADesc.wSTAType )
Jeff Johnson295189b2012-06-20 16:38:30 -07006502 {
6503 /*--------------------------------------------------------------------
6504 Process the ctrl BAP frame; if data it will return false and it
6505 will be routed through the regular data path
6506 --------------------------------------------------------------------*/
6507 if ( WLANTL_ProcessBAPFrame( pvBDHeader,
6508 vosTempBuff,
6509 pTLCb,
6510 &first_data_pkt_arrived,
6511 ucSTAId))
6512 {
6513 vosTempBuff = vosDataBuff;
6514 continue;
6515 }
6516 }/*if BT-AMP station*/
6517 else if(selfBcastLoopback == VOS_TRUE)
6518 {
6519 /* Drop packet */
6520 vos_pkt_return_packet(vosTempBuff);
6521 vosTempBuff = vosDataBuff;
6522 continue;
6523 }
6524
6525 /*---------------------------------------------------------------------
6526 Data packet received, send to state machine
6527 ---------------------------------------------------------------------*/
6528 wSTAEvent = WLANTL_RX_EVENT;
6529
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306530 pfnSTAFsm = tlSTAFsm[pClientSTA->tlState].
Jeff Johnson295189b2012-06-20 16:38:30 -07006531 pfnSTATbl[wSTAEvent];
6532
6533 if ( NULL != pfnSTAFsm )
6534 {
6535#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
6536 /* Read RSSI and update */
6537 vosStatus = WLANTL_HSHandleRXFrame(vos_get_global_context(
6538 VOS_MODULE_ID_TL,pTLCb),
6539 WLANTL_DATA_FRAME_TYPE,
6540 pvBDHeader,
6541 ucSTAId,
6542 broadcast,
6543 vosTempBuff);
6544 broadcast = VOS_FALSE;
6545#else
6546 vosStatus = WLANTL_ReadRSSI(vos_get_global_context(VOS_MODULE_ID_TL,pTLCb), pvBDHeader, ucSTAId);
Kiet Lam47325522014-03-10 11:50:46 -07006547#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07006548 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
6549 {
6550 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6551 "Handle RX Data Frame fail within Handoff support module"));
6552 /* Do Not Drop packet at here
6553 * Revisit why HO module return fail
6554 vos_pkt_return_packet(vosTempBuff);
6555 vosTempBuff = vosDataBuff;
6556 continue;
6557 */
6558 }
6559 pfnSTAFsm( vos_get_global_context(VOS_MODULE_ID_TL,pTLCb), ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07006560 &vosTempBuff, VOS_FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07006561 }
6562 else
6563 {
6564 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6565 "WLAN TL:NULL state function, STA:%d, State: %d- dropping packet",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306566 ucSTAId, pClientSTA->tlState));
Jeff Johnson295189b2012-06-20 16:38:30 -07006567 /* Drop packet */
6568 vos_pkt_return_packet(vosTempBuff);
6569 vosTempBuff = vosDataBuff;
6570 continue;
6571 }
6572
6573 vosTempBuff = vosDataBuff;
6574 }/*while chain*/
6575
6576 return VOS_STATUS_SUCCESS;
6577}/* WLANTL_RxCachedFrames */
6578
6579/*==========================================================================
Katya Nigam664f5032014-05-05 12:24:32 +05306580 FUNCTION WLANTL_RxProcessMsg
6581
6582 DESCRIPTION
6583 Called by VOSS when a message was serialized for TL through the
6584 rx thread/task.
6585
6586 DEPENDENCIES
6587 The TL must be initialized before this function can be called.
6588
6589 PARAMETERS
6590
6591 IN
6592 pvosGCtx: pointer to the global vos context; a handle to TL's
6593 control block can be extracted from its context
6594 message: type and content of the message
6595
6596
6597 RETURN VALUE
6598 The result code associated with performing the operation
6599
6600 VOS_STATUS_E_INVAL: invalid input parameters
6601 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
6602 page fault
6603 VOS_STATUS_SUCCESS: Everything is good :)
6604
6605 Other values can be returned as a result of a function call, please check
6606 corresponding API for more info.
6607 SIDE EFFECTS
6608
6609============================================================================*/
6610VOS_STATUS
6611WLANTL_RxProcessMsg
6612(
6613 v_PVOID_t pvosGCtx,
6614 vos_msg_t* message
6615)
6616{
6617 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6618 v_U32_t uData;
6619 v_U8_t ucSTAId;
6620 v_U8_t ucUcastSig;
6621 v_U8_t ucBcastSig;
6622
6623 /*------------------------------------------------------------------------
6624 Sanity check
6625 ------------------------------------------------------------------------*/
6626 if ( NULL == message )
6627 {
6628 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6629 "WLAN TL:Invalid parameter sent on WLANTL_RxProcessMessage"));
6630 return VOS_STATUS_E_INVAL;
6631 }
6632
6633 /*------------------------------------------------------------------------
6634 Process message
6635 ------------------------------------------------------------------------*/
6636 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6637 "WLAN TL:Received message: %d through rx flow", message->type));
6638
6639 switch( message->type )
6640 {
6641
6642 case WLANTL_RX_FWD_CACHED:
6643 /*---------------------------------------------------------------------
6644 The data sent with the message has the following structure:
6645 | 00 | ucBcastSignature | ucUcastSignature | ucSTAID |
6646 each field above is one byte
6647 ---------------------------------------------------------------------*/
6648 uData = message->bodyval;
6649 ucSTAId = ( uData & 0x000000FF);
6650 ucUcastSig = ( uData & 0x0000FF00)>>8;
6651 ucBcastSig = (v_U8_t)(( uData & 0x00FF0000)>>16);
6652 vosStatus = WLANTL_ForwardSTAFrames( pvosGCtx, ucSTAId,
6653 ucUcastSig, ucBcastSig);
6654 break;
6655
6656 default:
6657 /*no processing for now*/
6658 break;
6659 }
6660
6661 return VOS_STATUS_SUCCESS;
6662}
6663
6664
6665/*==========================================================================
Jeff Johnson295189b2012-06-20 16:38:30 -07006666 FUNCTION WLANTL_ResourceCB
6667
6668 DESCRIPTION
6669 Called by the TL when it has packets available for transmission.
6670
6671 DEPENDENCIES
6672 The TL must be registered with BAL before this function can be called.
6673
6674 PARAMETERS
6675
6676 IN
6677 pvosGCtx: pointer to the global vos context; a handle to TL's
6678 or BAL's control block can be extracted from its context
6679
6680 RETURN VALUE
6681 The result code associated with performing the operation
6682
6683 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
6684 page fault
6685 VOS_STATUS_SUCCESS: Everything is good :)
6686
6687 SIDE EFFECTS
6688
6689============================================================================*/
6690VOS_STATUS
6691WLANTL_ResourceCB
6692(
6693 v_PVOID_t pvosGCtx,
6694 v_U32_t uCount
6695)
6696{
6697 WLANTL_CbType* pTLCb = NULL;
6698 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
6699
6700 /*------------------------------------------------------------------------
6701 Sanity check
6702 Extract TL control block
6703 ------------------------------------------------------------------------*/
6704 pTLCb = VOS_GET_TL_CB(pvosGCtx);
6705 if ( NULL == pTLCb )
6706 {
6707 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6708 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
6709 return VOS_STATUS_E_FAULT;
6710 }
6711
6712 pTLCb->uResCount = uCount;
6713
6714
6715 /*-----------------------------------------------------------------------
6716 Resume Tx if enough res and not suspended
6717 -----------------------------------------------------------------------*/
6718 if (( pTLCb->uResCount >= WDA_TLI_MIN_RES_MF ) &&
6719 ( 0 == pTLCb->ucTxSuspended ))
6720 {
6721 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6722 "WLAN TL:Issuing Xmit start request to BAL for avail res ASYNC"));
6723 return WDA_DS_StartXmit(pvosGCtx);
6724 }
6725
6726 return VOS_STATUS_SUCCESS;
6727}/* WLANTL_ResourceCB */
6728
6729
Gopichand Nakkala11acd112012-12-31 16:04:04 -08006730/*==========================================================================
6731 FUNCTION WLANTL_IsTxXmitPending
6732
6733 DESCRIPTION
6734 Called by the WDA when it wants to know whether WDA_DS_TX_START_XMIT msg
6735 is pending in TL msg queue
6736
6737 DEPENDENCIES
6738 The TL must be registered with WDA before this function can be called.
6739
6740 PARAMETERS
6741
6742 IN
6743 pvosGCtx: pointer to the global vos context; a handle to TL's
6744 or WDA's control block can be extracted from its context
6745
6746 RETURN VALUE
6747 The result code associated with performing the operation
6748
6749 0: No WDA_DS_TX_START_XMIT msg pending
6750 1: Msg WDA_DS_TX_START_XMIT already pending in TL msg queue
6751
6752 SIDE EFFECTS
6753
6754============================================================================*/
6755v_BOOL_t
6756WLANTL_IsTxXmitPending
6757(
6758 v_PVOID_t pvosGCtx
6759)
6760{
6761
6762 WLANTL_CbType* pTLCb = NULL;
6763 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
6764
6765 /*------------------------------------------------------------------------
6766 Sanity check
6767 Extract TL control block
6768 ------------------------------------------------------------------------*/
6769 pTLCb = VOS_GET_TL_CB(pvosGCtx);
6770 if ( NULL == pTLCb )
6771 {
6772 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
6773 "WLAN TL:Invalid TL pointer from pvosGCtx in WLANTL_IsTxXmitPending "));
6774 return FALSE;
6775 }
6776
6777 return pTLCb->isTxTranmitMsgPending;
6778
6779}/*WLANTL_IsTxXmitPending */
6780
6781/*==========================================================================
6782 FUNCTION WLANTL_SetTxXmitPending
6783
6784 DESCRIPTION
6785 Called by the WDA when it wants to indicate that WDA_DS_TX_START_XMIT msg
6786 is pending in TL msg queue
6787
6788 DEPENDENCIES
6789 The TL must be registered with WDA before this function can be called.
6790
6791 PARAMETERS
6792
6793 IN
6794 pvosGCtx: pointer to the global vos context; a handle to TL's
6795 or WDA's control block can be extracted from its context
6796
6797 RETURN VALUE None
6798
6799 SIDE EFFECTS
6800
6801============================================================================*/
6802
6803v_VOID_t
6804WLANTL_SetTxXmitPending
6805(
6806 v_PVOID_t pvosGCtx
6807)
6808{
6809
6810 WLANTL_CbType* pTLCb = NULL;
6811 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
6812
6813 /*------------------------------------------------------------------------
6814 Sanity check
6815 Extract TL control block
6816 ------------------------------------------------------------------------*/
6817 pTLCb = VOS_GET_TL_CB(pvosGCtx);
6818 if ( NULL == pTLCb )
6819 {
6820 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
6821 "WLAN TL:Invalid TL pointer from pvosGCtx in WLANTL_SetTxXmitPending"));
6822 return;
6823 }
6824
6825 pTLCb->isTxTranmitMsgPending = 1;
6826 return;
6827
6828}/*WLANTL_SetTxXmitPending */
6829
6830/*==========================================================================
6831 FUNCTION WLANTL_ClearTxXmitPending
6832
6833 DESCRIPTION
6834 Called by the WDA when it wants to indicate that no WDA_DS_TX_START_XMIT msg
6835 is pending in TL msg queue
6836
6837 DEPENDENCIES
6838 The TL must be registered with WDA before this function can be called.
6839
6840 PARAMETERS
6841
6842 IN
6843 pvosGCtx: pointer to the global vos context; a handle to TL's
6844 or WDA's control block can be extracted from its context
6845
6846 RETURN VALUE None
6847
6848 SIDE EFFECTS
6849
6850============================================================================*/
6851
6852v_VOID_t
6853WLANTL_ClearTxXmitPending
6854(
6855 v_PVOID_t pvosGCtx
6856)
6857{
6858
6859 WLANTL_CbType* pTLCb = NULL;
6860 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
6861
6862 /*------------------------------------------------------------------------
6863 Sanity check
6864 Extract TL control block
6865 ------------------------------------------------------------------------*/
6866 pTLCb = VOS_GET_TL_CB(pvosGCtx);
6867 if ( NULL == pTLCb )
6868 {
6869 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
6870 "WLAN TL:Invalid TL pointer from pvosGCtx in WLANTL_ClearTxXmitPending "));
6871 return;
6872 }
6873
6874 pTLCb->isTxTranmitMsgPending = 0;
6875 return;
6876}/*WLANTL_ClearTxXmitPending */
6877
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05306878/*==========================================================================
6879 FUNCTION WLANTL_TxThreadDebugHandler
6880
6881 DESCRIPTION
6882 Printing TL Snapshot dump, processed under TxThread context, currently
6883 information regarding the global TlCb struture. Dumps information related
6884 to per active STA connection currently in use by TL.
6885
6886 DEPENDENCIES
6887 The TL must be initialized before this gets called.
6888
6889 PARAMETERS
6890
6891 IN
6892 pvosGCtx: pointer to the global vos context; a handle to TL's
6893 or WDA's control block can be extracted from its context
6894
6895 RETURN VALUE None
6896
6897 SIDE EFFECTS
6898
6899============================================================================*/
6900
6901v_VOID_t
6902WLANTL_TxThreadDebugHandler
6903(
6904 v_PVOID_t *pVosContext
6905)
6906{
6907 WLANTL_CbType* pTLCb = NULL;
6908 WLANTL_STAClientType* pClientSTA = NULL;
6909 int i = 0;
6910 tWDA_CbContext *pWDA = NULL;
6911
6912 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
6913 "WLAN TL: %s Enter ", __func__));
6914
6915 pTLCb = VOS_GET_TL_CB(pVosContext);
6916 pWDA = (tWDA_CbContext *)vos_get_global_context(VOS_MODULE_ID_WDA, pVosContext);
6917
6918 if ( NULL == pVosContext || NULL == pTLCb )
6919 {
6920 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6921 "Global VoS Context or TL Context are NULL"));
6922 return;
6923 }
6924
6925 if (NULL != pWDA)
6926 {
6927 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6928 "WDA uTxFlowMask: %d", pWDA->uTxFlowMask));
6929 }
6930 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6931 "************************TL DUMP INFORMATION**************"));
6932
6933 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6934 "uDelayedTriggerFrmInt:%d\tuMinFramesProcThres:%d",
6935 pTLCb->tlConfigInfo.uDelayedTriggerFrmInt,
6936 pTLCb->tlConfigInfo.uMinFramesProcThres));
6937
6938 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6939 "Management Frame Client exists: %d",
6940 pTLCb->tlMgmtFrmClient.ucExists));
6941 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6942 "usPendingTxCompleteCount: %d\tucTxSuspended: %d",
6943 pTLCb->usPendingTxCompleteCount,
6944 pTLCb->ucTxSuspended));
6945
6946 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6947 "uResCount: %d", pTLCb->uResCount));
6948
6949 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6950 "ucRegisteredStaId: %d\tucCurrentSTA: %d",
6951 pTLCb->ucRegisteredStaId, pTLCb->ucCurrentSTA));
6952
6953 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6954 "UrgentFrameProcessing: %s\tuFramesProcThres: %d",
6955 (pTLCb->bUrgent?"True":"False"), pTLCb->uFramesProcThres));
6956
6957 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6958 "isTxTranmitMsgPending: %d\t isBMPS: %s",
6959 pTLCb->isTxTranmitMsgPending, pTLCb->isBMPS?"True":"False"));
6960
6961#ifdef FEATURE_WLAN_TDLS
6962 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6963 "TDLS Peer Count: %d", pTLCb->ucTdlsPeerCount));
6964#endif
6965
6966 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6967 "++++++++++++++++++++Registerd Client Information++++++++++"));
6968
6969 for ( i =0; i<WLAN_MAX_STA_COUNT; i++ )
6970 {
6971 pClientSTA = pTLCb->atlSTAClients[i];
6972 if( NULL == pClientSTA || 0 == pClientSTA->ucExists)
6973 {
6974 continue;
6975 }
6976
6977 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6978 "######################STA Index: %d ############################",i));
6979 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "WLAN_STADescType:"));
6980 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6981 "STAId: %d\t STA MAC Address: %pM", pClientSTA->wSTADesc.ucSTAId,
6982 pClientSTA->wSTADesc.vSTAMACAddress.bytes));
6983 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6984 "STA Type: %d\tProtectedFrame: %d",
6985 pClientSTA->wSTADesc.wSTAType, pClientSTA->wSTADesc.ucProtectedFrame));
6986 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6987 "QoS: %d\tRxFrameTrans: %d\tTxFrameTrans: %d",
6988 pClientSTA->wSTADesc.ucQosEnabled, pClientSTA->wSTADesc.ucSwFrameRXXlation,
6989 pClientSTA->wSTADesc.ucSwFrameTXXlation));
6990 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6991 "ucUcastSig: %d\tucBcastSig: %d", pClientSTA->wSTADesc.ucUcastSig,
6992 pClientSTA->wSTADesc.ucBcastSig));
6993
6994 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6995 "ClientIndex: %d\t Exists: %d", i, pClientSTA->ucExists));
6996 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6997 "TL State: %d\t TL Priority: %d", pClientSTA->tlState,
6998 pClientSTA->tlPri));
6999 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7000 "ucTxSuspended: %d\tucPktPending: %d", pClientSTA->ucTxSuspended,
7001 pClientSTA->ucPktPending));
7002 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7003 "ucEAPOLPktPending: %d\tucNoMoreData: %d",
7004 pClientSTA->ucEapolPktPending, pClientSTA->ucNoMoreData));
7005 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Katya Nigam63902932014-06-26 19:04:23 +05307006 "enableCaching: %d\t fcStaTxDisabled: %d", pClientSTA->enableCaching,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307007 pClientSTA->fcStaTxDisabled));
7008 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7009 "ucCurrentAC: %d\tucServicedAC: %d", pClientSTA->ucCurrentAC,
7010 pClientSTA->ucServicedAC));
7011 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7012 "TID: %d\tautTxCount[0]: %d\tauRxCount[0]: %d",0, pClientSTA->auTxCount[0],
7013 pClientSTA->auRxCount[0]));
7014 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7015 "aucAcMask[0]: %d\taucAcMask[1]: %d\taucAcMask[2]: %d\taucAcMask[3]: %d\t",
7016 pClientSTA->aucACMask[0], pClientSTA->aucACMask[1],
7017 pClientSTA->aucACMask[2], pClientSTA->aucACMask[3]));
7018 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7019 "ucCurrentWeight: %d", pClientSTA->ucCurrentWeight));
7020
7021 if( WLAN_STA_SOFTAP == pClientSTA->wSTADesc.wSTAType)
7022 {
7023 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7024 "TrafficStatistics for SOFTAP Station:"));
7025 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7026 "RUF=%d\tRMF=%d\tRBF=%d", pClientSTA->trafficStatistics.rxUCFcnt,
7027 pClientSTA->trafficStatistics.rxMCFcnt,
7028 pClientSTA->trafficStatistics.rxBCFcnt));
7029 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7030 "RUB=%d\tRMB=%d\tRBB=%d", pClientSTA->trafficStatistics.rxUCBcnt,
7031 pClientSTA->trafficStatistics.rxMCBcnt,
7032 pClientSTA->trafficStatistics.rxBCBcnt));
7033 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7034 "TUF=%d\tTMF=%d\tTBF=%d", pClientSTA->trafficStatistics.txUCFcnt,
7035 pClientSTA->trafficStatistics.txMCFcnt,
7036 pClientSTA->trafficStatistics.txBCFcnt));
7037 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7038 "TUB=%d\tTMB=%d\tTBB=%d", pClientSTA->trafficStatistics.txUCBcnt,
7039 pClientSTA->trafficStatistics.txMCBcnt,
7040 pClientSTA->trafficStatistics.txBCBcnt));
7041 }
7042 }
7043 return;
7044}
7045
7046/*==========================================================================
Mihir Shetefd62d9d2014-08-06 15:08:21 +05307047 FUNCTION WLANTL_FatalErrorHandler
7048
7049 DESCRIPTION
7050 Handle Fatal errors detected on the TX path.
7051 Currently issues SSR to recover from the error.
7052
7053 DEPENDENCIES
7054 The TL must be initialized before this gets called.
7055
7056 PARAMETERS
7057
7058 IN
7059 pvosGCtx: pointer to the global vos context; a handle to TL's
7060 or WDA's control block can be extracted from its context
7061
7062 RETURN VALUE None
7063
7064 SIDE EFFECTS
7065
7066============================================================================*/
7067v_VOID_t
7068WLANTL_FatalErrorHandler
7069(
7070 v_PVOID_t *pVosContext
7071)
7072{
7073
7074 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
7075 "WLAN TL: %s Enter ", __func__));
7076
7077 if ( NULL == pVosContext )
7078 {
7079 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7080 "%s: Global VoS Context or TL Context are NULL",
7081 __func__));
7082 return;
7083 }
7084
7085 /*
7086 * Issue SSR. vos_wlanRestart has tight checks to make sure that
7087 * we do not send an FIQ if previous FIQ is not processed
7088 */
7089 vos_wlanRestart();
7090}
7091
7092/*==========================================================================
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307093 FUNCTION WLANTL_TLDebugMessage
7094
7095 DESCRIPTION
7096 Post a TL Snapshot request, posts message in TxThread.
7097
7098 DEPENDENCIES
7099 The TL must be initialized before this gets called.
7100
7101 PARAMETERS
7102
7103 IN
7104 displaySnapshot Boolean showing whether to dump the snapshot or not.
7105
7106 RETURN VALUE None
7107
7108 SIDE EFFECTS
7109
7110============================================================================*/
7111
7112v_VOID_t
7113WLANTL_TLDebugMessage
7114(
Mihir Shete327c2ab2014-11-13 15:17:02 +05307115 v_U32_t debugFlags
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307116)
7117{
7118 vos_msg_t vosMsg;
7119 VOS_STATUS status;
7120
Mihir Shete327c2ab2014-11-13 15:17:02 +05307121 if(debugFlags & WLANTL_DEBUG_TX_SNAPSHOT)
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307122 {
7123 vosMsg.reserved = 0;
7124 vosMsg.bodyptr = NULL;
7125 vosMsg.type = WLANTL_TX_SNAPSHOT;
7126
7127 status = vos_tx_mq_serialize( VOS_MODULE_ID_TL, &vosMsg);
7128 if(status != VOS_STATUS_SUCCESS)
7129 {
7130 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "TX Msg Posting Failed with status: %d",status));
7131 return;
7132 }
7133 }
Mihir Shete327c2ab2014-11-13 15:17:02 +05307134 if (debugFlags & WLANTL_DEBUG_FW_CLEANUP)
7135 {
7136 vosMsg.reserved = 0;
7137 vosMsg.bodyptr = NULL;
7138 vosMsg.type = WLANTL_TX_FW_DEBUG;
7139
7140 status = vos_tx_mq_serialize( VOS_MODULE_ID_TL, &vosMsg);
7141 if(status != VOS_STATUS_SUCCESS)
7142 {
7143 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "TX Msg Posting Failed with status: %d",status));
7144 return;
7145 }
7146 }
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307147 return;
7148}
Jeff Johnson295189b2012-06-20 16:38:30 -07007149
Mihir Shetefd62d9d2014-08-06 15:08:21 +05307150/*==========================================================================
7151 FUNCTION WLANTL_FatalError
7152
7153 DESCRIPTION
7154 Fatal error reported in TX path, post an event to TX Thread for further
7155 handling
7156
7157 DEPENDENCIES
7158 The TL must be initialized before this gets called.
7159
7160 PARAMETERS
7161
7162 VOID
7163
7164 RETURN VALUE None
7165
7166 SIDE EFFECTS
7167
7168============================================================================*/
7169
7170v_VOID_t
7171WLANTL_FatalError
7172(
7173 v_VOID_t
7174)
7175{
7176 vos_msg_t vosMsg;
7177 VOS_STATUS status;
7178
7179 vosMsg.reserved = 0;
7180 vosMsg.bodyptr = NULL;
7181 vosMsg.type = WLANTL_TX_FATAL_ERROR;
7182
7183 status = vos_tx_mq_serialize( VOS_MODULE_ID_TL, &vosMsg);
7184 if(status != VOS_STATUS_SUCCESS)
7185 {
7186 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7187 "%s: TX Msg Posting Failed with status: %d",
7188 __func__,status));
7189 }
7190 return;
7191}
Jeff Johnson295189b2012-06-20 16:38:30 -07007192/*============================================================================
7193 TL STATE MACHINE
7194============================================================================*/
7195
7196/*==========================================================================
7197 FUNCTION WLANTL_STATxConn
7198
7199 DESCRIPTION
7200 Transmit in connected state - only EAPOL and WAI packets allowed
7201
7202 DEPENDENCIES
7203 The STA must be registered with TL before this function can be called.
7204
7205 PARAMETERS
7206
7207 IN
7208 pvosGCtx: pointer to the global vos context; a handle to TL's
7209 control block can be extracted from its context
7210 ucSTAId: identifier of the station being processed
7211 vosDataBuff: pointer to the tx vos buffer
7212
7213 RETURN VALUE
7214 The result code associated with performing the operation
7215
7216 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
7217 page fault
7218 VOS_STATUS_SUCCESS: Everything is good :)
7219
7220 Other return values are possible coming from the called functions.
7221 Please check API for additional info.
7222
7223 SIDE EFFECTS
7224
7225============================================================================*/
7226VOS_STATUS
7227WLANTL_STATxConn
7228(
7229 v_PVOID_t pvosGCtx,
7230 v_U8_t ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07007231 vos_pkt_t** pvosDataBuff,
7232 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -07007233)
7234{
7235 v_U16_t usPktLen;
7236 VOS_STATUS vosStatus;
7237 v_MACADDR_t vDestMacAddr;
7238 vos_pkt_t* vosDataBuff = NULL;
7239 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307240 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007241 WLANTL_MetaInfoType tlMetaInfo;
7242 v_U8_t ucTypeSubtype = 0;
7243 v_U8_t ucTid;
7244 v_U8_t extraHeadSpace = 0;
7245 v_U8_t ucWDSEnabled = 0;
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007246 v_U8_t ucAC, ucACMask, i;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05307247 v_U32_t txFlag = HAL_TX_NO_ENCRYPTION_MASK;
Jeff Johnson295189b2012-06-20 16:38:30 -07007248 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
7249
7250 /*------------------------------------------------------------------------
7251 Sanity check
7252 Extract TL control block
7253 ------------------------------------------------------------------------*/
7254 pTLCb = VOS_GET_TL_CB(pvosGCtx);
7255 if ( NULL == pTLCb )
7256 {
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007257 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7258 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STATxConn");
Jeff Johnson295189b2012-06-20 16:38:30 -07007259 *pvosDataBuff = NULL;
7260 return VOS_STATUS_E_FAULT;
7261 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307262 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
7263
7264 if ( NULL == pClientSTA )
7265 {
7266 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7267 "WLAN TL:Client Memory was not allocated on %s", __func__));
7268 return VOS_STATUS_E_FAILURE;
7269 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007270
7271 /*-------------------------------------------------------------------
7272 Disable AC temporary - if successfull retrieve re-enable
7273 The order is justified because of the possible scenario
7274 - TL tryes to fetch packet for AC and it returns NULL
7275 - TL analyzes the data it has received to see if there are
7276 any more pkts available for AC -> if not TL will disable AC
7277 - however it is possible that while analyzing results TL got
7278 preempted by a pending indication where the mask was again set
7279 TL will not check again and as a result when it resumes
7280 execution it will disable AC
7281 To prevent this the AC will be disabled here and if retrieve
7282 is successfull it will be re-enabled
7283 -------------------------------------------------------------------*/
7284
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007285
7286 //LTI:pTLCb->atlSTAClients[ucSTAId].
7287 //LTI: aucACMask[pTLCb->atlSTAClients[ucSTAId].ucCurrentAC] = 0;
7288
7289 /*------------------------------------------------------------------------
7290 Fetch packet from HDD
7291 ------------------------------------------------------------------------*/
Sunil Ravid5406f22013-01-22 00:18:31 -08007292#ifdef FEATURE_WLAN_TDLS
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307293 if ((WLAN_STA_SOFTAP != pClientSTA->wSTADesc.wSTAType) &&
Agarwal Ashishcd86f7b2014-06-16 17:11:58 +05307294 !(vos_concurrent_open_sessions_running()) &&
Sunil Ravid5406f22013-01-22 00:18:31 -08007295 !pTLCb->ucTdlsPeerCount)
7296 {
7297#else
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307298 if ((WLAN_STA_SOFTAP != pClientSTA->wSTADesc.wSTAType) &&
Agarwal Ashishcd86f7b2014-06-16 17:11:58 +05307299 !(vos_concurrent_open_sessions_running()))
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007300 {
Sunil Ravid5406f22013-01-22 00:18:31 -08007301#endif
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307302 ucAC = pClientSTA->ucCurrentAC;
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007303
7304 /*-------------------------------------------------------------------
7305 Disable AC temporary - if successfull retrieve re-enable
7306 The order is justified because of the possible scenario
7307 - TL tryes to fetch packet for AC and it returns NULL
7308 - TL analyzes the data it has received to see if there are
7309 any more pkts available for AC -> if not TL will disable AC
7310 - however it is possible that while analyzing results TL got
7311 preempted by a pending indication where the mask was again set
7312 TL will not check again and as a result when it resumes
7313 execution it will disable AC
7314 To prevent this the AC will be disabled here and if retrieve
7315 is successfull it will be re-enabled
7316 -------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307317 pClientSTA->aucACMask[ucAC] = 0;
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007318 }
7319 else
7320 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307321 //softap case
7322 ucAC = pTLCb->uCurServedAC;
7323 pClientSTA->aucACMask[ucAC] = 0;
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007324 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007325
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307326 /*You make an initial assumption that HDD has no more data and if the
Jeff Johnson295189b2012-06-20 16:38:30 -07007327 assumption was wrong you reset the flags to their original state
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307328 This will prevent from exposing a race condition between checking with HDD
Jeff Johnson295189b2012-06-20 16:38:30 -07007329 for packets and setting the flags to false*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307330 //LTI: vos_atomic_set_U8( &pTLCb->atlSTAClients[ucSTAId].ucPktPending, 0);
7331 //LTI: pTLCb->atlSTAClients[ucSTAId].ucNoMoreData = 1;
7332 vos_atomic_set_U8( &pClientSTA->ucPktPending, 0);
7333 WLAN_TL_AC_ARRAY_2_MASK( pClientSTA, ucACMask, i);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307334 /*You make an initial assumption that HDD has no more data and if the
7335 assumption was wrong you reset the flags to their original state
7336 This will prevent from exposing a race condition between checking with HDD
7337 for packets and setting the flags to false*/
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007338 if ( 0 == ucACMask )
7339 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307340 pClientSTA->ucNoMoreData = 1;
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007341 }
7342 else
7343 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307344 vos_atomic_set_U8( &pClientSTA->ucPktPending, 1);
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007345 }
7346
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007347
Madan Mohan Koyyalamudid93f4942012-10-05 15:05:40 -07007348 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007349 "WLAN TL: WLANTL_STATxConn fetching packet from HDD for AC: %d AC Mask: %d Pkt Pending: %d",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307350 ucAC, ucACMask, pClientSTA->ucPktPending);
Jeff Johnson295189b2012-06-20 16:38:30 -07007351
7352 /*------------------------------------------------------------------------
7353 Fetch tx packet from HDD
7354 ------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007355
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307356 vosStatus = pClientSTA->pfnSTAFetchPkt( pvosGCtx,
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007357 &ucSTAId,
7358 ucAC,
7359 &vosDataBuff, &tlMetaInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07007360
7361 if (( VOS_STATUS_SUCCESS != vosStatus ) || ( NULL == vosDataBuff ))
7362 {
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007363 TLLOG1(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Jeff Johnson295189b2012-06-20 16:38:30 -07007364 "WLAN TL:No more data at HDD status %d", vosStatus));
7365 *pvosDataBuff = NULL;
7366
7367 /*--------------------------------------------------------------------
7368 Reset AC for the serviced station to the highest priority AC
7369 -> due to no more data at the station
7370 Even if this AC is not supported by the station, correction will be
7371 made in the main TL loop
7372 --------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307373 pClientSTA->ucCurrentAC = WLANTL_AC_VO;
7374 pClientSTA->ucCurrentWeight = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07007375
Madan Mohan Koyyalamudid8000342012-11-08 14:55:26 -08007376 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007377 "WLAN TL: WLANTL_STATxConn no more packets in HDD for AC: %d AC Mask: %d",
7378 ucAC, ucACMask);
7379
Jeff Johnson295189b2012-06-20 16:38:30 -07007380 return vosStatus;
7381 }
7382
7383 /*There are still packets in HDD - set back the pending packets and
7384 the no more data assumption*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307385 vos_atomic_set_U8( &pClientSTA->ucPktPending, 1);
7386 pClientSTA->ucNoMoreData = 0;
7387 pClientSTA->aucACMask[ucAC] = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07007388
Jeff Johnson295189b2012-06-20 16:38:30 -07007389#ifdef WLAN_PERF
7390 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAL,
7391 (v_PVOID_t)0);
7392
7393#endif /*WLAN_PERF*/
7394
7395
7396#ifdef FEATURE_WLAN_WAPI
7397 /*------------------------------------------------------------------------
7398 If the packet is neither an Eapol packet nor a WAI packet then drop it
7399 ------------------------------------------------------------------------*/
7400 if ( 0 == tlMetaInfo.ucIsEapol && 0 == tlMetaInfo.ucIsWai )
7401 {
Madan Mohan Koyyalamudid93f4942012-10-05 15:05:40 -07007402 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Jeff Johnson295189b2012-06-20 16:38:30 -07007403 "WLAN TL:Only EAPOL or WAI packets allowed before authentication"));
7404
7405 /* Fail tx for packet */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307406 pClientSTA->pfnSTATxComp( pvosGCtx, vosDataBuff,
Jeff Johnson295189b2012-06-20 16:38:30 -07007407 VOS_STATUS_E_BADMSG);
7408 vosDataBuff = NULL;
7409 *pvosDataBuff = NULL;
7410 return VOS_STATUS_SUCCESS;
7411 }
7412#else
7413 if ( 0 == tlMetaInfo.ucIsEapol )
7414 {
7415 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
7416 "WLAN TL:Received non EAPOL packet before authentication"));
7417
7418 /* Fail tx for packet */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307419 pClientSTA->pfnSTATxComp( pvosGCtx, vosDataBuff,
Jeff Johnson295189b2012-06-20 16:38:30 -07007420 VOS_STATUS_E_BADMSG);
7421 vosDataBuff = NULL;
7422 *pvosDataBuff = NULL;
7423 return VOS_STATUS_SUCCESS;
7424 }
7425#endif /* FEATURE_WLAN_WAPI */
7426
7427 /*-------------------------------------------------------------------------
7428 Check TID
7429 -------------------------------------------------------------------------*/
7430 ucTid = tlMetaInfo.ucTID;
7431
7432 /*Make sure TID is valid*/
7433 if ( WLANTL_TID_INVALID(ucTid))
7434 {
Rajesh Chauhan2df40bf2013-08-22 11:26:12 -07007435 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Jeff Johnson295189b2012-06-20 16:38:30 -07007436 "WLAN TL:Invalid TID sent in meta info %d - defaulting to 0 (BE)",
7437 ucTid));
7438 ucTid = 0;
7439 }
7440
7441 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
7442 "WLAN TL:Attaching BD header to pkt on WLANTL_STATxConn"));
7443
7444#ifdef FEATURE_WLAN_WAPI
7445 /*------------------------------------------------------------------------
7446 Translate 802.3 frame to 802.11 if Frame translation is enabled or if
7447 frame is a WAI frame.
7448 ------------------------------------------------------------------------*/
7449 if ( ( 1 == tlMetaInfo.ucIsWai ) ||
7450 ( 0 == tlMetaInfo.ucDisableFrmXtl ) )
7451#else
7452 /*------------------------------------------------------------------------
7453 Translate 802.3 frame to 802.11 if Frame translation is enabled
7454 ------------------------------------------------------------------------*/
7455 if ( ( 0 == tlMetaInfo.ucDisableFrmXtl ) &&
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307456 ( 0 != pClientSTA->wSTADesc.ucSwFrameTXXlation) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007457#endif //#ifdef FEATURE_WLAN_WAPI
7458 {
Kiran Venkatappacab0d352012-12-17 13:09:22 -08007459 vosStatus = WLANTL_Translate8023To80211Header( vosDataBuff, &vosStatus,
7460 pTLCb, &ucSTAId,
Ravi Joshid0699502013-07-08 15:48:47 -07007461 &tlMetaInfo, &ucWDSEnabled,
7462 &extraHeadSpace);
Jeff Johnson295189b2012-06-20 16:38:30 -07007463 if ( VOS_STATUS_SUCCESS != vosStatus )
7464 {
7465 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7466 "WLAN TL:Error when translating header WLANTL_STATxConn"));
7467
7468 return vosStatus;
7469 }
7470
7471 tlMetaInfo.ucDisableFrmXtl = 1;
7472 }
7473
7474 /*-------------------------------------------------------------------------
7475 Call HAL to fill BD header
7476 -------------------------------------------------------------------------*/
7477 ucTypeSubtype |= (WLANTL_80211_DATA_TYPE << 4);
7478
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307479 if ( pClientSTA->wSTADesc.ucQosEnabled )
Jeff Johnson295189b2012-06-20 16:38:30 -07007480 {
7481 ucTypeSubtype |= (WLANTL_80211_DATA_QOS_SUBTYPE);
7482 }
7483
Gopichand Nakkala8b54e912013-03-11 10:44:21 +05307484#ifdef FEATURE_WLAN_WAPI
7485 /* TL State does not transition to AUTHENTICATED till GTK is installed, So in
7486 * case of WPA where GTK handshake is done after the 4 way handshake, the
7487 * unicast 2/2 EAPOL packet from the STA->AP has to be encrypted even before
7488 * the TL is in authenticated state. Since the PTK has been installed
7489 * already (after the 4 way handshake) we make sure that all traffic
7490 * is encrypted henceforth.(Note: TL is still not in AUTHENTICATED state so
7491 * we will only allow EAPOL data or WAI in case of WAPI)
7492 */
7493 if (tlMetaInfo.ucIsEapol && pClientSTA->ptkInstalled)
7494 {
7495 txFlag = 0;
7496 }
7497#else
7498 if (pClientSTA->ptkInstalled)
7499 {
7500 txFlag = 0;
7501 }
7502#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007503
7504 vosStatus = (VOS_STATUS)WDA_DS_BuildTxPacketInfo( pvosGCtx, vosDataBuff , &vDestMacAddr,
7505 tlMetaInfo.ucDisableFrmXtl, &usPktLen,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307506 pClientSTA->wSTADesc.ucQosEnabled, ucWDSEnabled,
Jeff Johnson295189b2012-06-20 16:38:30 -07007507 extraHeadSpace,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307508 ucTypeSubtype, &pClientSTA->wSTADesc.vSelfMACAddress,
Gopichand Nakkala8b54e912013-03-11 10:44:21 +05307509 ucTid, txFlag,
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07007510 tlMetaInfo.usTimeStamp, tlMetaInfo.ucIsEapol || tlMetaInfo.ucIsWai, tlMetaInfo.ucUP );
Jeff Johnson295189b2012-06-20 16:38:30 -07007511
7512 if ( VOS_STATUS_SUCCESS != vosStatus )
7513 {
7514 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7515 "WLAN TL:Failed while attempting to fill BD %d", vosStatus));
7516 *pvosDataBuff = NULL;
7517 return vosStatus;
7518 }
7519
7520 /*-----------------------------------------------------------------------
7521 Update tx counter for BA session query for tx side
7522 !1 - should this be done for EAPOL frames?
7523 -----------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307524 pClientSTA->auTxCount[ucTid]++;
Jeff Johnson295189b2012-06-20 16:38:30 -07007525
7526 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307527 (v_PVOID_t)pClientSTA->pfnSTATxComp );
Jeff Johnson295189b2012-06-20 16:38:30 -07007528
7529 /*------------------------------------------------------------------------
7530 Save data to input pointer for TL core
7531 ------------------------------------------------------------------------*/
7532 *pvosDataBuff = vosDataBuff;
7533 /*security frames cannot be delayed*/
7534 pTLCb->bUrgent = TRUE;
7535
Jeff Johnson295189b2012-06-20 16:38:30 -07007536 /* TX Statistics */
7537 if (!(tlMetaInfo.ucBcast || tlMetaInfo.ucMcast))
7538 {
7539 /* This is TX UC frame */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307540 pClientSTA->trafficStatistics.txUCFcnt++;
7541 pClientSTA->trafficStatistics.txUCBcnt += usPktLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07007542 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007543
7544 return VOS_STATUS_SUCCESS;
7545}/* WLANTL_STATxConn */
7546
7547
7548/*==========================================================================
7549 FUNCTION WLANTL_STATxAuth
7550
7551 DESCRIPTION
7552 Transmit in authenticated state - all data allowed
7553
7554 DEPENDENCIES
7555 The STA must be registered with TL before this function can be called.
7556
7557 PARAMETERS
7558
7559 IN
7560 pvosGCtx: pointer to the global vos context; a handle to TL's
7561 control block can be extracted from its context
7562 ucSTAId: identifier of the station being processed
7563 vosDataBuff: pointer to the tx vos buffer
7564
7565 RETURN VALUE
7566 The result code associated with performing the operation
7567
7568 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
7569 page fault
7570 VOS_STATUS_SUCCESS: Everything is good :)
7571
7572 Other return values are possible coming from the called functions.
7573 Please check API for additional info.
7574
7575 SIDE EFFECTS
7576
7577============================================================================*/
7578VOS_STATUS
7579WLANTL_STATxAuth
7580(
7581 v_PVOID_t pvosGCtx,
7582 v_U8_t ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07007583 vos_pkt_t** pvosDataBuff,
7584 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -07007585)
7586{
7587 v_U16_t usPktLen;
7588 VOS_STATUS vosStatus;
7589 v_MACADDR_t vDestMacAddr;
7590 vos_pkt_t* vosDataBuff = NULL;
7591 WLANTL_CbType* pTLCb = NULL;
7592 WLANTL_MetaInfoType tlMetaInfo;
7593 v_U8_t ucTypeSubtype = 0;
7594 WLANTL_ACEnumType ucAC;
7595 WLANTL_ACEnumType ucNextAC;
7596 v_U8_t ucTid;
7597 v_U8_t ucSwFrmXtl = 0;
7598 v_U8_t extraHeadSpace = 0;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307599 WLANTL_STAClientType *pStaClient = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007600 v_U8_t ucWDSEnabled = 0;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05307601 v_U32_t ucTxFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07007602 v_U8_t ucACMask, i;
7603 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
7604
7605 /*------------------------------------------------------------------------
7606 Sanity check
7607 Extract TL control block
7608 ------------------------------------------------------------------------*/
7609 pTLCb = VOS_GET_TL_CB(pvosGCtx);
7610 if (( NULL == pTLCb ) || ( NULL == pvosDataBuff ))
7611 {
7612 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Jeff Johnson0298bd02013-11-14 19:58:38 -08007613 "WLAN TL:Invalid input params on WLANTL_STATxAuth TL %p DB %p",
Jeff Johnson295189b2012-06-20 16:38:30 -07007614 pTLCb, pvosDataBuff));
7615 if (NULL != pvosDataBuff)
7616 {
7617 *pvosDataBuff = NULL;
7618 }
7619 if(NULL != pTLCb)
7620 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307621 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
7622 {
7623 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7624 "WLAN TL:Client Memory was not allocated on %s", __func__));
7625 return VOS_STATUS_E_FAILURE;
7626 }
7627 pTLCb->atlSTAClients[ucSTAId]->ucNoMoreData = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07007628 }
7629 return VOS_STATUS_E_FAULT;
7630 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307631 pStaClient = pTLCb->atlSTAClients[ucSTAId];
Jeff Johnson295189b2012-06-20 16:38:30 -07007632
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307633 if ( NULL == pStaClient )
7634 {
7635 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7636 "WLAN TL:Client Memory was not allocated on %s", __func__));
7637 return VOS_STATUS_E_FAILURE;
7638 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007639
7640 vos_mem_zero(&tlMetaInfo, sizeof(tlMetaInfo));
7641 /*------------------------------------------------------------------------
7642 Fetch packet from HDD
7643 ------------------------------------------------------------------------*/
Sunil Ravid5406f22013-01-22 00:18:31 -08007644#ifdef FEATURE_WLAN_TDLS
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307645 if ((WLAN_STA_SOFTAP != pStaClient->wSTADesc.wSTAType) &&
Agarwal Ashishcd86f7b2014-06-16 17:11:58 +05307646 (!vos_concurrent_open_sessions_running()) &&
Sunil Ravid5406f22013-01-22 00:18:31 -08007647 !pTLCb->ucTdlsPeerCount)
7648 {
7649#else
Jeff Johnson295189b2012-06-20 16:38:30 -07007650 if ((WLAN_STA_SOFTAP != pStaClient->wSTADesc.wSTAType) &&
Agarwal Ashishcd86f7b2014-06-16 17:11:58 +05307651 (!vos_concurrent_open_sessions_running()))
Jeff Johnson295189b2012-06-20 16:38:30 -07007652 {
7653#endif
7654 ucAC = pStaClient->ucCurrentAC;
7655
7656 /*-------------------------------------------------------------------
7657 Disable AC temporary - if successfull retrieve re-enable
7658 The order is justified because of the possible scenario
7659 - TL tryes to fetch packet for AC and it returns NULL
7660 - TL analyzes the data it has received to see if there are
7661 any more pkts available for AC -> if not TL will disable AC
7662 - however it is possible that while analyzing results TL got
7663 preempted by a pending indication where the mask was again set
7664 TL will not check again and as a result when it resumes
7665 execution it will disable AC
7666 To prevent this the AC will be disabled here and if retrieve
7667 is successfull it will be re-enabled
7668 -------------------------------------------------------------------*/
7669 pStaClient->aucACMask[pStaClient->ucCurrentAC] = 0;
7670
7671 // don't reset it, as other AC queues in HDD may have packets
7672 //vos_atomic_set_U8( &pStaClient->ucPktPending, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007673 }
7674 else
7675 {
7676 //softap case
7677 ucAC = pTLCb->uCurServedAC;
7678 pStaClient->aucACMask[ucAC] = 0;
7679
7680 //vos_atomic_set_U8( &pStaClient->ucPktPending, 0);
7681 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007682
7683 WLAN_TL_AC_ARRAY_2_MASK( pStaClient, ucACMask, i);
Jeff Johnson295189b2012-06-20 16:38:30 -07007684 /*You make an initial assumption that HDD has no more data and if the
7685 assumption was wrong you reset the flags to their original state
7686 This will prevent from exposing a race condition between checking with HDD
7687 for packets and setting the flags to false*/
7688 if ( 0 == ucACMask )
7689 {
7690 vos_atomic_set_U8( &pStaClient->ucPktPending, 0);
7691 pStaClient->ucNoMoreData = 1;
7692 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007693
7694 vosStatus = pStaClient->pfnSTAFetchPkt( pvosGCtx,
7695 &ucSTAId,
7696 ucAC,
7697 &vosDataBuff, &tlMetaInfo );
7698
7699
7700 if (( VOS_STATUS_SUCCESS != vosStatus ) || ( NULL == vosDataBuff ))
7701 {
7702
7703 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
7704 "WLAN TL:Failed while attempting to fetch pkt from HDD %d",
7705 vosStatus);
7706 *pvosDataBuff = NULL;
7707 /*--------------------------------------------------------------------
7708 Reset AC for the serviced station to the highest priority AC
7709 -> due to no more data at the station
7710 Even if this AC is not supported by the station, correction will be
7711 made in the main TL loop
7712 --------------------------------------------------------------------*/
7713 pStaClient->ucCurrentAC = WLANTL_AC_VO;
7714 pStaClient->ucCurrentWeight = 0;
7715
7716 return vosStatus;
7717 }
7718
Jeff Johnsone7245742012-09-05 17:12:55 -07007719 WLANTL_StatHandleTXFrame(pvosGCtx, ucSTAId, vosDataBuff, NULL, &tlMetaInfo);
Jeff Johnsone7245742012-09-05 17:12:55 -07007720
Jeff Johnson295189b2012-06-20 16:38:30 -07007721 /*There are still packets in HDD - set back the pending packets and
7722 the no more data assumption*/
7723 vos_atomic_set_U8( &pStaClient->ucPktPending, 1);
7724 pStaClient->ucNoMoreData = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07007725
Jeff Johnson295189b2012-06-20 16:38:30 -07007726 if (WLAN_STA_SOFTAP != pStaClient->wSTADesc.wSTAType)
7727 {
Jeff Johnson295189b2012-06-20 16:38:30 -07007728 // don't need to set it, as we don't reset it in this function.
7729 //vos_atomic_set_U8( &pTLCb->atlSTAClients[ucSTAId].ucPktPending, 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07007730 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007731
7732#ifdef WLAN_PERF
7733 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAL,
7734 (v_PVOID_t)0);
7735#endif /*WLAN_PERF*/
7736
7737 /*-------------------------------------------------------------------------
7738 Check TID
7739 -------------------------------------------------------------------------*/
7740 ucTid = tlMetaInfo.ucTID;
7741
7742 /*Make sure TID is valid*/
7743 if ( WLANTL_TID_INVALID(ucTid))
7744 {
Rajesh Chauhan2df40bf2013-08-22 11:26:12 -07007745 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Jeff Johnson295189b2012-06-20 16:38:30 -07007746 "WLAN TL:Invalid TID sent in meta info %d - defaulting to 0 (BE)",
7747 ucTid));
7748 ucTid = 0;
7749 }
7750
7751 /*Save for UAPSD timer consideration*/
7752 pStaClient->ucServicedAC = ucAC;
7753
7754 if ( ucAC == pStaClient->ucCurrentAC )
7755 {
7756 pStaClient->aucACMask[pStaClient->ucCurrentAC] = 1;
7757 pStaClient->ucCurrentWeight--;
7758 }
7759 else
7760 {
7761 pStaClient->ucCurrentAC = ucAC;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307762 pStaClient->ucCurrentWeight = pTLCb->tlConfigInfo.ucAcWeights[ucAC] - 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07007763
7764 pStaClient->aucACMask[pStaClient->ucCurrentAC] = 1;
7765
7766 }
7767
Jeff Johnson295189b2012-06-20 16:38:30 -07007768 if (WLAN_STA_SOFTAP != pStaClient->wSTADesc.wSTAType)
7769 {
Jeff Johnson295189b2012-06-20 16:38:30 -07007770 if ( 0 == pStaClient->ucCurrentWeight )
7771 {
7772 WLANTL_ACEnumType tempAC = ucAC;
7773 /*-----------------------------------------------------------------------
7774 Choose next AC - !!! optimize me
7775 -----------------------------------------------------------------------*/
7776 while ( 0 != ucACMask )
7777 {
7778 ucNextAC = (WLANTL_ACEnumType)(( tempAC - 1 ) & WLANTL_MASK_AC);
7779 if ( 0 != pStaClient->aucACMask[ucNextAC] )
7780 {
7781 pStaClient->ucCurrentAC = ucNextAC;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307782 pStaClient->ucCurrentWeight = pTLCb->tlConfigInfo.ucAcWeights[ucNextAC];
Jeff Johnson295189b2012-06-20 16:38:30 -07007783
7784 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
7785 "WLAN TL: Changing serviced AC to: %d with Weight: %d",
7786 pStaClient->ucCurrentAC ,
7787 pStaClient->ucCurrentWeight));
7788 break;
7789 }
7790 tempAC = ucNextAC;
7791 }
7792 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007793 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007794
7795 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
7796 "WLAN TL:Attaching BD header to pkt on WLANTL_STATxAuth"));
7797
7798 /*------------------------------------------------------------------------
7799 Translate 802.3 frame to 802.11
7800 ------------------------------------------------------------------------*/
7801 if ( 0 == tlMetaInfo.ucDisableFrmXtl )
7802 {
7803 /* Needs frame translation */
7804 // if the client has not enabled SW-only frame translation
7805 // and if the frame is a unicast frame
7806 // (HW frame translation does not support multiple broadcast domains
7807 // so we use SW frame translation for broadcast/multicast frames)
7808#ifdef FEATURE_WLAN_WAPI
7809 // and if the frame is not a WAPI frame
7810#endif
7811 // then use HW_based frame translation
7812
7813 if ( ( 0 == pStaClient->wSTADesc.ucSwFrameTXXlation ) &&
7814 ( 0 == tlMetaInfo.ucBcast ) &&
7815 ( 0 == tlMetaInfo.ucMcast )
7816#ifdef FEATURE_WLAN_WAPI
7817 && ( tlMetaInfo.ucIsWai != 1 )
7818#endif
7819 )
7820 {
7821#ifdef WLAN_PERF
7822 v_U32_t uFastFwdOK = 0;
7823
7824 /* HW based translation. See if the frame could be fast forwarded */
7825 WDA_TLI_FastHwFwdDataFrame( pvosGCtx, vosDataBuff , &vosStatus,
7826 &uFastFwdOK, &tlMetaInfo, &pStaClient->wSTADesc);
7827
7828 if( VOS_STATUS_SUCCESS == vosStatus )
7829 {
7830 if(uFastFwdOK)
7831 {
7832 /* Packet could be fast forwarded now */
7833 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
7834 (v_PVOID_t)pStaClient->pfnSTATxComp );
7835
7836 *pvosDataBuff = vosDataBuff;
7837
7838 /* TODO: Do we really need to update WLANTL_HSHandleTXFrame()
7839 stats for every pkt? */
7840 pStaClient->auTxCount[tlMetaInfo.ucTID]++;
7841 return vosStatus;
7842 }
7843 /* can't be fast forwarded, fall through normal (slow) path. */
7844 }
7845 else
7846 {
7847
7848 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7849 "WLAN TL:Failed while attempting to fastFwd BD %d", vosStatus));
7850 *pvosDataBuff = NULL;
7851 return vosStatus;
7852 }
7853#endif /*WLAN_PERF*/
7854 }
7855 else
7856 {
7857 /* SW based translation */
7858
7859#ifdef FEATURE_WLAN_WAPI
7860 gUcIsWai = tlMetaInfo.ucIsWai,
7861#endif
7862
Kiran Venkatappacab0d352012-12-17 13:09:22 -08007863 vosStatus = WLANTL_Translate8023To80211Header( vosDataBuff, &vosStatus,
7864 pTLCb, &ucSTAId,
Ravi Joshid0699502013-07-08 15:48:47 -07007865 &tlMetaInfo, &ucWDSEnabled,
7866 &extraHeadSpace);
Jeff Johnson295189b2012-06-20 16:38:30 -07007867 if ( VOS_STATUS_SUCCESS != vosStatus )
7868 {
7869 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7870 "WLAN TL:Error when translating header WLANTL_STATxAuth"));
7871 return vosStatus;
7872 }
7873
7874 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
Arif Hussainf2b00992013-11-17 21:46:15 -08007875 "WLAN TL software translation success"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007876 ucSwFrmXtl = 1;
7877 tlMetaInfo.ucDisableFrmXtl = 1;
7878 }
7879 }
Gopichand Nakkala574f6d12013-06-27 19:38:43 +05307880#ifdef FEATURE_WLAN_TDLS
7881 /*In case of TDLS, if the packet is destined to TDLS STA ucSTAId may
7882 change. so update the pStaClient accordingly */
7883 pStaClient = pTLCb->atlSTAClients[ucSTAId];
Jeff Johnson295189b2012-06-20 16:38:30 -07007884
Gopichand Nakkala574f6d12013-06-27 19:38:43 +05307885 if ( NULL == pStaClient )
7886 {
7887 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7888 "pStaClient is NULL %s", __func__));
7889 return VOS_STATUS_E_FAILURE;
7890 }
7891#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007892 /*-------------------------------------------------------------------------
7893 Call HAL to fill BD header
7894 -------------------------------------------------------------------------*/
7895 ucTypeSubtype |= (WLANTL_80211_DATA_TYPE << 4);
7896
7897 if ( pStaClient->wSTADesc.ucQosEnabled )
7898 {
7899 ucTypeSubtype |= (WLANTL_80211_DATA_QOS_SUBTYPE);
7900 }
7901
7902 ucTxFlag = (0 != pStaClient->wUAPSDInfo[ucAC].ucSet)?
7903 HAL_TRIGGER_ENABLED_AC_MASK:0;
7904
7905#ifdef FEATURE_WLAN_WAPI
7906 if ( pStaClient->wSTADesc.ucIsWapiSta == 1 )
7907 {
7908#ifdef LIBRA_WAPI_SUPPORT
7909 ucTxFlag = ucTxFlag | HAL_WAPI_STA_MASK;
7910#endif //LIBRA_WAPI_SUPPORT
7911 if ( tlMetaInfo.ucIsWai == 1 )
7912 {
7913 ucTxFlag = ucTxFlag | HAL_TX_NO_ENCRYPTION_MASK;
7914 }
7915 }
7916#endif /* FEATURE_WLAN_WAPI */
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007917#ifdef FEATURE_WLAN_TDLS
7918 if ( pStaClient->wSTADesc.wSTAType == WLAN_STA_TDLS )
7919 {
7920 ucTxFlag = ucTxFlag | HAL_TDLS_PEER_STA_MASK;
7921 }
7922#endif /* FEATURE_WLAN_TDLS */
Abhishek Singhfa011222014-04-14 10:57:08 +05307923 if( tlMetaInfo.ucIsArp )
7924 {
7925 /*Send ARP at lowest Phy rate and through WQ5 */
7926 ucTxFlag |= HAL_USE_BD_RATE_MASK;
Abhishek Singhfa011222014-04-14 10:57:08 +05307927 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007928
7929 vosStatus = (VOS_STATUS)WDA_DS_BuildTxPacketInfo( pvosGCtx,
7930 vosDataBuff , &vDestMacAddr,
7931 tlMetaInfo.ucDisableFrmXtl, &usPktLen,
7932 pStaClient->wSTADesc.ucQosEnabled, ucWDSEnabled,
7933 extraHeadSpace,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307934 ucTypeSubtype, &pStaClient->wSTADesc.vSelfMACAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07007935 ucTid, ucTxFlag, tlMetaInfo.usTimeStamp,
7936 tlMetaInfo.ucIsEapol, tlMetaInfo.ucUP );
7937
7938 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
7939 {
7940 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7941 "Fill TX BD Error status %d", vosStatus));
7942
7943 return vosStatus;
7944 }
7945
Jeff Johnson295189b2012-06-20 16:38:30 -07007946 /* TX Statistics */
7947 if (!(tlMetaInfo.ucBcast || tlMetaInfo.ucMcast))
7948 {
7949 /* This is TX UC frame */
7950 pStaClient->trafficStatistics.txUCFcnt++;
7951 pStaClient->trafficStatistics.txUCBcnt += usPktLen;
7952 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007953
Kiran Venkatappacab0d352012-12-17 13:09:22 -08007954#ifndef FEATURE_WLAN_TDLS
Jeff Johnson295189b2012-06-20 16:38:30 -07007955 /*-----------------------------------------------------------------------
7956 Update tx counter for BA session query for tx side
7957 -----------------------------------------------------------------------*/
7958 pStaClient->auTxCount[ucTid]++;
Kiran Venkatappacab0d352012-12-17 13:09:22 -08007959#else
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307960 pTLCb->atlSTAClients[ucSTAId]->auTxCount[ucTid]++;
Kiran Venkatappacab0d352012-12-17 13:09:22 -08007961#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007962
7963 /* This code is to send traffic with lower priority AC when we does not
7964 get admitted to send it. Today HAL does not downgrade AC so this code
7965 does not get executed.(In other words, HAL doesnÂ’t change tid. The if
7966 statement is always false.)
7967 NOTE: In the case of LA downgrade occurs in HDD (that was the change
7968 Phani made during WMM-AC plugfest). If WM & BMP also took this approach,
7969 then there will be no need for any AC downgrade logic in TL/WDI. */
7970#if 0
7971 if (( ucTid != tlMetaInfo.ucTID ) &&
7972 ( 0 != pStaClient->wSTADesc.ucQosEnabled ) &&
7973 ( 0 != ucSwFrmXtl ))
7974 {
7975 /*---------------------------------------------------------------------
7976 !! FIX me: Once downgrading is clear put in the proper change
7977 ---------------------------------------------------------------------*/
7978 ucQCOffset = WLANHAL_TX_BD_HEADER_SIZE + WLANTL_802_11_HEADER_LEN;
7979
7980 //!!!Fix this replace peek with extract
7981 vos_pkt_peek_data( vosDataBuff, ucQCOffset,(v_PVOID_t)&pucQosCtrl,
7982 sizeof(*pucQosCtrl));
7983 *pucQosCtrl = ucTid; //? proper byte order
7984 }
7985#endif
7986
7987 if ( VOS_STATUS_SUCCESS != vosStatus )
7988 {
7989 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7990 "WLAN TL:Failed while attempting to fill BD %d", vosStatus));
7991 *pvosDataBuff = NULL;
7992 return vosStatus;
7993 }
7994
7995 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
7996 (v_PVOID_t)pStaClient->pfnSTATxComp );
7997
7998 *pvosDataBuff = vosDataBuff;
7999
8000 /*BE & BK can be delayed, VO and VI not frames cannot be delayed*/
8001 if ( pStaClient->ucServicedAC > WLANTL_AC_BE )
8002 {
8003 pTLCb->bUrgent= TRUE;
8004 }
8005
8006 return VOS_STATUS_SUCCESS;
8007}/* WLANTL_STATxAuth */
8008
8009/*==========================================================================
8010 FUNCTION WLANTL_STATxDisc
8011
8012 DESCRIPTION
8013 Transmit in disconnected state - no data allowed
8014
8015 DEPENDENCIES
8016 The STA must be registered with TL before this function can be called.
8017
8018 PARAMETERS
8019
8020 IN
8021 pvosGCtx: pointer to the global vos context; a handle to TL's
8022 control block can be extracted from its context
8023 ucSTAId: identifier of the station being processed
8024 vosDataBuff: pointer to the tx vos buffer
8025
8026 RETURN VALUE
8027 The result code associated with performing the operation
8028
8029 VOS_STATUS_SUCCESS: Everything is good :)
8030
8031 SIDE EFFECTS
8032
8033============================================================================*/
8034VOS_STATUS
8035WLANTL_STATxDisc
8036(
8037 v_PVOID_t pvosGCtx,
8038 v_U8_t ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008039 vos_pkt_t** pvosDataBuff,
8040 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -07008041)
8042{
8043 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308044 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07008045 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
8046
Jeff Johnson295189b2012-06-20 16:38:30 -07008047 /*------------------------------------------------------------------------
8048 Sanity check
8049 Extract TL control block
8050 ------------------------------------------------------------------------*/
8051 pTLCb = VOS_GET_TL_CB(pvosGCtx);
8052 if ( NULL == pTLCb )
8053 {
8054 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8055 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STATxAuth"));
8056 *pvosDataBuff = NULL;
8057 return VOS_STATUS_E_FAULT;
8058 }
8059
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308060 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
8061
8062 if ( NULL == pClientSTA )
8063 {
8064 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8065 "WLAN TL:Client Memory was not allocated on %s", __func__));
8066 return VOS_STATUS_E_FAILURE;
8067 }
8068
Jeff Johnson295189b2012-06-20 16:38:30 -07008069 /*------------------------------------------------------------------------
8070 Error
8071 ------------------------------------------------------------------------*/
8072 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8073 "WLAN TL:Packet should not be transmitted in state disconnected ignoring"
8074 " request"));
8075
8076 *pvosDataBuff = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308077 pClientSTA->ucNoMoreData = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07008078
8079 //Should not be anything pending in disconnect state
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308080 vos_atomic_set_U8( &pClientSTA->ucPktPending, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008081
8082 return VOS_STATUS_SUCCESS;
8083}/* WLANTL_STATxDisc */
8084
8085/*==========================================================================
8086 FUNCTION WLANTL_STARxConn
8087
8088 DESCRIPTION
8089 Receive in connected state - only EAPOL
8090
8091 DEPENDENCIES
8092 The STA must be registered with TL before this function can be called.
8093
8094 PARAMETERS
8095
8096 IN
8097 pvosGCtx: pointer to the global vos context; a handle to TL's
8098 control block can be extracted from its context
8099 ucSTAId: identifier of the station being processed
8100 vosDataBuff: pointer to the tx/rx vos buffer
8101
8102 RETURN VALUE
8103 The result code associated with performing the operation
8104
8105 VOS_STATUS_E_INVAL: invalid input parameters
8106 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
8107 page fault
8108 VOS_STATUS_SUCCESS: Everything is good :)
8109
8110 SIDE EFFECTS
8111
8112============================================================================*/
8113VOS_STATUS
8114WLANTL_STARxConn
8115(
8116 v_PVOID_t pvosGCtx,
8117 v_U8_t ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008118 vos_pkt_t** pvosDataBuff,
8119 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -07008120)
8121{
8122 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308123 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07008124 v_U16_t usEtherType = 0;
8125 v_U16_t usPktLen;
8126 v_U8_t ucMPDUHOffset;
8127 v_U16_t usMPDUDOffset;
8128 v_U16_t usMPDULen;
8129 v_U8_t ucMPDUHLen;
8130 v_U16_t usActualHLen = 0;
8131 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8132 vos_pkt_t* vosDataBuff;
8133 v_PVOID_t aucBDHeader;
8134 v_U8_t ucTid;
8135 WLANTL_RxMetaInfoType wRxMetaInfo;
8136 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
8137
8138 /*------------------------------------------------------------------------
8139 Sanity check
8140 ------------------------------------------------------------------------*/
8141 if (( NULL == pvosDataBuff ) || ( NULL == ( vosDataBuff = *pvosDataBuff )))
8142 {
8143 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8144 "WLAN TL:Invalid parameter sent on WLANTL_STARxConn"));
8145 return VOS_STATUS_E_INVAL;
8146 }
8147
8148 /*------------------------------------------------------------------------
8149 Extract TL control block
8150 ------------------------------------------------------------------------*/
8151 pTLCb = VOS_GET_TL_CB(pvosGCtx);
8152 if ( NULL == pTLCb )
8153 {
8154 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8155 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
8156 return VOS_STATUS_E_FAULT;
8157 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308158 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
8159
8160 if ( NULL == pClientSTA )
8161 {
8162 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8163 "WLAN TL:Client Memory was not allocated on %s", __func__));
8164 return VOS_STATUS_E_FAILURE;
8165 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008166
8167 /*------------------------------------------------------------------------
8168 Extract BD header and check if valid
8169 ------------------------------------------------------------------------*/
8170 vosStatus = WDA_DS_PeekRxPacketInfo( vosDataBuff, (v_PVOID_t)&aucBDHeader, 0/*Swap BD*/ );
8171
8172 if ( NULL == aucBDHeader )
8173 {
8174 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8175 "WLAN TL:Cannot extract BD header"));
8176 VOS_ASSERT( 0 );
8177 return VOS_STATUS_E_FAULT;
8178 }
8179
8180
8181 ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(aucBDHeader);
8182 usMPDUDOffset = (v_U16_t)WDA_GET_RX_MPDU_DATA_OFFSET(aucBDHeader);
8183 usMPDULen = (v_U16_t)WDA_GET_RX_MPDU_LEN(aucBDHeader);
8184 ucMPDUHLen = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(aucBDHeader);
8185 ucTid = (v_U8_t)WDA_GET_RX_TID(aucBDHeader);
8186
8187 vos_pkt_get_packet_length( vosDataBuff, &usPktLen);
8188
8189 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8190 "WLAN TL:BD header processing data: HO %d DO %d Len %d HLen %d",
8191 ucMPDUHOffset, usMPDUDOffset, usMPDULen, ucMPDUHLen));
8192
8193 /*It will cut out the 802.11 header if not used*/
8194 if ( VOS_STATUS_SUCCESS != WDA_DS_TrimRxPacketInfo( vosDataBuff ) )
8195 {
8196 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8197 "WLAN TL:BD header corrupted - dropping packet"));
8198 /* Drop packet */
8199 vos_pkt_return_packet(vosDataBuff);
8200 return VOS_STATUS_SUCCESS;
8201 }
8202
8203 vosStatus = WLANTL_GetEtherType(aucBDHeader,vosDataBuff,ucMPDUHLen,&usEtherType);
8204
8205 if( VOS_IS_STATUS_SUCCESS(vosStatus) )
8206 {
8207#ifdef FEATURE_WLAN_WAPI
8208 /* If frame is neither an EAPOL frame nor a WAI frame then we drop the frame*/
8209 /* TODO: Do we need a check to see if we are in WAPI mode? If not is it possible */
8210 /* that we get an EAPOL packet in WAPI mode or vice versa? */
8211 if ( WLANTL_LLC_8021X_TYPE != usEtherType && WLANTL_LLC_WAI_TYPE != usEtherType )
8212 {
Sunil Ravid5406f22013-01-22 00:18:31 -08008213 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07008214 "WLAN TL:RX Frame not EAPOL or WAI EtherType %d - dropping", usEtherType );
Jeff Johnson295189b2012-06-20 16:38:30 -07008215 /* Drop packet */
8216 vos_pkt_return_packet(vosDataBuff);
8217 }
8218#else
8219 if ( WLANTL_LLC_8021X_TYPE != usEtherType )
8220 {
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07008221 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8222 "WLAN TL:RX Frame not EAPOL EtherType %d - dropping", usEtherType);
Jeff Johnson295189b2012-06-20 16:38:30 -07008223 /* Drop packet */
8224 vos_pkt_return_packet(vosDataBuff);
8225 }
8226#endif /* FEATURE_WLAN_WAPI */
8227 else /* Frame is an EAPOL frame or a WAI frame*/
8228 {
Katya Nigam42e16e82014-02-04 16:28:55 +05308229 MTRACE(vos_trace(VOS_MODULE_ID_TL,
8230 TRACE_CODE_TL_RX_CONN_EAPOL, ucSTAId, usEtherType ));
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07008231
Madan Mohan Koyyalamudid8000342012-11-08 14:55:26 -08008232 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07008233 "WLAN TL:RX Frame EAPOL EtherType %d - processing", usEtherType);
8234
Jeff Johnson295189b2012-06-20 16:38:30 -07008235 if (( 0 == WDA_GET_RX_FT_DONE(aucBDHeader) ) &&
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308236 ( 0 != pClientSTA->wSTADesc.ucSwFrameRXXlation))
Jeff Johnson295189b2012-06-20 16:38:30 -07008237 {
8238 if (usMPDUDOffset > ucMPDUHOffset)
8239 {
8240 usActualHLen = usMPDUDOffset - ucMPDUHOffset;
8241 }
8242
8243 vosStatus = WLANTL_Translate80211To8023Header( vosDataBuff, &vosStatus, usActualHLen,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008244 ucMPDUHLen, pTLCb, ucSTAId, bForwardIAPPwithLLC);
Jeff Johnson295189b2012-06-20 16:38:30 -07008245
8246 if ( VOS_STATUS_SUCCESS != vosStatus )
8247 {
Kaushik, Sushante386ee12014-05-01 15:50:52 +05308248 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Jeff Johnson295189b2012-06-20 16:38:30 -07008249 "WLAN TL:Failed to translate from 802.11 to 802.3 - dropping"));
8250 /* Drop packet */
8251 vos_pkt_return_packet(vosDataBuff);
8252 return vosStatus;
8253 }
8254 }
8255 /*-------------------------------------------------------------------
8256 Increment receive counter
8257 -------------------------------------------------------------------*/
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -07008258 if ( !WLANTL_TID_INVALID( ucTid) )
8259 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308260 pClientSTA->auRxCount[ucTid]++;
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -07008261 }
8262 else
8263 {
8264 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8265 "WLAN TL:Invalid tid %d (Station ID %d) on %s",
8266 ucTid, ucSTAId, __func__));
8267 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008268
8269 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8270 "WLAN TL:Sending EAPoL frame to station %d AC %d", ucSTAId, ucTid));
8271
8272 /*-------------------------------------------------------------------
8273 !!!Assuming TID = UP mapping
8274 -------------------------------------------------------------------*/
8275 wRxMetaInfo.ucUP = ucTid;
8276
Jeff Johnson295189b2012-06-20 16:38:30 -07008277 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
Arif Hussainf2b00992013-11-17 21:46:15 -08008278 "WLAN TL %s:Sending data chain to station", __func__));
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308279 if ( WLAN_STA_SOFTAP == pClientSTA->wSTADesc.wSTAType )
Jeff Johnson295189b2012-06-20 16:38:30 -07008280 {
8281 wRxMetaInfo.ucDesSTAId = WLAN_RX_SAP_SELF_STA_ID;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308282 pClientSTA->pfnSTARx( pvosGCtx, vosDataBuff, ucSTAId,
Jeff Johnson295189b2012-06-20 16:38:30 -07008283 &wRxMetaInfo );
8284 }
8285 else
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308286 pClientSTA->pfnSTARx( pvosGCtx, vosDataBuff, ucSTAId,
Jeff Johnson295189b2012-06-20 16:38:30 -07008287 &wRxMetaInfo );
8288 }/*EAPOL frame or WAI frame*/
8289 }/*vos status success*/
8290
8291 return VOS_STATUS_SUCCESS;
8292}/* WLANTL_STARxConn */
8293
Jeff Johnson295189b2012-06-20 16:38:30 -07008294/*==========================================================================
8295 FUNCTION WLANTL_FwdPktToHDD
8296
8297 DESCRIPTION
8298 Determine the Destation Station ID and route the Frame to Upper Layer
8299
8300 DEPENDENCIES
8301
8302 PARAMETERS
8303
8304 IN
8305 pvosGCtx: pointer to the global vos context; a handle to TL's
8306 control block can be extracted from its context
8307 ucSTAId: identifier of the station being processed
8308 vosDataBuff: pointer to the rx vos buffer
8309
8310 RETURN VALUE
8311 The result code associated with performing the operation
8312
8313 VOS_STATUS_E_INVAL: invalid input parameters
8314 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
8315 page fault
8316 VOS_STATUS_SUCCESS: Everything is good :)
8317
8318 SIDE EFFECTS
8319
8320============================================================================*/
8321
8322VOS_STATUS
8323WLANTL_FwdPktToHDD
8324(
8325 v_PVOID_t pvosGCtx,
8326 vos_pkt_t* pvosDataBuff,
8327 v_U8_t ucSTAId
8328)
8329{
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308330 v_MACADDR_t DestMacAddress;
8331 v_MACADDR_t *pDestMacAddress = &DestMacAddress;
8332 v_SIZE_t usMacAddSize = VOS_MAC_ADDR_SIZE;
Jeff Johnson295189b2012-06-20 16:38:30 -07008333 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308334 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07008335 vos_pkt_t* vosDataBuff ;
8336 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
Girish Gowli93e3edd2014-05-01 15:42:31 +05308337 v_U32_t* STAMetaInfoPtr;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308338 vos_pkt_t* vosNextDataBuff ;
8339 v_U8_t ucDesSTAId;
Jeff Johnson295189b2012-06-20 16:38:30 -07008340 WLANTL_RxMetaInfoType wRxMetaInfo;
8341
Jeff Johnson295189b2012-06-20 16:38:30 -07008342 /*------------------------------------------------------------------------
8343 Sanity check
8344 ------------------------------------------------------------------------*/
8345 if (( NULL == pvosDataBuff ) || ( NULL == ( vosDataBuff = pvosDataBuff )))
8346 {
8347 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8348 "WLAN TL:Invalid parameter sent on WLANTL_FwdPktToHdd"));
8349 return VOS_STATUS_E_INVAL;
8350 }
8351
8352 /*------------------------------------------------------------------------
8353 Extract TL control block
8354 ------------------------------------------------------------------------*/
8355 pTLCb = VOS_GET_TL_CB(pvosGCtx);
8356 if ( NULL == pTLCb )
8357 {
8358 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8359 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_FwdPktToHdd"));
8360 return VOS_STATUS_E_FAULT;
8361 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308362
Tushnim Bhattacharyya5dd94562013-03-20 20:15:03 -07008363 if(WLANTL_STA_ID_INVALID(ucSTAId))
8364 {
8365 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"ucSTAId %d is not valid",
8366 ucSTAId));
8367 return VOS_STATUS_E_INVAL;
8368 }
8369
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308370 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
8371
8372 if ( NULL == pClientSTA )
8373 {
8374 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8375 "WLAN TL:Client Memory was not allocated on %s", __func__));
8376 return VOS_STATUS_E_FAILURE;
8377 }
8378
Jeff Johnson295189b2012-06-20 16:38:30 -07008379 /* This the change required for SoftAp to handle Reordered Buffer. Since a STA
8380 may have packets destined to multiple destinations we have to process each packet
8381 at a time and determine its Destination. So the Voschain provided by Reorder code
8382 is unchain and forwarded to Upper Layer after Determining the Destination */
8383
8384 vosDataBuff = pvosDataBuff;
8385 while (vosDataBuff != NULL)
8386 {
8387 vos_pkt_walk_packet_chain( vosDataBuff, &vosNextDataBuff, 1/*true*/ );
8388 vos_pkt_get_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
Girish Gowli93e3edd2014-05-01 15:42:31 +05308389 (v_PVOID_t *)&STAMetaInfoPtr );
8390 wRxMetaInfo.ucUP = (v_U8_t)((uintptr_t)STAMetaInfoPtr & WLANTL_AC_MASK);
8391 ucDesSTAId = (v_U8_t)(((uintptr_t)STAMetaInfoPtr) >> WLANTL_STAID_OFFSET);
Jeff Johnson295189b2012-06-20 16:38:30 -07008392
8393 vosStatus = vos_pkt_extract_data( vosDataBuff, 0, (v_VOID_t *)pDestMacAddress, &usMacAddSize);
8394 if ( VOS_STATUS_SUCCESS != vosStatus )
8395 {
8396 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08008397 "WLAN TL: recv corrupted data packet"));
Jeff Johnson295189b2012-06-20 16:38:30 -07008398 vos_pkt_return_packet(vosDataBuff);
8399 return vosStatus;
8400 }
8401
Arif Hussaina7c8e412013-11-20 11:06:42 -08008402 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
8403 "station mac "MAC_ADDRESS_STR,
8404 MAC_ADDR_ARRAY(pDestMacAddress->bytes)));
Jeff Johnson295189b2012-06-20 16:38:30 -07008405
8406 if (vos_is_macaddr_broadcast( pDestMacAddress ) || vos_is_macaddr_group(pDestMacAddress))
8407 {
8408 // destination is mc/bc station
8409 ucDesSTAId = WLAN_RX_BCMC_STA_ID;
8410 TLLOG4(VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO_LOW,
Arif Hussainf2b00992013-11-17 21:46:15 -08008411 "%s: BC/MC packet, id %d", __func__, WLAN_RX_BCMC_STA_ID));
Jeff Johnson295189b2012-06-20 16:38:30 -07008412 }
8413 else
8414 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308415 if (vos_is_macaddr_equal(pDestMacAddress, &pClientSTA->wSTADesc.vSelfMACAddress))
Jeff Johnson295189b2012-06-20 16:38:30 -07008416 {
8417 // destination is AP itself
8418 ucDesSTAId = WLAN_RX_SAP_SELF_STA_ID;
8419 TLLOG4(VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO_LOW,
Arif Hussainf2b00992013-11-17 21:46:15 -08008420 "%s: packet to AP itself, id %d", __func__, WLAN_RX_SAP_SELF_STA_ID));
Jeff Johnson295189b2012-06-20 16:38:30 -07008421 }
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05308422 else if (( WLAN_MAX_STA_COUNT <= ucDesSTAId ) || (NULL != pTLCb->atlSTAClients[ucDesSTAId] && pTLCb->atlSTAClients[ucDesSTAId]->ucExists == 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07008423 {
8424 // destination station is something else
8425 TLLOG4(VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO_LOW,
Arif Hussainf2b00992013-11-17 21:46:15 -08008426 "%s: get an station index larger than WLAN_MAX_STA_COUNT %d", __func__, ucDesSTAId));
Jeff Johnson295189b2012-06-20 16:38:30 -07008427 ucDesSTAId = WLAN_RX_SAP_SELF_STA_ID;
8428 }
8429
8430
8431 //loopback unicast station comes here
8432 }
8433
Girish Gowli93e3edd2014-05-01 15:42:31 +05308434 wRxMetaInfo.ucUP = (v_U8_t)((uintptr_t)STAMetaInfoPtr & WLANTL_AC_MASK);
Jeff Johnson295189b2012-06-20 16:38:30 -07008435 wRxMetaInfo.ucDesSTAId = ucDesSTAId;
8436
Madan Mohan Koyyalamudi6c2977d2013-09-04 15:42:45 +05308437 vosStatus = pClientSTA->pfnSTARx( pvosGCtx, vosDataBuff, ucDesSTAId,
Jeff Johnson295189b2012-06-20 16:38:30 -07008438 &wRxMetaInfo );
Madan Mohan Koyyalamudi6c2977d2013-09-04 15:42:45 +05308439 if ( VOS_STATUS_SUCCESS != vosStatus )
8440 {
8441 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08008442 "WLAN TL: failed to send pkt to HDD"));
Madan Mohan Koyyalamudi6c2977d2013-09-04 15:42:45 +05308443 vos_pkt_return_packet(vosDataBuff);
8444
8445 return vosStatus;
8446 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008447 vosDataBuff = vosNextDataBuff;
8448 }
8449 return VOS_STATUS_SUCCESS;
8450}
Jeff Johnson295189b2012-06-20 16:38:30 -07008451
8452/*==========================================================================
8453 FUNCTION WLANTL_STARxAuth
8454
8455 DESCRIPTION
8456 Receive in authenticated state - all data allowed
8457
8458 DEPENDENCIES
8459 The STA must be registered with TL before this function can be called.
8460
8461 PARAMETERS
8462
8463 IN
8464 pvosGCtx: pointer to the global vos context; a handle to TL's
8465 control block can be extracted from its context
8466 ucSTAId: identifier of the station being processed
8467 vosDataBuff: pointer to the rx vos buffer
8468
8469 RETURN VALUE
8470 The result code associated with performing the operation
8471
8472 VOS_STATUS_E_INVAL: invalid input parameters
8473 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
8474 page fault
8475 VOS_STATUS_SUCCESS: Everything is good :)
8476
8477 SIDE EFFECTS
8478
8479============================================================================*/
8480VOS_STATUS
8481WLANTL_STARxAuth
8482(
8483 v_PVOID_t pvosGCtx,
8484 v_U8_t ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008485 vos_pkt_t** pvosDataBuff,
8486 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -07008487)
8488{
8489 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308490 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07008491 v_U8_t ucAsf; /* AMSDU sub frame */
8492 v_U16_t usMPDUDOffset;
8493 v_U8_t ucMPDUHOffset;
8494 v_U16_t usMPDULen;
8495 v_U8_t ucMPDUHLen;
8496 v_U16_t usActualHLen = 0;
8497 v_U8_t ucTid;
8498#ifdef FEATURE_WLAN_WAPI
Jeff Johnsone0343db2013-04-03 16:39:24 -07008499 v_U16_t usEtherType = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07008500#endif
8501 v_U16_t usPktLen;
8502 vos_pkt_t* vosDataBuff ;
8503 v_PVOID_t aucBDHeader;
8504 VOS_STATUS vosStatus;
8505 WLANTL_RxMetaInfoType wRxMetaInfo;
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -07008506 static v_U8_t ucPMPDUHLen;
Girish Gowli93e3edd2014-05-01 15:42:31 +05308507 v_U32_t* STAMetaInfoPtr;
Jeff Johnson295189b2012-06-20 16:38:30 -07008508 v_U8_t ucEsf=0; /* first subframe of AMSDU flag */
8509 v_U64_t ullcurrentReplayCounter=0; /*current replay counter*/
8510 v_U64_t ullpreviousReplayCounter=0; /*previous replay counter*/
8511 v_U16_t ucUnicastBroadcastType=0; /*It denotes whether received frame is UC or BC*/
Madan Mohan Koyyalamudi4fe30172012-10-18 20:13:40 -07008512 struct _BARFrmStruct *pBarFrame = NULL;
8513
Jeff Johnson295189b2012-06-20 16:38:30 -07008514 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
8515
8516 /*------------------------------------------------------------------------
8517 Sanity check
8518 ------------------------------------------------------------------------*/
8519 if (( NULL == pvosDataBuff ) || ( NULL == ( vosDataBuff = *pvosDataBuff )))
8520 {
8521 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8522 "WLAN TL:Invalid parameter sent on WLANTL_STARxAuth"));
8523 return VOS_STATUS_E_INVAL;
8524 }
8525
8526 /*------------------------------------------------------------------------
8527 Extract TL control block
8528 ------------------------------------------------------------------------*/
8529 pTLCb = VOS_GET_TL_CB(pvosGCtx);
8530 if ( NULL == pTLCb )
8531 {
8532 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8533 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STARxAuth"));
8534 return VOS_STATUS_E_FAULT;
8535 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308536 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
8537
8538 if ( NULL == pClientSTA )
8539 {
8540 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8541 "WLAN TL:Client Memory was not allocated on %s", __func__));
8542 return VOS_STATUS_E_FAILURE;
8543 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008544
8545 /*------------------------------------------------------------------------
8546 Extract BD header and check if valid
8547 ------------------------------------------------------------------------*/
8548 WDA_DS_PeekRxPacketInfo( vosDataBuff, (v_PVOID_t)&aucBDHeader, 0 );
8549
8550 ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(aucBDHeader);
8551 usMPDUDOffset = (v_U16_t)WDA_GET_RX_MPDU_DATA_OFFSET(aucBDHeader);
8552 usMPDULen = (v_U16_t)WDA_GET_RX_MPDU_LEN(aucBDHeader);
8553 ucMPDUHLen = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(aucBDHeader);
8554 ucTid = (v_U8_t)WDA_GET_RX_TID(aucBDHeader);
8555
Madan Mohan Koyyalamudi4fe30172012-10-18 20:13:40 -07008556 /* Fix for a hardware bug.
8557 * H/W does not update the tid field in BD header for BAR frames.
8558 * Fix is to read the tid field from MAC header of BAR frame */
8559 if( (WDA_GET_RX_TYPE(aucBDHeader) == SIR_MAC_CTRL_FRAME) &&
8560 (WDA_GET_RX_SUBTYPE(aucBDHeader) == SIR_MAC_CTRL_BAR))
8561 {
8562 pBarFrame = (struct _BARFrmStruct *)(WDA_GET_RX_MAC_HEADER(aucBDHeader));
8563 ucTid = pBarFrame->barControl.numTID;
8564 }
8565
Jeff Johnson295189b2012-06-20 16:38:30 -07008566 /*Host based replay check is needed for unicast data frames*/
8567 ucUnicastBroadcastType = (v_U16_t)WDA_IS_RX_BCAST(aucBDHeader);
Jeff Johnson295189b2012-06-20 16:38:30 -07008568 if(0 != ucMPDUHLen)
8569 {
8570 ucPMPDUHLen = ucMPDUHLen;
8571 }
8572
8573 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8574 "WLAN TL:BD header processing data: HO %d DO %d Len %d HLen %d"
8575 " Tid %d BD %d",
8576 ucMPDUHOffset, usMPDUDOffset, usMPDULen, ucMPDUHLen, ucTid,
8577 WLANHAL_RX_BD_HEADER_SIZE));
8578
8579 vos_pkt_get_packet_length( vosDataBuff, &usPktLen);
8580
8581 if ( VOS_STATUS_SUCCESS != WDA_DS_TrimRxPacketInfo( vosDataBuff ) )
8582 {
8583 if((WDA_GET_RX_ASF(aucBDHeader) && !WDA_GET_RX_ESF(aucBDHeader)))
8584 {
8585 /* AMSDU case, ucMPDUHOffset = 0
8586 * it should be hancdled seperatly */
8587 if(( usMPDUDOffset > ucMPDUHOffset ) &&
8588 ( usMPDULen >= ucMPDUHLen ) && ( usPktLen >= usMPDULen ) &&
8589 ( !WLANTL_TID_INVALID(ucTid) ))
8590 {
8591 ucMPDUHOffset = usMPDUDOffset - WLANTL_MPDU_HEADER_LEN;
8592 }
8593 else
8594 {
8595 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8596 "WLAN TL:BD header corrupted - dropping packet"));
8597 /* Drop packet */
8598 vos_pkt_return_packet(vosDataBuff);
8599 return VOS_STATUS_SUCCESS;
8600 }
8601 }
8602 else
8603 {
8604 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8605 "WLAN TL:BD header corrupted - dropping packet"));
8606 /* Drop packet */
8607 vos_pkt_return_packet(vosDataBuff);
8608 return VOS_STATUS_SUCCESS;
8609 }
8610 }
8611
8612#ifdef FEATURE_WLAN_WAPI
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308613 if ( pClientSTA->wSTADesc.ucIsWapiSta )
Jeff Johnson295189b2012-06-20 16:38:30 -07008614 {
8615 vosStatus = WLANTL_GetEtherType(aucBDHeader, vosDataBuff, ucMPDUHLen, &usEtherType);
8616 if( VOS_IS_STATUS_SUCCESS(vosStatus) )
8617 {
8618 if ( WLANTL_LLC_WAI_TYPE == usEtherType )
8619 {
8620 if ( !( WLANHAL_RX_IS_UNPROTECTED_WPI_FRAME(aucBDHeader)) )
8621 {
8622 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8623 "WLAN TL:WAI frame was received encrypted - dropping"));
8624 /* Drop packet */
8625 /*Temporary fix added to fix wapi rekey issue*/
8626 //vos_pkt_return_packet(vosDataBuff);
8627 //return vosStatus; //returning success
8628 }
8629 }
8630 else
8631 {
8632 if ( WLANHAL_RX_IS_UNPROTECTED_WPI_FRAME(aucBDHeader) )
8633 {
8634 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8635 "WLAN TL:Non-WAI frame was received unencrypted - dropping"));
8636 /* Drop packet */
8637 vos_pkt_return_packet(vosDataBuff);
8638 return vosStatus; //returning success
8639 }
8640 }
8641 }
8642 else //could not extract EtherType - this should not happen
8643 {
8644 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Jeff Johnson04dd8a82012-06-29 20:41:40 -07008645 "WLAN TL:Could not extract EtherType"));
8646 //Packet is already freed
Jeff Johnson295189b2012-06-20 16:38:30 -07008647 return vosStatus; //returning failure
Jeff Johnson295189b2012-06-20 16:38:30 -07008648 }
8649 }
8650#endif /* FEATURE_WLAN_WAPI */
8651
8652 /*----------------------------------------------------------------------
8653 Increment receive counter
8654 !! not sure this is the best place to increase this - pkt might be
8655 dropped below or delayed in TL's queues
8656 - will leave it here for now
8657 ------------------------------------------------------------------------*/
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -07008658 if ( !WLANTL_TID_INVALID( ucTid) )
8659 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308660 pClientSTA->auRxCount[ucTid]++;
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -07008661 }
8662 else
8663 {
8664 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8665 "WLAN TL:Invalid tid %d (Station ID %d) on %s",
8666 ucTid, ucSTAId, __func__));
8667 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008668
8669 /*------------------------------------------------------------------------
8670 Check if AMSDU and send for processing if so
8671 ------------------------------------------------------------------------*/
8672 ucAsf = (v_U8_t)WDA_GET_RX_ASF(aucBDHeader);
8673
8674 if ( 0 != ucAsf )
8675 {
8676 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8677 "WLAN TL:Packet is AMSDU sub frame - sending for completion"));
8678 vosStatus = WLANTL_AMSDUProcess( pvosGCtx, &vosDataBuff, aucBDHeader, ucSTAId,
8679 ucMPDUHLen, usMPDULen );
8680 if(NULL == vosDataBuff)
8681 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07008682 //Packet is already freed
Jeff Johnson295189b2012-06-20 16:38:30 -07008683 return VOS_STATUS_SUCCESS;
8684 }
8685 }
8686 /* After AMSDU header handled
8687 * AMSDU frame just same with normal frames */
8688 /*-------------------------------------------------------------------
8689 Translating header if necesary
8690 !! Fix me: rmv comments below
8691 ----------------------------------------------------------------------*/
8692 if (( 0 == WDA_GET_RX_FT_DONE(aucBDHeader) ) &&
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308693 ( 0 != pClientSTA->wSTADesc.ucSwFrameRXXlation) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07008694 ( WLANTL_IS_DATA_FRAME(WDA_GET_RX_TYPE_SUBTYPE(aucBDHeader)) ))
8695 {
8696 if(0 == ucMPDUHLen)
8697 {
8698 ucMPDUHLen = ucPMPDUHLen;
8699 }
8700 if (usMPDUDOffset > ucMPDUHOffset)
8701 {
8702 usActualHLen = usMPDUDOffset - ucMPDUHOffset;
8703 }
8704 vosStatus = WLANTL_Translate80211To8023Header( vosDataBuff, &vosStatus, usActualHLen,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008705 ucMPDUHLen, pTLCb, ucSTAId, bForwardIAPPwithLLC);
Jeff Johnson295189b2012-06-20 16:38:30 -07008706
8707 if ( VOS_STATUS_SUCCESS != vosStatus )
8708 {
Kaushik, Sushante386ee12014-05-01 15:50:52 +05308709 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Jeff Johnson295189b2012-06-20 16:38:30 -07008710 "WLAN TL:Failed to translate from 802.11 to 802.3 - dropping"));
8711 /* Drop packet */
8712 vos_pkt_return_packet(vosDataBuff);
8713 return vosStatus;
8714 }
8715 }
8716 /* Softap requires additional Info such as Destination STAID and Access
8717 Category. Voschain or Buffer returned by BA would be unchain and this
8718 Meta Data would help in routing the packets to appropriate Destination */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308719 if( WLAN_STA_SOFTAP == pClientSTA->wSTADesc.wSTAType)
Jeff Johnson295189b2012-06-20 16:38:30 -07008720 {
Arun Kumar Khandavalli37cfc222014-01-09 22:32:40 +05308721 STAMetaInfoPtr = (v_U32_t *)(uintptr_t)(ucTid | (WDA_GET_RX_ADDR3_IDX(aucBDHeader) << WLANTL_STAID_OFFSET));
Jeff Johnson295189b2012-06-20 16:38:30 -07008722 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
8723 (v_PVOID_t)STAMetaInfoPtr);
8724 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008725
8726 /*------------------------------------------------------------------------
8727 Check to see if re-ordering session is in place
8728 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308729 if ( 0 != pClientSTA->atlBAReorderInfo[ucTid].ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07008730 {
8731 WLANTL_MSDUReorder( pTLCb, &vosDataBuff, aucBDHeader, ucSTAId, ucTid );
8732 }
8733
Jeff Johnson295189b2012-06-20 16:38:30 -07008734if(0 == ucUnicastBroadcastType
8735#ifdef FEATURE_ON_CHIP_REORDERING
8736 && (WLANHAL_IsOnChipReorderingEnabledForTID(pvosGCtx, ucSTAId, ucTid) != TRUE)
8737#endif
8738)
8739{
8740 /* replay check code : check whether replay check is needed or not */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308741 if(VOS_TRUE == pClientSTA->ucIsReplayCheckValid)
Jeff Johnson295189b2012-06-20 16:38:30 -07008742 {
8743 /* replay check is needed for the station */
8744
8745 /* check whether frame is AMSDU frame */
8746 if ( 0 != ucAsf )
8747 {
8748 /* Since virgo can't send AMSDU frames this leg of the code
8749 was not tested properly, it needs to be tested properly*/
8750 /* Frame is AMSDU frame. As per 802.11n only first
8751 subframe will have replay counter */
8752 ucEsf = WDA_GET_RX_ESF( aucBDHeader );
8753 if( 0 != ucEsf )
8754 {
8755 v_BOOL_t status;
8756 /* Getting 48-bit replay counter from the RX BD */
8757 ullcurrentReplayCounter = WDA_DS_GetReplayCounter(aucBDHeader);
8758
8759 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Arif Hussainf2b00992013-11-17 21:46:15 -08008760 "WLAN TL: AMSDU currentReplayCounter [0x%llX]",ullcurrentReplayCounter);
Jeff Johnson295189b2012-06-20 16:38:30 -07008761
8762 /* Getting 48-bit previous replay counter from TL control block */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308763 ullpreviousReplayCounter = pClientSTA->ullReplayCounter[ucTid];
Jeff Johnson295189b2012-06-20 16:38:30 -07008764
8765 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Arif Hussainf2b00992013-11-17 21:46:15 -08008766 "WLAN TL: AMSDU previousReplayCounter [0x%llX]",ullpreviousReplayCounter);
Jeff Johnson295189b2012-06-20 16:38:30 -07008767
8768 /* It is first subframe of AMSDU thus it
8769 conatains replay counter perform the
8770 replay check for this first subframe*/
8771 status = WLANTL_IsReplayPacket( ullcurrentReplayCounter, ullpreviousReplayCounter);
8772 if(VOS_FALSE == status)
8773 {
8774 /* Not a replay paket, update previous replay counter in TL CB */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308775 pClientSTA->ullReplayCounter[ucTid] = ullcurrentReplayCounter;
Jeff Johnson295189b2012-06-20 16:38:30 -07008776 }
8777 else
8778 {
8779 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08008780 "WLAN TL: AMSDU Drop the replay packet with PN : [0x%llX]",ullcurrentReplayCounter);
Jeff Johnson295189b2012-06-20 16:38:30 -07008781
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308782 pClientSTA->ulTotalReplayPacketsDetected++;
Jeff Johnson295189b2012-06-20 16:38:30 -07008783 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08008784 "WLAN TL: AMSDU total dropped replay packets on STA ID %X is [0x%X]",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308785 ucSTAId, pClientSTA->ulTotalReplayPacketsDetected);
Jeff Johnson295189b2012-06-20 16:38:30 -07008786
8787 /* Drop the packet */
8788 vos_pkt_return_packet(vosDataBuff);
8789 return VOS_STATUS_SUCCESS;
8790 }
8791 }
8792 }
8793 else
8794 {
8795 v_BOOL_t status;
8796
8797 /* Getting 48-bit replay counter from the RX BD */
8798 ullcurrentReplayCounter = WDA_DS_GetReplayCounter(aucBDHeader);
8799
8800 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Arif Hussainf2b00992013-11-17 21:46:15 -08008801 "WLAN TL: Non-AMSDU currentReplayCounter [0x%llX]",ullcurrentReplayCounter);
Jeff Johnson295189b2012-06-20 16:38:30 -07008802
8803 /* Getting 48-bit previous replay counter from TL control block */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308804 ullpreviousReplayCounter = pClientSTA->ullReplayCounter[ucTid];
Jeff Johnson295189b2012-06-20 16:38:30 -07008805
8806 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Arif Hussainf2b00992013-11-17 21:46:15 -08008807 "WLAN TL: Non-AMSDU previousReplayCounter [0x%llX]",ullpreviousReplayCounter);
Jeff Johnson295189b2012-06-20 16:38:30 -07008808
8809 /* It is not AMSDU frame so perform
8810 reaply check for each packet, as
8811 each packet contains valid replay counter*/
8812 status = WLANTL_IsReplayPacket( ullcurrentReplayCounter, ullpreviousReplayCounter);
8813 if(VOS_FALSE == status)
8814 {
8815 /* Not a replay paket, update previous replay counter in TL CB */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308816 pClientSTA->ullReplayCounter[ucTid] = ullcurrentReplayCounter;
Jeff Johnson295189b2012-06-20 16:38:30 -07008817 }
8818 else
8819 {
8820 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08008821 "WLAN TL: Non-AMSDU Drop the replay packet with PN : [0x%llX]",ullcurrentReplayCounter);
Jeff Johnson295189b2012-06-20 16:38:30 -07008822
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308823 pClientSTA->ulTotalReplayPacketsDetected++;
Jeff Johnson295189b2012-06-20 16:38:30 -07008824 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08008825 "WLAN TL: Non-AMSDU total dropped replay packets on STA ID %X is [0x%X]",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308826 ucSTAId, pClientSTA->ulTotalReplayPacketsDetected);
Jeff Johnson295189b2012-06-20 16:38:30 -07008827
8828 /* Repaly packet, drop the packet */
8829 vos_pkt_return_packet(vosDataBuff);
8830 return VOS_STATUS_SUCCESS;
8831 }
8832 }
8833 }
8834}
8835/*It is a broadast packet DPU has already done replay check for
8836 broadcast packets no need to do replay check of these packets*/
Jeff Johnson295189b2012-06-20 16:38:30 -07008837
8838 if ( NULL != vosDataBuff )
8839 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308840 if( WLAN_STA_SOFTAP == pClientSTA->wSTADesc.wSTAType)
Jeff Johnson295189b2012-06-20 16:38:30 -07008841 {
8842 WLANTL_FwdPktToHDD( pvosGCtx, vosDataBuff, ucSTAId );
8843 }
8844 else
Jeff Johnson295189b2012-06-20 16:38:30 -07008845 {
8846 wRxMetaInfo.ucUP = ucTid;
Shailender Karmuchi13c0d082013-03-26 14:41:39 -07008847 wRxMetaInfo.rssiAvg = pClientSTA->rssiAvg;
Gopichand Nakkala4a2fc1a2013-05-17 16:59:39 +05308848#ifdef FEATURE_WLAN_TDLS
8849 if (WLAN_STA_TDLS == pClientSTA->wSTADesc.wSTAType)
8850 {
8851 wRxMetaInfo.isStaTdls = TRUE;
8852 }
8853 else
8854 {
8855 wRxMetaInfo.isStaTdls = FALSE;
8856 }
8857#endif
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308858 pClientSTA->pfnSTARx( pvosGCtx, vosDataBuff, ucSTAId,
Jeff Johnson295189b2012-06-20 16:38:30 -07008859 &wRxMetaInfo );
8860 }
8861 }/* if not NULL */
8862
8863 return VOS_STATUS_SUCCESS;
8864}/* WLANTL_STARxAuth */
8865
8866
8867/*==========================================================================
8868 FUNCTION WLANTL_STARxDisc
8869
8870 DESCRIPTION
8871 Receive in disconnected state - no data allowed
8872
8873 DEPENDENCIES
8874 The STA must be registered with TL before this function can be called.
8875
8876 PARAMETERS
8877
8878 IN
8879 pvosGCtx: pointer to the global vos context; a handle to TL's
8880 control block can be extracted from its context
8881 ucSTAId: identifier of the station being processed
8882 vosDataBuff: pointer to the rx vos buffer
8883
8884 RETURN VALUE
8885 The result code associated with performing the operation
8886
8887 VOS_STATUS_SUCCESS: Everything is good :)
8888
8889 SIDE EFFECTS
8890
8891============================================================================*/
8892VOS_STATUS
8893WLANTL_STARxDisc
8894(
8895 v_PVOID_t pvosGCtx,
8896 v_U8_t ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008897 vos_pkt_t** pvosDataBuff,
8898 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -07008899)
8900{
8901 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
8902
8903 /*------------------------------------------------------------------------
8904 Sanity check
8905 ------------------------------------------------------------------------*/
8906 if (( NULL == pvosDataBuff ) || ( NULL == *pvosDataBuff ))
8907 {
8908 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8909 "WLAN TL:Invalid parameter sent on WLANTL_STARxDisc"));
8910 return VOS_STATUS_E_INVAL;
8911 }
8912
8913 /*------------------------------------------------------------------------
8914 Error - drop packet
8915 ------------------------------------------------------------------------*/
8916 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8917 "WLAN TL:Packet should not be received in state disconnected"
8918 " - dropping"));
8919 vos_pkt_return_packet(*pvosDataBuff);
8920 *pvosDataBuff = NULL;
8921
8922 return VOS_STATUS_SUCCESS;
8923}/* WLANTL_STARxDisc */
8924
8925/*==========================================================================
8926 Processing main loops for MAIN and TX threads
8927 ==========================================================================*/
8928
8929/*==========================================================================
8930 FUNCTION WLANTL_McProcessMsg
8931
8932 DESCRIPTION
8933 Called by VOSS when a message was serialized for TL through the
8934 main thread/task.
8935
8936 DEPENDENCIES
8937 The TL must be initialized before this function can be called.
8938
8939 PARAMETERS
8940
8941 IN
8942 pvosGCtx: pointer to the global vos context; a handle to TL's
8943 control block can be extracted from its context
8944 message: type and content of the message
8945
8946
8947 RETURN VALUE
8948 The result code associated with performing the operation
8949
8950 VOS_STATUS_E_INVAL: invalid input parameters
8951 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
8952 page fault
8953 VOS_STATUS_SUCCESS: Everything is good :)
8954
8955 SIDE EFFECTS
8956
8957============================================================================*/
8958VOS_STATUS
8959WLANTL_McProcessMsg
8960(
8961 v_PVOID_t pvosGCtx,
8962 vos_msg_t* message
8963)
8964{
8965 WLANTL_CbType* pTLCb = NULL;
8966 tAddBAInd* ptAddBaInd = NULL;
8967 tDelBAInd* ptDelBaInd = NULL;
8968 tAddBARsp* ptAddBaRsp = NULL;
8969 vos_msg_t vosMessage;
8970 VOS_STATUS vosStatus;
8971 tpFlushACRsp FlushACRspPtr;
8972 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
8973
8974 /*------------------------------------------------------------------------
8975 Sanity check
8976 ------------------------------------------------------------------------*/
8977 if ( NULL == message )
8978 {
8979 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8980 "WLAN TL:Invalid parameter sent on WLANTL_ProcessMainMessage"));
8981 return VOS_STATUS_E_INVAL;
8982 }
8983
8984 /*------------------------------------------------------------------------
8985 Extract TL control block
8986 ------------------------------------------------------------------------*/
8987 pTLCb = VOS_GET_TL_CB(pvosGCtx);
8988 if ( NULL == pTLCb )
8989 {
8990 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8991 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ProcessMainMessage"));
8992 return VOS_STATUS_E_FAULT;
8993 }
8994
8995 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8996 "WLAN TL:Received message: %d through main flow", message->type));
8997
8998 switch( message->type )
8999 {
9000 case WDA_TL_FLUSH_AC_RSP:
9001 // Extract the message from the message body
9002 FlushACRspPtr = (tpFlushACRsp)(message->bodyptr);
9003 // Make sure the call back function is not null.
Tushnim Bhattacharyya5dd94562013-03-20 20:15:03 -07009004 if ( NULL == pTLCb->tlBAPClient.pfnFlushOpCompleteCb )
9005 {
9006 VOS_ASSERT(0);
9007 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9008 "WLAN TL:Invalid TL pointer pfnFlushOpCompleteCb"));
9009 return VOS_STATUS_E_FAULT;
9010 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009011
9012 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9013 "Received message: Flush complete received by TL"));
9014
9015 // Since we have the response back from HAL, just call the BAP client
9016 // registered call back from TL. There is only 1 possible
9017 // BAP client. So directly reference tlBAPClient
9018 pTLCb->tlBAPClient.pfnFlushOpCompleteCb( pvosGCtx,
9019 FlushACRspPtr->ucSTAId,
9020 FlushACRspPtr->ucTid, FlushACRspPtr->status );
9021
9022 // Free the PAL memory, we are done with it.
9023 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9024 "Flush complete received by TL: Freeing %p", FlushACRspPtr));
9025 vos_mem_free((v_VOID_t *)FlushACRspPtr);
9026 break;
9027
9028 case WDA_HDD_ADDBA_REQ:
9029 ptAddBaInd = (tAddBAInd*)(message->bodyptr);
9030 vosStatus = WLANTL_BaSessionAdd( pvosGCtx,
9031 ptAddBaInd->baSession.baSessionID,
9032 ptAddBaInd->baSession.STAID,
9033 ptAddBaInd->baSession.baTID,
9034 (v_U32_t)ptAddBaInd->baSession.baBufferSize,
9035 ptAddBaInd->baSession.winSize,
9036 ptAddBaInd->baSession.SSN);
9037 ptAddBaRsp = vos_mem_malloc(sizeof(*ptAddBaRsp));
9038
9039 if ( NULL == ptAddBaRsp )
9040 {
9041 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9042 "WLAN TL: fatal failure, cannot allocate BA Rsp structure"));
9043 VOS_ASSERT(0);
9044 return VOS_STATUS_E_NOMEM;
9045 }
9046
9047 if ( VOS_STATUS_SUCCESS == vosStatus )
9048 {
9049 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9050 "WLAN TL: Sending success indication to HAL for ADD BA"));
9051 /*Send success*/
9052 ptAddBaRsp->mesgType = WDA_HDD_ADDBA_RSP;
9053 vosMessage.type = WDA_HDD_ADDBA_RSP;
9054 }
9055 else
9056 {
9057 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9058 "WLAN TL: Sending failure indication to HAL for ADD BA"));
9059
9060 /*Send failure*/
9061 ptAddBaRsp->mesgType = WDA_BA_FAIL_IND;
9062 vosMessage.type = WDA_BA_FAIL_IND;
9063 }
9064
9065 ptAddBaRsp->mesgLen = sizeof(tAddBARsp);
9066 ptAddBaRsp->baSessionID = ptAddBaInd->baSession.baSessionID;
9067 /* This is default, reply win size has to be handled BA module, FIX THIS */
9068 ptAddBaRsp->replyWinSize = WLANTL_MAX_WINSIZE;
9069 vosMessage.bodyptr = ptAddBaRsp;
9070
9071 vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
9072 WLANTL_McFreeMsg (pvosGCtx, message);
9073 break;
9074 case WDA_DELETEBA_IND:
9075 ptDelBaInd = (tDelBAInd*)(message->bodyptr);
9076 vosStatus = WLANTL_BaSessionDel(pvosGCtx,
9077 ptDelBaInd->staIdx,
9078 ptDelBaInd->baTID);
9079
9080 if ( VOS_STATUS_SUCCESS != vosStatus )
9081 {
9082 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9083 "WLAN TL: Failed to del BA session STA:%d TID:%d Status :%d",
9084 ptDelBaInd->staIdx,
9085 ptDelBaInd->baTID,
9086 vosStatus));
9087 }
9088 WLANTL_McFreeMsg (pvosGCtx, message);
9089 break;
9090 default:
9091 /*no processing for now*/
9092 break;
9093 }
9094
9095 return VOS_STATUS_SUCCESS;
9096}/* WLANTL_ProcessMainMessage */
9097
9098/*==========================================================================
9099 FUNCTION WLANTL_McFreeMsg
9100
9101 DESCRIPTION
9102 Called by VOSS to free a given TL message on the Main thread when there
9103 are messages pending in the queue when the whole system is been reset.
9104 For now, TL does not allocate any body so this function shout translate
9105 into a NOOP
9106
9107 DEPENDENCIES
9108 The TL must be initialized before this function can be called.
9109
9110 PARAMETERS
9111
9112 IN
9113 pvosGCtx: pointer to the global vos context; a handle to TL's
9114 control block can be extracted from its context
9115 message: type and content of the message
9116
9117
9118 RETURN VALUE
9119 The result code associated with performing the operation
9120
9121 VOS_STATUS_SUCCESS: Everything is good :)
9122
9123 SIDE EFFECTS
9124
9125============================================================================*/
9126VOS_STATUS
9127WLANTL_McFreeMsg
9128(
9129 v_PVOID_t pvosGCtx,
9130 vos_msg_t* message
9131)
9132{
9133 WLANTL_CbType* pTLCb = NULL;
9134 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
9135
9136 /*------------------------------------------------------------------------
9137 Sanity check
9138 ------------------------------------------------------------------------*/
9139 if ( NULL == message )
9140 {
9141 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9142 "WLAN TL:Invalid parameter sent on WLANTL_McFreeMsg"));
9143 return VOS_STATUS_E_INVAL;
9144 }
9145
9146 /*------------------------------------------------------------------------
9147 Extract TL control block
9148 ------------------------------------------------------------------------*/
9149 pTLCb = VOS_GET_TL_CB(pvosGCtx);
9150 if ( NULL == pTLCb )
9151 {
9152 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9153 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_McFreeMsg"));
9154 return VOS_STATUS_E_FAULT;
9155 }
9156
9157 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9158 "WLAN TL:Received message: %d through main free", message->type));
9159
9160 switch( message->type )
9161 {
9162 case WDA_HDD_ADDBA_REQ:
9163 case WDA_DELETEBA_IND:
9164 /*vos free body pointer*/
9165 vos_mem_free(message->bodyptr);
9166 message->bodyptr = NULL;
9167 break;
9168 default:
9169 /*no processing for now*/
9170 break;
9171 }
9172
9173 return VOS_STATUS_SUCCESS;
9174}/*WLANTL_McFreeMsg*/
9175
9176/*==========================================================================
9177 FUNCTION WLANTL_TxProcessMsg
9178
9179 DESCRIPTION
9180 Called by VOSS when a message was serialized for TL through the
9181 tx thread/task.
9182
9183 DEPENDENCIES
9184 The TL must be initialized before this function can be called.
9185
9186 PARAMETERS
9187
9188 IN
9189 pvosGCtx: pointer to the global vos context; a handle to TL's
9190 control block can be extracted from its context
9191 message: type and content of the message
9192
9193
9194 RETURN VALUE
9195 The result code associated with performing the operation
9196
9197 VOS_STATUS_E_INVAL: invalid input parameters
9198 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
9199 page fault
9200 VOS_STATUS_SUCCESS: Everything is good :)
9201
9202 Other values can be returned as a result of a function call, please check
9203 corresponding API for more info.
9204 SIDE EFFECTS
9205
9206============================================================================*/
9207VOS_STATUS
9208WLANTL_TxProcessMsg
9209(
9210 v_PVOID_t pvosGCtx,
9211 vos_msg_t* message
9212)
9213{
9214 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07009215 void (*callbackRoutine) (void *callbackContext);
9216 void *callbackContext;
Jeff Johnson295189b2012-06-20 16:38:30 -07009217 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
9218
9219 /*------------------------------------------------------------------------
9220 Sanity check
9221 ------------------------------------------------------------------------*/
9222 if ( NULL == message )
9223 {
9224 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9225 "WLAN TL:Invalid parameter sent on WLANTL_ProcessTxMessage"));
9226 return VOS_STATUS_E_INVAL;
9227 }
9228
9229 /*------------------------------------------------------------------------
9230 Process message
9231 ------------------------------------------------------------------------*/
9232 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9233 "WLAN TL:Received message: %d through tx flow", message->type));
9234
9235 switch( message->type )
9236 {
9237 case WLANTL_TX_SIG_SUSPEND:
9238 vosStatus = WLANTL_SuspendCB( pvosGCtx,
9239 (WLANTL_SuspendCBType)message->bodyptr,
9240 message->reserved);
9241 break;
9242 case WLANTL_TX_RES_NEEDED:
9243 vosStatus = WLANTL_GetTxResourcesCB( pvosGCtx );
9244 break;
Katya Nigam664f5032014-05-05 12:24:32 +05309245
Jeff Johnson295189b2012-06-20 16:38:30 -07009246 case WDA_DS_TX_START_XMIT:
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05309247 WLANTL_ClearTxXmitPending(pvosGCtx);
9248 vosStatus = WDA_DS_TxFrames( pvosGCtx );
Jeff Johnson295189b2012-06-20 16:38:30 -07009249 break;
9250
9251 case WDA_DS_FINISH_ULA:
Arun Kumar Khandavalli8d1979d2014-01-09 21:12:25 +05309252 callbackContext = message->bodyptr;
9253 callbackRoutine = message->callback;
9254 if ( NULL != callbackRoutine )
9255 {
9256 callbackRoutine(callbackContext);
9257 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009258 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07009259
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05309260 case WLANTL_TX_SNAPSHOT:
9261 /*Dumping TL State and then continuing to print
9262 the DXE Dump*/
9263 WLANTL_TxThreadDebugHandler(pvosGCtx);
9264 WDA_TransportChannelDebug(NULL, VOS_TRUE, VOS_FALSE);
9265 break;
9266
Mihir Shetefd62d9d2014-08-06 15:08:21 +05309267 case WLANTL_TX_FATAL_ERROR:
9268 WLANTL_FatalErrorHandler(pvosGCtx);
9269 break;
9270
Mihir Shete327c2ab2014-11-13 15:17:02 +05309271 case WLANTL_TX_FW_DEBUG:
9272 vos_fwDumpReq(274, 0, 0, 0, 0);
9273 break;
9274
Jeff Johnson295189b2012-06-20 16:38:30 -07009275 default:
9276 /*no processing for now*/
9277 break;
9278 }
9279
9280 return vosStatus;
9281}/* WLANTL_TxProcessMsg */
9282
9283/*==========================================================================
9284 FUNCTION WLANTL_McFreeMsg
9285
9286 DESCRIPTION
9287 Called by VOSS to free a given TL message on the Main thread when there
9288 are messages pending in the queue when the whole system is been reset.
9289 For now, TL does not allocate any body so this function shout translate
9290 into a NOOP
9291
9292 DEPENDENCIES
9293 The TL must be initialized before this function can be called.
9294
9295 PARAMETERS
9296
9297 IN
9298 pvosGCtx: pointer to the global vos context; a handle to TL's
9299 control block can be extracted from its context
9300 message: type and content of the message
9301
9302
9303 RETURN VALUE
9304 The result code associated with performing the operation
9305
9306 VOS_STATUS_SUCCESS: Everything is good :)
9307
9308 SIDE EFFECTS
9309
9310============================================================================*/
9311VOS_STATUS
9312WLANTL_TxFreeMsg
9313(
9314 v_PVOID_t pvosGCtx,
9315 vos_msg_t* message
9316)
9317{
9318 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
9319
9320 /*Nothing to do for now!!!*/
9321 return VOS_STATUS_SUCCESS;
9322}/*WLANTL_TxFreeMsg*/
9323
Jeff Johnson295189b2012-06-20 16:38:30 -07009324/*==========================================================================
9325
9326 FUNCTION WLANTL_TxFCFrame
9327
9328 DESCRIPTION
9329 Internal utility function to send FC frame. Enable
9330 or disable LWM mode based on the information.
9331
9332 DEPENDENCIES
9333 TL must be initiailized before this function gets called.
9334 FW sends up special flow control frame.
9335
9336 PARAMETERS
9337
9338 IN
9339 pvosGCtx: pointer to the global vos context; a handle to TL's
9340 control block can be extracted from its context
9341
9342 RETURN VALUE
9343 The result code associated with performing the operation
9344
9345 VOS_STATUS_E_INVAL: Input pointers are NULL.
9346 VOS_STATUS_E_FAULT: Something is wrong.
9347 VOS_STATUS_SUCCESS: Everything is good.
9348
9349 SIDE EFFECTS
9350 Newly formed FC frame is generated and waits to be transmitted. Previously unsent frame will
9351 be released.
9352
9353============================================================================*/
9354VOS_STATUS
9355WLANTL_TxFCFrame
9356(
9357 v_PVOID_t pvosGCtx
9358)
9359{
9360#if 0
9361 WLANTL_CbType* pTLCb = NULL;
9362 VOS_STATUS vosStatus;
9363 tpHalFcTxBd pvFcTxBd = NULL;
9364 vos_pkt_t * pPacket = NULL;
9365 v_U8_t ucSTAId = 0;
9366 v_U8_t ucBitCheck = 1;
9367
9368 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009369 "WLAN TL: Send FC frame %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009370
9371 /*------------------------------------------------------------------------
9372 Sanity check
9373 ------------------------------------------------------------------------*/
9374 if ( NULL == pvosGCtx )
9375 {
9376 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009377 "WLAN TL:Invalid parameter %s", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07009378 return VOS_STATUS_E_INVAL;
9379 }
9380 /*------------------------------------------------------------------------
9381 Extract TL control block
9382 ------------------------------------------------------------------------*/
9383 pTLCb = VOS_GET_TL_CB(pvosGCtx);
9384
9385 if (NULL == pTLCb)
9386 {
9387 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009388 "WLAN TL:Invalid pointer in %s \n", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07009389 return VOS_STATUS_E_INVAL;
9390 }
9391
9392 //Get one voss packet
9393 vosStatus = vos_pkt_get_packet( &pPacket, VOS_PKT_TYPE_TX_802_11_MGMT, sizeof(tHalFcTxBd), 1,
9394 VOS_FALSE, NULL, NULL );
9395
9396 if ( VOS_STATUS_SUCCESS != vosStatus )
9397 {
9398 return VOS_STATUS_E_INVAL;
9399 }
9400
9401 vosStatus = vos_pkt_reserve_head( pPacket, (void *)&pvFcTxBd, sizeof(tHalFcTxBd));
9402
9403 if( VOS_STATUS_SUCCESS != vosStatus )
9404 {
9405 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009406 "%s: failed to reserve FC TX BD %d\n",__func__, sizeof(tHalFcTxBd)));
Jeff Johnson295189b2012-06-20 16:38:30 -07009407 vos_pkt_return_packet( pPacket );
9408 return VOS_STATUS_E_FAULT;
9409 }
9410
9411 //Generate most recent tlFCInfo. Most fields are correct.
9412 pTLCb->tlFCInfo.fcSTAThreshEnabledMask = 0;
9413 pTLCb->tlFCInfo.fcSTATxMoreDataMask = 0;
9414 for( ucSTAId = 0, ucBitCheck = 1 ; ucSTAId < WLAN_MAX_STA_COUNT; ucBitCheck <<= 1, ucSTAId ++)
9415 {
9416 if (0 == pTLCb->atlSTAClients[ucSTAId].ucExists)
9417 {
9418 continue;
9419 }
9420
9421 if (pTLCb->atlSTAClients[ucSTAId].ucPktPending)
9422 {
9423 pTLCb->tlFCInfo.fcSTATxMoreDataMask |= ucBitCheck;
9424 }
9425
9426 if ( (pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled) &&
9427 (pTLCb->atlSTAClients[ucSTAId].bmuMemConsumed > pTLCb->atlSTAClients[ucSTAId].uLwmThreshold))
9428 {
9429 pTLCb->tlFCInfo.fcSTAThreshEnabledMask |= ucBitCheck;
9430
9431 pTLCb->tlFCInfo.fcSTAThresh[ucSTAId] = (tANI_U8)pTLCb->atlSTAClients[ucSTAId].uLwmThreshold;
9432
9433 pTLCb->atlSTAClients[ucSTAId].ucLwmEventReported = FALSE;
9434 }
9435
9436 }
9437
9438 //request immediate feedback
9439 pTLCb->tlFCInfo.fcConfig |= 0x4;
9440
9441 //fill in BD to sent
9442 vosStatus = WLANHAL_FillFcTxBd(pvosGCtx, &pTLCb->tlFCInfo, (void *)pvFcTxBd);
9443
9444 if( VOS_STATUS_SUCCESS != vosStatus )
9445 {
9446 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009447 "%s: Fill FC TX BD unsuccessful\n", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07009448 vos_pkt_return_packet( pPacket );
9449 return VOS_STATUS_E_FAULT;
9450 }
9451
9452 if (NULL != pTLCb->vosTxFCBuf)
9453 {
9454 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009455 "%s: Previous FC TX BD not sent\n", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07009456 vos_pkt_return_packet(pTLCb->vosTxFCBuf);
9457 }
9458
9459 pTLCb->vosTxFCBuf = pPacket;
9460
9461 vos_pkt_set_user_data_ptr( pPacket, VOS_PKT_USER_DATA_ID_TL,
9462 (v_PVOID_t)WLANTL_TxCompDefaultCb);
9463 vosStatus = WDA_DS_StartXmit(pvosGCtx);
9464
9465 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009466 "WLAN TL: send FC frame leave %s", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07009467#endif
9468 return VOS_STATUS_SUCCESS;
9469}
9470
Jeff Johnson295189b2012-06-20 16:38:30 -07009471
9472/*==========================================================================
9473 FUNCTION WLANTL_GetTxResourcesCB
9474
9475 DESCRIPTION
9476 Processing function for Resource needed signal. A request will be issued
9477 to BAL to get more tx resources.
9478
9479 DEPENDENCIES
9480 The TL must be initialized before this function can be called.
9481
9482 PARAMETERS
9483
9484 IN
9485 pvosGCtx: pointer to the global vos context; a handle to TL's
9486 control block can be extracted from its context
9487
9488
9489 RETURN VALUE
9490 The result code associated with performing the operation
9491
9492 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
9493 page fault
9494 VOS_STATUS_SUCCESS: Everything is good :)
9495
9496 Other values can be returned as a result of a function call, please check
9497 corresponding API for more info.
9498 SIDE EFFECTS
9499
9500============================================================================*/
9501VOS_STATUS
9502WLANTL_GetTxResourcesCB
9503(
9504 v_PVOID_t pvosGCtx
9505)
9506{
9507 WLANTL_CbType* pTLCb = NULL;
9508 v_U32_t uResCount = WDA_TLI_MIN_RES_DATA;
9509 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
9510 v_U8_t ucMgmt = 0;
9511 v_U8_t ucBAP = 0;
9512 v_U8_t ucData = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07009513#ifdef WLAN_SOFTAP_FLOWCTRL_EN
9514 tBssSystemRole systemRole;
9515 tpAniSirGlobal pMac;
9516#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07009517 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
9518 /*------------------------------------------------------------------------
9519 Extract TL control block
9520 ------------------------------------------------------------------------*/
9521 pTLCb = VOS_GET_TL_CB(pvosGCtx);
9522 if ( NULL == pTLCb )
9523 {
9524 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9525 "WLAN TL:Invalid TL pointer from pvosGCtx on"
9526 " WLANTL_ProcessTxMessage"));
9527 return VOS_STATUS_E_FAULT;
9528 }
9529
9530 /*------------------------------------------------------------------------
9531 Get tx resources from BAL
9532 ------------------------------------------------------------------------*/
9533 vosStatus = WDA_DS_GetTxResources( pvosGCtx, &uResCount );
9534
9535 if ( (VOS_STATUS_SUCCESS != vosStatus) && (VOS_STATUS_E_RESOURCES != vosStatus))
9536 {
9537 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9538 "WLAN TL:TL failed to get resources from BAL, Err: %d",
9539 vosStatus));
9540 return vosStatus;
9541 }
9542
9543 /* Currently only Linux BAL returns the E_RESOURCES error code when it is running
9544 out of BD/PDUs. To make use of this interrupt for throughput enhancement, similar
9545 changes should be done in BAL code of AMSS and WM */
9546 if (VOS_STATUS_E_RESOURCES == vosStatus)
9547 {
9548#ifdef VOLANS_PERF
9549 WLANHAL_EnableIdleBdPduInterrupt(pvosGCtx, (tANI_U8)bdPduInterruptGetThreshold);
9550 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9551 "WLAN TL: Enabling Idle BD/PDU interrupt, Current resources = %d", uResCount);
9552#else
9553 return VOS_STATUS_E_FAILURE;
9554#endif
9555 }
9556
9557 pTLCb->uResCount = uResCount;
9558
9559
Jeff Johnson295189b2012-06-20 16:38:30 -07009560#ifdef WLAN_SOFTAP_FLOWCTRL_EN
9561 /* FIXME: disabled since creating issues in power-save, needs to be addressed */
9562 pTLCb->sendFCFrame ++;
9563 pMac = vos_get_context(VOS_MODULE_ID_WDA, pvosGCtx);
9564 systemRole = wdaGetGlobalSystemRole(pMac);
9565 if (eSYSTEM_AP_ROLE == systemRole)
9566 {
9567 if (pTLCb->sendFCFrame % 16 == 0)
9568 {
9569 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9570 "Transmit FC"));
9571 WLANTL_TxFCFrame (pvosGCtx);
9572 }
9573 }
9574#endif //WLAN_SOFTAP_FLOWCTRL_EN
Jeff Johnson295189b2012-06-20 16:38:30 -07009575
9576 ucData = ( pTLCb->uResCount >= WDA_TLI_MIN_RES_DATA );
9577 ucBAP = ( pTLCb->uResCount >= WDA_TLI_MIN_RES_BAP ) &&
9578 ( NULL != pTLCb->tlBAPClient.vosPendingDataBuff );
9579 ucMgmt = ( pTLCb->uResCount >= WDA_TLI_MIN_RES_MF ) &&
9580 ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff );
9581
9582 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9583 "WLAN TL: Eval Resume tx Res: %d DATA: %d BAP: %d MGMT: %d",
9584 pTLCb->uResCount, ucData, ucBAP, ucMgmt));
9585
9586 if (( 0 == pTLCb->ucTxSuspended ) &&
9587 (( 0 != ucData ) || ( 0 != ucMgmt ) || ( 0 != ucBAP ) ) )
9588 {
9589 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9590 "Issuing Xmit start request to BAL for avail res SYNC"));
9591 vosStatus =WDA_DS_StartXmit(pvosGCtx);
9592 }
9593 return vosStatus;
9594}/*WLANTL_GetTxResourcesCB*/
9595
9596/*==========================================================================
9597 Utility functions
9598 ==========================================================================*/
9599
9600/*==========================================================================
9601 FUNCTION WLANTL_Translate8023To80211Header
9602
9603 DESCRIPTION
9604 Inline function for translating and 802.11 header into an 802.3 header.
9605
9606 DEPENDENCIES
9607
9608
9609 PARAMETERS
9610
9611 IN
9612 pTLCb: TL control block
Kiran Venkatappaa044eb92012-12-17 15:48:49 -08009613 IN/OUT
9614 ucStaId: station ID. Incase of TDLS, this returns actual TDLS
9615 station ID used
Jeff Johnson295189b2012-06-20 16:38:30 -07009616
9617 IN/OUT
9618 vosDataBuff: vos data buffer, will contain the new header on output
9619
9620 OUT
9621 pvosStatus: status of the operation
9622
9623 RETURN VALUE
9624
9625 VOS_STATUS_SUCCESS: Everything is good :)
9626
9627 Other error codes might be returned from the vos api used in the function
9628 please check those return values.
9629
9630 SIDE EFFECTS
9631
9632============================================================================*/
Kiran Venkatappacab0d352012-12-17 13:09:22 -08009633VOS_STATUS
9634WLANTL_Translate8023To80211Header
9635(
9636 vos_pkt_t* vosDataBuff,
9637 VOS_STATUS* pvosStatus,
9638 WLANTL_CbType* pTLCb,
9639 v_U8_t *pucStaId,
Ravi Joshid0699502013-07-08 15:48:47 -07009640 WLANTL_MetaInfoType *tlMetaInfo,
Kiran Venkatappacab0d352012-12-17 13:09:22 -08009641 v_U8_t *ucWDSEnabled,
9642 v_U8_t *extraHeadSpace
9643)
Jeff Johnson295189b2012-06-20 16:38:30 -07009644{
9645 WLANTL_8023HeaderType w8023Header;
9646 WLANTL_80211HeaderType *pw80211Header; // Allocate an aligned BD and then fill it.
9647 VOS_STATUS vosStatus;
9648 v_U8_t MandatoryucHeaderSize = WLAN80211_MANDATORY_HEADER_SIZE;
9649 v_U8_t ucHeaderSize = 0;
9650 v_VOID_t *ppvBDHeader = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309651 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07009652 v_U8_t ucQoSOffset = WLAN80211_MANDATORY_HEADER_SIZE;
Kiran Venkatappacab0d352012-12-17 13:09:22 -08009653 v_U8_t ucStaId;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009654#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009655 v_BOOL_t bIAPPTxwithLLC = VOS_FALSE;
9656 v_SIZE_t wIAPPSnapSize = WLANTL_LLC_HEADER_LEN;
9657 v_U8_t wIAPPSnap[WLANTL_LLC_HEADER_LEN] = {0};
9658#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07009659 *ucWDSEnabled = 0; // default WDS off.
9660 vosStatus = vos_pkt_pop_head( vosDataBuff, &w8023Header,
9661 sizeof(w8023Header));
9662
9663 if ( VOS_STATUS_SUCCESS != vosStatus )
9664 {
9665 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9666 "WLAN TL: Packet pop header fails on WLANTL_Translate8023To80211Header"));
9667 return vosStatus;
9668 }
9669
Kiran Venkatappacab0d352012-12-17 13:09:22 -08009670 if( NULL == pucStaId )
9671 {
9672 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9673 "WLAN TL: Invalid pointer for StaId"));
9674 return VOS_STATUS_E_INVAL;
9675 }
9676 ucStaId = *pucStaId;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309677 pClientSTA = pTLCb->atlSTAClients[ucStaId];
9678
9679 if ( NULL == pClientSTA )
9680 {
9681 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9682 "WLAN TL:Client Memory was not allocated on %s", __func__));
9683 return VOS_STATUS_E_FAILURE;
9684 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009685
Kiran Venkatappaa044eb92012-12-17 15:48:49 -08009686#ifdef FEATURE_WLAN_TDLS
9687
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05309688 if ( WLAN_STA_INFRA == pTLCb->atlSTAClients[ucStaId]->wSTADesc.wSTAType
9689 && pTLCb->ucTdlsPeerCount )
Kiran Venkatappacab0d352012-12-17 13:09:22 -08009690 {
9691 v_U8_t ucIndex = 0;
9692 for ( ucIndex = 0; ucIndex < WLAN_MAX_STA_COUNT ; ucIndex++)
9693 {
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05309694 if ( ucIndex != ucStaId && pTLCb->atlSTAClients[ucIndex] && pTLCb->atlSTAClients[ucIndex]->ucExists &&
Gopichand Nakkala471708b2013-06-04 20:03:01 +05309695 (pTLCb->atlSTAClients[ucIndex]->tlState == WLANTL_STA_AUTHENTICATED) &&
9696 (!pTLCb->atlSTAClients[ucIndex]->ucTxSuspended) &&
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05309697 vos_mem_compare( (void*)pTLCb->atlSTAClients[ucIndex]->wSTADesc.vSTAMACAddress.bytes,
Kiran Venkatappacab0d352012-12-17 13:09:22 -08009698 (void*)w8023Header.vDA, 6) )
9699 {
9700 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
9701 "WLAN TL: Got a TDLS station. Using that index"));
9702 ucStaId = ucIndex;
9703 *pucStaId = ucStaId;
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05309704 pClientSTA = pTLCb->atlSTAClients[ucStaId];
9705 if ( NULL == pClientSTA )
9706 {
9707 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9708 "WLAN TL:Client Memory was not allocated on %s", __func__));
9709 return VOS_STATUS_E_FAILURE;
9710 }
Kiran Venkatappacab0d352012-12-17 13:09:22 -08009711 break;
9712 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009713 }
Kiran Venkatappacab0d352012-12-17 13:09:22 -08009714 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009715#endif
9716
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009717#ifdef FEATURE_WLAN_ESE_UPLOAD
9718if ((0 == w8023Header.usLenType) && (pClientSTA->wSTADesc.ucIsEseSta))
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009719{
9720 vos_pkt_extract_data(vosDataBuff,0,&wIAPPSnap[0],&wIAPPSnapSize);
9721 if (vos_mem_compare(wIAPPSnap,WLANTL_AIRONET_SNAP_HEADER,WLANTL_LLC_HEADER_LEN))
9722 {
9723 /*The SNAP and the protocol type are already in the data buffer.
9724 They are filled by the application (wpa_supplicant). So, Skip Adding LLC below.*/
9725 bIAPPTxwithLLC = VOS_TRUE;
9726 }
9727 else
9728 {
9729 bIAPPTxwithLLC = VOS_FALSE;
9730 }
9731}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009732#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07009733
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009734 if ((0 != pClientSTA->wSTADesc.ucAddRmvLLC)
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009735#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009736 && (!bIAPPTxwithLLC)
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009737#endif /* FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009738 )
Jeff Johnson295189b2012-06-20 16:38:30 -07009739 {
9740 /* Push the length */
9741 vosStatus = vos_pkt_push_head(vosDataBuff,
9742 &w8023Header.usLenType, sizeof(w8023Header.usLenType));
9743
9744 if ( VOS_STATUS_SUCCESS != vosStatus )
9745 {
9746 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9747 "WLAN TL: Packet push ether type fails on"
9748 " WLANTL_Translate8023To80211Header"));
9749 return vosStatus;
9750 }
9751
9752#ifdef BTAMP_TEST
9753 // The STA side will execute this, a hack to test BTAMP by using the
9754 // infra setup. On real BTAMP this will come from BAP itself.
9755 {
9756 static v_U8_t WLANTL_BT_AMP_LLC_HEADER[] = {0xAA, 0xAA, 0x03, 0x00, 0x19, 0x58 };
9757 vosStatus = vos_pkt_push_head(vosDataBuff, WLANTL_BT_AMP_LLC_HEADER,
9758 sizeof(WLANTL_BT_AMP_LLC_HEADER));
9759
9760 if ( VOS_STATUS_SUCCESS != vosStatus )
9761 {
9762 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9763 "WLAN TL: Packet push LLC header fails on"
9764 " WLANTL_Translate8023To80211Header"));
9765 return vosStatus;
9766 }
9767 }
9768#else
9769 vosStatus = vos_pkt_push_head(vosDataBuff, WLANTL_LLC_HEADER,
9770 sizeof(WLANTL_LLC_HEADER));
9771
9772 if ( VOS_STATUS_SUCCESS != vosStatus )
9773 {
9774 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9775 "WLAN TL: Packet push LLC header fails on"
9776 " WLANTL_Translate8023To80211Header"));
9777 return vosStatus;
9778 }
9779#endif
9780 }/*If add LLC is enabled*/
9781 else
9782 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009783#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009784 bIAPPTxwithLLC = VOS_FALSE; /*Reset the Flag here to start afresh with the next TX pkt*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009785#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07009786 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9787 "WLAN TL: STA Client registered to not remove LLC"
9788 " WLANTL_Translate8023To80211Header"));
9789 }
9790
9791#ifdef BTAMP_TEST
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309792 pClientSTA->wSTADesc.wSTAType = WLAN_STA_BT_AMP;
Jeff Johnson295189b2012-06-20 16:38:30 -07009793#endif
9794
9795 // Find the space required for the 802.11 header format
9796 // based on the frame control fields.
9797 ucHeaderSize = MandatoryucHeaderSize;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309798 if (pClientSTA->wSTADesc.ucQosEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -07009799 {
9800 ucHeaderSize += sizeof(pw80211Header->usQosCtrl);
9801 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309802 if (pClientSTA->wSTADesc.wSTAType == WLAN_STA_BT_AMP)
Jeff Johnson295189b2012-06-20 16:38:30 -07009803 {
9804 ucHeaderSize += sizeof(pw80211Header->optvA4);
Jeff Johnson295189b2012-06-20 16:38:30 -07009805 ucQoSOffset += sizeof(pw80211Header->optvA4);
Jeff Johnson295189b2012-06-20 16:38:30 -07009806 }
9807
9808 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9809 " WLANTL_Translate8023To80211Header : Header size = %d ", ucHeaderSize));
9810
9811 vos_pkt_reserve_head( vosDataBuff, &ppvBDHeader, ucHeaderSize );
9812 if ( NULL == ppvBDHeader )
9813 {
9814 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9815 "WLAN TL:VOSS packet corrupted "));
9816 *pvosStatus = VOS_STATUS_E_INVAL;
9817 return *pvosStatus;
9818 }
9819
Jeff Johnson295189b2012-06-20 16:38:30 -07009820
9821 // OK now we have the space. Fill the 80211 header
9822 /* Fill A2 */
9823 pw80211Header = (WLANTL_80211HeaderType *)(ppvBDHeader);
9824 // only clear the required space.
9825 vos_mem_set( pw80211Header, ucHeaderSize, 0 );
9826 vos_mem_copy( pw80211Header->vA2, w8023Header.vSA, VOS_MAC_ADDR_SIZE);
9827
9828
9829#ifdef FEATURE_WLAN_WAPI
Gopichand Nakkala8b54e912013-03-11 10:44:21 +05309830 if (( WLANTL_STA_AUTHENTICATED == pClientSTA->tlState ||
9831 pClientSTA->ptkInstalled ) && gUcIsWai != 1)
Jeff Johnson295189b2012-06-20 16:38:30 -07009832#else
Gopichand Nakkala8b54e912013-03-11 10:44:21 +05309833 if ( WLANTL_STA_AUTHENTICATED == pClientSTA->tlState ||
9834 pClientSTA->ptkInstalled )
Jeff Johnson295189b2012-06-20 16:38:30 -07009835#endif
9836 {
9837 pw80211Header->wFrmCtrl.wep =
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309838 pClientSTA->wSTADesc.ucProtectedFrame;
Jeff Johnson295189b2012-06-20 16:38:30 -07009839 }
9840
9841 pw80211Header->usDurationId = 0;
9842 pw80211Header->usSeqCtrl = 0;
9843
9844 pw80211Header->wFrmCtrl.type = WLANTL_80211_DATA_TYPE;
9845
9846
9847
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309848 if(pClientSTA->wSTADesc.ucQosEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -07009849 {
9850 pw80211Header->wFrmCtrl.subType = WLANTL_80211_DATA_QOS_SUBTYPE;
9851
Ravi Joshid0699502013-07-08 15:48:47 -07009852 *((v_U16_t *)((v_U8_t *)ppvBDHeader + ucQoSOffset)) = tlMetaInfo->ucUP;
Jeff Johnson295189b2012-06-20 16:38:30 -07009853
9854 }
9855 else
9856 {
9857 pw80211Header->wFrmCtrl.subType = 0;
9858
9859 // NO NO NO - there is not enough memory allocated to write the QOS ctrl
9860 // field, it will overwrite the first 2 bytes of the data packet(LLC header)
9861 // pw80211Header->usQosCtrl = 0;
9862 }
9863
9864
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309865 switch( pClientSTA->wSTADesc.wSTAType )
Jeff Johnson295189b2012-06-20 16:38:30 -07009866 {
Ravi Joshid0699502013-07-08 15:48:47 -07009867 case WLAN_STA_IBSS:
Jeff Johnson295189b2012-06-20 16:38:30 -07009868 pw80211Header->wFrmCtrl.toDS = 0;
9869 pw80211Header->wFrmCtrl.fromDS = 0;
Ravi Joshid0699502013-07-08 15:48:47 -07009870
9871 /*
9872 * If the frame is a multicast frame, then, the Address1
9873 * should be the destination address filled in the packet. Which is
9874 * the multicast address. Otherwise, set it to BSSID
9875 */
9876 if (0 == tlMetaInfo->ucBcast && 1 == tlMetaInfo->ucMcast)
9877 {
9878 vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1,
9879 (v_MACADDR_t*)&w8023Header.vDA);
9880 }
9881 else
9882 {
9883 vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1,
9884 &pClientSTA->wSTADesc.vSTAMACAddress);
9885 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009886 vos_mem_copy( pw80211Header->vA3,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309887 &pClientSTA->wSTADesc.vBSSIDforIBSS ,
Jeff Johnson295189b2012-06-20 16:38:30 -07009888 VOS_MAC_ADDR_SIZE);
9889 break;
9890
Ravi Joshid0699502013-07-08 15:48:47 -07009891 case WLAN_STA_BT_AMP:
Jeff Johnson295189b2012-06-20 16:38:30 -07009892 *ucWDSEnabled = 1; // WDS on.
9893 pw80211Header->wFrmCtrl.toDS = 1;
9894 pw80211Header->wFrmCtrl.fromDS = 1;
9895 vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309896 &pClientSTA->wSTADesc.vSTAMACAddress);
Jeff Johnson295189b2012-06-20 16:38:30 -07009897 vos_mem_copy( pw80211Header->vA2,
Ravi Joshid0699502013-07-08 15:48:47 -07009898 w8023Header.vSA, VOS_MAC_ADDR_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07009899 vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA3,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309900 &pClientSTA->wSTADesc.vSTAMACAddress);
Jeff Johnson295189b2012-06-20 16:38:30 -07009901 /* fill the optional A4 header */
9902 vos_mem_copy( pw80211Header->optvA4,
Ravi Joshid0699502013-07-08 15:48:47 -07009903 w8023Header.vSA, VOS_MAC_ADDR_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07009904 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -08009905 "BTAMP CASE NOW ---------staid=%d",
Ravi Joshid0699502013-07-08 15:48:47 -07009906 ucStaId));
Jeff Johnson295189b2012-06-20 16:38:30 -07009907 break;
9908
Ravi Joshid0699502013-07-08 15:48:47 -07009909 case WLAN_STA_SOFTAP:
Jeff Johnson295189b2012-06-20 16:38:30 -07009910 *ucWDSEnabled = 0; // WDS off.
9911 pw80211Header->wFrmCtrl.toDS = 0;
9912 pw80211Header->wFrmCtrl.fromDS = 1;
9913 /*Copy the DA to A1*/
9914 vos_mem_copy( pw80211Header->vA1, w8023Header.vDA , VOS_MAC_ADDR_SIZE);
9915 vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA2,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309916 &pClientSTA->wSTADesc.vSelfMACAddress);
Jeff Johnson295189b2012-06-20 16:38:30 -07009917 vos_mem_copy( pw80211Header->vA3,
Ravi Joshid0699502013-07-08 15:48:47 -07009918 w8023Header.vSA, VOS_MAC_ADDR_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07009919 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -08009920 "sw 802 to 80211 softap case ---------staid=%d",
Ravi Joshid0699502013-07-08 15:48:47 -07009921 ucStaId));
Jeff Johnson295189b2012-06-20 16:38:30 -07009922 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009923#ifdef FEATURE_WLAN_TDLS
Ravi Joshid0699502013-07-08 15:48:47 -07009924 case WLAN_STA_TDLS:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009925 pw80211Header->wFrmCtrl.toDS = 0;
9926 pw80211Header->wFrmCtrl.fromDS = 0;
9927 /*Fix me*/
9928 vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309929 &pClientSTA->wSTADesc.vSTAMACAddress);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009930 vos_mem_copy( pw80211Header->vA3,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309931 &pClientSTA->wSTADesc.vBSSIDforIBSS ,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009932 VOS_MAC_ADDR_SIZE);
9933 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -08009934 ("TL:TDLS CASE NOW ---------staid=%d"), ucStaId);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009935 break;
9936#endif
Ravi Joshid0699502013-07-08 15:48:47 -07009937 case WLAN_STA_INFRA:
9938 default:
Jeff Johnson295189b2012-06-20 16:38:30 -07009939 pw80211Header->wFrmCtrl.toDS = 1;
9940 pw80211Header->wFrmCtrl.fromDS = 0;
9941 vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309942 &pClientSTA->wSTADesc.vSTAMACAddress);
Jeff Johnson295189b2012-06-20 16:38:30 -07009943 vos_mem_copy( pw80211Header->vA3, w8023Header.vDA , VOS_MAC_ADDR_SIZE);
9944 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -08009945 "REGULAR INFRA LINK CASE---------staid=%d",
Ravi Joshid0699502013-07-08 15:48:47 -07009946 ucStaId));
Jeff Johnson295189b2012-06-20 16:38:30 -07009947 break;
9948 }
9949 // OK now we have the space. Fill the 80211 header
9950 /* Fill A2 */
9951 pw80211Header = (WLANTL_80211HeaderType *)(ppvBDHeader);
9952 return VOS_STATUS_SUCCESS;
9953}/*WLANTL_Translate8023To80211Header*/
9954
9955
9956/*=============================================================================
9957 BEGIN LOG FUNCTION !!! Remove me or clean me
9958=============================================================================*/
Ravi Kumar Vaishnavb7652402013-01-18 19:05:15 -08009959#if 0 //def WLANTL_DEBUG
Jeff Johnson295189b2012-06-20 16:38:30 -07009960
9961#define WLANTL_DEBUG_FRAME_BYTE_PER_LINE 16
9962#define WLANTL_DEBUG_FRAME_BYTE_PER_BYTE 4
9963
9964static v_VOID_t WLANTL_DebugFrame
9965(
9966 v_PVOID_t dataPointer,
9967 v_U32_t dataSize
9968)
9969{
9970 v_U8_t lineBuffer[WLANTL_DEBUG_FRAME_BYTE_PER_LINE];
9971 v_U32_t numLines;
9972 v_U32_t numBytes;
9973 v_U32_t idx;
9974 v_U8_t *linePointer;
9975
9976 numLines = dataSize / WLANTL_DEBUG_FRAME_BYTE_PER_LINE;
9977 numBytes = dataSize % WLANTL_DEBUG_FRAME_BYTE_PER_LINE;
9978 linePointer = (v_U8_t *)dataPointer;
9979
9980 TLLOGE(VOS_TRACE(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR, "WLAN TL:Frame Debug Frame Size %d, Pointer 0x%p", dataSize, dataPointer));
9981 for(idx = 0; idx < numLines; idx++)
9982 {
9983 memset(lineBuffer, 0, WLANTL_DEBUG_FRAME_BYTE_PER_LINE);
9984 memcpy(lineBuffer, linePointer, WLANTL_DEBUG_FRAME_BYTE_PER_LINE);
9985 TLLOGE(VOS_TRACE(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR,
9986 "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",
9987 lineBuffer[0], lineBuffer[1], lineBuffer[2], lineBuffer[3], lineBuffer[4], lineBuffer[5], lineBuffer[6], lineBuffer[7],
9988 lineBuffer[8], lineBuffer[9], lineBuffer[10], lineBuffer[11], lineBuffer[12], lineBuffer[13], lineBuffer[14], lineBuffer[15]));
9989 linePointer += WLANTL_DEBUG_FRAME_BYTE_PER_LINE;
9990 }
9991
9992 if(0 == numBytes)
9993 return;
9994
9995 memset(lineBuffer, 0, WLANTL_DEBUG_FRAME_BYTE_PER_LINE);
9996 memcpy(lineBuffer, linePointer, numBytes);
9997 for(idx = 0; idx < WLANTL_DEBUG_FRAME_BYTE_PER_LINE / WLANTL_DEBUG_FRAME_BYTE_PER_BYTE; idx++)
9998 {
9999 TLLOGE(VOS_TRACE(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR, "WLAN TL:0x%2x 0x%2x 0x%2x 0x%2x",
10000 lineBuffer[idx * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE], lineBuffer[1 + idx * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE],
10001 lineBuffer[2 + idx * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE], lineBuffer[3 + idx * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE]));
10002 if(((idx + 1) * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE) >= numBytes)
10003 break;
10004 }
10005
10006 return;
10007}
10008#endif
10009
10010/*=============================================================================
10011 END LOG FUNCTION
10012=============================================================================*/
10013
10014/*==========================================================================
10015 FUNCTION WLANTL_Translate80211To8023Header
10016
10017 DESCRIPTION
10018 Inline function for translating and 802.11 header into an 802.3 header.
10019
10020 DEPENDENCIES
10021
10022
10023 PARAMETERS
10024
10025 IN
10026 pTLCb: TL control block
10027 ucStaId: station ID
10028 ucHeaderLen: Length of the header from BD
10029 ucActualHLen: Length of header including padding or any other trailers
10030
10031 IN/OUT
10032 vosDataBuff: vos data buffer, will contain the new header on output
10033
10034 OUT
10035 pvosStatus: status of the operation
10036
10037 RETURN VALUE
10038
10039 The result code associated with performing the operation
10040 VOS_STATUS_SUCCESS: Everything is good :)
10041
10042 SIDE EFFECTS
10043
10044============================================================================*/
10045VOS_STATUS
10046WLANTL_Translate80211To8023Header
10047(
10048 vos_pkt_t* vosDataBuff,
10049 VOS_STATUS* pvosStatus,
10050 v_U16_t usActualHLen,
10051 v_U8_t ucHeaderLen,
10052 WLANTL_CbType* pTLCb,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010053 v_U8_t ucSTAId,
10054 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -070010055)
10056{
10057 WLANTL_8023HeaderType w8023Header;
10058 WLANTL_80211HeaderType w80211Header;
10059 v_U8_t aucLLCHeader[WLANTL_LLC_HEADER_LEN];
10060 VOS_STATUS vosStatus;
10061 v_U16_t usDataStartOffset = 0;
10062 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
10063
10064 if ( sizeof(w80211Header) < ucHeaderLen )
10065 {
10066 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10067 "Warning !: Check the header size for the Rx frame structure=%d received=%dn",
10068 sizeof(w80211Header), ucHeaderLen));
10069 ucHeaderLen = sizeof(w80211Header);
10070 }
10071
10072 // This will take care of headers of all sizes, 3 address, 3 addr QOS,
10073 // WDS non-QOS and WDS QoS etc. We have space for all in the 802.11 header structure.
10074 vosStatus = vos_pkt_pop_head( vosDataBuff, &w80211Header, ucHeaderLen);
10075
10076 if ( VOS_STATUS_SUCCESS != vosStatus )
10077 {
10078 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10079 "WLAN TL: Failed to pop 80211 header from packet %d",
10080 vosStatus));
10081
10082 return vosStatus;
10083 }
10084
10085 switch ( w80211Header.wFrmCtrl.fromDS )
10086 {
10087 case 0:
Jeff Johnson295189b2012-06-20 16:38:30 -070010088 if ( w80211Header.wFrmCtrl.toDS )
10089 {
10090 //SoftAP AP mode
10091 vos_mem_copy( w8023Header.vDA, w80211Header.vA3, VOS_MAC_ADDR_SIZE);
10092 vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE);
10093 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -080010094 "WLAN TL SoftAP: 802 3 DA %08x SA %08x",
Jeff Johnson295189b2012-06-20 16:38:30 -070010095 w8023Header.vDA, w8023Header.vSA));
10096 }
10097 else
10098 {
10099 /* IBSS */
10100 vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE);
10101 vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE);
10102 }
Jeff Johnson295189b2012-06-20 16:38:30 -070010103 break;
10104 case 1:
10105 if ( w80211Header.wFrmCtrl.toDS )
10106 {
10107 /* BT-AMP case */
10108 vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE);
10109 vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE);
10110 }
10111 else
10112 { /* Infra */
10113 vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE);
10114 vos_mem_copy( w8023Header.vSA, w80211Header.vA3, VOS_MAC_ADDR_SIZE);
10115 }
10116 break;
10117 }
10118
10119 if( usActualHLen > ucHeaderLen )
10120 {
10121 usDataStartOffset = usActualHLen - ucHeaderLen;
10122 }
10123
10124 if ( 0 < usDataStartOffset )
10125 {
10126 vosStatus = vos_pkt_trim_head( vosDataBuff, usDataStartOffset );
10127
10128 if ( VOS_STATUS_SUCCESS != vosStatus )
10129 {
10130 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10131 "WLAN TL: Failed to trim header from packet %d",
10132 vosStatus));
10133 return vosStatus;
10134 }
10135 }
10136
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010137 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
10138 {
10139 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10140 "WLAN TL:Client Memory was not allocated on %s", __func__));
10141 return VOS_STATUS_E_FAILURE;
10142 }
10143
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010144 if ( 0 != pTLCb->atlSTAClients[ucSTAId]->wSTADesc.ucAddRmvLLC
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010145#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010146 && (!bForwardIAPPwithLLC)
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010147#endif /* FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010148 )
Jeff Johnson295189b2012-06-20 16:38:30 -070010149 {
10150 // Extract the LLC header
10151 vosStatus = vos_pkt_pop_head( vosDataBuff, aucLLCHeader,
10152 WLANTL_LLC_HEADER_LEN);
10153
10154 if ( VOS_STATUS_SUCCESS != vosStatus )
10155 {
Kaushik, Sushante386ee12014-05-01 15:50:52 +053010156 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Jeff Johnson295189b2012-06-20 16:38:30 -070010157 "WLAN TL: Failed to pop LLC header from packet %d",
10158 vosStatus));
10159
10160 return vosStatus;
10161 }
10162
10163 //Extract the length
10164 vos_mem_copy(&w8023Header.usLenType,
10165 &aucLLCHeader[WLANTL_LLC_HEADER_LEN - sizeof(w8023Header.usLenType)],
10166 sizeof(w8023Header.usLenType) );
10167 }
10168 else
10169 {
10170 vosStatus = vos_pkt_get_packet_length(vosDataBuff,
10171 &w8023Header.usLenType);
10172
10173 if ( VOS_STATUS_SUCCESS != vosStatus )
10174 {
10175 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10176 "WLAN TL: Failed to get packet length %d",
10177 vosStatus));
10178
10179 return vosStatus;
10180 }
10181
10182 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10183 "WLAN TL: BTAMP len (ethertype) fld = %d",
10184 w8023Header.usLenType));
10185 w8023Header.usLenType = vos_cpu_to_be16(w8023Header.usLenType);
10186 }
10187
10188 vos_pkt_push_head(vosDataBuff, &w8023Header, sizeof(w8023Header));
10189
10190#ifdef BTAMP_TEST
10191 {
10192 // AP side will execute this.
10193 v_U8_t *temp_w8023Header = NULL;
10194 vosStatus = vos_pkt_peek_data( vosDataBuff, 0,
10195 &temp_w8023Header, sizeof(w8023Header) );
10196 }
10197#endif
10198#if 0 /*TL_DEBUG*/
10199 vos_pkt_get_packet_length(vosDataBuff, &usLen);
10200 vos_pkt_pop_head( vosDataBuff, aucData, usLen);
10201
10202 WLANTL_DebugFrame(aucData, usLen);
10203
10204 vos_pkt_push_head(vosDataBuff, aucData, usLen);
10205
10206#endif
10207
10208 *pvosStatus = VOS_STATUS_SUCCESS;
10209
10210 return VOS_STATUS_SUCCESS;
10211}/*WLANTL_Translate80211To8023Header*/
10212
Madan Mohan Koyyalamudia148e1e2012-11-30 14:52:59 -080010213/*==========================================================================
10214 FUNCTION WLANTL_FindFrameTypeBcMcUc
10215
10216 DESCRIPTION
10217 Utility function to find whether received frame is broadcast, multicast
10218 or unicast.
10219
10220 DEPENDENCIES
10221 The STA must be registered with TL before this function can be called.
10222
10223 PARAMETERS
10224
10225 IN
10226 pTLCb: pointer to the TL's control block
10227 ucSTAId: identifier of the station being processed
10228 vosDataBuff: pointer to the vos buffer
10229
10230 IN/OUT
10231 pucBcMcUc: pointer to buffer, will contain frame type on return
10232
10233 RETURN VALUE
10234 The result code associated with performing the operation
10235
10236 VOS_STATUS_E_INVAL: invalid input parameters
10237 VOS_STATUS_E_BADMSG: failed to extract info from data buffer
10238 VOS_STATUS_SUCCESS: success
10239
10240 SIDE EFFECTS
10241 None.
10242============================================================================*/
10243VOS_STATUS
10244WLANTL_FindFrameTypeBcMcUc
10245(
10246 WLANTL_CbType *pTLCb,
10247 v_U8_t ucSTAId,
10248 vos_pkt_t *vosDataBuff,
10249 v_U8_t *pucBcMcUc
10250)
10251{
10252 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
10253 v_PVOID_t aucBDHeader;
10254 v_PVOID_t pvPeekData;
10255 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
10256
10257 /*------------------------------------------------------------------------
10258 Sanity check
10259 ------------------------------------------------------------------------*/
10260 if ((NULL == pTLCb) ||
10261 (NULL == vosDataBuff) ||
10262 (NULL == pucBcMcUc))
10263 {
10264 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10265 "WLAN TL:Invalid parameter in WLANTL_FindFrameTypeBcMcUc"));
10266 return VOS_STATUS_E_INVAL;
10267 }
10268
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010269 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
10270 {
10271 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10272 "WLAN TL:Client Memory was not allocated on %s", __func__));
10273 return VOS_STATUS_E_FAILURE;
10274 }
10275
Madan Mohan Koyyalamudia148e1e2012-11-30 14:52:59 -080010276 /*------------------------------------------------------------------------
10277 Extract BD header and check if valid
10278 ------------------------------------------------------------------------*/
10279 vosStatus = WDA_DS_PeekRxPacketInfo(vosDataBuff, (v_PVOID_t)&aucBDHeader, 0/*Swap BD*/ );
10280
10281 if (NULL == aucBDHeader)
10282 {
10283 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10284 "WLAN TL:WLANTL_FindFrameTypeBcMcUc - Cannot extract BD header"));
10285 VOS_ASSERT(0);
10286 return VOS_STATUS_E_BADMSG;
10287 }
10288
10289 if ((0 == WDA_GET_RX_FT_DONE(aucBDHeader)) &&
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010290 (0 != pTLCb->atlSTAClients[ucSTAId]->wSTADesc.ucSwFrameRXXlation))
Madan Mohan Koyyalamudia148e1e2012-11-30 14:52:59 -080010291 {
10292 /* Its an 802.11 frame, extract MAC address 1 */
10293 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10294 "WLAN TL:WLANTL_FindFrameTypeBcMcUc - 802.11 frame, peeking Addr1"));
10295 vosStatus = vos_pkt_peek_data(vosDataBuff, WLANTL_MAC_ADDR_ALIGN(1),
10296 (v_PVOID_t)&pvPeekData, VOS_MAC_ADDR_SIZE);
10297 }
10298 else
10299 {
10300 /* Its an 802.3 frame, extract Destination MAC address */
10301 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10302 "WLAN TL:WLANTL_FindFrameTypeBcMcUc - 802.3 frame, peeking DA"));
10303 vosStatus = vos_pkt_peek_data(vosDataBuff, WLANTL_MAC_ADDR_ALIGN(0),
10304 (v_PVOID_t)&pvPeekData, VOS_MAC_ADDR_SIZE);
10305 }
10306
10307 if (VOS_STATUS_SUCCESS != vosStatus)
10308 {
10309 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10310 "WLAN TL:WLANTL_FindFrameTypeBcMcUc - Failed to peek MAC address"));
10311 return vosStatus;
10312 }
10313
10314 if (((tANI_U8 *)pvPeekData)[0] == 0xff)
10315 {
10316 *pucBcMcUc = WLANTL_FRAME_TYPE_BCAST;
10317 }
10318 else
10319 {
10320 if ((((tANI_U8 *)pvPeekData)[0] & 0x01) == 0x01)
10321 *pucBcMcUc = WLANTL_FRAME_TYPE_MCAST;
10322 else
10323 *pucBcMcUc = WLANTL_FRAME_TYPE_UCAST;
10324 }
10325
10326 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10327 "WLAN TL:WLANTL_FindFrameTypeBcMcUc - Addr1Byte1 is: %x",
10328 ((tANI_U8 *)pvPeekData)[0]));
10329
10330 return VOS_STATUS_SUCCESS;
10331}
10332
Jeff Johnson295189b2012-06-20 16:38:30 -070010333#if 0
10334#ifdef WLAN_PERF
10335/*==========================================================================
10336 FUNCTION WLANTL_FastHwFwdDataFrame
10337
10338 DESCRIPTION
10339 Fast path function to quickly forward a data frame if HAL determines BD
10340 signature computed here matches the signature inside current VOSS packet.
10341 If there is a match, HAL and TL fills in the swapped packet length into
10342 BD header and DxE header, respectively. Otherwise, packet goes back to
10343 normal (slow) path and a new BD signature would be tagged into BD in this
10344 VOSS packet later by the WLANHAL_FillTxBd() function.
10345
10346 DEPENDENCIES
10347
10348 PARAMETERS
10349
10350 IN
10351 pvosGCtx VOS context
10352 vosDataBuff Ptr to VOSS packet
10353 pMetaInfo For getting frame's TID
10354 pStaInfo For checking STA type
10355
10356 OUT
10357 pvosStatus returned status
10358 puFastFwdOK Flag to indicate whether frame could be fast forwarded
10359
10360 RETURN VALUE
10361 No return.
10362
10363 SIDE EFFECTS
10364
10365============================================================================*/
10366static void
10367WLANTL_FastHwFwdDataFrame
10368(
10369 v_PVOID_t pvosGCtx,
10370 vos_pkt_t* vosDataBuff,
10371 VOS_STATUS* pvosStatus,
10372 v_U32_t* puFastFwdOK,
10373 WLANTL_MetaInfoType* pMetaInfo,
10374 WLAN_STADescType* pStaInfo
10375
10376)
10377{
10378 v_PVOID_t pvPeekData;
10379 v_U8_t ucDxEBDWLANHeaderLen = WLANTL_BD_HEADER_LEN(0) + sizeof(WLANBAL_sDXEHeaderType);
10380 v_U8_t ucIsUnicast;
10381 WLANBAL_sDXEHeaderType *pDxEHeader;
10382 v_PVOID_t pvBDHeader;
10383 v_PVOID_t pucBuffPtr;
10384 v_U16_t usPktLen;
10385
10386 /*-----------------------------------------------------------------------
10387 Extract packet length
10388 -----------------------------------------------------------------------*/
10389
10390 vos_pkt_get_packet_length( vosDataBuff, &usPktLen);
10391
10392 /*-----------------------------------------------------------------------
10393 Extract MAC address
10394 -----------------------------------------------------------------------*/
10395 *pvosStatus = vos_pkt_peek_data( vosDataBuff,
10396 WLANTL_MAC_ADDR_ALIGN(0),
10397 (v_PVOID_t)&pvPeekData,
10398 VOS_MAC_ADDR_SIZE );
10399
10400 if ( VOS_STATUS_SUCCESS != *pvosStatus )
10401 {
10402 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10403 "WLAN TL:Failed while attempting to extract MAC Addr %d",
10404 *pvosStatus));
10405 *pvosStatus = VOS_STATUS_E_INVAL;
10406 return;
10407 }
10408
10409 /*-----------------------------------------------------------------------
10410 Reserve head room for DxE header, BD, and WLAN header
10411 -----------------------------------------------------------------------*/
10412
10413 vos_pkt_reserve_head( vosDataBuff, &pucBuffPtr,
10414 ucDxEBDWLANHeaderLen );
10415 if ( NULL == pucBuffPtr )
10416 {
10417 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10418 "WLAN TL:No enough space in VOSS packet %p for DxE/BD/WLAN header", vosDataBuff));
10419 *pvosStatus = VOS_STATUS_E_INVAL;
10420 return;
10421 }
10422 pDxEHeader = (WLANBAL_sDXEHeaderType *)pucBuffPtr;
10423 pvBDHeader = (v_PVOID_t) &pDxEHeader[1];
10424
10425 /* UMA Tx acceleration is enabled.
10426 * UMA would help convert frames to 802.11, fill partial BD fields and
10427 * construct LLC header. To further accelerate this kind of frames,
10428 * HAL would attempt to reuse the BD descriptor if the BD signature
10429 * matches to the saved BD descriptor.
10430 */
10431 if(pStaInfo->wSTAType == WLAN_STA_IBSS)
10432 ucIsUnicast = !(((tANI_U8 *)pvPeekData)[0] & 0x01);
10433 else
10434 ucIsUnicast = 1;
10435
10436 *puFastFwdOK = (v_U32_t) WLANHAL_TxBdFastFwd(pvosGCtx, pvPeekData, pMetaInfo->ucTID, ucIsUnicast, pvBDHeader, usPktLen );
10437
10438 /* Can't be fast forwarded. Trim the VOS head back to original location. */
10439 if(! *puFastFwdOK){
10440 vos_pkt_trim_head(vosDataBuff, ucDxEBDWLANHeaderLen);
10441 }else{
10442 /* could be fast forwarded. Now notify BAL DxE header filling could be completely skipped
10443 */
10444 v_U32_t uPacketSize = WLANTL_BD_HEADER_LEN(0) + usPktLen;
10445 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAL,
10446 (v_PVOID_t)uPacketSize);
10447 pDxEHeader->size = SWAP_ENDIAN_UINT32(uPacketSize);
10448 }
10449 *pvosStatus = VOS_STATUS_SUCCESS;
10450 return;
10451}
10452#endif /*WLAN_PERF*/
10453#endif
10454
10455#if 0
10456/*==========================================================================
10457 FUNCTION WLANTL_PrepareBDHeader
10458
10459 DESCRIPTION
10460 Inline function for preparing BD header before HAL processing.
10461
10462 DEPENDENCIES
10463 Just notify HAL that suspend in TL is complete.
10464
10465 PARAMETERS
10466
10467 IN
10468 vosDataBuff: vos data buffer
10469 ucDisableFrmXtl: is frame xtl disabled
10470
10471 OUT
10472 ppvBDHeader: it will contain the BD header
10473 pvDestMacAdddr: it will contain the destination MAC address
10474 pvosStatus: status of the combined processing
10475 pusPktLen: packet len.
10476
10477 RETURN VALUE
10478 No return.
10479
10480 SIDE EFFECTS
10481
10482============================================================================*/
10483void
10484WLANTL_PrepareBDHeader
10485(
10486 vos_pkt_t* vosDataBuff,
10487 v_PVOID_t* ppvBDHeader,
10488 v_MACADDR_t* pvDestMacAdddr,
10489 v_U8_t ucDisableFrmXtl,
10490 VOS_STATUS* pvosStatus,
10491 v_U16_t* pusPktLen,
10492 v_U8_t ucQosEnabled,
10493 v_U8_t ucWDSEnabled,
10494 v_U8_t extraHeadSpace
10495)
10496{
10497 v_U8_t ucHeaderOffset;
10498 v_U8_t ucHeaderLen;
Jeff Johnson295189b2012-06-20 16:38:30 -070010499 v_U8_t ucBDHeaderLen = WLANTL_BD_HEADER_LEN(ucDisableFrmXtl);
10500
10501 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
10502 /*-------------------------------------------------------------------------
10503 Get header pointer from VOSS
10504 !!! make sure reserve head zeros out the memory
10505 -------------------------------------------------------------------------*/
10506 vos_pkt_get_packet_length( vosDataBuff, pusPktLen);
10507
10508 if ( WLANTL_MAC_HEADER_LEN(ucDisableFrmXtl) > *pusPktLen )
10509 {
10510 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10511 "WLAN TL: Length of the packet smaller than expected network"
10512 " header %d", *pusPktLen ));
10513
10514 *pvosStatus = VOS_STATUS_E_INVAL;
10515 return;
10516 }
10517
10518 vos_pkt_reserve_head( vosDataBuff, ppvBDHeader,
10519 ucBDHeaderLen );
10520 if ( NULL == *ppvBDHeader )
10521 {
10522 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10523 "WLAN TL:VOSS packet corrupted on Attach BD header"));
10524 *pvosStatus = VOS_STATUS_E_INVAL;
10525 return;
10526 }
10527
10528 /*-----------------------------------------------------------------------
10529 Extract MAC address
10530 -----------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -070010531 {
10532 v_SIZE_t usMacAddrSize = VOS_MAC_ADDR_SIZE;
10533 *pvosStatus = vos_pkt_extract_data( vosDataBuff,
10534 ucBDHeaderLen +
10535 WLANTL_MAC_ADDR_ALIGN(ucDisableFrmXtl),
10536 (v_PVOID_t)pvDestMacAdddr,
10537 &usMacAddrSize );
10538 }
Jeff Johnson295189b2012-06-20 16:38:30 -070010539 if ( VOS_STATUS_SUCCESS != *pvosStatus )
10540 {
10541 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10542 "WLAN TL:Failed while attempting to extract MAC Addr %d",
10543 *pvosStatus));
10544 }
10545 else
10546 {
10547 /*---------------------------------------------------------------------
10548 Fill MPDU info fields:
10549 - MPDU data start offset
10550 - MPDU header start offset
10551 - MPDU header length
10552 - MPDU length - this is a 16b field - needs swapping
10553 --------------------------------------------------------------------*/
10554 ucHeaderOffset = ucBDHeaderLen;
10555 ucHeaderLen = WLANTL_MAC_HEADER_LEN(ucDisableFrmXtl);
10556
10557 if ( 0 != ucDisableFrmXtl )
10558 {
10559 if ( 0 != ucQosEnabled )
10560 {
10561 ucHeaderLen += WLANTL_802_11_HEADER_QOS_CTL;
10562 }
10563
10564 // Similar to Qos we need something for WDS format !
10565 if ( ucWDSEnabled != 0 )
10566 {
10567 // If we have frame translation enabled
10568 ucHeaderLen += WLANTL_802_11_HEADER_ADDR4_LEN;
10569 }
10570 if ( extraHeadSpace != 0 )
10571 {
10572 // Decrease the packet length with the extra padding after the header
10573 *pusPktLen = *pusPktLen - extraHeadSpace;
10574 }
10575 }
10576
10577 WLANHAL_TX_BD_SET_MPDU_HEADER_LEN( *ppvBDHeader, ucHeaderLen);
10578 WLANHAL_TX_BD_SET_MPDU_HEADER_OFFSET( *ppvBDHeader, ucHeaderOffset);
10579 WLANHAL_TX_BD_SET_MPDU_DATA_OFFSET( *ppvBDHeader,
10580 ucHeaderOffset + ucHeaderLen + extraHeadSpace);
10581 WLANHAL_TX_BD_SET_MPDU_LEN( *ppvBDHeader, *pusPktLen);
10582
10583 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10584 "WLAN TL: VALUES ARE HLen=%x Hoff=%x doff=%x len=%x ex=%d",
10585 ucHeaderLen, ucHeaderOffset,
10586 (ucHeaderOffset + ucHeaderLen + extraHeadSpace),
10587 *pusPktLen, extraHeadSpace));
10588 }/* if peek MAC success*/
10589
10590}/* WLANTL_PrepareBDHeader */
10591#endif
10592
Jeff Johnson295189b2012-06-20 16:38:30 -070010593//THIS IS A HACK AND NEEDS TO BE FIXED FOR CONCURRENCY
10594/*==========================================================================
10595 FUNCTION WLAN_TLGetNextTxIds
10596
10597 DESCRIPTION
10598 Gets the next station and next AC in the list that should be served by the TL.
10599
10600 Multiple Station Scheduling and TL queue management.
10601
10602 4 HDD BC/MC data packet queue status is specified as Station 0's status. Weights used
10603 in WFQ algorith are initialized in WLANTL_OPEN and contained in tlConfigInfo field.
10604 Each station has fields of ucPktPending and AC mask to tell whether a AC has traffic
10605 or not.
10606
10607 Stations are served in a round-robin fashion from highest priority to lowest priority.
10608 The number of round-robin times of each prioirty equals to the WFQ weights and differetiates
10609 the traffic of different prioirty. As such, stations can not provide low priority packets if
10610 high priority packets are all served.
10611
10612 DEPENDENCIES
10613
10614 PARAMETERS
10615
10616 IN
10617 pvosGCtx: pointer to the global vos context; a handle to TL's
10618 control block can be extracted from its context
10619
10620 OUT
10621 pucSTAId: Station ID
10622
10623 RETURN VALUE
10624 The result code associated with performing the operation
10625
10626 VOS_STATUS_SUCCESS: Everything is good
10627
10628 SIDE EFFECTS
10629
10630 TL context contains currently served station ID in ucCurrentSTA field, currently served AC
10631 in uCurServedAC field, and unserved weights of current AC in uCurLeftWeight.
10632 When existing from the function, these three fields are changed accordingly.
10633
10634============================================================================*/
10635VOS_STATUS
10636WLAN_TLAPGetNextTxIds
10637(
10638 v_PVOID_t pvosGCtx,
10639 v_U8_t* pucSTAId
10640)
10641{
10642 WLANTL_CbType* pTLCb;
10643 v_U8_t ucACFilter = 1;
10644 v_U8_t ucNextSTA ;
10645 v_BOOL_t isServed = TRUE; //current round has find a packet or not
10646 v_U8_t ucACLoopNum = WLANTL_AC_VO + 1; //number of loop to go
10647 v_U8_t uFlowMask; // TX FlowMask from WDA
10648 uint8 ucACMask;
Gopichand Nakkala96237bc2013-01-04 12:20:29 -080010649 uint8 i = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -070010650 /*------------------------------------------------------------------------
10651 Extract TL control block
10652 ------------------------------------------------------------------------*/
10653 //ENTER();
10654
10655 pTLCb = VOS_GET_TL_CB(pvosGCtx);
10656 if ( NULL == pTLCb )
10657 {
10658 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10659 "WLAN TL:Invalid TL pointer from pvosGCtx on WLAN_TLAPGetNextTxIds"));
10660 return VOS_STATUS_E_FAULT;
10661 }
10662
10663 if ( VOS_STATUS_SUCCESS != WDA_DS_GetTxFlowMask( pvosGCtx, &uFlowMask ) )
10664 {
10665 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10666 "WLAN TL:Failed to retrieve Flow control mask from WDA"));
10667 return VOS_STATUS_E_FAULT;
10668 }
10669
10670 ucNextSTA = pTLCb->ucCurrentSTA;
10671
10672 ++ucNextSTA;
10673
10674 if ( WLAN_MAX_STA_COUNT <= ucNextSTA )
10675 {
10676 //one round is done.
10677 ucNextSTA = 0;
10678 pTLCb->ucCurLeftWeight--;
10679 isServed = FALSE;
10680 if ( 0 == pTLCb->ucCurLeftWeight )
10681 {
10682 //current prioirty is done
10683 if ( WLANTL_AC_BK == (WLANTL_ACEnumType)pTLCb->uCurServedAC )
10684 {
10685 //end of current VO, VI, BE, BK loop. Reset priority.
10686 pTLCb->uCurServedAC = WLANTL_AC_VO;
10687 }
10688 else
10689 {
10690 pTLCb->uCurServedAC --;
10691 }
10692
10693 pTLCb->ucCurLeftWeight = pTLCb->tlConfigInfo.ucAcWeights[pTLCb->uCurServedAC];
10694
10695 } // (0 == pTLCb->ucCurLeftWeight)
10696 } //( WLAN_MAX_STA_COUNT == ucNextSTA )
10697
10698 //decide how many loops to go. if current loop is partial, do one extra to make sure
10699 //we cover every station
10700 if ((1 == pTLCb->ucCurLeftWeight) && (ucNextSTA != 0))
10701 {
10702 ucACLoopNum ++; // now is 5 loops
10703 }
10704
10705 /* Start with highest priority. ucNextSTA, pTLCb->uCurServedAC, pTLCb->ucCurLeftWeight
10706 all have previous values.*/
10707 for (; ucACLoopNum > 0; ucACLoopNum--)
10708 {
10709
10710 ucACFilter = 1 << pTLCb->uCurServedAC;
10711
10712 // pTLCb->ucCurLeftWeight keeps previous results.
10713 for (; (pTLCb->ucCurLeftWeight > 0) && (uFlowMask & ucACFilter); pTLCb->ucCurLeftWeight-- )
10714 {
10715
10716 for ( ; ucNextSTA < WLAN_MAX_STA_COUNT; ucNextSTA ++ )
10717 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010718 if(NULL == pTLCb->atlSTAClients[ucNextSTA])
10719 {
10720 continue;
10721 }
10722 WLAN_TL_AC_ARRAY_2_MASK (pTLCb->atlSTAClients[ucNextSTA], ucACMask, i);
Jeff Johnson295189b2012-06-20 16:38:30 -070010723
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010724 if ( (0 == pTLCb->atlSTAClients[ucNextSTA]->ucExists) ||
10725 ((0 == pTLCb->atlSTAClients[ucNextSTA]->ucPktPending) && !(ucACMask)) ||
Jeff Johnson295189b2012-06-20 16:38:30 -070010726 (0 == (ucACMask & ucACFilter)) )
10727
10728 {
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -080010729 //current station does not exist or have any packet to serve.
10730 continue;
10731 }
10732
10733 if (WLANTL_STA_AUTHENTICATED != pTLCb->atlSTAClients[ucNextSTA]->tlState)
10734 {
10735 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10736 "%s Sta %d not in auth state so skipping it.",
10737 __func__, ucNextSTA));
Jeff Johnson295189b2012-06-20 16:38:30 -070010738 continue;
10739 }
10740
10741 //go to next station if current station can't send due to flow control
10742 //Station is allowed to send when it is not in LWM mode. When station is in LWM mode,
10743 //station is allowed to send only after FW reports FW memory is below threshold and on-fly
10744 //packets are less then allowed value
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010745 if ( (TRUE == pTLCb->atlSTAClients[ucNextSTA]->ucLwmModeEnabled) &&
10746 ((FALSE == pTLCb->atlSTAClients[ucNextSTA]->ucLwmEventReported) ||
10747 (0 < pTLCb->atlSTAClients[ucNextSTA]->uBuffThresholdMax))
Jeff Johnson295189b2012-06-20 16:38:30 -070010748 )
10749 {
10750 continue;
10751 }
10752
10753
10754 // Find a station. Weight is updated already.
10755 *pucSTAId = ucNextSTA;
10756 pTLCb->ucCurrentSTA = ucNextSTA;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010757 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC = pTLCb->uCurServedAC;
Jeff Johnson295189b2012-06-20 16:38:30 -070010758
10759 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
10760 " TL serve one station AC: %d W: %d StaId: %d",
10761 pTLCb->uCurServedAC, pTLCb->ucCurLeftWeight, pTLCb->ucCurrentSTA ));
10762
10763 return VOS_STATUS_SUCCESS;
10764 } //STA loop
10765
10766 ucNextSTA = 0;
10767 if ( FALSE == isServed )
10768 {
10769 //current loop finds no packet.no need to repeat for the same priority
10770 break;
10771 }
10772 //current loop is partial loop. go for one more loop.
10773 isServed = FALSE;
10774
10775 } //Weight loop
10776
10777 if (WLANTL_AC_BK == pTLCb->uCurServedAC)
10778 {
10779 pTLCb->uCurServedAC = WLANTL_AC_VO;
10780 }
10781 else
10782 {
10783 pTLCb->uCurServedAC--;
10784 }
10785 pTLCb->ucCurLeftWeight = pTLCb->tlConfigInfo.ucAcWeights[pTLCb->uCurServedAC];
10786
10787 }// AC loop
10788
10789 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -080010790 " TL can't find one station to serve" ));
Jeff Johnson295189b2012-06-20 16:38:30 -070010791
10792 pTLCb->uCurServedAC = WLANTL_AC_BK;
10793 pTLCb->ucCurLeftWeight = 1;
10794 //invalid number will be captured by caller
10795 pTLCb->ucCurrentSTA = WLAN_MAX_STA_COUNT;
10796
10797 *pucSTAId = pTLCb->ucCurrentSTA;
Jeff Johnson295189b2012-06-20 16:38:30 -070010798 return VOS_STATUS_E_FAULT;
10799}
10800
10801
10802/*==========================================================================
10803 FUNCTION WLAN_TLGetNextTxIds
10804
10805 DESCRIPTION
10806 Gets the next station and next AC in the list
10807
10808 DEPENDENCIES
10809
10810 PARAMETERS
10811
10812 IN
10813 pvosGCtx: pointer to the global vos context; a handle to TL's
10814 control block can be extracted from its context
10815
10816 OUT
10817 pucSTAId: Station ID
10818
10819
10820 RETURN VALUE
10821 The result code associated with performing the operation
10822
10823 VOS_STATUS_SUCCESS: Everything is good :)
10824
10825 SIDE EFFECTS
10826
10827============================================================================*/
10828VOS_STATUS
10829WLAN_TLGetNextTxIds
10830(
10831 v_PVOID_t pvosGCtx,
10832 v_U8_t* pucSTAId
10833)
10834{
10835 WLANTL_CbType* pTLCb;
10836 v_U8_t ucNextAC;
10837 v_U8_t ucNextSTA;
10838 v_U8_t ucCount;
10839 v_U8_t uFlowMask; // TX FlowMask from WDA
10840 v_U8_t ucACMask = 0;
10841 v_U8_t i = 0;
10842
10843 tBssSystemRole systemRole; //RG HACK to be removed
10844 tpAniSirGlobal pMac;
10845
10846 pMac = vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
10847 if ( NULL == pMac )
10848 {
10849 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070010850 "%s: Invalid pMac", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -070010851 return VOS_STATUS_E_FAULT;
10852 }
10853
10854 systemRole = wdaGetGlobalSystemRole(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -070010855
Jeff Johnson295189b2012-06-20 16:38:30 -070010856 /*------------------------------------------------------------------------
10857 Extract TL control block
10858 ------------------------------------------------------------------------*/
10859 pTLCb = VOS_GET_TL_CB(pvosGCtx);
10860 if ( NULL == pTLCb )
10861 {
10862 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10863 "WLAN TL:Invalid TL pointer from pvosGCtx on WLAN_TLGetNextTxIds"));
10864 return VOS_STATUS_E_FAULT;
10865 }
10866
Sunil Ravid5406f22013-01-22 00:18:31 -080010867#ifdef FEATURE_WLAN_TDLS
Agarwal Ashishcd86f7b2014-06-16 17:11:58 +053010868 if ((eSYSTEM_AP_ROLE == systemRole) ||
10869 (vos_concurrent_open_sessions_running()) || pTLCb->ucTdlsPeerCount)
Sunil Ravid5406f22013-01-22 00:18:31 -080010870#else
Agarwal Ashishcd86f7b2014-06-16 17:11:58 +053010871 if ((eSYSTEM_AP_ROLE == systemRole) ||
10872 (vos_concurrent_open_sessions_running()))
Sunil Ravid5406f22013-01-22 00:18:31 -080010873#endif
10874 {
10875 return WLAN_TLAPGetNextTxIds(pvosGCtx,pucSTAId);
10876 }
10877
10878
Jeff Johnson295189b2012-06-20 16:38:30 -070010879 if ( VOS_STATUS_SUCCESS != WDA_DS_GetTxFlowMask( pvosGCtx, &uFlowMask ) )
10880 {
10881 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10882 "WLAN TL:Failed to retrieve Flow control mask from WDA"));
10883 return VOS_STATUS_E_FAULT;
10884 }
10885
10886 /*STA id - no priority yet implemented */
10887 /*-----------------------------------------------------------------------
10888 Choose the next STA for tx - for now go in a round robin fashion
10889 through all the stations that have pending packets
10890 -------------------------------------------------------------------------*/
10891 ucNextSTA = pTLCb->ucCurrentSTA;
10892
10893 pTLCb->ucCurrentSTA = WLAN_MAX_STA_COUNT;
10894 for ( ucCount = 0;
10895 ucCount < WLAN_MAX_STA_COUNT;
10896 ucCount++ )
10897 {
10898 ucNextSTA = ( (ucNextSTA+1) >= WLAN_MAX_STA_COUNT )?0:(ucNextSTA+1);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010899 if(NULL == pTLCb->atlSTAClients[ucNextSTA])
10900 {
10901 continue;
10902 }
10903 if (( pTLCb->atlSTAClients[ucNextSTA]->ucExists ) &&
10904 ( pTLCb->atlSTAClients[ucNextSTA]->ucPktPending ))
Jeff Johnson295189b2012-06-20 16:38:30 -070010905 {
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -080010906 if (WLANTL_STA_AUTHENTICATED == pTLCb->atlSTAClients[ucNextSTA]->tlState)
10907 {
10908 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10909 "STA ID: %d on WLAN_TLGetNextTxIds", *pucSTAId));
10910 pTLCb->ucCurrentSTA = ucNextSTA;
10911 break;
Tushnim Bhattacharyya5dd94562013-03-20 20:15:03 -070010912 }
10913 else
10914 {
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -080010915 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10916 "%s Sta %d is not in auth state, skipping this sta.",
10917 __func__, ucNextSTA));
Tushnim Bhattacharyya5dd94562013-03-20 20:15:03 -070010918 }
Jeff Johnson295189b2012-06-20 16:38:30 -070010919 }
10920 }
10921
10922 *pucSTAId = pTLCb->ucCurrentSTA;
10923
10924 if ( WLANTL_STA_ID_INVALID( *pucSTAId ) )
10925 {
10926 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10927 "WLAN TL:No station registered with TL at this point"));
10928
10929 return VOS_STATUS_E_FAULT;
10930
10931 }
10932
10933 /*Convert the array to a mask for easier operation*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010934 WLAN_TL_AC_ARRAY_2_MASK( pTLCb->atlSTAClients[*pucSTAId], ucACMask, i);
Jeff Johnson295189b2012-06-20 16:38:30 -070010935
10936 if ( 0 == ucACMask )
10937 {
10938 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10939 "WLAN TL: Mask 0 "
10940 "STA ID: %d on WLAN_TLGetNextTxIds", *pucSTAId));
10941
10942 /*setting STA id to invalid if mask is 0*/
10943 *pucSTAId = WLAN_MAX_STA_COUNT;
10944
10945 return VOS_STATUS_E_FAULT;
10946 }
10947
10948 /*-----------------------------------------------------------------------
10949 AC is updated whenever a packet is fetched from HDD -> the current
10950 weight of such an AC cannot be 0 -> in this case TL is expected to
10951 exit this function at this point during the main Tx loop
10952 -----------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010953 if ( 0 < pTLCb->atlSTAClients[*pucSTAId]->ucCurrentWeight )
Jeff Johnson295189b2012-06-20 16:38:30 -070010954 {
10955 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10956 "WLAN TL: Maintaining serviced AC to: %d for Weight: %d",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010957 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC ,
10958 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentWeight));
Jeff Johnson295189b2012-06-20 16:38:30 -070010959 return VOS_STATUS_SUCCESS;
10960 }
10961
10962 /*-----------------------------------------------------------------------
10963 Choose highest priority AC - !!! optimize me
10964 -----------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010965 ucNextAC = pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC;
Jeff Johnson295189b2012-06-20 16:38:30 -070010966 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10967 "Next AC: %d", ucNextAC));
10968
10969 while ( 0 != ucACMask )
10970 {
10971 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10972 " AC Mask: %d Next: %d Res : %d",
10973 ucACMask, ( 1 << ucNextAC ), ( ucACMask & ( 1 << ucNextAC ))));
10974
10975 if ( 0 != ( ucACMask & ( 1 << ucNextAC ) & uFlowMask ))
10976 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010977 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC =
Jeff Johnson295189b2012-06-20 16:38:30 -070010978 (WLANTL_ACEnumType)ucNextAC;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010979 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentWeight =
Jeff Johnson295189b2012-06-20 16:38:30 -070010980 pTLCb->tlConfigInfo.ucAcWeights[ucNextAC];
10981
10982 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10983 "WLAN TL: Switching serviced AC to: %d with Weight: %d",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010984 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC ,
10985 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentWeight));
Jeff Johnson295189b2012-06-20 16:38:30 -070010986 break;
10987 }
10988
10989 ucNextAC = ( ucNextAC - 1 ) & WLANTL_MASK_AC;
10990
10991 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10992 "Next AC %d", ucNextAC));
10993
10994 }
10995
10996 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10997 " C AC: %d C W: %d",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010998 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC,
10999 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentWeight));
Jeff Johnson295189b2012-06-20 16:38:30 -070011000
11001 return VOS_STATUS_SUCCESS;
11002}/* WLAN_TLGetNextTxIds */
11003
Jeff Johnson295189b2012-06-20 16:38:30 -070011004
11005
11006/*==========================================================================
11007 DEFAULT HANDLERS: Registered at initialization with TL
11008 ==========================================================================*/
11009
11010/*==========================================================================
11011
11012 FUNCTION WLANTL_MgmtFrmRxDefaultCb
11013
11014 DESCRIPTION
11015 Default Mgmt Frm rx callback: asserts all the time. If this function gets
11016 called it means there is no registered rx cb pointer for Mgmt Frm.
11017
11018 DEPENDENCIES
11019
11020 PARAMETERS
11021 Not used.
11022
11023 RETURN VALUE
11024
11025 VOS_STATUS_E_FAILURE: Always FAILURE.
11026
11027============================================================================*/
11028VOS_STATUS
11029WLANTL_MgmtFrmRxDefaultCb
11030(
11031 v_PVOID_t pvosGCtx,
11032 v_PVOID_t vosBuff
11033)
11034{
11035 if ( NULL != vosBuff )
11036 {
11037 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
11038 "WLAN TL:Fatal failure: No registered Mgmt Frm client on pkt RX"));
11039 /* Drop packet */
11040 vos_pkt_return_packet((vos_pkt_t *)vosBuff);
11041 }
11042
Jeff Johnson295189b2012-06-20 16:38:30 -070011043 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11044 "WLAN TL: No registered Mgmt Frm client on pkt RX. Load/Unload in progress, Ignore"));
Jeff Johnson295189b2012-06-20 16:38:30 -070011045
11046 return VOS_STATUS_E_FAILURE;
11047}/*WLANTL_MgmtFrmRxDefaultCb*/
11048
11049/*==========================================================================
11050
Madan Mohan Koyyalamudi6c2977d2013-09-04 15:42:45 +053011051 FUNCTION WLANTL_BAPRxDefaultCb
Jeff Johnson295189b2012-06-20 16:38:30 -070011052
11053 DESCRIPTION
11054 Default BAP rx callback: asserts all the time. If this function gets
11055 called it means there is no registered rx cb pointer for BAP.
11056
11057 DEPENDENCIES
11058
11059 PARAMETERS
11060 Not used.
11061
11062 RETURN VALUE
11063
11064 VOS_STATUS_E_FAILURE: Always FAILURE.
11065
11066============================================================================*/
11067VOS_STATUS
11068WLANTL_BAPRxDefaultCb
11069(
11070 v_PVOID_t pvosGCtx,
11071 vos_pkt_t* vosDataBuff,
11072 WLANTL_BAPFrameEnumType frameType
11073)
11074{
11075 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
11076 "WLAN TL:Fatal failure: No registered BAP client on BAP pkt RX"));
11077#ifndef BTAMP_TEST
11078 VOS_ASSERT(0);
11079#endif
11080 return VOS_STATUS_E_FAILURE;
11081}/*WLANTL_MgmtFrmRxDefaultCb*/
11082
11083/*==========================================================================
11084
11085 FUNCTION WLANTL_STARxDefaultCb
11086
11087 DESCRIPTION
11088 Default STA rx callback: asserts all the time. If this function gets
11089 called it means there is no registered rx cb pointer for station.
11090 (Mem corruption most likely, it should never happen)
11091
11092 DEPENDENCIES
11093
11094 PARAMETERS
11095 Not used.
11096
11097 RETURN VALUE
11098
11099 VOS_STATUS_E_FAILURE: Always FAILURE.
11100
11101============================================================================*/
11102VOS_STATUS
11103WLANTL_STARxDefaultCb
11104(
11105 v_PVOID_t pvosGCtx,
11106 vos_pkt_t* vosDataBuff,
11107 v_U8_t ucSTAId,
11108 WLANTL_RxMetaInfoType* pRxMetaInfo
11109)
11110{
11111 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11112 "WLAN TL: No registered STA client rx cb for STAID: %d dropping pkt",
11113 ucSTAId));
11114 vos_pkt_return_packet(vosDataBuff);
Madan Mohan Koyyalamudi6c2977d2013-09-04 15:42:45 +053011115 return VOS_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -070011116}/*WLANTL_MgmtFrmRxDefaultCb*/
11117
11118
11119/*==========================================================================
11120
11121 FUNCTION WLANTL_STAFetchPktDefaultCb
11122
11123 DESCRIPTION
11124 Default fetch callback: asserts all the time. If this function gets
11125 called it means there is no registered fetch cb pointer for station.
11126 (Mem corruption most likely, it should never happen)
11127
11128 DEPENDENCIES
11129
11130 PARAMETERS
11131 Not used.
11132
11133 RETURN VALUE
11134
11135 VOS_STATUS_E_FAILURE: Always FAILURE.
11136
11137============================================================================*/
11138VOS_STATUS
11139WLANTL_STAFetchPktDefaultCb
11140(
11141 v_PVOID_t pvosGCtx,
11142 v_U8_t* pucSTAId,
11143 WLANTL_ACEnumType ucAC,
11144 vos_pkt_t** vosDataBuff,
11145 WLANTL_MetaInfoType* tlMetaInfo
11146)
11147{
11148 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
11149 "WLAN TL:Fatal failure: No registered STA client on data pkt RX"));
11150 VOS_ASSERT(0);
11151 return VOS_STATUS_E_FAILURE;
11152}/*WLANTL_MgmtFrmRxDefaultCb*/
11153
11154/*==========================================================================
11155
11156 FUNCTION WLANTL_TxCompDefaultCb
11157
11158 DESCRIPTION
11159 Default tx complete handler. It will release the completed pkt to
11160 prevent memory leaks.
11161
11162 PARAMETERS
11163
11164 IN
11165 pvosGCtx: pointer to the global vos context; a handle to
11166 TL/HAL/PE/BAP/HDD control block can be extracted from
11167 its context
11168 vosDataBuff: pointer to the VOSS data buffer that was transmitted
11169 wTxSTAtus: status of the transmission
11170
11171
11172 RETURN VALUE
11173 The result code associated with performing the operation; please
11174 check vos_pkt_return_packet for possible error codes.
11175
11176 Please check vos_pkt_return_packet API for possible return values.
11177
11178============================================================================*/
11179VOS_STATUS
11180WLANTL_TxCompDefaultCb
11181(
11182 v_PVOID_t pvosGCtx,
11183 vos_pkt_t* vosDataBuff,
11184 VOS_STATUS wTxSTAtus
11185)
11186{
11187 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11188 "WLAN TL:TXComp not registered, releasing pkt to prevent mem leak"));
11189 return vos_pkt_return_packet(vosDataBuff);
11190}/*WLANTL_TxCompDefaultCb*/
11191
11192
11193/*==========================================================================
11194 Cleanup functions
11195 ==========================================================================*/
11196
11197/*==========================================================================
11198
11199 FUNCTION WLANTL_CleanCB
11200
11201 DESCRIPTION
11202 Cleans TL control block
11203
11204 DEPENDENCIES
11205
11206 PARAMETERS
11207
11208 IN
11209 pTLCb: pointer to TL's control block
11210 ucEmpty: set if TL has to clean up the queues and release pedning pkts
11211
11212 RETURN VALUE
11213 The result code associated with performing the operation
11214
11215 VOS_STATUS_E_INVAL: invalid input parameters
11216 VOS_STATUS_SUCCESS: Everything is good :)
11217
11218 SIDE EFFECTS
11219
11220============================================================================*/
11221VOS_STATUS
11222WLANTL_CleanCB
11223(
11224 WLANTL_CbType* pTLCb,
11225 v_U8_t ucEmpty
11226)
11227{
11228 v_U8_t ucIndex;
11229 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
11230
11231 /*-------------------------------------------------------------------------
11232 Sanity check
11233 -------------------------------------------------------------------------*/
11234 if ( NULL == pTLCb )
11235 {
11236 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11237 "WLAN TL:Invalid parameter sent on WLANTL_CleanCB"));
11238 return VOS_STATUS_E_INVAL;
11239 }
11240
11241 /* number of packets sent to BAL waiting for tx complete confirmation */
11242 pTLCb->usPendingTxCompleteCount = 0;
11243
11244 /* global suspend flag */
11245 vos_atomic_set_U8( &pTLCb->ucTxSuspended, 1);
11246
11247 /* resource flag */
11248 pTLCb->uResCount = 0;
11249
11250
11251 /*-------------------------------------------------------------------------
11252 Client stations
11253 -------------------------------------------------------------------------*/
11254 for ( ucIndex = 0; ucIndex < WLAN_MAX_STA_COUNT ; ucIndex++)
11255 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011256 if(NULL != pTLCb->atlSTAClients[ucIndex])
11257 {
11258 WLANTL_CleanSTA( pTLCb->atlSTAClients[ucIndex], ucEmpty);
11259 }
Jeff Johnson295189b2012-06-20 16:38:30 -070011260 }
11261
11262 /*-------------------------------------------------------------------------
11263 Management Frame client
11264 -------------------------------------------------------------------------*/
11265 pTLCb->tlMgmtFrmClient.ucExists = 0;
11266
11267 if ( ( 0 != ucEmpty) &&
11268 ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff ))
11269 {
11270 vos_pkt_return_packet(pTLCb->tlMgmtFrmClient.vosPendingDataBuff);
11271 }
11272
11273 pTLCb->tlMgmtFrmClient.vosPendingDataBuff = NULL;
11274
11275 /* set to a default cb in order to prevent constant checking for NULL */
11276 pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx = WLANTL_MgmtFrmRxDefaultCb;
11277
11278 /*-------------------------------------------------------------------------
11279 BT AMP client
11280 -------------------------------------------------------------------------*/
11281 pTLCb->tlBAPClient.ucExists = 0;
11282
11283 if (( 0 != ucEmpty) &&
11284 ( NULL != pTLCb->tlBAPClient.vosPendingDataBuff ))
11285 {
11286 vos_pkt_return_packet(pTLCb->tlBAPClient.vosPendingDataBuff);
11287 }
11288
11289 if (( 0 != ucEmpty) &&
11290 ( NULL != pTLCb->vosDummyBuf ))
11291 {
11292 vos_pkt_return_packet(pTLCb->vosDummyBuf);
11293 }
11294
11295 pTLCb->tlBAPClient.vosPendingDataBuff = NULL;
11296
11297 pTLCb->vosDummyBuf = NULL;
11298 pTLCb->vosTempBuf = NULL;
11299 pTLCb->ucCachedSTAId = WLAN_MAX_STA_COUNT;
11300
11301 /* set to a default cb in order to prevent constant checking for NULL */
11302 pTLCb->tlBAPClient.pfnTlBAPRx = WLANTL_BAPRxDefaultCb;
11303
11304 pTLCb->ucRegisteredStaId = WLAN_MAX_STA_COUNT;
11305
11306 return VOS_STATUS_SUCCESS;
11307
11308}/* WLANTL_CleanCB*/
11309
11310/*==========================================================================
11311
11312 FUNCTION WLANTL_CleanSTA
11313
11314 DESCRIPTION
11315 Cleans a station control block.
11316
11317 DEPENDENCIES
11318
11319 PARAMETERS
11320
11321 IN
11322 pvosGCtx: pointer to the global vos context; a handle to TL's
11323 control block can be extracted from its context
11324 ucEmpty: if set the queues and pending pkts will be emptyed
11325
11326 RETURN VALUE
11327 The result code associated with performing the operation
11328
11329 VOS_STATUS_E_INVAL: invalid input parameters
11330 VOS_STATUS_SUCCESS: Everything is good :)
11331
11332 SIDE EFFECTS
11333
11334============================================================================*/
11335VOS_STATUS
11336WLANTL_CleanSTA
11337(
11338 WLANTL_STAClientType* ptlSTAClient,
11339 v_U8_t ucEmpty
11340)
11341{
11342 v_U8_t ucIndex;
11343 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
11344
11345 /*-------------------------------------------------------------------------
11346 Sanity check
11347 -------------------------------------------------------------------------*/
11348 if ( NULL == ptlSTAClient )
11349 {
11350 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11351 "WLAN TL:Invalid parameter sent on WLANTL_CleanSTA"));
11352 return VOS_STATUS_E_INVAL;
11353 }
11354
11355 /*------------------------------------------------------------------------
11356 Clear station from TL
11357 ------------------------------------------------------------------------*/
11358 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11359 "WLAN TL: Clearing STA Client ID: %d, Empty flag: %d",
11360 ptlSTAClient->wSTADesc.ucSTAId, ucEmpty ));
11361
11362 ptlSTAClient->pfnSTARx = WLANTL_STARxDefaultCb;
11363 ptlSTAClient->pfnSTATxComp = WLANTL_TxCompDefaultCb;
11364 ptlSTAClient->pfnSTAFetchPkt = WLANTL_STAFetchPktDefaultCb;
11365
11366 ptlSTAClient->tlState = WLANTL_STA_INIT;
11367 ptlSTAClient->tlPri = WLANTL_STA_PRI_NORMAL;
11368
11369 vos_zero_macaddr( &ptlSTAClient->wSTADesc.vSTAMACAddress );
11370 vos_zero_macaddr( &ptlSTAClient->wSTADesc.vBSSIDforIBSS );
11371 vos_zero_macaddr( &ptlSTAClient->wSTADesc.vSelfMACAddress );
11372
11373 ptlSTAClient->wSTADesc.ucSTAId = 0;
11374 ptlSTAClient->wSTADesc.wSTAType = WLAN_STA_MAX;
11375
11376 ptlSTAClient->wSTADesc.ucQosEnabled = 0;
11377 ptlSTAClient->wSTADesc.ucAddRmvLLC = 0;
11378 ptlSTAClient->wSTADesc.ucSwFrameTXXlation = 0;
11379 ptlSTAClient->wSTADesc.ucSwFrameRXXlation = 0;
11380 ptlSTAClient->wSTADesc.ucProtectedFrame = 0;
11381
11382 /*-------------------------------------------------------------------------
11383 AMSDU information for the STA
11384 -------------------------------------------------------------------------*/
11385 if ( ( 0 != ucEmpty ) &&
11386 ( NULL != ptlSTAClient->vosAMSDUChainRoot ))
11387 {
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -070011388 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
Jeff Johnson0298bd02013-11-14 19:58:38 -080011389 "WLAN TL:Non NULL vosAMSDUChainRoot on WLANTL_CleanSTA, "
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -070011390 "suspecting a memory corruption"));
11391
Jeff Johnson295189b2012-06-20 16:38:30 -070011392 }
11393
11394 ptlSTAClient->vosAMSDUChain = NULL;
11395 ptlSTAClient->vosAMSDUChainRoot = NULL;
11396
11397 vos_mem_zero( (v_PVOID_t)ptlSTAClient->aucMPDUHeader,
11398 WLANTL_MPDU_HEADER_LEN);
11399 ptlSTAClient->ucMPDUHeaderLen = 0;
11400
11401 /*-------------------------------------------------------------------------
11402 Reordering information for the STA
11403 -------------------------------------------------------------------------*/
11404 for ( ucIndex = 0; ucIndex < WLAN_MAX_TID ; ucIndex++)
11405 {
11406 if(0 == ptlSTAClient->atlBAReorderInfo[ucIndex].ucExists)
11407 {
11408 continue;
11409 }
11410 if(NULL != ptlSTAClient->atlBAReorderInfo[ucIndex].reorderBuffer)
11411 {
11412 ptlSTAClient->atlBAReorderInfo[ucIndex].reorderBuffer->isAvailable = VOS_TRUE;
11413 memset(&ptlSTAClient->atlBAReorderInfo[ucIndex].reorderBuffer->arrayBuffer[0], 0, WLANTL_MAX_WINSIZE * sizeof(v_PVOID_t));
11414 }
11415 vos_timer_destroy(&ptlSTAClient->atlBAReorderInfo[ucIndex].agingTimer);
11416 memset(&ptlSTAClient->atlBAReorderInfo[ucIndex], 0, sizeof(WLANTL_BAReorderType));
11417 }
11418
11419 /*-------------------------------------------------------------------------
11420 QOS information for the STA
11421 -------------------------------------------------------------------------*/
11422 ptlSTAClient->ucCurrentAC = WLANTL_AC_VO;
11423 ptlSTAClient->ucCurrentWeight = 0;
11424 ptlSTAClient->ucServicedAC = WLANTL_AC_BK;
11425
11426 vos_mem_zero( ptlSTAClient->aucACMask, sizeof(ptlSTAClient->aucACMask));
11427 vos_mem_zero( &ptlSTAClient->wUAPSDInfo, sizeof(ptlSTAClient->wUAPSDInfo));
11428
11429
11430 /*--------------------------------------------------------------------
11431 Stats info
11432 --------------------------------------------------------------------*/
11433 vos_mem_zero( ptlSTAClient->auRxCount,
11434 sizeof(ptlSTAClient->auRxCount[0])* WLAN_MAX_TID);
11435 vos_mem_zero( ptlSTAClient->auTxCount,
11436 sizeof(ptlSTAClient->auTxCount[0])* WLAN_MAX_TID);
11437 ptlSTAClient->rssiAvg = 0;
11438
11439 /*Tx not suspended and station fully registered*/
11440 vos_atomic_set_U8( &ptlSTAClient->ucTxSuspended, 0);
11441 vos_atomic_set_U8( &ptlSTAClient->ucNoMoreData, 1);
11442
11443 if ( 0 == ucEmpty )
11444 {
11445 ptlSTAClient->wSTADesc.ucUcastSig = WLAN_TL_INVALID_U_SIG;
11446 ptlSTAClient->wSTADesc.ucBcastSig = WLAN_TL_INVALID_B_SIG;
11447 }
11448
11449 ptlSTAClient->ucExists = 0;
11450
11451 /*--------------------------------------------------------------------
11452 Statistics info
11453 --------------------------------------------------------------------*/
11454 memset(&ptlSTAClient->trafficStatistics,
11455 0,
11456 sizeof(WLANTL_TRANSFER_STA_TYPE));
11457
11458 /*fix me!!: add new values from the TL Cb for cleanup */
11459 return VOS_STATUS_SUCCESS;
11460}/* WLANTL_CleanSTA */
11461
11462
11463/*==========================================================================
11464 FUNCTION WLANTL_EnableUAPSDForAC
11465
11466 DESCRIPTION
11467 Called by HDD to enable UAPSD. TL in turn calls WDA API to enable the
11468 logic in FW/SLM to start sending trigger frames. Previously TL had the
11469 trigger frame logic which later moved down to FW. Hence
11470 HDD -> TL -> WDA -> FW call flow.
11471
11472 DEPENDENCIES
11473 The TL must be initialized before this function can be called.
11474
11475 PARAMETERS
11476
11477 IN
11478 pvosGCtx: pointer to the global vos context; a handle to TL's
11479 control block can be extracted from its context
11480 ucSTAId: station Id
11481 ucAC: AC for which U-APSD is being enabled
11482 ucTid: TID for which U-APSD is setup
11483 ucUP: used to place in the trigger frame generation
11484 ucServiceInt: service interval used by TL to send trigger frames
11485 ucSuspendInt: suspend interval used by TL to determine that an
11486 app is idle and should start sending trigg frms less often
11487 wTSDir: direction of TSpec
11488
11489 RETURN VALUE
11490 The result code associated with performing the operation
11491
11492 VOS_STATUS_SUCCESS: Everything is good :)
11493
11494 SIDE EFFECTS
11495
11496============================================================================*/
11497VOS_STATUS
11498WLANTL_EnableUAPSDForAC
11499(
11500 v_PVOID_t pvosGCtx,
11501 v_U8_t ucSTAId,
11502 WLANTL_ACEnumType ucAC,
11503 v_U8_t ucTid,
11504 v_U8_t ucUP,
11505 v_U32_t uServiceInt,
11506 v_U32_t uSuspendInt,
11507 WLANTL_TSDirType wTSDir
11508)
11509{
11510
11511 WLANTL_CbType* pTLCb = NULL;
11512 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11513 tUapsdInfo halUAPSDInfo;
11514 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
11515
11516 /*------------------------------------------------------------------------
11517 Sanity check
11518 Extract TL control block
11519 ------------------------------------------------------------------------*/
11520 pTLCb = VOS_GET_TL_CB(pvosGCtx);
11521 if (( NULL == pTLCb ) || WLANTL_STA_ID_INVALID( ucSTAId )
Gopichand Nakkala574f6d12013-06-27 19:38:43 +053011522 || WLANTL_AC_INVALID(ucAC))
Jeff Johnson295189b2012-06-20 16:38:30 -070011523 {
11524 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11525 "WLAN TL:Invalid input params on WLANTL_EnableUAPSDForAC"
Gopichand Nakkala574f6d12013-06-27 19:38:43 +053011526 " TL: %p STA: %d AC: %d",
11527 pTLCb, ucSTAId, ucAC));
Jeff Johnson295189b2012-06-20 16:38:30 -070011528 return VOS_STATUS_E_FAULT;
11529 }
11530
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011531 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
11532 {
11533 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11534 "WLAN TL:Client Memory was not allocated on %s", __func__));
11535 return VOS_STATUS_E_FAILURE;
11536 }
11537
Jeff Johnson295189b2012-06-20 16:38:30 -070011538 /*Set this flag in order to remember that this is a trigger enabled AC*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011539 pTLCb->atlSTAClients[ucSTAId]->wUAPSDInfo[ucAC].ucSet = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -070011540
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053011541#ifdef FEATURE_WLAN_TDLS
11542 if(pTLCb->atlSTAClients[ucSTAId]->wSTADesc.wSTAType != WLAN_STA_TDLS)
11543#endif
11544 {
11545 if( 0 == uServiceInt )
11546 {
11547 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi198ade32013-09-29 03:52:25 +053011548 "WLAN TL:Input params on WLANTL_EnableUAPSDForAC"
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053011549 " SI: %d", uServiceInt ));
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053011550 }
Jeff Johnson295189b2012-06-20 16:38:30 -070011551
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053011552 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11553 "WLAN TL:Enabling U-APSD in FW for STA: %d AC: %d SI: %d SPI: %d "
11554 "DI: %d",
11555 ucSTAId, ucAC, uServiceInt, uSuspendInt,
11556 pTLCb->tlConfigInfo.uDelayedTriggerFrmInt));
Jeff Johnson295189b2012-06-20 16:38:30 -070011557
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053011558 /*Save all info for HAL*/
11559 halUAPSDInfo.staidx = ucSTAId;
11560 halUAPSDInfo.ac = ucAC;
11561 halUAPSDInfo.up = ucUP;
11562 halUAPSDInfo.srvInterval = uServiceInt;
11563 halUAPSDInfo.susInterval = uSuspendInt;
11564 halUAPSDInfo.delayInterval = pTLCb->tlConfigInfo.uDelayedTriggerFrmInt;
11565
11566 /*Notify HAL*/
11567 vosStatus = WDA_EnableUapsdAcParams(pvosGCtx, ucSTAId, &halUAPSDInfo);
11568 }
Jeff Johnson295189b2012-06-20 16:38:30 -070011569 return vosStatus;
11570
11571}/*WLANTL_EnableUAPSDForAC*/
11572
11573
11574/*==========================================================================
11575 FUNCTION WLANTL_DisableUAPSDForAC
11576
11577 DESCRIPTION
11578 Called by HDD to disable UAPSD. TL in turn calls WDA API to disable the
11579 logic in FW/SLM to stop sending trigger frames. Previously TL had the
11580 trigger frame logic which later moved down to FW. Hence
11581 HDD -> TL -> WDA -> FW call flow.
11582
11583 DEPENDENCIES
11584 The TL must be initialized before this function can be called.
11585
11586 PARAMETERS
11587
11588 IN
11589 pvosGCtx: pointer to the global vos context; a handle to TL's
11590 control block can be extracted from its context
11591 ucSTAId: station Id
11592 ucAC: AC for which U-APSD is being enabled
11593
11594
11595 RETURN VALUE
11596 The result code associated with performing the operation
11597
11598 VOS_STATUS_SUCCESS: Everything is good :)
11599
11600 SIDE EFFECTS
11601
11602============================================================================*/
11603VOS_STATUS
11604WLANTL_DisableUAPSDForAC
11605(
11606 v_PVOID_t pvosGCtx,
11607 v_U8_t ucSTAId,
11608 WLANTL_ACEnumType ucAC
11609)
11610{
11611 WLANTL_CbType* pTLCb;
11612 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
11613
11614 /*------------------------------------------------------------------------
11615 Sanity check
11616 Extract TL control block
11617 ------------------------------------------------------------------------*/
11618 pTLCb = VOS_GET_TL_CB(pvosGCtx);
11619 if (( NULL == pTLCb ) || WLANTL_STA_ID_INVALID( ucSTAId )
11620 || WLANTL_AC_INVALID(ucAC) )
11621 {
11622 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11623 "WLAN TL:Invalid input params on WLANTL_DisableUAPSDForAC"
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +053011624 " TL: %p STA: %d AC: %d", pTLCb, ucSTAId, ucAC ));
Jeff Johnson295189b2012-06-20 16:38:30 -070011625 return VOS_STATUS_E_FAULT;
11626 }
11627
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011628 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
11629 {
11630 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11631 "WLAN TL:Client Memory was not allocated on %s", __func__));
11632 return VOS_STATUS_E_FAILURE;
11633 }
11634
Jeff Johnson295189b2012-06-20 16:38:30 -070011635 /*Reset this flag as this is no longer a trigger enabled AC*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011636 pTLCb->atlSTAClients[ucSTAId]->wUAPSDInfo[ucAC].ucSet = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -070011637
11638 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11639 "WLAN TL:Disabling U-APSD in FW for STA: %d AC: %d ",
11640 ucSTAId, ucAC));
11641
11642 /*Notify HAL*/
11643 WDA_DisableUapsdAcParams(pvosGCtx, ucSTAId, ucAC);
11644
11645 return VOS_STATUS_SUCCESS;
11646}/* WLANTL_DisableUAPSDForAC */
11647
11648#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
11649/*==========================================================================
11650 FUNCTION WLANTL_RegRSSIIndicationCB
11651
11652 DESCRIPTION Registration function to get notification if RSSI cross
11653 threshold.
11654 Client should register threshold, direction, and notification
11655 callback function pointer
11656
11657 DEPENDENCIES NONE
11658
11659 PARAMETERS in pAdapter - Global handle
11660 in rssiValue - RSSI threshold value
11661 in triggerEvent - Cross direction should be notified
11662 UP, DOWN, and CROSS
11663 in crossCBFunction - Notification CB Function
11664 in usrCtxt - user context
11665
11666 RETURN VALUE VOS_STATUS
11667
11668 SIDE EFFECTS NONE
11669
11670============================================================================*/
11671VOS_STATUS WLANTL_RegRSSIIndicationCB
11672(
11673 v_PVOID_t pAdapter,
11674 v_S7_t rssiValue,
11675 v_U8_t triggerEvent,
11676 WLANTL_RSSICrossThresholdCBType crossCBFunction,
11677 VOS_MODULE_ID moduleID,
11678 v_PVOID_t usrCtxt
11679)
11680{
11681 VOS_STATUS status = VOS_STATUS_SUCCESS;
11682
11683 status = WLANTL_HSRegRSSIIndicationCB(pAdapter,
11684 rssiValue,
11685 triggerEvent,
11686 crossCBFunction,
11687 moduleID,
11688 usrCtxt);
11689
11690 return status;
11691}
11692
11693/*==========================================================================
11694 FUNCTION WLANTL_DeregRSSIIndicationCB
11695
11696 DESCRIPTION Remove specific threshold from list
11697
11698 DEPENDENCIES NONE
11699
11700 PARAMETERS in pAdapter - Global handle
11701 in rssiValue - RSSI threshold value
11702 in triggerEvent - Cross direction should be notified
11703 UP, DOWN, and CROSS
11704
11705 RETURN VALUE VOS_STATUS
11706
11707 SIDE EFFECTS NONE
11708
11709============================================================================*/
11710VOS_STATUS WLANTL_DeregRSSIIndicationCB
11711(
11712 v_PVOID_t pAdapter,
11713 v_S7_t rssiValue,
11714 v_U8_t triggerEvent,
11715 WLANTL_RSSICrossThresholdCBType crossCBFunction,
11716 VOS_MODULE_ID moduleID
11717)
11718{
11719 VOS_STATUS status = VOS_STATUS_SUCCESS;
11720
11721 status = WLANTL_HSDeregRSSIIndicationCB(pAdapter,
11722 rssiValue,
11723 triggerEvent,
11724 crossCBFunction,
11725 moduleID);
11726 return status;
11727}
11728
11729/*==========================================================================
11730 FUNCTION WLANTL_SetAlpha
11731
11732 DESCRIPTION ALPLA is weight value to calculate AVG RSSI
11733 avgRSSI = (ALPHA * historyRSSI) + ((10 - ALPHA) * newRSSI)
11734 avgRSSI has (ALPHA * 10)% of history RSSI weight and
11735 (10 - ALPHA)% of newRSSI weight
11736 This portion is dynamically configurable.
11737 Default is ?
11738
11739 DEPENDENCIES NONE
11740
11741 PARAMETERS in pAdapter - Global handle
11742 in valueAlpah - ALPHA
11743
11744 RETURN VALUE VOS_STATUS
11745
11746 SIDE EFFECTS NONE
11747
11748============================================================================*/
11749VOS_STATUS WLANTL_SetAlpha
11750(
11751 v_PVOID_t pAdapter,
11752 v_U8_t valueAlpha
11753)
11754{
11755 VOS_STATUS status = VOS_STATUS_SUCCESS;
11756
11757 status = WLANTL_HSSetAlpha(pAdapter, valueAlpha);
11758 return status;
11759}
11760
11761/*==========================================================================
11762
11763 FUNCTION
11764
11765 DESCRIPTION
11766
11767 PARAMETERS
11768
11769 RETURN VALUE
11770
11771============================================================================*/
11772VOS_STATUS WLANTL_BMPSRSSIRegionChangedNotification
11773(
11774 v_PVOID_t pAdapter,
11775 tpSirRSSINotification pRSSINotification
11776)
11777{
11778 VOS_STATUS status = VOS_STATUS_SUCCESS;
11779
11780 status = WLANTL_HSBMPSRSSIRegionChangedNotification(pAdapter, pRSSINotification);
11781 return status;
11782}
11783
11784/*==========================================================================
11785 FUNCTION WLANTL_RegGetTrafficStatus
11786
11787 DESCRIPTION Registration function for traffic status monitoring
11788 During measure period count data frames.
11789 If frame count is larger then IDLE threshold set as traffic ON
11790 or OFF.
11791 And traffic status is changed send report to client with
11792 registered callback function
11793
11794 DEPENDENCIES NONE
11795
11796 PARAMETERS in pAdapter - Global handle
11797 in idleThreshold - Traffic on or off threshold
11798 in measurePeriod - Traffic state check period
11799 in trfficStatusCB - traffic status changed notification
11800 CB function
11801 in usrCtxt - user context
11802
11803 RETURN VALUE VOS_STATUS
11804
11805 SIDE EFFECTS NONE
11806
11807============================================================================*/
11808VOS_STATUS WLANTL_RegGetTrafficStatus
11809(
11810 v_PVOID_t pAdapter,
11811 v_U32_t idleThreshold,
11812 v_U32_t measurePeriod,
11813 WLANTL_TrafficStatusChangedCBType trfficStatusCB,
11814 v_PVOID_t usrCtxt
11815)
11816{
11817 VOS_STATUS status = VOS_STATUS_SUCCESS;
11818
11819 status = WLANTL_HSRegGetTrafficStatus(pAdapter,
11820 idleThreshold,
11821 measurePeriod,
11822 trfficStatusCB,
11823 usrCtxt);
11824 return status;
11825}
11826#endif
11827/*==========================================================================
11828 FUNCTION WLANTL_GetStatistics
11829
11830 DESCRIPTION Get traffic statistics for identified station
11831
11832 DEPENDENCIES NONE
11833
11834 PARAMETERS in pAdapter - Global handle
11835 in statType - specific statistics field to reset
11836 out statBuffer - traffic statistics buffer
11837
11838 RETURN VALUE VOS_STATUS
11839
11840 SIDE EFFECTS NONE
11841
11842============================================================================*/
11843VOS_STATUS WLANTL_GetStatistics
11844(
11845 v_PVOID_t pAdapter,
11846 WLANTL_TRANSFER_STA_TYPE *statBuffer,
11847 v_U8_t STAid
11848)
11849{
11850 WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011851 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -070011852 VOS_STATUS status = VOS_STATUS_SUCCESS;
11853 WLANTL_TRANSFER_STA_TYPE *statistics = NULL;
11854
11855 /*------------------------------------------------------------------------
11856 Sanity check
11857 Extract TL control block
11858 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011859 if ( NULL == pTLCb )
Jeff Johnson295189b2012-06-20 16:38:30 -070011860 {
11861 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11862 "WLAN TL:Invalid TL pointer on WLANTL_GetStatistics"));
11863 return VOS_STATUS_E_FAULT;
11864 }
11865
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011866 pClientSTA = pTLCb->atlSTAClients[STAid];
11867
11868 if ( NULL == pClientSTA )
11869 {
11870 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11871 "WLAN TL:Client Memory was not allocated on %s", __func__));
11872 return VOS_STATUS_E_FAILURE;
11873 }
11874
11875 if(0 == pClientSTA->ucExists)
Jeff Johnson295189b2012-06-20 16:38:30 -070011876 {
11877 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11878 "WLAN TL: %d STA ID does not exist", STAid));
11879 return VOS_STATUS_E_INVAL;
11880 }
11881
11882 if(NULL == statBuffer)
11883 {
11884 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11885 "WLAN TL:Invalid TL statistics buffer pointer on WLANTL_GetStatistics"));
11886 return VOS_STATUS_E_INVAL;
11887 }
11888
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011889 statistics = &pClientSTA->trafficStatistics;
Katya Nigam493ff652014-02-11 14:31:04 +053011890 vos_mem_copy(statBuffer, statistics, sizeof(WLANTL_TRANSFER_STA_TYPE));
Jeff Johnson295189b2012-06-20 16:38:30 -070011891
11892 return status;
11893}
11894
11895/*==========================================================================
11896 FUNCTION WLANTL_ResetStatistics
11897
11898 DESCRIPTION Reset statistics structure for identified station ID
11899 Reset means set values as 0
11900
11901 DEPENDENCIES NONE
11902
11903 PARAMETERS in pAdapter - Global handle
11904 in statType - specific statistics field to reset
11905
11906 RETURN VALUE VOS_STATUS
11907
11908 SIDE EFFECTS NONE
11909
11910============================================================================*/
11911VOS_STATUS WLANTL_ResetStatistics
11912(
11913 v_PVOID_t pAdapter,
11914 v_U8_t STAid
11915)
11916{
11917 WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011918 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -070011919 VOS_STATUS status = VOS_STATUS_SUCCESS;
11920 WLANTL_TRANSFER_STA_TYPE *statistics = NULL;
11921
11922 /*------------------------------------------------------------------------
11923 Sanity check
11924 Extract TL control block
11925 ------------------------------------------------------------------------*/
11926 if (NULL == pTLCb)
11927 {
11928 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11929 "WLAN TL:Invalid TL pointer on WLANTL_GetStatistics"));
11930 return VOS_STATUS_E_FAULT;
11931 }
11932
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011933 pClientSTA = pTLCb->atlSTAClients[STAid];
11934
11935 if ( NULL == pClientSTA )
11936 {
11937 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11938 "WLAN TL:Client Memory was not allocated on %s", __func__));
11939 return VOS_STATUS_E_FAILURE;
11940 }
11941
11942 if(0 == pClientSTA->ucExists)
Jeff Johnson295189b2012-06-20 16:38:30 -070011943 {
11944 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11945 "WLAN TL: %d STA ID does not exist", STAid));
11946 return VOS_STATUS_E_INVAL;
11947 }
11948
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011949 statistics = &pClientSTA->trafficStatistics;
Jeff Johnson295189b2012-06-20 16:38:30 -070011950 vos_mem_zero((v_VOID_t *)statistics, sizeof(WLANTL_TRANSFER_STA_TYPE));
11951
11952 return status;
11953}
11954
11955/*==========================================================================
11956 FUNCTION WLANTL_GetSpecStatistic
11957
11958 DESCRIPTION Get specific field within statistics structure for
11959 identified station ID
11960
11961 DEPENDENCIES NONE
11962
11963 PARAMETERS in pAdapter - Global handle
11964 in statType - specific statistics field to reset
11965 in STAid - Station ID
11966 out buffer - Statistic value
11967
11968 RETURN VALUE VOS_STATUS
11969
11970 SIDE EFFECTS NONE
11971
11972============================================================================*/
11973VOS_STATUS WLANTL_GetSpecStatistic
11974(
11975 v_PVOID_t pAdapter,
11976 WLANTL_TRANSFER_STATIC_TYPE statType,
11977 v_U32_t *buffer,
11978 v_U8_t STAid
11979)
11980{
11981 WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011982 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -070011983 VOS_STATUS status = VOS_STATUS_SUCCESS;
11984 WLANTL_TRANSFER_STA_TYPE *statistics = NULL;
11985
11986 /*------------------------------------------------------------------------
11987 Sanity check
11988 Extract TL control block
11989 ------------------------------------------------------------------------*/
11990 if (NULL == pTLCb)
11991 {
11992 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11993 "WLAN TL:Invalid TL pointer on WLANTL_GetStatistics"));
11994 return VOS_STATUS_E_FAULT;
11995 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011996 pClientSTA = pTLCb->atlSTAClients[STAid];
Jeff Johnson295189b2012-06-20 16:38:30 -070011997
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011998 if ( NULL == pClientSTA )
11999 {
12000 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12001 "WLAN TL:Client Memory was not allocated on %s", __func__));
12002 return VOS_STATUS_E_FAILURE;
12003 }
12004
12005 if(0 == pClientSTA->ucExists)
Jeff Johnson295189b2012-06-20 16:38:30 -070012006 {
12007 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12008 "WLAN TL: %d STA ID does not exist", STAid));
12009 return VOS_STATUS_E_INVAL;
12010 }
12011
12012 if(NULL == buffer)
12013 {
12014 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12015 "WLAN TL:Invalid TL statistic buffer pointer on WLANTL_GetStatistics"));
12016 return VOS_STATUS_E_INVAL;
12017 }
12018
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012019 statistics = &pClientSTA->trafficStatistics;
Jeff Johnson295189b2012-06-20 16:38:30 -070012020 switch(statType)
12021 {
12022 case WLANTL_STATIC_TX_UC_FCNT:
12023 *buffer = statistics->txUCFcnt;
12024 break;
12025
12026 case WLANTL_STATIC_TX_MC_FCNT:
12027 *buffer = statistics->txMCFcnt;
12028 break;
12029
12030 case WLANTL_STATIC_TX_BC_FCNT:
12031 *buffer = statistics->txBCFcnt;
12032 break;
12033
12034 case WLANTL_STATIC_TX_UC_BCNT:
12035 *buffer = statistics->txUCBcnt;
12036 break;
12037
12038 case WLANTL_STATIC_TX_MC_BCNT:
12039 *buffer = statistics->txMCBcnt;
12040 break;
12041
12042 case WLANTL_STATIC_TX_BC_BCNT:
12043 *buffer = statistics->txBCBcnt;
12044 break;
12045
12046 case WLANTL_STATIC_RX_UC_FCNT:
12047 *buffer = statistics->rxUCFcnt;
12048 break;
12049
12050 case WLANTL_STATIC_RX_MC_FCNT:
12051 *buffer = statistics->rxMCFcnt;
12052 break;
12053
12054 case WLANTL_STATIC_RX_BC_FCNT:
12055 *buffer = statistics->rxBCFcnt;
12056 break;
12057
12058 case WLANTL_STATIC_RX_UC_BCNT:
12059 *buffer = statistics->rxUCBcnt;
12060 break;
12061
12062 case WLANTL_STATIC_RX_MC_BCNT:
12063 *buffer = statistics->rxMCBcnt;
12064 break;
12065
12066 case WLANTL_STATIC_RX_BC_BCNT:
12067 *buffer = statistics->rxBCBcnt;
12068 break;
12069
12070 case WLANTL_STATIC_RX_BCNT:
12071 *buffer = statistics->rxBcnt;
12072 break;
12073
12074 case WLANTL_STATIC_RX_BCNT_CRC_OK:
12075 *buffer = statistics->rxBcntCRCok;
12076 break;
12077
12078 case WLANTL_STATIC_RX_RATE:
12079 *buffer = statistics->rxRate;
12080 break;
12081
12082 default:
12083 *buffer = 0;
12084 status = VOS_STATUS_E_INVAL;
12085 break;
12086 }
12087
12088
12089 return status;
12090}
12091
12092/*==========================================================================
12093 FUNCTION WLANTL_ResetSpecStatistic
12094
12095 DESCRIPTION Reset specific field within statistics structure for
12096 identified station ID
12097 Reset means set as 0
12098
12099 DEPENDENCIES NONE
12100
12101 PARAMETERS in pAdapter - Global handle
12102 in statType - specific statistics field to reset
12103 in STAid - Station ID
12104
12105 RETURN VALUE VOS_STATUS
12106
12107 SIDE EFFECTS NONE
12108
12109============================================================================*/
12110VOS_STATUS WLANTL_ResetSpecStatistic
12111(
12112 v_PVOID_t pAdapter,
12113 WLANTL_TRANSFER_STATIC_TYPE statType,
12114 v_U8_t STAid
12115)
12116{
12117 WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012118 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -070012119 VOS_STATUS status = VOS_STATUS_SUCCESS;
12120 WLANTL_TRANSFER_STA_TYPE *statistics = NULL;
12121
12122 /*------------------------------------------------------------------------
12123 Sanity check
12124 Extract TL control block
12125 ------------------------------------------------------------------------*/
12126 if (NULL == pTLCb)
12127 {
12128 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12129 "WLAN TL:Invalid TL pointer on WLANTL_GetStatistics"));
12130 return VOS_STATUS_E_FAULT;
12131 }
12132
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012133 pClientSTA = pTLCb->atlSTAClients[STAid];
12134
12135 if ( NULL == pClientSTA )
12136 {
12137 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12138 "WLAN TL:Client Memory was not allocated on %s", __func__));
12139 return VOS_STATUS_E_FAILURE;
12140 }
12141
12142 if(0 == pClientSTA->ucExists)
Jeff Johnson295189b2012-06-20 16:38:30 -070012143 {
12144 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12145 "WLAN TL: %d STA ID does not exist", STAid));
12146 return VOS_STATUS_E_INVAL;
12147 }
12148
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012149 statistics = &pClientSTA->trafficStatistics;
Jeff Johnson295189b2012-06-20 16:38:30 -070012150 switch(statType)
12151 {
12152 case WLANTL_STATIC_TX_UC_FCNT:
12153 statistics->txUCFcnt = 0;
12154 break;
12155
12156 case WLANTL_STATIC_TX_MC_FCNT:
12157 statistics->txMCFcnt = 0;
12158 break;
12159
12160 case WLANTL_STATIC_TX_BC_FCNT:
12161 statistics->txBCFcnt = 0;
12162 break;
12163
12164 case WLANTL_STATIC_TX_UC_BCNT:
12165 statistics->txUCBcnt = 0;
12166 break;
12167
12168 case WLANTL_STATIC_TX_MC_BCNT:
12169 statistics->txMCBcnt = 0;
12170 break;
12171
12172 case WLANTL_STATIC_TX_BC_BCNT:
12173 statistics->txBCBcnt = 0;
12174 break;
12175
12176 case WLANTL_STATIC_RX_UC_FCNT:
12177 statistics->rxUCFcnt = 0;
12178 break;
12179
12180 case WLANTL_STATIC_RX_MC_FCNT:
12181 statistics->rxMCFcnt = 0;
12182 break;
12183
12184 case WLANTL_STATIC_RX_BC_FCNT:
12185 statistics->rxBCFcnt = 0;
12186 break;
12187
12188 case WLANTL_STATIC_RX_UC_BCNT:
12189 statistics->rxUCBcnt = 0;
12190 break;
12191
12192 case WLANTL_STATIC_RX_MC_BCNT:
12193 statistics->rxMCBcnt = 0;
12194 break;
12195
12196 case WLANTL_STATIC_RX_BC_BCNT:
12197 statistics->rxBCBcnt = 0;
12198 break;
12199
12200 case WLANTL_STATIC_RX_BCNT:
12201 statistics->rxBcnt = 0;
12202 break;
12203
12204 case WLANTL_STATIC_RX_BCNT_CRC_OK:
12205 statistics->rxBcntCRCok = 0;
12206 break;
12207
12208 case WLANTL_STATIC_RX_RATE:
12209 statistics->rxRate = 0;
12210 break;
12211
12212 default:
12213 status = VOS_STATUS_E_INVAL;
12214 break;
12215 }
12216
12217 return status;
12218}
12219
12220
12221/*==========================================================================
12222
12223 FUNCTION
12224
12225 DESCRIPTION Read RSSI value out of a RX BD
12226
12227 PARAMETERS: Caller must validate all parameters
12228
12229 RETURN VALUE
12230
12231============================================================================*/
12232VOS_STATUS WLANTL_ReadRSSI
12233(
12234 v_PVOID_t pAdapter,
12235 v_PVOID_t pBDHeader,
12236 v_U8_t STAid
12237)
12238{
12239 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
12240 v_S7_t currentRSSI, currentRSSI0, currentRSSI1;
12241
12242
12243 if(NULL == tlCtxt)
12244 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070012245 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "%s Invalid TL handle", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -070012246 return VOS_STATUS_E_INVAL;
12247 }
12248
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012249 if ( NULL == tlCtxt->atlSTAClients[STAid] )
12250 {
12251 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12252 "WLAN TL:Client Memory was not allocated on %s", __func__));
12253 return VOS_STATUS_E_FAILURE;
12254 }
12255
Jeff Johnson295189b2012-06-20 16:38:30 -070012256 currentRSSI0 = WLANTL_GETRSSI0(pBDHeader);
12257 currentRSSI1 = WLANTL_GETRSSI1(pBDHeader);
12258 currentRSSI = (currentRSSI0 > currentRSSI1) ? currentRSSI0 : currentRSSI1;
12259
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012260 tlCtxt->atlSTAClients[STAid]->rssiAvg = currentRSSI;
Jeff Johnson295189b2012-06-20 16:38:30 -070012261
12262 return VOS_STATUS_SUCCESS;
12263}
12264
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +053012265/*==========================================================================
12266
12267 FUNCTION
12268
12269 DESCRIPTION Read SNR value out of a RX BD
12270
12271 PARAMETERS: Caller must validate all parameters
12272
12273 RETURN VALUE
12274
12275============================================================================*/
12276VOS_STATUS WLANTL_ReadSNR
12277(
12278 v_PVOID_t pAdapter,
12279 v_PVOID_t pBDHeader,
12280 v_U8_t STAid
12281)
12282{
12283 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
12284 v_S7_t currentSNR;
12285
12286
12287 if (NULL == tlCtxt)
12288 {
12289 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12290 "%s Invalid TL handle", __func__));
12291 return VOS_STATUS_E_INVAL;
12292 }
12293
12294 if (NULL == tlCtxt->atlSTAClients[STAid])
12295 {
12296 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12297 "WLAN TL:Client Memory was not allocated on %s", __func__));
12298 return VOS_STATUS_E_FAILURE;
12299 }
12300
12301 currentSNR = WLANTL_GETSNR(pBDHeader);
12302
Madan Mohan Koyyalamudi43acf032013-09-27 04:33:28 +053012303 /* SNR reported in the Buffer Descriptor is scaled up by 2(SNR*2),
12304 * Get the correct SNR value
12305 */
12306 currentSNR = currentSNR >> 1;
12307
12308 /* SNR reported by HW cannot be more than 35dB due to HW limitations */
12309 currentSNR = (WLANTL_MAX_HW_SNR > currentSNR ? currentSNR :
12310 WLANTL_MAX_HW_SNR);
12311
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +053012312 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
12313 "%s: snrsum: %d snridx: %d prevsnravg: %d",
12314 __func__,
12315 tlCtxt->atlSTAClients[STAid]->snrSum,
12316 tlCtxt->atlSTAClients[STAid]->snrIdx,
12317 tlCtxt->atlSTAClients[STAid]->prevSnrAvg));
12318
12319 /* The SNR returned for all purposes is the average SNR over
12320 * WLANTL_MAX_SNR_DATA_SMAPLES.When data samples
12321 * > WLANTL_MAX_SNR_DATA_SAMPLES are obtained,
12322 * store the average of the samples in prevSnrAvg
12323 * and start a new averaging window. The prevSnrAvg is used when
12324 * enough data samples are not available when applications
12325 * actually query for SNR.
12326 *
12327 * SEE: WLANTL_GetSnr()
12328 */
12329 if (tlCtxt->atlSTAClients[STAid]->snrIdx >= WLANTL_MAX_SNR_DATA_SAMPLES)
12330 {
12331 tlCtxt->atlSTAClients[STAid]->prevSnrAvg =
12332 tlCtxt->atlSTAClients[STAid]->snrSum /
12333 tlCtxt->atlSTAClients[STAid]->snrIdx;
12334 tlCtxt->atlSTAClients[STAid]->snrSum = 0;
12335 tlCtxt->atlSTAClients[STAid]->snrIdx = 0;
12336 }
12337 tlCtxt->atlSTAClients[STAid]->snrSum += currentSNR;
12338 tlCtxt->atlSTAClients[STAid]->snrIdx += 1;
12339
12340 return VOS_STATUS_SUCCESS;
12341}
Jeff Johnson295189b2012-06-20 16:38:30 -070012342
12343/*
12344 DESCRIPTION
12345 TL returns the weight currently maintained in TL.
12346 IN
12347 pvosGCtx: pointer to the global vos context; a handle to TL's
12348 or SME's control block can be extracted from its context
12349
12350 OUT
12351 pACWeights: Caller allocated memory for filling in weights
12352
12353 RETURN VALUE VOS_STATUS
12354*/
12355VOS_STATUS
12356WLANTL_GetACWeights
12357(
12358 v_PVOID_t pvosGCtx,
12359 v_U8_t* pACWeights
12360)
12361{
12362 WLANTL_CbType* pTLCb = NULL;
12363 v_U8_t ucIndex;
12364 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
12365
12366 /*------------------------------------------------------------------------
12367 Sanity check
12368 ------------------------------------------------------------------------*/
12369 if ( NULL == pACWeights )
12370 {
12371 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12372 "WLAN TL:Invalid parameter sent on WLANTL_GetACWeights"));
12373 return VOS_STATUS_E_INVAL;
12374 }
12375
12376 /*------------------------------------------------------------------------
12377 Extract TL control block and check existance
12378 ------------------------------------------------------------------------*/
12379 pTLCb = VOS_GET_TL_CB(pvosGCtx);
12380 if ( NULL == pTLCb )
12381 {
12382 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12383 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetACWeights"));
12384 return VOS_STATUS_E_FAULT;
12385 }
12386 for ( ucIndex = 0; ucIndex < WLANTL_MAX_AC ; ucIndex++)
12387 {
12388 pACWeights[ucIndex] = pTLCb->tlConfigInfo.ucAcWeights[ucIndex];
12389 }
12390
12391 return VOS_STATUS_SUCCESS;
12392}
12393
12394
12395
12396/*
12397 DESCRIPTION
12398 Change the weight currently maintained by TL.
12399 IN
12400 pvosGCtx: pointer to the global vos context; a handle to TL's
12401 or SME's control block can be extracted from its context
12402 pACWeights: Caller allocated memory contain the weights to use
12403
12404
12405 RETURN VALUE VOS_STATUS
12406*/
12407VOS_STATUS
12408WLANTL_SetACWeights
12409(
12410 v_PVOID_t pvosGCtx,
12411 v_U8_t* pACWeights
12412)
12413{
12414 WLANTL_CbType* pTLCb = NULL;
12415 v_U8_t ucIndex;
12416 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
12417
12418 /*------------------------------------------------------------------------
12419 Sanity check
12420 ------------------------------------------------------------------------*/
12421 if ( NULL == pACWeights )
12422 {
12423 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12424 "WLAN TL:Invalid parameter sent on WLANTL_GetACWeights"));
12425 return VOS_STATUS_E_INVAL;
12426 }
12427
12428 /*------------------------------------------------------------------------
12429 Extract TL control block and check existance
12430 ------------------------------------------------------------------------*/
12431 pTLCb = VOS_GET_TL_CB(pvosGCtx);
12432 if ( NULL == pTLCb )
12433 {
12434 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12435 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetACWeights"));
12436 return VOS_STATUS_E_FAULT;
12437 }
12438 for ( ucIndex = 0; ucIndex < WLANTL_MAX_AC ; ucIndex++)
12439 {
12440 pTLCb->tlConfigInfo.ucAcWeights[ucIndex] = pACWeights[ucIndex];
12441 }
12442
12443 return VOS_STATUS_SUCCESS;
12444}
12445
12446
12447/*==========================================================================
12448
12449 FUNCTION
12450
12451 DESCRIPTION
12452
12453 PARAMETERS
12454
12455 RETURN VALUE
12456
12457============================================================================*/
12458void WLANTL_PowerStateChangedCB
12459(
12460 v_PVOID_t pAdapter,
12461 tPmcState newState
12462)
12463{
12464 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
12465
12466 if (NULL == tlCtxt)
12467 {
12468 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +053012469 "%s: Invalid TL Control Block", __func__ );
Jeff Johnson295189b2012-06-20 16:38:30 -070012470 return;
12471 }
12472
12473 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, "Power state changed, new state is %d", newState );
12474 switch(newState)
12475 {
12476 case FULL_POWER:
12477 tlCtxt->isBMPS = VOS_FALSE;
12478 break;
12479
12480 case BMPS:
12481#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
12482 WLANTL_SetFWRSSIThresholds(pAdapter);
12483#endif
12484
12485 tlCtxt->isBMPS = VOS_TRUE;
12486 break;
12487
12488 case IMPS:
12489 case LOW_POWER:
12490 case REQUEST_BMPS:
12491 case REQUEST_FULL_POWER:
12492 case REQUEST_IMPS:
12493 case STOPPED:
12494 case REQUEST_START_UAPSD:
12495 case REQUEST_STOP_UAPSD:
12496 case UAPSD:
12497 case REQUEST_STANDBY:
12498 case STANDBY:
12499 case REQUEST_ENTER_WOWL:
12500 case REQUEST_EXIT_WOWL:
12501 case WOWL:
12502 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, "Not handle this events %d", newState ));
12503 break;
12504
12505 default:
12506 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "Not a valid event %d", newState ));
12507 break;
12508 }
12509
12510 return;
12511}
12512/*==========================================================================
12513 FUNCTION WLANTL_GetEtherType
12514
12515 DESCRIPTION Extract Ether type information from the BD
12516
12517 DEPENDENCIES NONE
12518
12519 PARAMETERS in aucBDHeader - BD header
12520 in vosDataBuff - data buffer
12521 in ucMPDUHLen - MPDU header length
12522 out pUsEtherType - pointer to Ethertype
12523
12524 RETURN VALUE VOS_STATUS_SUCCESS : if the EtherType is successfully extracted
12525 VOS_STATUS_FAILURE : if the EtherType extraction failed and
12526 the packet was dropped
12527
12528 SIDE EFFECTS NONE
12529
12530============================================================================*/
12531static VOS_STATUS WLANTL_GetEtherType
12532(
12533 v_U8_t * aucBDHeader,
12534 vos_pkt_t * vosDataBuff,
12535 v_U8_t ucMPDUHLen,
12536 v_U16_t * pUsEtherType
12537)
12538{
12539 v_U8_t ucOffset;
12540 v_U16_t usEtherType = *pUsEtherType;
12541 v_SIZE_t usLLCSize = sizeof(usEtherType);
12542 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12543
12544 /*------------------------------------------------------------------------
12545 Check if LLC is present - if not, TL is unable to determine type
12546 ------------------------------------------------------------------------*/
12547 if ( VOS_FALSE == WDA_IS_RX_LLC_PRESENT( aucBDHeader ) )
12548 {
12549 ucOffset = WLANTL_802_3_HEADER_LEN - sizeof(usEtherType);
12550 }
12551 else
12552 {
12553 ucOffset = ucMPDUHLen + WLANTL_LLC_PROTO_TYPE_OFFSET;
12554 }
12555
12556 /*------------------------------------------------------------------------
12557 Extract LLC type
12558 ------------------------------------------------------------------------*/
12559 vosStatus = vos_pkt_extract_data( vosDataBuff, ucOffset,
12560 (v_PVOID_t)&usEtherType, &usLLCSize);
12561
12562 if (( VOS_STATUS_SUCCESS != vosStatus ) ||
12563 ( sizeof(usEtherType) != usLLCSize ))
12564
12565 {
12566 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12567 "WLAN TL:Error extracting Ether type from data packet"));
12568 /* Drop packet */
12569 vos_pkt_return_packet(vosDataBuff);
12570 vosStatus = VOS_STATUS_E_FAILURE;
12571 }
12572 else
12573 {
12574 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
12575 "WLAN TL:Ether type retrieved before endianess conv: %d",
12576 usEtherType));
12577
12578 usEtherType = vos_be16_to_cpu(usEtherType);
12579 *pUsEtherType = usEtherType;
12580
12581 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
12582 "WLAN TL:Ether type retrieved: %d", usEtherType));
12583 }
12584
12585 return vosStatus;
12586}
12587
Jeff Johnson295189b2012-06-20 16:38:30 -070012588/*==========================================================================
12589 FUNCTION WLANTL_GetSoftAPStatistics
12590
12591 DESCRIPTION Collect the cumulative statistics for all Softap stations
12592
12593 DEPENDENCIES NONE
12594
12595 PARAMETERS in pvosGCtx - Pointer to the global vos context
12596 bReset - If set TL statistics will be cleared after reading
12597 out statsSum - pointer to collected statistics
12598
12599 RETURN VALUE VOS_STATUS_SUCCESS : if the Statistics are successfully extracted
12600
12601 SIDE EFFECTS NONE
12602
12603============================================================================*/
12604VOS_STATUS WLANTL_GetSoftAPStatistics(v_PVOID_t pAdapter, WLANTL_TRANSFER_STA_TYPE *statsSum, v_BOOL_t bReset)
12605{
12606 v_U8_t i = 0;
12607 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12608 WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter);
12609 WLANTL_TRANSFER_STA_TYPE statBufferTemp;
12610 vos_mem_zero((v_VOID_t *)&statBufferTemp, sizeof(WLANTL_TRANSFER_STA_TYPE));
12611 vos_mem_zero((v_VOID_t *)statsSum, sizeof(WLANTL_TRANSFER_STA_TYPE));
12612
12613
12614 if ( NULL == pTLCb )
12615 {
12616 return VOS_STATUS_E_FAULT;
12617 }
12618
12619 // Sum up all the statistics for stations of Soft AP from TL
12620 for (i = 0; i < WLAN_MAX_STA_COUNT; i++)
12621 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012622 if ( NULL == pTLCb->atlSTAClients[i])
12623 {
12624 continue;
12625 }
12626 if (pTLCb->atlSTAClients[i]->wSTADesc.wSTAType == WLAN_STA_SOFTAP)
Jeff Johnson295189b2012-06-20 16:38:30 -070012627 {
12628 vosStatus = WLANTL_GetStatistics(pAdapter, &statBufferTemp, i);// Can include staId 1 because statistics not collected for it
12629
12630 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
12631 return VOS_STATUS_E_FAULT;
12632
12633 // Add to the counters
12634 statsSum->txUCFcnt += statBufferTemp.txUCFcnt;
12635 statsSum->txMCFcnt += statBufferTemp.txMCFcnt;
12636 statsSum->txBCFcnt += statBufferTemp.txBCFcnt;
12637 statsSum->txUCBcnt += statBufferTemp.txUCBcnt;
12638 statsSum->txMCBcnt += statBufferTemp.txMCBcnt;
12639 statsSum->txBCBcnt += statBufferTemp.txBCBcnt;
12640 statsSum->rxUCFcnt += statBufferTemp.rxUCFcnt;
12641 statsSum->rxMCFcnt += statBufferTemp.rxMCFcnt;
12642 statsSum->rxBCFcnt += statBufferTemp.rxBCFcnt;
12643 statsSum->rxUCBcnt += statBufferTemp.rxUCBcnt;
12644 statsSum->rxMCBcnt += statBufferTemp.rxMCBcnt;
12645 statsSum->rxBCBcnt += statBufferTemp.rxBCBcnt;
12646
12647 if (bReset)
12648 {
12649 vosStatus = WLANTL_ResetStatistics(pAdapter, i);
12650 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
12651 return VOS_STATUS_E_FAULT;
12652 }
12653 }
12654 }
12655
12656 return vosStatus;
12657}
Mohit Khanna698ba2a2012-12-04 15:08:18 -080012658#ifdef FEATURE_WLAN_TDLS_INTERNAL
12659/*==========================================================================
12660 FUNCTION WLANTL_GetEtherType_2
12661
12662 DESCRIPTION Extract Ether type information from the BD
12663
12664 DEPENDENCIES NONE
12665
12666 PARAMETERS in aucBDHeader - BD header
12667 in vosDataBuff - data buffer
12668 in ucMPDUHLen - MPDU header length
12669 out pUsEtherType - pointer to Ethertype
12670
12671 RETURN VALUE VOS_STATUS_SUCCESS : if the EtherType is successfully extracted
12672 VOS_STATUS_FAILURE : if the EtherType extraction failed and
12673 the packet was dropped
12674
12675 SIDE EFFECTS NONE
12676
12677============================================================================*/
12678static VOS_STATUS WLANTL_GetEtherType_2
12679(
12680 v_U8_t * aucBDHeader,
12681 vos_pkt_t * vosDataBuff,
12682 v_U8_t ucMPDUHLen,
12683 v_U16_t * pUsEtherType
12684)
12685{
12686 v_U8_t ucOffset;
12687 v_U16_t usEtherType = *pUsEtherType;
12688 v_SIZE_t usLLCSize = sizeof(usEtherType);
12689 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12690 //v_U8_t ucLLCHeader;
12691 v_U8_t ucMPDUHOffset ;
12692 /*------------------------------------------------------------------------
12693 Check if LLC is present - if not, TL is unable to determine type
12694 ------------------------------------------------------------------------*/
12695 //ucMPDUHOffset = (v_U8_t)WLANHAL_RX_BD_GET_MPDU_H_OFFSET(aucBDHeader) ;
12696 //ucLLCHeader = (v_U8_t)WLANHAL_RX_BD_GET_LLC(aucBDHeader);
12697 ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(aucBDHeader);
12698
12699 if ( VOS_TRUE == WDA_IS_RX_LLC_PRESENT(aucBDHeader) )
12700 {
12701 ucOffset = ucMPDUHOffset + WLANTL_802_3_HEADER_LEN - sizeof(usEtherType);
12702 }
12703 else
12704 {
12705 ucOffset = WLANHAL_RX_BD_HEADER_SIZE + ucMPDUHLen
12706 + WLANTL_LLC_PROTO_TYPE_OFFSET;
12707 }
12708
12709 /*------------------------------------------------------------------------
12710 Extract LLC type
12711 ------------------------------------------------------------------------*/
12712 vosStatus = vos_pkt_extract_data( vosDataBuff, ucOffset,
12713 (v_PVOID_t)&usEtherType, &usLLCSize);
12714
12715 /* TODO: Do it in better way */
12716 if(vos_be16_to_cpu(usEtherType) == 0x890d)
12717 {
12718 VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -080012719 ("TDLS frame llc %x"), vos_be16_to_cpu(usEtherType)) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080012720 }
12721
12722 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
12723 "WLAN TL:Ether type retrieved before endianess conv: %d",
12724 usEtherType);
12725
12726 usEtherType = vos_be16_to_cpu(usEtherType);
12727 *pUsEtherType = usEtherType;
12728
12729 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
12730 "WLAN TL:Ether type retrieved: %d", usEtherType);
12731
12732 return vosStatus;
12733}
12734#endif /* FEATURE_WLAN_TDLS */
12735
Jeff Johnson295189b2012-06-20 16:38:30 -070012736/*===============================================================================
12737 FUNCTION WLANTL_IsReplayPacket
12738
12739 DESCRIPTION This function does replay check for valid stations
12740
12741 DEPENDENCIES Validity of replay check must be done before the function
12742 is called
12743
12744 PARAMETERS currentReplayCounter current replay counter taken from RX BD
12745 previousReplayCounter previous replay counter taken from TL CB
12746
12747 RETRUN VOS_TRUE packet is a replay packet
12748 VOS_FALSE packet is not a replay packet
12749
12750 SIDE EFFECTS none
12751 ===============================================================================*/
12752v_BOOL_t
12753WLANTL_IsReplayPacket
12754(
12755 v_U64_t ullcurrentReplayCounter,
12756 v_U64_t ullpreviousReplayCounter
12757)
12758{
12759 /* Do the replay check by comparing previous received replay counter with
12760 current received replay counter*/
12761 if(ullpreviousReplayCounter < ullcurrentReplayCounter)
12762 {
12763 /* Valid packet not replay */
12764 return VOS_FALSE;
12765 }
12766 else
12767 {
12768
12769 /* Current packet number is less than or equal to previuos received
12770 packet no, this means current packet is replay packet */
12771 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12772 "WLAN TL: Replay packet found with replay counter :[0x%llX]",ullcurrentReplayCounter);
12773
12774 return VOS_TRUE;
12775 }
12776}
12777
12778#if 0
12779/*===============================================================================
12780 FUNCTION WLANTL_GetReplayCounterFromRxBD
12781
12782 DESCRIPTION This function extracts 48-bit replay packet number from RX BD
12783
12784 DEPENDENCIES Validity of replay check must be done before the function
12785 is called
12786
12787 PARAMETERS pucRxHeader pointer to RX BD header
12788
12789 RETRUN v_U64_t Packet number extarcted from RX BD
12790
12791 SIDE EFFECTS none
12792 ===============================================================================*/
12793v_U64_t
12794WLANTL_GetReplayCounterFromRxBD
12795(
12796 v_U8_t *pucRxBDHeader
12797)
12798{
12799/* 48-bit replay counter is created as follows
12800 from RX BD 6 byte PMI command:
12801 Addr : AES/TKIP
12802 0x38 : pn3/tsc3
12803 0x39 : pn2/tsc2
12804 0x3a : pn1/tsc1
12805 0x3b : pn0/tsc0
12806
12807 0x3c : pn5/tsc5
12808 0x3d : pn4/tsc4 */
12809
12810#ifdef ANI_BIG_BYTE_ENDIAN
12811 v_U64_t ullcurrentReplayCounter = 0;
12812 /* Getting 48-bit replay counter from the RX BD */
12813 ullcurrentReplayCounter = WLANHAL_RX_BD_GET_PMICMD_20TO23(pucRxBDHeader);
12814 ullcurrentReplayCounter <<= 16;
12815 ullcurrentReplayCounter |= (( WLANHAL_RX_BD_GET_PMICMD_24TO25(pucRxBDHeader) & 0xFFFF0000) >> 16);
12816 return ullcurrentReplayCounter;
12817#else
12818 v_U64_t ullcurrentReplayCounter = 0;
12819 /* Getting 48-bit replay counter from the RX BD */
12820 ullcurrentReplayCounter = (WLANHAL_RX_BD_GET_PMICMD_24TO25(pucRxBDHeader) & 0x0000FFFF);
12821 ullcurrentReplayCounter <<= 32;
12822 ullcurrentReplayCounter |= WLANHAL_RX_BD_GET_PMICMD_20TO23(pucRxBDHeader);
12823 return ullcurrentReplayCounter;
12824#endif
12825}
12826#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070012827
12828/*===============================================================================
12829 FUNCTION WLANTL_PostResNeeded
12830
12831 DESCRIPTION This function posts message to TL to reserve BD/PDU memory
12832
12833 DEPENDENCIES None
12834
12835 PARAMETERS pvosGCtx
12836
12837 RETURN None
12838
12839 SIDE EFFECTS none
12840 ===============================================================================*/
12841
12842void WLANTL_PostResNeeded(v_PVOID_t pvosGCtx)
12843{
12844 vos_msg_t vosMsg;
12845
12846 vosMsg.reserved = 0;
12847 vosMsg.bodyptr = NULL;
12848 vosMsg.type = WLANTL_TX_RES_NEEDED;
12849 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
12850 "WLAN TL: BD/PDU available interrupt received, Posting message to TL");
12851 if(!VOS_IS_STATUS_SUCCESS(vos_tx_mq_serialize( VOS_MQ_ID_TL, &vosMsg)))
12852 {
12853 VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070012854 " %s fails to post message", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -070012855 }
12856}
12857
12858/*===============================================================================
12859 FUNCTION WLANTL_UpdateRssiBmps
12860
12861 DESCRIPTION This function updates the TL's RSSI (in BMPS mode)
12862
12863 DEPENDENCIES None
12864
12865 PARAMETERS
12866
12867 pvosGCtx VOS context VOS Global context
12868 staId Station ID Station ID
12869 rssi RSSI (BMPS mode) RSSI in BMPS mode
12870
12871 RETURN None
12872
12873 SIDE EFFECTS none
12874 ===============================================================================*/
12875
12876void WLANTL_UpdateRssiBmps(v_PVOID_t pvosGCtx, v_U8_t staId, v_S7_t rssi)
12877{
12878 WLANTL_CbType* pTLCb = VOS_GET_TL_CB(pvosGCtx);
12879
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012880 if (NULL != pTLCb && NULL != pTLCb->atlSTAClients[staId])
Jeff Johnson295189b2012-06-20 16:38:30 -070012881 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012882 pTLCb->atlSTAClients[staId]->rssiAvgBmps = rssi;
Jeff Johnson295189b2012-06-20 16:38:30 -070012883 }
12884}
Gopichand Nakkala8a2b1442013-05-29 15:33:14 +053012885
12886/*===============================================================================
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +053012887 FUNCTION WLANTL_UpdateSnrBmps
12888
12889 DESCRIPTION This function updates the TL's SNR (in BMPS mode)
12890
12891 DEPENDENCIES None
12892
12893 PARAMETERS
12894
12895 pvosGCtx VOS context VOS Global context
12896 staId Station ID Station ID
12897 snr SNR (BMPS mode) SNR in BMPS mode
12898
12899 RETURN None
12900
12901 SIDE EFFECTS none
12902 ===============================================================================*/
12903
12904void WLANTL_UpdateSnrBmps(v_PVOID_t pvosGCtx, v_U8_t staId, v_S7_t snr)
12905{
12906 WLANTL_CbType* pTLCb = VOS_GET_TL_CB(pvosGCtx);
12907
12908 if (NULL != pTLCb && NULL != pTLCb->atlSTAClients[staId])
12909 {
12910 pTLCb->atlSTAClients[staId]->snrAvgBmps = snr;
12911 }
12912}
12913
12914/*===============================================================================
Gopichand Nakkala8a2b1442013-05-29 15:33:14 +053012915 FUNCTION WLANTL_UpdateLinkCapacity
12916
12917 DESCRIPTION This function updates the STA's Link Capacity in TL
12918
12919 DEPENDENCIES None
12920
12921 PARAMETERS
12922
12923 pvosGCtx VOS context VOS Global context
12924 staId Station ID Station ID
12925 linkCapacity linkCapacity Link Capacity
12926
12927 RETURN None
12928
12929 SIDE EFFECTS none
12930 ===============================================================================*/
12931
12932void WLANTL_UpdateLinkCapacity(v_PVOID_t pvosGCtx, v_U8_t staId, v_U32_t linkCapacity)
12933{
12934 WLANTL_CbType* pTLCb = VOS_GET_TL_CB(pvosGCtx);
12935
12936 if (NULL != pTLCb && NULL != pTLCb->atlSTAClients[staId])
12937 {
12938 pTLCb->atlSTAClients[staId]->linkCapacity = linkCapacity;
12939 }
12940}
12941
12942
12943/*===========================================================================
12944
12945 FUNCTION WLANTL_GetSTALinkCapacity
12946
12947 DESCRIPTION
12948
12949 Returns Link Capacity of a particular STA.
12950
12951 DEPENDENCIES
12952
12953 A station must have been registered before its state can be retrieved.
12954
12955
12956 PARAMETERS
12957
12958 IN
12959 pvosGCtx: pointer to the global vos context; a handle to TL's
12960 control block can be extracted from its context
12961 ucSTAId: identifier of the station
12962
12963 OUT
12964 plinkCapacity: the current link capacity the connection to
12965 the given station
12966
12967
12968 RETURN VALUE
12969
12970 The result code associated with performing the operation
12971
12972 VOS_STATUS_E_INVAL: Input parameters are invalid
12973 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
12974 TL cb is NULL ; access would cause a page fault
12975 VOS_STATUS_E_EXISTS: Station was not registered
12976 VOS_STATUS_SUCCESS: Everything is good :)
12977
12978 SIDE EFFECTS
12979
12980============================================================================*/
12981VOS_STATUS
12982WLANTL_GetSTALinkCapacity
12983(
12984 v_PVOID_t pvosGCtx,
12985 v_U8_t ucSTAId,
12986 v_U32_t *plinkCapacity
12987)
12988{
12989 WLANTL_CbType* pTLCb = NULL;
12990 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
12991
12992 /*------------------------------------------------------------------------
12993 Sanity check
12994 ------------------------------------------------------------------------*/
12995 if ( NULL == plinkCapacity )
12996 {
12997 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12998 FL("WLAN TL:Invalid parameter")));
12999 return VOS_STATUS_E_INVAL;
13000 }
13001
13002 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
13003 {
13004 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13005 FL("WLAN TL:Invalid station id")));
13006 return VOS_STATUS_E_FAULT;
13007 }
13008
13009 /*------------------------------------------------------------------------
13010 Extract TL control block and check existance
13011 ------------------------------------------------------------------------*/
13012 pTLCb = VOS_GET_TL_CB(pvosGCtx);
13013 if ( NULL == pTLCb )
13014 {
13015 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13016 FL("WLAN TL:Invalid TL pointer from pvosGCtx")));
13017 return VOS_STATUS_E_FAULT;
13018 }
13019
13020 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
13021 {
13022 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13023 FL("WLAN TL:Client Memory was not allocated")));
13024 return VOS_STATUS_E_FAILURE;
13025 }
13026
13027 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
13028 {
13029 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
13030 FL("WLAN TL:Station was not previously registered")));
13031 return VOS_STATUS_E_EXISTS;
13032 }
13033
13034 /*------------------------------------------------------------------------
13035 Get STA state
13036 ------------------------------------------------------------------------*/
13037 *plinkCapacity = pTLCb->atlSTAClients[ucSTAId]->linkCapacity;
13038
13039 return VOS_STATUS_SUCCESS;
13040}/* WLANTL_GetSTALinkCapacity */