blob: 1ec925a4ea42ac2826f32c845b3c271f62a71812 [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
Agarwal Ashish16020c42014-12-29 22:01:11 +05301694 FUNCTION WLANTL_UpdateTdlsSTAClient
1695
1696 DESCRIPTION
1697
1698 HDD will call this API when ENABLE_LINK happens and HDD want to
1699 register QoS or other params for TDLS peers.
1700
1701 DEPENDENCIES
1702
1703 A station must have been registered before the WMM/QOS registration is
1704 called.
1705
1706 PARAMETERS
1707
1708 pvosGCtx: pointer to the global vos context; a handle to TL's
1709 control block can be extracted from its context
1710 wSTADescType: STA Descriptor, contains information related to the
1711 new added STA
1712
1713 RETURN VALUE
1714
1715 The result code associated with performing the operation
1716
1717 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
1718 TL cb is NULL ; access would cause a page fault
1719 VOS_STATUS_E_EXISTS: Station was not registered
1720 VOS_STATUS_SUCCESS: Everything is good :)
1721
1722 SIDE EFFECTS
1723
1724============================================================================*/
1725
1726VOS_STATUS
1727WLANTL_UpdateTdlsSTAClient
1728(
1729 v_PVOID_t pvosGCtx,
1730 WLAN_STADescType* pwSTADescType
1731)
1732{
1733 WLANTL_CbType* pTLCb = NULL;
1734 WLANTL_STAClientType* pClientSTA = NULL;
1735 /*------------------------------------------------------------------------
1736 Extract TL control block
1737 ------------------------------------------------------------------------*/
1738 pTLCb = VOS_GET_TL_CB(pvosGCtx);
1739 if ( NULL == pTLCb || ( WLAN_MAX_STA_COUNT <= pwSTADescType->ucSTAId))
1740 {
1741 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1742 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_UpdateTdlsSTAClient"));
1743 return VOS_STATUS_E_FAULT;
1744 }
1745
1746 pClientSTA = pTLCb->atlSTAClients[pwSTADescType->ucSTAId];
1747 if ((NULL == pClientSTA) || 0 == pClientSTA->ucExists)
1748 {
1749 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1750 "WLAN TL:Station not exists"));
1751 return VOS_STATUS_E_FAILURE;
1752 }
1753
1754 pClientSTA->wSTADesc.ucQosEnabled = pwSTADescType->ucQosEnabled;
1755
1756 return VOS_STATUS_SUCCESS;
1757
1758}
1759
1760
1761/*===========================================================================
1762
Gopichand Nakkala8b54e912013-03-11 10:44:21 +05301763 FUNCTION WLANTL_STAPtkInstalled
1764
1765 DESCRIPTION
1766
1767 HDD will make this notification whenever PTK is installed for the STA
1768
1769 DEPENDENCIES
1770
1771 A station must have been registered before the change state can be
1772 called.
1773
1774 PARAMETERS
1775
1776 pvosGCtx: pointer to the global vos context; a handle to TL's
1777 control block can be extracted from its context
1778 ucSTAId: identifier for the STA for which Pairwise key is
1779 installed
1780
1781 RETURN VALUE
1782
1783 The result code associated with performing the operation
1784
1785 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
1786 TL cb is NULL ; access would cause a page fault
1787 VOS_STATUS_E_EXISTS: Station was not registered
1788 VOS_STATUS_SUCCESS: Everything is good :)
1789
1790 SIDE EFFECTS
1791
1792============================================================================*/
1793VOS_STATUS
1794WLANTL_STAPtkInstalled
1795(
1796 v_PVOID_t pvosGCtx,
1797 v_U8_t ucSTAId
1798)
1799{
1800 WLANTL_CbType* pTLCb = NULL;
1801 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
1802
1803 /*------------------------------------------------------------------------
1804 Sanity check
1805 ------------------------------------------------------------------------*/
1806
1807 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
1808 {
1809 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1810 "WLAN TL:Invalid station id requested on WLANTL_ChangeSTAState"));
1811 return VOS_STATUS_E_FAULT;
1812 }
1813
1814 /*------------------------------------------------------------------------
1815 Extract TL control block and check existance
1816 ------------------------------------------------------------------------*/
1817 pTLCb = VOS_GET_TL_CB(pvosGCtx);
1818 if ( NULL == pTLCb )
1819 {
1820 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1821 FL("WLAN TL:Invalid TL pointer from pvosGCtx")));
1822 return VOS_STATUS_E_FAULT;
1823 }
1824
1825 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
1826 {
1827 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1828 FL("WLAN TL:Client Memory was not allocated")));
1829 return VOS_STATUS_E_FAILURE;
1830 }
1831
1832 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
1833 {
1834 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1835 FL("WLAN TL:Station was not previously registered")));
1836 return VOS_STATUS_E_EXISTS;
1837 }
1838
1839 pTLCb->atlSTAClients[ucSTAId]->ptkInstalled = 1;
1840
1841 return VOS_STATUS_SUCCESS;
1842}/* WLANTL_STAPtkInstalled */
1843
1844/*===========================================================================
1845
Madan Mohan Koyyalamudifc1d1fe2012-10-18 15:07:12 -07001846 FUNCTION WLANTL_GetSTAState
1847
1848 DESCRIPTION
1849
1850 Returns connectivity state of a particular STA.
1851
1852 DEPENDENCIES
1853
1854 A station must have been registered before its state can be retrieved.
1855
1856
1857 PARAMETERS
1858
1859 IN
1860 pvosGCtx: pointer to the global vos context; a handle to TL's
1861 control block can be extracted from its context
1862 ucSTAId: identifier of the station
1863
1864 OUT
1865 ptlSTAState: the current state of the connection to the given station
1866
1867
1868 RETURN VALUE
1869
1870 The result code associated with performing the operation
1871
1872 VOS_STATUS_E_INVAL: Input parameters are invalid
1873 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
1874 TL cb is NULL ; access would cause a page fault
1875 VOS_STATUS_E_EXISTS: Station was not registered
1876 VOS_STATUS_SUCCESS: Everything is good :)
1877
1878 SIDE EFFECTS
1879
1880============================================================================*/
1881VOS_STATUS
1882WLANTL_GetSTAState
1883(
1884 v_PVOID_t pvosGCtx,
1885 v_U8_t ucSTAId,
1886 WLANTL_STAStateType *ptlSTAState
1887)
1888{
1889 WLANTL_CbType* pTLCb = NULL;
1890 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
1891
1892 /*------------------------------------------------------------------------
1893 Sanity check
1894 ------------------------------------------------------------------------*/
1895 if ( NULL == ptlSTAState )
1896 {
1897 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1898 "WLAN TL:Invalid parameter sent on WLANTL_GetSTAState"));
1899 return VOS_STATUS_E_INVAL;
1900 }
1901
1902 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
1903 {
1904 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1905 "WLAN TL:Invalid station id requested on WLANTL_GetSTAState"));
1906 return VOS_STATUS_E_FAULT;
1907 }
1908
1909 /*------------------------------------------------------------------------
1910 Extract TL control block and check existance
1911 ------------------------------------------------------------------------*/
1912 pTLCb = VOS_GET_TL_CB(pvosGCtx);
1913 if ( NULL == pTLCb )
1914 {
1915 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1916 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetSTAState"));
1917 return VOS_STATUS_E_FAULT;
1918 }
1919
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301920 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
1921 {
1922 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1923 "WLAN TL:Client Memory was not allocated on %s", __func__));
1924 return VOS_STATUS_E_FAILURE;
1925 }
1926
1927 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
Madan Mohan Koyyalamudifc1d1fe2012-10-18 15:07:12 -07001928 {
Sunil Ravid5406f22013-01-22 00:18:31 -08001929 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Madan Mohan Koyyalamudifc1d1fe2012-10-18 15:07:12 -07001930 "WLAN TL:Station was not previously registered on WLANTL_GetSTAState"));
1931 return VOS_STATUS_E_EXISTS;
1932 }
1933
1934 /*------------------------------------------------------------------------
1935 Get STA state
1936 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301937 *ptlSTAState = pTLCb->atlSTAClients[ucSTAId]->tlState;
Madan Mohan Koyyalamudifc1d1fe2012-10-18 15:07:12 -07001938
1939 return VOS_STATUS_SUCCESS;
1940}/* WLANTL_GetSTAState */
1941
Shailender Karmuchia734f332013-04-19 14:02:48 -07001942/*==========================================================================
1943 FUNCTION WLANTL_UpdateSTABssIdforIBSS
1944
1945 DESCRIPTION
1946 HDD will call this API to update the BSSID for this Station.
1947
1948 DEPENDENCIES
1949 The HDD Should registered the staID with TL before calling this function.
1950
1951 PARAMETERS
1952
1953 IN
1954 pvosGCtx: Pointer to the global vos context; a handle to TL's
1955 or WDA's control block can be extracted from its context
1956 IN
1957 ucSTAId The Station ID for Bssid to be updated
1958 IN
1959 pBssid BSSID to be updated
1960
1961 RETURN VALUE
1962 The result code associated with performing the operation
1963
1964 VOS_STATUS_E_INVAL: Input parameters are invalid
1965 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
1966 TL cb is NULL ; access would cause a page fault
1967 VOS_STATUS_E_EXISTS: Station was not registered
1968 VOS_STATUS_SUCCESS: Everything is good :)
1969
1970 SIDE EFFECTS
1971============================================================================*/
1972
1973
1974VOS_STATUS
1975WLANTL_UpdateSTABssIdforIBSS
1976(
1977 v_PVOID_t pvosGCtx,
1978 v_U8_t ucSTAId,
1979 v_U8_t *pBssid
1980)
1981{
1982 WLANTL_CbType* pTLCb = NULL;
1983 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
1984
1985 /*------------------------------------------------------------------------
1986 Sanity check
1987 ------------------------------------------------------------------------*/
1988 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
1989 {
1990 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1991 "WLAN TL:Invalid station id requested %s", __func__));
1992 return VOS_STATUS_E_FAULT;
1993 }
1994
1995 /*------------------------------------------------------------------------
1996 Extract TL control block and check existance
1997 ------------------------------------------------------------------------*/
1998 pTLCb = VOS_GET_TL_CB(pvosGCtx);
1999 if ( NULL == pTLCb )
2000 {
2001 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2002 "WLAN TL:Invalid TL pointer from pvosGCtx %s", __func__));
2003 return VOS_STATUS_E_FAULT;
2004 }
2005
2006 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
2007 {
2008 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2009 "WLAN TL:Client Memory was not allocated on %s", __func__));
2010 return VOS_STATUS_E_FAILURE;
2011 }
2012
2013 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
2014 {
2015 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
2016 "WLAN TL:Station was not previously registered %s", __func__));
2017 return VOS_STATUS_E_EXISTS;
2018 }
2019
2020 /*------------------------------------------------------------------------
2021 Update the IBSS BSSID
2022 ------------------------------------------------------------------------*/
2023 vos_mem_copy( &pTLCb->atlSTAClients[ucSTAId]->wSTADesc.vBSSIDforIBSS,
2024 pBssid, sizeof(v_MACADDR_t));
2025
2026 return VOS_STATUS_SUCCESS;
2027}
2028
Madan Mohan Koyyalamudifc1d1fe2012-10-18 15:07:12 -07002029/*===========================================================================
2030
Jeff Johnson295189b2012-06-20 16:38:30 -07002031 FUNCTION WLANTL_STAPktPending
2032
2033 DESCRIPTION
2034
2035 HDD will call this API when a packet is pending transmission in its
2036 queues.
2037
2038 DEPENDENCIES
2039
2040 A station must have been registered before the packet pending
2041 notification can be sent.
2042
2043 RESTRICTION: TL will not count packets for pending notification.
2044 HDD is expected to send the notification only when
2045 non-empty event gets triggered. Worst case scenario
2046 is that TL might end up making a call when Hdds
2047 queues are actually empty.
2048
2049 PARAMETERS
2050
2051 pvosGCtx: pointer to the global vos context; a handle to TL's
2052 control block can be extracted from its context
2053 ucSTAId: identifier for the STA that is pending transmission
2054
2055 RETURN VALUE
2056
2057 The result code associated with performing the operation
2058
2059 VOS_STATUS_E_INVAL: Input parameters are invalid
2060 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
2061 to TL cb is NULL ; access would cause a page fault
2062 VOS_STATUS_E_EXISTS: Station was not registered
2063 VOS_STATUS_SUCCESS: Everything is good :)
2064
2065 SIDE EFFECTS
2066
2067============================================================================*/
2068VOS_STATUS
2069WLANTL_STAPktPending
2070(
2071 v_PVOID_t pvosGCtx,
2072 v_U8_t ucSTAId,
2073 WLANTL_ACEnumType ucAc
2074)
2075{
2076 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302077 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002078 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2079
2080 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
2081 "WLAN TL:Packet pending indication for STA: %d AC: %d", ucSTAId, ucAc);
2082
2083 /*------------------------------------------------------------------------
2084 Sanity check
2085 ------------------------------------------------------------------------*/
2086 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
2087 {
2088 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2089 "WLAN TL:Invalid station id requested on WLANTL_STAPktPending"));
2090 return VOS_STATUS_E_FAULT;
2091 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002092 /*------------------------------------------------------------------------
2093 Extract TL control block and check existance
2094 ------------------------------------------------------------------------*/
2095 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2096 if ( NULL == pTLCb )
2097 {
2098 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2099 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STAPktPending"));
2100 return VOS_STATUS_E_FAULT;
2101 }
2102
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302103 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
2104
2105 if ( NULL == pClientSTA )
2106 {
2107 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2108 "WLAN TL:Client Memory was not allocated on %s", __func__));
2109 return VOS_STATUS_E_FAILURE;
2110 }
2111
2112 if ( 0 == pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07002113 {
Katya Nigamb130d572014-11-24 16:38:16 +05302114 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Jeff Johnson295189b2012-06-20 16:38:30 -07002115 "WLAN TL:Station was not previously registered on WLANTL_STAPktPending"));
2116 return VOS_STATUS_E_EXISTS;
2117 }
2118
2119 /*---------------------------------------------------------------------
2120 Temporary fix to enable TL to fetch packets when multiple peers join
2121 an IBSS. To fix CR177301. Needs to go away when the actual fix of
2122 going through all STA's in round robin fashion gets merged in from
2123 BT AMP branch.
2124 --------------------------------------------------------------------*/
2125 pTLCb->ucRegisteredStaId = ucSTAId;
2126
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302127 if( WLANTL_STA_CONNECTED == pClientSTA->tlState )
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07002128 { /* EAPOL_HI_PRIORITY : need to find out whether EAPOL is pending before
2129 WLANTL_FetchPacket()/WLANTL_TxConn() is called.
2130 change STA_AUTHENTICATED != tlState to CONNECTED == tlState
2131 to make sure TL is indeed waiting for EAPOL.
2132 Just in the case when STA got disconnected shortly after connectection */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302133 pClientSTA->ucEapolPktPending = 1;
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07002134
Katya Nigam42e16e82014-02-04 16:28:55 +05302135 MTRACE(vos_trace(VOS_MODULE_ID_TL,
2136 TRACE_CODE_TL_EAPOL_PKT_PENDING, ucSTAId, ucAc));
2137
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07002138 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07002139 "WLAN TL:Packet pending indication for STA: %d AC: %d State: %d",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302140 ucSTAId, ucAc, pClientSTA->tlState);
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07002141 }
2142
Jeff Johnson295189b2012-06-20 16:38:30 -07002143 /*-----------------------------------------------------------------------
2144 Enable this AC in the AC mask in order for TL to start servicing it
2145 Set packet pending flag
2146 To avoid race condition, serialize the updation of AC and AC mask
2147 through WLANTL_TX_STAID_AC_IND message.
2148 -----------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07002149
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302150 pClientSTA->aucACMask[ucAc] = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07002151
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302152 vos_atomic_set_U8( &pClientSTA->ucPktPending, 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07002153
Mihir Shete5d148f12014-12-16 17:54:49 +05302154 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_STA_PKT_PENDING, ucSTAId,
2155 (pTLCb->ucTxSuspended << 31) |
2156 ((pTLCb->uResCount >= WDA_TLI_MIN_RES_DATA) << 30) |
2157 pClientSTA->tlState));
2158
Jeff Johnson295189b2012-06-20 16:38:30 -07002159 /*------------------------------------------------------------------------
2160 Check if there are enough resources for transmission and tx is not
2161 suspended.
2162 ------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi24a00f92012-10-22 15:21:02 -07002163 if (( pTLCb->uResCount >= WDA_TLI_MIN_RES_DATA ) &&
2164 ( 0 == pTLCb->ucTxSuspended ))
Jeff Johnson295189b2012-06-20 16:38:30 -07002165 {
Katya Nigam42e16e82014-02-04 16:28:55 +05302166
Jeff Johnson295189b2012-06-20 16:38:30 -07002167 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
2168 "Issuing Xmit start request to BAL"));
2169 WDA_DS_StartXmit(pvosGCtx);
2170 }
2171 else
2172 {
2173 /*---------------------------------------------------------------------
2174 No error code is sent because TL will resume tx autonomously if
2175 resources become available or tx gets resumed
2176 ---------------------------------------------------------------------*/
Madan Mohan Koyyalamudi179e6fe2012-10-15 15:31:08 -07002177 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Jeff Johnson295189b2012-06-20 16:38:30 -07002178 "WLAN TL:Request to send but condition not met. Res: %d,Suspend: %d",
Madan Mohan Koyyalamudi48139e32012-10-11 14:43:56 -07002179 pTLCb->uResCount, pTLCb->ucTxSuspended );
Jeff Johnson295189b2012-06-20 16:38:30 -07002180 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002181 return VOS_STATUS_SUCCESS;
2182}/* WLANTL_STAPktPending */
2183
2184/*==========================================================================
2185
2186 FUNCTION WLANTL_SetSTAPriority
2187
2188 DESCRIPTION
2189
2190 TL exposes this API to allow upper layers a rough control over the
2191 priority of transmission for a given station when supporting multiple
2192 connections.
2193
2194 DEPENDENCIES
2195
2196 A station must have been registered before the change in priority can be
2197 called.
2198
2199 PARAMETERS
2200
2201 pvosGCtx: pointer to the global vos context; a handle to TL's
2202 control block can be extracted from its context
2203 ucSTAId: identifier for the STA that has to change priority
2204
2205 RETURN VALUE
2206
2207 The result code associated with performing the operation
2208
2209 VOS_STATUS_E_INVAL: Input parameters are invalid
2210 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
2211 to TL cb is NULL ; access would cause a page fault
2212 VOS_STATUS_E_EXISTS: Station was not registered
2213 VOS_STATUS_SUCCESS: Everything is good :)
2214
2215 SIDE EFFECTS
2216
2217============================================================================*/
2218VOS_STATUS
2219WLANTL_SetSTAPriority
2220(
2221 v_PVOID_t pvosGCtx,
2222 v_U8_t ucSTAId,
2223 WLANTL_STAPriorityType tlSTAPri
2224)
2225{
2226 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302227 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002228 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2229
2230 /*------------------------------------------------------------------------
2231 Sanity check
2232 ------------------------------------------------------------------------*/
2233 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
2234 {
2235 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2236 "WLAN TL:Invalid station id requested on WLANTL_SetSTAPriority"));
2237 return VOS_STATUS_E_FAULT;
2238 }
2239
2240 /*------------------------------------------------------------------------
2241 Extract TL control block
2242 ------------------------------------------------------------------------*/
2243 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2244 if ( NULL == pTLCb )
2245 {
2246 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2247 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SetSTAPriority"));
2248 return VOS_STATUS_E_FAULT;
2249 }
2250
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302251 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
2252
2253 if ( NULL == pClientSTA )
2254 {
2255 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2256 "WLAN TL:Client Memory was not allocated on %s", __func__));
2257 return VOS_STATUS_E_FAILURE;
2258 }
2259
2260 if ( 0 == pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07002261 {
2262 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2263 "WLAN TL:Station was not previously registered on WLANTL_SetSTAPriority"));
2264 return VOS_STATUS_E_EXISTS;
2265 }
2266
2267 /*------------------------------------------------------------------------
2268 Re-analize if lock is needed when adding multiple stations
2269 ------------------------------------------------------------------------*/
2270 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
2271 "WLAN TL:Changing state for STA Pri ID: %d from %d to %d",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302272 ucSTAId, pClientSTA->tlPri, tlSTAPri));
2273 pClientSTA->tlPri = tlSTAPri;
Jeff Johnson295189b2012-06-20 16:38:30 -07002274
2275 return VOS_STATUS_SUCCESS;
2276}/* WLANTL_SetSTAPriority */
2277
2278
2279/*----------------------------------------------------------------------------
2280 INTERACTION WITH BAP
2281 ---------------------------------------------------------------------------*/
2282
2283/*==========================================================================
2284
2285 FUNCTION WLANTL_RegisterBAPClient
2286
2287 DESCRIPTION
2288 Called by SME to register itself as client for non-data BT-AMP packets.
2289
2290 DEPENDENCIES
2291 TL must be initialized before this function can be called.
2292
2293 PARAMETERS
2294
2295 IN
2296 pvosGCtx: pointer to the global vos context; a handle to TL's
2297 or SME's control block can be extracted from its context
2298 pfnTlBAPRxFrm: pointer to the receive processing routine for non-data
2299 BT-AMP packets
2300 pfnFlushOpCompleteCb:
2301 pointer to the call back function, for the Flush operation
2302 completion.
2303
2304
2305 RETURN VALUE
2306
2307 The result code associated with performing the operation
2308
2309 VOS_STATUS_E_INVAL: Input parameters are invalid
2310 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
2311 to TL cb is NULL ; access would cause a page fault
2312 VOS_STATUS_E_EXISTS: BAL client was already registered
2313 VOS_STATUS_SUCCESS: Everything is good :)
2314
2315 SIDE EFFECTS
2316
2317============================================================================*/
2318VOS_STATUS
2319WLANTL_RegisterBAPClient
2320(
2321 v_PVOID_t pvosGCtx,
2322 WLANTL_BAPRxCBType pfnTlBAPRxFrm,
2323 WLANTL_FlushOpCompCBType pfnFlushOpCompleteCb
2324)
2325{
2326 WLANTL_CbType* pTLCb = NULL;
2327 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2328
2329 /*------------------------------------------------------------------------
2330 Sanity check
2331 ------------------------------------------------------------------------*/
2332 if ( NULL == pfnTlBAPRxFrm )
2333 {
2334 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2335 "WLAN TL:Invalid parameter sent on WLANTL_RegisterBAPClient"));
2336 return VOS_STATUS_E_INVAL;
2337 }
2338
2339 if ( NULL == pfnFlushOpCompleteCb )
2340 {
2341 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2342 "Invalid Flush Complete Cb parameter sent on WLANTL_RegisterBAPClient"));
2343 return VOS_STATUS_E_INVAL;
2344 }
2345
2346 /*------------------------------------------------------------------------
2347 Extract TL control block
2348 ------------------------------------------------------------------------*/
2349 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2350 if ( NULL == pTLCb )
2351 {
2352 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2353 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_RegisterBAPClient"));
2354 return VOS_STATUS_E_FAULT;
2355 }
2356
2357 /*------------------------------------------------------------------------
2358 Make sure this is the first registration attempt
2359 ------------------------------------------------------------------------*/
2360 if ( 0 != pTLCb->tlBAPClient.ucExists )
2361 {
2362 pTLCb->tlBAPClient.ucExists++;
2363 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2364 "WLAN TL:BAP client was already registered"));
2365 return VOS_STATUS_E_EXISTS;
2366 }
2367
2368 /*------------------------------------------------------------------------
2369 Register station with TL
2370 ------------------------------------------------------------------------*/
2371 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
2372 "WLAN TL:Registering BAP Client" ));
2373
2374 pTLCb->tlBAPClient.ucExists++;
2375
2376 if ( NULL != pfnTlBAPRxFrm )
2377 {
2378 pTLCb->tlBAPClient.pfnTlBAPRx = pfnTlBAPRxFrm;
2379 }
2380
2381 pTLCb->tlBAPClient.pfnFlushOpCompleteCb = pfnFlushOpCompleteCb;
2382
2383 pTLCb->tlBAPClient.vosPendingDataBuff = NULL;
2384
2385 return VOS_STATUS_SUCCESS;
2386}/* WLANTL_RegisterBAPClient */
2387
2388
2389/*==========================================================================
2390
2391 FUNCTION WLANTL_TxBAPFrm
2392
2393 DESCRIPTION
2394 BAP calls this when it wants to send a frame to the module
2395
2396 DEPENDENCIES
2397 BAP must be registered with TL before this function can be called.
2398
2399 RESTRICTION: BAP CANNOT push any packets to TL until it did not receive
2400 a tx complete from the previous packet, that means BAP
2401 sends one packet, wait for tx complete and then
2402 sends another one
2403
2404 If BAP sends another packet before TL manages to process the
2405 previously sent packet call will end in failure
2406
2407 PARAMETERS
2408
2409 IN
2410 pvosGCtx: pointer to the global vos context; a handle to TL's
2411 or BAP's control block can be extracted from its context
2412 vosDataBuff: pointer to the vOSS buffer containing the packet to be
2413 transmitted
2414 pMetaInfo: meta information about the packet
2415 pfnTlBAPTxComp: pointer to a transmit complete routine for notifying
2416 the result of the operation over the bus
2417
2418 RETURN VALUE
2419 The result code associated with performing the operation
2420
2421 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
2422 page fault
2423 VOS_STATUS_E_EXISTS: BAL client was not yet registered
2424 VOS_STATUS_E_BUSY: The previous BT-AMP packet was not yet transmitted
2425 VOS_STATUS_SUCCESS: Everything is good :)
2426
2427 Other failure messages may be returned from the BD header handling
2428 routines, please check apropriate API for more info.
2429
2430 SIDE EFFECTS
2431
2432============================================================================*/
2433VOS_STATUS
2434WLANTL_TxBAPFrm
2435(
2436 v_PVOID_t pvosGCtx,
2437 vos_pkt_t* vosDataBuff,
2438 WLANTL_MetaInfoType* pMetaInfo,
2439 WLANTL_TxCompCBType pfnTlBAPTxComp
2440)
2441{
2442 WLANTL_CbType* pTLCb = NULL;
2443 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
2444 v_MACADDR_t vDestMacAddr;
2445 v_U16_t usPktLen;
2446 v_U8_t ucStaId = 0;
2447 v_U8_t extraHeadSpace = 0;
2448 v_U8_t ucWDSEnabled = 0;
2449 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2450
2451 /*------------------------------------------------------------------------
2452 Sanity check
2453 Extract TL control block
2454 ------------------------------------------------------------------------*/
2455 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2456 if ( NULL == pTLCb )
2457 {
2458 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2459 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_TxBAPFrm"));
2460 return VOS_STATUS_E_FAULT;
2461 }
2462
2463 /*------------------------------------------------------------------------
2464 Ensure that BAP client was registered previously
2465 ------------------------------------------------------------------------*/
2466 if (( 0 == pTLCb->tlBAPClient.ucExists ) ||
2467 ( WLANTL_STA_ID_INVALID(pTLCb->tlBAPClient.ucBAPSTAId) ))
2468 {
2469 pTLCb->tlBAPClient.ucExists++;
2470 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2471 "WLAN TL:BAP client not register on WLANTL_TxBAPFrm"));
2472 return VOS_STATUS_E_EXISTS;
2473 }
2474
2475 /*------------------------------------------------------------------------
2476 Check if any BT-AMP Frm is pending
2477 ------------------------------------------------------------------------*/
2478 if ( NULL != pTLCb->tlBAPClient.vosPendingDataBuff )
2479 {
2480 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2481 "WLAN TL:BT-AMP Frame already pending tx in TL on WLANTL_TxBAPFrm"));
2482 return VOS_STATUS_E_BUSY;
2483 }
2484
2485 /*------------------------------------------------------------------------
2486 Save buffer and notify BAL; no lock is needed if the above restriction
2487 is met
2488 Save the tx complete fnct pointer as tl specific data in the vos buffer
2489 ------------------------------------------------------------------------*/
2490
2491 /*------------------------------------------------------------------------
2492 Translate 802.3 frame to 802.11
2493 ------------------------------------------------------------------------*/
2494 ucStaId = pTLCb->tlBAPClient.ucBAPSTAId;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302495 if ( NULL == pTLCb->atlSTAClients[ucStaId] )
2496 {
2497 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2498 "WLAN TL:Client Memory was not allocated on %s", __func__));
2499 return VOS_STATUS_E_FAILURE;
2500 }
2501 if (( 0 == pMetaInfo->ucDisableFrmXtl ) &&
2502 ( 0 != pTLCb->atlSTAClients[ucStaId]->wSTADesc.ucSwFrameTXXlation ))
Jeff Johnson295189b2012-06-20 16:38:30 -07002503 {
Kiran Venkatappacab0d352012-12-17 13:09:22 -08002504 vosStatus = WLANTL_Translate8023To80211Header( vosDataBuff, &vosStatus,
2505 pTLCb, &ucStaId,
Ravi Joshid0699502013-07-08 15:48:47 -07002506 pMetaInfo, &ucWDSEnabled,
2507 &extraHeadSpace);
Jeff Johnson295189b2012-06-20 16:38:30 -07002508
2509 if ( VOS_STATUS_SUCCESS != vosStatus )
2510 {
2511 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2512 "WLAN TL:Error when translating header WLANTL_TxBAPFrm"));
2513
2514 return vosStatus;
2515 }
2516
2517 pMetaInfo->ucDisableFrmXtl = 1;
2518 }
2519
2520 /*-------------------------------------------------------------------------
2521 Call HAL to fill BD header
2522 -------------------------------------------------------------------------*/
2523
2524 /* Adding Type, SubType which was missing for EAPOL from BAP */
2525 pMetaInfo->ucType |= (WLANTL_80211_DATA_TYPE << 4);
2526 pMetaInfo->ucType |= (WLANTL_80211_DATA_QOS_SUBTYPE);
2527
2528 vosStatus = WDA_DS_BuildTxPacketInfo( pvosGCtx, vosDataBuff ,
2529 &vDestMacAddr, pMetaInfo->ucDisableFrmXtl,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302530 &usPktLen, pTLCb->atlSTAClients[ucStaId]->wSTADesc.ucQosEnabled,
Jeff Johnson295189b2012-06-20 16:38:30 -07002531 ucWDSEnabled, extraHeadSpace, pMetaInfo->ucType,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302532 &pTLCb->atlSTAClients[ucStaId]->wSTADesc.vSelfMACAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07002533 pMetaInfo->ucTID, 0 /* No ACK */, pMetaInfo->usTimeStamp,
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07002534 pMetaInfo->ucIsEapol || pMetaInfo->ucIsWai, pMetaInfo->ucUP );
Jeff Johnson295189b2012-06-20 16:38:30 -07002535
2536 if ( VOS_STATUS_SUCCESS != vosStatus )
2537 {
2538 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2539 "WLAN TL:Failed while building TX header %d", vosStatus));
2540 return vosStatus;
2541 }
2542
2543 if ( NULL != pfnTlBAPTxComp )
2544 {
2545 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
2546 (v_PVOID_t)pfnTlBAPTxComp);
2547 }
2548 else
2549 {
2550 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
2551 (v_PVOID_t)WLANTL_TxCompDefaultCb);
2552
2553 }
2554
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05302555 vos_atomic_set( (uintptr_t*)&pTLCb->tlBAPClient.vosPendingDataBuff,
2556 (uintptr_t)vosDataBuff);
Jeff Johnson295189b2012-06-20 16:38:30 -07002557
2558 /*------------------------------------------------------------------------
2559 Check if thre are enough resources for transmission and tx is not
2560 suspended.
2561 ------------------------------------------------------------------------*/
2562 if (( pTLCb->uResCount >= WDA_TLI_MIN_RES_BAP ) &&
2563 ( 0 == pTLCb->ucTxSuspended ))
2564 {
2565 WDA_DS_StartXmit(pvosGCtx);
2566 }
2567 else
2568 {
2569 /*---------------------------------------------------------------------
2570 No error code is sent because TL will resume tx autonomously if
2571 resources become available or tx gets resumed
2572 ---------------------------------------------------------------------*/
2573 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
2574 "WLAN TL:Request to send from BAP but condition not met.Res: %d,"
2575 "Suspend: %d", pTLCb->uResCount, pTLCb->ucTxSuspended ));
2576 }
2577
2578 return VOS_STATUS_SUCCESS;
2579}/* WLANTL_TxBAPFrm */
2580
2581
2582/*----------------------------------------------------------------------------
2583 INTERACTION WITH SME
2584 ---------------------------------------------------------------------------*/
2585
2586/*==========================================================================
2587
2588 FUNCTION WLANTL_GetRssi
2589
2590 DESCRIPTION
2591 TL will extract the RSSI information from every data packet from the
2592 ongoing traffic and will store it. It will provide the result to SME
2593 upon request.
2594
2595 DEPENDENCIES
2596
2597 WARNING: the read and write of this value will not be protected
2598 by locks, therefore the information obtained after a read
2599 might not always be consistent.
2600
2601 PARAMETERS
2602
2603 IN
2604 pvosGCtx: pointer to the global vos context; a handle to TL's
2605 or SME's control block can be extracted from its context
2606 ucSTAId: station identifier for the requested value
2607
2608 OUT
2609 puRssi: the average value of the RSSI
2610
2611
2612 RETURN VALUE
2613 The result code associated with performing the operation
2614
2615 VOS_STATUS_E_INVAL: Input parameters are invalid
2616 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
2617 to TL cb is NULL ; access would cause a page fault
2618 VOS_STATUS_E_EXISTS: STA was not yet registered
2619 VOS_STATUS_SUCCESS: Everything is good :)
2620
2621 SIDE EFFECTS
2622
2623============================================================================*/
2624VOS_STATUS
2625WLANTL_GetRssi
2626(
2627 v_PVOID_t pvosGCtx,
2628 v_U8_t ucSTAId,
2629 v_S7_t* pRssi
2630)
2631{
2632 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302633 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002634 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2635
2636 /*------------------------------------------------------------------------
2637 Sanity check
2638 ------------------------------------------------------------------------*/
2639 if ( NULL == pRssi )
2640 {
2641 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2642 "WLAN TL:Invalid parameter sent on WLANTL_GetRssi"));
2643 return VOS_STATUS_E_INVAL;
2644 }
2645
2646 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
2647 {
2648 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2649 "WLAN TL:Invalid station id requested on WLANTL_GetRssi"));
2650 return VOS_STATUS_E_FAULT;
2651 }
2652
2653 /*------------------------------------------------------------------------
2654 Extract TL control block and check existance
2655 ------------------------------------------------------------------------*/
2656 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2657 if ( NULL == pTLCb )
2658 {
2659 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2660 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetRssi"));
2661 return VOS_STATUS_E_FAULT;
2662 }
2663
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302664 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
2665
2666 if ( NULL == pClientSTA )
2667 {
2668 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2669 "WLAN TL:Client Memory was not allocated on %s", __func__));
2670 return VOS_STATUS_E_FAILURE;
2671 }
2672
2673 if ( 0 == pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07002674 {
2675 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2676 "WLAN TL:Station was not previously registered on WLANTL_GetRssi"));
2677 return VOS_STATUS_E_EXISTS;
2678 }
2679
2680 /*------------------------------------------------------------------------
2681 Copy will not be locked; please read restriction
2682 ------------------------------------------------------------------------*/
Katya Nigam5c2e5f62013-11-15 19:19:11 +05302683 if(pTLCb->isBMPS || IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002684 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302685 *pRssi = pClientSTA->rssiAvgBmps;
Jeff Johnson295189b2012-06-20 16:38:30 -07002686 /* Check If RSSI is zero because we are reading rssAvgBmps updated by HAL in
2687 previous GetStatsRequest. It may be updated as zero by Hal because EnterBmps
2688 might not have happend by that time. Hence reading the most recent Rssi
2689 calcluated by TL*/
2690 if(0 == *pRssi)
2691 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302692 *pRssi = pClientSTA->rssiAvg;
Jeff Johnson295189b2012-06-20 16:38:30 -07002693 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002694 }
2695 else
2696 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302697 *pRssi = pClientSTA->rssiAvg;
Jeff Johnson295189b2012-06-20 16:38:30 -07002698 }
2699
2700 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Jeff Johnson32d95a32012-09-10 13:15:23 -07002701 "WLAN TL:WLANTL_GetRssi for STA: %d RSSI: %d%s",
2702 ucSTAId, *pRssi,
2703 pTLCb->isBMPS ? " in BMPS" : ""));
Jeff Johnson295189b2012-06-20 16:38:30 -07002704
2705 return VOS_STATUS_SUCCESS;
2706}/* WLANTL_GetRssi */
2707
2708/*==========================================================================
2709
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05302710 FUNCTION WLANTL_GetSnr
2711
2712 DESCRIPTION
2713 TL will extract the SNR information from every data packet from the
2714 ongoing traffic and will store it. It will provide the result to SME
2715 upon request.
2716
2717 DEPENDENCIES
2718
2719 WARNING: the read and write of this value will not be protected
2720 by locks, therefore the information obtained after a read
2721 might not always be consistent.
2722
2723 PARAMETERS
2724
2725 IN
2726 pvosGCtx: pointer to the global vos context; a handle to TL's
2727 or SME's control block can be extracted from its context
2728 ucSTAId: station identifier for the requested value
2729
2730 OUT
2731 pSnr: the average value of the SNR
2732
2733
2734 RETURN VALUE
2735 The result code associated with performing the operation
2736
2737 VOS_STATUS_E_INVAL: Input parameters are invalid
2738 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
2739 to TL cb is NULL ; access would cause a page fault
2740 VOS_STATUS_E_EXISTS: STA was not yet registered
2741 VOS_STATUS_SUCCESS: Everything is good :)
2742
2743 SIDE EFFECTS
2744
2745============================================================================*/
2746VOS_STATUS
2747WLANTL_GetSnr
2748(
2749 tANI_U8 ucSTAId,
2750 tANI_S8* pSnr
2751)
2752{
2753 WLANTL_CbType* pTLCb = NULL;
2754 WLANTL_STAClientType* pClientSTA = NULL;
2755 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2756
2757 /*------------------------------------------------------------------------
2758 Sanity check
2759 ------------------------------------------------------------------------*/
2760 if (NULL == pSnr)
2761 {
2762 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2763 "WLAN TL:Invalid parameter sent on %s", __func__));
2764 return VOS_STATUS_E_INVAL;
2765 }
2766
2767 if (WLANTL_STA_ID_INVALID(ucSTAId))
2768 {
2769 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2770 "WLAN TL:Invalid station id requested on %s", __func__));
2771 return VOS_STATUS_E_FAULT;
2772 }
2773
2774 /*------------------------------------------------------------------------
2775 Extract TL control block and check existance
2776 ------------------------------------------------------------------------*/
2777 pTLCb = VOS_GET_TL_CB(vos_get_global_context(VOS_MODULE_ID_TL, NULL));
2778 if (NULL == pTLCb)
2779 {
2780 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2781 "WLAN TL:Invalid TL pointer from pvosGCtx on %s", __func__));
2782 return VOS_STATUS_E_FAULT;
2783 }
2784
2785 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
2786
2787 if (NULL == pClientSTA)
2788 {
2789 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2790 "WLAN TL:Client Memory was not allocated on %s", __func__));
2791 return VOS_STATUS_E_FAILURE;
2792 }
2793
2794 if (0 == pClientSTA->ucExists)
2795 {
2796 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2797 "WLAN TL:Station was not previously registered on %s", __func__));
2798 return VOS_STATUS_E_EXISTS;
2799 }
2800
2801 /*------------------------------------------------------------------------
2802 Copy will not be locked; please read restriction
2803 ------------------------------------------------------------------------*/
2804 if (pTLCb->isBMPS)
2805 {
2806 *pSnr = pClientSTA->snrAvgBmps;
2807 }
2808 else
2809 {
2810 /* SNR is averaged over WLANTL_MAX_SNR_DATA_SAMPLES, if there are not enough
2811 * data samples (snridx) to calculate the average then return the
2812 * average for the window of prevoius 20 packets. And if there aren't
2813 * enough samples and the average for previous window of 20 packets is
2814 * not available then return a predefined value
2815 *
2816 * NOTE: the SNR_HACK_BMPS value is defined to 127, documents from HW
2817 * team reveal that the SNR value has a ceiling well below 127 dBm,
2818 * so if SNR has value of 127 the userspace applications can know that
2819 * the SNR has not been computed yet because enough data was not
2820 * available for SNR calculation
2821 */
2822 if (pClientSTA->snrIdx > (WLANTL_MAX_SNR_DATA_SAMPLES/2)
2823 || !(pClientSTA->prevSnrAvg))
2824 {
2825 *pSnr = pClientSTA->snrSum / pClientSTA->snrIdx;
2826 }
2827 else if (pClientSTA->prevSnrAvg)
2828 {
2829 *pSnr = pClientSTA->prevSnrAvg;
2830 }
2831 else
2832 {
2833 *pSnr = SNR_HACK_BMPS;
2834 }
2835 }
2836
2837 VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
2838 "WLAN TL:WLANTL_GetSnr for STA: %d SNR: %d%s",
2839 ucSTAId, *pSnr,
2840 pTLCb->isBMPS ? " in BMPS" : "");
2841
2842 return VOS_STATUS_SUCCESS;
2843}/* WLANTL_GetSnr */
2844/*==========================================================================
2845
Jeff Johnson295189b2012-06-20 16:38:30 -07002846 FUNCTION WLANTL_GetLinkQuality
2847
2848 DESCRIPTION
2849 TL will extract the SNR information from every data packet from the
2850 ongoing traffic and will store it. It will provide the result to SME
2851 upon request.
2852
2853 DEPENDENCIES
2854
2855 WARNING: the read and write of this value will not be protected
2856 by locks, therefore the information obtained after a read
2857 might not always be consistent.
2858
2859 PARAMETERS
2860
2861 IN
2862 pvosGCtx: pointer to the global vos context; a handle to TL's
2863 or SME's control block can be extracted from its context
2864 ucSTAId: station identifier for the requested value
2865
2866 OUT
2867 puLinkQuality: the average value of the SNR
2868
2869
2870 RETURN VALUE
2871 The result code associated with performing the operation
2872
2873 VOS_STATUS_E_INVAL: Input parameters are invalid
2874 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
2875 to TL cb is NULL ; access would cause a page fault
2876 VOS_STATUS_E_EXISTS: STA was not yet registered
2877 VOS_STATUS_SUCCESS: Everything is good :)
2878
2879 SIDE EFFECTS
2880
2881============================================================================*/
2882VOS_STATUS
2883WLANTL_GetLinkQuality
2884(
2885 v_PVOID_t pvosGCtx,
2886 v_U8_t ucSTAId,
2887 v_U32_t* puLinkQuality
2888)
2889{
2890 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302891 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002892
2893 /*------------------------------------------------------------------------
2894 Sanity check
2895 ------------------------------------------------------------------------*/
2896 if ( NULL == puLinkQuality )
2897 {
2898 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2899 "Invalid parameter sent on WLANTL_GetLinkQuality"));
2900 return VOS_STATUS_E_INVAL;
2901 }
2902
2903 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
2904 {
2905 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2906 "Invalid station id requested on WLANTL_GetLinkQuality"));
2907 return VOS_STATUS_E_FAULT;
2908 }
2909
2910 /*------------------------------------------------------------------------
2911 Extract TL control block and check existance
2912 ------------------------------------------------------------------------*/
2913 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2914 if ( NULL == pTLCb )
2915 {
2916 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2917 "Invalid TL pointer from pvosGCtx on WLANTL_GetLinkQuality"));
2918 return VOS_STATUS_E_FAULT;
2919 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302920 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
Jeff Johnson295189b2012-06-20 16:38:30 -07002921
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302922 if ( NULL == pClientSTA )
2923 {
2924 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2925 "WLAN TL:Client Memory was not allocated on %s", __func__));
2926 return VOS_STATUS_E_FAILURE;
2927 }
2928
2929 if ( 0 == pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07002930 {
2931 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2932 "Station was not previously registered on WLANTL_GetLinkQuality"));
2933 return VOS_STATUS_E_EXISTS;
2934 }
2935
2936 /*------------------------------------------------------------------------
2937 Copy will not be locked; please read restriction
2938 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302939 *puLinkQuality = pClientSTA->uLinkQualityAvg;
Jeff Johnson295189b2012-06-20 16:38:30 -07002940
2941 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
2942 "WLANTL_GetLinkQuality for STA: %d LinkQuality: %d", ucSTAId, *puLinkQuality));
2943
2944 return VOS_STATUS_SUCCESS;
2945}/* WLANTL_GetLinkQuality */
2946
2947/*==========================================================================
2948
2949 FUNCTION WLANTL_FlushStaTID
2950
2951 DESCRIPTION
2952 TL provides this API as an interface to SME (BAP) layer. TL inturn posts a
2953 message to HAL. This API is called by the SME inorder to perform a flush
2954 operation.
2955
2956 DEPENDENCIES
2957
2958 PARAMETERS
2959
2960 IN
2961 pvosGCtx: pointer to the global vos context; a handle to TL's
2962 or SME's control block can be extracted from its context
2963 ucSTAId: station identifier for the requested value
2964 ucTid: Tspec ID for the new BA session
2965
2966 OUT
2967 The response for this post is received in the main thread, via a response
2968 message from HAL to TL.
2969
2970 RETURN VALUE
2971 VOS_STATUS_SUCCESS: Everything is good :)
2972
2973 SIDE EFFECTS
2974============================================================================*/
2975VOS_STATUS
2976WLANTL_FlushStaTID
2977(
2978 v_PVOID_t pvosGCtx,
2979 v_U8_t ucSTAId,
2980 v_U8_t ucTid
2981)
2982{
2983 WLANTL_CbType* pTLCb = NULL;
2984 tpFlushACReq FlushACReqPtr = NULL;
2985 vos_msg_t vosMessage;
2986
2987
2988 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
2989 {
2990 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2991 "Invalid station id requested on WLANTL_FlushStaTID"));
2992 return VOS_STATUS_E_FAULT;
2993 }
2994
2995 /*------------------------------------------------------------------------
2996 Extract TL control block and check existance
2997 ------------------------------------------------------------------------*/
2998 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2999 if ( NULL == pTLCb )
3000 {
3001 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3002 "Invalid TL pointer from pvosGCtx on WLANTL_FlushStaTID"));
3003 return VOS_STATUS_E_FAULT;
3004 }
3005
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05303006 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
3007 {
3008 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3009 "WLAN TL:Client Memory was not allocated on %s", __func__));
3010 return VOS_STATUS_E_FAILURE;
3011 }
3012
3013 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07003014 {
3015 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3016 "Station was not previously registered on WLANTL_FlushStaTID"));
3017 return VOS_STATUS_E_EXISTS;
3018 }
3019
3020 /*------------------------------------------------------------------------
3021 We need to post a message with the STA, TID value to HAL. HAL performs the flush
3022 ------------------------------------------------------------------------*/
3023 FlushACReqPtr = vos_mem_malloc(sizeof(tFlushACReq));
3024
3025 if ( NULL == FlushACReqPtr )
3026 {
3027 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3028 "WLAN TL: fatal failure, cannot allocate Flush Req structure"));
3029 VOS_ASSERT(0);
3030 return VOS_STATUS_E_NOMEM;
3031 }
3032
3033 // Start constructing the message for HAL
3034 FlushACReqPtr->mesgType = SIR_TL_HAL_FLUSH_AC_REQ;
3035 FlushACReqPtr->mesgLen = sizeof(tFlushACReq);
3036 FlushACReqPtr->mesgLen = sizeof(tFlushACReq);
3037 FlushACReqPtr->ucSTAId = ucSTAId;
3038 FlushACReqPtr->ucTid = ucTid;
3039
3040 vosMessage.type = WDA_TL_FLUSH_AC_REQ;
3041 vosMessage.bodyptr = (void *)FlushACReqPtr;
3042
3043 vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
3044 return VOS_STATUS_SUCCESS;
3045}
3046
3047
3048/*----------------------------------------------------------------------------
3049 INTERACTION WITH PE
3050 ---------------------------------------------------------------------------*/
Siddharth Bhal4551b102014-10-09 21:36:36 +05303051/*==========================================================================
Jeff Johnson295189b2012-06-20 16:38:30 -07003052
Siddharth Bhal4551b102014-10-09 21:36:36 +05303053 FUNCTION WLANTL_updateSpoofMacAddr
3054
3055 DESCRIPTION
3056 Called by HDD to update macaddr
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 spoofMacAddr: spoofed mac adderess
3067 selfMacAddr: self Mac Address
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_SUCCESS: Everything is good :)
3076
3077 SIDE EFFECTS
3078
3079============================================================================*/
3080VOS_STATUS
3081WLANTL_updateSpoofMacAddr
3082(
3083 v_PVOID_t pvosGCtx,
3084 v_MACADDR_t* spoofMacAddr,
3085 v_MACADDR_t* selfMacAddr
3086)
3087{
3088 WLANTL_CbType* pTLCb = NULL;
3089 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3090
3091 /*------------------------------------------------------------------------
3092 Sanity check
3093 ------------------------------------------------------------------------*/
3094 if ( NULL == spoofMacAddr || NULL == selfMacAddr)
3095 {
3096 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3097 "WLAN TL:Invalid parameter sent on WLANTL_updateSpoofMacAddr");
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 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 vos_mem_copy(pTLCb->spoofMacAddr.selfMac.bytes, selfMacAddr,
3113 VOS_MAC_ADDRESS_LEN);
3114 vos_mem_copy(pTLCb->spoofMacAddr.spoofMac.bytes, spoofMacAddr,
3115 VOS_MAC_ADDRESS_LEN);
3116
3117 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
3118 "TL: SelfSTA mac Addr for current Scan "MAC_ADDRESS_STR,
3119 MAC_ADDR_ARRAY(pTLCb->spoofMacAddr.selfMac.bytes));
3120
3121 return VOS_STATUS_SUCCESS;
3122}/* WLANTL_updateSpoofMacAddr */
Jeff Johnson295189b2012-06-20 16:38:30 -07003123/*==========================================================================
3124
3125 FUNCTION WLANTL_RegisterMgmtFrmClient
3126
3127 DESCRIPTION
3128 Called by PE to register as a client for management frames delivery.
3129
3130 DEPENDENCIES
3131 TL must be initialized before this API can be called.
3132
3133 PARAMETERS
3134
3135 IN
3136 pvosGCtx: pointer to the global vos context; a handle to
3137 TL's control block can be extracted from its context
3138 pfnTlMgmtFrmRx: pointer to the receive processing routine for
3139 management frames
3140
3141 RETURN VALUE
3142 The result code associated with performing the operation
3143
3144 VOS_STATUS_E_INVAL: Input parameters are invalid
3145 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
3146 page fault
3147 VOS_STATUS_E_EXISTS: Mgmt Frame client was already registered
3148 VOS_STATUS_SUCCESS: Everything is good :)
3149
3150 SIDE EFFECTS
3151
3152============================================================================*/
3153VOS_STATUS
3154WLANTL_RegisterMgmtFrmClient
3155(
3156 v_PVOID_t pvosGCtx,
3157 WLANTL_MgmtFrmRxCBType pfnTlMgmtFrmRx
3158)
3159{
3160 WLANTL_CbType* pTLCb = NULL;
3161 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3162
3163 /*------------------------------------------------------------------------
3164 Sanity check
3165 ------------------------------------------------------------------------*/
3166 if ( NULL == pfnTlMgmtFrmRx )
3167 {
3168 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3169 "WLAN TL:Invalid parameter sent on WLANTL_RegisterMgmtFrmClient"));
3170 return VOS_STATUS_E_INVAL;
3171 }
3172
3173 /*------------------------------------------------------------------------
3174 Extract TL control block
3175 ------------------------------------------------------------------------*/
3176 pTLCb = VOS_GET_TL_CB(pvosGCtx);
3177 if ( NULL == pTLCb )
3178 {
3179 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3180 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
3181 return VOS_STATUS_E_FAULT;
3182 }
3183
3184 /*------------------------------------------------------------------------
3185 Make sure this is the first registration attempt
3186 ------------------------------------------------------------------------*/
3187 if ( 0 != pTLCb->tlMgmtFrmClient.ucExists )
3188 {
3189 pTLCb->tlMgmtFrmClient.ucExists++;
3190 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3191 "WLAN TL:Management frame client was already registered"));
3192 return VOS_STATUS_E_EXISTS;
3193 }
3194
3195 /*------------------------------------------------------------------------
3196 Register station with TL
3197 ------------------------------------------------------------------------*/
3198 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3199 "WLAN TL:Registering Management Frame Client" ));
3200
3201 pTLCb->tlMgmtFrmClient.ucExists++;
3202
3203 if ( NULL != pfnTlMgmtFrmRx )
3204 {
3205 pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx = pfnTlMgmtFrmRx;
3206 }
3207
3208 pTLCb->tlMgmtFrmClient.vosPendingDataBuff = NULL;
3209
3210 return VOS_STATUS_SUCCESS;
3211}/* WLANTL_RegisterMgmtFrmClient */
3212
3213/*==========================================================================
3214
3215 FUNCTION WLANTL_DeRegisterMgmtFrmClient
3216
3217 DESCRIPTION
3218 Called by PE to deregister as a client for management frames delivery.
3219
3220 DEPENDENCIES
3221 TL must be initialized before this API can be called.
3222
3223 PARAMETERS
3224
3225 IN
3226 pvosGCtx: pointer to the global vos context; a handle to
3227 TL's control block can be extracted from its context
3228 RETURN VALUE
3229 The result code associated with performing the operation
3230
3231 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
3232 page fault
3233 VOS_STATUS_E_EXISTS: Mgmt Frame client was never registered
3234 VOS_STATUS_SUCCESS: Everything is good :)
3235
3236 SIDE EFFECTS
3237
3238============================================================================*/
3239VOS_STATUS
3240WLANTL_DeRegisterMgmtFrmClient
3241(
3242 v_PVOID_t pvosGCtx
3243)
3244{
3245 WLANTL_CbType* pTLCb = NULL;
3246 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3247
3248 /*------------------------------------------------------------------------
3249 Extract TL control block
3250 ------------------------------------------------------------------------*/
3251 pTLCb = VOS_GET_TL_CB(pvosGCtx);
3252 if ( NULL == pTLCb )
3253 {
3254 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3255 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
3256 return VOS_STATUS_E_FAULT;
3257 }
3258
3259 /*------------------------------------------------------------------------
3260 Make sure this is the first registration attempt
3261 ------------------------------------------------------------------------*/
3262 if ( 0 == pTLCb->tlMgmtFrmClient.ucExists )
3263 {
3264 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3265 "WLAN TL:Management frame client was never registered"));
3266 return VOS_STATUS_E_EXISTS;
3267 }
3268
3269 /*------------------------------------------------------------------------
3270 Clear registration with TL
3271 ------------------------------------------------------------------------*/
3272 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3273 "WLAN TL:Deregistering Management Frame Client" ));
3274
3275 pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx = WLANTL_MgmtFrmRxDefaultCb;
3276 if ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff)
3277 {
3278 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
3279 "WLAN TL:Management cache buffer not empty on deregistering"
3280 " - dropping packet" ));
3281 vos_pkt_return_packet(pTLCb->tlMgmtFrmClient.vosPendingDataBuff);
3282
3283 pTLCb->tlMgmtFrmClient.vosPendingDataBuff = NULL;
3284 }
3285
3286 pTLCb->tlMgmtFrmClient.ucExists = 0;
3287
3288 return VOS_STATUS_SUCCESS;
3289}/* WLANTL_RegisterMgmtFrmClient */
3290
3291/*==========================================================================
3292
3293 FUNCTION WLANTL_TxMgmtFrm
3294
3295 DESCRIPTION
3296 Called by PE when it want to send out a management frame.
3297 HAL will also use this API for the few frames it sends out, they are not
3298 management frames howevere it is accepted that an exception will be
3299 allowed ONLY for the usage of HAL.
3300 Generic data frames SHOULD NOT travel through this function.
3301
3302 DEPENDENCIES
3303 TL must be initialized before this API can be called.
3304
3305 RESTRICTION: If PE sends another packet before TL manages to process the
3306 previously sent packet call will end in failure
3307
3308 Frames comming through here must be 802.11 frames, frame
3309 translation in UMA will be automatically disabled.
3310
3311 PARAMETERS
3312
3313 IN
3314 pvosGCtx: pointer to the global vos context;a handle to TL's
3315 control block can be extracted from its context
3316 vosFrmBuf: pointer to a vOSS buffer containing the management
3317 frame to be transmitted
3318 usFrmLen: the length of the frame to be transmitted; information
3319 is already included in the vOSS buffer
3320 wFrmType: the type of the frame being transmitted
3321 tid: tid used to transmit this frame
3322 pfnCompTxFunc: function pointer to the transmit complete routine
3323 pvBDHeader: pointer to the BD header, if NULL it means it was not
3324 yet constructed and it lies within TL's responsibility
3325 to do so; if not NULL it is expected that it was
3326 already packed inside the vos packet
3327 ucAckResponse: flag notifying it an interrupt is needed for the
3328 acknowledgement received when the frame is sent out
3329 the air and ; the interrupt will be processed by HAL,
3330 only one such frame can be pending in the system at
3331 one time.
3332
3333
3334 RETURN VALUE
3335 The result code associated with performing the operation
3336
3337 VOS_STATUS_E_INVAL: Input parameters are invalid
3338 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
3339 page fault
3340 VOS_STATUS_E_EXISTS: Mgmt Frame client was not yet registered
3341 VOS_STATUS_E_BUSY: The previous Mgmt packet was not yet transmitted
3342 VOS_STATUS_SUCCESS: Everything is good :)
3343
3344 Other failure messages may be returned from the BD header handling
3345 routines, please check apropriate API for more info.
3346
3347 SIDE EFFECTS
3348
3349============================================================================*/
3350VOS_STATUS
3351WLANTL_TxMgmtFrm
3352(
3353 v_PVOID_t pvosGCtx,
3354 vos_pkt_t* vosFrmBuf,
3355 v_U16_t usFrmLen,
3356 v_U8_t wFrmType,
3357 v_U8_t ucTid,
3358 WLANTL_TxCompCBType pfnCompTxFunc,
3359 v_PVOID_t pvBDHeader,
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05303360 v_U32_t ucAckResponse
Jeff Johnson295189b2012-06-20 16:38:30 -07003361)
3362{
3363 WLANTL_CbType* pTLCb = NULL;
3364 v_MACADDR_t vDestMacAddr;
3365 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
3366 v_U16_t usPktLen;
3367 v_U32_t usTimeStamp = 0;
3368 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3369
3370 /*------------------------------------------------------------------------
3371 Sanity check
3372 ------------------------------------------------------------------------*/
3373 if ( NULL == vosFrmBuf )
3374 {
3375 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3376 "WLAN TL:Invalid parameter sent on WLANTL_TxMgmtFrm"));
3377 return VOS_STATUS_E_INVAL;
3378 }
3379
3380 /*------------------------------------------------------------------------
3381 Extract TL control block
3382 ------------------------------------------------------------------------*/
3383 pTLCb = VOS_GET_TL_CB(pvosGCtx);
3384 if ( NULL == pTLCb )
3385 {
3386 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
3387 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_TxMgmtFrm"));
3388 return VOS_STATUS_E_FAULT;
3389 }
3390
3391 /*------------------------------------------------------------------------
3392 Ensure that management frame client was previously registered
3393 ------------------------------------------------------------------------*/
3394 if ( 0 == pTLCb->tlMgmtFrmClient.ucExists )
3395 {
3396 pTLCb->tlMgmtFrmClient.ucExists++;
3397 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
3398 "WLAN TL:Management Frame client not register on WLANTL_TxMgmtFrm"));
3399 return VOS_STATUS_E_EXISTS;
3400 }
3401
3402 /*------------------------------------------------------------------------
3403 Check if any Mgmt Frm is pending
3404 ------------------------------------------------------------------------*/
3405 //vosTempBuff = pTLCb->tlMgmtFrmClient.vosPendingDataBuff;
3406 if ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff )
3407 {
3408
3409 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
3410 "WLAN TL:Management Frame already pending tx in TL: failing old one"));
3411
3412
3413 /*Failing the tx for the previous packet enqued by PE*/
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05303414 //vos_atomic_set( (uintptr_t*)&pTLCb->tlMgmtFrmClient.vosPendingDataBuff,
3415 // (uintptr_t)NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07003416
3417 //vos_pkt_get_user_data_ptr( vosTempBuff, VOS_PKT_USER_DATA_ID_TL,
3418 // (v_PVOID_t)&pfnTxComp);
3419
3420 /*it should never be NULL - default handler should be registered if none*/
3421 //if ( NULL == pfnTxComp )
3422 //{
3423 // VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3424 // "NULL pointer to Tx Complete on WLANTL_TxMgmtFrm");
3425 // VOS_ASSERT(0);
3426 // return VOS_STATUS_E_FAULT;
3427 //}
3428
3429 //pfnTxComp( pvosGCtx, vosTempBuff, VOS_STATUS_E_RESOURCES );
3430 //return VOS_STATUS_E_BUSY;
3431
3432
3433 //pfnCompTxFunc( pvosGCtx, vosFrmBuf, VOS_STATUS_E_RESOURCES);
3434 return VOS_STATUS_E_RESOURCES;
3435 }
3436
3437
3438 /*------------------------------------------------------------------------
3439 Check if BD header was build, if not construct
3440 ------------------------------------------------------------------------*/
3441 if ( NULL == pvBDHeader )
3442 {
3443 v_MACADDR_t* pvAddr2MacAddr;
3444 v_U8_t uQosHdr = VOS_FALSE;
3445
3446 /* Get address 2 of Mangement Frame to give to WLANHAL_FillTxBd */
3447 vosStatus = vos_pkt_peek_data( vosFrmBuf,
3448 WLANTL_MAC_ADDR_ALIGN(1) + VOS_MAC_ADDR_SIZE,
3449 (v_PVOID_t)&pvAddr2MacAddr, VOS_MAC_ADDR_SIZE);
3450
3451 if ( VOS_STATUS_SUCCESS != vosStatus )
3452 {
3453 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
3454 "WLAN TL:Failed while attempting to get addr2 %d", vosStatus));
3455 return vosStatus;
3456 }
Gopichand Nakkala0f3eb5c2013-05-07 16:48:38 +05303457
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003458 /* ESE IAPP/TDLS Frame which are data frames but technically used
Jeff Johnson295189b2012-06-20 16:38:30 -07003459 * for management functionality comes through route.
3460 */
3461 if (WLANTL_IS_QOS_DATA_FRAME(wFrmType)) \
3462 {
3463 uQosHdr = VOS_TRUE;
3464 }
Siddharth Bhal4551b102014-10-09 21:36:36 +05303465
3466 if (WLANTL_IS_PROBE_REQ(wFrmType))
3467 {
3468 if (VOS_TRUE == vos_mem_compare((v_VOID_t*) pvAddr2MacAddr,
3469 (v_VOID_t*) &pTLCb->spoofMacAddr.spoofMac, VOS_MAC_ADDRESS_LEN))
3470 {
3471 pvAddr2MacAddr = (v_PVOID_t)pTLCb->spoofMacAddr.selfMac.bytes;
3472 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
3473 "TL: using self sta addr to get staidx for spoofed probe req "
3474 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pvAddr2MacAddr->bytes));
3475 }
3476 }
3477
Jeff Johnson295189b2012-06-20 16:38:30 -07003478 /*----------------------------------------------------------------------
3479 Call WDA to build TX header
3480 ----------------------------------------------------------------------*/
3481 vosStatus = WDA_DS_BuildTxPacketInfo( pvosGCtx, vosFrmBuf , &vDestMacAddr,
3482 1 /* always 802.11 frames*/, &usPktLen, uQosHdr /*qos not enabled !!!*/,
Siddharth Bhal4551b102014-10-09 21:36:36 +05303483 0 /* WDS off */, 0, wFrmType, pvAddr2MacAddr, ucTid,
Jeff Johnson295189b2012-06-20 16:38:30 -07003484 ucAckResponse, usTimeStamp, 0, 0 );
3485
3486
3487 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
3488 {
3489 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
3490 "WLAN TL:Failed while attempting to build TX header %d", vosStatus));
3491 return vosStatus;
3492 }
3493 }/* if BD header not present */
3494
3495 /*------------------------------------------------------------------------
3496 Save buffer and notify BAL; no lock is needed if the above restriction
3497 is met
3498 Save the tx complete fnct pointer as tl specific data in the vos buffer
3499 ------------------------------------------------------------------------*/
3500 if ( NULL != pfnCompTxFunc )
3501 {
3502 vos_pkt_set_user_data_ptr( vosFrmBuf, VOS_PKT_USER_DATA_ID_TL,
3503 (v_PVOID_t)pfnCompTxFunc);
3504 }
3505 else
3506 {
3507 vos_pkt_set_user_data_ptr( vosFrmBuf, VOS_PKT_USER_DATA_ID_TL,
3508 (v_PVOID_t)WLANTL_TxCompDefaultCb);
3509
3510 }
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05303511 vos_atomic_set( (uintptr_t*)&pTLCb->tlMgmtFrmClient.vosPendingDataBuff,
3512 (uintptr_t)vosFrmBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003513
3514 /*------------------------------------------------------------------------
3515 Check if thre are enough resources for transmission and tx is not
3516 suspended.
3517 ------------------------------------------------------------------------*/
3518 if ( pTLCb->uResCount >= WDA_TLI_MIN_RES_MF )
3519 {
3520 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3521 "WLAN TL:Issuing Xmit start request to BAL for MGMT"));
3522 vosStatus = WDA_DS_StartXmit(pvosGCtx);
3523 if(VOS_STATUS_SUCCESS != vosStatus)
3524 {
3525 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
3526 "WLAN TL:WDA_DS_StartXmit fails. vosStatus %d", vosStatus));
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05303527 vos_atomic_set( (uintptr_t*)&pTLCb->tlMgmtFrmClient.vosPendingDataBuff,0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003528 }
3529 return vosStatus;
3530
3531 }
3532 else
3533 {
3534 /*---------------------------------------------------------------------
3535 No error code is sent because TL will resume tx autonomously if
3536 resources become available or tx gets resumed
3537 ---------------------------------------------------------------------*/
3538 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
3539 "WLAN TL:Request to send for Mgmt Frm but condition not met. Res: %d",
3540 pTLCb->uResCount));
3541 }
3542
3543 return VOS_STATUS_SUCCESS;
3544}/* WLANTL_TxMgmtFrm */
3545
3546/*----------------------------------------------------------------------------
3547 INTERACTION WITH HAL
3548 ---------------------------------------------------------------------------*/
3549
3550/*==========================================================================
3551
3552 FUNCTION WLANTL_ResetNotification
3553
3554 DESCRIPTION
3555 HAL notifies TL when the module is being reset.
3556 Currently not used.
3557
3558 DEPENDENCIES
3559
3560 PARAMETERS
3561
3562 IN
3563 pvosGCtx: pointer to the global vos context; a handle to TL's
3564 control block can be extracted from its context
3565
3566
3567 RETURN VALUE
3568 The result code associated with performing the operation
3569
3570 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
3571 page fault
3572 VOS_STATUS_SUCCESS: Everything is good :)
3573
3574 SIDE EFFECTS
3575
3576============================================================================*/
3577VOS_STATUS
3578WLANTL_ResetNotification
3579(
3580 v_PVOID_t pvosGCtx
3581)
3582{
3583 WLANTL_CbType* pTLCb = NULL;
3584 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3585
3586 /*------------------------------------------------------------------------
3587 Sanity check
3588 Extract TL control block
3589 ------------------------------------------------------------------------*/
3590 pTLCb = VOS_GET_TL_CB(pvosGCtx);
3591 if ( NULL == pTLCb )
3592 {
3593 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3594 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ResetNotification"));
3595 return VOS_STATUS_E_FAULT;
3596 }
3597
3598 WLANTL_CleanCB(pTLCb, 1 /*empty all queues and pending packets*/);
3599 return VOS_STATUS_SUCCESS;
3600}/* WLANTL_ResetNotification */
3601
3602/*==========================================================================
3603
3604 FUNCTION WLANTL_SuspendDataTx
3605
3606 DESCRIPTION
3607 HAL calls this API when it wishes to suspend transmission for a
3608 particular STA.
3609
3610 DEPENDENCIES
3611 The STA for which the request is made must be first registered with
3612 TL by HDD.
3613
3614 RESTRICTION: In case of a suspend, the flag write and read will not be
3615 locked: worst case scenario one more packet can get
3616 through before the flag gets updated (we can make this
3617 write atomic as well to guarantee consistency)
3618
3619 PARAMETERS
3620
3621 IN
3622 pvosGCtx: pointer to the global vos context; a handle to TL's
3623 control block can be extracted from its context
3624 pucSTAId: identifier of the station for which the request is made;
3625 a value of NULL assumes suspend on all active station
3626 pfnSuspendTxCB: pointer to the suspend result notification in case the
3627 call is asynchronous
3628
3629
3630 RETURN VALUE
3631 The result code associated with performing the operation
3632
3633 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
3634 to TL cb is NULL ; access would cause a page fault
3635 VOS_STATUS_E_EXISTS: Station was not registered
3636 VOS_STATUS_SUCCESS: Everything is good :)
3637
3638 SIDE EFFECTS
3639
3640============================================================================*/
3641
3642VOS_STATUS
3643WLANTL_SuspendDataTx
3644(
3645 v_PVOID_t pvosGCtx,
3646 v_U8_t* pucSTAId,
3647 WLANTL_SuspendCBType pfnSuspendTx
3648)
3649{
3650 WLANTL_CbType* pTLCb = NULL;
3651 vos_msg_t vosMsg;
Jeff Johnson295189b2012-06-20 16:38:30 -07003652
3653 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3654
3655 /*------------------------------------------------------------------------
3656 Sanity check
3657 Extract TL control block
3658 ------------------------------------------------------------------------*/
3659 pTLCb = VOS_GET_TL_CB(pvosGCtx);
Hoonki Lee14621352013-04-16 17:51:19 -07003660 if ( NULL == pTLCb )
Jeff Johnson295189b2012-06-20 16:38:30 -07003661 {
3662 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3663 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SuspendDataTx"));
3664 return VOS_STATUS_E_FAULT;
3665 }
3666
3667 /*------------------------------------------------------------------------
3668 Check the type of request: generic suspend, or per station suspend
3669 ------------------------------------------------------------------------*/
Hoonki Lee14621352013-04-16 17:51:19 -07003670 if (NULL == pucSTAId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003671 {
3672 /* General Suspend Request received */
3673 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3674 "WLAN TL:General suspend requested"));
Hoonki Lee14621352013-04-16 17:51:19 -07003675 vos_atomic_set_U8( &pTLCb->ucTxSuspended, 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07003676 vosMsg.reserved = WLAN_MAX_STA_COUNT;
3677 }
3678 else
3679 {
Hoonki Lee14621352013-04-16 17:51:19 -07003680 if ( WLANTL_STA_ID_INVALID( *pucSTAId ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07003681 {
Hoonki Lee14621352013-04-16 17:51:19 -07003682 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3683 "WLAN TL:Invalid station id %d requested on WLANTL_SuspendDataTx", *pucSTAId));
3684 return VOS_STATUS_E_FAULT;
3685 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003686
Gopichand Nakkalae5fef6c2013-06-19 18:04:23 +05303687 if ( NULL == pTLCb->atlSTAClients[*pucSTAId] )
3688 {
3689 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3690 "WLAN TL:Invalid pTLCb->atlSTAClients pointer for STA Id :%d on "
3691 "WLANTL_SuspendDataTx", *pucSTAId));
3692 return VOS_STATUS_E_FAULT;
3693 }
3694
3695 if ( 0 == pTLCb->atlSTAClients[*pucSTAId]->ucExists )
Hoonki Lee14621352013-04-16 17:51:19 -07003696 {
3697 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3698 "WLAN TL:Station %d was not previously registered on WLANTL_SuspendDataTx", *pucSTAId));
3699 return VOS_STATUS_E_EXISTS;
3700 }
3701
3702 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3703 "WLAN TL:Suspend request for station: %d", *pucSTAId));
3704 vos_atomic_set_U8( &pTLCb->atlSTAClients[*pucSTAId]->ucTxSuspended, 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07003705 vosMsg.reserved = *pucSTAId;
3706 }
3707
3708 /*------------------------------------------------------------------------
3709 Serialize request through TX thread
3710 ------------------------------------------------------------------------*/
3711 vosMsg.type = WLANTL_TX_SIG_SUSPEND;
3712 vosMsg.bodyptr = (v_PVOID_t)pfnSuspendTx;
3713
Katya Nigam42e16e82014-02-04 16:28:55 +05303714 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_SUSPEND_DATA_TX,
3715 vosMsg.reserved , 0 ));
3716
Jeff Johnson295189b2012-06-20 16:38:30 -07003717 if(!VOS_IS_STATUS_SUCCESS(vos_tx_mq_serialize( VOS_MQ_ID_TL, &vosMsg)))
3718 {
3719 VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003720 " %s fails to post message", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003721 }
3722
3723 return VOS_STATUS_SUCCESS;
3724}/* WLANTL_SuspendDataTx */
3725
3726/*==========================================================================
3727
3728 FUNCTION WLANTL_ResumeDataTx
3729
3730 DESCRIPTION
3731 Called by HAL to resume data transmission for a given STA.
3732
3733 WARNING: If a station was individually suspended a global resume will
3734 not resume that station
3735
3736 DEPENDENCIES
3737
3738 PARAMETERS
3739
3740 IN
3741 pvosGCtx: pointer to the global vos context; a handle to TL's
3742 control block can be extracted from its context
3743 pucSTAId: identifier of the station which is being resumed; NULL
3744 translates into global resume
3745
3746 RETURN VALUE
3747 The result code associated with performing the operation
3748
3749 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
3750 to TL cb is NULL ; access would cause a page fault
3751 VOS_STATUS_E_EXISTS: Station was not registered
3752 VOS_STATUS_SUCCESS: Everything is good :)
3753
3754 SIDE EFFECTS
3755
3756============================================================================*/
3757
3758VOS_STATUS
3759WLANTL_ResumeDataTx
3760(
3761 v_PVOID_t pvosGCtx,
3762 v_U8_t* pucSTAId
3763)
3764{
3765 WLANTL_CbType* pTLCb = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003766 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3767
3768 /*------------------------------------------------------------------------
3769 Sanity check
3770 Extract TL control block
3771 ------------------------------------------------------------------------*/
3772 pTLCb = VOS_GET_TL_CB(pvosGCtx);
Hoonki Lee14621352013-04-16 17:51:19 -07003773 if ( NULL == pTLCb )
Jeff Johnson295189b2012-06-20 16:38:30 -07003774 {
3775 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3776 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ResumeDataTx"));
3777 return VOS_STATUS_E_FAULT;
3778 }
3779
Jeff Johnson295189b2012-06-20 16:38:30 -07003780 /*------------------------------------------------------------------------
3781 Check to see the type of resume
3782 ------------------------------------------------------------------------*/
Hoonki Lee14621352013-04-16 17:51:19 -07003783 if ( NULL == pucSTAId )
Jeff Johnson295189b2012-06-20 16:38:30 -07003784 {
Katya Nigam42e16e82014-02-04 16:28:55 +05303785 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_RESUME_DATA_TX,
3786 41 , 0 ));
3787
Jeff Johnson295189b2012-06-20 16:38:30 -07003788 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3789 "WLAN TL:General resume requested"));
3790 vos_atomic_set_U8( &pTLCb->ucTxSuspended, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003791 }
3792 else
3793 {
Katya Nigam42e16e82014-02-04 16:28:55 +05303794 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_RESUME_DATA_TX,
3795 *pucSTAId , 0 ));
3796
Hoonki Lee14621352013-04-16 17:51:19 -07003797 if ( WLANTL_STA_ID_INVALID( *pucSTAId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07003798 {
Hoonki Lee14621352013-04-16 17:51:19 -07003799 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3800 "WLAN TL:Invalid station id %d requested on WLANTL_ResumeDataTx", *pucSTAId));
3801 return VOS_STATUS_E_FAULT;
3802 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003803
Gopichand Nakkalae5fef6c2013-06-19 18:04:23 +05303804 if ( NULL == pTLCb->atlSTAClients[*pucSTAId] )
3805 {
3806 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3807 "WLAN TL:Invalid pTLCb->atlSTAClients pointer for STA Id :%d on "
3808 "WLANTL_ResumeDataTx", *pucSTAId));
3809 return VOS_STATUS_E_FAULT;
3810 }
3811
3812 if ( 0 == pTLCb->atlSTAClients[*pucSTAId]->ucExists )
Hoonki Lee14621352013-04-16 17:51:19 -07003813 {
3814 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3815 "WLAN TL:Station %d was not previously registered on WLANTL_ResumeDataTx", *pucSTAId));
3816 return VOS_STATUS_E_EXISTS;
3817 }
3818
3819 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3820 "WLAN TL:Resume request for station: %d", *pucSTAId));
3821 vos_atomic_set_U8( &pTLCb->atlSTAClients[*pucSTAId]->ucTxSuspended, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003822 }
3823
3824 /*------------------------------------------------------------------------
3825 Resuming transmission
3826 ------------------------------------------------------------------------*/
Hoonki Lee14621352013-04-16 17:51:19 -07003827 if (( pTLCb->uResCount >= WDA_TLI_MIN_RES_MF ) &&
3828 ( 0 == pTLCb->ucTxSuspended ))
Jeff Johnson295189b2012-06-20 16:38:30 -07003829 {
3830 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3831 "WLAN TL:Resuming transmission"));
3832 return WDA_DS_StartXmit(pvosGCtx);
3833 }
3834
3835 return VOS_STATUS_SUCCESS;
3836}/* WLANTL_ResumeDataTx */
3837
3838/*==========================================================================
3839 FUNCTION WLANTL_SuspendCB
3840
3841 DESCRIPTION
3842 Callback function for serializing Suspend signal through Tx thread
3843
3844 DEPENDENCIES
3845 Just notify HAL that suspend in TL is complete.
3846
3847 PARAMETERS
3848
3849 IN
3850 pvosGCtx: pointer to the global vos context; a handle to TL's
3851 control block can be extracted from its context
3852 pUserData: user data sent with the callback
3853
3854 RETURN VALUE
3855 The result code associated with performing the operation
3856
3857 VOS_STATUS_E_INVAL: invalid input parameters
3858 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
3859 page fault
3860 VOS_STATUS_SUCCESS: Everything is good :)
3861
3862
3863 SIDE EFFECTS
3864
3865============================================================================*/
3866VOS_STATUS
3867WLANTL_SuspendCB
3868(
3869 v_PVOID_t pvosGCtx,
3870 WLANTL_SuspendCBType pfnSuspendCB,
3871 v_U16_t usReserved
3872)
3873{
3874 WLANTL_CbType* pTLCb = NULL;
3875 v_U8_t ucSTAId = (v_U8_t)usReserved;
3876 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3877
3878 /*------------------------------------------------------------------------
3879 Sanity check
3880 ------------------------------------------------------------------------*/
3881 if ( NULL == pfnSuspendCB )
3882 {
3883 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
3884 "WLAN TL: No Call back processing requested WLANTL_SuspendCB"));
3885 return VOS_STATUS_SUCCESS;
3886 }
3887
3888 /*------------------------------------------------------------------------
3889 Extract TL control block
3890 ------------------------------------------------------------------------*/
3891 pTLCb = VOS_GET_TL_CB(pvosGCtx);
3892 if ( NULL == pTLCb )
3893 {
3894 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3895 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SuspendCB"));
3896 return VOS_STATUS_E_FAULT;
3897 }
3898
3899 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
3900 {
3901 pfnSuspendCB(pvosGCtx, NULL, VOS_STATUS_SUCCESS);
3902 }
3903 else
3904 {
3905 pfnSuspendCB(pvosGCtx, &ucSTAId, VOS_STATUS_SUCCESS);
3906 }
3907
3908 return VOS_STATUS_SUCCESS;
3909}/*WLANTL_SuspendCB*/
3910
3911
3912/*----------------------------------------------------------------------------
3913 CLIENT INDEPENDENT INTERFACE
3914 ---------------------------------------------------------------------------*/
3915
3916/*==========================================================================
3917
3918 FUNCTION WLANTL_GetTxPktCount
3919
3920 DESCRIPTION
3921 TL will provide the number of transmitted packets counted per
3922 STA per TID.
3923
3924 DEPENDENCIES
3925
3926 PARAMETERS
3927
3928 IN
3929 pvosGCtx: pointer to the global vos context; a handle to TL's
3930 control block can be extracted from its context
3931 ucSTAId: identifier of the station
3932 ucTid: identifier of the tspec
3933
3934 OUT
3935 puTxPktCount: the number of packets tx packet for this STA and TID
3936
3937 RETURN VALUE
3938 The result code associated with performing the operation
3939
3940 VOS_STATUS_E_INVAL: Input parameters are invalid
3941 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
3942 to TL cb is NULL ; access would cause a page fault
3943 VOS_STATUS_E_EXISTS: Station was not registered
3944 VOS_STATUS_SUCCESS: Everything is good :)
3945
3946 SIDE EFFECTS
3947
3948============================================================================*/
3949VOS_STATUS
3950WLANTL_GetTxPktCount
3951(
3952 v_PVOID_t pvosGCtx,
3953 v_U8_t ucSTAId,
3954 v_U8_t ucTid,
3955 v_U32_t* puTxPktCount
3956)
3957{
3958 WLANTL_CbType* pTLCb = NULL;
3959 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3960
3961 /*------------------------------------------------------------------------
3962 Sanity check
3963 ------------------------------------------------------------------------*/
3964 if ( NULL == puTxPktCount )
3965 {
3966 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3967 "WLAN TL:Invalid parameter sent on WLANTL_GetTxPktCount"));
3968 return VOS_STATUS_E_INVAL;
3969 }
3970
3971 if ( WLANTL_STA_ID_INVALID( ucSTAId ) || WLANTL_TID_INVALID( ucTid) )
3972 {
3973 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3974 "WLAN TL:Invalid station id %d/tid %d requested on WLANTL_GetTxPktCount",
3975 ucSTAId, ucTid));
3976 return VOS_STATUS_E_FAULT;
3977 }
3978
3979 /*------------------------------------------------------------------------
3980 Extract TL control block and check if station exists
3981 ------------------------------------------------------------------------*/
3982 pTLCb = VOS_GET_TL_CB(pvosGCtx);
3983 if ( NULL == pTLCb )
3984 {
3985 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3986 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetTxPktCount"));
3987 return VOS_STATUS_E_FAULT;
3988 }
3989
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05303990 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
3991 {
3992 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3993 "WLAN TL:Client Memory was not allocated on %s", __func__));
3994 return VOS_STATUS_E_FAILURE;
3995 }
3996
3997 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07003998 {
3999 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4000 "WLAN TL:Station was not previously registered on WLANTL_GetTxPktCount %d",
4001 ucSTAId));
4002 return VOS_STATUS_E_EXISTS;
4003 }
4004
4005 /*------------------------------------------------------------------------
4006 Return data
4007 ------------------------------------------------------------------------*/
4008 //VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_MED,
4009 // "WLAN TL:Requested tx packet count for STA: %d, TID: %d",
4010 // ucSTAId, ucTid);
4011
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304012 *puTxPktCount = pTLCb->atlSTAClients[ucSTAId]->auTxCount[ucTid];
Jeff Johnson295189b2012-06-20 16:38:30 -07004013
4014 return VOS_STATUS_SUCCESS;
4015}/* WLANTL_GetTxPktCount */
4016
4017/*==========================================================================
4018
4019 FUNCTION WLANTL_GetRxPktCount
4020
4021 DESCRIPTION
4022 TL will provide the number of received packets counted per
4023 STA per TID.
4024
4025 DEPENDENCIES
4026
4027 PARAMETERS
4028
4029 IN
4030 pvosGCtx: pointer to the global vos context; a handle to TL's
4031 control block can be extracted from its context
4032 ucSTAId: identifier of the station
4033 ucTid: identifier of the tspec
4034
4035 OUT
4036 puTxPktCount: the number of packets rx packet for this STA and TID
4037
4038 RETURN VALUE
4039 The result code associated with performing the operation
4040
4041 VOS_STATUS_E_INVAL: Input parameters are invalid
4042 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
4043 to TL cb is NULL ; access would cause a page fault
4044 VOS_STATUS_E_EXISTS: Station was not registered
4045 VOS_STATUS_SUCCESS: Everything is good :)
4046
4047 SIDE EFFECTS
4048
4049============================================================================*/
4050VOS_STATUS
4051WLANTL_GetRxPktCount
4052(
4053 v_PVOID_t pvosGCtx,
4054 v_U8_t ucSTAId,
4055 v_U8_t ucTid,
4056 v_U32_t* puRxPktCount
4057)
4058{
4059 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304060 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004061 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
4062
4063 /*------------------------------------------------------------------------
4064 Sanity check
4065 ------------------------------------------------------------------------*/
4066 if ( NULL == puRxPktCount )
4067 {
4068 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4069 "WLAN TL:Invalid parameter sent on WLANTL_GetRxPktCount"));
4070 return VOS_STATUS_E_INVAL;
4071 }
4072
4073 if ( WLANTL_STA_ID_INVALID( ucSTAId ) || WLANTL_TID_INVALID( ucTid) )
4074 {
4075 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4076 "WLAN TL:Invalid station id %d/tid %d requested on WLANTL_GetRxPktCount",
4077 ucSTAId, ucTid));
4078 return VOS_STATUS_E_FAULT;
4079 }
4080
4081 /*------------------------------------------------------------------------
4082 Extract TL control block and existance
4083 ------------------------------------------------------------------------*/
4084 pTLCb = VOS_GET_TL_CB(pvosGCtx);
4085 if ( NULL == pTLCb )
4086 {
4087 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4088 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetRxPktCount"));
4089 return VOS_STATUS_E_FAULT;
4090 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304091 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
Jeff Johnson295189b2012-06-20 16:38:30 -07004092
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304093 if ( NULL == pClientSTA )
4094 {
4095 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4096 "WLAN TL:Client Memory was not allocated on %s", __func__));
4097 return VOS_STATUS_E_FAILURE;
4098 }
4099
4100 if ( 0 == pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07004101 {
4102 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4103 "WLAN TL:Station was not previously registered on WLANTL_GetRxPktCount"));
4104 return VOS_STATUS_E_EXISTS;
4105 }
4106
4107 /*------------------------------------------------------------------------
4108 Return data
4109 ------------------------------------------------------------------------*/
4110 TLLOG3(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_MED,
4111 "WLAN TL:Requested rx packet count for STA: %d, TID: %d",
4112 ucSTAId, ucTid));
4113
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304114 *puRxPktCount = pClientSTA->auRxCount[ucTid];
Jeff Johnson295189b2012-06-20 16:38:30 -07004115
4116 return VOS_STATUS_SUCCESS;
4117}/* WLANTL_GetRxPktCount */
4118
Jeff Johnson295189b2012-06-20 16:38:30 -07004119VOS_STATUS
4120WLANTL_TxFCFrame
4121(
4122 v_PVOID_t pvosGCtx
4123);
Jeff Johnson295189b2012-06-20 16:38:30 -07004124/*============================================================================
4125 TL INTERNAL API DEFINITION
4126============================================================================*/
4127
4128/*==========================================================================
4129
4130 FUNCTION WLANTL_GetFrames
4131
4132 DESCRIPTION
4133
4134 BAL calls this function at the request of the lower bus interface.
4135 When this request is being received TL will retrieve packets from HDD
4136 in accordance with the priority rules and the count supplied by BAL.
4137
4138 DEPENDENCIES
4139
4140 HDD must have registered with TL at least one STA before this function
4141 can be called.
4142
4143 PARAMETERS
4144
4145 IN
4146 pvosGCtx: pointer to the global vos context; a handle to TL's
4147 or BAL's control block can be extracted from its context
4148 uSize: maximum size accepted by the lower layer
4149 uFlowMask TX flow control mask for Prima. Each bit is defined as
4150 WDA_TXFlowEnumType
4151
4152 OUT
4153 vosDataBuff: it will contain a pointer to the first buffer supplied
4154 by TL, if there is more than one packet supplied, TL
4155 will chain them through vOSS buffers
4156
4157 RETURN VALUE
4158
4159 The result code associated with performing the operation
4160
4161 1 or more: number of required resources if there are still frames to fetch
4162 0 : error or HDD queues are drained
4163
4164 SIDE EFFECTS
4165
4166 NOTE
4167
4168 Featurized uFlowMask. If we want to remove featurization, we need to change
4169 BAL on Volans.
4170
4171============================================================================*/
4172v_U32_t
4173WLANTL_GetFrames
4174(
4175 v_PVOID_t pvosGCtx,
4176 vos_pkt_t **ppFrameDataBuff,
4177 v_U32_t uSize,
Jeff Johnson295189b2012-06-20 16:38:30 -07004178 v_U8_t uFlowMask,
Jeff Johnson295189b2012-06-20 16:38:30 -07004179 v_BOOL_t* pbUrgent
4180)
4181{
4182 vos_pkt_t** pvosDataBuff = (vos_pkt_t**)ppFrameDataBuff;
4183 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304184 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004185 v_U32_t uRemaining = uSize;
4186 vos_pkt_t* vosRoot;
4187 vos_pkt_t* vosTempBuf;
4188 WLANTL_STAFuncType pfnSTAFsm;
4189 v_U16_t usPktLen;
4190 v_U32_t uResLen;
4191 v_U8_t ucSTAId;
4192 v_U8_t ucAC;
4193 vos_pkt_t* vosDataBuff;
4194 v_U32_t uTotalPktLen;
4195 v_U32_t i=0;
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -08004196 v_U32_t j=0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004197 v_U32_t ucResult = 0;
4198 VOS_STATUS vosStatus;
4199 WLANTL_STAEventType wSTAEvent;
4200 tBssSystemRole systemRole;
4201 tpAniSirGlobal pMac;
4202 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
4203
4204 /*------------------------------------------------------------------------
4205 Sanity check
4206 Extract TL control block
4207 ------------------------------------------------------------------------*/
4208 pTLCb = VOS_GET_TL_CB(pvosGCtx);
4209 if (( NULL == pTLCb ) || ( NULL == pvosDataBuff ))
4210 {
4211 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4212 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
4213 return ucResult;
4214 }
4215
4216 pMac = vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
4217 if ( NULL == pMac )
4218 {
4219 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004220 "%s: Invalid pMac", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07004221 return ucResult;
4222 }
4223
4224 vosDataBuff = pTLCb->vosDummyBuf; /* Just to avoid checking for NULL at
4225 each iteration */
4226
Jeff Johnson295189b2012-06-20 16:38:30 -07004227 pTLCb->uResCount = uSize;
Jeff Johnson295189b2012-06-20 16:38:30 -07004228
4229 /*-----------------------------------------------------------------------
4230 Save the root as we will walk this chain as we fill it
4231 -----------------------------------------------------------------------*/
4232 vosRoot = vosDataBuff;
4233
4234 /*-----------------------------------------------------------------------
4235 There is still data - until FSM function says otherwise
4236 -----------------------------------------------------------------------*/
4237 pTLCb->bUrgent = FALSE;
4238
Jeff Johnson295189b2012-06-20 16:38:30 -07004239 while (( pTLCb->tlConfigInfo.uMinFramesProcThres < pTLCb->uResCount ) &&
4240 ( 0 < uRemaining ))
Jeff Johnson295189b2012-06-20 16:38:30 -07004241 {
4242 systemRole = wdaGetGlobalSystemRole(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004243#ifdef WLAN_SOFTAP_FLOWCTRL_EN
4244/* FIXME: The code has been disabled since it is creating issues in power save */
4245 if (eSYSTEM_AP_ROLE == systemRole)
4246 {
4247 if (pTLCb->done_once == 0 && NULL == pTLCb->vosTxFCBuf)
4248 {
4249 WLANTL_TxFCFrame (pvosGCtx);
4250 pTLCb->done_once ++;
4251 }
4252 }
4253 if ( NULL != pTLCb->vosTxFCBuf )
4254 {
4255 //there is flow control packet waiting to be sent
4256 WDA_TLI_PROCESS_FRAME_LEN( pTLCb->vosTxFCBuf, usPktLen, uResLen, uTotalPktLen);
4257
4258 if ( ( pTLCb->uResCount > uResLen ) &&
Jeff Johnson9b5dc4d2013-02-22 21:28:47 -08004259 ( uRemaining > uTotalPktLen ) &&
4260 ( uFlowMask & ( 1 << WDA_TXFLOW_FC ) ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004261 {
4262 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4263 "WLAN TL:Chaining FC frame first on GetFrame"));
4264
4265 vos_pkt_chain_packet( vosDataBuff, pTLCb->vosTxFCBuf, 1 /*true*/ );
4266
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05304267 vos_atomic_set( (uintptr_t*)&pTLCb->vosTxFCBuf, (uintptr_t) NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07004268
4269 /*FC frames cannot be delayed*/
4270 pTLCb->bUrgent = TRUE;
4271
4272 /*Update remaining len from SSC */
4273 uRemaining -= (usPktLen + WDA_DXE_HEADER_SIZE);
4274
4275 /*Update resource count */
4276 pTLCb->uResCount -= uResLen;
4277 }
4278 else
4279 {
4280 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004281 "WLAN TL:send fc out of source %s", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07004282 ucResult = ( pTLCb->uResCount > uResLen )?VOS_TRUE:VOS_FALSE;
4283 break; /* Out of resources or reached max len */
4284 }
4285 }
4286 else
4287#endif //WLAN_SOFTAP_FLOWCTRL_EN
Jeff Johnson295189b2012-06-20 16:38:30 -07004288
Jeff Johnson9b5dc4d2013-02-22 21:28:47 -08004289 if (( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff ) &&
4290 ( uFlowMask & ( 1 << WDA_TXFLOW_MGMT ) ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004291 {
4292 WDA_TLI_PROCESS_FRAME_LEN( pTLCb->tlMgmtFrmClient.vosPendingDataBuff,
4293 usPktLen, uResLen, uTotalPktLen);
4294
Manjunathappa Prakashfb585462013-12-23 19:07:07 -08004295 if (usPktLen > WLANTL_MAX_ALLOWED_LEN)
4296 {
4297 usPktLen = WLANTL_MAX_ALLOWED_LEN;
4298 VOS_ASSERT(0);
4299 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004300
4301 if ( ( pTLCb->uResCount > uResLen ) &&
Jeff Johnson9b5dc4d2013-02-22 21:28:47 -08004302 ( uRemaining > uTotalPktLen ) &&
4303 ( uFlowMask & ( 1 << WDA_TXFLOW_MGMT ) ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004304 {
4305 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4306 "WLAN TL:Chaining management frame on GetFrame"));
4307
4308 vos_pkt_chain_packet( vosDataBuff,
4309 pTLCb->tlMgmtFrmClient.vosPendingDataBuff,
4310 1 /*true*/ );
4311
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05304312 vos_atomic_set( (uintptr_t*)&pTLCb->tlMgmtFrmClient.
4313 vosPendingDataBuff, (uintptr_t)NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07004314
4315 /*management frames cannot be delayed*/
4316 pTLCb->bUrgent = TRUE;
4317
4318 /*Update remaining len from SSC */
4319 uRemaining -= (usPktLen + WDA_DXE_HEADER_SIZE);
4320
4321 /*Update resource count */
4322 pTLCb->uResCount -= uResLen;
4323 }
4324 else
4325 {
4326 ucResult = ( pTLCb->uResCount > uResLen )?VOS_TRUE:VOS_FALSE;
4327 break; /* Out of resources or reached max len */
4328 }
4329 }
4330 else if (( pTLCb->tlBAPClient.vosPendingDataBuff ) &&
4331 ( WDA_TLI_MIN_RES_BAP <= pTLCb->uResCount ) &&
Gopichand Nakkala7e48ca72012-12-31 14:15:07 -08004332 ( 0 == pTLCb->ucTxSuspended ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004333 {
4334 WDA_TLI_PROCESS_FRAME_LEN( pTLCb->tlBAPClient.vosPendingDataBuff,
4335 usPktLen, uResLen, uTotalPktLen);
4336
Manjunathappa Prakashfb585462013-12-23 19:07:07 -08004337 if (usPktLen > WLANTL_MAX_ALLOWED_LEN)
4338 {
4339 usPktLen = WLANTL_MAX_ALLOWED_LEN;
4340 VOS_ASSERT(0);
4341 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004342
4343 if ( ( pTLCb->uResCount > (uResLen + WDA_TLI_MIN_RES_MF ) ) &&
4344 ( uRemaining > uTotalPktLen ))
4345 {
4346 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4347 "WLAN TL:Chaining BT-AMP frame on GetFrame"));
4348
4349 vos_pkt_chain_packet( vosDataBuff,
4350 pTLCb->tlBAPClient.vosPendingDataBuff,
4351 1 /*true*/ );
4352
4353 /*BAP frames cannot be delayed*/
4354 pTLCb->bUrgent = TRUE;
4355
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05304356 vos_atomic_set( (uintptr_t*)&pTLCb->tlBAPClient.vosPendingDataBuff,
4357 (uintptr_t) NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07004358
4359 /*Update remaining len from SSC */
4360 uRemaining -= (usPktLen + WDA_DXE_HEADER_SIZE);
4361
4362 /*Update resource count */
4363 pTLCb->uResCount -= uResLen;
4364 }
4365 else
4366 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004367 ucResult = uResLen + WDA_TLI_MIN_RES_MF;
Jeff Johnson295189b2012-06-20 16:38:30 -07004368 break; /* Out of resources or reached max len */
4369 }
4370 }
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004371 /* note: this feature implemented only after WLAN_INGETRATED_SOC */
4372 /* search 'EAPOL_HI_PRIORITY' will show EAPOL HI_PRIORITY change in TL and WDI
4373 by default, EAPOL will be treated as higher priority, which means
4374 use mgmt_pool and DXE_TX_HI prority channel.
4375 this is introduced to address EAPOL failure under high background traffic
4376 with multi-channel concurrent mode. But this change works in SCC or standalone, too.
4377 see CR#387009 and WCNSOS-8
4378 */
4379 else if (( WDA_TLI_MIN_RES_MF <= pTLCb->uResCount )&&
4380 ( 0 == pTLCb->ucTxSuspended ) &&
4381 ( uFlowMask & ( 1 << WDA_TXFLOW_MGMT ) )
4382 )
4383 {
4384 vosTempBuf = NULL;
4385 /*---------------------------------------------------------------------
4386 Check to see if there was any EAPOL packet is pending
4387 *--------------------------------------------------------------------*/
4388 for ( i = 0; i < WLAN_MAX_STA_COUNT; i++)
4389 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304390 if ((NULL != pTLCb->atlSTAClients[i]) &&
4391 (pTLCb->atlSTAClients[i]->ucExists) &&
4392 (0 == pTLCb->atlSTAClients[i]->ucTxSuspended) &&
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -08004393 (WLANTL_STA_CONNECTED == pTLCb->atlSTAClients[i]->tlState) &&
4394 (pTLCb->atlSTAClients[i]->ucPktPending)
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004395 )
4396 break;
4397 }
4398
4399 if (i >= WLAN_MAX_STA_COUNT)
4400 {
4401 /* No More to Serve Exit Get Frames */
4402 break;
4403 }
4404 /* Serve EAPOL frame with HI_FLOW_MASK */
4405 ucSTAId = i;
4406
Katya Nigam42e16e82014-02-04 16:28:55 +05304407 MTRACE(vos_trace(VOS_MODULE_ID_TL,
4408 TRACE_CODE_TL_GET_FRAMES_EAPOL, ucSTAId, pTLCb->atlSTAClients[i]->tlState));
4409
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -08004410 for (j = WLANTL_MAX_AC ; j > 0; j--)
4411 {
4412 if (0 != pTLCb->atlSTAClients[ucSTAId]->aucACMask[j-1])
4413 {
4414 pTLCb->atlSTAClients[ucSTAId]->ucCurrentAC = j-1;
4415 pTLCb->uCurServedAC = j-1;
4416 }
4417 }
4418
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304419 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
4420
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004421 wSTAEvent = WLANTL_TX_EVENT;
4422
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304423 pfnSTAFsm = tlSTAFsm[pClientSTA->tlState].
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004424 pfnSTATbl[wSTAEvent];
4425
4426 if ( NULL != pfnSTAFsm )
4427 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304428 pClientSTA->ucNoMoreData = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004429 vosStatus = pfnSTAFsm( pvosGCtx, ucSTAId, &vosTempBuf, VOS_FALSE);
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004430
4431 if (( VOS_STATUS_SUCCESS != vosStatus ) &&
4432 ( NULL != vosTempBuf ))
4433 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304434 pClientSTA->pfnSTATxComp( pvosGCtx, vosTempBuf, vosStatus );
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004435 vosTempBuf = NULL;
4436 break;
4437 }/* status success*/
4438 }
4439
4440 if (NULL != vosTempBuf)
4441 {
4442 WDA_TLI_PROCESS_FRAME_LEN( vosTempBuf, usPktLen, uResLen, uTotalPktLen);
4443
Manjunathappa Prakashfb585462013-12-23 19:07:07 -08004444 if (usPktLen > WLANTL_MAX_ALLOWED_LEN)
4445 {
4446 usPktLen = WLANTL_MAX_ALLOWED_LEN;
4447 VOS_ASSERT(0);
4448 }
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004449
4450 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
4451 "WLAN TL:Resources needed by frame: %d", uResLen));
4452
4453 if ( ( pTLCb->uResCount >= (uResLen + WDA_TLI_MIN_RES_MF ) ) &&
4454 ( uRemaining > uTotalPktLen )
4455 )
4456 {
4457 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4458 "WLAN TL:Chaining data frame on GetFrame"));
4459
4460 vos_pkt_chain_packet( vosDataBuff, vosTempBuf, 1 /*true*/ );
4461
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004462 /*EAPOL frame cannot be delayed*/
4463 pTLCb->bUrgent = TRUE;
4464
4465 vosTempBuf = NULL;
4466
4467 /*Update remaining len from SSC */
4468 uRemaining -= (usPktLen + WDA_DXE_HEADER_SIZE);
4469
4470 /*Update resource count */
4471 pTLCb->uResCount -= uResLen;
4472
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004473 //fow control update
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304474 pClientSTA->uIngress_length += uResLen;
4475 pClientSTA->uBuffThresholdMax = (pClientSTA->uBuffThresholdMax >= uResLen) ?
4476 (pClientSTA->uBuffThresholdMax - uResLen) : 0;
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -08004477 pClientSTA->ucEapolPktPending = 0;
4478 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4479 "WLAN TL:GetFrames STA: %d EAPOLPktPending %d",
4480 ucSTAId, pClientSTA->ucEapolPktPending);
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004481 }
4482 }
4483 else
4484 { // no EAPOL frames exit Get frames
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -08004485 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4486 "WLAN TL:GetFrames STA: %d, no EAPOL frame, continue.",
4487 ucSTAId));
4488 continue;
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004489 }
4490 }
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004491
Jeff Johnson9b5dc4d2013-02-22 21:28:47 -08004492 else if (( WDA_TLI_MIN_RES_DATA <= pTLCb->uResCount ) &&
4493 ( 0 == pTLCb->ucTxSuspended ) &&
4494 (( uFlowMask & ( 1 << WDA_TXFLOW_AC_BK ) ) ||
4495 ( uFlowMask & ( 1 << WDA_TXFLOW_AC_BE ) ) ||
4496 ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VI ) ) ||
4497 ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VO ) )) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004498 {
4499 /*---------------------------------------------------------------------
4500 Check to see if there was any packet left behind previously due to
4501 size constraints
4502 ---------------------------------------------------------------------*/
4503 vosTempBuf = NULL;
4504
4505 if ( NULL != pTLCb->vosTempBuf )
4506 {
4507 vosTempBuf = pTLCb->vosTempBuf;
4508 pTLCb->vosTempBuf = NULL;
4509 ucSTAId = pTLCb->ucCachedSTAId;
4510 ucAC = pTLCb->ucCachedAC;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304511
4512 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
4513 {
4514 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4515 "WLAN TL:Client Memory was not allocated on %s", __func__));
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05304516 continue;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304517 }
4518
4519 pTLCb->atlSTAClients[ucSTAId]->ucNoMoreData = 0;
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05304520 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
Jeff Johnson295189b2012-06-20 16:38:30 -07004521
4522 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4523 "WLAN TL:Chaining cached data frame on GetFrame"));
4524 }
4525 else
4526 {
4527 WLAN_TLGetNextTxIds( pvosGCtx, &ucSTAId);
4528 if (ucSTAId >= WLAN_MAX_STA_COUNT)
4529 {
4530 /* Packets start coming in even after insmod Without *
4531 starting Hostapd or Interface being up *
4532 During which cases STAID is invaled and hence
4533 the check. HalMsg_ScnaComplete Triggers */
4534
4535 break;
4536 }
4537 /* ucCurrentAC should have correct AC to be served by calling
4538 WLAN_TLGetNextTxIds */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304539 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304540 if ( NULL == pClientSTA )
4541 {
4542 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4543 "WLAN TL:Client Memory was not allocated on %s", __func__));
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05304544 continue;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304545 }
4546
4547 ucAC = pClientSTA->ucCurrentAC;
4548
4549 pClientSTA->ucNoMoreData = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07004550 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004551 "WLAN TL: %s get one data frame, station ID %d ", __func__, ucSTAId));
Jeff Johnson295189b2012-06-20 16:38:30 -07004552 /*-------------------------------------------------------------------
4553 Check to see that STA is valid and tx is not suspended
4554 -------------------------------------------------------------------*/
4555 if ( ( ! WLANTL_STA_ID_INVALID( ucSTAId ) ) &&
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304556 ( 0 == pClientSTA->ucTxSuspended ) &&
4557 ( 0 == pClientSTA->fcStaTxDisabled) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004558 {
4559 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004560 "WLAN TL: %s sta id valid and not suspended ",__func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07004561 wSTAEvent = WLANTL_TX_EVENT;
4562
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304563 pfnSTAFsm = tlSTAFsm[pClientSTA->tlState].
Jeff Johnson295189b2012-06-20 16:38:30 -07004564 pfnSTATbl[wSTAEvent];
4565
4566 if ( NULL != pfnSTAFsm )
4567 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304568 pClientSTA->ucNoMoreData = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004569 vosStatus = pfnSTAFsm( pvosGCtx, ucSTAId, &vosTempBuf, VOS_FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07004570
4571 if (( VOS_STATUS_SUCCESS != vosStatus ) &&
4572 ( NULL != vosTempBuf ))
4573 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304574 pClientSTA->pfnSTATxComp( pvosGCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -07004575 vosTempBuf,
4576 vosStatus );
4577 vosTempBuf = NULL;
4578 }/* status success*/
4579 }/*NULL function state*/
4580 }/* valid STA id and ! suspended*/
4581 else
4582 {
4583 if ( ! WLANTL_STA_ID_INVALID( ucSTAId ) )
4584 {
4585 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4586 "WLAN TL:Not fetching frame because suspended for sta ID %d",
4587 ucSTAId));
4588 }
4589 }
4590 }/* data */
4591
4592 if ( NULL != vosTempBuf )
4593 {
4594 WDA_TLI_PROCESS_FRAME_LEN( vosTempBuf, usPktLen, uResLen, uTotalPktLen);
4595
Manjunathappa Prakashfb585462013-12-23 19:07:07 -08004596 if (usPktLen > WLANTL_MAX_ALLOWED_LEN)
4597 {
4598 usPktLen = WLANTL_MAX_ALLOWED_LEN;
4599 VOS_ASSERT(0);
4600 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004601
4602 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
4603 "WLAN TL:Resources needed by frame: %d", uResLen));
4604
4605 if ( ( pTLCb->uResCount >= (uResLen + WDA_TLI_MIN_RES_BAP ) ) &&
Jeff Johnson9b5dc4d2013-02-22 21:28:47 -08004606 ( uRemaining > uTotalPktLen ) &&
4607 ( uFlowMask & ( 1 << ucAC ) ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004608 {
4609 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4610 "WLAN TL:Chaining data frame on GetFrame"));
4611
4612 vos_pkt_chain_packet( vosDataBuff, vosTempBuf, 1 /*true*/ );
4613 vosTempBuf = NULL;
4614
4615 /*Update remaining len from SSC */
4616 uRemaining -= (usPktLen + WDA_DXE_HEADER_SIZE);
4617
4618 /*Update resource count */
4619 pTLCb->uResCount -= uResLen;
4620
Jeff Johnson295189b2012-06-20 16:38:30 -07004621 //fow control update
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304622 pClientSTA->uIngress_length += uResLen;
4623 pClientSTA->uBuffThresholdMax = (pClientSTA->uBuffThresholdMax >= uResLen) ?
4624 (pClientSTA->uBuffThresholdMax - uResLen) : 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004625
4626 }
4627 else
4628 {
4629 /* Store this for later tx - already fetched from HDD */
4630 pTLCb->vosTempBuf = vosTempBuf;
4631 pTLCb->ucCachedSTAId = ucSTAId;
4632 pTLCb->ucCachedAC = ucAC;
Jeff Johnson295189b2012-06-20 16:38:30 -07004633 ucResult = uResLen + WDA_TLI_MIN_RES_BAP;
4634 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4635 "min %d res required by TL.", ucResult ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004636 break; /* Out of resources or reached max len */
4637 }
4638 }
4639 else
4640 {
4641 for ( i = 0; i < WLAN_MAX_STA_COUNT; i++)
4642 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304643 if (NULL != pTLCb->atlSTAClients[i] && (pTLCb->atlSTAClients[i]->ucExists) &&
4644 (pTLCb->atlSTAClients[i]->ucPktPending))
Jeff Johnson295189b2012-06-20 16:38:30 -07004645 {
4646 /* There is station to be Served */
4647 break;
4648 }
4649 }
4650 if (i >= WLAN_MAX_STA_COUNT)
4651 {
4652 /* No More to Serve Exit Get Frames */
4653 break;
4654 }
4655 else
4656 {
4657 /* More to be Served */
4658 continue;
4659 }
4660 }
4661 }
4662 else
4663 {
4664 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4665 "WLAN TL:Returning from GetFrame: resources = %d suspended = %d",
4666 pTLCb->uResCount, pTLCb->ucTxSuspended));
Jeff Johnson295189b2012-06-20 16:38:30 -07004667 /* TL is starving even when DXE is not in low resource condition
4668 Return min resource number required and Let DXE deceide what to do */
4669 if(( 0 == pTLCb->ucTxSuspended ) &&
4670 (( uFlowMask & ( 1 << WDA_TXFLOW_AC_BK ) ) ||
4671 ( uFlowMask & ( 1 << WDA_TXFLOW_AC_BE ) ) ||
4672 ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VI ) ) ||
4673 ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VO ) )))
4674 {
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07004675 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Jeff Johnson295189b2012-06-20 16:38:30 -07004676 "WLAN TL:Returning from GetFrame: resources = %d",
4677 pTLCb->uResCount));
4678 ucResult = WDA_TLI_MIN_RES_DATA;
4679 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004680 break; /*out of min data resources*/
4681 }
4682
4683 pTLCb->usPendingTxCompleteCount++;
4684 /* Move data buffer up one packet */
4685 vos_pkt_walk_packet_chain( vosDataBuff, &vosDataBuff, 0/*false*/ );
4686 }
4687
4688 /*----------------------------------------------------------------------
4689 Packet chain starts at root + 1
4690 ----------------------------------------------------------------------*/
4691 vos_pkt_walk_packet_chain( vosRoot, &vosDataBuff, 1/*true*/ );
4692
4693 *pvosDataBuff = vosDataBuff;
Manjunathappa Prakashfb585462013-12-23 19:07:07 -08004694 if (pbUrgent)
4695 {
4696 *pbUrgent = pTLCb->bUrgent;
4697 }
4698 else
4699 {
4700 VOS_ASSERT( pbUrgent );
4701 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004702 return ucResult;
4703}/* WLANTL_GetFrames */
4704
4705
4706/*==========================================================================
4707
4708 FUNCTION WLANTL_TxComp
4709
4710 DESCRIPTION
4711 It is being called by BAL upon asynchronous notification of the packet
4712 or packets being sent over the bus.
4713
4714 DEPENDENCIES
4715 Tx complete cannot be called without a previous transmit.
4716
4717 PARAMETERS
4718
4719 IN
4720 pvosGCtx: pointer to the global vos context; a handle to TL's
4721 or BAL's control block can be extracted from its context
4722 vosDataBuff: it will contain a pointer to the first buffer for which
4723 the BAL report is being made, if there is more then one
4724 packet they will be chained using vOSS buffers.
4725 wTxStatus: the status of the transmitted packet, see above chapter
4726 on HDD interaction for a list of possible values
4727
4728 RETURN VALUE
4729 The result code associated with performing the operation
4730
4731 VOS_STATUS_E_INVAL: Input parameters are invalid
4732 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
4733 page fault
4734 VOS_STATUS_E_EXISTS: Station was not registered
4735 VOS_STATUS_SUCCESS: Everything is good :)
4736
4737 SIDE EFFECTS
4738
4739============================================================================*/
4740VOS_STATUS
4741WLANTL_TxComp
4742(
4743 v_PVOID_t pvosGCtx,
4744 vos_pkt_t *pFrameDataBuff,
4745 VOS_STATUS wTxStatus
4746)
4747{
4748 vos_pkt_t* vosDataBuff = (vos_pkt_t*)pFrameDataBuff;
4749 WLANTL_CbType* pTLCb = NULL;
4750 WLANTL_TxCompCBType pfnTxComp = NULL;
4751 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07004752 vos_pkt_t* vosTempTx = NULL;
4753
4754 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
4755
4756 /*------------------------------------------------------------------------
4757 Sanity check
4758 ------------------------------------------------------------------------*/
4759 if ( NULL == vosDataBuff )
4760 {
4761 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4762 "WLAN TL:Extraneous NULL data pointer on WLANTL_TxComp"));
4763 return VOS_STATUS_E_INVAL;
4764 }
4765
4766 /*------------------------------------------------------------------------
4767 Extract TL control block
4768 ------------------------------------------------------------------------*/
4769 pTLCb = VOS_GET_TL_CB(pvosGCtx);
4770 if ( NULL == pTLCb )
4771 {
4772 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4773 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_TxComp"));
4774 return VOS_STATUS_E_FAULT;
4775 }
4776
4777 while ((0 < pTLCb->usPendingTxCompleteCount) &&
4778 ( VOS_STATUS_SUCCESS == vosStatus ) &&
4779 ( NULL != vosDataBuff))
4780 {
4781 vos_pkt_get_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
4782 (v_PVOID_t)&pfnTxComp);
4783
4784 /*it should never be NULL - default handler should be registered if none*/
4785 if ( NULL == pfnTxComp )
4786 {
4787 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4788 "WLAN TL:NULL pointer to Tx Complete on WLANTL_TxComp"));
4789 VOS_ASSERT(0);
4790 return VOS_STATUS_E_FAULT;
4791 }
4792
4793 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05304794 "WLAN TL:Calling Tx complete for pkt %p in function %p",
Jeff Johnson295189b2012-06-20 16:38:30 -07004795 vosDataBuff, pfnTxComp));
4796
4797 vosTempTx = vosDataBuff;
4798 vosStatus = vos_pkt_walk_packet_chain( vosDataBuff,
4799 &vosDataBuff, 1/*true*/);
4800
4801 pfnTxComp( pvosGCtx, vosTempTx, wTxStatus );
4802
4803 pTLCb->usPendingTxCompleteCount--;
4804 }
4805
Jeff Johnson295189b2012-06-20 16:38:30 -07004806
4807 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4808 "WLAN TL: current TL values are: resources = %d "
4809 "pTLCb->usPendingTxCompleteCount = %d",
4810 pTLCb->uResCount, pTLCb->usPendingTxCompleteCount));
4811
4812 return VOS_STATUS_SUCCESS;
4813}/* WLANTL_TxComp */
4814
4815/*==========================================================================
4816
4817 FUNCTION WLANTL_CacheSTAFrame
4818
4819 DESCRIPTION
4820 Internal utility function for for caching incoming data frames that do
4821 not have a registered station yet.
4822
4823 DEPENDENCIES
4824 TL must be initiailized before this function gets called.
4825 In order to benefit from thsi caching, the components must ensure that
4826 they will only register with TL at the moment when they are fully setup
4827 and ready to receive incoming data
4828
4829 PARAMETERS
4830
4831 IN
4832
4833 pTLCb: TL control block
4834 ucSTAId: station id
4835 vosTempBuff: the data packet
4836 uDPUSig: DPU signature of the incoming packet
4837 bBcast: true if packet had the MC/BC bit set
4838
4839 RETURN VALUE
4840 The result code associated with performing the operation
4841
4842 VOS_STATUS_E_FAULT: pointer to TL cb is NULL or STA Id invalid ; access
4843 would cause a page fault
4844 VOS_STATUS_SUCCESS: Everything is good :)
4845
4846 SIDE EFFECTS
4847
4848============================================================================*/
4849static VOS_STATUS
4850WLANTL_CacheSTAFrame
4851(
4852 WLANTL_CbType* pTLCb,
4853 v_U8_t ucSTAId,
4854 vos_pkt_t* vosTempBuff,
4855 v_U32_t uDPUSig,
4856 v_U8_t bBcast,
4857 v_U8_t ucFrmType
4858)
4859{
4860 v_U8_t ucUcastSig;
4861 v_U8_t ucBcastSig;
4862 v_BOOL_t bOldSTAPkt;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304863 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004864 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
4865
4866 /*-------------------------------------------------------------------------
4867 Sanity check
4868 -------------------------------------------------------------------------*/
4869 if (( NULL == pTLCb ) || ( NULL == vosTempBuff ) )
4870 {
4871 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05304872 "WLAN TL: Invalid input pointer on WLANTL_CacheSTAFrame TL %p"
4873 " Packet %p", pTLCb, vosTempBuff ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004874 return VOS_STATUS_E_FAULT;
4875 }
4876
4877 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
4878 {
4879 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4880 "WLAN TL:Invalid station id requested on WLANTL_CacheSTAFrame"));
4881 return VOS_STATUS_E_FAULT;
4882 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304883 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
4884
4885 if ( NULL == pClientSTA )
4886 {
4887 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4888 "WLAN TL:Client Memory was not allocated on %s", __func__));
4889 return VOS_STATUS_E_FAILURE;
4890 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004891
4892 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4893 "WLAN TL:Attempting to cache pkt for STA %d, BD DPU Sig: %d with sig UC: %d, BC: %d",
4894 ucSTAId, uDPUSig,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304895 pClientSTA->wSTADesc.ucUcastSig,
4896 pClientSTA->wSTADesc.ucBcastSig));
Jeff Johnson295189b2012-06-20 16:38:30 -07004897
4898 if(WLANTL_IS_CTRL_FRAME(ucFrmType))
4899 {
4900 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4901 "WLAN TL: No need to cache CTRL frame. Dropping"));
4902 vos_pkt_return_packet(vosTempBuff);
4903 return VOS_STATUS_SUCCESS;
4904 }
4905
4906 /*-------------------------------------------------------------------------
4907 Check if the packet that we are trying to cache belongs to the old
4908 registered station (if any) or the new (potentially)upcoming station
4909
4910 - If the STA with this Id was never registered with TL - the signature
4911 will be invalid;
4912 - If the STA was previously registered TL will have cached the former
4913 set of DPU signatures
4914 -------------------------------------------------------------------------*/
4915 if ( bBcast )
4916 {
4917 ucBcastSig = (v_U8_t)uDPUSig;
4918 bOldSTAPkt = (( WLAN_TL_INVALID_B_SIG !=
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304919 pClientSTA->wSTADesc.ucBcastSig ) &&
4920 ( ucBcastSig == pClientSTA->wSTADesc.ucBcastSig ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004921 }
4922 else
4923 {
4924 ucUcastSig = (v_U8_t)uDPUSig;
4925 bOldSTAPkt = (( WLAN_TL_INVALID_U_SIG !=
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304926 pClientSTA->wSTADesc.ucUcastSig ) &&
4927 ( ucUcastSig == pClientSTA->wSTADesc.ucUcastSig ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004928 }
4929
4930 /*------------------------------------------------------------------------
4931 If the value of the DPU SIG matches the old, this packet will not
4932 be cached as it belonged to the former association
4933 In case the SIG does not match - this is a packet for a potentially new
4934 associated station
4935 -------------------------------------------------------------------------*/
Varun Reddy Yeturua39b9902013-01-18 15:48:32 -08004936 if ( bOldSTAPkt || bBcast )
Jeff Johnson295189b2012-06-20 16:38:30 -07004937 {
4938 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4939 "WLAN TL:Data packet matches old sig for sig DPU: %d UC: %d, "
4940 "BC: %d - dropping",
4941 uDPUSig,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304942 pClientSTA->wSTADesc.ucUcastSig,
4943 pClientSTA->wSTADesc.ucBcastSig));
Jeff Johnson295189b2012-06-20 16:38:30 -07004944 vos_pkt_return_packet(vosTempBuff);
4945 }
4946 else
4947 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304948 if ( NULL == pClientSTA->vosBegCachedFrame )
Jeff Johnson295189b2012-06-20 16:38:30 -07004949 {
4950 /*this is the first frame that we are caching */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304951 pClientSTA->vosBegCachedFrame = vosTempBuff;
Mihir Sheteb7337272014-04-11 15:53:08 +05304952
4953 pClientSTA->tlCacheInfo.cacheInitTime = vos_timer_get_system_time();
4954 pClientSTA->tlCacheInfo.cacheDoneTime =
4955 pClientSTA->tlCacheInfo.cacheInitTime;
4956 pClientSTA->tlCacheInfo.cacheSize = 1;
4957
Mihir Sheteae6f02b2014-04-11 19:49:21 +05304958 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_CACHE_FRAME,
4959 ucSTAId, pClientSTA->tlCacheInfo.cacheSize));
4960
Jeff Johnson295189b2012-06-20 16:38:30 -07004961 }
4962 else
4963 {
4964 /*this is a subsequent frame that we are caching: chain to the end */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304965 vos_pkt_chain_packet(pClientSTA->vosEndCachedFrame,
Jeff Johnson295189b2012-06-20 16:38:30 -07004966 vosTempBuff, VOS_TRUE);
Mihir Sheteb7337272014-04-11 15:53:08 +05304967
4968 pClientSTA->tlCacheInfo.cacheDoneTime = vos_timer_get_system_time();
4969 pClientSTA->tlCacheInfo.cacheSize ++;
4970
4971 if (pClientSTA->tlCacheInfo.cacheSize % WLANTL_CACHE_TRACE_WATERMARK == 0)
4972 {
4973 VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4974 "%s: Cache High watermark for staid:%d (%d)",
4975 __func__,ucSTAId, pClientSTA->tlCacheInfo.cacheSize);
Mihir Sheteae6f02b2014-04-11 19:49:21 +05304976 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_CACHE_FRAME,
4977 ucSTAId, pClientSTA->tlCacheInfo.cacheSize));
Mihir Sheteb7337272014-04-11 15:53:08 +05304978 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004979 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304980 pClientSTA->vosEndCachedFrame = vosTempBuff;
Jeff Johnson295189b2012-06-20 16:38:30 -07004981 }/*else new packet*/
4982
4983 return VOS_STATUS_SUCCESS;
4984}/*WLANTL_CacheSTAFrame*/
4985
4986/*==========================================================================
4987
4988 FUNCTION WLANTL_FlushCachedFrames
4989
4990 DESCRIPTION
4991 Internal utility function used by TL to flush the station cache
4992
4993 DEPENDENCIES
4994 TL must be initiailized before this function gets called.
4995
4996 PARAMETERS
4997
4998 IN
4999
5000 vosDataBuff: it will contain a pointer to the first cached buffer
5001 received,
5002
5003 RETURN VALUE
5004 The result code associated with performing the operation
5005
5006 VOS_STATUS_SUCCESS: Everything is good :)
5007
5008 SIDE EFFECTS
5009
5010 NOTE
5011 This function doesn't re-initialize vosDataBuff to NULL. It's caller's
5012 responsibility to do so, if required, after this function call.
5013 Because of this restriction, we decide to make this function to static
5014 so that upper layer doesn't need to be aware of this restriction.
5015
5016============================================================================*/
5017static VOS_STATUS
5018WLANTL_FlushCachedFrames
5019(
5020 vos_pkt_t* vosDataBuff
5021)
5022{
5023 /*----------------------------------------------------------------------
5024 Return the entire chain to vos if there are indeed cache frames
5025 ----------------------------------------------------------------------*/
5026 if ( NULL != vosDataBuff )
5027 {
5028 vos_pkt_return_packet(vosDataBuff);
5029 }
5030
5031 return VOS_STATUS_SUCCESS;
5032}/*WLANTL_FlushCachedFrames*/
5033
5034/*==========================================================================
5035
5036 FUNCTION WLANTL_ForwardSTAFrames
5037
5038 DESCRIPTION
5039 Internal utility function for either forwarding cached data to the station after
5040 the station has been registered, or flushing cached data if the station has not
5041 been registered.
5042
5043
5044 DEPENDENCIES
5045 TL must be initiailized before this function gets called.
5046
5047 PARAMETERS
5048
5049 IN
5050
5051 pTLCb: TL control block
5052 ucSTAId: station id
5053
5054 RETURN VALUE
5055 The result code associated with performing the operation
5056
5057 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
5058 page fault
5059 VOS_STATUS_SUCCESS: Everything is good :)
5060
5061 SIDE EFFECTS
5062 This function doesn't re-initialize vosDataBuff to NULL. It's caller's
5063 responsibility to do so, if required, after this function call.
5064 Because of this restriction, we decide to make this function to static
5065 so that upper layer doesn't need to be aware of this restriction.
5066
5067============================================================================*/
5068static VOS_STATUS
5069WLANTL_ForwardSTAFrames
5070(
5071 void* pvosGCtx,
5072 v_U8_t ucSTAId,
5073 v_U8_t ucUcastSig,
5074 v_U8_t ucBcastSig
5075)
5076{
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305077 WLANTL_CbType* pTLCb = NULL;
5078 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005079 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
5080
5081 /*-------------------------------------------------------------------------
5082 Sanity check
5083 -------------------------------------------------------------------------*/
5084 pTLCb = VOS_GET_TL_CB(pvosGCtx);
5085 if ( NULL == pTLCb )
5086 {
5087 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05305088 "WLAN TL: Invalid input pointer on WLANTL_ForwardSTAFrames TL %p",
Jeff Johnson295189b2012-06-20 16:38:30 -07005089 pTLCb ));
5090 return VOS_STATUS_E_FAULT;
5091 }
5092
5093 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
5094 {
5095 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5096 "WLAN TL:Invalid station id requested on WLANTL_ForwardSTAFrames"));
5097 return VOS_STATUS_E_FAULT;
5098 }
5099
5100 //WLAN_TL_LOCK_STA_CACHE(pTLCb->atlSTAClients[ucSTAId]);
5101
5102 /*------------------------------------------------------------------------
5103 Check if station has not been registered in the mean while
5104 if not registered, flush cached frames.
5105 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305106 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
5107
5108 if ( NULL == pClientSTA )
5109 {
5110 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5111 "WLAN TL:Client Memory was not allocated on %s", __func__));
5112 return VOS_STATUS_E_FAILURE;
5113 }
5114
5115 if ( 0 == pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07005116 {
5117 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5118 "WLAN TL:Station has been deleted for STA %d - flushing cache", ucSTAId));
Mihir Sheteae6f02b2014-04-11 19:49:21 +05305119 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_FLUSH_CACHED_FRAMES,
5120 ucSTAId, pClientSTA->tlCacheInfo.cacheSize));
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305121 WLANTL_FlushCachedFrames(pClientSTA->vosBegCachedFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07005122 goto done;
5123 }
5124
5125 /*------------------------------------------------------------------------
5126 Forwarding cache frames received while the station was in the process
5127 of being registered with the rest of the SW components
5128
5129 Access to the cache must be locked; similarly updating the signature and
5130 the existence flag must be synchronized because these values are checked
5131 during cached
5132 ------------------------------------------------------------------------*/
5133 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5134 "WLAN TL:Preparing to fwd packets for STA %d", ucSTAId));
5135
5136 /*-----------------------------------------------------------------------
5137 Save the new signature values
5138 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305139 pClientSTA->wSTADesc.ucUcastSig = ucUcastSig;
5140 pClientSTA->wSTADesc.ucBcastSig = ucBcastSig;
Jeff Johnson295189b2012-06-20 16:38:30 -07005141
5142 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5143 "WLAN TL:Fwd-ing packets for STA %d UC %d BC %d",
5144 ucSTAId, ucUcastSig, ucBcastSig));
5145
5146 /*-------------------------------------------------------------------------
5147 Check to see if we have any cached data to forward
5148 -------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305149 if ( NULL != pClientSTA->vosBegCachedFrame )
Jeff Johnson295189b2012-06-20 16:38:30 -07005150 {
5151 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5152 "WLAN TL: Fwd-ing Cached packets for station %d", ucSTAId ));
5153
5154 WLANTL_RxCachedFrames( pTLCb,
5155 ucSTAId,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305156 pClientSTA->vosBegCachedFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07005157 }
5158 else
5159 {
5160 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5161 "WLAN TL: NO cached packets for station %d", ucSTAId ));
5162 }
5163
5164done:
5165 /*-------------------------------------------------------------------------
5166 Clear the station cache
5167 -------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305168 pClientSTA->vosBegCachedFrame = NULL;
5169 pClientSTA->vosEndCachedFrame = NULL;
Mihir Sheteb7337272014-04-11 15:53:08 +05305170 pClientSTA->tlCacheInfo.cacheSize = 0;
5171 pClientSTA->tlCacheInfo.cacheClearTime = vos_timer_get_system_time();
Jeff Johnson295189b2012-06-20 16:38:30 -07005172
5173 /*-----------------------------------------------------------------------
5174 After all the init is complete we can mark the existance flag
5175 ----------------------------------------------------------------------*/
Katya Nigam63902932014-06-26 19:04:23 +05305176 pClientSTA->enableCaching = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005177
5178 //WLAN_TL_UNLOCK_STA_CACHE(pTLCb->atlSTAClients[ucSTAId]);
5179 return VOS_STATUS_SUCCESS;
5180
5181}/*WLANTL_ForwardSTAFrames*/
5182
5183
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005184#if defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07005185/*==========================================================================
5186
5187 FUNCTION WLANTL_IsIAPPFrame
5188
5189 DESCRIPTION
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005190 Internal utility function for detecting incoming ESE IAPP frames
Jeff Johnson295189b2012-06-20 16:38:30 -07005191
5192 DEPENDENCIES
5193
5194 PARAMETERS
5195
5196 IN
5197
5198 pvBDHeader: pointer to the BD header
5199 vosTempBuff: the data packet
5200
5201 IN/OUT
5202 pFirstDataPktArrived: static from caller function; used for rssi
5203 computation
5204 RETURN VALUE
5205 The result code associated with performing the operation
5206
5207 VOS_TRUE: It is a IAPP frame
5208 VOS_FALSE: It is NOT IAPP frame
5209
5210 SIDE EFFECTS
5211
5212============================================================================*/
5213v_BOOL_t
5214WLANTL_IsIAPPFrame
5215(
5216 v_PVOID_t pvBDHeader,
5217 vos_pkt_t* vosTempBuff
5218)
5219{
5220 v_U16_t usMPDUDOffset;
5221 v_U8_t ucOffset;
5222 v_U8_t ucSnapHdr[WLANTL_LLC_SNAP_SIZE];
5223 v_SIZE_t usSnapHdrSize = WLANTL_LLC_SNAP_SIZE;
5224 VOS_STATUS vosStatus;
5225
5226 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
5227
5228 /*------------------------------------------------------------------------
5229 Check if OUI field is present.
5230 -------------------------------------------------------------------------*/
5231 if ( VOS_FALSE == WDA_IS_RX_LLC_PRESENT(pvBDHeader) )
5232 {
5233 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5234 "WLAN TL:LLC header removed, cannot determine BT-AMP type -"
5235 "dropping pkt"));
5236 /* Drop packet */
5237 vos_pkt_return_packet(vosTempBuff);
5238 return VOS_TRUE;
5239 }
5240 usMPDUDOffset = (v_U8_t)WDA_GET_RX_MPDU_DATA_OFFSET(pvBDHeader);
5241 ucOffset = (v_U8_t)usMPDUDOffset + WLANTL_LLC_SNAP_OFFSET;
5242
5243 vosStatus = vos_pkt_extract_data( vosTempBuff, ucOffset,
5244 (v_PVOID_t)ucSnapHdr, &usSnapHdrSize);
5245
5246 if (( VOS_STATUS_SUCCESS != vosStatus))
5247 {
5248 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5249 "Unable to extract Snap Hdr of data packet -"
5250 "dropping pkt"));
5251 return VOS_FALSE;
5252 }
5253
5254 /*------------------------------------------------------------------------
5255 Check if this is IAPP frame by matching Aironet Snap hdr.
5256 -------------------------------------------------------------------------*/
5257 // Compare returns 1 if values are same and 0
5258 // if not the same.
5259 if (( WLANTL_LLC_SNAP_SIZE != usSnapHdrSize ) ||
5260 ( 0 == vos_mem_compare(ucSnapHdr, (v_PVOID_t)WLANTL_AIRONET_SNAP_HEADER,
5261 WLANTL_LLC_SNAP_SIZE ) ))
5262 {
5263 return VOS_FALSE;
5264 }
5265
5266 return VOS_TRUE;
5267
5268}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005269#endif //FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07005270
5271/*==========================================================================
5272
5273 FUNCTION WLANTL_ProcessBAPFrame
5274
5275 DESCRIPTION
5276 Internal utility function for processing incoming BT-AMP frames
5277
5278 DEPENDENCIES
5279 TL must be initiailized before this function gets called.
5280 Bothe the BT-AMP station and the BAP Ctrl path must have been previously
5281 registered with TL.
5282
5283 PARAMETERS
5284
5285 IN
5286
5287 pvBDHeader: pointer to the BD header
5288 vosTempBuff: the data packet
5289 pTLCb: TL control block
5290 ucSTAId: station id
5291
5292 IN/OUT
5293 pFirstDataPktArrived: static from caller function; used for rssi
5294 computation
5295 RETURN VALUE
5296 The result code associated with performing the operation
5297
5298 VOS_STATUS_E_INVAL: Input parameters are invalid
5299 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
5300 page fault
5301 VOS_STATUS_SUCCESS: Everything is good :)
5302
5303 SIDE EFFECTS
5304
5305============================================================================*/
5306v_BOOL_t
5307WLANTL_ProcessBAPFrame
5308(
5309 v_PVOID_t pvBDHeader,
5310 vos_pkt_t* vosTempBuff,
5311 WLANTL_CbType* pTLCb,
5312 v_U8_t* pFirstDataPktArrived,
5313 v_U8_t ucSTAId
5314)
5315{
5316 v_U16_t usMPDUDOffset;
5317 v_U8_t ucOffset;
5318 v_U8_t ucOUI[WLANTL_LLC_OUI_SIZE];
5319 v_SIZE_t usOUISize = WLANTL_LLC_OUI_SIZE;
5320 VOS_STATUS vosStatus;
5321 v_U16_t usType;
5322 v_SIZE_t usTypeLen = sizeof(usType);
5323 v_U8_t ucMPDUHOffset;
5324 v_U8_t ucMPDUHLen = 0;
5325 v_U16_t usActualHLen = 0;
5326
5327 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
5328
5329 /*------------------------------------------------------------------------
5330 Extract OUI and type from LLC and validate; if non-data send to BAP
5331 -------------------------------------------------------------------------*/
5332 if ( VOS_FALSE == WDA_IS_RX_LLC_PRESENT(pvBDHeader) )
5333 {
5334 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5335 "WLAN TL:LLC header removed, cannot determine BT-AMP type -"
5336 "dropping pkt"));
5337 /* Drop packet */
5338 vos_pkt_return_packet(vosTempBuff);
5339 return VOS_TRUE;
5340 }
5341
5342 usMPDUDOffset = (v_U8_t)WDA_GET_RX_MPDU_DATA_OFFSET(pvBDHeader);
5343 ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(pvBDHeader);
5344 ucMPDUHLen = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(pvBDHeader);
5345 ucOffset = (v_U8_t)usMPDUDOffset + WLANTL_LLC_OUI_OFFSET;
5346
5347 vosStatus = vos_pkt_extract_data( vosTempBuff, ucOffset,
5348 (v_PVOID_t)ucOUI, &usOUISize);
5349
5350#if 0
5351 // Compare returns 1 if values are same and 0
5352 // if not the same.
5353 if (( WLANTL_LLC_OUI_SIZE != usOUISize ) ||
5354 ( 0 == vos_mem_compare(ucOUI, (v_PVOID_t)WLANTL_BT_AMP_OUI,
5355 WLANTL_LLC_OUI_SIZE ) ))
5356 {
5357 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5358 "LLC header points to diff OUI in BT-AMP station -"
5359 "dropping pkt"));
5360 /* Drop packet */
5361 vos_pkt_return_packet(vosTempBuff);
5362 return VOS_TRUE;
5363 }
5364#endif
5365 /*------------------------------------------------------------------------
5366 Extract LLC OUI and ensure that this is indeed a BT-AMP frame
5367 ------------------------------------------------------------------------*/
5368 vosStatus = vos_pkt_extract_data( vosTempBuff,
5369 ucOffset + WLANTL_LLC_OUI_SIZE,
5370 (v_PVOID_t)&usType, &usTypeLen);
5371
5372 if (( VOS_STATUS_SUCCESS != vosStatus) ||
5373 ( sizeof(usType) != usTypeLen ))
5374 {
5375 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5376 "Unable to extract type on incoming BAP packet -"
5377 "dropping pkt"));
5378 /* Drop packet */
5379 vos_pkt_return_packet(vosTempBuff);
5380 return VOS_TRUE;
5381 }
5382
5383 /*------------------------------------------------------------------------
5384 Check if this is BT-AMP data or ctrl packet(RSN, LinkSvision, ActivityR)
5385 ------------------------------------------------------------------------*/
5386 usType = vos_be16_to_cpu(usType);
5387
5388 if (WLANTL_BAP_IS_NON_DATA_PKT_TYPE(usType))
5389 {
5390 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5391 "WLAN TL:Non-data packet received over BT-AMP link: %d, => BAP",
5392 usType));
5393
5394 /*Flatten packet as BAP expects to be able to peek*/
5395 if ( VOS_STATUS_SUCCESS != vos_pkt_flatten_rx_pkt(&vosTempBuff))
5396 {
5397 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5398 "WLAN TL:Cannot flatten BT-AMP packet - dropping"));
5399 /* Drop packet */
5400 vos_pkt_return_packet(vosTempBuff);
5401 return VOS_TRUE;
5402 }
5403
5404 /* Send packet to BAP client*/
Jeff Johnson295189b2012-06-20 16:38:30 -07005405 if ( VOS_STATUS_SUCCESS != WDA_DS_TrimRxPacketInfo( vosTempBuff ) )
5406 {
5407 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5408 "WLAN TL:BD header corrupted - dropping packet"));
5409 /* Drop packet */
5410 vos_pkt_return_packet(vosTempBuff);
5411 return VOS_TRUE;
5412 }
5413
5414 if ( 0 == WDA_GET_RX_FT_DONE(pvBDHeader) )
5415 {
5416 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5417 "Non-data packet received over BT-AMP link: Sending it for "
5418 "frame Translation"));
5419
5420 if (usMPDUDOffset > ucMPDUHOffset)
5421 {
5422 usActualHLen = usMPDUDOffset - ucMPDUHOffset;
5423 }
5424
5425 /* software frame translation for BTAMP WDS.*/
5426 WLANTL_Translate80211To8023Header( vosTempBuff, &vosStatus, usActualHLen,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005427 ucMPDUHLen, pTLCb,ucSTAId, VOS_FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07005428
5429 }
5430 if (pTLCb->tlBAPClient.pfnTlBAPRx)
5431 pTLCb->tlBAPClient.pfnTlBAPRx( vos_get_global_context(VOS_MODULE_ID_TL,pTLCb),
5432 vosTempBuff,
5433 (WLANTL_BAPFrameEnumType)usType );
Manjunathappa Prakashfb585462013-12-23 19:07:07 -08005434 else
5435 {
5436 VOS_ASSERT(0);
5437 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005438
5439 return VOS_TRUE;
5440 }
5441 else
5442 {
5443 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5444 "WLAN TL: BAP DATA packet received over BT-AMP link: %d, => BAP",
5445 usType));
5446 /*!!!FIX ME!!*/
5447 #if 0
5448 /*--------------------------------------------------------------------
5449 For data packet collect phy stats RSSI and Link Quality
5450 Calculate the RSSI average and save it. Continuous average is done.
5451 --------------------------------------------------------------------*/
5452 if ( *pFirstDataPktArrived == 0)
5453 {
5454 pTLCb->atlSTAClients[ucSTAId].rssiAvg =
5455 WLANHAL_GET_RSSI_AVERAGE( pvBDHeader );
5456 pTLCb->atlSTAClients[ucSTAId].uLinkQualityAvg =
5457 WLANHAL_RX_BD_GET_SNR( pvBDHeader );
5458
5459 // Rcvd 1st pkt, start average from next time
5460 *pFirstDataPktArrived = 1;
5461 }
5462 else
5463 {
5464 pTLCb->atlSTAClients[ucSTAId].rssiAvg =
5465 (WLANHAL_GET_RSSI_AVERAGE( pvBDHeader ) +
5466 pTLCb->atlSTAClients[ucSTAId].rssiAvg)/2;
5467 pTLCb->atlSTAClients[ucSTAId].uLinkQualityAvg =
5468 (WLANHAL_RX_BD_GET_SNR( pvBDHeader ) +
5469 pTLCb->atlSTAClients[ucSTAId].uLinkQualityAvg)/2;
5470 }/*Else, first data packet*/
5471 #endif
5472 }/*BT-AMP data packet*/
5473
5474 return VOS_FALSE;
5475}/*WLANTL_ProcessBAPFrame*/
5476
Jeff Johnson295189b2012-06-20 16:38:30 -07005477
5478/*==========================================================================
5479
5480 FUNCTION WLANTL_ProcessFCFrame
5481
5482 DESCRIPTION
5483 Internal utility function for processing incoming Flow Control frames. Enable
5484 or disable LWM mode based on the information.
5485
5486 DEPENDENCIES
5487 TL must be initiailized before this function gets called.
5488 FW sends up special flow control frame.
5489
5490 PARAMETERS
5491
5492 IN
5493 pvosGCtx pointer to vos global context
5494 pvBDHeader: pointer to the BD header
5495 pTLCb: TL control block
5496 pvBDHeader pointer to BD header.
5497
5498 IN/OUT
5499 pFirstDataPktArrived: static from caller function; used for rssi
5500 computation
5501 RETURN VALUE
5502 The result code associated with performing the operation
5503
5504 VOS_STATUS_E_INVAL: Input frame are invalid
5505 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
5506 page fault
5507 VOS_STATUS_SUCCESS: Everything is good :)
5508
5509 SIDE EFFECTS
5510 The ingress and egress of each station will be updated. If needed, LWM mode will
5511 be enabled or disabled based on the flow control algorithm.
5512
5513============================================================================*/
5514v_BOOL_t
5515WLANTL_ProcessFCFrame
5516(
5517 v_PVOID_t pvosGCtx,
5518 vos_pkt_t* pvosDataBuff,
5519 v_PVOID_t pvBDHeader
5520)
5521{
5522#if 1 //enable processing of only fcStaTxDisabled bitmap for now. the else part is old better qos code.
5523 // need to revisit the old code for full implementation.
Hoonki Lee14621352013-04-16 17:51:19 -07005524 v_U8_t ucSTAId;
5525 v_U16_t ucStaValidBitmap;
5526 v_U16_t ucStaTxDisabledBitmap;
5527 WLANTL_CbType* pTLCb = NULL;
5528 #ifdef TL_DEBUG_FC
5529 v_U32_t rxTimeStamp;
5530 v_U32_t curTick;
5531 #endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005532 /*------------------------------------------------------------------------
Hoonki Lee14621352013-04-16 17:51:19 -07005533 Extract TL control block
Jeff Johnson295189b2012-06-20 16:38:30 -07005534 ------------------------------------------------------------------------*/
5535 pTLCb = VOS_GET_TL_CB(pvosGCtx);
5536 if ( NULL == pTLCb )
5537 {
5538 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5539 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SuspendDataTx"));
5540 return VOS_STATUS_E_FAULT;
5541 }
Hoonki Lee14621352013-04-16 17:51:19 -07005542 ucStaValidBitmap = WDA_GET_RX_FC_VALID_STA_MASK(pvBDHeader);
5543 ucStaTxDisabledBitmap = WDA_GET_RX_FC_STA_TX_DISABLED_BITMAP(pvBDHeader);
5544#ifdef TL_DEBUG_FC
5545 rxTimeStamp = WDA_GET_RX_TIMESTAMP(pvBDHeader);
5546 /* hard code of MTU_GLOBAL_TIMER_ADDR to calculate the time between generated and processed */
5547 wpalReadRegister(0x03081400+0x1D4, &curTick);
Jeff Johnson295189b2012-06-20 16:38:30 -07005548
Jeff Johnson295189b2012-06-20 16:38:30 -07005549 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08005550 "%ld (%ld-%ld): Disabled %x Valid %x", curTick > rxTimeStamp ? curTick - rxTimeStamp : rxTimeStamp - (0xFFFFFFFF - curTick),
Hoonki Lee14621352013-04-16 17:51:19 -07005551 curTick, rxTimeStamp, ucStaTxDisabledBitmap, ucStaValidBitmap));
5552#endif
5553 for(ucSTAId = 0; ucStaValidBitmap != 0; ucStaValidBitmap >>=1, ucStaTxDisabledBitmap >>= 1, ucSTAId ++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005554 {
Hoonki Lee14621352013-04-16 17:51:19 -07005555 if ( (0 == (ucStaValidBitmap & 0x1)) || (pTLCb->atlSTAClients[ucSTAId] && (0 == pTLCb->atlSTAClients[ucSTAId]->ucExists)) )
5556 continue;
5557
5558 if (ucStaTxDisabledBitmap & 0x1)
5559 {
5560 WLANTL_SuspendDataTx(pvosGCtx, &ucSTAId, NULL);
5561 }
5562 else
5563 {
5564 WLANTL_ResumeDataTx(pvosGCtx, &ucSTAId);
5565 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005566 }
5567
5568#else
5569 VOS_STATUS vosStatus;
5570 tpHalFcRxBd pvFcRxBd = NULL;
5571 v_U8_t ucBitCheck = 0x1;
5572 v_U8_t ucStaValid = 0;
5573 v_U8_t ucSTAId = 0;
5574
5575 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
5576 "Received FC Response");
5577 if ( (NULL == pTLCb) || (NULL == pvosDataBuff))
5578 {
5579 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08005580 "WLAN TL:Invalid pointer in %s", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07005581 return VOS_STATUS_E_FAULT;
5582 }
5583 vosStatus = vos_pkt_peek_data( pvosDataBuff, 0, (v_PVOID_t)&pvFcRxBd,
5584 sizeof(tHalFcRxBd));
5585
5586 if ( (VOS_STATUS_SUCCESS != vosStatus) || (NULL == pvFcRxBd) )
5587 {
5588 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5589 "WLAN TL:wrong FC Rx packet"));
5590 return VOS_STATUS_E_INVAL;
5591 }
5592
5593 // need to swap bytes in the FC contents.
5594 WLANHAL_SwapFcRxBd(&pvFcRxBd->fcSTATxQLen[0]);
5595
5596 //logic to enable/disable LWM mode for each station
5597 for( ucStaValid = (v_U8_t)pvFcRxBd->fcSTAValidMask; ucStaValid; ucStaValid >>= 1, ucBitCheck <<= 1, ucSTAId ++)
5598 {
5599 if ( (0 == (ucStaValid & 0x1)) || (0 == pTLCb->atlSTAClients[ucSTAId].ucExists) )
5600 {
5601 continue;
5602 }
5603
5604 if ( pvFcRxBd->fcSTAThreshIndMask & ucBitCheck )
5605 {
5606 //LWM event is reported by FW. Able to fetch more packet
5607 if( pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled )
5608 {
5609 //Now memory usage is below LWM. Station can send more packets.
5610 pTLCb->atlSTAClients[ucSTAId].ucLwmEventReported = TRUE;
5611 }
5612 else
5613 {
5614 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
Arif Hussainf2b00992013-11-17 21:46:15 -08005615 "WLAN TL: FW report LWM event but the station %d is not in LWM mode", ucSTAId));
Jeff Johnson295189b2012-06-20 16:38:30 -07005616 }
5617 }
5618
5619 //calculate uEgress_length/uIngress_length only after receiving enough packets
5620 if (WLANTL_LWM_INGRESS_SAMPLE_THRESHOLD <= pTLCb->atlSTAClients[ucSTAId].uIngress_length)
5621 {
5622 //check memory usage info to see whether LWM mode should be enabled for the station
5623 v_U32_t uEgress_length = pTLCb->atlSTAClients[ucSTAId].uIngress_length +
5624 pTLCb->atlSTAClients[ucSTAId].bmuMemConsumed - pvFcRxBd->fcSTATxQLen[ucSTAId];
5625
5626 //if ((float)uEgress_length/(float)pTLCb->atlSTAClients[ucSTAId].uIngress_length
5627 // <= WLANTL_LWM_EGRESS_INGRESS_THRESHOLD)
5628 if ( (pTLCb->atlSTAClients[ucSTAId].uIngress_length > uEgress_length) &&
5629 ((pTLCb->atlSTAClients[ucSTAId].uIngress_length - uEgress_length ) >=
5630 (pTLCb->atlSTAClients[ucSTAId].uIngress_length >> 2))
5631 )
5632 {
5633 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -08005634 "WLAN TL:Enable LWM mode for station %d", ucSTAId));
Jeff Johnson295189b2012-06-20 16:38:30 -07005635 pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled = TRUE;
5636 }
5637 else
5638 {
5639 if( pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled )
5640 {
5641 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -08005642 "WLAN TL:Disable LWM mode for station %d", ucSTAId));
Jeff Johnson295189b2012-06-20 16:38:30 -07005643 pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled = FALSE;
5644 }
5645
5646 }
5647
5648 //remember memory usage in FW starting from this round
5649 pTLCb->atlSTAClients[ucSTAId].bmuMemConsumed = pvFcRxBd->fcSTATxQLen[ucSTAId];
5650 pTLCb->atlSTAClients[ucSTAId].uIngress_length = 0;
5651 } //(WLANTL_LWM_INGRESS_SAMPLE_THRESHOLD <= pTLCb->atlSTAClients[ucSTAId].uIngress_length)
5652
5653 if( pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled )
5654 {
5655 //always update current maximum allowed memeory usage
5656 pTLCb->atlSTAClients[ucSTAId].uBuffThresholdMax = WLANTL_STA_BMU_THRESHOLD_MAX -
5657 pvFcRxBd->fcSTATxQLen[ucSTAId];
5658 }
5659
5660 }
5661#endif
5662
5663 return VOS_STATUS_SUCCESS;
5664}
Jeff Johnson295189b2012-06-20 16:38:30 -07005665
5666
5667/*==========================================================================
5668
5669 FUNCTION WLANTL_RxFrames
5670
5671 DESCRIPTION
5672 Callback registered by TL and called by BAL when a packet is received
5673 over the bus. Upon the call of this function TL will make the necessary
5674 decision with regards to the forwarding or queuing of this packet and
5675 the layer it needs to be delivered to.
5676
5677 DEPENDENCIES
5678 TL must be initiailized before this function gets called.
5679 If the frame carried is a data frame then the station for which it is
5680 destined to must have been previously registered with TL.
5681
5682 PARAMETERS
5683
5684 IN
5685 pvosGCtx: pointer to the global vos context; a handle to TL's
5686 or BAL's control block can be extracted from its context
5687
5688 vosDataBuff: it will contain a pointer to the first buffer received,
5689 if there is more then one packet they will be chained
5690 using vOSS buffers.
5691
5692 RETURN VALUE
5693 The result code associated with performing the operation
5694
5695 VOS_STATUS_E_INVAL: Input parameters are invalid
5696 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
5697 page fault
5698 VOS_STATUS_SUCCESS: Everything is good :)
5699
5700 SIDE EFFECTS
5701
5702============================================================================*/
5703VOS_STATUS
5704WLANTL_RxFrames
5705(
5706 v_PVOID_t pvosGCtx,
5707 vos_pkt_t *pFrameDataBuff
5708)
5709{
5710 vos_pkt_t* vosDataBuff = (vos_pkt_t*)pFrameDataBuff;
5711 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305712 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005713 WLANTL_STAFuncType pfnSTAFsm;
5714 vos_pkt_t* vosTempBuff;
5715 v_U8_t ucSTAId;
5716 VOS_STATUS vosStatus;
5717 v_U8_t ucFrmType;
5718 v_PVOID_t pvBDHeader = NULL;
5719 WLANTL_STAEventType wSTAEvent = WLANTL_RX_EVENT;
5720 v_U8_t ucTid = 0;
5721 v_BOOL_t broadcast = VOS_FALSE;
5722 v_BOOL_t selfBcastLoopback = VOS_FALSE;
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -07005723 static v_U8_t first_data_pkt_arrived;
Jeff Johnson295189b2012-06-20 16:38:30 -07005724 v_U32_t uDPUSig;
Jeff Johnson295189b2012-06-20 16:38:30 -07005725 v_U16_t usPktLen;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005726#ifdef FEATURE_WLAN_TDLS_INTERNAL
5727 v_U8_t ucMPDUHLen = 0 ;
5728 v_U16_t usEtherType = 0;
5729#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005730 v_BOOL_t bForwardIAPPwithLLC = VOS_FALSE;
Dino Mycle3b9536d2014-07-09 22:05:24 +05305731#ifdef WLAN_FEATURE_LINK_LAYER_STATS
5732 v_S7_t currentAvgRSSI = 0;
5733 v_U8_t ac;
5734
5735#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005736
Jeff Johnson295189b2012-06-20 16:38:30 -07005737 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
5738
5739 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5740 "WLAN TL:TL Receive Frames called"));
5741
5742 /*------------------------------------------------------------------------
5743 Sanity check
5744 ------------------------------------------------------------------------*/
5745 if ( NULL == vosDataBuff )
5746 {
5747 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5748 "WLAN TL:Invalid parameter sent on WLANTL_RxFrames"));
5749 return VOS_STATUS_E_INVAL;
5750 }
5751
Katya Nigam3802f202013-12-16 19:27:14 +05305752 /*------------------------------------------------------------------------
5753 Popolaute timestamp as the time when packet arrives
5754 ---------------------------------------------------------------------- */
5755 vosDataBuff->timestamp = vos_timer_get_system_ticks();
5756
Jeff Johnson295189b2012-06-20 16:38:30 -07005757 /*------------------------------------------------------------------------
5758 Extract TL control block
5759 ------------------------------------------------------------------------*/
5760 pTLCb = VOS_GET_TL_CB(pvosGCtx);
5761 if ( NULL == pTLCb )
5762 {
5763 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5764 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
5765 return VOS_STATUS_E_FAULT;
5766 }
5767
5768 /*---------------------------------------------------------------------
5769 Save the initial buffer - this is the first received buffer
5770 ---------------------------------------------------------------------*/
5771 vosTempBuff = vosDataBuff;
5772
5773 while ( NULL != vosTempBuff )
5774 {
Madan Mohan Koyyalamudia148e1e2012-11-30 14:52:59 -08005775 broadcast = VOS_FALSE;
5776 selfBcastLoopback = VOS_FALSE;
5777
Jeff Johnson295189b2012-06-20 16:38:30 -07005778 vos_pkt_walk_packet_chain( vosDataBuff, &vosDataBuff, 1/*true*/ );
5779
5780 /*---------------------------------------------------------------------
5781 Peek at BD header - do not remove
5782 !!! Optimize me: only part of header is needed; not entire one
5783 ---------------------------------------------------------------------*/
5784 vosStatus = WDA_DS_PeekRxPacketInfo( vosTempBuff, (v_PVOID_t)&pvBDHeader, 1/*Swap BD*/ );
5785
5786 if ( NULL == pvBDHeader )
5787 {
5788 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5789 "WLAN TL:Cannot extract BD header"));
5790 /* Drop packet */
5791 vos_pkt_return_packet(vosTempBuff);
5792 vosTempBuff = vosDataBuff;
5793 continue;
5794 }
5795
Jeff Johnson295189b2012-06-20 16:38:30 -07005796 /*---------------------------------------------------------------------
5797 Check if FC frame reported from FW
5798 ---------------------------------------------------------------------*/
5799 if(WDA_IS_RX_FC(pvBDHeader))
5800 {
5801 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5802 "WLAN TL:receive one FC frame"));
5803
5804 WLANTL_ProcessFCFrame(pvosGCtx, vosTempBuff, pvBDHeader);
5805 /* Drop packet */
5806 vos_pkt_return_packet(vosTempBuff);
5807 vosTempBuff = vosDataBuff;
5808 continue;
5809 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005810
5811 /* AMSDU HW bug fix
5812 * After 2nd AMSDU subframe HW could not handle BD correctly
5813 * HAL workaround is needed */
5814 if(WDA_GET_RX_ASF(pvBDHeader))
5815 {
5816 WDA_DS_RxAmsduBdFix(pvosGCtx, pvBDHeader);
5817 }
5818
5819 /*---------------------------------------------------------------------
5820 Extract frame control field from 802.11 header if present
5821 (frame translation not done)
5822 ---------------------------------------------------------------------*/
5823
5824 vosStatus = WDA_DS_GetFrameTypeSubType( pvosGCtx, vosTempBuff,
5825 pvBDHeader, &ucFrmType );
5826 if ( VOS_STATUS_SUCCESS != vosStatus )
5827 {
5828 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5829 "WLAN TL:Cannot extract Frame Control Field"));
5830 /* Drop packet */
5831 vos_pkt_return_packet(vosTempBuff);
5832 vosTempBuff = vosDataBuff;
5833 continue;
5834 }
5835
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005836#ifdef FEATURE_WLAN_TDLS_INTERNAL
5837 if ( WLANTL_IS_DATA_FRAME(ucFrmType))
5838 {
5839 ucMPDUHLen = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(pvBDHeader);
5840 WLANTL_GetEtherType_2(pvBDHeader, vosTempBuff, ucMPDUHLen, &usEtherType) ;
5841 }
5842#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005843 vos_pkt_get_packet_length(vosTempBuff, &usPktLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07005844
5845 /*---------------------------------------------------------------------
5846 Check if management and send to PE
5847 ---------------------------------------------------------------------*/
5848
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005849 if ( WLANTL_IS_MGMT_FRAME(ucFrmType)
5850#ifdef FEATURE_WLAN_TDLS_INTERNAL
5851 || (WLANTL_IS_TDLS_FRAME(usEtherType))
5852#endif
5853 )
Jeff Johnson295189b2012-06-20 16:38:30 -07005854 {
5855 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5856 "WLAN TL:Sending packet to management client"));
5857 if ( VOS_STATUS_SUCCESS != vos_pkt_flatten_rx_pkt(&vosTempBuff))
5858 {
5859 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5860 "WLAN TL:Cannot flatten packet - dropping"));
5861 /* Drop packet */
5862 vos_pkt_return_packet(vosTempBuff);
5863 vosTempBuff = vosDataBuff;
5864 continue;
5865 }
5866 ucSTAId = (v_U8_t)WDA_GET_RX_STAID( pvBDHeader );
5867 /* Read RSSI and update */
5868 if(!WLANTL_STA_ID_INVALID(ucSTAId))
5869 {
5870#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
5871 /* Read RSSI and update */
5872 vosStatus = WLANTL_HSHandleRXFrame(pvosGCtx,
5873 WLANTL_MGMT_FRAME_TYPE,
5874 pvBDHeader,
5875 ucSTAId,
5876 VOS_FALSE,
5877 NULL);
5878#else
5879 vosStatus = WLANTL_ReadRSSI(pvosGCtx, pvBDHeader, ucSTAId);
5880#endif
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05305881 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
5882 {
5883 TLLOGW(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5884 "Handle RX Management Frame fail within Handoff "
5885 "support module"));
5886 /* Do Not Drop packet at here
5887 * Revisit why HO module return fail
5888 * vos_pkt_return_packet(vosTempBuff);
5889 * vosTempBuff = vosDataBuff;
5890 * continue;
5891 */
5892 }
5893 vosStatus = WLANTL_ReadSNR(pvosGCtx, pvBDHeader, ucSTAId);
5894
5895 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
5896 {
5897 TLLOGW(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5898 FL("Failed to Read SNR")));
5899 }
Dino Mycle3b9536d2014-07-09 22:05:24 +05305900#ifdef WLAN_FEATURE_LINK_LAYER_STATS
5901 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
5902 if ( NULL != pClientSTA)
5903 {
5904 pClientSTA->interfaceStats.mgmtRx++;
Dino Mycle3b9536d2014-07-09 22:05:24 +05305905 }
5906#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005907 }
5908
Jeff Johnson295189b2012-06-20 16:38:30 -07005909 pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx( pvosGCtx, vosTempBuff);
5910 }
5911 else /* Data Frame */
5912 {
5913 ucSTAId = (v_U8_t)WDA_GET_RX_STAID( pvBDHeader );
5914 ucTid = (v_U8_t)WDA_GET_RX_TID( pvBDHeader );
Dino Mycle3b9536d2014-07-09 22:05:24 +05305915#ifdef WLAN_FEATURE_LINK_LAYER_STATS
5916 ac = WLANTL_TID_2_AC[ucTid];
5917#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005918
5919 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5920 "WLAN TL:Data packet received for STA %d", ucSTAId));
5921
5922 /*------------------------------------------------------------------
5923 This should be corrected when multipe sta support is added !!!
5924 for now bcast frames will be sent to the last registered STA
5925 ------------------------------------------------------------------*/
5926 if ( WDA_IS_RX_BCAST(pvBDHeader))
5927 {
5928 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5929 "WLAN TL:TL rx Bcast frame - sending to last registered station"));
5930 broadcast = VOS_TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005931 /*-------------------------------------------------------------------
5932 If Addr1 is b/mcast, but Addr3 is our own self MAC, it is a b/mcast
5933 pkt we sent looping back to us. To be dropped if we are non BTAMP
5934 -------------------------------------------------------------------*/
5935 if( WLANHAL_RX_BD_ADDR3_SELF_IDX ==
5936 (v_U8_t)WDA_GET_RX_ADDR3_IDX( pvBDHeader ))
5937 {
5938 selfBcastLoopback = VOS_TRUE;
5939 }
5940 }/*if bcast*/
5941
5942 if ( WLANTL_STA_ID_INVALID(ucSTAId) )
5943 {
5944 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5945 "WLAN TL:STA ID invalid - dropping pkt"));
5946 /* Drop packet */
5947 vos_pkt_return_packet(vosTempBuff);
5948 vosTempBuff = vosDataBuff;
5949 continue;
5950 }
5951
5952 /*----------------------------------------------------------------------
5953 No need to lock cache access because cache manipulation only happens
5954 in the transport thread/task context
5955 - These frames are to be forwarded to the station upon registration
5956 which happens in the main thread context
5957 The caching here can happen in either Tx or Rx thread depending
5958 on the current SSC scheduling
5959 - also we need to make sure that the frames in the cache are fwd-ed to
5960 the station before the new incoming ones
5961 -----------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305962 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
5963 if (NULL == pClientSTA)
5964 {
5965 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5966 "WLAN TL:STA not allocated memory. Dropping packet"));
5967 vos_pkt_return_packet(vosTempBuff);
5968 vosTempBuff = vosDataBuff;
5969 continue;
5970 }
5971
Hoonki Lee5305c3a2013-04-29 23:28:59 -07005972#ifdef FEATURE_WLAN_TDLS
5973 if (( pClientSTA->ucExists ) &&
5974 (WLAN_STA_TDLS == pClientSTA->wSTADesc.wSTAType) &&
5975 (pClientSTA->ucTxSuspended))
5976 vos_atomic_set_U8( &pClientSTA->ucTxSuspended, 0 );
5977 else if ( !broadcast && (pClientSTA->ucExists == 0 ) )
5978 {
5979 tpSirMacMgmtHdr pMacHeader = WDA_GET_RX_MAC_HEADER( pvBDHeader );
5980
5981 /* from the direct peer while it is not registered to TL yet */
5982 if ( (pMacHeader->fc.fromDS == 0) &&
5983 (pMacHeader->fc.toDS == 0) )
5984 {
5985 v_U8_t ucAddr3STAId;
5986
5987 ucAddr3STAId = WDA_GET_RX_ADDR3_IDX(pvBDHeader);
5988
5989 if ( WLANTL_STA_ID_INVALID(ucAddr3STAId) )
5990 {
5991 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5992 "WLAN TL:STA ID %d invalid - dropping pkt", ucAddr3STAId));
5993 /* Drop packet */
5994 vos_pkt_return_packet(vosTempBuff);
5995 vosTempBuff = vosDataBuff;
5996 continue;
5997 }
5998
5999 if (!(pTLCb->atlSTAClients[ucAddr3STAId] && pTLCb->atlSTAClients[ucAddr3STAId]->ucExists &&
6000 (WLAN_STA_INFRA == pTLCb->atlSTAClients[ucAddr3STAId]->wSTADesc.wSTAType) &&
6001 (WLANTL_STA_AUTHENTICATED == pTLCb->atlSTAClients[ucAddr3STAId]->tlState)))
6002 {
6003 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Arif Hussainf2b00992013-11-17 21:46:15 -08006004 "%s: staId %d addr3Id %d tlState %d. Unkown Receiver/Transmitter Dropping packet", __func__,
Hoonki Lee5305c3a2013-04-29 23:28:59 -07006005 ucSTAId, ucAddr3STAId, pTLCb->atlSTAClients[ucAddr3STAId]->tlState));
6006 vos_pkt_return_packet(vosTempBuff);
6007 vosTempBuff = vosDataBuff;
6008 continue;
6009 }
6010 else
6011 {
6012 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Arif Hussainf2b00992013-11-17 21:46:15 -08006013 "%s: staId %d doesn't exist, but mapped to AP staId %d", __func__,
Hoonki Lee5305c3a2013-04-29 23:28:59 -07006014 ucSTAId, ucAddr3STAId));
6015 ucSTAId = ucAddr3STAId;
6016 pClientSTA = pTLCb->atlSTAClients[ucAddr3STAId];
6017 }
6018 }
6019 }
6020#endif
6021
Katya Nigam63902932014-06-26 19:04:23 +05306022 if (( pClientSTA->enableCaching == 1 ) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07006023 /*Dont buffer Broadcast/Multicast frames. If AP transmits bursts of Broadcast/Multicast data frames,
6024 * libra buffers all Broadcast/Multicast packets after authentication with AP,
6025 * So it will lead to low resource condition in Rx Data Path.*/
Katya Nigam63902932014-06-26 19:04:23 +05306026 ( WDA_IS_RX_BCAST(pvBDHeader) == 0 ))
Jeff Johnson295189b2012-06-20 16:38:30 -07006027 {
Katya Nigam6201c3e2014-05-27 17:51:42 +05306028 if( WDA_IsSelfSTA(pvosGCtx,ucSTAId))
6029 {
6030 //drop packet for Self STA index
6031 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
6032 "%s: Packet dropped for Self STA with staId %d ", __func__, ucSTAId ));
6033
6034 vos_pkt_return_packet(vosTempBuff);
6035 vosTempBuff = vosDataBuff;
6036 continue;
6037 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006038 uDPUSig = WDA_GET_RX_DPUSIG( pvBDHeader );
6039 //Station has not yet been registered with TL - cache the frame
Hoonki Lee5305c3a2013-04-29 23:28:59 -07006040 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Arif Hussainf2b00992013-11-17 21:46:15 -08006041 "%s: staId %d exist %d tlState %d cache rx frame", __func__, ucSTAId,
Hoonki Lee5305c3a2013-04-29 23:28:59 -07006042 pClientSTA->ucExists, pClientSTA->tlState));
Jeff Johnson295189b2012-06-20 16:38:30 -07006043 WLANTL_CacheSTAFrame( pTLCb, ucSTAId, vosTempBuff, uDPUSig, broadcast, ucFrmType);
6044 vosTempBuff = vosDataBuff;
6045 continue;
6046 }
6047
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08006048#ifdef FEATURE_WLAN_ESE_UPLOAD
6049 if ((pClientSTA->wSTADesc.ucIsEseSta)|| broadcast)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07006050 {
6051 /*--------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08006052 Filter the IAPP frames for ESE connection;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07006053 if data it will return false and it
6054 will be routed through the regular data path
6055 --------------------------------------------------------------------*/
6056 if ( WLANTL_IsIAPPFrame(pvBDHeader,
6057 vosTempBuff))
6058 {
6059 bForwardIAPPwithLLC = VOS_TRUE;
6060 }
6061 }
6062#endif
6063
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08006064#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
6065 if ((pClientSTA->wSTADesc.ucIsEseSta)|| broadcast)
Jeff Johnson295189b2012-06-20 16:38:30 -07006066 {
6067 /*--------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08006068 Filter the IAPP frames for ESE connection;
Jeff Johnson295189b2012-06-20 16:38:30 -07006069 if data it will return false and it
6070 will be routed through the regular data path
6071 --------------------------------------------------------------------*/
6072 if ( WLANTL_IsIAPPFrame(pvBDHeader,
6073 vosTempBuff))
6074 {
6075 if ( VOS_STATUS_SUCCESS != vos_pkt_flatten_rx_pkt(&vosTempBuff))
6076 {
6077 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6078 "WLAN TL:Cannot flatten packet - dropping"));
6079 /* Drop packet */
6080 vos_pkt_return_packet(vosTempBuff);
6081 } else {
6082
6083 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08006084 "WLAN TL: Received ESE IAPP Frame"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006085
6086 pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx( pvosGCtx, vosTempBuff);
6087 }
6088 vosTempBuff = vosDataBuff;
6089 continue;
6090 }
6091 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08006092#endif /* defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD) */
Jeff Johnson295189b2012-06-20 16:38:30 -07006093
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306094 if ( WLAN_STA_BT_AMP == pClientSTA->wSTADesc.wSTAType )
Jeff Johnson295189b2012-06-20 16:38:30 -07006095 {
6096 /*--------------------------------------------------------------------
6097 Process the ctrl BAP frame; if data it will return false and it
6098 will be routed through the regular data path
6099 --------------------------------------------------------------------*/
6100 if ( WLANTL_ProcessBAPFrame( pvBDHeader,
6101 vosTempBuff,
6102 pTLCb,
6103 &first_data_pkt_arrived,
6104 ucSTAId))
6105 {
6106 vosTempBuff = vosDataBuff;
6107 continue;
6108 }
6109 }/*if BT-AMP station*/
6110 else if(selfBcastLoopback == VOS_TRUE)
6111 {
6112 /* Drop packet */
6113 vos_pkt_return_packet(vosTempBuff);
6114 vosTempBuff = vosDataBuff;
6115 continue;
6116 }
6117
6118 /*---------------------------------------------------------------------
6119 Data packet received, send to state machine
6120 ---------------------------------------------------------------------*/
6121 wSTAEvent = WLANTL_RX_EVENT;
6122
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306123 pfnSTAFsm = tlSTAFsm[pClientSTA->tlState].
Jeff Johnson295189b2012-06-20 16:38:30 -07006124 pfnSTATbl[wSTAEvent];
6125
6126 if ( NULL != pfnSTAFsm )
6127 {
6128#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
6129 /* Read RSSI and update */
6130 vosStatus = WLANTL_HSHandleRXFrame(pvosGCtx,
6131 WLANTL_DATA_FRAME_TYPE,
6132 pvBDHeader,
6133 ucSTAId,
6134 broadcast,
6135 vosTempBuff);
6136 broadcast = VOS_FALSE;
6137#else
6138 vosStatus = WLANTL_ReadRSSI(pvosGCtx, pvBDHeader, ucSTAId);
Kiet Lam47325522014-03-10 11:50:46 -07006139#endif
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05306140 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
Jeff Johnson295189b2012-06-20 16:38:30 -07006141 {
6142 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
6143 "Handle RX Data Frame fail within Handoff support module"));
6144 /* Do Not Drop packet at here
6145 * Revisit why HO module return fail
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05306146 * vos_pkt_return_packet(vosTempBuff);
6147 * vosTempBuff = vosDataBuff;
6148 * continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07006149 */
6150 }
Dino Mycle3b9536d2014-07-09 22:05:24 +05306151#ifdef WLAN_FEATURE_LINK_LAYER_STATS
6152 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
6153 if ( NULL != pClientSTA)
6154 {
6155 tpSirMacMgmtHdr pMacHeader = WDA_GET_RX_MAC_HEADER( pvBDHeader );
Mahesh A Saptasagarbbdcf122014-10-28 20:57:11 +05306156 if (!IS_BROADCAST_ADD(pMacHeader->da) && IS_MULTICAST_ADD(pMacHeader->da))
Dino Mycle3b9536d2014-07-09 22:05:24 +05306157 {
6158 pClientSTA->interfaceStats.accessCategoryStats[ac].rxMcast++;
6159 }
6160
6161 WLANTL_HSGetDataRSSI(pvosGCtx, pvBDHeader, ucSTAId,
6162 &currentAvgRSSI);
6163 pClientSTA->interfaceStats.rssiData = currentAvgRSSI;
6164
6165 pClientSTA->interfaceStats.accessCategoryStats[ac].rxMpdu++;
6166 if (WDA_IS_RX_AN_AMPDU (pvBDHeader))
6167 {
6168 pClientSTA->interfaceStats.accessCategoryStats[ac].rxAmpdu++;
6169 }
6170 }
6171
6172
6173#endif
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05306174 vosStatus = WLANTL_ReadSNR(pvosGCtx, pvBDHeader, ucSTAId);
6175
6176 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
6177 {
6178 TLLOGW(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
6179 FL("Failed to Read SNR")));
6180 }
6181
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07006182 pfnSTAFsm( pvosGCtx, ucSTAId, &vosTempBuff, bForwardIAPPwithLLC);
Jeff Johnson295189b2012-06-20 16:38:30 -07006183 }
6184 else
6185 {
6186 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
6187 "WLAN TL:NULL state function, STA:%d, State: %d- dropping packet",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306188 ucSTAId, pClientSTA->tlState));
Jeff Johnson295189b2012-06-20 16:38:30 -07006189 /* Drop packet */
6190 vos_pkt_return_packet(vosTempBuff);
6191 vosTempBuff = vosDataBuff;
6192 continue;
6193 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006194 }/* else data frame*/
6195
6196 vosTempBuff = vosDataBuff;
6197 }/*while chain*/
6198
6199 return VOS_STATUS_SUCCESS;
6200}/* WLANTL_RxFrames */
6201
Dino Mycle3b9536d2014-07-09 22:05:24 +05306202#ifdef WLAN_FEATURE_LINK_LAYER_STATS
6203/*==========================================================================
6204
6205 FUNCTION WLANTL_CollectInterfaceStats
6206
6207 DESCRIPTION
6208 Utility function used by TL to send the statitics
6209
6210 DEPENDENCIES
6211
6212
6213 PARAMETERS
6214
6215 IN
6216
6217 ucSTAId: station for which the statistics need to collected
6218
6219 vosDataBuff: it will contain the pointer to the corresponding
6220 structure
6221
6222 RETURN VALUE
6223 The result code associated with performing the operation
6224
6225 VOS_STATUS_E_INVAL: Input parameters are invalid
6226 VOS_STATUS_SUCCESS: Everything is good :)
6227
6228 SIDE EFFECTS
6229
6230============================================================================*/
6231VOS_STATUS
6232WLANTL_CollectInterfaceStats
6233(
6234 v_PVOID_t pvosGCtx,
6235 v_U8_t ucSTAId,
6236 WLANTL_InterfaceStatsType *vosDataBuff
6237)
6238{
6239 WLANTL_CbType* pTLCb = NULL;
6240 /*------------------------------------------------------------------------
6241 Sanity check
6242 ------------------------------------------------------------------------*/
6243 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
6244 {
6245 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6246 "WLAN TL:Invalid station id requested on WLANTL_CollectStats"));
6247 return VOS_STATUS_E_FAULT;
6248 }
6249 /*------------------------------------------------------------------------
6250 Extract TL control block
6251 ------------------------------------------------------------------------*/
6252 pTLCb = VOS_GET_TL_CB(pvosGCtx);
6253 if ( NULL == pTLCb )
6254 {
6255 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6256 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_CollectStats"));
6257 return VOS_STATUS_E_FAULT;
6258 }
6259
6260 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
6261 {
6262 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6263 "WLAN TL:Client Memory was not allocated on %s", __func__));
6264 return VOS_STATUS_E_FAILURE;
6265 }
Srinivas Dasari98947432014-11-07 19:41:24 +05306266 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6267 "WLAN TL: collect WIFI_STATS_IFACE results"));
6268
Dino Mycle3b9536d2014-07-09 22:05:24 +05306269 vos_mem_copy(vosDataBuff, &pTLCb->atlSTAClients[ucSTAId]->interfaceStats,
6270 sizeof(WLANTL_InterfaceStatsType));
6271 return VOS_STATUS_SUCCESS;
6272}
6273
Srinivas Dasari98947432014-11-07 19:41:24 +05306274/*==========================================================================
6275
6276 FUNCTION WLANTL_ClearInterfaceStats
6277
6278 DESCRIPTION
6279 Utility function used by TL to clear the statitics
6280
6281 DEPENDENCIES
6282
6283
6284 PARAMETERS
6285
6286 IN
6287
6288 ucSTAId: station for which the statistics need to collected
6289
6290 RETURN VALUE
6291 The result code associated with performing the operation
6292
6293 VOS_STATUS_E_INVAL: Input parameters are invalid
6294 VOS_STATUS_SUCCESS: Everything is good :)
6295
6296 SIDE EFFECTS
6297
6298============================================================================*/
6299VOS_STATUS
6300WLANTL_ClearInterfaceStats
6301(
6302 v_PVOID_t pvosGCtx,
6303 v_U8_t ucSTAId,
6304 v_U8_t statsClearReqMask
6305)
6306{
6307 WLANTL_CbType* pTLCb = NULL;
6308 WLANTL_STAClientType* pClientSTA = NULL;
6309 /*------------------------------------------------------------------------
6310 Sanity check
6311 ------------------------------------------------------------------------*/
6312 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
6313 {
6314 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6315 "WLAN TL:Invalid station id requested on WLANTL_CollectStats"));
6316 return VOS_STATUS_E_FAULT;
6317 }
6318 /*------------------------------------------------------------------------
6319 Extract TL control block
6320 ------------------------------------------------------------------------*/
6321 pTLCb = VOS_GET_TL_CB(pvosGCtx);
6322 if ( NULL == pTLCb )
6323 {
6324 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6325 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_CollectStats"));
6326 return VOS_STATUS_E_FAULT;
6327 }
6328
6329 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
6330 if ( NULL == pClientSTA )
6331 {
6332 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6333 "WLAN TL:Client Memory was not allocated on %s", __func__));
6334 return VOS_STATUS_E_FAILURE;
6335 }
6336
6337 if ((statsClearReqMask & WIFI_STATS_IFACE_AC) ||
6338 (statsClearReqMask & WIFI_STATS_IFACE)) {
6339 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6340 "WLAN TL:cleared WIFI_STATS_IFACE_AC results"));
6341 pClientSTA->interfaceStats.accessCategoryStats[0].rxMcast = 0;
6342 pClientSTA->interfaceStats.accessCategoryStats[1].rxMcast = 0;
6343 pClientSTA->interfaceStats.accessCategoryStats[2].rxMcast = 0;
6344 pClientSTA->interfaceStats.accessCategoryStats[3].rxMcast = 0;
6345
6346 pClientSTA->interfaceStats.accessCategoryStats[0].rxMpdu = 0;
6347 pClientSTA->interfaceStats.accessCategoryStats[1].rxMpdu = 0;
6348 pClientSTA->interfaceStats.accessCategoryStats[2].rxMpdu = 0;
6349 pClientSTA->interfaceStats.accessCategoryStats[3].rxMpdu = 0;
6350
6351 pClientSTA->interfaceStats.accessCategoryStats[0].rxAmpdu = 0;
6352 pClientSTA->interfaceStats.accessCategoryStats[1].rxAmpdu = 0;
6353 pClientSTA->interfaceStats.accessCategoryStats[2].rxAmpdu = 0;
6354 pClientSTA->interfaceStats.accessCategoryStats[3].rxAmpdu = 0;
6355 }
6356
6357 if (statsClearReqMask & WIFI_STATS_IFACE) {
6358 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6359 "WLAN TL:cleared WIFI_STATS_IFACE results"));
6360 pClientSTA->interfaceStats.mgmtRx = 0;
6361 pClientSTA->interfaceStats.rssiData = 0;
6362 return VOS_STATUS_SUCCESS;
6363 }
6364
6365 return VOS_STATUS_SUCCESS;
6366}
6367
Dino Mycle3b9536d2014-07-09 22:05:24 +05306368#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
Jeff Johnson295189b2012-06-20 16:38:30 -07006369
6370/*==========================================================================
6371
6372 FUNCTION WLANTL_RxCachedFrames
6373
6374 DESCRIPTION
6375 Utility function used by TL to forward the cached frames to a particular
6376 station;
6377
6378 DEPENDENCIES
6379 TL must be initiailized before this function gets called.
6380 If the frame carried is a data frame then the station for which it is
6381 destined to must have been previously registered with TL.
6382
6383 PARAMETERS
6384
6385 IN
6386 pTLCb: pointer to TL handle
6387
6388 ucSTAId: station for which we need to forward the packets
6389
6390 vosDataBuff: it will contain a pointer to the first cached buffer
6391 received, if there is more then one packet they will be
6392 chained using vOSS buffers.
6393
6394 RETURN VALUE
6395 The result code associated with performing the operation
6396
6397 VOS_STATUS_E_INVAL: Input parameters are invalid
6398 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
6399 page fault
6400 VOS_STATUS_SUCCESS: Everything is good :)
6401
6402 SIDE EFFECTS
6403
6404============================================================================*/
6405VOS_STATUS
6406WLANTL_RxCachedFrames
6407(
6408 WLANTL_CbType* pTLCb,
6409 v_U8_t ucSTAId,
6410 vos_pkt_t* vosDataBuff
6411)
6412{
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306413 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006414 WLANTL_STAFuncType pfnSTAFsm;
6415 vos_pkt_t* vosTempBuff;
6416 VOS_STATUS vosStatus;
6417 v_PVOID_t pvBDHeader = NULL;
6418 WLANTL_STAEventType wSTAEvent = WLANTL_RX_EVENT;
6419 v_U8_t ucTid = 0;
6420 v_BOOL_t broadcast = VOS_FALSE;
6421 v_BOOL_t bSigMatch = VOS_FALSE;
6422 v_BOOL_t selfBcastLoopback = VOS_FALSE;
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -07006423 static v_U8_t first_data_pkt_arrived;
Jeff Johnson295189b2012-06-20 16:38:30 -07006424 v_U32_t uDPUSig;
6425 v_U8_t ucUcastSig;
6426 v_U8_t ucBcastSig;
6427 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
6428
6429 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6430 "WLAN TL:TL Receive Cached Frames called"));
6431
6432 /*------------------------------------------------------------------------
6433 Sanity check
6434 ------------------------------------------------------------------------*/
6435 if ( NULL == vosDataBuff )
6436 {
6437 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6438 "WLAN TL:Invalid parameter sent on WLANTL_RxFrames"));
6439 return VOS_STATUS_E_INVAL;
6440 }
6441
Mihir Sheteae6f02b2014-04-11 19:49:21 +05306442 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
6443
6444 if ( NULL == pClientSTA )
6445 {
6446 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6447 "WLAN TL:Client Memory was not allocated on %s", __func__));
6448 return VOS_STATUS_E_FAILURE;
6449 }
6450
6451 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_FORWARD_CACHED_FRAMES,
6452 ucSTAId, 1<<16 | pClientSTA->tlCacheInfo.cacheSize));
6453
Jeff Johnson295189b2012-06-20 16:38:30 -07006454 /*---------------------------------------------------------------------
6455 Save the initial buffer - this is the first received buffer
6456 ---------------------------------------------------------------------*/
6457 vosTempBuff = vosDataBuff;
6458
6459 while ( NULL != vosTempBuff )
6460 {
Madan Mohan Koyyalamudia148e1e2012-11-30 14:52:59 -08006461 broadcast = VOS_FALSE;
6462 selfBcastLoopback = VOS_FALSE;
6463
Jeff Johnson295189b2012-06-20 16:38:30 -07006464 vos_pkt_walk_packet_chain( vosDataBuff, &vosDataBuff, 1/*true*/ );
6465
6466 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6467 "WLAN TL:Sending new cached packet to station %d", ucSTAId));
6468 /*---------------------------------------------------------------------
6469 Peek at BD header - do not remove
6470 !!! Optimize me: only part of header is needed; not entire one
6471 ---------------------------------------------------------------------*/
6472 vosStatus = WDA_DS_PeekRxPacketInfo( vosTempBuff, (v_PVOID_t)&pvBDHeader, 0 );
6473
6474 if ( NULL == pvBDHeader )
6475 {
6476 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6477 "WLAN TL:Cannot extract BD header"));
6478 /* Drop packet */
6479 vos_pkt_return_packet(vosTempBuff);
6480 vosTempBuff = vosDataBuff;
6481 continue;
6482 }
6483
6484 uDPUSig = WDA_GET_RX_DPUSIG( pvBDHeader );
6485
6486 /* AMSDU HW bug fix
6487 * After 2nd AMSDU subframe HW could not handle BD correctly
6488 * HAL workaround is needed */
6489 if(WDA_GET_RX_ASF(pvBDHeader))
6490 {
6491 WDA_DS_RxAmsduBdFix(vos_get_global_context(VOS_MODULE_ID_TL,pTLCb),
6492 pvBDHeader);
6493 }
6494
6495 ucTid = (v_U8_t)WDA_GET_RX_TID( pvBDHeader );
6496
6497 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6498 "WLAN TL:Data packet cached for STA %d", ucSTAId);
6499
6500 /*------------------------------------------------------------------
6501 This should be corrected when multipe sta support is added !!!
6502 for now bcast frames will be sent to the last registered STA
6503 ------------------------------------------------------------------*/
6504 if ( WDA_IS_RX_BCAST(pvBDHeader))
6505 {
6506 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6507 "WLAN TL:TL rx Bcast frame "));
6508 broadcast = VOS_TRUE;
6509
6510 /* If Addr1 is b/mcast, but Addr3 is our own self MAC, it is a b/mcast
6511 * pkt we sent looping back to us. To be dropped if we are non BTAMP
6512 */
6513 if( WLANHAL_RX_BD_ADDR3_SELF_IDX ==
6514 (v_U8_t)WDA_GET_RX_ADDR3_IDX( pvBDHeader ))
6515 {
6516 selfBcastLoopback = VOS_TRUE;
6517 }
6518 }/*if bcast*/
6519
6520 /*-------------------------------------------------------------------------
6521 Check if the packet that we cached matches the DPU signature of the
6522 newly added station
6523 -------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306524 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
6525
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306526 if ( NULL == pClientSTA )
6527 {
6528 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6529 "WLAN TL:Client Memory was not allocated on %s", __func__));
6530 return VOS_STATUS_E_FAILURE;
6531 }
6532
Jeff Johnson295189b2012-06-20 16:38:30 -07006533 if ( broadcast )
6534 {
6535 ucBcastSig = (v_U8_t)uDPUSig;
6536 bSigMatch = (( WLAN_TL_INVALID_B_SIG !=
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306537 pClientSTA->wSTADesc.ucBcastSig ) &&
6538 ( ucBcastSig == pClientSTA->wSTADesc.ucBcastSig ));
Jeff Johnson295189b2012-06-20 16:38:30 -07006539 }
6540 else
6541 {
6542 ucUcastSig = (v_U8_t)uDPUSig;
6543 bSigMatch = (( WLAN_TL_INVALID_U_SIG !=
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306544 pClientSTA->wSTADesc.ucUcastSig ) &&
6545 ( ucUcastSig == pClientSTA->wSTADesc.ucUcastSig ));
Jeff Johnson295189b2012-06-20 16:38:30 -07006546 }
6547
6548 /*-------------------------------------------------------------------------
6549 If the packet doesn't match - drop it
6550 -------------------------------------------------------------------------*/
6551 if ( !bSigMatch )
6552 {
Rajesh Chauhana6b08f42013-06-18 19:01:26 -07006553 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_MED,
Jeff Johnson295189b2012-06-20 16:38:30 -07006554 "WLAN TL: Cached packet does not match DPU Sig of the new STA - drop "
6555 " DPU Sig %d UC %d BC %d B %d",
6556 uDPUSig,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306557 pClientSTA->wSTADesc.ucUcastSig,
Rajesh Chauhana6b08f42013-06-18 19:01:26 -07006558 pClientSTA->wSTADesc.ucBcastSig,
Jeff Johnson295189b2012-06-20 16:38:30 -07006559 broadcast));
6560
6561 /* Drop packet */
6562 vos_pkt_return_packet(vosTempBuff);
6563 vosTempBuff = vosDataBuff;
6564 continue;
6565
6566 }/*if signature mismatch*/
6567
6568 /*------------------------------------------------------------------------
6569 Check if BT-AMP frame:
6570 - additional processing needed in this case to separate BT-AMP date
6571 from BT-AMP Ctrl path
6572 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306573 if ( WLAN_STA_BT_AMP == pClientSTA->wSTADesc.wSTAType )
Jeff Johnson295189b2012-06-20 16:38:30 -07006574 {
6575 /*--------------------------------------------------------------------
6576 Process the ctrl BAP frame; if data it will return false and it
6577 will be routed through the regular data path
6578 --------------------------------------------------------------------*/
6579 if ( WLANTL_ProcessBAPFrame( pvBDHeader,
6580 vosTempBuff,
6581 pTLCb,
6582 &first_data_pkt_arrived,
6583 ucSTAId))
6584 {
6585 vosTempBuff = vosDataBuff;
6586 continue;
6587 }
6588 }/*if BT-AMP station*/
6589 else if(selfBcastLoopback == VOS_TRUE)
6590 {
6591 /* Drop packet */
6592 vos_pkt_return_packet(vosTempBuff);
6593 vosTempBuff = vosDataBuff;
6594 continue;
6595 }
6596
6597 /*---------------------------------------------------------------------
6598 Data packet received, send to state machine
6599 ---------------------------------------------------------------------*/
6600 wSTAEvent = WLANTL_RX_EVENT;
6601
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306602 pfnSTAFsm = tlSTAFsm[pClientSTA->tlState].
Jeff Johnson295189b2012-06-20 16:38:30 -07006603 pfnSTATbl[wSTAEvent];
6604
6605 if ( NULL != pfnSTAFsm )
6606 {
6607#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
6608 /* Read RSSI and update */
6609 vosStatus = WLANTL_HSHandleRXFrame(vos_get_global_context(
6610 VOS_MODULE_ID_TL,pTLCb),
6611 WLANTL_DATA_FRAME_TYPE,
6612 pvBDHeader,
6613 ucSTAId,
6614 broadcast,
6615 vosTempBuff);
6616 broadcast = VOS_FALSE;
6617#else
6618 vosStatus = WLANTL_ReadRSSI(vos_get_global_context(VOS_MODULE_ID_TL,pTLCb), pvBDHeader, ucSTAId);
Kiet Lam47325522014-03-10 11:50:46 -07006619#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07006620 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
6621 {
6622 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6623 "Handle RX Data Frame fail within Handoff support module"));
6624 /* Do Not Drop packet at here
6625 * Revisit why HO module return fail
6626 vos_pkt_return_packet(vosTempBuff);
6627 vosTempBuff = vosDataBuff;
6628 continue;
6629 */
6630 }
6631 pfnSTAFsm( vos_get_global_context(VOS_MODULE_ID_TL,pTLCb), ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07006632 &vosTempBuff, VOS_FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07006633 }
6634 else
6635 {
6636 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6637 "WLAN TL:NULL state function, STA:%d, State: %d- dropping packet",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306638 ucSTAId, pClientSTA->tlState));
Jeff Johnson295189b2012-06-20 16:38:30 -07006639 /* Drop packet */
6640 vos_pkt_return_packet(vosTempBuff);
6641 vosTempBuff = vosDataBuff;
6642 continue;
6643 }
6644
6645 vosTempBuff = vosDataBuff;
6646 }/*while chain*/
6647
6648 return VOS_STATUS_SUCCESS;
6649}/* WLANTL_RxCachedFrames */
6650
6651/*==========================================================================
Katya Nigam664f5032014-05-05 12:24:32 +05306652 FUNCTION WLANTL_RxProcessMsg
6653
6654 DESCRIPTION
6655 Called by VOSS when a message was serialized for TL through the
6656 rx thread/task.
6657
6658 DEPENDENCIES
6659 The TL must be initialized before this function can be called.
6660
6661 PARAMETERS
6662
6663 IN
6664 pvosGCtx: pointer to the global vos context; a handle to TL's
6665 control block can be extracted from its context
6666 message: type and content of the message
6667
6668
6669 RETURN VALUE
6670 The result code associated with performing the operation
6671
6672 VOS_STATUS_E_INVAL: invalid input parameters
6673 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
6674 page fault
6675 VOS_STATUS_SUCCESS: Everything is good :)
6676
6677 Other values can be returned as a result of a function call, please check
6678 corresponding API for more info.
6679 SIDE EFFECTS
6680
6681============================================================================*/
6682VOS_STATUS
6683WLANTL_RxProcessMsg
6684(
6685 v_PVOID_t pvosGCtx,
6686 vos_msg_t* message
6687)
6688{
6689 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6690 v_U32_t uData;
6691 v_U8_t ucSTAId;
6692 v_U8_t ucUcastSig;
6693 v_U8_t ucBcastSig;
6694
6695 /*------------------------------------------------------------------------
6696 Sanity check
6697 ------------------------------------------------------------------------*/
6698 if ( NULL == message )
6699 {
6700 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6701 "WLAN TL:Invalid parameter sent on WLANTL_RxProcessMessage"));
6702 return VOS_STATUS_E_INVAL;
6703 }
6704
6705 /*------------------------------------------------------------------------
6706 Process message
6707 ------------------------------------------------------------------------*/
6708 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6709 "WLAN TL:Received message: %d through rx flow", message->type));
6710
6711 switch( message->type )
6712 {
6713
6714 case WLANTL_RX_FWD_CACHED:
6715 /*---------------------------------------------------------------------
6716 The data sent with the message has the following structure:
6717 | 00 | ucBcastSignature | ucUcastSignature | ucSTAID |
6718 each field above is one byte
6719 ---------------------------------------------------------------------*/
6720 uData = message->bodyval;
6721 ucSTAId = ( uData & 0x000000FF);
6722 ucUcastSig = ( uData & 0x0000FF00)>>8;
6723 ucBcastSig = (v_U8_t)(( uData & 0x00FF0000)>>16);
6724 vosStatus = WLANTL_ForwardSTAFrames( pvosGCtx, ucSTAId,
6725 ucUcastSig, ucBcastSig);
6726 break;
6727
6728 default:
6729 /*no processing for now*/
6730 break;
6731 }
6732
6733 return VOS_STATUS_SUCCESS;
6734}
6735
6736
6737/*==========================================================================
Jeff Johnson295189b2012-06-20 16:38:30 -07006738 FUNCTION WLANTL_ResourceCB
6739
6740 DESCRIPTION
6741 Called by the TL when it has packets available for transmission.
6742
6743 DEPENDENCIES
6744 The TL must be registered with BAL before this function can be called.
6745
6746 PARAMETERS
6747
6748 IN
6749 pvosGCtx: pointer to the global vos context; a handle to TL's
6750 or BAL's control block can be extracted from its context
6751
6752 RETURN VALUE
6753 The result code associated with performing the operation
6754
6755 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
6756 page fault
6757 VOS_STATUS_SUCCESS: Everything is good :)
6758
6759 SIDE EFFECTS
6760
6761============================================================================*/
6762VOS_STATUS
6763WLANTL_ResourceCB
6764(
6765 v_PVOID_t pvosGCtx,
6766 v_U32_t uCount
6767)
6768{
6769 WLANTL_CbType* pTLCb = NULL;
6770 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
6771
6772 /*------------------------------------------------------------------------
6773 Sanity check
6774 Extract TL control block
6775 ------------------------------------------------------------------------*/
6776 pTLCb = VOS_GET_TL_CB(pvosGCtx);
6777 if ( NULL == pTLCb )
6778 {
6779 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6780 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
6781 return VOS_STATUS_E_FAULT;
6782 }
6783
6784 pTLCb->uResCount = uCount;
6785
6786
6787 /*-----------------------------------------------------------------------
6788 Resume Tx if enough res and not suspended
6789 -----------------------------------------------------------------------*/
6790 if (( pTLCb->uResCount >= WDA_TLI_MIN_RES_MF ) &&
6791 ( 0 == pTLCb->ucTxSuspended ))
6792 {
6793 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6794 "WLAN TL:Issuing Xmit start request to BAL for avail res ASYNC"));
6795 return WDA_DS_StartXmit(pvosGCtx);
6796 }
6797
6798 return VOS_STATUS_SUCCESS;
6799}/* WLANTL_ResourceCB */
6800
6801
Gopichand Nakkala11acd112012-12-31 16:04:04 -08006802/*==========================================================================
6803 FUNCTION WLANTL_IsTxXmitPending
6804
6805 DESCRIPTION
6806 Called by the WDA when it wants to know whether WDA_DS_TX_START_XMIT msg
6807 is pending in TL msg queue
6808
6809 DEPENDENCIES
6810 The TL must be registered with WDA before this function can be called.
6811
6812 PARAMETERS
6813
6814 IN
6815 pvosGCtx: pointer to the global vos context; a handle to TL's
6816 or WDA's control block can be extracted from its context
6817
6818 RETURN VALUE
6819 The result code associated with performing the operation
6820
6821 0: No WDA_DS_TX_START_XMIT msg pending
6822 1: Msg WDA_DS_TX_START_XMIT already pending in TL msg queue
6823
6824 SIDE EFFECTS
6825
6826============================================================================*/
6827v_BOOL_t
6828WLANTL_IsTxXmitPending
6829(
6830 v_PVOID_t pvosGCtx
6831)
6832{
6833
6834 WLANTL_CbType* pTLCb = NULL;
6835 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
6836
6837 /*------------------------------------------------------------------------
6838 Sanity check
6839 Extract TL control block
6840 ------------------------------------------------------------------------*/
6841 pTLCb = VOS_GET_TL_CB(pvosGCtx);
6842 if ( NULL == pTLCb )
6843 {
6844 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
6845 "WLAN TL:Invalid TL pointer from pvosGCtx in WLANTL_IsTxXmitPending "));
6846 return FALSE;
6847 }
6848
6849 return pTLCb->isTxTranmitMsgPending;
6850
6851}/*WLANTL_IsTxXmitPending */
6852
6853/*==========================================================================
6854 FUNCTION WLANTL_SetTxXmitPending
6855
6856 DESCRIPTION
6857 Called by the WDA when it wants to indicate that WDA_DS_TX_START_XMIT msg
6858 is pending in TL msg queue
6859
6860 DEPENDENCIES
6861 The TL must be registered with WDA before this function can be called.
6862
6863 PARAMETERS
6864
6865 IN
6866 pvosGCtx: pointer to the global vos context; a handle to TL's
6867 or WDA's control block can be extracted from its context
6868
6869 RETURN VALUE None
6870
6871 SIDE EFFECTS
6872
6873============================================================================*/
6874
6875v_VOID_t
6876WLANTL_SetTxXmitPending
6877(
6878 v_PVOID_t pvosGCtx
6879)
6880{
6881
6882 WLANTL_CbType* pTLCb = NULL;
6883 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
6884
6885 /*------------------------------------------------------------------------
6886 Sanity check
6887 Extract TL control block
6888 ------------------------------------------------------------------------*/
6889 pTLCb = VOS_GET_TL_CB(pvosGCtx);
6890 if ( NULL == pTLCb )
6891 {
6892 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
6893 "WLAN TL:Invalid TL pointer from pvosGCtx in WLANTL_SetTxXmitPending"));
6894 return;
6895 }
6896
6897 pTLCb->isTxTranmitMsgPending = 1;
6898 return;
6899
6900}/*WLANTL_SetTxXmitPending */
6901
6902/*==========================================================================
6903 FUNCTION WLANTL_ClearTxXmitPending
6904
6905 DESCRIPTION
6906 Called by the WDA when it wants to indicate that no WDA_DS_TX_START_XMIT msg
6907 is pending in TL msg queue
6908
6909 DEPENDENCIES
6910 The TL must be registered with WDA before this function can be called.
6911
6912 PARAMETERS
6913
6914 IN
6915 pvosGCtx: pointer to the global vos context; a handle to TL's
6916 or WDA's control block can be extracted from its context
6917
6918 RETURN VALUE None
6919
6920 SIDE EFFECTS
6921
6922============================================================================*/
6923
6924v_VOID_t
6925WLANTL_ClearTxXmitPending
6926(
6927 v_PVOID_t pvosGCtx
6928)
6929{
6930
6931 WLANTL_CbType* pTLCb = NULL;
6932 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
6933
6934 /*------------------------------------------------------------------------
6935 Sanity check
6936 Extract TL control block
6937 ------------------------------------------------------------------------*/
6938 pTLCb = VOS_GET_TL_CB(pvosGCtx);
6939 if ( NULL == pTLCb )
6940 {
6941 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
6942 "WLAN TL:Invalid TL pointer from pvosGCtx in WLANTL_ClearTxXmitPending "));
6943 return;
6944 }
6945
6946 pTLCb->isTxTranmitMsgPending = 0;
6947 return;
6948}/*WLANTL_ClearTxXmitPending */
6949
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05306950/*==========================================================================
6951 FUNCTION WLANTL_TxThreadDebugHandler
6952
6953 DESCRIPTION
6954 Printing TL Snapshot dump, processed under TxThread context, currently
6955 information regarding the global TlCb struture. Dumps information related
6956 to per active STA connection currently in use by TL.
6957
6958 DEPENDENCIES
6959 The TL must be initialized before this gets called.
6960
6961 PARAMETERS
6962
6963 IN
6964 pvosGCtx: pointer to the global vos context; a handle to TL's
6965 or WDA's control block can be extracted from its context
6966
6967 RETURN VALUE None
6968
6969 SIDE EFFECTS
6970
6971============================================================================*/
6972
6973v_VOID_t
6974WLANTL_TxThreadDebugHandler
6975(
6976 v_PVOID_t *pVosContext
6977)
6978{
6979 WLANTL_CbType* pTLCb = NULL;
6980 WLANTL_STAClientType* pClientSTA = NULL;
6981 int i = 0;
Mihir Shete5d148f12014-12-16 17:54:49 +05306982 v_U8_t uFlowMask; // TX FlowMask from WDA
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05306983
6984 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
6985 "WLAN TL: %s Enter ", __func__));
6986
6987 pTLCb = VOS_GET_TL_CB(pVosContext);
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05306988
6989 if ( NULL == pVosContext || NULL == pTLCb )
6990 {
6991 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6992 "Global VoS Context or TL Context are NULL"));
6993 return;
6994 }
6995
Mihir Shete5d148f12014-12-16 17:54:49 +05306996 if (VOS_STATUS_SUCCESS == WDA_DS_GetTxFlowMask(pVosContext, &uFlowMask))
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05306997 {
6998 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Mihir Shete5d148f12014-12-16 17:54:49 +05306999 "WDA uTxFlowMask: 0x%x", uFlowMask));
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307000 }
Mihir Shete5d148f12014-12-16 17:54:49 +05307001
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307002 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7003 "************************TL DUMP INFORMATION**************"));
7004
7005 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7006 "uDelayedTriggerFrmInt:%d\tuMinFramesProcThres:%d",
7007 pTLCb->tlConfigInfo.uDelayedTriggerFrmInt,
7008 pTLCb->tlConfigInfo.uMinFramesProcThres));
7009
7010 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7011 "Management Frame Client exists: %d",
7012 pTLCb->tlMgmtFrmClient.ucExists));
7013 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7014 "usPendingTxCompleteCount: %d\tucTxSuspended: %d",
7015 pTLCb->usPendingTxCompleteCount,
7016 pTLCb->ucTxSuspended));
7017
7018 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7019 "uResCount: %d", pTLCb->uResCount));
7020
7021 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7022 "ucRegisteredStaId: %d\tucCurrentSTA: %d",
7023 pTLCb->ucRegisteredStaId, pTLCb->ucCurrentSTA));
7024
7025 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7026 "UrgentFrameProcessing: %s\tuFramesProcThres: %d",
7027 (pTLCb->bUrgent?"True":"False"), pTLCb->uFramesProcThres));
7028
7029 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7030 "isTxTranmitMsgPending: %d\t isBMPS: %s",
7031 pTLCb->isTxTranmitMsgPending, pTLCb->isBMPS?"True":"False"));
7032
7033#ifdef FEATURE_WLAN_TDLS
7034 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7035 "TDLS Peer Count: %d", pTLCb->ucTdlsPeerCount));
7036#endif
7037
7038 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7039 "++++++++++++++++++++Registerd Client Information++++++++++"));
7040
7041 for ( i =0; i<WLAN_MAX_STA_COUNT; i++ )
7042 {
7043 pClientSTA = pTLCb->atlSTAClients[i];
7044 if( NULL == pClientSTA || 0 == pClientSTA->ucExists)
7045 {
7046 continue;
7047 }
7048
7049 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7050 "######################STA Index: %d ############################",i));
7051 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "WLAN_STADescType:"));
7052 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7053 "STAId: %d\t STA MAC Address: %pM", pClientSTA->wSTADesc.ucSTAId,
7054 pClientSTA->wSTADesc.vSTAMACAddress.bytes));
7055 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7056 "STA Type: %d\tProtectedFrame: %d",
7057 pClientSTA->wSTADesc.wSTAType, pClientSTA->wSTADesc.ucProtectedFrame));
7058 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7059 "QoS: %d\tRxFrameTrans: %d\tTxFrameTrans: %d",
7060 pClientSTA->wSTADesc.ucQosEnabled, pClientSTA->wSTADesc.ucSwFrameRXXlation,
7061 pClientSTA->wSTADesc.ucSwFrameTXXlation));
7062 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7063 "ucUcastSig: %d\tucBcastSig: %d", pClientSTA->wSTADesc.ucUcastSig,
7064 pClientSTA->wSTADesc.ucBcastSig));
7065
7066 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7067 "ClientIndex: %d\t Exists: %d", i, pClientSTA->ucExists));
7068 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7069 "TL State: %d\t TL Priority: %d", pClientSTA->tlState,
7070 pClientSTA->tlPri));
7071 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7072 "ucTxSuspended: %d\tucPktPending: %d", pClientSTA->ucTxSuspended,
7073 pClientSTA->ucPktPending));
7074 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7075 "ucEAPOLPktPending: %d\tucNoMoreData: %d",
7076 pClientSTA->ucEapolPktPending, pClientSTA->ucNoMoreData));
7077 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Katya Nigam63902932014-06-26 19:04:23 +05307078 "enableCaching: %d\t fcStaTxDisabled: %d", pClientSTA->enableCaching,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307079 pClientSTA->fcStaTxDisabled));
7080 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7081 "ucCurrentAC: %d\tucServicedAC: %d", pClientSTA->ucCurrentAC,
7082 pClientSTA->ucServicedAC));
7083 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7084 "TID: %d\tautTxCount[0]: %d\tauRxCount[0]: %d",0, pClientSTA->auTxCount[0],
7085 pClientSTA->auRxCount[0]));
7086 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7087 "aucAcMask[0]: %d\taucAcMask[1]: %d\taucAcMask[2]: %d\taucAcMask[3]: %d\t",
7088 pClientSTA->aucACMask[0], pClientSTA->aucACMask[1],
7089 pClientSTA->aucACMask[2], pClientSTA->aucACMask[3]));
7090 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7091 "ucCurrentWeight: %d", pClientSTA->ucCurrentWeight));
7092
7093 if( WLAN_STA_SOFTAP == pClientSTA->wSTADesc.wSTAType)
7094 {
7095 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7096 "TrafficStatistics for SOFTAP Station:"));
7097 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7098 "RUF=%d\tRMF=%d\tRBF=%d", pClientSTA->trafficStatistics.rxUCFcnt,
7099 pClientSTA->trafficStatistics.rxMCFcnt,
7100 pClientSTA->trafficStatistics.rxBCFcnt));
7101 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7102 "RUB=%d\tRMB=%d\tRBB=%d", pClientSTA->trafficStatistics.rxUCBcnt,
7103 pClientSTA->trafficStatistics.rxMCBcnt,
7104 pClientSTA->trafficStatistics.rxBCBcnt));
7105 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7106 "TUF=%d\tTMF=%d\tTBF=%d", pClientSTA->trafficStatistics.txUCFcnt,
7107 pClientSTA->trafficStatistics.txMCFcnt,
7108 pClientSTA->trafficStatistics.txBCFcnt));
7109 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7110 "TUB=%d\tTMB=%d\tTBB=%d", pClientSTA->trafficStatistics.txUCBcnt,
7111 pClientSTA->trafficStatistics.txMCBcnt,
7112 pClientSTA->trafficStatistics.txBCBcnt));
7113 }
7114 }
7115 return;
7116}
7117
7118/*==========================================================================
Mihir Shetefd62d9d2014-08-06 15:08:21 +05307119 FUNCTION WLANTL_FatalErrorHandler
7120
7121 DESCRIPTION
7122 Handle Fatal errors detected on the TX path.
7123 Currently issues SSR to recover from the error.
7124
7125 DEPENDENCIES
7126 The TL must be initialized before this gets called.
7127
7128 PARAMETERS
7129
7130 IN
7131 pvosGCtx: pointer to the global vos context; a handle to TL's
7132 or WDA's control block can be extracted from its context
7133
7134 RETURN VALUE None
7135
7136 SIDE EFFECTS
7137
7138============================================================================*/
7139v_VOID_t
7140WLANTL_FatalErrorHandler
7141(
7142 v_PVOID_t *pVosContext
7143)
7144{
7145
7146 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
7147 "WLAN TL: %s Enter ", __func__));
7148
7149 if ( NULL == pVosContext )
7150 {
7151 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7152 "%s: Global VoS Context or TL Context are NULL",
7153 __func__));
7154 return;
7155 }
7156
7157 /*
7158 * Issue SSR. vos_wlanRestart has tight checks to make sure that
7159 * we do not send an FIQ if previous FIQ is not processed
7160 */
7161 vos_wlanRestart();
7162}
7163
7164/*==========================================================================
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307165 FUNCTION WLANTL_TLDebugMessage
7166
7167 DESCRIPTION
7168 Post a TL Snapshot request, posts message in TxThread.
7169
7170 DEPENDENCIES
7171 The TL must be initialized before this gets called.
7172
7173 PARAMETERS
7174
7175 IN
7176 displaySnapshot Boolean showing whether to dump the snapshot or not.
7177
7178 RETURN VALUE None
7179
7180 SIDE EFFECTS
7181
7182============================================================================*/
7183
7184v_VOID_t
7185WLANTL_TLDebugMessage
7186(
Mihir Shete327c2ab2014-11-13 15:17:02 +05307187 v_U32_t debugFlags
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307188)
7189{
7190 vos_msg_t vosMsg;
7191 VOS_STATUS status;
7192
Mihir Shete327c2ab2014-11-13 15:17:02 +05307193 if(debugFlags & WLANTL_DEBUG_TX_SNAPSHOT)
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307194 {
7195 vosMsg.reserved = 0;
7196 vosMsg.bodyptr = NULL;
7197 vosMsg.type = WLANTL_TX_SNAPSHOT;
7198
7199 status = vos_tx_mq_serialize( VOS_MODULE_ID_TL, &vosMsg);
7200 if(status != VOS_STATUS_SUCCESS)
7201 {
7202 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "TX Msg Posting Failed with status: %d",status));
7203 return;
7204 }
7205 }
Mihir Shete327c2ab2014-11-13 15:17:02 +05307206 if (debugFlags & WLANTL_DEBUG_FW_CLEANUP)
7207 {
7208 vosMsg.reserved = 0;
7209 vosMsg.bodyptr = NULL;
7210 vosMsg.type = WLANTL_TX_FW_DEBUG;
7211
7212 status = vos_tx_mq_serialize( VOS_MODULE_ID_TL, &vosMsg);
7213 if(status != VOS_STATUS_SUCCESS)
7214 {
7215 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "TX Msg Posting Failed with status: %d",status));
7216 return;
7217 }
7218 }
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307219 return;
7220}
Jeff Johnson295189b2012-06-20 16:38:30 -07007221
Mihir Shetefd62d9d2014-08-06 15:08:21 +05307222/*==========================================================================
7223 FUNCTION WLANTL_FatalError
7224
7225 DESCRIPTION
7226 Fatal error reported in TX path, post an event to TX Thread for further
7227 handling
7228
7229 DEPENDENCIES
7230 The TL must be initialized before this gets called.
7231
7232 PARAMETERS
7233
7234 VOID
7235
7236 RETURN VALUE None
7237
7238 SIDE EFFECTS
7239
7240============================================================================*/
7241
7242v_VOID_t
7243WLANTL_FatalError
7244(
7245 v_VOID_t
7246)
7247{
7248 vos_msg_t vosMsg;
7249 VOS_STATUS status;
7250
7251 vosMsg.reserved = 0;
7252 vosMsg.bodyptr = NULL;
7253 vosMsg.type = WLANTL_TX_FATAL_ERROR;
7254
7255 status = vos_tx_mq_serialize( VOS_MODULE_ID_TL, &vosMsg);
7256 if(status != VOS_STATUS_SUCCESS)
7257 {
7258 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7259 "%s: TX Msg Posting Failed with status: %d",
7260 __func__,status));
7261 }
7262 return;
7263}
Jeff Johnson295189b2012-06-20 16:38:30 -07007264/*============================================================================
7265 TL STATE MACHINE
7266============================================================================*/
7267
7268/*==========================================================================
7269 FUNCTION WLANTL_STATxConn
7270
7271 DESCRIPTION
7272 Transmit in connected state - only EAPOL and WAI packets allowed
7273
7274 DEPENDENCIES
7275 The STA must be registered with TL before this function can be called.
7276
7277 PARAMETERS
7278
7279 IN
7280 pvosGCtx: pointer to the global vos context; a handle to TL's
7281 control block can be extracted from its context
7282 ucSTAId: identifier of the station being processed
7283 vosDataBuff: pointer to the tx vos buffer
7284
7285 RETURN VALUE
7286 The result code associated with performing the operation
7287
7288 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
7289 page fault
7290 VOS_STATUS_SUCCESS: Everything is good :)
7291
7292 Other return values are possible coming from the called functions.
7293 Please check API for additional info.
7294
7295 SIDE EFFECTS
7296
7297============================================================================*/
7298VOS_STATUS
7299WLANTL_STATxConn
7300(
7301 v_PVOID_t pvosGCtx,
7302 v_U8_t ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07007303 vos_pkt_t** pvosDataBuff,
7304 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -07007305)
7306{
7307 v_U16_t usPktLen;
7308 VOS_STATUS vosStatus;
7309 v_MACADDR_t vDestMacAddr;
7310 vos_pkt_t* vosDataBuff = NULL;
7311 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307312 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007313 WLANTL_MetaInfoType tlMetaInfo;
7314 v_U8_t ucTypeSubtype = 0;
7315 v_U8_t ucTid;
7316 v_U8_t extraHeadSpace = 0;
7317 v_U8_t ucWDSEnabled = 0;
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007318 v_U8_t ucAC, ucACMask, i;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05307319 v_U32_t txFlag = HAL_TX_NO_ENCRYPTION_MASK;
Jeff Johnson295189b2012-06-20 16:38:30 -07007320 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
7321
7322 /*------------------------------------------------------------------------
7323 Sanity check
7324 Extract TL control block
7325 ------------------------------------------------------------------------*/
7326 pTLCb = VOS_GET_TL_CB(pvosGCtx);
7327 if ( NULL == pTLCb )
7328 {
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007329 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7330 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STATxConn");
Jeff Johnson295189b2012-06-20 16:38:30 -07007331 *pvosDataBuff = NULL;
7332 return VOS_STATUS_E_FAULT;
7333 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307334 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
7335
7336 if ( NULL == pClientSTA )
7337 {
7338 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7339 "WLAN TL:Client Memory was not allocated on %s", __func__));
7340 return VOS_STATUS_E_FAILURE;
7341 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007342
7343 /*-------------------------------------------------------------------
7344 Disable AC temporary - if successfull retrieve re-enable
7345 The order is justified because of the possible scenario
7346 - TL tryes to fetch packet for AC and it returns NULL
7347 - TL analyzes the data it has received to see if there are
7348 any more pkts available for AC -> if not TL will disable AC
7349 - however it is possible that while analyzing results TL got
7350 preempted by a pending indication where the mask was again set
7351 TL will not check again and as a result when it resumes
7352 execution it will disable AC
7353 To prevent this the AC will be disabled here and if retrieve
7354 is successfull it will be re-enabled
7355 -------------------------------------------------------------------*/
7356
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007357
7358 //LTI:pTLCb->atlSTAClients[ucSTAId].
7359 //LTI: aucACMask[pTLCb->atlSTAClients[ucSTAId].ucCurrentAC] = 0;
7360
7361 /*------------------------------------------------------------------------
7362 Fetch packet from HDD
7363 ------------------------------------------------------------------------*/
Sunil Ravid5406f22013-01-22 00:18:31 -08007364#ifdef FEATURE_WLAN_TDLS
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307365 if ((WLAN_STA_SOFTAP != pClientSTA->wSTADesc.wSTAType) &&
Agarwal Ashishcd86f7b2014-06-16 17:11:58 +05307366 !(vos_concurrent_open_sessions_running()) &&
Sunil Ravid5406f22013-01-22 00:18:31 -08007367 !pTLCb->ucTdlsPeerCount)
7368 {
7369#else
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307370 if ((WLAN_STA_SOFTAP != pClientSTA->wSTADesc.wSTAType) &&
Agarwal Ashishcd86f7b2014-06-16 17:11:58 +05307371 !(vos_concurrent_open_sessions_running()))
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007372 {
Sunil Ravid5406f22013-01-22 00:18:31 -08007373#endif
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307374 ucAC = pClientSTA->ucCurrentAC;
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007375
7376 /*-------------------------------------------------------------------
7377 Disable AC temporary - if successfull retrieve re-enable
7378 The order is justified because of the possible scenario
7379 - TL tryes to fetch packet for AC and it returns NULL
7380 - TL analyzes the data it has received to see if there are
7381 any more pkts available for AC -> if not TL will disable AC
7382 - however it is possible that while analyzing results TL got
7383 preempted by a pending indication where the mask was again set
7384 TL will not check again and as a result when it resumes
7385 execution it will disable AC
7386 To prevent this the AC will be disabled here and if retrieve
7387 is successfull it will be re-enabled
7388 -------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307389 pClientSTA->aucACMask[ucAC] = 0;
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007390 }
7391 else
7392 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307393 //softap case
7394 ucAC = pTLCb->uCurServedAC;
7395 pClientSTA->aucACMask[ucAC] = 0;
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007396 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007397
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307398 /*You make an initial assumption that HDD has no more data and if the
Jeff Johnson295189b2012-06-20 16:38:30 -07007399 assumption was wrong you reset the flags to their original state
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307400 This will prevent from exposing a race condition between checking with HDD
Jeff Johnson295189b2012-06-20 16:38:30 -07007401 for packets and setting the flags to false*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307402 //LTI: vos_atomic_set_U8( &pTLCb->atlSTAClients[ucSTAId].ucPktPending, 0);
7403 //LTI: pTLCb->atlSTAClients[ucSTAId].ucNoMoreData = 1;
7404 vos_atomic_set_U8( &pClientSTA->ucPktPending, 0);
7405 WLAN_TL_AC_ARRAY_2_MASK( pClientSTA, ucACMask, i);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307406 /*You make an initial assumption that HDD has no more data and if the
7407 assumption was wrong you reset the flags to their original state
7408 This will prevent from exposing a race condition between checking with HDD
7409 for packets and setting the flags to false*/
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007410 if ( 0 == ucACMask )
7411 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307412 pClientSTA->ucNoMoreData = 1;
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007413 }
7414 else
7415 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307416 vos_atomic_set_U8( &pClientSTA->ucPktPending, 1);
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007417 }
7418
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007419
Madan Mohan Koyyalamudid93f4942012-10-05 15:05:40 -07007420 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007421 "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 +05307422 ucAC, ucACMask, pClientSTA->ucPktPending);
Jeff Johnson295189b2012-06-20 16:38:30 -07007423
7424 /*------------------------------------------------------------------------
7425 Fetch tx packet from HDD
7426 ------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007427
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307428 vosStatus = pClientSTA->pfnSTAFetchPkt( pvosGCtx,
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007429 &ucSTAId,
7430 ucAC,
7431 &vosDataBuff, &tlMetaInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07007432
7433 if (( VOS_STATUS_SUCCESS != vosStatus ) || ( NULL == vosDataBuff ))
7434 {
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007435 TLLOG1(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Jeff Johnson295189b2012-06-20 16:38:30 -07007436 "WLAN TL:No more data at HDD status %d", vosStatus));
7437 *pvosDataBuff = NULL;
7438
7439 /*--------------------------------------------------------------------
7440 Reset AC for the serviced station to the highest priority AC
7441 -> due to no more data at the station
7442 Even if this AC is not supported by the station, correction will be
7443 made in the main TL loop
7444 --------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307445 pClientSTA->ucCurrentAC = WLANTL_AC_VO;
7446 pClientSTA->ucCurrentWeight = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07007447
Madan Mohan Koyyalamudid8000342012-11-08 14:55:26 -08007448 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007449 "WLAN TL: WLANTL_STATxConn no more packets in HDD for AC: %d AC Mask: %d",
7450 ucAC, ucACMask);
7451
Jeff Johnson295189b2012-06-20 16:38:30 -07007452 return vosStatus;
7453 }
7454
7455 /*There are still packets in HDD - set back the pending packets and
7456 the no more data assumption*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307457 vos_atomic_set_U8( &pClientSTA->ucPktPending, 1);
7458 pClientSTA->ucNoMoreData = 0;
7459 pClientSTA->aucACMask[ucAC] = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07007460
Jeff Johnson295189b2012-06-20 16:38:30 -07007461#ifdef WLAN_PERF
7462 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAL,
7463 (v_PVOID_t)0);
7464
7465#endif /*WLAN_PERF*/
7466
7467
7468#ifdef FEATURE_WLAN_WAPI
7469 /*------------------------------------------------------------------------
7470 If the packet is neither an Eapol packet nor a WAI packet then drop it
7471 ------------------------------------------------------------------------*/
7472 if ( 0 == tlMetaInfo.ucIsEapol && 0 == tlMetaInfo.ucIsWai )
7473 {
Madan Mohan Koyyalamudid93f4942012-10-05 15:05:40 -07007474 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Jeff Johnson295189b2012-06-20 16:38:30 -07007475 "WLAN TL:Only EAPOL or WAI packets allowed before authentication"));
7476
7477 /* Fail tx for packet */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307478 pClientSTA->pfnSTATxComp( pvosGCtx, vosDataBuff,
Jeff Johnson295189b2012-06-20 16:38:30 -07007479 VOS_STATUS_E_BADMSG);
7480 vosDataBuff = NULL;
7481 *pvosDataBuff = NULL;
7482 return VOS_STATUS_SUCCESS;
7483 }
7484#else
7485 if ( 0 == tlMetaInfo.ucIsEapol )
7486 {
7487 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
7488 "WLAN TL:Received non EAPOL packet before authentication"));
7489
7490 /* Fail tx for packet */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307491 pClientSTA->pfnSTATxComp( pvosGCtx, vosDataBuff,
Jeff Johnson295189b2012-06-20 16:38:30 -07007492 VOS_STATUS_E_BADMSG);
7493 vosDataBuff = NULL;
7494 *pvosDataBuff = NULL;
7495 return VOS_STATUS_SUCCESS;
7496 }
7497#endif /* FEATURE_WLAN_WAPI */
7498
7499 /*-------------------------------------------------------------------------
7500 Check TID
7501 -------------------------------------------------------------------------*/
7502 ucTid = tlMetaInfo.ucTID;
7503
7504 /*Make sure TID is valid*/
7505 if ( WLANTL_TID_INVALID(ucTid))
7506 {
Rajesh Chauhan2df40bf2013-08-22 11:26:12 -07007507 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Jeff Johnson295189b2012-06-20 16:38:30 -07007508 "WLAN TL:Invalid TID sent in meta info %d - defaulting to 0 (BE)",
7509 ucTid));
7510 ucTid = 0;
7511 }
7512
7513 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
7514 "WLAN TL:Attaching BD header to pkt on WLANTL_STATxConn"));
7515
7516#ifdef FEATURE_WLAN_WAPI
7517 /*------------------------------------------------------------------------
7518 Translate 802.3 frame to 802.11 if Frame translation is enabled or if
7519 frame is a WAI frame.
7520 ------------------------------------------------------------------------*/
7521 if ( ( 1 == tlMetaInfo.ucIsWai ) ||
7522 ( 0 == tlMetaInfo.ucDisableFrmXtl ) )
7523#else
7524 /*------------------------------------------------------------------------
7525 Translate 802.3 frame to 802.11 if Frame translation is enabled
7526 ------------------------------------------------------------------------*/
7527 if ( ( 0 == tlMetaInfo.ucDisableFrmXtl ) &&
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307528 ( 0 != pClientSTA->wSTADesc.ucSwFrameTXXlation) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007529#endif //#ifdef FEATURE_WLAN_WAPI
7530 {
Kiran Venkatappacab0d352012-12-17 13:09:22 -08007531 vosStatus = WLANTL_Translate8023To80211Header( vosDataBuff, &vosStatus,
7532 pTLCb, &ucSTAId,
Ravi Joshid0699502013-07-08 15:48:47 -07007533 &tlMetaInfo, &ucWDSEnabled,
7534 &extraHeadSpace);
Jeff Johnson295189b2012-06-20 16:38:30 -07007535 if ( VOS_STATUS_SUCCESS != vosStatus )
7536 {
7537 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7538 "WLAN TL:Error when translating header WLANTL_STATxConn"));
7539
7540 return vosStatus;
7541 }
7542
7543 tlMetaInfo.ucDisableFrmXtl = 1;
7544 }
7545
7546 /*-------------------------------------------------------------------------
7547 Call HAL to fill BD header
7548 -------------------------------------------------------------------------*/
7549 ucTypeSubtype |= (WLANTL_80211_DATA_TYPE << 4);
7550
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307551 if ( pClientSTA->wSTADesc.ucQosEnabled )
Jeff Johnson295189b2012-06-20 16:38:30 -07007552 {
7553 ucTypeSubtype |= (WLANTL_80211_DATA_QOS_SUBTYPE);
7554 }
7555
Gopichand Nakkala8b54e912013-03-11 10:44:21 +05307556#ifdef FEATURE_WLAN_WAPI
7557 /* TL State does not transition to AUTHENTICATED till GTK is installed, So in
7558 * case of WPA where GTK handshake is done after the 4 way handshake, the
7559 * unicast 2/2 EAPOL packet from the STA->AP has to be encrypted even before
7560 * the TL is in authenticated state. Since the PTK has been installed
7561 * already (after the 4 way handshake) we make sure that all traffic
7562 * is encrypted henceforth.(Note: TL is still not in AUTHENTICATED state so
7563 * we will only allow EAPOL data or WAI in case of WAPI)
7564 */
7565 if (tlMetaInfo.ucIsEapol && pClientSTA->ptkInstalled)
7566 {
7567 txFlag = 0;
7568 }
7569#else
7570 if (pClientSTA->ptkInstalled)
7571 {
7572 txFlag = 0;
7573 }
7574#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007575
7576 vosStatus = (VOS_STATUS)WDA_DS_BuildTxPacketInfo( pvosGCtx, vosDataBuff , &vDestMacAddr,
7577 tlMetaInfo.ucDisableFrmXtl, &usPktLen,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307578 pClientSTA->wSTADesc.ucQosEnabled, ucWDSEnabled,
Jeff Johnson295189b2012-06-20 16:38:30 -07007579 extraHeadSpace,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307580 ucTypeSubtype, &pClientSTA->wSTADesc.vSelfMACAddress,
Gopichand Nakkala8b54e912013-03-11 10:44:21 +05307581 ucTid, txFlag,
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07007582 tlMetaInfo.usTimeStamp, tlMetaInfo.ucIsEapol || tlMetaInfo.ucIsWai, tlMetaInfo.ucUP );
Jeff Johnson295189b2012-06-20 16:38:30 -07007583
7584 if ( VOS_STATUS_SUCCESS != vosStatus )
7585 {
7586 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7587 "WLAN TL:Failed while attempting to fill BD %d", vosStatus));
7588 *pvosDataBuff = NULL;
7589 return vosStatus;
7590 }
7591
7592 /*-----------------------------------------------------------------------
7593 Update tx counter for BA session query for tx side
7594 !1 - should this be done for EAPOL frames?
7595 -----------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307596 pClientSTA->auTxCount[ucTid]++;
Jeff Johnson295189b2012-06-20 16:38:30 -07007597
7598 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307599 (v_PVOID_t)pClientSTA->pfnSTATxComp );
Jeff Johnson295189b2012-06-20 16:38:30 -07007600
7601 /*------------------------------------------------------------------------
7602 Save data to input pointer for TL core
7603 ------------------------------------------------------------------------*/
7604 *pvosDataBuff = vosDataBuff;
7605 /*security frames cannot be delayed*/
7606 pTLCb->bUrgent = TRUE;
7607
Jeff Johnson295189b2012-06-20 16:38:30 -07007608 /* TX Statistics */
7609 if (!(tlMetaInfo.ucBcast || tlMetaInfo.ucMcast))
7610 {
7611 /* This is TX UC frame */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307612 pClientSTA->trafficStatistics.txUCFcnt++;
7613 pClientSTA->trafficStatistics.txUCBcnt += usPktLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07007614 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007615
7616 return VOS_STATUS_SUCCESS;
7617}/* WLANTL_STATxConn */
7618
7619
7620/*==========================================================================
7621 FUNCTION WLANTL_STATxAuth
7622
7623 DESCRIPTION
7624 Transmit in authenticated state - all data allowed
7625
7626 DEPENDENCIES
7627 The STA must be registered with TL before this function can be called.
7628
7629 PARAMETERS
7630
7631 IN
7632 pvosGCtx: pointer to the global vos context; a handle to TL's
7633 control block can be extracted from its context
7634 ucSTAId: identifier of the station being processed
7635 vosDataBuff: pointer to the tx vos buffer
7636
7637 RETURN VALUE
7638 The result code associated with performing the operation
7639
7640 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
7641 page fault
7642 VOS_STATUS_SUCCESS: Everything is good :)
7643
7644 Other return values are possible coming from the called functions.
7645 Please check API for additional info.
7646
7647 SIDE EFFECTS
7648
7649============================================================================*/
7650VOS_STATUS
7651WLANTL_STATxAuth
7652(
7653 v_PVOID_t pvosGCtx,
7654 v_U8_t ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07007655 vos_pkt_t** pvosDataBuff,
7656 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -07007657)
7658{
7659 v_U16_t usPktLen;
7660 VOS_STATUS vosStatus;
7661 v_MACADDR_t vDestMacAddr;
7662 vos_pkt_t* vosDataBuff = NULL;
7663 WLANTL_CbType* pTLCb = NULL;
7664 WLANTL_MetaInfoType tlMetaInfo;
7665 v_U8_t ucTypeSubtype = 0;
7666 WLANTL_ACEnumType ucAC;
7667 WLANTL_ACEnumType ucNextAC;
7668 v_U8_t ucTid;
7669 v_U8_t ucSwFrmXtl = 0;
7670 v_U8_t extraHeadSpace = 0;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307671 WLANTL_STAClientType *pStaClient = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007672 v_U8_t ucWDSEnabled = 0;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05307673 v_U32_t ucTxFlag = 0;
Abhishek Singh45e68fe2014-12-11 12:55:59 +05307674 v_U8_t ucACMask, i;
7675 v_U8_t prevStaId;
Jeff Johnson295189b2012-06-20 16:38:30 -07007676 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
7677
7678 /*------------------------------------------------------------------------
7679 Sanity check
7680 Extract TL control block
7681 ------------------------------------------------------------------------*/
7682 pTLCb = VOS_GET_TL_CB(pvosGCtx);
7683 if (( NULL == pTLCb ) || ( NULL == pvosDataBuff ))
7684 {
7685 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Jeff Johnson0298bd02013-11-14 19:58:38 -08007686 "WLAN TL:Invalid input params on WLANTL_STATxAuth TL %p DB %p",
Jeff Johnson295189b2012-06-20 16:38:30 -07007687 pTLCb, pvosDataBuff));
7688 if (NULL != pvosDataBuff)
7689 {
7690 *pvosDataBuff = NULL;
7691 }
7692 if(NULL != pTLCb)
7693 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307694 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
7695 {
7696 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7697 "WLAN TL:Client Memory was not allocated on %s", __func__));
7698 return VOS_STATUS_E_FAILURE;
7699 }
7700 pTLCb->atlSTAClients[ucSTAId]->ucNoMoreData = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07007701 }
7702 return VOS_STATUS_E_FAULT;
7703 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307704 pStaClient = pTLCb->atlSTAClients[ucSTAId];
Jeff Johnson295189b2012-06-20 16:38:30 -07007705
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307706 if ( NULL == pStaClient )
7707 {
7708 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7709 "WLAN TL:Client Memory was not allocated on %s", __func__));
7710 return VOS_STATUS_E_FAILURE;
7711 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007712
7713 vos_mem_zero(&tlMetaInfo, sizeof(tlMetaInfo));
7714 /*------------------------------------------------------------------------
7715 Fetch packet from HDD
7716 ------------------------------------------------------------------------*/
Sunil Ravid5406f22013-01-22 00:18:31 -08007717#ifdef FEATURE_WLAN_TDLS
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307718 if ((WLAN_STA_SOFTAP != pStaClient->wSTADesc.wSTAType) &&
Agarwal Ashishcd86f7b2014-06-16 17:11:58 +05307719 (!vos_concurrent_open_sessions_running()) &&
Sunil Ravid5406f22013-01-22 00:18:31 -08007720 !pTLCb->ucTdlsPeerCount)
7721 {
7722#else
Jeff Johnson295189b2012-06-20 16:38:30 -07007723 if ((WLAN_STA_SOFTAP != pStaClient->wSTADesc.wSTAType) &&
Agarwal Ashishcd86f7b2014-06-16 17:11:58 +05307724 (!vos_concurrent_open_sessions_running()))
Jeff Johnson295189b2012-06-20 16:38:30 -07007725 {
7726#endif
7727 ucAC = pStaClient->ucCurrentAC;
7728
7729 /*-------------------------------------------------------------------
7730 Disable AC temporary - if successfull retrieve re-enable
7731 The order is justified because of the possible scenario
7732 - TL tryes to fetch packet for AC and it returns NULL
7733 - TL analyzes the data it has received to see if there are
7734 any more pkts available for AC -> if not TL will disable AC
7735 - however it is possible that while analyzing results TL got
7736 preempted by a pending indication where the mask was again set
7737 TL will not check again and as a result when it resumes
7738 execution it will disable AC
7739 To prevent this the AC will be disabled here and if retrieve
7740 is successfull it will be re-enabled
7741 -------------------------------------------------------------------*/
7742 pStaClient->aucACMask[pStaClient->ucCurrentAC] = 0;
7743
7744 // don't reset it, as other AC queues in HDD may have packets
7745 //vos_atomic_set_U8( &pStaClient->ucPktPending, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007746 }
7747 else
7748 {
7749 //softap case
7750 ucAC = pTLCb->uCurServedAC;
7751 pStaClient->aucACMask[ucAC] = 0;
7752
7753 //vos_atomic_set_U8( &pStaClient->ucPktPending, 0);
7754 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007755
7756 WLAN_TL_AC_ARRAY_2_MASK( pStaClient, ucACMask, i);
Jeff Johnson295189b2012-06-20 16:38:30 -07007757 /*You make an initial assumption that HDD has no more data and if the
7758 assumption was wrong you reset the flags to their original state
7759 This will prevent from exposing a race condition between checking with HDD
7760 for packets and setting the flags to false*/
7761 if ( 0 == ucACMask )
7762 {
7763 vos_atomic_set_U8( &pStaClient->ucPktPending, 0);
7764 pStaClient->ucNoMoreData = 1;
7765 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007766
Abhishek Singh45e68fe2014-12-11 12:55:59 +05307767 if (WLAN_STA_IBSS == pStaClient->wSTADesc.wSTAType)
7768 prevStaId = ucSTAId;
7769
Jeff Johnson295189b2012-06-20 16:38:30 -07007770 vosStatus = pStaClient->pfnSTAFetchPkt( pvosGCtx,
7771 &ucSTAId,
7772 ucAC,
7773 &vosDataBuff, &tlMetaInfo );
7774
7775
7776 if (( VOS_STATUS_SUCCESS != vosStatus ) || ( NULL == vosDataBuff ))
7777 {
7778
7779 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
7780 "WLAN TL:Failed while attempting to fetch pkt from HDD %d",
7781 vosStatus);
7782 *pvosDataBuff = NULL;
7783 /*--------------------------------------------------------------------
7784 Reset AC for the serviced station to the highest priority AC
7785 -> due to no more data at the station
7786 Even if this AC is not supported by the station, correction will be
7787 made in the main TL loop
7788 --------------------------------------------------------------------*/
7789 pStaClient->ucCurrentAC = WLANTL_AC_VO;
7790 pStaClient->ucCurrentWeight = 0;
7791
7792 return vosStatus;
7793 }
7794
Abhishek Singh45e68fe2014-12-11 12:55:59 +05307795 /* In IBSS only one queue is used for all staID and the fetched packet's
7796 * staID might be different from the staID for which data was pending.
7797 * So update the pStaClient and do sanity checks for the new pStaClient.
7798 */
7799 if ((WLAN_STA_IBSS == pStaClient->wSTADesc.wSTAType) && (prevStaId != ucSTAId))
7800 {
7801 pStaClient = pTLCb->atlSTAClients[ucSTAId];
7802 if (NULL == pStaClient)
7803 {
7804 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7805 "WLAN TL:Station is null ");
7806 vos_pkt_return_packet(vosDataBuff);
7807 *pvosDataBuff = NULL;
7808 return VOS_STATUS_E_FAILURE;
7809 }
7810 if ((0 == pStaClient->ucExists) ||
7811 (WLANTL_STA_AUTHENTICATED != pStaClient->tlState))
7812 {
7813 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7814 "WLAN TL:Station not registered or connected state = %d",
7815 pStaClient->tlState);
7816 vos_pkt_return_packet(vosDataBuff);
7817 *pvosDataBuff = NULL;
7818 return VOS_STATUS_E_EXISTS;
7819 }
7820 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007821 WLANTL_StatHandleTXFrame(pvosGCtx, ucSTAId, vosDataBuff, NULL, &tlMetaInfo);
Jeff Johnsone7245742012-09-05 17:12:55 -07007822
Jeff Johnson295189b2012-06-20 16:38:30 -07007823 /*There are still packets in HDD - set back the pending packets and
7824 the no more data assumption*/
7825 vos_atomic_set_U8( &pStaClient->ucPktPending, 1);
7826 pStaClient->ucNoMoreData = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07007827
Jeff Johnson295189b2012-06-20 16:38:30 -07007828 if (WLAN_STA_SOFTAP != pStaClient->wSTADesc.wSTAType)
7829 {
Jeff Johnson295189b2012-06-20 16:38:30 -07007830 // don't need to set it, as we don't reset it in this function.
7831 //vos_atomic_set_U8( &pTLCb->atlSTAClients[ucSTAId].ucPktPending, 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07007832 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007833
7834#ifdef WLAN_PERF
7835 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAL,
7836 (v_PVOID_t)0);
7837#endif /*WLAN_PERF*/
7838
7839 /*-------------------------------------------------------------------------
7840 Check TID
7841 -------------------------------------------------------------------------*/
7842 ucTid = tlMetaInfo.ucTID;
7843
7844 /*Make sure TID is valid*/
7845 if ( WLANTL_TID_INVALID(ucTid))
7846 {
Rajesh Chauhan2df40bf2013-08-22 11:26:12 -07007847 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Jeff Johnson295189b2012-06-20 16:38:30 -07007848 "WLAN TL:Invalid TID sent in meta info %d - defaulting to 0 (BE)",
7849 ucTid));
7850 ucTid = 0;
7851 }
7852
7853 /*Save for UAPSD timer consideration*/
7854 pStaClient->ucServicedAC = ucAC;
7855
7856 if ( ucAC == pStaClient->ucCurrentAC )
7857 {
7858 pStaClient->aucACMask[pStaClient->ucCurrentAC] = 1;
7859 pStaClient->ucCurrentWeight--;
7860 }
7861 else
7862 {
7863 pStaClient->ucCurrentAC = ucAC;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307864 pStaClient->ucCurrentWeight = pTLCb->tlConfigInfo.ucAcWeights[ucAC] - 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07007865
7866 pStaClient->aucACMask[pStaClient->ucCurrentAC] = 1;
7867
7868 }
7869
Jeff Johnson295189b2012-06-20 16:38:30 -07007870 if (WLAN_STA_SOFTAP != pStaClient->wSTADesc.wSTAType)
7871 {
Jeff Johnson295189b2012-06-20 16:38:30 -07007872 if ( 0 == pStaClient->ucCurrentWeight )
7873 {
7874 WLANTL_ACEnumType tempAC = ucAC;
7875 /*-----------------------------------------------------------------------
7876 Choose next AC - !!! optimize me
7877 -----------------------------------------------------------------------*/
7878 while ( 0 != ucACMask )
7879 {
7880 ucNextAC = (WLANTL_ACEnumType)(( tempAC - 1 ) & WLANTL_MASK_AC);
7881 if ( 0 != pStaClient->aucACMask[ucNextAC] )
7882 {
7883 pStaClient->ucCurrentAC = ucNextAC;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307884 pStaClient->ucCurrentWeight = pTLCb->tlConfigInfo.ucAcWeights[ucNextAC];
Jeff Johnson295189b2012-06-20 16:38:30 -07007885
7886 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
7887 "WLAN TL: Changing serviced AC to: %d with Weight: %d",
7888 pStaClient->ucCurrentAC ,
7889 pStaClient->ucCurrentWeight));
7890 break;
7891 }
7892 tempAC = ucNextAC;
7893 }
7894 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007895 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007896
7897 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
7898 "WLAN TL:Attaching BD header to pkt on WLANTL_STATxAuth"));
7899
7900 /*------------------------------------------------------------------------
7901 Translate 802.3 frame to 802.11
7902 ------------------------------------------------------------------------*/
7903 if ( 0 == tlMetaInfo.ucDisableFrmXtl )
7904 {
7905 /* Needs frame translation */
7906 // if the client has not enabled SW-only frame translation
7907 // and if the frame is a unicast frame
7908 // (HW frame translation does not support multiple broadcast domains
7909 // so we use SW frame translation for broadcast/multicast frames)
7910#ifdef FEATURE_WLAN_WAPI
7911 // and if the frame is not a WAPI frame
7912#endif
7913 // then use HW_based frame translation
7914
7915 if ( ( 0 == pStaClient->wSTADesc.ucSwFrameTXXlation ) &&
7916 ( 0 == tlMetaInfo.ucBcast ) &&
7917 ( 0 == tlMetaInfo.ucMcast )
7918#ifdef FEATURE_WLAN_WAPI
7919 && ( tlMetaInfo.ucIsWai != 1 )
7920#endif
7921 )
7922 {
7923#ifdef WLAN_PERF
7924 v_U32_t uFastFwdOK = 0;
7925
7926 /* HW based translation. See if the frame could be fast forwarded */
7927 WDA_TLI_FastHwFwdDataFrame( pvosGCtx, vosDataBuff , &vosStatus,
7928 &uFastFwdOK, &tlMetaInfo, &pStaClient->wSTADesc);
7929
7930 if( VOS_STATUS_SUCCESS == vosStatus )
7931 {
7932 if(uFastFwdOK)
7933 {
7934 /* Packet could be fast forwarded now */
7935 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
7936 (v_PVOID_t)pStaClient->pfnSTATxComp );
7937
7938 *pvosDataBuff = vosDataBuff;
7939
7940 /* TODO: Do we really need to update WLANTL_HSHandleTXFrame()
7941 stats for every pkt? */
7942 pStaClient->auTxCount[tlMetaInfo.ucTID]++;
7943 return vosStatus;
7944 }
7945 /* can't be fast forwarded, fall through normal (slow) path. */
7946 }
7947 else
7948 {
7949
7950 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7951 "WLAN TL:Failed while attempting to fastFwd BD %d", vosStatus));
7952 *pvosDataBuff = NULL;
7953 return vosStatus;
7954 }
7955#endif /*WLAN_PERF*/
7956 }
7957 else
7958 {
7959 /* SW based translation */
7960
7961#ifdef FEATURE_WLAN_WAPI
7962 gUcIsWai = tlMetaInfo.ucIsWai,
7963#endif
7964
Kiran Venkatappacab0d352012-12-17 13:09:22 -08007965 vosStatus = WLANTL_Translate8023To80211Header( vosDataBuff, &vosStatus,
7966 pTLCb, &ucSTAId,
Ravi Joshid0699502013-07-08 15:48:47 -07007967 &tlMetaInfo, &ucWDSEnabled,
7968 &extraHeadSpace);
Jeff Johnson295189b2012-06-20 16:38:30 -07007969 if ( VOS_STATUS_SUCCESS != vosStatus )
7970 {
7971 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7972 "WLAN TL:Error when translating header WLANTL_STATxAuth"));
7973 return vosStatus;
7974 }
7975
7976 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
Arif Hussainf2b00992013-11-17 21:46:15 -08007977 "WLAN TL software translation success"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007978 ucSwFrmXtl = 1;
7979 tlMetaInfo.ucDisableFrmXtl = 1;
7980 }
7981 }
Gopichand Nakkala574f6d12013-06-27 19:38:43 +05307982#ifdef FEATURE_WLAN_TDLS
7983 /*In case of TDLS, if the packet is destined to TDLS STA ucSTAId may
7984 change. so update the pStaClient accordingly */
7985 pStaClient = pTLCb->atlSTAClients[ucSTAId];
Jeff Johnson295189b2012-06-20 16:38:30 -07007986
Gopichand Nakkala574f6d12013-06-27 19:38:43 +05307987 if ( NULL == pStaClient )
7988 {
7989 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7990 "pStaClient is NULL %s", __func__));
7991 return VOS_STATUS_E_FAILURE;
7992 }
7993#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007994 /*-------------------------------------------------------------------------
7995 Call HAL to fill BD header
7996 -------------------------------------------------------------------------*/
7997 ucTypeSubtype |= (WLANTL_80211_DATA_TYPE << 4);
7998
7999 if ( pStaClient->wSTADesc.ucQosEnabled )
8000 {
8001 ucTypeSubtype |= (WLANTL_80211_DATA_QOS_SUBTYPE);
8002 }
8003
8004 ucTxFlag = (0 != pStaClient->wUAPSDInfo[ucAC].ucSet)?
8005 HAL_TRIGGER_ENABLED_AC_MASK:0;
8006
8007#ifdef FEATURE_WLAN_WAPI
8008 if ( pStaClient->wSTADesc.ucIsWapiSta == 1 )
8009 {
8010#ifdef LIBRA_WAPI_SUPPORT
8011 ucTxFlag = ucTxFlag | HAL_WAPI_STA_MASK;
8012#endif //LIBRA_WAPI_SUPPORT
8013 if ( tlMetaInfo.ucIsWai == 1 )
8014 {
8015 ucTxFlag = ucTxFlag | HAL_TX_NO_ENCRYPTION_MASK;
8016 }
8017 }
8018#endif /* FEATURE_WLAN_WAPI */
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008019#ifdef FEATURE_WLAN_TDLS
8020 if ( pStaClient->wSTADesc.wSTAType == WLAN_STA_TDLS )
8021 {
8022 ucTxFlag = ucTxFlag | HAL_TDLS_PEER_STA_MASK;
8023 }
8024#endif /* FEATURE_WLAN_TDLS */
Abhishek Singhfa011222014-04-14 10:57:08 +05308025 if( tlMetaInfo.ucIsArp )
8026 {
8027 /*Send ARP at lowest Phy rate and through WQ5 */
8028 ucTxFlag |= HAL_USE_BD_RATE_MASK;
Abhishek Singhfa011222014-04-14 10:57:08 +05308029 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008030
8031 vosStatus = (VOS_STATUS)WDA_DS_BuildTxPacketInfo( pvosGCtx,
8032 vosDataBuff , &vDestMacAddr,
8033 tlMetaInfo.ucDisableFrmXtl, &usPktLen,
8034 pStaClient->wSTADesc.ucQosEnabled, ucWDSEnabled,
8035 extraHeadSpace,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308036 ucTypeSubtype, &pStaClient->wSTADesc.vSelfMACAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07008037 ucTid, ucTxFlag, tlMetaInfo.usTimeStamp,
8038 tlMetaInfo.ucIsEapol, tlMetaInfo.ucUP );
8039
8040 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
8041 {
8042 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8043 "Fill TX BD Error status %d", vosStatus));
8044
8045 return vosStatus;
8046 }
8047
Jeff Johnson295189b2012-06-20 16:38:30 -07008048 /* TX Statistics */
8049 if (!(tlMetaInfo.ucBcast || tlMetaInfo.ucMcast))
8050 {
8051 /* This is TX UC frame */
8052 pStaClient->trafficStatistics.txUCFcnt++;
8053 pStaClient->trafficStatistics.txUCBcnt += usPktLen;
8054 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008055
Kiran Venkatappacab0d352012-12-17 13:09:22 -08008056#ifndef FEATURE_WLAN_TDLS
Jeff Johnson295189b2012-06-20 16:38:30 -07008057 /*-----------------------------------------------------------------------
8058 Update tx counter for BA session query for tx side
8059 -----------------------------------------------------------------------*/
8060 pStaClient->auTxCount[ucTid]++;
Kiran Venkatappacab0d352012-12-17 13:09:22 -08008061#else
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308062 pTLCb->atlSTAClients[ucSTAId]->auTxCount[ucTid]++;
Kiran Venkatappacab0d352012-12-17 13:09:22 -08008063#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07008064
8065 /* This code is to send traffic with lower priority AC when we does not
8066 get admitted to send it. Today HAL does not downgrade AC so this code
8067 does not get executed.(In other words, HAL doesnÂ’t change tid. The if
8068 statement is always false.)
8069 NOTE: In the case of LA downgrade occurs in HDD (that was the change
8070 Phani made during WMM-AC plugfest). If WM & BMP also took this approach,
8071 then there will be no need for any AC downgrade logic in TL/WDI. */
8072#if 0
8073 if (( ucTid != tlMetaInfo.ucTID ) &&
8074 ( 0 != pStaClient->wSTADesc.ucQosEnabled ) &&
8075 ( 0 != ucSwFrmXtl ))
8076 {
8077 /*---------------------------------------------------------------------
8078 !! FIX me: Once downgrading is clear put in the proper change
8079 ---------------------------------------------------------------------*/
8080 ucQCOffset = WLANHAL_TX_BD_HEADER_SIZE + WLANTL_802_11_HEADER_LEN;
8081
8082 //!!!Fix this replace peek with extract
8083 vos_pkt_peek_data( vosDataBuff, ucQCOffset,(v_PVOID_t)&pucQosCtrl,
8084 sizeof(*pucQosCtrl));
8085 *pucQosCtrl = ucTid; //? proper byte order
8086 }
8087#endif
8088
8089 if ( VOS_STATUS_SUCCESS != vosStatus )
8090 {
8091 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8092 "WLAN TL:Failed while attempting to fill BD %d", vosStatus));
8093 *pvosDataBuff = NULL;
8094 return vosStatus;
8095 }
8096
8097 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
8098 (v_PVOID_t)pStaClient->pfnSTATxComp );
8099
8100 *pvosDataBuff = vosDataBuff;
8101
8102 /*BE & BK can be delayed, VO and VI not frames cannot be delayed*/
8103 if ( pStaClient->ucServicedAC > WLANTL_AC_BE )
8104 {
8105 pTLCb->bUrgent= TRUE;
8106 }
8107
8108 return VOS_STATUS_SUCCESS;
8109}/* WLANTL_STATxAuth */
8110
8111/*==========================================================================
8112 FUNCTION WLANTL_STATxDisc
8113
8114 DESCRIPTION
8115 Transmit in disconnected state - no data allowed
8116
8117 DEPENDENCIES
8118 The STA must be registered with TL before this function can be called.
8119
8120 PARAMETERS
8121
8122 IN
8123 pvosGCtx: pointer to the global vos context; a handle to TL's
8124 control block can be extracted from its context
8125 ucSTAId: identifier of the station being processed
8126 vosDataBuff: pointer to the tx vos buffer
8127
8128 RETURN VALUE
8129 The result code associated with performing the operation
8130
8131 VOS_STATUS_SUCCESS: Everything is good :)
8132
8133 SIDE EFFECTS
8134
8135============================================================================*/
8136VOS_STATUS
8137WLANTL_STATxDisc
8138(
8139 v_PVOID_t pvosGCtx,
8140 v_U8_t ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008141 vos_pkt_t** pvosDataBuff,
8142 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -07008143)
8144{
8145 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308146 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07008147 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
8148
Jeff Johnson295189b2012-06-20 16:38:30 -07008149 /*------------------------------------------------------------------------
8150 Sanity check
8151 Extract TL control block
8152 ------------------------------------------------------------------------*/
8153 pTLCb = VOS_GET_TL_CB(pvosGCtx);
8154 if ( NULL == pTLCb )
8155 {
8156 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8157 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STATxAuth"));
8158 *pvosDataBuff = NULL;
8159 return VOS_STATUS_E_FAULT;
8160 }
8161
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308162 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
8163
8164 if ( NULL == pClientSTA )
8165 {
8166 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8167 "WLAN TL:Client Memory was not allocated on %s", __func__));
8168 return VOS_STATUS_E_FAILURE;
8169 }
8170
Jeff Johnson295189b2012-06-20 16:38:30 -07008171 /*------------------------------------------------------------------------
8172 Error
8173 ------------------------------------------------------------------------*/
8174 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8175 "WLAN TL:Packet should not be transmitted in state disconnected ignoring"
8176 " request"));
8177
8178 *pvosDataBuff = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308179 pClientSTA->ucNoMoreData = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07008180
8181 //Should not be anything pending in disconnect state
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308182 vos_atomic_set_U8( &pClientSTA->ucPktPending, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008183
8184 return VOS_STATUS_SUCCESS;
8185}/* WLANTL_STATxDisc */
8186
8187/*==========================================================================
8188 FUNCTION WLANTL_STARxConn
8189
8190 DESCRIPTION
8191 Receive in connected state - only EAPOL
8192
8193 DEPENDENCIES
8194 The STA must be registered with TL before this function can be called.
8195
8196 PARAMETERS
8197
8198 IN
8199 pvosGCtx: pointer to the global vos context; a handle to TL's
8200 control block can be extracted from its context
8201 ucSTAId: identifier of the station being processed
8202 vosDataBuff: pointer to the tx/rx vos buffer
8203
8204 RETURN VALUE
8205 The result code associated with performing the operation
8206
8207 VOS_STATUS_E_INVAL: invalid input parameters
8208 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
8209 page fault
8210 VOS_STATUS_SUCCESS: Everything is good :)
8211
8212 SIDE EFFECTS
8213
8214============================================================================*/
8215VOS_STATUS
8216WLANTL_STARxConn
8217(
8218 v_PVOID_t pvosGCtx,
8219 v_U8_t ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008220 vos_pkt_t** pvosDataBuff,
8221 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -07008222)
8223{
8224 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308225 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07008226 v_U16_t usEtherType = 0;
8227 v_U16_t usPktLen;
8228 v_U8_t ucMPDUHOffset;
8229 v_U16_t usMPDUDOffset;
8230 v_U16_t usMPDULen;
8231 v_U8_t ucMPDUHLen;
8232 v_U16_t usActualHLen = 0;
8233 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8234 vos_pkt_t* vosDataBuff;
8235 v_PVOID_t aucBDHeader;
8236 v_U8_t ucTid;
8237 WLANTL_RxMetaInfoType wRxMetaInfo;
8238 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
8239
8240 /*------------------------------------------------------------------------
8241 Sanity check
8242 ------------------------------------------------------------------------*/
8243 if (( NULL == pvosDataBuff ) || ( NULL == ( vosDataBuff = *pvosDataBuff )))
8244 {
8245 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8246 "WLAN TL:Invalid parameter sent on WLANTL_STARxConn"));
8247 return VOS_STATUS_E_INVAL;
8248 }
8249
8250 /*------------------------------------------------------------------------
8251 Extract TL control block
8252 ------------------------------------------------------------------------*/
8253 pTLCb = VOS_GET_TL_CB(pvosGCtx);
8254 if ( NULL == pTLCb )
8255 {
8256 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8257 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
8258 return VOS_STATUS_E_FAULT;
8259 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308260 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
8261
8262 if ( NULL == pClientSTA )
8263 {
8264 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8265 "WLAN TL:Client Memory was not allocated on %s", __func__));
8266 return VOS_STATUS_E_FAILURE;
8267 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008268
8269 /*------------------------------------------------------------------------
8270 Extract BD header and check if valid
8271 ------------------------------------------------------------------------*/
8272 vosStatus = WDA_DS_PeekRxPacketInfo( vosDataBuff, (v_PVOID_t)&aucBDHeader, 0/*Swap BD*/ );
8273
8274 if ( NULL == aucBDHeader )
8275 {
8276 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8277 "WLAN TL:Cannot extract BD header"));
8278 VOS_ASSERT( 0 );
8279 return VOS_STATUS_E_FAULT;
8280 }
8281
8282
8283 ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(aucBDHeader);
8284 usMPDUDOffset = (v_U16_t)WDA_GET_RX_MPDU_DATA_OFFSET(aucBDHeader);
8285 usMPDULen = (v_U16_t)WDA_GET_RX_MPDU_LEN(aucBDHeader);
8286 ucMPDUHLen = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(aucBDHeader);
8287 ucTid = (v_U8_t)WDA_GET_RX_TID(aucBDHeader);
8288
8289 vos_pkt_get_packet_length( vosDataBuff, &usPktLen);
8290
8291 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8292 "WLAN TL:BD header processing data: HO %d DO %d Len %d HLen %d",
8293 ucMPDUHOffset, usMPDUDOffset, usMPDULen, ucMPDUHLen));
8294
8295 /*It will cut out the 802.11 header if not used*/
8296 if ( VOS_STATUS_SUCCESS != WDA_DS_TrimRxPacketInfo( vosDataBuff ) )
8297 {
8298 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8299 "WLAN TL:BD header corrupted - dropping packet"));
8300 /* Drop packet */
8301 vos_pkt_return_packet(vosDataBuff);
8302 return VOS_STATUS_SUCCESS;
8303 }
8304
8305 vosStatus = WLANTL_GetEtherType(aucBDHeader,vosDataBuff,ucMPDUHLen,&usEtherType);
8306
8307 if( VOS_IS_STATUS_SUCCESS(vosStatus) )
8308 {
8309#ifdef FEATURE_WLAN_WAPI
8310 /* If frame is neither an EAPOL frame nor a WAI frame then we drop the frame*/
8311 /* TODO: Do we need a check to see if we are in WAPI mode? If not is it possible */
8312 /* that we get an EAPOL packet in WAPI mode or vice versa? */
8313 if ( WLANTL_LLC_8021X_TYPE != usEtherType && WLANTL_LLC_WAI_TYPE != usEtherType )
8314 {
Sunil Ravid5406f22013-01-22 00:18:31 -08008315 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07008316 "WLAN TL:RX Frame not EAPOL or WAI EtherType %d - dropping", usEtherType );
Jeff Johnson295189b2012-06-20 16:38:30 -07008317 /* Drop packet */
8318 vos_pkt_return_packet(vosDataBuff);
8319 }
8320#else
8321 if ( WLANTL_LLC_8021X_TYPE != usEtherType )
8322 {
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07008323 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8324 "WLAN TL:RX Frame not EAPOL EtherType %d - dropping", usEtherType);
Jeff Johnson295189b2012-06-20 16:38:30 -07008325 /* Drop packet */
8326 vos_pkt_return_packet(vosDataBuff);
8327 }
8328#endif /* FEATURE_WLAN_WAPI */
8329 else /* Frame is an EAPOL frame or a WAI frame*/
8330 {
Katya Nigam42e16e82014-02-04 16:28:55 +05308331 MTRACE(vos_trace(VOS_MODULE_ID_TL,
8332 TRACE_CODE_TL_RX_CONN_EAPOL, ucSTAId, usEtherType ));
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07008333
Madan Mohan Koyyalamudid8000342012-11-08 14:55:26 -08008334 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07008335 "WLAN TL:RX Frame EAPOL EtherType %d - processing", usEtherType);
8336
Jeff Johnson295189b2012-06-20 16:38:30 -07008337 if (( 0 == WDA_GET_RX_FT_DONE(aucBDHeader) ) &&
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308338 ( 0 != pClientSTA->wSTADesc.ucSwFrameRXXlation))
Jeff Johnson295189b2012-06-20 16:38:30 -07008339 {
8340 if (usMPDUDOffset > ucMPDUHOffset)
8341 {
8342 usActualHLen = usMPDUDOffset - ucMPDUHOffset;
8343 }
8344
8345 vosStatus = WLANTL_Translate80211To8023Header( vosDataBuff, &vosStatus, usActualHLen,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008346 ucMPDUHLen, pTLCb, ucSTAId, bForwardIAPPwithLLC);
Jeff Johnson295189b2012-06-20 16:38:30 -07008347
8348 if ( VOS_STATUS_SUCCESS != vosStatus )
8349 {
Kaushik, Sushante386ee12014-05-01 15:50:52 +05308350 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Jeff Johnson295189b2012-06-20 16:38:30 -07008351 "WLAN TL:Failed to translate from 802.11 to 802.3 - dropping"));
8352 /* Drop packet */
8353 vos_pkt_return_packet(vosDataBuff);
8354 return vosStatus;
8355 }
8356 }
8357 /*-------------------------------------------------------------------
8358 Increment receive counter
8359 -------------------------------------------------------------------*/
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -07008360 if ( !WLANTL_TID_INVALID( ucTid) )
8361 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308362 pClientSTA->auRxCount[ucTid]++;
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -07008363 }
8364 else
8365 {
8366 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8367 "WLAN TL:Invalid tid %d (Station ID %d) on %s",
8368 ucTid, ucSTAId, __func__));
8369 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008370
8371 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8372 "WLAN TL:Sending EAPoL frame to station %d AC %d", ucSTAId, ucTid));
8373
8374 /*-------------------------------------------------------------------
8375 !!!Assuming TID = UP mapping
8376 -------------------------------------------------------------------*/
8377 wRxMetaInfo.ucUP = ucTid;
8378
Jeff Johnson295189b2012-06-20 16:38:30 -07008379 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
Arif Hussainf2b00992013-11-17 21:46:15 -08008380 "WLAN TL %s:Sending data chain to station", __func__));
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308381 if ( WLAN_STA_SOFTAP == pClientSTA->wSTADesc.wSTAType )
Jeff Johnson295189b2012-06-20 16:38:30 -07008382 {
8383 wRxMetaInfo.ucDesSTAId = WLAN_RX_SAP_SELF_STA_ID;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308384 pClientSTA->pfnSTARx( pvosGCtx, vosDataBuff, ucSTAId,
Jeff Johnson295189b2012-06-20 16:38:30 -07008385 &wRxMetaInfo );
8386 }
8387 else
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308388 pClientSTA->pfnSTARx( pvosGCtx, vosDataBuff, ucSTAId,
Jeff Johnson295189b2012-06-20 16:38:30 -07008389 &wRxMetaInfo );
8390 }/*EAPOL frame or WAI frame*/
8391 }/*vos status success*/
8392
8393 return VOS_STATUS_SUCCESS;
8394}/* WLANTL_STARxConn */
8395
Jeff Johnson295189b2012-06-20 16:38:30 -07008396/*==========================================================================
8397 FUNCTION WLANTL_FwdPktToHDD
8398
8399 DESCRIPTION
8400 Determine the Destation Station ID and route the Frame to Upper Layer
8401
8402 DEPENDENCIES
8403
8404 PARAMETERS
8405
8406 IN
8407 pvosGCtx: pointer to the global vos context; a handle to TL's
8408 control block can be extracted from its context
8409 ucSTAId: identifier of the station being processed
8410 vosDataBuff: pointer to the rx vos buffer
8411
8412 RETURN VALUE
8413 The result code associated with performing the operation
8414
8415 VOS_STATUS_E_INVAL: invalid input parameters
8416 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
8417 page fault
8418 VOS_STATUS_SUCCESS: Everything is good :)
8419
8420 SIDE EFFECTS
8421
8422============================================================================*/
8423
8424VOS_STATUS
8425WLANTL_FwdPktToHDD
8426(
8427 v_PVOID_t pvosGCtx,
8428 vos_pkt_t* pvosDataBuff,
8429 v_U8_t ucSTAId
8430)
8431{
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308432 v_MACADDR_t DestMacAddress;
8433 v_MACADDR_t *pDestMacAddress = &DestMacAddress;
8434 v_SIZE_t usMacAddSize = VOS_MAC_ADDR_SIZE;
Jeff Johnson295189b2012-06-20 16:38:30 -07008435 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308436 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07008437 vos_pkt_t* vosDataBuff ;
8438 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
Girish Gowli93e3edd2014-05-01 15:42:31 +05308439 v_U32_t* STAMetaInfoPtr;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308440 vos_pkt_t* vosNextDataBuff ;
8441 v_U8_t ucDesSTAId;
Jeff Johnson295189b2012-06-20 16:38:30 -07008442 WLANTL_RxMetaInfoType wRxMetaInfo;
8443
Jeff Johnson295189b2012-06-20 16:38:30 -07008444 /*------------------------------------------------------------------------
8445 Sanity check
8446 ------------------------------------------------------------------------*/
8447 if (( NULL == pvosDataBuff ) || ( NULL == ( vosDataBuff = pvosDataBuff )))
8448 {
8449 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8450 "WLAN TL:Invalid parameter sent on WLANTL_FwdPktToHdd"));
8451 return VOS_STATUS_E_INVAL;
8452 }
8453
8454 /*------------------------------------------------------------------------
8455 Extract TL control block
8456 ------------------------------------------------------------------------*/
8457 pTLCb = VOS_GET_TL_CB(pvosGCtx);
8458 if ( NULL == pTLCb )
8459 {
8460 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8461 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_FwdPktToHdd"));
8462 return VOS_STATUS_E_FAULT;
8463 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308464
Tushnim Bhattacharyya5dd94562013-03-20 20:15:03 -07008465 if(WLANTL_STA_ID_INVALID(ucSTAId))
8466 {
8467 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"ucSTAId %d is not valid",
8468 ucSTAId));
8469 return VOS_STATUS_E_INVAL;
8470 }
8471
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308472 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
8473
8474 if ( NULL == pClientSTA )
8475 {
8476 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8477 "WLAN TL:Client Memory was not allocated on %s", __func__));
8478 return VOS_STATUS_E_FAILURE;
8479 }
8480
Jeff Johnson295189b2012-06-20 16:38:30 -07008481 /* This the change required for SoftAp to handle Reordered Buffer. Since a STA
8482 may have packets destined to multiple destinations we have to process each packet
8483 at a time and determine its Destination. So the Voschain provided by Reorder code
8484 is unchain and forwarded to Upper Layer after Determining the Destination */
8485
8486 vosDataBuff = pvosDataBuff;
8487 while (vosDataBuff != NULL)
8488 {
8489 vos_pkt_walk_packet_chain( vosDataBuff, &vosNextDataBuff, 1/*true*/ );
8490 vos_pkt_get_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
Girish Gowli93e3edd2014-05-01 15:42:31 +05308491 (v_PVOID_t *)&STAMetaInfoPtr );
8492 wRxMetaInfo.ucUP = (v_U8_t)((uintptr_t)STAMetaInfoPtr & WLANTL_AC_MASK);
8493 ucDesSTAId = (v_U8_t)(((uintptr_t)STAMetaInfoPtr) >> WLANTL_STAID_OFFSET);
Jeff Johnson295189b2012-06-20 16:38:30 -07008494
8495 vosStatus = vos_pkt_extract_data( vosDataBuff, 0, (v_VOID_t *)pDestMacAddress, &usMacAddSize);
8496 if ( VOS_STATUS_SUCCESS != vosStatus )
8497 {
8498 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08008499 "WLAN TL: recv corrupted data packet"));
Jeff Johnson295189b2012-06-20 16:38:30 -07008500 vos_pkt_return_packet(vosDataBuff);
8501 return vosStatus;
8502 }
8503
Arif Hussaina7c8e412013-11-20 11:06:42 -08008504 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
8505 "station mac "MAC_ADDRESS_STR,
8506 MAC_ADDR_ARRAY(pDestMacAddress->bytes)));
Jeff Johnson295189b2012-06-20 16:38:30 -07008507
8508 if (vos_is_macaddr_broadcast( pDestMacAddress ) || vos_is_macaddr_group(pDestMacAddress))
8509 {
8510 // destination is mc/bc station
8511 ucDesSTAId = WLAN_RX_BCMC_STA_ID;
8512 TLLOG4(VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO_LOW,
Arif Hussainf2b00992013-11-17 21:46:15 -08008513 "%s: BC/MC packet, id %d", __func__, WLAN_RX_BCMC_STA_ID));
Jeff Johnson295189b2012-06-20 16:38:30 -07008514 }
8515 else
8516 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308517 if (vos_is_macaddr_equal(pDestMacAddress, &pClientSTA->wSTADesc.vSelfMACAddress))
Jeff Johnson295189b2012-06-20 16:38:30 -07008518 {
8519 // destination is AP itself
8520 ucDesSTAId = WLAN_RX_SAP_SELF_STA_ID;
8521 TLLOG4(VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO_LOW,
Arif Hussainf2b00992013-11-17 21:46:15 -08008522 "%s: packet to AP itself, id %d", __func__, WLAN_RX_SAP_SELF_STA_ID));
Jeff Johnson295189b2012-06-20 16:38:30 -07008523 }
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05308524 else if (( WLAN_MAX_STA_COUNT <= ucDesSTAId ) || (NULL != pTLCb->atlSTAClients[ucDesSTAId] && pTLCb->atlSTAClients[ucDesSTAId]->ucExists == 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07008525 {
8526 // destination station is something else
8527 TLLOG4(VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO_LOW,
Arif Hussainf2b00992013-11-17 21:46:15 -08008528 "%s: get an station index larger than WLAN_MAX_STA_COUNT %d", __func__, ucDesSTAId));
Jeff Johnson295189b2012-06-20 16:38:30 -07008529 ucDesSTAId = WLAN_RX_SAP_SELF_STA_ID;
8530 }
8531
8532
8533 //loopback unicast station comes here
8534 }
8535
Girish Gowli93e3edd2014-05-01 15:42:31 +05308536 wRxMetaInfo.ucUP = (v_U8_t)((uintptr_t)STAMetaInfoPtr & WLANTL_AC_MASK);
Jeff Johnson295189b2012-06-20 16:38:30 -07008537 wRxMetaInfo.ucDesSTAId = ucDesSTAId;
8538
Madan Mohan Koyyalamudi6c2977d2013-09-04 15:42:45 +05308539 vosStatus = pClientSTA->pfnSTARx( pvosGCtx, vosDataBuff, ucDesSTAId,
Jeff Johnson295189b2012-06-20 16:38:30 -07008540 &wRxMetaInfo );
Madan Mohan Koyyalamudi6c2977d2013-09-04 15:42:45 +05308541 if ( VOS_STATUS_SUCCESS != vosStatus )
8542 {
8543 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08008544 "WLAN TL: failed to send pkt to HDD"));
Madan Mohan Koyyalamudi6c2977d2013-09-04 15:42:45 +05308545 vos_pkt_return_packet(vosDataBuff);
8546
8547 return vosStatus;
8548 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008549 vosDataBuff = vosNextDataBuff;
8550 }
8551 return VOS_STATUS_SUCCESS;
8552}
Jeff Johnson295189b2012-06-20 16:38:30 -07008553
8554/*==========================================================================
8555 FUNCTION WLANTL_STARxAuth
8556
8557 DESCRIPTION
8558 Receive in authenticated state - all data allowed
8559
8560 DEPENDENCIES
8561 The STA must be registered with TL before this function can be called.
8562
8563 PARAMETERS
8564
8565 IN
8566 pvosGCtx: pointer to the global vos context; a handle to TL's
8567 control block can be extracted from its context
8568 ucSTAId: identifier of the station being processed
8569 vosDataBuff: pointer to the rx vos buffer
8570
8571 RETURN VALUE
8572 The result code associated with performing the operation
8573
8574 VOS_STATUS_E_INVAL: invalid input parameters
8575 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
8576 page fault
8577 VOS_STATUS_SUCCESS: Everything is good :)
8578
8579 SIDE EFFECTS
8580
8581============================================================================*/
8582VOS_STATUS
8583WLANTL_STARxAuth
8584(
8585 v_PVOID_t pvosGCtx,
8586 v_U8_t ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008587 vos_pkt_t** pvosDataBuff,
8588 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -07008589)
8590{
8591 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308592 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07008593 v_U8_t ucAsf; /* AMSDU sub frame */
8594 v_U16_t usMPDUDOffset;
8595 v_U8_t ucMPDUHOffset;
8596 v_U16_t usMPDULen;
8597 v_U8_t ucMPDUHLen;
8598 v_U16_t usActualHLen = 0;
8599 v_U8_t ucTid;
8600#ifdef FEATURE_WLAN_WAPI
Jeff Johnsone0343db2013-04-03 16:39:24 -07008601 v_U16_t usEtherType = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07008602#endif
8603 v_U16_t usPktLen;
8604 vos_pkt_t* vosDataBuff ;
8605 v_PVOID_t aucBDHeader;
8606 VOS_STATUS vosStatus;
8607 WLANTL_RxMetaInfoType wRxMetaInfo;
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -07008608 static v_U8_t ucPMPDUHLen;
Girish Gowli93e3edd2014-05-01 15:42:31 +05308609 v_U32_t* STAMetaInfoPtr;
Jeff Johnson295189b2012-06-20 16:38:30 -07008610 v_U8_t ucEsf=0; /* first subframe of AMSDU flag */
8611 v_U64_t ullcurrentReplayCounter=0; /*current replay counter*/
8612 v_U64_t ullpreviousReplayCounter=0; /*previous replay counter*/
8613 v_U16_t ucUnicastBroadcastType=0; /*It denotes whether received frame is UC or BC*/
Madan Mohan Koyyalamudi4fe30172012-10-18 20:13:40 -07008614 struct _BARFrmStruct *pBarFrame = NULL;
8615
Jeff Johnson295189b2012-06-20 16:38:30 -07008616 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
8617
8618 /*------------------------------------------------------------------------
8619 Sanity check
8620 ------------------------------------------------------------------------*/
8621 if (( NULL == pvosDataBuff ) || ( NULL == ( vosDataBuff = *pvosDataBuff )))
8622 {
8623 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8624 "WLAN TL:Invalid parameter sent on WLANTL_STARxAuth"));
8625 return VOS_STATUS_E_INVAL;
8626 }
8627
8628 /*------------------------------------------------------------------------
8629 Extract TL control block
8630 ------------------------------------------------------------------------*/
8631 pTLCb = VOS_GET_TL_CB(pvosGCtx);
8632 if ( NULL == pTLCb )
8633 {
8634 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8635 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STARxAuth"));
8636 return VOS_STATUS_E_FAULT;
8637 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308638 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
8639
8640 if ( NULL == pClientSTA )
8641 {
8642 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8643 "WLAN TL:Client Memory was not allocated on %s", __func__));
8644 return VOS_STATUS_E_FAILURE;
8645 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008646
8647 /*------------------------------------------------------------------------
8648 Extract BD header and check if valid
8649 ------------------------------------------------------------------------*/
8650 WDA_DS_PeekRxPacketInfo( vosDataBuff, (v_PVOID_t)&aucBDHeader, 0 );
8651
8652 ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(aucBDHeader);
8653 usMPDUDOffset = (v_U16_t)WDA_GET_RX_MPDU_DATA_OFFSET(aucBDHeader);
8654 usMPDULen = (v_U16_t)WDA_GET_RX_MPDU_LEN(aucBDHeader);
8655 ucMPDUHLen = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(aucBDHeader);
8656 ucTid = (v_U8_t)WDA_GET_RX_TID(aucBDHeader);
8657
Madan Mohan Koyyalamudi4fe30172012-10-18 20:13:40 -07008658 /* Fix for a hardware bug.
8659 * H/W does not update the tid field in BD header for BAR frames.
8660 * Fix is to read the tid field from MAC header of BAR frame */
8661 if( (WDA_GET_RX_TYPE(aucBDHeader) == SIR_MAC_CTRL_FRAME) &&
8662 (WDA_GET_RX_SUBTYPE(aucBDHeader) == SIR_MAC_CTRL_BAR))
8663 {
8664 pBarFrame = (struct _BARFrmStruct *)(WDA_GET_RX_MAC_HEADER(aucBDHeader));
8665 ucTid = pBarFrame->barControl.numTID;
8666 }
8667
Jeff Johnson295189b2012-06-20 16:38:30 -07008668 /*Host based replay check is needed for unicast data frames*/
8669 ucUnicastBroadcastType = (v_U16_t)WDA_IS_RX_BCAST(aucBDHeader);
Jeff Johnson295189b2012-06-20 16:38:30 -07008670 if(0 != ucMPDUHLen)
8671 {
8672 ucPMPDUHLen = ucMPDUHLen;
8673 }
8674
8675 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8676 "WLAN TL:BD header processing data: HO %d DO %d Len %d HLen %d"
8677 " Tid %d BD %d",
8678 ucMPDUHOffset, usMPDUDOffset, usMPDULen, ucMPDUHLen, ucTid,
8679 WLANHAL_RX_BD_HEADER_SIZE));
8680
8681 vos_pkt_get_packet_length( vosDataBuff, &usPktLen);
8682
8683 if ( VOS_STATUS_SUCCESS != WDA_DS_TrimRxPacketInfo( vosDataBuff ) )
8684 {
8685 if((WDA_GET_RX_ASF(aucBDHeader) && !WDA_GET_RX_ESF(aucBDHeader)))
8686 {
8687 /* AMSDU case, ucMPDUHOffset = 0
8688 * it should be hancdled seperatly */
8689 if(( usMPDUDOffset > ucMPDUHOffset ) &&
8690 ( usMPDULen >= ucMPDUHLen ) && ( usPktLen >= usMPDULen ) &&
8691 ( !WLANTL_TID_INVALID(ucTid) ))
8692 {
8693 ucMPDUHOffset = usMPDUDOffset - WLANTL_MPDU_HEADER_LEN;
8694 }
8695 else
8696 {
8697 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8698 "WLAN TL:BD header corrupted - dropping packet"));
8699 /* Drop packet */
8700 vos_pkt_return_packet(vosDataBuff);
8701 return VOS_STATUS_SUCCESS;
8702 }
8703 }
8704 else
8705 {
8706 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8707 "WLAN TL:BD header corrupted - dropping packet"));
8708 /* Drop packet */
8709 vos_pkt_return_packet(vosDataBuff);
8710 return VOS_STATUS_SUCCESS;
8711 }
8712 }
8713
8714#ifdef FEATURE_WLAN_WAPI
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308715 if ( pClientSTA->wSTADesc.ucIsWapiSta )
Jeff Johnson295189b2012-06-20 16:38:30 -07008716 {
8717 vosStatus = WLANTL_GetEtherType(aucBDHeader, vosDataBuff, ucMPDUHLen, &usEtherType);
8718 if( VOS_IS_STATUS_SUCCESS(vosStatus) )
8719 {
8720 if ( WLANTL_LLC_WAI_TYPE == usEtherType )
8721 {
8722 if ( !( WLANHAL_RX_IS_UNPROTECTED_WPI_FRAME(aucBDHeader)) )
8723 {
8724 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8725 "WLAN TL:WAI frame was received encrypted - dropping"));
8726 /* Drop packet */
8727 /*Temporary fix added to fix wapi rekey issue*/
8728 //vos_pkt_return_packet(vosDataBuff);
8729 //return vosStatus; //returning success
8730 }
8731 }
8732 else
8733 {
8734 if ( WLANHAL_RX_IS_UNPROTECTED_WPI_FRAME(aucBDHeader) )
8735 {
8736 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8737 "WLAN TL:Non-WAI frame was received unencrypted - dropping"));
8738 /* Drop packet */
8739 vos_pkt_return_packet(vosDataBuff);
8740 return vosStatus; //returning success
8741 }
8742 }
8743 }
8744 else //could not extract EtherType - this should not happen
8745 {
8746 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Jeff Johnson04dd8a82012-06-29 20:41:40 -07008747 "WLAN TL:Could not extract EtherType"));
8748 //Packet is already freed
Jeff Johnson295189b2012-06-20 16:38:30 -07008749 return vosStatus; //returning failure
Jeff Johnson295189b2012-06-20 16:38:30 -07008750 }
8751 }
8752#endif /* FEATURE_WLAN_WAPI */
8753
8754 /*----------------------------------------------------------------------
8755 Increment receive counter
8756 !! not sure this is the best place to increase this - pkt might be
8757 dropped below or delayed in TL's queues
8758 - will leave it here for now
8759 ------------------------------------------------------------------------*/
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -07008760 if ( !WLANTL_TID_INVALID( ucTid) )
8761 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308762 pClientSTA->auRxCount[ucTid]++;
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -07008763 }
8764 else
8765 {
8766 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8767 "WLAN TL:Invalid tid %d (Station ID %d) on %s",
8768 ucTid, ucSTAId, __func__));
8769 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008770
8771 /*------------------------------------------------------------------------
8772 Check if AMSDU and send for processing if so
8773 ------------------------------------------------------------------------*/
8774 ucAsf = (v_U8_t)WDA_GET_RX_ASF(aucBDHeader);
8775
8776 if ( 0 != ucAsf )
8777 {
8778 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8779 "WLAN TL:Packet is AMSDU sub frame - sending for completion"));
8780 vosStatus = WLANTL_AMSDUProcess( pvosGCtx, &vosDataBuff, aucBDHeader, ucSTAId,
8781 ucMPDUHLen, usMPDULen );
8782 if(NULL == vosDataBuff)
8783 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07008784 //Packet is already freed
Jeff Johnson295189b2012-06-20 16:38:30 -07008785 return VOS_STATUS_SUCCESS;
8786 }
8787 }
8788 /* After AMSDU header handled
8789 * AMSDU frame just same with normal frames */
8790 /*-------------------------------------------------------------------
8791 Translating header if necesary
8792 !! Fix me: rmv comments below
8793 ----------------------------------------------------------------------*/
8794 if (( 0 == WDA_GET_RX_FT_DONE(aucBDHeader) ) &&
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308795 ( 0 != pClientSTA->wSTADesc.ucSwFrameRXXlation) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07008796 ( WLANTL_IS_DATA_FRAME(WDA_GET_RX_TYPE_SUBTYPE(aucBDHeader)) ))
8797 {
8798 if(0 == ucMPDUHLen)
8799 {
8800 ucMPDUHLen = ucPMPDUHLen;
8801 }
8802 if (usMPDUDOffset > ucMPDUHOffset)
8803 {
8804 usActualHLen = usMPDUDOffset - ucMPDUHOffset;
8805 }
8806 vosStatus = WLANTL_Translate80211To8023Header( vosDataBuff, &vosStatus, usActualHLen,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008807 ucMPDUHLen, pTLCb, ucSTAId, bForwardIAPPwithLLC);
Jeff Johnson295189b2012-06-20 16:38:30 -07008808
8809 if ( VOS_STATUS_SUCCESS != vosStatus )
8810 {
Kaushik, Sushante386ee12014-05-01 15:50:52 +05308811 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Jeff Johnson295189b2012-06-20 16:38:30 -07008812 "WLAN TL:Failed to translate from 802.11 to 802.3 - dropping"));
8813 /* Drop packet */
8814 vos_pkt_return_packet(vosDataBuff);
8815 return vosStatus;
8816 }
8817 }
8818 /* Softap requires additional Info such as Destination STAID and Access
8819 Category. Voschain or Buffer returned by BA would be unchain and this
8820 Meta Data would help in routing the packets to appropriate Destination */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308821 if( WLAN_STA_SOFTAP == pClientSTA->wSTADesc.wSTAType)
Jeff Johnson295189b2012-06-20 16:38:30 -07008822 {
Arun Kumar Khandavalli37cfc222014-01-09 22:32:40 +05308823 STAMetaInfoPtr = (v_U32_t *)(uintptr_t)(ucTid | (WDA_GET_RX_ADDR3_IDX(aucBDHeader) << WLANTL_STAID_OFFSET));
Jeff Johnson295189b2012-06-20 16:38:30 -07008824 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
8825 (v_PVOID_t)STAMetaInfoPtr);
8826 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008827
8828 /*------------------------------------------------------------------------
8829 Check to see if re-ordering session is in place
8830 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308831 if ( 0 != pClientSTA->atlBAReorderInfo[ucTid].ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07008832 {
8833 WLANTL_MSDUReorder( pTLCb, &vosDataBuff, aucBDHeader, ucSTAId, ucTid );
8834 }
8835
Jeff Johnson295189b2012-06-20 16:38:30 -07008836if(0 == ucUnicastBroadcastType
8837#ifdef FEATURE_ON_CHIP_REORDERING
8838 && (WLANHAL_IsOnChipReorderingEnabledForTID(pvosGCtx, ucSTAId, ucTid) != TRUE)
8839#endif
8840)
8841{
8842 /* replay check code : check whether replay check is needed or not */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308843 if(VOS_TRUE == pClientSTA->ucIsReplayCheckValid)
Jeff Johnson295189b2012-06-20 16:38:30 -07008844 {
8845 /* replay check is needed for the station */
8846
8847 /* check whether frame is AMSDU frame */
8848 if ( 0 != ucAsf )
8849 {
8850 /* Since virgo can't send AMSDU frames this leg of the code
8851 was not tested properly, it needs to be tested properly*/
8852 /* Frame is AMSDU frame. As per 802.11n only first
8853 subframe will have replay counter */
8854 ucEsf = WDA_GET_RX_ESF( aucBDHeader );
8855 if( 0 != ucEsf )
8856 {
8857 v_BOOL_t status;
8858 /* Getting 48-bit replay counter from the RX BD */
8859 ullcurrentReplayCounter = WDA_DS_GetReplayCounter(aucBDHeader);
8860
8861 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Arif Hussainf2b00992013-11-17 21:46:15 -08008862 "WLAN TL: AMSDU currentReplayCounter [0x%llX]",ullcurrentReplayCounter);
Jeff Johnson295189b2012-06-20 16:38:30 -07008863
8864 /* Getting 48-bit previous replay counter from TL control block */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308865 ullpreviousReplayCounter = pClientSTA->ullReplayCounter[ucTid];
Jeff Johnson295189b2012-06-20 16:38:30 -07008866
8867 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Arif Hussainf2b00992013-11-17 21:46:15 -08008868 "WLAN TL: AMSDU previousReplayCounter [0x%llX]",ullpreviousReplayCounter);
Jeff Johnson295189b2012-06-20 16:38:30 -07008869
8870 /* It is first subframe of AMSDU thus it
8871 conatains replay counter perform the
8872 replay check for this first subframe*/
8873 status = WLANTL_IsReplayPacket( ullcurrentReplayCounter, ullpreviousReplayCounter);
8874 if(VOS_FALSE == status)
8875 {
8876 /* Not a replay paket, update previous replay counter in TL CB */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308877 pClientSTA->ullReplayCounter[ucTid] = ullcurrentReplayCounter;
Jeff Johnson295189b2012-06-20 16:38:30 -07008878 }
8879 else
8880 {
8881 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08008882 "WLAN TL: AMSDU Drop the replay packet with PN : [0x%llX]",ullcurrentReplayCounter);
Jeff Johnson295189b2012-06-20 16:38:30 -07008883
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308884 pClientSTA->ulTotalReplayPacketsDetected++;
Jeff Johnson295189b2012-06-20 16:38:30 -07008885 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08008886 "WLAN TL: AMSDU total dropped replay packets on STA ID %X is [0x%X]",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308887 ucSTAId, pClientSTA->ulTotalReplayPacketsDetected);
Jeff Johnson295189b2012-06-20 16:38:30 -07008888
8889 /* Drop the packet */
8890 vos_pkt_return_packet(vosDataBuff);
8891 return VOS_STATUS_SUCCESS;
8892 }
8893 }
8894 }
8895 else
8896 {
8897 v_BOOL_t status;
8898
8899 /* Getting 48-bit replay counter from the RX BD */
8900 ullcurrentReplayCounter = WDA_DS_GetReplayCounter(aucBDHeader);
8901
8902 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Arif Hussainf2b00992013-11-17 21:46:15 -08008903 "WLAN TL: Non-AMSDU currentReplayCounter [0x%llX]",ullcurrentReplayCounter);
Jeff Johnson295189b2012-06-20 16:38:30 -07008904
8905 /* Getting 48-bit previous replay counter from TL control block */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308906 ullpreviousReplayCounter = pClientSTA->ullReplayCounter[ucTid];
Jeff Johnson295189b2012-06-20 16:38:30 -07008907
8908 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Arif Hussainf2b00992013-11-17 21:46:15 -08008909 "WLAN TL: Non-AMSDU previousReplayCounter [0x%llX]",ullpreviousReplayCounter);
Jeff Johnson295189b2012-06-20 16:38:30 -07008910
8911 /* It is not AMSDU frame so perform
8912 reaply check for each packet, as
8913 each packet contains valid replay counter*/
8914 status = WLANTL_IsReplayPacket( ullcurrentReplayCounter, ullpreviousReplayCounter);
8915 if(VOS_FALSE == status)
8916 {
8917 /* Not a replay paket, update previous replay counter in TL CB */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308918 pClientSTA->ullReplayCounter[ucTid] = ullcurrentReplayCounter;
Jeff Johnson295189b2012-06-20 16:38:30 -07008919 }
8920 else
8921 {
8922 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08008923 "WLAN TL: Non-AMSDU Drop the replay packet with PN : [0x%llX]",ullcurrentReplayCounter);
Jeff Johnson295189b2012-06-20 16:38:30 -07008924
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308925 pClientSTA->ulTotalReplayPacketsDetected++;
Jeff Johnson295189b2012-06-20 16:38:30 -07008926 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08008927 "WLAN TL: Non-AMSDU total dropped replay packets on STA ID %X is [0x%X]",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308928 ucSTAId, pClientSTA->ulTotalReplayPacketsDetected);
Jeff Johnson295189b2012-06-20 16:38:30 -07008929
8930 /* Repaly packet, drop the packet */
8931 vos_pkt_return_packet(vosDataBuff);
8932 return VOS_STATUS_SUCCESS;
8933 }
8934 }
8935 }
8936}
8937/*It is a broadast packet DPU has already done replay check for
8938 broadcast packets no need to do replay check of these packets*/
Jeff Johnson295189b2012-06-20 16:38:30 -07008939
8940 if ( NULL != vosDataBuff )
8941 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308942 if( WLAN_STA_SOFTAP == pClientSTA->wSTADesc.wSTAType)
Jeff Johnson295189b2012-06-20 16:38:30 -07008943 {
8944 WLANTL_FwdPktToHDD( pvosGCtx, vosDataBuff, ucSTAId );
8945 }
8946 else
Jeff Johnson295189b2012-06-20 16:38:30 -07008947 {
8948 wRxMetaInfo.ucUP = ucTid;
Shailender Karmuchi13c0d082013-03-26 14:41:39 -07008949 wRxMetaInfo.rssiAvg = pClientSTA->rssiAvg;
Gopichand Nakkala4a2fc1a2013-05-17 16:59:39 +05308950#ifdef FEATURE_WLAN_TDLS
8951 if (WLAN_STA_TDLS == pClientSTA->wSTADesc.wSTAType)
8952 {
8953 wRxMetaInfo.isStaTdls = TRUE;
8954 }
8955 else
8956 {
8957 wRxMetaInfo.isStaTdls = FALSE;
8958 }
8959#endif
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308960 pClientSTA->pfnSTARx( pvosGCtx, vosDataBuff, ucSTAId,
Jeff Johnson295189b2012-06-20 16:38:30 -07008961 &wRxMetaInfo );
8962 }
8963 }/* if not NULL */
8964
8965 return VOS_STATUS_SUCCESS;
8966}/* WLANTL_STARxAuth */
8967
8968
8969/*==========================================================================
8970 FUNCTION WLANTL_STARxDisc
8971
8972 DESCRIPTION
8973 Receive in disconnected state - no data allowed
8974
8975 DEPENDENCIES
8976 The STA must be registered with TL before this function can be called.
8977
8978 PARAMETERS
8979
8980 IN
8981 pvosGCtx: pointer to the global vos context; a handle to TL's
8982 control block can be extracted from its context
8983 ucSTAId: identifier of the station being processed
8984 vosDataBuff: pointer to the rx vos buffer
8985
8986 RETURN VALUE
8987 The result code associated with performing the operation
8988
8989 VOS_STATUS_SUCCESS: Everything is good :)
8990
8991 SIDE EFFECTS
8992
8993============================================================================*/
8994VOS_STATUS
8995WLANTL_STARxDisc
8996(
8997 v_PVOID_t pvosGCtx,
8998 v_U8_t ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008999 vos_pkt_t** pvosDataBuff,
9000 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -07009001)
9002{
9003 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
9004
9005 /*------------------------------------------------------------------------
9006 Sanity check
9007 ------------------------------------------------------------------------*/
9008 if (( NULL == pvosDataBuff ) || ( NULL == *pvosDataBuff ))
9009 {
9010 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9011 "WLAN TL:Invalid parameter sent on WLANTL_STARxDisc"));
9012 return VOS_STATUS_E_INVAL;
9013 }
9014
9015 /*------------------------------------------------------------------------
9016 Error - drop packet
9017 ------------------------------------------------------------------------*/
9018 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9019 "WLAN TL:Packet should not be received in state disconnected"
9020 " - dropping"));
9021 vos_pkt_return_packet(*pvosDataBuff);
9022 *pvosDataBuff = NULL;
9023
9024 return VOS_STATUS_SUCCESS;
9025}/* WLANTL_STARxDisc */
9026
9027/*==========================================================================
9028 Processing main loops for MAIN and TX threads
9029 ==========================================================================*/
9030
9031/*==========================================================================
9032 FUNCTION WLANTL_McProcessMsg
9033
9034 DESCRIPTION
9035 Called by VOSS when a message was serialized for TL through the
9036 main thread/task.
9037
9038 DEPENDENCIES
9039 The TL must be initialized before this function can be called.
9040
9041 PARAMETERS
9042
9043 IN
9044 pvosGCtx: pointer to the global vos context; a handle to TL's
9045 control block can be extracted from its context
9046 message: type and content of the message
9047
9048
9049 RETURN VALUE
9050 The result code associated with performing the operation
9051
9052 VOS_STATUS_E_INVAL: invalid input parameters
9053 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
9054 page fault
9055 VOS_STATUS_SUCCESS: Everything is good :)
9056
9057 SIDE EFFECTS
9058
9059============================================================================*/
9060VOS_STATUS
9061WLANTL_McProcessMsg
9062(
9063 v_PVOID_t pvosGCtx,
9064 vos_msg_t* message
9065)
9066{
9067 WLANTL_CbType* pTLCb = NULL;
9068 tAddBAInd* ptAddBaInd = NULL;
9069 tDelBAInd* ptDelBaInd = NULL;
9070 tAddBARsp* ptAddBaRsp = NULL;
9071 vos_msg_t vosMessage;
9072 VOS_STATUS vosStatus;
9073 tpFlushACRsp FlushACRspPtr;
9074 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
9075
9076 /*------------------------------------------------------------------------
9077 Sanity check
9078 ------------------------------------------------------------------------*/
9079 if ( NULL == message )
9080 {
9081 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9082 "WLAN TL:Invalid parameter sent on WLANTL_ProcessMainMessage"));
9083 return VOS_STATUS_E_INVAL;
9084 }
9085
9086 /*------------------------------------------------------------------------
9087 Extract TL control block
9088 ------------------------------------------------------------------------*/
9089 pTLCb = VOS_GET_TL_CB(pvosGCtx);
9090 if ( NULL == pTLCb )
9091 {
9092 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9093 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ProcessMainMessage"));
9094 return VOS_STATUS_E_FAULT;
9095 }
9096
9097 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9098 "WLAN TL:Received message: %d through main flow", message->type));
9099
9100 switch( message->type )
9101 {
9102 case WDA_TL_FLUSH_AC_RSP:
9103 // Extract the message from the message body
9104 FlushACRspPtr = (tpFlushACRsp)(message->bodyptr);
9105 // Make sure the call back function is not null.
Tushnim Bhattacharyya5dd94562013-03-20 20:15:03 -07009106 if ( NULL == pTLCb->tlBAPClient.pfnFlushOpCompleteCb )
9107 {
9108 VOS_ASSERT(0);
9109 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9110 "WLAN TL:Invalid TL pointer pfnFlushOpCompleteCb"));
9111 return VOS_STATUS_E_FAULT;
9112 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009113
9114 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9115 "Received message: Flush complete received by TL"));
9116
9117 // Since we have the response back from HAL, just call the BAP client
9118 // registered call back from TL. There is only 1 possible
9119 // BAP client. So directly reference tlBAPClient
9120 pTLCb->tlBAPClient.pfnFlushOpCompleteCb( pvosGCtx,
9121 FlushACRspPtr->ucSTAId,
9122 FlushACRspPtr->ucTid, FlushACRspPtr->status );
9123
9124 // Free the PAL memory, we are done with it.
9125 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9126 "Flush complete received by TL: Freeing %p", FlushACRspPtr));
9127 vos_mem_free((v_VOID_t *)FlushACRspPtr);
9128 break;
9129
9130 case WDA_HDD_ADDBA_REQ:
9131 ptAddBaInd = (tAddBAInd*)(message->bodyptr);
9132 vosStatus = WLANTL_BaSessionAdd( pvosGCtx,
9133 ptAddBaInd->baSession.baSessionID,
9134 ptAddBaInd->baSession.STAID,
9135 ptAddBaInd->baSession.baTID,
9136 (v_U32_t)ptAddBaInd->baSession.baBufferSize,
9137 ptAddBaInd->baSession.winSize,
9138 ptAddBaInd->baSession.SSN);
9139 ptAddBaRsp = vos_mem_malloc(sizeof(*ptAddBaRsp));
9140
9141 if ( NULL == ptAddBaRsp )
9142 {
9143 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9144 "WLAN TL: fatal failure, cannot allocate BA Rsp structure"));
9145 VOS_ASSERT(0);
9146 return VOS_STATUS_E_NOMEM;
9147 }
9148
9149 if ( VOS_STATUS_SUCCESS == vosStatus )
9150 {
9151 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9152 "WLAN TL: Sending success indication to HAL for ADD BA"));
9153 /*Send success*/
9154 ptAddBaRsp->mesgType = WDA_HDD_ADDBA_RSP;
9155 vosMessage.type = WDA_HDD_ADDBA_RSP;
9156 }
9157 else
9158 {
9159 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9160 "WLAN TL: Sending failure indication to HAL for ADD BA"));
9161
9162 /*Send failure*/
9163 ptAddBaRsp->mesgType = WDA_BA_FAIL_IND;
9164 vosMessage.type = WDA_BA_FAIL_IND;
9165 }
9166
9167 ptAddBaRsp->mesgLen = sizeof(tAddBARsp);
9168 ptAddBaRsp->baSessionID = ptAddBaInd->baSession.baSessionID;
9169 /* This is default, reply win size has to be handled BA module, FIX THIS */
9170 ptAddBaRsp->replyWinSize = WLANTL_MAX_WINSIZE;
9171 vosMessage.bodyptr = ptAddBaRsp;
9172
9173 vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
9174 WLANTL_McFreeMsg (pvosGCtx, message);
9175 break;
9176 case WDA_DELETEBA_IND:
9177 ptDelBaInd = (tDelBAInd*)(message->bodyptr);
9178 vosStatus = WLANTL_BaSessionDel(pvosGCtx,
9179 ptDelBaInd->staIdx,
9180 ptDelBaInd->baTID);
9181
9182 if ( VOS_STATUS_SUCCESS != vosStatus )
9183 {
9184 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9185 "WLAN TL: Failed to del BA session STA:%d TID:%d Status :%d",
9186 ptDelBaInd->staIdx,
9187 ptDelBaInd->baTID,
9188 vosStatus));
9189 }
9190 WLANTL_McFreeMsg (pvosGCtx, message);
9191 break;
9192 default:
9193 /*no processing for now*/
9194 break;
9195 }
9196
9197 return VOS_STATUS_SUCCESS;
9198}/* WLANTL_ProcessMainMessage */
9199
9200/*==========================================================================
9201 FUNCTION WLANTL_McFreeMsg
9202
9203 DESCRIPTION
9204 Called by VOSS to free a given TL message on the Main thread when there
9205 are messages pending in the queue when the whole system is been reset.
9206 For now, TL does not allocate any body so this function shout translate
9207 into a NOOP
9208
9209 DEPENDENCIES
9210 The TL must be initialized before this function can be called.
9211
9212 PARAMETERS
9213
9214 IN
9215 pvosGCtx: pointer to the global vos context; a handle to TL's
9216 control block can be extracted from its context
9217 message: type and content of the message
9218
9219
9220 RETURN VALUE
9221 The result code associated with performing the operation
9222
9223 VOS_STATUS_SUCCESS: Everything is good :)
9224
9225 SIDE EFFECTS
9226
9227============================================================================*/
9228VOS_STATUS
9229WLANTL_McFreeMsg
9230(
9231 v_PVOID_t pvosGCtx,
9232 vos_msg_t* message
9233)
9234{
9235 WLANTL_CbType* pTLCb = NULL;
9236 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
9237
9238 /*------------------------------------------------------------------------
9239 Sanity check
9240 ------------------------------------------------------------------------*/
9241 if ( NULL == message )
9242 {
9243 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9244 "WLAN TL:Invalid parameter sent on WLANTL_McFreeMsg"));
9245 return VOS_STATUS_E_INVAL;
9246 }
9247
9248 /*------------------------------------------------------------------------
9249 Extract TL control block
9250 ------------------------------------------------------------------------*/
9251 pTLCb = VOS_GET_TL_CB(pvosGCtx);
9252 if ( NULL == pTLCb )
9253 {
9254 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9255 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_McFreeMsg"));
9256 return VOS_STATUS_E_FAULT;
9257 }
9258
9259 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9260 "WLAN TL:Received message: %d through main free", message->type));
9261
9262 switch( message->type )
9263 {
9264 case WDA_HDD_ADDBA_REQ:
9265 case WDA_DELETEBA_IND:
9266 /*vos free body pointer*/
9267 vos_mem_free(message->bodyptr);
9268 message->bodyptr = NULL;
9269 break;
9270 default:
9271 /*no processing for now*/
9272 break;
9273 }
9274
9275 return VOS_STATUS_SUCCESS;
9276}/*WLANTL_McFreeMsg*/
9277
9278/*==========================================================================
9279 FUNCTION WLANTL_TxProcessMsg
9280
9281 DESCRIPTION
9282 Called by VOSS when a message was serialized for TL through the
9283 tx thread/task.
9284
9285 DEPENDENCIES
9286 The TL must be initialized before this function can be called.
9287
9288 PARAMETERS
9289
9290 IN
9291 pvosGCtx: pointer to the global vos context; a handle to TL's
9292 control block can be extracted from its context
9293 message: type and content of the message
9294
9295
9296 RETURN VALUE
9297 The result code associated with performing the operation
9298
9299 VOS_STATUS_E_INVAL: invalid input parameters
9300 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
9301 page fault
9302 VOS_STATUS_SUCCESS: Everything is good :)
9303
9304 Other values can be returned as a result of a function call, please check
9305 corresponding API for more info.
9306 SIDE EFFECTS
9307
9308============================================================================*/
9309VOS_STATUS
9310WLANTL_TxProcessMsg
9311(
9312 v_PVOID_t pvosGCtx,
9313 vos_msg_t* message
9314)
9315{
9316 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07009317 void (*callbackRoutine) (void *callbackContext);
9318 void *callbackContext;
Jeff Johnson295189b2012-06-20 16:38:30 -07009319 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
9320
9321 /*------------------------------------------------------------------------
9322 Sanity check
9323 ------------------------------------------------------------------------*/
9324 if ( NULL == message )
9325 {
9326 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9327 "WLAN TL:Invalid parameter sent on WLANTL_ProcessTxMessage"));
9328 return VOS_STATUS_E_INVAL;
9329 }
9330
9331 /*------------------------------------------------------------------------
9332 Process message
9333 ------------------------------------------------------------------------*/
9334 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9335 "WLAN TL:Received message: %d through tx flow", message->type));
9336
9337 switch( message->type )
9338 {
9339 case WLANTL_TX_SIG_SUSPEND:
9340 vosStatus = WLANTL_SuspendCB( pvosGCtx,
9341 (WLANTL_SuspendCBType)message->bodyptr,
9342 message->reserved);
9343 break;
9344 case WLANTL_TX_RES_NEEDED:
9345 vosStatus = WLANTL_GetTxResourcesCB( pvosGCtx );
9346 break;
Katya Nigam664f5032014-05-05 12:24:32 +05309347
Jeff Johnson295189b2012-06-20 16:38:30 -07009348 case WDA_DS_TX_START_XMIT:
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05309349 WLANTL_ClearTxXmitPending(pvosGCtx);
9350 vosStatus = WDA_DS_TxFrames( pvosGCtx );
Jeff Johnson295189b2012-06-20 16:38:30 -07009351 break;
9352
9353 case WDA_DS_FINISH_ULA:
Arun Kumar Khandavalli8d1979d2014-01-09 21:12:25 +05309354 callbackContext = message->bodyptr;
9355 callbackRoutine = message->callback;
9356 if ( NULL != callbackRoutine )
9357 {
9358 callbackRoutine(callbackContext);
9359 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009360 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07009361
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05309362 case WLANTL_TX_SNAPSHOT:
9363 /*Dumping TL State and then continuing to print
9364 the DXE Dump*/
9365 WLANTL_TxThreadDebugHandler(pvosGCtx);
9366 WDA_TransportChannelDebug(NULL, VOS_TRUE, VOS_FALSE);
9367 break;
9368
Mihir Shetefd62d9d2014-08-06 15:08:21 +05309369 case WLANTL_TX_FATAL_ERROR:
9370 WLANTL_FatalErrorHandler(pvosGCtx);
9371 break;
9372
Mihir Shete327c2ab2014-11-13 15:17:02 +05309373 case WLANTL_TX_FW_DEBUG:
9374 vos_fwDumpReq(274, 0, 0, 0, 0);
9375 break;
9376
Jeff Johnson295189b2012-06-20 16:38:30 -07009377 default:
9378 /*no processing for now*/
9379 break;
9380 }
9381
9382 return vosStatus;
9383}/* WLANTL_TxProcessMsg */
9384
9385/*==========================================================================
9386 FUNCTION WLANTL_McFreeMsg
9387
9388 DESCRIPTION
9389 Called by VOSS to free a given TL message on the Main thread when there
9390 are messages pending in the queue when the whole system is been reset.
9391 For now, TL does not allocate any body so this function shout translate
9392 into a NOOP
9393
9394 DEPENDENCIES
9395 The TL must be initialized before this function can be called.
9396
9397 PARAMETERS
9398
9399 IN
9400 pvosGCtx: pointer to the global vos context; a handle to TL's
9401 control block can be extracted from its context
9402 message: type and content of the message
9403
9404
9405 RETURN VALUE
9406 The result code associated with performing the operation
9407
9408 VOS_STATUS_SUCCESS: Everything is good :)
9409
9410 SIDE EFFECTS
9411
9412============================================================================*/
9413VOS_STATUS
9414WLANTL_TxFreeMsg
9415(
9416 v_PVOID_t pvosGCtx,
9417 vos_msg_t* message
9418)
9419{
9420 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
9421
9422 /*Nothing to do for now!!!*/
9423 return VOS_STATUS_SUCCESS;
9424}/*WLANTL_TxFreeMsg*/
9425
Jeff Johnson295189b2012-06-20 16:38:30 -07009426/*==========================================================================
9427
9428 FUNCTION WLANTL_TxFCFrame
9429
9430 DESCRIPTION
9431 Internal utility function to send FC frame. Enable
9432 or disable LWM mode based on the information.
9433
9434 DEPENDENCIES
9435 TL must be initiailized before this function gets called.
9436 FW sends up special flow control frame.
9437
9438 PARAMETERS
9439
9440 IN
9441 pvosGCtx: pointer to the global vos context; a handle to TL's
9442 control block can be extracted from its context
9443
9444 RETURN VALUE
9445 The result code associated with performing the operation
9446
9447 VOS_STATUS_E_INVAL: Input pointers are NULL.
9448 VOS_STATUS_E_FAULT: Something is wrong.
9449 VOS_STATUS_SUCCESS: Everything is good.
9450
9451 SIDE EFFECTS
9452 Newly formed FC frame is generated and waits to be transmitted. Previously unsent frame will
9453 be released.
9454
9455============================================================================*/
9456VOS_STATUS
9457WLANTL_TxFCFrame
9458(
9459 v_PVOID_t pvosGCtx
9460)
9461{
9462#if 0
9463 WLANTL_CbType* pTLCb = NULL;
9464 VOS_STATUS vosStatus;
9465 tpHalFcTxBd pvFcTxBd = NULL;
9466 vos_pkt_t * pPacket = NULL;
9467 v_U8_t ucSTAId = 0;
9468 v_U8_t ucBitCheck = 1;
9469
9470 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009471 "WLAN TL: Send FC frame %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009472
9473 /*------------------------------------------------------------------------
9474 Sanity check
9475 ------------------------------------------------------------------------*/
9476 if ( NULL == pvosGCtx )
9477 {
9478 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009479 "WLAN TL:Invalid parameter %s", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07009480 return VOS_STATUS_E_INVAL;
9481 }
9482 /*------------------------------------------------------------------------
9483 Extract TL control block
9484 ------------------------------------------------------------------------*/
9485 pTLCb = VOS_GET_TL_CB(pvosGCtx);
9486
9487 if (NULL == pTLCb)
9488 {
9489 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009490 "WLAN TL:Invalid pointer in %s \n", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07009491 return VOS_STATUS_E_INVAL;
9492 }
9493
9494 //Get one voss packet
9495 vosStatus = vos_pkt_get_packet( &pPacket, VOS_PKT_TYPE_TX_802_11_MGMT, sizeof(tHalFcTxBd), 1,
9496 VOS_FALSE, NULL, NULL );
9497
9498 if ( VOS_STATUS_SUCCESS != vosStatus )
9499 {
9500 return VOS_STATUS_E_INVAL;
9501 }
9502
9503 vosStatus = vos_pkt_reserve_head( pPacket, (void *)&pvFcTxBd, sizeof(tHalFcTxBd));
9504
9505 if( VOS_STATUS_SUCCESS != vosStatus )
9506 {
9507 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009508 "%s: failed to reserve FC TX BD %d\n",__func__, sizeof(tHalFcTxBd)));
Jeff Johnson295189b2012-06-20 16:38:30 -07009509 vos_pkt_return_packet( pPacket );
9510 return VOS_STATUS_E_FAULT;
9511 }
9512
9513 //Generate most recent tlFCInfo. Most fields are correct.
9514 pTLCb->tlFCInfo.fcSTAThreshEnabledMask = 0;
9515 pTLCb->tlFCInfo.fcSTATxMoreDataMask = 0;
9516 for( ucSTAId = 0, ucBitCheck = 1 ; ucSTAId < WLAN_MAX_STA_COUNT; ucBitCheck <<= 1, ucSTAId ++)
9517 {
9518 if (0 == pTLCb->atlSTAClients[ucSTAId].ucExists)
9519 {
9520 continue;
9521 }
9522
9523 if (pTLCb->atlSTAClients[ucSTAId].ucPktPending)
9524 {
9525 pTLCb->tlFCInfo.fcSTATxMoreDataMask |= ucBitCheck;
9526 }
9527
9528 if ( (pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled) &&
9529 (pTLCb->atlSTAClients[ucSTAId].bmuMemConsumed > pTLCb->atlSTAClients[ucSTAId].uLwmThreshold))
9530 {
9531 pTLCb->tlFCInfo.fcSTAThreshEnabledMask |= ucBitCheck;
9532
9533 pTLCb->tlFCInfo.fcSTAThresh[ucSTAId] = (tANI_U8)pTLCb->atlSTAClients[ucSTAId].uLwmThreshold;
9534
9535 pTLCb->atlSTAClients[ucSTAId].ucLwmEventReported = FALSE;
9536 }
9537
9538 }
9539
9540 //request immediate feedback
9541 pTLCb->tlFCInfo.fcConfig |= 0x4;
9542
9543 //fill in BD to sent
9544 vosStatus = WLANHAL_FillFcTxBd(pvosGCtx, &pTLCb->tlFCInfo, (void *)pvFcTxBd);
9545
9546 if( VOS_STATUS_SUCCESS != vosStatus )
9547 {
9548 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009549 "%s: Fill FC TX BD unsuccessful\n", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07009550 vos_pkt_return_packet( pPacket );
9551 return VOS_STATUS_E_FAULT;
9552 }
9553
9554 if (NULL != pTLCb->vosTxFCBuf)
9555 {
9556 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009557 "%s: Previous FC TX BD not sent\n", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07009558 vos_pkt_return_packet(pTLCb->vosTxFCBuf);
9559 }
9560
9561 pTLCb->vosTxFCBuf = pPacket;
9562
9563 vos_pkt_set_user_data_ptr( pPacket, VOS_PKT_USER_DATA_ID_TL,
9564 (v_PVOID_t)WLANTL_TxCompDefaultCb);
9565 vosStatus = WDA_DS_StartXmit(pvosGCtx);
9566
9567 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009568 "WLAN TL: send FC frame leave %s", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07009569#endif
9570 return VOS_STATUS_SUCCESS;
9571}
9572
Jeff Johnson295189b2012-06-20 16:38:30 -07009573
9574/*==========================================================================
9575 FUNCTION WLANTL_GetTxResourcesCB
9576
9577 DESCRIPTION
9578 Processing function for Resource needed signal. A request will be issued
9579 to BAL to get more tx resources.
9580
9581 DEPENDENCIES
9582 The TL must be initialized before this function can be called.
9583
9584 PARAMETERS
9585
9586 IN
9587 pvosGCtx: pointer to the global vos context; a handle to TL's
9588 control block can be extracted from its context
9589
9590
9591 RETURN VALUE
9592 The result code associated with performing the operation
9593
9594 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
9595 page fault
9596 VOS_STATUS_SUCCESS: Everything is good :)
9597
9598 Other values can be returned as a result of a function call, please check
9599 corresponding API for more info.
9600 SIDE EFFECTS
9601
9602============================================================================*/
9603VOS_STATUS
9604WLANTL_GetTxResourcesCB
9605(
9606 v_PVOID_t pvosGCtx
9607)
9608{
9609 WLANTL_CbType* pTLCb = NULL;
9610 v_U32_t uResCount = WDA_TLI_MIN_RES_DATA;
9611 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
9612 v_U8_t ucMgmt = 0;
9613 v_U8_t ucBAP = 0;
9614 v_U8_t ucData = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07009615#ifdef WLAN_SOFTAP_FLOWCTRL_EN
9616 tBssSystemRole systemRole;
9617 tpAniSirGlobal pMac;
9618#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07009619 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
9620 /*------------------------------------------------------------------------
9621 Extract TL control block
9622 ------------------------------------------------------------------------*/
9623 pTLCb = VOS_GET_TL_CB(pvosGCtx);
9624 if ( NULL == pTLCb )
9625 {
9626 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9627 "WLAN TL:Invalid TL pointer from pvosGCtx on"
9628 " WLANTL_ProcessTxMessage"));
9629 return VOS_STATUS_E_FAULT;
9630 }
9631
9632 /*------------------------------------------------------------------------
9633 Get tx resources from BAL
9634 ------------------------------------------------------------------------*/
9635 vosStatus = WDA_DS_GetTxResources( pvosGCtx, &uResCount );
9636
9637 if ( (VOS_STATUS_SUCCESS != vosStatus) && (VOS_STATUS_E_RESOURCES != vosStatus))
9638 {
9639 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9640 "WLAN TL:TL failed to get resources from BAL, Err: %d",
9641 vosStatus));
9642 return vosStatus;
9643 }
9644
9645 /* Currently only Linux BAL returns the E_RESOURCES error code when it is running
9646 out of BD/PDUs. To make use of this interrupt for throughput enhancement, similar
9647 changes should be done in BAL code of AMSS and WM */
9648 if (VOS_STATUS_E_RESOURCES == vosStatus)
9649 {
9650#ifdef VOLANS_PERF
9651 WLANHAL_EnableIdleBdPduInterrupt(pvosGCtx, (tANI_U8)bdPduInterruptGetThreshold);
9652 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9653 "WLAN TL: Enabling Idle BD/PDU interrupt, Current resources = %d", uResCount);
9654#else
9655 return VOS_STATUS_E_FAILURE;
9656#endif
9657 }
9658
9659 pTLCb->uResCount = uResCount;
9660
9661
Jeff Johnson295189b2012-06-20 16:38:30 -07009662#ifdef WLAN_SOFTAP_FLOWCTRL_EN
9663 /* FIXME: disabled since creating issues in power-save, needs to be addressed */
9664 pTLCb->sendFCFrame ++;
9665 pMac = vos_get_context(VOS_MODULE_ID_WDA, pvosGCtx);
9666 systemRole = wdaGetGlobalSystemRole(pMac);
9667 if (eSYSTEM_AP_ROLE == systemRole)
9668 {
9669 if (pTLCb->sendFCFrame % 16 == 0)
9670 {
9671 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9672 "Transmit FC"));
9673 WLANTL_TxFCFrame (pvosGCtx);
9674 }
9675 }
9676#endif //WLAN_SOFTAP_FLOWCTRL_EN
Jeff Johnson295189b2012-06-20 16:38:30 -07009677
9678 ucData = ( pTLCb->uResCount >= WDA_TLI_MIN_RES_DATA );
9679 ucBAP = ( pTLCb->uResCount >= WDA_TLI_MIN_RES_BAP ) &&
9680 ( NULL != pTLCb->tlBAPClient.vosPendingDataBuff );
9681 ucMgmt = ( pTLCb->uResCount >= WDA_TLI_MIN_RES_MF ) &&
9682 ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff );
9683
9684 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9685 "WLAN TL: Eval Resume tx Res: %d DATA: %d BAP: %d MGMT: %d",
9686 pTLCb->uResCount, ucData, ucBAP, ucMgmt));
9687
9688 if (( 0 == pTLCb->ucTxSuspended ) &&
9689 (( 0 != ucData ) || ( 0 != ucMgmt ) || ( 0 != ucBAP ) ) )
9690 {
9691 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9692 "Issuing Xmit start request to BAL for avail res SYNC"));
9693 vosStatus =WDA_DS_StartXmit(pvosGCtx);
9694 }
9695 return vosStatus;
9696}/*WLANTL_GetTxResourcesCB*/
9697
9698/*==========================================================================
9699 Utility functions
9700 ==========================================================================*/
9701
9702/*==========================================================================
9703 FUNCTION WLANTL_Translate8023To80211Header
9704
9705 DESCRIPTION
9706 Inline function for translating and 802.11 header into an 802.3 header.
9707
9708 DEPENDENCIES
9709
9710
9711 PARAMETERS
9712
9713 IN
9714 pTLCb: TL control block
Kiran Venkatappaa044eb92012-12-17 15:48:49 -08009715 IN/OUT
9716 ucStaId: station ID. Incase of TDLS, this returns actual TDLS
9717 station ID used
Jeff Johnson295189b2012-06-20 16:38:30 -07009718
9719 IN/OUT
9720 vosDataBuff: vos data buffer, will contain the new header on output
9721
9722 OUT
9723 pvosStatus: status of the operation
9724
9725 RETURN VALUE
9726
9727 VOS_STATUS_SUCCESS: Everything is good :)
9728
9729 Other error codes might be returned from the vos api used in the function
9730 please check those return values.
9731
9732 SIDE EFFECTS
9733
9734============================================================================*/
Kiran Venkatappacab0d352012-12-17 13:09:22 -08009735VOS_STATUS
9736WLANTL_Translate8023To80211Header
9737(
9738 vos_pkt_t* vosDataBuff,
9739 VOS_STATUS* pvosStatus,
9740 WLANTL_CbType* pTLCb,
9741 v_U8_t *pucStaId,
Ravi Joshid0699502013-07-08 15:48:47 -07009742 WLANTL_MetaInfoType *tlMetaInfo,
Kiran Venkatappacab0d352012-12-17 13:09:22 -08009743 v_U8_t *ucWDSEnabled,
9744 v_U8_t *extraHeadSpace
9745)
Jeff Johnson295189b2012-06-20 16:38:30 -07009746{
9747 WLANTL_8023HeaderType w8023Header;
9748 WLANTL_80211HeaderType *pw80211Header; // Allocate an aligned BD and then fill it.
9749 VOS_STATUS vosStatus;
9750 v_U8_t MandatoryucHeaderSize = WLAN80211_MANDATORY_HEADER_SIZE;
9751 v_U8_t ucHeaderSize = 0;
9752 v_VOID_t *ppvBDHeader = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309753 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07009754 v_U8_t ucQoSOffset = WLAN80211_MANDATORY_HEADER_SIZE;
Kiran Venkatappacab0d352012-12-17 13:09:22 -08009755 v_U8_t ucStaId;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009756#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009757 v_BOOL_t bIAPPTxwithLLC = VOS_FALSE;
9758 v_SIZE_t wIAPPSnapSize = WLANTL_LLC_HEADER_LEN;
9759 v_U8_t wIAPPSnap[WLANTL_LLC_HEADER_LEN] = {0};
9760#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07009761 *ucWDSEnabled = 0; // default WDS off.
9762 vosStatus = vos_pkt_pop_head( vosDataBuff, &w8023Header,
9763 sizeof(w8023Header));
9764
9765 if ( VOS_STATUS_SUCCESS != vosStatus )
9766 {
9767 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9768 "WLAN TL: Packet pop header fails on WLANTL_Translate8023To80211Header"));
9769 return vosStatus;
9770 }
9771
Kiran Venkatappacab0d352012-12-17 13:09:22 -08009772 if( NULL == pucStaId )
9773 {
9774 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9775 "WLAN TL: Invalid pointer for StaId"));
9776 return VOS_STATUS_E_INVAL;
9777 }
9778 ucStaId = *pucStaId;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309779 pClientSTA = pTLCb->atlSTAClients[ucStaId];
9780
9781 if ( NULL == pClientSTA )
9782 {
9783 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9784 "WLAN TL:Client Memory was not allocated on %s", __func__));
9785 return VOS_STATUS_E_FAILURE;
9786 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009787
Kiran Venkatappaa044eb92012-12-17 15:48:49 -08009788#ifdef FEATURE_WLAN_TDLS
9789
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05309790 if ( WLAN_STA_INFRA == pTLCb->atlSTAClients[ucStaId]->wSTADesc.wSTAType
9791 && pTLCb->ucTdlsPeerCount )
Kiran Venkatappacab0d352012-12-17 13:09:22 -08009792 {
9793 v_U8_t ucIndex = 0;
9794 for ( ucIndex = 0; ucIndex < WLAN_MAX_STA_COUNT ; ucIndex++)
9795 {
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05309796 if ( ucIndex != ucStaId && pTLCb->atlSTAClients[ucIndex] && pTLCb->atlSTAClients[ucIndex]->ucExists &&
Gopichand Nakkala471708b2013-06-04 20:03:01 +05309797 (pTLCb->atlSTAClients[ucIndex]->tlState == WLANTL_STA_AUTHENTICATED) &&
9798 (!pTLCb->atlSTAClients[ucIndex]->ucTxSuspended) &&
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05309799 vos_mem_compare( (void*)pTLCb->atlSTAClients[ucIndex]->wSTADesc.vSTAMACAddress.bytes,
Kiran Venkatappacab0d352012-12-17 13:09:22 -08009800 (void*)w8023Header.vDA, 6) )
9801 {
9802 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
9803 "WLAN TL: Got a TDLS station. Using that index"));
9804 ucStaId = ucIndex;
9805 *pucStaId = ucStaId;
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05309806 pClientSTA = pTLCb->atlSTAClients[ucStaId];
9807 if ( NULL == pClientSTA )
9808 {
9809 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9810 "WLAN TL:Client Memory was not allocated on %s", __func__));
9811 return VOS_STATUS_E_FAILURE;
9812 }
Kiran Venkatappacab0d352012-12-17 13:09:22 -08009813 break;
9814 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009815 }
Kiran Venkatappacab0d352012-12-17 13:09:22 -08009816 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009817#endif
9818
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009819#ifdef FEATURE_WLAN_ESE_UPLOAD
9820if ((0 == w8023Header.usLenType) && (pClientSTA->wSTADesc.ucIsEseSta))
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009821{
9822 vos_pkt_extract_data(vosDataBuff,0,&wIAPPSnap[0],&wIAPPSnapSize);
9823 if (vos_mem_compare(wIAPPSnap,WLANTL_AIRONET_SNAP_HEADER,WLANTL_LLC_HEADER_LEN))
9824 {
9825 /*The SNAP and the protocol type are already in the data buffer.
9826 They are filled by the application (wpa_supplicant). So, Skip Adding LLC below.*/
9827 bIAPPTxwithLLC = VOS_TRUE;
9828 }
9829 else
9830 {
9831 bIAPPTxwithLLC = VOS_FALSE;
9832 }
9833}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009834#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07009835
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009836 if ((0 != pClientSTA->wSTADesc.ucAddRmvLLC)
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009837#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009838 && (!bIAPPTxwithLLC)
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009839#endif /* FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009840 )
Jeff Johnson295189b2012-06-20 16:38:30 -07009841 {
9842 /* Push the length */
9843 vosStatus = vos_pkt_push_head(vosDataBuff,
9844 &w8023Header.usLenType, sizeof(w8023Header.usLenType));
9845
9846 if ( VOS_STATUS_SUCCESS != vosStatus )
9847 {
9848 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9849 "WLAN TL: Packet push ether type fails on"
9850 " WLANTL_Translate8023To80211Header"));
9851 return vosStatus;
9852 }
9853
9854#ifdef BTAMP_TEST
9855 // The STA side will execute this, a hack to test BTAMP by using the
9856 // infra setup. On real BTAMP this will come from BAP itself.
9857 {
9858 static v_U8_t WLANTL_BT_AMP_LLC_HEADER[] = {0xAA, 0xAA, 0x03, 0x00, 0x19, 0x58 };
9859 vosStatus = vos_pkt_push_head(vosDataBuff, WLANTL_BT_AMP_LLC_HEADER,
9860 sizeof(WLANTL_BT_AMP_LLC_HEADER));
9861
9862 if ( VOS_STATUS_SUCCESS != vosStatus )
9863 {
9864 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9865 "WLAN TL: Packet push LLC header fails on"
9866 " WLANTL_Translate8023To80211Header"));
9867 return vosStatus;
9868 }
9869 }
9870#else
9871 vosStatus = vos_pkt_push_head(vosDataBuff, WLANTL_LLC_HEADER,
9872 sizeof(WLANTL_LLC_HEADER));
9873
9874 if ( VOS_STATUS_SUCCESS != vosStatus )
9875 {
9876 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9877 "WLAN TL: Packet push LLC header fails on"
9878 " WLANTL_Translate8023To80211Header"));
9879 return vosStatus;
9880 }
9881#endif
9882 }/*If add LLC is enabled*/
9883 else
9884 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009885#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009886 bIAPPTxwithLLC = VOS_FALSE; /*Reset the Flag here to start afresh with the next TX pkt*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009887#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07009888 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9889 "WLAN TL: STA Client registered to not remove LLC"
9890 " WLANTL_Translate8023To80211Header"));
9891 }
9892
9893#ifdef BTAMP_TEST
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309894 pClientSTA->wSTADesc.wSTAType = WLAN_STA_BT_AMP;
Jeff Johnson295189b2012-06-20 16:38:30 -07009895#endif
9896
9897 // Find the space required for the 802.11 header format
9898 // based on the frame control fields.
9899 ucHeaderSize = MandatoryucHeaderSize;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309900 if (pClientSTA->wSTADesc.ucQosEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -07009901 {
9902 ucHeaderSize += sizeof(pw80211Header->usQosCtrl);
9903 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309904 if (pClientSTA->wSTADesc.wSTAType == WLAN_STA_BT_AMP)
Jeff Johnson295189b2012-06-20 16:38:30 -07009905 {
9906 ucHeaderSize += sizeof(pw80211Header->optvA4);
Jeff Johnson295189b2012-06-20 16:38:30 -07009907 ucQoSOffset += sizeof(pw80211Header->optvA4);
Jeff Johnson295189b2012-06-20 16:38:30 -07009908 }
9909
9910 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9911 " WLANTL_Translate8023To80211Header : Header size = %d ", ucHeaderSize));
9912
9913 vos_pkt_reserve_head( vosDataBuff, &ppvBDHeader, ucHeaderSize );
9914 if ( NULL == ppvBDHeader )
9915 {
9916 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9917 "WLAN TL:VOSS packet corrupted "));
9918 *pvosStatus = VOS_STATUS_E_INVAL;
9919 return *pvosStatus;
9920 }
9921
Jeff Johnson295189b2012-06-20 16:38:30 -07009922
9923 // OK now we have the space. Fill the 80211 header
9924 /* Fill A2 */
9925 pw80211Header = (WLANTL_80211HeaderType *)(ppvBDHeader);
9926 // only clear the required space.
9927 vos_mem_set( pw80211Header, ucHeaderSize, 0 );
9928 vos_mem_copy( pw80211Header->vA2, w8023Header.vSA, VOS_MAC_ADDR_SIZE);
9929
9930
9931#ifdef FEATURE_WLAN_WAPI
Gopichand Nakkala8b54e912013-03-11 10:44:21 +05309932 if (( WLANTL_STA_AUTHENTICATED == pClientSTA->tlState ||
9933 pClientSTA->ptkInstalled ) && gUcIsWai != 1)
Jeff Johnson295189b2012-06-20 16:38:30 -07009934#else
Gopichand Nakkala8b54e912013-03-11 10:44:21 +05309935 if ( WLANTL_STA_AUTHENTICATED == pClientSTA->tlState ||
9936 pClientSTA->ptkInstalled )
Jeff Johnson295189b2012-06-20 16:38:30 -07009937#endif
9938 {
9939 pw80211Header->wFrmCtrl.wep =
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309940 pClientSTA->wSTADesc.ucProtectedFrame;
Jeff Johnson295189b2012-06-20 16:38:30 -07009941 }
9942
9943 pw80211Header->usDurationId = 0;
9944 pw80211Header->usSeqCtrl = 0;
9945
9946 pw80211Header->wFrmCtrl.type = WLANTL_80211_DATA_TYPE;
9947
9948
9949
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309950 if(pClientSTA->wSTADesc.ucQosEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -07009951 {
9952 pw80211Header->wFrmCtrl.subType = WLANTL_80211_DATA_QOS_SUBTYPE;
9953
Ravi Joshid0699502013-07-08 15:48:47 -07009954 *((v_U16_t *)((v_U8_t *)ppvBDHeader + ucQoSOffset)) = tlMetaInfo->ucUP;
Jeff Johnson295189b2012-06-20 16:38:30 -07009955
9956 }
9957 else
9958 {
9959 pw80211Header->wFrmCtrl.subType = 0;
9960
9961 // NO NO NO - there is not enough memory allocated to write the QOS ctrl
9962 // field, it will overwrite the first 2 bytes of the data packet(LLC header)
9963 // pw80211Header->usQosCtrl = 0;
9964 }
9965
9966
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309967 switch( pClientSTA->wSTADesc.wSTAType )
Jeff Johnson295189b2012-06-20 16:38:30 -07009968 {
Ravi Joshid0699502013-07-08 15:48:47 -07009969 case WLAN_STA_IBSS:
Jeff Johnson295189b2012-06-20 16:38:30 -07009970 pw80211Header->wFrmCtrl.toDS = 0;
9971 pw80211Header->wFrmCtrl.fromDS = 0;
Ravi Joshid0699502013-07-08 15:48:47 -07009972
Abhishek Singh45e68fe2014-12-11 12:55:59 +05309973 vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1,
Ravi Joshid0699502013-07-08 15:48:47 -07009974 (v_MACADDR_t*)&w8023Header.vDA);
Jeff Johnson295189b2012-06-20 16:38:30 -07009975 vos_mem_copy( pw80211Header->vA3,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309976 &pClientSTA->wSTADesc.vBSSIDforIBSS ,
Jeff Johnson295189b2012-06-20 16:38:30 -07009977 VOS_MAC_ADDR_SIZE);
9978 break;
9979
Ravi Joshid0699502013-07-08 15:48:47 -07009980 case WLAN_STA_BT_AMP:
Jeff Johnson295189b2012-06-20 16:38:30 -07009981 *ucWDSEnabled = 1; // WDS on.
9982 pw80211Header->wFrmCtrl.toDS = 1;
9983 pw80211Header->wFrmCtrl.fromDS = 1;
9984 vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309985 &pClientSTA->wSTADesc.vSTAMACAddress);
Jeff Johnson295189b2012-06-20 16:38:30 -07009986 vos_mem_copy( pw80211Header->vA2,
Ravi Joshid0699502013-07-08 15:48:47 -07009987 w8023Header.vSA, VOS_MAC_ADDR_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07009988 vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA3,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309989 &pClientSTA->wSTADesc.vSTAMACAddress);
Jeff Johnson295189b2012-06-20 16:38:30 -07009990 /* fill the optional A4 header */
9991 vos_mem_copy( pw80211Header->optvA4,
Ravi Joshid0699502013-07-08 15:48:47 -07009992 w8023Header.vSA, VOS_MAC_ADDR_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07009993 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -08009994 "BTAMP CASE NOW ---------staid=%d",
Ravi Joshid0699502013-07-08 15:48:47 -07009995 ucStaId));
Jeff Johnson295189b2012-06-20 16:38:30 -07009996 break;
9997
Ravi Joshid0699502013-07-08 15:48:47 -07009998 case WLAN_STA_SOFTAP:
Jeff Johnson295189b2012-06-20 16:38:30 -07009999 *ucWDSEnabled = 0; // WDS off.
10000 pw80211Header->wFrmCtrl.toDS = 0;
10001 pw80211Header->wFrmCtrl.fromDS = 1;
10002 /*Copy the DA to A1*/
10003 vos_mem_copy( pw80211Header->vA1, w8023Header.vDA , VOS_MAC_ADDR_SIZE);
10004 vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA2,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010005 &pClientSTA->wSTADesc.vSelfMACAddress);
Jeff Johnson295189b2012-06-20 16:38:30 -070010006 vos_mem_copy( pw80211Header->vA3,
Ravi Joshid0699502013-07-08 15:48:47 -070010007 w8023Header.vSA, VOS_MAC_ADDR_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -070010008 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -080010009 "sw 802 to 80211 softap case ---------staid=%d",
Ravi Joshid0699502013-07-08 15:48:47 -070010010 ucStaId));
Jeff Johnson295189b2012-06-20 16:38:30 -070010011 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010012#ifdef FEATURE_WLAN_TDLS
Ravi Joshid0699502013-07-08 15:48:47 -070010013 case WLAN_STA_TDLS:
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010014 pw80211Header->wFrmCtrl.toDS = 0;
10015 pw80211Header->wFrmCtrl.fromDS = 0;
10016 /*Fix me*/
10017 vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010018 &pClientSTA->wSTADesc.vSTAMACAddress);
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010019 vos_mem_copy( pw80211Header->vA3,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010020 &pClientSTA->wSTADesc.vBSSIDforIBSS ,
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010021 VOS_MAC_ADDR_SIZE);
10022 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -080010023 ("TL:TDLS CASE NOW ---------staid=%d"), ucStaId);
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010024 break;
10025#endif
Ravi Joshid0699502013-07-08 15:48:47 -070010026 case WLAN_STA_INFRA:
10027 default:
Jeff Johnson295189b2012-06-20 16:38:30 -070010028 pw80211Header->wFrmCtrl.toDS = 1;
10029 pw80211Header->wFrmCtrl.fromDS = 0;
10030 vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010031 &pClientSTA->wSTADesc.vSTAMACAddress);
Jeff Johnson295189b2012-06-20 16:38:30 -070010032 vos_mem_copy( pw80211Header->vA3, w8023Header.vDA , VOS_MAC_ADDR_SIZE);
10033 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -080010034 "REGULAR INFRA LINK CASE---------staid=%d",
Ravi Joshid0699502013-07-08 15:48:47 -070010035 ucStaId));
Jeff Johnson295189b2012-06-20 16:38:30 -070010036 break;
10037 }
10038 // OK now we have the space. Fill the 80211 header
10039 /* Fill A2 */
10040 pw80211Header = (WLANTL_80211HeaderType *)(ppvBDHeader);
10041 return VOS_STATUS_SUCCESS;
10042}/*WLANTL_Translate8023To80211Header*/
10043
10044
10045/*=============================================================================
10046 BEGIN LOG FUNCTION !!! Remove me or clean me
10047=============================================================================*/
Ravi Kumar Vaishnavb7652402013-01-18 19:05:15 -080010048#if 0 //def WLANTL_DEBUG
Jeff Johnson295189b2012-06-20 16:38:30 -070010049
10050#define WLANTL_DEBUG_FRAME_BYTE_PER_LINE 16
10051#define WLANTL_DEBUG_FRAME_BYTE_PER_BYTE 4
10052
10053static v_VOID_t WLANTL_DebugFrame
10054(
10055 v_PVOID_t dataPointer,
10056 v_U32_t dataSize
10057)
10058{
10059 v_U8_t lineBuffer[WLANTL_DEBUG_FRAME_BYTE_PER_LINE];
10060 v_U32_t numLines;
10061 v_U32_t numBytes;
10062 v_U32_t idx;
10063 v_U8_t *linePointer;
10064
10065 numLines = dataSize / WLANTL_DEBUG_FRAME_BYTE_PER_LINE;
10066 numBytes = dataSize % WLANTL_DEBUG_FRAME_BYTE_PER_LINE;
10067 linePointer = (v_U8_t *)dataPointer;
10068
10069 TLLOGE(VOS_TRACE(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR, "WLAN TL:Frame Debug Frame Size %d, Pointer 0x%p", dataSize, dataPointer));
10070 for(idx = 0; idx < numLines; idx++)
10071 {
10072 memset(lineBuffer, 0, WLANTL_DEBUG_FRAME_BYTE_PER_LINE);
10073 memcpy(lineBuffer, linePointer, WLANTL_DEBUG_FRAME_BYTE_PER_LINE);
10074 TLLOGE(VOS_TRACE(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR,
10075 "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",
10076 lineBuffer[0], lineBuffer[1], lineBuffer[2], lineBuffer[3], lineBuffer[4], lineBuffer[5], lineBuffer[6], lineBuffer[7],
10077 lineBuffer[8], lineBuffer[9], lineBuffer[10], lineBuffer[11], lineBuffer[12], lineBuffer[13], lineBuffer[14], lineBuffer[15]));
10078 linePointer += WLANTL_DEBUG_FRAME_BYTE_PER_LINE;
10079 }
10080
10081 if(0 == numBytes)
10082 return;
10083
10084 memset(lineBuffer, 0, WLANTL_DEBUG_FRAME_BYTE_PER_LINE);
10085 memcpy(lineBuffer, linePointer, numBytes);
10086 for(idx = 0; idx < WLANTL_DEBUG_FRAME_BYTE_PER_LINE / WLANTL_DEBUG_FRAME_BYTE_PER_BYTE; idx++)
10087 {
10088 TLLOGE(VOS_TRACE(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR, "WLAN TL:0x%2x 0x%2x 0x%2x 0x%2x",
10089 lineBuffer[idx * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE], lineBuffer[1 + idx * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE],
10090 lineBuffer[2 + idx * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE], lineBuffer[3 + idx * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE]));
10091 if(((idx + 1) * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE) >= numBytes)
10092 break;
10093 }
10094
10095 return;
10096}
10097#endif
10098
10099/*=============================================================================
10100 END LOG FUNCTION
10101=============================================================================*/
10102
10103/*==========================================================================
10104 FUNCTION WLANTL_Translate80211To8023Header
10105
10106 DESCRIPTION
10107 Inline function for translating and 802.11 header into an 802.3 header.
10108
10109 DEPENDENCIES
10110
10111
10112 PARAMETERS
10113
10114 IN
10115 pTLCb: TL control block
10116 ucStaId: station ID
10117 ucHeaderLen: Length of the header from BD
10118 ucActualHLen: Length of header including padding or any other trailers
10119
10120 IN/OUT
10121 vosDataBuff: vos data buffer, will contain the new header on output
10122
10123 OUT
10124 pvosStatus: status of the operation
10125
10126 RETURN VALUE
10127
10128 The result code associated with performing the operation
10129 VOS_STATUS_SUCCESS: Everything is good :)
10130
10131 SIDE EFFECTS
10132
10133============================================================================*/
10134VOS_STATUS
10135WLANTL_Translate80211To8023Header
10136(
10137 vos_pkt_t* vosDataBuff,
10138 VOS_STATUS* pvosStatus,
10139 v_U16_t usActualHLen,
10140 v_U8_t ucHeaderLen,
10141 WLANTL_CbType* pTLCb,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010142 v_U8_t ucSTAId,
10143 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -070010144)
10145{
10146 WLANTL_8023HeaderType w8023Header;
10147 WLANTL_80211HeaderType w80211Header;
10148 v_U8_t aucLLCHeader[WLANTL_LLC_HEADER_LEN];
10149 VOS_STATUS vosStatus;
10150 v_U16_t usDataStartOffset = 0;
10151 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
10152
10153 if ( sizeof(w80211Header) < ucHeaderLen )
10154 {
10155 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10156 "Warning !: Check the header size for the Rx frame structure=%d received=%dn",
10157 sizeof(w80211Header), ucHeaderLen));
10158 ucHeaderLen = sizeof(w80211Header);
10159 }
10160
10161 // This will take care of headers of all sizes, 3 address, 3 addr QOS,
10162 // WDS non-QOS and WDS QoS etc. We have space for all in the 802.11 header structure.
10163 vosStatus = vos_pkt_pop_head( vosDataBuff, &w80211Header, ucHeaderLen);
10164
10165 if ( VOS_STATUS_SUCCESS != vosStatus )
10166 {
10167 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10168 "WLAN TL: Failed to pop 80211 header from packet %d",
10169 vosStatus));
10170
10171 return vosStatus;
10172 }
10173
10174 switch ( w80211Header.wFrmCtrl.fromDS )
10175 {
10176 case 0:
Jeff Johnson295189b2012-06-20 16:38:30 -070010177 if ( w80211Header.wFrmCtrl.toDS )
10178 {
10179 //SoftAP AP mode
10180 vos_mem_copy( w8023Header.vDA, w80211Header.vA3, VOS_MAC_ADDR_SIZE);
10181 vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE);
10182 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -080010183 "WLAN TL SoftAP: 802 3 DA %08x SA %08x",
Jeff Johnson295189b2012-06-20 16:38:30 -070010184 w8023Header.vDA, w8023Header.vSA));
10185 }
10186 else
10187 {
10188 /* IBSS */
10189 vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE);
10190 vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE);
10191 }
Jeff Johnson295189b2012-06-20 16:38:30 -070010192 break;
10193 case 1:
10194 if ( w80211Header.wFrmCtrl.toDS )
10195 {
10196 /* BT-AMP case */
10197 vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE);
10198 vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE);
10199 }
10200 else
10201 { /* Infra */
10202 vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE);
10203 vos_mem_copy( w8023Header.vSA, w80211Header.vA3, VOS_MAC_ADDR_SIZE);
10204 }
10205 break;
10206 }
10207
10208 if( usActualHLen > ucHeaderLen )
10209 {
10210 usDataStartOffset = usActualHLen - ucHeaderLen;
10211 }
10212
10213 if ( 0 < usDataStartOffset )
10214 {
10215 vosStatus = vos_pkt_trim_head( vosDataBuff, usDataStartOffset );
10216
10217 if ( VOS_STATUS_SUCCESS != vosStatus )
10218 {
10219 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10220 "WLAN TL: Failed to trim header from packet %d",
10221 vosStatus));
10222 return vosStatus;
10223 }
10224 }
10225
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010226 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
10227 {
10228 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10229 "WLAN TL:Client Memory was not allocated on %s", __func__));
10230 return VOS_STATUS_E_FAILURE;
10231 }
10232
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010233 if ( 0 != pTLCb->atlSTAClients[ucSTAId]->wSTADesc.ucAddRmvLLC
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010234#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010235 && (!bForwardIAPPwithLLC)
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010236#endif /* FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010237 )
Jeff Johnson295189b2012-06-20 16:38:30 -070010238 {
10239 // Extract the LLC header
10240 vosStatus = vos_pkt_pop_head( vosDataBuff, aucLLCHeader,
10241 WLANTL_LLC_HEADER_LEN);
10242
10243 if ( VOS_STATUS_SUCCESS != vosStatus )
10244 {
Kaushik, Sushante386ee12014-05-01 15:50:52 +053010245 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Jeff Johnson295189b2012-06-20 16:38:30 -070010246 "WLAN TL: Failed to pop LLC header from packet %d",
10247 vosStatus));
10248
10249 return vosStatus;
10250 }
10251
10252 //Extract the length
10253 vos_mem_copy(&w8023Header.usLenType,
10254 &aucLLCHeader[WLANTL_LLC_HEADER_LEN - sizeof(w8023Header.usLenType)],
10255 sizeof(w8023Header.usLenType) );
10256 }
10257 else
10258 {
10259 vosStatus = vos_pkt_get_packet_length(vosDataBuff,
10260 &w8023Header.usLenType);
10261
10262 if ( VOS_STATUS_SUCCESS != vosStatus )
10263 {
10264 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10265 "WLAN TL: Failed to get packet length %d",
10266 vosStatus));
10267
10268 return vosStatus;
10269 }
10270
10271 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10272 "WLAN TL: BTAMP len (ethertype) fld = %d",
10273 w8023Header.usLenType));
10274 w8023Header.usLenType = vos_cpu_to_be16(w8023Header.usLenType);
10275 }
10276
10277 vos_pkt_push_head(vosDataBuff, &w8023Header, sizeof(w8023Header));
10278
10279#ifdef BTAMP_TEST
10280 {
10281 // AP side will execute this.
10282 v_U8_t *temp_w8023Header = NULL;
10283 vosStatus = vos_pkt_peek_data( vosDataBuff, 0,
10284 &temp_w8023Header, sizeof(w8023Header) );
10285 }
10286#endif
10287#if 0 /*TL_DEBUG*/
10288 vos_pkt_get_packet_length(vosDataBuff, &usLen);
10289 vos_pkt_pop_head( vosDataBuff, aucData, usLen);
10290
10291 WLANTL_DebugFrame(aucData, usLen);
10292
10293 vos_pkt_push_head(vosDataBuff, aucData, usLen);
10294
10295#endif
10296
10297 *pvosStatus = VOS_STATUS_SUCCESS;
10298
10299 return VOS_STATUS_SUCCESS;
10300}/*WLANTL_Translate80211To8023Header*/
10301
Madan Mohan Koyyalamudia148e1e2012-11-30 14:52:59 -080010302/*==========================================================================
10303 FUNCTION WLANTL_FindFrameTypeBcMcUc
10304
10305 DESCRIPTION
10306 Utility function to find whether received frame is broadcast, multicast
10307 or unicast.
10308
10309 DEPENDENCIES
10310 The STA must be registered with TL before this function can be called.
10311
10312 PARAMETERS
10313
10314 IN
10315 pTLCb: pointer to the TL's control block
10316 ucSTAId: identifier of the station being processed
10317 vosDataBuff: pointer to the vos buffer
10318
10319 IN/OUT
10320 pucBcMcUc: pointer to buffer, will contain frame type on return
10321
10322 RETURN VALUE
10323 The result code associated with performing the operation
10324
10325 VOS_STATUS_E_INVAL: invalid input parameters
10326 VOS_STATUS_E_BADMSG: failed to extract info from data buffer
10327 VOS_STATUS_SUCCESS: success
10328
10329 SIDE EFFECTS
10330 None.
10331============================================================================*/
10332VOS_STATUS
10333WLANTL_FindFrameTypeBcMcUc
10334(
10335 WLANTL_CbType *pTLCb,
10336 v_U8_t ucSTAId,
10337 vos_pkt_t *vosDataBuff,
10338 v_U8_t *pucBcMcUc
10339)
10340{
10341 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
10342 v_PVOID_t aucBDHeader;
10343 v_PVOID_t pvPeekData;
10344 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
10345
10346 /*------------------------------------------------------------------------
10347 Sanity check
10348 ------------------------------------------------------------------------*/
10349 if ((NULL == pTLCb) ||
10350 (NULL == vosDataBuff) ||
10351 (NULL == pucBcMcUc))
10352 {
10353 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10354 "WLAN TL:Invalid parameter in WLANTL_FindFrameTypeBcMcUc"));
10355 return VOS_STATUS_E_INVAL;
10356 }
10357
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010358 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
10359 {
10360 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10361 "WLAN TL:Client Memory was not allocated on %s", __func__));
10362 return VOS_STATUS_E_FAILURE;
10363 }
10364
Madan Mohan Koyyalamudia148e1e2012-11-30 14:52:59 -080010365 /*------------------------------------------------------------------------
10366 Extract BD header and check if valid
10367 ------------------------------------------------------------------------*/
10368 vosStatus = WDA_DS_PeekRxPacketInfo(vosDataBuff, (v_PVOID_t)&aucBDHeader, 0/*Swap BD*/ );
10369
10370 if (NULL == aucBDHeader)
10371 {
10372 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10373 "WLAN TL:WLANTL_FindFrameTypeBcMcUc - Cannot extract BD header"));
10374 VOS_ASSERT(0);
10375 return VOS_STATUS_E_BADMSG;
10376 }
10377
10378 if ((0 == WDA_GET_RX_FT_DONE(aucBDHeader)) &&
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010379 (0 != pTLCb->atlSTAClients[ucSTAId]->wSTADesc.ucSwFrameRXXlation))
Madan Mohan Koyyalamudia148e1e2012-11-30 14:52:59 -080010380 {
10381 /* Its an 802.11 frame, extract MAC address 1 */
10382 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10383 "WLAN TL:WLANTL_FindFrameTypeBcMcUc - 802.11 frame, peeking Addr1"));
10384 vosStatus = vos_pkt_peek_data(vosDataBuff, WLANTL_MAC_ADDR_ALIGN(1),
10385 (v_PVOID_t)&pvPeekData, VOS_MAC_ADDR_SIZE);
10386 }
10387 else
10388 {
10389 /* Its an 802.3 frame, extract Destination MAC address */
10390 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10391 "WLAN TL:WLANTL_FindFrameTypeBcMcUc - 802.3 frame, peeking DA"));
10392 vosStatus = vos_pkt_peek_data(vosDataBuff, WLANTL_MAC_ADDR_ALIGN(0),
10393 (v_PVOID_t)&pvPeekData, VOS_MAC_ADDR_SIZE);
10394 }
10395
10396 if (VOS_STATUS_SUCCESS != vosStatus)
10397 {
10398 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10399 "WLAN TL:WLANTL_FindFrameTypeBcMcUc - Failed to peek MAC address"));
10400 return vosStatus;
10401 }
10402
10403 if (((tANI_U8 *)pvPeekData)[0] == 0xff)
10404 {
10405 *pucBcMcUc = WLANTL_FRAME_TYPE_BCAST;
10406 }
10407 else
10408 {
10409 if ((((tANI_U8 *)pvPeekData)[0] & 0x01) == 0x01)
10410 *pucBcMcUc = WLANTL_FRAME_TYPE_MCAST;
10411 else
10412 *pucBcMcUc = WLANTL_FRAME_TYPE_UCAST;
10413 }
10414
10415 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10416 "WLAN TL:WLANTL_FindFrameTypeBcMcUc - Addr1Byte1 is: %x",
10417 ((tANI_U8 *)pvPeekData)[0]));
10418
10419 return VOS_STATUS_SUCCESS;
10420}
10421
Jeff Johnson295189b2012-06-20 16:38:30 -070010422#if 0
10423#ifdef WLAN_PERF
10424/*==========================================================================
10425 FUNCTION WLANTL_FastHwFwdDataFrame
10426
10427 DESCRIPTION
10428 Fast path function to quickly forward a data frame if HAL determines BD
10429 signature computed here matches the signature inside current VOSS packet.
10430 If there is a match, HAL and TL fills in the swapped packet length into
10431 BD header and DxE header, respectively. Otherwise, packet goes back to
10432 normal (slow) path and a new BD signature would be tagged into BD in this
10433 VOSS packet later by the WLANHAL_FillTxBd() function.
10434
10435 DEPENDENCIES
10436
10437 PARAMETERS
10438
10439 IN
10440 pvosGCtx VOS context
10441 vosDataBuff Ptr to VOSS packet
10442 pMetaInfo For getting frame's TID
10443 pStaInfo For checking STA type
10444
10445 OUT
10446 pvosStatus returned status
10447 puFastFwdOK Flag to indicate whether frame could be fast forwarded
10448
10449 RETURN VALUE
10450 No return.
10451
10452 SIDE EFFECTS
10453
10454============================================================================*/
10455static void
10456WLANTL_FastHwFwdDataFrame
10457(
10458 v_PVOID_t pvosGCtx,
10459 vos_pkt_t* vosDataBuff,
10460 VOS_STATUS* pvosStatus,
10461 v_U32_t* puFastFwdOK,
10462 WLANTL_MetaInfoType* pMetaInfo,
10463 WLAN_STADescType* pStaInfo
10464
10465)
10466{
10467 v_PVOID_t pvPeekData;
10468 v_U8_t ucDxEBDWLANHeaderLen = WLANTL_BD_HEADER_LEN(0) + sizeof(WLANBAL_sDXEHeaderType);
10469 v_U8_t ucIsUnicast;
10470 WLANBAL_sDXEHeaderType *pDxEHeader;
10471 v_PVOID_t pvBDHeader;
10472 v_PVOID_t pucBuffPtr;
10473 v_U16_t usPktLen;
10474
10475 /*-----------------------------------------------------------------------
10476 Extract packet length
10477 -----------------------------------------------------------------------*/
10478
10479 vos_pkt_get_packet_length( vosDataBuff, &usPktLen);
10480
10481 /*-----------------------------------------------------------------------
10482 Extract MAC address
10483 -----------------------------------------------------------------------*/
10484 *pvosStatus = vos_pkt_peek_data( vosDataBuff,
10485 WLANTL_MAC_ADDR_ALIGN(0),
10486 (v_PVOID_t)&pvPeekData,
10487 VOS_MAC_ADDR_SIZE );
10488
10489 if ( VOS_STATUS_SUCCESS != *pvosStatus )
10490 {
10491 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10492 "WLAN TL:Failed while attempting to extract MAC Addr %d",
10493 *pvosStatus));
10494 *pvosStatus = VOS_STATUS_E_INVAL;
10495 return;
10496 }
10497
10498 /*-----------------------------------------------------------------------
10499 Reserve head room for DxE header, BD, and WLAN header
10500 -----------------------------------------------------------------------*/
10501
10502 vos_pkt_reserve_head( vosDataBuff, &pucBuffPtr,
10503 ucDxEBDWLANHeaderLen );
10504 if ( NULL == pucBuffPtr )
10505 {
10506 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10507 "WLAN TL:No enough space in VOSS packet %p for DxE/BD/WLAN header", vosDataBuff));
10508 *pvosStatus = VOS_STATUS_E_INVAL;
10509 return;
10510 }
10511 pDxEHeader = (WLANBAL_sDXEHeaderType *)pucBuffPtr;
10512 pvBDHeader = (v_PVOID_t) &pDxEHeader[1];
10513
10514 /* UMA Tx acceleration is enabled.
10515 * UMA would help convert frames to 802.11, fill partial BD fields and
10516 * construct LLC header. To further accelerate this kind of frames,
10517 * HAL would attempt to reuse the BD descriptor if the BD signature
10518 * matches to the saved BD descriptor.
10519 */
10520 if(pStaInfo->wSTAType == WLAN_STA_IBSS)
10521 ucIsUnicast = !(((tANI_U8 *)pvPeekData)[0] & 0x01);
10522 else
10523 ucIsUnicast = 1;
10524
10525 *puFastFwdOK = (v_U32_t) WLANHAL_TxBdFastFwd(pvosGCtx, pvPeekData, pMetaInfo->ucTID, ucIsUnicast, pvBDHeader, usPktLen );
10526
10527 /* Can't be fast forwarded. Trim the VOS head back to original location. */
10528 if(! *puFastFwdOK){
10529 vos_pkt_trim_head(vosDataBuff, ucDxEBDWLANHeaderLen);
10530 }else{
10531 /* could be fast forwarded. Now notify BAL DxE header filling could be completely skipped
10532 */
10533 v_U32_t uPacketSize = WLANTL_BD_HEADER_LEN(0) + usPktLen;
10534 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAL,
10535 (v_PVOID_t)uPacketSize);
10536 pDxEHeader->size = SWAP_ENDIAN_UINT32(uPacketSize);
10537 }
10538 *pvosStatus = VOS_STATUS_SUCCESS;
10539 return;
10540}
10541#endif /*WLAN_PERF*/
10542#endif
10543
10544#if 0
10545/*==========================================================================
10546 FUNCTION WLANTL_PrepareBDHeader
10547
10548 DESCRIPTION
10549 Inline function for preparing BD header before HAL processing.
10550
10551 DEPENDENCIES
10552 Just notify HAL that suspend in TL is complete.
10553
10554 PARAMETERS
10555
10556 IN
10557 vosDataBuff: vos data buffer
10558 ucDisableFrmXtl: is frame xtl disabled
10559
10560 OUT
10561 ppvBDHeader: it will contain the BD header
10562 pvDestMacAdddr: it will contain the destination MAC address
10563 pvosStatus: status of the combined processing
10564 pusPktLen: packet len.
10565
10566 RETURN VALUE
10567 No return.
10568
10569 SIDE EFFECTS
10570
10571============================================================================*/
10572void
10573WLANTL_PrepareBDHeader
10574(
10575 vos_pkt_t* vosDataBuff,
10576 v_PVOID_t* ppvBDHeader,
10577 v_MACADDR_t* pvDestMacAdddr,
10578 v_U8_t ucDisableFrmXtl,
10579 VOS_STATUS* pvosStatus,
10580 v_U16_t* pusPktLen,
10581 v_U8_t ucQosEnabled,
10582 v_U8_t ucWDSEnabled,
10583 v_U8_t extraHeadSpace
10584)
10585{
10586 v_U8_t ucHeaderOffset;
10587 v_U8_t ucHeaderLen;
Jeff Johnson295189b2012-06-20 16:38:30 -070010588 v_U8_t ucBDHeaderLen = WLANTL_BD_HEADER_LEN(ucDisableFrmXtl);
10589
10590 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
10591 /*-------------------------------------------------------------------------
10592 Get header pointer from VOSS
10593 !!! make sure reserve head zeros out the memory
10594 -------------------------------------------------------------------------*/
10595 vos_pkt_get_packet_length( vosDataBuff, pusPktLen);
10596
10597 if ( WLANTL_MAC_HEADER_LEN(ucDisableFrmXtl) > *pusPktLen )
10598 {
10599 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10600 "WLAN TL: Length of the packet smaller than expected network"
10601 " header %d", *pusPktLen ));
10602
10603 *pvosStatus = VOS_STATUS_E_INVAL;
10604 return;
10605 }
10606
10607 vos_pkt_reserve_head( vosDataBuff, ppvBDHeader,
10608 ucBDHeaderLen );
10609 if ( NULL == *ppvBDHeader )
10610 {
10611 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10612 "WLAN TL:VOSS packet corrupted on Attach BD header"));
10613 *pvosStatus = VOS_STATUS_E_INVAL;
10614 return;
10615 }
10616
10617 /*-----------------------------------------------------------------------
10618 Extract MAC address
10619 -----------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -070010620 {
10621 v_SIZE_t usMacAddrSize = VOS_MAC_ADDR_SIZE;
10622 *pvosStatus = vos_pkt_extract_data( vosDataBuff,
10623 ucBDHeaderLen +
10624 WLANTL_MAC_ADDR_ALIGN(ucDisableFrmXtl),
10625 (v_PVOID_t)pvDestMacAdddr,
10626 &usMacAddrSize );
10627 }
Jeff Johnson295189b2012-06-20 16:38:30 -070010628 if ( VOS_STATUS_SUCCESS != *pvosStatus )
10629 {
10630 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10631 "WLAN TL:Failed while attempting to extract MAC Addr %d",
10632 *pvosStatus));
10633 }
10634 else
10635 {
10636 /*---------------------------------------------------------------------
10637 Fill MPDU info fields:
10638 - MPDU data start offset
10639 - MPDU header start offset
10640 - MPDU header length
10641 - MPDU length - this is a 16b field - needs swapping
10642 --------------------------------------------------------------------*/
10643 ucHeaderOffset = ucBDHeaderLen;
10644 ucHeaderLen = WLANTL_MAC_HEADER_LEN(ucDisableFrmXtl);
10645
10646 if ( 0 != ucDisableFrmXtl )
10647 {
10648 if ( 0 != ucQosEnabled )
10649 {
10650 ucHeaderLen += WLANTL_802_11_HEADER_QOS_CTL;
10651 }
10652
10653 // Similar to Qos we need something for WDS format !
10654 if ( ucWDSEnabled != 0 )
10655 {
10656 // If we have frame translation enabled
10657 ucHeaderLen += WLANTL_802_11_HEADER_ADDR4_LEN;
10658 }
10659 if ( extraHeadSpace != 0 )
10660 {
10661 // Decrease the packet length with the extra padding after the header
10662 *pusPktLen = *pusPktLen - extraHeadSpace;
10663 }
10664 }
10665
10666 WLANHAL_TX_BD_SET_MPDU_HEADER_LEN( *ppvBDHeader, ucHeaderLen);
10667 WLANHAL_TX_BD_SET_MPDU_HEADER_OFFSET( *ppvBDHeader, ucHeaderOffset);
10668 WLANHAL_TX_BD_SET_MPDU_DATA_OFFSET( *ppvBDHeader,
10669 ucHeaderOffset + ucHeaderLen + extraHeadSpace);
10670 WLANHAL_TX_BD_SET_MPDU_LEN( *ppvBDHeader, *pusPktLen);
10671
10672 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10673 "WLAN TL: VALUES ARE HLen=%x Hoff=%x doff=%x len=%x ex=%d",
10674 ucHeaderLen, ucHeaderOffset,
10675 (ucHeaderOffset + ucHeaderLen + extraHeadSpace),
10676 *pusPktLen, extraHeadSpace));
10677 }/* if peek MAC success*/
10678
10679}/* WLANTL_PrepareBDHeader */
10680#endif
10681
Jeff Johnson295189b2012-06-20 16:38:30 -070010682//THIS IS A HACK AND NEEDS TO BE FIXED FOR CONCURRENCY
10683/*==========================================================================
10684 FUNCTION WLAN_TLGetNextTxIds
10685
10686 DESCRIPTION
10687 Gets the next station and next AC in the list that should be served by the TL.
10688
10689 Multiple Station Scheduling and TL queue management.
10690
10691 4 HDD BC/MC data packet queue status is specified as Station 0's status. Weights used
10692 in WFQ algorith are initialized in WLANTL_OPEN and contained in tlConfigInfo field.
10693 Each station has fields of ucPktPending and AC mask to tell whether a AC has traffic
10694 or not.
10695
10696 Stations are served in a round-robin fashion from highest priority to lowest priority.
10697 The number of round-robin times of each prioirty equals to the WFQ weights and differetiates
10698 the traffic of different prioirty. As such, stations can not provide low priority packets if
10699 high priority packets are all served.
10700
10701 DEPENDENCIES
10702
10703 PARAMETERS
10704
10705 IN
10706 pvosGCtx: pointer to the global vos context; a handle to TL's
10707 control block can be extracted from its context
10708
10709 OUT
10710 pucSTAId: Station ID
10711
10712 RETURN VALUE
10713 The result code associated with performing the operation
10714
10715 VOS_STATUS_SUCCESS: Everything is good
10716
10717 SIDE EFFECTS
10718
10719 TL context contains currently served station ID in ucCurrentSTA field, currently served AC
10720 in uCurServedAC field, and unserved weights of current AC in uCurLeftWeight.
10721 When existing from the function, these three fields are changed accordingly.
10722
10723============================================================================*/
10724VOS_STATUS
10725WLAN_TLAPGetNextTxIds
10726(
10727 v_PVOID_t pvosGCtx,
10728 v_U8_t* pucSTAId
10729)
10730{
10731 WLANTL_CbType* pTLCb;
10732 v_U8_t ucACFilter = 1;
10733 v_U8_t ucNextSTA ;
10734 v_BOOL_t isServed = TRUE; //current round has find a packet or not
10735 v_U8_t ucACLoopNum = WLANTL_AC_VO + 1; //number of loop to go
10736 v_U8_t uFlowMask; // TX FlowMask from WDA
10737 uint8 ucACMask;
Gopichand Nakkala96237bc2013-01-04 12:20:29 -080010738 uint8 i = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -070010739 /*------------------------------------------------------------------------
10740 Extract TL control block
10741 ------------------------------------------------------------------------*/
10742 //ENTER();
10743
10744 pTLCb = VOS_GET_TL_CB(pvosGCtx);
10745 if ( NULL == pTLCb )
10746 {
10747 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10748 "WLAN TL:Invalid TL pointer from pvosGCtx on WLAN_TLAPGetNextTxIds"));
10749 return VOS_STATUS_E_FAULT;
10750 }
10751
10752 if ( VOS_STATUS_SUCCESS != WDA_DS_GetTxFlowMask( pvosGCtx, &uFlowMask ) )
10753 {
10754 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10755 "WLAN TL:Failed to retrieve Flow control mask from WDA"));
10756 return VOS_STATUS_E_FAULT;
10757 }
10758
10759 ucNextSTA = pTLCb->ucCurrentSTA;
10760
10761 ++ucNextSTA;
10762
10763 if ( WLAN_MAX_STA_COUNT <= ucNextSTA )
10764 {
10765 //one round is done.
10766 ucNextSTA = 0;
10767 pTLCb->ucCurLeftWeight--;
10768 isServed = FALSE;
10769 if ( 0 == pTLCb->ucCurLeftWeight )
10770 {
10771 //current prioirty is done
10772 if ( WLANTL_AC_BK == (WLANTL_ACEnumType)pTLCb->uCurServedAC )
10773 {
10774 //end of current VO, VI, BE, BK loop. Reset priority.
10775 pTLCb->uCurServedAC = WLANTL_AC_VO;
10776 }
10777 else
10778 {
10779 pTLCb->uCurServedAC --;
10780 }
10781
10782 pTLCb->ucCurLeftWeight = pTLCb->tlConfigInfo.ucAcWeights[pTLCb->uCurServedAC];
10783
10784 } // (0 == pTLCb->ucCurLeftWeight)
10785 } //( WLAN_MAX_STA_COUNT == ucNextSTA )
10786
10787 //decide how many loops to go. if current loop is partial, do one extra to make sure
10788 //we cover every station
10789 if ((1 == pTLCb->ucCurLeftWeight) && (ucNextSTA != 0))
10790 {
10791 ucACLoopNum ++; // now is 5 loops
10792 }
10793
10794 /* Start with highest priority. ucNextSTA, pTLCb->uCurServedAC, pTLCb->ucCurLeftWeight
10795 all have previous values.*/
10796 for (; ucACLoopNum > 0; ucACLoopNum--)
10797 {
10798
10799 ucACFilter = 1 << pTLCb->uCurServedAC;
10800
10801 // pTLCb->ucCurLeftWeight keeps previous results.
10802 for (; (pTLCb->ucCurLeftWeight > 0) && (uFlowMask & ucACFilter); pTLCb->ucCurLeftWeight-- )
10803 {
10804
10805 for ( ; ucNextSTA < WLAN_MAX_STA_COUNT; ucNextSTA ++ )
10806 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010807 if(NULL == pTLCb->atlSTAClients[ucNextSTA])
10808 {
10809 continue;
10810 }
10811 WLAN_TL_AC_ARRAY_2_MASK (pTLCb->atlSTAClients[ucNextSTA], ucACMask, i);
Jeff Johnson295189b2012-06-20 16:38:30 -070010812
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010813 if ( (0 == pTLCb->atlSTAClients[ucNextSTA]->ucExists) ||
10814 ((0 == pTLCb->atlSTAClients[ucNextSTA]->ucPktPending) && !(ucACMask)) ||
Jeff Johnson295189b2012-06-20 16:38:30 -070010815 (0 == (ucACMask & ucACFilter)) )
10816
10817 {
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -080010818 //current station does not exist or have any packet to serve.
10819 continue;
10820 }
10821
10822 if (WLANTL_STA_AUTHENTICATED != pTLCb->atlSTAClients[ucNextSTA]->tlState)
10823 {
10824 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10825 "%s Sta %d not in auth state so skipping it.",
10826 __func__, ucNextSTA));
Jeff Johnson295189b2012-06-20 16:38:30 -070010827 continue;
10828 }
10829
10830 //go to next station if current station can't send due to flow control
10831 //Station is allowed to send when it is not in LWM mode. When station is in LWM mode,
10832 //station is allowed to send only after FW reports FW memory is below threshold and on-fly
10833 //packets are less then allowed value
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010834 if ( (TRUE == pTLCb->atlSTAClients[ucNextSTA]->ucLwmModeEnabled) &&
10835 ((FALSE == pTLCb->atlSTAClients[ucNextSTA]->ucLwmEventReported) ||
10836 (0 < pTLCb->atlSTAClients[ucNextSTA]->uBuffThresholdMax))
Jeff Johnson295189b2012-06-20 16:38:30 -070010837 )
10838 {
10839 continue;
10840 }
10841
10842
10843 // Find a station. Weight is updated already.
10844 *pucSTAId = ucNextSTA;
10845 pTLCb->ucCurrentSTA = ucNextSTA;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010846 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC = pTLCb->uCurServedAC;
Jeff Johnson295189b2012-06-20 16:38:30 -070010847
10848 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
10849 " TL serve one station AC: %d W: %d StaId: %d",
10850 pTLCb->uCurServedAC, pTLCb->ucCurLeftWeight, pTLCb->ucCurrentSTA ));
10851
10852 return VOS_STATUS_SUCCESS;
10853 } //STA loop
10854
10855 ucNextSTA = 0;
10856 if ( FALSE == isServed )
10857 {
10858 //current loop finds no packet.no need to repeat for the same priority
10859 break;
10860 }
10861 //current loop is partial loop. go for one more loop.
10862 isServed = FALSE;
10863
10864 } //Weight loop
10865
10866 if (WLANTL_AC_BK == pTLCb->uCurServedAC)
10867 {
10868 pTLCb->uCurServedAC = WLANTL_AC_VO;
10869 }
10870 else
10871 {
10872 pTLCb->uCurServedAC--;
10873 }
10874 pTLCb->ucCurLeftWeight = pTLCb->tlConfigInfo.ucAcWeights[pTLCb->uCurServedAC];
10875
10876 }// AC loop
10877
10878 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -080010879 " TL can't find one station to serve" ));
Jeff Johnson295189b2012-06-20 16:38:30 -070010880
10881 pTLCb->uCurServedAC = WLANTL_AC_BK;
10882 pTLCb->ucCurLeftWeight = 1;
10883 //invalid number will be captured by caller
10884 pTLCb->ucCurrentSTA = WLAN_MAX_STA_COUNT;
10885
10886 *pucSTAId = pTLCb->ucCurrentSTA;
Jeff Johnson295189b2012-06-20 16:38:30 -070010887 return VOS_STATUS_E_FAULT;
10888}
10889
10890
10891/*==========================================================================
10892 FUNCTION WLAN_TLGetNextTxIds
10893
10894 DESCRIPTION
10895 Gets the next station and next AC in the list
10896
10897 DEPENDENCIES
10898
10899 PARAMETERS
10900
10901 IN
10902 pvosGCtx: pointer to the global vos context; a handle to TL's
10903 control block can be extracted from its context
10904
10905 OUT
10906 pucSTAId: Station ID
10907
10908
10909 RETURN VALUE
10910 The result code associated with performing the operation
10911
10912 VOS_STATUS_SUCCESS: Everything is good :)
10913
10914 SIDE EFFECTS
10915
10916============================================================================*/
10917VOS_STATUS
10918WLAN_TLGetNextTxIds
10919(
10920 v_PVOID_t pvosGCtx,
10921 v_U8_t* pucSTAId
10922)
10923{
10924 WLANTL_CbType* pTLCb;
10925 v_U8_t ucNextAC;
10926 v_U8_t ucNextSTA;
10927 v_U8_t ucCount;
10928 v_U8_t uFlowMask; // TX FlowMask from WDA
10929 v_U8_t ucACMask = 0;
10930 v_U8_t i = 0;
10931
10932 tBssSystemRole systemRole; //RG HACK to be removed
10933 tpAniSirGlobal pMac;
10934
10935 pMac = vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
10936 if ( NULL == pMac )
10937 {
10938 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070010939 "%s: Invalid pMac", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -070010940 return VOS_STATUS_E_FAULT;
10941 }
10942
10943 systemRole = wdaGetGlobalSystemRole(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -070010944
Jeff Johnson295189b2012-06-20 16:38:30 -070010945 /*------------------------------------------------------------------------
10946 Extract TL control block
10947 ------------------------------------------------------------------------*/
10948 pTLCb = VOS_GET_TL_CB(pvosGCtx);
10949 if ( NULL == pTLCb )
10950 {
10951 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10952 "WLAN TL:Invalid TL pointer from pvosGCtx on WLAN_TLGetNextTxIds"));
10953 return VOS_STATUS_E_FAULT;
10954 }
10955
Sunil Ravid5406f22013-01-22 00:18:31 -080010956#ifdef FEATURE_WLAN_TDLS
Agarwal Ashishcd86f7b2014-06-16 17:11:58 +053010957 if ((eSYSTEM_AP_ROLE == systemRole) ||
10958 (vos_concurrent_open_sessions_running()) || pTLCb->ucTdlsPeerCount)
Sunil Ravid5406f22013-01-22 00:18:31 -080010959#else
Agarwal Ashishcd86f7b2014-06-16 17:11:58 +053010960 if ((eSYSTEM_AP_ROLE == systemRole) ||
10961 (vos_concurrent_open_sessions_running()))
Sunil Ravid5406f22013-01-22 00:18:31 -080010962#endif
10963 {
10964 return WLAN_TLAPGetNextTxIds(pvosGCtx,pucSTAId);
10965 }
10966
10967
Jeff Johnson295189b2012-06-20 16:38:30 -070010968 if ( VOS_STATUS_SUCCESS != WDA_DS_GetTxFlowMask( pvosGCtx, &uFlowMask ) )
10969 {
10970 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10971 "WLAN TL:Failed to retrieve Flow control mask from WDA"));
10972 return VOS_STATUS_E_FAULT;
10973 }
10974
10975 /*STA id - no priority yet implemented */
10976 /*-----------------------------------------------------------------------
10977 Choose the next STA for tx - for now go in a round robin fashion
10978 through all the stations that have pending packets
10979 -------------------------------------------------------------------------*/
10980 ucNextSTA = pTLCb->ucCurrentSTA;
10981
10982 pTLCb->ucCurrentSTA = WLAN_MAX_STA_COUNT;
10983 for ( ucCount = 0;
10984 ucCount < WLAN_MAX_STA_COUNT;
10985 ucCount++ )
10986 {
10987 ucNextSTA = ( (ucNextSTA+1) >= WLAN_MAX_STA_COUNT )?0:(ucNextSTA+1);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010988 if(NULL == pTLCb->atlSTAClients[ucNextSTA])
10989 {
10990 continue;
10991 }
10992 if (( pTLCb->atlSTAClients[ucNextSTA]->ucExists ) &&
10993 ( pTLCb->atlSTAClients[ucNextSTA]->ucPktPending ))
Jeff Johnson295189b2012-06-20 16:38:30 -070010994 {
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -080010995 if (WLANTL_STA_AUTHENTICATED == pTLCb->atlSTAClients[ucNextSTA]->tlState)
10996 {
10997 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10998 "STA ID: %d on WLAN_TLGetNextTxIds", *pucSTAId));
10999 pTLCb->ucCurrentSTA = ucNextSTA;
11000 break;
Tushnim Bhattacharyya5dd94562013-03-20 20:15:03 -070011001 }
11002 else
11003 {
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -080011004 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11005 "%s Sta %d is not in auth state, skipping this sta.",
11006 __func__, ucNextSTA));
Tushnim Bhattacharyya5dd94562013-03-20 20:15:03 -070011007 }
Jeff Johnson295189b2012-06-20 16:38:30 -070011008 }
11009 }
11010
11011 *pucSTAId = pTLCb->ucCurrentSTA;
11012
11013 if ( WLANTL_STA_ID_INVALID( *pucSTAId ) )
11014 {
11015 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11016 "WLAN TL:No station registered with TL at this point"));
11017
11018 return VOS_STATUS_E_FAULT;
11019
11020 }
11021
11022 /*Convert the array to a mask for easier operation*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011023 WLAN_TL_AC_ARRAY_2_MASK( pTLCb->atlSTAClients[*pucSTAId], ucACMask, i);
Jeff Johnson295189b2012-06-20 16:38:30 -070011024
11025 if ( 0 == ucACMask )
11026 {
11027 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11028 "WLAN TL: Mask 0 "
11029 "STA ID: %d on WLAN_TLGetNextTxIds", *pucSTAId));
11030
11031 /*setting STA id to invalid if mask is 0*/
11032 *pucSTAId = WLAN_MAX_STA_COUNT;
11033
11034 return VOS_STATUS_E_FAULT;
11035 }
11036
11037 /*-----------------------------------------------------------------------
11038 AC is updated whenever a packet is fetched from HDD -> the current
11039 weight of such an AC cannot be 0 -> in this case TL is expected to
11040 exit this function at this point during the main Tx loop
11041 -----------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011042 if ( 0 < pTLCb->atlSTAClients[*pucSTAId]->ucCurrentWeight )
Jeff Johnson295189b2012-06-20 16:38:30 -070011043 {
11044 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11045 "WLAN TL: Maintaining serviced AC to: %d for Weight: %d",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011046 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC ,
11047 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentWeight));
Jeff Johnson295189b2012-06-20 16:38:30 -070011048 return VOS_STATUS_SUCCESS;
11049 }
11050
11051 /*-----------------------------------------------------------------------
11052 Choose highest priority AC - !!! optimize me
11053 -----------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011054 ucNextAC = pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC;
Jeff Johnson295189b2012-06-20 16:38:30 -070011055 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11056 "Next AC: %d", ucNextAC));
11057
11058 while ( 0 != ucACMask )
11059 {
11060 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11061 " AC Mask: %d Next: %d Res : %d",
11062 ucACMask, ( 1 << ucNextAC ), ( ucACMask & ( 1 << ucNextAC ))));
11063
11064 if ( 0 != ( ucACMask & ( 1 << ucNextAC ) & uFlowMask ))
11065 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011066 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC =
Jeff Johnson295189b2012-06-20 16:38:30 -070011067 (WLANTL_ACEnumType)ucNextAC;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011068 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentWeight =
Jeff Johnson295189b2012-06-20 16:38:30 -070011069 pTLCb->tlConfigInfo.ucAcWeights[ucNextAC];
11070
11071 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11072 "WLAN TL: Switching serviced AC to: %d with Weight: %d",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011073 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC ,
11074 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentWeight));
Jeff Johnson295189b2012-06-20 16:38:30 -070011075 break;
11076 }
11077
11078 ucNextAC = ( ucNextAC - 1 ) & WLANTL_MASK_AC;
11079
11080 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11081 "Next AC %d", ucNextAC));
11082
11083 }
11084
11085 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11086 " C AC: %d C W: %d",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011087 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC,
11088 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentWeight));
Jeff Johnson295189b2012-06-20 16:38:30 -070011089
11090 return VOS_STATUS_SUCCESS;
11091}/* WLAN_TLGetNextTxIds */
11092
Jeff Johnson295189b2012-06-20 16:38:30 -070011093
11094
11095/*==========================================================================
11096 DEFAULT HANDLERS: Registered at initialization with TL
11097 ==========================================================================*/
11098
11099/*==========================================================================
11100
11101 FUNCTION WLANTL_MgmtFrmRxDefaultCb
11102
11103 DESCRIPTION
11104 Default Mgmt Frm rx callback: asserts all the time. If this function gets
11105 called it means there is no registered rx cb pointer for Mgmt Frm.
11106
11107 DEPENDENCIES
11108
11109 PARAMETERS
11110 Not used.
11111
11112 RETURN VALUE
11113
11114 VOS_STATUS_E_FAILURE: Always FAILURE.
11115
11116============================================================================*/
11117VOS_STATUS
11118WLANTL_MgmtFrmRxDefaultCb
11119(
11120 v_PVOID_t pvosGCtx,
11121 v_PVOID_t vosBuff
11122)
11123{
11124 if ( NULL != vosBuff )
11125 {
11126 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
11127 "WLAN TL:Fatal failure: No registered Mgmt Frm client on pkt RX"));
11128 /* Drop packet */
11129 vos_pkt_return_packet((vos_pkt_t *)vosBuff);
11130 }
11131
Jeff Johnson295189b2012-06-20 16:38:30 -070011132 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11133 "WLAN TL: No registered Mgmt Frm client on pkt RX. Load/Unload in progress, Ignore"));
Jeff Johnson295189b2012-06-20 16:38:30 -070011134
11135 return VOS_STATUS_E_FAILURE;
11136}/*WLANTL_MgmtFrmRxDefaultCb*/
11137
11138/*==========================================================================
11139
Madan Mohan Koyyalamudi6c2977d2013-09-04 15:42:45 +053011140 FUNCTION WLANTL_BAPRxDefaultCb
Jeff Johnson295189b2012-06-20 16:38:30 -070011141
11142 DESCRIPTION
11143 Default BAP rx callback: asserts all the time. If this function gets
11144 called it means there is no registered rx cb pointer for BAP.
11145
11146 DEPENDENCIES
11147
11148 PARAMETERS
11149 Not used.
11150
11151 RETURN VALUE
11152
11153 VOS_STATUS_E_FAILURE: Always FAILURE.
11154
11155============================================================================*/
11156VOS_STATUS
11157WLANTL_BAPRxDefaultCb
11158(
11159 v_PVOID_t pvosGCtx,
11160 vos_pkt_t* vosDataBuff,
11161 WLANTL_BAPFrameEnumType frameType
11162)
11163{
11164 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
11165 "WLAN TL:Fatal failure: No registered BAP client on BAP pkt RX"));
11166#ifndef BTAMP_TEST
11167 VOS_ASSERT(0);
11168#endif
11169 return VOS_STATUS_E_FAILURE;
11170}/*WLANTL_MgmtFrmRxDefaultCb*/
11171
11172/*==========================================================================
11173
11174 FUNCTION WLANTL_STARxDefaultCb
11175
11176 DESCRIPTION
11177 Default STA rx callback: asserts all the time. If this function gets
11178 called it means there is no registered rx cb pointer for station.
11179 (Mem corruption most likely, it should never happen)
11180
11181 DEPENDENCIES
11182
11183 PARAMETERS
11184 Not used.
11185
11186 RETURN VALUE
11187
11188 VOS_STATUS_E_FAILURE: Always FAILURE.
11189
11190============================================================================*/
11191VOS_STATUS
11192WLANTL_STARxDefaultCb
11193(
11194 v_PVOID_t pvosGCtx,
11195 vos_pkt_t* vosDataBuff,
11196 v_U8_t ucSTAId,
11197 WLANTL_RxMetaInfoType* pRxMetaInfo
11198)
11199{
11200 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11201 "WLAN TL: No registered STA client rx cb for STAID: %d dropping pkt",
11202 ucSTAId));
11203 vos_pkt_return_packet(vosDataBuff);
Madan Mohan Koyyalamudi6c2977d2013-09-04 15:42:45 +053011204 return VOS_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -070011205}/*WLANTL_MgmtFrmRxDefaultCb*/
11206
11207
11208/*==========================================================================
11209
11210 FUNCTION WLANTL_STAFetchPktDefaultCb
11211
11212 DESCRIPTION
11213 Default fetch callback: asserts all the time. If this function gets
11214 called it means there is no registered fetch cb pointer for station.
11215 (Mem corruption most likely, it should never happen)
11216
11217 DEPENDENCIES
11218
11219 PARAMETERS
11220 Not used.
11221
11222 RETURN VALUE
11223
11224 VOS_STATUS_E_FAILURE: Always FAILURE.
11225
11226============================================================================*/
11227VOS_STATUS
11228WLANTL_STAFetchPktDefaultCb
11229(
11230 v_PVOID_t pvosGCtx,
11231 v_U8_t* pucSTAId,
11232 WLANTL_ACEnumType ucAC,
11233 vos_pkt_t** vosDataBuff,
11234 WLANTL_MetaInfoType* tlMetaInfo
11235)
11236{
11237 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
11238 "WLAN TL:Fatal failure: No registered STA client on data pkt RX"));
11239 VOS_ASSERT(0);
11240 return VOS_STATUS_E_FAILURE;
11241}/*WLANTL_MgmtFrmRxDefaultCb*/
11242
11243/*==========================================================================
11244
11245 FUNCTION WLANTL_TxCompDefaultCb
11246
11247 DESCRIPTION
11248 Default tx complete handler. It will release the completed pkt to
11249 prevent memory leaks.
11250
11251 PARAMETERS
11252
11253 IN
11254 pvosGCtx: pointer to the global vos context; a handle to
11255 TL/HAL/PE/BAP/HDD control block can be extracted from
11256 its context
11257 vosDataBuff: pointer to the VOSS data buffer that was transmitted
11258 wTxSTAtus: status of the transmission
11259
11260
11261 RETURN VALUE
11262 The result code associated with performing the operation; please
11263 check vos_pkt_return_packet for possible error codes.
11264
11265 Please check vos_pkt_return_packet API for possible return values.
11266
11267============================================================================*/
11268VOS_STATUS
11269WLANTL_TxCompDefaultCb
11270(
11271 v_PVOID_t pvosGCtx,
11272 vos_pkt_t* vosDataBuff,
11273 VOS_STATUS wTxSTAtus
11274)
11275{
11276 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11277 "WLAN TL:TXComp not registered, releasing pkt to prevent mem leak"));
11278 return vos_pkt_return_packet(vosDataBuff);
11279}/*WLANTL_TxCompDefaultCb*/
11280
11281
11282/*==========================================================================
11283 Cleanup functions
11284 ==========================================================================*/
11285
11286/*==========================================================================
11287
11288 FUNCTION WLANTL_CleanCB
11289
11290 DESCRIPTION
11291 Cleans TL control block
11292
11293 DEPENDENCIES
11294
11295 PARAMETERS
11296
11297 IN
11298 pTLCb: pointer to TL's control block
11299 ucEmpty: set if TL has to clean up the queues and release pedning pkts
11300
11301 RETURN VALUE
11302 The result code associated with performing the operation
11303
11304 VOS_STATUS_E_INVAL: invalid input parameters
11305 VOS_STATUS_SUCCESS: Everything is good :)
11306
11307 SIDE EFFECTS
11308
11309============================================================================*/
11310VOS_STATUS
11311WLANTL_CleanCB
11312(
11313 WLANTL_CbType* pTLCb,
11314 v_U8_t ucEmpty
11315)
11316{
11317 v_U8_t ucIndex;
11318 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
11319
11320 /*-------------------------------------------------------------------------
11321 Sanity check
11322 -------------------------------------------------------------------------*/
11323 if ( NULL == pTLCb )
11324 {
11325 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11326 "WLAN TL:Invalid parameter sent on WLANTL_CleanCB"));
11327 return VOS_STATUS_E_INVAL;
11328 }
11329
11330 /* number of packets sent to BAL waiting for tx complete confirmation */
11331 pTLCb->usPendingTxCompleteCount = 0;
11332
11333 /* global suspend flag */
11334 vos_atomic_set_U8( &pTLCb->ucTxSuspended, 1);
11335
11336 /* resource flag */
11337 pTLCb->uResCount = 0;
11338
11339
11340 /*-------------------------------------------------------------------------
11341 Client stations
11342 -------------------------------------------------------------------------*/
11343 for ( ucIndex = 0; ucIndex < WLAN_MAX_STA_COUNT ; ucIndex++)
11344 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011345 if(NULL != pTLCb->atlSTAClients[ucIndex])
11346 {
11347 WLANTL_CleanSTA( pTLCb->atlSTAClients[ucIndex], ucEmpty);
11348 }
Jeff Johnson295189b2012-06-20 16:38:30 -070011349 }
11350
11351 /*-------------------------------------------------------------------------
11352 Management Frame client
11353 -------------------------------------------------------------------------*/
11354 pTLCb->tlMgmtFrmClient.ucExists = 0;
11355
11356 if ( ( 0 != ucEmpty) &&
11357 ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff ))
11358 {
11359 vos_pkt_return_packet(pTLCb->tlMgmtFrmClient.vosPendingDataBuff);
11360 }
11361
11362 pTLCb->tlMgmtFrmClient.vosPendingDataBuff = NULL;
11363
11364 /* set to a default cb in order to prevent constant checking for NULL */
11365 pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx = WLANTL_MgmtFrmRxDefaultCb;
11366
11367 /*-------------------------------------------------------------------------
11368 BT AMP client
11369 -------------------------------------------------------------------------*/
11370 pTLCb->tlBAPClient.ucExists = 0;
11371
11372 if (( 0 != ucEmpty) &&
11373 ( NULL != pTLCb->tlBAPClient.vosPendingDataBuff ))
11374 {
11375 vos_pkt_return_packet(pTLCb->tlBAPClient.vosPendingDataBuff);
11376 }
11377
11378 if (( 0 != ucEmpty) &&
11379 ( NULL != pTLCb->vosDummyBuf ))
11380 {
11381 vos_pkt_return_packet(pTLCb->vosDummyBuf);
11382 }
11383
11384 pTLCb->tlBAPClient.vosPendingDataBuff = NULL;
11385
11386 pTLCb->vosDummyBuf = NULL;
11387 pTLCb->vosTempBuf = NULL;
11388 pTLCb->ucCachedSTAId = WLAN_MAX_STA_COUNT;
11389
11390 /* set to a default cb in order to prevent constant checking for NULL */
11391 pTLCb->tlBAPClient.pfnTlBAPRx = WLANTL_BAPRxDefaultCb;
11392
11393 pTLCb->ucRegisteredStaId = WLAN_MAX_STA_COUNT;
11394
11395 return VOS_STATUS_SUCCESS;
11396
11397}/* WLANTL_CleanCB*/
11398
11399/*==========================================================================
11400
11401 FUNCTION WLANTL_CleanSTA
11402
11403 DESCRIPTION
11404 Cleans a station control block.
11405
11406 DEPENDENCIES
11407
11408 PARAMETERS
11409
11410 IN
11411 pvosGCtx: pointer to the global vos context; a handle to TL's
11412 control block can be extracted from its context
11413 ucEmpty: if set the queues and pending pkts will be emptyed
11414
11415 RETURN VALUE
11416 The result code associated with performing the operation
11417
11418 VOS_STATUS_E_INVAL: invalid input parameters
11419 VOS_STATUS_SUCCESS: Everything is good :)
11420
11421 SIDE EFFECTS
11422
11423============================================================================*/
11424VOS_STATUS
11425WLANTL_CleanSTA
11426(
11427 WLANTL_STAClientType* ptlSTAClient,
11428 v_U8_t ucEmpty
11429)
11430{
11431 v_U8_t ucIndex;
11432 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
11433
11434 /*-------------------------------------------------------------------------
11435 Sanity check
11436 -------------------------------------------------------------------------*/
11437 if ( NULL == ptlSTAClient )
11438 {
11439 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11440 "WLAN TL:Invalid parameter sent on WLANTL_CleanSTA"));
11441 return VOS_STATUS_E_INVAL;
11442 }
11443
11444 /*------------------------------------------------------------------------
11445 Clear station from TL
11446 ------------------------------------------------------------------------*/
11447 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11448 "WLAN TL: Clearing STA Client ID: %d, Empty flag: %d",
11449 ptlSTAClient->wSTADesc.ucSTAId, ucEmpty ));
11450
11451 ptlSTAClient->pfnSTARx = WLANTL_STARxDefaultCb;
11452 ptlSTAClient->pfnSTATxComp = WLANTL_TxCompDefaultCb;
11453 ptlSTAClient->pfnSTAFetchPkt = WLANTL_STAFetchPktDefaultCb;
11454
11455 ptlSTAClient->tlState = WLANTL_STA_INIT;
11456 ptlSTAClient->tlPri = WLANTL_STA_PRI_NORMAL;
11457
11458 vos_zero_macaddr( &ptlSTAClient->wSTADesc.vSTAMACAddress );
11459 vos_zero_macaddr( &ptlSTAClient->wSTADesc.vBSSIDforIBSS );
11460 vos_zero_macaddr( &ptlSTAClient->wSTADesc.vSelfMACAddress );
11461
11462 ptlSTAClient->wSTADesc.ucSTAId = 0;
11463 ptlSTAClient->wSTADesc.wSTAType = WLAN_STA_MAX;
11464
11465 ptlSTAClient->wSTADesc.ucQosEnabled = 0;
11466 ptlSTAClient->wSTADesc.ucAddRmvLLC = 0;
11467 ptlSTAClient->wSTADesc.ucSwFrameTXXlation = 0;
11468 ptlSTAClient->wSTADesc.ucSwFrameRXXlation = 0;
11469 ptlSTAClient->wSTADesc.ucProtectedFrame = 0;
11470
11471 /*-------------------------------------------------------------------------
11472 AMSDU information for the STA
11473 -------------------------------------------------------------------------*/
11474 if ( ( 0 != ucEmpty ) &&
11475 ( NULL != ptlSTAClient->vosAMSDUChainRoot ))
11476 {
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -070011477 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
Jeff Johnson0298bd02013-11-14 19:58:38 -080011478 "WLAN TL:Non NULL vosAMSDUChainRoot on WLANTL_CleanSTA, "
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -070011479 "suspecting a memory corruption"));
11480
Jeff Johnson295189b2012-06-20 16:38:30 -070011481 }
11482
11483 ptlSTAClient->vosAMSDUChain = NULL;
11484 ptlSTAClient->vosAMSDUChainRoot = NULL;
11485
11486 vos_mem_zero( (v_PVOID_t)ptlSTAClient->aucMPDUHeader,
11487 WLANTL_MPDU_HEADER_LEN);
11488 ptlSTAClient->ucMPDUHeaderLen = 0;
11489
11490 /*-------------------------------------------------------------------------
11491 Reordering information for the STA
11492 -------------------------------------------------------------------------*/
11493 for ( ucIndex = 0; ucIndex < WLAN_MAX_TID ; ucIndex++)
11494 {
11495 if(0 == ptlSTAClient->atlBAReorderInfo[ucIndex].ucExists)
11496 {
11497 continue;
11498 }
11499 if(NULL != ptlSTAClient->atlBAReorderInfo[ucIndex].reorderBuffer)
11500 {
11501 ptlSTAClient->atlBAReorderInfo[ucIndex].reorderBuffer->isAvailable = VOS_TRUE;
11502 memset(&ptlSTAClient->atlBAReorderInfo[ucIndex].reorderBuffer->arrayBuffer[0], 0, WLANTL_MAX_WINSIZE * sizeof(v_PVOID_t));
11503 }
11504 vos_timer_destroy(&ptlSTAClient->atlBAReorderInfo[ucIndex].agingTimer);
11505 memset(&ptlSTAClient->atlBAReorderInfo[ucIndex], 0, sizeof(WLANTL_BAReorderType));
11506 }
11507
11508 /*-------------------------------------------------------------------------
11509 QOS information for the STA
11510 -------------------------------------------------------------------------*/
11511 ptlSTAClient->ucCurrentAC = WLANTL_AC_VO;
11512 ptlSTAClient->ucCurrentWeight = 0;
11513 ptlSTAClient->ucServicedAC = WLANTL_AC_BK;
11514
11515 vos_mem_zero( ptlSTAClient->aucACMask, sizeof(ptlSTAClient->aucACMask));
11516 vos_mem_zero( &ptlSTAClient->wUAPSDInfo, sizeof(ptlSTAClient->wUAPSDInfo));
11517
11518
11519 /*--------------------------------------------------------------------
11520 Stats info
11521 --------------------------------------------------------------------*/
11522 vos_mem_zero( ptlSTAClient->auRxCount,
11523 sizeof(ptlSTAClient->auRxCount[0])* WLAN_MAX_TID);
11524 vos_mem_zero( ptlSTAClient->auTxCount,
11525 sizeof(ptlSTAClient->auTxCount[0])* WLAN_MAX_TID);
11526 ptlSTAClient->rssiAvg = 0;
11527
11528 /*Tx not suspended and station fully registered*/
11529 vos_atomic_set_U8( &ptlSTAClient->ucTxSuspended, 0);
11530 vos_atomic_set_U8( &ptlSTAClient->ucNoMoreData, 1);
11531
11532 if ( 0 == ucEmpty )
11533 {
11534 ptlSTAClient->wSTADesc.ucUcastSig = WLAN_TL_INVALID_U_SIG;
11535 ptlSTAClient->wSTADesc.ucBcastSig = WLAN_TL_INVALID_B_SIG;
11536 }
11537
11538 ptlSTAClient->ucExists = 0;
11539
11540 /*--------------------------------------------------------------------
11541 Statistics info
11542 --------------------------------------------------------------------*/
11543 memset(&ptlSTAClient->trafficStatistics,
11544 0,
11545 sizeof(WLANTL_TRANSFER_STA_TYPE));
11546
11547 /*fix me!!: add new values from the TL Cb for cleanup */
11548 return VOS_STATUS_SUCCESS;
11549}/* WLANTL_CleanSTA */
11550
11551
11552/*==========================================================================
11553 FUNCTION WLANTL_EnableUAPSDForAC
11554
11555 DESCRIPTION
11556 Called by HDD to enable UAPSD. TL in turn calls WDA API to enable the
11557 logic in FW/SLM to start sending trigger frames. Previously TL had the
11558 trigger frame logic which later moved down to FW. Hence
11559 HDD -> TL -> WDA -> FW call flow.
11560
11561 DEPENDENCIES
11562 The TL must be initialized before this function can be called.
11563
11564 PARAMETERS
11565
11566 IN
11567 pvosGCtx: pointer to the global vos context; a handle to TL's
11568 control block can be extracted from its context
11569 ucSTAId: station Id
11570 ucAC: AC for which U-APSD is being enabled
11571 ucTid: TID for which U-APSD is setup
11572 ucUP: used to place in the trigger frame generation
11573 ucServiceInt: service interval used by TL to send trigger frames
11574 ucSuspendInt: suspend interval used by TL to determine that an
11575 app is idle and should start sending trigg frms less often
11576 wTSDir: direction of TSpec
11577
11578 RETURN VALUE
11579 The result code associated with performing the operation
11580
11581 VOS_STATUS_SUCCESS: Everything is good :)
11582
11583 SIDE EFFECTS
11584
11585============================================================================*/
11586VOS_STATUS
11587WLANTL_EnableUAPSDForAC
11588(
11589 v_PVOID_t pvosGCtx,
11590 v_U8_t ucSTAId,
11591 WLANTL_ACEnumType ucAC,
11592 v_U8_t ucTid,
11593 v_U8_t ucUP,
11594 v_U32_t uServiceInt,
11595 v_U32_t uSuspendInt,
11596 WLANTL_TSDirType wTSDir
11597)
11598{
11599
11600 WLANTL_CbType* pTLCb = NULL;
11601 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11602 tUapsdInfo halUAPSDInfo;
11603 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
11604
11605 /*------------------------------------------------------------------------
11606 Sanity check
11607 Extract TL control block
11608 ------------------------------------------------------------------------*/
11609 pTLCb = VOS_GET_TL_CB(pvosGCtx);
11610 if (( NULL == pTLCb ) || WLANTL_STA_ID_INVALID( ucSTAId )
Gopichand Nakkala574f6d12013-06-27 19:38:43 +053011611 || WLANTL_AC_INVALID(ucAC))
Jeff Johnson295189b2012-06-20 16:38:30 -070011612 {
11613 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11614 "WLAN TL:Invalid input params on WLANTL_EnableUAPSDForAC"
Gopichand Nakkala574f6d12013-06-27 19:38:43 +053011615 " TL: %p STA: %d AC: %d",
11616 pTLCb, ucSTAId, ucAC));
Jeff Johnson295189b2012-06-20 16:38:30 -070011617 return VOS_STATUS_E_FAULT;
11618 }
11619
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011620 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
11621 {
11622 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11623 "WLAN TL:Client Memory was not allocated on %s", __func__));
11624 return VOS_STATUS_E_FAILURE;
11625 }
11626
Jeff Johnson295189b2012-06-20 16:38:30 -070011627 /*Set this flag in order to remember that this is a trigger enabled AC*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011628 pTLCb->atlSTAClients[ucSTAId]->wUAPSDInfo[ucAC].ucSet = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -070011629
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053011630#ifdef FEATURE_WLAN_TDLS
11631 if(pTLCb->atlSTAClients[ucSTAId]->wSTADesc.wSTAType != WLAN_STA_TDLS)
11632#endif
11633 {
11634 if( 0 == uServiceInt )
11635 {
11636 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi198ade32013-09-29 03:52:25 +053011637 "WLAN TL:Input params on WLANTL_EnableUAPSDForAC"
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053011638 " SI: %d", uServiceInt ));
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053011639 }
Jeff Johnson295189b2012-06-20 16:38:30 -070011640
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053011641 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11642 "WLAN TL:Enabling U-APSD in FW for STA: %d AC: %d SI: %d SPI: %d "
11643 "DI: %d",
11644 ucSTAId, ucAC, uServiceInt, uSuspendInt,
11645 pTLCb->tlConfigInfo.uDelayedTriggerFrmInt));
Jeff Johnson295189b2012-06-20 16:38:30 -070011646
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053011647 /*Save all info for HAL*/
11648 halUAPSDInfo.staidx = ucSTAId;
11649 halUAPSDInfo.ac = ucAC;
11650 halUAPSDInfo.up = ucUP;
11651 halUAPSDInfo.srvInterval = uServiceInt;
11652 halUAPSDInfo.susInterval = uSuspendInt;
11653 halUAPSDInfo.delayInterval = pTLCb->tlConfigInfo.uDelayedTriggerFrmInt;
11654
11655 /*Notify HAL*/
11656 vosStatus = WDA_EnableUapsdAcParams(pvosGCtx, ucSTAId, &halUAPSDInfo);
11657 }
Jeff Johnson295189b2012-06-20 16:38:30 -070011658 return vosStatus;
11659
11660}/*WLANTL_EnableUAPSDForAC*/
11661
11662
11663/*==========================================================================
11664 FUNCTION WLANTL_DisableUAPSDForAC
11665
11666 DESCRIPTION
11667 Called by HDD to disable UAPSD. TL in turn calls WDA API to disable the
11668 logic in FW/SLM to stop sending trigger frames. Previously TL had the
11669 trigger frame logic which later moved down to FW. Hence
11670 HDD -> TL -> WDA -> FW call flow.
11671
11672 DEPENDENCIES
11673 The TL must be initialized before this function can be called.
11674
11675 PARAMETERS
11676
11677 IN
11678 pvosGCtx: pointer to the global vos context; a handle to TL's
11679 control block can be extracted from its context
11680 ucSTAId: station Id
11681 ucAC: AC for which U-APSD is being enabled
11682
11683
11684 RETURN VALUE
11685 The result code associated with performing the operation
11686
11687 VOS_STATUS_SUCCESS: Everything is good :)
11688
11689 SIDE EFFECTS
11690
11691============================================================================*/
11692VOS_STATUS
11693WLANTL_DisableUAPSDForAC
11694(
11695 v_PVOID_t pvosGCtx,
11696 v_U8_t ucSTAId,
11697 WLANTL_ACEnumType ucAC
11698)
11699{
11700 WLANTL_CbType* pTLCb;
11701 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
11702
11703 /*------------------------------------------------------------------------
11704 Sanity check
11705 Extract TL control block
11706 ------------------------------------------------------------------------*/
11707 pTLCb = VOS_GET_TL_CB(pvosGCtx);
11708 if (( NULL == pTLCb ) || WLANTL_STA_ID_INVALID( ucSTAId )
11709 || WLANTL_AC_INVALID(ucAC) )
11710 {
11711 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11712 "WLAN TL:Invalid input params on WLANTL_DisableUAPSDForAC"
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +053011713 " TL: %p STA: %d AC: %d", pTLCb, ucSTAId, ucAC ));
Jeff Johnson295189b2012-06-20 16:38:30 -070011714 return VOS_STATUS_E_FAULT;
11715 }
11716
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011717 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
11718 {
11719 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11720 "WLAN TL:Client Memory was not allocated on %s", __func__));
11721 return VOS_STATUS_E_FAILURE;
11722 }
11723
Jeff Johnson295189b2012-06-20 16:38:30 -070011724 /*Reset this flag as this is no longer a trigger enabled AC*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011725 pTLCb->atlSTAClients[ucSTAId]->wUAPSDInfo[ucAC].ucSet = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -070011726
11727 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11728 "WLAN TL:Disabling U-APSD in FW for STA: %d AC: %d ",
11729 ucSTAId, ucAC));
11730
11731 /*Notify HAL*/
11732 WDA_DisableUapsdAcParams(pvosGCtx, ucSTAId, ucAC);
11733
11734 return VOS_STATUS_SUCCESS;
11735}/* WLANTL_DisableUAPSDForAC */
11736
11737#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
11738/*==========================================================================
11739 FUNCTION WLANTL_RegRSSIIndicationCB
11740
11741 DESCRIPTION Registration function to get notification if RSSI cross
11742 threshold.
11743 Client should register threshold, direction, and notification
11744 callback function pointer
11745
11746 DEPENDENCIES NONE
11747
11748 PARAMETERS in pAdapter - Global handle
11749 in rssiValue - RSSI threshold value
11750 in triggerEvent - Cross direction should be notified
11751 UP, DOWN, and CROSS
11752 in crossCBFunction - Notification CB Function
11753 in usrCtxt - user context
11754
11755 RETURN VALUE VOS_STATUS
11756
11757 SIDE EFFECTS NONE
11758
11759============================================================================*/
11760VOS_STATUS WLANTL_RegRSSIIndicationCB
11761(
11762 v_PVOID_t pAdapter,
11763 v_S7_t rssiValue,
11764 v_U8_t triggerEvent,
11765 WLANTL_RSSICrossThresholdCBType crossCBFunction,
11766 VOS_MODULE_ID moduleID,
11767 v_PVOID_t usrCtxt
11768)
11769{
11770 VOS_STATUS status = VOS_STATUS_SUCCESS;
11771
11772 status = WLANTL_HSRegRSSIIndicationCB(pAdapter,
11773 rssiValue,
11774 triggerEvent,
11775 crossCBFunction,
11776 moduleID,
11777 usrCtxt);
11778
11779 return status;
11780}
11781
11782/*==========================================================================
11783 FUNCTION WLANTL_DeregRSSIIndicationCB
11784
11785 DESCRIPTION Remove specific threshold from list
11786
11787 DEPENDENCIES NONE
11788
11789 PARAMETERS in pAdapter - Global handle
11790 in rssiValue - RSSI threshold value
11791 in triggerEvent - Cross direction should be notified
11792 UP, DOWN, and CROSS
11793
11794 RETURN VALUE VOS_STATUS
11795
11796 SIDE EFFECTS NONE
11797
11798============================================================================*/
11799VOS_STATUS WLANTL_DeregRSSIIndicationCB
11800(
11801 v_PVOID_t pAdapter,
11802 v_S7_t rssiValue,
11803 v_U8_t triggerEvent,
11804 WLANTL_RSSICrossThresholdCBType crossCBFunction,
11805 VOS_MODULE_ID moduleID
11806)
11807{
11808 VOS_STATUS status = VOS_STATUS_SUCCESS;
11809
11810 status = WLANTL_HSDeregRSSIIndicationCB(pAdapter,
11811 rssiValue,
11812 triggerEvent,
11813 crossCBFunction,
11814 moduleID);
11815 return status;
11816}
11817
11818/*==========================================================================
11819 FUNCTION WLANTL_SetAlpha
11820
11821 DESCRIPTION ALPLA is weight value to calculate AVG RSSI
11822 avgRSSI = (ALPHA * historyRSSI) + ((10 - ALPHA) * newRSSI)
11823 avgRSSI has (ALPHA * 10)% of history RSSI weight and
11824 (10 - ALPHA)% of newRSSI weight
11825 This portion is dynamically configurable.
11826 Default is ?
11827
11828 DEPENDENCIES NONE
11829
11830 PARAMETERS in pAdapter - Global handle
11831 in valueAlpah - ALPHA
11832
11833 RETURN VALUE VOS_STATUS
11834
11835 SIDE EFFECTS NONE
11836
11837============================================================================*/
11838VOS_STATUS WLANTL_SetAlpha
11839(
11840 v_PVOID_t pAdapter,
11841 v_U8_t valueAlpha
11842)
11843{
11844 VOS_STATUS status = VOS_STATUS_SUCCESS;
11845
11846 status = WLANTL_HSSetAlpha(pAdapter, valueAlpha);
11847 return status;
11848}
11849
11850/*==========================================================================
11851
11852 FUNCTION
11853
11854 DESCRIPTION
11855
11856 PARAMETERS
11857
11858 RETURN VALUE
11859
11860============================================================================*/
11861VOS_STATUS WLANTL_BMPSRSSIRegionChangedNotification
11862(
11863 v_PVOID_t pAdapter,
11864 tpSirRSSINotification pRSSINotification
11865)
11866{
11867 VOS_STATUS status = VOS_STATUS_SUCCESS;
11868
11869 status = WLANTL_HSBMPSRSSIRegionChangedNotification(pAdapter, pRSSINotification);
11870 return status;
11871}
11872
11873/*==========================================================================
11874 FUNCTION WLANTL_RegGetTrafficStatus
11875
11876 DESCRIPTION Registration function for traffic status monitoring
11877 During measure period count data frames.
11878 If frame count is larger then IDLE threshold set as traffic ON
11879 or OFF.
11880 And traffic status is changed send report to client with
11881 registered callback function
11882
11883 DEPENDENCIES NONE
11884
11885 PARAMETERS in pAdapter - Global handle
11886 in idleThreshold - Traffic on or off threshold
11887 in measurePeriod - Traffic state check period
11888 in trfficStatusCB - traffic status changed notification
11889 CB function
11890 in usrCtxt - user context
11891
11892 RETURN VALUE VOS_STATUS
11893
11894 SIDE EFFECTS NONE
11895
11896============================================================================*/
11897VOS_STATUS WLANTL_RegGetTrafficStatus
11898(
11899 v_PVOID_t pAdapter,
11900 v_U32_t idleThreshold,
11901 v_U32_t measurePeriod,
11902 WLANTL_TrafficStatusChangedCBType trfficStatusCB,
11903 v_PVOID_t usrCtxt
11904)
11905{
11906 VOS_STATUS status = VOS_STATUS_SUCCESS;
11907
11908 status = WLANTL_HSRegGetTrafficStatus(pAdapter,
11909 idleThreshold,
11910 measurePeriod,
11911 trfficStatusCB,
11912 usrCtxt);
11913 return status;
11914}
11915#endif
11916/*==========================================================================
11917 FUNCTION WLANTL_GetStatistics
11918
11919 DESCRIPTION Get traffic statistics for identified station
11920
11921 DEPENDENCIES NONE
11922
11923 PARAMETERS in pAdapter - Global handle
11924 in statType - specific statistics field to reset
11925 out statBuffer - traffic statistics buffer
11926
11927 RETURN VALUE VOS_STATUS
11928
11929 SIDE EFFECTS NONE
11930
11931============================================================================*/
11932VOS_STATUS WLANTL_GetStatistics
11933(
11934 v_PVOID_t pAdapter,
11935 WLANTL_TRANSFER_STA_TYPE *statBuffer,
11936 v_U8_t STAid
11937)
11938{
11939 WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011940 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -070011941 VOS_STATUS status = VOS_STATUS_SUCCESS;
11942 WLANTL_TRANSFER_STA_TYPE *statistics = NULL;
11943
11944 /*------------------------------------------------------------------------
11945 Sanity check
11946 Extract TL control block
11947 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011948 if ( NULL == pTLCb )
Jeff Johnson295189b2012-06-20 16:38:30 -070011949 {
11950 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11951 "WLAN TL:Invalid TL pointer on WLANTL_GetStatistics"));
11952 return VOS_STATUS_E_FAULT;
11953 }
11954
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011955 pClientSTA = pTLCb->atlSTAClients[STAid];
11956
11957 if ( NULL == pClientSTA )
11958 {
11959 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11960 "WLAN TL:Client Memory was not allocated on %s", __func__));
11961 return VOS_STATUS_E_FAILURE;
11962 }
11963
11964 if(0 == pClientSTA->ucExists)
Jeff Johnson295189b2012-06-20 16:38:30 -070011965 {
11966 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11967 "WLAN TL: %d STA ID does not exist", STAid));
11968 return VOS_STATUS_E_INVAL;
11969 }
11970
11971 if(NULL == statBuffer)
11972 {
11973 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11974 "WLAN TL:Invalid TL statistics buffer pointer on WLANTL_GetStatistics"));
11975 return VOS_STATUS_E_INVAL;
11976 }
11977
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011978 statistics = &pClientSTA->trafficStatistics;
Katya Nigam493ff652014-02-11 14:31:04 +053011979 vos_mem_copy(statBuffer, statistics, sizeof(WLANTL_TRANSFER_STA_TYPE));
Jeff Johnson295189b2012-06-20 16:38:30 -070011980
11981 return status;
11982}
11983
11984/*==========================================================================
11985 FUNCTION WLANTL_ResetStatistics
11986
11987 DESCRIPTION Reset statistics structure for identified station ID
11988 Reset means set values as 0
11989
11990 DEPENDENCIES NONE
11991
11992 PARAMETERS in pAdapter - Global handle
11993 in statType - specific statistics field to reset
11994
11995 RETURN VALUE VOS_STATUS
11996
11997 SIDE EFFECTS NONE
11998
11999============================================================================*/
12000VOS_STATUS WLANTL_ResetStatistics
12001(
12002 v_PVOID_t pAdapter,
12003 v_U8_t STAid
12004)
12005{
12006 WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012007 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -070012008 VOS_STATUS status = VOS_STATUS_SUCCESS;
12009 WLANTL_TRANSFER_STA_TYPE *statistics = NULL;
12010
12011 /*------------------------------------------------------------------------
12012 Sanity check
12013 Extract TL control block
12014 ------------------------------------------------------------------------*/
12015 if (NULL == pTLCb)
12016 {
12017 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12018 "WLAN TL:Invalid TL pointer on WLANTL_GetStatistics"));
12019 return VOS_STATUS_E_FAULT;
12020 }
12021
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012022 pClientSTA = pTLCb->atlSTAClients[STAid];
12023
12024 if ( NULL == pClientSTA )
12025 {
12026 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12027 "WLAN TL:Client Memory was not allocated on %s", __func__));
12028 return VOS_STATUS_E_FAILURE;
12029 }
12030
12031 if(0 == pClientSTA->ucExists)
Jeff Johnson295189b2012-06-20 16:38:30 -070012032 {
12033 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12034 "WLAN TL: %d STA ID does not exist", STAid));
12035 return VOS_STATUS_E_INVAL;
12036 }
12037
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012038 statistics = &pClientSTA->trafficStatistics;
Jeff Johnson295189b2012-06-20 16:38:30 -070012039 vos_mem_zero((v_VOID_t *)statistics, sizeof(WLANTL_TRANSFER_STA_TYPE));
12040
12041 return status;
12042}
12043
12044/*==========================================================================
12045 FUNCTION WLANTL_GetSpecStatistic
12046
12047 DESCRIPTION Get specific field within statistics structure for
12048 identified station ID
12049
12050 DEPENDENCIES NONE
12051
12052 PARAMETERS in pAdapter - Global handle
12053 in statType - specific statistics field to reset
12054 in STAid - Station ID
12055 out buffer - Statistic value
12056
12057 RETURN VALUE VOS_STATUS
12058
12059 SIDE EFFECTS NONE
12060
12061============================================================================*/
12062VOS_STATUS WLANTL_GetSpecStatistic
12063(
12064 v_PVOID_t pAdapter,
12065 WLANTL_TRANSFER_STATIC_TYPE statType,
12066 v_U32_t *buffer,
12067 v_U8_t STAid
12068)
12069{
12070 WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012071 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -070012072 VOS_STATUS status = VOS_STATUS_SUCCESS;
12073 WLANTL_TRANSFER_STA_TYPE *statistics = NULL;
12074
12075 /*------------------------------------------------------------------------
12076 Sanity check
12077 Extract TL control block
12078 ------------------------------------------------------------------------*/
12079 if (NULL == pTLCb)
12080 {
12081 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12082 "WLAN TL:Invalid TL pointer on WLANTL_GetStatistics"));
12083 return VOS_STATUS_E_FAULT;
12084 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012085 pClientSTA = pTLCb->atlSTAClients[STAid];
Jeff Johnson295189b2012-06-20 16:38:30 -070012086
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012087 if ( NULL == pClientSTA )
12088 {
12089 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12090 "WLAN TL:Client Memory was not allocated on %s", __func__));
12091 return VOS_STATUS_E_FAILURE;
12092 }
12093
12094 if(0 == pClientSTA->ucExists)
Jeff Johnson295189b2012-06-20 16:38:30 -070012095 {
12096 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12097 "WLAN TL: %d STA ID does not exist", STAid));
12098 return VOS_STATUS_E_INVAL;
12099 }
12100
12101 if(NULL == buffer)
12102 {
12103 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12104 "WLAN TL:Invalid TL statistic buffer pointer on WLANTL_GetStatistics"));
12105 return VOS_STATUS_E_INVAL;
12106 }
12107
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012108 statistics = &pClientSTA->trafficStatistics;
Jeff Johnson295189b2012-06-20 16:38:30 -070012109 switch(statType)
12110 {
12111 case WLANTL_STATIC_TX_UC_FCNT:
12112 *buffer = statistics->txUCFcnt;
12113 break;
12114
12115 case WLANTL_STATIC_TX_MC_FCNT:
12116 *buffer = statistics->txMCFcnt;
12117 break;
12118
12119 case WLANTL_STATIC_TX_BC_FCNT:
12120 *buffer = statistics->txBCFcnt;
12121 break;
12122
12123 case WLANTL_STATIC_TX_UC_BCNT:
12124 *buffer = statistics->txUCBcnt;
12125 break;
12126
12127 case WLANTL_STATIC_TX_MC_BCNT:
12128 *buffer = statistics->txMCBcnt;
12129 break;
12130
12131 case WLANTL_STATIC_TX_BC_BCNT:
12132 *buffer = statistics->txBCBcnt;
12133 break;
12134
12135 case WLANTL_STATIC_RX_UC_FCNT:
12136 *buffer = statistics->rxUCFcnt;
12137 break;
12138
12139 case WLANTL_STATIC_RX_MC_FCNT:
12140 *buffer = statistics->rxMCFcnt;
12141 break;
12142
12143 case WLANTL_STATIC_RX_BC_FCNT:
12144 *buffer = statistics->rxBCFcnt;
12145 break;
12146
12147 case WLANTL_STATIC_RX_UC_BCNT:
12148 *buffer = statistics->rxUCBcnt;
12149 break;
12150
12151 case WLANTL_STATIC_RX_MC_BCNT:
12152 *buffer = statistics->rxMCBcnt;
12153 break;
12154
12155 case WLANTL_STATIC_RX_BC_BCNT:
12156 *buffer = statistics->rxBCBcnt;
12157 break;
12158
12159 case WLANTL_STATIC_RX_BCNT:
12160 *buffer = statistics->rxBcnt;
12161 break;
12162
12163 case WLANTL_STATIC_RX_BCNT_CRC_OK:
12164 *buffer = statistics->rxBcntCRCok;
12165 break;
12166
12167 case WLANTL_STATIC_RX_RATE:
12168 *buffer = statistics->rxRate;
12169 break;
12170
12171 default:
12172 *buffer = 0;
12173 status = VOS_STATUS_E_INVAL;
12174 break;
12175 }
12176
12177
12178 return status;
12179}
12180
12181/*==========================================================================
12182 FUNCTION WLANTL_ResetSpecStatistic
12183
12184 DESCRIPTION Reset specific field within statistics structure for
12185 identified station ID
12186 Reset means set as 0
12187
12188 DEPENDENCIES NONE
12189
12190 PARAMETERS in pAdapter - Global handle
12191 in statType - specific statistics field to reset
12192 in STAid - Station ID
12193
12194 RETURN VALUE VOS_STATUS
12195
12196 SIDE EFFECTS NONE
12197
12198============================================================================*/
12199VOS_STATUS WLANTL_ResetSpecStatistic
12200(
12201 v_PVOID_t pAdapter,
12202 WLANTL_TRANSFER_STATIC_TYPE statType,
12203 v_U8_t STAid
12204)
12205{
12206 WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012207 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -070012208 VOS_STATUS status = VOS_STATUS_SUCCESS;
12209 WLANTL_TRANSFER_STA_TYPE *statistics = NULL;
12210
12211 /*------------------------------------------------------------------------
12212 Sanity check
12213 Extract TL control block
12214 ------------------------------------------------------------------------*/
12215 if (NULL == pTLCb)
12216 {
12217 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12218 "WLAN TL:Invalid TL pointer on WLANTL_GetStatistics"));
12219 return VOS_STATUS_E_FAULT;
12220 }
12221
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012222 pClientSTA = pTLCb->atlSTAClients[STAid];
12223
12224 if ( NULL == pClientSTA )
12225 {
12226 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12227 "WLAN TL:Client Memory was not allocated on %s", __func__));
12228 return VOS_STATUS_E_FAILURE;
12229 }
12230
12231 if(0 == pClientSTA->ucExists)
Jeff Johnson295189b2012-06-20 16:38:30 -070012232 {
12233 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12234 "WLAN TL: %d STA ID does not exist", STAid));
12235 return VOS_STATUS_E_INVAL;
12236 }
12237
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012238 statistics = &pClientSTA->trafficStatistics;
Jeff Johnson295189b2012-06-20 16:38:30 -070012239 switch(statType)
12240 {
12241 case WLANTL_STATIC_TX_UC_FCNT:
12242 statistics->txUCFcnt = 0;
12243 break;
12244
12245 case WLANTL_STATIC_TX_MC_FCNT:
12246 statistics->txMCFcnt = 0;
12247 break;
12248
12249 case WLANTL_STATIC_TX_BC_FCNT:
12250 statistics->txBCFcnt = 0;
12251 break;
12252
12253 case WLANTL_STATIC_TX_UC_BCNT:
12254 statistics->txUCBcnt = 0;
12255 break;
12256
12257 case WLANTL_STATIC_TX_MC_BCNT:
12258 statistics->txMCBcnt = 0;
12259 break;
12260
12261 case WLANTL_STATIC_TX_BC_BCNT:
12262 statistics->txBCBcnt = 0;
12263 break;
12264
12265 case WLANTL_STATIC_RX_UC_FCNT:
12266 statistics->rxUCFcnt = 0;
12267 break;
12268
12269 case WLANTL_STATIC_RX_MC_FCNT:
12270 statistics->rxMCFcnt = 0;
12271 break;
12272
12273 case WLANTL_STATIC_RX_BC_FCNT:
12274 statistics->rxBCFcnt = 0;
12275 break;
12276
12277 case WLANTL_STATIC_RX_UC_BCNT:
12278 statistics->rxUCBcnt = 0;
12279 break;
12280
12281 case WLANTL_STATIC_RX_MC_BCNT:
12282 statistics->rxMCBcnt = 0;
12283 break;
12284
12285 case WLANTL_STATIC_RX_BC_BCNT:
12286 statistics->rxBCBcnt = 0;
12287 break;
12288
12289 case WLANTL_STATIC_RX_BCNT:
12290 statistics->rxBcnt = 0;
12291 break;
12292
12293 case WLANTL_STATIC_RX_BCNT_CRC_OK:
12294 statistics->rxBcntCRCok = 0;
12295 break;
12296
12297 case WLANTL_STATIC_RX_RATE:
12298 statistics->rxRate = 0;
12299 break;
12300
12301 default:
12302 status = VOS_STATUS_E_INVAL;
12303 break;
12304 }
12305
12306 return status;
12307}
12308
12309
12310/*==========================================================================
12311
12312 FUNCTION
12313
12314 DESCRIPTION Read RSSI value out of a RX BD
12315
12316 PARAMETERS: Caller must validate all parameters
12317
12318 RETURN VALUE
12319
12320============================================================================*/
12321VOS_STATUS WLANTL_ReadRSSI
12322(
12323 v_PVOID_t pAdapter,
12324 v_PVOID_t pBDHeader,
12325 v_U8_t STAid
12326)
12327{
12328 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
12329 v_S7_t currentRSSI, currentRSSI0, currentRSSI1;
12330
12331
12332 if(NULL == tlCtxt)
12333 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070012334 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "%s Invalid TL handle", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -070012335 return VOS_STATUS_E_INVAL;
12336 }
12337
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012338 if ( NULL == tlCtxt->atlSTAClients[STAid] )
12339 {
12340 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12341 "WLAN TL:Client Memory was not allocated on %s", __func__));
12342 return VOS_STATUS_E_FAILURE;
12343 }
12344
Jeff Johnson295189b2012-06-20 16:38:30 -070012345 currentRSSI0 = WLANTL_GETRSSI0(pBDHeader);
12346 currentRSSI1 = WLANTL_GETRSSI1(pBDHeader);
12347 currentRSSI = (currentRSSI0 > currentRSSI1) ? currentRSSI0 : currentRSSI1;
12348
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012349 tlCtxt->atlSTAClients[STAid]->rssiAvg = currentRSSI;
Jeff Johnson295189b2012-06-20 16:38:30 -070012350
12351 return VOS_STATUS_SUCCESS;
12352}
12353
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +053012354/*==========================================================================
12355
12356 FUNCTION
12357
12358 DESCRIPTION Read SNR value out of a RX BD
12359
12360 PARAMETERS: Caller must validate all parameters
12361
12362 RETURN VALUE
12363
12364============================================================================*/
12365VOS_STATUS WLANTL_ReadSNR
12366(
12367 v_PVOID_t pAdapter,
12368 v_PVOID_t pBDHeader,
12369 v_U8_t STAid
12370)
12371{
12372 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
12373 v_S7_t currentSNR;
12374
12375
12376 if (NULL == tlCtxt)
12377 {
12378 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12379 "%s Invalid TL handle", __func__));
12380 return VOS_STATUS_E_INVAL;
12381 }
12382
12383 if (NULL == tlCtxt->atlSTAClients[STAid])
12384 {
12385 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12386 "WLAN TL:Client Memory was not allocated on %s", __func__));
12387 return VOS_STATUS_E_FAILURE;
12388 }
12389
12390 currentSNR = WLANTL_GETSNR(pBDHeader);
12391
Madan Mohan Koyyalamudi43acf032013-09-27 04:33:28 +053012392 /* SNR reported in the Buffer Descriptor is scaled up by 2(SNR*2),
12393 * Get the correct SNR value
12394 */
12395 currentSNR = currentSNR >> 1;
12396
12397 /* SNR reported by HW cannot be more than 35dB due to HW limitations */
12398 currentSNR = (WLANTL_MAX_HW_SNR > currentSNR ? currentSNR :
12399 WLANTL_MAX_HW_SNR);
12400
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +053012401 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
12402 "%s: snrsum: %d snridx: %d prevsnravg: %d",
12403 __func__,
12404 tlCtxt->atlSTAClients[STAid]->snrSum,
12405 tlCtxt->atlSTAClients[STAid]->snrIdx,
12406 tlCtxt->atlSTAClients[STAid]->prevSnrAvg));
12407
12408 /* The SNR returned for all purposes is the average SNR over
12409 * WLANTL_MAX_SNR_DATA_SMAPLES.When data samples
12410 * > WLANTL_MAX_SNR_DATA_SAMPLES are obtained,
12411 * store the average of the samples in prevSnrAvg
12412 * and start a new averaging window. The prevSnrAvg is used when
12413 * enough data samples are not available when applications
12414 * actually query for SNR.
12415 *
12416 * SEE: WLANTL_GetSnr()
12417 */
12418 if (tlCtxt->atlSTAClients[STAid]->snrIdx >= WLANTL_MAX_SNR_DATA_SAMPLES)
12419 {
12420 tlCtxt->atlSTAClients[STAid]->prevSnrAvg =
12421 tlCtxt->atlSTAClients[STAid]->snrSum /
12422 tlCtxt->atlSTAClients[STAid]->snrIdx;
12423 tlCtxt->atlSTAClients[STAid]->snrSum = 0;
12424 tlCtxt->atlSTAClients[STAid]->snrIdx = 0;
12425 }
12426 tlCtxt->atlSTAClients[STAid]->snrSum += currentSNR;
12427 tlCtxt->atlSTAClients[STAid]->snrIdx += 1;
12428
12429 return VOS_STATUS_SUCCESS;
12430}
Jeff Johnson295189b2012-06-20 16:38:30 -070012431
12432/*
12433 DESCRIPTION
12434 TL returns the weight currently maintained in TL.
12435 IN
12436 pvosGCtx: pointer to the global vos context; a handle to TL's
12437 or SME's control block can be extracted from its context
12438
12439 OUT
12440 pACWeights: Caller allocated memory for filling in weights
12441
12442 RETURN VALUE VOS_STATUS
12443*/
12444VOS_STATUS
12445WLANTL_GetACWeights
12446(
12447 v_PVOID_t pvosGCtx,
12448 v_U8_t* pACWeights
12449)
12450{
12451 WLANTL_CbType* pTLCb = NULL;
12452 v_U8_t ucIndex;
12453 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
12454
12455 /*------------------------------------------------------------------------
12456 Sanity check
12457 ------------------------------------------------------------------------*/
12458 if ( NULL == pACWeights )
12459 {
12460 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12461 "WLAN TL:Invalid parameter sent on WLANTL_GetACWeights"));
12462 return VOS_STATUS_E_INVAL;
12463 }
12464
12465 /*------------------------------------------------------------------------
12466 Extract TL control block and check existance
12467 ------------------------------------------------------------------------*/
12468 pTLCb = VOS_GET_TL_CB(pvosGCtx);
12469 if ( NULL == pTLCb )
12470 {
12471 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12472 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetACWeights"));
12473 return VOS_STATUS_E_FAULT;
12474 }
12475 for ( ucIndex = 0; ucIndex < WLANTL_MAX_AC ; ucIndex++)
12476 {
12477 pACWeights[ucIndex] = pTLCb->tlConfigInfo.ucAcWeights[ucIndex];
12478 }
12479
12480 return VOS_STATUS_SUCCESS;
12481}
12482
12483
12484
12485/*
12486 DESCRIPTION
12487 Change the weight currently maintained by TL.
12488 IN
12489 pvosGCtx: pointer to the global vos context; a handle to TL's
12490 or SME's control block can be extracted from its context
12491 pACWeights: Caller allocated memory contain the weights to use
12492
12493
12494 RETURN VALUE VOS_STATUS
12495*/
12496VOS_STATUS
12497WLANTL_SetACWeights
12498(
12499 v_PVOID_t pvosGCtx,
12500 v_U8_t* pACWeights
12501)
12502{
12503 WLANTL_CbType* pTLCb = NULL;
12504 v_U8_t ucIndex;
12505 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
12506
12507 /*------------------------------------------------------------------------
12508 Sanity check
12509 ------------------------------------------------------------------------*/
12510 if ( NULL == pACWeights )
12511 {
12512 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12513 "WLAN TL:Invalid parameter sent on WLANTL_GetACWeights"));
12514 return VOS_STATUS_E_INVAL;
12515 }
12516
12517 /*------------------------------------------------------------------------
12518 Extract TL control block and check existance
12519 ------------------------------------------------------------------------*/
12520 pTLCb = VOS_GET_TL_CB(pvosGCtx);
12521 if ( NULL == pTLCb )
12522 {
12523 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12524 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetACWeights"));
12525 return VOS_STATUS_E_FAULT;
12526 }
12527 for ( ucIndex = 0; ucIndex < WLANTL_MAX_AC ; ucIndex++)
12528 {
12529 pTLCb->tlConfigInfo.ucAcWeights[ucIndex] = pACWeights[ucIndex];
12530 }
12531
12532 return VOS_STATUS_SUCCESS;
12533}
12534
12535
12536/*==========================================================================
12537
12538 FUNCTION
12539
12540 DESCRIPTION
12541
12542 PARAMETERS
12543
12544 RETURN VALUE
12545
12546============================================================================*/
12547void WLANTL_PowerStateChangedCB
12548(
12549 v_PVOID_t pAdapter,
12550 tPmcState newState
12551)
12552{
12553 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
12554
12555 if (NULL == tlCtxt)
12556 {
12557 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +053012558 "%s: Invalid TL Control Block", __func__ );
Jeff Johnson295189b2012-06-20 16:38:30 -070012559 return;
12560 }
12561
12562 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, "Power state changed, new state is %d", newState );
12563 switch(newState)
12564 {
12565 case FULL_POWER:
12566 tlCtxt->isBMPS = VOS_FALSE;
12567 break;
12568
12569 case BMPS:
12570#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
12571 WLANTL_SetFWRSSIThresholds(pAdapter);
12572#endif
12573
12574 tlCtxt->isBMPS = VOS_TRUE;
12575 break;
12576
12577 case IMPS:
12578 case LOW_POWER:
12579 case REQUEST_BMPS:
12580 case REQUEST_FULL_POWER:
12581 case REQUEST_IMPS:
12582 case STOPPED:
12583 case REQUEST_START_UAPSD:
12584 case REQUEST_STOP_UAPSD:
12585 case UAPSD:
12586 case REQUEST_STANDBY:
12587 case STANDBY:
12588 case REQUEST_ENTER_WOWL:
12589 case REQUEST_EXIT_WOWL:
12590 case WOWL:
12591 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, "Not handle this events %d", newState ));
12592 break;
12593
12594 default:
12595 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "Not a valid event %d", newState ));
12596 break;
12597 }
12598
12599 return;
12600}
12601/*==========================================================================
12602 FUNCTION WLANTL_GetEtherType
12603
12604 DESCRIPTION Extract Ether type information from the BD
12605
12606 DEPENDENCIES NONE
12607
12608 PARAMETERS in aucBDHeader - BD header
12609 in vosDataBuff - data buffer
12610 in ucMPDUHLen - MPDU header length
12611 out pUsEtherType - pointer to Ethertype
12612
12613 RETURN VALUE VOS_STATUS_SUCCESS : if the EtherType is successfully extracted
12614 VOS_STATUS_FAILURE : if the EtherType extraction failed and
12615 the packet was dropped
12616
12617 SIDE EFFECTS NONE
12618
12619============================================================================*/
12620static VOS_STATUS WLANTL_GetEtherType
12621(
12622 v_U8_t * aucBDHeader,
12623 vos_pkt_t * vosDataBuff,
12624 v_U8_t ucMPDUHLen,
12625 v_U16_t * pUsEtherType
12626)
12627{
12628 v_U8_t ucOffset;
12629 v_U16_t usEtherType = *pUsEtherType;
12630 v_SIZE_t usLLCSize = sizeof(usEtherType);
12631 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12632
12633 /*------------------------------------------------------------------------
12634 Check if LLC is present - if not, TL is unable to determine type
12635 ------------------------------------------------------------------------*/
12636 if ( VOS_FALSE == WDA_IS_RX_LLC_PRESENT( aucBDHeader ) )
12637 {
12638 ucOffset = WLANTL_802_3_HEADER_LEN - sizeof(usEtherType);
12639 }
12640 else
12641 {
12642 ucOffset = ucMPDUHLen + WLANTL_LLC_PROTO_TYPE_OFFSET;
12643 }
12644
12645 /*------------------------------------------------------------------------
12646 Extract LLC type
12647 ------------------------------------------------------------------------*/
12648 vosStatus = vos_pkt_extract_data( vosDataBuff, ucOffset,
12649 (v_PVOID_t)&usEtherType, &usLLCSize);
12650
12651 if (( VOS_STATUS_SUCCESS != vosStatus ) ||
12652 ( sizeof(usEtherType) != usLLCSize ))
12653
12654 {
12655 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12656 "WLAN TL:Error extracting Ether type from data packet"));
12657 /* Drop packet */
12658 vos_pkt_return_packet(vosDataBuff);
12659 vosStatus = VOS_STATUS_E_FAILURE;
12660 }
12661 else
12662 {
12663 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
12664 "WLAN TL:Ether type retrieved before endianess conv: %d",
12665 usEtherType));
12666
12667 usEtherType = vos_be16_to_cpu(usEtherType);
12668 *pUsEtherType = usEtherType;
12669
12670 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
12671 "WLAN TL:Ether type retrieved: %d", usEtherType));
12672 }
12673
12674 return vosStatus;
12675}
12676
Jeff Johnson295189b2012-06-20 16:38:30 -070012677/*==========================================================================
12678 FUNCTION WLANTL_GetSoftAPStatistics
12679
12680 DESCRIPTION Collect the cumulative statistics for all Softap stations
12681
12682 DEPENDENCIES NONE
12683
12684 PARAMETERS in pvosGCtx - Pointer to the global vos context
12685 bReset - If set TL statistics will be cleared after reading
12686 out statsSum - pointer to collected statistics
12687
12688 RETURN VALUE VOS_STATUS_SUCCESS : if the Statistics are successfully extracted
12689
12690 SIDE EFFECTS NONE
12691
12692============================================================================*/
12693VOS_STATUS WLANTL_GetSoftAPStatistics(v_PVOID_t pAdapter, WLANTL_TRANSFER_STA_TYPE *statsSum, v_BOOL_t bReset)
12694{
12695 v_U8_t i = 0;
12696 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12697 WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter);
12698 WLANTL_TRANSFER_STA_TYPE statBufferTemp;
12699 vos_mem_zero((v_VOID_t *)&statBufferTemp, sizeof(WLANTL_TRANSFER_STA_TYPE));
12700 vos_mem_zero((v_VOID_t *)statsSum, sizeof(WLANTL_TRANSFER_STA_TYPE));
12701
12702
12703 if ( NULL == pTLCb )
12704 {
12705 return VOS_STATUS_E_FAULT;
12706 }
12707
12708 // Sum up all the statistics for stations of Soft AP from TL
12709 for (i = 0; i < WLAN_MAX_STA_COUNT; i++)
12710 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012711 if ( NULL == pTLCb->atlSTAClients[i])
12712 {
12713 continue;
12714 }
12715 if (pTLCb->atlSTAClients[i]->wSTADesc.wSTAType == WLAN_STA_SOFTAP)
Jeff Johnson295189b2012-06-20 16:38:30 -070012716 {
12717 vosStatus = WLANTL_GetStatistics(pAdapter, &statBufferTemp, i);// Can include staId 1 because statistics not collected for it
12718
12719 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
12720 return VOS_STATUS_E_FAULT;
12721
12722 // Add to the counters
12723 statsSum->txUCFcnt += statBufferTemp.txUCFcnt;
12724 statsSum->txMCFcnt += statBufferTemp.txMCFcnt;
12725 statsSum->txBCFcnt += statBufferTemp.txBCFcnt;
12726 statsSum->txUCBcnt += statBufferTemp.txUCBcnt;
12727 statsSum->txMCBcnt += statBufferTemp.txMCBcnt;
12728 statsSum->txBCBcnt += statBufferTemp.txBCBcnt;
12729 statsSum->rxUCFcnt += statBufferTemp.rxUCFcnt;
12730 statsSum->rxMCFcnt += statBufferTemp.rxMCFcnt;
12731 statsSum->rxBCFcnt += statBufferTemp.rxBCFcnt;
12732 statsSum->rxUCBcnt += statBufferTemp.rxUCBcnt;
12733 statsSum->rxMCBcnt += statBufferTemp.rxMCBcnt;
12734 statsSum->rxBCBcnt += statBufferTemp.rxBCBcnt;
12735
12736 if (bReset)
12737 {
12738 vosStatus = WLANTL_ResetStatistics(pAdapter, i);
12739 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
12740 return VOS_STATUS_E_FAULT;
12741 }
12742 }
12743 }
12744
12745 return vosStatus;
12746}
Mohit Khanna698ba2a2012-12-04 15:08:18 -080012747#ifdef FEATURE_WLAN_TDLS_INTERNAL
12748/*==========================================================================
12749 FUNCTION WLANTL_GetEtherType_2
12750
12751 DESCRIPTION Extract Ether type information from the BD
12752
12753 DEPENDENCIES NONE
12754
12755 PARAMETERS in aucBDHeader - BD header
12756 in vosDataBuff - data buffer
12757 in ucMPDUHLen - MPDU header length
12758 out pUsEtherType - pointer to Ethertype
12759
12760 RETURN VALUE VOS_STATUS_SUCCESS : if the EtherType is successfully extracted
12761 VOS_STATUS_FAILURE : if the EtherType extraction failed and
12762 the packet was dropped
12763
12764 SIDE EFFECTS NONE
12765
12766============================================================================*/
12767static VOS_STATUS WLANTL_GetEtherType_2
12768(
12769 v_U8_t * aucBDHeader,
12770 vos_pkt_t * vosDataBuff,
12771 v_U8_t ucMPDUHLen,
12772 v_U16_t * pUsEtherType
12773)
12774{
12775 v_U8_t ucOffset;
12776 v_U16_t usEtherType = *pUsEtherType;
12777 v_SIZE_t usLLCSize = sizeof(usEtherType);
12778 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12779 //v_U8_t ucLLCHeader;
12780 v_U8_t ucMPDUHOffset ;
12781 /*------------------------------------------------------------------------
12782 Check if LLC is present - if not, TL is unable to determine type
12783 ------------------------------------------------------------------------*/
12784 //ucMPDUHOffset = (v_U8_t)WLANHAL_RX_BD_GET_MPDU_H_OFFSET(aucBDHeader) ;
12785 //ucLLCHeader = (v_U8_t)WLANHAL_RX_BD_GET_LLC(aucBDHeader);
12786 ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(aucBDHeader);
12787
12788 if ( VOS_TRUE == WDA_IS_RX_LLC_PRESENT(aucBDHeader) )
12789 {
12790 ucOffset = ucMPDUHOffset + WLANTL_802_3_HEADER_LEN - sizeof(usEtherType);
12791 }
12792 else
12793 {
12794 ucOffset = WLANHAL_RX_BD_HEADER_SIZE + ucMPDUHLen
12795 + WLANTL_LLC_PROTO_TYPE_OFFSET;
12796 }
12797
12798 /*------------------------------------------------------------------------
12799 Extract LLC type
12800 ------------------------------------------------------------------------*/
12801 vosStatus = vos_pkt_extract_data( vosDataBuff, ucOffset,
12802 (v_PVOID_t)&usEtherType, &usLLCSize);
12803
12804 /* TODO: Do it in better way */
12805 if(vos_be16_to_cpu(usEtherType) == 0x890d)
12806 {
12807 VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -080012808 ("TDLS frame llc %x"), vos_be16_to_cpu(usEtherType)) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080012809 }
12810
12811 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
12812 "WLAN TL:Ether type retrieved before endianess conv: %d",
12813 usEtherType);
12814
12815 usEtherType = vos_be16_to_cpu(usEtherType);
12816 *pUsEtherType = usEtherType;
12817
12818 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
12819 "WLAN TL:Ether type retrieved: %d", usEtherType);
12820
12821 return vosStatus;
12822}
12823#endif /* FEATURE_WLAN_TDLS */
12824
Jeff Johnson295189b2012-06-20 16:38:30 -070012825/*===============================================================================
12826 FUNCTION WLANTL_IsReplayPacket
12827
12828 DESCRIPTION This function does replay check for valid stations
12829
12830 DEPENDENCIES Validity of replay check must be done before the function
12831 is called
12832
12833 PARAMETERS currentReplayCounter current replay counter taken from RX BD
12834 previousReplayCounter previous replay counter taken from TL CB
12835
12836 RETRUN VOS_TRUE packet is a replay packet
12837 VOS_FALSE packet is not a replay packet
12838
12839 SIDE EFFECTS none
12840 ===============================================================================*/
12841v_BOOL_t
12842WLANTL_IsReplayPacket
12843(
12844 v_U64_t ullcurrentReplayCounter,
12845 v_U64_t ullpreviousReplayCounter
12846)
12847{
12848 /* Do the replay check by comparing previous received replay counter with
12849 current received replay counter*/
12850 if(ullpreviousReplayCounter < ullcurrentReplayCounter)
12851 {
12852 /* Valid packet not replay */
12853 return VOS_FALSE;
12854 }
12855 else
12856 {
12857
12858 /* Current packet number is less than or equal to previuos received
12859 packet no, this means current packet is replay packet */
12860 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12861 "WLAN TL: Replay packet found with replay counter :[0x%llX]",ullcurrentReplayCounter);
12862
12863 return VOS_TRUE;
12864 }
12865}
12866
12867#if 0
12868/*===============================================================================
12869 FUNCTION WLANTL_GetReplayCounterFromRxBD
12870
12871 DESCRIPTION This function extracts 48-bit replay packet number from RX BD
12872
12873 DEPENDENCIES Validity of replay check must be done before the function
12874 is called
12875
12876 PARAMETERS pucRxHeader pointer to RX BD header
12877
12878 RETRUN v_U64_t Packet number extarcted from RX BD
12879
12880 SIDE EFFECTS none
12881 ===============================================================================*/
12882v_U64_t
12883WLANTL_GetReplayCounterFromRxBD
12884(
12885 v_U8_t *pucRxBDHeader
12886)
12887{
12888/* 48-bit replay counter is created as follows
12889 from RX BD 6 byte PMI command:
12890 Addr : AES/TKIP
12891 0x38 : pn3/tsc3
12892 0x39 : pn2/tsc2
12893 0x3a : pn1/tsc1
12894 0x3b : pn0/tsc0
12895
12896 0x3c : pn5/tsc5
12897 0x3d : pn4/tsc4 */
12898
12899#ifdef ANI_BIG_BYTE_ENDIAN
12900 v_U64_t ullcurrentReplayCounter = 0;
12901 /* Getting 48-bit replay counter from the RX BD */
12902 ullcurrentReplayCounter = WLANHAL_RX_BD_GET_PMICMD_20TO23(pucRxBDHeader);
12903 ullcurrentReplayCounter <<= 16;
12904 ullcurrentReplayCounter |= (( WLANHAL_RX_BD_GET_PMICMD_24TO25(pucRxBDHeader) & 0xFFFF0000) >> 16);
12905 return ullcurrentReplayCounter;
12906#else
12907 v_U64_t ullcurrentReplayCounter = 0;
12908 /* Getting 48-bit replay counter from the RX BD */
12909 ullcurrentReplayCounter = (WLANHAL_RX_BD_GET_PMICMD_24TO25(pucRxBDHeader) & 0x0000FFFF);
12910 ullcurrentReplayCounter <<= 32;
12911 ullcurrentReplayCounter |= WLANHAL_RX_BD_GET_PMICMD_20TO23(pucRxBDHeader);
12912 return ullcurrentReplayCounter;
12913#endif
12914}
12915#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070012916
12917/*===============================================================================
12918 FUNCTION WLANTL_PostResNeeded
12919
12920 DESCRIPTION This function posts message to TL to reserve BD/PDU memory
12921
12922 DEPENDENCIES None
12923
12924 PARAMETERS pvosGCtx
12925
12926 RETURN None
12927
12928 SIDE EFFECTS none
12929 ===============================================================================*/
12930
12931void WLANTL_PostResNeeded(v_PVOID_t pvosGCtx)
12932{
12933 vos_msg_t vosMsg;
12934
12935 vosMsg.reserved = 0;
12936 vosMsg.bodyptr = NULL;
12937 vosMsg.type = WLANTL_TX_RES_NEEDED;
12938 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
12939 "WLAN TL: BD/PDU available interrupt received, Posting message to TL");
12940 if(!VOS_IS_STATUS_SUCCESS(vos_tx_mq_serialize( VOS_MQ_ID_TL, &vosMsg)))
12941 {
12942 VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070012943 " %s fails to post message", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -070012944 }
12945}
12946
12947/*===============================================================================
12948 FUNCTION WLANTL_UpdateRssiBmps
12949
12950 DESCRIPTION This function updates the TL's RSSI (in BMPS mode)
12951
12952 DEPENDENCIES None
12953
12954 PARAMETERS
12955
12956 pvosGCtx VOS context VOS Global context
12957 staId Station ID Station ID
12958 rssi RSSI (BMPS mode) RSSI in BMPS mode
12959
12960 RETURN None
12961
12962 SIDE EFFECTS none
12963 ===============================================================================*/
12964
12965void WLANTL_UpdateRssiBmps(v_PVOID_t pvosGCtx, v_U8_t staId, v_S7_t rssi)
12966{
12967 WLANTL_CbType* pTLCb = VOS_GET_TL_CB(pvosGCtx);
12968
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012969 if (NULL != pTLCb && NULL != pTLCb->atlSTAClients[staId])
Jeff Johnson295189b2012-06-20 16:38:30 -070012970 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012971 pTLCb->atlSTAClients[staId]->rssiAvgBmps = rssi;
Jeff Johnson295189b2012-06-20 16:38:30 -070012972 }
12973}
Gopichand Nakkala8a2b1442013-05-29 15:33:14 +053012974
12975/*===============================================================================
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +053012976 FUNCTION WLANTL_UpdateSnrBmps
12977
12978 DESCRIPTION This function updates the TL's SNR (in BMPS mode)
12979
12980 DEPENDENCIES None
12981
12982 PARAMETERS
12983
12984 pvosGCtx VOS context VOS Global context
12985 staId Station ID Station ID
12986 snr SNR (BMPS mode) SNR in BMPS mode
12987
12988 RETURN None
12989
12990 SIDE EFFECTS none
12991 ===============================================================================*/
12992
12993void WLANTL_UpdateSnrBmps(v_PVOID_t pvosGCtx, v_U8_t staId, v_S7_t snr)
12994{
12995 WLANTL_CbType* pTLCb = VOS_GET_TL_CB(pvosGCtx);
12996
12997 if (NULL != pTLCb && NULL != pTLCb->atlSTAClients[staId])
12998 {
12999 pTLCb->atlSTAClients[staId]->snrAvgBmps = snr;
13000 }
13001}
13002
13003/*===============================================================================
Gopichand Nakkala8a2b1442013-05-29 15:33:14 +053013004 FUNCTION WLANTL_UpdateLinkCapacity
13005
13006 DESCRIPTION This function updates the STA's Link Capacity in TL
13007
13008 DEPENDENCIES None
13009
13010 PARAMETERS
13011
13012 pvosGCtx VOS context VOS Global context
13013 staId Station ID Station ID
13014 linkCapacity linkCapacity Link Capacity
13015
13016 RETURN None
13017
13018 SIDE EFFECTS none
13019 ===============================================================================*/
13020
13021void WLANTL_UpdateLinkCapacity(v_PVOID_t pvosGCtx, v_U8_t staId, v_U32_t linkCapacity)
13022{
13023 WLANTL_CbType* pTLCb = VOS_GET_TL_CB(pvosGCtx);
13024
13025 if (NULL != pTLCb && NULL != pTLCb->atlSTAClients[staId])
13026 {
13027 pTLCb->atlSTAClients[staId]->linkCapacity = linkCapacity;
13028 }
13029}
13030
13031
13032/*===========================================================================
13033
13034 FUNCTION WLANTL_GetSTALinkCapacity
13035
13036 DESCRIPTION
13037
13038 Returns Link Capacity of a particular STA.
13039
13040 DEPENDENCIES
13041
13042 A station must have been registered before its state can be retrieved.
13043
13044
13045 PARAMETERS
13046
13047 IN
13048 pvosGCtx: pointer to the global vos context; a handle to TL's
13049 control block can be extracted from its context
13050 ucSTAId: identifier of the station
13051
13052 OUT
13053 plinkCapacity: the current link capacity the connection to
13054 the given station
13055
13056
13057 RETURN VALUE
13058
13059 The result code associated with performing the operation
13060
13061 VOS_STATUS_E_INVAL: Input parameters are invalid
13062 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
13063 TL cb is NULL ; access would cause a page fault
13064 VOS_STATUS_E_EXISTS: Station was not registered
13065 VOS_STATUS_SUCCESS: Everything is good :)
13066
13067 SIDE EFFECTS
13068
13069============================================================================*/
13070VOS_STATUS
13071WLANTL_GetSTALinkCapacity
13072(
13073 v_PVOID_t pvosGCtx,
13074 v_U8_t ucSTAId,
13075 v_U32_t *plinkCapacity
13076)
13077{
13078 WLANTL_CbType* pTLCb = NULL;
13079 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
13080
13081 /*------------------------------------------------------------------------
13082 Sanity check
13083 ------------------------------------------------------------------------*/
13084 if ( NULL == plinkCapacity )
13085 {
13086 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13087 FL("WLAN TL:Invalid parameter")));
13088 return VOS_STATUS_E_INVAL;
13089 }
13090
13091 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
13092 {
13093 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13094 FL("WLAN TL:Invalid station id")));
13095 return VOS_STATUS_E_FAULT;
13096 }
13097
13098 /*------------------------------------------------------------------------
13099 Extract TL control block and check existance
13100 ------------------------------------------------------------------------*/
13101 pTLCb = VOS_GET_TL_CB(pvosGCtx);
13102 if ( NULL == pTLCb )
13103 {
13104 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13105 FL("WLAN TL:Invalid TL pointer from pvosGCtx")));
13106 return VOS_STATUS_E_FAULT;
13107 }
13108
13109 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
13110 {
13111 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13112 FL("WLAN TL:Client Memory was not allocated")));
13113 return VOS_STATUS_E_FAILURE;
13114 }
13115
13116 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
13117 {
13118 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
13119 FL("WLAN TL:Station was not previously registered")));
13120 return VOS_STATUS_E_EXISTS;
13121 }
13122
13123 /*------------------------------------------------------------------------
13124 Get STA state
13125 ------------------------------------------------------------------------*/
13126 *plinkCapacity = pTLCb->atlSTAClients[ucSTAId]->linkCapacity;
13127
13128 return VOS_STATUS_SUCCESS;
13129}/* WLANTL_GetSTALinkCapacity */