Merge branch 'x86-trampoline-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[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 -------------------------*/
48static 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 */
73void STAvClearAllCounter (PSStatCounter pStatistic)
74{
75 // set memory to zero
51b6d9c2 76 memset(pStatistic, 0, sizeof(SStatCounter));
5449c685
FB
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 */
0f4c60d6 93void STAvUpdateIsrStatCounter (PSStatCounter pStatistic, unsigned long dwIsr)
5449c685
FB
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
256a816b 106 if (dwIsr & ISR_TXDMA0) // ISR, bit0
5449c685
FB
107 pStatistic->ISRStat.dwIsrTx0OK++; // TXDMA0 successful
108
256a816b 109 if (dwIsr & ISR_AC0DMA) // ISR, bit1
5449c685
FB
110 pStatistic->ISRStat.dwIsrAC0TxOK++; // AC0DMA successful
111
256a816b 112 if (dwIsr & ISR_BNTX) // ISR, bit2
5449c685
FB
113 pStatistic->ISRStat.dwIsrBeaconTxOK++; // BeaconTx successful
114
256a816b 115 if (dwIsr & ISR_RXDMA0) // ISR, bit3
5449c685
FB
116 pStatistic->ISRStat.dwIsrRx0OK++; // Rx0 successful
117
256a816b 118 if (dwIsr & ISR_TBTT) // ISR, bit4
5449c685
FB
119 pStatistic->ISRStat.dwIsrTBTTInt++; // TBTT successful
120
256a816b 121 if (dwIsr & ISR_SOFTTIMER) // ISR, bit6
5449c685
FB
122 pStatistic->ISRStat.dwIsrSTIMERInt++;
123
256a816b 124 if (dwIsr & ISR_WATCHDOG) // ISR, bit7
5449c685
FB
125 pStatistic->ISRStat.dwIsrWatchDog++;
126
256a816b 127 if (dwIsr & ISR_FETALERR) // ISR, bit8
5449c685
FB
128 pStatistic->ISRStat.dwIsrUnrecoverableError++;
129
256a816b 130 if (dwIsr & ISR_SOFTINT) // ISR, bit9
5449c685
FB
131 pStatistic->ISRStat.dwIsrSoftInterrupt++; // software interrupt
132
256a816b 133 if (dwIsr & ISR_MIBNEARFULL) // ISR, bit10
5449c685
FB
134 pStatistic->ISRStat.dwIsrMIBNearfull++;
135
256a816b 136 if (dwIsr & ISR_RXNOBUF) // ISR, bit11
5449c685
FB
137 pStatistic->ISRStat.dwIsrRxNoBuf++; // Rx No Buff
138
256a816b 139 if (dwIsr & ISR_RXDMA1) // ISR, bit12
5449c685
FB
140 pStatistic->ISRStat.dwIsrRx1OK++; // Rx1 successful
141
256a816b 142// if (dwIsr & ISR_ATIMTX) // ISR, bit13
5449c685
FB
143// pStatistic->ISRStat.dwIsrATIMTxOK++; // ATIMTX successful
144
256a816b 145// if (dwIsr & ISR_SYNCTX) // ISR, bit14
5449c685
FB
146// pStatistic->ISRStat.dwIsrSYNCTxOK++; // SYNCTX successful
147
256a816b 148// if (dwIsr & ISR_CFPEND) // ISR, bit18
5449c685
FB
149// pStatistic->ISRStat.dwIsrCFPEnd++;
150
256a816b 151// if (dwIsr & ISR_ATIMEND) // ISR, bit19
5449c685
FB
152// pStatistic->ISRStat.dwIsrATIMEnd++;
153
256a816b 154// if (dwIsr & ISR_SYNCFLUSHOK) // ISR, bit20
5449c685
FB
155// pStatistic->ISRStat.dwIsrSYNCFlushOK++;
156
256a816b 157 if (dwIsr & ISR_SOFTTIMER1) // ISR, bit21
5449c685
FB
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 */
179void STAvUpdateRDStatCounter (PSStatCounter pStatistic,
3fc9b584 180 unsigned char byRSR, unsigned char byNewRSR, unsigned char byRxRate,
2989e96f 181 unsigned char *pbyBuffer, unsigned int cbFrameLength)
5449c685
FB
182{
183 //need change
184 PS802_11Header pHeader = (PS802_11Header)pbyBuffer;
185
256a816b 186 if (byRSR & RSR_ADDROK)
5449c685 187 pStatistic->dwRsrADDROk++;
256a816b 188 if (byRSR & RSR_CRCOK) {
5449c685
FB
189 pStatistic->dwRsrCRCOk++;
190
191 pStatistic->ullRsrOK++;
192
078b078f 193 if (cbFrameLength >= ETH_ALEN) {
5449c685 194 // update counters in case that successful transmit
256a816b 195 if (byRSR & RSR_ADDRBROAD) {
5449c685 196 pStatistic->ullRxBroadcastFrames++;
b2e876b6 197 pStatistic->ullRxBroadcastBytes += (unsigned long long) cbFrameLength;
5449c685 198 }
256a816b 199 else if (byRSR & RSR_ADDRMULTI) {
5449c685 200 pStatistic->ullRxMulticastFrames++;
b2e876b6 201 pStatistic->ullRxMulticastBytes += (unsigned long long) cbFrameLength;
5449c685
FB
202 }
203 else {
204 pStatistic->ullRxDirectedFrames++;
b2e876b6 205 pStatistic->ullRxDirectedBytes += (unsigned long long) cbFrameLength;
5449c685
FB
206 }
207 }
208 }
209
210 if(byRxRate==22) {
211 pStatistic->CustomStat.ullRsr11M++;
256a816b 212 if(byRSR & RSR_CRCOK) {
5449c685
FB
213 pStatistic->CustomStat.ullRsr11MCRCOk++;
214 }
7ca30195 215 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"11M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr11M, (int)pStatistic->CustomStat.ullRsr11MCRCOk, byRSR);
5449c685
FB
216 }
217 else if(byRxRate==11) {
218 pStatistic->CustomStat.ullRsr5M++;
256a816b 219 if(byRSR & RSR_CRCOK) {
5449c685
FB
220 pStatistic->CustomStat.ullRsr5MCRCOk++;
221 }
7ca30195 222 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 5M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr5M, (int)pStatistic->CustomStat.ullRsr5MCRCOk, byRSR);
5449c685
FB
223 }
224 else if(byRxRate==4) {
225 pStatistic->CustomStat.ullRsr2M++;
256a816b 226 if(byRSR & RSR_CRCOK) {
5449c685
FB
227 pStatistic->CustomStat.ullRsr2MCRCOk++;
228 }
7ca30195 229 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 2M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr2M, (int)pStatistic->CustomStat.ullRsr2MCRCOk, byRSR);
5449c685
FB
230 }
231 else if(byRxRate==2){
232 pStatistic->CustomStat.ullRsr1M++;
256a816b 233 if(byRSR & RSR_CRCOK) {
5449c685
FB
234 pStatistic->CustomStat.ullRsr1MCRCOk++;
235 }
7ca30195 236 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 1M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr1M, (int)pStatistic->CustomStat.ullRsr1MCRCOk, byRSR);
5449c685
FB
237 }
238 else if(byRxRate==12){
239 pStatistic->CustomStat.ullRsr6M++;
256a816b 240 if(byRSR & RSR_CRCOK) {
5449c685
FB
241 pStatistic->CustomStat.ullRsr6MCRCOk++;
242 }
7ca30195 243 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 6M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr6M, (int)pStatistic->CustomStat.ullRsr6MCRCOk);
5449c685
FB
244 }
245 else if(byRxRate==18){
246 pStatistic->CustomStat.ullRsr9M++;
256a816b 247 if(byRSR & RSR_CRCOK) {
5449c685
FB
248 pStatistic->CustomStat.ullRsr9MCRCOk++;
249 }
7ca30195 250 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 9M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr9M, (int)pStatistic->CustomStat.ullRsr9MCRCOk);
5449c685
FB
251 }
252 else if(byRxRate==24){
253 pStatistic->CustomStat.ullRsr12M++;
256a816b 254 if(byRSR & RSR_CRCOK) {
5449c685
FB
255 pStatistic->CustomStat.ullRsr12MCRCOk++;
256 }
7ca30195 257 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"12M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr12M, (int)pStatistic->CustomStat.ullRsr12MCRCOk);
5449c685
FB
258 }
259 else if(byRxRate==36){
260 pStatistic->CustomStat.ullRsr18M++;
256a816b 261 if(byRSR & RSR_CRCOK) {
5449c685
FB
262 pStatistic->CustomStat.ullRsr18MCRCOk++;
263 }
7ca30195 264 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"18M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr18M, (int)pStatistic->CustomStat.ullRsr18MCRCOk);
5449c685
FB
265 }
266 else if(byRxRate==48){
267 pStatistic->CustomStat.ullRsr24M++;
256a816b 268 if(byRSR & RSR_CRCOK) {
5449c685
FB
269 pStatistic->CustomStat.ullRsr24MCRCOk++;
270 }
7ca30195 271 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"24M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr24M, (int)pStatistic->CustomStat.ullRsr24MCRCOk);
5449c685
FB
272 }
273 else if(byRxRate==72){
274 pStatistic->CustomStat.ullRsr36M++;
256a816b 275 if(byRSR & RSR_CRCOK) {
5449c685
FB
276 pStatistic->CustomStat.ullRsr36MCRCOk++;
277 }
7ca30195 278 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"36M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr36M, (int)pStatistic->CustomStat.ullRsr36MCRCOk);
5449c685
FB
279 }
280 else if(byRxRate==96){
281 pStatistic->CustomStat.ullRsr48M++;
256a816b 282 if(byRSR & RSR_CRCOK) {
5449c685
FB
283 pStatistic->CustomStat.ullRsr48MCRCOk++;
284 }
7ca30195 285 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"48M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr48M, (int)pStatistic->CustomStat.ullRsr48MCRCOk);
5449c685
FB
286 }
287 else if(byRxRate==108){
288 pStatistic->CustomStat.ullRsr54M++;
256a816b 289 if(byRSR & RSR_CRCOK) {
5449c685
FB
290 pStatistic->CustomStat.ullRsr54MCRCOk++;
291 }
7ca30195 292 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"54M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr54M, (int)pStatistic->CustomStat.ullRsr54MCRCOk);
5449c685
FB
293 }
294 else {
7ca30195 295 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown: Total[%d], CRCOK[%d]\n", (int)pStatistic->dwRsrRxPacket+1, (int)pStatistic->dwRsrCRCOk);
5449c685
FB
296 }
297
256a816b 298 if (byRSR & RSR_BSSIDOK)
5449c685
FB
299 pStatistic->dwRsrBSSIDOk++;
300
256a816b 301 if (byRSR & RSR_BCNSSIDOK)
5449c685 302 pStatistic->dwRsrBCNSSIDOk++;
256a816b 303 if (byRSR & RSR_IVLDLEN) //invalid len (> 2312 byte)
5449c685 304 pStatistic->dwRsrLENErr++;
256a816b 305 if (byRSR & RSR_IVLDTYP) //invalid packet type
5449c685 306 pStatistic->dwRsrTYPErr++;
256a816b 307 if (byRSR & (RSR_IVLDTYP | RSR_IVLDLEN))
5449c685
FB
308 pStatistic->dwRsrErr++;
309
256a816b 310 if (byNewRSR & NEWRSR_DECRYPTOK)
5449c685 311 pStatistic->dwNewRsrDECRYPTOK++;
256a816b 312 if (byNewRSR & NEWRSR_CFPIND)
5449c685 313 pStatistic->dwNewRsrCFP++;
256a816b 314 if (byNewRSR & NEWRSR_HWUTSF)
5449c685 315 pStatistic->dwNewRsrUTSF++;
256a816b 316 if (byNewRSR & NEWRSR_BCNHITAID)
5449c685 317 pStatistic->dwNewRsrHITAID++;
256a816b 318 if (byNewRSR & NEWRSR_BCNHITAID0)
5449c685
FB
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
256a816b 334 if (byRSR & RSR_ADDRBROAD)
5449c685 335 pStatistic->dwRsrBroadcast++;
256a816b 336 else if (byRSR & RSR_ADDRMULTI)
5449c685
FB
337 pStatistic->dwRsrMulticast++;
338 else
339 pStatistic->dwRsrDirected++;
340
341 if (WLAN_GET_FC_MOREFRAG(pHeader->wFrameCtl))
342 pStatistic->dwRsrRxFragment++;
343
c92069f3 344 if (cbFrameLength < ETH_ZLEN + 4) {
5449c685
FB
345 pStatistic->dwRsrRunt++;
346 }
c92069f3 347 else if (cbFrameLength == ETH_ZLEN + 4) {
5449c685
FB
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 }
f4a68b93 362 else if ((1024 <= cbFrameLength) && (cbFrameLength <= ETH_FRAME_LEN + 4)) {
5449c685 363 pStatistic->dwRsrRxFrmLen1024_1518++;
f4a68b93 364 } else if (cbFrameLength > ETH_FRAME_LEN + 4) {
5449c685
FB
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
389void
390STAvUpdateRDStatCounterEx (
391 PSStatCounter pStatistic,
3fc9b584
CC
392 unsigned char byRSR,
393 unsigned char byNewRSR,
394 unsigned char byRxRate,
2989e96f 395 unsigned char *pbyBuffer,
b6e95cd5 396 unsigned int cbFrameLength
5449c685
FB
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
2989e96f 411 memcpy(pStatistic->abyCntRxPattern, (unsigned char *)pbyBuffer, 10);
5449c685
FB
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 */
432void
433STAvUpdateTDStatCounter (
434 PSStatCounter pStatistic,
3fc9b584
CC
435 unsigned char byTSR0,
436 unsigned char byTSR1,
2989e96f 437 unsigned char *pbyBuffer,
b6e95cd5
CC
438 unsigned int cbFrameLength,
439 unsigned int uIdx
5449c685
FB
440 )
441{
442 PWLAN_80211HDR_A4 pHeader;
2989e96f 443 unsigned char *pbyDestAddr;
3fc9b584 444 unsigned char byTSR0_NCR = byTSR0 & TSR0_NCR;
5449c685
FB
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
ca9e12ac 474 if (is_broadcast_ether_addr(pbyDestAddr)) {
5449c685 475 pStatistic->ullTxBroadcastFrames[uIdx]++;
b2e876b6 476 pStatistic->ullTxBroadcastBytes[uIdx] += (unsigned long long) cbFrameLength;
5449c685 477 }
670ea81e 478 else if (is_multicast_ether_addr(pbyDestAddr)) {
5449c685 479 pStatistic->ullTxMulticastFrames[uIdx]++;
b2e876b6 480 pStatistic->ullTxMulticastBytes[uIdx] += (unsigned long long) cbFrameLength;
5449c685
FB
481 }
482 else {
483 pStatistic->ullTxDirectedFrames[uIdx]++;
b2e876b6 484 pStatistic->ullTxDirectedBytes[uIdx] += (unsigned long long) cbFrameLength;
5449c685
FB
485 }
486 }
487 else {
256a816b 488 if (byTSR1 & TSR1_TERR)
5449c685 489 pStatistic->dwTsrErr[uIdx]++;
256a816b 490 if (byTSR1 & TSR1_RETRYTMO)
5449c685 491 pStatistic->dwTsrRetryTimeout[uIdx]++;
256a816b 492 if (byTSR1 & TSR1_TMO)
5449c685 493 pStatistic->dwTsrTransmitTimeout[uIdx]++;
256a816b 494 if (byTSR1 & ACK_DATA)
5449c685
FB
495 pStatistic->dwTsrACKData[uIdx]++;
496 }
497
ca9e12ac 498 if (is_broadcast_ether_addr(pbyDestAddr))
5449c685 499 pStatistic->dwTsrBroadcast[uIdx]++;
670ea81e 500 else if (is_multicast_ether_addr(pbyDestAddr))
5449c685
FB
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 */
522void
523STAvUpdateTDStatCounterEx (
524 PSStatCounter pStatistic,
2989e96f 525 unsigned char *pbyBuffer,
0f4c60d6 526 unsigned long cbFrameLength
5449c685
FB
527 )
528{
b6e95cd5 529 unsigned int uPktLength;
5449c685 530
b6e95cd5 531 uPktLength = (unsigned int)cbFrameLength;
5449c685
FB
532
533 // tx length
534 pStatistic->dwCntTxBufLength = uPktLength;
535 // tx pattern, we just see 16 bytes for sample
51b6d9c2 536 memcpy(pStatistic->abyCntTxPattern, pbyBuffer, 16);
5449c685
FB
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 */
554void
555STAvUpdate802_11Counter(
556 PSDot11Counters p802_11Counter,
557 PSStatCounter pStatistic,
0f4c60d6 558 unsigned long dwCounter
5449c685
FB
559 )
560{
561 //p802_11Counter->TransmittedFragmentCount
b2e876b6 562 p802_11Counter->MulticastTransmittedFrameCount = (unsigned long long) (pStatistic->dwTsrBroadcast[TYPE_AC0DMA] +
5449c685
FB
563 pStatistic->dwTsrBroadcast[TYPE_TXDMA0] +
564 pStatistic->dwTsrMulticast[TYPE_AC0DMA] +
565 pStatistic->dwTsrMulticast[TYPE_TXDMA0]);
b2e876b6
CC
566 p802_11Counter->FailedCount = (unsigned long long) (pStatistic->dwTsrErr[TYPE_AC0DMA] + pStatistic->dwTsrErr[TYPE_TXDMA0]);
567 p802_11Counter->RetryCount = (unsigned long long) (pStatistic->dwTsrRetry[TYPE_AC0DMA] + pStatistic->dwTsrRetry[TYPE_TXDMA0]);
568 p802_11Counter->MultipleRetryCount = (unsigned long long) (pStatistic->dwTsrMoreThanOnceRetry[TYPE_AC0DMA] +
5449c685
FB
569 pStatistic->dwTsrMoreThanOnceRetry[TYPE_TXDMA0]);
570 //p802_11Counter->FrameDuplicateCount
b2e876b6
CC
571 p802_11Counter->RTSSuccessCount += (unsigned long long) (dwCounter & 0x000000ff);
572 p802_11Counter->RTSFailureCount += (unsigned long long) ((dwCounter & 0x0000ff00) >> 8);
573 p802_11Counter->ACKFailureCount += (unsigned long long) ((dwCounter & 0x00ff0000) >> 16);
574 p802_11Counter->FCSErrorCount += (unsigned long long) ((dwCounter & 0xff000000) >> 24);
5449c685 575 //p802_11Counter->ReceivedFragmentCount
b2e876b6 576 p802_11Counter->MulticastReceivedFrameCount = (unsigned long long) (pStatistic->dwRsrBroadcast +
5449c685
FB
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 */
592void
593STAvClear802_11Counter(PSDot11Counters p802_11Counter)
594{
595 // set memory to zero
51b6d9c2 596 memset(p802_11Counter, 0, sizeof(SDot11Counters));
5449c685 597}
This page took 0.341657 seconds and 5 git commands to generate.