swcr.c 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356
  1. /*
  2. ** Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/swcr.c#1
  3. */
  4. /*! \file "swcr.c"
  5. \brief
  6. */
  7. /*
  8. ** Log: swcr.c
  9. **
  10. ** 09 03 2013 jeffrey.chang
  11. ** [BORA00002710] [MT6630][Wi-Fi] PM driver development
  12. ** fix build error
  13. **
  14. ** 08 28 2013 jeffrey.chang
  15. ** [BORA00002710] [MT6630][Wi-Fi] PM driver development
  16. ** fix bug
  17. **
  18. ** 08 28 2013 jeffrey.chang
  19. ** [BORA00002710] [MT6630][Wi-Fi] PM driver development
  20. ** modify set ip address logic
  21. **
  22. ** 08 28 2013 jeffrey.chang
  23. ** [BORA00002710] [MT6630][Wi-Fi] PM driver development
  24. ** 1) clear the IP buffer
  25. **
  26. ** 08 28 2013 jeffrey.chang
  27. ** [BORA00002710] [MT6630][Wi-Fi] PM driver development
  28. ** 1) modify code which may cause assert
  29. **
  30. ** 08 26 2013 jeffrey.chang
  31. ** [BORA00002710] [MT6630][Wi-Fi] PM driver development
  32. ** 1) fix bug
  33. **
  34. ** 08 26 2013 jeffrey.chang
  35. ** [BORA00002710] [MT6630][Wi-Fi] PM driver development
  36. ** 1) Add SwCr for enable/disable ARP filter
  37. **
  38. ** 08 26 2013 jeffrey.chang
  39. ** [BORA00002710] [MT6630][Wi-Fi] PM driver development
  40. ** 1) change the naming convetion of RX filter to be more general
  41. ** (following Android rules)
  42. **
  43. ** 08 23 2013 jeffrey.chang
  44. ** [BORA00002710] [MT6630][Wi-Fi] PM driver development
  45. ** 1) align Android design, only allow MC packet with table lookup passed.
  46. ** 2) For mulicast routing, kernel driver will turn on and pass all MC packet through
  47. ** by itself
  48. **
  49. ** 08 22 2013 tsaiyuan.hsu
  50. ** [BORA00002222] MT6630 unified MAC RXM
  51. ** add mDNS filter for Android.
  52. **
  53. ** 08 13 2013 terry.wu
  54. ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
  55. ** Remove unused code
  56. **
  57. ** 08 05 2013 terry.wu
  58. ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
  59. ** 1. Add SW rate definition
  60. ** 2. Add HW default rate selection logic from FW
  61. **
  62. ** 06 25 2013 terry.wu
  63. ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
  64. ** Update for 1st connection
  65. **
  66. ** 03 29 2013 cp.wu
  67. ** [BORA00002227] [MT6630 Wi-Fi][Driver] Update for Makefile and HIFSYS modifications
  68. ** 1. remove unused HIF definitions
  69. ** 2. enable NDIS 5.1 build success
  70. **
  71. ** 03 12 2013 terry.wu
  72. ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
  73. ** Update Tx utility function for management frame
  74. **
  75. ** 03 06 2013 wh.su
  76. ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
  77. ** submit some code related with security.
  78. **
  79. ** 02 19 2013 cp.wu
  80. ** [BORA00002227] [MT6630 Wi-Fi][Driver] Update for Makefile and HIFSYS modifications
  81. ** take use of GET_BSS_INFO_BY_INDEX() and MAX_BSS_INDEX macros
  82. ** for correctly indexing of BSS-INFO pointers
  83. **
  84. ** 01 28 2013 cm.chang
  85. ** [BORA00002149] [MT6630 Wi-Fi] Initial software development
  86. ** Sync CMD format
  87. **
  88. ** 01 22 2013 cp.wu
  89. ** [BORA00002253] [MT6630 Wi-Fi][Driver][Firmware] Add NLO and timeout mechanism to SCN module
  90. ** modification for ucBssIndex migration
  91. **
  92. ** 01 15 2013 terry.wu
  93. ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
  94. ** Update Tx done resource release mechanism.
  95. **
  96. ** 09 17 2012 cm.chang
  97. ** [BORA00002149] [MT6630 Wi-Fi] Initial software development
  98. ** Duplicate source from MT6620 v2.3 driver branch
  99. ** (Davinci label: MT6620_WIFI_Driver_V2_3_120913_1942_As_MT6630_Base)
  100. *
  101. * 06 04 2012 tsaiyuan.hsu
  102. * [WCXRP00001249] [ALPS.ICS] Daily build warning on "wlan/mgmt/swcr.c#1"
  103. * resolve build waring for "WNM_UNIT_TEST not defined".
  104. *
  105. * 03 02 2012 terry.wu
  106. * NULL
  107. * Sync CFG80211 modification from branch 2,2.
  108. *
  109. * 01 05 2012 tsaiyuan.hsu
  110. * [WCXRP00001157] [MT6620 Wi-Fi][FW][DRV] add timing measurement support for 802.11v
  111. * add timing measurement support for 802.11v.
  112. *
  113. * 11 22 2011 tsaiyuan.hsu
  114. * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
  115. * keep debug counter setting after wake up.
  116. *
  117. * 11 15 2011 cm.chang
  118. * NULL
  119. * Fix compiling warning
  120. *
  121. * 11 11 2011 tsaiyuan.hsu
  122. * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
  123. * fix debug counters of rx in driver.
  124. *
  125. * 11 11 2011 tsaiyuan.hsu
  126. * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
  127. * add debug counters of bb and ar for xlog.
  128. *
  129. * 11 10 2011 eddie.chen
  130. * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog)
  131. * Modify the QM xlog level and remove LOG_FUNC.
  132. *
  133. * 11 08 2011 tsaiyuan.hsu
  134. * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
  135. * add debug counters, eCurPsProf, for PS.
  136. *
  137. * 11 07 2011 tsaiyuan.hsu
  138. * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
  139. * add debug counters and periodically dump counters for debugging.
  140. *
  141. * 11 03 2011 wh.su
  142. * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG
  143. * change the DBGLOG for "\n" and "\r\n". LABEL to LOUD for XLOG
  144. *
  145. * 08 31 2011 tsaiyuan.hsu
  146. * [WCXRP00000931] [MT5931 Wi-Fi][DRV/FW] add swcr to disable roaming from driver
  147. * remove obsolete code.
  148. *
  149. * 08 15 2011 tsaiyuan.hsu
  150. * [WCXRP00000931] [MT5931 Wi-Fi][DRV/FW] add swcr to disable roaming from driver
  151. * add swcr in driver reg, 0x9fxx0000, to disable roaming .
  152. *
  153. * 05 11 2011 eddie.chen
  154. * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet
  155. * Fix dest type when GO packet copying.
  156. *
  157. * 05 09 2011 eddie.chen
  158. * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet
  159. * Check free number before copying broadcast packet.
  160. *
  161. * 04 14 2011 eddie.chen
  162. * [WCXRP00000603] [MT6620 Wi-Fi][DRV] Fix Klocwork warning
  163. * Check the SW RFB free. Fix the compile warning..
  164. *
  165. * 04 12 2011 eddie.chen
  166. * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma
  167. * Fix the sta index in processing security frame
  168. * Simple flow control for TC4 to avoid mgt frames for PS STA to occupy the TC4
  169. * Add debug message.
  170. *
  171. * 03 28 2011 eddie.chen
  172. * [WCXRP00000603] [MT6620 Wi-Fi][DRV] Fix Klocwork warning
  173. * Fix Klockwork warning.
  174. *
  175. * 03 15 2011 eddie.chen
  176. * [WCXRP00000554] [MT6620 Wi-Fi][DRV] Add sw control debug counter
  177. * Add sw debug counter for QM.
  178. *
  179. * 01 11 2011 eddie.chen
  180. * [WCXRP00000322] Add WMM IE in beacon,
  181. Add per station flow control when STA is in PS
  182. * Add swcr for test.
  183. *
  184. *
  185. */
  186. /*******************************************************************************
  187. * C O M P I L E R F L A G S
  188. ********************************************************************************
  189. */
  190. /*******************************************************************************
  191. * E X T E R N A L R E F E R E N C E S
  192. ********************************************************************************
  193. */
  194. #include "precomp.h"
  195. #include "swcr.h"
  196. #if CFG_SUPPORT_SWCR
  197. /*******************************************************************************
  198. * D A T A T Y P E S
  199. ********************************************************************************
  200. */
  201. /*******************************************************************************
  202. * P U B L I C D A T A
  203. ********************************************************************************
  204. */
  205. UINT_32 g_au4SwCr[SWCR_CR_NUM]; /*: 0: command other: data */
  206. /* JB mDNS Filter*/
  207. UINT_32 g_u4RXFilter = 0; /* [31] 0: stop 1: start, [3] IPv6 [2] IPv4 */
  208. static TIMER_T g_rSwcrDebugTimer;
  209. static BOOLEAN g_fgSwcrDebugTimer = FALSE;
  210. static UINT_32 g_u4SwcrDebugCheckTimeout;
  211. static ENUM_SWCR_DBG_TYPE_T g_ucSwcrDebugCheckType;
  212. static UINT_32 g_u4SwcrDebugFrameDumpType;
  213. /*******************************************************************************
  214. * P R I V A T E D A T A
  215. ********************************************************************************
  216. */
  217. static const PFN_CMD_RW_T g_arSwCtrlCmd[] = {
  218. swCtrlCmdCategory0,
  219. swCtrlCmdCategory1
  220. #if TEST_PS
  221. , testPsCmdCategory0, testPsCmdCategory1
  222. #endif
  223. #if CFG_SUPPORT_802_11V
  224. #if (CFG_SUPPORT_802_11V_TIMING_MEASUREMENT == 1) && (WNM_UNIT_TEST == 1)
  225. , testWNMCmdCategory0
  226. #endif
  227. #endif
  228. };
  229. const PFN_SWCR_RW_T g_arSwCrModHandle[] = {
  230. swCtrlSwCr,
  231. NULL
  232. };
  233. /*******************************************************************************
  234. * M A C R O S
  235. ********************************************************************************
  236. */
  237. enum {
  238. SWCTRL_MAGIC,
  239. SWCTRL_DEBUG,
  240. SWCTRL_WIFI_VAR,
  241. SWCTRL_ENABLE_INT,
  242. SWCTRL_DISABLE_INT,
  243. SWCTRL_TXM_INFO,
  244. SWCTRL_RXM_INFO,
  245. SWCTRL_DUMP_BSS,
  246. SWCTRL_QM_INFO,
  247. SWCTRL_DUMP_ALL_QUEUE_LEN,
  248. SWCTRL_DUMP_MEM,
  249. SWCTRL_TX_CTRL_INFO,
  250. SWCTRL_DUMP_QUEUE,
  251. SWCTRL_DUMP_QM_DBG_CNT,
  252. SWCTRL_QM_DBG_CNT,
  253. SWCTRL_RX_PKTS_DUMP,
  254. SWCTRL_RX_FILTER,
  255. #if CFG_INIT_ENABLE_PATTERN_FILTER_ARP
  256. SWCTRL_RX_ARP_OFFLOAD,
  257. #endif
  258. SWCTRL_PS_DTIM_SKIP,
  259. SWCTRL_ROAMING,
  260. SWCTRL_CATA0_INDEX_NUM
  261. };
  262. enum {
  263. SWCTRL_STA_INFO,
  264. SWCTRL_DUMP_STA,
  265. SWCTRL_STA_QUE_INFO,
  266. SWCTRL_CATA1_INDEX_NUM
  267. };
  268. /* JB mDNS Filter*/
  269. #define RX_FILTER_START (1<<31)
  270. #define RX_FILTER_IPV4 (1<<2)
  271. #define RX_FILTER_IPV6 (1<<3)
  272. typedef enum _ENUM_SWCR_RX_FILTER_CMD_T {
  273. SWCR_RX_FILTER_CMD_STOP = 0,
  274. SWCR_RX_FILTER_CMD_START,
  275. SWCR_RX_FILTER_CMD_ADD,
  276. SWCR_RX_FILTER_CMD_REMOVE,
  277. SWCR_RX_FILTER_NUM
  278. } ENUM_SWCR_RX_FILTER_CMD_T;
  279. #if TEST_PS
  280. enum {
  281. TEST_PS_MAGIC,
  282. TEST_PS_SETUP_BSS,
  283. TEST_PS_ENABLE_BEACON,
  284. TEST_PS_TRIGGER_BMC,
  285. TEST_PS_SEND_NULL,
  286. TEST_PS_BUFFER_BMC,
  287. TEST_PS_UPDATE_BEACON,
  288. TEST_PS_CATA0_INDEX_NUM
  289. };
  290. enum {
  291. TEST_PS_STA_PS,
  292. TEST_PS_STA_ENTER_PS,
  293. TEST_PS_STA_EXIT_PS,
  294. TEST_PS_STA_TRIGGER_PSPOLL,
  295. TEST_PS_STA_TRIGGER_FRAME,
  296. TEST_PS_CATA1_INDEX_NUM
  297. };
  298. #endif
  299. #if CFG_SUPPORT_802_11V
  300. #if WNM_UNIT_TEST
  301. enum {
  302. TEST_WNM_TIMING_MEAS,
  303. TEST_WNM_CATA0_INDEX_NUM
  304. };
  305. #endif
  306. #endif
  307. #define _SWCTRL_MAGIC 0x66201642
  308. /*******************************************************************************
  309. * F U N C T I O N D E C L A R A T I O N S
  310. ********************************************************************************
  311. */
  312. /*******************************************************************************
  313. * F U N C T I O N S
  314. ********************************************************************************
  315. */
  316. void dumpQueue(P_ADAPTER_T prAdapter)
  317. {
  318. P_TX_CTRL_T prTxCtrl;
  319. P_QUE_MGT_T prQM;
  320. P_GLUE_INFO_T prGlueInfo;
  321. UINT_32 i;
  322. UINT_32 j;
  323. DEBUGFUNC("dumpQueue");
  324. prTxCtrl = &prAdapter->rTxCtrl;
  325. prQM = &prAdapter->rQM;
  326. prGlueInfo = prAdapter->prGlueInfo;
  327. #if QM_ADAPTIVE_TC_RESOURCE_CTRL
  328. for (i = TC0_INDEX; i <= TC5_INDEX; i++) {
  329. DBGLOG(SW4, INFO, "TC %u\n", i);
  330. DBGLOG(SW4, INFO, "Max %u Free %u\n",
  331. prTxCtrl->rTc.au2MaxNumOfBuffer[i], prTxCtrl->rTc.au2FreeBufferCount[i]);
  332. DBGLOG(SW4, INFO,
  333. "Average %u minReserved %u CurrentTcResource %u GuaranteedTcResource %u\n",
  334. QM_GET_TX_QUEUE_LEN(prAdapter, i), prQM->au4MinReservedTcResource[i],
  335. prQM->au4CurrentTcResource[i], prQM->au4GuaranteedTcResource[i]);
  336. }
  337. #endif
  338. #if QM_FORWARDING_FAIRNESS
  339. for (i = 0; i < NUM_OF_PER_STA_TX_QUEUES; i++) {
  340. DBGLOG(SW4, INFO,
  341. "TC %u HeadStaIdx %u ForwardCount %u\n", i, prQM->au4HeadStaRecIndex[i],
  342. prQM->au4ResourceUsedCount[i]);
  343. }
  344. #endif
  345. DBGLOG(SW4, INFO, "BMC or unknown TxQueue Len %u\n", prQM->arTxQueue[0].u4NumElem);
  346. DBGLOG(SW4, INFO, "Pending %d\n", prGlueInfo->i4TxPendingFrameNum);
  347. DBGLOG(SW4, INFO, "Pending Security %d\n", prGlueInfo->i4TxPendingSecurityFrameNum);
  348. #if defined(LINUX)
  349. for (i = 0; i < 4; i++) {
  350. for (j = 0; j < CFG_MAX_TXQ_NUM; j++) {
  351. DBGLOG(SW4, INFO,
  352. "Pending Q[%u][%u] %d\n", i, j, prGlueInfo->ai4TxPendingFrameNumPerQueue[i][j]);
  353. }
  354. }
  355. #endif
  356. DBGLOG(SW4, INFO, " rFreeSwRfbList %u\n", prAdapter->rRxCtrl.rFreeSwRfbList.u4NumElem);
  357. DBGLOG(SW4, INFO, " rReceivedRfbList %u\n", prAdapter->rRxCtrl.rReceivedRfbList.u4NumElem);
  358. DBGLOG(SW4, INFO, " rIndicatedRfbList %u\n", prAdapter->rRxCtrl.rIndicatedRfbList.u4NumElem);
  359. DBGLOG(SW4, INFO, " ucNumIndPacket %u\n", prAdapter->rRxCtrl.ucNumIndPacket);
  360. DBGLOG(SW4, INFO, " ucNumRetainedPacket %u\n", prAdapter->rRxCtrl.ucNumRetainedPacket);
  361. }
  362. void dumpSTA(P_ADAPTER_T prAdapter, P_STA_RECORD_T prStaRec)
  363. {
  364. UINT_8 ucWTEntry;
  365. UINT_32 i;
  366. P_BSS_INFO_T prBssInfo;
  367. DEBUGFUNC("dumpSTA");
  368. ASSERT(prStaRec);
  369. ucWTEntry = prStaRec->ucWlanIndex;
  370. prBssInfo = GET_BSS_INFO_BY_INDEX(prAdapter, prStaRec->ucBssIndex);
  371. ASSERT(prBssInfo);
  372. DBGLOG(SW4, INFO, "Mac address: " MACSTR " Rcpi %u" "\n", MAC2STR(prStaRec->aucMacAddr),
  373. prStaRec->ucRCPI);
  374. DBGLOG(SW4, INFO, "Idx %u Wtbl %u Used %u State %u Bss Phy 0x%x Sta DesiredPhy 0x%x\n",
  375. prStaRec->ucIndex, ucWTEntry,
  376. prStaRec->fgIsInUse, prStaRec->ucStaState,
  377. prBssInfo->ucPhyTypeSet, prStaRec->ucDesiredPhyTypeSet);
  378. DBGLOG(SW4, INFO,
  379. "Sta Operation 0x%x DesiredNontHtRateSet 0x%x Mcs 0x%x u2HtCapInfo 0x%x\n",
  380. prStaRec->u2OperationalRateSet, prStaRec->u2DesiredNonHTRateSet, prStaRec->ucMcsSet,
  381. prStaRec->u2HtCapInfo);
  382. for (i = 0; i < NUM_OF_PER_STA_TX_QUEUES; i++)
  383. DBGLOG(SW4, INFO, "TC %u Queue Len %u\n", i, prStaRec->arTxQueue[i].u4NumElem);
  384. DBGLOG(SW4, INFO, "BmpDeliveryAC %x\n", prStaRec->ucBmpDeliveryAC);
  385. DBGLOG(SW4, INFO, "BmpTriggerAC %x\n", prStaRec->ucBmpTriggerAC);
  386. DBGLOG(SW4, INFO, "UapsdSpSupproted %u\n", prStaRec->fgIsUapsdSupported);
  387. DBGLOG(SW4, INFO, "IsQoS %u\n", prStaRec->fgIsQoS);
  388. DBGLOG(SW4, INFO, "AssocId %u\n", prStaRec->u2AssocId);
  389. DBGLOG(SW4, INFO, "fgIsInPS %u\n", prStaRec->fgIsInPS);
  390. DBGLOG(SW4, INFO, "ucFreeQuota %u\n", prStaRec->ucFreeQuota);
  391. DBGLOG(SW4, INFO, "ucFreeQuotaForDelivery %u\n", prStaRec->ucFreeQuotaForDelivery);
  392. DBGLOG(SW4, INFO, "ucFreeQuotaForNonDelivery %u\n", prStaRec->ucFreeQuotaForNonDelivery);
  393. #if 0
  394. DBGLOG(SW4, INFO, "IsQmmSup %u\n", prStaRec->fgIsWmmSupported);
  395. DBGLOG(SW4, INFO, "IsUapsdSup %u\n", prStaRec->fgIsUapsdSupported);
  396. DBGLOG(SW4, INFO, "AvailabaleDeliverPkts %u\n", prStaRec->ucAvailableDeliverPkts);
  397. DBGLOG(SW4, INFO, "BmpDeliverPktsAC %u\n", prStaRec->u4BmpDeliverPktsAC);
  398. DBGLOG(SW4, INFO, "BmpBufferAC %u\n", prStaRec->u4BmpBufferAC);
  399. DBGLOG(SW4, INFO, "BmpNonDeliverPktsAC %u\n", prStaRec->u4BmpNonDeliverPktsAC);
  400. #endif
  401. for (i = 0; i < CFG_RX_MAX_BA_TID_NUM; i++) {
  402. if (prStaRec->aprRxReorderParamRefTbl[i]) {
  403. DBGLOG(SW4, INFO,
  404. "RxReorder fgIsValid: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->fgIsValid);
  405. DBGLOG(SW4, INFO, "RxReorder Tid: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->ucTid);
  406. DBGLOG(SW4, INFO,
  407. "RxReorder rReOrderQue Len: %u\n",
  408. prStaRec->aprRxReorderParamRefTbl[i]->rReOrderQue.u4NumElem);
  409. DBGLOG(SW4, INFO,
  410. "RxReorder WinStart: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->u2WinStart);
  411. DBGLOG(SW4, INFO, "RxReorder WinEnd: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->u2WinEnd);
  412. DBGLOG(SW4, INFO, "RxReorder WinSize: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->u2WinSize);
  413. }
  414. }
  415. }
  416. VOID dumpBss(P_ADAPTER_T prAdapter, P_BSS_INFO_T prBssInfo)
  417. {
  418. DBGLOG(SW4, INFO, "SSID %s\n", prBssInfo->aucSSID);
  419. DBGLOG(SW4, INFO, "OWN " MACSTR "\n", MAC2STR(prBssInfo->aucOwnMacAddr));
  420. DBGLOG(SW4, INFO, "BSSID " MACSTR "\n", MAC2STR(prBssInfo->aucBSSID));
  421. DBGLOG(SW4, INFO, "eNetworkType %u\n", prBssInfo->eNetworkType);
  422. DBGLOG(SW4, INFO, "ucBssIndex %u\n", prBssInfo->ucBssIndex);
  423. DBGLOG(SW4, INFO, "eConnectionState %u\n", prBssInfo->eConnectionState);
  424. DBGLOG(SW4, INFO, "eCurrentOPMode %u\n", prBssInfo->eCurrentOPMode);
  425. DBGLOG(SW4, INFO, "fgIsQBSS %u\n", prBssInfo->fgIsQBSS);
  426. DBGLOG(SW4, INFO, "fgIsShortPreambleAllowed %u\n", prBssInfo->fgIsShortPreambleAllowed);
  427. DBGLOG(SW4, INFO, "fgUseShortPreamble %u\n", prBssInfo->fgUseShortPreamble);
  428. DBGLOG(SW4, INFO, "fgUseShortSlotTime %u\n", prBssInfo->fgUseShortSlotTime);
  429. DBGLOG(SW4, INFO, "ucNonHTBasicPhyType %x\n", prBssInfo->ucNonHTBasicPhyType);
  430. DBGLOG(SW4, INFO, "u2OperationalRateSet %x\n", prBssInfo->u2OperationalRateSet);
  431. DBGLOG(SW4, INFO, "u2BSSBasicRateSet %x\n", prBssInfo->u2BSSBasicRateSet);
  432. DBGLOG(SW4, INFO, "ucPhyTypeSet %x\n", prBssInfo->ucPhyTypeSet);
  433. DBGLOG(SW4, INFO, "rStaRecOfClientList %d\n", prBssInfo->rStaRecOfClientList.u4NumElem);
  434. DBGLOG(SW4, INFO, "u2CapInfo %x\n", prBssInfo->u2CapInfo);
  435. DBGLOG(SW4, INFO, "u2ATIMWindow %x\n", prBssInfo->u2ATIMWindow);
  436. DBGLOG(SW4, INFO, "u2AssocId %x\n", prBssInfo->u2AssocId);
  437. DBGLOG(SW4, INFO, "ucDTIMPeriod %x\n", prBssInfo->ucDTIMPeriod);
  438. DBGLOG(SW4, INFO, "ucDTIMCount %x\n", prBssInfo->ucDTIMCount);
  439. DBGLOG(SW4, INFO, "fgIsNetAbsent %x\n", prBssInfo->fgIsNetAbsent);
  440. DBGLOG(SW4, INFO, "eBand %d\n", prBssInfo->eBand);
  441. DBGLOG(SW4, INFO, "ucPrimaryChannel %d\n", prBssInfo->ucPrimaryChannel);
  442. DBGLOG(SW4, INFO, "ucHtOpInfo1 %d\n", prBssInfo->ucHtOpInfo1);
  443. DBGLOG(SW4, INFO, "ucHtOpInfo2 %d\n", prBssInfo->u2HtOpInfo2);
  444. DBGLOG(SW4, INFO, "ucHtOpInfo3 %d\n", prBssInfo->u2HtOpInfo3);
  445. DBGLOG(SW4, INFO, "fgErpProtectMode %d\n", prBssInfo->fgErpProtectMode);
  446. DBGLOG(SW4, INFO, "eHtProtectMode %d\n", prBssInfo->eHtProtectMode);
  447. DBGLOG(SW4, INFO, "eGfOperationMode %d\n", prBssInfo->eGfOperationMode);
  448. DBGLOG(SW4, INFO, "eRifsOperationMode %d\n", prBssInfo->eRifsOperationMode);
  449. DBGLOG(SW4, INFO, "fgObssErpProtectMode %d\n", prBssInfo->fgObssErpProtectMode);
  450. DBGLOG(SW4, INFO, "eObssHtProtectMode %d\n", prBssInfo->eObssHtProtectMode);
  451. DBGLOG(SW4, INFO, "eObssGfProtectMode %d\n", prBssInfo->eObssGfOperationMode);
  452. DBGLOG(SW4, INFO, "fgObssRifsOperationMode %d\n", prBssInfo->fgObssRifsOperationMode);
  453. DBGLOG(SW4, INFO, "fgAssoc40mBwAllowed %d\n", prBssInfo->fgAssoc40mBwAllowed);
  454. DBGLOG(SW4, INFO, "fg40mBwAllowed %d\n", prBssInfo->fg40mBwAllowed);
  455. DBGLOG(SW4, INFO, "eBssSCO %d\n", prBssInfo->eBssSCO);
  456. }
  457. VOID swCtrlCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0, UINT_8 ucOpt1)
  458. {
  459. UINT_8 ucIndex, ucRead;
  460. UINT_32 i;
  461. DEBUGFUNC("swCtrlCmdCategory0");
  462. SWCR_GET_RW_INDEX(ucAction, ucRead, ucIndex);
  463. i = 0;
  464. if (ucIndex >= SWCTRL_CATA0_INDEX_NUM)
  465. return;
  466. if (ucRead == SWCR_WRITE) {
  467. switch (ucIndex) {
  468. case SWCTRL_DEBUG:
  469. #if DBG
  470. aucDebugModule[ucOpt0] = (UINT_8) g_au4SwCr[1];
  471. #endif
  472. break;
  473. case SWCTRL_WIFI_VAR:
  474. break;
  475. #if QM_DEBUG_COUNTER
  476. case SWCTRL_DUMP_QM_DBG_CNT:
  477. for (i = 0; i < QM_DBG_CNT_NUM; i++)
  478. prAdapter->rQM.au4QmDebugCounters[i] = 0;
  479. break;
  480. case SWCTRL_QM_DBG_CNT:
  481. prAdapter->rQM.au4QmDebugCounters[ucOpt0] = g_au4SwCr[1];
  482. break;
  483. #endif
  484. #if CFG_RX_PKTS_DUMP
  485. case SWCTRL_RX_PKTS_DUMP:
  486. /* DBGLOG(SW4, INFO,("SWCTRL_RX_PKTS_DUMP: mask %x\n", g_au4SwCr[1])); */
  487. prAdapter->rRxCtrl.u4RxPktsDumpTypeMask = g_au4SwCr[1];
  488. break;
  489. #endif
  490. case SWCTRL_RX_FILTER:
  491. {
  492. UINT_32 u4rxfilter;
  493. BOOLEAN fgUpdate = FALSE;
  494. WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS;
  495. if (ucOpt0 == SWCR_RX_FILTER_CMD_STOP) {
  496. g_u4RXFilter &= ~(RX_FILTER_START);
  497. /* changed by jeffrey to align Android behavior */
  498. #if 0
  499. if (prAdapter->fgAllMulicastFilter == FALSE)
  500. prAdapter->u4OsPacketFilter &= ~PARAM_PACKET_FILTER_ALL_MULTICAST;
  501. #endif
  502. prAdapter->u4OsPacketFilter &= ~PARAM_PACKET_FILTER_MULTICAST;
  503. u4rxfilter = prAdapter->u4OsPacketFilter;
  504. fgUpdate = TRUE;
  505. } else if (ucOpt0 == SWCR_RX_FILTER_CMD_START) {
  506. g_u4RXFilter |= (RX_FILTER_START);
  507. if ((g_u4RXFilter & RX_FILTER_IPV4) || (g_u4RXFilter & RX_FILTER_IPV6)) {
  508. #if 0
  509. prAdapter->u4OsPacketFilter |= PARAM_PACKET_FILTER_ALL_MULTICAST;
  510. #endif
  511. prAdapter->u4OsPacketFilter |= PARAM_PACKET_FILTER_MULTICAST;
  512. }
  513. u4rxfilter = prAdapter->u4OsPacketFilter;
  514. fgUpdate = TRUE;
  515. } else if (ucOpt0 == SWCR_RX_FILTER_CMD_ADD) {
  516. if (ucOpt1 < 31)
  517. g_u4RXFilter |= (1 << ucOpt1);
  518. } else if (ucOpt0 == SWCR_RX_FILTER_CMD_REMOVE) {
  519. if (ucOpt1 < 31)
  520. g_u4RXFilter &= ~(1 << ucOpt1);
  521. }
  522. if (fgUpdate == TRUE)
  523. rStatus = wlanoidSetPacketFilter(prAdapter, u4rxfilter, FALSE, NULL, 0);
  524. /* DBGLOG(SW4, INFO,("SWCTRL_RX_FILTER:
  525. * g_u4RXFilter %x ucOpt0 %x ucOpt1 %x fgUpdate %x u4rxfilter %x, rStatus %x\n", */
  526. /* g_u4RXFilter, ucOpt0, ucOpt1, fgUpdate, u4rxfilter, rStatus)); */
  527. }
  528. break;
  529. #if CFG_INIT_ENABLE_PATTERN_FILTER_ARP
  530. case SWCTRL_RX_ARP_OFFLOAD:
  531. {
  532. WLAN_STATUS rStatus = WLAN_STATUS_FAILURE;
  533. UINT_32 u4SetInfoLen = 0;
  534. UINT_32 u4Len = OFFSET_OF(PARAM_NETWORK_ADDRESS_LIST, arAddress);
  535. UINT_32 u4NumIPv4 = 0, u4NumIPv6 = 0;
  536. UINT_32 i = 0;
  537. PUINT_8 pucBufIpAddr = NULL;
  538. P_PARAM_NETWORK_ADDRESS_LIST prParamNetAddrList = NULL;
  539. P_PARAM_NETWORK_ADDRESS_IP prParamIpAddr = NULL;
  540. PUINT_8 pucIp = NULL;
  541. /* PUINT_8 pucIpv6 = NULL; */
  542. UINT_32 bufSize =
  543. u4Len + (OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) +
  544. sizeof(PARAM_NETWORK_ADDRESS_IP)) * 3;
  545. P_PARAM_NETWORK_ADDRESS prParamNetAddr = NULL;
  546. /* <1> allocate IP address buffer */
  547. pucBufIpAddr = kalMemAlloc(bufSize, VIR_MEM_TYPE);
  548. pucIp = kalMemAlloc(3 * 4, VIR_MEM_TYPE); /* TODO: replace 3 to macro */
  549. prParamNetAddrList = (P_PARAM_NETWORK_ADDRESS_LIST) pucBufIpAddr;
  550. prParamNetAddr = prParamNetAddrList->arAddress;
  551. /* <2> clear IP address buffer */
  552. kalMemZero(pucBufIpAddr, bufSize);
  553. kalMemZero(pucIp, 3 * 4);
  554. /* <3> setup the number of IP address */
  555. if (ucOpt1 == 1) {
  556. if (wlanGetIPV4Address(prAdapter->prGlueInfo, pucIp, &u4NumIPv4) &&
  557. u4NumIPv4 > 3) /* TODO: repleace 3 to macro */
  558. u4NumIPv4 = 3;
  559. } else if (ucOpt1 == 0) {
  560. u4NumIPv4 = u4NumIPv6 = 0;
  561. }
  562. DBGLOG(INIT, INFO, "u4Len:%d bufSize:%d u4NumIPv4:%d\n", u4Len, bufSize, u4NumIPv4);
  563. prParamNetAddrList->u4AddressCount = u4NumIPv6 + u4NumIPv4;
  564. prParamNetAddrList->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP;
  565. for (i = 0; i < u4NumIPv4; i++) {
  566. prParamNetAddr->u2AddressLength = sizeof(PARAM_NETWORK_ADDRESS_IP);
  567. prParamNetAddr->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP;
  568. prParamIpAddr = (P_PARAM_NETWORK_ADDRESS_IP) prParamNetAddr->aucAddress;
  569. kalMemCopy(&prParamIpAddr->in_addr, pucIp + (i * 4), 4);
  570. prParamNetAddr =
  571. (P_PARAM_NETWORK_ADDRESS) ((UINT_32) prParamNetAddr +
  572. OFFSET_OF
  573. (PARAM_NETWORK_ADDRESS,
  574. aucAddress) + sizeof(PARAM_NETWORK_ADDRESS_IP));
  575. u4Len +=
  576. OFFSET_OF(PARAM_NETWORK_ADDRESS,
  577. aucAddress) + sizeof(PARAM_NETWORK_ADDRESS_IP);
  578. }
  579. #if 0
  580. #ifdef CONFIG_IPV6
  581. if (!wlanGetIPV6Address(prAdapter->prGlueInfo, pucIp, &u4NumIPv6)
  582. || (u4NumIPv6 + u4NumIPv4) > 3) {
  583. goto bailout;
  584. }
  585. pucIpv6 = kalMemAlloc(u4NumIPv6 * 16, VIR_MEM_TYPE);
  586. for (i = 0; i < u4NumIPv6; i++) {
  587. prParamNetAddr->u2AddressLength = 6;
  588. prParamNetAddr->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP;
  589. kalMemCopy(prParamNetAddr->aucAddress, pucIpv6 + (i * 16), 16);
  590. prParamNetAddr =
  591. (P_PARAM_NETWORK_ADDRESS) ((UINT_32) prParamNetAddr + sizeof(ip6));
  592. u4Len += OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) + sizeof(ip6);
  593. }
  594. #endif
  595. #endif
  596. ASSERT(u4Len <= bufSize);
  597. rStatus = wlanoidSetNetworkAddress(prAdapter,
  598. (PVOID) prParamNetAddrList, u4Len, &u4SetInfoLen);
  599. if (rStatus != WLAN_STATUS_SUCCESS)
  600. DBGLOG(INIT, INFO, "set HW packet filter fail 0x%1x\n", rStatus);
  601. if (pucIp)
  602. kalMemFree(pucIp, VIR_MEM_TYPE, 3 * 4); /* TODO: replace 3 to marco */
  603. if (pucBufIpAddr)
  604. kalMemFree(pucBufIpAddr, VIR_MEM_TYPE, bufSize);
  605. }
  606. break;
  607. #endif
  608. case SWCTRL_PS_DTIM_SKIP:
  609. break;
  610. case SWCTRL_ROAMING:
  611. break;
  612. default:
  613. break;
  614. }
  615. } else {
  616. switch (ucIndex) {
  617. case SWCTRL_DEBUG:
  618. #if DBG
  619. g_au4SwCr[1] = aucDebugModule[ucOpt0];
  620. #endif
  621. break;
  622. case SWCTRL_MAGIC:
  623. g_au4SwCr[1] = _SWCTRL_MAGIC;
  624. break;
  625. case SWCTRL_QM_INFO:
  626. {
  627. P_QUE_MGT_T prQM = &prAdapter->rQM;
  628. switch (ucOpt0) {
  629. case 0:
  630. #if QM_ADAPTIVE_TC_RESOURCE_CTRL
  631. g_au4SwCr[1] = (QM_GET_TX_QUEUE_LEN(prAdapter, ucOpt1));
  632. g_au4SwCr[2] = prQM->au4MinReservedTcResource[ucOpt1];
  633. g_au4SwCr[3] = prQM->au4CurrentTcResource[ucOpt1];
  634. g_au4SwCr[4] = prQM->au4GuaranteedTcResource[ucOpt1];
  635. #endif
  636. break;
  637. case 1:
  638. #if QM_FORWARDING_FAIRNESS
  639. g_au4SwCr[1] = prQM->au4ResourceUsedCount[ucOpt1];
  640. g_au4SwCr[2] = prQM->au4HeadStaRecIndex[ucOpt1];
  641. #endif
  642. break;
  643. case 2:
  644. g_au4SwCr[1] = prQM->arTxQueue[ucOpt1].u4NumElem; /* only one */
  645. break;
  646. }
  647. }
  648. case SWCTRL_TX_CTRL_INFO:
  649. {
  650. P_TX_CTRL_T prTxCtrl;
  651. prTxCtrl = &prAdapter->rTxCtrl;
  652. switch (ucOpt0) {
  653. case 0:
  654. g_au4SwCr[1] = prAdapter->rTxCtrl.rTc.au2FreeBufferCount[ucOpt1];
  655. g_au4SwCr[2] = prAdapter->rTxCtrl.rTc.au2MaxNumOfBuffer[ucOpt1];
  656. break;
  657. }
  658. }
  659. break;
  660. case SWCTRL_DUMP_QUEUE:
  661. dumpQueue(prAdapter);
  662. break;
  663. #if QM_DEBUG_COUNTER
  664. case SWCTRL_DUMP_QM_DBG_CNT:
  665. for (i = 0; i < QM_DBG_CNT_NUM; i++)
  666. DBGLOG(SW4, INFO, "QM:DBG %u %u\n", i, prAdapter->rQM.au4QmDebugCounters[i]);
  667. break;
  668. case SWCTRL_QM_DBG_CNT:
  669. g_au4SwCr[1] = prAdapter->rQM.au4QmDebugCounters[ucOpt0];
  670. break;
  671. #endif
  672. case SWCTRL_DUMP_BSS:
  673. {
  674. dumpBss(prAdapter, GET_BSS_INFO_BY_INDEX(prAdapter, ucOpt0));
  675. }
  676. break;
  677. default:
  678. break;
  679. }
  680. }
  681. }
  682. VOID swCtrlCmdCategory1(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0, UINT_8 ucOpt1)
  683. {
  684. UINT_8 ucIndex, ucRead;
  685. UINT_8 ucWTEntry;
  686. P_STA_RECORD_T prStaRec;
  687. DEBUGFUNC("swCtrlCmdCategory1");
  688. SWCR_GET_RW_INDEX(ucAction, ucRead, ucIndex);
  689. if (ucOpt0 >= CFG_STA_REC_NUM)
  690. return;
  691. /* prStaRec = cnmGetStaRecByIndex (prAdapter, ucOpt0); */
  692. prStaRec = &prAdapter->arStaRec[ucOpt0];
  693. ucWTEntry = prStaRec->ucWlanIndex;
  694. if (ucRead == SWCR_WRITE) {
  695. /* ToDo:: Nothing */
  696. } else {
  697. /* Read */
  698. switch (ucIndex) {
  699. case SWCTRL_STA_QUE_INFO:
  700. {
  701. g_au4SwCr[1] = prStaRec->arTxQueue[ucOpt1].u4NumElem;
  702. }
  703. break;
  704. case SWCTRL_STA_INFO:
  705. switch (ucOpt1) {
  706. case 0:
  707. g_au4SwCr[1] = prStaRec->fgIsInPS;
  708. break;
  709. }
  710. break;
  711. case SWCTRL_DUMP_STA:
  712. {
  713. dumpSTA(prAdapter, prStaRec);
  714. }
  715. break;
  716. default:
  717. break;
  718. }
  719. }
  720. }
  721. #if TEST_PS
  722. VOID
  723. testPsSendQoSNullFrame(IN P_ADAPTER_T prAdapter,
  724. IN P_STA_RECORD_T prStaRec,
  725. IN UINT_8 ucUP,
  726. IN UINT_8 ucBssIndex,
  727. IN BOOLEAN fgBMC,
  728. IN BOOLEAN fgIsBurstEnd, IN BOOLEAN ucPacketType, IN BOOLEAN ucPsSessionID, IN BOOLEAN fgSetEOSP)
  729. {
  730. P_MSDU_INFO_T prMsduInfo;
  731. UINT_16 u2EstimatedFrameLen;
  732. P_WLAN_MAC_HEADER_QOS_T prQoSNullFrame;
  733. DEBUGFUNC("testPsSendQoSNullFrame");
  734. DBGLOG(SW4, LOUD, "\n");
  735. /* 4 <1> Allocate a PKT_INFO_T for Null Frame */
  736. /* Init with MGMT Header Length */
  737. u2EstimatedFrameLen = MAC_TX_RESERVED_FIELD + WLAN_MAC_HEADER_QOS_LEN;
  738. /* Allocate a MSDU_INFO_T */
  739. prMsduInfo = cnmMgtPktAlloc(prAdapter, u2EstimatedFrameLen);
  740. if (prMsduInfo == NULL) {
  741. DBGLOG(SW4, WARN, "No PKT_INFO_T for sending Null Frame.\n");
  742. return;
  743. }
  744. /* 4 <2> Compose Null frame in MSDU_INfO_T. */
  745. bssComposeQoSNullFrame(prAdapter,
  746. (PUINT_8) ((ULONG) (prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD),
  747. prStaRec, ucUP, fgSetEOSP);
  748. TX_SET_MMPDU(prAdapter,
  749. prMsduInfo,
  750. ucBssIndex,
  751. prStaRec->ucIndex, WLAN_MAC_HEADER_QOS_LEN, WLAN_MAC_HEADER_QOS_LEN, NULL, MSDU_RATE_MODE_AUTO);
  752. prMsduInfo->ucUserPriority = ucUP;
  753. prMsduInfo->ucPacketType = ucPacketType;
  754. prQoSNullFrame = (P_WLAN_MAC_HEADER_QOS_T) ((PUINT_8)
  755. ((ULONG) (prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD));
  756. if (fgBMC)
  757. prQoSNullFrame->aucAddr1[0] = 0xfd;
  758. else
  759. prQoSNullFrame->aucAddr1[5] = 0xdd;
  760. /* 4 <4> Inform TXM to send this Null frame. */
  761. nicTxEnqueueMsdu(prAdapter, prMsduInfo);
  762. }
  763. VOID testPsSetupBss(IN P_ADAPTER_T prAdapter, IN UINT_8 ucBssIndex)
  764. {
  765. P_BSS_INFO_T prBssInfo;
  766. UINT_8 _aucZeroMacAddr[] = NULL_MAC_ADDR;
  767. DEBUGFUNC("testPsSetupBss()");
  768. DBGLOG(SW4, INFO, "index %d\n", ucBssIndex);
  769. prBssInfo = GET_BSS_INFO_BY_INDEX(prAdapter, ucBssIndex);
  770. /* 4 <1.2> Initiate PWR STATE */
  771. /* SET_NET_PWR_STATE_IDLE(prAdapter, ucNetworkTypeIndex); */
  772. /* 4 <2> Initiate BSS_INFO_T - common part */
  773. BSS_INFO_INIT(prAdapter, prBssInfo);
  774. prBssInfo->eConnectionState = PARAM_MEDIA_STATE_DISCONNECTED;
  775. prBssInfo->eConnectionStateIndicated = PARAM_MEDIA_STATE_DISCONNECTED;
  776. prBssInfo->eCurrentOPMode = OP_MODE_ACCESS_POINT;
  777. prBssInfo->fgIsNetActive = TRUE;
  778. prBssInfo->ucBssIndex = ucBssIndex;
  779. prBssInfo->ucReasonOfDisconnect = DISCONNECT_REASON_CODE_RESERVED;
  780. prBssInfo->ucPhyTypeSet = PHY_TYPE_SET_802_11BG; /* Depend on eBand */
  781. prBssInfo->ucConfigAdHocAPMode = AP_MODE_MIXED_11BG; /* Depend on eCurrentOPMode and ucPhyTypeSet */
  782. prBssInfo->u2BSSBasicRateSet = RATE_SET_ERP;
  783. prBssInfo->u2OperationalRateSet = RATE_SET_OFDM;
  784. prBssInfo->fgErpProtectMode = FALSE;
  785. prBssInfo->fgIsQBSS = TRUE;
  786. /* 4 <1.5> Setup MIB for current BSS */
  787. prBssInfo->u2BeaconInterval = 100;
  788. prBssInfo->ucDTIMPeriod = DOT11_DTIM_PERIOD_DEFAULT;
  789. prBssInfo->u2ATIMWindow = 0;
  790. prBssInfo->ucBeaconTimeoutCount = 0;
  791. bssInitForAP(prAdapter, prBssInfo, TRUE);
  792. COPY_MAC_ADDR(prBssInfo->aucBSSID, _aucZeroMacAddr);
  793. LINK_INITIALIZE(&prBssInfo->rStaRecOfClientList);
  794. prBssInfo->fgIsBeaconActivated = TRUE;
  795. prBssInfo->u2HwDefaultFixedRateCode = RATE_CCK_1M_LONG;
  796. COPY_MAC_ADDR(prBssInfo->aucOwnMacAddr, prAdapter->rWifiVar.aucMacAddress);
  797. /* 4 <3> Initiate BSS_INFO_T - private part */
  798. /* TODO */
  799. prBssInfo->eBand = BAND_2G4;
  800. prBssInfo->ucPrimaryChannel = 1;
  801. prBssInfo->prStaRecOfAP = (P_STA_RECORD_T) NULL;
  802. /* prBssInfo->fgErpProtectMode = eErpProectMode; */
  803. /* prBssInfo->eHtProtectMode = eHtProtectMode; */
  804. /* prBssInfo->eGfOperationMode = eGfOperationMode; */
  805. /* 4 <4> Allocate MSDU_INFO_T for Beacon */
  806. prBssInfo->prBeacon = cnmMgtPktAlloc(prAdapter, OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem[0]) + MAX_IE_LENGTH);
  807. if (prBssInfo->prBeacon) {
  808. prBssInfo->prBeacon->eSrc = TX_PACKET_MGMT;
  809. prBssInfo->prBeacon->ucBssIndex = ucBssIndex;
  810. } else {
  811. DBGLOG(SW4, INFO, "prBeacon allocation fail\n");
  812. }
  813. #if 0
  814. prBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = PM_UAPSD_ALL;
  815. prBssInfo->rPmProfSetupInfo.ucBmpTriggerAC = PM_UAPSD_ALL;
  816. prBssInfo->rPmProfSetupInfo.ucUapsdSp = WMM_MAX_SP_LENGTH_2;
  817. #else
  818. prBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = (UINT_8) prAdapter->u4UapsdAcBmp;
  819. prBssInfo->rPmProfSetupInfo.ucBmpTriggerAC = (UINT_8) prAdapter->u4UapsdAcBmp;
  820. prBssInfo->rPmProfSetupInfo.ucUapsdSp = (UINT_8) prAdapter->u4MaxSpLen;
  821. #endif
  822. #if 0
  823. for (eAci = 0; eAci < WMM_AC_INDEX_NUM; eAci++) {
  824. prBssInfo->arACQueParms[eAci].ucIsACMSet = FALSE;
  825. prBssInfo->arACQueParms[eAci].u2Aifsn = (UINT_16) eAci;
  826. prBssInfo->arACQueParms[eAci].u2CWmin = 7;
  827. prBssInfo->arACQueParms[eAci].u2CWmax = 31;
  828. prBssInfo->arACQueParms[eAci].u2TxopLimit = eAci + 1;
  829. DBGLOG(SW4, INFO,
  830. "MQM: eAci = %d, ACM = %d, Aifsn = %d, CWmin = %d, CWmax = %d, TxopLimit = %d\n",
  831. eAci, prBssInfo->arACQueParms[eAci].ucIsACMSet,
  832. prBssInfo->arACQueParms[eAci].u2Aifsn,
  833. prBssInfo->arACQueParms[eAci].u2CWmin,
  834. prBssInfo->arACQueParms[eAci].u2CWmax, prBssInfo->arACQueParms[eAci].u2TxopLimit);
  835. }
  836. #endif
  837. DBGLOG(SW4, INFO, "[2] ucBmpDeliveryAC:0x%x, ucBmpTriggerAC:0x%x, ucUapsdSp:0x%x",
  838. prBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC,
  839. prBssInfo->rPmProfSetupInfo.ucBmpTriggerAC, prBssInfo->rPmProfSetupInfo.ucUapsdSp);
  840. }
  841. VOID testPsCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0, UINT_8 ucOpt1)
  842. {
  843. UINT_8 ucIndex, ucRead;
  844. P_STA_RECORD_T prStaRec;
  845. DEBUGFUNC("testPsCmdCategory0");
  846. SWCR_GET_RW_INDEX(ucAction, ucRead, ucIndex);
  847. DBGLOG(SW4, LOUD, "Read %u Index %u\n", ucRead, ucIndex);
  848. prStaRec = cnmGetStaRecByIndex(prAdapter, 0);
  849. if (ucIndex >= TEST_PS_CATA0_INDEX_NUM)
  850. return;
  851. if (ucRead == SWCR_WRITE) {
  852. switch (ucIndex) {
  853. case TEST_PS_SETUP_BSS:
  854. testPsSetupBss(prAdapter, ucOpt0);
  855. break;
  856. case TEST_PS_ENABLE_BEACON:
  857. break;
  858. case TEST_PS_TRIGGER_BMC:
  859. /* txmForwardQueuedBmcPkts (ucOpt0); */
  860. break;
  861. case TEST_PS_SEND_NULL:
  862. {
  863. testPsSendQoSNullFrame(prAdapter, prStaRec, (UINT_8) (g_au4SwCr[1] & 0xFF), /* UP */
  864. ucOpt0, (BOOLEAN) ((g_au4SwCr[1] >> 8) & 0xFF), /* BMC */
  865. (BOOLEAN) ((g_au4SwCr[1] >> 16) & 0xFF), /* BurstEnd */
  866. (BOOLEAN) ((g_au4SwCr[1] >> 24) & 0xFF), /* Packet type */
  867. (UINT_8) ((g_au4SwCr[2]) & 0xFF), /* PS sesson ID 7: NOACK */
  868. FALSE /* EOSP */
  869. );
  870. }
  871. break;
  872. case TEST_PS_BUFFER_BMC:
  873. /* g_aprBssInfo[ucOpt0]->fgApToBufferBMC = (g_au4SwCr[1] & 0xFF); */
  874. break;
  875. case TEST_PS_UPDATE_BEACON:
  876. bssUpdateBeaconContent(prAdapter, ucOpt0 /*networktype */);
  877. break;
  878. default:
  879. break;
  880. }
  881. } else {
  882. switch (ucIndex) {
  883. case TEST_PS_MAGIC:
  884. g_au4SwCr[1] = 0x88660011;
  885. break;
  886. }
  887. }
  888. }
  889. #endif /* TEST_PS */
  890. #if TEST_PS
  891. VOID testPsCmdCategory1(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0, UINT_8 ucOpt1)
  892. {
  893. UINT_8 ucIndex, ucRead;
  894. UINT_8 ucWTEntry;
  895. P_STA_RECORD_T prStaRec;
  896. DEBUGFUNC("testPsCmdCategory1");
  897. SWCR_GET_RW_INDEX(ucAction, ucRead, ucIndex);
  898. if (ucOpt0 >= CFG_STA_REC_NUM)
  899. return;
  900. prStaRec = cnmGetStaRecByIndex(prAdapter, ucOpt0);
  901. if (!prStaRec)
  902. return;
  903. ucWTEntry = prStaRec->ucWlanIndex;
  904. if (ucRead == SWCR_WRITE) {
  905. switch (ucIndex) {
  906. case TEST_PS_STA_PS:
  907. prStaRec->fgIsInPS = (BOOLEAN) (g_au4SwCr[1] & 0x1);
  908. prStaRec->fgIsQoS = (BOOLEAN) (g_au4SwCr[1] >> 8 & 0xFF);
  909. prStaRec->fgIsUapsdSupported = (BOOLEAN) (g_au4SwCr[1] >> 16 & 0xFF);
  910. prStaRec->ucBmpDeliveryAC = (BOOLEAN) (g_au4SwCr[1] >> 24 & 0xFF);
  911. break;
  912. }
  913. } else {
  914. /* Read */
  915. switch (ucIndex) {
  916. default:
  917. break;
  918. }
  919. }
  920. }
  921. #endif /* TEST_PS */
  922. #if CFG_SUPPORT_802_11V
  923. #if (CFG_SUPPORT_802_11V_TIMING_MEASUREMENT == 1) && (WNM_UNIT_TEST == 1)
  924. VOID testWNMCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0, UINT_8 ucOpt1)
  925. {
  926. UINT_8 ucIndex, ucRead;
  927. P_STA_RECORD_T prStaRec;
  928. DEBUGFUNC("testWNMCmdCategory0");
  929. SWCR_GET_RW_INDEX(ucAction, ucRead, ucIndex);
  930. DBGLOG(SW4, INFO, "Read %u Index %u\n", ucRead, ucIndex);
  931. if (ucIndex >= TEST_WNM_CATA0_INDEX_NUM)
  932. return;
  933. if (ucRead == SWCR_WRITE) {
  934. switch (ucIndex) {
  935. case TEST_WNM_TIMING_MEAS:
  936. wnmTimingMeasUnitTest1(prAdapter, ucOpt0);
  937. break;
  938. default:
  939. break;
  940. }
  941. }
  942. }
  943. #endif /* TEST_WNM */
  944. #endif /* CFG_SUPPORT_802_11V */
  945. VOID swCtrlSwCr(P_ADAPTER_T prAdapter, UINT_8 ucRead, UINT_16 u2Addr, UINT_32 *pu4Data)
  946. {
  947. /* According other register STAIDX */
  948. UINT_8 ucOffset;
  949. ucOffset = (u2Addr >> 2) & 0x3F;
  950. if (ucOffset >= SWCR_CR_NUM)
  951. return;
  952. if (ucRead == SWCR_WRITE) {
  953. g_au4SwCr[ucOffset] = *pu4Data;
  954. if (ucOffset == 0x0) {
  955. /* Commmand [31:24]: Category */
  956. /* Commmand [23:23]: 1(W) 0(R) */
  957. /* Commmand [22:16]: Index */
  958. /* Commmand [15:08]: Option0 */
  959. /* Commmand [07:00]: Option1 */
  960. UINT_8 ucCate;
  961. UINT_32 u4Cmd;
  962. u4Cmd = g_au4SwCr[0];
  963. ucCate = (UINT_8) (u4Cmd >> 24);
  964. if (ucCate < sizeof(g_arSwCtrlCmd) / sizeof(g_arSwCtrlCmd[0])) {
  965. if (g_arSwCtrlCmd[ucCate] != NULL) {
  966. g_arSwCtrlCmd[ucCate] (prAdapter, ucCate,
  967. (UINT_8) (u4Cmd >> 16 & 0xFF),
  968. (UINT_8) ((u4Cmd >> 8) & 0xFF), (UINT_8) (u4Cmd & 0xFF));
  969. }
  970. }
  971. }
  972. } else {
  973. *pu4Data = g_au4SwCr[ucOffset];
  974. }
  975. }
  976. VOID swCrReadWriteCmd(P_ADAPTER_T prAdapter, UINT_8 ucRead, UINT_16 u2Addr, UINT_32 *pu4Data)
  977. {
  978. UINT_8 ucMod;
  979. ucMod = u2Addr >> 8;
  980. /* Address [15:8] MOD ID */
  981. /* Address [7:0] OFFSET */
  982. DEBUGFUNC("swCrReadWriteCmd");
  983. DBGLOG(SW4, TRACE, "%u addr 0x%x data 0x%x\n", ucRead, u2Addr, *pu4Data);
  984. if (ucMod < (sizeof(g_arSwCrModHandle) / sizeof(g_arSwCrModHandle[0]))) {
  985. if (g_arSwCrModHandle[ucMod] != NULL)
  986. g_arSwCrModHandle[ucMod] (prAdapter, ucRead, u2Addr, pu4Data);
  987. } /* ucMod */
  988. }
  989. /* Debug Support */
  990. VOID swCrFrameCheckEnable(P_ADAPTER_T prAdapter, UINT_32 u4DumpType)
  991. {
  992. g_u4SwcrDebugFrameDumpType = u4DumpType;
  993. #if CFG_RX_PKTS_DUMP
  994. prAdapter->rRxCtrl.u4RxPktsDumpTypeMask = u4DumpType;
  995. #endif
  996. }
  997. VOID swCrDebugInit(P_ADAPTER_T prAdapter)
  998. {
  999. /* frame dump */
  1000. if (g_u4SwcrDebugFrameDumpType)
  1001. swCrFrameCheckEnable(prAdapter, g_u4SwcrDebugFrameDumpType);
  1002. /* debug counter */
  1003. g_fgSwcrDebugTimer = FALSE;
  1004. cnmTimerInitTimer(prAdapter, &g_rSwcrDebugTimer, (PFN_MGMT_TIMEOUT_FUNC) swCrDebugCheckTimeout, (ULONG) NULL);
  1005. if (g_u4SwcrDebugCheckTimeout)
  1006. swCrDebugCheckEnable(prAdapter, TRUE, g_ucSwcrDebugCheckType, g_u4SwcrDebugCheckTimeout);
  1007. }
  1008. VOID swCrDebugUninit(P_ADAPTER_T prAdapter)
  1009. {
  1010. cnmTimerStopTimer(prAdapter, &g_rSwcrDebugTimer);
  1011. g_fgSwcrDebugTimer = FALSE;
  1012. }
  1013. VOID swCrDebugCheckEnable(P_ADAPTER_T prAdapter, BOOLEAN fgIsEnable, UINT_8 ucType, UINT_32 u4Timeout)
  1014. {
  1015. if (fgIsEnable) {
  1016. g_ucSwcrDebugCheckType = ucType;
  1017. g_u4SwcrDebugCheckTimeout = u4Timeout;
  1018. if (g_fgSwcrDebugTimer == FALSE)
  1019. swCrDebugCheckTimeout(prAdapter, 0);
  1020. } else {
  1021. cnmTimerStopTimer(prAdapter, &g_rSwcrDebugTimer);
  1022. g_u4SwcrDebugCheckTimeout = 0;
  1023. }
  1024. g_fgSwcrDebugTimer = fgIsEnable;
  1025. }
  1026. VOID swCrDebugCheck(P_ADAPTER_T prAdapter, P_CMD_SW_DBG_CTRL_T prCmdSwCtrl)
  1027. {
  1028. P_RX_CTRL_T prRxCtrl;
  1029. P_TX_CTRL_T prTxCtrl;
  1030. ASSERT(prAdapter);
  1031. prTxCtrl = &prAdapter->rTxCtrl;
  1032. prRxCtrl = &prAdapter->rRxCtrl;
  1033. /* dump counters */
  1034. if (prCmdSwCtrl) {
  1035. if (prCmdSwCtrl->u4Data == SWCR_DBG_TYPE_ALL) {
  1036. /* TX Counter from fw */
  1037. DBGLOG(SW4, INFO, "TX0\n"
  1038. "%08x %08x %08x %08x\n"
  1039. "%08x %08x %08x %08x\n",
  1040. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_CNT],
  1041. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_BCN_CNT],
  1042. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_FAILED_CNT],
  1043. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_RETRY_CNT],
  1044. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_AGING_TIMEOUT_CNT],
  1045. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_PS_OVERFLOW_CNT],
  1046. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_MGNT_DROP_CNT],
  1047. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_ERROR_CNT]);
  1048. #if 1
  1049. /* TX Counter from drv */
  1050. DBGLOG(SW4, INFO, "TX1\n"
  1051. "%08x %08x %08x %08x\n",
  1052. (UINT_32) TX_GET_CNT(prTxCtrl, TX_INACTIVE_BSS_DROP),
  1053. (UINT_32) TX_GET_CNT(prTxCtrl, TX_INACTIVE_STA_DROP),
  1054. (UINT_32) TX_GET_CNT(prTxCtrl, TX_FORWARD_OVERFLOW_DROP),
  1055. (UINT_32) TX_GET_CNT(prTxCtrl, TX_AP_BORADCAST_DROP));
  1056. #endif
  1057. /* RX Counter */
  1058. DBGLOG(SW4, INFO, "RX0\n"
  1059. "%08x %08x %08x %08x\n"
  1060. "%08x %08x %08x %08x\n"
  1061. "%08x %08x %08x %08x\n"
  1062. "%08x %08x %08x %08x\n",
  1063. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_CNT],
  1064. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_DROP_CNT],
  1065. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_DUP_DROP_CNT],
  1066. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_TYPE_ERROR_DROP_CNT],
  1067. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_CLASS_ERROR_DROP_CNT],
  1068. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_AMPDU_ERROR_DROP_CNT],
  1069. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_STATUS_ERROR_DROP_CNT],
  1070. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_FORMAT_ERROR_DROP_CNT],
  1071. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_ICV_ERROR_DROP_CNT],
  1072. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_KEY_ERROR_DROP_CNT],
  1073. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_TKIP_ERROR_DROP_CNT],
  1074. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_MIC_ERROR_DROP_CNT],
  1075. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_BIP_ERROR_DROP_CNT],
  1076. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_FCSERR_CNT],
  1077. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_FIFOFULL_CNT],
  1078. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_PFDROP_CNT]);
  1079. DBGLOG(SW4, INFO, "RX1\n"
  1080. "%08x %08x %08x %08x\n"
  1081. "%08x %08x %08x %08x\n",
  1082. (UINT_32) RX_GET_CNT(prRxCtrl, RX_MPDU_TOTAL_COUNT),
  1083. (UINT_32) RX_GET_CNT(prRxCtrl, RX_DATA_INDICATION_COUNT),
  1084. (UINT_32) RX_GET_CNT(prRxCtrl, RX_DATA_RETURNED_COUNT),
  1085. (UINT_32) RX_GET_CNT(prRxCtrl, RX_DATA_RETAINED_COUNT),
  1086. (UINT_32) RX_GET_CNT(prRxCtrl, RX_DROP_TOTAL_COUNT),
  1087. (UINT_32) RX_GET_CNT(prRxCtrl, RX_TYPE_ERR_DROP_COUNT),
  1088. (UINT_32) RX_GET_CNT(prRxCtrl, RX_CLASS_ERR_DROP_COUNT),
  1089. (UINT_32) RX_GET_CNT(prRxCtrl, RX_DST_NULL_DROP_COUNT));
  1090. DBGLOG(SW4, INFO, "PWR\n"
  1091. "%08x %08x %08x %08x\n"
  1092. "%08x %08x %08x %08x\n",
  1093. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_PS_POLL_CNT],
  1094. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_TRIGGER_NULL_CNT],
  1095. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_BCN_IND_CNT],
  1096. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_BCN_TIMEOUT_CNT],
  1097. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_PM_STATE0],
  1098. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_PM_STATE1],
  1099. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_CUR_PS_PROF0],
  1100. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_CUR_PS_PROF1]);
  1101. DBGLOG(SW4, INFO, "ARM\n"
  1102. "%08x %08x %08x %08x\n"
  1103. "%08x %08x\n",
  1104. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_AR_STA0_RATE],
  1105. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_AR_STA0_BWGI],
  1106. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_AR_STA0_RX_RATE_RCPI],
  1107. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_ROAMING_ENABLE],
  1108. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_ROAMING_ROAM_CNT],
  1109. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_ROAMING_INT_CNT]);
  1110. DBGLOG(SW4, INFO, "BB\n"
  1111. "%08x %08x %08x %08x\n"
  1112. "%08x %08x %08x %08x\n",
  1113. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_RX_MDRDY_CNT],
  1114. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_RX_FCSERR_CNT],
  1115. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_CCK_PD_CNT],
  1116. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_OFDM_PD_CNT],
  1117. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_CCK_SFDERR_CNT],
  1118. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_CCK_SIGERR_CNT],
  1119. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_OFDM_TAGERR_CNT],
  1120. prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_OFDM_SIGERR_CNT]);
  1121. }
  1122. }
  1123. /* start the next check */
  1124. if (g_u4SwcrDebugCheckTimeout)
  1125. cnmTimerStartTimer(prAdapter, &g_rSwcrDebugTimer, g_u4SwcrDebugCheckTimeout * MSEC_PER_SEC);
  1126. }
  1127. VOID swCrDebugCheckTimeout(IN P_ADAPTER_T prAdapter, ULONG ulParamPtr)
  1128. {
  1129. CMD_SW_DBG_CTRL_T rCmdSwCtrl;
  1130. WLAN_STATUS rStatus;
  1131. rCmdSwCtrl.u4Id = (0xb000 << 16) + g_ucSwcrDebugCheckType;
  1132. rCmdSwCtrl.u4Data = 0;
  1133. rStatus = wlanSendSetQueryCmd(prAdapter, /* prAdapter */
  1134. CMD_ID_SW_DBG_CTRL, /* ucCID */
  1135. FALSE, /* fgSetQuery */
  1136. TRUE, /* fgNeedResp */
  1137. FALSE, /* fgIsOid */
  1138. swCrDebugQuery, /* pfCmdDoneHandler */
  1139. swCrDebugQueryTimeout, /* pfCmdTimeoutHandler */
  1140. sizeof(CMD_SW_DBG_CTRL_T), /* u4SetQueryInfoLen */
  1141. (PUINT_8) &rCmdSwCtrl, /* pucInfoBuffer */
  1142. NULL, /* pvSetQueryBuffer */
  1143. 0 /* u4SetQueryBufferLen */
  1144. );
  1145. ASSERT(rStatus == WLAN_STATUS_PENDING);
  1146. }
  1147. VOID swCrDebugQuery(IN P_ADAPTER_T prAdapter, IN P_CMD_INFO_T prCmdInfo, IN PUINT_8 pucEventBuf)
  1148. {
  1149. ASSERT(prAdapter);
  1150. swCrDebugCheck(prAdapter, (P_CMD_SW_DBG_CTRL_T) (pucEventBuf));
  1151. }
  1152. VOID swCrDebugQueryTimeout(IN P_ADAPTER_T prAdapter, IN P_CMD_INFO_T prCmdInfo)
  1153. {
  1154. ASSERT(prAdapter);
  1155. swCrDebugCheck(prAdapter, NULL);
  1156. }
  1157. #endif /* CFG_SUPPORT_SWCR */