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