blob: fb3a8dc7027724af03996ff590c69b8765611057 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam1ed83fc2014-02-19 01:15:45 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
Jeff Johnson295189b2012-06-20 16:38:30 -070027
28/*===========================================================================
29
30 W L A N _ Q C T _ T L _ B A. C
31
32 OVERVIEW:
33
34 This software unit holds the implementation of the WLAN Transport Layer
35 Block Ack session support. Also included are the AMSDU de-aggregation
36 completion and MSDU re-ordering functionality.
37
38 The functions externalized by this module are to be called ONLY by the main
39 TL module or the HAL layer.
40
41 DEPENDENCIES:
42
43 Are listed for each API below.
44
45
46 Copyright (c) 2008 QUALCOMM Incorporated.
47 All Rights Reserved.
48 Qualcomm Confidential and Proprietary
49===========================================================================*/
50
51/*===========================================================================
52
53 EDIT HISTORY FOR FILE
54
55
56 This section contains comments describing changes made to the module.
57 Notice that changes are listed in reverse chronological order.
58
59
60 $Header$$DateTime$$Author$
61
62
63 when who what, where, why
64---------- --- --------------------------------------------------------
652010-10-xx dli Change ucCIndex to point to the slot the next frame to be expected to fwd
662008-08-22 sch Update based on unit test
672008-07-31 lti Created module
68
69===========================================================================*/
70
71/*----------------------------------------------------------------------------
72 * Include Files
73 * -------------------------------------------------------------------------*/
74#include "wlan_qct_tl.h"
75#include "wlan_qct_wda.h"
76#include "wlan_qct_tli.h"
77#include "wlan_qct_tli_ba.h"
78#include "wlan_qct_hal.h"
79#include "vos_list.h"
80#include "vos_lock.h"
81#include "tlDebug.h"
82/*----------------------------------------------------------------------------
83 * Preprocessor Definitions and Constants
84 * -------------------------------------------------------------------------*/
85//#define WLANTL_REORDER_DEBUG_MSG_ENABLE
86#define WLANTL_BA_REORDERING_AGING_TIMER 30 /* 30 millisec */
87#define WLANTL_BA_MIN_FREE_RX_VOS_BUFFER 0 /* RX VOS buffer low threshold */
Madan Mohan Koyyalamudi31e4cad2013-08-21 20:21:14 +053088#define CSN_WRAP_AROUND_THRESHOLD 3000 /* CSN wrap around threshold */
89
Jeff Johnson295189b2012-06-20 16:38:30 -070090
Dhanashri Atred8c20a32014-01-03 17:20:55 -080091const v_U8_t WLANTL_TID_2_AC[WLAN_MAX_TID] = { WLANTL_AC_BE,
92 WLANTL_AC_BK,
93 WLANTL_AC_BK,
94 WLANTL_AC_BE,
95 WLANTL_AC_VI,
96 WLANTL_AC_VI,
97 WLANTL_AC_VO,
98 WLANTL_AC_VO };
Jeff Johnson295189b2012-06-20 16:38:30 -070099
100/*==========================================================================
101
102 FUNCTION tlReorderingAgingTimerExpierCB
103
104 DESCRIPTION
105 After aging timer expiered, all Qed frames have to be routed to upper
106 layer. Otherwise, there is possibilitied that ahng some frames
107
108 PARAMETERS
109 v_PVOID_t timerUdata Timer callback user data
110 Has information about where frames should be
111 routed
112
113 RETURN VALUE
114 VOS_STATUS_SUCCESS General success
115 VOS_STATUS_E_INVAL Invalid frame handle
116
117============================================================================*/
118v_VOID_t WLANTL_ReorderingAgingTimerExpierCB
119(
120 v_PVOID_t timerUdata
121)
122{
123 WLANTL_TIMER_EXPIER_UDATA_T *expireHandle;
124 WLANTL_BAReorderType *ReorderInfo;
125 WLANTL_CbType *pTLHandle;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530126 WLANTL_STAClientType* pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700127 vos_pkt_t *vosDataBuff;
128 VOS_STATUS status = VOS_STATUS_SUCCESS;
129 v_U8_t ucSTAID;
130 v_U8_t ucTID;
131 v_U8_t opCode;
132 WLANTL_RxMetaInfoType wRxMetaInfo;
133 v_U32_t fwIdx = 0;
Madan Mohan Koyyalamudi31e4cad2013-08-21 20:21:14 +0530134 WDI_DS_RxMetaInfoType *pRxMetadata;
135 vos_pkt_t *pCurrent;
136 vos_pkt_t *pNext;
137 v_S15_t seq;
Leo Chang2301cff2014-01-03 20:31:46 -0800138 v_U32_t cIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -0700139 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
140
141 if(NULL == timerUdata)
142 {
143 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Timer Callback User data NULL"));
144 return;
145 }
146
147 expireHandle = (WLANTL_TIMER_EXPIER_UDATA_T *)timerUdata;
148 ucSTAID = (v_U8_t)expireHandle->STAID;
149 ucTID = expireHandle->TID;
150 if(WLANTL_STA_ID_INVALID(ucSTAID) || WLANTL_TID_INVALID(ucTID))
151 {
152 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"SID %d or TID %d is not valid",
153 ucSTAID, ucTID));
154 return;
155 }
156
157 pTLHandle = (WLANTL_CbType *)expireHandle->pTLHandle;
158 if(NULL == pTLHandle)
159 {
160 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"TL Control block NULL"));
161 return;
162 }
163
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530164 pClientSTA = pTLHandle->atlSTAClients[ucSTAID];
165 if( NULL == pClientSTA ){
166 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyylamudi64258222013-01-30 14:35:10 +0530167 "TL:STA Memory not allocated STA ID: %d, %s", ucSTAID, __func__));
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530168 return;
169 }
170
171 ReorderInfo = &pClientSTA->atlBAReorderInfo[ucTID];
Jeff Johnson295189b2012-06-20 16:38:30 -0700172 if(NULL == ReorderInfo)
173 {
174 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Reorder data NULL, this could not happen SID %d, TID %d",
175 ucSTAID, ucTID));
176 return;
177 }
178
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530179 if(0 == pClientSTA->atlBAReorderInfo[ucTID].ucExists)
Jeff Johnson295189b2012-06-20 16:38:30 -0700180 {
181 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Reorder session doesn't exist SID %d, TID %d",
182 ucSTAID, ucTID));
183 return;
184 }
185
186 if(!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(&ReorderInfo->reorderLock)))
187 {
188 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_ReorderingAgingTimerExpierCB, Get LOCK Fail"));
189 return;
190 }
191
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530192 if( 0 == pClientSTA->atlBAReorderInfo[ucTID].ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -0700193 {
194 vos_lock_release(&ReorderInfo->reorderLock);
195 return;
196 }
197
198 opCode = WLANTL_OPCODE_FWDALL_DROPCUR;
199 vosDataBuff = NULL;
200
201
Mohit Khanna23863762012-09-11 17:40:09 -0700202 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"BA timeout with %d pending frames, curIdx %d", ReorderInfo->pendingFramesCount, ReorderInfo->ucCIndex));
Jeff Johnson295189b2012-06-20 16:38:30 -0700203
204 if(ReorderInfo->pendingFramesCount == 0)
205 {
206 if(!VOS_IS_STATUS_SUCCESS(vos_lock_release(&ReorderInfo->reorderLock)))
207 {
208 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_ReorderingAgingTimerExpierCB, Release LOCK Fail"));
209 }
210 return;
211 }
212
213 if(0 == ReorderInfo->ucCIndex)
214 {
215 fwIdx = ReorderInfo->winSize;
216 }
217 else
218 {
219 fwIdx = ReorderInfo->ucCIndex - 1;
220 }
221
Jeff Johnson295189b2012-06-20 16:38:30 -0700222 /* Do replay check before giving packets to upper layer
223 replay check code : check whether replay check is needed or not */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530224 if(VOS_TRUE == pClientSTA->ucIsReplayCheckValid)
Jeff Johnson295189b2012-06-20 16:38:30 -0700225 {
226 v_U64_t ullpreviousReplayCounter = 0;
227 v_U64_t ullcurrentReplayCounter = 0;
228 v_U8_t ucloopCounter = 0;
229 v_BOOL_t status = 0;
230
231 /*Do replay check for all packets which are in Reorder buffer */
232 for(ucloopCounter = 0; ucloopCounter < WLANTL_MAX_WINSIZE; ucloopCounter++)
233 {
234 /*Get previous reply counter*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530235 ullpreviousReplayCounter = pClientSTA->ullReplayCounter[ucTID];
Jeff Johnson295189b2012-06-20 16:38:30 -0700236
237 /*Get current replay counter of packet in reorder buffer*/
238 ullcurrentReplayCounter = ReorderInfo->reorderBuffer->ullReplayCounter[ucloopCounter];
239
240 /*Check for holes, if a hole is found in Reorder buffer then
241 no need to do replay check on it, skip the current
242 hole and do replay check on other packets*/
243 if(NULL != (ReorderInfo->reorderBuffer->arrayBuffer[ucloopCounter]))
244 {
245 status = WLANTL_IsReplayPacket(ullcurrentReplayCounter, ullpreviousReplayCounter);
246 if(VOS_TRUE == status)
247 {
248 /*Increment the debug counter*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530249 pClientSTA->ulTotalReplayPacketsDetected++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700250
251 /*A replay packet found*/
252 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -0800253 "WLANTL_ReorderingAgingTimerExpierCB: total dropped replay packets on STA ID %X is [0x%X]",
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530254 ucSTAID, pClientSTA->ulTotalReplayPacketsDetected);
Jeff Johnson295189b2012-06-20 16:38:30 -0700255
256 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -0800257 "WLANTL_ReorderingAgingTimerExpierCB: replay packet found with PN : [0x%llX]",
Jeff Johnson295189b2012-06-20 16:38:30 -0700258 ullcurrentReplayCounter);
259
260 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -0800261 "WLANTL_ReorderingAgingTimerExpierCB: Drop the replay packet with PN : [0x%llX]",
Jeff Johnson295189b2012-06-20 16:38:30 -0700262 ullcurrentReplayCounter);
263
264 ReorderInfo->reorderBuffer->arrayBuffer[ucloopCounter] = NULL;
265 ReorderInfo->reorderBuffer->ullReplayCounter[ucloopCounter] = 0;
266 }
267 else
268 {
269 /*Not a replay packet update previous replay counter*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530270 pClientSTA->ullReplayCounter[ucTID] = ullcurrentReplayCounter;
Jeff Johnson295189b2012-06-20 16:38:30 -0700271 }
272 }
273 else
274 {
275 /* A hole detected in Reorder buffer*/
276 //BAMSGERROR("WLANTL_ReorderingAgingTimerExpierCB,hole detected\n",0,0,0);
277
278 }
279 }
280 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700281
Leo Chang2301cff2014-01-03 20:31:46 -0800282 cIndex = ReorderInfo->ucCIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 status = WLANTL_ChainFrontPkts(fwIdx, opCode,
284 &vosDataBuff, ReorderInfo, NULL);
Leo Chang2301cff2014-01-03 20:31:46 -0800285 ReorderInfo->ucCIndex = cIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -0700286 if(!VOS_IS_STATUS_SUCCESS(status))
287 {
288 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make packet chain fail with Qed frames %d", status));
289 if(!VOS_IS_STATUS_SUCCESS(vos_lock_release(&ReorderInfo->reorderLock)))
290 {
291 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_ReorderingAgingTimerExpierCB, Release LOCK Fail"));
292 }
293 return;
294 }
295
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530296 if(NULL == pClientSTA->pfnSTARx)
Jeff Johnson295189b2012-06-20 16:38:30 -0700297 {
298 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Callback function NULL with STAID %d", ucSTAID));
299 if(!VOS_IS_STATUS_SUCCESS(vos_lock_release(&ReorderInfo->reorderLock)))
300 {
301 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_ReorderingAgingTimerExpierCB, Release LOCK Fail"));
302 }
303 return;
304 }
305
306 if(NULL == vosDataBuff)
307 {
308 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"No pending frames, why triggered timer? "));
309 if(!VOS_IS_STATUS_SUCCESS(vos_lock_release(&ReorderInfo->reorderLock)))
310 {
311 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_ReorderingAgingTimerExpierCB, Release LOCK Fail"));
312 }
313 return;
314 }
315
Madan Mohan Koyyalamudi31e4cad2013-08-21 20:21:14 +0530316 pCurrent = vosDataBuff;
317
318 while (pCurrent != NULL)
319 {
320 vos_pkt_walk_packet_chain(pCurrent, &pNext, VOS_FALSE);
321
322 if (NULL == pNext)
323 {
324 /* This is the last packet, retrieve its sequence number */
325 pRxMetadata = WDI_DS_ExtractRxMetaData(VOS_TO_WPAL_PKT(pCurrent));
326 seq = WDA_GET_RX_REORDER_CUR_PKT_SEQ_NO(pRxMetadata);
327 }
328 pCurrent = pNext;
329 }
330 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
331 "%s: Sending out Frame no: %d to HDD", __func__, seq));
332 ReorderInfo->LastSN = seq;
333
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530334 if( WLAN_STA_SOFTAP == pClientSTA->wSTADesc.wSTAType)
Jeff Johnson295189b2012-06-20 16:38:30 -0700335 {
336 WLANTL_FwdPktToHDD( expireHandle->pAdapter, vosDataBuff, ucSTAID);
337 }
338 else
Jeff Johnson295189b2012-06-20 16:38:30 -0700339 {
340 wRxMetaInfo.ucUP = ucTID;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530341 pClientSTA->pfnSTARx(expireHandle->pAdapter,
Jeff Johnson295189b2012-06-20 16:38:30 -0700342 vosDataBuff, ucSTAID, &wRxMetaInfo);
343 }
344 if(!VOS_IS_STATUS_SUCCESS(vos_lock_release(&ReorderInfo->reorderLock)))
345 {
346 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_ReorderingAgingTimerExpierCB, Release LOCK Fail"));
347 }
348 return;
349}/*WLANTL_ReorderingAgingTimerExpierCB*/
350
351/*----------------------------------------------------------------------------
352 INTERACTION WITH TL Main
353 ---------------------------------------------------------------------------*/
354/*==========================================================================
355
356 FUNCTION WLANTL_InitBAReorderBuffer
357
358 DESCRIPTION
359 Init Reorder buffer array
360
361 PARAMETERS
362 v_PVOID_t pvosGCtx Global context
363
364 RETURN VALUE
365 NONE
366
367============================================================================*/
368
369void WLANTL_InitBAReorderBuffer
370(
371 v_PVOID_t pvosGCtx
372)
373{
374 WLANTL_CbType *pTLCb;
375 v_U32_t idx;
376 v_U32_t pIdx;
377
378 pTLCb = VOS_GET_TL_CB(pvosGCtx);
379 if (NULL == pTLCb)
380 {
381 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700382 "%s: Invalid TL Control Block", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -0700383 return;
384 }
385
386 for(idx = 0; idx < WLANTL_MAX_BA_SESSION; idx++)
387 {
388 pTLCb->reorderBufferPool[idx].isAvailable = VOS_TRUE;
389 for(pIdx = 0; pIdx < WLANTL_MAX_WINSIZE; pIdx++)
390 {
391 pTLCb->reorderBufferPool[idx].arrayBuffer[pIdx] = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700392 pTLCb->reorderBufferPool[idx].ullReplayCounter[pIdx] = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700393 }
394 }
395
396 TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"BA reorder buffer init"));
397 return;
398}
399
400/*==========================================================================
401
402 FUNCTION WLANTL_BaSessionAdd
403
404 DESCRIPTION
405 HAL notifies TL when a new Block Ack session is being added.
406
407 DEPENDENCIES
408 A BA session on Rx needs to be added in TL before the response is
409 being sent out
410
411 PARAMETERS
412
413 IN
414 pvosGCtx: pointer to the global vos context; a handle to TL's
415 control block can be extracted from its context
416 ucSTAId: identifier of the station for which requested the BA
417 session
418 ucTid: Tspec ID for the new BA session
419 uSize: size of the reordering window
420
421
422 RETURN VALUE
423 The result code associated with performing the operation
424
425 VOS_STATUS_E_INVAL: Input parameters are invalid
426 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
427 to TL cb is NULL ; access would cause a page fault
428 VOS_STATUS_E_EXISTS: Station was not registered or BA session already
429 exists
430 VOS_STATUS_E_NOSUPPORT: Not yet supported
431
432 SIDE EFFECTS
433
434============================================================================*/
435VOS_STATUS
436WLANTL_BaSessionAdd
437(
438 v_PVOID_t pvosGCtx,
439 v_U16_t sessionID,
440 v_U32_t ucSTAId,
441 v_U8_t ucTid,
442 v_U32_t uBufferSize,
443 v_U32_t winSize,
444 v_U32_t SSN
445)
446{
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530447 WLANTL_CbType *pTLCb = NULL;
448 WLANTL_STAClientType *pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700449 WLANTL_BAReorderType *reorderInfo;
450 v_U32_t idx;
451 VOS_STATUS status = VOS_STATUS_SUCCESS;
452 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
453
454 /*------------------------------------------------------------------------
455 Sanity check
456 ------------------------------------------------------------------------*/
457 if ( WLANTL_TID_INVALID(ucTid))
458 {
459 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
460 "WLAN TL:Invalid parameter sent on WLANTL_BaSessionAdd");
461 return VOS_STATUS_E_INVAL;
462 }
463
464 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
465 {
466 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
467 "WLAN TL:Invalid station id requested on WLANTL_BaSessionAdd");
468 return VOS_STATUS_E_FAULT;
469 }
470
471 /*------------------------------------------------------------------------
472 Extract TL control block and check existance
473 ------------------------------------------------------------------------*/
474 pTLCb = VOS_GET_TL_CB(pvosGCtx);
475 if ( NULL == pTLCb )
476 {
477 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
478 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_BaSessionAdd");
479 return VOS_STATUS_E_FAULT;
480 }
481
Leo Chang6b6faaf2014-01-24 21:21:26 -0800482 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530483 if ( NULL == pClientSTA )
484 {
485 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
486 "WLAN TL:Client Memory was not allocated on %s", __func__));
487 return VOS_STATUS_E_FAILURE;
488 }
489
490 if ( 0 == pClientSTA->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -0700491 {
492 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
493 "WLAN TL:Station was not yet registered on WLANTL_BaSessionAdd");
494 return VOS_STATUS_E_EXISTS;
495 }
496
Leo Chang6b6faaf2014-01-24 21:21:26 -0800497 reorderInfo = &pClientSTA->atlBAReorderInfo[ucTid];
498 if (!VOS_IS_STATUS_SUCCESS(
499 vos_lock_acquire(&reorderInfo->reorderLock)))
500 {
501 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
502 "%s: Release LOCK Fail", __func__));
503 return VOS_STATUS_E_FAULT;
504 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 /*------------------------------------------------------------------------
506 Verify that BA session was not already added
507 ------------------------------------------------------------------------*/
Leo Chang6b6faaf2014-01-24 21:21:26 -0800508 if ( 0 != reorderInfo->ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -0700509 {
Leo Chang6b6faaf2014-01-24 21:21:26 -0800510 reorderInfo->ucExists++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700511 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
512 "WLAN TL:BA session already exists on WLANTL_BaSessionAdd");
Leo Chang6b6faaf2014-01-24 21:21:26 -0800513 vos_lock_release(&reorderInfo->reorderLock);
Jeff Johnson295189b2012-06-20 16:38:30 -0700514 return VOS_STATUS_E_EXISTS;
515 }
516
517 /*------------------------------------------------------------------------
518 Initialize new BA session
519 ------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -0700520 for(idx = 0; idx < WLANTL_MAX_BA_SESSION; idx++)
521 {
522 if(VOS_TRUE == pTLCb->reorderBufferPool[idx].isAvailable)
523 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530524 pClientSTA->atlBAReorderInfo[ucTid].reorderBuffer =
Jeff Johnson295189b2012-06-20 16:38:30 -0700525 &(pTLCb->reorderBufferPool[idx]);
526 pTLCb->reorderBufferPool[idx].isAvailable = VOS_FALSE;
527 TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"%dth buffer available, buffer PTR 0x%p",
528 idx,
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530529 pClientSTA->atlBAReorderInfo[ucTid].reorderBuffer
Jeff Johnson295189b2012-06-20 16:38:30 -0700530 ));
531 break;
532 }
533 }
534
Jeff Johnson295189b2012-06-20 16:38:30 -0700535
Leo Chang6b6faaf2014-01-24 21:21:26 -0800536 if (WLAN_STA_SOFTAP == pClientSTA->wSTADesc.wSTAType)
Jeff Johnson295189b2012-06-20 16:38:30 -0700537 {
Leo Chang6b6faaf2014-01-24 21:21:26 -0800538 if (WLANTL_MAX_BA_SESSION == idx)
Jeff Johnson295189b2012-06-20 16:38:30 -0700539 {
540 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -0800541 "Number of Add BA request received more than allowed");
Leo Chang6b6faaf2014-01-24 21:21:26 -0800542 vos_lock_release(&reorderInfo->reorderLock);
Jeff Johnson295189b2012-06-20 16:38:30 -0700543 return VOS_STATUS_E_NOSUPPORT;
544 }
545 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 reorderInfo->timerUdata.pAdapter = pvosGCtx;
547 reorderInfo->timerUdata.pTLHandle = (v_PVOID_t)pTLCb;
548 reorderInfo->timerUdata.STAID = ucSTAId;
549 reorderInfo->timerUdata.TID = ucTid;
550
551 /* BA aging timer */
552 status = vos_timer_init(&reorderInfo->agingTimer,
553 VOS_TIMER_TYPE_SW,
554 WLANTL_ReorderingAgingTimerExpierCB,
555 (v_PVOID_t)(&reorderInfo->timerUdata));
556 if(!VOS_IS_STATUS_SUCCESS(status))
557 {
Leo Chang6b6faaf2014-01-24 21:21:26 -0800558 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
559 "%s: Timer Init Fail", __func__));
560 vos_lock_release(&reorderInfo->reorderLock);
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 return status;
562 }
563
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530564 pClientSTA->atlBAReorderInfo[ucTid].ucExists++;
565 pClientSTA->atlBAReorderInfo[ucTid].usCount = 0;
566 pClientSTA->atlBAReorderInfo[ucTid].ucCIndex = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700567 if(0 == winSize)
568 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530569 pClientSTA->atlBAReorderInfo[ucTid].winSize = WLANTL_MAX_WINSIZE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700570 }
571 else
572 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530573 pClientSTA->atlBAReorderInfo[ucTid].winSize = winSize;
Jeff Johnson295189b2012-06-20 16:38:30 -0700574 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530575 pClientSTA->atlBAReorderInfo[ucTid].SSN = SSN;
576 pClientSTA->atlBAReorderInfo[ucTid].sessionID = sessionID;
577 pClientSTA->atlBAReorderInfo[ucTid].pendingFramesCount = 0;
Madan Mohan Koyyalamudi31e4cad2013-08-21 20:21:14 +0530578 pClientSTA->atlBAReorderInfo[ucTid].LastSN = SSN;
Jeff Johnson295189b2012-06-20 16:38:30 -0700579 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
580 "WLAN TL:New BA session added for STA: %d TID: %d",
581 ucSTAId, ucTid));
582
Leo Chang6b6faaf2014-01-24 21:21:26 -0800583 if(!VOS_IS_STATUS_SUCCESS(
584 vos_lock_release(&reorderInfo->reorderLock)))
585 {
586 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
587 "%s: Release LOCK Fail", __func__));
588 return VOS_STATUS_E_FAULT;
589 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 return VOS_STATUS_SUCCESS;
591}/* WLANTL_BaSessionAdd */
592
593/*==========================================================================
594
595 FUNCTION WLANTL_BaSessionDel
596
597 DESCRIPTION
598 HAL notifies TL when a new Block Ack session is being deleted.
599
600 DEPENDENCIES
601
602 PARAMETERS
603
604 IN
605 pvosGCtx: pointer to the global vos context; a handle to TL's
606 control block can be extracted from its context
607 ucSTAId: identifier of the station for which requested the BA
608 session
609 ucTid: Tspec ID for the new BA session
610
611 RETURN VALUE
612 The result code associated with performing the operation
613
614 VOS_STATUS_E_INVAL: Input parameters are invalid
615 VOS_STATUS_E_FAULT: Station ID is outside array boundaries or pointer
616 to TL cb is NULL ; access would cause a page fault
617 VOS_STATUS_E_EXISTS: Station was not registered or BA session already
618 exists
619 VOS_STATUS_E_NOSUPPORT: Not yet supported
620
621 SIDE EFFECTS
622
623============================================================================*/
624VOS_STATUS
625WLANTL_BaSessionDel
626(
627 v_PVOID_t pvosGCtx,
628 v_U16_t ucSTAId,
629 v_U8_t ucTid
630)
631{
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530632 WLANTL_CbType* pTLCb = NULL;
633 WLANTL_STAClientType *pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700634 vos_pkt_t* vosDataBuff = NULL;
635 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
636 VOS_STATUS lockStatus = VOS_STATUS_E_FAILURE;
637 WLANTL_BAReorderType* reOrderInfo = NULL;
638 WLANTL_RxMetaInfoType wRxMetaInfo;
639 v_U32_t fwIdx = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700640 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
641
642 /*------------------------------------------------------------------------
643 Sanity check
644 ------------------------------------------------------------------------*/
645 if ( WLANTL_TID_INVALID(ucTid))
646 {
647 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
648 "WLAN TL:Invalid parameter sent on WLANTL_BaSessionDel");
649 return VOS_STATUS_E_INVAL;
650 }
651
652 if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
653 {
654 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
655 "WLAN TL:Invalid station id requested on WLANTL_BaSessionDel");
656 return VOS_STATUS_E_FAULT;
657 }
658
659 /*------------------------------------------------------------------------
660 Extract TL control block and check existance
661 ------------------------------------------------------------------------*/
662 pTLCb = VOS_GET_TL_CB(pvosGCtx);
663 if ( NULL == pTLCb )
664 {
665 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
666 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_BaSessionDel");
667 return VOS_STATUS_E_FAULT;
668 }
669
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530670 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
671
672 if ( NULL == pClientSTA )
673 {
674 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
675 "WLAN TL:Client Memory was not allocated on %s", __func__));
676 return VOS_STATUS_E_FAILURE;
677 }
678
679 if (( 0 == pClientSTA->ucExists ) &&
680 ( 0 == pClientSTA->atlBAReorderInfo[ucTid].ucExists ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700681 {
Madan Mohan Koyyalamudi8b7f1e62012-10-05 14:56:51 -0700682 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
Jeff Johnson295189b2012-06-20 16:38:30 -0700683 "WLAN TL:Station was not yet registered on WLANTL_BaSessionDel");
684 return VOS_STATUS_E_EXISTS;
685 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530686 else if(( 0 == pClientSTA->ucExists ) &&
687 ( 0 != pClientSTA->atlBAReorderInfo[ucTid].ucExists ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700688 {
689 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
690 "STA was deleted but BA info is still there, just remove BA info");
691
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530692 reOrderInfo = &pClientSTA->atlBAReorderInfo[ucTid];
Jeff Johnson295189b2012-06-20 16:38:30 -0700693 reOrderInfo->reorderBuffer->isAvailable = VOS_TRUE;
694 memset(&reOrderInfo->reorderBuffer->arrayBuffer[0],
695 0,
696 WLANTL_MAX_WINSIZE * sizeof(v_PVOID_t));
697 vos_timer_destroy(&reOrderInfo->agingTimer);
698 memset(reOrderInfo, 0, sizeof(WLANTL_BAReorderType));
699
700 return VOS_STATUS_SUCCESS;
701 }
702
703 /*------------------------------------------------------------------------
704 Verify that BA session was added
705 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530706 if ( 0 == pClientSTA->atlBAReorderInfo[ucTid].ucExists )
Jeff Johnson295189b2012-06-20 16:38:30 -0700707 {
Madan Mohan Koyyalamudi179e6fe2012-10-15 15:31:08 -0700708 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
Jeff Johnson295189b2012-06-20 16:38:30 -0700709 "WLAN TL:BA session does not exists on WLANTL_BaSessionDel");
710 return VOS_STATUS_E_EXISTS;
711 }
712
713
714 /*------------------------------------------------------------------------
715 Send all pending packets to HDD
716 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530717 reOrderInfo = &pClientSTA->atlBAReorderInfo[ucTid];
Jeff Johnson295189b2012-06-20 16:38:30 -0700718
719 /*------------------------------------------------------------------------
720 Invalidate reorder info here. This ensures that no packets are
721 bufferd after reorder buffer is cleaned.
722 */
723 lockStatus = vos_lock_acquire(&reOrderInfo->reorderLock);
724 if(!VOS_IS_STATUS_SUCCESS(lockStatus))
725 {
726 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
Arif Hussainf2b00992013-11-17 21:46:15 -0800727 "Unable to acquire reorder vos lock in %s", __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -0700728 return lockStatus;
729 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530730 pClientSTA->atlBAReorderInfo[ucTid].ucExists = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700731
732 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
733 "WLAN TL: Fwd all packets to HDD on WLANTL_BaSessionDel"));
734
735 if(0 == reOrderInfo->ucCIndex)
736 {
737 fwIdx = reOrderInfo->winSize;
738 }
739 else
740 {
741 fwIdx = reOrderInfo->ucCIndex - 1;
742 }
743
744 if(0 != reOrderInfo->pendingFramesCount)
745 {
746 vosStatus = WLANTL_ChainFrontPkts(fwIdx,
747 WLANTL_OPCODE_FWDALL_DROPCUR,
748 &vosDataBuff, reOrderInfo, pTLCb);
749 }
750
751 if ((VOS_STATUS_SUCCESS == vosStatus) && (NULL != vosDataBuff))
752 {
753 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
754 "WLAN TL: Chaining was successful sending all pkts to HDD : %x",
755 vosDataBuff ));
756
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530757 if ( WLAN_STA_SOFTAP == pClientSTA->wSTADesc.wSTAType )
Jeff Johnson295189b2012-06-20 16:38:30 -0700758 {
759 WLANTL_FwdPktToHDD( pvosGCtx, vosDataBuff, ucSTAId);
760 }
761 else
Jeff Johnson295189b2012-06-20 16:38:30 -0700762 {
763 wRxMetaInfo.ucUP = ucTid;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530764 pClientSTA->pfnSTARx( pvosGCtx, vosDataBuff, ucSTAId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 &wRxMetaInfo );
766 }
767 }
768
Jeff Johnson295189b2012-06-20 16:38:30 -0700769 /*------------------------------------------------------------------------
770 Delete reordering timer
771 ------------------------------------------------------------------------*/
772 if(VOS_TIMER_STATE_RUNNING == vos_timer_getCurrentState(&reOrderInfo->agingTimer))
773 {
774 vosStatus = vos_timer_stop(&reOrderInfo->agingTimer);
775 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
776 {
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +0530777 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Timer stop fail: %d", vosStatus));
Leo Chang6b6faaf2014-01-24 21:21:26 -0800778 vos_lock_release(&reOrderInfo->reorderLock);
Jeff Johnson295189b2012-06-20 16:38:30 -0700779 return vosStatus;
780 }
781 }
782
783 if(VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&reOrderInfo->agingTimer))
784 {
785 vosStatus = vos_timer_destroy(&reOrderInfo->agingTimer);
786 }
787 else
788 {
789 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Timer is not stopped state current state is %d",
790 vos_timer_getCurrentState(&reOrderInfo->agingTimer)));
791 }
792 if ( VOS_STATUS_SUCCESS != vosStatus )
793 {
794 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
795 "WLAN TL:Failed to destroy reorder timer on WLANTL_BaSessionAdd");
796 }
797
798 /*------------------------------------------------------------------------
799 Delete session
800 ------------------------------------------------------------------------*/
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530801 pClientSTA->atlBAReorderInfo[ucTid].usCount = 0;
802 pClientSTA->atlBAReorderInfo[ucTid].ucCIndex = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 reOrderInfo->winSize = 0;
804 reOrderInfo->SSN = 0;
805 reOrderInfo->sessionID = 0;
Madan Mohan Koyyalamudi31e4cad2013-08-21 20:21:14 +0530806 reOrderInfo->LastSN = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700807
Jeff Johnson295189b2012-06-20 16:38:30 -0700808 TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
809 "WLAN TL: BA session deleted for STA: %d TID: %d",
810 ucSTAId, ucTid));
811
812 memset((v_U8_t *)(&reOrderInfo->reorderBuffer->arrayBuffer[0]),
813 0,
814 WLANTL_MAX_WINSIZE * sizeof(v_PVOID_t));
815 reOrderInfo->reorderBuffer->isAvailable = VOS_TRUE;
816
Leo Chang6b6faaf2014-01-24 21:21:26 -0800817 vos_lock_release(&reOrderInfo->reorderLock);
Jeff Johnson295189b2012-06-20 16:38:30 -0700818 return VOS_STATUS_SUCCESS;
819}/* WLANTL_BaSessionDel */
820
821
822/*----------------------------------------------------------------------------
823 INTERACTION WITH TL main module
824 ---------------------------------------------------------------------------*/
825
826/*==========================================================================
827 AMSDU sub-frame processing module
828 ==========================================================================*/
829/*==========================================================================
830 FUNCTION WLANTL_AMSDUProcess
831
832 DESCRIPTION
833 Process A-MSDU sub-frame. Start of chain if marked as first frame.
834 Linked at the end of the existing AMSDU chain.
835
836 DEPENDENCIES
837
838 PARAMETERS
839
840 IN/OUT:
841 vosDataBuff: vos packet for the received data
842 outgoing contains the root of the chain for the rx
843 aggregated MSDU if the frame is marked as last; otherwise
844 NULL
845
846 IN
847 pvosGCtx: pointer to the global vos context; a handle to TL's
848 control block can be extracted from its context
849 pvBDHeader: pointer to the BD header
850 ucSTAId: Station ID
851 ucMPDUHLen: length of the MPDU header
852 usMPDULen: length of the MPDU
853
854 RETURN VALUE
855 The result code associated with performing the operation
856
857 VOS_STATUS_E_INVAL: invalid input parameters
858 VOS_STATUS_E_FAULT: pointer to TL cb is NULL ; access would cause a
859 page fault
860 VOS_STATUS_SUCCESS: Everything is good :)
861
862 Other values can be returned as a result of a function call, please check
863 corresponding API for more info.
864
865 SIDE EFFECTS
866
867============================================================================*/
868VOS_STATUS
869WLANTL_AMSDUProcess
870(
871 v_PVOID_t pvosGCtx,
872 vos_pkt_t** ppVosDataBuff,
873 v_PVOID_t pvBDHeader,
874 v_U8_t ucSTAId,
875 v_U8_t ucMPDUHLen,
876 v_U16_t usMPDULen
877)
878{
879 v_U8_t ucFsf; /* First AMSDU sub frame */
880 v_U8_t ucAef; /* Error in AMSDU sub frame */
881 WLANTL_CbType* pTLCb = NULL;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530882 WLANTL_STAClientType *pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700883 v_U8_t MPDUHeaderAMSDUHeader[WLANTL_MPDU_HEADER_LEN + TL_AMSDU_SUBFRM_HEADER_LEN];
884 v_U16_t subFrameLength;
885 v_U16_t paddingSize;
886 VOS_STATUS vStatus = VOS_STATUS_SUCCESS;
887 v_U16_t MPDUDataOffset;
888 v_U16_t packetLength;
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -0700889 static v_U32_t numAMSDUFrames;
Jeff Johnson295189b2012-06-20 16:38:30 -0700890 vos_pkt_t* vosDataBuff;
891 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
892 /*------------------------------------------------------------------------
893 Sanity check
894 ------------------------------------------------------------------------*/
895 if (( NULL == ppVosDataBuff ) || (NULL == *ppVosDataBuff) || ( NULL == pvBDHeader ) ||
896 ( WLANTL_STA_ID_INVALID(ucSTAId)) )
897 {
898 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
899 "WLAN TL:Invalid parameter sent on WLANTL_AMSDUProcess");
900 return VOS_STATUS_E_INVAL;
901 }
902
903 vosDataBuff = *ppVosDataBuff;
904 /*------------------------------------------------------------------------
905 Extract TL control block
906 ------------------------------------------------------------------------*/
907 pTLCb = VOS_GET_TL_CB(pvosGCtx);
908 if ( NULL == pTLCb )
909 {
910 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
911 "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_AMSDUProcess");
912 return VOS_STATUS_E_FAULT;
913 }
914
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530915 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
916
917 if ( NULL == pClientSTA )
918 {
919 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
920 "WLAN TL:Client Memory was not allocated on %s", __func__));
921 return VOS_STATUS_E_FAILURE;
922 }
923
Jeff Johnson295189b2012-06-20 16:38:30 -0700924 /*------------------------------------------------------------------------
925 Check frame
926 ------------------------------------------------------------------------*/
927 ucAef = (v_U8_t)WDA_GET_RX_AEF( pvBDHeader );
928 ucFsf = (v_U8_t)WDA_GET_RX_ESF( pvBDHeader );
Jeff Johnson295189b2012-06-20 16:38:30 -0700929 /* On Prima, MPDU data offset not includes BD header size */
930 MPDUDataOffset = (v_U16_t)WDA_GET_RX_MPDU_DATA_OFFSET(pvBDHeader);
Jeff Johnson295189b2012-06-20 16:38:30 -0700931
932 if ( WLANHAL_RX_BD_AEF_SET == ucAef )
933 {
934 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
935 "WLAN TL:Error in AMSDU - dropping entire chain"));
936
937 vos_pkt_return_packet(vosDataBuff);
938 *ppVosDataBuff = NULL;
939 return VOS_STATUS_SUCCESS; /*Not a transport error*/
940 }
941
942 if((0 != ucMPDUHLen) && ucFsf)
943 {
944 /*
945 * This is first AMSDU sub frame
946 * AMSDU Header should be removed
947 * MPDU header should be stored into context to recover next frames
948 */
Leela V Kiran Kumar Reddy Chirala6a458752013-02-16 15:41:27 -0800949 /* Assumed here Address4 is never part of AMSDU received at TL */
950 if (ucMPDUHLen > WLANTL_MPDU_HEADER_LEN)
951 {
952 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"MPDU Header length (%d) is greater",ucMPDUHLen));
953 vos_pkt_return_packet(vosDataBuff);
954 *ppVosDataBuff = NULL;
955 return VOS_STATUS_SUCCESS; /*Not a transport error*/
956 }
957
Jeff Johnson295189b2012-06-20 16:38:30 -0700958 vStatus = vos_pkt_pop_head(vosDataBuff, MPDUHeaderAMSDUHeader, ucMPDUHLen + TL_AMSDU_SUBFRM_HEADER_LEN);
959 if(!VOS_IS_STATUS_SUCCESS(vStatus))
960 {
961 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Pop MPDU AMSDU Header fail"));
962 vos_pkt_return_packet(vosDataBuff);
963 *ppVosDataBuff = NULL;
964 return VOS_STATUS_SUCCESS; /*Not a transport error*/
965 }
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530966 pClientSTA->ucMPDUHeaderLen = ucMPDUHLen;
Katya Nigam493ff652014-02-11 14:31:04 +0530967 vos_mem_copy(pClientSTA->aucMPDUHeader, MPDUHeaderAMSDUHeader, ucMPDUHLen);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530968 /* AMSDU header stored to handle garbage data within next frame */
Jeff Johnson295189b2012-06-20 16:38:30 -0700969 }
970 else
971 {
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530972 /* Trim garbage, size is frameLoop */
Jeff Johnson295189b2012-06-20 16:38:30 -0700973 if(MPDUDataOffset > 0)
974 {
975 vStatus = vos_pkt_trim_head(vosDataBuff, MPDUDataOffset);
976 }
977 if(!VOS_IS_STATUS_SUCCESS(vStatus))
978 {
979 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Trim Garbage Data fail"));
980 vos_pkt_return_packet(vosDataBuff);
981 *ppVosDataBuff = NULL;
982 return VOS_STATUS_SUCCESS; /*Not a transport error*/
983 }
984
985 /* Remove MPDU header and AMSDU header from the packet */
986 vStatus = vos_pkt_pop_head(vosDataBuff, MPDUHeaderAMSDUHeader, ucMPDUHLen + TL_AMSDU_SUBFRM_HEADER_LEN);
987 if(!VOS_IS_STATUS_SUCCESS(vStatus))
988 {
989 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"AMSDU Header Pop fail"));
990 vos_pkt_return_packet(vosDataBuff);
991 *ppVosDataBuff = NULL;
992 return VOS_STATUS_SUCCESS; /*Not a transport error*/
993 }
994 } /* End of henalding not first sub frame specific */
995
996 /* Put in MPDU header into all the frame */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +0530997 vStatus = vos_pkt_push_head(vosDataBuff, pClientSTA->aucMPDUHeader, pClientSTA->ucMPDUHeaderLen);
Jeff Johnson295189b2012-06-20 16:38:30 -0700998 if(!VOS_IS_STATUS_SUCCESS(vStatus))
999 {
1000 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"MPDU Header Push back fail"));
1001 vos_pkt_return_packet(vosDataBuff);
1002 *ppVosDataBuff = NULL;
1003 return VOS_STATUS_SUCCESS; /*Not a transport error*/
1004 }
1005
1006 /* Find Padding and remove */
Katya Nigam493ff652014-02-11 14:31:04 +05301007 vos_mem_copy(&subFrameLength, MPDUHeaderAMSDUHeader + ucMPDUHLen + WLANTL_AMSDU_SUBFRAME_LEN_OFFSET, sizeof(v_U16_t));
Jeff Johnson295189b2012-06-20 16:38:30 -07001008 subFrameLength = vos_be16_to_cpu(subFrameLength);
1009 paddingSize = usMPDULen - ucMPDUHLen - subFrameLength - TL_AMSDU_SUBFRM_HEADER_LEN;
1010
1011 vos_pkt_get_packet_length(vosDataBuff, &packetLength);
1012 if((paddingSize > 0) && (paddingSize < packetLength))
1013 {
1014 /* There is padding bits, remove it */
1015 vos_pkt_trim_tail(vosDataBuff, paddingSize);
1016 }
1017 else if(0 == paddingSize)
1018 {
1019 /* No Padding bits */
1020 /* Do Nothing */
1021 }
1022 else
1023 {
1024 /* Padding size is larger than Frame size, Actually negative */
1025 /* Not a valid case, not a valid frame, drop it */
1026 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Padding Size is negative, no possible %d", paddingSize));
1027 vos_pkt_return_packet(vosDataBuff);
1028 *ppVosDataBuff = NULL;
1029 return VOS_STATUS_SUCCESS; /*Not a transport error*/
1030 }
1031
1032 numAMSDUFrames++;
1033 if(0 == (numAMSDUFrames % 5000))
1034 {
Jeff Johnson0298bd02013-11-14 19:58:38 -08001035 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"%u AMSDU frames arrived", numAMSDUFrames));
Jeff Johnson295189b2012-06-20 16:38:30 -07001036 }
1037 return VOS_STATUS_SUCCESS;
1038}/* WLANTL_AMSDUProcess */
1039
1040/*==========================================================================
1041 Re-ordering module
1042 ==========================================================================*/
1043
1044/*==========================================================================
1045 FUNCTION WLANTL_MSDUReorder
1046
1047 DESCRIPTION
1048 MSDU reordering
1049
1050 DEPENDENCIES
1051
1052 PARAMETERS
1053
1054 IN
1055
1056 vosDataBuff: vos packet for the received data
1057 pvBDHeader: pointer to the BD header
1058 ucSTAId: Station ID
1059
1060 RETURN VALUE
1061 The result code associated with performing the operation
1062
1063 VOS_STATUS_SUCCESS: Everything is good :)
1064
1065 SIDE EFFECTS
1066
1067============================================================================*/
1068VOS_STATUS WLANTL_MSDUReorder
1069(
1070 WLANTL_CbType *pTLCb,
1071 vos_pkt_t **vosDataBuff,
1072 v_PVOID_t pvBDHeader,
1073 v_U8_t ucSTAId,
1074 v_U8_t ucTid
1075)
1076{
1077 WLANTL_BAReorderType *currentReorderInfo;
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301078 WLANTL_STAClientType *pClientSTA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001079 vos_pkt_t *vosPktIdx;
1080 v_U8_t ucOpCode;
1081 v_U8_t ucSlotIdx;
1082 v_U8_t ucFwdIdx;
1083 v_U16_t CSN;
1084 v_U32_t ucCIndexOrig;
1085 VOS_STATUS status = VOS_STATUS_SUCCESS;
1086 VOS_STATUS lockStatus = VOS_STATUS_SUCCESS;
1087 VOS_STATUS timerStatus = VOS_STATUS_SUCCESS;
1088 VOS_TIMER_STATE timerState;
1089 v_SIZE_t rxFree;
Jeff Johnson295189b2012-06-20 16:38:30 -07001090 v_U64_t ullreplayCounter = 0; /* 48-bit replay counter */
Dhanashri Atred8c20a32014-01-03 17:20:55 -08001091 v_U8_t ac;
1092 v_U16_t reorderTime;
Jeff Johnson295189b2012-06-20 16:38:30 -07001093 if((NULL == pTLCb) || (*vosDataBuff == NULL))
1094 {
1095 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid ARG pTLCb 0x%p, vosDataBuff 0x%p",
1096 pTLCb, *vosDataBuff));
1097 return VOS_STATUS_E_INVAL;
1098 }
1099
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301100 pClientSTA = pTLCb->atlSTAClients[ucSTAId];
1101
1102 if ( NULL == pClientSTA )
1103 {
1104 TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1105 "WLAN TL:Client Memory was not allocated on %s", __func__));
1106 return VOS_STATUS_E_FAILURE;
1107 }
1108
1109 currentReorderInfo = &pClientSTA->atlBAReorderInfo[ucTid];
Jeff Johnson295189b2012-06-20 16:38:30 -07001110
1111 lockStatus = vos_lock_acquire(&currentReorderInfo->reorderLock);
1112 if(!VOS_IS_STATUS_SUCCESS(lockStatus))
1113 {
1114 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
1115 return lockStatus;
1116 }
1117
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301118 if( pClientSTA->atlBAReorderInfo[ucTid].ucExists == 0 )
Jeff Johnson295189b2012-06-20 16:38:30 -07001119 {
1120 vos_lock_release(&currentReorderInfo->reorderLock);
1121 return VOS_STATUS_E_INVAL;
1122 }
1123 ucOpCode = (v_U8_t)WDA_GET_RX_REORDER_OPCODE(pvBDHeader);
1124 ucSlotIdx = (v_U8_t)WDA_GET_RX_REORDER_SLOT_IDX(pvBDHeader);
1125 ucFwdIdx = (v_U8_t)WDA_GET_RX_REORDER_FWD_IDX(pvBDHeader);
1126 CSN = (v_U16_t)WDA_GET_RX_REORDER_CUR_PKT_SEQ_NO(pvBDHeader);
1127
1128
1129
1130#ifdef WLANTL_HAL_VOLANS
1131 /* Replay check code : check whether replay check is needed or not */
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301132 if(VOS_TRUE == pClientSTA->ucIsReplayCheckValid)
Jeff Johnson295189b2012-06-20 16:38:30 -07001133 {
1134 /* Getting 48-bit replay counter from the RX BD */
1135 ullreplayCounter = WDA_DS_GetReplayCounter(aucBDHeader);
1136 }
1137#endif
1138
1139#ifdef WLANTL_REORDER_DEBUG_MSG_ENABLE
1140 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"opCode %d SI %d, FI %d, CI %d seqNo %d", ucOpCode, ucSlotIdx, ucFwdIdx, currentReorderInfo->ucCIndex, CSN));
1141#else
1142 TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"opCode %d SI %d, FI %d, CI %d seqNo %d", ucOpCode, ucSlotIdx, ucFwdIdx, currentReorderInfo->ucCIndex, CSN));
1143#endif
1144
1145 // remember our current CI so that later we can tell if it advanced
1146 ucCIndexOrig = currentReorderInfo->ucCIndex;
1147
Madan Mohan Koyyalamudi31e4cad2013-08-21 20:21:14 +05301148 switch(ucOpCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07001149 {
1150 case WLANTL_OPCODE_INVALID:
1151 /* Do nothing just pass through current frame */
1152 break;
1153
1154 case WLANTL_OPCODE_QCUR_FWDBUF:
Madan Mohan Koyyalamudi31e4cad2013-08-21 20:21:14 +05301155 if (currentReorderInfo->LastSN > CSN)
1156 {
1157 if ((currentReorderInfo->LastSN - CSN) < CSN_WRAP_AROUND_THRESHOLD)
1158 {
1159 //this frame is received after BA timer is expired, discard it
1160 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
1161 "(QCUR_FWDBUF) dropping old frame, SN=%d LastSN=%d",
1162 CSN, currentReorderInfo->LastSN));
1163 status = vos_pkt_return_packet(*vosDataBuff);
1164 if (!VOS_IS_STATUS_SUCCESS(status))
1165 {
1166 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1167 "(QCUR_FWDBUF) drop old frame fail %d", status));
1168 }
1169 *vosDataBuff = NULL;
1170 lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
1171 if (!VOS_IS_STATUS_SUCCESS(lockStatus))
1172 {
1173 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1174 "WLANTL_MSDUReorder, Release LOCK Fail"));
1175 return lockStatus;
1176 }
1177 return status;
1178 }
1179 }
1180 currentReorderInfo->LastSN = CSN;
Jeff Johnson295189b2012-06-20 16:38:30 -07001181 if(0 == currentReorderInfo->pendingFramesCount)
1182 {
1183 //This frame will be fwd'ed to the OS. The next slot is the one we expect next
1184 currentReorderInfo->ucCIndex = (ucSlotIdx + 1) % currentReorderInfo->winSize;
1185 lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
1186 if(!VOS_IS_STATUS_SUCCESS(lockStatus))
1187 {
1188 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
1189 return lockStatus;
1190 }
1191 return status;
1192 }
1193 status = WLANTL_QueueCurrent(currentReorderInfo,
1194 vosDataBuff,
1195 ucSlotIdx);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301196 if(VOS_TRUE == pClientSTA->ucIsReplayCheckValid)
Jeff Johnson295189b2012-06-20 16:38:30 -07001197 {
1198 WLANTL_FillReplayCounter(currentReorderInfo,
1199 ullreplayCounter, ucSlotIdx);
1200 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001201 if(VOS_STATUS_E_RESOURCES == status)
1202 {
1203 /* This is the case slot index is already cycle one route, route all the frames Qed */
1204 vosPktIdx = NULL;
1205 status = WLANTL_ChainFrontPkts(ucFwdIdx,
1206 WLANTL_OPCODE_FWDALL_QCUR,
1207 &vosPktIdx,
1208 currentReorderInfo,
1209 pTLCb);
1210 if(!VOS_IS_STATUS_SUCCESS(status))
1211 {
1212 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make frame chain fail %d", status));
1213 lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
1214 if(!VOS_IS_STATUS_SUCCESS(lockStatus))
1215 {
1216 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
1217 return lockStatus;
1218 }
1219 return status;
1220 }
1221 status = vos_pkt_chain_packet(vosPktIdx, *vosDataBuff, 1);
1222 *vosDataBuff = vosPktIdx;
1223 currentReorderInfo->pendingFramesCount = 0;
1224 }
1225 else
1226 {
1227 vosPktIdx = NULL;
1228 status = WLANTL_ChainFrontPkts(ucFwdIdx,
1229 WLANTL_OPCODE_QCUR_FWDBUF,
1230 &vosPktIdx,
1231 currentReorderInfo,
1232 pTLCb);
1233 if(!VOS_IS_STATUS_SUCCESS(status))
1234 {
1235 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make frame chain fail %d", status));
1236 lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
1237 if(!VOS_IS_STATUS_SUCCESS(lockStatus))
1238 {
1239 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
1240 return lockStatus;
1241 }
1242 return status;
1243 }
Leo Chang2301cff2014-01-03 20:31:46 -08001244 currentReorderInfo->ucCIndex = ucFwdIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001245 *vosDataBuff = vosPktIdx;
1246 }
1247 break;
1248
1249 case WLANTL_OPCODE_FWDBUF_FWDCUR:
1250 vosPktIdx = NULL;
1251 status = WLANTL_ChainFrontPkts(ucFwdIdx,
1252 WLANTL_OPCODE_FWDBUF_FWDCUR,
1253 &vosPktIdx,
1254 currentReorderInfo,
1255 pTLCb);
1256 if(!VOS_IS_STATUS_SUCCESS(status))
1257 {
1258 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make frame chain fail %d", status));
1259 lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
1260 if(!VOS_IS_STATUS_SUCCESS(lockStatus))
1261 {
1262 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
1263 return lockStatus;
1264 }
1265 return status;
1266 }
1267
1268 if(NULL == vosPktIdx)
1269 {
Arif Hussainf2b00992013-11-17 21:46:15 -08001270 TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"Nothing to chain, just send current frame"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001271 }
1272 else
1273 {
1274 status = vos_pkt_chain_packet(vosPktIdx, *vosDataBuff, 1);
1275 if(!VOS_IS_STATUS_SUCCESS(status))
1276 {
1277 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make frame chain with CUR frame fail %d",
1278 status));
1279 lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
1280 if(!VOS_IS_STATUS_SUCCESS(lockStatus))
1281 {
1282 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
1283 return lockStatus;
1284 }
1285 return status;
1286 }
1287 *vosDataBuff = vosPktIdx;
1288 }
1289 //ucFwdIdx is the slot this packet supposes to take but there is a hole there
1290 //It looks that the chip will put the next packet into the slot ucFwdIdx.
1291 currentReorderInfo->ucCIndex = ucFwdIdx;
1292 break;
1293
1294 case WLANTL_OPCODE_QCUR:
Madan Mohan Koyyalamudi31e4cad2013-08-21 20:21:14 +05301295 if (currentReorderInfo->LastSN > CSN)
1296 {
1297 if ((currentReorderInfo->LastSN - CSN) < CSN_WRAP_AROUND_THRESHOLD)
1298 {
1299 // this frame is received after BA timer is expired, so disard it
1300 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
1301 "(QCUR) dropping old frame, SN=%d LastSN=%d",
1302 CSN, currentReorderInfo->LastSN));
1303 status = vos_pkt_return_packet(*vosDataBuff);
1304 if (!VOS_IS_STATUS_SUCCESS(status))
1305 {
1306 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1307 "*** (QCUR) drop old frame fail %d", status));
1308 }
1309 *vosDataBuff = NULL;
1310 lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
1311 if (!VOS_IS_STATUS_SUCCESS(lockStatus))
1312 {
1313 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
1314 "WLANTL_MSDUReorder, Release LOCK Fail"));
1315 return lockStatus;
1316 }
1317 return status;
1318 }
1319 }
1320
Jeff Johnson295189b2012-06-20 16:38:30 -07001321 status = WLANTL_QueueCurrent(currentReorderInfo,
1322 vosDataBuff,
1323 ucSlotIdx);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301324 if(VOS_TRUE == pClientSTA->ucIsReplayCheckValid)
Jeff Johnson295189b2012-06-20 16:38:30 -07001325 {
1326 WLANTL_FillReplayCounter(currentReorderInfo,
1327 ullreplayCounter, ucSlotIdx);
1328 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001329 if(VOS_STATUS_E_RESOURCES == status)
1330 {
1331 /* This is the case slot index is already cycle one route, route all the frames Qed */
1332 vosPktIdx = NULL;
1333 status = WLANTL_ChainFrontPkts(ucFwdIdx,
1334 WLANTL_OPCODE_FWDALL_QCUR,
1335 &vosPktIdx,
1336 currentReorderInfo,
1337 pTLCb);
1338 if(!VOS_IS_STATUS_SUCCESS(status))
1339 {
1340 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make frame chain fail %d", status));
1341 lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
1342 if(!VOS_IS_STATUS_SUCCESS(lockStatus))
1343 {
1344 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
1345 return lockStatus;
1346 }
1347 return status;
1348 }
1349 status = vos_pkt_chain_packet(vosPktIdx, *vosDataBuff, 1);
1350 *vosDataBuff = vosPktIdx;
1351 currentReorderInfo->pendingFramesCount = 0;
1352 }
1353 else
1354 {
1355 /* Since current Frame is Qed, no frame will be routed */
1356 *vosDataBuff = NULL;
1357 }
1358 break;
1359
1360 case WLANTL_OPCODE_FWDBUF_QUEUECUR:
1361 vosPktIdx = NULL;
1362 status = WLANTL_ChainFrontPkts(ucFwdIdx,
1363 WLANTL_OPCODE_FWDBUF_QUEUECUR,
1364 &vosPktIdx,
1365 currentReorderInfo,
1366 pTLCb);
1367 if(!VOS_IS_STATUS_SUCCESS(status))
1368 {
1369 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make chain with buffered frame fail %d",
1370 status));
1371 lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
1372 if(!VOS_IS_STATUS_SUCCESS(lockStatus))
1373 {
1374 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
1375 return lockStatus;
1376 }
1377 return status;
1378 }
1379 //This opCode means the window shift. Enforce the current Index
1380 currentReorderInfo->ucCIndex = ucFwdIdx;
1381
1382 status = WLANTL_QueueCurrent(currentReorderInfo,
1383 vosDataBuff,
1384 ucSlotIdx);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301385 if(VOS_TRUE == pClientSTA->ucIsReplayCheckValid)
Jeff Johnson295189b2012-06-20 16:38:30 -07001386 {
1387 WLANTL_FillReplayCounter(currentReorderInfo,
1388 ullreplayCounter, ucSlotIdx);
1389 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001390 if(VOS_STATUS_E_RESOURCES == status)
1391 {
1392 vos_pkt_return_packet(vosPktIdx);
1393 /* This is the case slot index is already cycle one route, route all the frames Qed */
1394 vosPktIdx = NULL;
1395 status = WLANTL_ChainFrontPkts(ucFwdIdx,
1396 WLANTL_OPCODE_FWDALL_QCUR,
1397 &vosPktIdx,
1398 currentReorderInfo,
1399 pTLCb);
1400 if(!VOS_IS_STATUS_SUCCESS(status))
1401 {
1402 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make frame chain fail %d", status));
1403 lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
1404 if(!VOS_IS_STATUS_SUCCESS(lockStatus))
1405 {
1406 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
1407 return lockStatus;
1408 }
1409 return status;
1410 }
1411 status = vos_pkt_chain_packet(vosPktIdx, *vosDataBuff, 1);
1412 *vosDataBuff = vosPktIdx;
1413 currentReorderInfo->pendingFramesCount = 0;
1414 }
1415 *vosDataBuff = vosPktIdx;
1416 break;
1417
1418 case WLANTL_OPCODE_FWDBUF_DROPCUR:
1419 vosPktIdx = NULL;
1420 status = WLANTL_ChainFrontPkts(ucFwdIdx,
1421 WLANTL_OPCODE_FWDBUF_DROPCUR,
1422 &vosPktIdx,
1423 currentReorderInfo,
1424 pTLCb);
1425 if(!VOS_IS_STATUS_SUCCESS(status))
1426 {
1427 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make chain with buffered frame fail %d",
1428 status));
1429 lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
1430 if(!VOS_IS_STATUS_SUCCESS(lockStatus))
1431 {
1432 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
1433 return lockStatus;
1434 }
1435 return status;
1436 }
1437
1438 //Since BAR frame received, set the index to the right location
1439 currentReorderInfo->ucCIndex = ucFwdIdx;
1440
1441 /* Current frame has to be dropped, BAR frame */
1442 status = vos_pkt_return_packet(*vosDataBuff);
1443 if(!VOS_IS_STATUS_SUCCESS(status))
1444 {
1445 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Drop BAR frame fail %d",
1446 status));
1447 lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
1448 if(!VOS_IS_STATUS_SUCCESS(lockStatus))
1449 {
1450 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
1451 return lockStatus;
1452 }
1453 return status;
1454 }
1455 *vosDataBuff = vosPktIdx;
1456 break;
1457
1458 case WLANTL_OPCODE_FWDALL_DROPCUR:
1459 vosPktIdx = NULL;
1460 status = WLANTL_ChainFrontPkts(ucFwdIdx,
1461 WLANTL_OPCODE_FWDALL_DROPCUR,
1462 &vosPktIdx,
1463 currentReorderInfo,
1464 pTLCb);
1465 if(!VOS_IS_STATUS_SUCCESS(status))
1466 {
1467 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make chain with buffered frame fail %d",
1468 status));
1469 lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
1470 if(!VOS_IS_STATUS_SUCCESS(lockStatus))
1471 {
1472 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
1473 return lockStatus;
1474 }
1475 return status;
1476 }
1477
1478 //Since BAR frame received and beyond cur window, set the index to the right location
1479 currentReorderInfo->ucCIndex = 0;
1480
1481 status = vos_pkt_return_packet(*vosDataBuff);
1482 if(!VOS_IS_STATUS_SUCCESS(status))
1483 {
1484 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Drop BAR frame fail %d",
1485 status));
1486 lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
1487 if(!VOS_IS_STATUS_SUCCESS(lockStatus))
1488 {
1489 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
1490 return lockStatus;
1491 }
1492 return status;
1493 }
1494
1495 *vosDataBuff = vosPktIdx;
1496 break;
1497
1498 case WLANTL_OPCODE_FWDALL_QCUR:
1499 vosPktIdx = NULL;
1500 status = WLANTL_ChainFrontPkts(currentReorderInfo->winSize,
1501 WLANTL_OPCODE_FWDALL_DROPCUR,
1502 &vosPktIdx,
1503 currentReorderInfo,
1504 pTLCb);
1505 if(!VOS_IS_STATUS_SUCCESS(status))
1506 {
1507 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make chain with buffered frame fail %d",
1508 status));
1509 lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
1510 if(!VOS_IS_STATUS_SUCCESS(lockStatus))
1511 {
1512 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
1513 return lockStatus;
1514 }
1515 return status;
1516 }
1517 status = WLANTL_QueueCurrent(currentReorderInfo,
1518 vosDataBuff,
1519 ucSlotIdx);
Madan Mohan Koyylamudi3b8400c2013-01-24 17:47:01 +05301520 if(VOS_TRUE == pClientSTA->ucIsReplayCheckValid)
Jeff Johnson295189b2012-06-20 16:38:30 -07001521 {
1522 WLANTL_FillReplayCounter(currentReorderInfo,
1523 ullreplayCounter, ucSlotIdx);
1524 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001525 if(!VOS_IS_STATUS_SUCCESS(status))
1526 {
1527 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Q Current frame fail %d",
1528 status));
1529 lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
1530 if(!VOS_IS_STATUS_SUCCESS(lockStatus))
1531 {
1532 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
1533 return lockStatus;
1534 }
1535 return status;
1536 }
1537 currentReorderInfo->ucCIndex = ucSlotIdx;
1538 *vosDataBuff = vosPktIdx;
1539 break;
1540
1541 case WLANTL_OPCODE_TEARDOWN:
1542 // do we have a procedure in place to teardown BA?
1543
1544 // fall through to drop the current packet
1545 case WLANTL_OPCODE_DROPCUR:
1546 vos_pkt_return_packet(*vosDataBuff);
1547 *vosDataBuff = NULL;
1548 break;
1549
1550 default:
1551 break;
1552 }
1553
1554 /* Check the available VOS RX buffer size
1555 * If remaining VOS RX buffer is too few, have to make space
1556 * Route all the Qed frames upper layer
1557 * Otherwise, RX thread could be stall */
1558 vos_pkt_get_available_buffer_pool(VOS_PKT_TYPE_RX_RAW, &rxFree);
Yue Mad8cac142013-03-28 11:33:46 -07001559 if(WLANTL_BA_MIN_FREE_RX_VOS_BUFFER >= rxFree)
Jeff Johnson295189b2012-06-20 16:38:30 -07001560 {
Yue Ma13da2012013-05-27 17:42:05 -07001561 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, "RX Free: %d", rxFree));
1562 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, "RX free buffer count is too low, Pending frame count is %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001563 currentReorderInfo->pendingFramesCount));
1564 vosPktIdx = NULL;
1565 status = WLANTL_ChainFrontPkts(ucFwdIdx,
1566 WLANTL_OPCODE_FWDALL_DROPCUR,
1567 &vosPktIdx,
1568 currentReorderInfo,
1569 pTLCb);
1570 if(!VOS_IS_STATUS_SUCCESS(status))
1571 {
1572 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make frame chain fail %d", status));
1573 lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
1574 if(!VOS_IS_STATUS_SUCCESS(lockStatus))
1575 {
1576 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
1577 return lockStatus;
1578 }
1579 return status;
1580 }
1581 if(NULL != *vosDataBuff)
1582 {
1583 TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"Already something, Chain it"));
1584 vos_pkt_chain_packet(*vosDataBuff, vosPktIdx, 1);
1585 }
1586 else
1587 {
1588 *vosDataBuff = vosPktIdx;
1589 }
1590 currentReorderInfo->pendingFramesCount = 0;
1591 }
1592
1593 /*
1594 * Current aging timer logic:
1595 * 1) if we forwarded any packets and the timer is running:
1596 * stop the timer
1597 * 2) if there are packets queued and the timer is not running:
1598 * start the timer
Leo Chang2301cff2014-01-03 20:31:46 -08001599 * 3) if timer is running and no pending frame:
1600 * stop the timer
Jeff Johnson295189b2012-06-20 16:38:30 -07001601 */
1602 timerState = vos_timer_getCurrentState(&currentReorderInfo->agingTimer);
1603 if ((VOS_TIMER_STATE_RUNNING == timerState) &&
Leo Chang2301cff2014-01-03 20:31:46 -08001604 ((ucCIndexOrig != currentReorderInfo->ucCIndex) ||
1605 (0 == currentReorderInfo->pendingFramesCount)))
Jeff Johnson295189b2012-06-20 16:38:30 -07001606 {
1607 TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"HOLE filled, Pending Frames Count %d",
1608 currentReorderInfo->pendingFramesCount));
1609
1610 // we forwarded some packets so stop aging the current hole
1611 timerStatus = vos_timer_stop(&currentReorderInfo->agingTimer);
1612 timerState = VOS_TIMER_STATE_STOPPED;
1613
1614 // ignore the returned status since there is a race condition
1615 // whereby between the time we called getCurrentState() and the
1616 // time we call stop() the timer could have fired. In that case
1617 // stop() will return an error, but we don't care since the
1618 // timer has stopped
1619 }
1620
1621 if (currentReorderInfo->pendingFramesCount > 0)
1622 {
1623 if (VOS_TIMER_STATE_STOPPED == timerState)
1624 {
1625 TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"There is a new HOLE, Pending Frames Count %d",
1626 currentReorderInfo->pendingFramesCount));
Dhanashri Atred8c20a32014-01-03 17:20:55 -08001627 ac = WLANTL_TID_2_AC[ucTid];
1628 if (WLANTL_AC_INVALID(ac))
1629 {
1630 reorderTime = WLANTL_BA_REORDERING_AGING_TIMER;
1631 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid AC %d using default reorder time %d",
1632 ac, reorderTime));
1633 }
1634 else
1635 {
1636 reorderTime = pTLCb->tlConfigInfo.ucReorderAgingTime[ac];
1637 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001638 timerStatus = vos_timer_start(&currentReorderInfo->agingTimer,
Dhanashri Atred8c20a32014-01-03 17:20:55 -08001639 reorderTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07001640 if(!VOS_IS_STATUS_SUCCESS(timerStatus))
1641 {
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05301642 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Timer start fail: %d", timerStatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07001643 lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
1644 if(!VOS_IS_STATUS_SUCCESS(lockStatus))
1645 {
1646 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
1647 return lockStatus;
1648 }
1649 return timerStatus;
1650 }
1651 }
1652 else
1653 {
1654 // we didn't forward any packets and the timer was already
1655 // running so we're still aging the same hole
1656 TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"Still HOLE, Pending Frames Count %d",
1657 currentReorderInfo->pendingFramesCount));
1658 }
1659 }
1660
1661 lockStatus = vos_lock_release(&currentReorderInfo->reorderLock);
1662 if(!VOS_IS_STATUS_SUCCESS(lockStatus))
1663 {
1664 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_MSDUReorder, Release LOCK Fail"));
1665 return lockStatus;
1666 }
1667 return VOS_STATUS_SUCCESS;
1668}/* WLANTL_MSDUReorder */
1669
1670
1671/*==========================================================================
1672 Utility functions
1673 ==========================================================================*/
1674
1675/*==========================================================================
1676
1677 FUNCTION WLANTL_QueueCurrent
1678
1679 DESCRIPTION
1680 It will queue a packet at a given slot index in the MSDU reordering list.
1681
1682 DEPENDENCIES
1683
1684 PARAMETERS
1685
1686 IN
1687 pwBaReorder: pointer to the BA reordering session info
1688 vosDataBuff: data buffer to be queued
1689 ucSlotIndex: slot index
1690
1691 RETURN VALUE
1692 The result code associated with performing the operation
1693
1694 VOS_STATUS_SUCCESS: Everything is OK
1695
1696
1697 SIDE EFFECTS
1698
1699============================================================================*/
1700VOS_STATUS WLANTL_QueueCurrent
1701(
1702 WLANTL_BAReorderType* pwBaReorder,
1703 vos_pkt_t** vosDataBuff,
1704 v_U8_t ucSlotIndex
1705)
1706{
1707 VOS_STATUS status = VOS_STATUS_SUCCESS;
1708
1709 TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"vos Packet has to be Qed 0x%p",
1710 *vosDataBuff));
1711 if(NULL != pwBaReorder->reorderBuffer->arrayBuffer[ucSlotIndex])
1712 {
Arif Hussainf2b00992013-11-17 21:46:15 -08001713 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"One Cycle rounded, lost many frames already, not in Q %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001714 pwBaReorder->pendingFramesCount));
1715 return VOS_STATUS_E_RESOURCES;
1716 }
1717
1718 pwBaReorder->reorderBuffer->arrayBuffer[ucSlotIndex] =
1719 (v_PVOID_t)(*vosDataBuff);
1720 pwBaReorder->pendingFramesCount++;
1721 TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"Assigned, Pending Frames %d at slot %d, dataPtr 0x%x",
1722 pwBaReorder->pendingFramesCount,
1723 ucSlotIndex,
1724 pwBaReorder->reorderBuffer->arrayBuffer[ucSlotIndex]));
1725
1726 return status;
1727}/*WLANTL_QueueCurrent*/
1728
1729/*==========================================================================
1730
1731 FUNCTION WLANTL_ChainFrontPkts
1732
1733 DESCRIPTION
1734 It will remove all the packets from the front of a vos list and chain
1735 them to a vos pkt .
1736
1737 DEPENDENCIES
1738
1739 PARAMETERS
1740
1741 IN
1742 ucCount: number of packets to extract
1743 pwBaReorder: pointer to the BA reordering session info
1744
1745 OUT
1746 vosDataBuff: data buffer containing the extracted chain of packets
1747
1748 RETURN VALUE
1749 The result code associated with performing the operation
1750
1751 VOS_STATUS_SUCCESS: Everything is OK
1752
1753
1754 SIDE EFFECTS
1755
1756============================================================================*/
1757VOS_STATUS WLANTL_ChainFrontPkts
1758(
1759 v_U32_t fwdIndex,
1760 v_U8_t opCode,
1761 vos_pkt_t **vosDataBuff,
1762 WLANTL_BAReorderType *pwBaReorder,
1763 WLANTL_CbType *pTLCb
1764)
1765{
1766 VOS_STATUS status = VOS_STATUS_SUCCESS;
1767 v_U32_t idx;
1768 v_PVOID_t currentDataPtr = NULL;
1769 int negDetect;
1770#ifdef WLANTL_REORDER_DEBUG_MSG_ENABLE
1771#define WLANTL_OUT_OF_WINDOW_IDX 65
1772 v_U32_t frameIdx[2] = {0, 0}, ffidx = fwdIndex, idx2 = WLANTL_OUT_OF_WINDOW_IDX;
1773 int pending = pwBaReorder->pendingFramesCount, start = WLANTL_OUT_OF_WINDOW_IDX, end;
1774#endif
1775
1776 if(pwBaReorder->ucCIndex >= fwdIndex)
1777 {
1778 fwdIndex += pwBaReorder->winSize;
1779 }
1780
1781 if((WLANTL_OPCODE_FWDALL_DROPCUR == opCode) ||
1782 (WLANTL_OPCODE_FWDALL_QCUR == opCode))
1783 {
1784 fwdIndex = pwBaReorder->ucCIndex + pwBaReorder->winSize;
1785 }
1786
1787 TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"Current Index %d, FWD Index %d, reorderBuffer 0x%p",
1788 pwBaReorder->ucCIndex % pwBaReorder->winSize,
1789 fwdIndex % pwBaReorder->winSize,
1790 pwBaReorder->reorderBuffer));
1791
1792 negDetect = pwBaReorder->pendingFramesCount;
1793 for(idx = pwBaReorder->ucCIndex; idx <= fwdIndex; idx++)
1794 {
1795 currentDataPtr =
1796 pwBaReorder->reorderBuffer->arrayBuffer[idx % pwBaReorder->winSize];
1797 if(NULL != currentDataPtr)
1798 {
1799#ifdef WLANTL_REORDER_DEBUG_MSG_ENABLE
1800 idx2 = (idx >= pwBaReorder->winSize) ? (idx - pwBaReorder->winSize) : idx;
1801 frameIdx[idx2 / 32] |= 1 << (idx2 % 32);
1802 if(start == WLANTL_OUT_OF_WINDOW_IDX) start = idx2;
1803#endif
1804 TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"There is buffered frame %d",
1805 idx % pwBaReorder->winSize));
1806 if(NULL == *vosDataBuff)
1807 {
1808 *vosDataBuff = (vos_pkt_t *)currentDataPtr;
1809 TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"This is new head %d",
1810 idx % pwBaReorder->winSize));
1811 }
1812 else
1813 {
1814 TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"There is bufered Just add %d",
1815 idx % pwBaReorder->winSize));
1816 vos_pkt_chain_packet(*vosDataBuff,
1817 (vos_pkt_t *)currentDataPtr,
1818 VOS_TRUE);
1819 }
1820 pwBaReorder->reorderBuffer->arrayBuffer[idx % pwBaReorder->winSize]
1821 = NULL;
1822 pwBaReorder->pendingFramesCount--;
1823 negDetect--;
1824 if(negDetect < 0)
1825 {
Arif Hussainf2b00992013-11-17 21:46:15 -08001826 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"This is not possible, some balance has problem"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001827 VOS_ASSERT(0);
1828 return VOS_STATUS_E_FAULT;
1829 }
1830 TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"Slot Index %d, set as NULL, Pending Frames %d",
1831 idx % pwBaReorder->winSize,
1832 pwBaReorder->pendingFramesCount
1833 ));
1834 pwBaReorder->ucCIndex = (idx + 1) % pwBaReorder->winSize;
1835 }
1836 else
1837 {
1838 TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"Empty Array %d",
1839 idx % pwBaReorder->winSize));
1840 }
1841 TLLOG4(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,"Current Index %d, winSize %d",
1842 pwBaReorder->ucCIndex,
1843 pwBaReorder->winSize
1844 ));
1845 }
1846
1847#ifdef WLANTL_REORDER_DEBUG_MSG_ENABLE
1848 end = idx2;
1849
1850 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Fwd 0x%08X-%08X opCode %d fwdIdx %d windowSize %d pending frame %d fw no. %d from idx %d to %d",
1851 frameIdx[1], frameIdx[0], opCode, ffidx, pwBaReorder->winSize, pending, pending - negDetect, start, end));
1852#endif
1853
1854 return status;
1855}/*WLANTL_ChainFrontPkts*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001856/*==========================================================================
1857
1858 FUNCTION WLANTL_FillReplayCounter
1859
1860 DESCRIPTION
1861 It will fill repaly counter at a given slot index in the MSDU reordering list.
1862
1863 DEPENDENCIES
1864
1865 PARAMETERS
1866
1867 IN
1868 pwBaReorder : pointer to the BA reordering session info
1869 replayCounter: replay counter to be filled
1870 ucSlotIndex : slot index
1871
1872 RETURN VALUE
1873 NONE
1874
1875
1876 SIDE EFFECTS
1877 NONE
1878
1879 ============================================================================*/
1880void WLANTL_FillReplayCounter
1881(
1882 WLANTL_BAReorderType* pwBaReorder,
1883 v_U64_t ullreplayCounter,
1884 v_U8_t ucSlotIndex
1885)
1886{
1887
1888 //BAMSGDEBUG("replay counter to be filled in Qed frames %llu",
1889 //replayCounter, 0, 0);
1890
1891 pwBaReorder->reorderBuffer->ullReplayCounter[ucSlotIndex] = ullreplayCounter;
1892 //BAMSGDEBUG("Assigned, replay counter Pending Frames %d at slot %d, replay counter[0x%llX]\n",
1893 //pwBaReorder->pendingFramesCount,
1894 //ucSlotIndex,
1895 //pwBaReorder->reorderBuffer->ullReplayCounter);
1896 return;
1897}/*WLANTL_FillReplayCounter*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001898