mib.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. /*
  2. * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
  3. * All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along
  16. * with this program; if not, write to the Free Software Foundation, Inc.,
  17. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18. *
  19. * File: mib.c
  20. *
  21. * Purpose: Implement MIB Data Structure
  22. *
  23. * Author: Tevin Chen
  24. *
  25. * Date: May 21, 1996
  26. *
  27. * Functions:
  28. * STAvClearAllCounter - Clear All MIB Counter
  29. * STAvUpdateIstStatCounter - Update ISR statistic counter
  30. * STAvUpdateRDStatCounter - Update Rx statistic counter
  31. * STAvUpdateRDStatCounterEx - Update Rx statistic counter and copy rcv data
  32. * STAvUpdateTDStatCounter - Update Tx statistic counter
  33. * STAvUpdateTDStatCounterEx - Update Tx statistic counter and copy tx data
  34. * STAvUpdate802_11Counter - Update 802.11 mib counter
  35. *
  36. * Revision History:
  37. *
  38. */
  39. #include "upc.h"
  40. #include "mac.h"
  41. #include "tether.h"
  42. #include "mib.h"
  43. #include "wctl.h"
  44. #include "baseband.h"
  45. /*--------------------- Static Classes ----------------------------*/
  46. /*--------------------- Static Variables --------------------------*/
  47. /*--------------------- Static Functions --------------------------*/
  48. /*--------------------- Export Variables --------------------------*/
  49. /*--------------------- Export Functions --------------------------*/
  50. /*
  51. * Description: Clear All Statistic Counter
  52. *
  53. * Parameters:
  54. * In:
  55. * pStatistic - Pointer to Statistic Counter Data Structure
  56. * Out:
  57. * none
  58. *
  59. * Return Value: none
  60. *
  61. */
  62. void STAvClearAllCounter(PSStatCounter pStatistic)
  63. {
  64. // set memory to zero
  65. memset(pStatistic, 0, sizeof(SStatCounter));
  66. }
  67. /*
  68. * Description: Update Isr Statistic Counter
  69. *
  70. * Parameters:
  71. * In:
  72. * pStatistic - Pointer to Statistic Counter Data Structure
  73. * wisr - Interrupt status
  74. * Out:
  75. * none
  76. *
  77. * Return Value: none
  78. *
  79. */
  80. void STAvUpdateIsrStatCounter(PSStatCounter pStatistic, unsigned long dwIsr)
  81. {
  82. /**********************/
  83. /* ABNORMAL interrupt */
  84. /**********************/
  85. // not any IMR bit invoke irq
  86. if (dwIsr == 0) {
  87. pStatistic->ISRStat.dwIsrUnknown++;
  88. return;
  89. }
  90. //Added by Kyle
  91. if (dwIsr & ISR_TXDMA0) // ISR, bit0
  92. pStatistic->ISRStat.dwIsrTx0OK++; // TXDMA0 successful
  93. if (dwIsr & ISR_AC0DMA) // ISR, bit1
  94. pStatistic->ISRStat.dwIsrAC0TxOK++; // AC0DMA successful
  95. if (dwIsr & ISR_BNTX) // ISR, bit2
  96. pStatistic->ISRStat.dwIsrBeaconTxOK++; // BeaconTx successful
  97. if (dwIsr & ISR_RXDMA0) // ISR, bit3
  98. pStatistic->ISRStat.dwIsrRx0OK++; // Rx0 successful
  99. if (dwIsr & ISR_TBTT) // ISR, bit4
  100. pStatistic->ISRStat.dwIsrTBTTInt++; // TBTT successful
  101. if (dwIsr & ISR_SOFTTIMER) // ISR, bit6
  102. pStatistic->ISRStat.dwIsrSTIMERInt++;
  103. if (dwIsr & ISR_WATCHDOG) // ISR, bit7
  104. pStatistic->ISRStat.dwIsrWatchDog++;
  105. if (dwIsr & ISR_FETALERR) // ISR, bit8
  106. pStatistic->ISRStat.dwIsrUnrecoverableError++;
  107. if (dwIsr & ISR_SOFTINT) // ISR, bit9
  108. pStatistic->ISRStat.dwIsrSoftInterrupt++; // software interrupt
  109. if (dwIsr & ISR_MIBNEARFULL) // ISR, bit10
  110. pStatistic->ISRStat.dwIsrMIBNearfull++;
  111. if (dwIsr & ISR_RXNOBUF) // ISR, bit11
  112. pStatistic->ISRStat.dwIsrRxNoBuf++; // Rx No Buff
  113. if (dwIsr & ISR_RXDMA1) // ISR, bit12
  114. pStatistic->ISRStat.dwIsrRx1OK++; // Rx1 successful
  115. if (dwIsr & ISR_SOFTTIMER1) // ISR, bit21
  116. pStatistic->ISRStat.dwIsrSTIMER1Int++;
  117. }
  118. /*
  119. * Description: Update Rx Statistic Counter
  120. *
  121. * Parameters:
  122. * In:
  123. * pStatistic - Pointer to Statistic Counter Data Structure
  124. * byRSR - Rx Status
  125. * byNewRSR - Rx Status
  126. * pbyBuffer - Rx Buffer
  127. * cbFrameLength - Rx Length
  128. * Out:
  129. * none
  130. *
  131. * Return Value: none
  132. *
  133. */
  134. void STAvUpdateRDStatCounter(PSStatCounter pStatistic,
  135. unsigned char byRSR, unsigned char byNewRSR, unsigned char byRxRate,
  136. unsigned char *pbyBuffer, unsigned int cbFrameLength)
  137. {
  138. //need change
  139. PS802_11Header pHeader = (PS802_11Header)pbyBuffer;
  140. if (byRSR & RSR_ADDROK)
  141. pStatistic->dwRsrADDROk++;
  142. if (byRSR & RSR_CRCOK) {
  143. pStatistic->dwRsrCRCOk++;
  144. pStatistic->ullRsrOK++;
  145. if (cbFrameLength >= ETH_ALEN) {
  146. // update counters in case of successful transmit
  147. if (byRSR & RSR_ADDRBROAD) {
  148. pStatistic->ullRxBroadcastFrames++;
  149. pStatistic->ullRxBroadcastBytes += (unsigned long long) cbFrameLength;
  150. } else if (byRSR & RSR_ADDRMULTI) {
  151. pStatistic->ullRxMulticastFrames++;
  152. pStatistic->ullRxMulticastBytes += (unsigned long long) cbFrameLength;
  153. } else {
  154. pStatistic->ullRxDirectedFrames++;
  155. pStatistic->ullRxDirectedBytes += (unsigned long long) cbFrameLength;
  156. }
  157. }
  158. }
  159. if (byRxRate == 22) {
  160. pStatistic->CustomStat.ullRsr11M++;
  161. if (byRSR & RSR_CRCOK)
  162. pStatistic->CustomStat.ullRsr11MCRCOk++;
  163. pr_debug("11M: ALL[%d], OK[%d]:[%02x]\n",
  164. (int)pStatistic->CustomStat.ullRsr11M,
  165. (int)pStatistic->CustomStat.ullRsr11MCRCOk, byRSR);
  166. } else if (byRxRate == 11) {
  167. pStatistic->CustomStat.ullRsr5M++;
  168. if (byRSR & RSR_CRCOK)
  169. pStatistic->CustomStat.ullRsr5MCRCOk++;
  170. pr_debug(" 5M: ALL[%d], OK[%d]:[%02x]\n",
  171. (int)pStatistic->CustomStat.ullRsr5M,
  172. (int)pStatistic->CustomStat.ullRsr5MCRCOk, byRSR);
  173. } else if (byRxRate == 4) {
  174. pStatistic->CustomStat.ullRsr2M++;
  175. if (byRSR & RSR_CRCOK)
  176. pStatistic->CustomStat.ullRsr2MCRCOk++;
  177. pr_debug(" 2M: ALL[%d], OK[%d]:[%02x]\n",
  178. (int)pStatistic->CustomStat.ullRsr2M,
  179. (int)pStatistic->CustomStat.ullRsr2MCRCOk, byRSR);
  180. } else if (byRxRate == 2) {
  181. pStatistic->CustomStat.ullRsr1M++;
  182. if (byRSR & RSR_CRCOK)
  183. pStatistic->CustomStat.ullRsr1MCRCOk++;
  184. pr_debug(" 1M: ALL[%d], OK[%d]:[%02x]\n",
  185. (int)pStatistic->CustomStat.ullRsr1M,
  186. (int)pStatistic->CustomStat.ullRsr1MCRCOk, byRSR);
  187. } else if (byRxRate == 12) {
  188. pStatistic->CustomStat.ullRsr6M++;
  189. if (byRSR & RSR_CRCOK)
  190. pStatistic->CustomStat.ullRsr6MCRCOk++;
  191. pr_debug(" 6M: ALL[%d], OK[%d]\n",
  192. (int)pStatistic->CustomStat.ullRsr6M,
  193. (int)pStatistic->CustomStat.ullRsr6MCRCOk);
  194. } else if (byRxRate == 18) {
  195. pStatistic->CustomStat.ullRsr9M++;
  196. if (byRSR & RSR_CRCOK)
  197. pStatistic->CustomStat.ullRsr9MCRCOk++;
  198. pr_debug(" 9M: ALL[%d], OK[%d]\n",
  199. (int)pStatistic->CustomStat.ullRsr9M,
  200. (int)pStatistic->CustomStat.ullRsr9MCRCOk);
  201. } else if (byRxRate == 24) {
  202. pStatistic->CustomStat.ullRsr12M++;
  203. if (byRSR & RSR_CRCOK)
  204. pStatistic->CustomStat.ullRsr12MCRCOk++;
  205. pr_debug("12M: ALL[%d], OK[%d]\n",
  206. (int)pStatistic->CustomStat.ullRsr12M,
  207. (int)pStatistic->CustomStat.ullRsr12MCRCOk);
  208. } else if (byRxRate == 36) {
  209. pStatistic->CustomStat.ullRsr18M++;
  210. if (byRSR & RSR_CRCOK)
  211. pStatistic->CustomStat.ullRsr18MCRCOk++;
  212. pr_debug("18M: ALL[%d], OK[%d]\n",
  213. (int)pStatistic->CustomStat.ullRsr18M,
  214. (int)pStatistic->CustomStat.ullRsr18MCRCOk);
  215. } else if (byRxRate == 48) {
  216. pStatistic->CustomStat.ullRsr24M++;
  217. if (byRSR & RSR_CRCOK)
  218. pStatistic->CustomStat.ullRsr24MCRCOk++;
  219. pr_debug("24M: ALL[%d], OK[%d]\n",
  220. (int)pStatistic->CustomStat.ullRsr24M,
  221. (int)pStatistic->CustomStat.ullRsr24MCRCOk);
  222. } else if (byRxRate == 72) {
  223. pStatistic->CustomStat.ullRsr36M++;
  224. if (byRSR & RSR_CRCOK)
  225. pStatistic->CustomStat.ullRsr36MCRCOk++;
  226. pr_debug("36M: ALL[%d], OK[%d]\n",
  227. (int)pStatistic->CustomStat.ullRsr36M,
  228. (int)pStatistic->CustomStat.ullRsr36MCRCOk);
  229. } else if (byRxRate == 96) {
  230. pStatistic->CustomStat.ullRsr48M++;
  231. if (byRSR & RSR_CRCOK)
  232. pStatistic->CustomStat.ullRsr48MCRCOk++;
  233. pr_debug("48M: ALL[%d], OK[%d]\n",
  234. (int)pStatistic->CustomStat.ullRsr48M,
  235. (int)pStatistic->CustomStat.ullRsr48MCRCOk);
  236. } else if (byRxRate == 108) {
  237. pStatistic->CustomStat.ullRsr54M++;
  238. if (byRSR & RSR_CRCOK)
  239. pStatistic->CustomStat.ullRsr54MCRCOk++;
  240. pr_debug("54M: ALL[%d], OK[%d]\n",
  241. (int)pStatistic->CustomStat.ullRsr54M,
  242. (int)pStatistic->CustomStat.ullRsr54MCRCOk);
  243. } else {
  244. pr_debug("Unknown: Total[%d], CRCOK[%d]\n",
  245. (int)pStatistic->dwRsrRxPacket+1,
  246. (int)pStatistic->dwRsrCRCOk);
  247. }
  248. if (byRSR & RSR_BSSIDOK)
  249. pStatistic->dwRsrBSSIDOk++;
  250. if (byRSR & RSR_BCNSSIDOK)
  251. pStatistic->dwRsrBCNSSIDOk++;
  252. if (byRSR & RSR_IVLDLEN) //invalid len (> 2312 byte)
  253. pStatistic->dwRsrLENErr++;
  254. if (byRSR & RSR_IVLDTYP) //invalid packet type
  255. pStatistic->dwRsrTYPErr++;
  256. if (byRSR & (RSR_IVLDTYP | RSR_IVLDLEN))
  257. pStatistic->dwRsrErr++;
  258. if (byNewRSR & NEWRSR_DECRYPTOK)
  259. pStatistic->dwNewRsrDECRYPTOK++;
  260. if (byNewRSR & NEWRSR_CFPIND)
  261. pStatistic->dwNewRsrCFP++;
  262. if (byNewRSR & NEWRSR_HWUTSF)
  263. pStatistic->dwNewRsrUTSF++;
  264. if (byNewRSR & NEWRSR_BCNHITAID)
  265. pStatistic->dwNewRsrHITAID++;
  266. if (byNewRSR & NEWRSR_BCNHITAID0)
  267. pStatistic->dwNewRsrHITAID0++;
  268. // increase rx packet count
  269. pStatistic->dwRsrRxPacket++;
  270. pStatistic->dwRsrRxOctet += cbFrameLength;
  271. if (IS_TYPE_DATA(pbyBuffer))
  272. pStatistic->dwRsrRxData++;
  273. else if (IS_TYPE_MGMT(pbyBuffer))
  274. pStatistic->dwRsrRxManage++;
  275. else if (IS_TYPE_CONTROL(pbyBuffer))
  276. pStatistic->dwRsrRxControl++;
  277. if (byRSR & RSR_ADDRBROAD)
  278. pStatistic->dwRsrBroadcast++;
  279. else if (byRSR & RSR_ADDRMULTI)
  280. pStatistic->dwRsrMulticast++;
  281. else
  282. pStatistic->dwRsrDirected++;
  283. if (WLAN_GET_FC_MOREFRAG(pHeader->wFrameCtl))
  284. pStatistic->dwRsrRxFragment++;
  285. if (cbFrameLength < ETH_ZLEN + 4)
  286. pStatistic->dwRsrRunt++;
  287. else if (cbFrameLength == ETH_ZLEN + 4)
  288. pStatistic->dwRsrRxFrmLen64++;
  289. else if ((65 <= cbFrameLength) && (cbFrameLength <= 127))
  290. pStatistic->dwRsrRxFrmLen65_127++;
  291. else if ((128 <= cbFrameLength) && (cbFrameLength <= 255))
  292. pStatistic->dwRsrRxFrmLen128_255++;
  293. else if ((256 <= cbFrameLength) && (cbFrameLength <= 511))
  294. pStatistic->dwRsrRxFrmLen256_511++;
  295. else if ((512 <= cbFrameLength) && (cbFrameLength <= 1023))
  296. pStatistic->dwRsrRxFrmLen512_1023++;
  297. else if ((1024 <= cbFrameLength) && (cbFrameLength <= ETH_FRAME_LEN + 4))
  298. pStatistic->dwRsrRxFrmLen1024_1518++;
  299. else if (cbFrameLength > ETH_FRAME_LEN + 4)
  300. pStatistic->dwRsrLong++;
  301. }
  302. /*
  303. * Description: Update Rx Statistic Counter and copy Rx buffer
  304. *
  305. * Parameters:
  306. * In:
  307. * pStatistic - Pointer to Statistic Counter Data Structure
  308. * byRSR - Rx Status
  309. * byNewRSR - Rx Status
  310. * pbyBuffer - Rx Buffer
  311. * cbFrameLength - Rx Length
  312. * Out:
  313. * none
  314. *
  315. * Return Value: none
  316. *
  317. */
  318. void
  319. STAvUpdateRDStatCounterEx(
  320. PSStatCounter pStatistic,
  321. unsigned char byRSR,
  322. unsigned char byNewRSR,
  323. unsigned char byRxRate,
  324. unsigned char *pbyBuffer,
  325. unsigned int cbFrameLength
  326. )
  327. {
  328. STAvUpdateRDStatCounter(
  329. pStatistic,
  330. byRSR,
  331. byNewRSR,
  332. byRxRate,
  333. pbyBuffer,
  334. cbFrameLength
  335. );
  336. // rx length
  337. pStatistic->dwCntRxFrmLength = cbFrameLength;
  338. // rx pattern, we just see 10 bytes for sample
  339. memcpy(pStatistic->abyCntRxPattern, (unsigned char *)pbyBuffer, 10);
  340. }
  341. /*
  342. * Description: Update Tx Statistic Counter
  343. *
  344. * Parameters:
  345. * In:
  346. * pStatistic - Pointer to Statistic Counter Data Structure
  347. * byTSR0 - Tx Status
  348. * byTSR1 - Tx Status
  349. * pbyBuffer - Tx Buffer
  350. * cbFrameLength - Tx Length
  351. * uIdx - Index of Tx DMA
  352. * Out:
  353. * none
  354. *
  355. * Return Value: none
  356. *
  357. */
  358. void
  359. STAvUpdateTDStatCounter(
  360. PSStatCounter pStatistic,
  361. unsigned char byTSR0,
  362. unsigned char byTSR1,
  363. unsigned char *pbyBuffer,
  364. unsigned int cbFrameLength,
  365. unsigned int uIdx
  366. )
  367. {
  368. PWLAN_80211HDR_A4 pHeader;
  369. unsigned char *pbyDestAddr;
  370. unsigned char byTSR0_NCR = byTSR0 & TSR0_NCR;
  371. pHeader = (PWLAN_80211HDR_A4) pbyBuffer;
  372. if (WLAN_GET_FC_TODS(pHeader->wFrameCtl) == 0)
  373. pbyDestAddr = &(pHeader->abyAddr1[0]);
  374. else
  375. pbyDestAddr = &(pHeader->abyAddr3[0]);
  376. // increase tx packet count
  377. pStatistic->dwTsrTxPacket[uIdx]++;
  378. pStatistic->dwTsrTxOctet[uIdx] += cbFrameLength;
  379. if (byTSR0_NCR != 0) {
  380. pStatistic->dwTsrRetry[uIdx]++;
  381. pStatistic->dwTsrTotalRetry[uIdx] += byTSR0_NCR;
  382. if (byTSR0_NCR == 1)
  383. pStatistic->dwTsrOnceRetry[uIdx]++;
  384. else
  385. pStatistic->dwTsrMoreThanOnceRetry[uIdx]++;
  386. }
  387. if ((byTSR1&(TSR1_TERR|TSR1_RETRYTMO|TSR1_TMO|ACK_DATA)) == 0) {
  388. pStatistic->ullTsrOK[uIdx]++;
  389. pStatistic->CustomStat.ullTsrAllOK =
  390. (pStatistic->ullTsrOK[TYPE_AC0DMA] + pStatistic->ullTsrOK[TYPE_TXDMA0]);
  391. // update counters in case that successful transmit
  392. if (is_broadcast_ether_addr(pbyDestAddr)) {
  393. pStatistic->ullTxBroadcastFrames[uIdx]++;
  394. pStatistic->ullTxBroadcastBytes[uIdx] += (unsigned long long) cbFrameLength;
  395. } else if (is_multicast_ether_addr(pbyDestAddr)) {
  396. pStatistic->ullTxMulticastFrames[uIdx]++;
  397. pStatistic->ullTxMulticastBytes[uIdx] += (unsigned long long) cbFrameLength;
  398. } else {
  399. pStatistic->ullTxDirectedFrames[uIdx]++;
  400. pStatistic->ullTxDirectedBytes[uIdx] += (unsigned long long) cbFrameLength;
  401. }
  402. } else {
  403. if (byTSR1 & TSR1_TERR)
  404. pStatistic->dwTsrErr[uIdx]++;
  405. if (byTSR1 & TSR1_RETRYTMO)
  406. pStatistic->dwTsrRetryTimeout[uIdx]++;
  407. if (byTSR1 & TSR1_TMO)
  408. pStatistic->dwTsrTransmitTimeout[uIdx]++;
  409. if (byTSR1 & ACK_DATA)
  410. pStatistic->dwTsrACKData[uIdx]++;
  411. }
  412. if (is_broadcast_ether_addr(pbyDestAddr))
  413. pStatistic->dwTsrBroadcast[uIdx]++;
  414. else if (is_multicast_ether_addr(pbyDestAddr))
  415. pStatistic->dwTsrMulticast[uIdx]++;
  416. else
  417. pStatistic->dwTsrDirected[uIdx]++;
  418. }
  419. /*
  420. * Description: Update Tx Statistic Counter and copy Tx buffer
  421. *
  422. * Parameters:
  423. * In:
  424. * pStatistic - Pointer to Statistic Counter Data Structure
  425. * pbyBuffer - Tx Buffer
  426. * cbFrameLength - Tx Length
  427. * Out:
  428. * none
  429. *
  430. * Return Value: none
  431. *
  432. */
  433. void
  434. STAvUpdateTDStatCounterEx(
  435. PSStatCounter pStatistic,
  436. unsigned char *pbyBuffer,
  437. unsigned long cbFrameLength
  438. )
  439. {
  440. unsigned int uPktLength;
  441. uPktLength = (unsigned int)cbFrameLength;
  442. // tx length
  443. pStatistic->dwCntTxBufLength = uPktLength;
  444. // tx pattern, we just see 16 bytes for sample
  445. memcpy(pStatistic->abyCntTxPattern, pbyBuffer, 16);
  446. }
  447. /*
  448. * Description: Update 802.11 mib counter
  449. *
  450. * Parameters:
  451. * In:
  452. * p802_11Counter - Pointer to 802.11 mib counter
  453. * pStatistic - Pointer to Statistic Counter Data Structure
  454. * dwCounter - hardware counter for 802.11 mib
  455. * Out:
  456. * none
  457. *
  458. * Return Value: none
  459. *
  460. */
  461. void
  462. STAvUpdate802_11Counter(
  463. PSDot11Counters p802_11Counter,
  464. PSStatCounter pStatistic,
  465. unsigned long dwCounter
  466. )
  467. {
  468. p802_11Counter->MulticastTransmittedFrameCount = (unsigned long long) (pStatistic->dwTsrBroadcast[TYPE_AC0DMA] +
  469. pStatistic->dwTsrBroadcast[TYPE_TXDMA0] +
  470. pStatistic->dwTsrMulticast[TYPE_AC0DMA] +
  471. pStatistic->dwTsrMulticast[TYPE_TXDMA0]);
  472. p802_11Counter->FailedCount = (unsigned long long) (pStatistic->dwTsrErr[TYPE_AC0DMA] + pStatistic->dwTsrErr[TYPE_TXDMA0]);
  473. p802_11Counter->RetryCount = (unsigned long long) (pStatistic->dwTsrRetry[TYPE_AC0DMA] + pStatistic->dwTsrRetry[TYPE_TXDMA0]);
  474. p802_11Counter->MultipleRetryCount = (unsigned long long) (pStatistic->dwTsrMoreThanOnceRetry[TYPE_AC0DMA] +
  475. pStatistic->dwTsrMoreThanOnceRetry[TYPE_TXDMA0]);
  476. p802_11Counter->RTSSuccessCount += (unsigned long long) (dwCounter & 0x000000ff);
  477. p802_11Counter->RTSFailureCount += (unsigned long long) ((dwCounter & 0x0000ff00) >> 8);
  478. p802_11Counter->ACKFailureCount += (unsigned long long) ((dwCounter & 0x00ff0000) >> 16);
  479. p802_11Counter->FCSErrorCount += (unsigned long long) ((dwCounter & 0xff000000) >> 24);
  480. p802_11Counter->MulticastReceivedFrameCount = (unsigned long long) (pStatistic->dwRsrBroadcast +
  481. pStatistic->dwRsrMulticast);
  482. }
  483. /*
  484. * Description: Clear 802.11 mib counter
  485. *
  486. * Parameters:
  487. * In:
  488. * p802_11Counter - Pointer to 802.11 mib counter
  489. * Out:
  490. * none
  491. *
  492. * Return Value: none
  493. *
  494. */
  495. void
  496. STAvClear802_11Counter(PSDot11Counters p802_11Counter)
  497. {
  498. // set memory to zero
  499. memset(p802_11Counter, 0, sizeof(SDot11Counters));
  500. }