2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/swcr.c#1 $
15 * 06 04 2012 tsaiyuan.hsu
16 * [WCXRP00001249] [ALPS.ICS] Daily build warning on "wlan/mgmt/swcr.c#1"
17 * resolve build waring for "WNM_UNIT_TEST not defined".
21 * Sync CFG80211 modification from branch 2,2.
23 * 01 05 2012 tsaiyuan.hsu
24 * [WCXRP00001157] [MT6620 Wi-Fi][FW][DRV] add timing measurement support for 802.11v
25 * add timing measurement support for 802.11v.
27 * 11 22 2011 tsaiyuan.hsu
28 * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
29 * keep debug counter setting after wake up.
33 * Fix compiling warning
35 * 11 11 2011 tsaiyuan.hsu
36 * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
37 * fix debug counters of rx in driver.
39 * 11 11 2011 tsaiyuan.hsu
40 * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
41 * add debug counters of bb and ar for xlog.
43 * 11 10 2011 eddie.chen
44 * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog)
45 * Modify the QM xlog level and remove LOG_FUNC.
47 * 11 08 2011 tsaiyuan.hsu
48 * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
49 * add debug counters, eCurPsProf, for PS.
51 * 11 07 2011 tsaiyuan.hsu
52 * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
53 * add debug counters and periodically dump counters for debugging.
56 * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG
57 * change the DBGLOG for "\n" and "\r\n". LABEL to LOUD for XLOG
59 * 08 31 2011 tsaiyuan.hsu
60 * [WCXRP00000931] [MT5931 Wi-Fi][DRV/FW] add swcr to disable roaming from driver
61 * remove obsolete code.
63 * 08 15 2011 tsaiyuan.hsu
64 * [WCXRP00000931] [MT5931 Wi-Fi][DRV/FW] add swcr to disable roaming from driver
65 * add swcr in driver reg, 0x9fxx0000, to disable roaming .
67 * 05 11 2011 eddie.chen
68 * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet
69 * Fix dest type when GO packet copying.
71 * 05 09 2011 eddie.chen
72 * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet
73 * Check free number before copying broadcast packet.
75 * 04 14 2011 eddie.chen
76 * [WCXRP00000603] [MT6620 Wi-Fi][DRV] Fix Klocwork warning
77 * Check the SW RFB free. Fix the compile warning..
79 * 04 12 2011 eddie.chen
80 * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma
81 * Fix the sta index in processing security frame
82 * Simple flow control for TC4 to avoid mgt frames for PS STA to occupy the TC4
85 * 03 28 2011 eddie.chen
86 * [WCXRP00000603] [MT6620 Wi-Fi][DRV] Fix Klocwork warning
87 * Fix Klockwork warning.
89 * 03 15 2011 eddie.chen
90 * [WCXRP00000554] [MT6620 Wi-Fi][DRV] Add sw control debug counter
91 * Add sw debug counter for QM.
93 * 01 11 2011 eddie.chen
94 * [WCXRP00000322] Add WMM IE in beacon,
95 Add per station flow control when STA is in PS
103 /*******************************************************************************
104 * C O M P I L E R F L A G S
105 ********************************************************************************
108 /*******************************************************************************
109 * E X T E R N A L R E F E R E N C E S
110 ********************************************************************************
117 #pragma GCC diagnostic ignored "-Wformat"
119 /*******************************************************************************
121 ********************************************************************************
124 /*******************************************************************************
125 * P U B L I C D A T A
126 ********************************************************************************
129 extern SWCR_MAP_ENTRY_T g_arRlmArSwCrMap[];
130 SWCR_MOD_MAP_ENTRY_T g_arSwCrAllMaps[] = {
131 { SWCR_MAP_NUM(g_arRlmArSwCrMap), g_arRlmArSwCrMap}, /* 0x00nn */
136 VOID swCtrlCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1);
137 VOID swCtrlCmdCategory1(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1);
138 VOID testPsCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1);
139 VOID testPsCmdCategory1(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1);
140 void testWNMCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1);
141 VOID swCtrlSwCr(P_ADAPTER_T prAdapter, UINT_8 ucRead, UINT_16 u2Addr, UINT_32 *pu4Data);
144 VOID swCrDebugCheck(P_ADAPTER_T prAdapter, P_CMD_SW_DBG_CTRL_T prCmdSwCtrl);
145 VOID swCrDebugCheckTimeout(
146 IN P_ADAPTER_T prAdapter,
149 IN P_ADAPTER_T prAdapter,
150 IN P_CMD_INFO_T prCmdInfo,
151 IN PUINT_8 pucEventBuf
153 VOID swCrDebugQueryTimeout(
154 IN P_ADAPTER_T prAdapter,
155 IN P_CMD_INFO_T prCmdInfo);
157 UINT_32 g_au4SwCr[SWCR_CR_NUM]; /*: 0: command other: data */
160 UINT_32 g_u4mDNSRXFilter = 0; /* [31] 0: stop 1: start, [3] IPv6 [2] IPv4*/
162 static TIMER_T g_rSwcrDebugTimer;
163 static BOOLEAN g_fgSwcrDebugTimer = FALSE;
164 static UINT_32 g_u4SwcrDebugCheckTimeout = 0;
165 static ENUM_SWCR_DBG_TYPE_T g_ucSwcrDebugCheckType = 0;
166 static UINT_32 g_u4SwcrDebugFrameDumpType = 0;
168 /*******************************************************************************
169 * P R I V A T E D A T A
170 ********************************************************************************
174 const static PFN_CMD_RW_T g_arSwCtrlCmd[] ={
181 #if CFG_SUPPORT_802_11V
182 #if (CFG_SUPPORT_802_11V_TIMING_MEASUREMENT ==1) && (WNM_UNIT_TEST ==1)
183 , testWNMCmdCategory0
189 const PFN_SWCR_RW_T g_arSwCrModHandle[] = {
195 /*******************************************************************************
197 ********************************************************************************
210 SWCTRL_DUMP_ALL_QUEUE_LEN,
214 SWCTRL_DUMP_QM_DBG_CNT,
217 SWCTRL_RX_MDNS_FILTER,
218 SWCTRL_CATA0_INDEX_NUM
225 SWCTRL_CATA1_INDEX_NUM
229 #define RX_MDNS_FILTER_START (1<<31)
230 #define RX_MDNS_FILTER_IPV4 (1<<2)
231 #define RX_MDNS_FILTER_IPV6 (1<<3)
232 typedef enum _ENUM_SWCR_RX_MDNS_FILTER_CMD_T {
233 SWCR_RX_MDNS_FILTER_CMD_STOP = 0,
234 SWCR_RX_MDNS_FILTER_CMD_START,
235 SWCR_RX_MDNS_FILTER_CMD_ADD,
236 SWCR_RX_MDNS_FILTER_CMD_REMOVE,
237 SWCR_RX_MDNS_FILTER_NUM
238 } ENUM_SWCR_RX_MDNS_FILTER_CMD_T;
244 TEST_PS_ENABLE_BEACON,
248 TEST_PS_UPDATE_BEACON,
249 TEST_PS_CATA0_INDEX_NUM
254 TEST_PS_STA_ENTER_PS,
256 TEST_PS_STA_TRIGGER_PSPOLL,
257 TEST_PS_STA_TRIGGER_FRAME,
258 TEST_PS_CATA1_INDEX_NUM
262 #if CFG_SUPPORT_802_11V
265 TEST_WNM_TIMING_MEAS,
266 TEST_WNM_CATA0_INDEX_NUM
272 #define _SWCTRL_MAGIC 0x66201642
274 /*******************************************************************************
275 * F U N C T I O N D E C L A R A T I O N S
276 ********************************************************************************
280 /*******************************************************************************
282 ********************************************************************************
285 void dumpQueue(P_ADAPTER_T prAdapter)
288 P_TX_CTRL_T prTxCtrl;
290 P_GLUE_INFO_T prGlueInfo;
295 DEBUGFUNC("dumpQueue");
297 prTxCtrl = &prAdapter->rTxCtrl;
298 prQM = &prAdapter->rQM;
299 prGlueInfo = prAdapter->prGlueInfo;
301 for(i = TC0_INDEX; i<=TC5_INDEX; i++) {
302 DBGLOG(SW4, INFO,( "TC %u\n",i));
303 DBGLOG(SW4, INFO,( "Max %u Free %u\n",
304 prTxCtrl->rTc.aucMaxNumOfBuffer[i], prTxCtrl->rTc.aucFreeBufferCount[i]));
306 DBGLOG(SW4, INFO,("Average %u minReserved %u CurrentTcResource %u GuaranteedTcResource %u\n",
307 QM_GET_TX_QUEUE_LEN(prAdapter, i),
308 prQM->au4MinReservedTcResource[i],
309 prQM->au4CurrentTcResource[i],
310 prQM->au4GuaranteedTcResource[i]));
315 for(i = 0; i<NUM_OF_PER_STA_TX_QUEUES; i++) {
316 DBGLOG(SW4, INFO,( "TC %u HeadStaIdx %u ForwardCount %u\n",i, prQM->au4HeadStaRecIndex[i],prQM->au4ForwardCount[i]));
319 DBGLOG(SW4, INFO,( "BMC or unknown TxQueue Len %u\n",prQM->arTxQueue[0].u4NumElem));
320 DBGLOG(SW4, INFO,( "Pending %d\n",prGlueInfo->i4TxPendingFrameNum));
321 DBGLOG(SW4, INFO,( "Pending Security %d\n",prGlueInfo->i4TxPendingSecurityFrameNum));
324 for(j=0;j<CFG_MAX_TXQ_NUM;j++){
325 DBGLOG(SW4, INFO,( "Pending Q[%u][%u] %d\n",i,j,prGlueInfo->ai4TxPendingFrameNumPerQueue[i][j]));
330 DBGLOG(SW4, INFO,( " rFreeSwRfbList %u\n", prAdapter->rRxCtrl.rFreeSwRfbList.u4NumElem));
331 DBGLOG(SW4, INFO,( " rReceivedRfbList %u\n", prAdapter->rRxCtrl.rReceivedRfbList.u4NumElem));
332 DBGLOG(SW4, INFO,( " rIndicatedRfbList %u\n", prAdapter->rRxCtrl.rIndicatedRfbList.u4NumElem));
333 DBGLOG(SW4, INFO,( " ucNumIndPacket %u\n", prAdapter->rRxCtrl.ucNumIndPacket));
334 DBGLOG(SW4, INFO,( " ucNumRetainedPacket %u\n", prAdapter->rRxCtrl.ucNumRetainedPacket));
340 void dumpSTA(P_ADAPTER_T prAdapter, P_STA_RECORD_T prStaRec)
344 P_BSS_INFO_T prBssInfo;
346 DEBUGFUNC("dumpSTA");
349 ucWTEntry = prStaRec->ucWTEntry;
351 prBssInfo = &prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex];
354 DBGLOG(SW4, INFO,("Mac address: " MACSTR " Rcpi %u" "\n", MAC2STR(prStaRec->aucMacAddr),prStaRec->ucRCPI));
356 DBGLOG(SW4, INFO,("Idx %u Wtbl %u Used %u State %u Bss Phy 0x%x Sta DesiredPhy 0x%x\n",
357 prStaRec->ucIndex, ucWTEntry,
358 prStaRec->fgIsInUse,prStaRec->ucStaState,
359 prBssInfo->ucPhyTypeSet,
360 prStaRec->ucDesiredPhyTypeSet));
362 DBGLOG(SW4, INFO,("Sta Operation 0x%x DesiredNontHtRateSet 0x%x Mcs 0x%x u2HtCapInfo 0x%x\n",
363 prStaRec->u2OperationalRateSet,prStaRec->u2DesiredNonHTRateSet,prStaRec->ucMcsSet, prStaRec->u2HtCapInfo));
366 for(i = 0; i<NUM_OF_PER_STA_TX_QUEUES; i++) {
367 DBGLOG(SW4, INFO,( "TC %u Queue Len %u\n",i,prStaRec->arTxQueue[i].u4NumElem));
370 DBGLOG(SW4, INFO, ("BmpDeliveryAC %x\n",prStaRec->ucBmpDeliveryAC));
371 DBGLOG(SW4, INFO, ("BmpTriggerAC %x\n",prStaRec->ucBmpTriggerAC));
372 DBGLOG(SW4, INFO, ("UapsdSpSupproted %u\n",prStaRec->fgIsUapsdSupported));
373 DBGLOG(SW4, INFO, ("IsQoS %u\n",prStaRec->fgIsQoS));
374 DBGLOG(SW4, INFO, ("AssocId %u\n",prStaRec->u2AssocId));
376 DBGLOG(SW4, INFO, ("fgIsInPS %u\n",prStaRec->fgIsInPS));
377 DBGLOG(SW4, INFO, ("ucFreeQuota %u\n",prStaRec->ucFreeQuota));
378 DBGLOG(SW4, INFO, ("ucFreeQuotaForDelivery %u\n",prStaRec->ucFreeQuotaForDelivery));
379 DBGLOG(SW4, INFO, ("ucFreeQuotaForNonDelivery %u\n",prStaRec->ucFreeQuotaForNonDelivery));
383 DBGLOG(SW4, INFO, ("IsQmmSup %u\n",prStaRec->fgIsWmmSupported));
384 DBGLOG(SW4, INFO, ("IsUapsdSup %u\n",prStaRec->fgIsUapsdSupported));
385 DBGLOG(SW4, INFO, ("AvailabaleDeliverPkts %u\n",prStaRec->ucAvailableDeliverPkts));
386 DBGLOG(SW4, INFO, ("BmpDeliverPktsAC %u\n",prStaRec->u4BmpDeliverPktsAC));
387 DBGLOG(SW4, INFO, ("BmpBufferAC %u\n",prStaRec->u4BmpBufferAC));
388 DBGLOG(SW4, INFO, ("BmpNonDeliverPktsAC %u\n",prStaRec->u4BmpNonDeliverPktsAC));
391 for(i=0;i<CFG_RX_MAX_BA_TID_NUM;i++) {
392 if(prStaRec->aprRxReorderParamRefTbl[i]){
393 DBGLOG(SW4, INFO,("RxReorder fgIsValid: %u\n",prStaRec->aprRxReorderParamRefTbl[i]->fgIsValid));
394 DBGLOG(SW4, INFO,("RxReorder Tid: %u\n",prStaRec->aprRxReorderParamRefTbl[i]->ucTid));
395 DBGLOG(SW4, INFO,("RxReorder rReOrderQue Len: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->rReOrderQue.u4NumElem));
396 DBGLOG(SW4, INFO,("RxReorder WinStart: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->u2WinStart));
397 DBGLOG(SW4, INFO,("RxReorder WinEnd: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->u2WinEnd));
398 DBGLOG(SW4, INFO,("RxReorder WinSize: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->u2WinSize));
405 VOID dumpBss(P_ADAPTER_T prAdapter, P_BSS_INFO_T prBssInfo)
408 DBGLOG(SW4, INFO, ("SSID %s\n",prBssInfo->aucSSID));
409 DBGLOG(SW4, INFO, ("OWN " MACSTR"\n",MAC2STR(prBssInfo->aucOwnMacAddr)));
410 DBGLOG(SW4, INFO, ("BSSID " MACSTR"\n",MAC2STR(prBssInfo->aucBSSID)));
411 DBGLOG(SW4, INFO, ("ucNetTypeIndex %u\n",prBssInfo->ucNetTypeIndex));
412 DBGLOG(SW4, INFO, ("eConnectionState %u\n",prBssInfo->eConnectionState));
413 DBGLOG(SW4, INFO, ("eCurrentOPMode %u\n",prBssInfo->eCurrentOPMode));
414 DBGLOG(SW4, INFO, ("fgIsQBSS %u\n",prBssInfo->fgIsQBSS));
415 DBGLOG(SW4, INFO, ("fgIsShortPreambleAllowed %u\n",prBssInfo->fgIsShortPreambleAllowed));
416 DBGLOG(SW4, INFO, ("fgUseShortPreamble %u\n",prBssInfo->fgUseShortPreamble));
417 DBGLOG(SW4, INFO, ("fgUseShortSlotTime %u\n",prBssInfo->fgUseShortSlotTime));
418 DBGLOG(SW4, INFO, ("ucNonHTBasicPhyType %x\n",prBssInfo->ucNonHTBasicPhyType));
419 DBGLOG(SW4, INFO, ("u2OperationalRateSet %x\n",prBssInfo->u2OperationalRateSet));
420 DBGLOG(SW4, INFO, ("u2BSSBasicRateSet %x\n",prBssInfo->u2BSSBasicRateSet));
421 DBGLOG(SW4, INFO, ("ucPhyTypeSet %x\n",prBssInfo->ucPhyTypeSet));
422 DBGLOG(SW4, INFO, ("rStaRecOfClientList %d\n",prBssInfo->rStaRecOfClientList.u4NumElem));
423 DBGLOG(SW4, INFO, ("u2CapInfo %x\n",prBssInfo->u2CapInfo));
424 DBGLOG(SW4, INFO, ("u2ATIMWindow %x\n",prBssInfo->u2ATIMWindow));
425 DBGLOG(SW4, INFO, ("u2AssocId %x\n",prBssInfo->u2AssocId));
426 DBGLOG(SW4, INFO, ("ucDTIMPeriod %x\n",prBssInfo->ucDTIMPeriod));
427 DBGLOG(SW4, INFO, ("ucDTIMCount %x\n",prBssInfo->ucDTIMCount));
428 DBGLOG(SW4, INFO, ("fgIsNetAbsent %x\n", prBssInfo->fgIsNetAbsent));
429 DBGLOG(SW4, INFO, ("eBand %d\n", prBssInfo->eBand));
430 DBGLOG(SW4, INFO, ("ucPrimaryChannel %d\n", prBssInfo->ucPrimaryChannel));
431 DBGLOG(SW4, INFO, ("ucHtOpInfo1 %d\n", prBssInfo->ucHtOpInfo1));
432 DBGLOG(SW4, INFO, ("ucHtOpInfo2 %d\n", prBssInfo->u2HtOpInfo2));
433 DBGLOG(SW4, INFO, ("ucHtOpInfo3 %d\n", prBssInfo->u2HtOpInfo3));
434 DBGLOG(SW4, INFO, ("fgErpProtectMode %d\n", prBssInfo->fgErpProtectMode));
435 DBGLOG(SW4, INFO, ("eHtProtectMode %d\n", prBssInfo->eHtProtectMode));
436 DBGLOG(SW4, INFO, ("eGfOperationMode %d\n", prBssInfo->eGfOperationMode));
437 DBGLOG(SW4, INFO, ("eRifsOperationMode %d\n", prBssInfo->eRifsOperationMode));
438 DBGLOG(SW4, INFO, ("fgObssErpProtectMode %d\n", prBssInfo->fgObssErpProtectMode));
439 DBGLOG(SW4, INFO, ("eObssHtProtectMode %d\n", prBssInfo->eObssHtProtectMode));
440 DBGLOG(SW4, INFO, ("eObssGfProtectMode %d\n", prBssInfo->eObssGfOperationMode));
441 DBGLOG(SW4, INFO, ("fgObssRifsOperationMode %d\n", prBssInfo->fgObssRifsOperationMode));
442 DBGLOG(SW4, INFO, ("fgAssoc40mBwAllowed %d\n", prBssInfo->fgAssoc40mBwAllowed));
443 DBGLOG(SW4, INFO, ("fg40mBwAllowed %d\n", prBssInfo->fg40mBwAllowed));
444 DBGLOG(SW4, INFO, ("eBssSCO %d\n", prBssInfo->eBssSCO));
451 VOID swCtrlCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1)
453 UINT_8 ucIndex,ucRead;
456 DEBUGFUNC("swCtrlCmdCategory0");
458 SWCR_GET_RW_INDEX(ucAction,ucRead,ucIndex);
462 if(ucIndex>=SWCTRL_CATA0_INDEX_NUM) return;
464 if(ucRead == SWCR_WRITE) {
468 aucDebugModule[ucOpt0] = (UINT_8)g_au4SwCr[1];
471 case SWCTRL_WIFI_VAR:
475 case SWCTRL_DUMP_QM_DBG_CNT:
476 for(i=0;i<QM_DBG_CNT_NUM;i++) {
477 prAdapter->rQM.au4QmDebugCounters[i] = 0;
480 case SWCTRL_QM_DBG_CNT:
481 prAdapter->rQM.au4QmDebugCounters[ucOpt0] = g_au4SwCr[1];
486 case SWCTRL_RX_PKTS_DUMP:
487 //DBGLOG(SW4, INFO,("SWCTRL_RX_PKTS_DUMP: mask %x\n", g_au4SwCr[1]));
488 prAdapter->rRxCtrl.u4RxPktsDumpTypeMask = g_au4SwCr[1];
491 case SWCTRL_RX_MDNS_FILTER:
494 BOOLEAN fgUpdate = FALSE;
495 WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS;
497 if (ucOpt0 == SWCR_RX_MDNS_FILTER_CMD_STOP) {
498 g_u4mDNSRXFilter &= ~(RX_MDNS_FILTER_START);
500 u4rxfilter = prAdapter->u4OsPacketFilter;
503 else if (ucOpt0 == SWCR_RX_MDNS_FILTER_CMD_START) {
504 g_u4mDNSRXFilter |= (RX_MDNS_FILTER_START);
506 u4rxfilter = prAdapter->u4OsPacketFilter;
507 if ((g_u4mDNSRXFilter & RX_MDNS_FILTER_IPV4) ||
508 (g_u4mDNSRXFilter & RX_MDNS_FILTER_IPV6)) {
509 u4rxfilter |= PARAM_PACKET_FILTER_ALL_MULTICAST;
513 else if (ucOpt0 == SWCR_RX_MDNS_FILTER_CMD_ADD) {
515 g_u4mDNSRXFilter |= (1<<ucOpt1);
518 else if (ucOpt0 == SWCR_RX_MDNS_FILTER_CMD_REMOVE) {
520 g_u4mDNSRXFilter &= ~(1<<ucOpt1);
524 if (fgUpdate == TRUE) {
525 rStatus = wlanSendSetQueryCmd (
526 prAdapter, /* prAdapter */
527 CMD_ID_SET_RX_FILTER, /* ucCID */
528 TRUE, /* fgSetQuery */
529 FALSE, /* fgNeedResp */
531 NULL, /* pfCmdDoneHandler */
532 NULL, /* pfCmdTimeoutHandler */
533 sizeof(UINT_32), /* u4SetQueryInfoLen */
534 (PUINT_8) &u4rxfilter, /* pucInfoBuffer */
535 NULL, /* pvSetQueryBuffer */
536 0 /* un4SetQueryBufferLen */
539 //DBGLOG(SW4, INFO,("SWCTRL_RX_MDNS_FILTER: g_u4mDNSRXFilter %x ucOpt0 %x ucOpt1 %x fgUpdate %x u4rxfilter %x, rStatus %x\n",
540 // g_u4mDNSRXFilter, ucOpt0, ucOpt1, fgUpdate, u4rxfilter, rStatus));
551 g_au4SwCr[1] = aucDebugModule[ucOpt0] ;
555 g_au4SwCr[1] = _SWCTRL_MAGIC ;
556 DBGLOG(SW4, INFO,("BUILD TIME: %s %s\n", __DATE__, __TIME__));
560 P_QUE_MGT_T prQM = &prAdapter->rQM;
563 g_au4SwCr[1] = (QM_GET_TX_QUEUE_LEN(prAdapter, ucOpt1)) ;
564 g_au4SwCr[2] = prQM->au4MinReservedTcResource[ucOpt1] ;
565 g_au4SwCr[3] = prQM->au4CurrentTcResource[ucOpt1];
566 g_au4SwCr[4] = prQM->au4GuaranteedTcResource[ucOpt1];
570 g_au4SwCr[1] = prQM->au4ForwardCount[ucOpt1];
571 g_au4SwCr[2] = prQM->au4HeadStaRecIndex[ucOpt1];
575 g_au4SwCr[1] = prQM->arTxQueue[ucOpt1].u4NumElem; /* only one */
582 case SWCTRL_TX_CTRL_INFO:
584 P_TX_CTRL_T prTxCtrl;
585 prTxCtrl = &prAdapter->rTxCtrl;
588 g_au4SwCr[1] = prAdapter->rTxCtrl.rTc.aucFreeBufferCount[ucOpt1];
589 g_au4SwCr[2] = prAdapter->rTxCtrl.rTc.aucMaxNumOfBuffer[ucOpt1];
595 case SWCTRL_DUMP_QUEUE:
596 dumpQueue(prAdapter);
600 case SWCTRL_DUMP_QM_DBG_CNT:
601 for(i=0;i<QM_DBG_CNT_NUM;i++) {
602 DBGLOG(SW4, INFO,("QM:DBG %u %u\n",i , prAdapter->rQM.au4QmDebugCounters[i]));
606 case SWCTRL_QM_DBG_CNT:
607 g_au4SwCr[1] = prAdapter->rQM.au4QmDebugCounters[ucOpt0];
610 case SWCTRL_DUMP_BSS:
612 dumpBss(prAdapter, &(prAdapter->rWifiVar.arBssInfo[ucOpt0])) ;
624 VOID swCtrlCmdCategory1(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1)
626 UINT_8 ucIndex,ucRead;
628 P_STA_RECORD_T prStaRec;
630 DEBUGFUNC("swCtrlCmdCategory1");
632 SWCR_GET_RW_INDEX(ucAction,ucRead,ucIndex);
634 if(ucOpt0>=CFG_STA_REC_NUM) return;
636 //prStaRec = cnmGetStaRecByIndex (prAdapter, ucOpt0);
637 prStaRec = &prAdapter->arStaRec[ucOpt0];
638 ucWTEntry = prStaRec->ucWTEntry;
639 if(ucRead == SWCR_WRITE) {
644 case SWCTRL_STA_QUE_INFO:
646 g_au4SwCr[1] = prStaRec->arTxQueue[ucOpt1].u4NumElem;
649 case SWCTRL_STA_INFO:
652 g_au4SwCr[1] = prStaRec->fgIsInPS;
658 case SWCTRL_DUMP_STA:
660 dumpSTA(prAdapter, prStaRec);
676 testPsSendQoSNullFrame (
677 IN P_ADAPTER_T prAdapter,
678 IN P_STA_RECORD_T prStaRec,
680 IN UINT_8 ucNetTypeIndex,
682 IN BOOLEAN fgIsBurstEnd,
683 IN BOOLEAN ucPacketType,
684 IN BOOLEAN ucPsSessionID,
688 P_MSDU_INFO_T prMsduInfo;
689 UINT_16 u2EstimatedFrameLen;
690 P_WLAN_MAC_HEADER_QOS_T prQoSNullFrame;
693 DEBUGFUNC("testPsSendQoSNullFrame");
694 DBGLOG(SW4, LOUD, ("\n"));
696 //4 <1> Allocate a PKT_INFO_T for Null Frame
697 /* Init with MGMT Header Length */
698 u2EstimatedFrameLen = MAC_TX_RESERVED_FIELD + \
699 WLAN_MAC_HEADER_QOS_LEN;
701 /* Allocate a MSDU_INFO_T */
702 if ( (prMsduInfo = cnmMgtPktAlloc(prAdapter, u2EstimatedFrameLen)) == NULL) {
703 DBGLOG(SW4, WARN, ("No PKT_INFO_T for sending Null Frame.\n"));
707 //4 <2> Compose Null frame in MSDU_INfO_T.
708 bssComposeQoSNullFrame(prAdapter,
709 (PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD),
715 prMsduInfo->eSrc = TX_PACKET_MGMT;
716 //prMsduInfo->ucPacketType = HIF_TX_PACKET_TYPE_DATA;
717 prMsduInfo->ucPacketType = ucPacketType;
718 prMsduInfo->ucStaRecIndex = prStaRec->ucIndex;
719 prMsduInfo->ucNetworkType = ucNetTypeIndex;
720 prMsduInfo->ucMacHeaderLength = WLAN_MAC_HEADER_QOS_LEN;
721 prMsduInfo->fgIs802_1x = FALSE;
722 prMsduInfo->fgIs802_11 = TRUE;
723 prMsduInfo->u2FrameLength = WLAN_MAC_HEADER_QOS_LEN;
724 prMsduInfo->ucTxSeqNum = nicIncreaseTxSeqNum(prAdapter);
725 prMsduInfo->pfTxDoneHandler = NULL;
726 prMsduInfo->fgIsBasicRate = TRUE;
727 prMsduInfo->fgIsBurstEnd = fgIsBurstEnd;
728 prMsduInfo->ucUserPriority = ucUP;
729 prMsduInfo->ucPsSessionID = ucPsSessionID /* 0~7 Test 7 means NOACK*/;
731 prQoSNullFrame = (P_WLAN_MAC_HEADER_QOS_T)( (PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD) );
734 prQoSNullFrame->aucAddr1[0] = 0xfd;
737 prQoSNullFrame->aucAddr1[5] = 0xdd;
740 //4 <4> Inform TXM to send this Null frame.
741 nicTxEnqueueMsdu(prAdapter, prMsduInfo);
749 IN P_ADAPTER_T prAdapter,
750 IN UINT_8 ucNetworkTypeIndex
753 P_BSS_INFO_T prBssInfo;
754 UINT_8 _aucZeroMacAddr[] = NULL_MAC_ADDR;
756 DEBUGFUNC("testPsSetupBss()");
757 DBGLOG(SW4, INFO, ("index %d\n", ucNetworkTypeIndex));
759 prBssInfo = &(prAdapter->rWifiVar.arBssInfo[ucNetworkTypeIndex]);
761 //4 <1.2> Initiate PWR STATE
762 //SET_NET_PWR_STATE_IDLE(prAdapter, ucNetworkTypeIndex);
765 //4 <2> Initiate BSS_INFO_T - common part
766 BSS_INFO_INIT(prAdapter, ucNetworkTypeIndex);
768 prBssInfo->eConnectionState = PARAM_MEDIA_STATE_DISCONNECTED;
769 prBssInfo->eConnectionStateIndicated = PARAM_MEDIA_STATE_DISCONNECTED;
770 prBssInfo->eCurrentOPMode = OP_MODE_ACCESS_POINT;
771 prBssInfo->fgIsNetActive = TRUE;
772 prBssInfo->ucNetTypeIndex = (ucNetworkTypeIndex);
773 prBssInfo->ucReasonOfDisconnect = DISCONNECT_REASON_CODE_RESERVED;
775 prBssInfo->ucPhyTypeSet = PHY_TYPE_SET_802_11BG; /* Depend on eBand */
776 prBssInfo->ucConfigAdHocAPMode = AP_MODE_MIXED_11BG; /* Depend on eCurrentOPMode and ucPhyTypeSet */
777 prBssInfo->u2BSSBasicRateSet = RATE_SET_ERP;
778 prBssInfo->u2OperationalRateSet = RATE_SET_OFDM;
779 prBssInfo->fgErpProtectMode = FALSE;
780 prBssInfo->fgIsQBSS = TRUE;
782 //4 <1.5> Setup MIB for current BSS
783 prBssInfo->u2BeaconInterval = 100;
784 prBssInfo->ucDTIMPeriod = DOT11_DTIM_PERIOD_DEFAULT;
785 prBssInfo->u2ATIMWindow = 0;
787 prBssInfo->ucBeaconTimeoutCount = 0;
790 bssInitForAP (prAdapter,prBssInfo, TRUE);
792 COPY_MAC_ADDR(prBssInfo->aucBSSID, _aucZeroMacAddr);
793 LINK_INITIALIZE(&prBssInfo->rStaRecOfClientList);
794 prBssInfo->fgIsBeaconActivated = TRUE;
795 prBssInfo->ucHwDefaultFixedRateCode = RATE_CCK_1M_LONG;
798 COPY_MAC_ADDR(prBssInfo->aucOwnMacAddr, prAdapter->rWifiVar.aucMacAddress);
800 //4 <3> Initiate BSS_INFO_T - private part
802 prBssInfo->eBand = BAND_2G4;
803 prBssInfo->ucPrimaryChannel = 1;
804 prBssInfo->prStaRecOfAP = (P_STA_RECORD_T)NULL;
807 //prBssInfo->fgErpProtectMode = eErpProectMode;
808 //prBssInfo->eHtProtectMode = eHtProtectMode;
809 //prBssInfo->eGfOperationMode = eGfOperationMode;
812 //4 <4> Allocate MSDU_INFO_T for Beacon
813 prBssInfo->prBeacon = cnmMgtPktAlloc(prAdapter,
814 OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem[0]) + MAX_IE_LENGTH);
816 if (prBssInfo->prBeacon) {
817 prBssInfo->prBeacon->eSrc = TX_PACKET_MGMT;
818 prBssInfo->prBeacon->ucNetworkType = ucNetworkTypeIndex;
821 DBGLOG(SW4, INFO, ("prBeacon allocation fail\n"));
825 prBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = PM_UAPSD_ALL;
826 prBssInfo->rPmProfSetupInfo.ucBmpTriggerAC = PM_UAPSD_ALL;
827 prBssInfo->rPmProfSetupInfo.ucUapsdSp = WMM_MAX_SP_LENGTH_2;
829 prBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = (UINT_8)prAdapter->u4UapsdAcBmp;
830 prBssInfo->rPmProfSetupInfo.ucBmpTriggerAC =(UINT_8) prAdapter->u4UapsdAcBmp;
831 prBssInfo->rPmProfSetupInfo.ucUapsdSp = (UINT_8)prAdapter->u4MaxSpLen;
835 for(eAci = 0; eAci < WMM_AC_INDEX_NUM; eAci++){
837 prBssInfo->arACQueParms[eAci].fgIsACMSet = FALSE;
838 prBssInfo->arACQueParms[eAci].u2Aifsn = (UINT_16) eAci;
839 prBssInfo->arACQueParms[eAci].u2CWmin = 7;
840 prBssInfo->arACQueParms[eAci].u2CWmax = 31;
841 prBssInfo->arACQueParms[eAci].u2TxopLimit = eAci+1;
842 DBGLOG(SW4, INFO, ("MQM: eAci = %d, ACM = %d, Aifsn = %d, CWmin = %d, CWmax = %d, TxopLimit = %d\n",
843 eAci,prBssInfo->arACQueParms[eAci].fgIsACMSet ,
844 prBssInfo->arACQueParms[eAci].u2Aifsn,
845 prBssInfo->arACQueParms[eAci].u2CWmin,
846 prBssInfo->arACQueParms[eAci].u2CWmax,
847 prBssInfo->arACQueParms[eAci].u2TxopLimit));
853 DBGLOG(SW4, INFO, ("[2] ucBmpDeliveryAC:0x%x, ucBmpTriggerAC:0x%x, ucUapsdSp:0x%x",
854 prBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC,
855 prBssInfo->rPmProfSetupInfo.ucBmpTriggerAC,
856 prBssInfo->rPmProfSetupInfo.ucUapsdSp));
864 VOID testPsCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1)
866 UINT_8 ucIndex,ucRead;
867 P_STA_RECORD_T prStaRec;
869 DEBUGFUNC("testPsCmdCategory0");
870 SWCR_GET_RW_INDEX(ucAction,ucRead,ucIndex);
872 DBGLOG(SW4, LOUD, ("Read %u Index %u\n",ucRead,ucIndex));
874 prStaRec = cnmGetStaRecByIndex (prAdapter, 0);
876 if(ucIndex>=TEST_PS_CATA0_INDEX_NUM) return;
878 if(ucRead == SWCR_WRITE) {
880 case TEST_PS_SETUP_BSS:
881 testPsSetupBss(prAdapter, ucOpt0) ;
884 case TEST_PS_ENABLE_BEACON:
887 case TEST_PS_TRIGGER_BMC:
888 //txmForwardQueuedBmcPkts (ucOpt0);
890 case TEST_PS_SEND_NULL:
893 testPsSendQoSNullFrame (prAdapter,prStaRec,
894 (UINT_8)(g_au4SwCr[1] & 0xFF), /* UP */
896 (BOOLEAN)((g_au4SwCr[1] >>8)& 0xFF), /* BMC*/
897 (BOOLEAN)((g_au4SwCr[1] >>16)& 0xFF), /* BurstEnd*/
898 (BOOLEAN)((g_au4SwCr[1] >>24)& 0xFF), /* Packet type*/
899 (UINT_8)((g_au4SwCr[2] )& 0xFF), /* PS sesson ID 7: NOACK */
904 case TEST_PS_BUFFER_BMC:
905 //g_aprBssInfo[ucOpt0]->fgApToBufferBMC = (g_au4SwCr[1] & 0xFF);
907 case TEST_PS_UPDATE_BEACON:
908 bssUpdateBeaconContent(prAdapter, ucOpt0 /*networktype*/ );
919 g_au4SwCr[1] = 0x88660011 ;
930 VOID testPsCmdCategory1(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1)
932 UINT_8 ucIndex,ucRead;
934 P_STA_RECORD_T prStaRec;
936 DEBUGFUNC("testPsCmdCategory1");
938 SWCR_GET_RW_INDEX(ucAction,ucRead,ucIndex);
940 if(ucOpt0>=CFG_STA_REC_NUM) return;
942 prStaRec = cnmGetStaRecByIndex (prAdapter, ucOpt0);
943 ucWTEntry = prStaRec->ucWTEntry;
944 if(ucRead == SWCR_WRITE) {
948 prStaRec->fgIsInPS = (BOOLEAN) (g_au4SwCr[1] & 0x1);
949 prStaRec->fgIsQoS = (BOOLEAN) (g_au4SwCr[1] >>8 & 0xFF);
950 prStaRec->fgIsUapsdSupported = (BOOLEAN) (g_au4SwCr[1] >>16 & 0xFF);
951 prStaRec->ucBmpDeliveryAC = (BOOLEAN) (g_au4SwCr[1] >>24 & 0xFF);
970 #if CFG_SUPPORT_802_11V
971 #if (CFG_SUPPORT_802_11V_TIMING_MEASUREMENT ==1) && (WNM_UNIT_TEST ==1)
972 VOID testWNMCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1)
974 UINT_8 ucIndex,ucRead;
975 P_STA_RECORD_T prStaRec;
977 DEBUGFUNC("testWNMCmdCategory0");
978 SWCR_GET_RW_INDEX(ucAction,ucRead,ucIndex);
980 DBGLOG(SW4, INFO, ("Read %u Index %u\n",ucRead,ucIndex));
982 if(ucIndex>=TEST_WNM_CATA0_INDEX_NUM) return;
984 if(ucRead == SWCR_WRITE) {
986 case TEST_WNM_TIMING_MEAS:
987 wnmTimingMeasUnitTest1(prAdapter, ucOpt0) ;
996 #endif //CFG_SUPPORT_802_11V
998 VOID swCtrlSwCr(P_ADAPTER_T prAdapter, UINT_8 ucRead, UINT_16 u2Addr, UINT_32 *pu4Data)
1000 /* According other register STAIDX */
1002 ucOffset = (u2Addr>>2) & 0x3F;
1004 if(ucOffset>= SWCR_CR_NUM) return;
1006 if(ucRead==SWCR_WRITE) {
1007 g_au4SwCr[ucOffset] = *pu4Data;
1009 /* Commmand [31:24]: Category */
1010 /* Commmand [23:23]: 1(W) 0(R) */
1011 /* Commmand [22:16]: Index */
1012 /* Commmand [15:08]: Option0 */
1013 /* Commmand [07:00]: Option1 */
1016 u4Cmd = g_au4SwCr[0];
1017 ucCate = (UINT_8)(u4Cmd >> 24) ;
1018 if(ucCate < sizeof(g_arSwCtrlCmd)/sizeof(g_arSwCtrlCmd[0])) {
1019 if(g_arSwCtrlCmd[ucCate]!=NULL) {
1020 g_arSwCtrlCmd[ucCate](prAdapter, ucCate, (UINT_8)(u4Cmd>>16 & 0xFF),(UINT_8)((u4Cmd>>8) & 0xFF), (UINT_8)(u4Cmd&0xFF));
1026 *pu4Data = g_au4SwCr[ucOffset];
1030 VOID swCrReadWriteCmd(P_ADAPTER_T prAdapter, UINT_8 ucRead, UINT_16 u2Addr, UINT_32 *pu4Data)
1035 /* Address [15:8] MOD ID */
1036 /* Address [7:0] OFFSET */
1038 DEBUGFUNC("swCrReadWriteCmd");
1039 DBGLOG(SW4, INFO, ("%u addr 0x%x data 0x%x\n",ucRead,u2Addr,*pu4Data));
1041 if(ucMod < (sizeof(g_arSwCrModHandle)/sizeof(g_arSwCrModHandle[0])) ) {
1043 if(g_arSwCrModHandle[ucMod]!=NULL) {
1044 g_arSwCrModHandle[ucMod](prAdapter, ucRead, u2Addr, pu4Data);
1050 VOID swCrFrameCheckEnable(P_ADAPTER_T prAdapter, UINT_32 u4DumpType)
1052 g_u4SwcrDebugFrameDumpType = u4DumpType;
1053 prAdapter->rRxCtrl.u4RxPktsDumpTypeMask = u4DumpType;
1056 VOID swCrDebugInit(P_ADAPTER_T prAdapter)
1059 if (g_u4SwcrDebugFrameDumpType) {
1060 swCrFrameCheckEnable(prAdapter, g_u4SwcrDebugFrameDumpType);
1064 g_fgSwcrDebugTimer = FALSE;
1066 cnmTimerInitTimer(prAdapter,
1068 (PFN_MGMT_TIMEOUT_FUNC)swCrDebugCheckTimeout,
1071 if (g_u4SwcrDebugCheckTimeout) {
1072 swCrDebugCheckEnable(prAdapter, TRUE, g_ucSwcrDebugCheckType, g_u4SwcrDebugCheckTimeout);
1076 VOID swCrDebugUninit(P_ADAPTER_T prAdapter)
1078 cnmTimerStopTimer(prAdapter, &g_rSwcrDebugTimer);
1080 g_fgSwcrDebugTimer = FALSE;
1083 VOID swCrDebugCheckEnable(P_ADAPTER_T prAdapter, BOOLEAN fgIsEnable, UINT_8 ucType, UINT_32 u4Timeout)
1086 g_ucSwcrDebugCheckType = ucType;
1087 g_u4SwcrDebugCheckTimeout = u4Timeout;
1088 if (g_fgSwcrDebugTimer == FALSE) {
1089 swCrDebugCheckTimeout(prAdapter, 0);
1093 cnmTimerStopTimer(prAdapter, &g_rSwcrDebugTimer);
1094 g_u4SwcrDebugCheckTimeout = 0;
1097 g_fgSwcrDebugTimer = fgIsEnable;
1100 VOID swCrDebugCheck(P_ADAPTER_T prAdapter, P_CMD_SW_DBG_CTRL_T prCmdSwCtrl)
1102 P_RX_CTRL_T prRxCtrl;
1103 P_TX_CTRL_T prTxCtrl;
1107 prTxCtrl = &prAdapter->rTxCtrl;
1108 prRxCtrl = &prAdapter->rRxCtrl;
1112 if (prCmdSwCtrl->u4Data == SWCR_DBG_TYPE_ALL) {
1114 // TX Counter from fw
1115 DBGLOG(SW4, INFO, ("TX0\n" \
1116 "%08x %08x %08x %08x\n" \
1117 "%08x %08x %08x %08x\n",
1118 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_CNT],
1119 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_BCN_CNT],
1120 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_FAILED_CNT],
1121 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_RETRY_CNT],
1122 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_AGING_TIMEOUT_CNT],
1123 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_PS_OVERFLOW_CNT],
1124 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_MGNT_DROP_CNT],
1125 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_ERROR_CNT]));
1127 // TX Counter from drv
1128 DBGLOG(SW4, INFO, ("TX1\n" \
1129 "%08x %08x %08x %08x\n",
1130 (UINT_32)TX_GET_CNT(prTxCtrl, TX_INACTIVE_BSS_DROP),
1131 (UINT_32)TX_GET_CNT(prTxCtrl, TX_INACTIVE_STA_DROP),
1132 (UINT_32)TX_GET_CNT(prTxCtrl, TX_FORWARD_OVERFLOW_DROP),
1133 (UINT_32)TX_GET_CNT(prTxCtrl, TX_AP_BORADCAST_DROP)));
1137 DBGLOG(SW4, INFO, ("RX0\n" \
1138 "%08x %08x %08x %08x\n" \
1139 "%08x %08x %08x %08x\n" \
1140 "%08x %08x %08x %08x\n" \
1141 "%08x %08x %08x %08x\n",
1142 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_CNT],
1143 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_DROP_CNT],
1144 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_DUP_DROP_CNT],
1145 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_TYPE_ERROR_DROP_CNT],
1146 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_CLASS_ERROR_DROP_CNT],
1147 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_AMPDU_ERROR_DROP_CNT],
1148 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_STATUS_ERROR_DROP_CNT],
1149 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_FORMAT_ERROR_DROP_CNT],
1150 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_ICV_ERROR_DROP_CNT],
1151 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_KEY_ERROR_DROP_CNT],
1152 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_TKIP_ERROR_DROP_CNT],
1153 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_MIC_ERROR_DROP_CNT],
1154 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_BIP_ERROR_DROP_CNT],
1155 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_FCSERR_CNT],
1156 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_FIFOFULL_CNT],
1157 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_PFDROP_CNT]));
1159 DBGLOG(SW4, INFO, ("RX1\n" \
1160 "%08x %08x %08x %08x\n" \
1161 "%08x %08x %08x %08x\n",
1162 (UINT_32)RX_GET_CNT(prRxCtrl, RX_MPDU_TOTAL_COUNT),
1163 (UINT_32)RX_GET_CNT(prRxCtrl, RX_DATA_INDICATION_COUNT),
1164 (UINT_32)RX_GET_CNT(prRxCtrl, RX_DATA_RETURNED_COUNT),
1165 (UINT_32)RX_GET_CNT(prRxCtrl, RX_DATA_RETAINED_COUNT),
1166 (UINT_32)RX_GET_CNT(prRxCtrl, RX_DROP_TOTAL_COUNT),
1167 (UINT_32)RX_GET_CNT(prRxCtrl, RX_TYPE_ERR_DROP_COUNT),
1168 (UINT_32)RX_GET_CNT(prRxCtrl, RX_CLASS_ERR_DROP_COUNT),
1169 (UINT_32)RX_GET_CNT(prRxCtrl, RX_DST_NULL_DROP_COUNT)));
1171 DBGLOG(SW4, INFO, ("PWR\n" \
1172 "%08x %08x %08x %08x\n" \
1173 "%08x %08x %08x %08x\n",
1174 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_PS_POLL_CNT],
1175 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_TRIGGER_NULL_CNT],
1176 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_BCN_IND_CNT],
1177 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_BCN_TIMEOUT_CNT],
1178 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_PM_STATE0],
1179 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_PM_STATE1],
1180 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_CUR_PS_PROF0],
1181 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_CUR_PS_PROF1]));
1183 DBGLOG(SW4, INFO, ("ARM\n" \
1184 "%08x %08x %08x %08x\n" \
1186 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_AR_STA0_RATE],
1187 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_AR_STA0_BWGI],
1188 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_AR_STA0_RX_RATE_RCPI],
1189 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_ROAMING_ENABLE],
1190 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_ROAMING_ROAM_CNT],
1191 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_ROAMING_INT_CNT]));
1193 DBGLOG(SW4, INFO, ("BB\n" \
1194 "%08x %08x %08x %08x\n" \
1195 "%08x %08x %08x %08x\n",
1196 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_RX_MDRDY_CNT],
1197 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_RX_FCSERR_CNT],
1198 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_CCK_PD_CNT],
1199 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_OFDM_PD_CNT],
1200 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_CCK_SFDERR_CNT],
1201 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_CCK_SIGERR_CNT],
1202 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_OFDM_TAGERR_CNT],
1203 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_OFDM_SIGERR_CNT]));
1208 // start the next check
1209 if (g_u4SwcrDebugCheckTimeout) {
1210 cnmTimerStartTimer(prAdapter, &g_rSwcrDebugTimer, g_u4SwcrDebugCheckTimeout * MSEC_PER_SEC);
1214 VOID swCrDebugCheckTimeout(
1215 IN P_ADAPTER_T prAdapter,
1218 CMD_SW_DBG_CTRL_T rCmdSwCtrl;
1219 WLAN_STATUS rStatus;
1221 rCmdSwCtrl.u4Id = (0xb000<<16) + g_ucSwcrDebugCheckType;
1222 rCmdSwCtrl.u4Data = 0;
1223 rStatus = wlanSendSetQueryCmd (
1224 prAdapter, /* prAdapter */
1225 CMD_ID_SW_DBG_CTRL, /* ucCID */
1226 FALSE, /* fgSetQuery */
1227 TRUE, /* fgNeedResp */
1228 FALSE, /* fgIsOid */
1229 swCrDebugQuery, /* pfCmdDoneHandler */
1230 swCrDebugQueryTimeout, /* pfCmdTimeoutHandler */
1231 sizeof(CMD_SW_DBG_CTRL_T), /* u4SetQueryInfoLen */
1232 (PUINT_8)&rCmdSwCtrl, /* pucInfoBuffer */
1233 NULL, /* pvSetQueryBuffer */
1234 0 /* u4SetQueryBufferLen */
1237 ASSERT(rStatus == WLAN_STATUS_PENDING);
1242 VOID swCrDebugQuery(
1243 IN P_ADAPTER_T prAdapter,
1244 IN P_CMD_INFO_T prCmdInfo,
1245 IN PUINT_8 pucEventBuf
1250 swCrDebugCheck(prAdapter, (P_CMD_SW_DBG_CTRL_T)(pucEventBuf));
1253 VOID swCrDebugQueryTimeout(
1254 IN P_ADAPTER_T prAdapter,
1255 IN P_CMD_INFO_T prCmdInfo)
1259 swCrDebugCheck(prAdapter, NULL);
1262 #endif /* CFG_SUPPORT_SWCR */