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