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