1981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* 2981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * RxQueue.c 3981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 4981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. 5981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * All rights reserved. 6981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 7981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Redistribution and use in source and binary forms, with or without 8981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * modification, are permitted provided that the following conditions 9981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * are met: 10981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 11981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * * Redistributions of source code must retain the above copyright 12981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * notice, this list of conditions and the following disclaimer. 13981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * * Redistributions in binary form must reproduce the above copyright 14981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * notice, this list of conditions and the following disclaimer in 15981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * the documentation and/or other materials provided with the 16981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * distribution. 17981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * * Neither the name Texas Instruments nor the names of its 18981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * contributors may be used to endorse or promote products derived 19981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * from this software without specific prior written permission. 20981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 21981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 33981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 34981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 35981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/** \file RxQueue.c 36981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \brief RX Queue module that responsible to support re-ordering of received packets to upper layers. 37981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 38981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \see RxQueue.h 39981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 40981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define __FILE_ID__ FILE_ID_98 41981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "tidef.h" 42981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "osApi.h" 43981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "report.h" 44981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "RxBuf.h" 45981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "TWDriver.h" 46981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "public_descriptors.h" 47981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 48981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/************************ static definition declaration *****************************/ 49981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define RX_QUEUE_ARRAY_SIZE 8 50981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define RX_QUEUE_ARRAY_SIZE_BIT_MASK 0x7 /* RX_QUEUE_ARRAY_SIZE -1 */ 51981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define RX_QUEUE_WIN_SIZE RX_QUEUE_ARRAY_SIZE 52981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 53653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt#define BA_SESSION_IS_A_BIGGER_THAN_B(A,B) (((((A)-(B)) & 0xFFF) < 0x7FF) && ((A)!=(B))) 54653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt#define BA_SESSION_IS_A_BIGGER_EQUAL_THAN_B(A,B) (((((A)-(B)) & 0xFFF) < 0x7FF)) 55653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt#define SEQ_NUM_WRAP 0x1000 56653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt#define SEQ_NUM_MASK 0xFFF 57653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt 58981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 59981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/************************ static structures declaration *****************************/ 60981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* structure describe one entry of save packet information in the packet queue array */ 61981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidttypedef struct 62981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 63981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt void *pPacket; /* Packet address of the packet */ 64981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_STATUS tStatus; /* RxXfer status. */ 65981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT16 uFrameSn; 66981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} TRxQueuePacketEntry; 67981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 68981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* structure describe set of data that one Tid, also including the arras himself */ 69981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidttypedef struct 70981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 71981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* array packets Entries */ 72981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRxQueuePacketEntry aPaketsQueue [RX_QUEUE_ARRAY_SIZE]; 73981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* TID BA state */ 74981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_BOOL aTidBaEstablished; 75981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* index that winStar point on */ 76981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT32 aWinStartArrayInex; 77981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* windows size */ 78981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT32 aTidWinSize; 79981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* expected sequence number (ESN) */ 80981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT16 aTidExpectedSn; 81981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} TRxQueueTidDataBase; 82981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 83981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* structure describe set of data that assist of manage one SA RxQueue arrays */ 84981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidttypedef struct 85981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 86981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRxQueueTidDataBase tSa1ArrayMng [MAX_NUM_OF_802_1d_TAGS]; 87981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} TRxQueueArraysMng; 88981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 89981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* main RxQueue structure in order to management the packets disordered array. */ 90981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidttypedef struct 91981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 92981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_HANDLE hOs; /* OS handler */ 93981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_HANDLE hReport; /* Report handler */ 94981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRxQueueArraysMng tRxQueueArraysMng; /* manage each Source Address RxQueue arrays */ 95981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TPacketReceiveCb tReceivePacketCB; /* Receive packets CB address */ 96981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_HANDLE hReceivePacketCB_handle; /* Receive packets CB handler */ 97981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 98981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} TRxQueue; 99981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 100981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/************************ static function declaration *****************************/ 101981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_STATUS RxQueue_PassPacket (TI_HANDLE hRxQueue, TI_STATUS tStatus, const void *pBuffer); 102981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 103981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/** 104981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \fn RxQueue_Create() 105981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \brief Create the RxQueue module. 106981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 107981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Allocate and clear the RxQueue module object. 108981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 109981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param hOs - Handle to Os Abstraction Layer 110981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \return Handle of the allocated object 111981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \sa RxQueue_Destroy 112981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 113981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_HANDLE RxQueue_Create (TI_HANDLE hOs) 114981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 115981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRxQueue *pRxQueue; 116981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 117981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* allocate module object */ 118981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pRxQueue = os_memoryAlloc (hOs, sizeof(TRxQueue)); 119981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 120981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (!pRxQueue) 121981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 122981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt WLAN_OS_REPORT (("RxQueue_Create(): Allocation failed!!\n")); 123981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return NULL; 124981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 125981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 126981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_memoryZero (hOs, pRxQueue, (sizeof(TRxQueue))); 127981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 128981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pRxQueue->hOs = hOs; 129981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 130981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return (pRxQueue); 131981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 132981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 133981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 134981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/** 135981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \fn RxQueue_Destroy() 136981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \brief Destroy the module. 137981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 138981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Free the module's queues and object. 139981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 140981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param hRxQueue - The module object 141981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \return TI_OK on success or TI_NOK on failure 142981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \sa RxQueue_Create 143981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 144981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS RxQueue_Destroy (TI_HANDLE hRxQueue) 145981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 146981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRxQueue *pRxQueue = (TRxQueue *)hRxQueue; 147981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 148981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* free module object */ 149981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_memoryFree (pRxQueue->hOs, pRxQueue, sizeof(TRxQueue)); 150981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 151981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return TI_OK; 152981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 153981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 154981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 155981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/** 156981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \fn RxQueue_Init() 157981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \brief Init required handles 158981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 159981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Init required handles and module variables. 160981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 161981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \note 162981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param hRxQueue - The module object 163981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param hReport - Report module Handles 164981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \return TI_OK on success or TI_NOK on failure 165981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \sa 166981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 167981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS RxQueue_Init (TI_HANDLE hRxQueue, TI_HANDLE hReport) 168981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 169981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRxQueue *pRxQueue = (TRxQueue *)hRxQueue; 170981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 171981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pRxQueue->hReport = hReport; 172653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt 173981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return TI_OK; 174981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 175981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 176981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 177981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/** 178981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \fn RxQueue_Register_CB() 179981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \brief Register the function to be called for received Rx. 180981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 181981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \note 182981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param hRxQueue - The module object 183981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param CallBackID - event ID 184981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param CBFunc - function address. 185981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param CBObj - function parameter. 186981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \return TI_OK on success or TI_NOK on failure 187981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \sa 188981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 189981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid RxQueue_Register_CB (TI_HANDLE hRxQueue, TI_UINT32 uCallBackID, void *CBFunc, TI_HANDLE CBObj) 190981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 191981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRxQueue* pRxQueue = (TRxQueue *)hRxQueue; 192981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 193981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE1(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION , "RxQueue_Register_CB: CallBack ID = 0x%x\n", uCallBackID); 194981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 195981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt switch(uCallBackID) 196981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 197981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt case TWD_INT_RECEIVE_PACKET: 198981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pRxQueue->tReceivePacketCB = (TPacketReceiveCb)CBFunc; 199981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pRxQueue->hReceivePacketCB_handle = CBObj; 200981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 201981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 202981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt default: 203981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE0(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_Register_CB: Illegal value\n"); 204981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 205981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 206981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 207981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 208981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/** 209981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \fn RxQueue_CloseBaSession () 210981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \brief Close BA session receiver and pass all packets in the TID queue to upper layer. 211981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 212981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \note 213981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param hRxQueue - RxQueue handle. 214981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param uFrameTid - TID session. 215981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \return None 216981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \sa 217981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 218981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid RxQueue_CloseBaSession(TI_HANDLE hRxQueue, TI_UINT8 uFrameTid) 219981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 220981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRxQueue *pRxQueue = (TRxQueue *)hRxQueue; 221981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT32 i; 222981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /*set the SA Tid pointer */ 223981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRxQueueTidDataBase *pTidDataBase = &(pRxQueue->tRxQueueArraysMng.tSa1ArrayMng[uFrameTid]); 224981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 225981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* TID illegal value ? */ 226981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (uFrameTid >= MAX_NUM_OF_802_1d_TAGS) 227981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 228981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_CloseBaSession: BA event - DELBA frame with TID value too big, TID = %d\n", uFrameTid); 229981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 230981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 231981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 232981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 233981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if(pTidDataBase->aTidBaEstablished == TI_TRUE) 234981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 235981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* clean BA session */ 236981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aTidBaEstablished = TI_FALSE; 237981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 238981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* pass all valid entries at the array */ 239981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt for (i = 0; (i < RX_QUEUE_ARRAY_SIZE) && (i < RX_QUEUE_WIN_SIZE); i++) 240981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 241981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket != NULL) 242981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 243981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxQueue_PassPacket (pRxQueue, 244981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].tStatus, 245981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket); 246981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 247981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket = NULL; 248981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 249981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 250981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aWinStartArrayInex ++; 251981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 252981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* aWinStartArrayInex % RX_QUEUE_ARRAY_SIZE */ 253981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aWinStartArrayInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK; 254981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 255981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 256981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 257981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 258981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 259981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/** 260981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \fn RxQueue_PassPacket() 261981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \brief Responsible on decode packet parameters and pass it to upper layer. 262981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 263981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \note 264981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param hRxQueue - RxQueue handle. 265981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param aStatus - RxXfer status that indicate if the upper layer should free the packet or use it. 266981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param pFrame - paket address of the packet 267981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param pRxParams - address to structure of the Rx Descriptor received by FW. 268981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \return TI_OK on success or TI_NOK on failure 269981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \sa 270981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 271981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_STATUS RxQueue_PassPacket (TI_HANDLE hRxQueue, TI_STATUS tStatus, const void *pBuffer) 272981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 273981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 274981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRxQueue *pRxQueue = (TRxQueue *)hRxQueue; 275981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 276981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (tStatus == TI_OK) 277981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 278981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Get the mac header location in the packet Buffer */ 279981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt dot11_header_t *pMacHdr = (dot11_header_t *)(TI_UINT8*)RX_BUF_DATA(pBuffer); 280981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 281981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Handle endian for the frame control fields */ 282981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pMacHdr->fc = ENDIAN_HANDLE_WORD(pMacHdr->fc); 283981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pMacHdr->duration = ENDIAN_HANDLE_WORD(pMacHdr->duration); 284981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pMacHdr->seqCtrl = ENDIAN_HANDLE_WORD(pMacHdr->seqCtrl); 285981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 286981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 287981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 288981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxIfDescriptor_t *pRxParams = (RxIfDescriptor_t*)pBuffer; 289981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 290981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pRxParams->status &= ~RX_DESC_STATUS_MASK; 291981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pRxParams->status |= RX_DESC_STATUS_DRIVER_RX_Q_FAIL; 292981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 293981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 294981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION , "RxQueue_PassPacket: call TWD_OWNER_RX_QUEUE CB. In std rxData_ReceivePacket()\n"); 295981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 296981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Set the packet to upper layer */ 297981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* if the packet status not success it will be discarded */ 298981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pRxQueue->tReceivePacketCB (pRxQueue->hReceivePacketCB_handle, pBuffer); 299981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 300981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return TI_OK; 301981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 302981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 303981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 304981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/** 305981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \fn RxQueue_ReceivePacket() 306981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \brief Main function of the RxQueue module. 307981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Responsible on reorder of the packets from the RxXfer to the RX module. 308981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Call from RxXfer in order to pass packet to uppers layers. 309981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * In order to save disordered packets the module use array of structures per TID 310981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * that each entry describe a packet. The array elements is sorted in the way that 311981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * the winStart array index represent always the winStar packet and the lowest SN. 312981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Each increment index represent index at the BA window. Array index winEnd always 313981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * represent winEnd packet. The indexes of winStart and winEnd handled in cyclic manner. 314981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * The function functionality devided to parts: 315981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Part 1: 316981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * in case the modulo receive packet with SN equal to winStart: 317981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * " pass it to upper layers 318981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * " increases winStart and array index winStart 319981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * " validate that all sequential queue packet are pass to the upper layers. 320981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Part 2: 321981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * in case the modulo receive packet that SN between winStart to winEnd: 322981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * " Save it sorted at the array at index: Save index = ((SN - winStart) + index array winStart) % arraySize. 323981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Part 3: 324981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * in case the modulo receive packet that SN higher then winEnd: 325981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * " Update winStart and WinEnd. 326981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * " Save it sorted at the array in index winEnd index. 327981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * " Pass to the upper layers all packets at the array indexes from old winStart index to the updated winStart index. 328981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Part 4 + 5: 329981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * in case the modulo receive BA event packet: 330981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * " Update winStart and WinEnd 331981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * " Pass to the upper layers all packets at the array indexes from old winStart index to the updated winStart index. 332981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * " Free BA event packet via pass it to upper layers with error status. 333981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 334981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \note 335981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param hRxQueue - RxQueue handle. 336981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param aStatus - RxXfer status that indicate if the upper layer should free the packet or use it. 337981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param pBuffer - paket address of the packet 338981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \return None 339981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \sa 340981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 341981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid RxQueue_ReceivePacket (TI_HANDLE hRxQueue, const void * pBuffer) 342981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 343981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRxQueue *pRxQueue = (TRxQueue *)hRxQueue; 344981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxIfDescriptor_t *pRxParams = (RxIfDescriptor_t*)pBuffer; 345981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT8 *pFrame = RX_BUF_DATA((TI_UINT8 *)pBuffer); 346981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_STATUS tStatus = TI_OK; 347981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt dot11_header_t *pHdr = (dot11_header_t *)pFrame; 348981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT16 uQosControl; 349981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 350981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt COPY_WLAN_WORD(&uQosControl, &pHdr->qosControl); /* copy with endianess handling. */ 351981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 352981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* 353653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt * Retrieving the TAG from the packet itself and not from the Rx Descriptor since by now it is not correct 354981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Note: in the DR TAG_CLASS_EAPOL packet handled as TAG_CLASS_QOS_DATA 355981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 356981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (IS_QOS_FRAME(*(TI_UINT16*)pFrame) && (pRxParams->packet_class_tag != TAG_CLASS_QOS_DATA) && (pRxParams->packet_class_tag != TAG_CLASS_AMSDU)) 357981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 358acd89e8f547322db23ab0f7c3775082654c4b13bDmitry Shmidt TRACE1(pRxQueue->hReport, REPORT_SEVERITY_WARNING, "RxQueue_ReceivePacket: BAD CLASS TAG =0x%x from FW.\n", pRxParams->packet_class_tag); 359981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 360981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Get AMSDU bit from frame */ 361981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if( uQosControl & DOT11_QOS_CONTROL_FIELD_A_MSDU_BITS) 362981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 363981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pRxParams->packet_class_tag = TAG_CLASS_AMSDU; 364981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 365981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 366981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 367981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pRxParams->packet_class_tag = TAG_CLASS_QOS_DATA; 368981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 369acd89e8f547322db23ab0f7c3775082654c4b13bDmitry Shmidt } 370981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 371981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* 372981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * packet doesn't need reorder ? 373981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 374981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if ((pRxParams->packet_class_tag != TAG_CLASS_QOS_DATA) && (pRxParams->packet_class_tag != TAG_CLASS_BA_EVENT) && (pRxParams->packet_class_tag != TAG_CLASS_AMSDU)) 375981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 376acd89e8f547322db23ab0f7c3775082654c4b13bDmitry Shmidt TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: pass packet without reorder.\n"); 377981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 378981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxQueue_PassPacket (pRxQueue, tStatus, pBuffer); 379981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 380981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 381981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 382981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 383981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 384981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* 385981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * pRxParams->type == TAG_CLASS_QOS_DATA ? 386981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 387981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if ((pRxParams->packet_class_tag == TAG_CLASS_QOS_DATA) || (pRxParams->packet_class_tag == TAG_CLASS_AMSDU)) 388981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 389981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT8 uFrameTid; 390981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT16 uFrameSn; 391653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt TI_UINT16 uSequenceControl; 392981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRxQueueTidDataBase *pTidDataBase; 393981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 394981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Get TID from frame */ 395981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt uFrameTid = uQosControl & DOT11_QOS_CONTROL_FIELD_TID_BITS; 396981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 397981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* TID illegal value ? */ 398981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (uFrameTid >= MAX_NUM_OF_802_1d_TAGS) 399981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 400981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR, "RxQueue_ReceivePacket: TID value too big, TID = %d. packet discarded!\n",uFrameTid); 401981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 402981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer); 403981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 404981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 405981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 406981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 407981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /*set the SA Tid pointer */ 408981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase = &(pRxQueue->tRxQueueArraysMng.tSa1ArrayMng[uFrameTid]); 409981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 410981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* TID legal value */ 411981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* packet TID BA not established ? */ 412981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (pTidDataBase->aTidBaEstablished != TI_TRUE) 413981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 414981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: pass packet without reorder.\n"); 415981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 416981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxQueue_PassPacket (pRxQueue, tStatus, pBuffer); 417981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 418981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 419981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 420981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 421981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* packet TID BA established */ 422981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Get Sequence Number from frame */ 423981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt COPY_WLAN_WORD(&uSequenceControl, &pHdr->seqCtrl); /* copy with endianess handling. */ 424981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt uFrameSn = (uSequenceControl & DOT11_SC_SEQ_NUM_MASK) >> 4; 425981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 426981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* 427981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * note: 428981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * the FW never send paket, in establish TID BA, that the SN less then ESN !!! 429981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 430981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 431981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* frame Sequence Number is the expected one ? */ 432981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (uFrameSn == pTidDataBase->aTidExpectedSn) 433981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 434981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: frame Sequence Number == expected one Sequence Number.\n"); 435981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 436981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* pass the packet */ 437981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxQueue_PassPacket (pRxQueue, tStatus, pBuffer); 438981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 439981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aTidExpectedSn++; 440653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt pTidDataBase->aTidExpectedSn &= 0xfff; 441981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 442981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* increase the ArrayInex to the next */ 443981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aWinStartArrayInex++; 444981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 445981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* aWinStartArrayInex % RX_QUEUE_ARRAY_SIZE */ 446981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aWinStartArrayInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK; 447981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 448981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* pass all saved queue packets with SN higher then the expected one */ 449981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt while (pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket != NULL) 450981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 451981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxQueue_PassPacket (pRxQueue, 452981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].tStatus, 453981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket); 454981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 455981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket = NULL; 456981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 457981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aWinStartArrayInex++; 458981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 459981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* aWinStartArrayInex % RX_QUEUE_ARRAY_SIZE */ 460981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aWinStartArrayInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK; 461981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 462653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt pTidDataBase->aTidExpectedSn++; 463653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt pTidDataBase->aTidExpectedSn &= 0xfff; 464653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt } 465981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 466981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 467981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 468981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 469981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* frame Sequence Number is lower then Expected sequence number (ISN) ? */ 470653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt if (! BA_SESSION_IS_A_BIGGER_THAN_B (uFrameSn, pTidDataBase->aTidExpectedSn)) 471981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 472653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt /* WLAN_OS_REPORT(("%s: ERROR - SN=%u is less than ESN=%u\n", __FUNCTION__, uFrameSn, pTidDataBase->aTidExpectedSn)); */ 473981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 474653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt TRACE2(pRxQueue->hReport, REPORT_SEVERITY_ERROR, 475653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt "RxQueue_ReceivePacket: frame SN=%u is less than ESN=%u\n",uFrameSn,pTidDataBase->aTidExpectedSn); 476653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt 477653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer); 478981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 479981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 480981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 481981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 482981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* frame Sequence Number between winStart and winEnd ? */ 483653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt if ((BA_SESSION_IS_A_BIGGER_THAN_B (uFrameSn, pTidDataBase->aTidExpectedSn)) && 484981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* mean: uFrameSn <= pTidDataBase->aTidExpectedSn + pTidDataBase->aTidWinSize) */ 485653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt ( ! BA_SESSION_IS_A_BIGGER_THAN_B (uFrameSn,(pTidDataBase->aTidExpectedSn + pTidDataBase->aTidWinSize - 1)))) 486981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 487653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt TI_UINT16 uSaveInex = pTidDataBase->aWinStartArrayInex + (TI_UINT16)((uFrameSn + SEQ_NUM_WRAP - pTidDataBase->aTidExpectedSn) & SEQ_NUM_MASK); 488981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* uSaveInex % RX_QUEUE_ARRAY_SIZE */ 489981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt uSaveInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK; 490981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 491653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt 492981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (pTidDataBase->aPaketsQueue[uSaveInex].pPacket == NULL) 493981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 494981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* save the packet in the queue */ 495981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aPaketsQueue[uSaveInex].tStatus = tStatus; 496981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aPaketsQueue[uSaveInex].pPacket = (void *)pBuffer; 497981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aPaketsQueue[uSaveInex].uFrameSn = uFrameSn; 498981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 499981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 500981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 501981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR, "RxQueue_ReceivePacket: frame Sequence has allready saved. uFrameSn = %d\n",uFrameSn); 502981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer); 503981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 504981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 505981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 506981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 507981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 508981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 509981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* 510981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt frame Sequence Number higher then winEnd ? 511981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 512653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt if ( BA_SESSION_IS_A_BIGGER_THAN_B (uFrameSn, (pTidDataBase->aTidExpectedSn + pTidDataBase->aTidWinSize - 1)) ) 513981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 514981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT32 i; 515653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt TI_UINT16 uNewWinStartSn = (uFrameSn + SEQ_NUM_WRAP - pTidDataBase->aTidWinSize + 1) & SEQ_NUM_MASK; 516981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT16 uSaveInex; 517981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 518653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: frame Sequence Number higher then winEnd.\n"); 519981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 520981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* increase the ArrayInex to the next */ 521981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aWinStartArrayInex++; 522981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 523981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* aWinStartArrayInex % RX_QUEUE_ARRAY_SIZE */ 524981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aWinStartArrayInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK; 525981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 526653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt /* update the Expected SN since the current one is lost */ 527653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt pTidDataBase->aTidExpectedSn++; 528653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt pTidDataBase->aTidExpectedSn &= 0xFFF; 529653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt 530981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* pass all saved queue packets with SN lower then the new win start */ 531981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt for (i = 0; 532653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt BA_SESSION_IS_A_BIGGER_THAN_B(uNewWinStartSn,pTidDataBase->aTidExpectedSn) && 533981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (i < RX_QUEUE_ARRAY_SIZE) && 534981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (i < pTidDataBase->aTidWinSize); 535981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt i++) 536981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 537981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket != NULL) 538981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 539981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxQueue_PassPacket (pRxQueue, 540981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].tStatus, 541981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket); 542981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 543981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket = NULL; 544981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 545981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 546981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aWinStartArrayInex++; 547981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 548981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* aWinStartArrayInex % RX_QUEUE_ARRAY_SIZE */ 549981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aWinStartArrayInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK; 550981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 551653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt pTidDataBase->aTidExpectedSn++; 552653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt pTidDataBase->aTidExpectedSn &= 0xFFF; 553653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt 554653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt } 555981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 556653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt /* Calculate the new Expected SN */ 557653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt if (i == pTidDataBase->aTidWinSize) 558981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 559653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt pTidDataBase->aTidExpectedSn = uNewWinStartSn; 560653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt } 561653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt else 562653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt { 563653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt /* Incase the uWinStartDelta lower than aTidWinSize check if ther are packets stored in Array */ 564653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt while (pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket != NULL) { 565653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt RxQueue_PassPacket (pRxQueue, 566653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].tStatus, 567653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket); 568653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt 569653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket = NULL; 570653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt 571653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt pTidDataBase->aWinStartArrayInex++; 572653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt 573653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt /* aWinStartArrayInex % RX_QUEUE_ARRAY_SIZE */ 574653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt pTidDataBase->aWinStartArrayInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK; 575653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt 576653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt pTidDataBase->aTidExpectedSn++; 577653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt pTidDataBase->aTidExpectedSn &= 0xFFF; 578653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt } 579981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 580981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 581981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if(pTidDataBase->aTidExpectedSn == uFrameSn) 582981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 583981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* pass the packet */ 584981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxQueue_PassPacket (pRxQueue, tStatus, pBuffer); 585981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aTidExpectedSn++; 586653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt pTidDataBase->aTidExpectedSn &= 0xfff; 587981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 588981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 589981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 590653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt uSaveInex = pTidDataBase->aWinStartArrayInex + (TI_UINT16)((uFrameSn + SEQ_NUM_WRAP - pTidDataBase->aTidExpectedSn) & SEQ_NUM_MASK); 591981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 592653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt /* uSaveInex % RX_QUEUE_ARRAY_SIZE */ 593653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt uSaveInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK; 594981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 595981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* save the packet in the last entry of the queue */ 596653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt pTidDataBase->aPaketsQueue[uSaveInex].tStatus = tStatus; 597981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aPaketsQueue[uSaveInex].pPacket = (void *)pBuffer; 598981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aPaketsQueue[uSaveInex].pPacket = (void *)pBuffer; 599981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 600981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 601981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 602981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 603981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 604981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 605981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 606981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* 607981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * BA event ? 608981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 609981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (pRxParams->packet_class_tag == TAG_CLASS_BA_EVENT) 610981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 611981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRxQueueTidDataBase *pTidDataBase; 612981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT8 *pDataFrameBody; 613981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT16 ufc; 614981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT8 uFrameTid; 615981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT16 uStartingSequenceNumber; 616981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT16 uWinStartDelta; 617981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT16 uBarControlField; 618981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT16 uBaStartingSequenceControlField; 619981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT16 uBAParameterField; 620981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT32 i; 621981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 622981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Get sub type from frame */ 623981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt COPY_WLAN_WORD(&ufc, &pHdr->fc); /* copy with endianess handling. */ 624981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 625981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* get the type to BA event */ 626981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt switch ((dot11_Fc_Sub_Type_e)(ufc & DOT11_FC_SUB_MASK)) 627981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 628981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt case DOT11_FC_SUB_BAR: 629981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION , "RxQueue_ReceivePacket: BA event - BAR frame.\n"); 630981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 631981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* get pointer to the frame body */ 632981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pDataFrameBody = pFrame + sizeof(dot11_BarFrameHeader_t); 633981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 634981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Get TID from BAR frame */ 635981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt COPY_WLAN_WORD (&uBarControlField, (TI_UINT16 *)pDataFrameBody); /* copy with endianess handling. */ 636981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt uFrameTid = (uBarControlField & DOT11_BAR_CONTROL_FIELD_TID_BITS) >> 12; 637981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 638981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* TID illegal value ? */ 639981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (uFrameTid >= MAX_NUM_OF_802_1d_TAGS) 640981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 641981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_ReceivePacket: BA event - BAR frame with TID value too big, TID = %d.\n",uFrameTid); 642981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 643981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer); 644981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 645981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 646981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 647981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 648981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* set the SA Tid pointer */ 649981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase = &(pRxQueue->tRxQueueArraysMng.tSa1ArrayMng[uFrameTid]); 650981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 651981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* TID legal value */ 652981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* packet TID BA not established ? */ 653981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (pTidDataBase->aTidBaEstablished != TI_TRUE) 654981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 655981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_ReceivePacket: BA event - BAR frame for TID not established, TID = %d.\n",uFrameTid); 656981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 657981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer); 658981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 659981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 660981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 661981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 662981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Get Starting Sequence number from BAR frame */ 663981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pDataFrameBody = pDataFrameBody + 2; 664981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt COPY_WLAN_WORD (&uBaStartingSequenceControlField, (TI_UINT16 *)pDataFrameBody); /* copy with endianess handling. */ 665981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt uStartingSequenceNumber = (uBaStartingSequenceControlField & DOT11_SC_SEQ_NUM_MASK) >> 4; 666981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 667981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Starting Sequence Number is higher then winStart ? */ 668653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt if ( BA_SESSION_IS_A_BIGGER_THAN_B (uStartingSequenceNumber, pTidDataBase->aTidExpectedSn) ) 669981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 670653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt uWinStartDelta = (uStartingSequenceNumber + SEQ_NUM_WRAP - pTidDataBase->aTidExpectedSn) & SEQ_NUM_MASK; 671981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 672981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* pass all saved queue packets with SN lower then the new win start */ 673981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt for (i = 0; 674981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ((i < uWinStartDelta) || (pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket != NULL)) && 675981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (i < RX_QUEUE_ARRAY_SIZE) && 676981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (i < RX_QUEUE_WIN_SIZE); 677981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt i++) 678981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 679981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket != NULL) 680981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 681981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxQueue_PassPacket (pRxQueue, 682981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].tStatus, 683981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket); 684981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 685981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket = NULL; 686981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 687981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 688981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aWinStartArrayInex++; 689981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 690981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* aWinStartArrayInex % RX_QUEUE_ARRAY_SIZE */ 691981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aWinStartArrayInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK; 692981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 693981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 694981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aTidExpectedSn = uStartingSequenceNumber; 695981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 696981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 697981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 698981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 699981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt case DOT11_FC_SUB_ACTION: 700981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* get pointer to the frame body */ 701981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pDataFrameBody = pFrame + sizeof(dot11_mgmtHeader_t); 702981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 703981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* get Action field from BA action frame */ 704981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pDataFrameBody++; 705981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt switch(*pDataFrameBody) 706981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 707981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt case DOT11_BA_ACTION_ADDBA: 708981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 709981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE0( pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: BA event - ADDBA frame.\n"); 710981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 711981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* get TID field and winSize from ADDBA action frame */ 712981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pDataFrameBody = pDataFrameBody + 2; 713981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt COPY_WLAN_WORD(&uBAParameterField, (TI_UINT16 *)pDataFrameBody); /* copy with endianess handling. */ 714981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt uFrameTid = (uBAParameterField & DOT11_BA_PARAMETER_SET_FIELD_TID_BITS) >> 2; 715981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 716981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* TID illegal value ? */ 717981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (uFrameTid >= MAX_NUM_OF_802_1d_TAGS) 718981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 719981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_ReceivePacket: BA event - ADDBA frame with TID value too big, TID = %d.\n",uFrameTid); 720981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 721981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer); 722981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 723981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 724981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 725981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 726981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /*set the SA Tid pointer */ 727981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase = &(pRxQueue->tRxQueueArraysMng.tSa1ArrayMng[uFrameTid]); 728981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 729981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* TID legal value */ 730981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* packet TID BA established ? */ 731981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (pTidDataBase->aTidBaEstablished == TI_TRUE) 732981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 733981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_ReceivePacket: BA event - ADDBA frame for TID already established, TID = %d.\n",uFrameTid); 734981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 735981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer); 736981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 737981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 738981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 739981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 740981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* get winSize from ADDBA action frame */ 741981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aTidWinSize = (uBAParameterField & DOT11_BA_PARAMETER_SET_FIELD_WINSIZE_BITS) >> 6; 742981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 743981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* winSize illegal value ? */ 744981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (pTidDataBase->aTidWinSize > RX_QUEUE_WIN_SIZE) 745981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 746981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* In case the win Size is higher then 8 the driver and the FW set it to 8 and inform the AP in ADDBA respond */ 747981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aTidWinSize = RX_QUEUE_WIN_SIZE; 748981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 749981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 750981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* packet TID BA not yet established and winSize legal */ 751981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* establishe BA TID */ 752981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aTidBaEstablished = TI_TRUE; 753981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 754981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* get initial sequence number (ISN) from ADDBA action frame */ 755981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pDataFrameBody = pDataFrameBody + 4; 756981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt COPY_WLAN_WORD (&uStartingSequenceNumber, (TI_UINT16 *)pDataFrameBody); /* copy with endianess handling. */ 757981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aTidExpectedSn = (uStartingSequenceNumber & DOT11_SC_SEQ_NUM_MASK) >> 4; 758981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase->aWinStartArrayInex = 0; 759981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_memoryZero (pRxQueue->hOs, pTidDataBase->aPaketsQueue, sizeof (TRxQueuePacketEntry) * RX_QUEUE_ARRAY_SIZE); 760981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 761981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 762981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt case DOT11_BA_ACTION_DELBA: 763981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 764981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE0( pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: BA event - DELBA frame.\n"); 765981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 766981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* get TID field and winSize from ADDBA action frame */ 767981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pDataFrameBody = pDataFrameBody + 2; 768981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt COPY_WLAN_WORD(&uBAParameterField, (TI_UINT16 *)pDataFrameBody); /* copy with endianess handling. */ 769981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt uFrameTid = (uBAParameterField & DOT11_DELBA_PARAMETER_FIELD_TID_BITS) >> 12; 770981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 771981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* TID illegal value ? */ 772981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (uFrameTid >= MAX_NUM_OF_802_1d_TAGS) 773981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 774981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_ReceivePacket: BA event - DELBA frame with TID value too big, TID = %d.\n",uFrameTid); 775981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 776981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer); 777981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 778981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 779981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 780981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 781981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /*set the SA Tid pointer */ 782981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pTidDataBase = &(pRxQueue->tRxQueueArraysMng.tSa1ArrayMng[uFrameTid]); 783981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 784981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* TID legal value */ 785981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* packet TID BA not established ? */ 786981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (pTidDataBase->aTidBaEstablished != TI_TRUE) 787981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 788981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_ReceivePacket: BA event - DELBA frame for TID not established, TID = %d.\n",uFrameTid); 789981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 790981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer); 791981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 792981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 793981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 794981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 795981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxQueue_CloseBaSession(hRxQueue, uFrameTid); 796981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 797981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 798981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt default: 799981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_ReceivePacket: BA event Action field from BA action frame illegal. action = 0x%x\n",*pDataFrameBody); 800981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 801981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer); 802981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 803981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 804981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 805981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt break; 806981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 807981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt default: 808981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_ReceivePacket: BA event with Subtype illegal. Subtype = 0x%x\n",((ufc & DOT11_FC_SUB_MASK) >> 4)); 809981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 810981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer); 811981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 812981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 813981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 814981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 815981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 816981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 817981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR, "RxQueue_ReceivePacket: unknow type tag. tag = %d\n", pRxParams->packet_class_tag); 818981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 819981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt RxQueue_PassPacket (pRxQueue, tStatus, pBuffer); 820981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 821981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return; 822981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 823981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 824