Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh...
[pandora-kernel.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, DWORD 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_ATIMTX)               // ISR, bit13
143 //        pStatistic->ISRStat.dwIsrATIMTxOK++;          // ATIMTX successful
144
145 //    if (dwIsr & ISR_SYNCTX)               // ISR, bit14
146 //        pStatistic->ISRStat.dwIsrSYNCTxOK++;          // SYNCTX successful
147
148 //    if (dwIsr & ISR_CFPEND)               // ISR, bit18
149 //        pStatistic->ISRStat.dwIsrCFPEnd++;
150
151 //    if (dwIsr & ISR_ATIMEND)              // ISR, bit19
152 //        pStatistic->ISRStat.dwIsrATIMEnd++;
153
154 //    if (dwIsr & ISR_SYNCFLUSHOK)          // ISR, bit20
155 //        pStatistic->ISRStat.dwIsrSYNCFlushOK++;
156
157     if (dwIsr & ISR_SOFTTIMER1)           // ISR, bit21
158         pStatistic->ISRStat.dwIsrSTIMER1Int++;
159
160 }
161
162
163 /*
164  * Description: Update Rx Statistic Counter
165  *
166  * Parameters:
167  *  In:
168  *      pStatistic      - Pointer to Statistic Counter Data Structure
169  *      byRSR           - Rx Status
170  *      byNewRSR        - Rx Status
171  *      pbyBuffer       - Rx Buffer
172  *      cbFrameLength   - Rx Length
173  *  Out:
174  *      none
175  *
176  * Return Value: none
177  *
178  */
179 void STAvUpdateRDStatCounter (PSStatCounter pStatistic,
180                               BYTE byRSR, BYTE byNewRSR, BYTE byRxRate,
181                               PBYTE pbyBuffer, UINT cbFrameLength)
182 {
183     //need change
184     PS802_11Header pHeader = (PS802_11Header)pbyBuffer;
185
186     if (byRSR & RSR_ADDROK)
187         pStatistic->dwRsrADDROk++;
188     if (byRSR & RSR_CRCOK) {
189         pStatistic->dwRsrCRCOk++;
190
191         pStatistic->ullRsrOK++;
192
193         if (cbFrameLength >= ETH_ALEN) {
194             // update counters in case that successful transmit
195             if (byRSR & RSR_ADDRBROAD) {
196                 pStatistic->ullRxBroadcastFrames++;
197                 pStatistic->ullRxBroadcastBytes += (ULONGLONG)cbFrameLength;
198             }
199             else if (byRSR & RSR_ADDRMULTI) {
200                 pStatistic->ullRxMulticastFrames++;
201                 pStatistic->ullRxMulticastBytes += (ULONGLONG)cbFrameLength;
202             }
203             else {
204                 pStatistic->ullRxDirectedFrames++;
205                 pStatistic->ullRxDirectedBytes += (ULONGLONG)cbFrameLength;
206             }
207         }
208     }
209
210     if(byRxRate==22) {
211         pStatistic->CustomStat.ullRsr11M++;
212         if(byRSR & RSR_CRCOK) {
213             pStatistic->CustomStat.ullRsr11MCRCOk++;
214         }
215         DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"11M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr11M, (INT)pStatistic->CustomStat.ullRsr11MCRCOk, byRSR);
216     }
217     else if(byRxRate==11) {
218         pStatistic->CustomStat.ullRsr5M++;
219         if(byRSR & RSR_CRCOK) {
220             pStatistic->CustomStat.ullRsr5MCRCOk++;
221         }
222         DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 5M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr5M, (INT)pStatistic->CustomStat.ullRsr5MCRCOk, byRSR);
223     }
224     else if(byRxRate==4) {
225         pStatistic->CustomStat.ullRsr2M++;
226         if(byRSR & RSR_CRCOK) {
227             pStatistic->CustomStat.ullRsr2MCRCOk++;
228         }
229         DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 2M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr2M, (INT)pStatistic->CustomStat.ullRsr2MCRCOk, byRSR);
230     }
231     else if(byRxRate==2){
232         pStatistic->CustomStat.ullRsr1M++;
233         if(byRSR & RSR_CRCOK) {
234             pStatistic->CustomStat.ullRsr1MCRCOk++;
235         }
236         DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 1M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr1M, (INT)pStatistic->CustomStat.ullRsr1MCRCOk, byRSR);
237     }
238     else if(byRxRate==12){
239         pStatistic->CustomStat.ullRsr6M++;
240         if(byRSR & RSR_CRCOK) {
241             pStatistic->CustomStat.ullRsr6MCRCOk++;
242         }
243         DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 6M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr6M, (INT)pStatistic->CustomStat.ullRsr6MCRCOk);
244     }
245     else if(byRxRate==18){
246         pStatistic->CustomStat.ullRsr9M++;
247         if(byRSR & RSR_CRCOK) {
248             pStatistic->CustomStat.ullRsr9MCRCOk++;
249         }
250         DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 9M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr9M, (INT)pStatistic->CustomStat.ullRsr9MCRCOk);
251     }
252     else if(byRxRate==24){
253         pStatistic->CustomStat.ullRsr12M++;
254         if(byRSR & RSR_CRCOK) {
255             pStatistic->CustomStat.ullRsr12MCRCOk++;
256         }
257         DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"12M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr12M, (INT)pStatistic->CustomStat.ullRsr12MCRCOk);
258     }
259     else if(byRxRate==36){
260         pStatistic->CustomStat.ullRsr18M++;
261         if(byRSR & RSR_CRCOK) {
262             pStatistic->CustomStat.ullRsr18MCRCOk++;
263         }
264         DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"18M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr18M, (INT)pStatistic->CustomStat.ullRsr18MCRCOk);
265     }
266     else if(byRxRate==48){
267         pStatistic->CustomStat.ullRsr24M++;
268         if(byRSR & RSR_CRCOK) {
269             pStatistic->CustomStat.ullRsr24MCRCOk++;
270         }
271         DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"24M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr24M, (INT)pStatistic->CustomStat.ullRsr24MCRCOk);
272     }
273     else if(byRxRate==72){
274         pStatistic->CustomStat.ullRsr36M++;
275         if(byRSR & RSR_CRCOK) {
276             pStatistic->CustomStat.ullRsr36MCRCOk++;
277         }
278         DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"36M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr36M, (INT)pStatistic->CustomStat.ullRsr36MCRCOk);
279     }
280     else if(byRxRate==96){
281         pStatistic->CustomStat.ullRsr48M++;
282         if(byRSR & RSR_CRCOK) {
283             pStatistic->CustomStat.ullRsr48MCRCOk++;
284         }
285         DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"48M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr48M, (INT)pStatistic->CustomStat.ullRsr48MCRCOk);
286     }
287     else if(byRxRate==108){
288         pStatistic->CustomStat.ullRsr54M++;
289         if(byRSR & RSR_CRCOK) {
290             pStatistic->CustomStat.ullRsr54MCRCOk++;
291         }
292         DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"54M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr54M, (INT)pStatistic->CustomStat.ullRsr54MCRCOk);
293     }
294     else {
295         DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown: Total[%d], CRCOK[%d]\n", (INT)pStatistic->dwRsrRxPacket+1, (INT)pStatistic->dwRsrCRCOk);
296     }
297
298     if (byRSR & RSR_BSSIDOK)
299         pStatistic->dwRsrBSSIDOk++;
300
301     if (byRSR & RSR_BCNSSIDOK)
302         pStatistic->dwRsrBCNSSIDOk++;
303     if (byRSR & RSR_IVLDLEN)  //invalid len (> 2312 byte)
304         pStatistic->dwRsrLENErr++;
305     if (byRSR & RSR_IVLDTYP)  //invalid packet type
306         pStatistic->dwRsrTYPErr++;
307     if (byRSR & (RSR_IVLDTYP | RSR_IVLDLEN))
308         pStatistic->dwRsrErr++;
309
310     if (byNewRSR & NEWRSR_DECRYPTOK)
311         pStatistic->dwNewRsrDECRYPTOK++;
312     if (byNewRSR & NEWRSR_CFPIND)
313         pStatistic->dwNewRsrCFP++;
314     if (byNewRSR & NEWRSR_HWUTSF)
315         pStatistic->dwNewRsrUTSF++;
316     if (byNewRSR & NEWRSR_BCNHITAID)
317         pStatistic->dwNewRsrHITAID++;
318     if (byNewRSR & NEWRSR_BCNHITAID0)
319         pStatistic->dwNewRsrHITAID0++;
320
321     // increase rx packet count
322     pStatistic->dwRsrRxPacket++;
323     pStatistic->dwRsrRxOctet += cbFrameLength;
324
325
326     if (IS_TYPE_DATA(pbyBuffer)) {
327         pStatistic->dwRsrRxData++;
328     } else if (IS_TYPE_MGMT(pbyBuffer)){
329         pStatistic->dwRsrRxManage++;
330     } else if (IS_TYPE_CONTROL(pbyBuffer)){
331         pStatistic->dwRsrRxControl++;
332     }
333
334     if (byRSR & RSR_ADDRBROAD)
335         pStatistic->dwRsrBroadcast++;
336     else if (byRSR & RSR_ADDRMULTI)
337         pStatistic->dwRsrMulticast++;
338     else
339         pStatistic->dwRsrDirected++;
340
341     if (WLAN_GET_FC_MOREFRAG(pHeader->wFrameCtl))
342         pStatistic->dwRsrRxFragment++;
343
344     if (cbFrameLength < MIN_PACKET_LEN + 4) {
345         pStatistic->dwRsrRunt++;
346     }
347     else if (cbFrameLength == MIN_PACKET_LEN + 4) {
348         pStatistic->dwRsrRxFrmLen64++;
349     }
350     else if ((65 <= cbFrameLength) && (cbFrameLength <= 127)) {
351         pStatistic->dwRsrRxFrmLen65_127++;
352     }
353     else if ((128 <= cbFrameLength) && (cbFrameLength <= 255)) {
354         pStatistic->dwRsrRxFrmLen128_255++;
355     }
356     else if ((256 <= cbFrameLength) && (cbFrameLength <= 511)) {
357         pStatistic->dwRsrRxFrmLen256_511++;
358     }
359     else if ((512 <= cbFrameLength) && (cbFrameLength <= 1023)) {
360         pStatistic->dwRsrRxFrmLen512_1023++;
361     }
362     else if ((1024 <= cbFrameLength) && (cbFrameLength <= ETH_FRAME_LEN + 4)) {
363         pStatistic->dwRsrRxFrmLen1024_1518++;
364     } else if (cbFrameLength > ETH_FRAME_LEN + 4) {
365         pStatistic->dwRsrLong++;
366     }
367
368 }
369
370
371
372 /*
373  * Description: Update Rx Statistic Counter and copy Rx buffer
374  *
375  * Parameters:
376  *  In:
377  *      pStatistic      - Pointer to Statistic Counter Data Structure
378  *      byRSR           - Rx Status
379  *      byNewRSR        - Rx Status
380  *      pbyBuffer       - Rx Buffer
381  *      cbFrameLength   - Rx Length
382  *  Out:
383  *      none
384  *
385  * Return Value: none
386  *
387  */
388
389 void
390 STAvUpdateRDStatCounterEx (
391     PSStatCounter   pStatistic,
392     BYTE            byRSR,
393     BYTE            byNewRSR,
394     BYTE            byRxRate,
395     PBYTE           pbyBuffer,
396     UINT            cbFrameLength
397     )
398 {
399     STAvUpdateRDStatCounter(
400                     pStatistic,
401                     byRSR,
402                     byNewRSR,
403                     byRxRate,
404                     pbyBuffer,
405                     cbFrameLength
406                     );
407
408     // rx length
409     pStatistic->dwCntRxFrmLength = cbFrameLength;
410     // rx pattern, we just see 10 bytes for sample
411     memcpy(pStatistic->abyCntRxPattern, (PBYTE)pbyBuffer, 10);
412 }
413
414
415 /*
416  * Description: Update Tx Statistic Counter
417  *
418  * Parameters:
419  *  In:
420  *      pStatistic      - Pointer to Statistic Counter Data Structure
421  *      byTSR0          - Tx Status
422  *      byTSR1          - Tx Status
423  *      pbyBuffer       - Tx Buffer
424  *      cbFrameLength   - Tx Length
425  *      uIdx            - Index of Tx DMA
426  *  Out:
427  *      none
428  *
429  * Return Value: none
430  *
431  */
432 void
433 STAvUpdateTDStatCounter (
434     PSStatCounter   pStatistic,
435     BYTE            byTSR0,
436     BYTE            byTSR1,
437     PBYTE           pbyBuffer,
438     UINT            cbFrameLength,
439     UINT            uIdx
440     )
441 {
442     PWLAN_80211HDR_A4   pHeader;
443     PBYTE               pbyDestAddr;
444     BYTE                byTSR0_NCR = byTSR0 & TSR0_NCR;
445
446
447
448     pHeader = (PWLAN_80211HDR_A4) pbyBuffer;
449     if (WLAN_GET_FC_TODS(pHeader->wFrameCtl) == 0) {
450         pbyDestAddr = &(pHeader->abyAddr1[0]);
451     }
452     else {
453         pbyDestAddr = &(pHeader->abyAddr3[0]);
454     }
455     // increase tx packet count
456     pStatistic->dwTsrTxPacket[uIdx]++;
457     pStatistic->dwTsrTxOctet[uIdx] += cbFrameLength;
458
459     if (byTSR0_NCR != 0) {
460         pStatistic->dwTsrRetry[uIdx]++;
461         pStatistic->dwTsrTotalRetry[uIdx] += byTSR0_NCR;
462
463         if (byTSR0_NCR == 1)
464             pStatistic->dwTsrOnceRetry[uIdx]++;
465         else
466             pStatistic->dwTsrMoreThanOnceRetry[uIdx]++;
467     }
468
469     if ((byTSR1&(TSR1_TERR|TSR1_RETRYTMO|TSR1_TMO|ACK_DATA)) == 0) {
470         pStatistic->ullTsrOK[uIdx]++;
471         pStatistic->CustomStat.ullTsrAllOK =
472             (pStatistic->ullTsrOK[TYPE_AC0DMA] + pStatistic->ullTsrOK[TYPE_TXDMA0]);
473         // update counters in case that successful transmit
474         if (IS_BROADCAST_ADDRESS(pbyDestAddr)) {
475             pStatistic->ullTxBroadcastFrames[uIdx]++;
476             pStatistic->ullTxBroadcastBytes[uIdx] += (ULONGLONG)cbFrameLength;
477         }
478         else if (IS_MULTICAST_ADDRESS(pbyDestAddr)) {
479             pStatistic->ullTxMulticastFrames[uIdx]++;
480             pStatistic->ullTxMulticastBytes[uIdx] += (ULONGLONG)cbFrameLength;
481         }
482         else {
483             pStatistic->ullTxDirectedFrames[uIdx]++;
484             pStatistic->ullTxDirectedBytes[uIdx] += (ULONGLONG)cbFrameLength;
485         }
486     }
487     else {
488         if (byTSR1 & TSR1_TERR)
489             pStatistic->dwTsrErr[uIdx]++;
490         if (byTSR1 & TSR1_RETRYTMO)
491             pStatistic->dwTsrRetryTimeout[uIdx]++;
492         if (byTSR1 & TSR1_TMO)
493             pStatistic->dwTsrTransmitTimeout[uIdx]++;
494         if (byTSR1 & ACK_DATA)
495             pStatistic->dwTsrACKData[uIdx]++;
496     }
497
498     if (IS_BROADCAST_ADDRESS(pbyDestAddr))
499         pStatistic->dwTsrBroadcast[uIdx]++;
500     else if (IS_MULTICAST_ADDRESS(pbyDestAddr))
501         pStatistic->dwTsrMulticast[uIdx]++;
502     else
503         pStatistic->dwTsrDirected[uIdx]++;
504
505 }
506
507
508 /*
509  * Description: Update Tx Statistic Counter and copy Tx buffer
510  *
511  * Parameters:
512  *  In:
513  *      pStatistic      - Pointer to Statistic Counter Data Structure
514  *      pbyBuffer       - Tx Buffer
515  *      cbFrameLength   - Tx Length
516  *  Out:
517  *      none
518  *
519  * Return Value: none
520  *
521  */
522 void
523 STAvUpdateTDStatCounterEx (
524     PSStatCounter   pStatistic,
525     PBYTE           pbyBuffer,
526     DWORD           cbFrameLength
527     )
528 {
529     UINT    uPktLength;
530
531     uPktLength = (UINT)cbFrameLength;
532
533     // tx length
534     pStatistic->dwCntTxBufLength = uPktLength;
535     // tx pattern, we just see 16 bytes for sample
536     memcpy(pStatistic->abyCntTxPattern, pbyBuffer, 16);
537 }
538
539
540 /*
541  * Description: Update 802.11 mib counter
542  *
543  * Parameters:
544  *  In:
545  *      p802_11Counter  - Pointer to 802.11 mib counter
546  *      pStatistic      - Pointer to Statistic Counter Data Structure
547  *      dwCounter       - hardware counter for 802.11 mib
548  *  Out:
549  *      none
550  *
551  * Return Value: none
552  *
553  */
554 void
555 STAvUpdate802_11Counter(
556     PSDot11Counters         p802_11Counter,
557     PSStatCounter           pStatistic,
558     DWORD                   dwCounter
559     )
560 {
561     //p802_11Counter->TransmittedFragmentCount
562     p802_11Counter->MulticastTransmittedFrameCount = (ULONGLONG) (pStatistic->dwTsrBroadcast[TYPE_AC0DMA] +
563                                                                   pStatistic->dwTsrBroadcast[TYPE_TXDMA0] +
564                                                                   pStatistic->dwTsrMulticast[TYPE_AC0DMA] +
565                                                                   pStatistic->dwTsrMulticast[TYPE_TXDMA0]);
566     p802_11Counter->FailedCount = (ULONGLONG) (pStatistic->dwTsrErr[TYPE_AC0DMA] + pStatistic->dwTsrErr[TYPE_TXDMA0]);
567     p802_11Counter->RetryCount = (ULONGLONG) (pStatistic->dwTsrRetry[TYPE_AC0DMA] + pStatistic->dwTsrRetry[TYPE_TXDMA0]);
568     p802_11Counter->MultipleRetryCount = (ULONGLONG) (pStatistic->dwTsrMoreThanOnceRetry[TYPE_AC0DMA] +
569                                                           pStatistic->dwTsrMoreThanOnceRetry[TYPE_TXDMA0]);
570     //p802_11Counter->FrameDuplicateCount
571     p802_11Counter->RTSSuccessCount += (ULONGLONG)  (dwCounter & 0x000000ff);
572     p802_11Counter->RTSFailureCount += (ULONGLONG) ((dwCounter & 0x0000ff00) >> 8);
573     p802_11Counter->ACKFailureCount += (ULONGLONG) ((dwCounter & 0x00ff0000) >> 16);
574     p802_11Counter->FCSErrorCount +=   (ULONGLONG) ((dwCounter & 0xff000000) >> 24);
575     //p802_11Counter->ReceivedFragmentCount
576     p802_11Counter->MulticastReceivedFrameCount = (ULONGLONG) (pStatistic->dwRsrBroadcast +
577                                                                pStatistic->dwRsrMulticast);
578 }
579
580 /*
581  * Description: Clear 802.11 mib counter
582  *
583  * Parameters:
584  *  In:
585  *      p802_11Counter  - Pointer to 802.11 mib counter
586  *  Out:
587  *      none
588  *
589  * Return Value: none
590  *
591  */
592 void
593 STAvClear802_11Counter(PSDot11Counters p802_11Counter)
594 {
595     // set memory to zero
596         memset(p802_11Counter, 0, sizeof(SDot11Counters));
597 }