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