blob: b74b1b6a7d774fb16266f7ae1922dcefeace93d5 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Abhishek Singh00b71972016-01-07 10:51:04 +05302 * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
Kiet Lam1ed83fc2014-02-19 01:15:45 -08003 *
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
Jeff Johnson295189b2012-06-20 16:38:30 -070048===========================================================================*/
49
50/*===========================================================================
51
52 EDIT HISTORY FOR FILE
53
54
55 This section contains comments describing changes made to the module.
56 Notice that changes are listed in reverse chronological order.
57
58
59 $Header$$DateTime$$Author$
60
61
62 when who what, where, why
63---------- --- --------------------------------------------------------
Abhishek Singh00b71972016-01-07 10:51:04 +0530642013-08-19 rajekuma Added RMC support
Jeff Johnson295189b2012-06-20 16:38:30 -0700652010-07-13 c_shinde Fixed an issue where WAPI rekeying was failing because
66 WAI frame sent out during rekeying had the protected bit
67 set to 1.
682010-05-06 rnair Changed name of variable from usLlcType to usEtherType
69 Changed function name from GetLLCType to GetEtherType
70 Fixed 802.3 to 802.11 frame translation issue where two
71 bytes of the LLC header was getting overwritten in the
72 non-Qos path
732010-05-06 rnair RxAuth path fix for modifying the header before ether
74 type is retreived (Detected while testing rekeying
75 in WAPI Volans)
762010-02-19 bad Fixed 802.11 to 802.3 ft issues with WAPI
772010-02-19 rnair WAPI: If frame is a WAI frame in TxConn and TxAuth, TL
78 does frame translation.
792010-02-01 rnair WAPI: Fixed a bug where the value of ucIsWapiSta was not
80 being set in the TL control block in the RegisterSTA func.
812010-01-08 lti Added TL Data Caching
822009-11-04 rnair WAPI: Moving common functionality to a seperate function
83 called WLANTL_GetLLCType
842009-10-15 rnair WAPI: Featurizing WAPI code
852009-10-09 rnair WAPI: Modifications to authenticated state handling of Rx data
862009-10-06 rnair Adding support for WAPI
872009-09-22 lti Add deregistration API for management client
882009-07-16 rnair Temporary fix to let TL fetch packets when multiple
89 peers exist in an IBSS
902009-06-10 lti Fix for checking TID value of meta info on TX - prevent
91 memory overwrite
92 Fix for properly checking the sta id for resuming trigger
93 frame generation
942009-05-14 lti Fix for sending out trigger frames
952009-05-15 lti Addr3 filtering
962009-04-13 lti Assert if packet larger then allowed
97 Drop packet that fails flatten
982009-04-02 lti Performance fixes for TL
992009-02-19 lti Added fix for LLC management on Rx Connect
1002009-01-16 lti Replaced peek data with extract data for non BD opertions
101 Extracted frame control in Tl and pass to HAL for frame
102 type evaluation
1032009-02-02 sch Add handoff support
1042008-12-09 lti Fixes for AMSS compilation
105 Removed assert on receive when there is no station
1062008-12-02 lti Fix fo trigger frame generation
1072008-10-31 lti Fix fo TL tx suspend
1082008-10-01 lti Merged in fixes from reordering
109 Disabled part of UAPSD functionality in TL
110 (will be re-enabled once UAPSD is tested)
111 Fix for UAPSD multiple enable
1122008-08-10 lti Fixes following UAPSD testing
113 Fixed infinite loop on mask computation when STA no reg
1142008-08-06 lti Fixes after QOS unit testing
1152008-08-06 lti Added QOS support
1162008-07-23 lti Fix for vos packet draining
1172008-07-17 lti Fix for data type value
118 Added frame translation code in TL
119 Avoid returning failure to PE in case previous frame is
120 still pending; fail previous and cache new one for tx
121 Get frames returning boolean true if more frames are pending
1222008-07-03 lti Fixes following pre-integration testing
1232008-06-26 lti Fixes following unit testing
124 Added alloc and free for TL context
125 Using atomic set u8 instead of u32
1262008-05-16 lti Created module
127
128===========================================================================*/
129
130/*----------------------------------------------------------------------------
131 * Include Files
132 * -------------------------------------------------------------------------*/
133#include "wlan_qct_tl.h"
134#include "wlan_qct_wda.h"
135#include "wlan_qct_tli.h"
136#include "wlan_qct_tli_ba.h"
137#include "wlan_qct_tl_hosupport.h"
Katya Nigam42e16e82014-02-04 16:28:55 +0530138#include "vos_types.h"
139#include "vos_trace.h"
140#include "wlan_qct_tl_trace.h"
Jeff Johnson295189b2012-06-20 16:38:30 -0700141#include "tlDebug.h"
Hanumantha Reddy Pothulaee001fc2015-05-26 15:21:53 +0530142#include "cfgApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -0700143#ifdef FEATURE_WLAN_WAPI
144/*Included to access WDI_RxBdType */
145#include "wlan_qct_wdi_bd.h"
146#endif
147/*Enables debugging behavior in TL*/
148#define TL_DEBUG
Hoonki Lee14621352013-04-16 17:51:19 -0700149/*Enables debugging FC control frame in TL*/
150//#define TL_DEBUG_FC
Jeff Johnson295189b2012-06-20 16:38:30 -0700151//#define WLAN_SOFTAP_FLOWCTRL_EN
Jeff Johnson295189b2012-06-20 16:38:30 -0700152//#define BTAMP_TEST
Hoonki Lee14621352013-04-16 17:51:19 -0700153#ifdef TL_DEBUG_FC
154#include <wlan_qct_pal_status.h>
155#include <wlan_qct_pal_device.h> // wpalReadRegister
156#endif
157
Jeff Johnson295189b2012-06-20 16:38:30 -0700158/*----------------------------------------------------------------------------
159 * Preprocessor Definitions and Constants
160 * -------------------------------------------------------------------------*/
161/*LLC header value*/
162static v_U8_t WLANTL_LLC_HEADER[] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00 };
163
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800164#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700165/*Aironet SNAP header value*/
166static v_U8_t WLANTL_AIRONET_SNAP_HEADER[] = {0xAA, 0xAA, 0x03, 0x00, 0x40, 0x96, 0x00, 0x00 };
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800167#endif //FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700168
169/*BT-AMP packet LLC OUI value*/
170const v_U8_t WLANTL_BT_AMP_OUI[] = {0x00, 0x19, 0x58 };
171
Dino Mycle3b9536d2014-07-09 22:05:24 +0530172#ifdef WLAN_FEATURE_LINK_LAYER_STATS
173extern const v_U8_t WLANTL_TID_2_AC[WLAN_MAX_TID];
174
175#endif
176
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +0530177#define WLANTL_MAX_SNR_DATA_SAMPLES 20
Jeff Johnson295189b2012-06-20 16:38:30 -0700178
179#ifdef VOLANS_PERF
180#define WLANTL_BD_PDU_INTERRUPT_ENABLE_THRESHOLD 120
181#define WLANTL_BD_PDU_INTERRUPT_GET_THRESHOLD 120
182
183/* TL BD/PDU threshold to enable interrupt */
184int bdPduInterruptEnableThreshold = WLANTL_BD_PDU_INTERRUPT_ENABLE_THRESHOLD;
185int bdPduInterruptGetThreshold = WLANTL_BD_PDU_INTERRUPT_GET_THRESHOLD;
186#endif /* VOLANS_PERF */
187
188/*-----------------------------------*
189 | Type(2b) | Sub-type(4b) |
190 *-----------------------------------*/
191#define WLANTL_IS_DATA_FRAME(_type_sub) \
192 ( WLANTL_DATA_FRAME_TYPE == ( (_type_sub) & 0x30 ))
193
194#define WLANTL_IS_QOS_DATA_FRAME(_type_sub) \
195 (( WLANTL_DATA_FRAME_TYPE == ( (_type_sub) & 0x30 )) && \
196 ( WLANTL_80211_DATA_QOS_SUBTYPE == ( (_type_sub) & 0xF )))
197
198#define WLANTL_IS_MGMT_FRAME(_type_sub) \
199 ( WLANTL_MGMT_FRAME_TYPE == ( (_type_sub) & 0x30 ))
200
Dino Mycle3b9536d2014-07-09 22:05:24 +0530201#define WLANTL_IS_MGMT_ACTION_FRAME(_type_sub) \
202 (( WLANTL_MGMT_FRAME_TYPE == ( (_type_sub) & 0x30 )) && \
203 ( ( WLANTL_80211_MGMT_ACTION_SUBTYPE == ( (_type_sub) & 0xF )) || \
204 ( WLANTL_80211_MGMT_ACTION_NO_ACK_SUBTYPE == ( (_type_sub) & 0xF ))))
205
Siddharth Bhal4551b102014-10-09 21:36:36 +0530206#define WLANTL_IS_PROBE_REQ(_type_sub) \
207 ( WLANTL_MGMT_PROBE_REQ_FRAME_TYPE == ( (_type_sub) & 0x3F ))
208
Jeff Johnson295189b2012-06-20 16:38:30 -0700209#define WLANTL_IS_CTRL_FRAME(_type_sub) \
210 ( WLANTL_CTRL_FRAME_TYPE == ( (_type_sub) & 0x30 ))
211
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800212#ifdef FEATURE_WLAN_TDLS
213#define WLANTL_IS_TDLS_FRAME(_eth_type) \
214 ( WLANTL_LLC_TDLS_TYPE == ( _eth_type))
215#endif
216
Jeff Johnson295189b2012-06-20 16:38:30 -0700217/*MAX Allowed len processed by TL - MAx MTU + 802.3 header + BD+DXE+XTL*/
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -0800218#define WLANTL_MAX_ALLOWED_LEN (1514 + 100)
Jeff Johnson295189b2012-06-20 16:38:30 -0700219
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +0530220#define WLANTL_DATA_FLOW_MASK 0x0F
Jeff Johnson295189b2012-06-20 16:38:30 -0700221
Jeff Johnson295189b2012-06-20 16:38:30 -0700222//some flow_control define
223//LWM mode will be enabled for this station if the egress/ingress falls below this ratio
224#define WLANTL_LWM_EGRESS_INGRESS_THRESHOLD (0.75)
225
226//Get enough sample to do the LWM related calculation
227#define WLANTL_LWM_INGRESS_SAMPLE_THRESHOLD (64)
228
229//Maximal on-fly packet per station in LWM mode
230#define WLANTL_STA_BMU_THRESHOLD_MAX (256)
231
232#define WLANTL_AC_MASK (0x7)
Gopichand Nakkala976e3252013-01-03 15:45:56 -0800233#define WLANTL_STAID_OFFSET (0x6)
Jeff Johnson295189b2012-06-20 16:38:30 -0700234
235/* UINT32 type endian swap */
236#define SWAP_ENDIAN_UINT32(a) ((a) = ((a) >> 0x18 ) |(((a) & 0xFF0000) >> 0x08) | \
237 (((a) & 0xFF00) << 0x08) | (((a) & 0xFF) << 0x18))
238
Madan Mohan Koyyalamudi43acf032013-09-27 04:33:28 +0530239/* Maximum value of SNR that can be calculated by the HW */
240#define WLANTL_MAX_HW_SNR 35
Jeff Johnson295189b2012-06-20 16:38:30 -0700241
Hanumantha Reddy Pothulae5ab23d2015-09-14 18:08:24 +0530242#define DISABLE_ARP_TOGGLE 0
243#define ENABLE_ARP_TOGGLE 1
244#define SEND_ARP_ON_WQ5 2
245
Jeff Johnson295189b2012-06-20 16:38:30 -0700246/*----------------------------------------------------------------------------
247 * Type Declarations
248 * -------------------------------------------------------------------------*/
249#define TL_LITTLE_BIT_ENDIAN
250
251typedef struct
252{
253
Jeff Johnson295189b2012-06-20 16:38:30 -0700254
255 v_U8_t protVer :2;
256 v_U8_t type :2;
257 v_U8_t subType :4;
258
259 v_U8_t toDS :1;
260 v_U8_t fromDS :1;
261 v_U8_t moreFrag :1;
262 v_U8_t retry :1;
263 v_U8_t powerMgmt :1;
264 v_U8_t moreData :1;
265 v_U8_t wep :1;
266 v_U8_t order :1;
267
Jeff Johnson295189b2012-06-20 16:38:30 -0700268
269} WLANTL_MACFCType;
270
271/* 802.11 header */
272typedef struct
273{
274 /* Frame control field */
275 WLANTL_MACFCType wFrmCtrl;
276
277 /* Duration ID */
278 v_U16_t usDurationId;
279
280 /* Address 1 field */
281 v_U8_t vA1[VOS_MAC_ADDR_SIZE];
282
283 /* Address 2 field */
284 v_U8_t vA2[VOS_MAC_ADDR_SIZE];
285
286 /* Address 3 field */
287 v_U8_t vA3[VOS_MAC_ADDR_SIZE];
288
289 /* Sequence control field */
290 v_U16_t usSeqCtrl;
291
292 // Find the size of the mandatory header size.
293#define WLAN80211_MANDATORY_HEADER_SIZE \
294 (sizeof(WLANTL_MACFCType) + sizeof(v_U16_t) + \
295 (3 * (sizeof(v_U8_t) * VOS_MAC_ADDR_SIZE)) + \
296 sizeof(v_U16_t))
297
298 /* Optional A4 address */
299 v_U8_t optvA4[VOS_MAC_ADDR_SIZE];
300
301 /* Optional QOS control field */
302 v_U16_t usQosCtrl;
303}WLANTL_80211HeaderType;
304
305/* 802.3 header */
306typedef struct
307{
308 /* Destination address field */
309 v_U8_t vDA[VOS_MAC_ADDR_SIZE];
310
311 /* Source address field */
312 v_U8_t vSA[VOS_MAC_ADDR_SIZE];
313
314 /* Length field */
315 v_U16_t usLenType;
316}WLANTL_8023HeaderType;
317
318/*----------------------------------------------------------------------------
319 * Global Data Definitions
320 * -------------------------------------------------------------------------*/
321#define WLAN_TL_INVALID_U_SIG 255
322#define WLAN_TL_INVALID_B_SIG 255
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530323#define ENTER() VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, "Enter:%s", __func__)
324
Jeff Johnson295189b2012-06-20 16:38:30 -0700325#define WLAN_TL_AC_ARRAY_2_MASK( _pSTA, _ucACMask, i ) \
326 do\
327 {\
328 _ucACMask = 0; \
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +0530329 for ( i = 0; i < WLANTL_NUM_TX_QUEUES; i++ ) \
Jeff Johnson295189b2012-06-20 16:38:30 -0700330 { \
331 if ( 0 != (_pSTA)->aucACMask[i] ) \
332 { \
333 _ucACMask |= ( 1 << i ); \
334 } \
335 } \
336 } while (0);
337
Kapil Guptad90b3862016-06-25 00:42:49 +0530338
339/* Following is the copy of g11bRateInfo to understand rate index at TL */
340#define WLANTL_MAX_RATE_NUM 137
341typedef struct
342{
343 uint32 phyRate; //unit in Mega bits per sec X 10
344 uint32 tputRate; //unit in Mega bits per sec X 10
345 uint32 tputBpms; //unit in Bytes per msec = (tputRateX1024x1024)/(8x10X1000) ~= (tputRate*13)
346 uint32 tputBpus; //unit in Bytes per usec: round off to integral value
347}WLANTL_RateInfo;
348
349WLANTL_RateInfo gTLRateInfo[WLANTL_MAX_RATE_NUM] = {
350 //11b rates
351 { 10, 9, 117, 0}, //index 0
352 { 20, 17, 221, 0}, //index 1
353 { 55, 41, 533, 0}, //index 2
354 { 110, 68, 884, 0}, //index 3
355
356 //11b short preamble
357 { 10, 10, 130, 0}, //index 4
358 { 20, 18, 234, 0}, //index 5
359 { 55, 44, 572, 0}, //index 6
360 { 110, 77, 1001, 0}, //index 7
361
362 //11ag
363 { 60, 50, 650, 1}, //index 8
364 { 90, 70, 910, 1}, //index 9
365 { 120, 100, 1300, 1}, //index 10
366 { 180, 150, 1950, 2}, //index 11
367 { 240, 190, 2470, 2}, //index 12
368 { 360, 280, 3640, 4}, //index 13
369 { 480, 350, 4550, 5}, //index 14
370 { 540, 380, 4940, 6}, //index 15
371
372 //11n SIMO
373 { 65, 54, 702, 1}, //index 16
374 { 130, 108, 1404, 1}, //index 17
375 { 195, 161, 2093, 2}, //index 18
376 { 260, 217, 2821, 3}, //index 19
377 { 390, 326, 4238, 4}, //index 20
378 { 520, 435, 5655, 6}, //index 21
379 { 585, 492, 6396, 6}, //index 22
380 { 650, 548, 7124, 7}, //index 23
381
382 //11n SIMO SGI
383 { 72, 59, 767, 1}, //index 24
384 { 144, 118, 1534, 2}, //index 25
385 { 217, 180, 2340, 2}, //index 26
386 { 289, 243, 3159, 3}, //index 27
387 { 434, 363, 4719, 5}, //index 28
388 { 578, 486, 6318, 6}, //index 29
389 { 650, 548, 7124, 7}, //index 30
390 { 722, 606, 7878, 8}, //index 31
391
392 //11n GF SIMO
393 { 65, 54, 702, 1}, //index 32
394 { 130, 108, 1404, 1}, //index 33
395 { 195, 161, 2093, 2}, //index 34
396 { 260, 217, 2821, 3}, //index 35
397 { 390, 326, 4238, 4}, //index 36
398 { 520, 435, 5655, 6}, //index 37
399 { 585, 492, 6396, 6}, //index 38
400 { 650, 548, 7124, 7}, //index 39
401
402 //11n SIMO CB MCS 0 - 7
403 { 135, 110, 1430, 1}, //index 40
404 { 270, 223, 2899, 3}, //index 41
405 { 405, 337, 4381, 4}, //index 42
406 { 540, 454, 5902, 6}, //index 43
407 { 810, 679, 8827, 9}, //index 44
408 { 1080, 909, 11817, 12}, //index 45
409 { 1215, 1022, 13286, 13}, //index 46
410 { 1350, 1137, 14781, 15}, //index 47
411
412 //11n SIMO CB SGI MCS 0 - 7
413 { 150, 121, 1573, 2}, //index 48
414 { 300, 249, 3237, 3}, //index 49
415 { 450, 378, 4914, 5}, //index 50
416 { 600, 503, 6539, 7}, //index 51
417 { 900, 758, 9854, 10}, //index 52
418 { 1200, 1010, 13130, 13}, //index 53
419 { 1350, 1137, 14781, 15}, //index 54
420 { 1500, 1262, 16406, 16}, //index 55
421
422 //11n SIMO GF CB MCS 0 - 7
423 { 135, 110, 1430, 1}, //index 56
424 { 270, 223, 2899, 3}, //index 57
425 { 405, 337, 4381, 4}, //index 58
426 { 540, 454, 5902, 6}, //index 59
427 { 810, 679, 8827, 9}, //index 60
428 { 1080, 909, 11817, 12}, //index 61
429 { 1215, 1022, 13286, 13}, //index 62
430 { 1350, 1137, 14781, 15}, //index 63
431
432 //11AC
433 { 1350, 675, 8775, 9}, //reserved 64
434 { 1350, 675, 8775, 9}, //reserved 65
435 { 65, 45, 585, 1}, //index 66
436 { 130, 91, 1183, 1}, //index 67
437 { 195, 136, 1768, 2}, //index 68
438 { 260, 182, 2366, 2}, //index 69
439 { 390, 273, 3549, 4}, //index 70
440 { 520, 364, 4732, 5}, //index 71
441 { 585, 409, 5317, 5}, //index 72
442 { 650, 455, 5915, 6}, //index 73
443 { 780, 546, 7098, 7}, //index 74
444 { 1350, 675, 8775, 9}, //reserved 75
445 { 1350, 675, 8775, 9}, //reserved 76
446 { 1350, 675, 8775, 9}, //reserved 77
447 { 1350, 675, 8775, 9}, //index 78
448 { 1350, 675, 8775, 9}, //index 79
449 { 1350, 675, 8775, 9}, //index 80
450 { 1350, 675, 8775, 9}, //index 81
451 { 1350, 675, 8775, 9}, //index 82
452 { 1350, 675, 8775, 9}, //index 83
453 { 655, 458, 5954, 6}, //index 84
454 { 722, 505, 6565, 7}, //index 85
455 { 866, 606, 7878, 8}, //index 86
456 { 1350, 675, 8775, 9}, //reserved 87
457 { 1350, 675, 8775, 9}, //reserved 88
458 { 1350, 675, 8775, 9}, //reserved 89
459 { 135, 94, 1222, 1}, //index 90
460 { 270, 189, 2457, 2}, //index 91
461 { 405, 283, 3679, 4}, //index 92
462 { 540, 378, 4914, 5}, //index 93
463 { 810, 567, 7371, 7}, //index 94
464 { 1080, 756, 9828, 10}, //index 95
465 { 1215, 850, 11050, 11}, //index 96
466 { 1350, 675, 8775, 9}, //index 97
467 { 1350, 675, 8775, 9}, //index 98
468 { 1620, 810, 10530, 11}, //index 99
469 { 1800, 900, 11700, 12}, //index 100
470 { 1350, 675, 8775, 9}, //reserved 101
471 { 1350, 675, 8775, 9}, //index 102
472 { 1350, 675, 8775, 9}, //index 103
473 { 1350, 675, 8775, 9}, //index 104
474 { 1350, 675, 8775, 9}, //index 105
475 { 1350, 675, 8775, 9}, //index 106
476 { 1200, 840, 10920, 11}, //index 107
477 { 1350, 675, 8775, 9}, //index 108
478 { 1500, 750, 9750, 10}, //index 109
479 { 1350, 675, 8775, 9}, //index 110
480 { 1800, 900, 11700, 12}, //index 111
481 { 2000, 1000, 13000, 13}, //index 112
482 { 1350, 675, 8775, 9}, //index 113
483 { 292, 204, 2652, 3}, //index 114
484 { 585, 409, 5317, 5}, //index 115
485 { 877, 613, 7969, 8}, //index 116
486 { 1170, 819, 10647, 11}, //index 117
487 { 1755, 877, 11401, 11}, //index 118
488 { 2340, 1170, 15210, 15}, //index 119
489 { 2632, 1316, 17108, 17}, //index 120
490 { 2925, 1462, 19006, 19}, //index 121
491 { 1350, 675, 8775, 9}, //index 122
492 { 3510, 1755, 22815, 23}, //index 123
493 { 3900, 1950, 25350, 25}, //index 124
494 { 1350, 675, 8775, 9}, //reserved 125
495 { 1350, 675, 8775, 9}, //index 126
496 { 1350, 675, 8775, 9}, //index 127
497 { 1350, 675, 8775, 9}, //index 128
498 { 1350, 675, 8775, 9}, //index 129
499 { 1350, 675, 8775, 9}, //index 130
500 { 1350, 675, 8775, 9}, //index 131
501 { 2925, 1462, 19006, 19}, //index 132
502 { 3250, 1625, 21125, 21}, //index 133
503 { 1350, 675, 8775, 9}, //index 134
504 { 3900, 1950, 25350, 25}, //index 135
505 { 4333, 2166, 28158, 28} //index 136
506 };
507
508
509
Jeff Johnson295189b2012-06-20 16:38:30 -0700510/*----------------------------------------------------------------------------
511 * Static Variable Definitions
512 * -------------------------------------------------------------------------*/
513
514/*----------------------------------------------------------------------------
515 * Static Function Declarations and Definitions
516 * -------------------------------------------------------------------------*/
517
518static VOS_STATUS
519WLANTL_GetEtherType
520(
521 v_U8_t * aucBDHeader,
522 vos_pkt_t * vosDataBuff,
523 v_U8_t ucMPDUHLen,
524 v_U16_t * usEtherType
525);
526
Jeff Johnson295189b2012-06-20 16:38:30 -0700527
528/*----------------------------------------------------------------------------
529 * Externalized Function Definitions
530* -------------------------------------------------------------------------*/
531
532/*----------------------------------------------------------------------------
533 * Function Declarations and Documentation
534 * -------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530535/*==========================================================================
536
537 FUNCTION WLANTL_FreeClientMemory
538
539 DESCRIPTION
540 It frees up the memory allocated to all the STA clients in TLCB block
541 Can be called inside Close, Stop or when some FAULT occurs
542
543 DEPENDENCIES
544
545 PARAMETERS
546
547 IN
548 pClientSTA: Pointer to the global client pointer array
549
550 RETURN VALUE
551
552 SIDE EFFECTS
553
554============================================================================*/
555void WLANTL_FreeClientMemory
556(WLANTL_STAClientType* pClientSTA[WLAN_MAX_STA_COUNT])
557{
558 v_U32_t i = 0;
559 for(i =0; i < WLAN_MAX_STA_COUNT; i++)
560 {
561 if( NULL != pClientSTA[i] )
562 {
563 vos_mem_free(pClientSTA[i]);
564 }
565 pClientSTA[i] = NULL;
566 }
567 return;
568}
Jeff Johnson295189b2012-06-20 16:38:30 -0700569
570/*==========================================================================
571
572 FUNCTION WLANTL_Open
573
574 DESCRIPTION
575 Called by HDD at driver initialization. TL will initialize all its
576 internal resources and will wait for the call to start to register
577 with the other modules.
578
579 DEPENDENCIES
580
581 PARAMETERS
582
583 IN
584 pvosGCtx: pointer to the global vos context; a handle to TL's
585 control block can be extracted from its context
586 pTLConfig: TL Configuration
587
588 RETURN VALUE
589 The result code associated with performing the operation
590
591 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a page
592 fault
593 VOS_STATUS_SUCCESS: Everything is good :)
594
595 SIDE EFFECTS
596
597============================================================================*/
598VOS_STATUS
599WLANTL_Open
600(
601 v_PVOID_t pvosGCtx,
602 WLANTL_ConfigInfoType* pTLConfig
603)
604{
605 WLANTL_CbType* pTLCb = NULL;
606 v_U8_t ucIndex;
607 tHalHandle smeContext;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530608 v_U32_t i = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700609#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
610 VOS_STATUS status = VOS_STATUS_SUCCESS;
611#endif
612 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
613
614 /*------------------------------------------------------------------------
615 Sanity check
616 Extract TL control block
617 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530618 ENTER();
Jeff Johnson295189b2012-06-20 16:38:30 -0700619 vos_alloc_context( pvosGCtx, VOS_MODULE_ID_TL,
620 (void*)&pTLCb, sizeof(WLANTL_CbType));
621
622 pTLCb = VOS_GET_TL_CB(pvosGCtx);
623 if (( NULL == pTLCb ) || ( NULL == pTLConfig ) )
624 {
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -0700625 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +0530626 "WLAN TL: Invalid input pointer on WLANTL_Open TL %p Config %p", pTLCb, pTLConfig ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700627 return VOS_STATUS_E_FAULT;
628 }
629
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -0700630 /* Set the default log level to VOS_TRACE_LEVEL_ERROR */
631 vos_trace_setLevel(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR);
632
Jeff Johnson295189b2012-06-20 16:38:30 -0700633 smeContext = vos_get_context(VOS_MODULE_ID_SME, pvosGCtx);
634 if ( NULL == smeContext )
635 {
636 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700637 "%s: Invalid smeContext", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -0700638 return VOS_STATUS_E_FAULT;
639 }
640
641 /* Zero out the memory so we are OK, when CleanCB is called.*/
642 vos_mem_zero((v_VOID_t *)pTLCb, sizeof(WLANTL_CbType));
643
644 /*------------------------------------------------------------------------
645 Clean up TL control block, initialize all values
646 ------------------------------------------------------------------------*/
647 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
648 "WLAN TL:WLANTL_Open"));
649
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530650 for ( i =0; i<WLAN_MAX_STA_COUNT; i++ )
Jeff Johnson295189b2012-06-20 16:38:30 -0700651 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530652 if ( i < WLAN_NON32_STA_COUNT )
653 {
654 pTLCb->atlSTAClients[i] = vos_mem_malloc(sizeof(WLANTL_STAClientType));
655 /* Allocating memory for LEGACY STA COUNT so as to avoid regression issues. */
656 if ( NULL == pTLCb->atlSTAClients[i] )
657 {
658 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "WLAN TL: StaClient allocation failed"));
659 WLANTL_FreeClientMemory(pTLCb->atlSTAClients);
660 vos_free_context(pvosGCtx, VOS_MODULE_ID_TL, pTLCb);
661 return VOS_STATUS_E_FAULT;
662 }
663 vos_mem_zero((v_VOID_t *) pTLCb->atlSTAClients[i], sizeof(WLANTL_STAClientType));
664 }
665 else
666 {
667 pTLCb->atlSTAClients[i] = NULL;
668 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700669 }
670
Sushant Kaushikf4a27972015-04-16 16:48:00 +0530671 pTLCb->reorderBufferPool = vos_mem_vmalloc(sizeof(WLANTL_REORDER_BUFFER_T) * WLANTL_MAX_BA_SESSION);
Jeff Johnson295189b2012-06-20 16:38:30 -0700672 if (NULL == pTLCb->reorderBufferPool)
673 {
Arif Hussainf2b00992013-11-17 21:46:15 -0800674 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 +0530675 WLANTL_FreeClientMemory(pTLCb->atlSTAClients);
Jeff Johnson295189b2012-06-20 16:38:30 -0700676 vos_free_context(pvosGCtx, VOS_MODULE_ID_TL, pTLCb);
677 return VOS_STATUS_E_FAULT;
Jeff Johnson295189b2012-06-20 16:38:30 -0700678 }
679
680 vos_mem_zero((v_VOID_t *)pTLCb->reorderBufferPool, sizeof(WLANTL_REORDER_BUFFER_T) * WLANTL_MAX_BA_SESSION);
681
682 WLANTL_CleanCB(pTLCb, 0 /*do not empty*/);
683
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +0530684 for ( ucIndex = 0; ucIndex < WLANTL_NUM_TX_QUEUES ; ucIndex++)
Jeff Johnson295189b2012-06-20 16:38:30 -0700685 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530686 pTLCb->tlConfigInfo.ucAcWeights[ucIndex] = pTLConfig->ucAcWeights[ucIndex];
Jeff Johnson295189b2012-06-20 16:38:30 -0700687 }
688
Dhanashri Atred8c20a32014-01-03 17:20:55 -0800689 for ( ucIndex = 0; ucIndex < WLANTL_MAX_AC ; ucIndex++)
690 {
691 pTLCb->tlConfigInfo.ucReorderAgingTime[ucIndex] = pTLConfig->ucReorderAgingTime[ucIndex];
692 }
693
Jeff Johnson295189b2012-06-20 16:38:30 -0700694 // scheduling init to be the last one of previous round
695 pTLCb->uCurServedAC = WLANTL_AC_BK;
696 pTLCb->ucCurLeftWeight = 1;
697 pTLCb->ucCurrentSTA = WLAN_MAX_STA_COUNT-1;
698
699#if 0
700 //flow control field init
701 vos_mem_zero(&pTLCb->tlFCInfo, sizeof(tFcTxParams_type));
702 //bit 0: set (Bd/pdu count) bit 1: set (request station PS change notification)
703 pTLCb->tlFCInfo.fcConfig = 0x1;
704#endif
705
706 pTLCb->vosTxFCBuf = NULL;
707 pTLCb->tlConfigInfo.uMinFramesProcThres =
708 pTLConfig->uMinFramesProcThres;
Jeff Johnson295189b2012-06-20 16:38:30 -0700709
Sunil Ravid5406f22013-01-22 00:18:31 -0800710#ifdef FEATURE_WLAN_TDLS
711 pTLCb->ucTdlsPeerCount = 0;
712#endif
713
Jeff Johnson295189b2012-06-20 16:38:30 -0700714 pTLCb->tlConfigInfo.uDelayedTriggerFrmInt =
715 pTLConfig->uDelayedTriggerFrmInt;
716
717 /*------------------------------------------------------------------------
718 Allocate internal resources
719 ------------------------------------------------------------------------*/
720 vos_pkt_get_packet(&pTLCb->vosDummyBuf, VOS_PKT_TYPE_RX_RAW, 1, 1,
721 1/*true*/,NULL, NULL);
722
723 WLANTL_InitBAReorderBuffer(pvosGCtx);
724#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
725 /* Initialize Handoff support modue
726 * RSSI measure and Traffic state monitoring */
727 status = WLANTL_HSInit(pvosGCtx);
728 if(!VOS_IS_STATUS_SUCCESS(status))
729 {
730 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
731 "Handoff support module init fail"));
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530732 WLANTL_FreeClientMemory(pTLCb->atlSTAClients);
Sushant Kaushikf4a27972015-04-16 16:48:00 +0530733 vos_mem_vfree(pTLCb->reorderBufferPool);
Jeff Johnson295189b2012-06-20 16:38:30 -0700734 vos_free_context(pvosGCtx, VOS_MODULE_ID_TL, pTLCb);
735 return status;
736 }
737#endif
738
Abhishek Singh00b71972016-01-07 10:51:04 +0530739#ifdef WLAN_FEATURE_RMC
740 status = WLANTL_RmcInit(pvosGCtx);
741 if (!VOS_IS_STATUS_SUCCESS(status))
742 {
743 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
744 "RMC module init fail"));
745 return status;
746 }
747#endif
748
Jeff Johnson295189b2012-06-20 16:38:30 -0700749 pTLCb->isBMPS = VOS_FALSE;
750 pmcRegisterDeviceStateUpdateInd( smeContext,
751 WLANTL_PowerStateChangedCB, pvosGCtx );
752
753 return VOS_STATUS_SUCCESS;
754}/* WLANTL_Open */
755
756/*==========================================================================
757
758 FUNCTION WLANTL_Start
759
760 DESCRIPTION
761 Called by HDD as part of the overall start procedure. TL will use this
762 call to register with BAL as a transport layer entity.
763
764 DEPENDENCIES
765
766 PARAMETERS
767
768 IN
769 pvosGCtx: pointer to the global vos context; a handle to TL's
770 control block can be extracted from its context
771
772 RETURN VALUE
773 The result code associated with performing the operation
774
775 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a page
776 fault
777 VOS_STATUS_SUCCESS: Everything is good :)
778
779 Other codes can be returned as a result of a BAL failure; see BAL API
780 for more info
781
782 SIDE EFFECTS
783
784============================================================================*/
785VOS_STATUS
786WLANTL_Start
787(
788 v_PVOID_t pvosGCtx
789)
790{
791 WLANTL_CbType* pTLCb = NULL;
792 v_U32_t uResCount = WDA_TLI_MIN_RES_DATA;
793 VOS_STATUS vosStatus;
794 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
795
796 /*------------------------------------------------------------------------
797 Sanity check
798 Extract TL control block
799 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530800 ENTER();
Jeff Johnson295189b2012-06-20 16:38:30 -0700801 pTLCb = VOS_GET_TL_CB(pvosGCtx);
802 if ( NULL == pTLCb )
803 {
804 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
805 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_Start"));
806 return VOS_STATUS_E_FAULT;
807 }
808
809 /*------------------------------------------------------------------------
810 Register with WDA as transport layer client
811 Request resources for tx from bus
812 ------------------------------------------------------------------------*/
813 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
814 "WLAN TL:WLAN TL:WLANTL_Start"));
815
Katya Nigam42e16e82014-02-04 16:28:55 +0530816 tlTraceInit();
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 vosStatus = WDA_DS_Register( pvosGCtx,
818 WLANTL_TxComp,
819 WLANTL_RxFrames,
820 WLANTL_GetFrames,
821 WLANTL_ResourceCB,
822 WDA_TLI_MIN_RES_DATA,
823 pvosGCtx,
824 &uResCount );
825
826 if ( VOS_STATUS_SUCCESS != vosStatus )
827 {
828 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
829 "WLAN TL:TL failed to register with BAL/WDA, Err: %d",
830 vosStatus));
831 return vosStatus;
832 }
833
834 /* Enable transmission */
835 vos_atomic_set_U8( &pTLCb->ucTxSuspended, 0);
836
837 pTLCb->uResCount = uResCount;
Jeff Johnson295189b2012-06-20 16:38:30 -0700838 return VOS_STATUS_SUCCESS;
839}/* WLANTL_Start */
840
841/*==========================================================================
842
843 FUNCTION WLANTL_Stop
844
845 DESCRIPTION
846 Called by HDD to stop operation in TL, before close. TL will suspend all
847 frame transfer operation and will wait for the close request to clean up
848 its resources.
849
850 DEPENDENCIES
851
852 PARAMETERS
853
854 IN
855 pvosGCtx: pointer to the global vos context; a handle to TL's
856 control block can be extracted from its context
857
858 RETURN VALUE
859 The result code associated with performing the operation
860
861 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a page
862 fault
863 VOS_STATUS_SUCCESS: Everything is good :)
864
865 SIDE EFFECTS
866
867============================================================================*/
868VOS_STATUS
869WLANTL_Stop
870(
871 v_PVOID_t pvosGCtx
872)
873{
874 WLANTL_CbType* pTLCb = NULL;
875 v_U8_t ucIndex;
876 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
877
878 /*------------------------------------------------------------------------
879 Sanity check
880 Extract TL control block
881 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530882 ENTER();
Jeff Johnson295189b2012-06-20 16:38:30 -0700883 pTLCb = VOS_GET_TL_CB(pvosGCtx);
884 if ( NULL == pTLCb )
885 {
886 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
887 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
888 return VOS_STATUS_E_FAULT;
889 }
890
891 /*------------------------------------------------------------------------
892 Stop TL and empty Station list
893 ------------------------------------------------------------------------*/
894 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
895 "WLAN TL:WLANTL_Stop"));
896
897 /* Disable transmission */
898 vos_atomic_set_U8( &pTLCb->ucTxSuspended, 1);
899
900 if ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff )
901 {
902 vos_pkt_return_packet(pTLCb->tlMgmtFrmClient.vosPendingDataBuff);
903 pTLCb->tlMgmtFrmClient.vosPendingDataBuff = NULL;
904 }
905
906 if ( NULL != pTLCb->tlBAPClient.vosPendingDataBuff )
907 {
908 vos_pkt_return_packet(pTLCb->tlBAPClient.vosPendingDataBuff);
909 pTLCb->tlBAPClient.vosPendingDataBuff = NULL;
910 }
911
912#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
913 if(VOS_STATUS_SUCCESS != WLANTL_HSStop(pvosGCtx))
914 {
915 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
916 "Handoff Support module stop fail"));
917 }
918#endif
919
920 /*-------------------------------------------------------------------------
921 Clean client stations
922 -------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530923 for ( ucIndex = 0; ucIndex < WLAN_MAX_STA_COUNT; ucIndex++)
Jeff Johnson295189b2012-06-20 16:38:30 -0700924 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530925 if ( NULL != pTLCb->atlSTAClients[ucIndex] )
926 {
927 WLANTL_CleanSTA(pTLCb->atlSTAClients[ucIndex], 1 /*empty all queues*/);
928 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700929 }
930
931
932 return VOS_STATUS_SUCCESS;
933}/* WLANTL_Stop */
934
935/*==========================================================================
936
937 FUNCTION WLANTL_Close
938
939 DESCRIPTION
940 Called by HDD during general driver close procedure. TL will clean up
941 all the internal resources.
942
943 DEPENDENCIES
944
945 PARAMETERS
946
947 IN
948 pvosGCtx: pointer to the global vos context; a handle to TL's
949 control block can be extracted from its context
950
951 RETURN VALUE
952 The result code associated with performing the operation
953
954 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a page
955 fault
956 VOS_STATUS_SUCCESS: Everything is good :)
957
958 SIDE EFFECTS
959
960============================================================================*/
961VOS_STATUS
962WLANTL_Close
963(
964 v_PVOID_t pvosGCtx
965)
966{
967 WLANTL_CbType* pTLCb = NULL;
968 tHalHandle smeContext;
969 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
970
971 /*------------------------------------------------------------------------
972 Sanity check
973 Extract TL control block
974 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530975 ENTER();
Jeff Johnson295189b2012-06-20 16:38:30 -0700976 pTLCb = VOS_GET_TL_CB(pvosGCtx);
977 if ( NULL == pTLCb )
978 {
979 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
980 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
981 return VOS_STATUS_E_FAULT;
982 }
983 /*------------------------------------------------------------------------
984 Deregister from PMC
985 ------------------------------------------------------------------------*/
986 smeContext = vos_get_context(VOS_MODULE_ID_SME, pvosGCtx);
987 if ( NULL == smeContext )
988 {
989 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700990 "%s: Invalid smeContext", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -0700991 // continue so that we can cleanup as much as possible
992 }
993 else
994 {
995 pmcDeregisterDeviceStateUpdateInd( smeContext, WLANTL_PowerStateChangedCB );
996 }
997
998#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
999 if(VOS_STATUS_SUCCESS != WLANTL_HSDeInit(pvosGCtx))
1000 {
1001 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
1002 "Handoff Support module DeInit fail"));
1003 }
1004#endif
1005
Abhishek Singh00b71972016-01-07 10:51:04 +05301006#ifdef WLAN_FEATURE_RMC
1007 if(VOS_STATUS_SUCCESS != WLANTL_RmcDeInit(pvosGCtx))
1008 {
1009 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
1010 "RMC module DeInit fail"));
1011 }
1012#endif
1013
Jeff Johnson295189b2012-06-20 16:38:30 -07001014 /*------------------------------------------------------------------------
1015 Cleanup TL control block.
1016 ------------------------------------------------------------------------*/
1017 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
1018 "WLAN TL: WLANTL_Close"));
1019 WLANTL_CleanCB(pTLCb, 1 /* empty queues/lists/pkts if any*/);
1020
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301021 WLANTL_FreeClientMemory(pTLCb->atlSTAClients);
1022
Sushant Kaushikf4a27972015-04-16 16:48:00 +05301023 vos_mem_vfree(pTLCb->reorderBufferPool);
Jeff Johnson295189b2012-06-20 16:38:30 -07001024
1025 /*------------------------------------------------------------------------
1026 Free TL context from VOSS global
1027 ------------------------------------------------------------------------*/
1028 vos_free_context(pvosGCtx, VOS_MODULE_ID_TL, pTLCb);
1029 return VOS_STATUS_SUCCESS;
1030}/* WLANTL_Close */
1031
1032/*----------------------------------------------------------------------------
1033 INTERACTION WITH HDD
1034 ---------------------------------------------------------------------------*/
1035/*==========================================================================
1036
1037 FUNCTION WLANTL_ConfigureSwFrameTXXlationForAll
1038
1039 DESCRIPTION
1040 Function to disable/enable frame translation for all association stations.
1041
1042 DEPENDENCIES
1043
1044 PARAMETERS
1045 IN
1046 pvosGCtx: VOS context
1047 EnableFrameXlation TRUE means enable SW translation for all stations.
1048 .
1049
1050 RETURN VALUE
1051
1052 void.
1053
1054============================================================================*/
1055void
1056WLANTL_ConfigureSwFrameTXXlationForAll
1057(
1058 v_PVOID_t pvosGCtx,
1059 v_BOOL_t enableFrameXlation
1060)
1061{
1062 v_U8_t ucIndex;
1063 /*------------------------------------------------------------------------
1064 Extract TL control block
1065 ------------------------------------------------------------------------*/
1066 WLANTL_CbType* pTLCb = VOS_GET_TL_CB(pvosGCtx);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301067 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001068 if ( NULL == pTLCb )
1069 {
1070 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1071 "WLAN TL:Invalid TL pointer from pvosGCtx on "
1072 "WLANTL_ConfigureSwFrameTXXlationForAll"));
1073 return;
1074 }
1075
1076 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
1077 "WLANTL_ConfigureSwFrameTXXlationForAll: Configure SW frameXlation %d",
1078 enableFrameXlation));
1079
1080 for ( ucIndex = 0; ucIndex < WLAN_MAX_TID; ucIndex++)
1081 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301082 pClientSTA = pTLCb->atlSTAClients[ucIndex];
1083 if ( NULL != pClientSTA && 0 != pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07001084 {
1085#ifdef WLAN_SOFTAP_VSTA_FEATURE
1086 // if this station was not allocated resources to perform HW-based
1087 // TX frame translation then force SW-based TX frame translation
1088 // otherwise use the frame translation supplied by the client
1089 if (!WDA_IsHwFrameTxTranslationCapable(pvosGCtx, ucIndex))
1090 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301091 pClientSTA->wSTADesc.ucSwFrameTXXlation = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07001092 }
1093 else
1094#endif
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301095 pClientSTA->wSTADesc.ucSwFrameTXXlation = enableFrameXlation;
Jeff Johnson295189b2012-06-20 16:38:30 -07001096 }
1097 }
1098}
1099
1100/*===========================================================================
1101
1102 FUNCTION WLANTL_StartForwarding
1103
1104 DESCRIPTION
1105
1106 This function is used to ask serialization through TX thread of the
1107 cached frame forwarding (if statation has been registered in the mean while)
1108 or flushing (if station has not been registered by the time)
1109
1110 In case of forwarding, upper layer is only required to call WLANTL_RegisterSTAClient()
1111 and doesn't need to call this function explicitly. TL will handle this inside
1112 WLANTL_RegisterSTAClient().
1113
1114 In case of flushing, upper layer is required to call this function explicitly
1115
1116 DEPENDENCIES
1117
1118 TL must have been initialized before this gets called.
1119
1120
1121 PARAMETERS
1122
1123 ucSTAId: station id
1124
1125 RETURN VALUE
1126
1127 The result code associated with performing the operation
1128 Please check return values of vos_tx_mq_serialize.
1129
1130 SIDE EFFECTS
1131 If TL was asked to perform WLANTL_CacheSTAFrame() in WLANTL_RxFrames(),
1132 either WLANTL_RegisterSTAClient() or this function must be called
1133 within reasonable time. Otherwise, TL will keep cached vos buffer until
1134 one of this function is called, and may end up with system buffer exhasution.
1135
1136 It's an upper layer's responsibility to call this function in case of
1137 flushing
1138
1139============================================================================*/
1140
1141VOS_STATUS
1142WLANTL_StartForwarding
1143(
1144 v_U8_t ucSTAId,
1145 v_U8_t ucUcastSig,
1146 v_U8_t ucBcastSig
1147)
1148{
1149 vos_msg_t sMessage;
1150 v_U32_t uData;
1151 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
1152
1153 /* Signal the OS to serialize our event */
1154 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
1155 "Serializing TL Start Forwarding Cached for control STA %d",
1156 ucSTAId );
1157
1158 vos_mem_zero( &sMessage, sizeof(vos_msg_t) );
1159
1160 uData = ucSTAId | (ucUcastSig << 8 ) | (ucBcastSig << 16);
Jeff Johnsond86c05a2013-11-10 18:50:34 -08001161 sMessage.bodyval = uData;
Katya Nigam664f5032014-05-05 12:24:32 +05301162 sMessage.type = WLANTL_RX_FWD_CACHED;
Jeff Johnson295189b2012-06-20 16:38:30 -07001163
Katya Nigam664f5032014-05-05 12:24:32 +05301164 return vos_rx_mq_serialize(VOS_MQ_ID_TL, &sMessage);
Jeff Johnson295189b2012-06-20 16:38:30 -07001165
1166} /* WLANTL_StartForwarding() */
1167
1168/*===========================================================================
1169
Katya Nigam63902932014-06-26 19:04:23 +05301170 FUNCTION WLANTL_EnableCaching
1171
1172 DESCRIPTION
1173
1174 This function is used to enable caching only when assoc/reassoc req is send.
1175 that is cache packets only for such STA ID.
1176
1177
1178 DEPENDENCIES
1179
1180 TL must have been initialized before this gets called.
1181
1182
1183 PARAMETERS
1184
1185 staId: station id
1186
1187 RETURN VALUE
1188
1189 none
1190
1191============================================================================*/
1192void WLANTL_EnableCaching(v_U8_t staId)
1193{
1194 v_PVOID_t pvosGCtx= vos_get_global_context(VOS_MODULE_ID_TL,NULL);
1195 WLANTL_CbType* pTLCb = VOS_GET_TL_CB(pvosGCtx);
1196 if ( NULL == pTLCb )
1197 {
1198 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1199 "WLAN TL:Invalid TL pointer from pvosGCtx on "
1200 "WLANTL_EnableCaching"));
1201 return;
1202 }
1203 pTLCb->atlSTAClients[staId]->enableCaching = 1;
1204}
1205
1206/*===========================================================================
1207
Jeff Johnson295189b2012-06-20 16:38:30 -07001208 FUNCTION WLANTL_AssocFailed
1209
1210 DESCRIPTION
1211
1212 This function is used by PE to notify TL that cache needs to flushed'
1213 when association is not successfully completed
1214
1215 Internally, TL post a message to TX_Thread to serialize the request to
1216 keep lock-free mechanism.
1217
1218
1219 DEPENDENCIES
1220
1221 TL must have been initialized before this gets called.
1222
1223
1224 PARAMETERS
1225
1226 ucSTAId: station id
1227
1228 RETURN VALUE
1229
1230 none
1231
1232 SIDE EFFECTS
1233 There may be race condition that PE call this API and send another association
1234 request immediately with same staId before TX_thread can process the message.
1235
1236 To avoid this, we might need PE to wait for TX_thread process the message,
1237 but this is not currently implemented.
1238
1239============================================================================*/
1240void WLANTL_AssocFailed(v_U8_t staId)
1241{
1242 // flushing frames and forwarding frames uses the same message
1243 // the only difference is what happens when the message is processed
1244 // if the STA exist, the frames will be forwarded
1245 // and if it doesn't exist, the frames will be flushed
1246 // 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 +05301247 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_ASSOC_FAILED,
1248 staId, 0));
1249
Jeff Johnson295189b2012-06-20 16:38:30 -07001250 if(!VOS_IS_STATUS_SUCCESS(WLANTL_StartForwarding(staId,0,0)))
1251 {
1252 VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Mihir Sheteb7337272014-04-11 15:53:08 +05301253 " %s fails to start forwarding (staId %d)", __func__, staId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001254 }
1255}
Nirav Shah4f765af2015-01-21 19:51:30 +05301256
Nirav Shah4b53d4b2015-05-08 05:35:00 -07001257 /*===========================================================================
Jeff Johnson295189b2012-06-20 16:38:30 -07001258
1259 FUNCTION WLANTL_Finish_ULA
1260
1261 DESCRIPTION
1262 This function is used by HDD to notify TL to finish Upper layer authentication
1263 incase the last EAPOL packet is pending in the TL queue.
1264 To avoid the race condition between sme set key and the last EAPOL packet
1265 the HDD module calls this function just before calling the sme_RoamSetKey.
1266
1267 DEPENDENCIES
1268
1269 TL must have been initialized before this gets called.
Nirav Shah4f765af2015-01-21 19:51:30 +05301270
Jeff Johnson295189b2012-06-20 16:38:30 -07001271 PARAMETERS
1272
Nirav Shah4b53d4b2015-05-08 05:35:00 -07001273 callbackRoutine: HDD Callback function.
1274 callbackContext : HDD userdata context.
Nirav Shah4f765af2015-01-21 19:51:30 +05301275
Jeff Johnson295189b2012-06-20 16:38:30 -07001276 RETURN VALUE
1277
1278 VOS_STATUS_SUCCESS/VOS_STATUS_FAILURE
Nirav Shah4f765af2015-01-21 19:51:30 +05301279
Jeff Johnson295189b2012-06-20 16:38:30 -07001280 SIDE EFFECTS
Nirav Shah4f765af2015-01-21 19:51:30 +05301281
Jeff Johnson295189b2012-06-20 16:38:30 -07001282============================================================================*/
1283
1284VOS_STATUS WLANTL_Finish_ULA( void (*callbackRoutine) (void *callbackContext),
Nirav Shah4b53d4b2015-05-08 05:35:00 -07001285 void *callbackContext)
Jeff Johnson295189b2012-06-20 16:38:30 -07001286{
Nirav Shah4b53d4b2015-05-08 05:35:00 -07001287 return WDA_DS_FinishULA( callbackRoutine, callbackContext);
Nirav Shah4f765af2015-01-21 19:51:30 +05301288}
Jeff Johnson295189b2012-06-20 16:38:30 -07001289
Nirav Shah4b53d4b2015-05-08 05:35:00 -07001290
Jeff Johnson295189b2012-06-20 16:38:30 -07001291/*===========================================================================
1292
1293 FUNCTION WLANTL_RegisterSTAClient
1294
1295 DESCRIPTION
1296
1297 This function is used by HDD to register as a client for data services
1298 with TL. HDD will call this API for each new station that it adds,
1299 thus having the flexibility of registering different callback for each
1300 STA it services.
1301
1302 DEPENDENCIES
1303
1304 TL must have been initialized before this gets called.
1305
1306 Restriction:
1307 Main thread will have higher priority that Tx and Rx threads thus
1308 guaranteeing that a station will be added before any data can be
1309 received for it. (This enables TL to be lock free)
1310
1311 PARAMETERS
1312
1313 pvosGCtx: pointer to the global vos context; a handle to TL's
1314 control block can be extracted from its context
1315 pfnStARx: function pointer to the receive packet handler from HDD
1316 pfnSTATxComp: function pointer to the transmit complete confirmation
1317 handler from HDD
1318 pfnSTAFetchPkt: function pointer to the packet retrieval routine in HDD
1319 wSTADescType: STA Descriptor, contains information related to the
1320 new added STA
1321
1322 RETURN VALUE
1323
1324 The result code associated with performing the operation
1325
1326 VOS_STATUS_E_INVAL: Input parameters are invalid
1327 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
1328 TL cb is NULL ; access would cause a page fault
1329 VOS_STATUS_E_EXISTS: Station was already registered
1330 VOS_STATUS_SUCCESS: Everything is good :)
1331
1332 SIDE EFFECTS
1333
1334============================================================================*/
1335VOS_STATUS
1336WLANTL_RegisterSTAClient
1337(
1338 v_PVOID_t pvosGCtx,
1339 WLANTL_STARxCBType pfnSTARx,
1340 WLANTL_TxCompCBType pfnSTATxComp,
1341 WLANTL_STAFetchPktCBType pfnSTAFetchPkt,
1342 WLAN_STADescType* pwSTADescType,
1343 v_S7_t rssi
1344)
1345{
1346 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301347 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001348 v_U8_t ucTid = 0;/*Local variable to clear previous replay counters of STA on all TIDs*/
Hanumantha Reddy Pothulaee001fc2015-05-26 15:21:53 +05301349 v_U32_t istoggleArpEnb = 0;
1350 tpAniSirGlobal pMac;
Jeff Johnson295189b2012-06-20 16:38:30 -07001351 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
1352
1353 /*------------------------------------------------------------------------
1354 Sanity check
1355 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301356 ENTER();
Jeff Johnson295189b2012-06-20 16:38:30 -07001357 if (( NULL == pwSTADescType ) || ( NULL == pfnSTARx ) ||
1358 ( NULL == pfnSTAFetchPkt ))
1359 {
1360 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1361 "WLAN TL:Invalid parameter sent on WLANTL_RegisterSTAClient"));
1362 return VOS_STATUS_E_INVAL;
1363 }
1364
1365 if ( WLANTL_STA_ID_INVALID( pwSTADescType->ucSTAId ) )
1366 {
1367 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1368 "WLAN TL:Invalid station id requested on WLANTL_RegisterSTAClient"));
1369 return VOS_STATUS_E_FAULT;
1370 }
1371
1372 /*------------------------------------------------------------------------
1373 Extract TL control block
1374 ------------------------------------------------------------------------*/
1375 pTLCb = VOS_GET_TL_CB(pvosGCtx);
1376 if ( NULL == pTLCb )
1377 {
1378 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1379 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_RegisterSTAClient"));
1380 return VOS_STATUS_E_FAULT;
1381 }
1382
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301383 //Code for checking and allocating memory for new STA
1384 if ( NULL == pTLCb->atlSTAClients[pwSTADescType->ucSTAId] ){
1385 pTLCb->atlSTAClients[pwSTADescType->ucSTAId] = vos_mem_malloc(sizeof(WLANTL_STAClientType));
1386 if ( NULL == pTLCb->atlSTAClients[pwSTADescType->ucSTAId] ){
1387 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1388 "WLAN TL: STA Client memory allocation failed in WLANTL_RegisterSTAClient"));
1389 return VOS_STATUS_E_FAILURE;
1390 }
1391 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
1392 "WLAN TL: STA Client memory allocation in WLANTL_RegisterSTAClient"));
1393 vos_mem_zero((v_VOID_t *) pTLCb->atlSTAClients[pwSTADescType->ucSTAId],sizeof(WLANTL_STAClientType));
1394 }
1395
1396 //Assigning the pointer to local variable for easy access in future
1397 pClientSTA = pTLCb->atlSTAClients[pwSTADescType->ucSTAId];
1398 if ( 0 != pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07001399 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301400 pClientSTA->ucExists++;
Jeff Johnson295189b2012-06-20 16:38:30 -07001401 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1402 "WLAN TL:Station was already registered on WLANTL_RegisterSTAClient"));
1403 return VOS_STATUS_E_EXISTS;
1404 }
1405
1406 /*------------------------------------------------------------------------
1407 Register station with TL
1408 ------------------------------------------------------------------------*/
Katya Nigam42e16e82014-02-04 16:28:55 +05301409 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_REGISTER_STA_CLIENT,
1410 pwSTADescType->ucSTAId, (unsigned )
1411 (*(pwSTADescType->vSTAMACAddress.bytes+2)<<24 |
1412 *(pwSTADescType->vSTAMACAddress.bytes+3)<<16 |
1413 *(pwSTADescType->vSTAMACAddress.bytes+4)<<8 |
1414 *(pwSTADescType->vSTAMACAddress.bytes+5))));
1415
Jeff Johnson295189b2012-06-20 16:38:30 -07001416 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
1417 "WLAN TL:Registering STA Client ID: %d", pwSTADescType->ucSTAId ));
1418
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301419 pClientSTA->pfnSTARx = pfnSTARx;
1420 pClientSTA->pfnSTAFetchPkt = pfnSTAFetchPkt;
Jeff Johnson295189b2012-06-20 16:38:30 -07001421
1422 /* Only register if different from NULL - TL default Tx Comp Cb will
1423 release the vos packet */
1424 if ( NULL != pfnSTATxComp )
1425 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301426 pClientSTA->pfnSTATxComp = pfnSTATxComp;
Jeff Johnson295189b2012-06-20 16:38:30 -07001427 }
1428
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301429 pClientSTA->tlState = WLANTL_STA_INIT;
1430 pClientSTA->tlPri = WLANTL_STA_PRI_NORMAL;
1431 pClientSTA->wSTADesc.ucSTAId = pwSTADescType->ucSTAId;
Gopichand Nakkala8b54e912013-03-11 10:44:21 +05301432 pClientSTA->ptkInstalled = 0;
Bhargav Shahfbaeca22016-07-13 10:27:35 +05301433 pClientSTA->disassoc_progress = VOS_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001434
Hanumantha Reddy Pothulaee001fc2015-05-26 15:21:53 +05301435 pMac = vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
1436 if ( NULL != pMac )
1437 {
1438 wlan_cfgGetInt(pMac, WNI_CFG_TOGGLE_ARP_BDRATES, &istoggleArpEnb);
1439 }
Hanumantha Reddy Pothulae5ab23d2015-09-14 18:08:24 +05301440 pClientSTA->arpRate = istoggleArpEnb ? ENABLE_ARP_TOGGLE : DISABLE_ARP_TOGGLE;
1441 pClientSTA->arpOnWQ5 = istoggleArpEnb == SEND_ARP_ON_WQ5;
Hanumantha Reddy Pothulaee001fc2015-05-26 15:21:53 +05301442
Jeff Johnson295189b2012-06-20 16:38:30 -07001443 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Hanumantha Reddy Pothulaee001fc2015-05-26 15:21:53 +05301444 "WLAN TL:Registering STA Client ID: %d with UC %d and BC %d toggleArp :%hhu",
1445 pwSTADescType->ucSTAId, pwSTADescType->ucUcastSig,
1446 pwSTADescType->ucBcastSig, pClientSTA->arpRate));
Jeff Johnson295189b2012-06-20 16:38:30 -07001447
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301448 pClientSTA->wSTADesc.wSTAType = pwSTADescType->wSTAType;
Jeff Johnson295189b2012-06-20 16:38:30 -07001449
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301450 pClientSTA->wSTADesc.ucQosEnabled = pwSTADescType->ucQosEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07001451
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301452 pClientSTA->wSTADesc.ucAddRmvLLC = pwSTADescType->ucAddRmvLLC;
Jeff Johnson295189b2012-06-20 16:38:30 -07001453
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301454 pClientSTA->wSTADesc.ucProtectedFrame = pwSTADescType->ucProtectedFrame;
Jeff Johnson295189b2012-06-20 16:38:30 -07001455
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001456#ifdef FEATURE_WLAN_ESE
1457 pClientSTA->wSTADesc.ucIsEseSta = pwSTADescType->ucIsEseSta;
Jeff Johnson295189b2012-06-20 16:38:30 -07001458
1459 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001460 "WLAN TL:Registering STA Client ID: %d QoS %d Add LLC %d ProtFrame %d EseSta %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001461 pwSTADescType->ucSTAId,
1462 pwSTADescType->ucQosEnabled,
1463 pwSTADescType->ucAddRmvLLC,
1464 pwSTADescType->ucProtectedFrame,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001465 pwSTADescType->ucIsEseSta));
Jeff Johnson295189b2012-06-20 16:38:30 -07001466#else
1467
1468 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
1469 "WLAN TL:Registering STA Client ID: %d QoS %d Add LLC %d ProtFrame %d",
1470 pwSTADescType->ucSTAId,
1471 pwSTADescType->ucQosEnabled,
1472 pwSTADescType->ucAddRmvLLC,
1473 pwSTADescType->ucProtectedFrame));
1474
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001475#endif //FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001476#ifdef WLAN_SOFTAP_VSTA_FEATURE
1477 // if this station was not allocated resources to perform HW-based
1478 // TX frame translation then force SW-based TX frame translation
1479 // otherwise use the frame translation supplied by the client
1480
1481 if (!WDA_IsHwFrameTxTranslationCapable(pvosGCtx, pwSTADescType->ucSTAId)
1482 || ( WLAN_STA_BT_AMP == pwSTADescType->wSTAType))
1483 {
1484 pwSTADescType->ucSwFrameTXXlation = 1;
1485 }
1486#endif
1487
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301488 pClientSTA->wSTADesc.ucSwFrameTXXlation = pwSTADescType->ucSwFrameTXXlation;
1489 pClientSTA->wSTADesc.ucSwFrameRXXlation = pwSTADescType->ucSwFrameRXXlation;
Jeff Johnson295189b2012-06-20 16:38:30 -07001490
1491#ifdef FEATURE_WLAN_WAPI
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301492 pClientSTA->wSTADesc.ucIsWapiSta = pwSTADescType->ucIsWapiSta;
Jeff Johnson295189b2012-06-20 16:38:30 -07001493#endif /* FEATURE_WLAN_WAPI */
1494
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301495 vos_copy_macaddr( &pClientSTA->wSTADesc.vSTAMACAddress, &pwSTADescType->vSTAMACAddress);
Jeff Johnson295189b2012-06-20 16:38:30 -07001496
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301497 vos_copy_macaddr( &pClientSTA->wSTADesc.vBSSIDforIBSS, &pwSTADescType->vBSSIDforIBSS);
Jeff Johnson295189b2012-06-20 16:38:30 -07001498
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301499 vos_copy_macaddr( &pClientSTA->wSTADesc.vSelfMACAddress, &pwSTADescType->vSelfMACAddress);
Jeff Johnson295189b2012-06-20 16:38:30 -07001500
Jeff Johnson295189b2012-06-20 16:38:30 -07001501 /* In volans release L replay check is done at TL */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301502 pClientSTA->ucIsReplayCheckValid = pwSTADescType->ucIsReplayCheckValid;
1503 pClientSTA->ulTotalReplayPacketsDetected = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001504/*Clear replay counters of the STA on all TIDs*/
1505 for(ucTid = 0; ucTid < WLANTL_MAX_TID ; ucTid++)
1506 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301507 pClientSTA->ullReplayCounter[ucTid] = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001508 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001509
1510 /*--------------------------------------------------------------------
1511 Set the AC for the registered station to the highest priority AC
1512 Even if this AC is not supported by the station, correction will be
1513 made in the main TL loop after the supported mask is properly
1514 updated in the pending packets call
1515 --------------------------------------------------------------------*/
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +05301516 pClientSTA->ucCurrentAC = WLANTL_AC_HIGH_PRIO;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301517 pClientSTA->ucCurrentWeight = 0;
1518 pClientSTA->ucServicedAC = WLANTL_AC_BK;
1519 pClientSTA->ucEapolPktPending = 0;
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07001520
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301521 vos_mem_zero( pClientSTA->aucACMask, sizeof(pClientSTA->aucACMask));
Jeff Johnson295189b2012-06-20 16:38:30 -07001522
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301523 vos_mem_zero( &pClientSTA->wUAPSDInfo, sizeof(pClientSTA->wUAPSDInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07001524
1525 /*--------------------------------------------------------------------
1526 Reordering info and AMSDU de-aggregation
1527 --------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301528 vos_mem_zero( pClientSTA->atlBAReorderInfo,
1529 sizeof(pClientSTA->atlBAReorderInfo[0])*
Jeff Johnson295189b2012-06-20 16:38:30 -07001530 WLAN_MAX_TID);
1531
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301532 vos_mem_zero( pClientSTA->aucMPDUHeader,
Jeff Johnson295189b2012-06-20 16:38:30 -07001533 WLANTL_MPDU_HEADER_LEN);
1534
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301535 pClientSTA->ucMPDUHeaderLen = 0;
1536 pClientSTA->vosAMSDUChain = NULL;
1537 pClientSTA->vosAMSDUChainRoot = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001538
1539
Leo Chang6b6faaf2014-01-24 21:21:26 -08001540 /* Reorder LOCK
1541 * During handle normal RX frame within RX thread,
1542 * if MC thread try to preempt, ADDBA, DELBA, TIMER
1543 * Context should be protected from race */
1544 for (ucTid = 0; ucTid < WLAN_MAX_TID ; ucTid++)
1545 {
1546 if (!VOS_IS_STATUS_SUCCESS(
1547 vos_lock_init(&pClientSTA->atlBAReorderInfo[ucTid].reorderLock)))
1548 {
1549 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1550 "Lock Init Fail"));
1551 return VOS_STATUS_E_FAILURE;
1552 }
1553 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001554 /*--------------------------------------------------------------------
1555 Stats info
1556 --------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301557 vos_mem_zero( pClientSTA->auRxCount,
1558 sizeof(pClientSTA->auRxCount[0])*
Jeff Johnson295189b2012-06-20 16:38:30 -07001559 WLAN_MAX_TID);
1560
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301561 vos_mem_zero( pClientSTA->auTxCount,
1562 sizeof(pClientSTA->auRxCount[0])*
Jeff Johnson295189b2012-06-20 16:38:30 -07001563 WLAN_MAX_TID);
1564 /* Initial RSSI is always reported as zero because TL doesnt have enough
1565 data to calculate RSSI. So to avoid reporting zero, we are initializing
1566 RSSI with RSSI saved in BssDescription during scanning. */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301567 pClientSTA->rssiAvg = rssi;
Bhargav Shah0b23d202015-07-10 17:14:34 +05301568 pClientSTA->rssiAvgBmps = rssi;
Shailender Karmuchi13c0d082013-03-26 14:41:39 -07001569#ifdef FEATURE_WLAN_TDLS
1570 if(WLAN_STA_TDLS == pClientSTA->wSTADesc.wSTAType)
1571 {
1572 /* If client is TDLS, use TDLS specific alpha */
1573 pClientSTA->rssiAlpha = WLANTL_HO_TDLS_ALPHA;
1574 }
1575 else
1576 {
1577 pClientSTA->rssiAlpha = WLANTL_HO_DEFAULT_ALPHA;
1578 }
1579#else
1580 pClientSTA->rssiAlpha = WLANTL_HO_DEFAULT_ALPHA;
1581#endif /* FEATURE_WLAN_TDLS */
Dino Mycle3b9536d2014-07-09 22:05:24 +05301582#ifdef WLAN_FEATURE_LINK_LAYER_STATS
1583 pClientSTA->rssiDataAlpha = WLANTL_HO_DEFAULT_ALPHA;
1584 pClientSTA->interfaceStats.accessCategoryStats[0].ac = WLANTL_AC_BK;
1585 pClientSTA->interfaceStats.accessCategoryStats[1].ac = WLANTL_AC_BE;
1586 pClientSTA->interfaceStats.accessCategoryStats[2].ac = WLANTL_AC_VI;
1587 pClientSTA->interfaceStats.accessCategoryStats[3].ac = WLANTL_AC_VO;
1588#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001589
1590 /*Tx not suspended and station fully registered*/
1591 vos_atomic_set_U8(
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301592 &pClientSTA->ucTxSuspended, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001593
1594 /* Used until multiple station support will be added*/
1595 pTLCb->ucRegisteredStaId = pwSTADescType->ucSTAId;
1596
1597 /* Save the BAP station ID for future usage */
1598 if ( WLAN_STA_BT_AMP == pwSTADescType->wSTAType )
1599 {
1600 pTLCb->tlBAPClient.ucBAPSTAId = pwSTADescType->ucSTAId;
1601 }
1602
1603 /*------------------------------------------------------------------------
1604 Statistics info
1605 -----------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301606 memset(&pClientSTA->trafficStatistics,
Jeff Johnson295189b2012-06-20 16:38:30 -07001607 0, sizeof(WLANTL_TRANSFER_STA_TYPE));
1608
1609
1610 /*------------------------------------------------------------------------
1611 Start with the state suggested by client caller
1612 -----------------------------------------------------------------------*/
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05301613 pClientSTA->tlState = pwSTADescType->ucInitState;
Jeff Johnson295189b2012-06-20 16:38:30 -07001614 /*-----------------------------------------------------------------------
1615 After all the init is complete we can mark the existance flag
1616 ----------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301617 pClientSTA->ucExists++;
Jeff Johnson295189b2012-06-20 16:38:30 -07001618
Jeff Johnson295189b2012-06-20 16:38:30 -07001619 //flow control fields init
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301620 pClientSTA->ucLwmModeEnabled = FALSE;
1621 pClientSTA->ucLwmEventReported = FALSE;
1622 pClientSTA->bmuMemConsumed = 0;
1623 pClientSTA->uIngress_length = 0;
1624 pClientSTA->uBuffThresholdMax = WLANTL_STA_BMU_THRESHOLD_MAX;
Jeff Johnson295189b2012-06-20 16:38:30 -07001625
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301626 pClientSTA->uLwmThreshold = WLANTL_STA_BMU_THRESHOLD_MAX / 3;
Jeff Johnson295189b2012-06-20 16:38:30 -07001627
1628 //@@@ HDDSOFTAP does not queue unregistered packet for now
1629 if ( WLAN_STA_SOFTAP != pwSTADescType->wSTAType )
1630 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001631 /*------------------------------------------------------------------------
1632 Forward received frames while STA was not yet registered
1633 - ----------------------------------------------------------------------*/
1634 if(!VOS_IS_STATUS_SUCCESS(WLANTL_StartForwarding( pwSTADescType->ucSTAId,
1635 pwSTADescType->ucUcastSig,
1636 pwSTADescType->ucBcastSig)))
1637 {
1638 VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001639 " %s fails to start forwarding", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001640 }
Sunil Ravid5406f22013-01-22 00:18:31 -08001641#ifdef FEATURE_WLAN_TDLS
1642 if( WLAN_STA_TDLS == pwSTADescType->wSTAType )
1643 pTLCb->ucTdlsPeerCount++;
1644#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001645 }
Abhishek Singh00b71972016-01-07 10:51:04 +05301646#ifdef WLAN_FEATURE_RMC
1647 vos_lock_init(&pClientSTA->mcLock);
1648#endif /* WLAN_FEATURE_RMC */
1649
Jeff Johnson295189b2012-06-20 16:38:30 -07001650 return VOS_STATUS_SUCCESS;
1651}/* WLANTL_RegisterSTAClient */
1652
1653/*===========================================================================
1654
1655 FUNCTION WLANTL_ClearSTAClient
1656
1657 DESCRIPTION
1658
1659 HDD will call this API when it no longer needs data services for the
1660 particular station.
1661
1662 DEPENDENCIES
1663
1664 A station must have been registered before the clear registration is
1665 called.
1666
1667 PARAMETERS
1668
1669 pvosGCtx: pointer to the global vos context; a handle to TL's
1670 control block can be extracted from its context
1671 ucSTAId: identifier for the STA to be cleared
1672
1673 RETURN VALUE
1674
1675 The result code associated with performing the operation
1676
1677 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
1678 TL cb is NULL ; access would cause a page fault
1679 VOS_STATUS_E_EXISTS: Station was not registered
1680 VOS_STATUS_SUCCESS: Everything is good :)
1681
1682 SIDE EFFECTS
1683
1684============================================================================*/
1685VOS_STATUS
1686WLANTL_ClearSTAClient
1687(
1688 v_PVOID_t pvosGCtx,
1689 v_U8_t ucSTAId
1690)
1691{
1692 WLANTL_CbType* pTLCb = NULL;
1693 v_U8_t ucIndex;
1694 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
1695
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301696 ENTER();
Jeff Johnson295189b2012-06-20 16:38:30 -07001697 /*------------------------------------------------------------------------
1698 Sanity check
1699 ------------------------------------------------------------------------*/
1700 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
1701 {
1702 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1703 "WLAN TL:Invalid station id requested on WLANTL_ClearSTAClient"));
1704 return VOS_STATUS_E_FAULT;
1705 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001706 /*------------------------------------------------------------------------
1707 Extract TL control block
1708 ------------------------------------------------------------------------*/
1709 pTLCb = VOS_GET_TL_CB(pvosGCtx);
1710 if ( NULL == pTLCb )
1711 {
1712 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1713 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ClearSTAClient"));
1714 return VOS_STATUS_E_FAULT;
1715 }
1716
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301717 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
1718 {
1719 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1720 "WLAN TL:Client Memory was not allocated on %s", __func__));
1721 return VOS_STATUS_E_FAILURE;
1722 }
1723
1724 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07001725 {
1726 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1727 "WLAN TL:Station was not previously registered on WLANTL_ClearSTAClient"));
Siddharth Bhalaef8ee12014-04-02 00:09:45 +05301728 /* Clean packets cached for the STA */
1729 WLANTL_StartForwarding(ucSTAId,0,0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001730 return VOS_STATUS_E_EXISTS;
1731 }
1732
1733 /* Delete BA sessions on all TID's */
Leo Chang6b6faaf2014-01-24 21:21:26 -08001734 for (ucIndex = 0; ucIndex < WLAN_MAX_TID ; ucIndex++)
Jeff Johnson295189b2012-06-20 16:38:30 -07001735 {
Leo Chang6b6faaf2014-01-24 21:21:26 -08001736 WLANTL_BaSessionDel(pvosGCtx, ucSTAId, ucIndex);
1737 vos_lock_destroy(&pTLCb->atlSTAClients[ucSTAId]->atlBAReorderInfo[ucIndex].reorderLock);
Jeff Johnson295189b2012-06-20 16:38:30 -07001738 }
1739
Sunil Ravid5406f22013-01-22 00:18:31 -08001740#ifdef FEATURE_WLAN_TDLS
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301741 /* decrement ucTdlsPeerCount only if it is non-zero */
1742 if(WLAN_STA_TDLS == pTLCb->atlSTAClients[ucSTAId]->wSTADesc.wSTAType
Sunil Ravid5406f22013-01-22 00:18:31 -08001743 && pTLCb->ucTdlsPeerCount)
1744 pTLCb->ucTdlsPeerCount--;
1745#endif
1746
Jeff Johnson295189b2012-06-20 16:38:30 -07001747 /*------------------------------------------------------------------------
1748 Clear station
1749 ------------------------------------------------------------------------*/
1750 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
1751 "WLAN TL:Clearing STA Client ID: %d", ucSTAId ));
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301752 WLANTL_CleanSTA(pTLCb->atlSTAClients[ucSTAId], 1 /*empty packets*/);
Jeff Johnson295189b2012-06-20 16:38:30 -07001753
Abhishek Singh00b71972016-01-07 10:51:04 +05301754#ifdef WLAN_FEATURE_RMC
1755 /*--------------------------------------------------------------------
1756 Delete multicast entries for duplicate detection
1757 --------------------------------------------------------------------*/
1758 WLANTL_McastDeleteAllEntries(pTLCb->atlSTAClients[ucSTAId]);
1759
1760 vos_lock_destroy(&pTLCb->atlSTAClients[ucSTAId]->mcLock);
1761#endif /* WLAN_FEATURE_RMC */
1762
Jeff Johnson295189b2012-06-20 16:38:30 -07001763 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
1764 "WLAN TL:Clearing STA Reset History RSSI and Region number"));
1765 pTLCb->hoSupport.currentHOState.historyRSSI = 0;
1766 pTLCb->hoSupport.currentHOState.regionNumber = 0;
1767
1768 return VOS_STATUS_SUCCESS;
1769}/* WLANTL_ClearSTAClient */
1770
1771/*===========================================================================
1772
1773 FUNCTION WLANTL_ChangeSTAState
1774
1775 DESCRIPTION
1776
1777 HDD will make this notification whenever a change occurs in the
1778 connectivity state of a particular STA.
1779
1780 DEPENDENCIES
1781
1782 A station must have been registered before the change state can be
1783 called.
1784
1785 RESTRICTION: A station is being notified as authenticated before the
1786 keys are installed in HW. This way if a frame is received
1787 before the keys are installed DPU will drop that frame.
1788
1789 Main thread has higher priority that Tx and Rx threads thus guaranteeing
1790 the following:
1791 - a station will be in assoc state in TL before TL receives any data
1792 for it
1793
1794 PARAMETERS
1795
1796 pvosGCtx: pointer to the global vos context; a handle to TL's
1797 control block can be extracted from its context
1798 ucSTAId: identifier for the STA that is pending transmission
1799 tlSTAState: the new state of the connection to the given station
1800
1801
1802 RETURN VALUE
1803
1804 The result code associated with performing the operation
1805
1806 VOS_STATUS_E_INVAL: Input parameters are invalid
1807 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
1808 TL cb is NULL ; access would cause a page fault
1809 VOS_STATUS_E_EXISTS: Station was not registered
1810 VOS_STATUS_SUCCESS: Everything is good :)
1811
1812 SIDE EFFECTS
1813
1814============================================================================*/
1815VOS_STATUS
1816WLANTL_ChangeSTAState
1817(
1818 v_PVOID_t pvosGCtx,
1819 v_U8_t ucSTAId,
1820 WLANTL_STAStateType tlSTAState
1821)
1822{
1823 WLANTL_CbType* pTLCb = NULL;
1824 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
1825
1826 /*------------------------------------------------------------------------
1827 Sanity check
1828 ------------------------------------------------------------------------*/
1829 if ( tlSTAState >= WLANTL_STA_MAX_STATE )
1830 {
1831 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1832 "WLAN TL:Invalid parameter sent on WLANTL_ChangeSTAState"));
1833 return VOS_STATUS_E_INVAL;
1834 }
1835
1836 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
1837 {
1838 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1839 "WLAN TL:Invalid station id requested on WLANTL_ChangeSTAState"));
1840 return VOS_STATUS_E_FAULT;
1841 }
1842
1843 /*------------------------------------------------------------------------
1844 Extract TL control block and check existance
1845 ------------------------------------------------------------------------*/
1846 pTLCb = VOS_GET_TL_CB(pvosGCtx);
1847 if ( NULL == pTLCb )
1848 {
1849 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1850 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
1851 return VOS_STATUS_E_FAULT;
1852 }
1853
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301854 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
1855 {
1856 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1857 "WLAN TL:Client Memory was not allocated on %s", __func__));
1858 return VOS_STATUS_E_FAILURE;
1859 }
1860
1861 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07001862 {
1863 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1864 "WLAN TL:Station was not previously registered on WLANTL_ChangeSTAState"));
1865 return VOS_STATUS_E_EXISTS;
1866 }
1867
1868 /*------------------------------------------------------------------------
1869 Change STA state
1870 No need to lock this operation, see restrictions above
1871 ------------------------------------------------------------------------*/
1872 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
1873 "WLAN TL:Changing state for STA Client ID: %d from %d to %d",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301874 ucSTAId, pTLCb->atlSTAClients[ucSTAId]->tlState, tlSTAState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001875
Katya Nigam42e16e82014-02-04 16:28:55 +05301876 MTRACE(vos_trace(VOS_MODULE_ID_TL,
1877 TRACE_CODE_TL_STA_STATE, ucSTAId,tlSTAState ));
1878
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301879 pTLCb->atlSTAClients[ucSTAId]->tlState = tlSTAState;
Jeff Johnson295189b2012-06-20 16:38:30 -07001880
1881 return VOS_STATUS_SUCCESS;
1882}/* WLANTL_ChangeSTAState */
1883
1884/*===========================================================================
1885
Agarwal Ashish16020c42014-12-29 22:01:11 +05301886 FUNCTION WLANTL_UpdateTdlsSTAClient
1887
1888 DESCRIPTION
1889
1890 HDD will call this API when ENABLE_LINK happens and HDD want to
1891 register QoS or other params for TDLS peers.
1892
1893 DEPENDENCIES
1894
1895 A station must have been registered before the WMM/QOS registration is
1896 called.
1897
1898 PARAMETERS
1899
1900 pvosGCtx: pointer to the global vos context; a handle to TL's
1901 control block can be extracted from its context
1902 wSTADescType: STA Descriptor, contains information related to the
1903 new added STA
1904
1905 RETURN VALUE
1906
1907 The result code associated with performing the operation
1908
1909 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
1910 TL cb is NULL ; access would cause a page fault
1911 VOS_STATUS_E_EXISTS: Station was not registered
1912 VOS_STATUS_SUCCESS: Everything is good :)
1913
1914 SIDE EFFECTS
1915
1916============================================================================*/
1917
1918VOS_STATUS
1919WLANTL_UpdateTdlsSTAClient
1920(
1921 v_PVOID_t pvosGCtx,
1922 WLAN_STADescType* pwSTADescType
1923)
1924{
1925 WLANTL_CbType* pTLCb = NULL;
1926 WLANTL_STAClientType* pClientSTA = NULL;
1927 /*------------------------------------------------------------------------
1928 Extract TL control block
1929 ------------------------------------------------------------------------*/
1930 pTLCb = VOS_GET_TL_CB(pvosGCtx);
1931 if ( NULL == pTLCb || ( WLAN_MAX_STA_COUNT <= pwSTADescType->ucSTAId))
1932 {
1933 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1934 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_UpdateTdlsSTAClient"));
1935 return VOS_STATUS_E_FAULT;
1936 }
1937
1938 pClientSTA = pTLCb->atlSTAClients[pwSTADescType->ucSTAId];
1939 if ((NULL == pClientSTA) || 0 == pClientSTA->ucExists)
1940 {
1941 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1942 "WLAN TL:Station not exists"));
1943 return VOS_STATUS_E_FAILURE;
1944 }
1945
1946 pClientSTA->wSTADesc.ucQosEnabled = pwSTADescType->ucQosEnabled;
1947
Masti, Narayanraddic754cdc2015-12-24 18:22:36 +05301948 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
1949 "WLAN TL: %s: ucQosEnabled of pwSTADescType: %d"
1950 "pClientSTA->wSTADesc: %d",
1951 __func__, pwSTADescType->ucQosEnabled,
1952 pClientSTA->wSTADesc.ucQosEnabled));
1953
Agarwal Ashish16020c42014-12-29 22:01:11 +05301954 return VOS_STATUS_SUCCESS;
1955
1956}
1957
Katya Nigame7b69a82015-04-28 15:24:06 +05301958VOS_STATUS WLANTL_SetMonRxCbk(v_PVOID_t pvosGCtx, WLANTL_MonRxCBType pfnMonRx)
1959{
1960 WLANTL_CbType* pTLCb = NULL ;
1961 pTLCb = VOS_GET_TL_CB(pvosGCtx);
1962 if ( NULL == pTLCb )
1963 {
1964 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1965 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_RegisterSTAClient"));
1966 return VOS_STATUS_E_FAULT;
1967 }
1968 pTLCb->pfnMonRx = pfnMonRx;
1969 return VOS_STATUS_SUCCESS;
1970}
1971
1972void WLANTL_SetIsConversionReq(v_PVOID_t pvosGCtx, v_BOOL_t isConversionReq)
1973{
1974 WLANTL_CbType* pTLCb = NULL ;
1975 pTLCb = VOS_GET_TL_CB(pvosGCtx);
1976 if ( NULL == pTLCb )
1977 {
1978 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1979 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_RegisterSTAClient"));
1980 return;
1981 }
1982 pTLCb->isConversionReq = isConversionReq;
1983 return;
1984}
1985
Agarwal Ashish16020c42014-12-29 22:01:11 +05301986
1987/*===========================================================================
1988
Gopichand Nakkala8b54e912013-03-11 10:44:21 +05301989 FUNCTION WLANTL_STAPtkInstalled
1990
1991 DESCRIPTION
1992
1993 HDD will make this notification whenever PTK is installed for the STA
1994
1995 DEPENDENCIES
1996
1997 A station must have been registered before the change state can be
1998 called.
1999
2000 PARAMETERS
2001
2002 pvosGCtx: pointer to the global vos context; a handle to TL's
2003 control block can be extracted from its context
2004 ucSTAId: identifier for the STA for which Pairwise key is
2005 installed
2006
2007 RETURN VALUE
2008
2009 The result code associated with performing the operation
2010
2011 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
2012 TL cb is NULL ; access would cause a page fault
2013 VOS_STATUS_E_EXISTS: Station was not registered
2014 VOS_STATUS_SUCCESS: Everything is good :)
2015
2016 SIDE EFFECTS
2017
2018============================================================================*/
2019VOS_STATUS
2020WLANTL_STAPtkInstalled
2021(
2022 v_PVOID_t pvosGCtx,
2023 v_U8_t ucSTAId
2024)
2025{
2026 WLANTL_CbType* pTLCb = NULL;
2027 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2028
2029 /*------------------------------------------------------------------------
2030 Sanity check
2031 ------------------------------------------------------------------------*/
2032
2033 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
2034 {
2035 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2036 "WLAN TL:Invalid station id requested on WLANTL_ChangeSTAState"));
2037 return VOS_STATUS_E_FAULT;
2038 }
2039
2040 /*------------------------------------------------------------------------
2041 Extract TL control block and check existance
2042 ------------------------------------------------------------------------*/
2043 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2044 if ( NULL == pTLCb )
2045 {
2046 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2047 FL("WLAN TL:Invalid TL pointer from pvosGCtx")));
2048 return VOS_STATUS_E_FAULT;
2049 }
2050
2051 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
2052 {
2053 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2054 FL("WLAN TL:Client Memory was not allocated")));
2055 return VOS_STATUS_E_FAILURE;
2056 }
2057
2058 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
2059 {
2060 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2061 FL("WLAN TL:Station was not previously registered")));
2062 return VOS_STATUS_E_EXISTS;
2063 }
2064
2065 pTLCb->atlSTAClients[ucSTAId]->ptkInstalled = 1;
2066
2067 return VOS_STATUS_SUCCESS;
2068}/* WLANTL_STAPtkInstalled */
2069
2070/*===========================================================================
2071
Madan Mohan Koyyalamudifc1d1fe2012-10-18 15:07:12 -07002072 FUNCTION WLANTL_GetSTAState
2073
2074 DESCRIPTION
2075
2076 Returns connectivity state of a particular STA.
2077
2078 DEPENDENCIES
2079
2080 A station must have been registered before its state can be retrieved.
2081
2082
2083 PARAMETERS
2084
2085 IN
2086 pvosGCtx: pointer to the global vos context; a handle to TL's
2087 control block can be extracted from its context
2088 ucSTAId: identifier of the station
2089
2090 OUT
2091 ptlSTAState: the current state of the connection to the given station
2092
2093
2094 RETURN VALUE
2095
2096 The result code associated with performing the operation
2097
2098 VOS_STATUS_E_INVAL: Input parameters are invalid
2099 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
2100 TL cb is NULL ; access would cause a page fault
2101 VOS_STATUS_E_EXISTS: Station was not registered
2102 VOS_STATUS_SUCCESS: Everything is good :)
2103
2104 SIDE EFFECTS
2105
2106============================================================================*/
2107VOS_STATUS
2108WLANTL_GetSTAState
2109(
2110 v_PVOID_t pvosGCtx,
2111 v_U8_t ucSTAId,
2112 WLANTL_STAStateType *ptlSTAState
2113)
2114{
2115 WLANTL_CbType* pTLCb = NULL;
2116 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2117
2118 /*------------------------------------------------------------------------
2119 Sanity check
2120 ------------------------------------------------------------------------*/
2121 if ( NULL == ptlSTAState )
2122 {
2123 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2124 "WLAN TL:Invalid parameter sent on WLANTL_GetSTAState"));
2125 return VOS_STATUS_E_INVAL;
2126 }
2127
2128 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
2129 {
2130 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2131 "WLAN TL:Invalid station id requested on WLANTL_GetSTAState"));
2132 return VOS_STATUS_E_FAULT;
2133 }
2134
2135 /*------------------------------------------------------------------------
2136 Extract TL control block and check existance
2137 ------------------------------------------------------------------------*/
2138 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2139 if ( NULL == pTLCb )
2140 {
2141 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2142 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetSTAState"));
2143 return VOS_STATUS_E_FAULT;
2144 }
2145
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302146 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
2147 {
2148 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2149 "WLAN TL:Client Memory was not allocated on %s", __func__));
2150 return VOS_STATUS_E_FAILURE;
2151 }
2152
2153 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
Madan Mohan Koyyalamudifc1d1fe2012-10-18 15:07:12 -07002154 {
Sunil Ravid5406f22013-01-22 00:18:31 -08002155 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Madan Mohan Koyyalamudifc1d1fe2012-10-18 15:07:12 -07002156 "WLAN TL:Station was not previously registered on WLANTL_GetSTAState"));
2157 return VOS_STATUS_E_EXISTS;
2158 }
2159
2160 /*------------------------------------------------------------------------
2161 Get STA state
2162 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302163 *ptlSTAState = pTLCb->atlSTAClients[ucSTAId]->tlState;
Madan Mohan Koyyalamudifc1d1fe2012-10-18 15:07:12 -07002164
2165 return VOS_STATUS_SUCCESS;
2166}/* WLANTL_GetSTAState */
2167
Shailender Karmuchia734f332013-04-19 14:02:48 -07002168/*==========================================================================
2169 FUNCTION WLANTL_UpdateSTABssIdforIBSS
2170
2171 DESCRIPTION
2172 HDD will call this API to update the BSSID for this Station.
2173
2174 DEPENDENCIES
2175 The HDD Should registered the staID with TL before calling this function.
2176
2177 PARAMETERS
2178
2179 IN
2180 pvosGCtx: Pointer to the global vos context; a handle to TL's
2181 or WDA's control block can be extracted from its context
2182 IN
2183 ucSTAId The Station ID for Bssid to be updated
2184 IN
2185 pBssid BSSID to be updated
2186
2187 RETURN VALUE
2188 The result code associated with performing the operation
2189
2190 VOS_STATUS_E_INVAL: Input parameters are invalid
2191 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
2192 TL cb is NULL ; access would cause a page fault
2193 VOS_STATUS_E_EXISTS: Station was not registered
2194 VOS_STATUS_SUCCESS: Everything is good :)
2195
2196 SIDE EFFECTS
2197============================================================================*/
2198
2199
2200VOS_STATUS
2201WLANTL_UpdateSTABssIdforIBSS
2202(
2203 v_PVOID_t pvosGCtx,
2204 v_U8_t ucSTAId,
2205 v_U8_t *pBssid
2206)
2207{
2208 WLANTL_CbType* pTLCb = NULL;
2209 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2210
2211 /*------------------------------------------------------------------------
2212 Sanity check
2213 ------------------------------------------------------------------------*/
2214 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
2215 {
2216 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2217 "WLAN TL:Invalid station id requested %s", __func__));
2218 return VOS_STATUS_E_FAULT;
2219 }
2220
2221 /*------------------------------------------------------------------------
2222 Extract TL control block and check existance
2223 ------------------------------------------------------------------------*/
2224 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2225 if ( NULL == pTLCb )
2226 {
2227 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2228 "WLAN TL:Invalid TL pointer from pvosGCtx %s", __func__));
2229 return VOS_STATUS_E_FAULT;
2230 }
2231
2232 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
2233 {
2234 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2235 "WLAN TL:Client Memory was not allocated on %s", __func__));
2236 return VOS_STATUS_E_FAILURE;
2237 }
2238
2239 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
2240 {
2241 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
2242 "WLAN TL:Station was not previously registered %s", __func__));
2243 return VOS_STATUS_E_EXISTS;
2244 }
2245
2246 /*------------------------------------------------------------------------
2247 Update the IBSS BSSID
2248 ------------------------------------------------------------------------*/
2249 vos_mem_copy( &pTLCb->atlSTAClients[ucSTAId]->wSTADesc.vBSSIDforIBSS,
2250 pBssid, sizeof(v_MACADDR_t));
2251
2252 return VOS_STATUS_SUCCESS;
2253}
2254
Madan Mohan Koyyalamudifc1d1fe2012-10-18 15:07:12 -07002255/*===========================================================================
2256
Jeff Johnson295189b2012-06-20 16:38:30 -07002257 FUNCTION WLANTL_STAPktPending
2258
2259 DESCRIPTION
2260
2261 HDD will call this API when a packet is pending transmission in its
2262 queues.
2263
2264 DEPENDENCIES
2265
2266 A station must have been registered before the packet pending
2267 notification can be sent.
2268
2269 RESTRICTION: TL will not count packets for pending notification.
2270 HDD is expected to send the notification only when
2271 non-empty event gets triggered. Worst case scenario
2272 is that TL might end up making a call when Hdds
2273 queues are actually empty.
2274
2275 PARAMETERS
2276
2277 pvosGCtx: pointer to the global vos context; a handle to TL's
2278 control block can be extracted from its context
2279 ucSTAId: identifier for the STA that is pending transmission
2280
2281 RETURN VALUE
2282
2283 The result code associated with performing the operation
2284
2285 VOS_STATUS_E_INVAL: Input parameters are invalid
2286 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
2287 to TL cb is NULL ; access would cause a page fault
2288 VOS_STATUS_E_EXISTS: Station was not registered
2289 VOS_STATUS_SUCCESS: Everything is good :)
2290
2291 SIDE EFFECTS
2292
2293============================================================================*/
2294VOS_STATUS
2295WLANTL_STAPktPending
2296(
2297 v_PVOID_t pvosGCtx,
2298 v_U8_t ucSTAId,
2299 WLANTL_ACEnumType ucAc
2300)
2301{
2302 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302303 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002304 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2305
2306 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
2307 "WLAN TL:Packet pending indication for STA: %d AC: %d", ucSTAId, ucAc);
2308
2309 /*------------------------------------------------------------------------
2310 Sanity check
2311 ------------------------------------------------------------------------*/
2312 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
2313 {
2314 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2315 "WLAN TL:Invalid station id requested on WLANTL_STAPktPending"));
2316 return VOS_STATUS_E_FAULT;
2317 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002318 /*------------------------------------------------------------------------
2319 Extract TL control block and check existance
2320 ------------------------------------------------------------------------*/
2321 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2322 if ( NULL == pTLCb )
2323 {
2324 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2325 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STAPktPending"));
2326 return VOS_STATUS_E_FAULT;
2327 }
2328
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302329 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
2330
2331 if ( NULL == pClientSTA )
2332 {
2333 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2334 "WLAN TL:Client Memory was not allocated on %s", __func__));
2335 return VOS_STATUS_E_FAILURE;
2336 }
2337
2338 if ( 0 == pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07002339 {
Katya Nigamb130d572014-11-24 16:38:16 +05302340 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Jeff Johnson295189b2012-06-20 16:38:30 -07002341 "WLAN TL:Station was not previously registered on WLANTL_STAPktPending"));
2342 return VOS_STATUS_E_EXISTS;
2343 }
2344
2345 /*---------------------------------------------------------------------
2346 Temporary fix to enable TL to fetch packets when multiple peers join
2347 an IBSS. To fix CR177301. Needs to go away when the actual fix of
2348 going through all STA's in round robin fashion gets merged in from
2349 BT AMP branch.
2350 --------------------------------------------------------------------*/
2351 pTLCb->ucRegisteredStaId = ucSTAId;
2352
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302353 if( WLANTL_STA_CONNECTED == pClientSTA->tlState )
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07002354 { /* EAPOL_HI_PRIORITY : need to find out whether EAPOL is pending before
2355 WLANTL_FetchPacket()/WLANTL_TxConn() is called.
2356 change STA_AUTHENTICATED != tlState to CONNECTED == tlState
2357 to make sure TL is indeed waiting for EAPOL.
2358 Just in the case when STA got disconnected shortly after connectection */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302359 pClientSTA->ucEapolPktPending = 1;
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07002360
Katya Nigam42e16e82014-02-04 16:28:55 +05302361 MTRACE(vos_trace(VOS_MODULE_ID_TL,
2362 TRACE_CODE_TL_EAPOL_PKT_PENDING, ucSTAId, ucAc));
2363
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07002364 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07002365 "WLAN TL:Packet pending indication for STA: %d AC: %d State: %d",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302366 ucSTAId, ucAc, pClientSTA->tlState);
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07002367 }
2368
Jeff Johnson295189b2012-06-20 16:38:30 -07002369 /*-----------------------------------------------------------------------
2370 Enable this AC in the AC mask in order for TL to start servicing it
2371 Set packet pending flag
2372 To avoid race condition, serialize the updation of AC and AC mask
2373 through WLANTL_TX_STAID_AC_IND message.
2374 -----------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07002375
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302376 pClientSTA->aucACMask[ucAc] = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07002377
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302378 vos_atomic_set_U8( &pClientSTA->ucPktPending, 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07002379
2380 /*------------------------------------------------------------------------
2381 Check if there are enough resources for transmission and tx is not
2382 suspended.
2383 ------------------------------------------------------------------------*/
Nirav Shah4b53d4b2015-05-08 05:35:00 -07002384 if (( pTLCb->uResCount >= WDA_TLI_MIN_RES_DATA ) &&
2385 ( 0 == pTLCb->ucTxSuspended ))
Jeff Johnson295189b2012-06-20 16:38:30 -07002386 {
Katya Nigam42e16e82014-02-04 16:28:55 +05302387
Jeff Johnson295189b2012-06-20 16:38:30 -07002388 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
2389 "Issuing Xmit start request to BAL"));
2390 WDA_DS_StartXmit(pvosGCtx);
2391 }
2392 else
2393 {
2394 /*---------------------------------------------------------------------
2395 No error code is sent because TL will resume tx autonomously if
2396 resources become available or tx gets resumed
2397 ---------------------------------------------------------------------*/
Madan Mohan Koyyalamudi179e6fe2012-10-15 15:31:08 -07002398 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Jeff Johnson295189b2012-06-20 16:38:30 -07002399 "WLAN TL:Request to send but condition not met. Res: %d,Suspend: %d",
Madan Mohan Koyyalamudi48139e32012-10-11 14:43:56 -07002400 pTLCb->uResCount, pTLCb->ucTxSuspended );
Jeff Johnson295189b2012-06-20 16:38:30 -07002401 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002402 return VOS_STATUS_SUCCESS;
2403}/* WLANTL_STAPktPending */
2404
2405/*==========================================================================
2406
2407 FUNCTION WLANTL_SetSTAPriority
2408
2409 DESCRIPTION
2410
2411 TL exposes this API to allow upper layers a rough control over the
2412 priority of transmission for a given station when supporting multiple
2413 connections.
2414
2415 DEPENDENCIES
2416
2417 A station must have been registered before the change in priority can be
2418 called.
2419
2420 PARAMETERS
2421
2422 pvosGCtx: pointer to the global vos context; a handle to TL's
2423 control block can be extracted from its context
2424 ucSTAId: identifier for the STA that has to change priority
2425
2426 RETURN VALUE
2427
2428 The result code associated with performing the operation
2429
2430 VOS_STATUS_E_INVAL: Input parameters are invalid
2431 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
2432 to TL cb is NULL ; access would cause a page fault
2433 VOS_STATUS_E_EXISTS: Station was not registered
2434 VOS_STATUS_SUCCESS: Everything is good :)
2435
2436 SIDE EFFECTS
2437
2438============================================================================*/
2439VOS_STATUS
2440WLANTL_SetSTAPriority
2441(
2442 v_PVOID_t pvosGCtx,
2443 v_U8_t ucSTAId,
2444 WLANTL_STAPriorityType tlSTAPri
2445)
2446{
2447 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302448 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002449 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2450
2451 /*------------------------------------------------------------------------
2452 Sanity check
2453 ------------------------------------------------------------------------*/
2454 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
2455 {
2456 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2457 "WLAN TL:Invalid station id requested on WLANTL_SetSTAPriority"));
2458 return VOS_STATUS_E_FAULT;
2459 }
2460
2461 /*------------------------------------------------------------------------
2462 Extract TL control block
2463 ------------------------------------------------------------------------*/
2464 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2465 if ( NULL == pTLCb )
2466 {
2467 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2468 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SetSTAPriority"));
2469 return VOS_STATUS_E_FAULT;
2470 }
2471
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302472 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
2473
2474 if ( NULL == pClientSTA )
2475 {
2476 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2477 "WLAN TL:Client Memory was not allocated on %s", __func__));
2478 return VOS_STATUS_E_FAILURE;
2479 }
2480
2481 if ( 0 == pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07002482 {
2483 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2484 "WLAN TL:Station was not previously registered on WLANTL_SetSTAPriority"));
2485 return VOS_STATUS_E_EXISTS;
2486 }
2487
2488 /*------------------------------------------------------------------------
2489 Re-analize if lock is needed when adding multiple stations
2490 ------------------------------------------------------------------------*/
2491 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
2492 "WLAN TL:Changing state for STA Pri ID: %d from %d to %d",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302493 ucSTAId, pClientSTA->tlPri, tlSTAPri));
2494 pClientSTA->tlPri = tlSTAPri;
Jeff Johnson295189b2012-06-20 16:38:30 -07002495
2496 return VOS_STATUS_SUCCESS;
2497}/* WLANTL_SetSTAPriority */
2498
2499
2500/*----------------------------------------------------------------------------
2501 INTERACTION WITH BAP
2502 ---------------------------------------------------------------------------*/
2503
2504/*==========================================================================
2505
2506 FUNCTION WLANTL_RegisterBAPClient
2507
2508 DESCRIPTION
2509 Called by SME to register itself as client for non-data BT-AMP packets.
2510
2511 DEPENDENCIES
2512 TL must be initialized before this function can be called.
2513
2514 PARAMETERS
2515
2516 IN
2517 pvosGCtx: pointer to the global vos context; a handle to TL's
2518 or SME's control block can be extracted from its context
2519 pfnTlBAPRxFrm: pointer to the receive processing routine for non-data
2520 BT-AMP packets
2521 pfnFlushOpCompleteCb:
2522 pointer to the call back function, for the Flush operation
2523 completion.
2524
2525
2526 RETURN VALUE
2527
2528 The result code associated with performing the operation
2529
2530 VOS_STATUS_E_INVAL: Input parameters are invalid
2531 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
2532 to TL cb is NULL ; access would cause a page fault
2533 VOS_STATUS_E_EXISTS: BAL client was already registered
2534 VOS_STATUS_SUCCESS: Everything is good :)
2535
2536 SIDE EFFECTS
2537
2538============================================================================*/
2539VOS_STATUS
2540WLANTL_RegisterBAPClient
2541(
2542 v_PVOID_t pvosGCtx,
2543 WLANTL_BAPRxCBType pfnTlBAPRxFrm,
2544 WLANTL_FlushOpCompCBType pfnFlushOpCompleteCb
2545)
2546{
2547 WLANTL_CbType* pTLCb = NULL;
2548 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2549
2550 /*------------------------------------------------------------------------
2551 Sanity check
2552 ------------------------------------------------------------------------*/
2553 if ( NULL == pfnTlBAPRxFrm )
2554 {
2555 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2556 "WLAN TL:Invalid parameter sent on WLANTL_RegisterBAPClient"));
2557 return VOS_STATUS_E_INVAL;
2558 }
2559
2560 if ( NULL == pfnFlushOpCompleteCb )
2561 {
2562 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2563 "Invalid Flush Complete Cb parameter sent on WLANTL_RegisterBAPClient"));
2564 return VOS_STATUS_E_INVAL;
2565 }
2566
2567 /*------------------------------------------------------------------------
2568 Extract TL control block
2569 ------------------------------------------------------------------------*/
2570 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2571 if ( NULL == pTLCb )
2572 {
2573 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2574 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_RegisterBAPClient"));
2575 return VOS_STATUS_E_FAULT;
2576 }
2577
2578 /*------------------------------------------------------------------------
2579 Make sure this is the first registration attempt
2580 ------------------------------------------------------------------------*/
2581 if ( 0 != pTLCb->tlBAPClient.ucExists )
2582 {
2583 pTLCb->tlBAPClient.ucExists++;
2584 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2585 "WLAN TL:BAP client was already registered"));
2586 return VOS_STATUS_E_EXISTS;
2587 }
2588
2589 /*------------------------------------------------------------------------
2590 Register station with TL
2591 ------------------------------------------------------------------------*/
2592 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
2593 "WLAN TL:Registering BAP Client" ));
2594
2595 pTLCb->tlBAPClient.ucExists++;
2596
2597 if ( NULL != pfnTlBAPRxFrm )
2598 {
2599 pTLCb->tlBAPClient.pfnTlBAPRx = pfnTlBAPRxFrm;
2600 }
2601
2602 pTLCb->tlBAPClient.pfnFlushOpCompleteCb = pfnFlushOpCompleteCb;
2603
2604 pTLCb->tlBAPClient.vosPendingDataBuff = NULL;
2605
2606 return VOS_STATUS_SUCCESS;
2607}/* WLANTL_RegisterBAPClient */
2608
2609
2610/*==========================================================================
2611
2612 FUNCTION WLANTL_TxBAPFrm
2613
2614 DESCRIPTION
2615 BAP calls this when it wants to send a frame to the module
2616
2617 DEPENDENCIES
2618 BAP must be registered with TL before this function can be called.
2619
2620 RESTRICTION: BAP CANNOT push any packets to TL until it did not receive
2621 a tx complete from the previous packet, that means BAP
2622 sends one packet, wait for tx complete and then
2623 sends another one
2624
2625 If BAP sends another packet before TL manages to process the
2626 previously sent packet call will end in failure
2627
2628 PARAMETERS
2629
2630 IN
2631 pvosGCtx: pointer to the global vos context; a handle to TL's
2632 or BAP's control block can be extracted from its context
2633 vosDataBuff: pointer to the vOSS buffer containing the packet to be
2634 transmitted
2635 pMetaInfo: meta information about the packet
2636 pfnTlBAPTxComp: pointer to a transmit complete routine for notifying
2637 the result of the operation over the bus
2638
2639 RETURN VALUE
2640 The result code associated with performing the operation
2641
2642 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
2643 page fault
2644 VOS_STATUS_E_EXISTS: BAL client was not yet registered
2645 VOS_STATUS_E_BUSY: The previous BT-AMP packet was not yet transmitted
2646 VOS_STATUS_SUCCESS: Everything is good :)
2647
2648 Other failure messages may be returned from the BD header handling
2649 routines, please check apropriate API for more info.
2650
2651 SIDE EFFECTS
2652
2653============================================================================*/
2654VOS_STATUS
2655WLANTL_TxBAPFrm
2656(
2657 v_PVOID_t pvosGCtx,
2658 vos_pkt_t* vosDataBuff,
2659 WLANTL_MetaInfoType* pMetaInfo,
2660 WLANTL_TxCompCBType pfnTlBAPTxComp
2661)
2662{
2663 WLANTL_CbType* pTLCb = NULL;
2664 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
2665 v_MACADDR_t vDestMacAddr;
2666 v_U16_t usPktLen;
2667 v_U8_t ucStaId = 0;
2668 v_U8_t extraHeadSpace = 0;
2669 v_U8_t ucWDSEnabled = 0;
2670 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2671
2672 /*------------------------------------------------------------------------
2673 Sanity check
2674 Extract TL control block
2675 ------------------------------------------------------------------------*/
2676 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2677 if ( NULL == pTLCb )
2678 {
2679 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2680 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_TxBAPFrm"));
2681 return VOS_STATUS_E_FAULT;
2682 }
2683
2684 /*------------------------------------------------------------------------
2685 Ensure that BAP client was registered previously
2686 ------------------------------------------------------------------------*/
2687 if (( 0 == pTLCb->tlBAPClient.ucExists ) ||
2688 ( WLANTL_STA_ID_INVALID(pTLCb->tlBAPClient.ucBAPSTAId) ))
2689 {
2690 pTLCb->tlBAPClient.ucExists++;
2691 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2692 "WLAN TL:BAP client not register on WLANTL_TxBAPFrm"));
2693 return VOS_STATUS_E_EXISTS;
2694 }
2695
2696 /*------------------------------------------------------------------------
2697 Check if any BT-AMP Frm is pending
2698 ------------------------------------------------------------------------*/
2699 if ( NULL != pTLCb->tlBAPClient.vosPendingDataBuff )
2700 {
2701 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2702 "WLAN TL:BT-AMP Frame already pending tx in TL on WLANTL_TxBAPFrm"));
2703 return VOS_STATUS_E_BUSY;
2704 }
2705
2706 /*------------------------------------------------------------------------
2707 Save buffer and notify BAL; no lock is needed if the above restriction
2708 is met
2709 Save the tx complete fnct pointer as tl specific data in the vos buffer
2710 ------------------------------------------------------------------------*/
2711
2712 /*------------------------------------------------------------------------
2713 Translate 802.3 frame to 802.11
2714 ------------------------------------------------------------------------*/
2715 ucStaId = pTLCb->tlBAPClient.ucBAPSTAId;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302716 if ( NULL == pTLCb->atlSTAClients[ucStaId] )
2717 {
2718 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2719 "WLAN TL:Client Memory was not allocated on %s", __func__));
2720 return VOS_STATUS_E_FAILURE;
2721 }
2722 if (( 0 == pMetaInfo->ucDisableFrmXtl ) &&
2723 ( 0 != pTLCb->atlSTAClients[ucStaId]->wSTADesc.ucSwFrameTXXlation ))
Jeff Johnson295189b2012-06-20 16:38:30 -07002724 {
Kiran Venkatappacab0d352012-12-17 13:09:22 -08002725 vosStatus = WLANTL_Translate8023To80211Header( vosDataBuff, &vosStatus,
2726 pTLCb, &ucStaId,
Ravi Joshid0699502013-07-08 15:48:47 -07002727 pMetaInfo, &ucWDSEnabled,
2728 &extraHeadSpace);
Jeff Johnson295189b2012-06-20 16:38:30 -07002729
2730 if ( VOS_STATUS_SUCCESS != vosStatus )
2731 {
2732 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2733 "WLAN TL:Error when translating header WLANTL_TxBAPFrm"));
2734
2735 return vosStatus;
2736 }
2737
2738 pMetaInfo->ucDisableFrmXtl = 1;
2739 }
2740
2741 /*-------------------------------------------------------------------------
2742 Call HAL to fill BD header
2743 -------------------------------------------------------------------------*/
2744
2745 /* Adding Type, SubType which was missing for EAPOL from BAP */
2746 pMetaInfo->ucType |= (WLANTL_80211_DATA_TYPE << 4);
2747 pMetaInfo->ucType |= (WLANTL_80211_DATA_QOS_SUBTYPE);
2748
2749 vosStatus = WDA_DS_BuildTxPacketInfo( pvosGCtx, vosDataBuff ,
2750 &vDestMacAddr, pMetaInfo->ucDisableFrmXtl,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302751 &usPktLen, pTLCb->atlSTAClients[ucStaId]->wSTADesc.ucQosEnabled,
Jeff Johnson295189b2012-06-20 16:38:30 -07002752 ucWDSEnabled, extraHeadSpace, pMetaInfo->ucType,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302753 &pTLCb->atlSTAClients[ucStaId]->wSTADesc.vSelfMACAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07002754 pMetaInfo->ucTID, 0 /* No ACK */, pMetaInfo->usTimeStamp,
Ganesh Kondabattini10e67352015-03-16 17:41:57 +05302755 pMetaInfo->ucIsEapol || pMetaInfo->ucIsWai, pMetaInfo->ucUP,
2756 pMetaInfo->ucTxBdToken);
Jeff Johnson295189b2012-06-20 16:38:30 -07002757
2758 if ( VOS_STATUS_SUCCESS != vosStatus )
2759 {
2760 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2761 "WLAN TL:Failed while building TX header %d", vosStatus));
2762 return vosStatus;
2763 }
2764
2765 if ( NULL != pfnTlBAPTxComp )
2766 {
2767 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
2768 (v_PVOID_t)pfnTlBAPTxComp);
2769 }
2770 else
2771 {
2772 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
2773 (v_PVOID_t)WLANTL_TxCompDefaultCb);
2774
2775 }
2776
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05302777 vos_atomic_set( (uintptr_t*)&pTLCb->tlBAPClient.vosPendingDataBuff,
2778 (uintptr_t)vosDataBuff);
Jeff Johnson295189b2012-06-20 16:38:30 -07002779
2780 /*------------------------------------------------------------------------
2781 Check if thre are enough resources for transmission and tx is not
2782 suspended.
2783 ------------------------------------------------------------------------*/
2784 if (( pTLCb->uResCount >= WDA_TLI_MIN_RES_BAP ) &&
2785 ( 0 == pTLCb->ucTxSuspended ))
2786 {
2787 WDA_DS_StartXmit(pvosGCtx);
2788 }
2789 else
2790 {
2791 /*---------------------------------------------------------------------
2792 No error code is sent because TL will resume tx autonomously if
2793 resources become available or tx gets resumed
2794 ---------------------------------------------------------------------*/
2795 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
2796 "WLAN TL:Request to send from BAP but condition not met.Res: %d,"
2797 "Suspend: %d", pTLCb->uResCount, pTLCb->ucTxSuspended ));
2798 }
2799
2800 return VOS_STATUS_SUCCESS;
2801}/* WLANTL_TxBAPFrm */
2802
2803
2804/*----------------------------------------------------------------------------
2805 INTERACTION WITH SME
2806 ---------------------------------------------------------------------------*/
2807
2808/*==========================================================================
2809
2810 FUNCTION WLANTL_GetRssi
2811
2812 DESCRIPTION
2813 TL will extract the RSSI information from every data packet from the
2814 ongoing traffic and will store it. It will provide the result to SME
2815 upon request.
2816
2817 DEPENDENCIES
2818
2819 WARNING: the read and write of this value will not be protected
2820 by locks, therefore the information obtained after a read
2821 might not always be consistent.
2822
2823 PARAMETERS
2824
2825 IN
2826 pvosGCtx: pointer to the global vos context; a handle to TL's
2827 or SME's control block can be extracted from its context
2828 ucSTAId: station identifier for the requested value
2829
2830 OUT
2831 puRssi: the average value of the RSSI
2832
2833
2834 RETURN VALUE
2835 The result code associated with performing the operation
2836
2837 VOS_STATUS_E_INVAL: Input parameters are invalid
2838 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
2839 to TL cb is NULL ; access would cause a page fault
2840 VOS_STATUS_E_EXISTS: STA was not yet registered
2841 VOS_STATUS_SUCCESS: Everything is good :)
2842
2843 SIDE EFFECTS
2844
2845============================================================================*/
2846VOS_STATUS
2847WLANTL_GetRssi
2848(
2849 v_PVOID_t pvosGCtx,
2850 v_U8_t ucSTAId,
2851 v_S7_t* pRssi
2852)
2853{
2854 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302855 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002856 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2857
2858 /*------------------------------------------------------------------------
2859 Sanity check
2860 ------------------------------------------------------------------------*/
2861 if ( NULL == pRssi )
2862 {
2863 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2864 "WLAN TL:Invalid parameter sent on WLANTL_GetRssi"));
2865 return VOS_STATUS_E_INVAL;
2866 }
2867
2868 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
2869 {
2870 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2871 "WLAN TL:Invalid station id requested on WLANTL_GetRssi"));
2872 return VOS_STATUS_E_FAULT;
2873 }
2874
2875 /*------------------------------------------------------------------------
2876 Extract TL control block and check existance
2877 ------------------------------------------------------------------------*/
2878 pTLCb = VOS_GET_TL_CB(pvosGCtx);
2879 if ( NULL == pTLCb )
2880 {
2881 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2882 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetRssi"));
2883 return VOS_STATUS_E_FAULT;
2884 }
2885
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302886 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
2887
2888 if ( NULL == pClientSTA )
2889 {
2890 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2891 "WLAN TL:Client Memory was not allocated on %s", __func__));
2892 return VOS_STATUS_E_FAILURE;
2893 }
2894
2895 if ( 0 == pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07002896 {
2897 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2898 "WLAN TL:Station was not previously registered on WLANTL_GetRssi"));
2899 return VOS_STATUS_E_EXISTS;
2900 }
2901
2902 /*------------------------------------------------------------------------
2903 Copy will not be locked; please read restriction
2904 ------------------------------------------------------------------------*/
Katya Nigam5c2e5f62013-11-15 19:19:11 +05302905 if(pTLCb->isBMPS || IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002906 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302907 *pRssi = pClientSTA->rssiAvgBmps;
Jeff Johnson295189b2012-06-20 16:38:30 -07002908 /* Check If RSSI is zero because we are reading rssAvgBmps updated by HAL in
2909 previous GetStatsRequest. It may be updated as zero by Hal because EnterBmps
2910 might not have happend by that time. Hence reading the most recent Rssi
2911 calcluated by TL*/
2912 if(0 == *pRssi)
2913 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302914 *pRssi = pClientSTA->rssiAvg;
Jeff Johnson295189b2012-06-20 16:38:30 -07002915 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002916 }
2917 else
2918 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05302919 *pRssi = pClientSTA->rssiAvg;
Jeff Johnson295189b2012-06-20 16:38:30 -07002920 }
2921
2922 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Jeff Johnson32d95a32012-09-10 13:15:23 -07002923 "WLAN TL:WLANTL_GetRssi for STA: %d RSSI: %d%s",
2924 ucSTAId, *pRssi,
2925 pTLCb->isBMPS ? " in BMPS" : ""));
Jeff Johnson295189b2012-06-20 16:38:30 -07002926
2927 return VOS_STATUS_SUCCESS;
2928}/* WLANTL_GetRssi */
2929
2930/*==========================================================================
2931
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05302932 FUNCTION WLANTL_GetSnr
2933
2934 DESCRIPTION
2935 TL will extract the SNR information from every data packet from the
2936 ongoing traffic and will store it. It will provide the result to SME
2937 upon request.
2938
2939 DEPENDENCIES
2940
2941 WARNING: the read and write of this value will not be protected
2942 by locks, therefore the information obtained after a read
2943 might not always be consistent.
2944
2945 PARAMETERS
2946
2947 IN
2948 pvosGCtx: pointer to the global vos context; a handle to TL's
2949 or SME's control block can be extracted from its context
2950 ucSTAId: station identifier for the requested value
2951
2952 OUT
2953 pSnr: the average value of the SNR
2954
2955
2956 RETURN VALUE
2957 The result code associated with performing the operation
2958
2959 VOS_STATUS_E_INVAL: Input parameters are invalid
2960 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
2961 to TL cb is NULL ; access would cause a page fault
2962 VOS_STATUS_E_EXISTS: STA was not yet registered
2963 VOS_STATUS_SUCCESS: Everything is good :)
2964
2965 SIDE EFFECTS
2966
2967============================================================================*/
2968VOS_STATUS
2969WLANTL_GetSnr
2970(
2971 tANI_U8 ucSTAId,
2972 tANI_S8* pSnr
2973)
2974{
2975 WLANTL_CbType* pTLCb = NULL;
2976 WLANTL_STAClientType* pClientSTA = NULL;
2977 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
2978
2979 /*------------------------------------------------------------------------
2980 Sanity check
2981 ------------------------------------------------------------------------*/
2982 if (NULL == pSnr)
2983 {
2984 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2985 "WLAN TL:Invalid parameter sent on %s", __func__));
2986 return VOS_STATUS_E_INVAL;
2987 }
2988
2989 if (WLANTL_STA_ID_INVALID(ucSTAId))
2990 {
2991 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
2992 "WLAN TL:Invalid station id requested on %s", __func__));
2993 return VOS_STATUS_E_FAULT;
2994 }
2995
2996 /*------------------------------------------------------------------------
2997 Extract TL control block and check existance
2998 ------------------------------------------------------------------------*/
2999 pTLCb = VOS_GET_TL_CB(vos_get_global_context(VOS_MODULE_ID_TL, NULL));
3000 if (NULL == pTLCb)
3001 {
3002 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3003 "WLAN TL:Invalid TL pointer from pvosGCtx on %s", __func__));
3004 return VOS_STATUS_E_FAULT;
3005 }
3006
3007 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
3008
3009 if (NULL == pClientSTA)
3010 {
3011 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3012 "WLAN TL:Client Memory was not allocated on %s", __func__));
3013 return VOS_STATUS_E_FAILURE;
3014 }
3015
3016 if (0 == pClientSTA->ucExists)
3017 {
3018 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3019 "WLAN TL:Station was not previously registered on %s", __func__));
3020 return VOS_STATUS_E_EXISTS;
3021 }
3022
3023 /*------------------------------------------------------------------------
3024 Copy will not be locked; please read restriction
3025 ------------------------------------------------------------------------*/
3026 if (pTLCb->isBMPS)
3027 {
3028 *pSnr = pClientSTA->snrAvgBmps;
3029 }
3030 else
3031 {
3032 /* SNR is averaged over WLANTL_MAX_SNR_DATA_SAMPLES, if there are not enough
3033 * data samples (snridx) to calculate the average then return the
3034 * average for the window of prevoius 20 packets. And if there aren't
3035 * enough samples and the average for previous window of 20 packets is
3036 * not available then return a predefined value
3037 *
3038 * NOTE: the SNR_HACK_BMPS value is defined to 127, documents from HW
3039 * team reveal that the SNR value has a ceiling well below 127 dBm,
3040 * so if SNR has value of 127 the userspace applications can know that
3041 * the SNR has not been computed yet because enough data was not
3042 * available for SNR calculation
3043 */
3044 if (pClientSTA->snrIdx > (WLANTL_MAX_SNR_DATA_SAMPLES/2)
3045 || !(pClientSTA->prevSnrAvg))
3046 {
3047 *pSnr = pClientSTA->snrSum / pClientSTA->snrIdx;
3048 }
3049 else if (pClientSTA->prevSnrAvg)
3050 {
3051 *pSnr = pClientSTA->prevSnrAvg;
3052 }
3053 else
3054 {
3055 *pSnr = SNR_HACK_BMPS;
3056 }
3057 }
3058
3059 VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3060 "WLAN TL:WLANTL_GetSnr for STA: %d SNR: %d%s",
3061 ucSTAId, *pSnr,
3062 pTLCb->isBMPS ? " in BMPS" : "");
3063
3064 return VOS_STATUS_SUCCESS;
3065}/* WLANTL_GetSnr */
3066/*==========================================================================
3067
Jeff Johnson295189b2012-06-20 16:38:30 -07003068 FUNCTION WLANTL_GetLinkQuality
3069
3070 DESCRIPTION
3071 TL will extract the SNR information from every data packet from the
3072 ongoing traffic and will store it. It will provide the result to SME
3073 upon request.
3074
3075 DEPENDENCIES
3076
3077 WARNING: the read and write of this value will not be protected
3078 by locks, therefore the information obtained after a read
3079 might not always be consistent.
3080
3081 PARAMETERS
3082
3083 IN
3084 pvosGCtx: pointer to the global vos context; a handle to TL's
3085 or SME's control block can be extracted from its context
3086 ucSTAId: station identifier for the requested value
3087
3088 OUT
3089 puLinkQuality: the average value of the SNR
3090
3091
3092 RETURN VALUE
3093 The result code associated with performing the operation
3094
3095 VOS_STATUS_E_INVAL: Input parameters are invalid
3096 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
3097 to TL cb is NULL ; access would cause a page fault
3098 VOS_STATUS_E_EXISTS: STA was not yet registered
3099 VOS_STATUS_SUCCESS: Everything is good :)
3100
3101 SIDE EFFECTS
3102
3103============================================================================*/
3104VOS_STATUS
3105WLANTL_GetLinkQuality
3106(
3107 v_PVOID_t pvosGCtx,
3108 v_U8_t ucSTAId,
3109 v_U32_t* puLinkQuality
3110)
3111{
3112 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05303113 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003114
3115 /*------------------------------------------------------------------------
3116 Sanity check
3117 ------------------------------------------------------------------------*/
3118 if ( NULL == puLinkQuality )
3119 {
3120 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3121 "Invalid parameter sent on WLANTL_GetLinkQuality"));
3122 return VOS_STATUS_E_INVAL;
3123 }
3124
3125 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
3126 {
3127 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3128 "Invalid station id requested on WLANTL_GetLinkQuality"));
3129 return VOS_STATUS_E_FAULT;
3130 }
3131
3132 /*------------------------------------------------------------------------
3133 Extract TL control block and check existance
3134 ------------------------------------------------------------------------*/
3135 pTLCb = VOS_GET_TL_CB(pvosGCtx);
3136 if ( NULL == pTLCb )
3137 {
3138 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3139 "Invalid TL pointer from pvosGCtx on WLANTL_GetLinkQuality"));
3140 return VOS_STATUS_E_FAULT;
3141 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05303142 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
Jeff Johnson295189b2012-06-20 16:38:30 -07003143
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05303144 if ( NULL == pClientSTA )
3145 {
3146 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3147 "WLAN TL:Client Memory was not allocated on %s", __func__));
3148 return VOS_STATUS_E_FAILURE;
3149 }
3150
3151 if ( 0 == pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07003152 {
3153 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3154 "Station was not previously registered on WLANTL_GetLinkQuality"));
3155 return VOS_STATUS_E_EXISTS;
3156 }
3157
3158 /*------------------------------------------------------------------------
3159 Copy will not be locked; please read restriction
3160 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05303161 *puLinkQuality = pClientSTA->uLinkQualityAvg;
Jeff Johnson295189b2012-06-20 16:38:30 -07003162
3163 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3164 "WLANTL_GetLinkQuality for STA: %d LinkQuality: %d", ucSTAId, *puLinkQuality));
3165
3166 return VOS_STATUS_SUCCESS;
3167}/* WLANTL_GetLinkQuality */
3168
3169/*==========================================================================
3170
3171 FUNCTION WLANTL_FlushStaTID
3172
3173 DESCRIPTION
3174 TL provides this API as an interface to SME (BAP) layer. TL inturn posts a
3175 message to HAL. This API is called by the SME inorder to perform a flush
3176 operation.
3177
3178 DEPENDENCIES
3179
3180 PARAMETERS
3181
3182 IN
3183 pvosGCtx: pointer to the global vos context; a handle to TL's
3184 or SME's control block can be extracted from its context
3185 ucSTAId: station identifier for the requested value
3186 ucTid: Tspec ID for the new BA session
3187
3188 OUT
3189 The response for this post is received in the main thread, via a response
3190 message from HAL to TL.
3191
3192 RETURN VALUE
3193 VOS_STATUS_SUCCESS: Everything is good :)
3194
3195 SIDE EFFECTS
3196============================================================================*/
3197VOS_STATUS
3198WLANTL_FlushStaTID
3199(
3200 v_PVOID_t pvosGCtx,
3201 v_U8_t ucSTAId,
3202 v_U8_t ucTid
3203)
3204{
3205 WLANTL_CbType* pTLCb = NULL;
3206 tpFlushACReq FlushACReqPtr = NULL;
3207 vos_msg_t vosMessage;
3208
3209
3210 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
3211 {
3212 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3213 "Invalid station id requested on WLANTL_FlushStaTID"));
3214 return VOS_STATUS_E_FAULT;
3215 }
3216
3217 /*------------------------------------------------------------------------
3218 Extract TL control block and check existance
3219 ------------------------------------------------------------------------*/
3220 pTLCb = VOS_GET_TL_CB(pvosGCtx);
3221 if ( NULL == pTLCb )
3222 {
3223 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3224 "Invalid TL pointer from pvosGCtx on WLANTL_FlushStaTID"));
3225 return VOS_STATUS_E_FAULT;
3226 }
3227
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05303228 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
3229 {
3230 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3231 "WLAN TL:Client Memory was not allocated on %s", __func__));
3232 return VOS_STATUS_E_FAILURE;
3233 }
3234
3235 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07003236 {
3237 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3238 "Station was not previously registered on WLANTL_FlushStaTID"));
3239 return VOS_STATUS_E_EXISTS;
3240 }
3241
3242 /*------------------------------------------------------------------------
3243 We need to post a message with the STA, TID value to HAL. HAL performs the flush
3244 ------------------------------------------------------------------------*/
3245 FlushACReqPtr = vos_mem_malloc(sizeof(tFlushACReq));
3246
3247 if ( NULL == FlushACReqPtr )
3248 {
3249 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3250 "WLAN TL: fatal failure, cannot allocate Flush Req structure"));
3251 VOS_ASSERT(0);
3252 return VOS_STATUS_E_NOMEM;
3253 }
3254
3255 // Start constructing the message for HAL
3256 FlushACReqPtr->mesgType = SIR_TL_HAL_FLUSH_AC_REQ;
3257 FlushACReqPtr->mesgLen = sizeof(tFlushACReq);
3258 FlushACReqPtr->mesgLen = sizeof(tFlushACReq);
3259 FlushACReqPtr->ucSTAId = ucSTAId;
3260 FlushACReqPtr->ucTid = ucTid;
3261
3262 vosMessage.type = WDA_TL_FLUSH_AC_REQ;
3263 vosMessage.bodyptr = (void *)FlushACReqPtr;
3264
3265 vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
3266 return VOS_STATUS_SUCCESS;
3267}
3268
3269
3270/*----------------------------------------------------------------------------
3271 INTERACTION WITH PE
3272 ---------------------------------------------------------------------------*/
Siddharth Bhal4551b102014-10-09 21:36:36 +05303273/*==========================================================================
Jeff Johnson295189b2012-06-20 16:38:30 -07003274
Siddharth Bhal4551b102014-10-09 21:36:36 +05303275 FUNCTION WLANTL_updateSpoofMacAddr
3276
3277 DESCRIPTION
3278 Called by HDD to update macaddr
3279
3280 DEPENDENCIES
3281 TL must be initialized before this API can be called.
3282
3283 PARAMETERS
3284
3285 IN
3286 pvosGCtx: pointer to the global vos context; a handle to
3287 TL's control block can be extracted from its context
3288 spoofMacAddr: spoofed mac adderess
3289 selfMacAddr: self Mac Address
3290
3291 RETURN VALUE
3292 The result code associated with performing the operation
3293
3294 VOS_STATUS_E_INVAL: Input parameters are invalid
3295 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
3296 page fault
3297 VOS_STATUS_SUCCESS: Everything is good :)
3298
3299 SIDE EFFECTS
3300
3301============================================================================*/
3302VOS_STATUS
3303WLANTL_updateSpoofMacAddr
3304(
3305 v_PVOID_t pvosGCtx,
3306 v_MACADDR_t* spoofMacAddr,
3307 v_MACADDR_t* selfMacAddr
3308)
3309{
3310 WLANTL_CbType* pTLCb = NULL;
3311 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3312
3313 /*------------------------------------------------------------------------
Siddharth Bhal4551b102014-10-09 21:36:36 +05303314 Extract TL control block
3315 ------------------------------------------------------------------------*/
3316 pTLCb = VOS_GET_TL_CB(pvosGCtx);
3317 if ( NULL == pTLCb )
3318 {
3319 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3320 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState");
3321 return VOS_STATUS_E_FAULT;
3322 }
3323
3324 vos_mem_copy(pTLCb->spoofMacAddr.selfMac.bytes, selfMacAddr,
3325 VOS_MAC_ADDRESS_LEN);
3326 vos_mem_copy(pTLCb->spoofMacAddr.spoofMac.bytes, spoofMacAddr,
3327 VOS_MAC_ADDRESS_LEN);
3328
3329 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
3330 "TL: SelfSTA mac Addr for current Scan "MAC_ADDRESS_STR,
3331 MAC_ADDR_ARRAY(pTLCb->spoofMacAddr.selfMac.bytes));
3332
3333 return VOS_STATUS_SUCCESS;
3334}/* WLANTL_updateSpoofMacAddr */
Jeff Johnson295189b2012-06-20 16:38:30 -07003335/*==========================================================================
3336
3337 FUNCTION WLANTL_RegisterMgmtFrmClient
3338
3339 DESCRIPTION
3340 Called by PE to register as a client for management frames delivery.
3341
3342 DEPENDENCIES
3343 TL must be initialized before this API can be called.
3344
3345 PARAMETERS
3346
3347 IN
3348 pvosGCtx: pointer to the global vos context; a handle to
3349 TL's control block can be extracted from its context
3350 pfnTlMgmtFrmRx: pointer to the receive processing routine for
3351 management frames
3352
3353 RETURN VALUE
3354 The result code associated with performing the operation
3355
3356 VOS_STATUS_E_INVAL: Input parameters are invalid
3357 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
3358 page fault
3359 VOS_STATUS_E_EXISTS: Mgmt Frame client was already registered
3360 VOS_STATUS_SUCCESS: Everything is good :)
3361
3362 SIDE EFFECTS
3363
3364============================================================================*/
3365VOS_STATUS
3366WLANTL_RegisterMgmtFrmClient
3367(
3368 v_PVOID_t pvosGCtx,
3369 WLANTL_MgmtFrmRxCBType pfnTlMgmtFrmRx
3370)
3371{
3372 WLANTL_CbType* pTLCb = NULL;
3373 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3374
3375 /*------------------------------------------------------------------------
3376 Sanity check
3377 ------------------------------------------------------------------------*/
3378 if ( NULL == pfnTlMgmtFrmRx )
3379 {
3380 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3381 "WLAN TL:Invalid parameter sent on WLANTL_RegisterMgmtFrmClient"));
3382 return VOS_STATUS_E_INVAL;
3383 }
3384
3385 /*------------------------------------------------------------------------
3386 Extract TL control block
3387 ------------------------------------------------------------------------*/
3388 pTLCb = VOS_GET_TL_CB(pvosGCtx);
3389 if ( NULL == pTLCb )
3390 {
3391 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3392 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
3393 return VOS_STATUS_E_FAULT;
3394 }
3395
3396 /*------------------------------------------------------------------------
3397 Make sure this is the first registration attempt
3398 ------------------------------------------------------------------------*/
3399 if ( 0 != pTLCb->tlMgmtFrmClient.ucExists )
3400 {
3401 pTLCb->tlMgmtFrmClient.ucExists++;
3402 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3403 "WLAN TL:Management frame client was already registered"));
3404 return VOS_STATUS_E_EXISTS;
3405 }
3406
3407 /*------------------------------------------------------------------------
3408 Register station with TL
3409 ------------------------------------------------------------------------*/
3410 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3411 "WLAN TL:Registering Management Frame Client" ));
3412
3413 pTLCb->tlMgmtFrmClient.ucExists++;
3414
3415 if ( NULL != pfnTlMgmtFrmRx )
3416 {
3417 pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx = pfnTlMgmtFrmRx;
3418 }
3419
3420 pTLCb->tlMgmtFrmClient.vosPendingDataBuff = NULL;
3421
3422 return VOS_STATUS_SUCCESS;
3423}/* WLANTL_RegisterMgmtFrmClient */
3424
3425/*==========================================================================
3426
3427 FUNCTION WLANTL_DeRegisterMgmtFrmClient
3428
3429 DESCRIPTION
3430 Called by PE to deregister as a client for management frames delivery.
3431
3432 DEPENDENCIES
3433 TL must be initialized before this API can be called.
3434
3435 PARAMETERS
3436
3437 IN
3438 pvosGCtx: pointer to the global vos context; a handle to
3439 TL's control block can be extracted from its context
3440 RETURN VALUE
3441 The result code associated with performing the operation
3442
3443 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
3444 page fault
3445 VOS_STATUS_E_EXISTS: Mgmt Frame client was never registered
3446 VOS_STATUS_SUCCESS: Everything is good :)
3447
3448 SIDE EFFECTS
3449
3450============================================================================*/
3451VOS_STATUS
3452WLANTL_DeRegisterMgmtFrmClient
3453(
3454 v_PVOID_t pvosGCtx
3455)
3456{
3457 WLANTL_CbType* pTLCb = NULL;
3458 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3459
3460 /*------------------------------------------------------------------------
3461 Extract TL control block
3462 ------------------------------------------------------------------------*/
3463 pTLCb = VOS_GET_TL_CB(pvosGCtx);
3464 if ( NULL == pTLCb )
3465 {
3466 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3467 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
3468 return VOS_STATUS_E_FAULT;
3469 }
3470
3471 /*------------------------------------------------------------------------
3472 Make sure this is the first registration attempt
3473 ------------------------------------------------------------------------*/
3474 if ( 0 == pTLCb->tlMgmtFrmClient.ucExists )
3475 {
3476 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3477 "WLAN TL:Management frame client was never registered"));
3478 return VOS_STATUS_E_EXISTS;
3479 }
3480
3481 /*------------------------------------------------------------------------
3482 Clear registration with TL
3483 ------------------------------------------------------------------------*/
3484 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3485 "WLAN TL:Deregistering Management Frame Client" ));
3486
3487 pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx = WLANTL_MgmtFrmRxDefaultCb;
3488 if ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff)
3489 {
3490 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
3491 "WLAN TL:Management cache buffer not empty on deregistering"
3492 " - dropping packet" ));
3493 vos_pkt_return_packet(pTLCb->tlMgmtFrmClient.vosPendingDataBuff);
3494
3495 pTLCb->tlMgmtFrmClient.vosPendingDataBuff = NULL;
3496 }
3497
3498 pTLCb->tlMgmtFrmClient.ucExists = 0;
3499
3500 return VOS_STATUS_SUCCESS;
3501}/* WLANTL_RegisterMgmtFrmClient */
3502
3503/*==========================================================================
3504
3505 FUNCTION WLANTL_TxMgmtFrm
3506
3507 DESCRIPTION
3508 Called by PE when it want to send out a management frame.
3509 HAL will also use this API for the few frames it sends out, they are not
3510 management frames howevere it is accepted that an exception will be
3511 allowed ONLY for the usage of HAL.
3512 Generic data frames SHOULD NOT travel through this function.
3513
3514 DEPENDENCIES
3515 TL must be initialized before this API can be called.
3516
3517 RESTRICTION: If PE sends another packet before TL manages to process the
3518 previously sent packet call will end in failure
3519
3520 Frames comming through here must be 802.11 frames, frame
3521 translation in UMA will be automatically disabled.
3522
3523 PARAMETERS
3524
3525 IN
3526 pvosGCtx: pointer to the global vos context;a handle to TL's
3527 control block can be extracted from its context
3528 vosFrmBuf: pointer to a vOSS buffer containing the management
3529 frame to be transmitted
3530 usFrmLen: the length of the frame to be transmitted; information
3531 is already included in the vOSS buffer
3532 wFrmType: the type of the frame being transmitted
3533 tid: tid used to transmit this frame
3534 pfnCompTxFunc: function pointer to the transmit complete routine
3535 pvBDHeader: pointer to the BD header, if NULL it means it was not
3536 yet constructed and it lies within TL's responsibility
3537 to do so; if not NULL it is expected that it was
3538 already packed inside the vos packet
3539 ucAckResponse: flag notifying it an interrupt is needed for the
3540 acknowledgement received when the frame is sent out
3541 the air and ; the interrupt will be processed by HAL,
3542 only one such frame can be pending in the system at
3543 one time.
3544
3545
3546 RETURN VALUE
3547 The result code associated with performing the operation
3548
3549 VOS_STATUS_E_INVAL: Input parameters are invalid
3550 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
3551 page fault
3552 VOS_STATUS_E_EXISTS: Mgmt Frame client was not yet registered
3553 VOS_STATUS_E_BUSY: The previous Mgmt packet was not yet transmitted
3554 VOS_STATUS_SUCCESS: Everything is good :)
3555
3556 Other failure messages may be returned from the BD header handling
3557 routines, please check apropriate API for more info.
3558
3559 SIDE EFFECTS
3560
3561============================================================================*/
3562VOS_STATUS
3563WLANTL_TxMgmtFrm
3564(
3565 v_PVOID_t pvosGCtx,
3566 vos_pkt_t* vosFrmBuf,
3567 v_U16_t usFrmLen,
3568 v_U8_t wFrmType,
3569 v_U8_t ucTid,
3570 WLANTL_TxCompCBType pfnCompTxFunc,
3571 v_PVOID_t pvBDHeader,
Ganesh Kondabattini10e67352015-03-16 17:41:57 +05303572 v_U32_t ucAckResponse,
3573 v_U32_t ucTxBdToken
Jeff Johnson295189b2012-06-20 16:38:30 -07003574)
3575{
3576 WLANTL_CbType* pTLCb = NULL;
3577 v_MACADDR_t vDestMacAddr;
3578 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
3579 v_U16_t usPktLen;
3580 v_U32_t usTimeStamp = 0;
3581 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3582
3583 /*------------------------------------------------------------------------
3584 Sanity check
3585 ------------------------------------------------------------------------*/
3586 if ( NULL == vosFrmBuf )
3587 {
3588 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3589 "WLAN TL:Invalid parameter sent on WLANTL_TxMgmtFrm"));
3590 return VOS_STATUS_E_INVAL;
3591 }
3592
3593 /*------------------------------------------------------------------------
3594 Extract TL control block
3595 ------------------------------------------------------------------------*/
3596 pTLCb = VOS_GET_TL_CB(pvosGCtx);
3597 if ( NULL == pTLCb )
3598 {
3599 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
3600 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_TxMgmtFrm"));
3601 return VOS_STATUS_E_FAULT;
3602 }
3603
3604 /*------------------------------------------------------------------------
3605 Ensure that management frame client was previously registered
3606 ------------------------------------------------------------------------*/
3607 if ( 0 == pTLCb->tlMgmtFrmClient.ucExists )
3608 {
3609 pTLCb->tlMgmtFrmClient.ucExists++;
3610 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
3611 "WLAN TL:Management Frame client not register on WLANTL_TxMgmtFrm"));
3612 return VOS_STATUS_E_EXISTS;
3613 }
3614
3615 /*------------------------------------------------------------------------
3616 Check if any Mgmt Frm is pending
3617 ------------------------------------------------------------------------*/
3618 //vosTempBuff = pTLCb->tlMgmtFrmClient.vosPendingDataBuff;
3619 if ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff )
3620 {
3621
3622 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
3623 "WLAN TL:Management Frame already pending tx in TL: failing old one"));
3624
3625
3626 /*Failing the tx for the previous packet enqued by PE*/
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05303627 //vos_atomic_set( (uintptr_t*)&pTLCb->tlMgmtFrmClient.vosPendingDataBuff,
3628 // (uintptr_t)NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07003629
3630 //vos_pkt_get_user_data_ptr( vosTempBuff, VOS_PKT_USER_DATA_ID_TL,
3631 // (v_PVOID_t)&pfnTxComp);
3632
3633 /*it should never be NULL - default handler should be registered if none*/
3634 //if ( NULL == pfnTxComp )
3635 //{
3636 // VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3637 // "NULL pointer to Tx Complete on WLANTL_TxMgmtFrm");
3638 // VOS_ASSERT(0);
3639 // return VOS_STATUS_E_FAULT;
3640 //}
3641
3642 //pfnTxComp( pvosGCtx, vosTempBuff, VOS_STATUS_E_RESOURCES );
3643 //return VOS_STATUS_E_BUSY;
3644
3645
3646 //pfnCompTxFunc( pvosGCtx, vosFrmBuf, VOS_STATUS_E_RESOURCES);
3647 return VOS_STATUS_E_RESOURCES;
3648 }
3649
3650
3651 /*------------------------------------------------------------------------
3652 Check if BD header was build, if not construct
3653 ------------------------------------------------------------------------*/
3654 if ( NULL == pvBDHeader )
3655 {
3656 v_MACADDR_t* pvAddr2MacAddr;
3657 v_U8_t uQosHdr = VOS_FALSE;
3658
3659 /* Get address 2 of Mangement Frame to give to WLANHAL_FillTxBd */
3660 vosStatus = vos_pkt_peek_data( vosFrmBuf,
3661 WLANTL_MAC_ADDR_ALIGN(1) + VOS_MAC_ADDR_SIZE,
3662 (v_PVOID_t)&pvAddr2MacAddr, VOS_MAC_ADDR_SIZE);
3663
3664 if ( VOS_STATUS_SUCCESS != vosStatus )
3665 {
3666 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
3667 "WLAN TL:Failed while attempting to get addr2 %d", vosStatus));
3668 return vosStatus;
3669 }
Gopichand Nakkala0f3eb5c2013-05-07 16:48:38 +05303670
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003671 /* ESE IAPP/TDLS Frame which are data frames but technically used
Jeff Johnson295189b2012-06-20 16:38:30 -07003672 * for management functionality comes through route.
3673 */
3674 if (WLANTL_IS_QOS_DATA_FRAME(wFrmType)) \
3675 {
3676 uQosHdr = VOS_TRUE;
3677 }
Siddharth Bhal4551b102014-10-09 21:36:36 +05303678
3679 if (WLANTL_IS_PROBE_REQ(wFrmType))
3680 {
3681 if (VOS_TRUE == vos_mem_compare((v_VOID_t*) pvAddr2MacAddr,
3682 (v_VOID_t*) &pTLCb->spoofMacAddr.spoofMac, VOS_MAC_ADDRESS_LEN))
3683 {
3684 pvAddr2MacAddr = (v_PVOID_t)pTLCb->spoofMacAddr.selfMac.bytes;
3685 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
3686 "TL: using self sta addr to get staidx for spoofed probe req "
3687 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pvAddr2MacAddr->bytes));
3688 }
3689 }
3690
Jeff Johnson295189b2012-06-20 16:38:30 -07003691 /*----------------------------------------------------------------------
3692 Call WDA to build TX header
3693 ----------------------------------------------------------------------*/
3694 vosStatus = WDA_DS_BuildTxPacketInfo( pvosGCtx, vosFrmBuf , &vDestMacAddr,
3695 1 /* always 802.11 frames*/, &usPktLen, uQosHdr /*qos not enabled !!!*/,
Siddharth Bhal4551b102014-10-09 21:36:36 +05303696 0 /* WDS off */, 0, wFrmType, pvAddr2MacAddr, ucTid,
Ganesh Kondabattini10e67352015-03-16 17:41:57 +05303697 ucAckResponse, usTimeStamp, 0, 0, ucTxBdToken);
Jeff Johnson295189b2012-06-20 16:38:30 -07003698
3699
3700 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
3701 {
3702 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
3703 "WLAN TL:Failed while attempting to build TX header %d", vosStatus));
3704 return vosStatus;
3705 }
3706 }/* if BD header not present */
3707
3708 /*------------------------------------------------------------------------
3709 Save buffer and notify BAL; no lock is needed if the above restriction
3710 is met
3711 Save the tx complete fnct pointer as tl specific data in the vos buffer
3712 ------------------------------------------------------------------------*/
3713 if ( NULL != pfnCompTxFunc )
3714 {
3715 vos_pkt_set_user_data_ptr( vosFrmBuf, VOS_PKT_USER_DATA_ID_TL,
3716 (v_PVOID_t)pfnCompTxFunc);
3717 }
3718 else
3719 {
3720 vos_pkt_set_user_data_ptr( vosFrmBuf, VOS_PKT_USER_DATA_ID_TL,
3721 (v_PVOID_t)WLANTL_TxCompDefaultCb);
3722
3723 }
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05303724 vos_atomic_set( (uintptr_t*)&pTLCb->tlMgmtFrmClient.vosPendingDataBuff,
3725 (uintptr_t)vosFrmBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003726
3727 /*------------------------------------------------------------------------
3728 Check if thre are enough resources for transmission and tx is not
3729 suspended.
3730 ------------------------------------------------------------------------*/
3731 if ( pTLCb->uResCount >= WDA_TLI_MIN_RES_MF )
3732 {
3733 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3734 "WLAN TL:Issuing Xmit start request to BAL for MGMT"));
3735 vosStatus = WDA_DS_StartXmit(pvosGCtx);
3736 if(VOS_STATUS_SUCCESS != vosStatus)
3737 {
3738 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
3739 "WLAN TL:WDA_DS_StartXmit fails. vosStatus %d", vosStatus));
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05303740 vos_atomic_set( (uintptr_t*)&pTLCb->tlMgmtFrmClient.vosPendingDataBuff,0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003741 }
3742 return vosStatus;
3743
3744 }
3745 else
3746 {
3747 /*---------------------------------------------------------------------
3748 No error code is sent because TL will resume tx autonomously if
3749 resources become available or tx gets resumed
3750 ---------------------------------------------------------------------*/
3751 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
3752 "WLAN TL:Request to send for Mgmt Frm but condition not met. Res: %d",
3753 pTLCb->uResCount));
3754 }
3755
3756 return VOS_STATUS_SUCCESS;
3757}/* WLANTL_TxMgmtFrm */
3758
3759/*----------------------------------------------------------------------------
3760 INTERACTION WITH HAL
3761 ---------------------------------------------------------------------------*/
3762
3763/*==========================================================================
3764
3765 FUNCTION WLANTL_ResetNotification
3766
3767 DESCRIPTION
3768 HAL notifies TL when the module is being reset.
3769 Currently not used.
3770
3771 DEPENDENCIES
3772
3773 PARAMETERS
3774
3775 IN
3776 pvosGCtx: pointer to the global vos context; a handle to TL's
3777 control block can be extracted from its context
3778
3779
3780 RETURN VALUE
3781 The result code associated with performing the operation
3782
3783 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
3784 page fault
3785 VOS_STATUS_SUCCESS: Everything is good :)
3786
3787 SIDE EFFECTS
3788
3789============================================================================*/
3790VOS_STATUS
3791WLANTL_ResetNotification
3792(
3793 v_PVOID_t pvosGCtx
3794)
3795{
3796 WLANTL_CbType* pTLCb = NULL;
3797 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3798
3799 /*------------------------------------------------------------------------
3800 Sanity check
3801 Extract TL control block
3802 ------------------------------------------------------------------------*/
3803 pTLCb = VOS_GET_TL_CB(pvosGCtx);
3804 if ( NULL == pTLCb )
3805 {
3806 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3807 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ResetNotification"));
3808 return VOS_STATUS_E_FAULT;
3809 }
3810
3811 WLANTL_CleanCB(pTLCb, 1 /*empty all queues and pending packets*/);
3812 return VOS_STATUS_SUCCESS;
3813}/* WLANTL_ResetNotification */
3814
3815/*==========================================================================
3816
3817 FUNCTION WLANTL_SuspendDataTx
3818
3819 DESCRIPTION
3820 HAL calls this API when it wishes to suspend transmission for a
3821 particular STA.
3822
3823 DEPENDENCIES
3824 The STA for which the request is made must be first registered with
3825 TL by HDD.
3826
3827 RESTRICTION: In case of a suspend, the flag write and read will not be
3828 locked: worst case scenario one more packet can get
3829 through before the flag gets updated (we can make this
3830 write atomic as well to guarantee consistency)
3831
3832 PARAMETERS
3833
3834 IN
3835 pvosGCtx: pointer to the global vos context; a handle to TL's
3836 control block can be extracted from its context
3837 pucSTAId: identifier of the station for which the request is made;
3838 a value of NULL assumes suspend on all active station
3839 pfnSuspendTxCB: pointer to the suspend result notification in case the
3840 call is asynchronous
3841
3842
3843 RETURN VALUE
3844 The result code associated with performing the operation
3845
3846 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
3847 to TL cb is NULL ; access would cause a page fault
3848 VOS_STATUS_E_EXISTS: Station was not registered
3849 VOS_STATUS_SUCCESS: Everything is good :)
3850
3851 SIDE EFFECTS
3852
3853============================================================================*/
3854
3855VOS_STATUS
3856WLANTL_SuspendDataTx
3857(
3858 v_PVOID_t pvosGCtx,
3859 v_U8_t* pucSTAId,
3860 WLANTL_SuspendCBType pfnSuspendTx
3861)
3862{
3863 WLANTL_CbType* pTLCb = NULL;
3864 vos_msg_t vosMsg;
Jeff Johnson295189b2012-06-20 16:38:30 -07003865
3866 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3867
3868 /*------------------------------------------------------------------------
3869 Sanity check
3870 Extract TL control block
3871 ------------------------------------------------------------------------*/
3872 pTLCb = VOS_GET_TL_CB(pvosGCtx);
Hoonki Lee14621352013-04-16 17:51:19 -07003873 if ( NULL == pTLCb )
Jeff Johnson295189b2012-06-20 16:38:30 -07003874 {
3875 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3876 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SuspendDataTx"));
3877 return VOS_STATUS_E_FAULT;
3878 }
3879
3880 /*------------------------------------------------------------------------
3881 Check the type of request: generic suspend, or per station suspend
3882 ------------------------------------------------------------------------*/
Hoonki Lee14621352013-04-16 17:51:19 -07003883 if (NULL == pucSTAId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003884 {
3885 /* General Suspend Request received */
3886 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3887 "WLAN TL:General suspend requested"));
Hoonki Lee14621352013-04-16 17:51:19 -07003888 vos_atomic_set_U8( &pTLCb->ucTxSuspended, 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07003889 vosMsg.reserved = WLAN_MAX_STA_COUNT;
3890 }
3891 else
3892 {
Hoonki Lee14621352013-04-16 17:51:19 -07003893 if ( WLANTL_STA_ID_INVALID( *pucSTAId ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07003894 {
Hoonki Lee14621352013-04-16 17:51:19 -07003895 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3896 "WLAN TL:Invalid station id %d requested on WLANTL_SuspendDataTx", *pucSTAId));
3897 return VOS_STATUS_E_FAULT;
3898 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003899
Gopichand Nakkalae5fef6c2013-06-19 18:04:23 +05303900 if ( NULL == pTLCb->atlSTAClients[*pucSTAId] )
3901 {
3902 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3903 "WLAN TL:Invalid pTLCb->atlSTAClients pointer for STA Id :%d on "
3904 "WLANTL_SuspendDataTx", *pucSTAId));
3905 return VOS_STATUS_E_FAULT;
3906 }
3907
3908 if ( 0 == pTLCb->atlSTAClients[*pucSTAId]->ucExists )
Hoonki Lee14621352013-04-16 17:51:19 -07003909 {
3910 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3911 "WLAN TL:Station %d was not previously registered on WLANTL_SuspendDataTx", *pucSTAId));
3912 return VOS_STATUS_E_EXISTS;
3913 }
3914
3915 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
3916 "WLAN TL:Suspend request for station: %d", *pucSTAId));
3917 vos_atomic_set_U8( &pTLCb->atlSTAClients[*pucSTAId]->ucTxSuspended, 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07003918 vosMsg.reserved = *pucSTAId;
3919 }
3920
3921 /*------------------------------------------------------------------------
3922 Serialize request through TX thread
3923 ------------------------------------------------------------------------*/
3924 vosMsg.type = WLANTL_TX_SIG_SUSPEND;
3925 vosMsg.bodyptr = (v_PVOID_t)pfnSuspendTx;
3926
Katya Nigam42e16e82014-02-04 16:28:55 +05303927 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_SUSPEND_DATA_TX,
3928 vosMsg.reserved , 0 ));
3929
Jeff Johnson295189b2012-06-20 16:38:30 -07003930 if(!VOS_IS_STATUS_SUCCESS(vos_tx_mq_serialize( VOS_MQ_ID_TL, &vosMsg)))
3931 {
3932 VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003933 " %s fails to post message", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003934 }
3935
3936 return VOS_STATUS_SUCCESS;
3937}/* WLANTL_SuspendDataTx */
3938
3939/*==========================================================================
3940
3941 FUNCTION WLANTL_ResumeDataTx
3942
3943 DESCRIPTION
3944 Called by HAL to resume data transmission for a given STA.
3945
3946 WARNING: If a station was individually suspended a global resume will
3947 not resume that station
3948
3949 DEPENDENCIES
3950
3951 PARAMETERS
3952
3953 IN
3954 pvosGCtx: pointer to the global vos context; a handle to TL's
3955 control block can be extracted from its context
3956 pucSTAId: identifier of the station which is being resumed; NULL
3957 translates into global resume
3958
3959 RETURN VALUE
3960 The result code associated with performing the operation
3961
3962 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
3963 to TL cb is NULL ; access would cause a page fault
3964 VOS_STATUS_E_EXISTS: Station was not registered
3965 VOS_STATUS_SUCCESS: Everything is good :)
3966
3967 SIDE EFFECTS
3968
3969============================================================================*/
3970
3971VOS_STATUS
3972WLANTL_ResumeDataTx
3973(
3974 v_PVOID_t pvosGCtx,
3975 v_U8_t* pucSTAId
3976)
3977{
3978 WLANTL_CbType* pTLCb = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003979 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
3980
3981 /*------------------------------------------------------------------------
3982 Sanity check
3983 Extract TL control block
3984 ------------------------------------------------------------------------*/
3985 pTLCb = VOS_GET_TL_CB(pvosGCtx);
Hoonki Lee14621352013-04-16 17:51:19 -07003986 if ( NULL == pTLCb )
Jeff Johnson295189b2012-06-20 16:38:30 -07003987 {
3988 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
3989 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ResumeDataTx"));
3990 return VOS_STATUS_E_FAULT;
3991 }
3992
Jeff Johnson295189b2012-06-20 16:38:30 -07003993 /*------------------------------------------------------------------------
3994 Check to see the type of resume
3995 ------------------------------------------------------------------------*/
Hoonki Lee14621352013-04-16 17:51:19 -07003996 if ( NULL == pucSTAId )
Jeff Johnson295189b2012-06-20 16:38:30 -07003997 {
Katya Nigam42e16e82014-02-04 16:28:55 +05303998 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_RESUME_DATA_TX,
3999 41 , 0 ));
4000
Jeff Johnson295189b2012-06-20 16:38:30 -07004001 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4002 "WLAN TL:General resume requested"));
4003 vos_atomic_set_U8( &pTLCb->ucTxSuspended, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004004 }
4005 else
4006 {
Katya Nigam42e16e82014-02-04 16:28:55 +05304007 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_RESUME_DATA_TX,
4008 *pucSTAId , 0 ));
4009
Hoonki Lee14621352013-04-16 17:51:19 -07004010 if ( WLANTL_STA_ID_INVALID( *pucSTAId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07004011 {
Hoonki Lee14621352013-04-16 17:51:19 -07004012 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4013 "WLAN TL:Invalid station id %d requested on WLANTL_ResumeDataTx", *pucSTAId));
4014 return VOS_STATUS_E_FAULT;
4015 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004016
Gopichand Nakkalae5fef6c2013-06-19 18:04:23 +05304017 if ( NULL == pTLCb->atlSTAClients[*pucSTAId] )
4018 {
4019 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4020 "WLAN TL:Invalid pTLCb->atlSTAClients pointer for STA Id :%d on "
4021 "WLANTL_ResumeDataTx", *pucSTAId));
4022 return VOS_STATUS_E_FAULT;
4023 }
4024
4025 if ( 0 == pTLCb->atlSTAClients[*pucSTAId]->ucExists )
Hoonki Lee14621352013-04-16 17:51:19 -07004026 {
4027 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4028 "WLAN TL:Station %d was not previously registered on WLANTL_ResumeDataTx", *pucSTAId));
4029 return VOS_STATUS_E_EXISTS;
4030 }
4031
4032 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4033 "WLAN TL:Resume request for station: %d", *pucSTAId));
4034 vos_atomic_set_U8( &pTLCb->atlSTAClients[*pucSTAId]->ucTxSuspended, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004035 }
4036
4037 /*------------------------------------------------------------------------
4038 Resuming transmission
4039 ------------------------------------------------------------------------*/
Hoonki Lee14621352013-04-16 17:51:19 -07004040 if (( pTLCb->uResCount >= WDA_TLI_MIN_RES_MF ) &&
4041 ( 0 == pTLCb->ucTxSuspended ))
Jeff Johnson295189b2012-06-20 16:38:30 -07004042 {
4043 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4044 "WLAN TL:Resuming transmission"));
4045 return WDA_DS_StartXmit(pvosGCtx);
4046 }
4047
4048 return VOS_STATUS_SUCCESS;
4049}/* WLANTL_ResumeDataTx */
4050
4051/*==========================================================================
4052 FUNCTION WLANTL_SuspendCB
4053
4054 DESCRIPTION
4055 Callback function for serializing Suspend signal through Tx thread
4056
4057 DEPENDENCIES
4058 Just notify HAL that suspend in TL is complete.
4059
4060 PARAMETERS
4061
4062 IN
4063 pvosGCtx: pointer to the global vos context; a handle to TL's
4064 control block can be extracted from its context
4065 pUserData: user data sent with the callback
4066
4067 RETURN VALUE
4068 The result code associated with performing the operation
4069
4070 VOS_STATUS_E_INVAL: invalid input parameters
4071 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
4072 page fault
4073 VOS_STATUS_SUCCESS: Everything is good :)
4074
4075
4076 SIDE EFFECTS
4077
4078============================================================================*/
4079VOS_STATUS
4080WLANTL_SuspendCB
4081(
4082 v_PVOID_t pvosGCtx,
4083 WLANTL_SuspendCBType pfnSuspendCB,
4084 v_U16_t usReserved
4085)
4086{
4087 WLANTL_CbType* pTLCb = NULL;
4088 v_U8_t ucSTAId = (v_U8_t)usReserved;
4089 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
4090
4091 /*------------------------------------------------------------------------
4092 Sanity check
4093 ------------------------------------------------------------------------*/
4094 if ( NULL == pfnSuspendCB )
4095 {
4096 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
4097 "WLAN TL: No Call back processing requested WLANTL_SuspendCB"));
4098 return VOS_STATUS_SUCCESS;
4099 }
4100
4101 /*------------------------------------------------------------------------
4102 Extract TL control block
4103 ------------------------------------------------------------------------*/
4104 pTLCb = VOS_GET_TL_CB(pvosGCtx);
4105 if ( NULL == pTLCb )
4106 {
4107 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4108 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SuspendCB"));
4109 return VOS_STATUS_E_FAULT;
4110 }
4111
4112 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
4113 {
4114 pfnSuspendCB(pvosGCtx, NULL, VOS_STATUS_SUCCESS);
4115 }
4116 else
4117 {
4118 pfnSuspendCB(pvosGCtx, &ucSTAId, VOS_STATUS_SUCCESS);
4119 }
4120
4121 return VOS_STATUS_SUCCESS;
4122}/*WLANTL_SuspendCB*/
4123
4124
4125/*----------------------------------------------------------------------------
4126 CLIENT INDEPENDENT INTERFACE
4127 ---------------------------------------------------------------------------*/
4128
4129/*==========================================================================
4130
4131 FUNCTION WLANTL_GetTxPktCount
4132
4133 DESCRIPTION
4134 TL will provide the number of transmitted packets counted per
4135 STA per TID.
4136
4137 DEPENDENCIES
4138
4139 PARAMETERS
4140
4141 IN
4142 pvosGCtx: pointer to the global vos context; a handle to TL's
4143 control block can be extracted from its context
4144 ucSTAId: identifier of the station
4145 ucTid: identifier of the tspec
4146
4147 OUT
4148 puTxPktCount: the number of packets tx packet for this STA and TID
4149
4150 RETURN VALUE
4151 The result code associated with performing the operation
4152
4153 VOS_STATUS_E_INVAL: Input parameters are invalid
4154 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
4155 to TL cb is NULL ; access would cause a page fault
4156 VOS_STATUS_E_EXISTS: Station was not registered
4157 VOS_STATUS_SUCCESS: Everything is good :)
4158
4159 SIDE EFFECTS
4160
4161============================================================================*/
4162VOS_STATUS
4163WLANTL_GetTxPktCount
4164(
4165 v_PVOID_t pvosGCtx,
4166 v_U8_t ucSTAId,
4167 v_U8_t ucTid,
4168 v_U32_t* puTxPktCount
4169)
4170{
4171 WLANTL_CbType* pTLCb = NULL;
4172 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
4173
4174 /*------------------------------------------------------------------------
4175 Sanity check
4176 ------------------------------------------------------------------------*/
4177 if ( NULL == puTxPktCount )
4178 {
4179 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4180 "WLAN TL:Invalid parameter sent on WLANTL_GetTxPktCount"));
4181 return VOS_STATUS_E_INVAL;
4182 }
4183
4184 if ( WLANTL_STA_ID_INVALID( ucSTAId ) || WLANTL_TID_INVALID( ucTid) )
4185 {
4186 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4187 "WLAN TL:Invalid station id %d/tid %d requested on WLANTL_GetTxPktCount",
4188 ucSTAId, ucTid));
4189 return VOS_STATUS_E_FAULT;
4190 }
4191
4192 /*------------------------------------------------------------------------
4193 Extract TL control block and check if station exists
4194 ------------------------------------------------------------------------*/
4195 pTLCb = VOS_GET_TL_CB(pvosGCtx);
4196 if ( NULL == pTLCb )
4197 {
4198 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4199 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetTxPktCount"));
4200 return VOS_STATUS_E_FAULT;
4201 }
4202
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304203 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
4204 {
4205 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4206 "WLAN TL:Client Memory was not allocated on %s", __func__));
4207 return VOS_STATUS_E_FAILURE;
4208 }
4209
4210 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07004211 {
4212 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4213 "WLAN TL:Station was not previously registered on WLANTL_GetTxPktCount %d",
4214 ucSTAId));
4215 return VOS_STATUS_E_EXISTS;
4216 }
4217
4218 /*------------------------------------------------------------------------
4219 Return data
4220 ------------------------------------------------------------------------*/
4221 //VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_MED,
4222 // "WLAN TL:Requested tx packet count for STA: %d, TID: %d",
4223 // ucSTAId, ucTid);
4224
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304225 *puTxPktCount = pTLCb->atlSTAClients[ucSTAId]->auTxCount[ucTid];
Jeff Johnson295189b2012-06-20 16:38:30 -07004226
4227 return VOS_STATUS_SUCCESS;
4228}/* WLANTL_GetTxPktCount */
4229
4230/*==========================================================================
4231
4232 FUNCTION WLANTL_GetRxPktCount
4233
4234 DESCRIPTION
4235 TL will provide the number of received packets counted per
4236 STA per TID.
4237
4238 DEPENDENCIES
4239
4240 PARAMETERS
4241
4242 IN
4243 pvosGCtx: pointer to the global vos context; a handle to TL's
4244 control block can be extracted from its context
4245 ucSTAId: identifier of the station
4246 ucTid: identifier of the tspec
4247
4248 OUT
4249 puTxPktCount: the number of packets rx packet for this STA and TID
4250
4251 RETURN VALUE
4252 The result code associated with performing the operation
4253
4254 VOS_STATUS_E_INVAL: Input parameters are invalid
4255 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
4256 to TL cb is NULL ; access would cause a page fault
4257 VOS_STATUS_E_EXISTS: Station was not registered
4258 VOS_STATUS_SUCCESS: Everything is good :)
4259
4260 SIDE EFFECTS
4261
4262============================================================================*/
4263VOS_STATUS
4264WLANTL_GetRxPktCount
4265(
4266 v_PVOID_t pvosGCtx,
4267 v_U8_t ucSTAId,
4268 v_U8_t ucTid,
4269 v_U32_t* puRxPktCount
4270)
4271{
4272 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304273 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004274 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
4275
4276 /*------------------------------------------------------------------------
4277 Sanity check
4278 ------------------------------------------------------------------------*/
4279 if ( NULL == puRxPktCount )
4280 {
4281 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4282 "WLAN TL:Invalid parameter sent on WLANTL_GetRxPktCount"));
4283 return VOS_STATUS_E_INVAL;
4284 }
4285
4286 if ( WLANTL_STA_ID_INVALID( ucSTAId ) || WLANTL_TID_INVALID( ucTid) )
4287 {
4288 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4289 "WLAN TL:Invalid station id %d/tid %d requested on WLANTL_GetRxPktCount",
4290 ucSTAId, ucTid));
4291 return VOS_STATUS_E_FAULT;
4292 }
4293
4294 /*------------------------------------------------------------------------
4295 Extract TL control block and existance
4296 ------------------------------------------------------------------------*/
4297 pTLCb = VOS_GET_TL_CB(pvosGCtx);
4298 if ( NULL == pTLCb )
4299 {
4300 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4301 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetRxPktCount"));
4302 return VOS_STATUS_E_FAULT;
4303 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304304 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
Jeff Johnson295189b2012-06-20 16:38:30 -07004305
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304306 if ( NULL == pClientSTA )
4307 {
4308 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4309 "WLAN TL:Client Memory was not allocated on %s", __func__));
4310 return VOS_STATUS_E_FAILURE;
4311 }
4312
4313 if ( 0 == pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07004314 {
4315 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4316 "WLAN TL:Station was not previously registered on WLANTL_GetRxPktCount"));
4317 return VOS_STATUS_E_EXISTS;
4318 }
4319
4320 /*------------------------------------------------------------------------
4321 Return data
4322 ------------------------------------------------------------------------*/
4323 TLLOG3(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_MED,
4324 "WLAN TL:Requested rx packet count for STA: %d, TID: %d",
4325 ucSTAId, ucTid));
4326
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304327 *puRxPktCount = pClientSTA->auRxCount[ucTid];
Jeff Johnson295189b2012-06-20 16:38:30 -07004328
4329 return VOS_STATUS_SUCCESS;
4330}/* WLANTL_GetRxPktCount */
4331
Jeff Johnson295189b2012-06-20 16:38:30 -07004332VOS_STATUS
4333WLANTL_TxFCFrame
4334(
4335 v_PVOID_t pvosGCtx
4336);
Karthick S79bbe822015-07-14 15:28:08 +05304337
4338/*==========================================================================
4339
4340 FUNCTION WLANTL_IsEAPOLPending
4341
4342 DESCRIPTION
4343
4344 HDD calls this function when hdd_tx_timeout occurs. This checks whether
4345 EAPOL is pending.
4346
4347 DEPENDENCIES
4348
4349 HDD must have registered with TL at least one STA before this function
4350 can be called.
4351
4352 PARAMETERS
4353
4354 IN
4355 pvosGCtx: pointer to the global vos context
4356
4357 RETURN VALUE
4358
4359 The result code associated with performing the operation
4360
4361 Success : Indicates EAPOL frame is pending and sta is in connected state
4362
4363 Failure : EAPOL frame is not pending
4364
4365 SIDE EFFECTS
4366============================================================================*/
4367VOS_STATUS
4368WLANTL_IsEAPOLPending
4369(
4370 v_PVOID_t pvosGCtx
4371)
4372{
4373 WLANTL_CbType* pTLCb = NULL;
4374 v_U32_t i = 0;
4375 /*------------------------------------------------------------------------
4376 Sanity check
4377 Extract TL control block
4378 ------------------------------------------------------------------------*/
4379 pTLCb = VOS_GET_TL_CB(pvosGCtx);
4380 if (NULL == pTLCb)
4381 {
4382 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4383 "WLAN TL:Invalid TL pointer for pvosGCtx"));
4384 return VOS_STATUS_E_FAILURE;
4385 }
4386 /*---------------------------------------------------------------------
4387 Check to see if there was any EAPOL packet is pending
4388 *--------------------------------------------------------------------*/
4389 for ( i = 0; i < WLAN_MAX_STA_COUNT; i++)
4390 {
4391 if ((NULL != pTLCb->atlSTAClients[i]) &&
4392 (pTLCb->atlSTAClients[i]->ucExists) &&
4393 (0 == pTLCb->atlSTAClients[i]->ucTxSuspended) &&
4394 (WLANTL_STA_CONNECTED == pTLCb->atlSTAClients[i]->tlState) &&
4395 (pTLCb->atlSTAClients[i]->ucPktPending)
4396 )
4397 return VOS_STATUS_SUCCESS;
4398 }
4399 return VOS_STATUS_E_FAILURE;
4400}
4401
Jeff Johnson295189b2012-06-20 16:38:30 -07004402/*============================================================================
4403 TL INTERNAL API DEFINITION
4404============================================================================*/
4405
4406/*==========================================================================
4407
4408 FUNCTION WLANTL_GetFrames
4409
4410 DESCRIPTION
4411
4412 BAL calls this function at the request of the lower bus interface.
4413 When this request is being received TL will retrieve packets from HDD
4414 in accordance with the priority rules and the count supplied by BAL.
4415
4416 DEPENDENCIES
4417
4418 HDD must have registered with TL at least one STA before this function
4419 can be called.
4420
4421 PARAMETERS
4422
4423 IN
4424 pvosGCtx: pointer to the global vos context; a handle to TL's
4425 or BAL's control block can be extracted from its context
4426 uSize: maximum size accepted by the lower layer
4427 uFlowMask TX flow control mask for Prima. Each bit is defined as
4428 WDA_TXFlowEnumType
4429
4430 OUT
4431 vosDataBuff: it will contain a pointer to the first buffer supplied
4432 by TL, if there is more than one packet supplied, TL
4433 will chain them through vOSS buffers
4434
4435 RETURN VALUE
4436
4437 The result code associated with performing the operation
4438
4439 1 or more: number of required resources if there are still frames to fetch
4440 0 : error or HDD queues are drained
4441
4442 SIDE EFFECTS
4443
4444 NOTE
4445
4446 Featurized uFlowMask. If we want to remove featurization, we need to change
4447 BAL on Volans.
4448
4449============================================================================*/
4450v_U32_t
4451WLANTL_GetFrames
4452(
4453 v_PVOID_t pvosGCtx,
4454 vos_pkt_t **ppFrameDataBuff,
4455 v_U32_t uSize,
Jeff Johnson295189b2012-06-20 16:38:30 -07004456 v_U8_t uFlowMask,
Jeff Johnson295189b2012-06-20 16:38:30 -07004457 v_BOOL_t* pbUrgent
4458)
4459{
4460 vos_pkt_t** pvosDataBuff = (vos_pkt_t**)ppFrameDataBuff;
4461 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304462 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004463 v_U32_t uRemaining = uSize;
4464 vos_pkt_t* vosRoot;
4465 vos_pkt_t* vosTempBuf;
4466 WLANTL_STAFuncType pfnSTAFsm;
4467 v_U16_t usPktLen;
4468 v_U32_t uResLen;
4469 v_U8_t ucSTAId;
4470 v_U8_t ucAC;
4471 vos_pkt_t* vosDataBuff;
4472 v_U32_t uTotalPktLen;
4473 v_U32_t i=0;
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -08004474 v_U32_t j=0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004475 v_U32_t ucResult = 0;
4476 VOS_STATUS vosStatus;
4477 WLANTL_STAEventType wSTAEvent;
4478 tBssSystemRole systemRole;
4479 tpAniSirGlobal pMac;
4480 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
4481
4482 /*------------------------------------------------------------------------
4483 Sanity check
4484 Extract TL control block
4485 ------------------------------------------------------------------------*/
4486 pTLCb = VOS_GET_TL_CB(pvosGCtx);
4487 if (( NULL == pTLCb ) || ( NULL == pvosDataBuff ))
4488 {
4489 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4490 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
4491 return ucResult;
4492 }
4493
4494 pMac = vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
4495 if ( NULL == pMac )
4496 {
4497 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004498 "%s: Invalid pMac", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07004499 return ucResult;
4500 }
4501
4502 vosDataBuff = pTLCb->vosDummyBuf; /* Just to avoid checking for NULL at
4503 each iteration */
4504
Jeff Johnson295189b2012-06-20 16:38:30 -07004505 pTLCb->uResCount = uSize;
Jeff Johnson295189b2012-06-20 16:38:30 -07004506
4507 /*-----------------------------------------------------------------------
4508 Save the root as we will walk this chain as we fill it
4509 -----------------------------------------------------------------------*/
4510 vosRoot = vosDataBuff;
4511
4512 /*-----------------------------------------------------------------------
4513 There is still data - until FSM function says otherwise
4514 -----------------------------------------------------------------------*/
4515 pTLCb->bUrgent = FALSE;
4516
Jeff Johnson295189b2012-06-20 16:38:30 -07004517 while (( pTLCb->tlConfigInfo.uMinFramesProcThres < pTLCb->uResCount ) &&
4518 ( 0 < uRemaining ))
Jeff Johnson295189b2012-06-20 16:38:30 -07004519 {
4520 systemRole = wdaGetGlobalSystemRole(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004521#ifdef WLAN_SOFTAP_FLOWCTRL_EN
4522/* FIXME: The code has been disabled since it is creating issues in power save */
4523 if (eSYSTEM_AP_ROLE == systemRole)
4524 {
4525 if (pTLCb->done_once == 0 && NULL == pTLCb->vosTxFCBuf)
4526 {
4527 WLANTL_TxFCFrame (pvosGCtx);
4528 pTLCb->done_once ++;
4529 }
4530 }
4531 if ( NULL != pTLCb->vosTxFCBuf )
4532 {
4533 //there is flow control packet waiting to be sent
4534 WDA_TLI_PROCESS_FRAME_LEN( pTLCb->vosTxFCBuf, usPktLen, uResLen, uTotalPktLen);
4535
4536 if ( ( pTLCb->uResCount > uResLen ) &&
Jeff Johnson9b5dc4d2013-02-22 21:28:47 -08004537 ( uRemaining > uTotalPktLen ) &&
4538 ( uFlowMask & ( 1 << WDA_TXFLOW_FC ) ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004539 {
4540 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4541 "WLAN TL:Chaining FC frame first on GetFrame"));
4542
4543 vos_pkt_chain_packet( vosDataBuff, pTLCb->vosTxFCBuf, 1 /*true*/ );
4544
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05304545 vos_atomic_set( (uintptr_t*)&pTLCb->vosTxFCBuf, (uintptr_t) NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07004546
4547 /*FC frames cannot be delayed*/
4548 pTLCb->bUrgent = TRUE;
4549
4550 /*Update remaining len from SSC */
4551 uRemaining -= (usPktLen + WDA_DXE_HEADER_SIZE);
4552
4553 /*Update resource count */
4554 pTLCb->uResCount -= uResLen;
4555 }
4556 else
4557 {
4558 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004559 "WLAN TL:send fc out of source %s", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07004560 ucResult = ( pTLCb->uResCount > uResLen )?VOS_TRUE:VOS_FALSE;
4561 break; /* Out of resources or reached max len */
4562 }
4563 }
4564 else
4565#endif //WLAN_SOFTAP_FLOWCTRL_EN
Jeff Johnson295189b2012-06-20 16:38:30 -07004566
Jeff Johnson9b5dc4d2013-02-22 21:28:47 -08004567 if (( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff ) &&
4568 ( uFlowMask & ( 1 << WDA_TXFLOW_MGMT ) ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004569 {
4570 WDA_TLI_PROCESS_FRAME_LEN( pTLCb->tlMgmtFrmClient.vosPendingDataBuff,
4571 usPktLen, uResLen, uTotalPktLen);
4572
Manjunathappa Prakashfb585462013-12-23 19:07:07 -08004573 if (usPktLen > WLANTL_MAX_ALLOWED_LEN)
4574 {
4575 usPktLen = WLANTL_MAX_ALLOWED_LEN;
4576 VOS_ASSERT(0);
4577 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004578
4579 if ( ( pTLCb->uResCount > uResLen ) &&
Jeff Johnson9b5dc4d2013-02-22 21:28:47 -08004580 ( uRemaining > uTotalPktLen ) &&
4581 ( uFlowMask & ( 1 << WDA_TXFLOW_MGMT ) ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004582 {
4583 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4584 "WLAN TL:Chaining management frame on GetFrame"));
4585
4586 vos_pkt_chain_packet( vosDataBuff,
4587 pTLCb->tlMgmtFrmClient.vosPendingDataBuff,
4588 1 /*true*/ );
4589
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05304590 vos_atomic_set( (uintptr_t*)&pTLCb->tlMgmtFrmClient.
4591 vosPendingDataBuff, (uintptr_t)NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07004592
4593 /*management frames cannot be delayed*/
4594 pTLCb->bUrgent = TRUE;
4595
4596 /*Update remaining len from SSC */
4597 uRemaining -= (usPktLen + WDA_DXE_HEADER_SIZE);
4598
4599 /*Update resource count */
4600 pTLCb->uResCount -= uResLen;
4601 }
4602 else
4603 {
4604 ucResult = ( pTLCb->uResCount > uResLen )?VOS_TRUE:VOS_FALSE;
4605 break; /* Out of resources or reached max len */
4606 }
4607 }
4608 else if (( pTLCb->tlBAPClient.vosPendingDataBuff ) &&
4609 ( WDA_TLI_MIN_RES_BAP <= pTLCb->uResCount ) &&
Gopichand Nakkala7e48ca72012-12-31 14:15:07 -08004610 ( 0 == pTLCb->ucTxSuspended ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004611 {
4612 WDA_TLI_PROCESS_FRAME_LEN( pTLCb->tlBAPClient.vosPendingDataBuff,
4613 usPktLen, uResLen, uTotalPktLen);
4614
Manjunathappa Prakashfb585462013-12-23 19:07:07 -08004615 if (usPktLen > WLANTL_MAX_ALLOWED_LEN)
4616 {
4617 usPktLen = WLANTL_MAX_ALLOWED_LEN;
4618 VOS_ASSERT(0);
4619 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004620
4621 if ( ( pTLCb->uResCount > (uResLen + WDA_TLI_MIN_RES_MF ) ) &&
4622 ( uRemaining > uTotalPktLen ))
4623 {
4624 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4625 "WLAN TL:Chaining BT-AMP frame on GetFrame"));
4626
4627 vos_pkt_chain_packet( vosDataBuff,
4628 pTLCb->tlBAPClient.vosPendingDataBuff,
4629 1 /*true*/ );
4630
4631 /*BAP frames cannot be delayed*/
4632 pTLCb->bUrgent = TRUE;
4633
Arun Kumar Khandavalli0af8d3c2014-02-07 18:05:11 +05304634 vos_atomic_set( (uintptr_t*)&pTLCb->tlBAPClient.vosPendingDataBuff,
4635 (uintptr_t) NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07004636
4637 /*Update remaining len from SSC */
4638 uRemaining -= (usPktLen + WDA_DXE_HEADER_SIZE);
4639
4640 /*Update resource count */
4641 pTLCb->uResCount -= uResLen;
4642 }
4643 else
4644 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004645 ucResult = uResLen + WDA_TLI_MIN_RES_MF;
Jeff Johnson295189b2012-06-20 16:38:30 -07004646 break; /* Out of resources or reached max len */
4647 }
4648 }
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004649 /* note: this feature implemented only after WLAN_INGETRATED_SOC */
4650 /* search 'EAPOL_HI_PRIORITY' will show EAPOL HI_PRIORITY change in TL and WDI
4651 by default, EAPOL will be treated as higher priority, which means
4652 use mgmt_pool and DXE_TX_HI prority channel.
4653 this is introduced to address EAPOL failure under high background traffic
4654 with multi-channel concurrent mode. But this change works in SCC or standalone, too.
4655 see CR#387009 and WCNSOS-8
4656 */
4657 else if (( WDA_TLI_MIN_RES_MF <= pTLCb->uResCount )&&
4658 ( 0 == pTLCb->ucTxSuspended ) &&
4659 ( uFlowMask & ( 1 << WDA_TXFLOW_MGMT ) )
4660 )
4661 {
4662 vosTempBuf = NULL;
4663 /*---------------------------------------------------------------------
4664 Check to see if there was any EAPOL packet is pending
4665 *--------------------------------------------------------------------*/
4666 for ( i = 0; i < WLAN_MAX_STA_COUNT; i++)
4667 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304668 if ((NULL != pTLCb->atlSTAClients[i]) &&
4669 (pTLCb->atlSTAClients[i]->ucExists) &&
4670 (0 == pTLCb->atlSTAClients[i]->ucTxSuspended) &&
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -08004671 (WLANTL_STA_CONNECTED == pTLCb->atlSTAClients[i]->tlState) &&
4672 (pTLCb->atlSTAClients[i]->ucPktPending)
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004673 )
4674 break;
4675 }
4676
4677 if (i >= WLAN_MAX_STA_COUNT)
4678 {
4679 /* No More to Serve Exit Get Frames */
4680 break;
4681 }
4682 /* Serve EAPOL frame with HI_FLOW_MASK */
4683 ucSTAId = i;
4684
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304685 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
4686
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +05304687 MTRACE(vos_trace(VOS_MODULE_ID_TL,
4688 TRACE_CODE_TL_GET_FRAMES_EAPOL, ucSTAId, pClientSTA->tlState));
4689
4690 if (pClientSTA->wSTADesc.wSTAType == WLAN_STA_INFRA)
4691 {
4692 if(0 != pClientSTA->aucACMask[WLANTL_AC_HIGH_PRIO])
4693 {
4694 pClientSTA->ucCurrentAC = WLANTL_AC_HIGH_PRIO;
4695 pTLCb->uCurServedAC = WLANTL_AC_HIGH_PRIO;
4696 }
4697 else
4698 break;
4699 }
4700 else
4701 {
4702 for (j = WLANTL_MAX_AC ; j > 0; j--)
4703 {
4704 if (0 != pClientSTA->aucACMask[j-1])
4705 {
4706 pClientSTA->ucCurrentAC = j-1;
4707 pTLCb->uCurServedAC = j-1;
4708 break;
4709 }
4710 }
4711 }
4712
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004713 wSTAEvent = WLANTL_TX_EVENT;
4714
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304715 pfnSTAFsm = tlSTAFsm[pClientSTA->tlState].
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004716 pfnSTATbl[wSTAEvent];
4717
4718 if ( NULL != pfnSTAFsm )
4719 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304720 pClientSTA->ucNoMoreData = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004721 vosStatus = pfnSTAFsm( pvosGCtx, ucSTAId, &vosTempBuf, VOS_FALSE);
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004722
4723 if (( VOS_STATUS_SUCCESS != vosStatus ) &&
4724 ( NULL != vosTempBuf ))
4725 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304726 pClientSTA->pfnSTATxComp( pvosGCtx, vosTempBuf, vosStatus );
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004727 vosTempBuf = NULL;
4728 break;
4729 }/* status success*/
4730 }
4731
4732 if (NULL != vosTempBuf)
4733 {
4734 WDA_TLI_PROCESS_FRAME_LEN( vosTempBuf, usPktLen, uResLen, uTotalPktLen);
4735
Manjunathappa Prakashfb585462013-12-23 19:07:07 -08004736 if (usPktLen > WLANTL_MAX_ALLOWED_LEN)
4737 {
4738 usPktLen = WLANTL_MAX_ALLOWED_LEN;
4739 VOS_ASSERT(0);
4740 }
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004741
4742 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
4743 "WLAN TL:Resources needed by frame: %d", uResLen));
4744
4745 if ( ( pTLCb->uResCount >= (uResLen + WDA_TLI_MIN_RES_MF ) ) &&
4746 ( uRemaining > uTotalPktLen )
4747 )
4748 {
4749 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4750 "WLAN TL:Chaining data frame on GetFrame"));
4751
4752 vos_pkt_chain_packet( vosDataBuff, vosTempBuf, 1 /*true*/ );
4753
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004754 /*EAPOL frame cannot be delayed*/
4755 pTLCb->bUrgent = TRUE;
4756
4757 vosTempBuf = NULL;
4758
4759 /*Update remaining len from SSC */
4760 uRemaining -= (usPktLen + WDA_DXE_HEADER_SIZE);
4761
4762 /*Update resource count */
4763 pTLCb->uResCount -= uResLen;
4764
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004765 //fow control update
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304766 pClientSTA->uIngress_length += uResLen;
4767 pClientSTA->uBuffThresholdMax = (pClientSTA->uBuffThresholdMax >= uResLen) ?
4768 (pClientSTA->uBuffThresholdMax - uResLen) : 0;
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -08004769 pClientSTA->ucEapolPktPending = 0;
4770 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4771 "WLAN TL:GetFrames STA: %d EAPOLPktPending %d",
4772 ucSTAId, pClientSTA->ucEapolPktPending);
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004773 }
4774 }
4775 else
4776 { // no EAPOL frames exit Get frames
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -08004777 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4778 "WLAN TL:GetFrames STA: %d, no EAPOL frame, continue.",
4779 ucSTAId));
4780 continue;
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004781 }
4782 }
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -07004783
Jeff Johnson9b5dc4d2013-02-22 21:28:47 -08004784 else if (( WDA_TLI_MIN_RES_DATA <= pTLCb->uResCount ) &&
4785 ( 0 == pTLCb->ucTxSuspended ) &&
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +05304786 ( uFlowMask & WLANTL_DATA_FLOW_MASK))
Jeff Johnson295189b2012-06-20 16:38:30 -07004787 {
4788 /*---------------------------------------------------------------------
4789 Check to see if there was any packet left behind previously due to
4790 size constraints
4791 ---------------------------------------------------------------------*/
4792 vosTempBuf = NULL;
4793
4794 if ( NULL != pTLCb->vosTempBuf )
4795 {
4796 vosTempBuf = pTLCb->vosTempBuf;
4797 pTLCb->vosTempBuf = NULL;
4798 ucSTAId = pTLCb->ucCachedSTAId;
4799 ucAC = pTLCb->ucCachedAC;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304800
4801 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
4802 {
4803 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4804 "WLAN TL:Client Memory was not allocated on %s", __func__));
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05304805 continue;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304806 }
4807
4808 pTLCb->atlSTAClients[ucSTAId]->ucNoMoreData = 0;
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05304809 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
Jeff Johnson295189b2012-06-20 16:38:30 -07004810
4811 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4812 "WLAN TL:Chaining cached data frame on GetFrame"));
4813 }
4814 else
4815 {
4816 WLAN_TLGetNextTxIds( pvosGCtx, &ucSTAId);
4817 if (ucSTAId >= WLAN_MAX_STA_COUNT)
4818 {
4819 /* Packets start coming in even after insmod Without *
4820 starting Hostapd or Interface being up *
4821 During which cases STAID is invaled and hence
4822 the check. HalMsg_ScnaComplete Triggers */
4823
4824 break;
4825 }
4826 /* ucCurrentAC should have correct AC to be served by calling
4827 WLAN_TLGetNextTxIds */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304828 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304829 if ( NULL == pClientSTA )
4830 {
4831 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4832 "WLAN TL:Client Memory was not allocated on %s", __func__));
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05304833 continue;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304834 }
4835
4836 ucAC = pClientSTA->ucCurrentAC;
4837
4838 pClientSTA->ucNoMoreData = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07004839 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004840 "WLAN TL: %s get one data frame, station ID %d ", __func__, ucSTAId));
Jeff Johnson295189b2012-06-20 16:38:30 -07004841 /*-------------------------------------------------------------------
4842 Check to see that STA is valid and tx is not suspended
4843 -------------------------------------------------------------------*/
4844 if ( ( ! WLANTL_STA_ID_INVALID( ucSTAId ) ) &&
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304845 ( 0 == pClientSTA->ucTxSuspended ) &&
4846 ( 0 == pClientSTA->fcStaTxDisabled) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004847 {
4848 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004849 "WLAN TL: %s sta id valid and not suspended ",__func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07004850 wSTAEvent = WLANTL_TX_EVENT;
4851
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304852 pfnSTAFsm = tlSTAFsm[pClientSTA->tlState].
Jeff Johnson295189b2012-06-20 16:38:30 -07004853 pfnSTATbl[wSTAEvent];
4854
4855 if ( NULL != pfnSTAFsm )
4856 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304857 pClientSTA->ucNoMoreData = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004858 vosStatus = pfnSTAFsm( pvosGCtx, ucSTAId, &vosTempBuf, VOS_FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07004859
4860 if (( VOS_STATUS_SUCCESS != vosStatus ) &&
4861 ( NULL != vosTempBuf ))
4862 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304863 pClientSTA->pfnSTATxComp( pvosGCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -07004864 vosTempBuf,
4865 vosStatus );
4866 vosTempBuf = NULL;
4867 }/* status success*/
4868 }/*NULL function state*/
4869 }/* valid STA id and ! suspended*/
4870 else
4871 {
4872 if ( ! WLANTL_STA_ID_INVALID( ucSTAId ) )
4873 {
4874 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
4875 "WLAN TL:Not fetching frame because suspended for sta ID %d",
4876 ucSTAId));
4877 }
4878 }
4879 }/* data */
4880
4881 if ( NULL != vosTempBuf )
4882 {
4883 WDA_TLI_PROCESS_FRAME_LEN( vosTempBuf, usPktLen, uResLen, uTotalPktLen);
4884
Manjunathappa Prakashfb585462013-12-23 19:07:07 -08004885 if (usPktLen > WLANTL_MAX_ALLOWED_LEN)
4886 {
4887 usPktLen = WLANTL_MAX_ALLOWED_LEN;
4888 VOS_ASSERT(0);
4889 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004890
4891 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
4892 "WLAN TL:Resources needed by frame: %d", uResLen));
4893
4894 if ( ( pTLCb->uResCount >= (uResLen + WDA_TLI_MIN_RES_BAP ) ) &&
Jeff Johnson9b5dc4d2013-02-22 21:28:47 -08004895 ( uRemaining > uTotalPktLen ) &&
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +05304896 ( uFlowMask & WLANTL_DATA_FLOW_MASK ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004897 {
4898 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4899 "WLAN TL:Chaining data frame on GetFrame"));
4900
4901 vos_pkt_chain_packet( vosDataBuff, vosTempBuf, 1 /*true*/ );
4902 vosTempBuf = NULL;
4903
4904 /*Update remaining len from SSC */
4905 uRemaining -= (usPktLen + WDA_DXE_HEADER_SIZE);
4906
4907 /*Update resource count */
4908 pTLCb->uResCount -= uResLen;
4909
Jeff Johnson295189b2012-06-20 16:38:30 -07004910 //fow control update
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304911 pClientSTA->uIngress_length += uResLen;
4912 pClientSTA->uBuffThresholdMax = (pClientSTA->uBuffThresholdMax >= uResLen) ?
4913 (pClientSTA->uBuffThresholdMax - uResLen) : 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004914
4915 }
4916 else
4917 {
4918 /* Store this for later tx - already fetched from HDD */
4919 pTLCb->vosTempBuf = vosTempBuf;
4920 pTLCb->ucCachedSTAId = ucSTAId;
4921 pTLCb->ucCachedAC = ucAC;
Jeff Johnson295189b2012-06-20 16:38:30 -07004922 ucResult = uResLen + WDA_TLI_MIN_RES_BAP;
4923 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4924 "min %d res required by TL.", ucResult ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004925 break; /* Out of resources or reached max len */
4926 }
4927 }
4928 else
4929 {
4930 for ( i = 0; i < WLAN_MAX_STA_COUNT; i++)
4931 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05304932 if (NULL != pTLCb->atlSTAClients[i] && (pTLCb->atlSTAClients[i]->ucExists) &&
Bhargav Shahfbaeca22016-07-13 10:27:35 +05304933 (pTLCb->atlSTAClients[i]->ucPktPending) &&
4934 (pTLCb->atlSTAClients[i]->disassoc_progress == VOS_FALSE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004935 {
4936 /* There is station to be Served */
4937 break;
4938 }
4939 }
4940 if (i >= WLAN_MAX_STA_COUNT)
4941 {
4942 /* No More to Serve Exit Get Frames */
4943 break;
4944 }
4945 else
4946 {
4947 /* More to be Served */
4948 continue;
4949 }
4950 }
4951 }
4952 else
4953 {
4954 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
4955 "WLAN TL:Returning from GetFrame: resources = %d suspended = %d",
4956 pTLCb->uResCount, pTLCb->ucTxSuspended));
Jeff Johnson295189b2012-06-20 16:38:30 -07004957 /* TL is starving even when DXE is not in low resource condition
4958 Return min resource number required and Let DXE deceide what to do */
4959 if(( 0 == pTLCb->ucTxSuspended ) &&
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +05304960 ( uFlowMask & WLANTL_DATA_FLOW_MASK ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004961 {
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07004962 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Jeff Johnson295189b2012-06-20 16:38:30 -07004963 "WLAN TL:Returning from GetFrame: resources = %d",
4964 pTLCb->uResCount));
4965 ucResult = WDA_TLI_MIN_RES_DATA;
4966 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004967 break; /*out of min data resources*/
4968 }
4969
4970 pTLCb->usPendingTxCompleteCount++;
4971 /* Move data buffer up one packet */
4972 vos_pkt_walk_packet_chain( vosDataBuff, &vosDataBuff, 0/*false*/ );
4973 }
4974
4975 /*----------------------------------------------------------------------
4976 Packet chain starts at root + 1
4977 ----------------------------------------------------------------------*/
4978 vos_pkt_walk_packet_chain( vosRoot, &vosDataBuff, 1/*true*/ );
4979
4980 *pvosDataBuff = vosDataBuff;
Manjunathappa Prakashfb585462013-12-23 19:07:07 -08004981 if (pbUrgent)
4982 {
4983 *pbUrgent = pTLCb->bUrgent;
4984 }
4985 else
4986 {
4987 VOS_ASSERT( pbUrgent );
4988 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004989 return ucResult;
4990}/* WLANTL_GetFrames */
4991
4992
4993/*==========================================================================
4994
4995 FUNCTION WLANTL_TxComp
4996
4997 DESCRIPTION
4998 It is being called by BAL upon asynchronous notification of the packet
4999 or packets being sent over the bus.
5000
5001 DEPENDENCIES
5002 Tx complete cannot be called without a previous transmit.
5003
5004 PARAMETERS
5005
5006 IN
5007 pvosGCtx: pointer to the global vos context; a handle to TL's
5008 or BAL's control block can be extracted from its context
5009 vosDataBuff: it will contain a pointer to the first buffer for which
5010 the BAL report is being made, if there is more then one
5011 packet they will be chained using vOSS buffers.
5012 wTxStatus: the status of the transmitted packet, see above chapter
5013 on HDD interaction for a list of possible values
5014
5015 RETURN VALUE
5016 The result code associated with performing the operation
5017
5018 VOS_STATUS_E_INVAL: Input parameters are invalid
5019 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
5020 page fault
5021 VOS_STATUS_E_EXISTS: Station was not registered
5022 VOS_STATUS_SUCCESS: Everything is good :)
5023
5024 SIDE EFFECTS
5025
5026============================================================================*/
5027VOS_STATUS
5028WLANTL_TxComp
5029(
5030 v_PVOID_t pvosGCtx,
5031 vos_pkt_t *pFrameDataBuff,
5032 VOS_STATUS wTxStatus
5033)
5034{
5035 vos_pkt_t* vosDataBuff = (vos_pkt_t*)pFrameDataBuff;
5036 WLANTL_CbType* pTLCb = NULL;
5037 WLANTL_TxCompCBType pfnTxComp = NULL;
5038 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005039 vos_pkt_t* vosTempTx = NULL;
5040
5041 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
5042
5043 /*------------------------------------------------------------------------
5044 Sanity check
5045 ------------------------------------------------------------------------*/
5046 if ( NULL == vosDataBuff )
5047 {
5048 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5049 "WLAN TL:Extraneous NULL data pointer on WLANTL_TxComp"));
5050 return VOS_STATUS_E_INVAL;
5051 }
5052
5053 /*------------------------------------------------------------------------
5054 Extract TL control block
5055 ------------------------------------------------------------------------*/
5056 pTLCb = VOS_GET_TL_CB(pvosGCtx);
5057 if ( NULL == pTLCb )
5058 {
5059 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5060 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_TxComp"));
5061 return VOS_STATUS_E_FAULT;
5062 }
5063
5064 while ((0 < pTLCb->usPendingTxCompleteCount) &&
5065 ( VOS_STATUS_SUCCESS == vosStatus ) &&
5066 ( NULL != vosDataBuff))
5067 {
5068 vos_pkt_get_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
5069 (v_PVOID_t)&pfnTxComp);
5070
5071 /*it should never be NULL - default handler should be registered if none*/
5072 if ( NULL == pfnTxComp )
5073 {
5074 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5075 "WLAN TL:NULL pointer to Tx Complete on WLANTL_TxComp"));
5076 VOS_ASSERT(0);
5077 return VOS_STATUS_E_FAULT;
5078 }
5079
5080 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05305081 "WLAN TL:Calling Tx complete for pkt %p in function %p",
Jeff Johnson295189b2012-06-20 16:38:30 -07005082 vosDataBuff, pfnTxComp));
5083
5084 vosTempTx = vosDataBuff;
5085 vosStatus = vos_pkt_walk_packet_chain( vosDataBuff,
5086 &vosDataBuff, 1/*true*/);
5087
5088 pfnTxComp( pvosGCtx, vosTempTx, wTxStatus );
5089
5090 pTLCb->usPendingTxCompleteCount--;
5091 }
5092
Jeff Johnson295189b2012-06-20 16:38:30 -07005093
5094 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5095 "WLAN TL: current TL values are: resources = %d "
5096 "pTLCb->usPendingTxCompleteCount = %d",
5097 pTLCb->uResCount, pTLCb->usPendingTxCompleteCount));
5098
5099 return VOS_STATUS_SUCCESS;
5100}/* WLANTL_TxComp */
5101
5102/*==========================================================================
5103
5104 FUNCTION WLANTL_CacheSTAFrame
5105
5106 DESCRIPTION
5107 Internal utility function for for caching incoming data frames that do
5108 not have a registered station yet.
5109
5110 DEPENDENCIES
5111 TL must be initiailized before this function gets called.
5112 In order to benefit from thsi caching, the components must ensure that
5113 they will only register with TL at the moment when they are fully setup
5114 and ready to receive incoming data
5115
5116 PARAMETERS
5117
5118 IN
5119
5120 pTLCb: TL control block
5121 ucSTAId: station id
5122 vosTempBuff: the data packet
5123 uDPUSig: DPU signature of the incoming packet
5124 bBcast: true if packet had the MC/BC bit set
5125
5126 RETURN VALUE
5127 The result code associated with performing the operation
5128
5129 VOS_STATUS_E_FAULT: pointer to TL cb is NULL or STA Id invalid ; access
5130 would cause a page fault
5131 VOS_STATUS_SUCCESS: Everything is good :)
5132
5133 SIDE EFFECTS
5134
5135============================================================================*/
5136static VOS_STATUS
5137WLANTL_CacheSTAFrame
5138(
5139 WLANTL_CbType* pTLCb,
5140 v_U8_t ucSTAId,
5141 vos_pkt_t* vosTempBuff,
5142 v_U32_t uDPUSig,
5143 v_U8_t bBcast,
5144 v_U8_t ucFrmType
5145)
5146{
5147 v_U8_t ucUcastSig;
5148 v_U8_t ucBcastSig;
5149 v_BOOL_t bOldSTAPkt;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305150 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005151 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
5152
5153 /*-------------------------------------------------------------------------
5154 Sanity check
5155 -------------------------------------------------------------------------*/
5156 if (( NULL == pTLCb ) || ( NULL == vosTempBuff ) )
5157 {
5158 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05305159 "WLAN TL: Invalid input pointer on WLANTL_CacheSTAFrame TL %p"
5160 " Packet %p", pTLCb, vosTempBuff ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005161 return VOS_STATUS_E_FAULT;
5162 }
5163
5164 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
5165 {
5166 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5167 "WLAN TL:Invalid station id requested on WLANTL_CacheSTAFrame"));
5168 return VOS_STATUS_E_FAULT;
5169 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305170 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
5171
5172 if ( NULL == pClientSTA )
5173 {
5174 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5175 "WLAN TL:Client Memory was not allocated on %s", __func__));
5176 return VOS_STATUS_E_FAILURE;
5177 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005178
5179 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5180 "WLAN TL:Attempting to cache pkt for STA %d, BD DPU Sig: %d with sig UC: %d, BC: %d",
5181 ucSTAId, uDPUSig,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305182 pClientSTA->wSTADesc.ucUcastSig,
5183 pClientSTA->wSTADesc.ucBcastSig));
Jeff Johnson295189b2012-06-20 16:38:30 -07005184
5185 if(WLANTL_IS_CTRL_FRAME(ucFrmType))
5186 {
5187 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5188 "WLAN TL: No need to cache CTRL frame. Dropping"));
5189 vos_pkt_return_packet(vosTempBuff);
5190 return VOS_STATUS_SUCCESS;
5191 }
5192
5193 /*-------------------------------------------------------------------------
5194 Check if the packet that we are trying to cache belongs to the old
5195 registered station (if any) or the new (potentially)upcoming station
5196
5197 - If the STA with this Id was never registered with TL - the signature
5198 will be invalid;
5199 - If the STA was previously registered TL will have cached the former
5200 set of DPU signatures
5201 -------------------------------------------------------------------------*/
5202 if ( bBcast )
5203 {
5204 ucBcastSig = (v_U8_t)uDPUSig;
5205 bOldSTAPkt = (( WLAN_TL_INVALID_B_SIG !=
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305206 pClientSTA->wSTADesc.ucBcastSig ) &&
5207 ( ucBcastSig == pClientSTA->wSTADesc.ucBcastSig ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005208 }
5209 else
5210 {
5211 ucUcastSig = (v_U8_t)uDPUSig;
5212 bOldSTAPkt = (( WLAN_TL_INVALID_U_SIG !=
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305213 pClientSTA->wSTADesc.ucUcastSig ) &&
5214 ( ucUcastSig == pClientSTA->wSTADesc.ucUcastSig ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005215 }
5216
5217 /*------------------------------------------------------------------------
5218 If the value of the DPU SIG matches the old, this packet will not
5219 be cached as it belonged to the former association
5220 In case the SIG does not match - this is a packet for a potentially new
5221 associated station
5222 -------------------------------------------------------------------------*/
Varun Reddy Yeturua39b9902013-01-18 15:48:32 -08005223 if ( bOldSTAPkt || bBcast )
Jeff Johnson295189b2012-06-20 16:38:30 -07005224 {
5225 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5226 "WLAN TL:Data packet matches old sig for sig DPU: %d UC: %d, "
5227 "BC: %d - dropping",
5228 uDPUSig,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305229 pClientSTA->wSTADesc.ucUcastSig,
5230 pClientSTA->wSTADesc.ucBcastSig));
Jeff Johnson295189b2012-06-20 16:38:30 -07005231 vos_pkt_return_packet(vosTempBuff);
5232 }
5233 else
5234 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305235 if ( NULL == pClientSTA->vosBegCachedFrame )
Jeff Johnson295189b2012-06-20 16:38:30 -07005236 {
5237 /*this is the first frame that we are caching */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305238 pClientSTA->vosBegCachedFrame = vosTempBuff;
Mihir Sheteb7337272014-04-11 15:53:08 +05305239
5240 pClientSTA->tlCacheInfo.cacheInitTime = vos_timer_get_system_time();
5241 pClientSTA->tlCacheInfo.cacheDoneTime =
5242 pClientSTA->tlCacheInfo.cacheInitTime;
5243 pClientSTA->tlCacheInfo.cacheSize = 1;
5244
Mihir Sheteae6f02b2014-04-11 19:49:21 +05305245 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_CACHE_FRAME,
5246 ucSTAId, pClientSTA->tlCacheInfo.cacheSize));
5247
Jeff Johnson295189b2012-06-20 16:38:30 -07005248 }
5249 else
5250 {
5251 /*this is a subsequent frame that we are caching: chain to the end */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305252 vos_pkt_chain_packet(pClientSTA->vosEndCachedFrame,
Jeff Johnson295189b2012-06-20 16:38:30 -07005253 vosTempBuff, VOS_TRUE);
Mihir Sheteb7337272014-04-11 15:53:08 +05305254
5255 pClientSTA->tlCacheInfo.cacheDoneTime = vos_timer_get_system_time();
5256 pClientSTA->tlCacheInfo.cacheSize ++;
5257
5258 if (pClientSTA->tlCacheInfo.cacheSize % WLANTL_CACHE_TRACE_WATERMARK == 0)
5259 {
5260 VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5261 "%s: Cache High watermark for staid:%d (%d)",
5262 __func__,ucSTAId, pClientSTA->tlCacheInfo.cacheSize);
Mihir Sheteae6f02b2014-04-11 19:49:21 +05305263 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_CACHE_FRAME,
5264 ucSTAId, pClientSTA->tlCacheInfo.cacheSize));
Mihir Sheteb7337272014-04-11 15:53:08 +05305265 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005266 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305267 pClientSTA->vosEndCachedFrame = vosTempBuff;
Jeff Johnson295189b2012-06-20 16:38:30 -07005268 }/*else new packet*/
5269
5270 return VOS_STATUS_SUCCESS;
5271}/*WLANTL_CacheSTAFrame*/
5272
5273/*==========================================================================
5274
5275 FUNCTION WLANTL_FlushCachedFrames
5276
5277 DESCRIPTION
5278 Internal utility function used by TL to flush the station cache
5279
5280 DEPENDENCIES
5281 TL must be initiailized before this function gets called.
5282
5283 PARAMETERS
5284
5285 IN
5286
5287 vosDataBuff: it will contain a pointer to the first cached buffer
5288 received,
5289
5290 RETURN VALUE
5291 The result code associated with performing the operation
5292
5293 VOS_STATUS_SUCCESS: Everything is good :)
5294
5295 SIDE EFFECTS
5296
5297 NOTE
5298 This function doesn't re-initialize vosDataBuff to NULL. It's caller's
5299 responsibility to do so, if required, after this function call.
5300 Because of this restriction, we decide to make this function to static
5301 so that upper layer doesn't need to be aware of this restriction.
5302
5303============================================================================*/
5304static VOS_STATUS
5305WLANTL_FlushCachedFrames
5306(
5307 vos_pkt_t* vosDataBuff
5308)
5309{
5310 /*----------------------------------------------------------------------
5311 Return the entire chain to vos if there are indeed cache frames
5312 ----------------------------------------------------------------------*/
5313 if ( NULL != vosDataBuff )
5314 {
5315 vos_pkt_return_packet(vosDataBuff);
5316 }
5317
5318 return VOS_STATUS_SUCCESS;
5319}/*WLANTL_FlushCachedFrames*/
5320
5321/*==========================================================================
5322
5323 FUNCTION WLANTL_ForwardSTAFrames
5324
5325 DESCRIPTION
5326 Internal utility function for either forwarding cached data to the station after
5327 the station has been registered, or flushing cached data if the station has not
5328 been registered.
5329
5330
5331 DEPENDENCIES
5332 TL must be initiailized before this function gets called.
5333
5334 PARAMETERS
5335
5336 IN
5337
5338 pTLCb: TL control block
5339 ucSTAId: station id
5340
5341 RETURN VALUE
5342 The result code associated with performing the operation
5343
5344 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
5345 page fault
5346 VOS_STATUS_SUCCESS: Everything is good :)
5347
5348 SIDE EFFECTS
5349 This function doesn't re-initialize vosDataBuff to NULL. It's caller's
5350 responsibility to do so, if required, after this function call.
5351 Because of this restriction, we decide to make this function to static
5352 so that upper layer doesn't need to be aware of this restriction.
5353
5354============================================================================*/
5355static VOS_STATUS
5356WLANTL_ForwardSTAFrames
5357(
5358 void* pvosGCtx,
5359 v_U8_t ucSTAId,
5360 v_U8_t ucUcastSig,
5361 v_U8_t ucBcastSig
5362)
5363{
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305364 WLANTL_CbType* pTLCb = NULL;
5365 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005366 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
5367
5368 /*-------------------------------------------------------------------------
5369 Sanity check
5370 -------------------------------------------------------------------------*/
5371 pTLCb = VOS_GET_TL_CB(pvosGCtx);
5372 if ( NULL == pTLCb )
5373 {
5374 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05305375 "WLAN TL: Invalid input pointer on WLANTL_ForwardSTAFrames TL %p",
Jeff Johnson295189b2012-06-20 16:38:30 -07005376 pTLCb ));
5377 return VOS_STATUS_E_FAULT;
5378 }
5379
5380 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
5381 {
5382 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5383 "WLAN TL:Invalid station id requested on WLANTL_ForwardSTAFrames"));
5384 return VOS_STATUS_E_FAULT;
5385 }
5386
5387 //WLAN_TL_LOCK_STA_CACHE(pTLCb->atlSTAClients[ucSTAId]);
5388
5389 /*------------------------------------------------------------------------
5390 Check if station has not been registered in the mean while
5391 if not registered, flush cached frames.
5392 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305393 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
5394
5395 if ( NULL == pClientSTA )
5396 {
5397 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5398 "WLAN TL:Client Memory was not allocated on %s", __func__));
5399 return VOS_STATUS_E_FAILURE;
5400 }
5401
5402 if ( 0 == pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07005403 {
5404 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5405 "WLAN TL:Station has been deleted for STA %d - flushing cache", ucSTAId));
Mihir Sheteae6f02b2014-04-11 19:49:21 +05305406 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_FLUSH_CACHED_FRAMES,
5407 ucSTAId, pClientSTA->tlCacheInfo.cacheSize));
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305408 WLANTL_FlushCachedFrames(pClientSTA->vosBegCachedFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07005409 goto done;
5410 }
5411
5412 /*------------------------------------------------------------------------
5413 Forwarding cache frames received while the station was in the process
5414 of being registered with the rest of the SW components
5415
5416 Access to the cache must be locked; similarly updating the signature and
5417 the existence flag must be synchronized because these values are checked
5418 during cached
5419 ------------------------------------------------------------------------*/
5420 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5421 "WLAN TL:Preparing to fwd packets for STA %d", ucSTAId));
5422
5423 /*-----------------------------------------------------------------------
5424 Save the new signature values
5425 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305426 pClientSTA->wSTADesc.ucUcastSig = ucUcastSig;
5427 pClientSTA->wSTADesc.ucBcastSig = ucBcastSig;
Jeff Johnson295189b2012-06-20 16:38:30 -07005428
5429 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5430 "WLAN TL:Fwd-ing packets for STA %d UC %d BC %d",
5431 ucSTAId, ucUcastSig, ucBcastSig));
5432
5433 /*-------------------------------------------------------------------------
5434 Check to see if we have any cached data to forward
5435 -------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305436 if ( NULL != pClientSTA->vosBegCachedFrame )
Jeff Johnson295189b2012-06-20 16:38:30 -07005437 {
5438 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5439 "WLAN TL: Fwd-ing Cached packets for station %d", ucSTAId ));
5440
5441 WLANTL_RxCachedFrames( pTLCb,
5442 ucSTAId,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305443 pClientSTA->vosBegCachedFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07005444 }
5445 else
5446 {
5447 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5448 "WLAN TL: NO cached packets for station %d", ucSTAId ));
5449 }
5450
5451done:
5452 /*-------------------------------------------------------------------------
5453 Clear the station cache
5454 -------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305455 pClientSTA->vosBegCachedFrame = NULL;
5456 pClientSTA->vosEndCachedFrame = NULL;
Mihir Sheteb7337272014-04-11 15:53:08 +05305457 pClientSTA->tlCacheInfo.cacheSize = 0;
5458 pClientSTA->tlCacheInfo.cacheClearTime = vos_timer_get_system_time();
Jeff Johnson295189b2012-06-20 16:38:30 -07005459
5460 /*-----------------------------------------------------------------------
5461 After all the init is complete we can mark the existance flag
5462 ----------------------------------------------------------------------*/
Katya Nigam63902932014-06-26 19:04:23 +05305463 pClientSTA->enableCaching = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005464
5465 //WLAN_TL_UNLOCK_STA_CACHE(pTLCb->atlSTAClients[ucSTAId]);
5466 return VOS_STATUS_SUCCESS;
5467
5468}/*WLANTL_ForwardSTAFrames*/
5469
5470
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005471#if defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07005472/*==========================================================================
5473
5474 FUNCTION WLANTL_IsIAPPFrame
5475
5476 DESCRIPTION
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005477 Internal utility function for detecting incoming ESE IAPP frames
Jeff Johnson295189b2012-06-20 16:38:30 -07005478
5479 DEPENDENCIES
5480
5481 PARAMETERS
5482
5483 IN
5484
5485 pvBDHeader: pointer to the BD header
5486 vosTempBuff: the data packet
5487
5488 IN/OUT
5489 pFirstDataPktArrived: static from caller function; used for rssi
5490 computation
5491 RETURN VALUE
5492 The result code associated with performing the operation
5493
5494 VOS_TRUE: It is a IAPP frame
5495 VOS_FALSE: It is NOT IAPP frame
5496
5497 SIDE EFFECTS
5498
5499============================================================================*/
5500v_BOOL_t
5501WLANTL_IsIAPPFrame
5502(
5503 v_PVOID_t pvBDHeader,
5504 vos_pkt_t* vosTempBuff
5505)
5506{
5507 v_U16_t usMPDUDOffset;
5508 v_U8_t ucOffset;
5509 v_U8_t ucSnapHdr[WLANTL_LLC_SNAP_SIZE];
5510 v_SIZE_t usSnapHdrSize = WLANTL_LLC_SNAP_SIZE;
5511 VOS_STATUS vosStatus;
5512
5513 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
5514
5515 /*------------------------------------------------------------------------
5516 Check if OUI field is present.
5517 -------------------------------------------------------------------------*/
5518 if ( VOS_FALSE == WDA_IS_RX_LLC_PRESENT(pvBDHeader) )
5519 {
5520 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5521 "WLAN TL:LLC header removed, cannot determine BT-AMP type -"
5522 "dropping pkt"));
5523 /* Drop packet */
5524 vos_pkt_return_packet(vosTempBuff);
5525 return VOS_TRUE;
5526 }
5527 usMPDUDOffset = (v_U8_t)WDA_GET_RX_MPDU_DATA_OFFSET(pvBDHeader);
5528 ucOffset = (v_U8_t)usMPDUDOffset + WLANTL_LLC_SNAP_OFFSET;
5529
5530 vosStatus = vos_pkt_extract_data( vosTempBuff, ucOffset,
5531 (v_PVOID_t)ucSnapHdr, &usSnapHdrSize);
5532
5533 if (( VOS_STATUS_SUCCESS != vosStatus))
5534 {
5535 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5536 "Unable to extract Snap Hdr of data packet -"
5537 "dropping pkt"));
5538 return VOS_FALSE;
5539 }
5540
5541 /*------------------------------------------------------------------------
5542 Check if this is IAPP frame by matching Aironet Snap hdr.
5543 -------------------------------------------------------------------------*/
5544 // Compare returns 1 if values are same and 0
5545 // if not the same.
5546 if (( WLANTL_LLC_SNAP_SIZE != usSnapHdrSize ) ||
5547 ( 0 == vos_mem_compare(ucSnapHdr, (v_PVOID_t)WLANTL_AIRONET_SNAP_HEADER,
5548 WLANTL_LLC_SNAP_SIZE ) ))
5549 {
5550 return VOS_FALSE;
5551 }
5552
5553 return VOS_TRUE;
5554
5555}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005556#endif //FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07005557
5558/*==========================================================================
5559
5560 FUNCTION WLANTL_ProcessBAPFrame
5561
5562 DESCRIPTION
5563 Internal utility function for processing incoming BT-AMP frames
5564
5565 DEPENDENCIES
5566 TL must be initiailized before this function gets called.
5567 Bothe the BT-AMP station and the BAP Ctrl path must have been previously
5568 registered with TL.
5569
5570 PARAMETERS
5571
5572 IN
5573
5574 pvBDHeader: pointer to the BD header
5575 vosTempBuff: the data packet
5576 pTLCb: TL control block
5577 ucSTAId: station id
5578
5579 IN/OUT
5580 pFirstDataPktArrived: static from caller function; used for rssi
5581 computation
5582 RETURN VALUE
5583 The result code associated with performing the operation
5584
5585 VOS_STATUS_E_INVAL: Input parameters are invalid
5586 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
5587 page fault
5588 VOS_STATUS_SUCCESS: Everything is good :)
5589
5590 SIDE EFFECTS
5591
5592============================================================================*/
5593v_BOOL_t
5594WLANTL_ProcessBAPFrame
5595(
5596 v_PVOID_t pvBDHeader,
5597 vos_pkt_t* vosTempBuff,
5598 WLANTL_CbType* pTLCb,
5599 v_U8_t* pFirstDataPktArrived,
5600 v_U8_t ucSTAId
5601)
5602{
5603 v_U16_t usMPDUDOffset;
5604 v_U8_t ucOffset;
5605 v_U8_t ucOUI[WLANTL_LLC_OUI_SIZE];
5606 v_SIZE_t usOUISize = WLANTL_LLC_OUI_SIZE;
5607 VOS_STATUS vosStatus;
5608 v_U16_t usType;
5609 v_SIZE_t usTypeLen = sizeof(usType);
5610 v_U8_t ucMPDUHOffset;
5611 v_U8_t ucMPDUHLen = 0;
5612 v_U16_t usActualHLen = 0;
5613
5614 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
5615
5616 /*------------------------------------------------------------------------
5617 Extract OUI and type from LLC and validate; if non-data send to BAP
5618 -------------------------------------------------------------------------*/
5619 if ( VOS_FALSE == WDA_IS_RX_LLC_PRESENT(pvBDHeader) )
5620 {
5621 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5622 "WLAN TL:LLC header removed, cannot determine BT-AMP type -"
5623 "dropping pkt"));
5624 /* Drop packet */
5625 vos_pkt_return_packet(vosTempBuff);
5626 return VOS_TRUE;
5627 }
5628
5629 usMPDUDOffset = (v_U8_t)WDA_GET_RX_MPDU_DATA_OFFSET(pvBDHeader);
5630 ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(pvBDHeader);
5631 ucMPDUHLen = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(pvBDHeader);
5632 ucOffset = (v_U8_t)usMPDUDOffset + WLANTL_LLC_OUI_OFFSET;
5633
5634 vosStatus = vos_pkt_extract_data( vosTempBuff, ucOffset,
5635 (v_PVOID_t)ucOUI, &usOUISize);
5636
5637#if 0
5638 // Compare returns 1 if values are same and 0
5639 // if not the same.
5640 if (( WLANTL_LLC_OUI_SIZE != usOUISize ) ||
5641 ( 0 == vos_mem_compare(ucOUI, (v_PVOID_t)WLANTL_BT_AMP_OUI,
5642 WLANTL_LLC_OUI_SIZE ) ))
5643 {
5644 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5645 "LLC header points to diff OUI in BT-AMP station -"
5646 "dropping pkt"));
5647 /* Drop packet */
5648 vos_pkt_return_packet(vosTempBuff);
5649 return VOS_TRUE;
5650 }
5651#endif
5652 /*------------------------------------------------------------------------
5653 Extract LLC OUI and ensure that this is indeed a BT-AMP frame
5654 ------------------------------------------------------------------------*/
5655 vosStatus = vos_pkt_extract_data( vosTempBuff,
5656 ucOffset + WLANTL_LLC_OUI_SIZE,
5657 (v_PVOID_t)&usType, &usTypeLen);
5658
5659 if (( VOS_STATUS_SUCCESS != vosStatus) ||
5660 ( sizeof(usType) != usTypeLen ))
5661 {
5662 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5663 "Unable to extract type on incoming BAP packet -"
5664 "dropping pkt"));
5665 /* Drop packet */
5666 vos_pkt_return_packet(vosTempBuff);
5667 return VOS_TRUE;
5668 }
5669
5670 /*------------------------------------------------------------------------
5671 Check if this is BT-AMP data or ctrl packet(RSN, LinkSvision, ActivityR)
5672 ------------------------------------------------------------------------*/
5673 usType = vos_be16_to_cpu(usType);
5674
5675 if (WLANTL_BAP_IS_NON_DATA_PKT_TYPE(usType))
5676 {
5677 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5678 "WLAN TL:Non-data packet received over BT-AMP link: %d, => BAP",
5679 usType));
5680
5681 /*Flatten packet as BAP expects to be able to peek*/
5682 if ( VOS_STATUS_SUCCESS != vos_pkt_flatten_rx_pkt(&vosTempBuff))
5683 {
5684 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5685 "WLAN TL:Cannot flatten BT-AMP packet - dropping"));
5686 /* Drop packet */
5687 vos_pkt_return_packet(vosTempBuff);
5688 return VOS_TRUE;
5689 }
5690
5691 /* Send packet to BAP client*/
Jeff Johnson295189b2012-06-20 16:38:30 -07005692 if ( VOS_STATUS_SUCCESS != WDA_DS_TrimRxPacketInfo( vosTempBuff ) )
5693 {
5694 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
5695 "WLAN TL:BD header corrupted - dropping packet"));
5696 /* Drop packet */
5697 vos_pkt_return_packet(vosTempBuff);
5698 return VOS_TRUE;
5699 }
5700
5701 if ( 0 == WDA_GET_RX_FT_DONE(pvBDHeader) )
5702 {
5703 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5704 "Non-data packet received over BT-AMP link: Sending it for "
5705 "frame Translation"));
5706
5707 if (usMPDUDOffset > ucMPDUHOffset)
5708 {
5709 usActualHLen = usMPDUDOffset - ucMPDUHOffset;
5710 }
5711
5712 /* software frame translation for BTAMP WDS.*/
5713 WLANTL_Translate80211To8023Header( vosTempBuff, &vosStatus, usActualHLen,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005714 ucMPDUHLen, pTLCb,ucSTAId, VOS_FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07005715
5716 }
5717 if (pTLCb->tlBAPClient.pfnTlBAPRx)
5718 pTLCb->tlBAPClient.pfnTlBAPRx( vos_get_global_context(VOS_MODULE_ID_TL,pTLCb),
5719 vosTempBuff,
5720 (WLANTL_BAPFrameEnumType)usType );
Manjunathappa Prakashfb585462013-12-23 19:07:07 -08005721 else
5722 {
5723 VOS_ASSERT(0);
5724 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005725
5726 return VOS_TRUE;
5727 }
5728 else
5729 {
5730 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
5731 "WLAN TL: BAP DATA packet received over BT-AMP link: %d, => BAP",
5732 usType));
5733 /*!!!FIX ME!!*/
5734 #if 0
5735 /*--------------------------------------------------------------------
5736 For data packet collect phy stats RSSI and Link Quality
5737 Calculate the RSSI average and save it. Continuous average is done.
5738 --------------------------------------------------------------------*/
5739 if ( *pFirstDataPktArrived == 0)
5740 {
5741 pTLCb->atlSTAClients[ucSTAId].rssiAvg =
5742 WLANHAL_GET_RSSI_AVERAGE( pvBDHeader );
5743 pTLCb->atlSTAClients[ucSTAId].uLinkQualityAvg =
5744 WLANHAL_RX_BD_GET_SNR( pvBDHeader );
5745
5746 // Rcvd 1st pkt, start average from next time
5747 *pFirstDataPktArrived = 1;
5748 }
5749 else
5750 {
5751 pTLCb->atlSTAClients[ucSTAId].rssiAvg =
5752 (WLANHAL_GET_RSSI_AVERAGE( pvBDHeader ) +
5753 pTLCb->atlSTAClients[ucSTAId].rssiAvg)/2;
5754 pTLCb->atlSTAClients[ucSTAId].uLinkQualityAvg =
5755 (WLANHAL_RX_BD_GET_SNR( pvBDHeader ) +
5756 pTLCb->atlSTAClients[ucSTAId].uLinkQualityAvg)/2;
5757 }/*Else, first data packet*/
5758 #endif
5759 }/*BT-AMP data packet*/
5760
5761 return VOS_FALSE;
5762}/*WLANTL_ProcessBAPFrame*/
5763
Jeff Johnson295189b2012-06-20 16:38:30 -07005764
5765/*==========================================================================
5766
5767 FUNCTION WLANTL_ProcessFCFrame
5768
5769 DESCRIPTION
5770 Internal utility function for processing incoming Flow Control frames. Enable
5771 or disable LWM mode based on the information.
5772
5773 DEPENDENCIES
5774 TL must be initiailized before this function gets called.
5775 FW sends up special flow control frame.
5776
5777 PARAMETERS
5778
5779 IN
5780 pvosGCtx pointer to vos global context
5781 pvBDHeader: pointer to the BD header
5782 pTLCb: TL control block
5783 pvBDHeader pointer to BD header.
5784
5785 IN/OUT
5786 pFirstDataPktArrived: static from caller function; used for rssi
5787 computation
5788 RETURN VALUE
5789 The result code associated with performing the operation
5790
5791 VOS_STATUS_E_INVAL: Input frame are invalid
5792 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
5793 page fault
5794 VOS_STATUS_SUCCESS: Everything is good :)
5795
5796 SIDE EFFECTS
5797 The ingress and egress of each station will be updated. If needed, LWM mode will
5798 be enabled or disabled based on the flow control algorithm.
5799
5800============================================================================*/
5801v_BOOL_t
5802WLANTL_ProcessFCFrame
5803(
5804 v_PVOID_t pvosGCtx,
5805 vos_pkt_t* pvosDataBuff,
5806 v_PVOID_t pvBDHeader
5807)
5808{
5809#if 1 //enable processing of only fcStaTxDisabled bitmap for now. the else part is old better qos code.
5810 // need to revisit the old code for full implementation.
Hoonki Lee14621352013-04-16 17:51:19 -07005811 v_U8_t ucSTAId;
5812 v_U16_t ucStaValidBitmap;
5813 v_U16_t ucStaTxDisabledBitmap;
5814 WLANTL_CbType* pTLCb = NULL;
5815 #ifdef TL_DEBUG_FC
5816 v_U32_t rxTimeStamp;
5817 v_U32_t curTick;
5818 #endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005819 /*------------------------------------------------------------------------
Hoonki Lee14621352013-04-16 17:51:19 -07005820 Extract TL control block
Jeff Johnson295189b2012-06-20 16:38:30 -07005821 ------------------------------------------------------------------------*/
5822 pTLCb = VOS_GET_TL_CB(pvosGCtx);
5823 if ( NULL == pTLCb )
5824 {
5825 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5826 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SuspendDataTx"));
5827 return VOS_STATUS_E_FAULT;
5828 }
Hoonki Lee14621352013-04-16 17:51:19 -07005829 ucStaValidBitmap = WDA_GET_RX_FC_VALID_STA_MASK(pvBDHeader);
5830 ucStaTxDisabledBitmap = WDA_GET_RX_FC_STA_TX_DISABLED_BITMAP(pvBDHeader);
5831#ifdef TL_DEBUG_FC
5832 rxTimeStamp = WDA_GET_RX_TIMESTAMP(pvBDHeader);
5833 /* hard code of MTU_GLOBAL_TIMER_ADDR to calculate the time between generated and processed */
5834 wpalReadRegister(0x03081400+0x1D4, &curTick);
Jeff Johnson295189b2012-06-20 16:38:30 -07005835
Jeff Johnson295189b2012-06-20 16:38:30 -07005836 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08005837 "%ld (%ld-%ld): Disabled %x Valid %x", curTick > rxTimeStamp ? curTick - rxTimeStamp : rxTimeStamp - (0xFFFFFFFF - curTick),
Hoonki Lee14621352013-04-16 17:51:19 -07005838 curTick, rxTimeStamp, ucStaTxDisabledBitmap, ucStaValidBitmap));
5839#endif
5840 for(ucSTAId = 0; ucStaValidBitmap != 0; ucStaValidBitmap >>=1, ucStaTxDisabledBitmap >>= 1, ucSTAId ++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005841 {
Hoonki Lee14621352013-04-16 17:51:19 -07005842 if ( (0 == (ucStaValidBitmap & 0x1)) || (pTLCb->atlSTAClients[ucSTAId] && (0 == pTLCb->atlSTAClients[ucSTAId]->ucExists)) )
5843 continue;
5844
5845 if (ucStaTxDisabledBitmap & 0x1)
5846 {
5847 WLANTL_SuspendDataTx(pvosGCtx, &ucSTAId, NULL);
5848 }
5849 else
5850 {
5851 WLANTL_ResumeDataTx(pvosGCtx, &ucSTAId);
5852 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005853 }
5854
5855#else
5856 VOS_STATUS vosStatus;
5857 tpHalFcRxBd pvFcRxBd = NULL;
5858 v_U8_t ucBitCheck = 0x1;
5859 v_U8_t ucStaValid = 0;
5860 v_U8_t ucSTAId = 0;
5861
5862 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
5863 "Received FC Response");
5864 if ( (NULL == pTLCb) || (NULL == pvosDataBuff))
5865 {
5866 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08005867 "WLAN TL:Invalid pointer in %s", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -07005868 return VOS_STATUS_E_FAULT;
5869 }
5870 vosStatus = vos_pkt_peek_data( pvosDataBuff, 0, (v_PVOID_t)&pvFcRxBd,
5871 sizeof(tHalFcRxBd));
5872
5873 if ( (VOS_STATUS_SUCCESS != vosStatus) || (NULL == pvFcRxBd) )
5874 {
5875 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
5876 "WLAN TL:wrong FC Rx packet"));
5877 return VOS_STATUS_E_INVAL;
5878 }
5879
5880 // need to swap bytes in the FC contents.
5881 WLANHAL_SwapFcRxBd(&pvFcRxBd->fcSTATxQLen[0]);
5882
5883 //logic to enable/disable LWM mode for each station
5884 for( ucStaValid = (v_U8_t)pvFcRxBd->fcSTAValidMask; ucStaValid; ucStaValid >>= 1, ucBitCheck <<= 1, ucSTAId ++)
5885 {
5886 if ( (0 == (ucStaValid & 0x1)) || (0 == pTLCb->atlSTAClients[ucSTAId].ucExists) )
5887 {
5888 continue;
5889 }
5890
5891 if ( pvFcRxBd->fcSTAThreshIndMask & ucBitCheck )
5892 {
5893 //LWM event is reported by FW. Able to fetch more packet
5894 if( pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled )
5895 {
5896 //Now memory usage is below LWM. Station can send more packets.
5897 pTLCb->atlSTAClients[ucSTAId].ucLwmEventReported = TRUE;
5898 }
5899 else
5900 {
5901 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
Arif Hussainf2b00992013-11-17 21:46:15 -08005902 "WLAN TL: FW report LWM event but the station %d is not in LWM mode", ucSTAId));
Jeff Johnson295189b2012-06-20 16:38:30 -07005903 }
5904 }
5905
5906 //calculate uEgress_length/uIngress_length only after receiving enough packets
5907 if (WLANTL_LWM_INGRESS_SAMPLE_THRESHOLD <= pTLCb->atlSTAClients[ucSTAId].uIngress_length)
5908 {
5909 //check memory usage info to see whether LWM mode should be enabled for the station
5910 v_U32_t uEgress_length = pTLCb->atlSTAClients[ucSTAId].uIngress_length +
5911 pTLCb->atlSTAClients[ucSTAId].bmuMemConsumed - pvFcRxBd->fcSTATxQLen[ucSTAId];
5912
5913 //if ((float)uEgress_length/(float)pTLCb->atlSTAClients[ucSTAId].uIngress_length
5914 // <= WLANTL_LWM_EGRESS_INGRESS_THRESHOLD)
5915 if ( (pTLCb->atlSTAClients[ucSTAId].uIngress_length > uEgress_length) &&
5916 ((pTLCb->atlSTAClients[ucSTAId].uIngress_length - uEgress_length ) >=
5917 (pTLCb->atlSTAClients[ucSTAId].uIngress_length >> 2))
5918 )
5919 {
5920 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -08005921 "WLAN TL:Enable LWM mode for station %d", ucSTAId));
Jeff Johnson295189b2012-06-20 16:38:30 -07005922 pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled = TRUE;
5923 }
5924 else
5925 {
5926 if( pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled )
5927 {
5928 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -08005929 "WLAN TL:Disable LWM mode for station %d", ucSTAId));
Jeff Johnson295189b2012-06-20 16:38:30 -07005930 pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled = FALSE;
5931 }
5932
5933 }
5934
5935 //remember memory usage in FW starting from this round
5936 pTLCb->atlSTAClients[ucSTAId].bmuMemConsumed = pvFcRxBd->fcSTATxQLen[ucSTAId];
5937 pTLCb->atlSTAClients[ucSTAId].uIngress_length = 0;
5938 } //(WLANTL_LWM_INGRESS_SAMPLE_THRESHOLD <= pTLCb->atlSTAClients[ucSTAId].uIngress_length)
5939
5940 if( pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled )
5941 {
5942 //always update current maximum allowed memeory usage
5943 pTLCb->atlSTAClients[ucSTAId].uBuffThresholdMax = WLANTL_STA_BMU_THRESHOLD_MAX -
5944 pvFcRxBd->fcSTATxQLen[ucSTAId];
5945 }
5946
5947 }
5948#endif
5949
5950 return VOS_STATUS_SUCCESS;
5951}
Jeff Johnson295189b2012-06-20 16:38:30 -07005952
5953
5954/*==========================================================================
5955
5956 FUNCTION WLANTL_RxFrames
5957
5958 DESCRIPTION
5959 Callback registered by TL and called by BAL when a packet is received
5960 over the bus. Upon the call of this function TL will make the necessary
5961 decision with regards to the forwarding or queuing of this packet and
5962 the layer it needs to be delivered to.
5963
5964 DEPENDENCIES
5965 TL must be initiailized before this function gets called.
5966 If the frame carried is a data frame then the station for which it is
5967 destined to must have been previously registered with TL.
5968
5969 PARAMETERS
5970
5971 IN
5972 pvosGCtx: pointer to the global vos context; a handle to TL's
5973 or BAL's control block can be extracted from its context
5974
5975 vosDataBuff: it will contain a pointer to the first buffer received,
5976 if there is more then one packet they will be chained
5977 using vOSS buffers.
5978
5979 RETURN VALUE
5980 The result code associated with performing the operation
5981
5982 VOS_STATUS_E_INVAL: Input parameters are invalid
5983 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
5984 page fault
5985 VOS_STATUS_SUCCESS: Everything is good :)
5986
5987 SIDE EFFECTS
5988
5989============================================================================*/
5990VOS_STATUS
5991WLANTL_RxFrames
5992(
5993 v_PVOID_t pvosGCtx,
5994 vos_pkt_t *pFrameDataBuff
5995)
5996{
5997 vos_pkt_t* vosDataBuff = (vos_pkt_t*)pFrameDataBuff;
5998 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05305999 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006000 WLANTL_STAFuncType pfnSTAFsm;
6001 vos_pkt_t* vosTempBuff;
6002 v_U8_t ucSTAId;
6003 VOS_STATUS vosStatus;
6004 v_U8_t ucFrmType;
6005 v_PVOID_t pvBDHeader = NULL;
6006 WLANTL_STAEventType wSTAEvent = WLANTL_RX_EVENT;
6007 v_U8_t ucTid = 0;
6008 v_BOOL_t broadcast = VOS_FALSE;
6009 v_BOOL_t selfBcastLoopback = VOS_FALSE;
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -07006010 static v_U8_t first_data_pkt_arrived;
Jeff Johnson295189b2012-06-20 16:38:30 -07006011 v_U32_t uDPUSig;
Jeff Johnson295189b2012-06-20 16:38:30 -07006012 v_U16_t usPktLen;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07006013 v_BOOL_t bForwardIAPPwithLLC = VOS_FALSE;
Dino Mycle3b9536d2014-07-09 22:05:24 +05306014#ifdef WLAN_FEATURE_LINK_LAYER_STATS
6015 v_S7_t currentAvgRSSI = 0;
6016 v_U8_t ac;
6017
6018#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07006019
Jeff Johnson295189b2012-06-20 16:38:30 -07006020 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
6021
6022 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6023 "WLAN TL:TL Receive Frames called"));
6024
6025 /*------------------------------------------------------------------------
6026 Sanity check
6027 ------------------------------------------------------------------------*/
6028 if ( NULL == vosDataBuff )
6029 {
6030 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6031 "WLAN TL:Invalid parameter sent on WLANTL_RxFrames"));
6032 return VOS_STATUS_E_INVAL;
6033 }
6034
Katya Nigam3802f202013-12-16 19:27:14 +05306035 /*------------------------------------------------------------------------
6036 Popolaute timestamp as the time when packet arrives
6037 ---------------------------------------------------------------------- */
6038 vosDataBuff->timestamp = vos_timer_get_system_ticks();
6039
Jeff Johnson295189b2012-06-20 16:38:30 -07006040 /*------------------------------------------------------------------------
6041 Extract TL control block
6042 ------------------------------------------------------------------------*/
6043 pTLCb = VOS_GET_TL_CB(pvosGCtx);
6044 if ( NULL == pTLCb )
6045 {
6046 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6047 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
6048 return VOS_STATUS_E_FAULT;
6049 }
6050
6051 /*---------------------------------------------------------------------
6052 Save the initial buffer - this is the first received buffer
6053 ---------------------------------------------------------------------*/
6054 vosTempBuff = vosDataBuff;
6055
6056 while ( NULL != vosTempBuff )
6057 {
Madan Mohan Koyyalamudia148e1e2012-11-30 14:52:59 -08006058 broadcast = VOS_FALSE;
6059 selfBcastLoopback = VOS_FALSE;
6060
Jeff Johnson295189b2012-06-20 16:38:30 -07006061 vos_pkt_walk_packet_chain( vosDataBuff, &vosDataBuff, 1/*true*/ );
6062
Katya Nigame7b69a82015-04-28 15:24:06 +05306063 if( vos_get_conparam() == VOS_MONITOR_MODE )
6064 {
6065 if( pTLCb->isConversionReq )
6066 WLANTL_MonTranslate80211To8023Header(vosTempBuff, pTLCb);
6067
6068 pTLCb->pfnMonRx(pvosGCtx, vosTempBuff, pTLCb->isConversionReq);
6069 vosTempBuff = vosDataBuff;
6070 continue;
6071 }
6072
Jeff Johnson295189b2012-06-20 16:38:30 -07006073 /*---------------------------------------------------------------------
6074 Peek at BD header - do not remove
6075 !!! Optimize me: only part of header is needed; not entire one
6076 ---------------------------------------------------------------------*/
6077 vosStatus = WDA_DS_PeekRxPacketInfo( vosTempBuff, (v_PVOID_t)&pvBDHeader, 1/*Swap BD*/ );
6078
6079 if ( NULL == pvBDHeader )
6080 {
6081 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6082 "WLAN TL:Cannot extract BD header"));
6083 /* Drop packet */
6084 vos_pkt_return_packet(vosTempBuff);
6085 vosTempBuff = vosDataBuff;
6086 continue;
6087 }
6088
Jeff Johnson295189b2012-06-20 16:38:30 -07006089 /*---------------------------------------------------------------------
6090 Check if FC frame reported from FW
6091 ---------------------------------------------------------------------*/
6092 if(WDA_IS_RX_FC(pvBDHeader))
6093 {
6094 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6095 "WLAN TL:receive one FC frame"));
6096
6097 WLANTL_ProcessFCFrame(pvosGCtx, vosTempBuff, pvBDHeader);
6098 /* Drop packet */
6099 vos_pkt_return_packet(vosTempBuff);
6100 vosTempBuff = vosDataBuff;
6101 continue;
6102 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006103
6104 /* AMSDU HW bug fix
6105 * After 2nd AMSDU subframe HW could not handle BD correctly
6106 * HAL workaround is needed */
6107 if(WDA_GET_RX_ASF(pvBDHeader))
6108 {
6109 WDA_DS_RxAmsduBdFix(pvosGCtx, pvBDHeader);
6110 }
6111
6112 /*---------------------------------------------------------------------
6113 Extract frame control field from 802.11 header if present
6114 (frame translation not done)
6115 ---------------------------------------------------------------------*/
6116
6117 vosStatus = WDA_DS_GetFrameTypeSubType( pvosGCtx, vosTempBuff,
6118 pvBDHeader, &ucFrmType );
6119 if ( VOS_STATUS_SUCCESS != vosStatus )
6120 {
6121 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6122 "WLAN TL:Cannot extract Frame Control Field"));
6123 /* Drop packet */
6124 vos_pkt_return_packet(vosTempBuff);
6125 vosTempBuff = vosDataBuff;
6126 continue;
6127 }
6128
Jeff Johnson295189b2012-06-20 16:38:30 -07006129 vos_pkt_get_packet_length(vosTempBuff, &usPktLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006130
6131 /*---------------------------------------------------------------------
6132 Check if management and send to PE
6133 ---------------------------------------------------------------------*/
6134
Deepthi Gowrie89de132015-05-14 12:23:57 +05306135 if ( WLANTL_IS_MGMT_FRAME(ucFrmType))
Jeff Johnson295189b2012-06-20 16:38:30 -07006136 {
6137 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6138 "WLAN TL:Sending packet to management client"));
6139 if ( VOS_STATUS_SUCCESS != vos_pkt_flatten_rx_pkt(&vosTempBuff))
6140 {
6141 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6142 "WLAN TL:Cannot flatten packet - dropping"));
6143 /* Drop packet */
6144 vos_pkt_return_packet(vosTempBuff);
6145 vosTempBuff = vosDataBuff;
6146 continue;
6147 }
6148 ucSTAId = (v_U8_t)WDA_GET_RX_STAID( pvBDHeader );
6149 /* Read RSSI and update */
6150 if(!WLANTL_STA_ID_INVALID(ucSTAId))
6151 {
6152#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
6153 /* Read RSSI and update */
6154 vosStatus = WLANTL_HSHandleRXFrame(pvosGCtx,
6155 WLANTL_MGMT_FRAME_TYPE,
6156 pvBDHeader,
6157 ucSTAId,
6158 VOS_FALSE,
6159 NULL);
6160#else
6161 vosStatus = WLANTL_ReadRSSI(pvosGCtx, pvBDHeader, ucSTAId);
6162#endif
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05306163 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
6164 {
6165 TLLOGW(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
6166 "Handle RX Management Frame fail within Handoff "
6167 "support module"));
6168 /* Do Not Drop packet at here
6169 * Revisit why HO module return fail
6170 * vos_pkt_return_packet(vosTempBuff);
6171 * vosTempBuff = vosDataBuff;
6172 * continue;
6173 */
6174 }
6175 vosStatus = WLANTL_ReadSNR(pvosGCtx, pvBDHeader, ucSTAId);
6176
6177 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
6178 {
6179 TLLOGW(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
6180 FL("Failed to Read SNR")));
6181 }
Dino Mycle3b9536d2014-07-09 22:05:24 +05306182#ifdef WLAN_FEATURE_LINK_LAYER_STATS
6183 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
6184 if ( NULL != pClientSTA)
6185 {
6186 pClientSTA->interfaceStats.mgmtRx++;
Dino Mycle3b9536d2014-07-09 22:05:24 +05306187 }
6188#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07006189 }
6190
Jeff Johnson295189b2012-06-20 16:38:30 -07006191 pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx( pvosGCtx, vosTempBuff);
6192 }
6193 else /* Data Frame */
6194 {
6195 ucSTAId = (v_U8_t)WDA_GET_RX_STAID( pvBDHeader );
6196 ucTid = (v_U8_t)WDA_GET_RX_TID( pvBDHeader );
6197
6198 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6199 "WLAN TL:Data packet received for STA %d", ucSTAId));
6200
6201 /*------------------------------------------------------------------
6202 This should be corrected when multipe sta support is added !!!
6203 for now bcast frames will be sent to the last registered STA
6204 ------------------------------------------------------------------*/
6205 if ( WDA_IS_RX_BCAST(pvBDHeader))
6206 {
6207 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6208 "WLAN TL:TL rx Bcast frame - sending to last registered station"));
6209 broadcast = VOS_TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07006210 /*-------------------------------------------------------------------
6211 If Addr1 is b/mcast, but Addr3 is our own self MAC, it is a b/mcast
6212 pkt we sent looping back to us. To be dropped if we are non BTAMP
6213 -------------------------------------------------------------------*/
6214 if( WLANHAL_RX_BD_ADDR3_SELF_IDX ==
6215 (v_U8_t)WDA_GET_RX_ADDR3_IDX( pvBDHeader ))
6216 {
6217 selfBcastLoopback = VOS_TRUE;
6218 }
6219 }/*if bcast*/
6220
Sravan Kumar Kairam09a5e0b2016-05-03 13:17:42 +05306221 if (WLANTL_STA_ID_INVALID(ucSTAId))
Jeff Johnson295189b2012-06-20 16:38:30 -07006222 {
6223 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Sravan Kumar Kairam09a5e0b2016-05-03 13:17:42 +05306224 "WLAN TL:STAId %d. Invalid STA ID dropping pkt",
6225 ucSTAId));
Jeff Johnson295189b2012-06-20 16:38:30 -07006226 /* Drop packet */
6227 vos_pkt_return_packet(vosTempBuff);
6228 vosTempBuff = vosDataBuff;
6229 continue;
6230 }
6231
Sravan Kumar Kairam09a5e0b2016-05-03 13:17:42 +05306232 if (WLANTL_TID_INVALID( ucTid)) {
6233 /* There is a possibility AP uses wrong TID. In that case to avoid
6234 dropping EAPOL packet in the driver use TID to zero.*/
6235 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
6236 "WLAN TL:Invalid Tid: %d Frame type: %d", ucTid, ucFrmType);
6237 ucTid = 0;
6238 }
6239
jagadeesh99d8e632015-04-27 13:21:24 +05306240#ifdef WLAN_FEATURE_LINK_LAYER_STATS
6241 ac = WLANTL_TID_2_AC[ucTid];
6242#endif
6243
Jeff Johnson295189b2012-06-20 16:38:30 -07006244 /*----------------------------------------------------------------------
6245 No need to lock cache access because cache manipulation only happens
6246 in the transport thread/task context
6247 - These frames are to be forwarded to the station upon registration
6248 which happens in the main thread context
6249 The caching here can happen in either Tx or Rx thread depending
6250 on the current SSC scheduling
6251 - also we need to make sure that the frames in the cache are fwd-ed to
6252 the station before the new incoming ones
6253 -----------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306254 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
6255 if (NULL == pClientSTA)
6256 {
6257 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
6258 "WLAN TL:STA not allocated memory. Dropping packet"));
6259 vos_pkt_return_packet(vosTempBuff);
6260 vosTempBuff = vosDataBuff;
6261 continue;
6262 }
6263
Hoonki Lee5305c3a2013-04-29 23:28:59 -07006264#ifdef FEATURE_WLAN_TDLS
6265 if (( pClientSTA->ucExists ) &&
6266 (WLAN_STA_TDLS == pClientSTA->wSTADesc.wSTAType) &&
6267 (pClientSTA->ucTxSuspended))
6268 vos_atomic_set_U8( &pClientSTA->ucTxSuspended, 0 );
6269 else if ( !broadcast && (pClientSTA->ucExists == 0 ) )
6270 {
6271 tpSirMacMgmtHdr pMacHeader = WDA_GET_RX_MAC_HEADER( pvBDHeader );
6272
6273 /* from the direct peer while it is not registered to TL yet */
6274 if ( (pMacHeader->fc.fromDS == 0) &&
6275 (pMacHeader->fc.toDS == 0) )
6276 {
6277 v_U8_t ucAddr3STAId;
6278
6279 ucAddr3STAId = WDA_GET_RX_ADDR3_IDX(pvBDHeader);
6280
6281 if ( WLANTL_STA_ID_INVALID(ucAddr3STAId) )
6282 {
6283 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
6284 "WLAN TL:STA ID %d invalid - dropping pkt", ucAddr3STAId));
6285 /* Drop packet */
6286 vos_pkt_return_packet(vosTempBuff);
6287 vosTempBuff = vosDataBuff;
6288 continue;
6289 }
6290
6291 if (!(pTLCb->atlSTAClients[ucAddr3STAId] && pTLCb->atlSTAClients[ucAddr3STAId]->ucExists &&
6292 (WLAN_STA_INFRA == pTLCb->atlSTAClients[ucAddr3STAId]->wSTADesc.wSTAType) &&
6293 (WLANTL_STA_AUTHENTICATED == pTLCb->atlSTAClients[ucAddr3STAId]->tlState)))
6294 {
6295 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Arif Hussainf2b00992013-11-17 21:46:15 -08006296 "%s: staId %d addr3Id %d tlState %d. Unkown Receiver/Transmitter Dropping packet", __func__,
Hoonki Lee5305c3a2013-04-29 23:28:59 -07006297 ucSTAId, ucAddr3STAId, pTLCb->atlSTAClients[ucAddr3STAId]->tlState));
6298 vos_pkt_return_packet(vosTempBuff);
6299 vosTempBuff = vosDataBuff;
6300 continue;
6301 }
6302 else
6303 {
6304 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Arif Hussainf2b00992013-11-17 21:46:15 -08006305 "%s: staId %d doesn't exist, but mapped to AP staId %d", __func__,
Hoonki Lee5305c3a2013-04-29 23:28:59 -07006306 ucSTAId, ucAddr3STAId));
6307 ucSTAId = ucAddr3STAId;
6308 pClientSTA = pTLCb->atlSTAClients[ucAddr3STAId];
6309 }
6310 }
6311 }
6312#endif
6313
Katya Nigam63902932014-06-26 19:04:23 +05306314 if (( pClientSTA->enableCaching == 1 ) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07006315 /*Dont buffer Broadcast/Multicast frames. If AP transmits bursts of Broadcast/Multicast data frames,
6316 * libra buffers all Broadcast/Multicast packets after authentication with AP,
6317 * So it will lead to low resource condition in Rx Data Path.*/
Katya Nigam63902932014-06-26 19:04:23 +05306318 ( WDA_IS_RX_BCAST(pvBDHeader) == 0 ))
Jeff Johnson295189b2012-06-20 16:38:30 -07006319 {
Katya Nigam6201c3e2014-05-27 17:51:42 +05306320 if( WDA_IsSelfSTA(pvosGCtx,ucSTAId))
6321 {
6322 //drop packet for Self STA index
6323 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
6324 "%s: Packet dropped for Self STA with staId %d ", __func__, ucSTAId ));
6325
6326 vos_pkt_return_packet(vosTempBuff);
6327 vosTempBuff = vosDataBuff;
6328 continue;
6329 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006330 uDPUSig = WDA_GET_RX_DPUSIG( pvBDHeader );
6331 //Station has not yet been registered with TL - cache the frame
Hoonki Lee5305c3a2013-04-29 23:28:59 -07006332 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Arif Hussainf2b00992013-11-17 21:46:15 -08006333 "%s: staId %d exist %d tlState %d cache rx frame", __func__, ucSTAId,
Hoonki Lee5305c3a2013-04-29 23:28:59 -07006334 pClientSTA->ucExists, pClientSTA->tlState));
Jeff Johnson295189b2012-06-20 16:38:30 -07006335 WLANTL_CacheSTAFrame( pTLCb, ucSTAId, vosTempBuff, uDPUSig, broadcast, ucFrmType);
6336 vosTempBuff = vosDataBuff;
6337 continue;
6338 }
6339
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08006340#ifdef FEATURE_WLAN_ESE_UPLOAD
6341 if ((pClientSTA->wSTADesc.ucIsEseSta)|| broadcast)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07006342 {
6343 /*--------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08006344 Filter the IAPP frames for ESE connection;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07006345 if data it will return false and it
6346 will be routed through the regular data path
6347 --------------------------------------------------------------------*/
6348 if ( WLANTL_IsIAPPFrame(pvBDHeader,
6349 vosTempBuff))
6350 {
6351 bForwardIAPPwithLLC = VOS_TRUE;
6352 }
6353 }
6354#endif
6355
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08006356#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
6357 if ((pClientSTA->wSTADesc.ucIsEseSta)|| broadcast)
Jeff Johnson295189b2012-06-20 16:38:30 -07006358 {
6359 /*--------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08006360 Filter the IAPP frames for ESE connection;
Jeff Johnson295189b2012-06-20 16:38:30 -07006361 if data it will return false and it
6362 will be routed through the regular data path
6363 --------------------------------------------------------------------*/
6364 if ( WLANTL_IsIAPPFrame(pvBDHeader,
6365 vosTempBuff))
6366 {
6367 if ( VOS_STATUS_SUCCESS != vos_pkt_flatten_rx_pkt(&vosTempBuff))
6368 {
6369 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6370 "WLAN TL:Cannot flatten packet - dropping"));
6371 /* Drop packet */
6372 vos_pkt_return_packet(vosTempBuff);
6373 } else {
6374
6375 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08006376 "WLAN TL: Received ESE IAPP Frame"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006377
6378 pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx( pvosGCtx, vosTempBuff);
6379 }
6380 vosTempBuff = vosDataBuff;
6381 continue;
6382 }
6383 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08006384#endif /* defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD) */
Jeff Johnson295189b2012-06-20 16:38:30 -07006385
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306386 if ( WLAN_STA_BT_AMP == pClientSTA->wSTADesc.wSTAType )
Jeff Johnson295189b2012-06-20 16:38:30 -07006387 {
6388 /*--------------------------------------------------------------------
6389 Process the ctrl BAP frame; if data it will return false and it
6390 will be routed through the regular data path
6391 --------------------------------------------------------------------*/
6392 if ( WLANTL_ProcessBAPFrame( pvBDHeader,
6393 vosTempBuff,
6394 pTLCb,
6395 &first_data_pkt_arrived,
6396 ucSTAId))
6397 {
6398 vosTempBuff = vosDataBuff;
6399 continue;
6400 }
6401 }/*if BT-AMP station*/
6402 else if(selfBcastLoopback == VOS_TRUE)
6403 {
6404 /* Drop packet */
6405 vos_pkt_return_packet(vosTempBuff);
6406 vosTempBuff = vosDataBuff;
6407 continue;
6408 }
6409
6410 /*---------------------------------------------------------------------
6411 Data packet received, send to state machine
6412 ---------------------------------------------------------------------*/
6413 wSTAEvent = WLANTL_RX_EVENT;
6414
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306415 pfnSTAFsm = tlSTAFsm[pClientSTA->tlState].
Jeff Johnson295189b2012-06-20 16:38:30 -07006416 pfnSTATbl[wSTAEvent];
6417
6418 if ( NULL != pfnSTAFsm )
6419 {
6420#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
6421 /* Read RSSI and update */
6422 vosStatus = WLANTL_HSHandleRXFrame(pvosGCtx,
6423 WLANTL_DATA_FRAME_TYPE,
6424 pvBDHeader,
6425 ucSTAId,
6426 broadcast,
6427 vosTempBuff);
6428 broadcast = VOS_FALSE;
6429#else
6430 vosStatus = WLANTL_ReadRSSI(pvosGCtx, pvBDHeader, ucSTAId);
Kiet Lam47325522014-03-10 11:50:46 -07006431#endif
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05306432 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
Jeff Johnson295189b2012-06-20 16:38:30 -07006433 {
6434 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
6435 "Handle RX Data Frame fail within Handoff support module"));
6436 /* Do Not Drop packet at here
6437 * Revisit why HO module return fail
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05306438 * vos_pkt_return_packet(vosTempBuff);
6439 * vosTempBuff = vosDataBuff;
6440 * continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07006441 */
6442 }
Dino Mycle3b9536d2014-07-09 22:05:24 +05306443#ifdef WLAN_FEATURE_LINK_LAYER_STATS
6444 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
6445 if ( NULL != pClientSTA)
6446 {
6447 tpSirMacMgmtHdr pMacHeader = WDA_GET_RX_MAC_HEADER( pvBDHeader );
Mahesh A Saptasagarbbdcf122014-10-28 20:57:11 +05306448 if (!IS_BROADCAST_ADD(pMacHeader->da) && IS_MULTICAST_ADD(pMacHeader->da))
Dino Mycle3b9536d2014-07-09 22:05:24 +05306449 {
6450 pClientSTA->interfaceStats.accessCategoryStats[ac].rxMcast++;
6451 }
6452
6453 WLANTL_HSGetDataRSSI(pvosGCtx, pvBDHeader, ucSTAId,
6454 &currentAvgRSSI);
6455 pClientSTA->interfaceStats.rssiData = currentAvgRSSI;
6456
6457 pClientSTA->interfaceStats.accessCategoryStats[ac].rxMpdu++;
6458 if (WDA_IS_RX_AN_AMPDU (pvBDHeader))
6459 {
6460 pClientSTA->interfaceStats.accessCategoryStats[ac].rxAmpdu++;
6461 }
6462 }
6463
6464
6465#endif
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05306466 vosStatus = WLANTL_ReadSNR(pvosGCtx, pvBDHeader, ucSTAId);
6467
6468 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
6469 {
6470 TLLOGW(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
6471 FL("Failed to Read SNR")));
6472 }
6473
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07006474 pfnSTAFsm( pvosGCtx, ucSTAId, &vosTempBuff, bForwardIAPPwithLLC);
Jeff Johnson295189b2012-06-20 16:38:30 -07006475 }
6476 else
6477 {
6478 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
6479 "WLAN TL:NULL state function, STA:%d, State: %d- dropping packet",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306480 ucSTAId, pClientSTA->tlState));
Jeff Johnson295189b2012-06-20 16:38:30 -07006481 /* Drop packet */
6482 vos_pkt_return_packet(vosTempBuff);
6483 vosTempBuff = vosDataBuff;
6484 continue;
6485 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006486 }/* else data frame*/
6487
6488 vosTempBuff = vosDataBuff;
6489 }/*while chain*/
6490
6491 return VOS_STATUS_SUCCESS;
6492}/* WLANTL_RxFrames */
6493
Dino Mycle3b9536d2014-07-09 22:05:24 +05306494#ifdef WLAN_FEATURE_LINK_LAYER_STATS
6495/*==========================================================================
6496
6497 FUNCTION WLANTL_CollectInterfaceStats
6498
6499 DESCRIPTION
6500 Utility function used by TL to send the statitics
6501
6502 DEPENDENCIES
6503
6504
6505 PARAMETERS
6506
6507 IN
6508
6509 ucSTAId: station for which the statistics need to collected
6510
6511 vosDataBuff: it will contain the pointer to the corresponding
6512 structure
6513
6514 RETURN VALUE
6515 The result code associated with performing the operation
6516
6517 VOS_STATUS_E_INVAL: Input parameters are invalid
6518 VOS_STATUS_SUCCESS: Everything is good :)
6519
6520 SIDE EFFECTS
6521
6522============================================================================*/
6523VOS_STATUS
6524WLANTL_CollectInterfaceStats
6525(
6526 v_PVOID_t pvosGCtx,
6527 v_U8_t ucSTAId,
6528 WLANTL_InterfaceStatsType *vosDataBuff
6529)
6530{
6531 WLANTL_CbType* pTLCb = NULL;
6532 /*------------------------------------------------------------------------
6533 Sanity check
6534 ------------------------------------------------------------------------*/
6535 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
6536 {
6537 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6538 "WLAN TL:Invalid station id requested on WLANTL_CollectStats"));
6539 return VOS_STATUS_E_FAULT;
6540 }
6541 /*------------------------------------------------------------------------
6542 Extract TL control block
6543 ------------------------------------------------------------------------*/
6544 pTLCb = VOS_GET_TL_CB(pvosGCtx);
6545 if ( NULL == pTLCb )
6546 {
6547 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6548 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_CollectStats"));
6549 return VOS_STATUS_E_FAULT;
6550 }
6551
6552 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
6553 {
6554 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6555 "WLAN TL:Client Memory was not allocated on %s", __func__));
6556 return VOS_STATUS_E_FAILURE;
6557 }
Srinivas Dasari98947432014-11-07 19:41:24 +05306558 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6559 "WLAN TL: collect WIFI_STATS_IFACE results"));
6560
Dino Mycle3b9536d2014-07-09 22:05:24 +05306561 vos_mem_copy(vosDataBuff, &pTLCb->atlSTAClients[ucSTAId]->interfaceStats,
6562 sizeof(WLANTL_InterfaceStatsType));
6563 return VOS_STATUS_SUCCESS;
6564}
6565
Srinivas Dasari98947432014-11-07 19:41:24 +05306566/*==========================================================================
6567
6568 FUNCTION WLANTL_ClearInterfaceStats
6569
6570 DESCRIPTION
6571 Utility function used by TL to clear the statitics
6572
6573 DEPENDENCIES
6574
6575
6576 PARAMETERS
6577
6578 IN
6579
6580 ucSTAId: station for which the statistics need to collected
6581
6582 RETURN VALUE
6583 The result code associated with performing the operation
6584
6585 VOS_STATUS_E_INVAL: Input parameters are invalid
6586 VOS_STATUS_SUCCESS: Everything is good :)
6587
6588 SIDE EFFECTS
6589
6590============================================================================*/
6591VOS_STATUS
6592WLANTL_ClearInterfaceStats
6593(
6594 v_PVOID_t pvosGCtx,
6595 v_U8_t ucSTAId,
6596 v_U8_t statsClearReqMask
6597)
6598{
6599 WLANTL_CbType* pTLCb = NULL;
6600 WLANTL_STAClientType* pClientSTA = NULL;
6601 /*------------------------------------------------------------------------
6602 Sanity check
6603 ------------------------------------------------------------------------*/
6604 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
6605 {
6606 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6607 "WLAN TL:Invalid station id requested on WLANTL_CollectStats"));
6608 return VOS_STATUS_E_FAULT;
6609 }
6610 /*------------------------------------------------------------------------
6611 Extract TL control block
6612 ------------------------------------------------------------------------*/
6613 pTLCb = VOS_GET_TL_CB(pvosGCtx);
6614 if ( NULL == pTLCb )
6615 {
6616 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6617 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_CollectStats"));
6618 return VOS_STATUS_E_FAULT;
6619 }
6620
6621 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
6622 if ( NULL == pClientSTA )
6623 {
6624 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6625 "WLAN TL:Client Memory was not allocated on %s", __func__));
6626 return VOS_STATUS_E_FAILURE;
6627 }
6628
6629 if ((statsClearReqMask & WIFI_STATS_IFACE_AC) ||
6630 (statsClearReqMask & WIFI_STATS_IFACE)) {
6631 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6632 "WLAN TL:cleared WIFI_STATS_IFACE_AC results"));
6633 pClientSTA->interfaceStats.accessCategoryStats[0].rxMcast = 0;
6634 pClientSTA->interfaceStats.accessCategoryStats[1].rxMcast = 0;
6635 pClientSTA->interfaceStats.accessCategoryStats[2].rxMcast = 0;
6636 pClientSTA->interfaceStats.accessCategoryStats[3].rxMcast = 0;
6637
6638 pClientSTA->interfaceStats.accessCategoryStats[0].rxMpdu = 0;
6639 pClientSTA->interfaceStats.accessCategoryStats[1].rxMpdu = 0;
6640 pClientSTA->interfaceStats.accessCategoryStats[2].rxMpdu = 0;
6641 pClientSTA->interfaceStats.accessCategoryStats[3].rxMpdu = 0;
6642
6643 pClientSTA->interfaceStats.accessCategoryStats[0].rxAmpdu = 0;
6644 pClientSTA->interfaceStats.accessCategoryStats[1].rxAmpdu = 0;
6645 pClientSTA->interfaceStats.accessCategoryStats[2].rxAmpdu = 0;
6646 pClientSTA->interfaceStats.accessCategoryStats[3].rxAmpdu = 0;
6647 }
6648
6649 if (statsClearReqMask & WIFI_STATS_IFACE) {
6650 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6651 "WLAN TL:cleared WIFI_STATS_IFACE results"));
6652 pClientSTA->interfaceStats.mgmtRx = 0;
6653 pClientSTA->interfaceStats.rssiData = 0;
6654 return VOS_STATUS_SUCCESS;
6655 }
6656
6657 return VOS_STATUS_SUCCESS;
6658}
6659
Dino Mycle3b9536d2014-07-09 22:05:24 +05306660#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
Jeff Johnson295189b2012-06-20 16:38:30 -07006661
6662/*==========================================================================
6663
6664 FUNCTION WLANTL_RxCachedFrames
6665
6666 DESCRIPTION
6667 Utility function used by TL to forward the cached frames to a particular
6668 station;
6669
6670 DEPENDENCIES
6671 TL must be initiailized before this function gets called.
6672 If the frame carried is a data frame then the station for which it is
6673 destined to must have been previously registered with TL.
6674
6675 PARAMETERS
6676
6677 IN
6678 pTLCb: pointer to TL handle
6679
6680 ucSTAId: station for which we need to forward the packets
6681
6682 vosDataBuff: it will contain a pointer to the first cached buffer
6683 received, if there is more then one packet they will be
6684 chained using vOSS buffers.
6685
6686 RETURN VALUE
6687 The result code associated with performing the operation
6688
6689 VOS_STATUS_E_INVAL: Input parameters are invalid
6690 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
6691 page fault
6692 VOS_STATUS_SUCCESS: Everything is good :)
6693
6694 SIDE EFFECTS
6695
6696============================================================================*/
6697VOS_STATUS
6698WLANTL_RxCachedFrames
6699(
6700 WLANTL_CbType* pTLCb,
6701 v_U8_t ucSTAId,
6702 vos_pkt_t* vosDataBuff
6703)
6704{
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306705 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006706 WLANTL_STAFuncType pfnSTAFsm;
6707 vos_pkt_t* vosTempBuff;
6708 VOS_STATUS vosStatus;
6709 v_PVOID_t pvBDHeader = NULL;
6710 WLANTL_STAEventType wSTAEvent = WLANTL_RX_EVENT;
6711 v_U8_t ucTid = 0;
6712 v_BOOL_t broadcast = VOS_FALSE;
6713 v_BOOL_t bSigMatch = VOS_FALSE;
6714 v_BOOL_t selfBcastLoopback = VOS_FALSE;
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -07006715 static v_U8_t first_data_pkt_arrived;
Jeff Johnson295189b2012-06-20 16:38:30 -07006716 v_U32_t uDPUSig;
6717 v_U8_t ucUcastSig;
6718 v_U8_t ucBcastSig;
6719 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
6720
6721 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6722 "WLAN TL:TL Receive Cached Frames called"));
6723
6724 /*------------------------------------------------------------------------
6725 Sanity check
6726 ------------------------------------------------------------------------*/
6727 if ( NULL == vosDataBuff )
6728 {
6729 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6730 "WLAN TL:Invalid parameter sent on WLANTL_RxFrames"));
6731 return VOS_STATUS_E_INVAL;
6732 }
6733
Mihir Sheteae6f02b2014-04-11 19:49:21 +05306734 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
6735
6736 if ( NULL == pClientSTA )
6737 {
6738 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6739 "WLAN TL:Client Memory was not allocated on %s", __func__));
6740 return VOS_STATUS_E_FAILURE;
6741 }
6742
6743 MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_FORWARD_CACHED_FRAMES,
6744 ucSTAId, 1<<16 | pClientSTA->tlCacheInfo.cacheSize));
6745
Jeff Johnson295189b2012-06-20 16:38:30 -07006746 /*---------------------------------------------------------------------
6747 Save the initial buffer - this is the first received buffer
6748 ---------------------------------------------------------------------*/
6749 vosTempBuff = vosDataBuff;
6750
6751 while ( NULL != vosTempBuff )
6752 {
Madan Mohan Koyyalamudia148e1e2012-11-30 14:52:59 -08006753 broadcast = VOS_FALSE;
6754 selfBcastLoopback = VOS_FALSE;
6755
Jeff Johnson295189b2012-06-20 16:38:30 -07006756 vos_pkt_walk_packet_chain( vosDataBuff, &vosDataBuff, 1/*true*/ );
6757
6758 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6759 "WLAN TL:Sending new cached packet to station %d", ucSTAId));
6760 /*---------------------------------------------------------------------
6761 Peek at BD header - do not remove
6762 !!! Optimize me: only part of header is needed; not entire one
6763 ---------------------------------------------------------------------*/
6764 vosStatus = WDA_DS_PeekRxPacketInfo( vosTempBuff, (v_PVOID_t)&pvBDHeader, 0 );
6765
6766 if ( NULL == pvBDHeader )
6767 {
6768 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6769 "WLAN TL:Cannot extract BD header"));
6770 /* Drop packet */
6771 vos_pkt_return_packet(vosTempBuff);
6772 vosTempBuff = vosDataBuff;
6773 continue;
6774 }
6775
6776 uDPUSig = WDA_GET_RX_DPUSIG( pvBDHeader );
6777
6778 /* AMSDU HW bug fix
6779 * After 2nd AMSDU subframe HW could not handle BD correctly
6780 * HAL workaround is needed */
6781 if(WDA_GET_RX_ASF(pvBDHeader))
6782 {
6783 WDA_DS_RxAmsduBdFix(vos_get_global_context(VOS_MODULE_ID_TL,pTLCb),
6784 pvBDHeader);
6785 }
6786
6787 ucTid = (v_U8_t)WDA_GET_RX_TID( pvBDHeader );
6788
6789 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6790 "WLAN TL:Data packet cached for STA %d", ucSTAId);
6791
6792 /*------------------------------------------------------------------
6793 This should be corrected when multipe sta support is added !!!
6794 for now bcast frames will be sent to the last registered STA
6795 ------------------------------------------------------------------*/
6796 if ( WDA_IS_RX_BCAST(pvBDHeader))
6797 {
6798 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
6799 "WLAN TL:TL rx Bcast frame "));
6800 broadcast = VOS_TRUE;
6801
6802 /* If Addr1 is b/mcast, but Addr3 is our own self MAC, it is a b/mcast
6803 * pkt we sent looping back to us. To be dropped if we are non BTAMP
6804 */
6805 if( WLANHAL_RX_BD_ADDR3_SELF_IDX ==
6806 (v_U8_t)WDA_GET_RX_ADDR3_IDX( pvBDHeader ))
6807 {
6808 selfBcastLoopback = VOS_TRUE;
6809 }
6810 }/*if bcast*/
6811
6812 /*-------------------------------------------------------------------------
6813 Check if the packet that we cached matches the DPU signature of the
6814 newly added station
6815 -------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306816 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
6817
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306818 if ( NULL == pClientSTA )
6819 {
6820 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6821 "WLAN TL:Client Memory was not allocated on %s", __func__));
6822 return VOS_STATUS_E_FAILURE;
6823 }
6824
Jeff Johnson295189b2012-06-20 16:38:30 -07006825 if ( broadcast )
6826 {
6827 ucBcastSig = (v_U8_t)uDPUSig;
6828 bSigMatch = (( WLAN_TL_INVALID_B_SIG !=
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306829 pClientSTA->wSTADesc.ucBcastSig ) &&
6830 ( ucBcastSig == pClientSTA->wSTADesc.ucBcastSig ));
Jeff Johnson295189b2012-06-20 16:38:30 -07006831 }
6832 else
6833 {
6834 ucUcastSig = (v_U8_t)uDPUSig;
6835 bSigMatch = (( WLAN_TL_INVALID_U_SIG !=
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306836 pClientSTA->wSTADesc.ucUcastSig ) &&
6837 ( ucUcastSig == pClientSTA->wSTADesc.ucUcastSig ));
Jeff Johnson295189b2012-06-20 16:38:30 -07006838 }
6839
6840 /*-------------------------------------------------------------------------
6841 If the packet doesn't match - drop it
6842 -------------------------------------------------------------------------*/
6843 if ( !bSigMatch )
6844 {
Rajesh Chauhana6b08f42013-06-18 19:01:26 -07006845 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_MED,
Jeff Johnson295189b2012-06-20 16:38:30 -07006846 "WLAN TL: Cached packet does not match DPU Sig of the new STA - drop "
6847 " DPU Sig %d UC %d BC %d B %d",
6848 uDPUSig,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306849 pClientSTA->wSTADesc.ucUcastSig,
Rajesh Chauhana6b08f42013-06-18 19:01:26 -07006850 pClientSTA->wSTADesc.ucBcastSig,
Jeff Johnson295189b2012-06-20 16:38:30 -07006851 broadcast));
6852
6853 /* Drop packet */
6854 vos_pkt_return_packet(vosTempBuff);
6855 vosTempBuff = vosDataBuff;
6856 continue;
6857
6858 }/*if signature mismatch*/
6859
6860 /*------------------------------------------------------------------------
6861 Check if BT-AMP frame:
6862 - additional processing needed in this case to separate BT-AMP date
6863 from BT-AMP Ctrl path
6864 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306865 if ( WLAN_STA_BT_AMP == pClientSTA->wSTADesc.wSTAType )
Jeff Johnson295189b2012-06-20 16:38:30 -07006866 {
6867 /*--------------------------------------------------------------------
6868 Process the ctrl BAP frame; if data it will return false and it
6869 will be routed through the regular data path
6870 --------------------------------------------------------------------*/
6871 if ( WLANTL_ProcessBAPFrame( pvBDHeader,
6872 vosTempBuff,
6873 pTLCb,
6874 &first_data_pkt_arrived,
6875 ucSTAId))
6876 {
6877 vosTempBuff = vosDataBuff;
6878 continue;
6879 }
6880 }/*if BT-AMP station*/
6881 else if(selfBcastLoopback == VOS_TRUE)
6882 {
6883 /* Drop packet */
6884 vos_pkt_return_packet(vosTempBuff);
6885 vosTempBuff = vosDataBuff;
6886 continue;
6887 }
6888
6889 /*---------------------------------------------------------------------
6890 Data packet received, send to state machine
6891 ---------------------------------------------------------------------*/
6892 wSTAEvent = WLANTL_RX_EVENT;
6893
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306894 pfnSTAFsm = tlSTAFsm[pClientSTA->tlState].
Jeff Johnson295189b2012-06-20 16:38:30 -07006895 pfnSTATbl[wSTAEvent];
6896
6897 if ( NULL != pfnSTAFsm )
6898 {
6899#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
6900 /* Read RSSI and update */
6901 vosStatus = WLANTL_HSHandleRXFrame(vos_get_global_context(
6902 VOS_MODULE_ID_TL,pTLCb),
6903 WLANTL_DATA_FRAME_TYPE,
6904 pvBDHeader,
6905 ucSTAId,
6906 broadcast,
6907 vosTempBuff);
6908 broadcast = VOS_FALSE;
6909#else
6910 vosStatus = WLANTL_ReadRSSI(vos_get_global_context(VOS_MODULE_ID_TL,pTLCb), pvBDHeader, ucSTAId);
Kiet Lam47325522014-03-10 11:50:46 -07006911#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07006912 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
6913 {
6914 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6915 "Handle RX Data Frame fail within Handoff support module"));
6916 /* Do Not Drop packet at here
6917 * Revisit why HO module return fail
6918 vos_pkt_return_packet(vosTempBuff);
6919 vosTempBuff = vosDataBuff;
6920 continue;
6921 */
6922 }
6923 pfnSTAFsm( vos_get_global_context(VOS_MODULE_ID_TL,pTLCb), ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07006924 &vosTempBuff, VOS_FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07006925 }
6926 else
6927 {
6928 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6929 "WLAN TL:NULL state function, STA:%d, State: %d- dropping packet",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05306930 ucSTAId, pClientSTA->tlState));
Jeff Johnson295189b2012-06-20 16:38:30 -07006931 /* Drop packet */
6932 vos_pkt_return_packet(vosTempBuff);
6933 vosTempBuff = vosDataBuff;
6934 continue;
6935 }
6936
6937 vosTempBuff = vosDataBuff;
6938 }/*while chain*/
6939
6940 return VOS_STATUS_SUCCESS;
6941}/* WLANTL_RxCachedFrames */
6942
6943/*==========================================================================
Katya Nigam664f5032014-05-05 12:24:32 +05306944 FUNCTION WLANTL_RxProcessMsg
6945
6946 DESCRIPTION
6947 Called by VOSS when a message was serialized for TL through the
6948 rx thread/task.
6949
6950 DEPENDENCIES
6951 The TL must be initialized before this function can be called.
6952
6953 PARAMETERS
6954
6955 IN
6956 pvosGCtx: pointer to the global vos context; a handle to TL's
6957 control block can be extracted from its context
6958 message: type and content of the message
6959
6960
6961 RETURN VALUE
6962 The result code associated with performing the operation
6963
6964 VOS_STATUS_E_INVAL: invalid input parameters
6965 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
6966 page fault
6967 VOS_STATUS_SUCCESS: Everything is good :)
6968
6969 Other values can be returned as a result of a function call, please check
6970 corresponding API for more info.
6971 SIDE EFFECTS
6972
6973============================================================================*/
6974VOS_STATUS
6975WLANTL_RxProcessMsg
6976(
6977 v_PVOID_t pvosGCtx,
6978 vos_msg_t* message
6979)
6980{
6981 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6982 v_U32_t uData;
6983 v_U8_t ucSTAId;
6984 v_U8_t ucUcastSig;
6985 v_U8_t ucBcastSig;
6986
6987 /*------------------------------------------------------------------------
6988 Sanity check
6989 ------------------------------------------------------------------------*/
6990 if ( NULL == message )
6991 {
6992 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
6993 "WLAN TL:Invalid parameter sent on WLANTL_RxProcessMessage"));
6994 return VOS_STATUS_E_INVAL;
6995 }
6996
6997 /*------------------------------------------------------------------------
6998 Process message
6999 ------------------------------------------------------------------------*/
7000 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
7001 "WLAN TL:Received message: %d through rx flow", message->type));
7002
7003 switch( message->type )
7004 {
7005
7006 case WLANTL_RX_FWD_CACHED:
7007 /*---------------------------------------------------------------------
7008 The data sent with the message has the following structure:
7009 | 00 | ucBcastSignature | ucUcastSignature | ucSTAID |
7010 each field above is one byte
7011 ---------------------------------------------------------------------*/
7012 uData = message->bodyval;
7013 ucSTAId = ( uData & 0x000000FF);
7014 ucUcastSig = ( uData & 0x0000FF00)>>8;
7015 ucBcastSig = (v_U8_t)(( uData & 0x00FF0000)>>16);
7016 vosStatus = WLANTL_ForwardSTAFrames( pvosGCtx, ucSTAId,
7017 ucUcastSig, ucBcastSig);
7018 break;
7019
7020 default:
7021 /*no processing for now*/
7022 break;
7023 }
7024
7025 return VOS_STATUS_SUCCESS;
7026}
7027
7028
7029/*==========================================================================
Jeff Johnson295189b2012-06-20 16:38:30 -07007030 FUNCTION WLANTL_ResourceCB
7031
7032 DESCRIPTION
7033 Called by the TL when it has packets available for transmission.
7034
7035 DEPENDENCIES
7036 The TL must be registered with BAL before this function can be called.
7037
7038 PARAMETERS
7039
7040 IN
7041 pvosGCtx: pointer to the global vos context; a handle to TL's
7042 or BAL's control block can be extracted from its context
7043
7044 RETURN VALUE
7045 The result code associated with performing the operation
7046
7047 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
7048 page fault
7049 VOS_STATUS_SUCCESS: Everything is good :)
7050
7051 SIDE EFFECTS
7052
7053============================================================================*/
7054VOS_STATUS
7055WLANTL_ResourceCB
7056(
7057 v_PVOID_t pvosGCtx,
7058 v_U32_t uCount
7059)
7060{
7061 WLANTL_CbType* pTLCb = NULL;
7062 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
7063
7064 /*------------------------------------------------------------------------
7065 Sanity check
7066 Extract TL control block
7067 ------------------------------------------------------------------------*/
7068 pTLCb = VOS_GET_TL_CB(pvosGCtx);
7069 if ( NULL == pTLCb )
7070 {
7071 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7072 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
7073 return VOS_STATUS_E_FAULT;
7074 }
7075
7076 pTLCb->uResCount = uCount;
7077
7078
7079 /*-----------------------------------------------------------------------
7080 Resume Tx if enough res and not suspended
7081 -----------------------------------------------------------------------*/
7082 if (( pTLCb->uResCount >= WDA_TLI_MIN_RES_MF ) &&
7083 ( 0 == pTLCb->ucTxSuspended ))
7084 {
7085 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
7086 "WLAN TL:Issuing Xmit start request to BAL for avail res ASYNC"));
7087 return WDA_DS_StartXmit(pvosGCtx);
7088 }
7089
7090 return VOS_STATUS_SUCCESS;
7091}/* WLANTL_ResourceCB */
7092
7093
Gopichand Nakkala11acd112012-12-31 16:04:04 -08007094/*==========================================================================
7095 FUNCTION WLANTL_IsTxXmitPending
7096
7097 DESCRIPTION
7098 Called by the WDA when it wants to know whether WDA_DS_TX_START_XMIT msg
7099 is pending in TL msg queue
7100
7101 DEPENDENCIES
7102 The TL must be registered with WDA before this function can be called.
7103
7104 PARAMETERS
7105
7106 IN
7107 pvosGCtx: pointer to the global vos context; a handle to TL's
7108 or WDA's control block can be extracted from its context
7109
7110 RETURN VALUE
7111 The result code associated with performing the operation
7112
7113 0: No WDA_DS_TX_START_XMIT msg pending
7114 1: Msg WDA_DS_TX_START_XMIT already pending in TL msg queue
7115
7116 SIDE EFFECTS
7117
7118============================================================================*/
7119v_BOOL_t
7120WLANTL_IsTxXmitPending
7121(
7122 v_PVOID_t pvosGCtx
7123)
7124{
7125
7126 WLANTL_CbType* pTLCb = NULL;
7127 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
7128
7129 /*------------------------------------------------------------------------
7130 Sanity check
7131 Extract TL control block
7132 ------------------------------------------------------------------------*/
7133 pTLCb = VOS_GET_TL_CB(pvosGCtx);
7134 if ( NULL == pTLCb )
7135 {
7136 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
7137 "WLAN TL:Invalid TL pointer from pvosGCtx in WLANTL_IsTxXmitPending "));
7138 return FALSE;
7139 }
7140
7141 return pTLCb->isTxTranmitMsgPending;
7142
7143}/*WLANTL_IsTxXmitPending */
7144
7145/*==========================================================================
7146 FUNCTION WLANTL_SetTxXmitPending
7147
7148 DESCRIPTION
7149 Called by the WDA when it wants to indicate that WDA_DS_TX_START_XMIT msg
7150 is pending in TL msg queue
7151
7152 DEPENDENCIES
7153 The TL must be registered with WDA before this function can be called.
7154
7155 PARAMETERS
7156
7157 IN
7158 pvosGCtx: pointer to the global vos context; a handle to TL's
7159 or WDA's control block can be extracted from its context
7160
7161 RETURN VALUE None
7162
7163 SIDE EFFECTS
7164
7165============================================================================*/
7166
7167v_VOID_t
7168WLANTL_SetTxXmitPending
7169(
7170 v_PVOID_t pvosGCtx
7171)
7172{
7173
7174 WLANTL_CbType* pTLCb = NULL;
7175 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
7176
7177 /*------------------------------------------------------------------------
7178 Sanity check
7179 Extract TL control block
7180 ------------------------------------------------------------------------*/
7181 pTLCb = VOS_GET_TL_CB(pvosGCtx);
7182 if ( NULL == pTLCb )
7183 {
7184 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
7185 "WLAN TL:Invalid TL pointer from pvosGCtx in WLANTL_SetTxXmitPending"));
7186 return;
7187 }
7188
7189 pTLCb->isTxTranmitMsgPending = 1;
7190 return;
7191
7192}/*WLANTL_SetTxXmitPending */
7193
7194/*==========================================================================
7195 FUNCTION WLANTL_ClearTxXmitPending
7196
7197 DESCRIPTION
7198 Called by the WDA when it wants to indicate that no WDA_DS_TX_START_XMIT msg
7199 is pending in TL msg queue
7200
7201 DEPENDENCIES
7202 The TL must be registered with WDA before this function can be called.
7203
7204 PARAMETERS
7205
7206 IN
7207 pvosGCtx: pointer to the global vos context; a handle to TL's
7208 or WDA's control block can be extracted from its context
7209
7210 RETURN VALUE None
7211
7212 SIDE EFFECTS
7213
7214============================================================================*/
7215
7216v_VOID_t
7217WLANTL_ClearTxXmitPending
7218(
7219 v_PVOID_t pvosGCtx
7220)
7221{
7222
7223 WLANTL_CbType* pTLCb = NULL;
7224 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
7225
7226 /*------------------------------------------------------------------------
7227 Sanity check
7228 Extract TL control block
7229 ------------------------------------------------------------------------*/
7230 pTLCb = VOS_GET_TL_CB(pvosGCtx);
7231 if ( NULL == pTLCb )
7232 {
7233 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
7234 "WLAN TL:Invalid TL pointer from pvosGCtx in WLANTL_ClearTxXmitPending "));
7235 return;
7236 }
7237
7238 pTLCb->isTxTranmitMsgPending = 0;
7239 return;
7240}/*WLANTL_ClearTxXmitPending */
7241
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307242/*==========================================================================
7243 FUNCTION WLANTL_TxThreadDebugHandler
7244
7245 DESCRIPTION
7246 Printing TL Snapshot dump, processed under TxThread context, currently
7247 information regarding the global TlCb struture. Dumps information related
7248 to per active STA connection currently in use by TL.
7249
7250 DEPENDENCIES
7251 The TL must be initialized before this gets called.
7252
7253 PARAMETERS
7254
7255 IN
7256 pvosGCtx: pointer to the global vos context; a handle to TL's
7257 or WDA's control block can be extracted from its context
7258
7259 RETURN VALUE None
7260
7261 SIDE EFFECTS
7262
7263============================================================================*/
7264
7265v_VOID_t
7266WLANTL_TxThreadDebugHandler
7267(
7268 v_PVOID_t *pVosContext
7269)
7270{
7271 WLANTL_CbType* pTLCb = NULL;
7272 WLANTL_STAClientType* pClientSTA = NULL;
7273 int i = 0;
Mihir Shete5d148f12014-12-16 17:54:49 +05307274 v_U8_t uFlowMask; // TX FlowMask from WDA
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307275
7276 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
7277 "WLAN TL: %s Enter ", __func__));
7278
7279 pTLCb = VOS_GET_TL_CB(pVosContext);
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307280
7281 if ( NULL == pVosContext || NULL == pTLCb )
7282 {
7283 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7284 "Global VoS Context or TL Context are NULL"));
7285 return;
7286 }
7287
Mihir Shete5d148f12014-12-16 17:54:49 +05307288 if (VOS_STATUS_SUCCESS == WDA_DS_GetTxFlowMask(pVosContext, &uFlowMask))
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307289 {
7290 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Mihir Shete5d148f12014-12-16 17:54:49 +05307291 "WDA uTxFlowMask: 0x%x", uFlowMask));
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307292 }
Mihir Shete5d148f12014-12-16 17:54:49 +05307293
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307294 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7295 "************************TL DUMP INFORMATION**************"));
7296
7297 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7298 "uDelayedTriggerFrmInt:%d\tuMinFramesProcThres:%d",
7299 pTLCb->tlConfigInfo.uDelayedTriggerFrmInt,
7300 pTLCb->tlConfigInfo.uMinFramesProcThres));
7301
7302 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7303 "Management Frame Client exists: %d",
7304 pTLCb->tlMgmtFrmClient.ucExists));
7305 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7306 "usPendingTxCompleteCount: %d\tucTxSuspended: %d",
7307 pTLCb->usPendingTxCompleteCount,
7308 pTLCb->ucTxSuspended));
7309
7310 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7311 "uResCount: %d", pTLCb->uResCount));
7312
7313 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7314 "ucRegisteredStaId: %d\tucCurrentSTA: %d",
7315 pTLCb->ucRegisteredStaId, pTLCb->ucCurrentSTA));
7316
7317 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7318 "UrgentFrameProcessing: %s\tuFramesProcThres: %d",
7319 (pTLCb->bUrgent?"True":"False"), pTLCb->uFramesProcThres));
7320
7321 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7322 "isTxTranmitMsgPending: %d\t isBMPS: %s",
7323 pTLCb->isTxTranmitMsgPending, pTLCb->isBMPS?"True":"False"));
7324
7325#ifdef FEATURE_WLAN_TDLS
7326 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7327 "TDLS Peer Count: %d", pTLCb->ucTdlsPeerCount));
7328#endif
7329
Mukul Sharma252582d2015-10-23 16:47:36 +05307330 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307331 "++++++++++++++++++++Registerd Client Information++++++++++"));
7332
7333 for ( i =0; i<WLAN_MAX_STA_COUNT; i++ )
7334 {
7335 pClientSTA = pTLCb->atlSTAClients[i];
7336 if( NULL == pClientSTA || 0 == pClientSTA->ucExists)
7337 {
7338 continue;
7339 }
7340
Mukul Sharma252582d2015-10-23 16:47:36 +05307341 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307342 "######################STA Index: %d ############################",i));
Mukul Sharma252582d2015-10-23 16:47:36 +05307343 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, "WLAN_STADescType:"));
7344 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307345 "STAId: %d\t STA MAC Address: %pM", pClientSTA->wSTADesc.ucSTAId,
7346 pClientSTA->wSTADesc.vSTAMACAddress.bytes));
Mukul Sharma252582d2015-10-23 16:47:36 +05307347 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307348 "STA Type: %d\tProtectedFrame: %d",
7349 pClientSTA->wSTADesc.wSTAType, pClientSTA->wSTADesc.ucProtectedFrame));
Mukul Sharma252582d2015-10-23 16:47:36 +05307350 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307351 "QoS: %d\tRxFrameTrans: %d\tTxFrameTrans: %d",
7352 pClientSTA->wSTADesc.ucQosEnabled, pClientSTA->wSTADesc.ucSwFrameRXXlation,
7353 pClientSTA->wSTADesc.ucSwFrameTXXlation));
Mukul Sharma252582d2015-10-23 16:47:36 +05307354 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307355 "ucUcastSig: %d\tucBcastSig: %d", pClientSTA->wSTADesc.ucUcastSig,
7356 pClientSTA->wSTADesc.ucBcastSig));
7357
Mukul Sharma252582d2015-10-23 16:47:36 +05307358 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307359 "ClientIndex: %d\t Exists: %d", i, pClientSTA->ucExists));
Mukul Sharma252582d2015-10-23 16:47:36 +05307360 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307361 "TL State: %d\t TL Priority: %d", pClientSTA->tlState,
7362 pClientSTA->tlPri));
Mukul Sharma252582d2015-10-23 16:47:36 +05307363 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307364 "ucTxSuspended: %d\tucPktPending: %d", pClientSTA->ucTxSuspended,
7365 pClientSTA->ucPktPending));
Mukul Sharma252582d2015-10-23 16:47:36 +05307366 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307367 "ucEAPOLPktPending: %d\tucNoMoreData: %d",
7368 pClientSTA->ucEapolPktPending, pClientSTA->ucNoMoreData));
Mukul Sharma252582d2015-10-23 16:47:36 +05307369 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Katya Nigam63902932014-06-26 19:04:23 +05307370 "enableCaching: %d\t fcStaTxDisabled: %d", pClientSTA->enableCaching,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307371 pClientSTA->fcStaTxDisabled));
Mukul Sharma252582d2015-10-23 16:47:36 +05307372 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307373 "ucCurrentAC: %d\tucServicedAC: %d", pClientSTA->ucCurrentAC,
7374 pClientSTA->ucServicedAC));
Mukul Sharma252582d2015-10-23 16:47:36 +05307375 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307376 "TID: %d\tautTxCount[0]: %d\tauRxCount[0]: %d",0, pClientSTA->auTxCount[0],
7377 pClientSTA->auRxCount[0]));
Mukul Sharma252582d2015-10-23 16:47:36 +05307378 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307379 "aucAcMask[0]: %d\taucAcMask[1]: %d\taucAcMask[2]: %d\taucAcMask[3]: %d\t",
7380 pClientSTA->aucACMask[0], pClientSTA->aucACMask[1],
7381 pClientSTA->aucACMask[2], pClientSTA->aucACMask[3]));
7382 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Mukul Sharma252582d2015-10-23 16:47:36 +05307383
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307384 "ucCurrentWeight: %d", pClientSTA->ucCurrentWeight));
7385
7386 if( WLAN_STA_SOFTAP == pClientSTA->wSTADesc.wSTAType)
7387 {
mukul sharma2cdb8ea2015-10-01 14:53:38 +05307388 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307389 "TrafficStatistics for SOFTAP Station:"));
mukul sharma2cdb8ea2015-10-01 14:53:38 +05307390 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307391 "RUF=%d\tRMF=%d\tRBF=%d", pClientSTA->trafficStatistics.rxUCFcnt,
7392 pClientSTA->trafficStatistics.rxMCFcnt,
7393 pClientSTA->trafficStatistics.rxBCFcnt));
mukul sharma2cdb8ea2015-10-01 14:53:38 +05307394 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307395 "RUB=%d\tRMB=%d\tRBB=%d", pClientSTA->trafficStatistics.rxUCBcnt,
7396 pClientSTA->trafficStatistics.rxMCBcnt,
7397 pClientSTA->trafficStatistics.rxBCBcnt));
mukul sharma2cdb8ea2015-10-01 14:53:38 +05307398 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307399 "TUF=%d\tTMF=%d\tTBF=%d", pClientSTA->trafficStatistics.txUCFcnt,
7400 pClientSTA->trafficStatistics.txMCFcnt,
7401 pClientSTA->trafficStatistics.txBCFcnt));
mukul sharma2cdb8ea2015-10-01 14:53:38 +05307402 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307403 "TUB=%d\tTMB=%d\tTBB=%d", pClientSTA->trafficStatistics.txUCBcnt,
7404 pClientSTA->trafficStatistics.txMCBcnt,
7405 pClientSTA->trafficStatistics.txBCBcnt));
7406 }
mukul sharma2cdb8ea2015-10-01 14:53:38 +05307407
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307408 }
7409 return;
7410}
7411
7412/*==========================================================================
Mihir Shetefd62d9d2014-08-06 15:08:21 +05307413 FUNCTION WLANTL_FatalErrorHandler
7414
7415 DESCRIPTION
7416 Handle Fatal errors detected on the TX path.
7417 Currently issues SSR to recover from the error.
7418
7419 DEPENDENCIES
7420 The TL must be initialized before this gets called.
7421
7422 PARAMETERS
7423
7424 IN
7425 pvosGCtx: pointer to the global vos context; a handle to TL's
7426 or WDA's control block can be extracted from its context
7427
7428 RETURN VALUE None
7429
7430 SIDE EFFECTS
7431
7432============================================================================*/
7433v_VOID_t
7434WLANTL_FatalErrorHandler
7435(
7436 v_PVOID_t *pVosContext
7437)
7438{
7439
7440 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
7441 "WLAN TL: %s Enter ", __func__));
7442
7443 if ( NULL == pVosContext )
7444 {
7445 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7446 "%s: Global VoS Context or TL Context are NULL",
7447 __func__));
7448 return;
7449 }
7450
7451 /*
7452 * Issue SSR. vos_wlanRestart has tight checks to make sure that
7453 * we do not send an FIQ if previous FIQ is not processed
7454 */
7455 vos_wlanRestart();
7456}
7457
7458/*==========================================================================
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307459 FUNCTION WLANTL_TLDebugMessage
7460
7461 DESCRIPTION
7462 Post a TL Snapshot request, posts message in TxThread.
7463
7464 DEPENDENCIES
7465 The TL must be initialized before this gets called.
7466
7467 PARAMETERS
7468
7469 IN
7470 displaySnapshot Boolean showing whether to dump the snapshot or not.
7471
7472 RETURN VALUE None
7473
7474 SIDE EFFECTS
7475
7476============================================================================*/
7477
7478v_VOID_t
7479WLANTL_TLDebugMessage
7480(
Mihir Shete327c2ab2014-11-13 15:17:02 +05307481 v_U32_t debugFlags
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307482)
7483{
7484 vos_msg_t vosMsg;
7485 VOS_STATUS status;
7486
Mihir Shete327c2ab2014-11-13 15:17:02 +05307487 if(debugFlags & WLANTL_DEBUG_TX_SNAPSHOT)
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307488 {
7489 vosMsg.reserved = 0;
7490 vosMsg.bodyptr = NULL;
7491 vosMsg.type = WLANTL_TX_SNAPSHOT;
7492
7493 status = vos_tx_mq_serialize( VOS_MODULE_ID_TL, &vosMsg);
7494 if(status != VOS_STATUS_SUCCESS)
7495 {
7496 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "TX Msg Posting Failed with status: %d",status));
7497 return;
7498 }
7499 }
Mihir Shete327c2ab2014-11-13 15:17:02 +05307500 if (debugFlags & WLANTL_DEBUG_FW_CLEANUP)
7501 {
7502 vosMsg.reserved = 0;
7503 vosMsg.bodyptr = NULL;
7504 vosMsg.type = WLANTL_TX_FW_DEBUG;
7505
7506 status = vos_tx_mq_serialize( VOS_MODULE_ID_TL, &vosMsg);
7507 if(status != VOS_STATUS_SUCCESS)
7508 {
7509 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "TX Msg Posting Failed with status: %d",status));
7510 return;
7511 }
7512 }
Sravan Kumar Kairame9d186c2015-11-27 23:37:02 +05307513 if(debugFlags & WLANTL_DEBUG_KICKDXE)
7514 {
7515 vosMsg.reserved = 0;
7516 vosMsg.bodyptr = NULL;
7517 vosMsg.type = WLANTL_TX_KICKDXE;
7518
7519 status = vos_tx_mq_serialize( VOS_MODULE_ID_TL, &vosMsg);
7520 if(status != VOS_STATUS_SUCCESS)
7521 {
7522 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "TX Msg Posting Failed with status: %d",status));
7523 return;
7524 }
7525 }
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05307526 return;
7527}
Jeff Johnson295189b2012-06-20 16:38:30 -07007528
Mihir Shetefd62d9d2014-08-06 15:08:21 +05307529/*==========================================================================
7530 FUNCTION WLANTL_FatalError
7531
7532 DESCRIPTION
7533 Fatal error reported in TX path, post an event to TX Thread for further
7534 handling
7535
7536 DEPENDENCIES
7537 The TL must be initialized before this gets called.
7538
7539 PARAMETERS
7540
7541 VOID
7542
7543 RETURN VALUE None
7544
7545 SIDE EFFECTS
7546
7547============================================================================*/
7548
7549v_VOID_t
7550WLANTL_FatalError
7551(
7552 v_VOID_t
7553)
7554{
7555 vos_msg_t vosMsg;
7556 VOS_STATUS status;
7557
7558 vosMsg.reserved = 0;
7559 vosMsg.bodyptr = NULL;
7560 vosMsg.type = WLANTL_TX_FATAL_ERROR;
7561
7562 status = vos_tx_mq_serialize( VOS_MODULE_ID_TL, &vosMsg);
7563 if(status != VOS_STATUS_SUCCESS)
7564 {
7565 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7566 "%s: TX Msg Posting Failed with status: %d",
7567 __func__,status));
7568 }
7569 return;
7570}
Jeff Johnson295189b2012-06-20 16:38:30 -07007571/*============================================================================
7572 TL STATE MACHINE
7573============================================================================*/
7574
7575/*==========================================================================
7576 FUNCTION WLANTL_STATxConn
7577
7578 DESCRIPTION
7579 Transmit in connected state - only EAPOL and WAI packets allowed
7580
7581 DEPENDENCIES
7582 The STA must be registered with TL before this function can be called.
7583
7584 PARAMETERS
7585
7586 IN
7587 pvosGCtx: pointer to the global vos context; a handle to TL's
7588 control block can be extracted from its context
7589 ucSTAId: identifier of the station being processed
7590 vosDataBuff: pointer to the tx vos buffer
7591
7592 RETURN VALUE
7593 The result code associated with performing the operation
7594
7595 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
7596 page fault
7597 VOS_STATUS_SUCCESS: Everything is good :)
7598
7599 Other return values are possible coming from the called functions.
7600 Please check API for additional info.
7601
7602 SIDE EFFECTS
7603
7604============================================================================*/
7605VOS_STATUS
7606WLANTL_STATxConn
7607(
7608 v_PVOID_t pvosGCtx,
7609 v_U8_t ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07007610 vos_pkt_t** pvosDataBuff,
7611 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -07007612)
7613{
7614 v_U16_t usPktLen;
7615 VOS_STATUS vosStatus;
7616 v_MACADDR_t vDestMacAddr;
7617 vos_pkt_t* vosDataBuff = NULL;
7618 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307619 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007620 WLANTL_MetaInfoType tlMetaInfo;
7621 v_U8_t ucTypeSubtype = 0;
7622 v_U8_t ucTid;
7623 v_U8_t extraHeadSpace = 0;
7624 v_U8_t ucWDSEnabled = 0;
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007625 v_U8_t ucAC, ucACMask, i;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05307626 v_U32_t txFlag = HAL_TX_NO_ENCRYPTION_MASK;
Jeff Johnson295189b2012-06-20 16:38:30 -07007627 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
7628
7629 /*------------------------------------------------------------------------
7630 Sanity check
7631 Extract TL control block
7632 ------------------------------------------------------------------------*/
7633 pTLCb = VOS_GET_TL_CB(pvosGCtx);
7634 if ( NULL == pTLCb )
7635 {
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007636 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7637 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STATxConn");
Jeff Johnson295189b2012-06-20 16:38:30 -07007638 *pvosDataBuff = NULL;
7639 return VOS_STATUS_E_FAULT;
7640 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307641 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
7642
7643 if ( NULL == pClientSTA )
7644 {
7645 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7646 "WLAN TL:Client Memory was not allocated on %s", __func__));
7647 return VOS_STATUS_E_FAILURE;
7648 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007649
7650 /*-------------------------------------------------------------------
7651 Disable AC temporary - if successfull retrieve re-enable
7652 The order is justified because of the possible scenario
7653 - TL tryes to fetch packet for AC and it returns NULL
7654 - TL analyzes the data it has received to see if there are
7655 any more pkts available for AC -> if not TL will disable AC
7656 - however it is possible that while analyzing results TL got
7657 preempted by a pending indication where the mask was again set
7658 TL will not check again and as a result when it resumes
7659 execution it will disable AC
7660 To prevent this the AC will be disabled here and if retrieve
7661 is successfull it will be re-enabled
7662 -------------------------------------------------------------------*/
7663
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007664
7665 //LTI:pTLCb->atlSTAClients[ucSTAId].
7666 //LTI: aucACMask[pTLCb->atlSTAClients[ucSTAId].ucCurrentAC] = 0;
7667
7668 /*------------------------------------------------------------------------
7669 Fetch packet from HDD
7670 ------------------------------------------------------------------------*/
Sunil Ravid5406f22013-01-22 00:18:31 -08007671#ifdef FEATURE_WLAN_TDLS
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307672 if ((WLAN_STA_SOFTAP != pClientSTA->wSTADesc.wSTAType) &&
Agarwal Ashishcd86f7b2014-06-16 17:11:58 +05307673 !(vos_concurrent_open_sessions_running()) &&
Sunil Ravid5406f22013-01-22 00:18:31 -08007674 !pTLCb->ucTdlsPeerCount)
7675 {
7676#else
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307677 if ((WLAN_STA_SOFTAP != pClientSTA->wSTADesc.wSTAType) &&
Agarwal Ashishcd86f7b2014-06-16 17:11:58 +05307678 !(vos_concurrent_open_sessions_running()))
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007679 {
Sunil Ravid5406f22013-01-22 00:18:31 -08007680#endif
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307681 ucAC = pClientSTA->ucCurrentAC;
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007682
7683 /*-------------------------------------------------------------------
7684 Disable AC temporary - if successfull retrieve re-enable
7685 The order is justified because of the possible scenario
7686 - TL tryes to fetch packet for AC and it returns NULL
7687 - TL analyzes the data it has received to see if there are
7688 any more pkts available for AC -> if not TL will disable AC
7689 - however it is possible that while analyzing results TL got
7690 preempted by a pending indication where the mask was again set
7691 TL will not check again and as a result when it resumes
7692 execution it will disable AC
7693 To prevent this the AC will be disabled here and if retrieve
7694 is successfull it will be re-enabled
7695 -------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307696 pClientSTA->aucACMask[ucAC] = 0;
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007697 }
7698 else
7699 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307700 //softap case
7701 ucAC = pTLCb->uCurServedAC;
7702 pClientSTA->aucACMask[ucAC] = 0;
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007703 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007704
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307705 /*You make an initial assumption that HDD has no more data and if the
Jeff Johnson295189b2012-06-20 16:38:30 -07007706 assumption was wrong you reset the flags to their original state
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307707 This will prevent from exposing a race condition between checking with HDD
Jeff Johnson295189b2012-06-20 16:38:30 -07007708 for packets and setting the flags to false*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307709 //LTI: vos_atomic_set_U8( &pTLCb->atlSTAClients[ucSTAId].ucPktPending, 0);
7710 //LTI: pTLCb->atlSTAClients[ucSTAId].ucNoMoreData = 1;
7711 vos_atomic_set_U8( &pClientSTA->ucPktPending, 0);
7712 WLAN_TL_AC_ARRAY_2_MASK( pClientSTA, ucACMask, i);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307713 /*You make an initial assumption that HDD has no more data and if the
7714 assumption was wrong you reset the flags to their original state
7715 This will prevent from exposing a race condition between checking with HDD
7716 for packets and setting the flags to false*/
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007717 if ( 0 == ucACMask )
7718 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307719 pClientSTA->ucNoMoreData = 1;
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007720 }
7721 else
7722 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307723 vos_atomic_set_U8( &pClientSTA->ucPktPending, 1);
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007724 }
7725
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007726
Madan Mohan Koyyalamudid93f4942012-10-05 15:05:40 -07007727 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007728 "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 +05307729 ucAC, ucACMask, pClientSTA->ucPktPending);
Jeff Johnson295189b2012-06-20 16:38:30 -07007730
7731 /*------------------------------------------------------------------------
7732 Fetch tx packet from HDD
7733 ------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007734
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307735 vosStatus = pClientSTA->pfnSTAFetchPkt( pvosGCtx,
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007736 &ucSTAId,
7737 ucAC,
7738 &vosDataBuff, &tlMetaInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07007739
7740 if (( VOS_STATUS_SUCCESS != vosStatus ) || ( NULL == vosDataBuff ))
7741 {
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007742 TLLOG1(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Jeff Johnson295189b2012-06-20 16:38:30 -07007743 "WLAN TL:No more data at HDD status %d", vosStatus));
7744 *pvosDataBuff = NULL;
7745
7746 /*--------------------------------------------------------------------
7747 Reset AC for the serviced station to the highest priority AC
7748 -> due to no more data at the station
7749 Even if this AC is not supported by the station, correction will be
7750 made in the main TL loop
7751 --------------------------------------------------------------------*/
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +05307752 pClientSTA->ucCurrentAC = WLANTL_AC_HIGH_PRIO;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307753 pClientSTA->ucCurrentWeight = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07007754
Madan Mohan Koyyalamudid8000342012-11-08 14:55:26 -08007755 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07007756 "WLAN TL: WLANTL_STATxConn no more packets in HDD for AC: %d AC Mask: %d",
7757 ucAC, ucACMask);
7758
Jeff Johnson295189b2012-06-20 16:38:30 -07007759 return vosStatus;
7760 }
7761
7762 /*There are still packets in HDD - set back the pending packets and
7763 the no more data assumption*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307764 vos_atomic_set_U8( &pClientSTA->ucPktPending, 1);
7765 pClientSTA->ucNoMoreData = 0;
7766 pClientSTA->aucACMask[ucAC] = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07007767
Jeff Johnson295189b2012-06-20 16:38:30 -07007768#ifdef WLAN_PERF
7769 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAL,
7770 (v_PVOID_t)0);
7771
7772#endif /*WLAN_PERF*/
7773
7774
7775#ifdef FEATURE_WLAN_WAPI
7776 /*------------------------------------------------------------------------
7777 If the packet is neither an Eapol packet nor a WAI packet then drop it
7778 ------------------------------------------------------------------------*/
7779 if ( 0 == tlMetaInfo.ucIsEapol && 0 == tlMetaInfo.ucIsWai )
7780 {
Madan Mohan Koyyalamudid93f4942012-10-05 15:05:40 -07007781 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Jeff Johnson295189b2012-06-20 16:38:30 -07007782 "WLAN TL:Only EAPOL or WAI packets allowed before authentication"));
7783
7784 /* Fail tx for packet */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307785 pClientSTA->pfnSTATxComp( pvosGCtx, vosDataBuff,
Jeff Johnson295189b2012-06-20 16:38:30 -07007786 VOS_STATUS_E_BADMSG);
7787 vosDataBuff = NULL;
7788 *pvosDataBuff = NULL;
7789 return VOS_STATUS_SUCCESS;
7790 }
7791#else
7792 if ( 0 == tlMetaInfo.ucIsEapol )
7793 {
7794 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
7795 "WLAN TL:Received non EAPOL packet before authentication"));
7796
7797 /* Fail tx for packet */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307798 pClientSTA->pfnSTATxComp( pvosGCtx, vosDataBuff,
Jeff Johnson295189b2012-06-20 16:38:30 -07007799 VOS_STATUS_E_BADMSG);
7800 vosDataBuff = NULL;
7801 *pvosDataBuff = NULL;
7802 return VOS_STATUS_SUCCESS;
7803 }
7804#endif /* FEATURE_WLAN_WAPI */
7805
7806 /*-------------------------------------------------------------------------
7807 Check TID
7808 -------------------------------------------------------------------------*/
7809 ucTid = tlMetaInfo.ucTID;
7810
7811 /*Make sure TID is valid*/
7812 if ( WLANTL_TID_INVALID(ucTid))
7813 {
Rajesh Chauhan2df40bf2013-08-22 11:26:12 -07007814 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Jeff Johnson295189b2012-06-20 16:38:30 -07007815 "WLAN TL:Invalid TID sent in meta info %d - defaulting to 0 (BE)",
7816 ucTid));
7817 ucTid = 0;
7818 }
7819
7820 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
7821 "WLAN TL:Attaching BD header to pkt on WLANTL_STATxConn"));
7822
7823#ifdef FEATURE_WLAN_WAPI
7824 /*------------------------------------------------------------------------
7825 Translate 802.3 frame to 802.11 if Frame translation is enabled or if
7826 frame is a WAI frame.
7827 ------------------------------------------------------------------------*/
7828 if ( ( 1 == tlMetaInfo.ucIsWai ) ||
7829 ( 0 == tlMetaInfo.ucDisableFrmXtl ) )
7830#else
7831 /*------------------------------------------------------------------------
7832 Translate 802.3 frame to 802.11 if Frame translation is enabled
7833 ------------------------------------------------------------------------*/
7834 if ( ( 0 == tlMetaInfo.ucDisableFrmXtl ) &&
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307835 ( 0 != pClientSTA->wSTADesc.ucSwFrameTXXlation) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007836#endif //#ifdef FEATURE_WLAN_WAPI
7837 {
Kiran Venkatappacab0d352012-12-17 13:09:22 -08007838 vosStatus = WLANTL_Translate8023To80211Header( vosDataBuff, &vosStatus,
7839 pTLCb, &ucSTAId,
Ravi Joshid0699502013-07-08 15:48:47 -07007840 &tlMetaInfo, &ucWDSEnabled,
7841 &extraHeadSpace);
Jeff Johnson295189b2012-06-20 16:38:30 -07007842 if ( VOS_STATUS_SUCCESS != vosStatus )
7843 {
7844 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7845 "WLAN TL:Error when translating header WLANTL_STATxConn"));
7846
7847 return vosStatus;
7848 }
7849
7850 tlMetaInfo.ucDisableFrmXtl = 1;
7851 }
7852
7853 /*-------------------------------------------------------------------------
7854 Call HAL to fill BD header
7855 -------------------------------------------------------------------------*/
7856 ucTypeSubtype |= (WLANTL_80211_DATA_TYPE << 4);
7857
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307858 if ( pClientSTA->wSTADesc.ucQosEnabled )
Jeff Johnson295189b2012-06-20 16:38:30 -07007859 {
7860 ucTypeSubtype |= (WLANTL_80211_DATA_QOS_SUBTYPE);
7861 }
7862
Gopichand Nakkala8b54e912013-03-11 10:44:21 +05307863#ifdef FEATURE_WLAN_WAPI
7864 /* TL State does not transition to AUTHENTICATED till GTK is installed, So in
7865 * case of WPA where GTK handshake is done after the 4 way handshake, the
7866 * unicast 2/2 EAPOL packet from the STA->AP has to be encrypted even before
7867 * the TL is in authenticated state. Since the PTK has been installed
7868 * already (after the 4 way handshake) we make sure that all traffic
7869 * is encrypted henceforth.(Note: TL is still not in AUTHENTICATED state so
7870 * we will only allow EAPOL data or WAI in case of WAPI)
7871 */
7872 if (tlMetaInfo.ucIsEapol && pClientSTA->ptkInstalled)
7873 {
7874 txFlag = 0;
7875 }
7876#else
7877 if (pClientSTA->ptkInstalled)
7878 {
7879 txFlag = 0;
7880 }
7881#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007882
7883 vosStatus = (VOS_STATUS)WDA_DS_BuildTxPacketInfo( pvosGCtx, vosDataBuff , &vDestMacAddr,
7884 tlMetaInfo.ucDisableFrmXtl, &usPktLen,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307885 pClientSTA->wSTADesc.ucQosEnabled, ucWDSEnabled,
Jeff Johnson295189b2012-06-20 16:38:30 -07007886 extraHeadSpace,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307887 ucTypeSubtype, &pClientSTA->wSTADesc.vSelfMACAddress,
Gopichand Nakkala8b54e912013-03-11 10:44:21 +05307888 ucTid, txFlag,
Ganesh Kondabattini10e67352015-03-16 17:41:57 +05307889 tlMetaInfo.usTimeStamp, tlMetaInfo.ucIsEapol || tlMetaInfo.ucIsWai, tlMetaInfo.ucUP,
7890 tlMetaInfo.ucTxBdToken);
Jeff Johnson295189b2012-06-20 16:38:30 -07007891
7892 if ( VOS_STATUS_SUCCESS != vosStatus )
7893 {
7894 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
7895 "WLAN TL:Failed while attempting to fill BD %d", vosStatus));
7896 *pvosDataBuff = NULL;
7897 return vosStatus;
7898 }
7899
7900 /*-----------------------------------------------------------------------
7901 Update tx counter for BA session query for tx side
7902 !1 - should this be done for EAPOL frames?
7903 -----------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307904 pClientSTA->auTxCount[ucTid]++;
Jeff Johnson295189b2012-06-20 16:38:30 -07007905
7906 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307907 (v_PVOID_t)pClientSTA->pfnSTATxComp );
Jeff Johnson295189b2012-06-20 16:38:30 -07007908
7909 /*------------------------------------------------------------------------
7910 Save data to input pointer for TL core
7911 ------------------------------------------------------------------------*/
7912 *pvosDataBuff = vosDataBuff;
7913 /*security frames cannot be delayed*/
7914 pTLCb->bUrgent = TRUE;
7915
Jeff Johnson295189b2012-06-20 16:38:30 -07007916 /* TX Statistics */
7917 if (!(tlMetaInfo.ucBcast || tlMetaInfo.ucMcast))
7918 {
7919 /* This is TX UC frame */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307920 pClientSTA->trafficStatistics.txUCFcnt++;
7921 pClientSTA->trafficStatistics.txUCBcnt += usPktLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07007922 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007923
7924 return VOS_STATUS_SUCCESS;
7925}/* WLANTL_STATxConn */
7926
7927
7928/*==========================================================================
7929 FUNCTION WLANTL_STATxAuth
7930
7931 DESCRIPTION
7932 Transmit in authenticated state - all data allowed
7933
7934 DEPENDENCIES
7935 The STA must be registered with TL before this function can be called.
7936
7937 PARAMETERS
7938
7939 IN
7940 pvosGCtx: pointer to the global vos context; a handle to TL's
7941 control block can be extracted from its context
7942 ucSTAId: identifier of the station being processed
7943 vosDataBuff: pointer to the tx vos buffer
7944
7945 RETURN VALUE
7946 The result code associated with performing the operation
7947
7948 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
7949 page fault
7950 VOS_STATUS_SUCCESS: Everything is good :)
7951
7952 Other return values are possible coming from the called functions.
7953 Please check API for additional info.
7954
7955 SIDE EFFECTS
7956
7957============================================================================*/
7958VOS_STATUS
7959WLANTL_STATxAuth
7960(
7961 v_PVOID_t pvosGCtx,
7962 v_U8_t ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07007963 vos_pkt_t** pvosDataBuff,
7964 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -07007965)
7966{
7967 v_U16_t usPktLen;
7968 VOS_STATUS vosStatus;
7969 v_MACADDR_t vDestMacAddr;
7970 vos_pkt_t* vosDataBuff = NULL;
7971 WLANTL_CbType* pTLCb = NULL;
7972 WLANTL_MetaInfoType tlMetaInfo;
7973 v_U8_t ucTypeSubtype = 0;
7974 WLANTL_ACEnumType ucAC;
7975 WLANTL_ACEnumType ucNextAC;
7976 v_U8_t ucTid;
7977 v_U8_t ucSwFrmXtl = 0;
7978 v_U8_t extraHeadSpace = 0;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05307979 WLANTL_STAClientType *pStaClient = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007980 v_U8_t ucWDSEnabled = 0;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05307981 v_U32_t ucTxFlag = 0;
Abhishek Singh45e68fe2014-12-11 12:55:59 +05307982 v_U8_t ucACMask, i;
Jeff Johnson295189b2012-06-20 16:38:30 -07007983 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
7984
7985 /*------------------------------------------------------------------------
7986 Sanity check
7987 Extract TL control block
7988 ------------------------------------------------------------------------*/
7989 pTLCb = VOS_GET_TL_CB(pvosGCtx);
7990 if (( NULL == pTLCb ) || ( NULL == pvosDataBuff ))
7991 {
7992 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Jeff Johnson0298bd02013-11-14 19:58:38 -08007993 "WLAN TL:Invalid input params on WLANTL_STATxAuth TL %p DB %p",
Jeff Johnson295189b2012-06-20 16:38:30 -07007994 pTLCb, pvosDataBuff));
7995 if (NULL != pvosDataBuff)
7996 {
7997 *pvosDataBuff = NULL;
7998 }
7999 if(NULL != pTLCb)
8000 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308001 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
8002 {
8003 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8004 "WLAN TL:Client Memory was not allocated on %s", __func__));
8005 return VOS_STATUS_E_FAILURE;
8006 }
8007 pTLCb->atlSTAClients[ucSTAId]->ucNoMoreData = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07008008 }
8009 return VOS_STATUS_E_FAULT;
8010 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308011 pStaClient = pTLCb->atlSTAClients[ucSTAId];
Jeff Johnson295189b2012-06-20 16:38:30 -07008012
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308013 if ( NULL == pStaClient )
8014 {
8015 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8016 "WLAN TL:Client Memory was not allocated on %s", __func__));
8017 return VOS_STATUS_E_FAILURE;
8018 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008019
8020 vos_mem_zero(&tlMetaInfo, sizeof(tlMetaInfo));
8021 /*------------------------------------------------------------------------
8022 Fetch packet from HDD
8023 ------------------------------------------------------------------------*/
Sunil Ravid5406f22013-01-22 00:18:31 -08008024#ifdef FEATURE_WLAN_TDLS
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308025 if ((WLAN_STA_SOFTAP != pStaClient->wSTADesc.wSTAType) &&
Agarwal Ashishcd86f7b2014-06-16 17:11:58 +05308026 (!vos_concurrent_open_sessions_running()) &&
Sunil Ravid5406f22013-01-22 00:18:31 -08008027 !pTLCb->ucTdlsPeerCount)
8028 {
8029#else
Jeff Johnson295189b2012-06-20 16:38:30 -07008030 if ((WLAN_STA_SOFTAP != pStaClient->wSTADesc.wSTAType) &&
Agarwal Ashishcd86f7b2014-06-16 17:11:58 +05308031 (!vos_concurrent_open_sessions_running()))
Jeff Johnson295189b2012-06-20 16:38:30 -07008032 {
8033#endif
8034 ucAC = pStaClient->ucCurrentAC;
8035
8036 /*-------------------------------------------------------------------
8037 Disable AC temporary - if successfull retrieve re-enable
8038 The order is justified because of the possible scenario
8039 - TL tryes to fetch packet for AC and it returns NULL
8040 - TL analyzes the data it has received to see if there are
8041 any more pkts available for AC -> if not TL will disable AC
8042 - however it is possible that while analyzing results TL got
8043 preempted by a pending indication where the mask was again set
8044 TL will not check again and as a result when it resumes
8045 execution it will disable AC
8046 To prevent this the AC will be disabled here and if retrieve
8047 is successfull it will be re-enabled
8048 -------------------------------------------------------------------*/
8049 pStaClient->aucACMask[pStaClient->ucCurrentAC] = 0;
8050
8051 // don't reset it, as other AC queues in HDD may have packets
8052 //vos_atomic_set_U8( &pStaClient->ucPktPending, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008053 }
8054 else
8055 {
8056 //softap case
8057 ucAC = pTLCb->uCurServedAC;
8058 pStaClient->aucACMask[ucAC] = 0;
8059
8060 //vos_atomic_set_U8( &pStaClient->ucPktPending, 0);
8061 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008062
8063 WLAN_TL_AC_ARRAY_2_MASK( pStaClient, ucACMask, i);
Jeff Johnson295189b2012-06-20 16:38:30 -07008064 /*You make an initial assumption that HDD has no more data and if the
8065 assumption was wrong you reset the flags to their original state
8066 This will prevent from exposing a race condition between checking with HDD
8067 for packets and setting the flags to false*/
8068 if ( 0 == ucACMask )
8069 {
8070 vos_atomic_set_U8( &pStaClient->ucPktPending, 0);
8071 pStaClient->ucNoMoreData = 1;
8072 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008073
8074 vosStatus = pStaClient->pfnSTAFetchPkt( pvosGCtx,
8075 &ucSTAId,
8076 ucAC,
8077 &vosDataBuff, &tlMetaInfo );
8078
8079
8080 if (( VOS_STATUS_SUCCESS != vosStatus ) || ( NULL == vosDataBuff ))
8081 {
8082
8083 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +05308084 "WLAN TL:Failed while attempting to fetch pkt from HDD QId:%d status:%d",
8085 ucAC, vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07008086 *pvosDataBuff = NULL;
8087 /*--------------------------------------------------------------------
8088 Reset AC for the serviced station to the highest priority AC
8089 -> due to no more data at the station
8090 Even if this AC is not supported by the station, correction will be
8091 made in the main TL loop
8092 --------------------------------------------------------------------*/
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +05308093 pStaClient->ucCurrentAC = WLANTL_AC_HIGH_PRIO;
Jeff Johnson295189b2012-06-20 16:38:30 -07008094 pStaClient->ucCurrentWeight = 0;
8095
8096 return vosStatus;
8097 }
8098
Jeff Johnsone7245742012-09-05 17:12:55 -07008099 WLANTL_StatHandleTXFrame(pvosGCtx, ucSTAId, vosDataBuff, NULL, &tlMetaInfo);
Jeff Johnsone7245742012-09-05 17:12:55 -07008100
Jeff Johnson295189b2012-06-20 16:38:30 -07008101 /*There are still packets in HDD - set back the pending packets and
8102 the no more data assumption*/
8103 vos_atomic_set_U8( &pStaClient->ucPktPending, 1);
8104 pStaClient->ucNoMoreData = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07008105
Jeff Johnson295189b2012-06-20 16:38:30 -07008106 if (WLAN_STA_SOFTAP != pStaClient->wSTADesc.wSTAType)
8107 {
Jeff Johnson295189b2012-06-20 16:38:30 -07008108 // don't need to set it, as we don't reset it in this function.
8109 //vos_atomic_set_U8( &pTLCb->atlSTAClients[ucSTAId].ucPktPending, 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07008110 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008111
8112#ifdef WLAN_PERF
8113 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAL,
8114 (v_PVOID_t)0);
8115#endif /*WLAN_PERF*/
8116
8117 /*-------------------------------------------------------------------------
8118 Check TID
8119 -------------------------------------------------------------------------*/
8120 ucTid = tlMetaInfo.ucTID;
8121
8122 /*Make sure TID is valid*/
8123 if ( WLANTL_TID_INVALID(ucTid))
8124 {
Rajesh Chauhan2df40bf2013-08-22 11:26:12 -07008125 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Jeff Johnson295189b2012-06-20 16:38:30 -07008126 "WLAN TL:Invalid TID sent in meta info %d - defaulting to 0 (BE)",
8127 ucTid));
8128 ucTid = 0;
8129 }
8130
8131 /*Save for UAPSD timer consideration*/
8132 pStaClient->ucServicedAC = ucAC;
8133
8134 if ( ucAC == pStaClient->ucCurrentAC )
8135 {
8136 pStaClient->aucACMask[pStaClient->ucCurrentAC] = 1;
8137 pStaClient->ucCurrentWeight--;
8138 }
8139 else
8140 {
8141 pStaClient->ucCurrentAC = ucAC;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308142 pStaClient->ucCurrentWeight = pTLCb->tlConfigInfo.ucAcWeights[ucAC] - 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07008143
8144 pStaClient->aucACMask[pStaClient->ucCurrentAC] = 1;
8145
8146 }
8147
Jeff Johnson295189b2012-06-20 16:38:30 -07008148 if (WLAN_STA_SOFTAP != pStaClient->wSTADesc.wSTAType)
8149 {
Jeff Johnson295189b2012-06-20 16:38:30 -07008150 if ( 0 == pStaClient->ucCurrentWeight )
8151 {
8152 WLANTL_ACEnumType tempAC = ucAC;
8153 /*-----------------------------------------------------------------------
8154 Choose next AC - !!! optimize me
8155 -----------------------------------------------------------------------*/
8156 while ( 0 != ucACMask )
8157 {
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +05308158 if(tempAC == WLANTL_AC_BK)
8159 ucNextAC = WLANTL_AC_HIGH_PRIO;
8160 else
8161 ucNextAC = (tempAC - 1);
8162
Jeff Johnson295189b2012-06-20 16:38:30 -07008163 if ( 0 != pStaClient->aucACMask[ucNextAC] )
8164 {
8165 pStaClient->ucCurrentAC = ucNextAC;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308166 pStaClient->ucCurrentWeight = pTLCb->tlConfigInfo.ucAcWeights[ucNextAC];
Jeff Johnson295189b2012-06-20 16:38:30 -07008167
8168 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8169 "WLAN TL: Changing serviced AC to: %d with Weight: %d",
8170 pStaClient->ucCurrentAC ,
8171 pStaClient->ucCurrentWeight));
8172 break;
8173 }
8174 tempAC = ucNextAC;
8175 }
8176 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008177 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008178
8179 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8180 "WLAN TL:Attaching BD header to pkt on WLANTL_STATxAuth"));
8181
8182 /*------------------------------------------------------------------------
8183 Translate 802.3 frame to 802.11
8184 ------------------------------------------------------------------------*/
8185 if ( 0 == tlMetaInfo.ucDisableFrmXtl )
8186 {
8187 /* Needs frame translation */
8188 // if the client has not enabled SW-only frame translation
8189 // and if the frame is a unicast frame
8190 // (HW frame translation does not support multiple broadcast domains
8191 // so we use SW frame translation for broadcast/multicast frames)
8192#ifdef FEATURE_WLAN_WAPI
8193 // and if the frame is not a WAPI frame
8194#endif
8195 // then use HW_based frame translation
8196
8197 if ( ( 0 == pStaClient->wSTADesc.ucSwFrameTXXlation ) &&
8198 ( 0 == tlMetaInfo.ucBcast ) &&
8199 ( 0 == tlMetaInfo.ucMcast )
8200#ifdef FEATURE_WLAN_WAPI
8201 && ( tlMetaInfo.ucIsWai != 1 )
8202#endif
8203 )
8204 {
8205#ifdef WLAN_PERF
8206 v_U32_t uFastFwdOK = 0;
8207
8208 /* HW based translation. See if the frame could be fast forwarded */
8209 WDA_TLI_FastHwFwdDataFrame( pvosGCtx, vosDataBuff , &vosStatus,
8210 &uFastFwdOK, &tlMetaInfo, &pStaClient->wSTADesc);
8211
8212 if( VOS_STATUS_SUCCESS == vosStatus )
8213 {
8214 if(uFastFwdOK)
8215 {
8216 /* Packet could be fast forwarded now */
8217 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
8218 (v_PVOID_t)pStaClient->pfnSTATxComp );
8219
8220 *pvosDataBuff = vosDataBuff;
8221
8222 /* TODO: Do we really need to update WLANTL_HSHandleTXFrame()
8223 stats for every pkt? */
8224 pStaClient->auTxCount[tlMetaInfo.ucTID]++;
8225 return vosStatus;
8226 }
8227 /* can't be fast forwarded, fall through normal (slow) path. */
8228 }
8229 else
8230 {
8231
8232 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8233 "WLAN TL:Failed while attempting to fastFwd BD %d", vosStatus));
8234 *pvosDataBuff = NULL;
8235 return vosStatus;
8236 }
8237#endif /*WLAN_PERF*/
8238 }
8239 else
8240 {
8241 /* SW based translation */
8242
Kiran Venkatappacab0d352012-12-17 13:09:22 -08008243 vosStatus = WLANTL_Translate8023To80211Header( vosDataBuff, &vosStatus,
8244 pTLCb, &ucSTAId,
Ravi Joshid0699502013-07-08 15:48:47 -07008245 &tlMetaInfo, &ucWDSEnabled,
8246 &extraHeadSpace);
Jeff Johnson295189b2012-06-20 16:38:30 -07008247 if ( VOS_STATUS_SUCCESS != vosStatus )
8248 {
8249 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8250 "WLAN TL:Error when translating header WLANTL_STATxAuth"));
8251 return vosStatus;
8252 }
8253
8254 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
Arif Hussainf2b00992013-11-17 21:46:15 -08008255 "WLAN TL software translation success"));
Jeff Johnson295189b2012-06-20 16:38:30 -07008256 ucSwFrmXtl = 1;
8257 tlMetaInfo.ucDisableFrmXtl = 1;
8258 }
8259 }
Gopichand Nakkala574f6d12013-06-27 19:38:43 +05308260#ifdef FEATURE_WLAN_TDLS
8261 /*In case of TDLS, if the packet is destined to TDLS STA ucSTAId may
8262 change. so update the pStaClient accordingly */
8263 pStaClient = pTLCb->atlSTAClients[ucSTAId];
Jeff Johnson295189b2012-06-20 16:38:30 -07008264
Gopichand Nakkala574f6d12013-06-27 19:38:43 +05308265 if ( NULL == pStaClient )
8266 {
8267 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8268 "pStaClient is NULL %s", __func__));
8269 return VOS_STATUS_E_FAILURE;
8270 }
8271#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07008272 /*-------------------------------------------------------------------------
8273 Call HAL to fill BD header
8274 -------------------------------------------------------------------------*/
8275 ucTypeSubtype |= (WLANTL_80211_DATA_TYPE << 4);
8276
8277 if ( pStaClient->wSTADesc.ucQosEnabled )
8278 {
8279 ucTypeSubtype |= (WLANTL_80211_DATA_QOS_SUBTYPE);
8280 }
8281
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +05308282 /* ucAC now points to TL Q ID with a new queue added in TL,
8283 * hence look for the uapsd info for the correct AC that
8284 * this packet belongs to.
8285 */
8286 ucTxFlag = (0 != pStaClient->wUAPSDInfo[tlMetaInfo.ac].ucSet)?
Jeff Johnson295189b2012-06-20 16:38:30 -07008287 HAL_TRIGGER_ENABLED_AC_MASK:0;
8288
8289#ifdef FEATURE_WLAN_WAPI
8290 if ( pStaClient->wSTADesc.ucIsWapiSta == 1 )
8291 {
8292#ifdef LIBRA_WAPI_SUPPORT
8293 ucTxFlag = ucTxFlag | HAL_WAPI_STA_MASK;
8294#endif //LIBRA_WAPI_SUPPORT
8295 if ( tlMetaInfo.ucIsWai == 1 )
8296 {
8297 ucTxFlag = ucTxFlag | HAL_TX_NO_ENCRYPTION_MASK;
8298 }
8299 }
8300#endif /* FEATURE_WLAN_WAPI */
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008301#ifdef FEATURE_WLAN_TDLS
8302 if ( pStaClient->wSTADesc.wSTAType == WLAN_STA_TDLS )
8303 {
8304 ucTxFlag = ucTxFlag | HAL_TDLS_PEER_STA_MASK;
8305 }
8306#endif /* FEATURE_WLAN_TDLS */
Abhishek Singhfa011222014-04-14 10:57:08 +05308307 if( tlMetaInfo.ucIsArp )
8308 {
Hanumantha Reddy Pothulae5ab23d2015-09-14 18:08:24 +05308309 if (pStaClient->arpOnWQ5)
8310 {
8311 ucTxFlag |= HAL_USE_FW_IN_TX_PATH;
8312 }
Hanumantha Reddy Pothulaee001fc2015-05-26 15:21:53 +05308313 if (pStaClient->arpRate == 0)
8314 {
8315 ucTxFlag |= HAL_USE_BD_RATE_1_MASK;
8316 }
8317 else if (pStaClient->arpRate == 1 || pStaClient->arpRate == 3)
8318 {
8319 pStaClient->arpRate ^= 0x2;
8320 ucTxFlag |= HAL_USE_BD_RATE_1_MASK<<(pStaClient->arpRate-1);
8321 }
8322 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
8323 "arp pkt sending on BD rate: %hhu", pStaClient->arpRate));
Abhishek Singhfa011222014-04-14 10:57:08 +05308324 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008325
8326 vosStatus = (VOS_STATUS)WDA_DS_BuildTxPacketInfo( pvosGCtx,
8327 vosDataBuff , &vDestMacAddr,
8328 tlMetaInfo.ucDisableFrmXtl, &usPktLen,
8329 pStaClient->wSTADesc.ucQosEnabled, ucWDSEnabled,
8330 extraHeadSpace,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308331 ucTypeSubtype, &pStaClient->wSTADesc.vSelfMACAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07008332 ucTid, ucTxFlag, tlMetaInfo.usTimeStamp,
Ganesh Kondabattini10e67352015-03-16 17:41:57 +05308333 tlMetaInfo.ucIsEapol, tlMetaInfo.ucUP,
8334 tlMetaInfo.ucTxBdToken);
Jeff Johnson295189b2012-06-20 16:38:30 -07008335
8336 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
8337 {
8338 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8339 "Fill TX BD Error status %d", vosStatus));
8340
8341 return vosStatus;
8342 }
8343
Jeff Johnson295189b2012-06-20 16:38:30 -07008344 /* TX Statistics */
8345 if (!(tlMetaInfo.ucBcast || tlMetaInfo.ucMcast))
8346 {
8347 /* This is TX UC frame */
8348 pStaClient->trafficStatistics.txUCFcnt++;
8349 pStaClient->trafficStatistics.txUCBcnt += usPktLen;
8350 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008351
Kiran Venkatappacab0d352012-12-17 13:09:22 -08008352#ifndef FEATURE_WLAN_TDLS
Jeff Johnson295189b2012-06-20 16:38:30 -07008353 /*-----------------------------------------------------------------------
8354 Update tx counter for BA session query for tx side
8355 -----------------------------------------------------------------------*/
8356 pStaClient->auTxCount[ucTid]++;
Kiran Venkatappacab0d352012-12-17 13:09:22 -08008357#else
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308358 pTLCb->atlSTAClients[ucSTAId]->auTxCount[ucTid]++;
Kiran Venkatappacab0d352012-12-17 13:09:22 -08008359#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07008360
8361 /* This code is to send traffic with lower priority AC when we does not
8362 get admitted to send it. Today HAL does not downgrade AC so this code
8363 does not get executed.(In other words, HAL doesnÂ’t change tid. The if
8364 statement is always false.)
8365 NOTE: In the case of LA downgrade occurs in HDD (that was the change
8366 Phani made during WMM-AC plugfest). If WM & BMP also took this approach,
8367 then there will be no need for any AC downgrade logic in TL/WDI. */
8368#if 0
8369 if (( ucTid != tlMetaInfo.ucTID ) &&
8370 ( 0 != pStaClient->wSTADesc.ucQosEnabled ) &&
8371 ( 0 != ucSwFrmXtl ))
8372 {
8373 /*---------------------------------------------------------------------
8374 !! FIX me: Once downgrading is clear put in the proper change
8375 ---------------------------------------------------------------------*/
8376 ucQCOffset = WLANHAL_TX_BD_HEADER_SIZE + WLANTL_802_11_HEADER_LEN;
8377
8378 //!!!Fix this replace peek with extract
8379 vos_pkt_peek_data( vosDataBuff, ucQCOffset,(v_PVOID_t)&pucQosCtrl,
8380 sizeof(*pucQosCtrl));
8381 *pucQosCtrl = ucTid; //? proper byte order
8382 }
8383#endif
8384
8385 if ( VOS_STATUS_SUCCESS != vosStatus )
8386 {
8387 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8388 "WLAN TL:Failed while attempting to fill BD %d", vosStatus));
8389 *pvosDataBuff = NULL;
8390 return vosStatus;
8391 }
8392
8393 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
8394 (v_PVOID_t)pStaClient->pfnSTATxComp );
8395
8396 *pvosDataBuff = vosDataBuff;
8397
8398 /*BE & BK can be delayed, VO and VI not frames cannot be delayed*/
8399 if ( pStaClient->ucServicedAC > WLANTL_AC_BE )
8400 {
8401 pTLCb->bUrgent= TRUE;
8402 }
8403
8404 return VOS_STATUS_SUCCESS;
8405}/* WLANTL_STATxAuth */
8406
8407/*==========================================================================
8408 FUNCTION WLANTL_STATxDisc
8409
8410 DESCRIPTION
8411 Transmit in disconnected state - no data allowed
8412
8413 DEPENDENCIES
8414 The STA must be registered with TL before this function can be called.
8415
8416 PARAMETERS
8417
8418 IN
8419 pvosGCtx: pointer to the global vos context; a handle to TL's
8420 control block can be extracted from its context
8421 ucSTAId: identifier of the station being processed
8422 vosDataBuff: pointer to the tx vos buffer
8423
8424 RETURN VALUE
8425 The result code associated with performing the operation
8426
8427 VOS_STATUS_SUCCESS: Everything is good :)
8428
8429 SIDE EFFECTS
8430
8431============================================================================*/
8432VOS_STATUS
8433WLANTL_STATxDisc
8434(
8435 v_PVOID_t pvosGCtx,
8436 v_U8_t ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008437 vos_pkt_t** pvosDataBuff,
8438 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -07008439)
8440{
8441 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308442 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07008443 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
8444
Jeff Johnson295189b2012-06-20 16:38:30 -07008445 /*------------------------------------------------------------------------
8446 Sanity check
8447 Extract TL control block
8448 ------------------------------------------------------------------------*/
8449 pTLCb = VOS_GET_TL_CB(pvosGCtx);
8450 if ( NULL == pTLCb )
8451 {
8452 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8453 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STATxAuth"));
8454 *pvosDataBuff = NULL;
8455 return VOS_STATUS_E_FAULT;
8456 }
8457
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308458 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
8459
8460 if ( NULL == pClientSTA )
8461 {
8462 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8463 "WLAN TL:Client Memory was not allocated on %s", __func__));
8464 return VOS_STATUS_E_FAILURE;
8465 }
8466
Jeff Johnson295189b2012-06-20 16:38:30 -07008467 /*------------------------------------------------------------------------
8468 Error
8469 ------------------------------------------------------------------------*/
8470 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8471 "WLAN TL:Packet should not be transmitted in state disconnected ignoring"
8472 " request"));
8473
8474 *pvosDataBuff = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308475 pClientSTA->ucNoMoreData = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07008476
8477 //Should not be anything pending in disconnect state
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308478 vos_atomic_set_U8( &pClientSTA->ucPktPending, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008479
8480 return VOS_STATUS_SUCCESS;
8481}/* WLANTL_STATxDisc */
8482
8483/*==========================================================================
8484 FUNCTION WLANTL_STARxConn
8485
8486 DESCRIPTION
8487 Receive in connected state - only EAPOL
8488
8489 DEPENDENCIES
8490 The STA must be registered with TL before this function can be called.
8491
8492 PARAMETERS
8493
8494 IN
8495 pvosGCtx: pointer to the global vos context; a handle to TL's
8496 control block can be extracted from its context
8497 ucSTAId: identifier of the station being processed
8498 vosDataBuff: pointer to the tx/rx vos buffer
8499
8500 RETURN VALUE
8501 The result code associated with performing the operation
8502
8503 VOS_STATUS_E_INVAL: invalid input parameters
8504 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
8505 page fault
8506 VOS_STATUS_SUCCESS: Everything is good :)
8507
8508 SIDE EFFECTS
8509
8510============================================================================*/
8511VOS_STATUS
8512WLANTL_STARxConn
8513(
8514 v_PVOID_t pvosGCtx,
8515 v_U8_t ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008516 vos_pkt_t** pvosDataBuff,
8517 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -07008518)
8519{
8520 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308521 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07008522 v_U16_t usEtherType = 0;
8523 v_U16_t usPktLen;
8524 v_U8_t ucMPDUHOffset;
8525 v_U16_t usMPDUDOffset;
8526 v_U16_t usMPDULen;
8527 v_U8_t ucMPDUHLen;
8528 v_U16_t usActualHLen = 0;
8529 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8530 vos_pkt_t* vosDataBuff;
8531 v_PVOID_t aucBDHeader;
8532 v_U8_t ucTid;
8533 WLANTL_RxMetaInfoType wRxMetaInfo;
8534 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
8535
8536 /*------------------------------------------------------------------------
8537 Sanity check
8538 ------------------------------------------------------------------------*/
8539 if (( NULL == pvosDataBuff ) || ( NULL == ( vosDataBuff = *pvosDataBuff )))
8540 {
8541 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8542 "WLAN TL:Invalid parameter sent on WLANTL_STARxConn"));
8543 return VOS_STATUS_E_INVAL;
8544 }
8545
8546 /*------------------------------------------------------------------------
8547 Extract TL control block
8548 ------------------------------------------------------------------------*/
8549 pTLCb = VOS_GET_TL_CB(pvosGCtx);
8550 if ( NULL == pTLCb )
8551 {
8552 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8553 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState"));
8554 return VOS_STATUS_E_FAULT;
8555 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308556 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
8557
8558 if ( NULL == pClientSTA )
8559 {
8560 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8561 "WLAN TL:Client Memory was not allocated on %s", __func__));
8562 return VOS_STATUS_E_FAILURE;
8563 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008564
8565 /*------------------------------------------------------------------------
8566 Extract BD header and check if valid
8567 ------------------------------------------------------------------------*/
8568 vosStatus = WDA_DS_PeekRxPacketInfo( vosDataBuff, (v_PVOID_t)&aucBDHeader, 0/*Swap BD*/ );
8569
8570 if ( NULL == aucBDHeader )
8571 {
8572 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8573 "WLAN TL:Cannot extract BD header"));
8574 VOS_ASSERT( 0 );
8575 return VOS_STATUS_E_FAULT;
8576 }
8577
8578
8579 ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(aucBDHeader);
8580 usMPDUDOffset = (v_U16_t)WDA_GET_RX_MPDU_DATA_OFFSET(aucBDHeader);
8581 usMPDULen = (v_U16_t)WDA_GET_RX_MPDU_LEN(aucBDHeader);
8582 ucMPDUHLen = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(aucBDHeader);
8583 ucTid = (v_U8_t)WDA_GET_RX_TID(aucBDHeader);
8584
8585 vos_pkt_get_packet_length( vosDataBuff, &usPktLen);
8586
8587 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8588 "WLAN TL:BD header processing data: HO %d DO %d Len %d HLen %d",
8589 ucMPDUHOffset, usMPDUDOffset, usMPDULen, ucMPDUHLen));
8590
8591 /*It will cut out the 802.11 header if not used*/
8592 if ( VOS_STATUS_SUCCESS != WDA_DS_TrimRxPacketInfo( vosDataBuff ) )
8593 {
8594 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8595 "WLAN TL:BD header corrupted - dropping packet"));
8596 /* Drop packet */
8597 vos_pkt_return_packet(vosDataBuff);
8598 return VOS_STATUS_SUCCESS;
8599 }
8600
8601 vosStatus = WLANTL_GetEtherType(aucBDHeader,vosDataBuff,ucMPDUHLen,&usEtherType);
8602
8603 if( VOS_IS_STATUS_SUCCESS(vosStatus) )
8604 {
8605#ifdef FEATURE_WLAN_WAPI
8606 /* If frame is neither an EAPOL frame nor a WAI frame then we drop the frame*/
8607 /* TODO: Do we need a check to see if we are in WAPI mode? If not is it possible */
8608 /* that we get an EAPOL packet in WAPI mode or vice versa? */
8609 if ( WLANTL_LLC_8021X_TYPE != usEtherType && WLANTL_LLC_WAI_TYPE != usEtherType )
8610 {
Sunil Ravid5406f22013-01-22 00:18:31 -08008611 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07008612 "WLAN TL:RX Frame not EAPOL or WAI EtherType %d - dropping", usEtherType );
Jeff Johnson295189b2012-06-20 16:38:30 -07008613 /* Drop packet */
8614 vos_pkt_return_packet(vosDataBuff);
8615 }
8616#else
8617 if ( WLANTL_LLC_8021X_TYPE != usEtherType )
8618 {
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07008619 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8620 "WLAN TL:RX Frame not EAPOL EtherType %d - dropping", usEtherType);
Jeff Johnson295189b2012-06-20 16:38:30 -07008621 /* Drop packet */
8622 vos_pkt_return_packet(vosDataBuff);
8623 }
8624#endif /* FEATURE_WLAN_WAPI */
8625 else /* Frame is an EAPOL frame or a WAI frame*/
8626 {
Katya Nigam42e16e82014-02-04 16:28:55 +05308627 MTRACE(vos_trace(VOS_MODULE_ID_TL,
8628 TRACE_CODE_TL_RX_CONN_EAPOL, ucSTAId, usEtherType ));
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07008629
Madan Mohan Koyyalamudid8000342012-11-08 14:55:26 -08008630 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi546e3f52012-10-05 12:17:57 -07008631 "WLAN TL:RX Frame EAPOL EtherType %d - processing", usEtherType);
8632
Jeff Johnson295189b2012-06-20 16:38:30 -07008633 if (( 0 == WDA_GET_RX_FT_DONE(aucBDHeader) ) &&
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308634 ( 0 != pClientSTA->wSTADesc.ucSwFrameRXXlation))
Jeff Johnson295189b2012-06-20 16:38:30 -07008635 {
8636 if (usMPDUDOffset > ucMPDUHOffset)
8637 {
8638 usActualHLen = usMPDUDOffset - ucMPDUHOffset;
8639 }
8640
8641 vosStatus = WLANTL_Translate80211To8023Header( vosDataBuff, &vosStatus, usActualHLen,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008642 ucMPDUHLen, pTLCb, ucSTAId, bForwardIAPPwithLLC);
Jeff Johnson295189b2012-06-20 16:38:30 -07008643
8644 if ( VOS_STATUS_SUCCESS != vosStatus )
8645 {
Kaushik, Sushante386ee12014-05-01 15:50:52 +05308646 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Jeff Johnson295189b2012-06-20 16:38:30 -07008647 "WLAN TL:Failed to translate from 802.11 to 802.3 - dropping"));
8648 /* Drop packet */
8649 vos_pkt_return_packet(vosDataBuff);
8650 return vosStatus;
8651 }
8652 }
8653 /*-------------------------------------------------------------------
8654 Increment receive counter
8655 -------------------------------------------------------------------*/
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -07008656 if ( !WLANTL_TID_INVALID( ucTid) )
8657 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308658 pClientSTA->auRxCount[ucTid]++;
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -07008659 }
8660 else
8661 {
8662 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8663 "WLAN TL:Invalid tid %d (Station ID %d) on %s",
8664 ucTid, ucSTAId, __func__));
Hanumantha Reddy Pothula0de10802016-02-11 17:29:27 +05308665 vos_pkt_return_packet(vosDataBuff);
8666 return VOS_STATUS_E_FAILURE;
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -07008667 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008668
8669 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
8670 "WLAN TL:Sending EAPoL frame to station %d AC %d", ucSTAId, ucTid));
8671
8672 /*-------------------------------------------------------------------
8673 !!!Assuming TID = UP mapping
8674 -------------------------------------------------------------------*/
8675 wRxMetaInfo.ucUP = ucTid;
8676
Jeff Johnson295189b2012-06-20 16:38:30 -07008677 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
Arif Hussainf2b00992013-11-17 21:46:15 -08008678 "WLAN TL %s:Sending data chain to station", __func__));
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308679 if ( WLAN_STA_SOFTAP == pClientSTA->wSTADesc.wSTAType )
Jeff Johnson295189b2012-06-20 16:38:30 -07008680 {
8681 wRxMetaInfo.ucDesSTAId = WLAN_RX_SAP_SELF_STA_ID;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308682 pClientSTA->pfnSTARx( pvosGCtx, vosDataBuff, ucSTAId,
Jeff Johnson295189b2012-06-20 16:38:30 -07008683 &wRxMetaInfo );
8684 }
8685 else
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308686 pClientSTA->pfnSTARx( pvosGCtx, vosDataBuff, ucSTAId,
Jeff Johnson295189b2012-06-20 16:38:30 -07008687 &wRxMetaInfo );
8688 }/*EAPOL frame or WAI frame*/
8689 }/*vos status success*/
8690
8691 return VOS_STATUS_SUCCESS;
8692}/* WLANTL_STARxConn */
8693
Jeff Johnson295189b2012-06-20 16:38:30 -07008694/*==========================================================================
8695 FUNCTION WLANTL_FwdPktToHDD
8696
8697 DESCRIPTION
8698 Determine the Destation Station ID and route the Frame to Upper Layer
8699
8700 DEPENDENCIES
8701
8702 PARAMETERS
8703
8704 IN
8705 pvosGCtx: pointer to the global vos context; a handle to TL's
8706 control block can be extracted from its context
8707 ucSTAId: identifier of the station being processed
8708 vosDataBuff: pointer to the rx vos buffer
8709
8710 RETURN VALUE
8711 The result code associated with performing the operation
8712
8713 VOS_STATUS_E_INVAL: invalid input parameters
8714 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
8715 page fault
8716 VOS_STATUS_SUCCESS: Everything is good :)
8717
8718 SIDE EFFECTS
8719
8720============================================================================*/
8721
8722VOS_STATUS
8723WLANTL_FwdPktToHDD
8724(
8725 v_PVOID_t pvosGCtx,
8726 vos_pkt_t* pvosDataBuff,
8727 v_U8_t ucSTAId
8728)
8729{
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308730 v_MACADDR_t DestMacAddress;
8731 v_MACADDR_t *pDestMacAddress = &DestMacAddress;
8732 v_SIZE_t usMacAddSize = VOS_MAC_ADDR_SIZE;
Jeff Johnson295189b2012-06-20 16:38:30 -07008733 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308734 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07008735 vos_pkt_t* vosDataBuff ;
8736 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
Girish Gowli93e3edd2014-05-01 15:42:31 +05308737 v_U32_t* STAMetaInfoPtr;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308738 vos_pkt_t* vosNextDataBuff ;
8739 v_U8_t ucDesSTAId;
Jeff Johnson295189b2012-06-20 16:38:30 -07008740 WLANTL_RxMetaInfoType wRxMetaInfo;
8741
Jeff Johnson295189b2012-06-20 16:38:30 -07008742 /*------------------------------------------------------------------------
8743 Sanity check
8744 ------------------------------------------------------------------------*/
8745 if (( NULL == pvosDataBuff ) || ( NULL == ( vosDataBuff = pvosDataBuff )))
8746 {
8747 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8748 "WLAN TL:Invalid parameter sent on WLANTL_FwdPktToHdd"));
8749 return VOS_STATUS_E_INVAL;
8750 }
8751
8752 /*------------------------------------------------------------------------
8753 Extract TL control block
8754 ------------------------------------------------------------------------*/
8755 pTLCb = VOS_GET_TL_CB(pvosGCtx);
8756 if ( NULL == pTLCb )
8757 {
8758 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8759 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_FwdPktToHdd"));
8760 return VOS_STATUS_E_FAULT;
8761 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308762
Tushnim Bhattacharyya5dd94562013-03-20 20:15:03 -07008763 if(WLANTL_STA_ID_INVALID(ucSTAId))
8764 {
8765 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"ucSTAId %d is not valid",
8766 ucSTAId));
8767 return VOS_STATUS_E_INVAL;
8768 }
8769
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308770 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
8771
8772 if ( NULL == pClientSTA )
8773 {
8774 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
8775 "WLAN TL:Client Memory was not allocated on %s", __func__));
8776 return VOS_STATUS_E_FAILURE;
8777 }
8778
Jeff Johnson295189b2012-06-20 16:38:30 -07008779 /* This the change required for SoftAp to handle Reordered Buffer. Since a STA
8780 may have packets destined to multiple destinations we have to process each packet
8781 at a time and determine its Destination. So the Voschain provided by Reorder code
8782 is unchain and forwarded to Upper Layer after Determining the Destination */
8783
8784 vosDataBuff = pvosDataBuff;
8785 while (vosDataBuff != NULL)
8786 {
8787 vos_pkt_walk_packet_chain( vosDataBuff, &vosNextDataBuff, 1/*true*/ );
8788 vos_pkt_get_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
Girish Gowli93e3edd2014-05-01 15:42:31 +05308789 (v_PVOID_t *)&STAMetaInfoPtr );
8790 wRxMetaInfo.ucUP = (v_U8_t)((uintptr_t)STAMetaInfoPtr & WLANTL_AC_MASK);
8791 ucDesSTAId = (v_U8_t)(((uintptr_t)STAMetaInfoPtr) >> WLANTL_STAID_OFFSET);
Jeff Johnson295189b2012-06-20 16:38:30 -07008792
8793 vosStatus = vos_pkt_extract_data( vosDataBuff, 0, (v_VOID_t *)pDestMacAddress, &usMacAddSize);
8794 if ( VOS_STATUS_SUCCESS != vosStatus )
8795 {
8796 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08008797 "WLAN TL: recv corrupted data packet"));
Jeff Johnson295189b2012-06-20 16:38:30 -07008798 vos_pkt_return_packet(vosDataBuff);
8799 return vosStatus;
8800 }
8801
Arif Hussaina7c8e412013-11-20 11:06:42 -08008802 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
8803 "station mac "MAC_ADDRESS_STR,
8804 MAC_ADDR_ARRAY(pDestMacAddress->bytes)));
Jeff Johnson295189b2012-06-20 16:38:30 -07008805
8806 if (vos_is_macaddr_broadcast( pDestMacAddress ) || vos_is_macaddr_group(pDestMacAddress))
8807 {
8808 // destination is mc/bc station
8809 ucDesSTAId = WLAN_RX_BCMC_STA_ID;
8810 TLLOG4(VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO_LOW,
Arif Hussainf2b00992013-11-17 21:46:15 -08008811 "%s: BC/MC packet, id %d", __func__, WLAN_RX_BCMC_STA_ID));
Jeff Johnson295189b2012-06-20 16:38:30 -07008812 }
8813 else
8814 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05308815 if (vos_is_macaddr_equal(pDestMacAddress, &pClientSTA->wSTADesc.vSelfMACAddress))
Jeff Johnson295189b2012-06-20 16:38:30 -07008816 {
8817 // destination is AP itself
8818 ucDesSTAId = WLAN_RX_SAP_SELF_STA_ID;
8819 TLLOG4(VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO_LOW,
Arif Hussainf2b00992013-11-17 21:46:15 -08008820 "%s: packet to AP itself, id %d", __func__, WLAN_RX_SAP_SELF_STA_ID));
Jeff Johnson295189b2012-06-20 16:38:30 -07008821 }
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +05308822 else if (( WLAN_MAX_STA_COUNT <= ucDesSTAId ) || (NULL != pTLCb->atlSTAClients[ucDesSTAId] && pTLCb->atlSTAClients[ucDesSTAId]->ucExists == 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07008823 {
8824 // destination station is something else
8825 TLLOG4(VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO_LOW,
Arif Hussainf2b00992013-11-17 21:46:15 -08008826 "%s: get an station index larger than WLAN_MAX_STA_COUNT %d", __func__, ucDesSTAId));
Jeff Johnson295189b2012-06-20 16:38:30 -07008827 ucDesSTAId = WLAN_RX_SAP_SELF_STA_ID;
8828 }
8829
8830
8831 //loopback unicast station comes here
8832 }
8833
Girish Gowli93e3edd2014-05-01 15:42:31 +05308834 wRxMetaInfo.ucUP = (v_U8_t)((uintptr_t)STAMetaInfoPtr & WLANTL_AC_MASK);
Jeff Johnson295189b2012-06-20 16:38:30 -07008835 wRxMetaInfo.ucDesSTAId = ucDesSTAId;
8836
Madan Mohan Koyyalamudi6c2977d2013-09-04 15:42:45 +05308837 vosStatus = pClientSTA->pfnSTARx( pvosGCtx, vosDataBuff, ucDesSTAId,
Jeff Johnson295189b2012-06-20 16:38:30 -07008838 &wRxMetaInfo );
Madan Mohan Koyyalamudi6c2977d2013-09-04 15:42:45 +05308839 if ( VOS_STATUS_SUCCESS != vosStatus )
8840 {
8841 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08008842 "WLAN TL: failed to send pkt to HDD"));
Madan Mohan Koyyalamudi6c2977d2013-09-04 15:42:45 +05308843 vos_pkt_return_packet(vosDataBuff);
8844
8845 return vosStatus;
8846 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008847 vosDataBuff = vosNextDataBuff;
8848 }
8849 return VOS_STATUS_SUCCESS;
8850}
Jeff Johnson295189b2012-06-20 16:38:30 -07008851
Kapil Guptad90b3862016-06-25 00:42:49 +05308852#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8853void WLANTL_StopRxRateMonitor(v_PVOID_t pvosGCtx)
8854{
8855 WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pvosGCtx);
8856 if (!pTLCb)
8857 return;
8858 pTLCb->gDsRxRoamStats.running = eWLAN_PAL_FALSE;
8859}
8860
8861void WLANTL_StartRxRateMonitor(v_PVOID_t pvosGCtx, v_U8_t staId,
8862 v_U16_t minRate,
8863 v_U16_t maxRate, v_U8_t minPercentage,
8864 v_U16_t minPktRequired, void *hHal,
8865 v_U64_t timeToWait,
8866 void (*triggerRoamScanfn) (void *, v_U8_t))
8867{
8868
8869 WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pvosGCtx);
8870 if (!pTLCb)
8871 return;
8872
8873 pTLCb->gDsRxRoamStats.running = eWLAN_PAL_TRUE;
8874 pTLCb->gDsRxRoamStats.index = 0;
8875 pTLCb->gDsRxRoamStats.lastTriggerTime = jiffies_to_msecs(jiffies);
8876 pTLCb->gDsRxRoamStats.maxRate = maxRate;
8877 pTLCb->gDsRxRoamStats.minRate = minRate;
8878 pTLCb->gDsRxRoamStats.staId = staId;
8879 pTLCb->gDsRxRoamStats.minPercentage = minPercentage;
8880 pTLCb->gDsRxRoamStats.timeToWait = timeToWait * 1000;
8881 pTLCb->gDsRxRoamStats.intialPktToStart = 0;
8882 pTLCb->gDsRxRoamStats.minPktRequired = minPktRequired;
8883 pTLCb->gDsRxRoamStats.triggerRoamScanfn = triggerRoamScanfn;
8884 pTLCb->gDsRxRoamStats.hHal = hHal;
8885 vos_mem_zero(pTLCb->gDsRxRoamStats.rxRoamStats, ROAM_MAX_INDEX_NUM *
8886 sizeof(WLANTL_RoamTrafficStatsType));
8887 VOS_TRACE(VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_DEBUG,
8888 "staId=%d, minRate=%d maxRate=%d minPercentage=%d minPktRequired=%d",
8889 staId, minRate, maxRate, minPercentage, minPktRequired);
8890}
8891
8892void static WLANTL_ClearAllRoamStats(WLANTL_CbType *pTLCb)
8893{
8894 pTLCb->gDsRxRoamStats.index = 0;
8895 pTLCb->gDsRxRoamStats.totalPkt = 0;
8896 pTLCb->gDsRxRoamStats.lowRatePkt = 0;
8897 pTLCb->gDsRxRoamStats.intialPktToStart = 0;
8898 vos_mem_zero(pTLCb->gDsRxRoamStats.rxRoamStats, ROAM_MAX_INDEX_NUM *
8899 sizeof(WLANTL_RoamTrafficStatsType));
8900}
8901
8902/*
8903 * WLANTL_ClearRoamStatsTillIndex : This API will clear older data
8904 * at the indexes.
8905 *
8906 * Since its a circular buffer we don't know if we are filling
8907 * data first time or some older data was already present at
8908 * the index. In that case we should clear the older data from
8909 * current index to new index and subtract this data from
8910 * global count as well before filling new one.
8911 */
8912static inline void WLANTL_ClearRoamStatsTillIndex(WLANTL_CbType *pTLCb,
8913 v_U8_t newIndex)
8914{
8915 while (pTLCb->gDsRxRoamStats.index < newIndex)
8916 {
8917 pTLCb->gDsRxRoamStats.index++;
8918 pTLCb->gDsRxRoamStats.totalPkt -=
8919 pTLCb->gDsRxRoamStats.
8920 rxRoamStats[pTLCb->gDsRxRoamStats.index].totalPktRcvd;
8921 pTLCb->gDsRxRoamStats.lowRatePkt -=
8922 pTLCb->gDsRxRoamStats.
8923 rxRoamStats[pTLCb->gDsRxRoamStats.index].lowRateRxPacketsRcvd;
8924 pTLCb->gDsRxRoamStats.
8925 rxRoamStats[pTLCb->gDsRxRoamStats.index].totalPktRcvd = 0;
8926 pTLCb->gDsRxRoamStats.
8927 rxRoamStats[pTLCb->gDsRxRoamStats.index].lowRateRxPacketsRcvd = 0;
8928 }
8929}
8930
8931
8932static void WLANTL_ClearOldPERStats(WLANTL_CbType *pTLCb, v_U8_t incrementCnt)
8933{
8934 v_U8_t newIndex;
8935
8936 newIndex = (pTLCb->gDsRxRoamStats.index + incrementCnt) %
8937 ROAM_MAX_INDEX_NUM;
8938
8939 /* We have crossed the max limit of buffer, clear the stats
8940 * till ROAM_MAX_INDEX_NUM and set index as 0 */
8941 if ((pTLCb->gDsRxRoamStats.index + incrementCnt) >=
8942 ROAM_MAX_INDEX_NUM)
8943 {
8944 WLANTL_ClearRoamStatsTillIndex(pTLCb, ROAM_MAX_INDEX_NUM - 1);
8945 pTLCb->gDsRxRoamStats.index = -1;
8946 }
8947 /* Clear the stats from current index till new index */
8948 WLANTL_ClearRoamStatsTillIndex(pTLCb, newIndex);
8949}
8950
8951/*
8952 * This API implements a circular buffer to store rate stats for a station to
8953 * trigger PER based roam scan.
8954 * API will start monitoring only if DUT gets continues packets which are below
8955 * configured rate. In the upper rates, this should have minimal effect on data
8956 * throughput.
8957 *
8958 * This API will store stats in a circular buffer of size ROAM_MAX_INDEX_NUM
8959 * where each index will have time duration of ROAM_PER_INDEX_TIME.
8960 * Using a buffer instead of counter will help to maintain stats of time
8961 * duration ROAM_PER_INDEX_TIME * ROAM_MAX_INDEX_NUM. Whenever host gets a new
8962 * packet, it will remove last ROAM_PER_INDEX_TIME duration of packets from
8963 * global entry and index entry and fill new data.
8964 *
8965 * Global stats of data also be maintained so that host need not to parse whole
8966 * buffer while checking the trigger condition
8967 * Each of the index will be having the packets stats at duration of
8968 * ROAM_PER_INDEX_TIME from the first packet which arrived in that.
8969 * Global index will be used to calculate new index position to fill once host
8970 * gets a packet.
8971 */
8972static void WLANTL_updatePERStats(WLANTL_CbType *pTLCb,
8973 v_U8_t rateIndex)
8974{
8975 v_U8_t incrementCnt;
8976 v_U64_t currentTime, timeDifference;
8977
8978 /*
8979 * Host will start monitoring Rx rates only if it gets
8980 * MIN_PKTS_TO_START_MONTIOR number of pkts continuously below min rate
8981 * This will make sure we never do this much processing in high
8982 * rates/throughput cases
8983 */
8984
8985 if(pTLCb->gDsRxRoamStats.intialPktToStart < MIN_PKTS_TO_START_MONTIOR)
8986 {
8987 if (gTLRateInfo[rateIndex].phyRate < pTLCb->gDsRxRoamStats.minRate)
8988 pTLCb->gDsRxRoamStats.intialPktToStart++;
8989 else
8990 pTLCb->gDsRxRoamStats.intialPktToStart = 0;
8991 return;
8992 }
8993
8994 currentTime = jiffies_to_msecs(jiffies);
8995 /*
8996 * scan was triggered in last timeToWait time duration
8997 * Wait for timeToWait before monitoring again.
8998 */
8999 if((currentTime - pTLCb->gDsRxRoamStats.lastTriggerTime) <
9000 pTLCb->gDsRxRoamStats.timeToWait)
9001 return;
9002
9003 /* paket above max rate, clear current stats and montior again */
9004 if (gTLRateInfo[rateIndex].phyRate >=
9005 pTLCb->gDsRxRoamStats.maxRate)
9006 {
9007 WLANTL_ClearAllRoamStats(pTLCb);
9008 /* Stop any PER based scan if going on */
9009 pTLCb->gDsRxRoamStats.
9010 triggerRoamScanfn(pTLCb->gDsRxRoamStats.hHal, 0);
9011 return;
9012 }
9013
9014 timeDifference = currentTime -
9015 pTLCb->gDsRxRoamStats.rxRoamStats[pTLCb->gDsRxRoamStats.index].time;
9016
9017 if (timeDifference)
Kapil Guptafe5d92a2016-07-12 18:05:24 +05309018 incrementCnt = do_div(timeDifference, ROAM_PER_INDEX_TIME);
Kapil Guptad90b3862016-06-25 00:42:49 +05309019
9020 /* More that ROAM_PER_INDEX_TIME has esclapsed,
9021 * fill data at new index */
9022 if (incrementCnt)
9023 {
9024 if (incrementCnt > ROAM_MAX_INDEX_NUM)
9025 {
9026 /*
9027 * Clear all stats, these are older than
9028 * ROAM_MAX_INDEX_NUM * ROAM_PER_INDEX_TIME (Max buffer time)
9029 */
9030 WLANTL_ClearAllRoamStats(pTLCb);
9031 pTLCb->gDsRxRoamStats.index = 0;
9032 }
9033 else
9034 WLANTL_ClearOldPERStats(pTLCb, incrementCnt);
9035
9036 pTLCb->gDsRxRoamStats.rxRoamStats
9037 [pTLCb->gDsRxRoamStats.index].time = currentTime;
9038 }
9039
9040 /* If pkt rate below minRate, increment low pkts counts */
9041 if (gTLRateInfo[rateIndex].phyRate <
9042 pTLCb->gDsRxRoamStats.minRate)
9043 {
9044 pTLCb->gDsRxRoamStats.
9045 rxRoamStats[pTLCb->gDsRxRoamStats.index].
9046 lowRateRxPacketsRcvd++;
9047 pTLCb->gDsRxRoamStats.lowRatePkt++;
9048 }
9049 /* Increment total pkts counts */
9050 pTLCb->gDsRxRoamStats.
9051 rxRoamStats[pTLCb->gDsRxRoamStats.index].totalPktRcvd++;
9052 pTLCb->gDsRxRoamStats.totalPkt++;
9053
9054 /* Check if we have reached threshold value to trigger a roam scan */
9055 if ((pTLCb->gDsRxRoamStats.totalPkt != 0) &&
9056 (pTLCb->gDsRxRoamStats.totalPkt >
9057 pTLCb->gDsRxRoamStats.minPktRequired)&&
Kapil Guptafe5d92a2016-07-12 18:05:24 +05309058 ((pTLCb->gDsRxRoamStats.lowRatePkt * 100) >
9059 (pTLCb->gDsRxRoamStats.totalPkt *
9060 pTLCb->gDsRxRoamStats.minPercentage)))
Kapil Guptad90b3862016-06-25 00:42:49 +05309061 {
9062 /* callback handler to trigger a roam scan */
9063 if (pTLCb->gDsRxRoamStats.triggerRoamScanfn)
9064 pTLCb->gDsRxRoamStats.
9065 triggerRoamScanfn(pTLCb->gDsRxRoamStats.hHal, 1);
9066
9067 VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_DEBUG,
9068 "PER Roam: triggerring roam scan totalPkt =%lu lowRatePkt %lu minPktRequired %u minPercentage %d",
9069 (long unsigned int) pTLCb->gDsRxRoamStats.totalPkt,
9070 (long unsigned int) pTLCb->gDsRxRoamStats.lowRatePkt,
9071 (unsigned int) pTLCb->gDsRxRoamStats.minPktRequired,
9072 pTLCb->gDsRxRoamStats.minPercentage);
9073
9074 WLANTL_ClearAllRoamStats(pTLCb);
9075 /* save current time as last trigger time */
9076 pTLCb->gDsRxRoamStats.lastTriggerTime = currentTime;
9077 }
9078}
9079#endif
9080
Jeff Johnson295189b2012-06-20 16:38:30 -07009081/*==========================================================================
9082 FUNCTION WLANTL_STARxAuth
9083
9084 DESCRIPTION
9085 Receive in authenticated state - all data allowed
9086
9087 DEPENDENCIES
9088 The STA must be registered with TL before this function can be called.
9089
9090 PARAMETERS
9091
9092 IN
9093 pvosGCtx: pointer to the global vos context; a handle to TL's
9094 control block can be extracted from its context
9095 ucSTAId: identifier of the station being processed
9096 vosDataBuff: pointer to the rx vos buffer
9097
9098 RETURN VALUE
9099 The result code associated with performing the operation
9100
9101 VOS_STATUS_E_INVAL: invalid input parameters
9102 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
9103 page fault
9104 VOS_STATUS_SUCCESS: Everything is good :)
9105
9106 SIDE EFFECTS
9107
9108============================================================================*/
9109VOS_STATUS
9110WLANTL_STARxAuth
9111(
9112 v_PVOID_t pvosGCtx,
9113 v_U8_t ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009114 vos_pkt_t** pvosDataBuff,
9115 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -07009116)
9117{
9118 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309119 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07009120 v_U8_t ucAsf; /* AMSDU sub frame */
9121 v_U16_t usMPDUDOffset;
9122 v_U8_t ucMPDUHOffset;
9123 v_U16_t usMPDULen;
9124 v_U8_t ucMPDUHLen;
9125 v_U16_t usActualHLen = 0;
9126 v_U8_t ucTid;
Kapil Guptad90b3862016-06-25 00:42:49 +05309127#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9128 v_U8_t rxRate;
9129 v_U8_t type;
9130#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07009131#ifdef FEATURE_WLAN_WAPI
Jeff Johnsone0343db2013-04-03 16:39:24 -07009132 v_U16_t usEtherType = 0;
Abhishek Singh3c47c6c2015-06-15 11:36:08 +05309133 tSirMacMgmtHdr *hdr;
Jeff Johnson295189b2012-06-20 16:38:30 -07009134#endif
9135 v_U16_t usPktLen;
9136 vos_pkt_t* vosDataBuff ;
9137 v_PVOID_t aucBDHeader;
9138 VOS_STATUS vosStatus;
9139 WLANTL_RxMetaInfoType wRxMetaInfo;
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -07009140 static v_U8_t ucPMPDUHLen;
Girish Gowli93e3edd2014-05-01 15:42:31 +05309141 v_U32_t* STAMetaInfoPtr;
Jeff Johnson295189b2012-06-20 16:38:30 -07009142 v_U8_t ucEsf=0; /* first subframe of AMSDU flag */
9143 v_U64_t ullcurrentReplayCounter=0; /*current replay counter*/
9144 v_U64_t ullpreviousReplayCounter=0; /*previous replay counter*/
9145 v_U16_t ucUnicastBroadcastType=0; /*It denotes whether received frame is UC or BC*/
Madan Mohan Koyyalamudi4fe30172012-10-18 20:13:40 -07009146 struct _BARFrmStruct *pBarFrame = NULL;
9147
Jeff Johnson295189b2012-06-20 16:38:30 -07009148 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
9149
9150 /*------------------------------------------------------------------------
9151 Sanity check
9152 ------------------------------------------------------------------------*/
9153 if (( NULL == pvosDataBuff ) || ( NULL == ( vosDataBuff = *pvosDataBuff )))
9154 {
9155 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9156 "WLAN TL:Invalid parameter sent on WLANTL_STARxAuth"));
9157 return VOS_STATUS_E_INVAL;
9158 }
9159
9160 /*------------------------------------------------------------------------
9161 Extract TL control block
9162 ------------------------------------------------------------------------*/
9163 pTLCb = VOS_GET_TL_CB(pvosGCtx);
9164 if ( NULL == pTLCb )
9165 {
9166 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9167 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STARxAuth"));
9168 return VOS_STATUS_E_FAULT;
9169 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309170 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
9171
9172 if ( NULL == pClientSTA )
9173 {
9174 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9175 "WLAN TL:Client Memory was not allocated on %s", __func__));
9176 return VOS_STATUS_E_FAILURE;
9177 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009178
9179 /*------------------------------------------------------------------------
9180 Extract BD header and check if valid
9181 ------------------------------------------------------------------------*/
9182 WDA_DS_PeekRxPacketInfo( vosDataBuff, (v_PVOID_t)&aucBDHeader, 0 );
9183
9184 ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(aucBDHeader);
9185 usMPDUDOffset = (v_U16_t)WDA_GET_RX_MPDU_DATA_OFFSET(aucBDHeader);
9186 usMPDULen = (v_U16_t)WDA_GET_RX_MPDU_LEN(aucBDHeader);
9187 ucMPDUHLen = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(aucBDHeader);
9188 ucTid = (v_U8_t)WDA_GET_RX_TID(aucBDHeader);
Kapil Guptad90b3862016-06-25 00:42:49 +05309189#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9190 rxRate = (v_U8_t)WDA_GET_RX_MAC_RATE_IDX(aucBDHeader);
9191 type = (v_U8_t)WDA_GET_RX_TYPE(aucBDHeader);
9192#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07009193
Madan Mohan Koyyalamudi4fe30172012-10-18 20:13:40 -07009194 /* Fix for a hardware bug.
9195 * H/W does not update the tid field in BD header for BAR frames.
9196 * Fix is to read the tid field from MAC header of BAR frame */
9197 if( (WDA_GET_RX_TYPE(aucBDHeader) == SIR_MAC_CTRL_FRAME) &&
9198 (WDA_GET_RX_SUBTYPE(aucBDHeader) == SIR_MAC_CTRL_BAR))
9199 {
9200 pBarFrame = (struct _BARFrmStruct *)(WDA_GET_RX_MAC_HEADER(aucBDHeader));
9201 ucTid = pBarFrame->barControl.numTID;
9202 }
9203
Jeff Johnson295189b2012-06-20 16:38:30 -07009204 /*Host based replay check is needed for unicast data frames*/
9205 ucUnicastBroadcastType = (v_U16_t)WDA_IS_RX_BCAST(aucBDHeader);
Jeff Johnson295189b2012-06-20 16:38:30 -07009206 if(0 != ucMPDUHLen)
9207 {
9208 ucPMPDUHLen = ucMPDUHLen;
9209 }
9210
9211 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9212 "WLAN TL:BD header processing data: HO %d DO %d Len %d HLen %d"
9213 " Tid %d BD %d",
9214 ucMPDUHOffset, usMPDUDOffset, usMPDULen, ucMPDUHLen, ucTid,
9215 WLANHAL_RX_BD_HEADER_SIZE));
9216
9217 vos_pkt_get_packet_length( vosDataBuff, &usPktLen);
9218
9219 if ( VOS_STATUS_SUCCESS != WDA_DS_TrimRxPacketInfo( vosDataBuff ) )
9220 {
9221 if((WDA_GET_RX_ASF(aucBDHeader) && !WDA_GET_RX_ESF(aucBDHeader)))
9222 {
9223 /* AMSDU case, ucMPDUHOffset = 0
9224 * it should be hancdled seperatly */
9225 if(( usMPDUDOffset > ucMPDUHOffset ) &&
9226 ( usMPDULen >= ucMPDUHLen ) && ( usPktLen >= usMPDULen ) &&
9227 ( !WLANTL_TID_INVALID(ucTid) ))
9228 {
9229 ucMPDUHOffset = usMPDUDOffset - WLANTL_MPDU_HEADER_LEN;
9230 }
9231 else
9232 {
9233 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9234 "WLAN TL:BD header corrupted - dropping packet"));
9235 /* Drop packet */
9236 vos_pkt_return_packet(vosDataBuff);
9237 return VOS_STATUS_SUCCESS;
9238 }
9239 }
9240 else
9241 {
9242 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9243 "WLAN TL:BD header corrupted - dropping packet"));
9244 /* Drop packet */
9245 vos_pkt_return_packet(vosDataBuff);
9246 return VOS_STATUS_SUCCESS;
9247 }
9248 }
9249
Abhishek Singh00b71972016-01-07 10:51:04 +05309250#ifdef WLAN_FEATURE_RMC
9251 if (pTLCb->multicastDuplicateDetectionEnabled &&
9252 (WLAN_STA_IBSS == pClientSTA->wSTADesc.wSTAType) &&
9253 WLANTL_IS_DATA_FRAME(WDA_GET_RX_TYPE_SUBTYPE(aucBDHeader)))
9254 {
9255 /*
9256 * Multicast duplicate detection is only for frames received in
9257 * IBSS mode.
9258 */
9259 if (VOS_TRUE == WLANTL_IsDuplicateMcastFrm(pClientSTA, vosDataBuff))
9260 {
9261 pTLCb->mcastDupCnt++;
9262 /* Duplicate multicast data packet, drop the packet */
9263 vos_pkt_return_packet(vosDataBuff);
9264 return VOS_STATUS_SUCCESS;
9265 }
9266 }
9267#endif /* WLAN_FEATURE_RMC */
9268
Jeff Johnson295189b2012-06-20 16:38:30 -07009269#ifdef FEATURE_WLAN_WAPI
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309270 if ( pClientSTA->wSTADesc.ucIsWapiSta )
Jeff Johnson295189b2012-06-20 16:38:30 -07009271 {
9272 vosStatus = WLANTL_GetEtherType(aucBDHeader, vosDataBuff, ucMPDUHLen, &usEtherType);
9273 if( VOS_IS_STATUS_SUCCESS(vosStatus) )
9274 {
9275 if ( WLANTL_LLC_WAI_TYPE == usEtherType )
Abhishek Singh3c47c6c2015-06-15 11:36:08 +05309276 {
9277 hdr = WDA_GET_RX_MAC_HEADER(aucBDHeader);
9278 if ( hdr->fc.wep )
Jeff Johnson295189b2012-06-20 16:38:30 -07009279 {
9280 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9281 "WLAN TL:WAI frame was received encrypted - dropping"));
9282 /* Drop packet */
9283 /*Temporary fix added to fix wapi rekey issue*/
Abhishek Singh3c47c6c2015-06-15 11:36:08 +05309284 vos_pkt_return_packet(vosDataBuff);
9285 return vosStatus; //returning success
Jeff Johnson295189b2012-06-20 16:38:30 -07009286 }
9287 }
9288 else
9289 {
9290 if ( WLANHAL_RX_IS_UNPROTECTED_WPI_FRAME(aucBDHeader) )
9291 {
9292 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9293 "WLAN TL:Non-WAI frame was received unencrypted - dropping"));
9294 /* Drop packet */
9295 vos_pkt_return_packet(vosDataBuff);
9296 return vosStatus; //returning success
9297 }
9298 }
9299 }
9300 else //could not extract EtherType - this should not happen
9301 {
9302 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Jeff Johnson04dd8a82012-06-29 20:41:40 -07009303 "WLAN TL:Could not extract EtherType"));
9304 //Packet is already freed
Jeff Johnson295189b2012-06-20 16:38:30 -07009305 return vosStatus; //returning failure
Jeff Johnson295189b2012-06-20 16:38:30 -07009306 }
9307 }
9308#endif /* FEATURE_WLAN_WAPI */
9309
9310 /*----------------------------------------------------------------------
9311 Increment receive counter
9312 !! not sure this is the best place to increase this - pkt might be
9313 dropped below or delayed in TL's queues
9314 - will leave it here for now
9315 ------------------------------------------------------------------------*/
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -07009316 if ( !WLANTL_TID_INVALID( ucTid) )
9317 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309318 pClientSTA->auRxCount[ucTid]++;
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -07009319 }
9320 else
9321 {
9322 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9323 "WLAN TL:Invalid tid %d (Station ID %d) on %s",
9324 ucTid, ucSTAId, __func__));
Hanumantha Reddy Pothula0de10802016-02-11 17:29:27 +05309325 vos_pkt_return_packet(vosDataBuff);
9326 return VOS_STATUS_E_FAILURE;
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -07009327 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009328
Kapil Guptad90b3862016-06-25 00:42:49 +05309329#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9330 if (pTLCb->gDsRxRoamStats.running &&
9331 (ucSTAId == pTLCb->gDsRxRoamStats.staId) &&
9332 (rxRate < WLANTL_MAX_RATE_NUM) && (type == SIR_MAC_DATA_FRAME))
9333 {
9334 WLANTL_updatePERStats(pTLCb, rxRate);
9335 }
9336#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07009337 /*------------------------------------------------------------------------
9338 Check if AMSDU and send for processing if so
9339 ------------------------------------------------------------------------*/
9340 ucAsf = (v_U8_t)WDA_GET_RX_ASF(aucBDHeader);
9341
9342 if ( 0 != ucAsf )
9343 {
9344 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9345 "WLAN TL:Packet is AMSDU sub frame - sending for completion"));
9346 vosStatus = WLANTL_AMSDUProcess( pvosGCtx, &vosDataBuff, aucBDHeader, ucSTAId,
9347 ucMPDUHLen, usMPDULen );
9348 if(NULL == vosDataBuff)
9349 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07009350 //Packet is already freed
Jeff Johnson295189b2012-06-20 16:38:30 -07009351 return VOS_STATUS_SUCCESS;
9352 }
9353 }
9354 /* After AMSDU header handled
9355 * AMSDU frame just same with normal frames */
9356 /*-------------------------------------------------------------------
9357 Translating header if necesary
9358 !! Fix me: rmv comments below
9359 ----------------------------------------------------------------------*/
9360 if (( 0 == WDA_GET_RX_FT_DONE(aucBDHeader) ) &&
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309361 ( 0 != pClientSTA->wSTADesc.ucSwFrameRXXlation) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07009362 ( WLANTL_IS_DATA_FRAME(WDA_GET_RX_TYPE_SUBTYPE(aucBDHeader)) ))
9363 {
9364 if(0 == ucMPDUHLen)
9365 {
9366 ucMPDUHLen = ucPMPDUHLen;
9367 }
9368 if (usMPDUDOffset > ucMPDUHOffset)
9369 {
9370 usActualHLen = usMPDUDOffset - ucMPDUHOffset;
9371 }
9372 vosStatus = WLANTL_Translate80211To8023Header( vosDataBuff, &vosStatus, usActualHLen,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009373 ucMPDUHLen, pTLCb, ucSTAId, bForwardIAPPwithLLC);
Jeff Johnson295189b2012-06-20 16:38:30 -07009374
9375 if ( VOS_STATUS_SUCCESS != vosStatus )
9376 {
Kaushik, Sushante386ee12014-05-01 15:50:52 +05309377 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Jeff Johnson295189b2012-06-20 16:38:30 -07009378 "WLAN TL:Failed to translate from 802.11 to 802.3 - dropping"));
9379 /* Drop packet */
9380 vos_pkt_return_packet(vosDataBuff);
9381 return vosStatus;
9382 }
9383 }
9384 /* Softap requires additional Info such as Destination STAID and Access
9385 Category. Voschain or Buffer returned by BA would be unchain and this
9386 Meta Data would help in routing the packets to appropriate Destination */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309387 if( WLAN_STA_SOFTAP == pClientSTA->wSTADesc.wSTAType)
Jeff Johnson295189b2012-06-20 16:38:30 -07009388 {
Arun Kumar Khandavalli37cfc222014-01-09 22:32:40 +05309389 STAMetaInfoPtr = (v_U32_t *)(uintptr_t)(ucTid | (WDA_GET_RX_ADDR3_IDX(aucBDHeader) << WLANTL_STAID_OFFSET));
Jeff Johnson295189b2012-06-20 16:38:30 -07009390 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_TL,
9391 (v_PVOID_t)STAMetaInfoPtr);
9392 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009393
9394 /*------------------------------------------------------------------------
9395 Check to see if re-ordering session is in place
9396 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309397 if ( 0 != pClientSTA->atlBAReorderInfo[ucTid].ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -07009398 {
9399 WLANTL_MSDUReorder( pTLCb, &vosDataBuff, aucBDHeader, ucSTAId, ucTid );
9400 }
9401
Jeff Johnson295189b2012-06-20 16:38:30 -07009402if(0 == ucUnicastBroadcastType
9403#ifdef FEATURE_ON_CHIP_REORDERING
9404 && (WLANHAL_IsOnChipReorderingEnabledForTID(pvosGCtx, ucSTAId, ucTid) != TRUE)
9405#endif
9406)
9407{
9408 /* replay check code : check whether replay check is needed or not */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309409 if(VOS_TRUE == pClientSTA->ucIsReplayCheckValid)
Jeff Johnson295189b2012-06-20 16:38:30 -07009410 {
9411 /* replay check is needed for the station */
9412
9413 /* check whether frame is AMSDU frame */
9414 if ( 0 != ucAsf )
9415 {
9416 /* Since virgo can't send AMSDU frames this leg of the code
9417 was not tested properly, it needs to be tested properly*/
9418 /* Frame is AMSDU frame. As per 802.11n only first
9419 subframe will have replay counter */
9420 ucEsf = WDA_GET_RX_ESF( aucBDHeader );
9421 if( 0 != ucEsf )
9422 {
9423 v_BOOL_t status;
9424 /* Getting 48-bit replay counter from the RX BD */
9425 ullcurrentReplayCounter = WDA_DS_GetReplayCounter(aucBDHeader);
9426
9427 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Arif Hussainf2b00992013-11-17 21:46:15 -08009428 "WLAN TL: AMSDU currentReplayCounter [0x%llX]",ullcurrentReplayCounter);
Jeff Johnson295189b2012-06-20 16:38:30 -07009429
9430 /* Getting 48-bit previous replay counter from TL control block */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309431 ullpreviousReplayCounter = pClientSTA->ullReplayCounter[ucTid];
Jeff Johnson295189b2012-06-20 16:38:30 -07009432
9433 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Arif Hussainf2b00992013-11-17 21:46:15 -08009434 "WLAN TL: AMSDU previousReplayCounter [0x%llX]",ullpreviousReplayCounter);
Jeff Johnson295189b2012-06-20 16:38:30 -07009435
9436 /* It is first subframe of AMSDU thus it
9437 conatains replay counter perform the
9438 replay check for this first subframe*/
9439 status = WLANTL_IsReplayPacket( ullcurrentReplayCounter, ullpreviousReplayCounter);
9440 if(VOS_FALSE == status)
9441 {
9442 /* Not a replay paket, update previous replay counter in TL CB */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309443 pClientSTA->ullReplayCounter[ucTid] = ullcurrentReplayCounter;
Jeff Johnson295189b2012-06-20 16:38:30 -07009444 }
9445 else
9446 {
9447 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08009448 "WLAN TL: AMSDU Drop the replay packet with PN : [0x%llX]",ullcurrentReplayCounter);
Jeff Johnson295189b2012-06-20 16:38:30 -07009449
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309450 pClientSTA->ulTotalReplayPacketsDetected++;
Jeff Johnson295189b2012-06-20 16:38:30 -07009451 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08009452 "WLAN TL: AMSDU total dropped replay packets on STA ID %X is [0x%X]",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309453 ucSTAId, pClientSTA->ulTotalReplayPacketsDetected);
Jeff Johnson295189b2012-06-20 16:38:30 -07009454
9455 /* Drop the packet */
9456 vos_pkt_return_packet(vosDataBuff);
9457 return VOS_STATUS_SUCCESS;
9458 }
9459 }
9460 }
9461 else
9462 {
9463 v_BOOL_t status;
9464
9465 /* Getting 48-bit replay counter from the RX BD */
9466 ullcurrentReplayCounter = WDA_DS_GetReplayCounter(aucBDHeader);
9467
9468 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Arif Hussainf2b00992013-11-17 21:46:15 -08009469 "WLAN TL: Non-AMSDU currentReplayCounter [0x%llX]",ullcurrentReplayCounter);
Jeff Johnson295189b2012-06-20 16:38:30 -07009470
9471 /* Getting 48-bit previous replay counter from TL control block */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309472 ullpreviousReplayCounter = pClientSTA->ullReplayCounter[ucTid];
Jeff Johnson295189b2012-06-20 16:38:30 -07009473
9474 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Arif Hussainf2b00992013-11-17 21:46:15 -08009475 "WLAN TL: Non-AMSDU previousReplayCounter [0x%llX]",ullpreviousReplayCounter);
Jeff Johnson295189b2012-06-20 16:38:30 -07009476
9477 /* It is not AMSDU frame so perform
9478 reaply check for each packet, as
9479 each packet contains valid replay counter*/
9480 status = WLANTL_IsReplayPacket( ullcurrentReplayCounter, ullpreviousReplayCounter);
9481 if(VOS_FALSE == status)
9482 {
9483 /* Not a replay paket, update previous replay counter in TL CB */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309484 pClientSTA->ullReplayCounter[ucTid] = ullcurrentReplayCounter;
Jeff Johnson295189b2012-06-20 16:38:30 -07009485 }
9486 else
9487 {
9488 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08009489 "WLAN TL: Non-AMSDU Drop the replay packet with PN : [0x%llX]",ullcurrentReplayCounter);
Jeff Johnson295189b2012-06-20 16:38:30 -07009490
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309491 pClientSTA->ulTotalReplayPacketsDetected++;
Jeff Johnson295189b2012-06-20 16:38:30 -07009492 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -08009493 "WLAN TL: Non-AMSDU total dropped replay packets on STA ID %X is [0x%X]",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309494 ucSTAId, pClientSTA->ulTotalReplayPacketsDetected);
Jeff Johnson295189b2012-06-20 16:38:30 -07009495
9496 /* Repaly packet, drop the packet */
9497 vos_pkt_return_packet(vosDataBuff);
9498 return VOS_STATUS_SUCCESS;
9499 }
9500 }
9501 }
9502}
9503/*It is a broadast packet DPU has already done replay check for
9504 broadcast packets no need to do replay check of these packets*/
Jeff Johnson295189b2012-06-20 16:38:30 -07009505
9506 if ( NULL != vosDataBuff )
9507 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309508 if( WLAN_STA_SOFTAP == pClientSTA->wSTADesc.wSTAType)
Jeff Johnson295189b2012-06-20 16:38:30 -07009509 {
9510 WLANTL_FwdPktToHDD( pvosGCtx, vosDataBuff, ucSTAId );
9511 }
9512 else
Jeff Johnson295189b2012-06-20 16:38:30 -07009513 {
9514 wRxMetaInfo.ucUP = ucTid;
Shailender Karmuchi13c0d082013-03-26 14:41:39 -07009515 wRxMetaInfo.rssiAvg = pClientSTA->rssiAvg;
Gopichand Nakkala4a2fc1a2013-05-17 16:59:39 +05309516#ifdef FEATURE_WLAN_TDLS
9517 if (WLAN_STA_TDLS == pClientSTA->wSTADesc.wSTAType)
9518 {
9519 wRxMetaInfo.isStaTdls = TRUE;
9520 }
9521 else
9522 {
9523 wRxMetaInfo.isStaTdls = FALSE;
9524 }
9525#endif
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05309526 pClientSTA->pfnSTARx( pvosGCtx, vosDataBuff, ucSTAId,
Jeff Johnson295189b2012-06-20 16:38:30 -07009527 &wRxMetaInfo );
9528 }
9529 }/* if not NULL */
9530
9531 return VOS_STATUS_SUCCESS;
9532}/* WLANTL_STARxAuth */
9533
9534
9535/*==========================================================================
9536 FUNCTION WLANTL_STARxDisc
9537
9538 DESCRIPTION
9539 Receive in disconnected state - no data allowed
9540
9541 DEPENDENCIES
9542 The STA must be registered with TL before this function can be called.
9543
9544 PARAMETERS
9545
9546 IN
9547 pvosGCtx: pointer to the global vos context; a handle to TL's
9548 control block can be extracted from its context
9549 ucSTAId: identifier of the station being processed
9550 vosDataBuff: pointer to the rx vos buffer
9551
9552 RETURN VALUE
9553 The result code associated with performing the operation
9554
9555 VOS_STATUS_SUCCESS: Everything is good :)
9556
9557 SIDE EFFECTS
9558
9559============================================================================*/
9560VOS_STATUS
9561WLANTL_STARxDisc
9562(
9563 v_PVOID_t pvosGCtx,
9564 v_U8_t ucSTAId,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009565 vos_pkt_t** pvosDataBuff,
9566 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -07009567)
9568{
9569 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
9570
9571 /*------------------------------------------------------------------------
9572 Sanity check
9573 ------------------------------------------------------------------------*/
9574 if (( NULL == pvosDataBuff ) || ( NULL == *pvosDataBuff ))
9575 {
9576 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9577 "WLAN TL:Invalid parameter sent on WLANTL_STARxDisc"));
9578 return VOS_STATUS_E_INVAL;
9579 }
9580
9581 /*------------------------------------------------------------------------
9582 Error - drop packet
9583 ------------------------------------------------------------------------*/
9584 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9585 "WLAN TL:Packet should not be received in state disconnected"
9586 " - dropping"));
9587 vos_pkt_return_packet(*pvosDataBuff);
9588 *pvosDataBuff = NULL;
9589
9590 return VOS_STATUS_SUCCESS;
9591}/* WLANTL_STARxDisc */
9592
9593/*==========================================================================
9594 Processing main loops for MAIN and TX threads
9595 ==========================================================================*/
9596
9597/*==========================================================================
9598 FUNCTION WLANTL_McProcessMsg
9599
9600 DESCRIPTION
9601 Called by VOSS when a message was serialized for TL through the
9602 main thread/task.
9603
9604 DEPENDENCIES
9605 The TL must be initialized before this function can be called.
9606
9607 PARAMETERS
9608
9609 IN
9610 pvosGCtx: pointer to the global vos context; a handle to TL's
9611 control block can be extracted from its context
9612 message: type and content of the message
9613
9614
9615 RETURN VALUE
9616 The result code associated with performing the operation
9617
9618 VOS_STATUS_E_INVAL: invalid input parameters
9619 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
9620 page fault
9621 VOS_STATUS_SUCCESS: Everything is good :)
9622
9623 SIDE EFFECTS
9624
9625============================================================================*/
9626VOS_STATUS
9627WLANTL_McProcessMsg
9628(
9629 v_PVOID_t pvosGCtx,
9630 vos_msg_t* message
9631)
9632{
9633 WLANTL_CbType* pTLCb = NULL;
9634 tAddBAInd* ptAddBaInd = NULL;
9635 tDelBAInd* ptDelBaInd = NULL;
9636 tAddBARsp* ptAddBaRsp = NULL;
9637 vos_msg_t vosMessage;
9638 VOS_STATUS vosStatus;
9639 tpFlushACRsp FlushACRspPtr;
9640 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
9641
9642 /*------------------------------------------------------------------------
9643 Sanity check
9644 ------------------------------------------------------------------------*/
9645 if ( NULL == message )
9646 {
9647 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9648 "WLAN TL:Invalid parameter sent on WLANTL_ProcessMainMessage"));
9649 return VOS_STATUS_E_INVAL;
9650 }
9651
9652 /*------------------------------------------------------------------------
9653 Extract TL control block
9654 ------------------------------------------------------------------------*/
9655 pTLCb = VOS_GET_TL_CB(pvosGCtx);
9656 if ( NULL == pTLCb )
9657 {
9658 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9659 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ProcessMainMessage"));
9660 return VOS_STATUS_E_FAULT;
9661 }
9662
9663 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9664 "WLAN TL:Received message: %d through main flow", message->type));
9665
9666 switch( message->type )
9667 {
9668 case WDA_TL_FLUSH_AC_RSP:
9669 // Extract the message from the message body
9670 FlushACRspPtr = (tpFlushACRsp)(message->bodyptr);
9671 // Make sure the call back function is not null.
Tushnim Bhattacharyya5dd94562013-03-20 20:15:03 -07009672 if ( NULL == pTLCb->tlBAPClient.pfnFlushOpCompleteCb )
9673 {
9674 VOS_ASSERT(0);
9675 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9676 "WLAN TL:Invalid TL pointer pfnFlushOpCompleteCb"));
9677 return VOS_STATUS_E_FAULT;
9678 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009679
9680 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9681 "Received message: Flush complete received by TL"));
9682
9683 // Since we have the response back from HAL, just call the BAP client
9684 // registered call back from TL. There is only 1 possible
9685 // BAP client. So directly reference tlBAPClient
9686 pTLCb->tlBAPClient.pfnFlushOpCompleteCb( pvosGCtx,
9687 FlushACRspPtr->ucSTAId,
9688 FlushACRspPtr->ucTid, FlushACRspPtr->status );
9689
9690 // Free the PAL memory, we are done with it.
9691 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9692 "Flush complete received by TL: Freeing %p", FlushACRspPtr));
9693 vos_mem_free((v_VOID_t *)FlushACRspPtr);
9694 break;
9695
9696 case WDA_HDD_ADDBA_REQ:
9697 ptAddBaInd = (tAddBAInd*)(message->bodyptr);
9698 vosStatus = WLANTL_BaSessionAdd( pvosGCtx,
9699 ptAddBaInd->baSession.baSessionID,
9700 ptAddBaInd->baSession.STAID,
9701 ptAddBaInd->baSession.baTID,
9702 (v_U32_t)ptAddBaInd->baSession.baBufferSize,
9703 ptAddBaInd->baSession.winSize,
9704 ptAddBaInd->baSession.SSN);
9705 ptAddBaRsp = vos_mem_malloc(sizeof(*ptAddBaRsp));
9706
9707 if ( NULL == ptAddBaRsp )
9708 {
9709 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9710 "WLAN TL: fatal failure, cannot allocate BA Rsp structure"));
9711 VOS_ASSERT(0);
9712 return VOS_STATUS_E_NOMEM;
9713 }
9714
9715 if ( VOS_STATUS_SUCCESS == vosStatus )
9716 {
9717 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9718 "WLAN TL: Sending success indication to HAL for ADD BA"));
9719 /*Send success*/
9720 ptAddBaRsp->mesgType = WDA_HDD_ADDBA_RSP;
9721 vosMessage.type = WDA_HDD_ADDBA_RSP;
9722 }
9723 else
9724 {
9725 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9726 "WLAN TL: Sending failure indication to HAL for ADD BA"));
9727
9728 /*Send failure*/
9729 ptAddBaRsp->mesgType = WDA_BA_FAIL_IND;
9730 vosMessage.type = WDA_BA_FAIL_IND;
9731 }
9732
9733 ptAddBaRsp->mesgLen = sizeof(tAddBARsp);
9734 ptAddBaRsp->baSessionID = ptAddBaInd->baSession.baSessionID;
9735 /* This is default, reply win size has to be handled BA module, FIX THIS */
9736 ptAddBaRsp->replyWinSize = WLANTL_MAX_WINSIZE;
9737 vosMessage.bodyptr = ptAddBaRsp;
9738
9739 vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
9740 WLANTL_McFreeMsg (pvosGCtx, message);
9741 break;
9742 case WDA_DELETEBA_IND:
9743 ptDelBaInd = (tDelBAInd*)(message->bodyptr);
9744 vosStatus = WLANTL_BaSessionDel(pvosGCtx,
9745 ptDelBaInd->staIdx,
9746 ptDelBaInd->baTID);
9747
9748 if ( VOS_STATUS_SUCCESS != vosStatus )
9749 {
9750 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9751 "WLAN TL: Failed to del BA session STA:%d TID:%d Status :%d",
9752 ptDelBaInd->staIdx,
9753 ptDelBaInd->baTID,
9754 vosStatus));
9755 }
9756 WLANTL_McFreeMsg (pvosGCtx, message);
9757 break;
9758 default:
9759 /*no processing for now*/
9760 break;
9761 }
9762
9763 return VOS_STATUS_SUCCESS;
9764}/* WLANTL_ProcessMainMessage */
9765
9766/*==========================================================================
9767 FUNCTION WLANTL_McFreeMsg
9768
9769 DESCRIPTION
9770 Called by VOSS to free a given TL message on the Main thread when there
9771 are messages pending in the queue when the whole system is been reset.
9772 For now, TL does not allocate any body so this function shout translate
9773 into a NOOP
9774
9775 DEPENDENCIES
9776 The TL must be initialized before this function can be called.
9777
9778 PARAMETERS
9779
9780 IN
9781 pvosGCtx: pointer to the global vos context; a handle to TL's
9782 control block can be extracted from its context
9783 message: type and content of the message
9784
9785
9786 RETURN VALUE
9787 The result code associated with performing the operation
9788
9789 VOS_STATUS_SUCCESS: Everything is good :)
9790
9791 SIDE EFFECTS
9792
9793============================================================================*/
9794VOS_STATUS
9795WLANTL_McFreeMsg
9796(
9797 v_PVOID_t pvosGCtx,
9798 vos_msg_t* message
9799)
9800{
9801 WLANTL_CbType* pTLCb = NULL;
9802 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
9803
9804 /*------------------------------------------------------------------------
9805 Sanity check
9806 ------------------------------------------------------------------------*/
9807 if ( NULL == message )
9808 {
9809 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9810 "WLAN TL:Invalid parameter sent on WLANTL_McFreeMsg"));
9811 return VOS_STATUS_E_INVAL;
9812 }
9813
9814 /*------------------------------------------------------------------------
9815 Extract TL control block
9816 ------------------------------------------------------------------------*/
9817 pTLCb = VOS_GET_TL_CB(pvosGCtx);
9818 if ( NULL == pTLCb )
9819 {
9820 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9821 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_McFreeMsg"));
9822 return VOS_STATUS_E_FAULT;
9823 }
9824
9825 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9826 "WLAN TL:Received message: %d through main free", message->type));
9827
9828 switch( message->type )
9829 {
9830 case WDA_HDD_ADDBA_REQ:
9831 case WDA_DELETEBA_IND:
9832 /*vos free body pointer*/
9833 vos_mem_free(message->bodyptr);
9834 message->bodyptr = NULL;
9835 break;
9836 default:
9837 /*no processing for now*/
9838 break;
9839 }
9840
9841 return VOS_STATUS_SUCCESS;
9842}/*WLANTL_McFreeMsg*/
9843
9844/*==========================================================================
9845 FUNCTION WLANTL_TxProcessMsg
9846
9847 DESCRIPTION
9848 Called by VOSS when a message was serialized for TL through the
9849 tx thread/task.
9850
9851 DEPENDENCIES
9852 The TL must be initialized before this function can be called.
9853
9854 PARAMETERS
9855
9856 IN
9857 pvosGCtx: pointer to the global vos context; a handle to TL's
9858 control block can be extracted from its context
9859 message: type and content of the message
9860
9861
9862 RETURN VALUE
9863 The result code associated with performing the operation
9864
9865 VOS_STATUS_E_INVAL: invalid input parameters
9866 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
9867 page fault
9868 VOS_STATUS_SUCCESS: Everything is good :)
9869
9870 Other values can be returned as a result of a function call, please check
9871 corresponding API for more info.
9872 SIDE EFFECTS
9873
9874============================================================================*/
9875VOS_STATUS
9876WLANTL_TxProcessMsg
9877(
9878 v_PVOID_t pvosGCtx,
9879 vos_msg_t* message
9880)
9881{
9882 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07009883 void (*callbackRoutine) (void *callbackContext);
9884 void *callbackContext;
Jeff Johnson295189b2012-06-20 16:38:30 -07009885 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
9886
9887 /*------------------------------------------------------------------------
9888 Sanity check
9889 ------------------------------------------------------------------------*/
9890 if ( NULL == message )
9891 {
9892 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
9893 "WLAN TL:Invalid parameter sent on WLANTL_ProcessTxMessage"));
9894 return VOS_STATUS_E_INVAL;
9895 }
9896
9897 /*------------------------------------------------------------------------
9898 Process message
9899 ------------------------------------------------------------------------*/
9900 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
9901 "WLAN TL:Received message: %d through tx flow", message->type));
9902
9903 switch( message->type )
9904 {
9905 case WLANTL_TX_SIG_SUSPEND:
9906 vosStatus = WLANTL_SuspendCB( pvosGCtx,
9907 (WLANTL_SuspendCBType)message->bodyptr,
9908 message->reserved);
9909 break;
9910 case WLANTL_TX_RES_NEEDED:
9911 vosStatus = WLANTL_GetTxResourcesCB( pvosGCtx );
9912 break;
Katya Nigam664f5032014-05-05 12:24:32 +05309913
Jeff Johnson295189b2012-06-20 16:38:30 -07009914 case WDA_DS_TX_START_XMIT:
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05309915 WLANTL_ClearTxXmitPending(pvosGCtx);
9916 vosStatus = WDA_DS_TxFrames( pvosGCtx );
Jeff Johnson295189b2012-06-20 16:38:30 -07009917 break;
9918
9919 case WDA_DS_FINISH_ULA:
Arun Kumar Khandavalli8d1979d2014-01-09 21:12:25 +05309920 callbackContext = message->bodyptr;
9921 callbackRoutine = message->callback;
9922 if ( NULL != callbackRoutine )
9923 {
9924 callbackRoutine(callbackContext);
9925 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009926 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07009927
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05309928 case WLANTL_TX_SNAPSHOT:
9929 /*Dumping TL State and then continuing to print
9930 the DXE Dump*/
9931 WLANTL_TxThreadDebugHandler(pvosGCtx);
9932 WDA_TransportChannelDebug(NULL, VOS_TRUE, VOS_FALSE);
9933 break;
9934
Mihir Shetefd62d9d2014-08-06 15:08:21 +05309935 case WLANTL_TX_FATAL_ERROR:
9936 WLANTL_FatalErrorHandler(pvosGCtx);
9937 break;
9938
Mihir Shete327c2ab2014-11-13 15:17:02 +05309939 case WLANTL_TX_FW_DEBUG:
Siddharth Bhal68115602015-01-18 20:44:55 +05309940 vos_fwDumpReq(274, 0, 0, 0, 0, 1); //Async event
Mihir Shete327c2ab2014-11-13 15:17:02 +05309941 break;
9942
Sravan Kumar Kairame9d186c2015-11-27 23:37:02 +05309943 case WLANTL_TX_KICKDXE:
9944 WDA_TransportKickDxe();
9945 break;
9946
Jeff Johnson295189b2012-06-20 16:38:30 -07009947 default:
9948 /*no processing for now*/
9949 break;
9950 }
9951
9952 return vosStatus;
9953}/* WLANTL_TxProcessMsg */
9954
9955/*==========================================================================
9956 FUNCTION WLANTL_McFreeMsg
9957
9958 DESCRIPTION
9959 Called by VOSS to free a given TL message on the Main thread when there
9960 are messages pending in the queue when the whole system is been reset.
9961 For now, TL does not allocate any body so this function shout translate
9962 into a NOOP
9963
9964 DEPENDENCIES
9965 The TL must be initialized before this function can be called.
9966
9967 PARAMETERS
9968
9969 IN
9970 pvosGCtx: pointer to the global vos context; a handle to TL's
9971 control block can be extracted from its context
9972 message: type and content of the message
9973
9974
9975 RETURN VALUE
9976 The result code associated with performing the operation
9977
9978 VOS_STATUS_SUCCESS: Everything is good :)
9979
9980 SIDE EFFECTS
9981
9982============================================================================*/
9983VOS_STATUS
9984WLANTL_TxFreeMsg
9985(
9986 v_PVOID_t pvosGCtx,
9987 vos_msg_t* message
9988)
9989{
9990 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
9991
9992 /*Nothing to do for now!!!*/
9993 return VOS_STATUS_SUCCESS;
9994}/*WLANTL_TxFreeMsg*/
9995
Jeff Johnson295189b2012-06-20 16:38:30 -07009996/*==========================================================================
9997
9998 FUNCTION WLANTL_TxFCFrame
9999
10000 DESCRIPTION
10001 Internal utility function to send FC frame. Enable
10002 or disable LWM mode based on the information.
10003
10004 DEPENDENCIES
10005 TL must be initiailized before this function gets called.
10006 FW sends up special flow control frame.
10007
10008 PARAMETERS
10009
10010 IN
10011 pvosGCtx: pointer to the global vos context; a handle to TL's
10012 control block can be extracted from its context
10013
10014 RETURN VALUE
10015 The result code associated with performing the operation
10016
10017 VOS_STATUS_E_INVAL: Input pointers are NULL.
10018 VOS_STATUS_E_FAULT: Something is wrong.
10019 VOS_STATUS_SUCCESS: Everything is good.
10020
10021 SIDE EFFECTS
10022 Newly formed FC frame is generated and waits to be transmitted. Previously unsent frame will
10023 be released.
10024
10025============================================================================*/
10026VOS_STATUS
10027WLANTL_TxFCFrame
10028(
10029 v_PVOID_t pvosGCtx
10030)
10031{
10032#if 0
10033 WLANTL_CbType* pTLCb = NULL;
10034 VOS_STATUS vosStatus;
10035 tpHalFcTxBd pvFcTxBd = NULL;
10036 vos_pkt_t * pPacket = NULL;
10037 v_U8_t ucSTAId = 0;
10038 v_U8_t ucBitCheck = 1;
10039
10040 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070010041 "WLAN TL: Send FC frame %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -070010042
10043 /*------------------------------------------------------------------------
10044 Sanity check
10045 ------------------------------------------------------------------------*/
10046 if ( NULL == pvosGCtx )
10047 {
10048 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070010049 "WLAN TL:Invalid parameter %s", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -070010050 return VOS_STATUS_E_INVAL;
10051 }
10052 /*------------------------------------------------------------------------
10053 Extract TL control block
10054 ------------------------------------------------------------------------*/
10055 pTLCb = VOS_GET_TL_CB(pvosGCtx);
10056
10057 if (NULL == pTLCb)
10058 {
10059 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070010060 "WLAN TL:Invalid pointer in %s \n", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -070010061 return VOS_STATUS_E_INVAL;
10062 }
10063
10064 //Get one voss packet
10065 vosStatus = vos_pkt_get_packet( &pPacket, VOS_PKT_TYPE_TX_802_11_MGMT, sizeof(tHalFcTxBd), 1,
10066 VOS_FALSE, NULL, NULL );
10067
10068 if ( VOS_STATUS_SUCCESS != vosStatus )
10069 {
10070 return VOS_STATUS_E_INVAL;
10071 }
10072
10073 vosStatus = vos_pkt_reserve_head( pPacket, (void *)&pvFcTxBd, sizeof(tHalFcTxBd));
10074
10075 if( VOS_STATUS_SUCCESS != vosStatus )
10076 {
10077 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070010078 "%s: failed to reserve FC TX BD %d\n",__func__, sizeof(tHalFcTxBd)));
Jeff Johnson295189b2012-06-20 16:38:30 -070010079 vos_pkt_return_packet( pPacket );
10080 return VOS_STATUS_E_FAULT;
10081 }
10082
10083 //Generate most recent tlFCInfo. Most fields are correct.
10084 pTLCb->tlFCInfo.fcSTAThreshEnabledMask = 0;
10085 pTLCb->tlFCInfo.fcSTATxMoreDataMask = 0;
10086 for( ucSTAId = 0, ucBitCheck = 1 ; ucSTAId < WLAN_MAX_STA_COUNT; ucBitCheck <<= 1, ucSTAId ++)
10087 {
10088 if (0 == pTLCb->atlSTAClients[ucSTAId].ucExists)
10089 {
10090 continue;
10091 }
10092
10093 if (pTLCb->atlSTAClients[ucSTAId].ucPktPending)
10094 {
10095 pTLCb->tlFCInfo.fcSTATxMoreDataMask |= ucBitCheck;
10096 }
10097
10098 if ( (pTLCb->atlSTAClients[ucSTAId].ucLwmModeEnabled) &&
10099 (pTLCb->atlSTAClients[ucSTAId].bmuMemConsumed > pTLCb->atlSTAClients[ucSTAId].uLwmThreshold))
10100 {
10101 pTLCb->tlFCInfo.fcSTAThreshEnabledMask |= ucBitCheck;
10102
10103 pTLCb->tlFCInfo.fcSTAThresh[ucSTAId] = (tANI_U8)pTLCb->atlSTAClients[ucSTAId].uLwmThreshold;
10104
10105 pTLCb->atlSTAClients[ucSTAId].ucLwmEventReported = FALSE;
10106 }
10107
10108 }
10109
10110 //request immediate feedback
10111 pTLCb->tlFCInfo.fcConfig |= 0x4;
10112
10113 //fill in BD to sent
10114 vosStatus = WLANHAL_FillFcTxBd(pvosGCtx, &pTLCb->tlFCInfo, (void *)pvFcTxBd);
10115
10116 if( VOS_STATUS_SUCCESS != vosStatus )
10117 {
10118 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070010119 "%s: Fill FC TX BD unsuccessful\n", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -070010120 vos_pkt_return_packet( pPacket );
10121 return VOS_STATUS_E_FAULT;
10122 }
10123
10124 if (NULL != pTLCb->vosTxFCBuf)
10125 {
10126 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070010127 "%s: Previous FC TX BD not sent\n", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -070010128 vos_pkt_return_packet(pTLCb->vosTxFCBuf);
10129 }
10130
10131 pTLCb->vosTxFCBuf = pPacket;
10132
10133 vos_pkt_set_user_data_ptr( pPacket, VOS_PKT_USER_DATA_ID_TL,
10134 (v_PVOID_t)WLANTL_TxCompDefaultCb);
10135 vosStatus = WDA_DS_StartXmit(pvosGCtx);
10136
10137 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070010138 "WLAN TL: send FC frame leave %s", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -070010139#endif
10140 return VOS_STATUS_SUCCESS;
10141}
10142
Jeff Johnson295189b2012-06-20 16:38:30 -070010143
10144/*==========================================================================
10145 FUNCTION WLANTL_GetTxResourcesCB
10146
10147 DESCRIPTION
10148 Processing function for Resource needed signal. A request will be issued
10149 to BAL to get more tx resources.
10150
10151 DEPENDENCIES
10152 The TL must be initialized before this function can be called.
10153
10154 PARAMETERS
10155
10156 IN
10157 pvosGCtx: pointer to the global vos context; a handle to TL's
10158 control block can be extracted from its context
10159
10160
10161 RETURN VALUE
10162 The result code associated with performing the operation
10163
10164 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
10165 page fault
10166 VOS_STATUS_SUCCESS: Everything is good :)
10167
10168 Other values can be returned as a result of a function call, please check
10169 corresponding API for more info.
10170 SIDE EFFECTS
10171
10172============================================================================*/
10173VOS_STATUS
10174WLANTL_GetTxResourcesCB
10175(
10176 v_PVOID_t pvosGCtx
10177)
10178{
10179 WLANTL_CbType* pTLCb = NULL;
10180 v_U32_t uResCount = WDA_TLI_MIN_RES_DATA;
10181 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
10182 v_U8_t ucMgmt = 0;
10183 v_U8_t ucBAP = 0;
10184 v_U8_t ucData = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -070010185#ifdef WLAN_SOFTAP_FLOWCTRL_EN
10186 tBssSystemRole systemRole;
10187 tpAniSirGlobal pMac;
10188#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070010189 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
10190 /*------------------------------------------------------------------------
10191 Extract TL control block
10192 ------------------------------------------------------------------------*/
10193 pTLCb = VOS_GET_TL_CB(pvosGCtx);
10194 if ( NULL == pTLCb )
10195 {
10196 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10197 "WLAN TL:Invalid TL pointer from pvosGCtx on"
10198 " WLANTL_ProcessTxMessage"));
10199 return VOS_STATUS_E_FAULT;
10200 }
10201
10202 /*------------------------------------------------------------------------
10203 Get tx resources from BAL
10204 ------------------------------------------------------------------------*/
10205 vosStatus = WDA_DS_GetTxResources( pvosGCtx, &uResCount );
10206
10207 if ( (VOS_STATUS_SUCCESS != vosStatus) && (VOS_STATUS_E_RESOURCES != vosStatus))
10208 {
10209 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10210 "WLAN TL:TL failed to get resources from BAL, Err: %d",
10211 vosStatus));
10212 return vosStatus;
10213 }
10214
10215 /* Currently only Linux BAL returns the E_RESOURCES error code when it is running
10216 out of BD/PDUs. To make use of this interrupt for throughput enhancement, similar
10217 changes should be done in BAL code of AMSS and WM */
10218 if (VOS_STATUS_E_RESOURCES == vosStatus)
10219 {
10220#ifdef VOLANS_PERF
10221 WLANHAL_EnableIdleBdPduInterrupt(pvosGCtx, (tANI_U8)bdPduInterruptGetThreshold);
10222 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10223 "WLAN TL: Enabling Idle BD/PDU interrupt, Current resources = %d", uResCount);
10224#else
10225 return VOS_STATUS_E_FAILURE;
10226#endif
10227 }
10228
10229 pTLCb->uResCount = uResCount;
10230
10231
Jeff Johnson295189b2012-06-20 16:38:30 -070010232#ifdef WLAN_SOFTAP_FLOWCTRL_EN
10233 /* FIXME: disabled since creating issues in power-save, needs to be addressed */
10234 pTLCb->sendFCFrame ++;
10235 pMac = vos_get_context(VOS_MODULE_ID_WDA, pvosGCtx);
10236 systemRole = wdaGetGlobalSystemRole(pMac);
10237 if (eSYSTEM_AP_ROLE == systemRole)
10238 {
10239 if (pTLCb->sendFCFrame % 16 == 0)
10240 {
10241 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10242 "Transmit FC"));
10243 WLANTL_TxFCFrame (pvosGCtx);
10244 }
10245 }
10246#endif //WLAN_SOFTAP_FLOWCTRL_EN
Jeff Johnson295189b2012-06-20 16:38:30 -070010247
10248 ucData = ( pTLCb->uResCount >= WDA_TLI_MIN_RES_DATA );
10249 ucBAP = ( pTLCb->uResCount >= WDA_TLI_MIN_RES_BAP ) &&
10250 ( NULL != pTLCb->tlBAPClient.vosPendingDataBuff );
10251 ucMgmt = ( pTLCb->uResCount >= WDA_TLI_MIN_RES_MF ) &&
10252 ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff );
10253
10254 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10255 "WLAN TL: Eval Resume tx Res: %d DATA: %d BAP: %d MGMT: %d",
10256 pTLCb->uResCount, ucData, ucBAP, ucMgmt));
10257
10258 if (( 0 == pTLCb->ucTxSuspended ) &&
10259 (( 0 != ucData ) || ( 0 != ucMgmt ) || ( 0 != ucBAP ) ) )
10260 {
10261 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10262 "Issuing Xmit start request to BAL for avail res SYNC"));
10263 vosStatus =WDA_DS_StartXmit(pvosGCtx);
10264 }
10265 return vosStatus;
10266}/*WLANTL_GetTxResourcesCB*/
10267
10268/*==========================================================================
10269 Utility functions
10270 ==========================================================================*/
10271
10272/*==========================================================================
10273 FUNCTION WLANTL_Translate8023To80211Header
10274
10275 DESCRIPTION
10276 Inline function for translating and 802.11 header into an 802.3 header.
10277
10278 DEPENDENCIES
10279
10280
10281 PARAMETERS
10282
10283 IN
10284 pTLCb: TL control block
Kiran Venkatappaa044eb92012-12-17 15:48:49 -080010285 IN/OUT
10286 ucStaId: station ID. Incase of TDLS, this returns actual TDLS
10287 station ID used
Jeff Johnson295189b2012-06-20 16:38:30 -070010288
10289 IN/OUT
10290 vosDataBuff: vos data buffer, will contain the new header on output
10291
10292 OUT
10293 pvosStatus: status of the operation
10294
10295 RETURN VALUE
10296
10297 VOS_STATUS_SUCCESS: Everything is good :)
10298
10299 Other error codes might be returned from the vos api used in the function
10300 please check those return values.
10301
10302 SIDE EFFECTS
10303
10304============================================================================*/
Kiran Venkatappacab0d352012-12-17 13:09:22 -080010305VOS_STATUS
10306WLANTL_Translate8023To80211Header
10307(
10308 vos_pkt_t* vosDataBuff,
10309 VOS_STATUS* pvosStatus,
10310 WLANTL_CbType* pTLCb,
10311 v_U8_t *pucStaId,
Ravi Joshid0699502013-07-08 15:48:47 -070010312 WLANTL_MetaInfoType *tlMetaInfo,
Kiran Venkatappacab0d352012-12-17 13:09:22 -080010313 v_U8_t *ucWDSEnabled,
10314 v_U8_t *extraHeadSpace
10315)
Jeff Johnson295189b2012-06-20 16:38:30 -070010316{
10317 WLANTL_8023HeaderType w8023Header;
10318 WLANTL_80211HeaderType *pw80211Header; // Allocate an aligned BD and then fill it.
10319 VOS_STATUS vosStatus;
10320 v_U8_t MandatoryucHeaderSize = WLAN80211_MANDATORY_HEADER_SIZE;
10321 v_U8_t ucHeaderSize = 0;
10322 v_VOID_t *ppvBDHeader = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010323 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -070010324 v_U8_t ucQoSOffset = WLAN80211_MANDATORY_HEADER_SIZE;
Kiran Venkatappacab0d352012-12-17 13:09:22 -080010325 v_U8_t ucStaId;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010326#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010327 v_BOOL_t bIAPPTxwithLLC = VOS_FALSE;
10328 v_SIZE_t wIAPPSnapSize = WLANTL_LLC_HEADER_LEN;
10329 v_U8_t wIAPPSnap[WLANTL_LLC_HEADER_LEN] = {0};
10330#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070010331 *ucWDSEnabled = 0; // default WDS off.
10332 vosStatus = vos_pkt_pop_head( vosDataBuff, &w8023Header,
10333 sizeof(w8023Header));
10334
10335 if ( VOS_STATUS_SUCCESS != vosStatus )
10336 {
10337 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10338 "WLAN TL: Packet pop header fails on WLANTL_Translate8023To80211Header"));
10339 return vosStatus;
10340 }
10341
Kiran Venkatappacab0d352012-12-17 13:09:22 -080010342 if( NULL == pucStaId )
10343 {
10344 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10345 "WLAN TL: Invalid pointer for StaId"));
10346 return VOS_STATUS_E_INVAL;
10347 }
10348 ucStaId = *pucStaId;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010349 pClientSTA = pTLCb->atlSTAClients[ucStaId];
10350
10351 if ( NULL == pClientSTA )
10352 {
10353 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10354 "WLAN TL:Client Memory was not allocated on %s", __func__));
10355 return VOS_STATUS_E_FAILURE;
10356 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010357
Kiran Venkatappaa044eb92012-12-17 15:48:49 -080010358#ifdef FEATURE_WLAN_TDLS
10359
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +053010360 if ( WLAN_STA_INFRA == pTLCb->atlSTAClients[ucStaId]->wSTADesc.wSTAType
10361 && pTLCb->ucTdlsPeerCount )
Kiran Venkatappacab0d352012-12-17 13:09:22 -080010362 {
10363 v_U8_t ucIndex = 0;
10364 for ( ucIndex = 0; ucIndex < WLAN_MAX_STA_COUNT ; ucIndex++)
10365 {
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +053010366 if ( ucIndex != ucStaId && pTLCb->atlSTAClients[ucIndex] && pTLCb->atlSTAClients[ucIndex]->ucExists &&
Gopichand Nakkala471708b2013-06-04 20:03:01 +053010367 (pTLCb->atlSTAClients[ucIndex]->tlState == WLANTL_STA_AUTHENTICATED) &&
10368 (!pTLCb->atlSTAClients[ucIndex]->ucTxSuspended) &&
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +053010369 vos_mem_compare( (void*)pTLCb->atlSTAClients[ucIndex]->wSTADesc.vSTAMACAddress.bytes,
Kiran Venkatappacab0d352012-12-17 13:09:22 -080010370 (void*)w8023Header.vDA, 6) )
10371 {
10372 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
10373 "WLAN TL: Got a TDLS station. Using that index"));
10374 ucStaId = ucIndex;
10375 *pucStaId = ucStaId;
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +053010376 pClientSTA = pTLCb->atlSTAClients[ucStaId];
10377 if ( NULL == pClientSTA )
10378 {
10379 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10380 "WLAN TL:Client Memory was not allocated on %s", __func__));
10381 return VOS_STATUS_E_FAILURE;
10382 }
Kiran Venkatappacab0d352012-12-17 13:09:22 -080010383 break;
10384 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010385 }
Kiran Venkatappacab0d352012-12-17 13:09:22 -080010386 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010387#endif
10388
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010389#ifdef FEATURE_WLAN_ESE_UPLOAD
10390if ((0 == w8023Header.usLenType) && (pClientSTA->wSTADesc.ucIsEseSta))
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010391{
10392 vos_pkt_extract_data(vosDataBuff,0,&wIAPPSnap[0],&wIAPPSnapSize);
10393 if (vos_mem_compare(wIAPPSnap,WLANTL_AIRONET_SNAP_HEADER,WLANTL_LLC_HEADER_LEN))
10394 {
10395 /*The SNAP and the protocol type are already in the data buffer.
10396 They are filled by the application (wpa_supplicant). So, Skip Adding LLC below.*/
10397 bIAPPTxwithLLC = VOS_TRUE;
10398 }
10399 else
10400 {
10401 bIAPPTxwithLLC = VOS_FALSE;
10402 }
10403}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010404#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -070010405
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010406 if ((0 != pClientSTA->wSTADesc.ucAddRmvLLC)
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010407#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010408 && (!bIAPPTxwithLLC)
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010409#endif /* FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010410 )
Jeff Johnson295189b2012-06-20 16:38:30 -070010411 {
10412 /* Push the length */
10413 vosStatus = vos_pkt_push_head(vosDataBuff,
10414 &w8023Header.usLenType, sizeof(w8023Header.usLenType));
10415
10416 if ( VOS_STATUS_SUCCESS != vosStatus )
10417 {
10418 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10419 "WLAN TL: Packet push ether type fails on"
10420 " WLANTL_Translate8023To80211Header"));
10421 return vosStatus;
10422 }
10423
10424#ifdef BTAMP_TEST
10425 // The STA side will execute this, a hack to test BTAMP by using the
10426 // infra setup. On real BTAMP this will come from BAP itself.
10427 {
10428 static v_U8_t WLANTL_BT_AMP_LLC_HEADER[] = {0xAA, 0xAA, 0x03, 0x00, 0x19, 0x58 };
10429 vosStatus = vos_pkt_push_head(vosDataBuff, WLANTL_BT_AMP_LLC_HEADER,
10430 sizeof(WLANTL_BT_AMP_LLC_HEADER));
10431
10432 if ( VOS_STATUS_SUCCESS != vosStatus )
10433 {
10434 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10435 "WLAN TL: Packet push LLC header fails on"
10436 " WLANTL_Translate8023To80211Header"));
10437 return vosStatus;
10438 }
10439 }
10440#else
10441 vosStatus = vos_pkt_push_head(vosDataBuff, WLANTL_LLC_HEADER,
10442 sizeof(WLANTL_LLC_HEADER));
10443
10444 if ( VOS_STATUS_SUCCESS != vosStatus )
10445 {
10446 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10447 "WLAN TL: Packet push LLC header fails on"
10448 " WLANTL_Translate8023To80211Header"));
10449 return vosStatus;
10450 }
10451#endif
10452 }/*If add LLC is enabled*/
10453 else
10454 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010455#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010456 bIAPPTxwithLLC = VOS_FALSE; /*Reset the Flag here to start afresh with the next TX pkt*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010457#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -070010458 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10459 "WLAN TL: STA Client registered to not remove LLC"
10460 " WLANTL_Translate8023To80211Header"));
10461 }
10462
10463#ifdef BTAMP_TEST
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010464 pClientSTA->wSTADesc.wSTAType = WLAN_STA_BT_AMP;
Jeff Johnson295189b2012-06-20 16:38:30 -070010465#endif
10466
10467 // Find the space required for the 802.11 header format
10468 // based on the frame control fields.
10469 ucHeaderSize = MandatoryucHeaderSize;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010470 if (pClientSTA->wSTADesc.ucQosEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -070010471 {
10472 ucHeaderSize += sizeof(pw80211Header->usQosCtrl);
10473 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010474 if (pClientSTA->wSTADesc.wSTAType == WLAN_STA_BT_AMP)
Jeff Johnson295189b2012-06-20 16:38:30 -070010475 {
10476 ucHeaderSize += sizeof(pw80211Header->optvA4);
Jeff Johnson295189b2012-06-20 16:38:30 -070010477 ucQoSOffset += sizeof(pw80211Header->optvA4);
Jeff Johnson295189b2012-06-20 16:38:30 -070010478 }
10479
10480 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10481 " WLANTL_Translate8023To80211Header : Header size = %d ", ucHeaderSize));
10482
10483 vos_pkt_reserve_head( vosDataBuff, &ppvBDHeader, ucHeaderSize );
10484 if ( NULL == ppvBDHeader )
10485 {
10486 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10487 "WLAN TL:VOSS packet corrupted "));
10488 *pvosStatus = VOS_STATUS_E_INVAL;
10489 return *pvosStatus;
10490 }
10491
Jeff Johnson295189b2012-06-20 16:38:30 -070010492
10493 // OK now we have the space. Fill the 80211 header
10494 /* Fill A2 */
10495 pw80211Header = (WLANTL_80211HeaderType *)(ppvBDHeader);
10496 // only clear the required space.
10497 vos_mem_set( pw80211Header, ucHeaderSize, 0 );
10498 vos_mem_copy( pw80211Header->vA2, w8023Header.vSA, VOS_MAC_ADDR_SIZE);
10499
10500
10501#ifdef FEATURE_WLAN_WAPI
Gopichand Nakkala8b54e912013-03-11 10:44:21 +053010502 if (( WLANTL_STA_AUTHENTICATED == pClientSTA->tlState ||
Abhishek Singh8cecdaa2015-05-22 14:46:40 +053010503 pClientSTA->ptkInstalled ) && (tlMetaInfo->ucIsWai != 1))
Jeff Johnson295189b2012-06-20 16:38:30 -070010504#else
Gopichand Nakkala8b54e912013-03-11 10:44:21 +053010505 if ( WLANTL_STA_AUTHENTICATED == pClientSTA->tlState ||
10506 pClientSTA->ptkInstalled )
Jeff Johnson295189b2012-06-20 16:38:30 -070010507#endif
10508 {
10509 pw80211Header->wFrmCtrl.wep =
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010510 pClientSTA->wSTADesc.ucProtectedFrame;
Jeff Johnson295189b2012-06-20 16:38:30 -070010511 }
10512
10513 pw80211Header->usDurationId = 0;
10514 pw80211Header->usSeqCtrl = 0;
10515
10516 pw80211Header->wFrmCtrl.type = WLANTL_80211_DATA_TYPE;
10517
10518
10519
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010520 if(pClientSTA->wSTADesc.ucQosEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -070010521 {
10522 pw80211Header->wFrmCtrl.subType = WLANTL_80211_DATA_QOS_SUBTYPE;
10523
Ravi Joshid0699502013-07-08 15:48:47 -070010524 *((v_U16_t *)((v_U8_t *)ppvBDHeader + ucQoSOffset)) = tlMetaInfo->ucUP;
Jeff Johnson295189b2012-06-20 16:38:30 -070010525
10526 }
10527 else
10528 {
10529 pw80211Header->wFrmCtrl.subType = 0;
Agarwal Ashish8b343f12015-01-08 20:06:44 +053010530 tlMetaInfo->ucUP = 0;
10531 tlMetaInfo->ucTID = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -070010532
10533 // NO NO NO - there is not enough memory allocated to write the QOS ctrl
10534 // field, it will overwrite the first 2 bytes of the data packet(LLC header)
10535 // pw80211Header->usQosCtrl = 0;
10536 }
10537
10538
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010539 switch( pClientSTA->wSTADesc.wSTAType )
Jeff Johnson295189b2012-06-20 16:38:30 -070010540 {
Ravi Joshid0699502013-07-08 15:48:47 -070010541 case WLAN_STA_IBSS:
Jeff Johnson295189b2012-06-20 16:38:30 -070010542 pw80211Header->wFrmCtrl.toDS = 0;
10543 pw80211Header->wFrmCtrl.fromDS = 0;
Ravi Joshid0699502013-07-08 15:48:47 -070010544
Abhishek Singh45e68fe2014-12-11 12:55:59 +053010545 vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1,
Ravi Joshid0699502013-07-08 15:48:47 -070010546 (v_MACADDR_t*)&w8023Header.vDA);
Jeff Johnson295189b2012-06-20 16:38:30 -070010547 vos_mem_copy( pw80211Header->vA3,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010548 &pClientSTA->wSTADesc.vBSSIDforIBSS ,
Jeff Johnson295189b2012-06-20 16:38:30 -070010549 VOS_MAC_ADDR_SIZE);
10550 break;
10551
Ravi Joshid0699502013-07-08 15:48:47 -070010552 case WLAN_STA_BT_AMP:
Jeff Johnson295189b2012-06-20 16:38:30 -070010553 *ucWDSEnabled = 1; // WDS on.
10554 pw80211Header->wFrmCtrl.toDS = 1;
10555 pw80211Header->wFrmCtrl.fromDS = 1;
10556 vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010557 &pClientSTA->wSTADesc.vSTAMACAddress);
Jeff Johnson295189b2012-06-20 16:38:30 -070010558 vos_mem_copy( pw80211Header->vA2,
Ravi Joshid0699502013-07-08 15:48:47 -070010559 w8023Header.vSA, VOS_MAC_ADDR_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -070010560 vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA3,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010561 &pClientSTA->wSTADesc.vSTAMACAddress);
Jeff Johnson295189b2012-06-20 16:38:30 -070010562 /* fill the optional A4 header */
10563 vos_mem_copy( pw80211Header->optvA4,
Ravi Joshid0699502013-07-08 15:48:47 -070010564 w8023Header.vSA, VOS_MAC_ADDR_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -070010565 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -080010566 "BTAMP CASE NOW ---------staid=%d",
Ravi Joshid0699502013-07-08 15:48:47 -070010567 ucStaId));
Jeff Johnson295189b2012-06-20 16:38:30 -070010568 break;
10569
Ravi Joshid0699502013-07-08 15:48:47 -070010570 case WLAN_STA_SOFTAP:
Jeff Johnson295189b2012-06-20 16:38:30 -070010571 *ucWDSEnabled = 0; // WDS off.
10572 pw80211Header->wFrmCtrl.toDS = 0;
10573 pw80211Header->wFrmCtrl.fromDS = 1;
10574 /*Copy the DA to A1*/
10575 vos_mem_copy( pw80211Header->vA1, w8023Header.vDA , VOS_MAC_ADDR_SIZE);
10576 vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA2,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010577 &pClientSTA->wSTADesc.vSelfMACAddress);
Jeff Johnson295189b2012-06-20 16:38:30 -070010578 vos_mem_copy( pw80211Header->vA3,
Ravi Joshid0699502013-07-08 15:48:47 -070010579 w8023Header.vSA, VOS_MAC_ADDR_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -070010580 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -080010581 "sw 802 to 80211 softap case ---------staid=%d",
Ravi Joshid0699502013-07-08 15:48:47 -070010582 ucStaId));
Jeff Johnson295189b2012-06-20 16:38:30 -070010583 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010584#ifdef FEATURE_WLAN_TDLS
Ravi Joshid0699502013-07-08 15:48:47 -070010585 case WLAN_STA_TDLS:
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010586 pw80211Header->wFrmCtrl.toDS = 0;
10587 pw80211Header->wFrmCtrl.fromDS = 0;
10588 /*Fix me*/
10589 vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010590 &pClientSTA->wSTADesc.vSTAMACAddress);
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010591 vos_mem_copy( pw80211Header->vA3,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010592 &pClientSTA->wSTADesc.vBSSIDforIBSS ,
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010593 VOS_MAC_ADDR_SIZE);
10594 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -080010595 ("TL:TDLS CASE NOW ---------staid=%d"), ucStaId);
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010596 break;
10597#endif
Ravi Joshid0699502013-07-08 15:48:47 -070010598 case WLAN_STA_INFRA:
10599 default:
Jeff Johnson295189b2012-06-20 16:38:30 -070010600 pw80211Header->wFrmCtrl.toDS = 1;
10601 pw80211Header->wFrmCtrl.fromDS = 0;
10602 vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010603 &pClientSTA->wSTADesc.vSTAMACAddress);
Jeff Johnson295189b2012-06-20 16:38:30 -070010604 vos_mem_copy( pw80211Header->vA3, w8023Header.vDA , VOS_MAC_ADDR_SIZE);
10605 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -080010606 "REGULAR INFRA LINK CASE---------staid=%d",
Ravi Joshid0699502013-07-08 15:48:47 -070010607 ucStaId));
Jeff Johnson295189b2012-06-20 16:38:30 -070010608 break;
10609 }
10610 // OK now we have the space. Fill the 80211 header
10611 /* Fill A2 */
10612 pw80211Header = (WLANTL_80211HeaderType *)(ppvBDHeader);
10613 return VOS_STATUS_SUCCESS;
10614}/*WLANTL_Translate8023To80211Header*/
10615
10616
10617/*=============================================================================
10618 BEGIN LOG FUNCTION !!! Remove me or clean me
10619=============================================================================*/
Ravi Kumar Vaishnavb7652402013-01-18 19:05:15 -080010620#if 0 //def WLANTL_DEBUG
Jeff Johnson295189b2012-06-20 16:38:30 -070010621
10622#define WLANTL_DEBUG_FRAME_BYTE_PER_LINE 16
10623#define WLANTL_DEBUG_FRAME_BYTE_PER_BYTE 4
10624
10625static v_VOID_t WLANTL_DebugFrame
10626(
10627 v_PVOID_t dataPointer,
10628 v_U32_t dataSize
10629)
10630{
10631 v_U8_t lineBuffer[WLANTL_DEBUG_FRAME_BYTE_PER_LINE];
10632 v_U32_t numLines;
10633 v_U32_t numBytes;
10634 v_U32_t idx;
10635 v_U8_t *linePointer;
10636
10637 numLines = dataSize / WLANTL_DEBUG_FRAME_BYTE_PER_LINE;
10638 numBytes = dataSize % WLANTL_DEBUG_FRAME_BYTE_PER_LINE;
10639 linePointer = (v_U8_t *)dataPointer;
10640
10641 TLLOGE(VOS_TRACE(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR, "WLAN TL:Frame Debug Frame Size %d, Pointer 0x%p", dataSize, dataPointer));
10642 for(idx = 0; idx < numLines; idx++)
10643 {
10644 memset(lineBuffer, 0, WLANTL_DEBUG_FRAME_BYTE_PER_LINE);
10645 memcpy(lineBuffer, linePointer, WLANTL_DEBUG_FRAME_BYTE_PER_LINE);
10646 TLLOGE(VOS_TRACE(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR,
10647 "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",
10648 lineBuffer[0], lineBuffer[1], lineBuffer[2], lineBuffer[3], lineBuffer[4], lineBuffer[5], lineBuffer[6], lineBuffer[7],
10649 lineBuffer[8], lineBuffer[9], lineBuffer[10], lineBuffer[11], lineBuffer[12], lineBuffer[13], lineBuffer[14], lineBuffer[15]));
10650 linePointer += WLANTL_DEBUG_FRAME_BYTE_PER_LINE;
10651 }
10652
10653 if(0 == numBytes)
10654 return;
10655
10656 memset(lineBuffer, 0, WLANTL_DEBUG_FRAME_BYTE_PER_LINE);
10657 memcpy(lineBuffer, linePointer, numBytes);
10658 for(idx = 0; idx < WLANTL_DEBUG_FRAME_BYTE_PER_LINE / WLANTL_DEBUG_FRAME_BYTE_PER_BYTE; idx++)
10659 {
10660 TLLOGE(VOS_TRACE(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR, "WLAN TL:0x%2x 0x%2x 0x%2x 0x%2x",
10661 lineBuffer[idx * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE], lineBuffer[1 + idx * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE],
10662 lineBuffer[2 + idx * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE], lineBuffer[3 + idx * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE]));
10663 if(((idx + 1) * WLANTL_DEBUG_FRAME_BYTE_PER_BYTE) >= numBytes)
10664 break;
10665 }
10666
10667 return;
10668}
10669#endif
10670
10671/*=============================================================================
10672 END LOG FUNCTION
10673=============================================================================*/
10674
10675/*==========================================================================
10676 FUNCTION WLANTL_Translate80211To8023Header
10677
10678 DESCRIPTION
10679 Inline function for translating and 802.11 header into an 802.3 header.
10680
10681 DEPENDENCIES
10682
10683
10684 PARAMETERS
10685
10686 IN
10687 pTLCb: TL control block
10688 ucStaId: station ID
10689 ucHeaderLen: Length of the header from BD
10690 ucActualHLen: Length of header including padding or any other trailers
10691
10692 IN/OUT
10693 vosDataBuff: vos data buffer, will contain the new header on output
10694
10695 OUT
10696 pvosStatus: status of the operation
10697
10698 RETURN VALUE
10699
10700 The result code associated with performing the operation
10701 VOS_STATUS_SUCCESS: Everything is good :)
10702
10703 SIDE EFFECTS
10704
10705============================================================================*/
10706VOS_STATUS
10707WLANTL_Translate80211To8023Header
10708(
10709 vos_pkt_t* vosDataBuff,
10710 VOS_STATUS* pvosStatus,
10711 v_U16_t usActualHLen,
10712 v_U8_t ucHeaderLen,
10713 WLANTL_CbType* pTLCb,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010714 v_U8_t ucSTAId,
10715 v_BOOL_t bForwardIAPPwithLLC
Jeff Johnson295189b2012-06-20 16:38:30 -070010716)
10717{
10718 WLANTL_8023HeaderType w8023Header;
10719 WLANTL_80211HeaderType w80211Header;
10720 v_U8_t aucLLCHeader[WLANTL_LLC_HEADER_LEN];
10721 VOS_STATUS vosStatus;
10722 v_U16_t usDataStartOffset = 0;
10723 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
10724
10725 if ( sizeof(w80211Header) < ucHeaderLen )
10726 {
10727 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10728 "Warning !: Check the header size for the Rx frame structure=%d received=%dn",
10729 sizeof(w80211Header), ucHeaderLen));
10730 ucHeaderLen = sizeof(w80211Header);
10731 }
10732
10733 // This will take care of headers of all sizes, 3 address, 3 addr QOS,
10734 // WDS non-QOS and WDS QoS etc. We have space for all in the 802.11 header structure.
10735 vosStatus = vos_pkt_pop_head( vosDataBuff, &w80211Header, ucHeaderLen);
10736
10737 if ( VOS_STATUS_SUCCESS != vosStatus )
10738 {
10739 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10740 "WLAN TL: Failed to pop 80211 header from packet %d",
10741 vosStatus));
10742
10743 return vosStatus;
10744 }
10745
10746 switch ( w80211Header.wFrmCtrl.fromDS )
10747 {
10748 case 0:
Jeff Johnson295189b2012-06-20 16:38:30 -070010749 if ( w80211Header.wFrmCtrl.toDS )
10750 {
10751 //SoftAP AP mode
10752 vos_mem_copy( w8023Header.vDA, w80211Header.vA3, VOS_MAC_ADDR_SIZE);
10753 vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE);
10754 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -080010755 "WLAN TL SoftAP: 802 3 DA %08x SA %08x",
Jeff Johnson295189b2012-06-20 16:38:30 -070010756 w8023Header.vDA, w8023Header.vSA));
10757 }
10758 else
10759 {
10760 /* IBSS */
10761 vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE);
10762 vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE);
10763 }
Jeff Johnson295189b2012-06-20 16:38:30 -070010764 break;
10765 case 1:
10766 if ( w80211Header.wFrmCtrl.toDS )
10767 {
10768 /* BT-AMP case */
10769 vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE);
10770 vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE);
10771 }
10772 else
10773 { /* Infra */
10774 vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE);
10775 vos_mem_copy( w8023Header.vSA, w80211Header.vA3, VOS_MAC_ADDR_SIZE);
10776 }
10777 break;
10778 }
10779
10780 if( usActualHLen > ucHeaderLen )
10781 {
10782 usDataStartOffset = usActualHLen - ucHeaderLen;
10783 }
10784
10785 if ( 0 < usDataStartOffset )
10786 {
10787 vosStatus = vos_pkt_trim_head( vosDataBuff, usDataStartOffset );
10788
10789 if ( VOS_STATUS_SUCCESS != vosStatus )
10790 {
10791 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10792 "WLAN TL: Failed to trim header from packet %d",
10793 vosStatus));
10794 return vosStatus;
10795 }
10796 }
10797
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053010798 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
10799 {
10800 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10801 "WLAN TL:Client Memory was not allocated on %s", __func__));
10802 return VOS_STATUS_E_FAILURE;
10803 }
10804
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010805 if ( 0 != pTLCb->atlSTAClients[ucSTAId]->wSTADesc.ucAddRmvLLC
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010806#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010807 && (!bForwardIAPPwithLLC)
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010808#endif /* FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010809 )
Jeff Johnson295189b2012-06-20 16:38:30 -070010810 {
10811 // Extract the LLC header
10812 vosStatus = vos_pkt_pop_head( vosDataBuff, aucLLCHeader,
10813 WLANTL_LLC_HEADER_LEN);
10814
10815 if ( VOS_STATUS_SUCCESS != vosStatus )
10816 {
Kaushik, Sushante386ee12014-05-01 15:50:52 +053010817 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Jeff Johnson295189b2012-06-20 16:38:30 -070010818 "WLAN TL: Failed to pop LLC header from packet %d",
10819 vosStatus));
10820
10821 return vosStatus;
10822 }
10823
10824 //Extract the length
10825 vos_mem_copy(&w8023Header.usLenType,
10826 &aucLLCHeader[WLANTL_LLC_HEADER_LEN - sizeof(w8023Header.usLenType)],
10827 sizeof(w8023Header.usLenType) );
10828 }
10829 else
10830 {
10831 vosStatus = vos_pkt_get_packet_length(vosDataBuff,
10832 &w8023Header.usLenType);
10833
10834 if ( VOS_STATUS_SUCCESS != vosStatus )
10835 {
10836 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10837 "WLAN TL: Failed to get packet length %d",
10838 vosStatus));
10839
10840 return vosStatus;
10841 }
10842
10843 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10844 "WLAN TL: BTAMP len (ethertype) fld = %d",
10845 w8023Header.usLenType));
10846 w8023Header.usLenType = vos_cpu_to_be16(w8023Header.usLenType);
10847 }
10848
10849 vos_pkt_push_head(vosDataBuff, &w8023Header, sizeof(w8023Header));
10850
10851#ifdef BTAMP_TEST
10852 {
10853 // AP side will execute this.
10854 v_U8_t *temp_w8023Header = NULL;
10855 vosStatus = vos_pkt_peek_data( vosDataBuff, 0,
10856 &temp_w8023Header, sizeof(w8023Header) );
10857 }
10858#endif
10859#if 0 /*TL_DEBUG*/
10860 vos_pkt_get_packet_length(vosDataBuff, &usLen);
10861 vos_pkt_pop_head( vosDataBuff, aucData, usLen);
10862
10863 WLANTL_DebugFrame(aucData, usLen);
10864
10865 vos_pkt_push_head(vosDataBuff, aucData, usLen);
10866
10867#endif
10868
10869 *pvosStatus = VOS_STATUS_SUCCESS;
10870
10871 return VOS_STATUS_SUCCESS;
10872}/*WLANTL_Translate80211To8023Header*/
10873
Katya Nigame7b69a82015-04-28 15:24:06 +053010874VOS_STATUS
10875WLANTL_MonTranslate80211To8023Header
10876(
10877 vos_pkt_t* vosDataBuff,
10878 WLANTL_CbType* pTLCb
10879)
10880{
10881 v_U16_t usMPDUDOffset;
10882 v_U8_t ucMPDUHOffset;
10883 v_U8_t ucMPDUHLen;
10884 v_U16_t usActualHLen = 0;
10885 v_U16_t usDataStartOffset = 0;
10886 v_PVOID_t aucBDHeader;
10887 WLANTL_8023HeaderType w8023Header;
10888 WLANTL_80211HeaderType w80211Header;
10889 VOS_STATUS vosStatus;
10890 v_U8_t aucLLCHeader[WLANTL_LLC_HEADER_LEN];
10891
10892 WDA_DS_PeekRxPacketInfo( vosDataBuff, (v_PVOID_t)&aucBDHeader, 0 );
10893 ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(aucBDHeader);
10894 usMPDUDOffset = (v_U16_t)WDA_GET_RX_MPDU_DATA_OFFSET(aucBDHeader);
10895 ucMPDUHLen = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(aucBDHeader);
10896 if (usMPDUDOffset > ucMPDUHOffset)
10897 {
10898 usActualHLen = usMPDUDOffset - ucMPDUHOffset;
10899 }
10900
10901 if ( sizeof(w80211Header) < ucMPDUHLen )
10902 {
10903 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10904 "Warning !: Check the header size for the Rx frame structure=%d received=%dn",
10905 sizeof(w80211Header), ucMPDUHLen));
10906 ucMPDUHLen = sizeof(w80211Header);
10907 }
10908
10909 vosStatus = vos_pkt_pop_head( vosDataBuff, &w80211Header, ucMPDUHLen);
10910 if ( VOS_STATUS_SUCCESS != vosStatus )
10911 {
10912 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10913 "WLAN TL: Failed to pop 80211 header from packet %d",
10914 vosStatus));
10915
10916 return vosStatus;
10917 }
10918 switch ( w80211Header.wFrmCtrl.fromDS )
10919 {
10920 case 0:
10921 if ( w80211Header.wFrmCtrl.toDS )
10922 {
10923 vos_mem_copy( w8023Header.vDA, w80211Header.vA3, VOS_MAC_ADDR_SIZE);
10924 vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE);
10925 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
10926 "WLAN TL SoftAP: 802 3 DA %08x SA %08x",
10927 w8023Header.vDA, w8023Header.vSA));
10928 }
10929 else
10930 {
10931 vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE);
10932 vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE);
10933 }
10934 break;
10935 case 1:
10936 if ( w80211Header.wFrmCtrl.toDS )
10937 {
10938 vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE);
10939 vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE);
10940 }
10941 else
10942 {
10943 vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE);
10944 vos_mem_copy( w8023Header.vSA, w80211Header.vA3, VOS_MAC_ADDR_SIZE);
10945 }
10946 break;
10947 }
10948 if( usActualHLen > ucMPDUHLen )
10949 {
10950 usDataStartOffset = usActualHLen - ucMPDUHLen;
10951 }
10952
10953 if ( 0 < usDataStartOffset )
10954 {
10955 vosStatus = vos_pkt_trim_head( vosDataBuff, usDataStartOffset );
10956
10957 if ( VOS_STATUS_SUCCESS != vosStatus )
10958 {
10959 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
10960 "WLAN TL: Failed to trim header from packet %d",
10961 vosStatus));
10962 return vosStatus;
10963 }
10964 }
10965 // Extract the LLC header
10966 vosStatus = vos_pkt_pop_head( vosDataBuff, aucLLCHeader,
10967 WLANTL_LLC_HEADER_LEN);
10968
10969 if ( VOS_STATUS_SUCCESS != vosStatus )
10970 {
10971 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
10972 "WLAN TL: Failed to pop LLC header from packet %d",
10973 vosStatus));
10974
10975 return vosStatus;
10976 }
10977
10978 //Extract the length
10979 vos_mem_copy(&w8023Header.usLenType,
10980 &aucLLCHeader[WLANTL_LLC_HEADER_LEN - sizeof(w8023Header.usLenType)],
10981 sizeof(w8023Header.usLenType) );
10982
10983 vos_pkt_push_head(vosDataBuff, &w8023Header, sizeof(w8023Header));
10984 return VOS_STATUS_SUCCESS;
10985}
10986
Madan Mohan Koyyalamudia148e1e2012-11-30 14:52:59 -080010987/*==========================================================================
10988 FUNCTION WLANTL_FindFrameTypeBcMcUc
10989
10990 DESCRIPTION
10991 Utility function to find whether received frame is broadcast, multicast
10992 or unicast.
10993
10994 DEPENDENCIES
10995 The STA must be registered with TL before this function can be called.
10996
10997 PARAMETERS
10998
10999 IN
11000 pTLCb: pointer to the TL's control block
11001 ucSTAId: identifier of the station being processed
11002 vosDataBuff: pointer to the vos buffer
11003
11004 IN/OUT
11005 pucBcMcUc: pointer to buffer, will contain frame type on return
11006
11007 RETURN VALUE
11008 The result code associated with performing the operation
11009
11010 VOS_STATUS_E_INVAL: invalid input parameters
11011 VOS_STATUS_E_BADMSG: failed to extract info from data buffer
11012 VOS_STATUS_SUCCESS: success
11013
11014 SIDE EFFECTS
11015 None.
11016============================================================================*/
11017VOS_STATUS
11018WLANTL_FindFrameTypeBcMcUc
11019(
11020 WLANTL_CbType *pTLCb,
11021 v_U8_t ucSTAId,
11022 vos_pkt_t *vosDataBuff,
11023 v_U8_t *pucBcMcUc
11024)
11025{
11026 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11027 v_PVOID_t aucBDHeader;
11028 v_PVOID_t pvPeekData;
11029 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
11030
11031 /*------------------------------------------------------------------------
11032 Sanity check
11033 ------------------------------------------------------------------------*/
11034 if ((NULL == pTLCb) ||
11035 (NULL == vosDataBuff) ||
11036 (NULL == pucBcMcUc))
11037 {
11038 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11039 "WLAN TL:Invalid parameter in WLANTL_FindFrameTypeBcMcUc"));
11040 return VOS_STATUS_E_INVAL;
11041 }
11042
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011043 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
11044 {
11045 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11046 "WLAN TL:Client Memory was not allocated on %s", __func__));
11047 return VOS_STATUS_E_FAILURE;
11048 }
11049
Madan Mohan Koyyalamudia148e1e2012-11-30 14:52:59 -080011050 /*------------------------------------------------------------------------
11051 Extract BD header and check if valid
11052 ------------------------------------------------------------------------*/
11053 vosStatus = WDA_DS_PeekRxPacketInfo(vosDataBuff, (v_PVOID_t)&aucBDHeader, 0/*Swap BD*/ );
11054
11055 if (NULL == aucBDHeader)
11056 {
11057 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11058 "WLAN TL:WLANTL_FindFrameTypeBcMcUc - Cannot extract BD header"));
11059 VOS_ASSERT(0);
11060 return VOS_STATUS_E_BADMSG;
11061 }
11062
11063 if ((0 == WDA_GET_RX_FT_DONE(aucBDHeader)) &&
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011064 (0 != pTLCb->atlSTAClients[ucSTAId]->wSTADesc.ucSwFrameRXXlation))
Madan Mohan Koyyalamudia148e1e2012-11-30 14:52:59 -080011065 {
11066 /* Its an 802.11 frame, extract MAC address 1 */
11067 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11068 "WLAN TL:WLANTL_FindFrameTypeBcMcUc - 802.11 frame, peeking Addr1"));
11069 vosStatus = vos_pkt_peek_data(vosDataBuff, WLANTL_MAC_ADDR_ALIGN(1),
11070 (v_PVOID_t)&pvPeekData, VOS_MAC_ADDR_SIZE);
11071 }
11072 else
11073 {
11074 /* Its an 802.3 frame, extract Destination MAC address */
11075 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11076 "WLAN TL:WLANTL_FindFrameTypeBcMcUc - 802.3 frame, peeking DA"));
11077 vosStatus = vos_pkt_peek_data(vosDataBuff, WLANTL_MAC_ADDR_ALIGN(0),
11078 (v_PVOID_t)&pvPeekData, VOS_MAC_ADDR_SIZE);
11079 }
11080
11081 if (VOS_STATUS_SUCCESS != vosStatus)
11082 {
11083 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11084 "WLAN TL:WLANTL_FindFrameTypeBcMcUc - Failed to peek MAC address"));
11085 return vosStatus;
11086 }
11087
11088 if (((tANI_U8 *)pvPeekData)[0] == 0xff)
11089 {
11090 *pucBcMcUc = WLANTL_FRAME_TYPE_BCAST;
11091 }
11092 else
11093 {
11094 if ((((tANI_U8 *)pvPeekData)[0] & 0x01) == 0x01)
11095 *pucBcMcUc = WLANTL_FRAME_TYPE_MCAST;
11096 else
11097 *pucBcMcUc = WLANTL_FRAME_TYPE_UCAST;
11098 }
11099
11100 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11101 "WLAN TL:WLANTL_FindFrameTypeBcMcUc - Addr1Byte1 is: %x",
11102 ((tANI_U8 *)pvPeekData)[0]));
11103
11104 return VOS_STATUS_SUCCESS;
11105}
11106
Jeff Johnson295189b2012-06-20 16:38:30 -070011107#if 0
11108#ifdef WLAN_PERF
11109/*==========================================================================
11110 FUNCTION WLANTL_FastHwFwdDataFrame
11111
11112 DESCRIPTION
11113 Fast path function to quickly forward a data frame if HAL determines BD
11114 signature computed here matches the signature inside current VOSS packet.
11115 If there is a match, HAL and TL fills in the swapped packet length into
11116 BD header and DxE header, respectively. Otherwise, packet goes back to
11117 normal (slow) path and a new BD signature would be tagged into BD in this
11118 VOSS packet later by the WLANHAL_FillTxBd() function.
11119
11120 DEPENDENCIES
11121
11122 PARAMETERS
11123
11124 IN
11125 pvosGCtx VOS context
11126 vosDataBuff Ptr to VOSS packet
11127 pMetaInfo For getting frame's TID
11128 pStaInfo For checking STA type
11129
11130 OUT
11131 pvosStatus returned status
11132 puFastFwdOK Flag to indicate whether frame could be fast forwarded
11133
11134 RETURN VALUE
11135 No return.
11136
11137 SIDE EFFECTS
11138
11139============================================================================*/
11140static void
11141WLANTL_FastHwFwdDataFrame
11142(
11143 v_PVOID_t pvosGCtx,
11144 vos_pkt_t* vosDataBuff,
11145 VOS_STATUS* pvosStatus,
11146 v_U32_t* puFastFwdOK,
11147 WLANTL_MetaInfoType* pMetaInfo,
11148 WLAN_STADescType* pStaInfo
11149
11150)
11151{
11152 v_PVOID_t pvPeekData;
11153 v_U8_t ucDxEBDWLANHeaderLen = WLANTL_BD_HEADER_LEN(0) + sizeof(WLANBAL_sDXEHeaderType);
11154 v_U8_t ucIsUnicast;
11155 WLANBAL_sDXEHeaderType *pDxEHeader;
11156 v_PVOID_t pvBDHeader;
11157 v_PVOID_t pucBuffPtr;
11158 v_U16_t usPktLen;
11159
11160 /*-----------------------------------------------------------------------
11161 Extract packet length
11162 -----------------------------------------------------------------------*/
11163
11164 vos_pkt_get_packet_length( vosDataBuff, &usPktLen);
11165
11166 /*-----------------------------------------------------------------------
11167 Extract MAC address
11168 -----------------------------------------------------------------------*/
11169 *pvosStatus = vos_pkt_peek_data( vosDataBuff,
11170 WLANTL_MAC_ADDR_ALIGN(0),
11171 (v_PVOID_t)&pvPeekData,
11172 VOS_MAC_ADDR_SIZE );
11173
11174 if ( VOS_STATUS_SUCCESS != *pvosStatus )
11175 {
11176 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11177 "WLAN TL:Failed while attempting to extract MAC Addr %d",
11178 *pvosStatus));
11179 *pvosStatus = VOS_STATUS_E_INVAL;
11180 return;
11181 }
11182
11183 /*-----------------------------------------------------------------------
11184 Reserve head room for DxE header, BD, and WLAN header
11185 -----------------------------------------------------------------------*/
11186
11187 vos_pkt_reserve_head( vosDataBuff, &pucBuffPtr,
11188 ucDxEBDWLANHeaderLen );
11189 if ( NULL == pucBuffPtr )
11190 {
11191 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11192 "WLAN TL:No enough space in VOSS packet %p for DxE/BD/WLAN header", vosDataBuff));
11193 *pvosStatus = VOS_STATUS_E_INVAL;
11194 return;
11195 }
11196 pDxEHeader = (WLANBAL_sDXEHeaderType *)pucBuffPtr;
11197 pvBDHeader = (v_PVOID_t) &pDxEHeader[1];
11198
11199 /* UMA Tx acceleration is enabled.
11200 * UMA would help convert frames to 802.11, fill partial BD fields and
11201 * construct LLC header. To further accelerate this kind of frames,
11202 * HAL would attempt to reuse the BD descriptor if the BD signature
11203 * matches to the saved BD descriptor.
11204 */
11205 if(pStaInfo->wSTAType == WLAN_STA_IBSS)
11206 ucIsUnicast = !(((tANI_U8 *)pvPeekData)[0] & 0x01);
11207 else
11208 ucIsUnicast = 1;
11209
11210 *puFastFwdOK = (v_U32_t) WLANHAL_TxBdFastFwd(pvosGCtx, pvPeekData, pMetaInfo->ucTID, ucIsUnicast, pvBDHeader, usPktLen );
11211
11212 /* Can't be fast forwarded. Trim the VOS head back to original location. */
11213 if(! *puFastFwdOK){
11214 vos_pkt_trim_head(vosDataBuff, ucDxEBDWLANHeaderLen);
11215 }else{
11216 /* could be fast forwarded. Now notify BAL DxE header filling could be completely skipped
11217 */
11218 v_U32_t uPacketSize = WLANTL_BD_HEADER_LEN(0) + usPktLen;
11219 vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAL,
11220 (v_PVOID_t)uPacketSize);
11221 pDxEHeader->size = SWAP_ENDIAN_UINT32(uPacketSize);
11222 }
11223 *pvosStatus = VOS_STATUS_SUCCESS;
11224 return;
11225}
11226#endif /*WLAN_PERF*/
11227#endif
11228
11229#if 0
11230/*==========================================================================
11231 FUNCTION WLANTL_PrepareBDHeader
11232
11233 DESCRIPTION
11234 Inline function for preparing BD header before HAL processing.
11235
11236 DEPENDENCIES
11237 Just notify HAL that suspend in TL is complete.
11238
11239 PARAMETERS
11240
11241 IN
11242 vosDataBuff: vos data buffer
11243 ucDisableFrmXtl: is frame xtl disabled
11244
11245 OUT
11246 ppvBDHeader: it will contain the BD header
11247 pvDestMacAdddr: it will contain the destination MAC address
11248 pvosStatus: status of the combined processing
11249 pusPktLen: packet len.
11250
11251 RETURN VALUE
11252 No return.
11253
11254 SIDE EFFECTS
11255
11256============================================================================*/
11257void
11258WLANTL_PrepareBDHeader
11259(
11260 vos_pkt_t* vosDataBuff,
11261 v_PVOID_t* ppvBDHeader,
11262 v_MACADDR_t* pvDestMacAdddr,
11263 v_U8_t ucDisableFrmXtl,
11264 VOS_STATUS* pvosStatus,
11265 v_U16_t* pusPktLen,
11266 v_U8_t ucQosEnabled,
11267 v_U8_t ucWDSEnabled,
11268 v_U8_t extraHeadSpace
11269)
11270{
11271 v_U8_t ucHeaderOffset;
11272 v_U8_t ucHeaderLen;
Jeff Johnson295189b2012-06-20 16:38:30 -070011273 v_U8_t ucBDHeaderLen = WLANTL_BD_HEADER_LEN(ucDisableFrmXtl);
11274
11275 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
11276 /*-------------------------------------------------------------------------
11277 Get header pointer from VOSS
11278 !!! make sure reserve head zeros out the memory
11279 -------------------------------------------------------------------------*/
11280 vos_pkt_get_packet_length( vosDataBuff, pusPktLen);
11281
11282 if ( WLANTL_MAC_HEADER_LEN(ucDisableFrmXtl) > *pusPktLen )
11283 {
11284 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11285 "WLAN TL: Length of the packet smaller than expected network"
11286 " header %d", *pusPktLen ));
11287
11288 *pvosStatus = VOS_STATUS_E_INVAL;
11289 return;
11290 }
11291
11292 vos_pkt_reserve_head( vosDataBuff, ppvBDHeader,
11293 ucBDHeaderLen );
11294 if ( NULL == *ppvBDHeader )
11295 {
11296 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11297 "WLAN TL:VOSS packet corrupted on Attach BD header"));
11298 *pvosStatus = VOS_STATUS_E_INVAL;
11299 return;
11300 }
11301
11302 /*-----------------------------------------------------------------------
11303 Extract MAC address
11304 -----------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -070011305 {
11306 v_SIZE_t usMacAddrSize = VOS_MAC_ADDR_SIZE;
11307 *pvosStatus = vos_pkt_extract_data( vosDataBuff,
11308 ucBDHeaderLen +
11309 WLANTL_MAC_ADDR_ALIGN(ucDisableFrmXtl),
11310 (v_PVOID_t)pvDestMacAdddr,
11311 &usMacAddrSize );
11312 }
Jeff Johnson295189b2012-06-20 16:38:30 -070011313 if ( VOS_STATUS_SUCCESS != *pvosStatus )
11314 {
11315 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11316 "WLAN TL:Failed while attempting to extract MAC Addr %d",
11317 *pvosStatus));
11318 }
11319 else
11320 {
11321 /*---------------------------------------------------------------------
11322 Fill MPDU info fields:
11323 - MPDU data start offset
11324 - MPDU header start offset
11325 - MPDU header length
11326 - MPDU length - this is a 16b field - needs swapping
11327 --------------------------------------------------------------------*/
11328 ucHeaderOffset = ucBDHeaderLen;
11329 ucHeaderLen = WLANTL_MAC_HEADER_LEN(ucDisableFrmXtl);
11330
11331 if ( 0 != ucDisableFrmXtl )
11332 {
11333 if ( 0 != ucQosEnabled )
11334 {
11335 ucHeaderLen += WLANTL_802_11_HEADER_QOS_CTL;
11336 }
11337
11338 // Similar to Qos we need something for WDS format !
11339 if ( ucWDSEnabled != 0 )
11340 {
11341 // If we have frame translation enabled
11342 ucHeaderLen += WLANTL_802_11_HEADER_ADDR4_LEN;
11343 }
11344 if ( extraHeadSpace != 0 )
11345 {
11346 // Decrease the packet length with the extra padding after the header
11347 *pusPktLen = *pusPktLen - extraHeadSpace;
11348 }
11349 }
11350
11351 WLANHAL_TX_BD_SET_MPDU_HEADER_LEN( *ppvBDHeader, ucHeaderLen);
11352 WLANHAL_TX_BD_SET_MPDU_HEADER_OFFSET( *ppvBDHeader, ucHeaderOffset);
11353 WLANHAL_TX_BD_SET_MPDU_DATA_OFFSET( *ppvBDHeader,
11354 ucHeaderOffset + ucHeaderLen + extraHeadSpace);
11355 WLANHAL_TX_BD_SET_MPDU_LEN( *ppvBDHeader, *pusPktLen);
11356
11357 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11358 "WLAN TL: VALUES ARE HLen=%x Hoff=%x doff=%x len=%x ex=%d",
11359 ucHeaderLen, ucHeaderOffset,
11360 (ucHeaderOffset + ucHeaderLen + extraHeadSpace),
11361 *pusPktLen, extraHeadSpace));
11362 }/* if peek MAC success*/
11363
11364}/* WLANTL_PrepareBDHeader */
11365#endif
11366
Jeff Johnson295189b2012-06-20 16:38:30 -070011367//THIS IS A HACK AND NEEDS TO BE FIXED FOR CONCURRENCY
11368/*==========================================================================
11369 FUNCTION WLAN_TLGetNextTxIds
11370
11371 DESCRIPTION
11372 Gets the next station and next AC in the list that should be served by the TL.
11373
11374 Multiple Station Scheduling and TL queue management.
11375
11376 4 HDD BC/MC data packet queue status is specified as Station 0's status. Weights used
11377 in WFQ algorith are initialized in WLANTL_OPEN and contained in tlConfigInfo field.
11378 Each station has fields of ucPktPending and AC mask to tell whether a AC has traffic
11379 or not.
11380
11381 Stations are served in a round-robin fashion from highest priority to lowest priority.
11382 The number of round-robin times of each prioirty equals to the WFQ weights and differetiates
11383 the traffic of different prioirty. As such, stations can not provide low priority packets if
11384 high priority packets are all served.
11385
11386 DEPENDENCIES
11387
11388 PARAMETERS
11389
11390 IN
11391 pvosGCtx: pointer to the global vos context; a handle to TL's
11392 control block can be extracted from its context
11393
11394 OUT
11395 pucSTAId: Station ID
11396
11397 RETURN VALUE
11398 The result code associated with performing the operation
11399
11400 VOS_STATUS_SUCCESS: Everything is good
11401
11402 SIDE EFFECTS
11403
11404 TL context contains currently served station ID in ucCurrentSTA field, currently served AC
11405 in uCurServedAC field, and unserved weights of current AC in uCurLeftWeight.
11406 When existing from the function, these three fields are changed accordingly.
11407
11408============================================================================*/
11409VOS_STATUS
11410WLAN_TLAPGetNextTxIds
11411(
11412 v_PVOID_t pvosGCtx,
11413 v_U8_t* pucSTAId
11414)
11415{
11416 WLANTL_CbType* pTLCb;
11417 v_U8_t ucACFilter = 1;
11418 v_U8_t ucNextSTA ;
11419 v_BOOL_t isServed = TRUE; //current round has find a packet or not
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +053011420 v_U8_t ucACLoopNum = WLANTL_AC_HIGH_PRIO + 1; //number of loop to go
Jeff Johnson295189b2012-06-20 16:38:30 -070011421 v_U8_t uFlowMask; // TX FlowMask from WDA
11422 uint8 ucACMask;
Gopichand Nakkala96237bc2013-01-04 12:20:29 -080011423 uint8 i = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -070011424 /*------------------------------------------------------------------------
11425 Extract TL control block
11426 ------------------------------------------------------------------------*/
11427 //ENTER();
11428
11429 pTLCb = VOS_GET_TL_CB(pvosGCtx);
11430 if ( NULL == pTLCb )
11431 {
11432 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11433 "WLAN TL:Invalid TL pointer from pvosGCtx on WLAN_TLAPGetNextTxIds"));
11434 return VOS_STATUS_E_FAULT;
11435 }
11436
11437 if ( VOS_STATUS_SUCCESS != WDA_DS_GetTxFlowMask( pvosGCtx, &uFlowMask ) )
11438 {
11439 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11440 "WLAN TL:Failed to retrieve Flow control mask from WDA"));
11441 return VOS_STATUS_E_FAULT;
11442 }
11443
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +053011444 /* The flow mask does not differentiate between different ACs/Qs
11445 * since we use a single dxe channel for all ACs/Qs, hence it is
11446 * enough to check that there are dxe resources on data channel
11447 */
11448 uFlowMask &= WLANTL_DATA_FLOW_MASK;
11449
11450 if (0 == uFlowMask)
11451 {
11452 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11453 "WLAN TL: No resources to send packets"));
11454
11455 // Setting STA Id to invalid if mask is 0
11456 *pucSTAId = WLAN_MAX_STA_COUNT;
11457 return VOS_STATUS_E_FAULT;
11458 }
11459
Jeff Johnson295189b2012-06-20 16:38:30 -070011460 ucNextSTA = pTLCb->ucCurrentSTA;
11461
11462 ++ucNextSTA;
11463
11464 if ( WLAN_MAX_STA_COUNT <= ucNextSTA )
11465 {
11466 //one round is done.
11467 ucNextSTA = 0;
11468 pTLCb->ucCurLeftWeight--;
11469 isServed = FALSE;
11470 if ( 0 == pTLCb->ucCurLeftWeight )
11471 {
11472 //current prioirty is done
11473 if ( WLANTL_AC_BK == (WLANTL_ACEnumType)pTLCb->uCurServedAC )
11474 {
11475 //end of current VO, VI, BE, BK loop. Reset priority.
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +053011476 pTLCb->uCurServedAC = WLANTL_AC_HIGH_PRIO;
Jeff Johnson295189b2012-06-20 16:38:30 -070011477 }
11478 else
11479 {
11480 pTLCb->uCurServedAC --;
11481 }
11482
11483 pTLCb->ucCurLeftWeight = pTLCb->tlConfigInfo.ucAcWeights[pTLCb->uCurServedAC];
11484
11485 } // (0 == pTLCb->ucCurLeftWeight)
11486 } //( WLAN_MAX_STA_COUNT == ucNextSTA )
11487
11488 //decide how many loops to go. if current loop is partial, do one extra to make sure
11489 //we cover every station
11490 if ((1 == pTLCb->ucCurLeftWeight) && (ucNextSTA != 0))
11491 {
11492 ucACLoopNum ++; // now is 5 loops
11493 }
11494
11495 /* Start with highest priority. ucNextSTA, pTLCb->uCurServedAC, pTLCb->ucCurLeftWeight
11496 all have previous values.*/
11497 for (; ucACLoopNum > 0; ucACLoopNum--)
11498 {
11499
11500 ucACFilter = 1 << pTLCb->uCurServedAC;
11501
11502 // pTLCb->ucCurLeftWeight keeps previous results.
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +053011503 for (; (pTLCb->ucCurLeftWeight > 0) ; pTLCb->ucCurLeftWeight-- )
Jeff Johnson295189b2012-06-20 16:38:30 -070011504 {
11505
11506 for ( ; ucNextSTA < WLAN_MAX_STA_COUNT; ucNextSTA ++ )
11507 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011508 if(NULL == pTLCb->atlSTAClients[ucNextSTA])
11509 {
11510 continue;
11511 }
11512 WLAN_TL_AC_ARRAY_2_MASK (pTLCb->atlSTAClients[ucNextSTA], ucACMask, i);
Jeff Johnson295189b2012-06-20 16:38:30 -070011513
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011514 if ( (0 == pTLCb->atlSTAClients[ucNextSTA]->ucExists) ||
11515 ((0 == pTLCb->atlSTAClients[ucNextSTA]->ucPktPending) && !(ucACMask)) ||
Jeff Johnson295189b2012-06-20 16:38:30 -070011516 (0 == (ucACMask & ucACFilter)) )
11517
11518 {
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -080011519 //current station does not exist or have any packet to serve.
11520 continue;
11521 }
11522
Bhargav Shahfbaeca22016-07-13 10:27:35 +053011523 if ((WLANTL_STA_AUTHENTICATED != pTLCb->atlSTAClients[ucNextSTA]->tlState)
11524 || (pTLCb->atlSTAClients[ucNextSTA]->disassoc_progress == VOS_TRUE ))
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -080011525 {
11526 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11527 "%s Sta %d not in auth state so skipping it.",
11528 __func__, ucNextSTA));
Jeff Johnson295189b2012-06-20 16:38:30 -070011529 continue;
11530 }
11531
11532 //go to next station if current station can't send due to flow control
11533 //Station is allowed to send when it is not in LWM mode. When station is in LWM mode,
11534 //station is allowed to send only after FW reports FW memory is below threshold and on-fly
11535 //packets are less then allowed value
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011536 if ( (TRUE == pTLCb->atlSTAClients[ucNextSTA]->ucLwmModeEnabled) &&
11537 ((FALSE == pTLCb->atlSTAClients[ucNextSTA]->ucLwmEventReported) ||
11538 (0 < pTLCb->atlSTAClients[ucNextSTA]->uBuffThresholdMax))
Jeff Johnson295189b2012-06-20 16:38:30 -070011539 )
11540 {
11541 continue;
11542 }
11543
11544
11545 // Find a station. Weight is updated already.
11546 *pucSTAId = ucNextSTA;
11547 pTLCb->ucCurrentSTA = ucNextSTA;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011548 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC = pTLCb->uCurServedAC;
Jeff Johnson295189b2012-06-20 16:38:30 -070011549
11550 TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
11551 " TL serve one station AC: %d W: %d StaId: %d",
11552 pTLCb->uCurServedAC, pTLCb->ucCurLeftWeight, pTLCb->ucCurrentSTA ));
11553
11554 return VOS_STATUS_SUCCESS;
11555 } //STA loop
11556
11557 ucNextSTA = 0;
11558 if ( FALSE == isServed )
11559 {
11560 //current loop finds no packet.no need to repeat for the same priority
11561 break;
11562 }
11563 //current loop is partial loop. go for one more loop.
11564 isServed = FALSE;
11565
11566 } //Weight loop
11567
11568 if (WLANTL_AC_BK == pTLCb->uCurServedAC)
11569 {
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +053011570 pTLCb->uCurServedAC = WLANTL_AC_HIGH_PRIO;
Jeff Johnson295189b2012-06-20 16:38:30 -070011571 }
11572 else
11573 {
11574 pTLCb->uCurServedAC--;
11575 }
11576 pTLCb->ucCurLeftWeight = pTLCb->tlConfigInfo.ucAcWeights[pTLCb->uCurServedAC];
11577
11578 }// AC loop
11579
11580 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussainf2b00992013-11-17 21:46:15 -080011581 " TL can't find one station to serve" ));
Jeff Johnson295189b2012-06-20 16:38:30 -070011582
11583 pTLCb->uCurServedAC = WLANTL_AC_BK;
11584 pTLCb->ucCurLeftWeight = 1;
11585 //invalid number will be captured by caller
11586 pTLCb->ucCurrentSTA = WLAN_MAX_STA_COUNT;
11587
11588 *pucSTAId = pTLCb->ucCurrentSTA;
Jeff Johnson295189b2012-06-20 16:38:30 -070011589 return VOS_STATUS_E_FAULT;
11590}
11591
11592
11593/*==========================================================================
11594 FUNCTION WLAN_TLGetNextTxIds
11595
11596 DESCRIPTION
11597 Gets the next station and next AC in the list
11598
11599 DEPENDENCIES
11600
11601 PARAMETERS
11602
11603 IN
11604 pvosGCtx: pointer to the global vos context; a handle to TL's
11605 control block can be extracted from its context
11606
11607 OUT
11608 pucSTAId: Station ID
11609
11610
11611 RETURN VALUE
11612 The result code associated with performing the operation
11613
11614 VOS_STATUS_SUCCESS: Everything is good :)
11615
11616 SIDE EFFECTS
11617
11618============================================================================*/
11619VOS_STATUS
11620WLAN_TLGetNextTxIds
11621(
11622 v_PVOID_t pvosGCtx,
11623 v_U8_t* pucSTAId
11624)
11625{
11626 WLANTL_CbType* pTLCb;
11627 v_U8_t ucNextAC;
11628 v_U8_t ucNextSTA;
11629 v_U8_t ucCount;
11630 v_U8_t uFlowMask; // TX FlowMask from WDA
11631 v_U8_t ucACMask = 0;
11632 v_U8_t i = 0;
11633
11634 tBssSystemRole systemRole; //RG HACK to be removed
11635 tpAniSirGlobal pMac;
11636
11637 pMac = vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
11638 if ( NULL == pMac )
11639 {
11640 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070011641 "%s: Invalid pMac", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -070011642 return VOS_STATUS_E_FAULT;
11643 }
11644
11645 systemRole = wdaGetGlobalSystemRole(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -070011646
Jeff Johnson295189b2012-06-20 16:38:30 -070011647 /*------------------------------------------------------------------------
11648 Extract TL control block
11649 ------------------------------------------------------------------------*/
11650 pTLCb = VOS_GET_TL_CB(pvosGCtx);
11651 if ( NULL == pTLCb )
11652 {
11653 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11654 "WLAN TL:Invalid TL pointer from pvosGCtx on WLAN_TLGetNextTxIds"));
11655 return VOS_STATUS_E_FAULT;
11656 }
11657
Sunil Ravid5406f22013-01-22 00:18:31 -080011658#ifdef FEATURE_WLAN_TDLS
Agarwal Ashishcd86f7b2014-06-16 17:11:58 +053011659 if ((eSYSTEM_AP_ROLE == systemRole) ||
Katya Nigam1fd24402015-02-16 14:52:19 +053011660 (eSYSTEM_STA_IN_IBSS_ROLE == systemRole) ||
Agarwal Ashishcd86f7b2014-06-16 17:11:58 +053011661 (vos_concurrent_open_sessions_running()) || pTLCb->ucTdlsPeerCount)
Sunil Ravid5406f22013-01-22 00:18:31 -080011662#else
Agarwal Ashishcd86f7b2014-06-16 17:11:58 +053011663 if ((eSYSTEM_AP_ROLE == systemRole) ||
Katya Nigam1fd24402015-02-16 14:52:19 +053011664 (eSYSTEM_STA_IN_IBSS_ROLE == systemRole) ||
Agarwal Ashishcd86f7b2014-06-16 17:11:58 +053011665 (vos_concurrent_open_sessions_running()))
Sunil Ravid5406f22013-01-22 00:18:31 -080011666#endif
11667 {
11668 return WLAN_TLAPGetNextTxIds(pvosGCtx,pucSTAId);
11669 }
11670
11671
Jeff Johnson295189b2012-06-20 16:38:30 -070011672 if ( VOS_STATUS_SUCCESS != WDA_DS_GetTxFlowMask( pvosGCtx, &uFlowMask ) )
11673 {
11674 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11675 "WLAN TL:Failed to retrieve Flow control mask from WDA"));
11676 return VOS_STATUS_E_FAULT;
11677 }
11678
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +053011679 /* The flow mask does not differentiate between different ACs/Qs
11680 * since we use a single dxe channel for all ACs/Qs, hence it is
11681 * enough to check that there are dxe resources on data channel
11682 */
11683 uFlowMask &= WLANTL_DATA_FLOW_MASK;
11684
11685 if (0 == uFlowMask)
11686 {
11687 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11688 "WLAN TL: No resources to send packets"));
11689
11690 // Setting STA id to invalid if mask is 0
11691 *pucSTAId = WLAN_MAX_STA_COUNT;
11692 return VOS_STATUS_E_FAULT;
11693 }
11694
Jeff Johnson295189b2012-06-20 16:38:30 -070011695 /*STA id - no priority yet implemented */
11696 /*-----------------------------------------------------------------------
11697 Choose the next STA for tx - for now go in a round robin fashion
11698 through all the stations that have pending packets
11699 -------------------------------------------------------------------------*/
11700 ucNextSTA = pTLCb->ucCurrentSTA;
11701
11702 pTLCb->ucCurrentSTA = WLAN_MAX_STA_COUNT;
11703 for ( ucCount = 0;
11704 ucCount < WLAN_MAX_STA_COUNT;
11705 ucCount++ )
11706 {
11707 ucNextSTA = ( (ucNextSTA+1) >= WLAN_MAX_STA_COUNT )?0:(ucNextSTA+1);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011708 if(NULL == pTLCb->atlSTAClients[ucNextSTA])
11709 {
11710 continue;
11711 }
11712 if (( pTLCb->atlSTAClients[ucNextSTA]->ucExists ) &&
11713 ( pTLCb->atlSTAClients[ucNextSTA]->ucPktPending ))
Jeff Johnson295189b2012-06-20 16:38:30 -070011714 {
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -080011715 if (WLANTL_STA_AUTHENTICATED == pTLCb->atlSTAClients[ucNextSTA]->tlState)
11716 {
11717 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11718 "STA ID: %d on WLAN_TLGetNextTxIds", *pucSTAId));
11719 pTLCb->ucCurrentSTA = ucNextSTA;
11720 break;
Tushnim Bhattacharyya5dd94562013-03-20 20:15:03 -070011721 }
11722 else
11723 {
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -080011724 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11725 "%s Sta %d is not in auth state, skipping this sta.",
11726 __func__, ucNextSTA));
Tushnim Bhattacharyya5dd94562013-03-20 20:15:03 -070011727 }
Jeff Johnson295189b2012-06-20 16:38:30 -070011728 }
11729 }
11730
11731 *pucSTAId = pTLCb->ucCurrentSTA;
11732
11733 if ( WLANTL_STA_ID_INVALID( *pucSTAId ) )
11734 {
11735 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11736 "WLAN TL:No station registered with TL at this point"));
11737
11738 return VOS_STATUS_E_FAULT;
11739
11740 }
11741
11742 /*Convert the array to a mask for easier operation*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011743 WLAN_TL_AC_ARRAY_2_MASK( pTLCb->atlSTAClients[*pucSTAId], ucACMask, i);
Jeff Johnson295189b2012-06-20 16:38:30 -070011744
11745 if ( 0 == ucACMask )
11746 {
11747 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11748 "WLAN TL: Mask 0 "
11749 "STA ID: %d on WLAN_TLGetNextTxIds", *pucSTAId));
11750
11751 /*setting STA id to invalid if mask is 0*/
11752 *pucSTAId = WLAN_MAX_STA_COUNT;
11753
11754 return VOS_STATUS_E_FAULT;
11755 }
11756
11757 /*-----------------------------------------------------------------------
11758 AC is updated whenever a packet is fetched from HDD -> the current
11759 weight of such an AC cannot be 0 -> in this case TL is expected to
11760 exit this function at this point during the main Tx loop
11761 -----------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011762 if ( 0 < pTLCb->atlSTAClients[*pucSTAId]->ucCurrentWeight )
Jeff Johnson295189b2012-06-20 16:38:30 -070011763 {
11764 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11765 "WLAN TL: Maintaining serviced AC to: %d for Weight: %d",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011766 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC ,
11767 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentWeight));
Jeff Johnson295189b2012-06-20 16:38:30 -070011768 return VOS_STATUS_SUCCESS;
11769 }
11770
11771 /*-----------------------------------------------------------------------
11772 Choose highest priority AC - !!! optimize me
11773 -----------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011774 ucNextAC = pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC;
Jeff Johnson295189b2012-06-20 16:38:30 -070011775 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11776 "Next AC: %d", ucNextAC));
11777
11778 while ( 0 != ucACMask )
11779 {
11780 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11781 " AC Mask: %d Next: %d Res : %d",
11782 ucACMask, ( 1 << ucNextAC ), ( ucACMask & ( 1 << ucNextAC ))));
11783
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +053011784 if ( 0 != ( ucACMask & ( 1 << ucNextAC )))
Jeff Johnson295189b2012-06-20 16:38:30 -070011785 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011786 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC =
Jeff Johnson295189b2012-06-20 16:38:30 -070011787 (WLANTL_ACEnumType)ucNextAC;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011788 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentWeight =
Jeff Johnson295189b2012-06-20 16:38:30 -070011789 pTLCb->tlConfigInfo.ucAcWeights[ucNextAC];
11790
11791 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11792 "WLAN TL: Switching serviced AC to: %d with Weight: %d",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011793 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC ,
11794 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentWeight));
Jeff Johnson295189b2012-06-20 16:38:30 -070011795 break;
11796 }
11797
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +053011798 if (ucNextAC == WLANTL_AC_BK)
11799 ucNextAC = WLANTL_AC_HIGH_PRIO;
11800 else
11801 ucNextAC--;
Jeff Johnson295189b2012-06-20 16:38:30 -070011802
11803 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11804 "Next AC %d", ucNextAC));
Jeff Johnson295189b2012-06-20 16:38:30 -070011805 }
11806
11807 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11808 " C AC: %d C W: %d",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053011809 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC,
11810 pTLCb->atlSTAClients[*pucSTAId]->ucCurrentWeight));
Jeff Johnson295189b2012-06-20 16:38:30 -070011811
11812 return VOS_STATUS_SUCCESS;
11813}/* WLAN_TLGetNextTxIds */
11814
Jeff Johnson295189b2012-06-20 16:38:30 -070011815
11816
11817/*==========================================================================
11818 DEFAULT HANDLERS: Registered at initialization with TL
11819 ==========================================================================*/
11820
11821/*==========================================================================
11822
11823 FUNCTION WLANTL_MgmtFrmRxDefaultCb
11824
11825 DESCRIPTION
11826 Default Mgmt Frm rx callback: asserts all the time. If this function gets
11827 called it means there is no registered rx cb pointer for Mgmt Frm.
11828
11829 DEPENDENCIES
11830
11831 PARAMETERS
11832 Not used.
11833
11834 RETURN VALUE
11835
11836 VOS_STATUS_E_FAILURE: Always FAILURE.
11837
11838============================================================================*/
11839VOS_STATUS
11840WLANTL_MgmtFrmRxDefaultCb
11841(
11842 v_PVOID_t pvosGCtx,
11843 v_PVOID_t vosBuff
11844)
11845{
11846 if ( NULL != vosBuff )
11847 {
11848 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
11849 "WLAN TL:Fatal failure: No registered Mgmt Frm client on pkt RX"));
11850 /* Drop packet */
11851 vos_pkt_return_packet((vos_pkt_t *)vosBuff);
11852 }
11853
Jeff Johnson295189b2012-06-20 16:38:30 -070011854 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11855 "WLAN TL: No registered Mgmt Frm client on pkt RX. Load/Unload in progress, Ignore"));
Jeff Johnson295189b2012-06-20 16:38:30 -070011856
11857 return VOS_STATUS_E_FAILURE;
11858}/*WLANTL_MgmtFrmRxDefaultCb*/
11859
11860/*==========================================================================
11861
Madan Mohan Koyyalamudi6c2977d2013-09-04 15:42:45 +053011862 FUNCTION WLANTL_BAPRxDefaultCb
Jeff Johnson295189b2012-06-20 16:38:30 -070011863
11864 DESCRIPTION
11865 Default BAP rx callback: asserts all the time. If this function gets
11866 called it means there is no registered rx cb pointer for BAP.
11867
11868 DEPENDENCIES
11869
11870 PARAMETERS
11871 Not used.
11872
11873 RETURN VALUE
11874
11875 VOS_STATUS_E_FAILURE: Always FAILURE.
11876
11877============================================================================*/
11878VOS_STATUS
11879WLANTL_BAPRxDefaultCb
11880(
11881 v_PVOID_t pvosGCtx,
11882 vos_pkt_t* vosDataBuff,
11883 WLANTL_BAPFrameEnumType frameType
11884)
11885{
11886 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
11887 "WLAN TL:Fatal failure: No registered BAP client on BAP pkt RX"));
11888#ifndef BTAMP_TEST
11889 VOS_ASSERT(0);
11890#endif
11891 return VOS_STATUS_E_FAILURE;
11892}/*WLANTL_MgmtFrmRxDefaultCb*/
11893
11894/*==========================================================================
11895
11896 FUNCTION WLANTL_STARxDefaultCb
11897
11898 DESCRIPTION
11899 Default STA rx callback: asserts all the time. If this function gets
11900 called it means there is no registered rx cb pointer for station.
11901 (Mem corruption most likely, it should never happen)
11902
11903 DEPENDENCIES
11904
11905 PARAMETERS
11906 Not used.
11907
11908 RETURN VALUE
11909
11910 VOS_STATUS_E_FAILURE: Always FAILURE.
11911
11912============================================================================*/
11913VOS_STATUS
11914WLANTL_STARxDefaultCb
11915(
11916 v_PVOID_t pvosGCtx,
11917 vos_pkt_t* vosDataBuff,
11918 v_U8_t ucSTAId,
11919 WLANTL_RxMetaInfoType* pRxMetaInfo
11920)
11921{
11922 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
11923 "WLAN TL: No registered STA client rx cb for STAID: %d dropping pkt",
11924 ucSTAId));
11925 vos_pkt_return_packet(vosDataBuff);
Madan Mohan Koyyalamudi6c2977d2013-09-04 15:42:45 +053011926 return VOS_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -070011927}/*WLANTL_MgmtFrmRxDefaultCb*/
11928
11929
11930/*==========================================================================
11931
11932 FUNCTION WLANTL_STAFetchPktDefaultCb
11933
11934 DESCRIPTION
11935 Default fetch callback: asserts all the time. If this function gets
11936 called it means there is no registered fetch cb pointer for station.
11937 (Mem corruption most likely, it should never happen)
11938
11939 DEPENDENCIES
11940
11941 PARAMETERS
11942 Not used.
11943
11944 RETURN VALUE
11945
11946 VOS_STATUS_E_FAILURE: Always FAILURE.
11947
11948============================================================================*/
11949VOS_STATUS
11950WLANTL_STAFetchPktDefaultCb
11951(
11952 v_PVOID_t pvosGCtx,
11953 v_U8_t* pucSTAId,
11954 WLANTL_ACEnumType ucAC,
11955 vos_pkt_t** vosDataBuff,
11956 WLANTL_MetaInfoType* tlMetaInfo
11957)
11958{
11959 TLLOGP(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
11960 "WLAN TL:Fatal failure: No registered STA client on data pkt RX"));
11961 VOS_ASSERT(0);
11962 return VOS_STATUS_E_FAILURE;
11963}/*WLANTL_MgmtFrmRxDefaultCb*/
11964
11965/*==========================================================================
11966
11967 FUNCTION WLANTL_TxCompDefaultCb
11968
11969 DESCRIPTION
11970 Default tx complete handler. It will release the completed pkt to
11971 prevent memory leaks.
11972
11973 PARAMETERS
11974
11975 IN
11976 pvosGCtx: pointer to the global vos context; a handle to
11977 TL/HAL/PE/BAP/HDD control block can be extracted from
11978 its context
11979 vosDataBuff: pointer to the VOSS data buffer that was transmitted
11980 wTxSTAtus: status of the transmission
11981
11982
11983 RETURN VALUE
11984 The result code associated with performing the operation; please
11985 check vos_pkt_return_packet for possible error codes.
11986
11987 Please check vos_pkt_return_packet API for possible return values.
11988
11989============================================================================*/
11990VOS_STATUS
11991WLANTL_TxCompDefaultCb
11992(
11993 v_PVOID_t pvosGCtx,
11994 vos_pkt_t* vosDataBuff,
11995 VOS_STATUS wTxSTAtus
11996)
11997{
11998 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
11999 "WLAN TL:TXComp not registered, releasing pkt to prevent mem leak"));
12000 return vos_pkt_return_packet(vosDataBuff);
12001}/*WLANTL_TxCompDefaultCb*/
12002
12003
12004/*==========================================================================
12005 Cleanup functions
12006 ==========================================================================*/
12007
12008/*==========================================================================
12009
12010 FUNCTION WLANTL_CleanCB
12011
12012 DESCRIPTION
12013 Cleans TL control block
12014
12015 DEPENDENCIES
12016
12017 PARAMETERS
12018
12019 IN
12020 pTLCb: pointer to TL's control block
12021 ucEmpty: set if TL has to clean up the queues and release pedning pkts
12022
12023 RETURN VALUE
12024 The result code associated with performing the operation
12025
12026 VOS_STATUS_E_INVAL: invalid input parameters
12027 VOS_STATUS_SUCCESS: Everything is good :)
12028
12029 SIDE EFFECTS
12030
12031============================================================================*/
12032VOS_STATUS
12033WLANTL_CleanCB
12034(
12035 WLANTL_CbType* pTLCb,
12036 v_U8_t ucEmpty
12037)
12038{
12039 v_U8_t ucIndex;
12040 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
12041
12042 /*-------------------------------------------------------------------------
12043 Sanity check
12044 -------------------------------------------------------------------------*/
12045 if ( NULL == pTLCb )
12046 {
12047 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12048 "WLAN TL:Invalid parameter sent on WLANTL_CleanCB"));
12049 return VOS_STATUS_E_INVAL;
12050 }
12051
12052 /* number of packets sent to BAL waiting for tx complete confirmation */
12053 pTLCb->usPendingTxCompleteCount = 0;
12054
12055 /* global suspend flag */
12056 vos_atomic_set_U8( &pTLCb->ucTxSuspended, 1);
12057
12058 /* resource flag */
12059 pTLCb->uResCount = 0;
12060
12061
12062 /*-------------------------------------------------------------------------
12063 Client stations
12064 -------------------------------------------------------------------------*/
12065 for ( ucIndex = 0; ucIndex < WLAN_MAX_STA_COUNT ; ucIndex++)
12066 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012067 if(NULL != pTLCb->atlSTAClients[ucIndex])
12068 {
12069 WLANTL_CleanSTA( pTLCb->atlSTAClients[ucIndex], ucEmpty);
12070 }
Jeff Johnson295189b2012-06-20 16:38:30 -070012071 }
12072
12073 /*-------------------------------------------------------------------------
12074 Management Frame client
12075 -------------------------------------------------------------------------*/
12076 pTLCb->tlMgmtFrmClient.ucExists = 0;
12077
12078 if ( ( 0 != ucEmpty) &&
12079 ( NULL != pTLCb->tlMgmtFrmClient.vosPendingDataBuff ))
12080 {
12081 vos_pkt_return_packet(pTLCb->tlMgmtFrmClient.vosPendingDataBuff);
12082 }
12083
12084 pTLCb->tlMgmtFrmClient.vosPendingDataBuff = NULL;
12085
12086 /* set to a default cb in order to prevent constant checking for NULL */
12087 pTLCb->tlMgmtFrmClient.pfnTlMgmtFrmRx = WLANTL_MgmtFrmRxDefaultCb;
12088
12089 /*-------------------------------------------------------------------------
12090 BT AMP client
12091 -------------------------------------------------------------------------*/
12092 pTLCb->tlBAPClient.ucExists = 0;
12093
12094 if (( 0 != ucEmpty) &&
12095 ( NULL != pTLCb->tlBAPClient.vosPendingDataBuff ))
12096 {
12097 vos_pkt_return_packet(pTLCb->tlBAPClient.vosPendingDataBuff);
12098 }
12099
12100 if (( 0 != ucEmpty) &&
12101 ( NULL != pTLCb->vosDummyBuf ))
12102 {
12103 vos_pkt_return_packet(pTLCb->vosDummyBuf);
12104 }
12105
12106 pTLCb->tlBAPClient.vosPendingDataBuff = NULL;
12107
12108 pTLCb->vosDummyBuf = NULL;
12109 pTLCb->vosTempBuf = NULL;
12110 pTLCb->ucCachedSTAId = WLAN_MAX_STA_COUNT;
12111
12112 /* set to a default cb in order to prevent constant checking for NULL */
12113 pTLCb->tlBAPClient.pfnTlBAPRx = WLANTL_BAPRxDefaultCb;
12114
12115 pTLCb->ucRegisteredStaId = WLAN_MAX_STA_COUNT;
12116
12117 return VOS_STATUS_SUCCESS;
12118
12119}/* WLANTL_CleanCB*/
12120
12121/*==========================================================================
12122
12123 FUNCTION WLANTL_CleanSTA
12124
12125 DESCRIPTION
12126 Cleans a station control block.
12127
12128 DEPENDENCIES
12129
12130 PARAMETERS
12131
12132 IN
12133 pvosGCtx: pointer to the global vos context; a handle to TL's
12134 control block can be extracted from its context
12135 ucEmpty: if set the queues and pending pkts will be emptyed
12136
12137 RETURN VALUE
12138 The result code associated with performing the operation
12139
12140 VOS_STATUS_E_INVAL: invalid input parameters
12141 VOS_STATUS_SUCCESS: Everything is good :)
12142
12143 SIDE EFFECTS
12144
12145============================================================================*/
12146VOS_STATUS
12147WLANTL_CleanSTA
12148(
12149 WLANTL_STAClientType* ptlSTAClient,
12150 v_U8_t ucEmpty
12151)
12152{
12153 v_U8_t ucIndex;
12154 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
12155
12156 /*-------------------------------------------------------------------------
12157 Sanity check
12158 -------------------------------------------------------------------------*/
12159 if ( NULL == ptlSTAClient )
12160 {
12161 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12162 "WLAN TL:Invalid parameter sent on WLANTL_CleanSTA"));
12163 return VOS_STATUS_E_INVAL;
12164 }
12165
12166 /*------------------------------------------------------------------------
12167 Clear station from TL
12168 ------------------------------------------------------------------------*/
12169 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
12170 "WLAN TL: Clearing STA Client ID: %d, Empty flag: %d",
12171 ptlSTAClient->wSTADesc.ucSTAId, ucEmpty ));
12172
12173 ptlSTAClient->pfnSTARx = WLANTL_STARxDefaultCb;
12174 ptlSTAClient->pfnSTATxComp = WLANTL_TxCompDefaultCb;
12175 ptlSTAClient->pfnSTAFetchPkt = WLANTL_STAFetchPktDefaultCb;
12176
12177 ptlSTAClient->tlState = WLANTL_STA_INIT;
12178 ptlSTAClient->tlPri = WLANTL_STA_PRI_NORMAL;
12179
12180 vos_zero_macaddr( &ptlSTAClient->wSTADesc.vSTAMACAddress );
12181 vos_zero_macaddr( &ptlSTAClient->wSTADesc.vBSSIDforIBSS );
12182 vos_zero_macaddr( &ptlSTAClient->wSTADesc.vSelfMACAddress );
12183
12184 ptlSTAClient->wSTADesc.ucSTAId = 0;
12185 ptlSTAClient->wSTADesc.wSTAType = WLAN_STA_MAX;
12186
12187 ptlSTAClient->wSTADesc.ucQosEnabled = 0;
12188 ptlSTAClient->wSTADesc.ucAddRmvLLC = 0;
12189 ptlSTAClient->wSTADesc.ucSwFrameTXXlation = 0;
12190 ptlSTAClient->wSTADesc.ucSwFrameRXXlation = 0;
12191 ptlSTAClient->wSTADesc.ucProtectedFrame = 0;
Bhargav Shahfbaeca22016-07-13 10:27:35 +053012192 ptlSTAClient->disassoc_progress = VOS_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -070012193 /*-------------------------------------------------------------------------
12194 AMSDU information for the STA
12195 -------------------------------------------------------------------------*/
12196 if ( ( 0 != ucEmpty ) &&
12197 ( NULL != ptlSTAClient->vosAMSDUChainRoot ))
12198 {
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -070012199 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
Jeff Johnson0298bd02013-11-14 19:58:38 -080012200 "WLAN TL:Non NULL vosAMSDUChainRoot on WLANTL_CleanSTA, "
Madan Mohan Koyyalamudic0e5bd82012-09-18 17:12:27 -070012201 "suspecting a memory corruption"));
12202
Jeff Johnson295189b2012-06-20 16:38:30 -070012203 }
12204
12205 ptlSTAClient->vosAMSDUChain = NULL;
12206 ptlSTAClient->vosAMSDUChainRoot = NULL;
12207
12208 vos_mem_zero( (v_PVOID_t)ptlSTAClient->aucMPDUHeader,
12209 WLANTL_MPDU_HEADER_LEN);
12210 ptlSTAClient->ucMPDUHeaderLen = 0;
12211
12212 /*-------------------------------------------------------------------------
12213 Reordering information for the STA
12214 -------------------------------------------------------------------------*/
12215 for ( ucIndex = 0; ucIndex < WLAN_MAX_TID ; ucIndex++)
12216 {
12217 if(0 == ptlSTAClient->atlBAReorderInfo[ucIndex].ucExists)
12218 {
12219 continue;
12220 }
12221 if(NULL != ptlSTAClient->atlBAReorderInfo[ucIndex].reorderBuffer)
12222 {
12223 ptlSTAClient->atlBAReorderInfo[ucIndex].reorderBuffer->isAvailable = VOS_TRUE;
12224 memset(&ptlSTAClient->atlBAReorderInfo[ucIndex].reorderBuffer->arrayBuffer[0], 0, WLANTL_MAX_WINSIZE * sizeof(v_PVOID_t));
12225 }
12226 vos_timer_destroy(&ptlSTAClient->atlBAReorderInfo[ucIndex].agingTimer);
12227 memset(&ptlSTAClient->atlBAReorderInfo[ucIndex], 0, sizeof(WLANTL_BAReorderType));
12228 }
12229
12230 /*-------------------------------------------------------------------------
12231 QOS information for the STA
12232 -------------------------------------------------------------------------*/
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +053012233 ptlSTAClient->ucCurrentAC = WLANTL_AC_HIGH_PRIO;
Jeff Johnson295189b2012-06-20 16:38:30 -070012234 ptlSTAClient->ucCurrentWeight = 0;
12235 ptlSTAClient->ucServicedAC = WLANTL_AC_BK;
12236
12237 vos_mem_zero( ptlSTAClient->aucACMask, sizeof(ptlSTAClient->aucACMask));
12238 vos_mem_zero( &ptlSTAClient->wUAPSDInfo, sizeof(ptlSTAClient->wUAPSDInfo));
12239
12240
12241 /*--------------------------------------------------------------------
12242 Stats info
12243 --------------------------------------------------------------------*/
12244 vos_mem_zero( ptlSTAClient->auRxCount,
12245 sizeof(ptlSTAClient->auRxCount[0])* WLAN_MAX_TID);
12246 vos_mem_zero( ptlSTAClient->auTxCount,
12247 sizeof(ptlSTAClient->auTxCount[0])* WLAN_MAX_TID);
12248 ptlSTAClient->rssiAvg = 0;
12249
12250 /*Tx not suspended and station fully registered*/
12251 vos_atomic_set_U8( &ptlSTAClient->ucTxSuspended, 0);
12252 vos_atomic_set_U8( &ptlSTAClient->ucNoMoreData, 1);
12253
12254 if ( 0 == ucEmpty )
12255 {
12256 ptlSTAClient->wSTADesc.ucUcastSig = WLAN_TL_INVALID_U_SIG;
12257 ptlSTAClient->wSTADesc.ucBcastSig = WLAN_TL_INVALID_B_SIG;
12258 }
12259
12260 ptlSTAClient->ucExists = 0;
12261
12262 /*--------------------------------------------------------------------
12263 Statistics info
12264 --------------------------------------------------------------------*/
12265 memset(&ptlSTAClient->trafficStatistics,
12266 0,
12267 sizeof(WLANTL_TRANSFER_STA_TYPE));
12268
12269 /*fix me!!: add new values from the TL Cb for cleanup */
12270 return VOS_STATUS_SUCCESS;
12271}/* WLANTL_CleanSTA */
12272
12273
12274/*==========================================================================
12275 FUNCTION WLANTL_EnableUAPSDForAC
12276
12277 DESCRIPTION
12278 Called by HDD to enable UAPSD. TL in turn calls WDA API to enable the
12279 logic in FW/SLM to start sending trigger frames. Previously TL had the
12280 trigger frame logic which later moved down to FW. Hence
12281 HDD -> TL -> WDA -> FW call flow.
12282
12283 DEPENDENCIES
12284 The TL must be initialized before this function can be called.
12285
12286 PARAMETERS
12287
12288 IN
12289 pvosGCtx: pointer to the global vos context; a handle to TL's
12290 control block can be extracted from its context
12291 ucSTAId: station Id
12292 ucAC: AC for which U-APSD is being enabled
12293 ucTid: TID for which U-APSD is setup
12294 ucUP: used to place in the trigger frame generation
12295 ucServiceInt: service interval used by TL to send trigger frames
12296 ucSuspendInt: suspend interval used by TL to determine that an
12297 app is idle and should start sending trigg frms less often
12298 wTSDir: direction of TSpec
12299
12300 RETURN VALUE
12301 The result code associated with performing the operation
12302
12303 VOS_STATUS_SUCCESS: Everything is good :)
12304
12305 SIDE EFFECTS
12306
12307============================================================================*/
12308VOS_STATUS
12309WLANTL_EnableUAPSDForAC
12310(
12311 v_PVOID_t pvosGCtx,
12312 v_U8_t ucSTAId,
12313 WLANTL_ACEnumType ucAC,
12314 v_U8_t ucTid,
12315 v_U8_t ucUP,
12316 v_U32_t uServiceInt,
12317 v_U32_t uSuspendInt,
12318 WLANTL_TSDirType wTSDir
12319)
12320{
12321
12322 WLANTL_CbType* pTLCb = NULL;
12323 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12324 tUapsdInfo halUAPSDInfo;
12325 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
12326
12327 /*------------------------------------------------------------------------
12328 Sanity check
12329 Extract TL control block
12330 ------------------------------------------------------------------------*/
12331 pTLCb = VOS_GET_TL_CB(pvosGCtx);
12332 if (( NULL == pTLCb ) || WLANTL_STA_ID_INVALID( ucSTAId )
Gopichand Nakkala574f6d12013-06-27 19:38:43 +053012333 || WLANTL_AC_INVALID(ucAC))
Jeff Johnson295189b2012-06-20 16:38:30 -070012334 {
12335 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12336 "WLAN TL:Invalid input params on WLANTL_EnableUAPSDForAC"
Gopichand Nakkala574f6d12013-06-27 19:38:43 +053012337 " TL: %p STA: %d AC: %d",
12338 pTLCb, ucSTAId, ucAC));
Jeff Johnson295189b2012-06-20 16:38:30 -070012339 return VOS_STATUS_E_FAULT;
12340 }
12341
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012342 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
12343 {
12344 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12345 "WLAN TL:Client Memory was not allocated on %s", __func__));
12346 return VOS_STATUS_E_FAILURE;
12347 }
12348
Jeff Johnson295189b2012-06-20 16:38:30 -070012349 /*Set this flag in order to remember that this is a trigger enabled AC*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012350 pTLCb->atlSTAClients[ucSTAId]->wUAPSDInfo[ucAC].ucSet = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -070012351
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053012352#ifdef FEATURE_WLAN_TDLS
12353 if(pTLCb->atlSTAClients[ucSTAId]->wSTADesc.wSTAType != WLAN_STA_TDLS)
12354#endif
12355 {
12356 if( 0 == uServiceInt )
12357 {
12358 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi198ade32013-09-29 03:52:25 +053012359 "WLAN TL:Input params on WLANTL_EnableUAPSDForAC"
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053012360 " SI: %d", uServiceInt ));
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053012361 }
Jeff Johnson295189b2012-06-20 16:38:30 -070012362
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053012363 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
12364 "WLAN TL:Enabling U-APSD in FW for STA: %d AC: %d SI: %d SPI: %d "
12365 "DI: %d",
12366 ucSTAId, ucAC, uServiceInt, uSuspendInt,
12367 pTLCb->tlConfigInfo.uDelayedTriggerFrmInt));
Jeff Johnson295189b2012-06-20 16:38:30 -070012368
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053012369 /*Save all info for HAL*/
12370 halUAPSDInfo.staidx = ucSTAId;
12371 halUAPSDInfo.ac = ucAC;
12372 halUAPSDInfo.up = ucUP;
12373 halUAPSDInfo.srvInterval = uServiceInt;
12374 halUAPSDInfo.susInterval = uSuspendInt;
12375 halUAPSDInfo.delayInterval = pTLCb->tlConfigInfo.uDelayedTriggerFrmInt;
12376
12377 /*Notify HAL*/
12378 vosStatus = WDA_EnableUapsdAcParams(pvosGCtx, ucSTAId, &halUAPSDInfo);
12379 }
Jeff Johnson295189b2012-06-20 16:38:30 -070012380 return vosStatus;
12381
12382}/*WLANTL_EnableUAPSDForAC*/
12383
12384
12385/*==========================================================================
12386 FUNCTION WLANTL_DisableUAPSDForAC
12387
12388 DESCRIPTION
12389 Called by HDD to disable UAPSD. TL in turn calls WDA API to disable the
12390 logic in FW/SLM to stop sending trigger frames. Previously TL had the
12391 trigger frame logic which later moved down to FW. Hence
12392 HDD -> TL -> WDA -> FW call flow.
12393
12394 DEPENDENCIES
12395 The TL must be initialized before this function can be called.
12396
12397 PARAMETERS
12398
12399 IN
12400 pvosGCtx: pointer to the global vos context; a handle to TL's
12401 control block can be extracted from its context
12402 ucSTAId: station Id
12403 ucAC: AC for which U-APSD is being enabled
12404
12405
12406 RETURN VALUE
12407 The result code associated with performing the operation
12408
12409 VOS_STATUS_SUCCESS: Everything is good :)
12410
12411 SIDE EFFECTS
12412
12413============================================================================*/
12414VOS_STATUS
12415WLANTL_DisableUAPSDForAC
12416(
12417 v_PVOID_t pvosGCtx,
12418 v_U8_t ucSTAId,
12419 WLANTL_ACEnumType ucAC
12420)
12421{
12422 WLANTL_CbType* pTLCb;
12423 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
12424
12425 /*------------------------------------------------------------------------
12426 Sanity check
12427 Extract TL control block
12428 ------------------------------------------------------------------------*/
12429 pTLCb = VOS_GET_TL_CB(pvosGCtx);
12430 if (( NULL == pTLCb ) || WLANTL_STA_ID_INVALID( ucSTAId )
12431 || WLANTL_AC_INVALID(ucAC) )
12432 {
12433 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12434 "WLAN TL:Invalid input params on WLANTL_DisableUAPSDForAC"
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +053012435 " TL: %p STA: %d AC: %d", pTLCb, ucSTAId, ucAC ));
Jeff Johnson295189b2012-06-20 16:38:30 -070012436 return VOS_STATUS_E_FAULT;
12437 }
12438
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012439 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
12440 {
12441 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12442 "WLAN TL:Client Memory was not allocated on %s", __func__));
12443 return VOS_STATUS_E_FAILURE;
12444 }
12445
Jeff Johnson295189b2012-06-20 16:38:30 -070012446 /*Reset this flag as this is no longer a trigger enabled AC*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012447 pTLCb->atlSTAClients[ucSTAId]->wUAPSDInfo[ucAC].ucSet = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -070012448
12449 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
12450 "WLAN TL:Disabling U-APSD in FW for STA: %d AC: %d ",
12451 ucSTAId, ucAC));
12452
12453 /*Notify HAL*/
12454 WDA_DisableUapsdAcParams(pvosGCtx, ucSTAId, ucAC);
12455
12456 return VOS_STATUS_SUCCESS;
12457}/* WLANTL_DisableUAPSDForAC */
12458
12459#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
12460/*==========================================================================
12461 FUNCTION WLANTL_RegRSSIIndicationCB
12462
12463 DESCRIPTION Registration function to get notification if RSSI cross
12464 threshold.
12465 Client should register threshold, direction, and notification
12466 callback function pointer
12467
12468 DEPENDENCIES NONE
12469
12470 PARAMETERS in pAdapter - Global handle
12471 in rssiValue - RSSI threshold value
12472 in triggerEvent - Cross direction should be notified
12473 UP, DOWN, and CROSS
12474 in crossCBFunction - Notification CB Function
12475 in usrCtxt - user context
12476
12477 RETURN VALUE VOS_STATUS
12478
12479 SIDE EFFECTS NONE
12480
12481============================================================================*/
12482VOS_STATUS WLANTL_RegRSSIIndicationCB
12483(
12484 v_PVOID_t pAdapter,
12485 v_S7_t rssiValue,
12486 v_U8_t triggerEvent,
12487 WLANTL_RSSICrossThresholdCBType crossCBFunction,
12488 VOS_MODULE_ID moduleID,
12489 v_PVOID_t usrCtxt
12490)
12491{
12492 VOS_STATUS status = VOS_STATUS_SUCCESS;
12493
12494 status = WLANTL_HSRegRSSIIndicationCB(pAdapter,
12495 rssiValue,
12496 triggerEvent,
12497 crossCBFunction,
12498 moduleID,
12499 usrCtxt);
12500
12501 return status;
12502}
12503
12504/*==========================================================================
12505 FUNCTION WLANTL_DeregRSSIIndicationCB
12506
12507 DESCRIPTION Remove specific threshold from list
12508
12509 DEPENDENCIES NONE
12510
12511 PARAMETERS in pAdapter - Global handle
12512 in rssiValue - RSSI threshold value
12513 in triggerEvent - Cross direction should be notified
12514 UP, DOWN, and CROSS
12515
12516 RETURN VALUE VOS_STATUS
12517
12518 SIDE EFFECTS NONE
12519
12520============================================================================*/
12521VOS_STATUS WLANTL_DeregRSSIIndicationCB
12522(
12523 v_PVOID_t pAdapter,
12524 v_S7_t rssiValue,
12525 v_U8_t triggerEvent,
12526 WLANTL_RSSICrossThresholdCBType crossCBFunction,
12527 VOS_MODULE_ID moduleID
12528)
12529{
12530 VOS_STATUS status = VOS_STATUS_SUCCESS;
12531
12532 status = WLANTL_HSDeregRSSIIndicationCB(pAdapter,
12533 rssiValue,
12534 triggerEvent,
12535 crossCBFunction,
12536 moduleID);
12537 return status;
12538}
12539
12540/*==========================================================================
12541 FUNCTION WLANTL_SetAlpha
12542
12543 DESCRIPTION ALPLA is weight value to calculate AVG RSSI
12544 avgRSSI = (ALPHA * historyRSSI) + ((10 - ALPHA) * newRSSI)
12545 avgRSSI has (ALPHA * 10)% of history RSSI weight and
12546 (10 - ALPHA)% of newRSSI weight
12547 This portion is dynamically configurable.
12548 Default is ?
12549
12550 DEPENDENCIES NONE
12551
12552 PARAMETERS in pAdapter - Global handle
12553 in valueAlpah - ALPHA
12554
12555 RETURN VALUE VOS_STATUS
12556
12557 SIDE EFFECTS NONE
12558
12559============================================================================*/
12560VOS_STATUS WLANTL_SetAlpha
12561(
12562 v_PVOID_t pAdapter,
12563 v_U8_t valueAlpha
12564)
12565{
12566 VOS_STATUS status = VOS_STATUS_SUCCESS;
12567
12568 status = WLANTL_HSSetAlpha(pAdapter, valueAlpha);
12569 return status;
12570}
12571
12572/*==========================================================================
12573
12574 FUNCTION
12575
12576 DESCRIPTION
12577
12578 PARAMETERS
12579
12580 RETURN VALUE
12581
12582============================================================================*/
12583VOS_STATUS WLANTL_BMPSRSSIRegionChangedNotification
12584(
12585 v_PVOID_t pAdapter,
12586 tpSirRSSINotification pRSSINotification
12587)
12588{
12589 VOS_STATUS status = VOS_STATUS_SUCCESS;
12590
12591 status = WLANTL_HSBMPSRSSIRegionChangedNotification(pAdapter, pRSSINotification);
12592 return status;
12593}
12594
12595/*==========================================================================
12596 FUNCTION WLANTL_RegGetTrafficStatus
12597
12598 DESCRIPTION Registration function for traffic status monitoring
12599 During measure period count data frames.
12600 If frame count is larger then IDLE threshold set as traffic ON
12601 or OFF.
12602 And traffic status is changed send report to client with
12603 registered callback function
12604
12605 DEPENDENCIES NONE
12606
12607 PARAMETERS in pAdapter - Global handle
12608 in idleThreshold - Traffic on or off threshold
12609 in measurePeriod - Traffic state check period
12610 in trfficStatusCB - traffic status changed notification
12611 CB function
12612 in usrCtxt - user context
12613
12614 RETURN VALUE VOS_STATUS
12615
12616 SIDE EFFECTS NONE
12617
12618============================================================================*/
12619VOS_STATUS WLANTL_RegGetTrafficStatus
12620(
12621 v_PVOID_t pAdapter,
12622 v_U32_t idleThreshold,
12623 v_U32_t measurePeriod,
12624 WLANTL_TrafficStatusChangedCBType trfficStatusCB,
12625 v_PVOID_t usrCtxt
12626)
12627{
12628 VOS_STATUS status = VOS_STATUS_SUCCESS;
12629
12630 status = WLANTL_HSRegGetTrafficStatus(pAdapter,
12631 idleThreshold,
12632 measurePeriod,
12633 trfficStatusCB,
12634 usrCtxt);
12635 return status;
12636}
12637#endif
12638/*==========================================================================
12639 FUNCTION WLANTL_GetStatistics
12640
12641 DESCRIPTION Get traffic statistics for identified station
12642
12643 DEPENDENCIES NONE
12644
12645 PARAMETERS in pAdapter - Global handle
12646 in statType - specific statistics field to reset
12647 out statBuffer - traffic statistics buffer
12648
12649 RETURN VALUE VOS_STATUS
12650
12651 SIDE EFFECTS NONE
12652
12653============================================================================*/
12654VOS_STATUS WLANTL_GetStatistics
12655(
12656 v_PVOID_t pAdapter,
12657 WLANTL_TRANSFER_STA_TYPE *statBuffer,
12658 v_U8_t STAid
12659)
12660{
12661 WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012662 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -070012663 VOS_STATUS status = VOS_STATUS_SUCCESS;
12664 WLANTL_TRANSFER_STA_TYPE *statistics = NULL;
12665
12666 /*------------------------------------------------------------------------
12667 Sanity check
12668 Extract TL control block
12669 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012670 if ( NULL == pTLCb )
Jeff Johnson295189b2012-06-20 16:38:30 -070012671 {
12672 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12673 "WLAN TL:Invalid TL pointer on WLANTL_GetStatistics"));
12674 return VOS_STATUS_E_FAULT;
12675 }
12676
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012677 pClientSTA = pTLCb->atlSTAClients[STAid];
12678
12679 if ( NULL == pClientSTA )
12680 {
12681 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12682 "WLAN TL:Client Memory was not allocated on %s", __func__));
12683 return VOS_STATUS_E_FAILURE;
12684 }
12685
12686 if(0 == pClientSTA->ucExists)
Jeff Johnson295189b2012-06-20 16:38:30 -070012687 {
12688 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12689 "WLAN TL: %d STA ID does not exist", STAid));
12690 return VOS_STATUS_E_INVAL;
12691 }
12692
12693 if(NULL == statBuffer)
12694 {
12695 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12696 "WLAN TL:Invalid TL statistics buffer pointer on WLANTL_GetStatistics"));
12697 return VOS_STATUS_E_INVAL;
12698 }
12699
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012700 statistics = &pClientSTA->trafficStatistics;
Katya Nigam493ff652014-02-11 14:31:04 +053012701 vos_mem_copy(statBuffer, statistics, sizeof(WLANTL_TRANSFER_STA_TYPE));
Jeff Johnson295189b2012-06-20 16:38:30 -070012702
12703 return status;
12704}
12705
12706/*==========================================================================
12707 FUNCTION WLANTL_ResetStatistics
12708
12709 DESCRIPTION Reset statistics structure for identified station ID
12710 Reset means set values as 0
12711
12712 DEPENDENCIES NONE
12713
12714 PARAMETERS in pAdapter - Global handle
12715 in statType - specific statistics field to reset
12716
12717 RETURN VALUE VOS_STATUS
12718
12719 SIDE EFFECTS NONE
12720
12721============================================================================*/
12722VOS_STATUS WLANTL_ResetStatistics
12723(
12724 v_PVOID_t pAdapter,
12725 v_U8_t STAid
12726)
12727{
12728 WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012729 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -070012730 VOS_STATUS status = VOS_STATUS_SUCCESS;
12731 WLANTL_TRANSFER_STA_TYPE *statistics = NULL;
12732
12733 /*------------------------------------------------------------------------
12734 Sanity check
12735 Extract TL control block
12736 ------------------------------------------------------------------------*/
12737 if (NULL == pTLCb)
12738 {
12739 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12740 "WLAN TL:Invalid TL pointer on WLANTL_GetStatistics"));
12741 return VOS_STATUS_E_FAULT;
12742 }
12743
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012744 pClientSTA = pTLCb->atlSTAClients[STAid];
12745
12746 if ( NULL == pClientSTA )
12747 {
12748 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12749 "WLAN TL:Client Memory was not allocated on %s", __func__));
12750 return VOS_STATUS_E_FAILURE;
12751 }
12752
12753 if(0 == pClientSTA->ucExists)
Jeff Johnson295189b2012-06-20 16:38:30 -070012754 {
12755 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12756 "WLAN TL: %d STA ID does not exist", STAid));
12757 return VOS_STATUS_E_INVAL;
12758 }
12759
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012760 statistics = &pClientSTA->trafficStatistics;
Jeff Johnson295189b2012-06-20 16:38:30 -070012761 vos_mem_zero((v_VOID_t *)statistics, sizeof(WLANTL_TRANSFER_STA_TYPE));
12762
12763 return status;
12764}
12765
12766/*==========================================================================
12767 FUNCTION WLANTL_GetSpecStatistic
12768
12769 DESCRIPTION Get specific field within statistics structure for
12770 identified station ID
12771
12772 DEPENDENCIES NONE
12773
12774 PARAMETERS in pAdapter - Global handle
12775 in statType - specific statistics field to reset
12776 in STAid - Station ID
12777 out buffer - Statistic value
12778
12779 RETURN VALUE VOS_STATUS
12780
12781 SIDE EFFECTS NONE
12782
12783============================================================================*/
12784VOS_STATUS WLANTL_GetSpecStatistic
12785(
12786 v_PVOID_t pAdapter,
12787 WLANTL_TRANSFER_STATIC_TYPE statType,
12788 v_U32_t *buffer,
12789 v_U8_t STAid
12790)
12791{
12792 WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012793 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -070012794 VOS_STATUS status = VOS_STATUS_SUCCESS;
12795 WLANTL_TRANSFER_STA_TYPE *statistics = NULL;
12796
12797 /*------------------------------------------------------------------------
12798 Sanity check
12799 Extract TL control block
12800 ------------------------------------------------------------------------*/
12801 if (NULL == pTLCb)
12802 {
12803 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12804 "WLAN TL:Invalid TL pointer on WLANTL_GetStatistics"));
12805 return VOS_STATUS_E_FAULT;
12806 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012807 pClientSTA = pTLCb->atlSTAClients[STAid];
Jeff Johnson295189b2012-06-20 16:38:30 -070012808
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012809 if ( NULL == pClientSTA )
12810 {
12811 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12812 "WLAN TL:Client Memory was not allocated on %s", __func__));
12813 return VOS_STATUS_E_FAILURE;
12814 }
12815
12816 if(0 == pClientSTA->ucExists)
Jeff Johnson295189b2012-06-20 16:38:30 -070012817 {
12818 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12819 "WLAN TL: %d STA ID does not exist", STAid));
12820 return VOS_STATUS_E_INVAL;
12821 }
12822
12823 if(NULL == buffer)
12824 {
12825 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12826 "WLAN TL:Invalid TL statistic buffer pointer on WLANTL_GetStatistics"));
12827 return VOS_STATUS_E_INVAL;
12828 }
12829
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012830 statistics = &pClientSTA->trafficStatistics;
Jeff Johnson295189b2012-06-20 16:38:30 -070012831 switch(statType)
12832 {
12833 case WLANTL_STATIC_TX_UC_FCNT:
12834 *buffer = statistics->txUCFcnt;
12835 break;
12836
12837 case WLANTL_STATIC_TX_MC_FCNT:
12838 *buffer = statistics->txMCFcnt;
12839 break;
12840
12841 case WLANTL_STATIC_TX_BC_FCNT:
12842 *buffer = statistics->txBCFcnt;
12843 break;
12844
12845 case WLANTL_STATIC_TX_UC_BCNT:
12846 *buffer = statistics->txUCBcnt;
12847 break;
12848
12849 case WLANTL_STATIC_TX_MC_BCNT:
12850 *buffer = statistics->txMCBcnt;
12851 break;
12852
12853 case WLANTL_STATIC_TX_BC_BCNT:
12854 *buffer = statistics->txBCBcnt;
12855 break;
12856
12857 case WLANTL_STATIC_RX_UC_FCNT:
12858 *buffer = statistics->rxUCFcnt;
12859 break;
12860
12861 case WLANTL_STATIC_RX_MC_FCNT:
12862 *buffer = statistics->rxMCFcnt;
12863 break;
12864
12865 case WLANTL_STATIC_RX_BC_FCNT:
12866 *buffer = statistics->rxBCFcnt;
12867 break;
12868
12869 case WLANTL_STATIC_RX_UC_BCNT:
12870 *buffer = statistics->rxUCBcnt;
12871 break;
12872
12873 case WLANTL_STATIC_RX_MC_BCNT:
12874 *buffer = statistics->rxMCBcnt;
12875 break;
12876
12877 case WLANTL_STATIC_RX_BC_BCNT:
12878 *buffer = statistics->rxBCBcnt;
12879 break;
12880
12881 case WLANTL_STATIC_RX_BCNT:
12882 *buffer = statistics->rxBcnt;
12883 break;
12884
12885 case WLANTL_STATIC_RX_BCNT_CRC_OK:
12886 *buffer = statistics->rxBcntCRCok;
12887 break;
12888
12889 case WLANTL_STATIC_RX_RATE:
12890 *buffer = statistics->rxRate;
12891 break;
12892
12893 default:
12894 *buffer = 0;
12895 status = VOS_STATUS_E_INVAL;
12896 break;
12897 }
12898
12899
12900 return status;
12901}
12902
12903/*==========================================================================
12904 FUNCTION WLANTL_ResetSpecStatistic
12905
12906 DESCRIPTION Reset specific field within statistics structure for
12907 identified station ID
12908 Reset means set as 0
12909
12910 DEPENDENCIES NONE
12911
12912 PARAMETERS in pAdapter - Global handle
12913 in statType - specific statistics field to reset
12914 in STAid - Station ID
12915
12916 RETURN VALUE VOS_STATUS
12917
12918 SIDE EFFECTS NONE
12919
12920============================================================================*/
12921VOS_STATUS WLANTL_ResetSpecStatistic
12922(
12923 v_PVOID_t pAdapter,
12924 WLANTL_TRANSFER_STATIC_TYPE statType,
12925 v_U8_t STAid
12926)
12927{
12928 WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012929 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -070012930 VOS_STATUS status = VOS_STATUS_SUCCESS;
12931 WLANTL_TRANSFER_STA_TYPE *statistics = NULL;
12932
12933 /*------------------------------------------------------------------------
12934 Sanity check
12935 Extract TL control block
12936 ------------------------------------------------------------------------*/
12937 if (NULL == pTLCb)
12938 {
12939 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12940 "WLAN TL:Invalid TL pointer on WLANTL_GetStatistics"));
12941 return VOS_STATUS_E_FAULT;
12942 }
12943
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012944 pClientSTA = pTLCb->atlSTAClients[STAid];
12945
12946 if ( NULL == pClientSTA )
12947 {
12948 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12949 "WLAN TL:Client Memory was not allocated on %s", __func__));
12950 return VOS_STATUS_E_FAILURE;
12951 }
12952
12953 if(0 == pClientSTA->ucExists)
Jeff Johnson295189b2012-06-20 16:38:30 -070012954 {
12955 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
12956 "WLAN TL: %d STA ID does not exist", STAid));
12957 return VOS_STATUS_E_INVAL;
12958 }
12959
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053012960 statistics = &pClientSTA->trafficStatistics;
Jeff Johnson295189b2012-06-20 16:38:30 -070012961 switch(statType)
12962 {
12963 case WLANTL_STATIC_TX_UC_FCNT:
12964 statistics->txUCFcnt = 0;
12965 break;
12966
12967 case WLANTL_STATIC_TX_MC_FCNT:
12968 statistics->txMCFcnt = 0;
12969 break;
12970
12971 case WLANTL_STATIC_TX_BC_FCNT:
12972 statistics->txBCFcnt = 0;
12973 break;
12974
12975 case WLANTL_STATIC_TX_UC_BCNT:
12976 statistics->txUCBcnt = 0;
12977 break;
12978
12979 case WLANTL_STATIC_TX_MC_BCNT:
12980 statistics->txMCBcnt = 0;
12981 break;
12982
12983 case WLANTL_STATIC_TX_BC_BCNT:
12984 statistics->txBCBcnt = 0;
12985 break;
12986
12987 case WLANTL_STATIC_RX_UC_FCNT:
12988 statistics->rxUCFcnt = 0;
12989 break;
12990
12991 case WLANTL_STATIC_RX_MC_FCNT:
12992 statistics->rxMCFcnt = 0;
12993 break;
12994
12995 case WLANTL_STATIC_RX_BC_FCNT:
12996 statistics->rxBCFcnt = 0;
12997 break;
12998
12999 case WLANTL_STATIC_RX_UC_BCNT:
13000 statistics->rxUCBcnt = 0;
13001 break;
13002
13003 case WLANTL_STATIC_RX_MC_BCNT:
13004 statistics->rxMCBcnt = 0;
13005 break;
13006
13007 case WLANTL_STATIC_RX_BC_BCNT:
13008 statistics->rxBCBcnt = 0;
13009 break;
13010
13011 case WLANTL_STATIC_RX_BCNT:
13012 statistics->rxBcnt = 0;
13013 break;
13014
13015 case WLANTL_STATIC_RX_BCNT_CRC_OK:
13016 statistics->rxBcntCRCok = 0;
13017 break;
13018
13019 case WLANTL_STATIC_RX_RATE:
13020 statistics->rxRate = 0;
13021 break;
13022
13023 default:
13024 status = VOS_STATUS_E_INVAL;
13025 break;
13026 }
13027
13028 return status;
13029}
13030
13031
13032/*==========================================================================
13033
13034 FUNCTION
13035
13036 DESCRIPTION Read RSSI value out of a RX BD
13037
13038 PARAMETERS: Caller must validate all parameters
13039
13040 RETURN VALUE
13041
13042============================================================================*/
13043VOS_STATUS WLANTL_ReadRSSI
13044(
13045 v_PVOID_t pAdapter,
13046 v_PVOID_t pBDHeader,
13047 v_U8_t STAid
13048)
13049{
13050 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
13051 v_S7_t currentRSSI, currentRSSI0, currentRSSI1;
13052
13053
13054 if(NULL == tlCtxt)
13055 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070013056 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "%s Invalid TL handle", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -070013057 return VOS_STATUS_E_INVAL;
13058 }
13059
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053013060 if ( NULL == tlCtxt->atlSTAClients[STAid] )
13061 {
13062 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13063 "WLAN TL:Client Memory was not allocated on %s", __func__));
13064 return VOS_STATUS_E_FAILURE;
13065 }
13066
Jeff Johnson295189b2012-06-20 16:38:30 -070013067 currentRSSI0 = WLANTL_GETRSSI0(pBDHeader);
13068 currentRSSI1 = WLANTL_GETRSSI1(pBDHeader);
13069 currentRSSI = (currentRSSI0 > currentRSSI1) ? currentRSSI0 : currentRSSI1;
13070
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053013071 tlCtxt->atlSTAClients[STAid]->rssiAvg = currentRSSI;
Jeff Johnson295189b2012-06-20 16:38:30 -070013072
13073 return VOS_STATUS_SUCCESS;
13074}
13075
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +053013076/*==========================================================================
13077
13078 FUNCTION
13079
13080 DESCRIPTION Read SNR value out of a RX BD
13081
13082 PARAMETERS: Caller must validate all parameters
13083
13084 RETURN VALUE
13085
13086============================================================================*/
13087VOS_STATUS WLANTL_ReadSNR
13088(
13089 v_PVOID_t pAdapter,
13090 v_PVOID_t pBDHeader,
13091 v_U8_t STAid
13092)
13093{
13094 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
13095 v_S7_t currentSNR;
13096
13097
13098 if (NULL == tlCtxt)
13099 {
13100 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13101 "%s Invalid TL handle", __func__));
13102 return VOS_STATUS_E_INVAL;
13103 }
13104
13105 if (NULL == tlCtxt->atlSTAClients[STAid])
13106 {
13107 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13108 "WLAN TL:Client Memory was not allocated on %s", __func__));
13109 return VOS_STATUS_E_FAILURE;
13110 }
13111
13112 currentSNR = WLANTL_GETSNR(pBDHeader);
13113
Madan Mohan Koyyalamudi43acf032013-09-27 04:33:28 +053013114 /* SNR reported in the Buffer Descriptor is scaled up by 2(SNR*2),
13115 * Get the correct SNR value
13116 */
13117 currentSNR = currentSNR >> 1;
13118
13119 /* SNR reported by HW cannot be more than 35dB due to HW limitations */
13120 currentSNR = (WLANTL_MAX_HW_SNR > currentSNR ? currentSNR :
13121 WLANTL_MAX_HW_SNR);
13122
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +053013123 TLLOG2(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
13124 "%s: snrsum: %d snridx: %d prevsnravg: %d",
13125 __func__,
13126 tlCtxt->atlSTAClients[STAid]->snrSum,
13127 tlCtxt->atlSTAClients[STAid]->snrIdx,
13128 tlCtxt->atlSTAClients[STAid]->prevSnrAvg));
13129
13130 /* The SNR returned for all purposes is the average SNR over
13131 * WLANTL_MAX_SNR_DATA_SMAPLES.When data samples
13132 * > WLANTL_MAX_SNR_DATA_SAMPLES are obtained,
13133 * store the average of the samples in prevSnrAvg
13134 * and start a new averaging window. The prevSnrAvg is used when
13135 * enough data samples are not available when applications
13136 * actually query for SNR.
13137 *
13138 * SEE: WLANTL_GetSnr()
13139 */
13140 if (tlCtxt->atlSTAClients[STAid]->snrIdx >= WLANTL_MAX_SNR_DATA_SAMPLES)
13141 {
13142 tlCtxt->atlSTAClients[STAid]->prevSnrAvg =
13143 tlCtxt->atlSTAClients[STAid]->snrSum /
13144 tlCtxt->atlSTAClients[STAid]->snrIdx;
13145 tlCtxt->atlSTAClients[STAid]->snrSum = 0;
13146 tlCtxt->atlSTAClients[STAid]->snrIdx = 0;
13147 }
13148 tlCtxt->atlSTAClients[STAid]->snrSum += currentSNR;
13149 tlCtxt->atlSTAClients[STAid]->snrIdx += 1;
13150
13151 return VOS_STATUS_SUCCESS;
13152}
Jeff Johnson295189b2012-06-20 16:38:30 -070013153
13154/*
13155 DESCRIPTION
13156 TL returns the weight currently maintained in TL.
13157 IN
13158 pvosGCtx: pointer to the global vos context; a handle to TL's
13159 or SME's control block can be extracted from its context
13160
13161 OUT
13162 pACWeights: Caller allocated memory for filling in weights
13163
13164 RETURN VALUE VOS_STATUS
13165*/
13166VOS_STATUS
13167WLANTL_GetACWeights
13168(
13169 v_PVOID_t pvosGCtx,
13170 v_U8_t* pACWeights
13171)
13172{
13173 WLANTL_CbType* pTLCb = NULL;
13174 v_U8_t ucIndex;
13175 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
13176
13177 /*------------------------------------------------------------------------
13178 Sanity check
13179 ------------------------------------------------------------------------*/
13180 if ( NULL == pACWeights )
13181 {
13182 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13183 "WLAN TL:Invalid parameter sent on WLANTL_GetACWeights"));
13184 return VOS_STATUS_E_INVAL;
13185 }
13186
13187 /*------------------------------------------------------------------------
13188 Extract TL control block and check existance
13189 ------------------------------------------------------------------------*/
13190 pTLCb = VOS_GET_TL_CB(pvosGCtx);
13191 if ( NULL == pTLCb )
13192 {
13193 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13194 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetACWeights"));
13195 return VOS_STATUS_E_FAULT;
13196 }
13197 for ( ucIndex = 0; ucIndex < WLANTL_MAX_AC ; ucIndex++)
13198 {
13199 pACWeights[ucIndex] = pTLCb->tlConfigInfo.ucAcWeights[ucIndex];
13200 }
13201
13202 return VOS_STATUS_SUCCESS;
13203}
13204
13205
13206
13207/*
13208 DESCRIPTION
13209 Change the weight currently maintained by TL.
13210 IN
13211 pvosGCtx: pointer to the global vos context; a handle to TL's
13212 or SME's control block can be extracted from its context
13213 pACWeights: Caller allocated memory contain the weights to use
13214
13215
13216 RETURN VALUE VOS_STATUS
13217*/
13218VOS_STATUS
13219WLANTL_SetACWeights
13220(
13221 v_PVOID_t pvosGCtx,
13222 v_U8_t* pACWeights
13223)
13224{
13225 WLANTL_CbType* pTLCb = NULL;
13226 v_U8_t ucIndex;
13227 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
13228
13229 /*------------------------------------------------------------------------
13230 Sanity check
13231 ------------------------------------------------------------------------*/
13232 if ( NULL == pACWeights )
13233 {
13234 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13235 "WLAN TL:Invalid parameter sent on WLANTL_GetACWeights"));
13236 return VOS_STATUS_E_INVAL;
13237 }
13238
13239 /*------------------------------------------------------------------------
13240 Extract TL control block and check existance
13241 ------------------------------------------------------------------------*/
13242 pTLCb = VOS_GET_TL_CB(pvosGCtx);
13243 if ( NULL == pTLCb )
13244 {
13245 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13246 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetACWeights"));
13247 return VOS_STATUS_E_FAULT;
13248 }
13249 for ( ucIndex = 0; ucIndex < WLANTL_MAX_AC ; ucIndex++)
13250 {
13251 pTLCb->tlConfigInfo.ucAcWeights[ucIndex] = pACWeights[ucIndex];
13252 }
13253
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +053013254 pTLCb->tlConfigInfo.ucAcWeights[WLANTL_AC_HIGH_PRIO] = pACWeights[WLANTL_AC_VO];
Jeff Johnson295189b2012-06-20 16:38:30 -070013255 return VOS_STATUS_SUCCESS;
13256}
13257
13258
13259/*==========================================================================
13260
13261 FUNCTION
13262
13263 DESCRIPTION
13264
13265 PARAMETERS
13266
13267 RETURN VALUE
13268
13269============================================================================*/
13270void WLANTL_PowerStateChangedCB
13271(
13272 v_PVOID_t pAdapter,
13273 tPmcState newState
13274)
13275{
13276 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
13277
13278 if (NULL == tlCtxt)
13279 {
13280 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +053013281 "%s: Invalid TL Control Block", __func__ );
Jeff Johnson295189b2012-06-20 16:38:30 -070013282 return;
13283 }
13284
13285 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, "Power state changed, new state is %d", newState );
13286 switch(newState)
13287 {
13288 case FULL_POWER:
13289 tlCtxt->isBMPS = VOS_FALSE;
13290 break;
13291
13292 case BMPS:
13293#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
13294 WLANTL_SetFWRSSIThresholds(pAdapter);
13295#endif
13296
13297 tlCtxt->isBMPS = VOS_TRUE;
13298 break;
13299
13300 case IMPS:
13301 case LOW_POWER:
13302 case REQUEST_BMPS:
13303 case REQUEST_FULL_POWER:
13304 case REQUEST_IMPS:
13305 case STOPPED:
13306 case REQUEST_START_UAPSD:
13307 case REQUEST_STOP_UAPSD:
13308 case UAPSD:
13309 case REQUEST_STANDBY:
13310 case STANDBY:
13311 case REQUEST_ENTER_WOWL:
13312 case REQUEST_EXIT_WOWL:
13313 case WOWL:
13314 TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN, "Not handle this events %d", newState ));
13315 break;
13316
13317 default:
13318 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "Not a valid event %d", newState ));
13319 break;
13320 }
13321
13322 return;
13323}
13324/*==========================================================================
13325 FUNCTION WLANTL_GetEtherType
13326
13327 DESCRIPTION Extract Ether type information from the BD
13328
13329 DEPENDENCIES NONE
13330
13331 PARAMETERS in aucBDHeader - BD header
13332 in vosDataBuff - data buffer
13333 in ucMPDUHLen - MPDU header length
13334 out pUsEtherType - pointer to Ethertype
13335
13336 RETURN VALUE VOS_STATUS_SUCCESS : if the EtherType is successfully extracted
13337 VOS_STATUS_FAILURE : if the EtherType extraction failed and
13338 the packet was dropped
13339
13340 SIDE EFFECTS NONE
13341
13342============================================================================*/
13343static VOS_STATUS WLANTL_GetEtherType
13344(
13345 v_U8_t * aucBDHeader,
13346 vos_pkt_t * vosDataBuff,
13347 v_U8_t ucMPDUHLen,
13348 v_U16_t * pUsEtherType
13349)
13350{
13351 v_U8_t ucOffset;
13352 v_U16_t usEtherType = *pUsEtherType;
13353 v_SIZE_t usLLCSize = sizeof(usEtherType);
13354 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13355
13356 /*------------------------------------------------------------------------
13357 Check if LLC is present - if not, TL is unable to determine type
13358 ------------------------------------------------------------------------*/
13359 if ( VOS_FALSE == WDA_IS_RX_LLC_PRESENT( aucBDHeader ) )
13360 {
13361 ucOffset = WLANTL_802_3_HEADER_LEN - sizeof(usEtherType);
13362 }
13363 else
13364 {
13365 ucOffset = ucMPDUHLen + WLANTL_LLC_PROTO_TYPE_OFFSET;
13366 }
13367
13368 /*------------------------------------------------------------------------
13369 Extract LLC type
13370 ------------------------------------------------------------------------*/
13371 vosStatus = vos_pkt_extract_data( vosDataBuff, ucOffset,
13372 (v_PVOID_t)&usEtherType, &usLLCSize);
13373
13374 if (( VOS_STATUS_SUCCESS != vosStatus ) ||
13375 ( sizeof(usEtherType) != usLLCSize ))
13376
13377 {
13378 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13379 "WLAN TL:Error extracting Ether type from data packet"));
13380 /* Drop packet */
13381 vos_pkt_return_packet(vosDataBuff);
13382 vosStatus = VOS_STATUS_E_FAILURE;
13383 }
13384 else
13385 {
13386 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
13387 "WLAN TL:Ether type retrieved before endianess conv: %d",
13388 usEtherType));
13389
13390 usEtherType = vos_be16_to_cpu(usEtherType);
13391 *pUsEtherType = usEtherType;
13392
13393 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
13394 "WLAN TL:Ether type retrieved: %d", usEtherType));
13395 }
13396
13397 return vosStatus;
13398}
13399
Jeff Johnson295189b2012-06-20 16:38:30 -070013400/*==========================================================================
13401 FUNCTION WLANTL_GetSoftAPStatistics
13402
13403 DESCRIPTION Collect the cumulative statistics for all Softap stations
13404
13405 DEPENDENCIES NONE
13406
13407 PARAMETERS in pvosGCtx - Pointer to the global vos context
13408 bReset - If set TL statistics will be cleared after reading
13409 out statsSum - pointer to collected statistics
13410
13411 RETURN VALUE VOS_STATUS_SUCCESS : if the Statistics are successfully extracted
13412
13413 SIDE EFFECTS NONE
13414
13415============================================================================*/
13416VOS_STATUS WLANTL_GetSoftAPStatistics(v_PVOID_t pAdapter, WLANTL_TRANSFER_STA_TYPE *statsSum, v_BOOL_t bReset)
13417{
13418 v_U8_t i = 0;
13419 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13420 WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter);
13421 WLANTL_TRANSFER_STA_TYPE statBufferTemp;
13422 vos_mem_zero((v_VOID_t *)&statBufferTemp, sizeof(WLANTL_TRANSFER_STA_TYPE));
13423 vos_mem_zero((v_VOID_t *)statsSum, sizeof(WLANTL_TRANSFER_STA_TYPE));
13424
13425
13426 if ( NULL == pTLCb )
13427 {
13428 return VOS_STATUS_E_FAULT;
13429 }
13430
13431 // Sum up all the statistics for stations of Soft AP from TL
13432 for (i = 0; i < WLAN_MAX_STA_COUNT; i++)
13433 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053013434 if ( NULL == pTLCb->atlSTAClients[i])
13435 {
13436 continue;
13437 }
13438 if (pTLCb->atlSTAClients[i]->wSTADesc.wSTAType == WLAN_STA_SOFTAP)
Jeff Johnson295189b2012-06-20 16:38:30 -070013439 {
13440 vosStatus = WLANTL_GetStatistics(pAdapter, &statBufferTemp, i);// Can include staId 1 because statistics not collected for it
13441
13442 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
13443 return VOS_STATUS_E_FAULT;
13444
13445 // Add to the counters
13446 statsSum->txUCFcnt += statBufferTemp.txUCFcnt;
13447 statsSum->txMCFcnt += statBufferTemp.txMCFcnt;
13448 statsSum->txBCFcnt += statBufferTemp.txBCFcnt;
13449 statsSum->txUCBcnt += statBufferTemp.txUCBcnt;
13450 statsSum->txMCBcnt += statBufferTemp.txMCBcnt;
13451 statsSum->txBCBcnt += statBufferTemp.txBCBcnt;
13452 statsSum->rxUCFcnt += statBufferTemp.rxUCFcnt;
13453 statsSum->rxMCFcnt += statBufferTemp.rxMCFcnt;
13454 statsSum->rxBCFcnt += statBufferTemp.rxBCFcnt;
13455 statsSum->rxUCBcnt += statBufferTemp.rxUCBcnt;
13456 statsSum->rxMCBcnt += statBufferTemp.rxMCBcnt;
13457 statsSum->rxBCBcnt += statBufferTemp.rxBCBcnt;
13458
13459 if (bReset)
13460 {
13461 vosStatus = WLANTL_ResetStatistics(pAdapter, i);
13462 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
13463 return VOS_STATUS_E_FAULT;
13464 }
13465 }
13466 }
13467
13468 return vosStatus;
13469}
Mohit Khanna698ba2a2012-12-04 15:08:18 -080013470
Jeff Johnson295189b2012-06-20 16:38:30 -070013471/*===============================================================================
13472 FUNCTION WLANTL_IsReplayPacket
13473
13474 DESCRIPTION This function does replay check for valid stations
13475
13476 DEPENDENCIES Validity of replay check must be done before the function
13477 is called
13478
13479 PARAMETERS currentReplayCounter current replay counter taken from RX BD
13480 previousReplayCounter previous replay counter taken from TL CB
13481
13482 RETRUN VOS_TRUE packet is a replay packet
13483 VOS_FALSE packet is not a replay packet
13484
13485 SIDE EFFECTS none
13486 ===============================================================================*/
13487v_BOOL_t
13488WLANTL_IsReplayPacket
13489(
13490 v_U64_t ullcurrentReplayCounter,
13491 v_U64_t ullpreviousReplayCounter
13492)
13493{
13494 /* Do the replay check by comparing previous received replay counter with
13495 current received replay counter*/
13496 if(ullpreviousReplayCounter < ullcurrentReplayCounter)
13497 {
13498 /* Valid packet not replay */
13499 return VOS_FALSE;
13500 }
13501 else
13502 {
13503
13504 /* Current packet number is less than or equal to previuos received
13505 packet no, this means current packet is replay packet */
13506 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13507 "WLAN TL: Replay packet found with replay counter :[0x%llX]",ullcurrentReplayCounter);
13508
13509 return VOS_TRUE;
13510 }
13511}
13512
13513#if 0
13514/*===============================================================================
13515 FUNCTION WLANTL_GetReplayCounterFromRxBD
13516
13517 DESCRIPTION This function extracts 48-bit replay packet number from RX BD
13518
13519 DEPENDENCIES Validity of replay check must be done before the function
13520 is called
13521
13522 PARAMETERS pucRxHeader pointer to RX BD header
13523
13524 RETRUN v_U64_t Packet number extarcted from RX BD
13525
13526 SIDE EFFECTS none
13527 ===============================================================================*/
13528v_U64_t
13529WLANTL_GetReplayCounterFromRxBD
13530(
13531 v_U8_t *pucRxBDHeader
13532)
13533{
13534/* 48-bit replay counter is created as follows
13535 from RX BD 6 byte PMI command:
13536 Addr : AES/TKIP
13537 0x38 : pn3/tsc3
13538 0x39 : pn2/tsc2
13539 0x3a : pn1/tsc1
13540 0x3b : pn0/tsc0
13541
13542 0x3c : pn5/tsc5
13543 0x3d : pn4/tsc4 */
13544
13545#ifdef ANI_BIG_BYTE_ENDIAN
13546 v_U64_t ullcurrentReplayCounter = 0;
13547 /* Getting 48-bit replay counter from the RX BD */
13548 ullcurrentReplayCounter = WLANHAL_RX_BD_GET_PMICMD_20TO23(pucRxBDHeader);
13549 ullcurrentReplayCounter <<= 16;
13550 ullcurrentReplayCounter |= (( WLANHAL_RX_BD_GET_PMICMD_24TO25(pucRxBDHeader) & 0xFFFF0000) >> 16);
13551 return ullcurrentReplayCounter;
13552#else
13553 v_U64_t ullcurrentReplayCounter = 0;
13554 /* Getting 48-bit replay counter from the RX BD */
13555 ullcurrentReplayCounter = (WLANHAL_RX_BD_GET_PMICMD_24TO25(pucRxBDHeader) & 0x0000FFFF);
13556 ullcurrentReplayCounter <<= 32;
13557 ullcurrentReplayCounter |= WLANHAL_RX_BD_GET_PMICMD_20TO23(pucRxBDHeader);
13558 return ullcurrentReplayCounter;
13559#endif
13560}
13561#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070013562
13563/*===============================================================================
13564 FUNCTION WLANTL_PostResNeeded
13565
13566 DESCRIPTION This function posts message to TL to reserve BD/PDU memory
13567
13568 DEPENDENCIES None
13569
13570 PARAMETERS pvosGCtx
13571
13572 RETURN None
13573
13574 SIDE EFFECTS none
13575 ===============================================================================*/
13576
13577void WLANTL_PostResNeeded(v_PVOID_t pvosGCtx)
13578{
13579 vos_msg_t vosMsg;
13580
13581 vosMsg.reserved = 0;
13582 vosMsg.bodyptr = NULL;
13583 vosMsg.type = WLANTL_TX_RES_NEEDED;
13584 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
13585 "WLAN TL: BD/PDU available interrupt received, Posting message to TL");
13586 if(!VOS_IS_STATUS_SUCCESS(vos_tx_mq_serialize( VOS_MQ_ID_TL, &vosMsg)))
13587 {
13588 VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070013589 " %s fails to post message", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -070013590 }
13591}
13592
13593/*===============================================================================
13594 FUNCTION WLANTL_UpdateRssiBmps
13595
13596 DESCRIPTION This function updates the TL's RSSI (in BMPS mode)
13597
13598 DEPENDENCIES None
13599
13600 PARAMETERS
13601
13602 pvosGCtx VOS context VOS Global context
13603 staId Station ID Station ID
13604 rssi RSSI (BMPS mode) RSSI in BMPS mode
13605
13606 RETURN None
13607
13608 SIDE EFFECTS none
13609 ===============================================================================*/
13610
13611void WLANTL_UpdateRssiBmps(v_PVOID_t pvosGCtx, v_U8_t staId, v_S7_t rssi)
13612{
13613 WLANTL_CbType* pTLCb = VOS_GET_TL_CB(pvosGCtx);
13614
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053013615 if (NULL != pTLCb && NULL != pTLCb->atlSTAClients[staId])
Jeff Johnson295189b2012-06-20 16:38:30 -070013616 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +053013617 pTLCb->atlSTAClients[staId]->rssiAvgBmps = rssi;
Jeff Johnson295189b2012-06-20 16:38:30 -070013618 }
13619}
Gopichand Nakkala8a2b1442013-05-29 15:33:14 +053013620
13621/*===============================================================================
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +053013622 FUNCTION WLANTL_UpdateSnrBmps
13623
13624 DESCRIPTION This function updates the TL's SNR (in BMPS mode)
13625
13626 DEPENDENCIES None
13627
13628 PARAMETERS
13629
13630 pvosGCtx VOS context VOS Global context
13631 staId Station ID Station ID
13632 snr SNR (BMPS mode) SNR in BMPS mode
13633
13634 RETURN None
13635
13636 SIDE EFFECTS none
13637 ===============================================================================*/
13638
13639void WLANTL_UpdateSnrBmps(v_PVOID_t pvosGCtx, v_U8_t staId, v_S7_t snr)
13640{
13641 WLANTL_CbType* pTLCb = VOS_GET_TL_CB(pvosGCtx);
13642
13643 if (NULL != pTLCb && NULL != pTLCb->atlSTAClients[staId])
13644 {
13645 pTLCb->atlSTAClients[staId]->snrAvgBmps = snr;
13646 }
13647}
13648
13649/*===============================================================================
Gopichand Nakkala8a2b1442013-05-29 15:33:14 +053013650 FUNCTION WLANTL_UpdateLinkCapacity
13651
13652 DESCRIPTION This function updates the STA's Link Capacity in TL
13653
13654 DEPENDENCIES None
13655
13656 PARAMETERS
13657
13658 pvosGCtx VOS context VOS Global context
13659 staId Station ID Station ID
13660 linkCapacity linkCapacity Link Capacity
13661
13662 RETURN None
13663
13664 SIDE EFFECTS none
13665 ===============================================================================*/
13666
13667void WLANTL_UpdateLinkCapacity(v_PVOID_t pvosGCtx, v_U8_t staId, v_U32_t linkCapacity)
13668{
13669 WLANTL_CbType* pTLCb = VOS_GET_TL_CB(pvosGCtx);
13670
13671 if (NULL != pTLCb && NULL != pTLCb->atlSTAClients[staId])
13672 {
13673 pTLCb->atlSTAClients[staId]->linkCapacity = linkCapacity;
13674 }
13675}
13676
13677
13678/*===========================================================================
13679
13680 FUNCTION WLANTL_GetSTALinkCapacity
13681
13682 DESCRIPTION
13683
13684 Returns Link Capacity of a particular STA.
13685
13686 DEPENDENCIES
13687
13688 A station must have been registered before its state can be retrieved.
13689
13690
13691 PARAMETERS
13692
13693 IN
13694 pvosGCtx: pointer to the global vos context; a handle to TL's
13695 control block can be extracted from its context
13696 ucSTAId: identifier of the station
13697
13698 OUT
13699 plinkCapacity: the current link capacity the connection to
13700 the given station
13701
13702
13703 RETURN VALUE
13704
13705 The result code associated with performing the operation
13706
13707 VOS_STATUS_E_INVAL: Input parameters are invalid
13708 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer to
13709 TL cb is NULL ; access would cause a page fault
13710 VOS_STATUS_E_EXISTS: Station was not registered
13711 VOS_STATUS_SUCCESS: Everything is good :)
13712
13713 SIDE EFFECTS
13714
13715============================================================================*/
13716VOS_STATUS
13717WLANTL_GetSTALinkCapacity
13718(
13719 v_PVOID_t pvosGCtx,
13720 v_U8_t ucSTAId,
13721 v_U32_t *plinkCapacity
13722)
13723{
13724 WLANTL_CbType* pTLCb = NULL;
13725 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
13726
13727 /*------------------------------------------------------------------------
13728 Sanity check
13729 ------------------------------------------------------------------------*/
13730 if ( NULL == plinkCapacity )
13731 {
13732 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13733 FL("WLAN TL:Invalid parameter")));
13734 return VOS_STATUS_E_INVAL;
13735 }
13736
13737 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
13738 {
13739 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13740 FL("WLAN TL:Invalid station id")));
13741 return VOS_STATUS_E_FAULT;
13742 }
13743
13744 /*------------------------------------------------------------------------
13745 Extract TL control block and check existance
13746 ------------------------------------------------------------------------*/
13747 pTLCb = VOS_GET_TL_CB(pvosGCtx);
13748 if ( NULL == pTLCb )
13749 {
13750 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13751 FL("WLAN TL:Invalid TL pointer from pvosGCtx")));
13752 return VOS_STATUS_E_FAULT;
13753 }
13754
13755 if ( NULL == pTLCb->atlSTAClients[ucSTAId] )
13756 {
13757 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13758 FL("WLAN TL:Client Memory was not allocated")));
13759 return VOS_STATUS_E_FAILURE;
13760 }
13761
13762 if ( 0 == pTLCb->atlSTAClients[ucSTAId]->ucExists )
13763 {
13764 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
13765 FL("WLAN TL:Station was not previously registered")));
13766 return VOS_STATUS_E_EXISTS;
13767 }
13768
13769 /*------------------------------------------------------------------------
13770 Get STA state
13771 ------------------------------------------------------------------------*/
13772 *plinkCapacity = pTLCb->atlSTAClients[ucSTAId]->linkCapacity;
13773
13774 return VOS_STATUS_SUCCESS;
13775}/* WLANTL_GetSTALinkCapacity */
Abhishek Singh00b71972016-01-07 10:51:04 +053013776
13777
13778#ifdef WLAN_FEATURE_RMC
13779VOS_STATUS WLANTL_RmcInit
13780(
13781 v_PVOID_t pAdapter
13782)
13783{
13784 WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter);
13785 VOS_STATUS status = VOS_STATUS_SUCCESS;
13786 tANI_U8 count;
13787
13788 /*sanity check*/
13789 if (NULL == pTLCb)
13790 {
13791 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13792 "Invalid TL handle"));
13793 return VOS_STATUS_E_INVAL;
13794 }
13795
13796 for ( count = 0; count < WLANTL_RMC_HASH_TABLE_SIZE; count++ )
13797 {
13798 pTLCb->rmcSession[count] = NULL;
13799 }
13800
13801 vos_lock_init(&pTLCb->rmcLock);
13802
13803 pTLCb->multicastDuplicateDetectionEnabled = 1;
13804 pTLCb->rmcDataPathEnabled = 0;
13805
13806 return status;
13807}
13808
13809
13810VOS_STATUS WLANTL_RmcDeInit
13811(
13812 v_PVOID_t pAdapter
13813)
13814{
13815 WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pAdapter);
13816 VOS_STATUS status = VOS_STATUS_SUCCESS;
13817 tANI_U8 count;
13818 WLANTL_RMC_SESSION *pNode;
13819 WLANTL_RMC_SESSION *pPrev;
13820
13821 /*sanity check*/
13822 if (NULL == pTLCb)
13823 {
13824 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13825 "Invalid TL handle"));
13826 return VOS_STATUS_E_INVAL;
13827 }
13828
13829 for ( count = 0; count < WLANTL_RMC_HASH_TABLE_SIZE; count++ )
13830 {
13831 pNode = pTLCb->rmcSession[count];
13832 while (pNode)
13833 {
13834 pPrev = pNode;
13835 pNode = pNode->next;
13836 vos_mem_free((v_VOID_t * )pPrev);
13837 }
13838 }
13839
13840 vos_lock_destroy(&pTLCb->rmcLock);
13841
13842 return status;
13843}
13844
13845
13846tANI_U8 WLANTL_RmcHashRmcSession ( v_MACADDR_t *pMcastAddr )
13847{
13848 tANI_U32 sum;
13849 tANI_U8 hash;
13850
13851 sum = (pMcastAddr->bytes[0] + pMcastAddr->bytes[1] + pMcastAddr->bytes[2] +
13852 pMcastAddr->bytes[3] + pMcastAddr->bytes[4] + pMcastAddr->bytes[5]);
13853
13854 hash = (tANI_U8)(sum & ((WLANTL_RMC_HASH_TABLE_SIZE - 1)));
13855
13856 return hash;
13857}
13858
13859
13860WLANTL_RMC_SESSION* WLANTL_RmcLookUpRmcSession
13861(
13862 WLANTL_RMC_SESSION *rmcSession[],
13863 v_MACADDR_t *pMcastAddr
13864)
13865{
13866 WLANTL_RMC_SESSION *pNode;
13867 tANI_U8 index;
13868
13869 /*sanity check*/
13870 if (NULL == pMcastAddr)
13871 {
13872 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13873 "Sanity check failed pMcastAddr %p", pMcastAddr));
13874 return NULL;
13875 }
13876
13877 index = WLANTL_RmcHashRmcSession(pMcastAddr);
13878 pNode = rmcSession[index];
13879 while ( pNode )
13880 {
13881 if (vos_is_macaddr_equal( &(pNode->rmcAddr), pMcastAddr))
13882 {
13883 return pNode;
13884 }
13885 pNode = pNode->next;
13886 }
13887
13888 return NULL;
13889}
13890
13891WLANTL_RMC_SESSION *WLANTL_RmcAddRmcSession
13892(
13893 WLANTL_RMC_SESSION *rmcSession[],
13894 v_MACADDR_t *pMcastAddr
13895)
13896{
13897 WLANTL_RMC_SESSION *pNode;
13898 tANI_U8 index;
13899
13900 index = WLANTL_RmcHashRmcSession(pMcastAddr);
13901 pNode = WLANTL_RmcLookUpRmcSession(rmcSession, pMcastAddr);
13902 if ( NULL != pNode )
13903 {
13904 /*already exists*/
13905 return NULL;
13906 }
13907 else
13908 {
13909 pNode = (WLANTL_RMC_SESSION *)vos_mem_malloc(sizeof(*pNode));
13910 if (pNode)
13911 {
13912 vos_mem_copy( &(pNode->rmcAddr), pMcastAddr,
13913 sizeof(pNode->rmcAddr) );
13914 pNode->next = rmcSession[index];
13915 rmcSession[index] = pNode;
13916 return pNode;
13917 }
13918 else
13919 {
13920 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
13921 "%s: vos_mem_malloc failed can't enable RMC session",
13922 __func__);
13923 return NULL;
13924 }
13925 }
13926}
13927
13928tANI_U8
13929WLANTL_RmcDeleteRmcSession
13930(
13931 WLANTL_RMC_SESSION *rmcSession[],
13932 v_MACADDR_t *pMcastAddr
13933)
13934{
13935 WLANTL_RMC_SESSION *pHead;
13936 WLANTL_RMC_SESSION *pNode;
13937 WLANTL_RMC_SESSION *pPrev;
13938 tANI_U8 index;
13939
13940 index = WLANTL_RmcHashRmcSession(pMcastAddr);
13941 pHead = pNode = rmcSession[index];
13942 while (pNode)
13943 {
13944 if (vos_is_macaddr_equal( &(pNode->rmcAddr), pMcastAddr))
13945 {
13946 if (pHead == pNode)
13947 {
13948 rmcSession[index] = pNode->next;
13949 }
13950 else
13951 {
13952 pPrev->next = pNode->next;
13953 }
13954 vos_mem_free((v_VOID_t * )pNode);
13955 return 1;
13956 }
13957 pPrev = pNode;
13958 pNode = pNode->next;
13959 }
13960
13961 return 0;
13962}
13963
13964VOS_STATUS
13965WLANTL_ProcessRmcCommand
13966(
13967 WLANTL_CbType* pTLCb,
13968 v_MACADDR_t *pMcastAddr,
13969 tANI_U32 command
13970)
13971{
13972 VOS_STATUS status;
13973 tANI_U32 count;
13974 tANI_U32 rmcActive;
13975
13976 if (!VOS_IS_STATUS_SUCCESS(vos_lock_acquire( &(pTLCb->rmcLock))))
13977 {
13978 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13979 "%s Get Lock Fail", __func__));
13980 return VOS_STATUS_E_FAILURE;
13981 }
13982
13983 /*add or delete node from active rmc hash table*/
13984 if (command)
13985 {
13986 /*add requested rmc session in active rmc session list*/
13987 if (WLANTL_RmcAddRmcSession(pTLCb->rmcSession, pMcastAddr))
13988 {
13989 TLLOGE( VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13990 "RMC session " MAC_ADDRESS_STR " added in TL hash table",
13991 MAC_ADDR_ARRAY(pMcastAddr->bytes) ) );
13992 pTLCb->rmcDataPathEnabled = TRUE;
13993 status = VOS_STATUS_SUCCESS;
13994 }
13995 else
13996 {
13997 TLLOGE( VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
13998 "RMC session " MAC_ADDRESS_STR " already exists in TL hash"
13999 " table", MAC_ADDR_ARRAY(pMcastAddr->bytes) ) );
14000 status = VOS_STATUS_E_FAILURE;
14001 }
14002 }
14003 else
14004 {
14005 /*delete requested rmc session from active rmc session list*/
14006 if (WLANTL_RmcDeleteRmcSession(pTLCb->rmcSession, pMcastAddr))
14007 {
14008 TLLOGE( VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
14009 "RMC session " MAC_ADDRESS_STR " deleted from TL hash table",
14010 MAC_ADDR_ARRAY(pMcastAddr->bytes)) );
14011 status = VOS_STATUS_SUCCESS;
14012 rmcActive = FALSE;
14013 for ( count = 0; count < WLANTL_RMC_HASH_TABLE_SIZE; count++ )
14014 {
14015 if (pTLCb->rmcSession[count])
14016 {
14017 rmcActive = TRUE;
14018 break;
14019 }
14020 }
14021 if (TRUE == rmcActive)
14022 {
14023 pTLCb->rmcDataPathEnabled = TRUE;
14024 }
14025 else
14026 {
14027 pTLCb->rmcDataPathEnabled = FALSE;
14028 }
14029 }
14030 else
14031 {
14032 TLLOGE( VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
14033 "RMC session " MAC_ADDRESS_STR " doesn't exist in TL hash"
14034 " table", MAC_ADDR_ARRAY(pMcastAddr->bytes) ) );
14035 status = VOS_STATUS_E_FAILURE;
14036 }
14037 }
14038
14039 if (!VOS_IS_STATUS_SUCCESS(vos_lock_release(&(pTLCb->rmcLock))))
14040 {
14041 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
14042 "%s Release Lock Fail", __func__));
14043 return VOS_STATUS_E_FAILURE;
14044 }
14045
14046 return status;
14047}/* End of WLANTL_ProcessRmcCommand */
14048
14049VOS_STATUS
14050WLANTL_EnableRMC
14051(
14052 v_PVOID_t pvosGCtx,
14053 v_MACADDR_t *pMcastTransmitterAddr
14054)
14055{
14056 WLANTL_CbType* pTLCb;
14057 VOS_STATUS status;
14058
14059 /*sanity check*/
14060 if ( (NULL == pvosGCtx) || (NULL == pMcastTransmitterAddr) )
14061 {
14062 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
14063 "WLAN TL %s: Sanity check failed pvosGCtx %p aMcastAddr %p",
14064 __func__, pvosGCtx, pMcastTransmitterAddr));
14065 return VOS_STATUS_E_FAILURE;
14066 }
14067
14068 /*sanity check*/
14069 pTLCb = VOS_GET_TL_CB(pvosGCtx);
14070 if ( NULL == pTLCb )
14071 {
14072 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
14073 "WLAN TL %s: pTLCb is NULL", __func__));
14074 return VOS_STATUS_E_FAILURE;
14075 }
14076
14077 status = WLANTL_ProcessRmcCommand(pTLCb, pMcastTransmitterAddr , 1);
14078
14079 return status;
14080} /* End of WLANTL_EnableRMC */
14081
14082
14083VOS_STATUS
14084WLANTL_DisableRMC
14085(
14086 v_PVOID_t pvosGCtx,
14087 v_MACADDR_t *pMcastTransmitterAddr
14088)
14089{
14090 WLANTL_CbType* pTLCb;
14091 VOS_STATUS status;
14092
14093 /*Sanity check*/
14094 if ((NULL == pvosGCtx) || (NULL == pMcastTransmitterAddr))
14095 {
14096 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
14097 "WLAN TL %s: Sanity check failed pvosGCtx %p aMcastAddr %p",
14098 __func__, pvosGCtx, pMcastTransmitterAddr));
14099 return VOS_STATUS_E_FAILURE;
14100 }
14101
14102 /*Sanity check*/
14103 pTLCb = VOS_GET_TL_CB(pvosGCtx);
14104 if (NULL == pTLCb)
14105 {
14106 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
14107 "WLAN TL %s: pTLCb is NULL", __func__));
14108 return VOS_STATUS_E_FAILURE;
14109 }
14110
14111 status = WLANTL_ProcessRmcCommand(pTLCb, pMcastTransmitterAddr, 0);
14112
14113 return status;
14114} /* End of WLANTL_DisableRMC */
14115
14116
14117/*=============================================================================
14118 Duplicate Multicast Detection Functions
14119==============================================================================*/
14120
14121/*=============================================================================
14122 FUNCTION WLANTL_IsDuplicateMcastFrm
14123
14124 DESCRIPTION
14125 This function checks for duplicast multicast frames and drops them.
14126
14127 DEPENDENCIES
14128
14129 PARAMETERS
14130
14131 IN
14132
14133 pClientSTA : Pointer to WLANTL_STAClientType
14134 aucBDHeader : Pointer to BD header
14135
14136 RETURN VALUE
14137
14138 VOS_FALSE: This frame is not a duplicate
14139
14140 VOS_TRUE: This frame is a duplicate
14141
14142==============================================================================*/
14143v_U8_t
14144WLANTL_IsDuplicateMcastFrm
14145(
14146 WLANTL_STAClientType *pClientSTA,
14147 vos_pkt_t *vosDataBuff
14148)
14149{
14150 v_U8_t duplicate = VOS_FALSE;
14151 WLANTL_RMC_SESSION *pNode;
14152 v_U16_t usSeqCtrl;
14153 v_MACADDR_t mcastAddr;
14154 VOS_STATUS vosStatus;
14155 v_PVOID_t pvPeekData;
14156
14157 /* Get address 1 of Data Frame */
14158 vosStatus = vos_pkt_peek_data(vosDataBuff, WLANTL_MAC_ADDR_ALIGN(1),
14159 (v_PVOID_t)&pvPeekData, VOS_MAC_ADDR_SIZE);
14160
14161 if ( VOS_STATUS_SUCCESS != vosStatus )
14162 {
14163 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
14164 "WLAN TL: Failed to get Addr 1 of 80211 header from packet %d",
14165 vosStatus));
14166 return VOS_FALSE;
14167 }
14168
14169 /* Copy address 1 of Data Frame */
14170 vos_mem_copy(&mcastAddr.bytes, pvPeekData, VOS_MAC_ADDR_SIZE);
14171
14172 /*
14173 * We perform duplicate detection for only multicast data frames
14174 */
14175 if (vos_is_macaddr_group(&mcastAddr) &&
14176 !vos_is_macaddr_broadcast(&mcastAddr))
14177 {
14178 /* Get sequence control of Data Frame */
14179 vosStatus = vos_pkt_peek_data(vosDataBuff,
14180 (WLANTL_MAC_ADDR_ALIGN(1) + (3 * VOS_MAC_ADDR_SIZE)),
14181 (v_PVOID_t)&pvPeekData, sizeof(v_U16_t));
14182
14183 if ( VOS_STATUS_SUCCESS != vosStatus )
14184 {
14185 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
14186 "WLAN TL: Failed to get Sequence Control from packet %d",
14187 vosStatus));
14188 return VOS_FALSE;
14189 }
14190
14191 /* Copy sequence control from the Data Frame */
14192 usSeqCtrl = *(v_U16_t *)pvPeekData;
14193
14194 if (!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(&(pClientSTA->mcLock))))
14195 {
14196 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
14197 "%s Get Lock Fail", __func__));
14198 return VOS_FALSE;
14199 }
14200
14201 pNode = WLANTL_RmcLookUpRmcSession(pClientSTA->mcastSession,
14202 &mcastAddr);
14203 if (NULL == pNode)
14204 {
14205 /* If the session does not exist, add it. */
14206 pNode = WLANTL_RmcAddRmcSession(pClientSTA->mcastSession,
14207 &mcastAddr);
14208 /* If we could not add a entry, skip duplicate detection */
14209 if (NULL == pNode)
14210 {
14211 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
14212 "%s Failed to add multicast session", __func__));
14213 if (!VOS_IS_STATUS_SUCCESS
14214 (vos_lock_release(&(pClientSTA->mcLock))))
14215 {
14216 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
14217 "%s Release Lock Fail", __func__));
14218 }
14219 return VOS_FALSE;
14220 }
14221 /* Initialize the sequence control value. */
14222 pNode->mcSeqCtl = usSeqCtrl;
14223 }
14224 else
14225 {
14226 /*
14227 * Check if the sequence number of this frame matches the last
14228 * we have seen.
14229 */
14230 if (pNode->mcSeqCtl == usSeqCtrl)
14231 {
14232 pNode->rxMCDupcnt++;
14233 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
14234 "%s Rx Multicast Duplicate %d " MAC_ADDRESS_STR
14235 " (Seq %x)", __func__,
14236 pNode->rxMCDupcnt, MAC_ADDR_ARRAY(mcastAddr.bytes),
14237 usSeqCtrl));
14238 duplicate = VOS_TRUE;
14239 }
14240 else
14241 {
14242 /* Update the last seen sequence number */
14243 pNode->mcSeqCtl = usSeqCtrl;
14244 }
14245 }
14246
14247 if (!VOS_IS_STATUS_SUCCESS (vos_lock_release(&(pClientSTA->mcLock))))
14248 {
14249 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
14250 "%s Release Lock Fail", __func__));
14251 }
14252 }
14253
14254 return duplicate;
14255}
14256
14257/*=============================================================================
14258 FUNCTION WLANTL_McastDeleteAllEntries
14259
14260 DESCRIPTION
14261 This function removes all multicast entries used for duplicate detection
14262
14263 DEPENDENCIES
14264
14265 PARAMETERS
14266
14267 IN
14268
14269 pClientSTA : Pointer to WLANTL_STAClientType
14270
14271 RETURN VALUE
14272
14273 None
14274
14275==============================================================================*/
14276void
14277WLANTL_McastDeleteAllEntries(WLANTL_STAClientType * pClientSTA)
14278{
14279 WLANTL_RMC_SESSION *pNode, **head;
14280 int index;
14281
14282 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
14283 "%s Deleting all multicast entries", __func__));
14284
14285 if (!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(&(pClientSTA->mcLock))))
14286 {
14287 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
14288 "%s Get Lock Fail", __func__));
14289 return;
14290 }
14291
14292 for (index = 0; index < WLANTL_RMC_HASH_TABLE_SIZE; index++)
14293 {
14294 head = &pClientSTA->mcastSession[index];
14295
14296 pNode = *head;
14297
14298 while (pNode)
14299 {
14300 *head = pNode->next;
14301 /* free the group entry */
14302 vos_mem_free(pNode);
14303 pNode = *head;
14304 }
14305 }
14306
14307 if (!VOS_IS_STATUS_SUCCESS (vos_lock_release(&(pClientSTA->mcLock))))
14308 {
14309 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
14310 "%s Release Lock Fail", __func__));
14311 }
14312}
14313
14314/*=============================================================================
14315 FUNCTION WLANTL_SetMcastDuplicateDetection
14316
14317 DESCRIPTION
14318 This function sets multicate duplicate detection operation.
14319 If enable is 1, the detection is enabled, else it is disabled.
14320
14321 DEPENDENCIES
14322
14323 PARAMETERS
14324
14325 IN
14326
14327 pvosGCtx : Pointer to VOS global context
14328 enable : Boolean to enable or disable
14329
14330 RETURN VALUE
14331 The result code associated with performing the operation
14332
14333 VOS_STATUS_E_FAULT: Sanity check on input failed
14334
14335 VOS_STATUS_SUCCESS: Everything is good :)
14336
14337 Other return values are possible coming from the called functions.
14338 Please check API for additional info.
14339
14340 SIDE EFFECTS
14341
14342==============================================================================*/
14343VOS_STATUS
14344WLANTL_SetMcastDuplicateDetection
14345(
14346 v_PVOID_t pvosGCtx,
14347 v_U8_t enable
14348)
14349{
14350 WLANTL_CbType* pTLCb;
14351
14352 /*Sanity check*/
14353 if (NULL == pvosGCtx)
14354 {
14355 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
14356 "WLAN TL %s: Sanity check failed pvosGCtx %p",
14357 __func__, pvosGCtx));
14358 return VOS_STATUS_E_FAILURE;
14359 }
14360
14361 /*Sanity check*/
14362 pTLCb = VOS_GET_TL_CB(pvosGCtx);
14363 if (NULL == pTLCb)
14364 {
14365 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
14366 "WLAN TL %s: pTLCb is NULL", __func__));
14367 return VOS_STATUS_E_FAILURE;
14368 }
14369
14370 switch (enable)
14371 {
14372 default:
14373 /*
14374 * Any value other than 0 or 1 is used to dump the
14375 * duplicate count.
14376 */
14377 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
14378 "WLAN TL %s: Multicast Duplicate Count %d",
14379 __func__, pTLCb->mcastDupCnt));
14380 break;
14381 case 0:
14382 case 1:
14383 pTLCb->multicastDuplicateDetectionEnabled = enable;
14384 break;
14385 }
14386
14387 return VOS_STATUS_SUCCESS;
14388}
14389
14390#endif /* WLAN_FEATURE_RMC */