| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356 |
- /*
- ** Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/swcr.c#1
- */
- /*! \file "swcr.c"
- \brief
- */
- /*
- ** Log: swcr.c
- **
- ** 09 03 2013 jeffrey.chang
- ** [BORA00002710] [MT6630][Wi-Fi] PM driver development
- ** fix build error
- **
- ** 08 28 2013 jeffrey.chang
- ** [BORA00002710] [MT6630][Wi-Fi] PM driver development
- ** fix bug
- **
- ** 08 28 2013 jeffrey.chang
- ** [BORA00002710] [MT6630][Wi-Fi] PM driver development
- ** modify set ip address logic
- **
- ** 08 28 2013 jeffrey.chang
- ** [BORA00002710] [MT6630][Wi-Fi] PM driver development
- ** 1) clear the IP buffer
- **
- ** 08 28 2013 jeffrey.chang
- ** [BORA00002710] [MT6630][Wi-Fi] PM driver development
- ** 1) modify code which may cause assert
- **
- ** 08 26 2013 jeffrey.chang
- ** [BORA00002710] [MT6630][Wi-Fi] PM driver development
- ** 1) fix bug
- **
- ** 08 26 2013 jeffrey.chang
- ** [BORA00002710] [MT6630][Wi-Fi] PM driver development
- ** 1) Add SwCr for enable/disable ARP filter
- **
- ** 08 26 2013 jeffrey.chang
- ** [BORA00002710] [MT6630][Wi-Fi] PM driver development
- ** 1) change the naming convetion of RX filter to be more general
- ** (following Android rules)
- **
- ** 08 23 2013 jeffrey.chang
- ** [BORA00002710] [MT6630][Wi-Fi] PM driver development
- ** 1) align Android design, only allow MC packet with table lookup passed.
- ** 2) For mulicast routing, kernel driver will turn on and pass all MC packet through
- ** by itself
- **
- ** 08 22 2013 tsaiyuan.hsu
- ** [BORA00002222] MT6630 unified MAC RXM
- ** add mDNS filter for Android.
- **
- ** 08 13 2013 terry.wu
- ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
- ** Remove unused code
- **
- ** 08 05 2013 terry.wu
- ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
- ** 1. Add SW rate definition
- ** 2. Add HW default rate selection logic from FW
- **
- ** 06 25 2013 terry.wu
- ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
- ** Update for 1st connection
- **
- ** 03 29 2013 cp.wu
- ** [BORA00002227] [MT6630 Wi-Fi][Driver] Update for Makefile and HIFSYS modifications
- ** 1. remove unused HIF definitions
- ** 2. enable NDIS 5.1 build success
- **
- ** 03 12 2013 terry.wu
- ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
- ** Update Tx utility function for management frame
- **
- ** 03 06 2013 wh.su
- ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
- ** submit some code related with security.
- **
- ** 02 19 2013 cp.wu
- ** [BORA00002227] [MT6630 Wi-Fi][Driver] Update for Makefile and HIFSYS modifications
- ** take use of GET_BSS_INFO_BY_INDEX() and MAX_BSS_INDEX macros
- ** for correctly indexing of BSS-INFO pointers
- **
- ** 01 28 2013 cm.chang
- ** [BORA00002149] [MT6630 Wi-Fi] Initial software development
- ** Sync CMD format
- **
- ** 01 22 2013 cp.wu
- ** [BORA00002253] [MT6630 Wi-Fi][Driver][Firmware] Add NLO and timeout mechanism to SCN module
- ** modification for ucBssIndex migration
- **
- ** 01 15 2013 terry.wu
- ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
- ** Update Tx done resource release mechanism.
- **
- ** 09 17 2012 cm.chang
- ** [BORA00002149] [MT6630 Wi-Fi] Initial software development
- ** Duplicate source from MT6620 v2.3 driver branch
- ** (Davinci label: MT6620_WIFI_Driver_V2_3_120913_1942_As_MT6630_Base)
- *
- * 06 04 2012 tsaiyuan.hsu
- * [WCXRP00001249] [ALPS.ICS] Daily build warning on "wlan/mgmt/swcr.c#1"
- * resolve build waring for "WNM_UNIT_TEST not defined".
- *
- * 03 02 2012 terry.wu
- * NULL
- * Sync CFG80211 modification from branch 2,2.
- *
- * 01 05 2012 tsaiyuan.hsu
- * [WCXRP00001157] [MT6620 Wi-Fi][FW][DRV] add timing measurement support for 802.11v
- * add timing measurement support for 802.11v.
- *
- * 11 22 2011 tsaiyuan.hsu
- * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
- * keep debug counter setting after wake up.
- *
- * 11 15 2011 cm.chang
- * NULL
- * Fix compiling warning
- *
- * 11 11 2011 tsaiyuan.hsu
- * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
- * fix debug counters of rx in driver.
- *
- * 11 11 2011 tsaiyuan.hsu
- * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
- * add debug counters of bb and ar for xlog.
- *
- * 11 10 2011 eddie.chen
- * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog)
- * Modify the QM xlog level and remove LOG_FUNC.
- *
- * 11 08 2011 tsaiyuan.hsu
- * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
- * add debug counters, eCurPsProf, for PS.
- *
- * 11 07 2011 tsaiyuan.hsu
- * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
- * add debug counters and periodically dump counters for debugging.
- *
- * 11 03 2011 wh.su
- * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG
- * change the DBGLOG for "\n" and "\r\n". LABEL to LOUD for XLOG
- *
- * 08 31 2011 tsaiyuan.hsu
- * [WCXRP00000931] [MT5931 Wi-Fi][DRV/FW] add swcr to disable roaming from driver
- * remove obsolete code.
- *
- * 08 15 2011 tsaiyuan.hsu
- * [WCXRP00000931] [MT5931 Wi-Fi][DRV/FW] add swcr to disable roaming from driver
- * add swcr in driver reg, 0x9fxx0000, to disable roaming .
- *
- * 05 11 2011 eddie.chen
- * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet
- * Fix dest type when GO packet copying.
- *
- * 05 09 2011 eddie.chen
- * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet
- * Check free number before copying broadcast packet.
- *
- * 04 14 2011 eddie.chen
- * [WCXRP00000603] [MT6620 Wi-Fi][DRV] Fix Klocwork warning
- * Check the SW RFB free. Fix the compile warning..
- *
- * 04 12 2011 eddie.chen
- * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma
- * Fix the sta index in processing security frame
- * Simple flow control for TC4 to avoid mgt frames for PS STA to occupy the TC4
- * Add debug message.
- *
- * 03 28 2011 eddie.chen
- * [WCXRP00000603] [MT6620 Wi-Fi][DRV] Fix Klocwork warning
- * Fix Klockwork warning.
- *
- * 03 15 2011 eddie.chen
- * [WCXRP00000554] [MT6620 Wi-Fi][DRV] Add sw control debug counter
- * Add sw debug counter for QM.
- *
- * 01 11 2011 eddie.chen
- * [WCXRP00000322] Add WMM IE in beacon,
- Add per station flow control when STA is in PS
- * Add swcr for test.
- *
- *
- */
- /*******************************************************************************
- * C O M P I L E R F L A G S
- ********************************************************************************
- */
- /*******************************************************************************
- * E X T E R N A L R E F E R E N C E S
- ********************************************************************************
- */
- #include "precomp.h"
- #include "swcr.h"
- #if CFG_SUPPORT_SWCR
- /*******************************************************************************
- * D A T A T Y P E S
- ********************************************************************************
- */
- /*******************************************************************************
- * P U B L I C D A T A
- ********************************************************************************
- */
- UINT_32 g_au4SwCr[SWCR_CR_NUM]; /*: 0: command other: data */
- /* JB mDNS Filter*/
- UINT_32 g_u4RXFilter = 0; /* [31] 0: stop 1: start, [3] IPv6 [2] IPv4 */
- static TIMER_T g_rSwcrDebugTimer;
- static BOOLEAN g_fgSwcrDebugTimer = FALSE;
- static UINT_32 g_u4SwcrDebugCheckTimeout;
- static ENUM_SWCR_DBG_TYPE_T g_ucSwcrDebugCheckType;
- static UINT_32 g_u4SwcrDebugFrameDumpType;
- /*******************************************************************************
- * P R I V A T E D A T A
- ********************************************************************************
- */
- static const PFN_CMD_RW_T g_arSwCtrlCmd[] = {
- swCtrlCmdCategory0,
- swCtrlCmdCategory1
- #if TEST_PS
- , testPsCmdCategory0, testPsCmdCategory1
- #endif
- #if CFG_SUPPORT_802_11V
- #if (CFG_SUPPORT_802_11V_TIMING_MEASUREMENT == 1) && (WNM_UNIT_TEST == 1)
- , testWNMCmdCategory0
- #endif
- #endif
- };
- const PFN_SWCR_RW_T g_arSwCrModHandle[] = {
- swCtrlSwCr,
- NULL
- };
- /*******************************************************************************
- * M A C R O S
- ********************************************************************************
- */
- enum {
- SWCTRL_MAGIC,
- SWCTRL_DEBUG,
- SWCTRL_WIFI_VAR,
- SWCTRL_ENABLE_INT,
- SWCTRL_DISABLE_INT,
- SWCTRL_TXM_INFO,
- SWCTRL_RXM_INFO,
- SWCTRL_DUMP_BSS,
- SWCTRL_QM_INFO,
- SWCTRL_DUMP_ALL_QUEUE_LEN,
- SWCTRL_DUMP_MEM,
- SWCTRL_TX_CTRL_INFO,
- SWCTRL_DUMP_QUEUE,
- SWCTRL_DUMP_QM_DBG_CNT,
- SWCTRL_QM_DBG_CNT,
- SWCTRL_RX_PKTS_DUMP,
- SWCTRL_RX_FILTER,
- #if CFG_INIT_ENABLE_PATTERN_FILTER_ARP
- SWCTRL_RX_ARP_OFFLOAD,
- #endif
- SWCTRL_PS_DTIM_SKIP,
- SWCTRL_ROAMING,
- SWCTRL_CATA0_INDEX_NUM
- };
- enum {
- SWCTRL_STA_INFO,
- SWCTRL_DUMP_STA,
- SWCTRL_STA_QUE_INFO,
- SWCTRL_CATA1_INDEX_NUM
- };
- /* JB mDNS Filter*/
- #define RX_FILTER_START (1<<31)
- #define RX_FILTER_IPV4 (1<<2)
- #define RX_FILTER_IPV6 (1<<3)
- typedef enum _ENUM_SWCR_RX_FILTER_CMD_T {
- SWCR_RX_FILTER_CMD_STOP = 0,
- SWCR_RX_FILTER_CMD_START,
- SWCR_RX_FILTER_CMD_ADD,
- SWCR_RX_FILTER_CMD_REMOVE,
- SWCR_RX_FILTER_NUM
- } ENUM_SWCR_RX_FILTER_CMD_T;
- #if TEST_PS
- enum {
- TEST_PS_MAGIC,
- TEST_PS_SETUP_BSS,
- TEST_PS_ENABLE_BEACON,
- TEST_PS_TRIGGER_BMC,
- TEST_PS_SEND_NULL,
- TEST_PS_BUFFER_BMC,
- TEST_PS_UPDATE_BEACON,
- TEST_PS_CATA0_INDEX_NUM
- };
- enum {
- TEST_PS_STA_PS,
- TEST_PS_STA_ENTER_PS,
- TEST_PS_STA_EXIT_PS,
- TEST_PS_STA_TRIGGER_PSPOLL,
- TEST_PS_STA_TRIGGER_FRAME,
- TEST_PS_CATA1_INDEX_NUM
- };
- #endif
- #if CFG_SUPPORT_802_11V
- #if WNM_UNIT_TEST
- enum {
- TEST_WNM_TIMING_MEAS,
- TEST_WNM_CATA0_INDEX_NUM
- };
- #endif
- #endif
- #define _SWCTRL_MAGIC 0x66201642
- /*******************************************************************************
- * F U N C T I O N D E C L A R A T I O N S
- ********************************************************************************
- */
- /*******************************************************************************
- * F U N C T I O N S
- ********************************************************************************
- */
- void dumpQueue(P_ADAPTER_T prAdapter)
- {
- P_TX_CTRL_T prTxCtrl;
- P_QUE_MGT_T prQM;
- P_GLUE_INFO_T prGlueInfo;
- UINT_32 i;
- UINT_32 j;
- DEBUGFUNC("dumpQueue");
- prTxCtrl = &prAdapter->rTxCtrl;
- prQM = &prAdapter->rQM;
- prGlueInfo = prAdapter->prGlueInfo;
- #if QM_ADAPTIVE_TC_RESOURCE_CTRL
- for (i = TC0_INDEX; i <= TC5_INDEX; i++) {
- DBGLOG(SW4, INFO, "TC %u\n", i);
- DBGLOG(SW4, INFO, "Max %u Free %u\n",
- prTxCtrl->rTc.au2MaxNumOfBuffer[i], prTxCtrl->rTc.au2FreeBufferCount[i]);
- DBGLOG(SW4, INFO,
- "Average %u minReserved %u CurrentTcResource %u GuaranteedTcResource %u\n",
- QM_GET_TX_QUEUE_LEN(prAdapter, i), prQM->au4MinReservedTcResource[i],
- prQM->au4CurrentTcResource[i], prQM->au4GuaranteedTcResource[i]);
- }
- #endif
- #if QM_FORWARDING_FAIRNESS
- for (i = 0; i < NUM_OF_PER_STA_TX_QUEUES; i++) {
- DBGLOG(SW4, INFO,
- "TC %u HeadStaIdx %u ForwardCount %u\n", i, prQM->au4HeadStaRecIndex[i],
- prQM->au4ResourceUsedCount[i]);
- }
- #endif
- DBGLOG(SW4, INFO, "BMC or unknown TxQueue Len %u\n", prQM->arTxQueue[0].u4NumElem);
- DBGLOG(SW4, INFO, "Pending %d\n", prGlueInfo->i4TxPendingFrameNum);
- DBGLOG(SW4, INFO, "Pending Security %d\n", prGlueInfo->i4TxPendingSecurityFrameNum);
- #if defined(LINUX)
- for (i = 0; i < 4; i++) {
- for (j = 0; j < CFG_MAX_TXQ_NUM; j++) {
- DBGLOG(SW4, INFO,
- "Pending Q[%u][%u] %d\n", i, j, prGlueInfo->ai4TxPendingFrameNumPerQueue[i][j]);
- }
- }
- #endif
- DBGLOG(SW4, INFO, " rFreeSwRfbList %u\n", prAdapter->rRxCtrl.rFreeSwRfbList.u4NumElem);
- DBGLOG(SW4, INFO, " rReceivedRfbList %u\n", prAdapter->rRxCtrl.rReceivedRfbList.u4NumElem);
- DBGLOG(SW4, INFO, " rIndicatedRfbList %u\n", prAdapter->rRxCtrl.rIndicatedRfbList.u4NumElem);
- DBGLOG(SW4, INFO, " ucNumIndPacket %u\n", prAdapter->rRxCtrl.ucNumIndPacket);
- DBGLOG(SW4, INFO, " ucNumRetainedPacket %u\n", prAdapter->rRxCtrl.ucNumRetainedPacket);
- }
- void dumpSTA(P_ADAPTER_T prAdapter, P_STA_RECORD_T prStaRec)
- {
- UINT_8 ucWTEntry;
- UINT_32 i;
- P_BSS_INFO_T prBssInfo;
- DEBUGFUNC("dumpSTA");
- ASSERT(prStaRec);
- ucWTEntry = prStaRec->ucWlanIndex;
- prBssInfo = GET_BSS_INFO_BY_INDEX(prAdapter, prStaRec->ucBssIndex);
- ASSERT(prBssInfo);
- DBGLOG(SW4, INFO, "Mac address: " MACSTR " Rcpi %u" "\n", MAC2STR(prStaRec->aucMacAddr),
- prStaRec->ucRCPI);
- DBGLOG(SW4, INFO, "Idx %u Wtbl %u Used %u State %u Bss Phy 0x%x Sta DesiredPhy 0x%x\n",
- prStaRec->ucIndex, ucWTEntry,
- prStaRec->fgIsInUse, prStaRec->ucStaState,
- prBssInfo->ucPhyTypeSet, prStaRec->ucDesiredPhyTypeSet);
- DBGLOG(SW4, INFO,
- "Sta Operation 0x%x DesiredNontHtRateSet 0x%x Mcs 0x%x u2HtCapInfo 0x%x\n",
- prStaRec->u2OperationalRateSet, prStaRec->u2DesiredNonHTRateSet, prStaRec->ucMcsSet,
- prStaRec->u2HtCapInfo);
- for (i = 0; i < NUM_OF_PER_STA_TX_QUEUES; i++)
- DBGLOG(SW4, INFO, "TC %u Queue Len %u\n", i, prStaRec->arTxQueue[i].u4NumElem);
- DBGLOG(SW4, INFO, "BmpDeliveryAC %x\n", prStaRec->ucBmpDeliveryAC);
- DBGLOG(SW4, INFO, "BmpTriggerAC %x\n", prStaRec->ucBmpTriggerAC);
- DBGLOG(SW4, INFO, "UapsdSpSupproted %u\n", prStaRec->fgIsUapsdSupported);
- DBGLOG(SW4, INFO, "IsQoS %u\n", prStaRec->fgIsQoS);
- DBGLOG(SW4, INFO, "AssocId %u\n", prStaRec->u2AssocId);
- DBGLOG(SW4, INFO, "fgIsInPS %u\n", prStaRec->fgIsInPS);
- DBGLOG(SW4, INFO, "ucFreeQuota %u\n", prStaRec->ucFreeQuota);
- DBGLOG(SW4, INFO, "ucFreeQuotaForDelivery %u\n", prStaRec->ucFreeQuotaForDelivery);
- DBGLOG(SW4, INFO, "ucFreeQuotaForNonDelivery %u\n", prStaRec->ucFreeQuotaForNonDelivery);
- #if 0
- DBGLOG(SW4, INFO, "IsQmmSup %u\n", prStaRec->fgIsWmmSupported);
- DBGLOG(SW4, INFO, "IsUapsdSup %u\n", prStaRec->fgIsUapsdSupported);
- DBGLOG(SW4, INFO, "AvailabaleDeliverPkts %u\n", prStaRec->ucAvailableDeliverPkts);
- DBGLOG(SW4, INFO, "BmpDeliverPktsAC %u\n", prStaRec->u4BmpDeliverPktsAC);
- DBGLOG(SW4, INFO, "BmpBufferAC %u\n", prStaRec->u4BmpBufferAC);
- DBGLOG(SW4, INFO, "BmpNonDeliverPktsAC %u\n", prStaRec->u4BmpNonDeliverPktsAC);
- #endif
- for (i = 0; i < CFG_RX_MAX_BA_TID_NUM; i++) {
- if (prStaRec->aprRxReorderParamRefTbl[i]) {
- DBGLOG(SW4, INFO,
- "RxReorder fgIsValid: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->fgIsValid);
- DBGLOG(SW4, INFO, "RxReorder Tid: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->ucTid);
- DBGLOG(SW4, INFO,
- "RxReorder rReOrderQue Len: %u\n",
- prStaRec->aprRxReorderParamRefTbl[i]->rReOrderQue.u4NumElem);
- DBGLOG(SW4, INFO,
- "RxReorder WinStart: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->u2WinStart);
- DBGLOG(SW4, INFO, "RxReorder WinEnd: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->u2WinEnd);
- DBGLOG(SW4, INFO, "RxReorder WinSize: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->u2WinSize);
- }
- }
- }
- VOID dumpBss(P_ADAPTER_T prAdapter, P_BSS_INFO_T prBssInfo)
- {
- DBGLOG(SW4, INFO, "SSID %s\n", prBssInfo->aucSSID);
- DBGLOG(SW4, INFO, "OWN " MACSTR "\n", MAC2STR(prBssInfo->aucOwnMacAddr));
- DBGLOG(SW4, INFO, "BSSID " MACSTR "\n", MAC2STR(prBssInfo->aucBSSID));
- DBGLOG(SW4, INFO, "eNetworkType %u\n", prBssInfo->eNetworkType);
- DBGLOG(SW4, INFO, "ucBssIndex %u\n", prBssInfo->ucBssIndex);
- DBGLOG(SW4, INFO, "eConnectionState %u\n", prBssInfo->eConnectionState);
- DBGLOG(SW4, INFO, "eCurrentOPMode %u\n", prBssInfo->eCurrentOPMode);
- DBGLOG(SW4, INFO, "fgIsQBSS %u\n", prBssInfo->fgIsQBSS);
- DBGLOG(SW4, INFO, "fgIsShortPreambleAllowed %u\n", prBssInfo->fgIsShortPreambleAllowed);
- DBGLOG(SW4, INFO, "fgUseShortPreamble %u\n", prBssInfo->fgUseShortPreamble);
- DBGLOG(SW4, INFO, "fgUseShortSlotTime %u\n", prBssInfo->fgUseShortSlotTime);
- DBGLOG(SW4, INFO, "ucNonHTBasicPhyType %x\n", prBssInfo->ucNonHTBasicPhyType);
- DBGLOG(SW4, INFO, "u2OperationalRateSet %x\n", prBssInfo->u2OperationalRateSet);
- DBGLOG(SW4, INFO, "u2BSSBasicRateSet %x\n", prBssInfo->u2BSSBasicRateSet);
- DBGLOG(SW4, INFO, "ucPhyTypeSet %x\n", prBssInfo->ucPhyTypeSet);
- DBGLOG(SW4, INFO, "rStaRecOfClientList %d\n", prBssInfo->rStaRecOfClientList.u4NumElem);
- DBGLOG(SW4, INFO, "u2CapInfo %x\n", prBssInfo->u2CapInfo);
- DBGLOG(SW4, INFO, "u2ATIMWindow %x\n", prBssInfo->u2ATIMWindow);
- DBGLOG(SW4, INFO, "u2AssocId %x\n", prBssInfo->u2AssocId);
- DBGLOG(SW4, INFO, "ucDTIMPeriod %x\n", prBssInfo->ucDTIMPeriod);
- DBGLOG(SW4, INFO, "ucDTIMCount %x\n", prBssInfo->ucDTIMCount);
- DBGLOG(SW4, INFO, "fgIsNetAbsent %x\n", prBssInfo->fgIsNetAbsent);
- DBGLOG(SW4, INFO, "eBand %d\n", prBssInfo->eBand);
- DBGLOG(SW4, INFO, "ucPrimaryChannel %d\n", prBssInfo->ucPrimaryChannel);
- DBGLOG(SW4, INFO, "ucHtOpInfo1 %d\n", prBssInfo->ucHtOpInfo1);
- DBGLOG(SW4, INFO, "ucHtOpInfo2 %d\n", prBssInfo->u2HtOpInfo2);
- DBGLOG(SW4, INFO, "ucHtOpInfo3 %d\n", prBssInfo->u2HtOpInfo3);
- DBGLOG(SW4, INFO, "fgErpProtectMode %d\n", prBssInfo->fgErpProtectMode);
- DBGLOG(SW4, INFO, "eHtProtectMode %d\n", prBssInfo->eHtProtectMode);
- DBGLOG(SW4, INFO, "eGfOperationMode %d\n", prBssInfo->eGfOperationMode);
- DBGLOG(SW4, INFO, "eRifsOperationMode %d\n", prBssInfo->eRifsOperationMode);
- DBGLOG(SW4, INFO, "fgObssErpProtectMode %d\n", prBssInfo->fgObssErpProtectMode);
- DBGLOG(SW4, INFO, "eObssHtProtectMode %d\n", prBssInfo->eObssHtProtectMode);
- DBGLOG(SW4, INFO, "eObssGfProtectMode %d\n", prBssInfo->eObssGfOperationMode);
- DBGLOG(SW4, INFO, "fgObssRifsOperationMode %d\n", prBssInfo->fgObssRifsOperationMode);
- DBGLOG(SW4, INFO, "fgAssoc40mBwAllowed %d\n", prBssInfo->fgAssoc40mBwAllowed);
- DBGLOG(SW4, INFO, "fg40mBwAllowed %d\n", prBssInfo->fg40mBwAllowed);
- DBGLOG(SW4, INFO, "eBssSCO %d\n", prBssInfo->eBssSCO);
- }
- VOID swCtrlCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0, UINT_8 ucOpt1)
- {
- UINT_8 ucIndex, ucRead;
- UINT_32 i;
- DEBUGFUNC("swCtrlCmdCategory0");
- SWCR_GET_RW_INDEX(ucAction, ucRead, ucIndex);
- i = 0;
- if (ucIndex >= SWCTRL_CATA0_INDEX_NUM)
- return;
- if (ucRead == SWCR_WRITE) {
- switch (ucIndex) {
- case SWCTRL_DEBUG:
- #if DBG
- aucDebugModule[ucOpt0] = (UINT_8) g_au4SwCr[1];
- #endif
- break;
- case SWCTRL_WIFI_VAR:
- break;
- #if QM_DEBUG_COUNTER
- case SWCTRL_DUMP_QM_DBG_CNT:
- for (i = 0; i < QM_DBG_CNT_NUM; i++)
- prAdapter->rQM.au4QmDebugCounters[i] = 0;
- break;
- case SWCTRL_QM_DBG_CNT:
- prAdapter->rQM.au4QmDebugCounters[ucOpt0] = g_au4SwCr[1];
- break;
- #endif
- #if CFG_RX_PKTS_DUMP
- case SWCTRL_RX_PKTS_DUMP:
- /* DBGLOG(SW4, INFO,("SWCTRL_RX_PKTS_DUMP: mask %x\n", g_au4SwCr[1])); */
- prAdapter->rRxCtrl.u4RxPktsDumpTypeMask = g_au4SwCr[1];
- break;
- #endif
- case SWCTRL_RX_FILTER:
- {
- UINT_32 u4rxfilter;
- BOOLEAN fgUpdate = FALSE;
- WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS;
- if (ucOpt0 == SWCR_RX_FILTER_CMD_STOP) {
- g_u4RXFilter &= ~(RX_FILTER_START);
- /* changed by jeffrey to align Android behavior */
- #if 0
- if (prAdapter->fgAllMulicastFilter == FALSE)
- prAdapter->u4OsPacketFilter &= ~PARAM_PACKET_FILTER_ALL_MULTICAST;
- #endif
- prAdapter->u4OsPacketFilter &= ~PARAM_PACKET_FILTER_MULTICAST;
- u4rxfilter = prAdapter->u4OsPacketFilter;
- fgUpdate = TRUE;
- } else if (ucOpt0 == SWCR_RX_FILTER_CMD_START) {
- g_u4RXFilter |= (RX_FILTER_START);
- if ((g_u4RXFilter & RX_FILTER_IPV4) || (g_u4RXFilter & RX_FILTER_IPV6)) {
- #if 0
- prAdapter->u4OsPacketFilter |= PARAM_PACKET_FILTER_ALL_MULTICAST;
- #endif
- prAdapter->u4OsPacketFilter |= PARAM_PACKET_FILTER_MULTICAST;
- }
- u4rxfilter = prAdapter->u4OsPacketFilter;
- fgUpdate = TRUE;
- } else if (ucOpt0 == SWCR_RX_FILTER_CMD_ADD) {
- if (ucOpt1 < 31)
- g_u4RXFilter |= (1 << ucOpt1);
- } else if (ucOpt0 == SWCR_RX_FILTER_CMD_REMOVE) {
- if (ucOpt1 < 31)
- g_u4RXFilter &= ~(1 << ucOpt1);
- }
- if (fgUpdate == TRUE)
- rStatus = wlanoidSetPacketFilter(prAdapter, u4rxfilter, FALSE, NULL, 0);
- /* DBGLOG(SW4, INFO,("SWCTRL_RX_FILTER:
- * g_u4RXFilter %x ucOpt0 %x ucOpt1 %x fgUpdate %x u4rxfilter %x, rStatus %x\n", */
- /* g_u4RXFilter, ucOpt0, ucOpt1, fgUpdate, u4rxfilter, rStatus)); */
- }
- break;
- #if CFG_INIT_ENABLE_PATTERN_FILTER_ARP
- case SWCTRL_RX_ARP_OFFLOAD:
- {
- WLAN_STATUS rStatus = WLAN_STATUS_FAILURE;
- UINT_32 u4SetInfoLen = 0;
- UINT_32 u4Len = OFFSET_OF(PARAM_NETWORK_ADDRESS_LIST, arAddress);
- UINT_32 u4NumIPv4 = 0, u4NumIPv6 = 0;
- UINT_32 i = 0;
- PUINT_8 pucBufIpAddr = NULL;
- P_PARAM_NETWORK_ADDRESS_LIST prParamNetAddrList = NULL;
- P_PARAM_NETWORK_ADDRESS_IP prParamIpAddr = NULL;
- PUINT_8 pucIp = NULL;
- /* PUINT_8 pucIpv6 = NULL; */
- UINT_32 bufSize =
- u4Len + (OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) +
- sizeof(PARAM_NETWORK_ADDRESS_IP)) * 3;
- P_PARAM_NETWORK_ADDRESS prParamNetAddr = NULL;
- /* <1> allocate IP address buffer */
- pucBufIpAddr = kalMemAlloc(bufSize, VIR_MEM_TYPE);
- pucIp = kalMemAlloc(3 * 4, VIR_MEM_TYPE); /* TODO: replace 3 to macro */
- prParamNetAddrList = (P_PARAM_NETWORK_ADDRESS_LIST) pucBufIpAddr;
- prParamNetAddr = prParamNetAddrList->arAddress;
- /* <2> clear IP address buffer */
- kalMemZero(pucBufIpAddr, bufSize);
- kalMemZero(pucIp, 3 * 4);
- /* <3> setup the number of IP address */
- if (ucOpt1 == 1) {
- if (wlanGetIPV4Address(prAdapter->prGlueInfo, pucIp, &u4NumIPv4) &&
- u4NumIPv4 > 3) /* TODO: repleace 3 to macro */
- u4NumIPv4 = 3;
- } else if (ucOpt1 == 0) {
- u4NumIPv4 = u4NumIPv6 = 0;
- }
- DBGLOG(INIT, INFO, "u4Len:%d bufSize:%d u4NumIPv4:%d\n", u4Len, bufSize, u4NumIPv4);
- prParamNetAddrList->u4AddressCount = u4NumIPv6 + u4NumIPv4;
- prParamNetAddrList->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP;
- for (i = 0; i < u4NumIPv4; i++) {
- prParamNetAddr->u2AddressLength = sizeof(PARAM_NETWORK_ADDRESS_IP);
- prParamNetAddr->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP;
- prParamIpAddr = (P_PARAM_NETWORK_ADDRESS_IP) prParamNetAddr->aucAddress;
- kalMemCopy(&prParamIpAddr->in_addr, pucIp + (i * 4), 4);
- prParamNetAddr =
- (P_PARAM_NETWORK_ADDRESS) ((UINT_32) prParamNetAddr +
- OFFSET_OF
- (PARAM_NETWORK_ADDRESS,
- aucAddress) + sizeof(PARAM_NETWORK_ADDRESS_IP));
- u4Len +=
- OFFSET_OF(PARAM_NETWORK_ADDRESS,
- aucAddress) + sizeof(PARAM_NETWORK_ADDRESS_IP);
- }
- #if 0
- #ifdef CONFIG_IPV6
- if (!wlanGetIPV6Address(prAdapter->prGlueInfo, pucIp, &u4NumIPv6)
- || (u4NumIPv6 + u4NumIPv4) > 3) {
- goto bailout;
- }
- pucIpv6 = kalMemAlloc(u4NumIPv6 * 16, VIR_MEM_TYPE);
- for (i = 0; i < u4NumIPv6; i++) {
- prParamNetAddr->u2AddressLength = 6;
- prParamNetAddr->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP;
- kalMemCopy(prParamNetAddr->aucAddress, pucIpv6 + (i * 16), 16);
- prParamNetAddr =
- (P_PARAM_NETWORK_ADDRESS) ((UINT_32) prParamNetAddr + sizeof(ip6));
- u4Len += OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) + sizeof(ip6);
- }
- #endif
- #endif
- ASSERT(u4Len <= bufSize);
- rStatus = wlanoidSetNetworkAddress(prAdapter,
- (PVOID) prParamNetAddrList, u4Len, &u4SetInfoLen);
- if (rStatus != WLAN_STATUS_SUCCESS)
- DBGLOG(INIT, INFO, "set HW packet filter fail 0x%1x\n", rStatus);
- if (pucIp)
- kalMemFree(pucIp, VIR_MEM_TYPE, 3 * 4); /* TODO: replace 3 to marco */
- if (pucBufIpAddr)
- kalMemFree(pucBufIpAddr, VIR_MEM_TYPE, bufSize);
- }
- break;
- #endif
- case SWCTRL_PS_DTIM_SKIP:
- break;
- case SWCTRL_ROAMING:
- break;
- default:
- break;
- }
- } else {
- switch (ucIndex) {
- case SWCTRL_DEBUG:
- #if DBG
- g_au4SwCr[1] = aucDebugModule[ucOpt0];
- #endif
- break;
- case SWCTRL_MAGIC:
- g_au4SwCr[1] = _SWCTRL_MAGIC;
- break;
- case SWCTRL_QM_INFO:
- {
- P_QUE_MGT_T prQM = &prAdapter->rQM;
- switch (ucOpt0) {
- case 0:
- #if QM_ADAPTIVE_TC_RESOURCE_CTRL
- g_au4SwCr[1] = (QM_GET_TX_QUEUE_LEN(prAdapter, ucOpt1));
- g_au4SwCr[2] = prQM->au4MinReservedTcResource[ucOpt1];
- g_au4SwCr[3] = prQM->au4CurrentTcResource[ucOpt1];
- g_au4SwCr[4] = prQM->au4GuaranteedTcResource[ucOpt1];
- #endif
- break;
- case 1:
- #if QM_FORWARDING_FAIRNESS
- g_au4SwCr[1] = prQM->au4ResourceUsedCount[ucOpt1];
- g_au4SwCr[2] = prQM->au4HeadStaRecIndex[ucOpt1];
- #endif
- break;
- case 2:
- g_au4SwCr[1] = prQM->arTxQueue[ucOpt1].u4NumElem; /* only one */
- break;
- }
- }
- case SWCTRL_TX_CTRL_INFO:
- {
- P_TX_CTRL_T prTxCtrl;
- prTxCtrl = &prAdapter->rTxCtrl;
- switch (ucOpt0) {
- case 0:
- g_au4SwCr[1] = prAdapter->rTxCtrl.rTc.au2FreeBufferCount[ucOpt1];
- g_au4SwCr[2] = prAdapter->rTxCtrl.rTc.au2MaxNumOfBuffer[ucOpt1];
- break;
- }
- }
- break;
- case SWCTRL_DUMP_QUEUE:
- dumpQueue(prAdapter);
- break;
- #if QM_DEBUG_COUNTER
- case SWCTRL_DUMP_QM_DBG_CNT:
- for (i = 0; i < QM_DBG_CNT_NUM; i++)
- DBGLOG(SW4, INFO, "QM:DBG %u %u\n", i, prAdapter->rQM.au4QmDebugCounters[i]);
- break;
- case SWCTRL_QM_DBG_CNT:
- g_au4SwCr[1] = prAdapter->rQM.au4QmDebugCounters[ucOpt0];
- break;
- #endif
- case SWCTRL_DUMP_BSS:
- {
- dumpBss(prAdapter, GET_BSS_INFO_BY_INDEX(prAdapter, ucOpt0));
- }
- break;
- default:
- break;
- }
- }
- }
- VOID swCtrlCmdCategory1(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0, UINT_8 ucOpt1)
- {
- UINT_8 ucIndex, ucRead;
- UINT_8 ucWTEntry;
- P_STA_RECORD_T prStaRec;
- DEBUGFUNC("swCtrlCmdCategory1");
- SWCR_GET_RW_INDEX(ucAction, ucRead, ucIndex);
- if (ucOpt0 >= CFG_STA_REC_NUM)
- return;
- /* prStaRec = cnmGetStaRecByIndex (prAdapter, ucOpt0); */
- prStaRec = &prAdapter->arStaRec[ucOpt0];
- ucWTEntry = prStaRec->ucWlanIndex;
- if (ucRead == SWCR_WRITE) {
- /* ToDo:: Nothing */
- } else {
- /* Read */
- switch (ucIndex) {
- case SWCTRL_STA_QUE_INFO:
- {
- g_au4SwCr[1] = prStaRec->arTxQueue[ucOpt1].u4NumElem;
- }
- break;
- case SWCTRL_STA_INFO:
- switch (ucOpt1) {
- case 0:
- g_au4SwCr[1] = prStaRec->fgIsInPS;
- break;
- }
- break;
- case SWCTRL_DUMP_STA:
- {
- dumpSTA(prAdapter, prStaRec);
- }
- break;
- default:
- break;
- }
- }
- }
- #if TEST_PS
- VOID
- testPsSendQoSNullFrame(IN P_ADAPTER_T prAdapter,
- IN P_STA_RECORD_T prStaRec,
- IN UINT_8 ucUP,
- IN UINT_8 ucBssIndex,
- IN BOOLEAN fgBMC,
- IN BOOLEAN fgIsBurstEnd, IN BOOLEAN ucPacketType, IN BOOLEAN ucPsSessionID, IN BOOLEAN fgSetEOSP)
- {
- P_MSDU_INFO_T prMsduInfo;
- UINT_16 u2EstimatedFrameLen;
- P_WLAN_MAC_HEADER_QOS_T prQoSNullFrame;
- DEBUGFUNC("testPsSendQoSNullFrame");
- DBGLOG(SW4, LOUD, "\n");
- /* 4 <1> Allocate a PKT_INFO_T for Null Frame */
- /* Init with MGMT Header Length */
- u2EstimatedFrameLen = MAC_TX_RESERVED_FIELD + WLAN_MAC_HEADER_QOS_LEN;
- /* Allocate a MSDU_INFO_T */
- prMsduInfo = cnmMgtPktAlloc(prAdapter, u2EstimatedFrameLen);
- if (prMsduInfo == NULL) {
- DBGLOG(SW4, WARN, "No PKT_INFO_T for sending Null Frame.\n");
- return;
- }
- /* 4 <2> Compose Null frame in MSDU_INfO_T. */
- bssComposeQoSNullFrame(prAdapter,
- (PUINT_8) ((ULONG) (prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD),
- prStaRec, ucUP, fgSetEOSP);
- TX_SET_MMPDU(prAdapter,
- prMsduInfo,
- ucBssIndex,
- prStaRec->ucIndex, WLAN_MAC_HEADER_QOS_LEN, WLAN_MAC_HEADER_QOS_LEN, NULL, MSDU_RATE_MODE_AUTO);
- prMsduInfo->ucUserPriority = ucUP;
- prMsduInfo->ucPacketType = ucPacketType;
- prQoSNullFrame = (P_WLAN_MAC_HEADER_QOS_T) ((PUINT_8)
- ((ULONG) (prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD));
- if (fgBMC)
- prQoSNullFrame->aucAddr1[0] = 0xfd;
- else
- prQoSNullFrame->aucAddr1[5] = 0xdd;
- /* 4 <4> Inform TXM to send this Null frame. */
- nicTxEnqueueMsdu(prAdapter, prMsduInfo);
- }
- VOID testPsSetupBss(IN P_ADAPTER_T prAdapter, IN UINT_8 ucBssIndex)
- {
- P_BSS_INFO_T prBssInfo;
- UINT_8 _aucZeroMacAddr[] = NULL_MAC_ADDR;
- DEBUGFUNC("testPsSetupBss()");
- DBGLOG(SW4, INFO, "index %d\n", ucBssIndex);
- prBssInfo = GET_BSS_INFO_BY_INDEX(prAdapter, ucBssIndex);
- /* 4 <1.2> Initiate PWR STATE */
- /* SET_NET_PWR_STATE_IDLE(prAdapter, ucNetworkTypeIndex); */
- /* 4 <2> Initiate BSS_INFO_T - common part */
- BSS_INFO_INIT(prAdapter, prBssInfo);
- prBssInfo->eConnectionState = PARAM_MEDIA_STATE_DISCONNECTED;
- prBssInfo->eConnectionStateIndicated = PARAM_MEDIA_STATE_DISCONNECTED;
- prBssInfo->eCurrentOPMode = OP_MODE_ACCESS_POINT;
- prBssInfo->fgIsNetActive = TRUE;
- prBssInfo->ucBssIndex = ucBssIndex;
- prBssInfo->ucReasonOfDisconnect = DISCONNECT_REASON_CODE_RESERVED;
- prBssInfo->ucPhyTypeSet = PHY_TYPE_SET_802_11BG; /* Depend on eBand */
- prBssInfo->ucConfigAdHocAPMode = AP_MODE_MIXED_11BG; /* Depend on eCurrentOPMode and ucPhyTypeSet */
- prBssInfo->u2BSSBasicRateSet = RATE_SET_ERP;
- prBssInfo->u2OperationalRateSet = RATE_SET_OFDM;
- prBssInfo->fgErpProtectMode = FALSE;
- prBssInfo->fgIsQBSS = TRUE;
- /* 4 <1.5> Setup MIB for current BSS */
- prBssInfo->u2BeaconInterval = 100;
- prBssInfo->ucDTIMPeriod = DOT11_DTIM_PERIOD_DEFAULT;
- prBssInfo->u2ATIMWindow = 0;
- prBssInfo->ucBeaconTimeoutCount = 0;
- bssInitForAP(prAdapter, prBssInfo, TRUE);
- COPY_MAC_ADDR(prBssInfo->aucBSSID, _aucZeroMacAddr);
- LINK_INITIALIZE(&prBssInfo->rStaRecOfClientList);
- prBssInfo->fgIsBeaconActivated = TRUE;
- prBssInfo->u2HwDefaultFixedRateCode = RATE_CCK_1M_LONG;
- COPY_MAC_ADDR(prBssInfo->aucOwnMacAddr, prAdapter->rWifiVar.aucMacAddress);
- /* 4 <3> Initiate BSS_INFO_T - private part */
- /* TODO */
- prBssInfo->eBand = BAND_2G4;
- prBssInfo->ucPrimaryChannel = 1;
- prBssInfo->prStaRecOfAP = (P_STA_RECORD_T) NULL;
- /* prBssInfo->fgErpProtectMode = eErpProectMode; */
- /* prBssInfo->eHtProtectMode = eHtProtectMode; */
- /* prBssInfo->eGfOperationMode = eGfOperationMode; */
- /* 4 <4> Allocate MSDU_INFO_T for Beacon */
- prBssInfo->prBeacon = cnmMgtPktAlloc(prAdapter, OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem[0]) + MAX_IE_LENGTH);
- if (prBssInfo->prBeacon) {
- prBssInfo->prBeacon->eSrc = TX_PACKET_MGMT;
- prBssInfo->prBeacon->ucBssIndex = ucBssIndex;
- } else {
- DBGLOG(SW4, INFO, "prBeacon allocation fail\n");
- }
- #if 0
- prBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = PM_UAPSD_ALL;
- prBssInfo->rPmProfSetupInfo.ucBmpTriggerAC = PM_UAPSD_ALL;
- prBssInfo->rPmProfSetupInfo.ucUapsdSp = WMM_MAX_SP_LENGTH_2;
- #else
- prBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = (UINT_8) prAdapter->u4UapsdAcBmp;
- prBssInfo->rPmProfSetupInfo.ucBmpTriggerAC = (UINT_8) prAdapter->u4UapsdAcBmp;
- prBssInfo->rPmProfSetupInfo.ucUapsdSp = (UINT_8) prAdapter->u4MaxSpLen;
- #endif
- #if 0
- for (eAci = 0; eAci < WMM_AC_INDEX_NUM; eAci++) {
- prBssInfo->arACQueParms[eAci].ucIsACMSet = FALSE;
- prBssInfo->arACQueParms[eAci].u2Aifsn = (UINT_16) eAci;
- prBssInfo->arACQueParms[eAci].u2CWmin = 7;
- prBssInfo->arACQueParms[eAci].u2CWmax = 31;
- prBssInfo->arACQueParms[eAci].u2TxopLimit = eAci + 1;
- DBGLOG(SW4, INFO,
- "MQM: eAci = %d, ACM = %d, Aifsn = %d, CWmin = %d, CWmax = %d, TxopLimit = %d\n",
- eAci, prBssInfo->arACQueParms[eAci].ucIsACMSet,
- prBssInfo->arACQueParms[eAci].u2Aifsn,
- prBssInfo->arACQueParms[eAci].u2CWmin,
- prBssInfo->arACQueParms[eAci].u2CWmax, prBssInfo->arACQueParms[eAci].u2TxopLimit);
- }
- #endif
- DBGLOG(SW4, INFO, "[2] ucBmpDeliveryAC:0x%x, ucBmpTriggerAC:0x%x, ucUapsdSp:0x%x",
- prBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC,
- prBssInfo->rPmProfSetupInfo.ucBmpTriggerAC, prBssInfo->rPmProfSetupInfo.ucUapsdSp);
- }
- VOID testPsCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0, UINT_8 ucOpt1)
- {
- UINT_8 ucIndex, ucRead;
- P_STA_RECORD_T prStaRec;
- DEBUGFUNC("testPsCmdCategory0");
- SWCR_GET_RW_INDEX(ucAction, ucRead, ucIndex);
- DBGLOG(SW4, LOUD, "Read %u Index %u\n", ucRead, ucIndex);
- prStaRec = cnmGetStaRecByIndex(prAdapter, 0);
- if (ucIndex >= TEST_PS_CATA0_INDEX_NUM)
- return;
- if (ucRead == SWCR_WRITE) {
- switch (ucIndex) {
- case TEST_PS_SETUP_BSS:
- testPsSetupBss(prAdapter, ucOpt0);
- break;
- case TEST_PS_ENABLE_BEACON:
- break;
- case TEST_PS_TRIGGER_BMC:
- /* txmForwardQueuedBmcPkts (ucOpt0); */
- break;
- case TEST_PS_SEND_NULL:
- {
- testPsSendQoSNullFrame(prAdapter, prStaRec, (UINT_8) (g_au4SwCr[1] & 0xFF), /* UP */
- ucOpt0, (BOOLEAN) ((g_au4SwCr[1] >> 8) & 0xFF), /* BMC */
- (BOOLEAN) ((g_au4SwCr[1] >> 16) & 0xFF), /* BurstEnd */
- (BOOLEAN) ((g_au4SwCr[1] >> 24) & 0xFF), /* Packet type */
- (UINT_8) ((g_au4SwCr[2]) & 0xFF), /* PS sesson ID 7: NOACK */
- FALSE /* EOSP */
- );
- }
- break;
- case TEST_PS_BUFFER_BMC:
- /* g_aprBssInfo[ucOpt0]->fgApToBufferBMC = (g_au4SwCr[1] & 0xFF); */
- break;
- case TEST_PS_UPDATE_BEACON:
- bssUpdateBeaconContent(prAdapter, ucOpt0 /*networktype */);
- break;
- default:
- break;
- }
- } else {
- switch (ucIndex) {
- case TEST_PS_MAGIC:
- g_au4SwCr[1] = 0x88660011;
- break;
- }
- }
- }
- #endif /* TEST_PS */
- #if TEST_PS
- VOID testPsCmdCategory1(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0, UINT_8 ucOpt1)
- {
- UINT_8 ucIndex, ucRead;
- UINT_8 ucWTEntry;
- P_STA_RECORD_T prStaRec;
- DEBUGFUNC("testPsCmdCategory1");
- SWCR_GET_RW_INDEX(ucAction, ucRead, ucIndex);
- if (ucOpt0 >= CFG_STA_REC_NUM)
- return;
- prStaRec = cnmGetStaRecByIndex(prAdapter, ucOpt0);
- if (!prStaRec)
- return;
- ucWTEntry = prStaRec->ucWlanIndex;
- if (ucRead == SWCR_WRITE) {
- switch (ucIndex) {
- case TEST_PS_STA_PS:
- prStaRec->fgIsInPS = (BOOLEAN) (g_au4SwCr[1] & 0x1);
- prStaRec->fgIsQoS = (BOOLEAN) (g_au4SwCr[1] >> 8 & 0xFF);
- prStaRec->fgIsUapsdSupported = (BOOLEAN) (g_au4SwCr[1] >> 16 & 0xFF);
- prStaRec->ucBmpDeliveryAC = (BOOLEAN) (g_au4SwCr[1] >> 24 & 0xFF);
- break;
- }
- } else {
- /* Read */
- switch (ucIndex) {
- default:
- break;
- }
- }
- }
- #endif /* TEST_PS */
- #if CFG_SUPPORT_802_11V
- #if (CFG_SUPPORT_802_11V_TIMING_MEASUREMENT == 1) && (WNM_UNIT_TEST == 1)
- VOID testWNMCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0, UINT_8 ucOpt1)
- {
- UINT_8 ucIndex, ucRead;
- P_STA_RECORD_T prStaRec;
- DEBUGFUNC("testWNMCmdCategory0");
- SWCR_GET_RW_INDEX(ucAction, ucRead, ucIndex);
- DBGLOG(SW4, INFO, "Read %u Index %u\n", ucRead, ucIndex);
- if (ucIndex >= TEST_WNM_CATA0_INDEX_NUM)
- return;
- if (ucRead == SWCR_WRITE) {
- switch (ucIndex) {
- case TEST_WNM_TIMING_MEAS:
- wnmTimingMeasUnitTest1(prAdapter, ucOpt0);
- break;
- default:
- break;
- }
- }
- }
- #endif /* TEST_WNM */
- #endif /* CFG_SUPPORT_802_11V */
- VOID swCtrlSwCr(P_ADAPTER_T prAdapter, UINT_8 ucRead, UINT_16 u2Addr, UINT_32 *pu4Data)
- {
- /* According other register STAIDX */
- UINT_8 ucOffset;
- ucOffset = (u2Addr >> 2) & 0x3F;
- if (ucOffset >= SWCR_CR_NUM)
- return;
- if (ucRead == SWCR_WRITE) {
- g_au4SwCr[ucOffset] = *pu4Data;
- if (ucOffset == 0x0) {
- /* Commmand [31:24]: Category */
- /* Commmand [23:23]: 1(W) 0(R) */
- /* Commmand [22:16]: Index */
- /* Commmand [15:08]: Option0 */
- /* Commmand [07:00]: Option1 */
- UINT_8 ucCate;
- UINT_32 u4Cmd;
- u4Cmd = g_au4SwCr[0];
- ucCate = (UINT_8) (u4Cmd >> 24);
- if (ucCate < sizeof(g_arSwCtrlCmd) / sizeof(g_arSwCtrlCmd[0])) {
- if (g_arSwCtrlCmd[ucCate] != NULL) {
- g_arSwCtrlCmd[ucCate] (prAdapter, ucCate,
- (UINT_8) (u4Cmd >> 16 & 0xFF),
- (UINT_8) ((u4Cmd >> 8) & 0xFF), (UINT_8) (u4Cmd & 0xFF));
- }
- }
- }
- } else {
- *pu4Data = g_au4SwCr[ucOffset];
- }
- }
- VOID swCrReadWriteCmd(P_ADAPTER_T prAdapter, UINT_8 ucRead, UINT_16 u2Addr, UINT_32 *pu4Data)
- {
- UINT_8 ucMod;
- ucMod = u2Addr >> 8;
- /* Address [15:8] MOD ID */
- /* Address [7:0] OFFSET */
- DEBUGFUNC("swCrReadWriteCmd");
- DBGLOG(SW4, TRACE, "%u addr 0x%x data 0x%x\n", ucRead, u2Addr, *pu4Data);
- if (ucMod < (sizeof(g_arSwCrModHandle) / sizeof(g_arSwCrModHandle[0]))) {
- if (g_arSwCrModHandle[ucMod] != NULL)
- g_arSwCrModHandle[ucMod] (prAdapter, ucRead, u2Addr, pu4Data);
- } /* ucMod */
- }
- /* Debug Support */
- VOID swCrFrameCheckEnable(P_ADAPTER_T prAdapter, UINT_32 u4DumpType)
- {
- g_u4SwcrDebugFrameDumpType = u4DumpType;
- #if CFG_RX_PKTS_DUMP
- prAdapter->rRxCtrl.u4RxPktsDumpTypeMask = u4DumpType;
- #endif
- }
- VOID swCrDebugInit(P_ADAPTER_T prAdapter)
- {
- /* frame dump */
- if (g_u4SwcrDebugFrameDumpType)
- swCrFrameCheckEnable(prAdapter, g_u4SwcrDebugFrameDumpType);
- /* debug counter */
- g_fgSwcrDebugTimer = FALSE;
- cnmTimerInitTimer(prAdapter, &g_rSwcrDebugTimer, (PFN_MGMT_TIMEOUT_FUNC) swCrDebugCheckTimeout, (ULONG) NULL);
- if (g_u4SwcrDebugCheckTimeout)
- swCrDebugCheckEnable(prAdapter, TRUE, g_ucSwcrDebugCheckType, g_u4SwcrDebugCheckTimeout);
- }
- VOID swCrDebugUninit(P_ADAPTER_T prAdapter)
- {
- cnmTimerStopTimer(prAdapter, &g_rSwcrDebugTimer);
- g_fgSwcrDebugTimer = FALSE;
- }
- VOID swCrDebugCheckEnable(P_ADAPTER_T prAdapter, BOOLEAN fgIsEnable, UINT_8 ucType, UINT_32 u4Timeout)
- {
- if (fgIsEnable) {
- g_ucSwcrDebugCheckType = ucType;
- g_u4SwcrDebugCheckTimeout = u4Timeout;
- if (g_fgSwcrDebugTimer == FALSE)
- swCrDebugCheckTimeout(prAdapter, 0);
- } else {
- cnmTimerStopTimer(prAdapter, &g_rSwcrDebugTimer);
- g_u4SwcrDebugCheckTimeout = 0;
- }
- g_fgSwcrDebugTimer = fgIsEnable;
- }
- VOID swCrDebugCheck(P_ADAPTER_T prAdapter, P_CMD_SW_DBG_CTRL_T prCmdSwCtrl)
- {
- P_RX_CTRL_T prRxCtrl;
- P_TX_CTRL_T prTxCtrl;
- ASSERT(prAdapter);
- prTxCtrl = &prAdapter->rTxCtrl;
- prRxCtrl = &prAdapter->rRxCtrl;
- /* dump counters */
- if (prCmdSwCtrl) {
- if (prCmdSwCtrl->u4Data == SWCR_DBG_TYPE_ALL) {
- /* TX Counter from fw */
- DBGLOG(SW4, INFO, "TX0\n"
- "%08x %08x %08x %08x\n"
- "%08x %08x %08x %08x\n",
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_BCN_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_FAILED_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_RETRY_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_AGING_TIMEOUT_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_PS_OVERFLOW_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_MGNT_DROP_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_ERROR_CNT]);
- #if 1
- /* TX Counter from drv */
- DBGLOG(SW4, INFO, "TX1\n"
- "%08x %08x %08x %08x\n",
- (UINT_32) TX_GET_CNT(prTxCtrl, TX_INACTIVE_BSS_DROP),
- (UINT_32) TX_GET_CNT(prTxCtrl, TX_INACTIVE_STA_DROP),
- (UINT_32) TX_GET_CNT(prTxCtrl, TX_FORWARD_OVERFLOW_DROP),
- (UINT_32) TX_GET_CNT(prTxCtrl, TX_AP_BORADCAST_DROP));
- #endif
- /* RX Counter */
- DBGLOG(SW4, INFO, "RX0\n"
- "%08x %08x %08x %08x\n"
- "%08x %08x %08x %08x\n"
- "%08x %08x %08x %08x\n"
- "%08x %08x %08x %08x\n",
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_DROP_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_DUP_DROP_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_TYPE_ERROR_DROP_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_CLASS_ERROR_DROP_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_AMPDU_ERROR_DROP_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_STATUS_ERROR_DROP_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_FORMAT_ERROR_DROP_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_ICV_ERROR_DROP_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_KEY_ERROR_DROP_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_TKIP_ERROR_DROP_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_MIC_ERROR_DROP_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_BIP_ERROR_DROP_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_FCSERR_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_FIFOFULL_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_PFDROP_CNT]);
- DBGLOG(SW4, INFO, "RX1\n"
- "%08x %08x %08x %08x\n"
- "%08x %08x %08x %08x\n",
- (UINT_32) RX_GET_CNT(prRxCtrl, RX_MPDU_TOTAL_COUNT),
- (UINT_32) RX_GET_CNT(prRxCtrl, RX_DATA_INDICATION_COUNT),
- (UINT_32) RX_GET_CNT(prRxCtrl, RX_DATA_RETURNED_COUNT),
- (UINT_32) RX_GET_CNT(prRxCtrl, RX_DATA_RETAINED_COUNT),
- (UINT_32) RX_GET_CNT(prRxCtrl, RX_DROP_TOTAL_COUNT),
- (UINT_32) RX_GET_CNT(prRxCtrl, RX_TYPE_ERR_DROP_COUNT),
- (UINT_32) RX_GET_CNT(prRxCtrl, RX_CLASS_ERR_DROP_COUNT),
- (UINT_32) RX_GET_CNT(prRxCtrl, RX_DST_NULL_DROP_COUNT));
- DBGLOG(SW4, INFO, "PWR\n"
- "%08x %08x %08x %08x\n"
- "%08x %08x %08x %08x\n",
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_PS_POLL_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_TRIGGER_NULL_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_BCN_IND_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_BCN_TIMEOUT_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_PM_STATE0],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_PM_STATE1],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_CUR_PS_PROF0],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_CUR_PS_PROF1]);
- DBGLOG(SW4, INFO, "ARM\n"
- "%08x %08x %08x %08x\n"
- "%08x %08x\n",
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_AR_STA0_RATE],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_AR_STA0_BWGI],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_AR_STA0_RX_RATE_RCPI],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_ROAMING_ENABLE],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_ROAMING_ROAM_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_ROAMING_INT_CNT]);
- DBGLOG(SW4, INFO, "BB\n"
- "%08x %08x %08x %08x\n"
- "%08x %08x %08x %08x\n",
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_RX_MDRDY_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_RX_FCSERR_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_CCK_PD_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_OFDM_PD_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_CCK_SFDERR_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_CCK_SIGERR_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_OFDM_TAGERR_CNT],
- prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_OFDM_SIGERR_CNT]);
- }
- }
- /* start the next check */
- if (g_u4SwcrDebugCheckTimeout)
- cnmTimerStartTimer(prAdapter, &g_rSwcrDebugTimer, g_u4SwcrDebugCheckTimeout * MSEC_PER_SEC);
- }
- VOID swCrDebugCheckTimeout(IN P_ADAPTER_T prAdapter, ULONG ulParamPtr)
- {
- CMD_SW_DBG_CTRL_T rCmdSwCtrl;
- WLAN_STATUS rStatus;
- rCmdSwCtrl.u4Id = (0xb000 << 16) + g_ucSwcrDebugCheckType;
- rCmdSwCtrl.u4Data = 0;
- rStatus = wlanSendSetQueryCmd(prAdapter, /* prAdapter */
- CMD_ID_SW_DBG_CTRL, /* ucCID */
- FALSE, /* fgSetQuery */
- TRUE, /* fgNeedResp */
- FALSE, /* fgIsOid */
- swCrDebugQuery, /* pfCmdDoneHandler */
- swCrDebugQueryTimeout, /* pfCmdTimeoutHandler */
- sizeof(CMD_SW_DBG_CTRL_T), /* u4SetQueryInfoLen */
- (PUINT_8) &rCmdSwCtrl, /* pucInfoBuffer */
- NULL, /* pvSetQueryBuffer */
- 0 /* u4SetQueryBufferLen */
- );
- ASSERT(rStatus == WLAN_STATUS_PENDING);
- }
- VOID swCrDebugQuery(IN P_ADAPTER_T prAdapter, IN P_CMD_INFO_T prCmdInfo, IN PUINT_8 pucEventBuf)
- {
- ASSERT(prAdapter);
- swCrDebugCheck(prAdapter, (P_CMD_SW_DBG_CTRL_T) (pucEventBuf));
- }
- VOID swCrDebugQueryTimeout(IN P_ADAPTER_T prAdapter, IN P_CMD_INFO_T prCmdInfo)
- {
- ASSERT(prAdapter);
- swCrDebugCheck(prAdapter, NULL);
- }
- #endif /* CFG_SUPPORT_SWCR */
|