Forest Bond | 5449c68 | 2009-04-25 10:30:44 -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 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 40 | #include "upc.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 41 | #include "mac.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 42 | #include "tether.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 43 | #include "mib.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 44 | #include "wctl.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 45 | #include "baseband.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 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 |
Jim Lieb | 51b6d9c | 2009-08-12 14:54:10 -0700 | [diff] [blame] | 76 | memset(pStatistic, 0, sizeof(SStatCounter)); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 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 |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 106 | if (dwIsr & ISR_TXDMA0) // ISR, bit0 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 107 | pStatistic->ISRStat.dwIsrTx0OK++; // TXDMA0 successful |
| 108 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 109 | if (dwIsr & ISR_AC0DMA) // ISR, bit1 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 110 | pStatistic->ISRStat.dwIsrAC0TxOK++; // AC0DMA successful |
| 111 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 112 | if (dwIsr & ISR_BNTX) // ISR, bit2 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 113 | pStatistic->ISRStat.dwIsrBeaconTxOK++; // BeaconTx successful |
| 114 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 115 | if (dwIsr & ISR_RXDMA0) // ISR, bit3 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 116 | pStatistic->ISRStat.dwIsrRx0OK++; // Rx0 successful |
| 117 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 118 | if (dwIsr & ISR_TBTT) // ISR, bit4 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 119 | pStatistic->ISRStat.dwIsrTBTTInt++; // TBTT successful |
| 120 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 121 | if (dwIsr & ISR_SOFTTIMER) // ISR, bit6 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 122 | pStatistic->ISRStat.dwIsrSTIMERInt++; |
| 123 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 124 | if (dwIsr & ISR_WATCHDOG) // ISR, bit7 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 125 | pStatistic->ISRStat.dwIsrWatchDog++; |
| 126 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 127 | if (dwIsr & ISR_FETALERR) // ISR, bit8 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 128 | pStatistic->ISRStat.dwIsrUnrecoverableError++; |
| 129 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 130 | if (dwIsr & ISR_SOFTINT) // ISR, bit9 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 131 | pStatistic->ISRStat.dwIsrSoftInterrupt++; // software interrupt |
| 132 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 133 | if (dwIsr & ISR_MIBNEARFULL) // ISR, bit10 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 134 | pStatistic->ISRStat.dwIsrMIBNearfull++; |
| 135 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 136 | if (dwIsr & ISR_RXNOBUF) // ISR, bit11 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 137 | pStatistic->ISRStat.dwIsrRxNoBuf++; // Rx No Buff |
| 138 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 139 | if (dwIsr & ISR_RXDMA1) // ISR, bit12 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 140 | pStatistic->ISRStat.dwIsrRx1OK++; // Rx1 successful |
| 141 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 142 | // if (dwIsr & ISR_ATIMTX) // ISR, bit13 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 143 | // pStatistic->ISRStat.dwIsrATIMTxOK++; // ATIMTX successful |
| 144 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 145 | // if (dwIsr & ISR_SYNCTX) // ISR, bit14 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 146 | // pStatistic->ISRStat.dwIsrSYNCTxOK++; // SYNCTX successful |
| 147 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 148 | // if (dwIsr & ISR_CFPEND) // ISR, bit18 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 149 | // pStatistic->ISRStat.dwIsrCFPEnd++; |
| 150 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 151 | // if (dwIsr & ISR_ATIMEND) // ISR, bit19 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 152 | // pStatistic->ISRStat.dwIsrATIMEnd++; |
| 153 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 154 | // if (dwIsr & ISR_SYNCFLUSHOK) // ISR, bit20 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 155 | // pStatistic->ISRStat.dwIsrSYNCFlushOK++; |
| 156 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 157 | if (dwIsr & ISR_SOFTTIMER1) // ISR, bit21 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 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 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 186 | if (byRSR & RSR_ADDROK) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 187 | pStatistic->dwRsrADDROk++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 188 | if (byRSR & RSR_CRCOK) { |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 189 | pStatistic->dwRsrCRCOk++; |
| 190 | |
| 191 | pStatistic->ullRsrOK++; |
| 192 | |
Charles Clément | 078b078 | 2010-05-14 19:37:32 -0700 | [diff] [blame] | 193 | if (cbFrameLength >= ETH_ALEN) { |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 194 | // update counters in case that successful transmit |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 195 | if (byRSR & RSR_ADDRBROAD) { |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 196 | pStatistic->ullRxBroadcastFrames++; |
| 197 | pStatistic->ullRxBroadcastBytes += (ULONGLONG)cbFrameLength; |
| 198 | } |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 199 | else if (byRSR & RSR_ADDRMULTI) { |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 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++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 212 | if(byRSR & RSR_CRCOK) { |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 213 | pStatistic->CustomStat.ullRsr11MCRCOk++; |
| 214 | } |
Jim Lieb | 7e809a9 | 2009-07-30 10:27:21 -0700 | [diff] [blame] | 215 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"11M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr11M, (INT)pStatistic->CustomStat.ullRsr11MCRCOk, byRSR); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 216 | } |
| 217 | else if(byRxRate==11) { |
| 218 | pStatistic->CustomStat.ullRsr5M++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 219 | if(byRSR & RSR_CRCOK) { |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 220 | pStatistic->CustomStat.ullRsr5MCRCOk++; |
| 221 | } |
Jim Lieb | 7e809a9 | 2009-07-30 10:27:21 -0700 | [diff] [blame] | 222 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 5M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr5M, (INT)pStatistic->CustomStat.ullRsr5MCRCOk, byRSR); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 223 | } |
| 224 | else if(byRxRate==4) { |
| 225 | pStatistic->CustomStat.ullRsr2M++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 226 | if(byRSR & RSR_CRCOK) { |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 227 | pStatistic->CustomStat.ullRsr2MCRCOk++; |
| 228 | } |
Jim Lieb | 7e809a9 | 2009-07-30 10:27:21 -0700 | [diff] [blame] | 229 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 2M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr2M, (INT)pStatistic->CustomStat.ullRsr2MCRCOk, byRSR); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 230 | } |
| 231 | else if(byRxRate==2){ |
| 232 | pStatistic->CustomStat.ullRsr1M++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 233 | if(byRSR & RSR_CRCOK) { |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 234 | pStatistic->CustomStat.ullRsr1MCRCOk++; |
| 235 | } |
Jim Lieb | 7e809a9 | 2009-07-30 10:27:21 -0700 | [diff] [blame] | 236 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 1M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr1M, (INT)pStatistic->CustomStat.ullRsr1MCRCOk, byRSR); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 237 | } |
| 238 | else if(byRxRate==12){ |
| 239 | pStatistic->CustomStat.ullRsr6M++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 240 | if(byRSR & RSR_CRCOK) { |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 241 | pStatistic->CustomStat.ullRsr6MCRCOk++; |
| 242 | } |
Jim Lieb | 7e809a9 | 2009-07-30 10:27:21 -0700 | [diff] [blame] | 243 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 6M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr6M, (INT)pStatistic->CustomStat.ullRsr6MCRCOk); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 244 | } |
| 245 | else if(byRxRate==18){ |
| 246 | pStatistic->CustomStat.ullRsr9M++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 247 | if(byRSR & RSR_CRCOK) { |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 248 | pStatistic->CustomStat.ullRsr9MCRCOk++; |
| 249 | } |
Jim Lieb | 7e809a9 | 2009-07-30 10:27:21 -0700 | [diff] [blame] | 250 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 9M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr9M, (INT)pStatistic->CustomStat.ullRsr9MCRCOk); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 251 | } |
| 252 | else if(byRxRate==24){ |
| 253 | pStatistic->CustomStat.ullRsr12M++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 254 | if(byRSR & RSR_CRCOK) { |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 255 | pStatistic->CustomStat.ullRsr12MCRCOk++; |
| 256 | } |
Jim Lieb | 7e809a9 | 2009-07-30 10:27:21 -0700 | [diff] [blame] | 257 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"12M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr12M, (INT)pStatistic->CustomStat.ullRsr12MCRCOk); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 258 | } |
| 259 | else if(byRxRate==36){ |
| 260 | pStatistic->CustomStat.ullRsr18M++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 261 | if(byRSR & RSR_CRCOK) { |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 262 | pStatistic->CustomStat.ullRsr18MCRCOk++; |
| 263 | } |
Jim Lieb | 7e809a9 | 2009-07-30 10:27:21 -0700 | [diff] [blame] | 264 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"18M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr18M, (INT)pStatistic->CustomStat.ullRsr18MCRCOk); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 265 | } |
| 266 | else if(byRxRate==48){ |
| 267 | pStatistic->CustomStat.ullRsr24M++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 268 | if(byRSR & RSR_CRCOK) { |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 269 | pStatistic->CustomStat.ullRsr24MCRCOk++; |
| 270 | } |
Jim Lieb | 7e809a9 | 2009-07-30 10:27:21 -0700 | [diff] [blame] | 271 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"24M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr24M, (INT)pStatistic->CustomStat.ullRsr24MCRCOk); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 272 | } |
| 273 | else if(byRxRate==72){ |
| 274 | pStatistic->CustomStat.ullRsr36M++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 275 | if(byRSR & RSR_CRCOK) { |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 276 | pStatistic->CustomStat.ullRsr36MCRCOk++; |
| 277 | } |
Jim Lieb | 7e809a9 | 2009-07-30 10:27:21 -0700 | [diff] [blame] | 278 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"36M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr36M, (INT)pStatistic->CustomStat.ullRsr36MCRCOk); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 279 | } |
| 280 | else if(byRxRate==96){ |
| 281 | pStatistic->CustomStat.ullRsr48M++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 282 | if(byRSR & RSR_CRCOK) { |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 283 | pStatistic->CustomStat.ullRsr48MCRCOk++; |
| 284 | } |
Jim Lieb | 7e809a9 | 2009-07-30 10:27:21 -0700 | [diff] [blame] | 285 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"48M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr48M, (INT)pStatistic->CustomStat.ullRsr48MCRCOk); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 286 | } |
| 287 | else if(byRxRate==108){ |
| 288 | pStatistic->CustomStat.ullRsr54M++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 289 | if(byRSR & RSR_CRCOK) { |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 290 | pStatistic->CustomStat.ullRsr54MCRCOk++; |
| 291 | } |
Jim Lieb | 7e809a9 | 2009-07-30 10:27:21 -0700 | [diff] [blame] | 292 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"54M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr54M, (INT)pStatistic->CustomStat.ullRsr54MCRCOk); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 293 | } |
| 294 | else { |
Jim Lieb | 7e809a9 | 2009-07-30 10:27:21 -0700 | [diff] [blame] | 295 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown: Total[%d], CRCOK[%d]\n", (INT)pStatistic->dwRsrRxPacket+1, (INT)pStatistic->dwRsrCRCOk); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 296 | } |
| 297 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 298 | if (byRSR & RSR_BSSIDOK) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 299 | pStatistic->dwRsrBSSIDOk++; |
| 300 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 301 | if (byRSR & RSR_BCNSSIDOK) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 302 | pStatistic->dwRsrBCNSSIDOk++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 303 | if (byRSR & RSR_IVLDLEN) //invalid len (> 2312 byte) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 304 | pStatistic->dwRsrLENErr++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 305 | if (byRSR & RSR_IVLDTYP) //invalid packet type |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 306 | pStatistic->dwRsrTYPErr++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 307 | if (byRSR & (RSR_IVLDTYP | RSR_IVLDLEN)) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 308 | pStatistic->dwRsrErr++; |
| 309 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 310 | if (byNewRSR & NEWRSR_DECRYPTOK) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 311 | pStatistic->dwNewRsrDECRYPTOK++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 312 | if (byNewRSR & NEWRSR_CFPIND) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 313 | pStatistic->dwNewRsrCFP++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 314 | if (byNewRSR & NEWRSR_HWUTSF) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 315 | pStatistic->dwNewRsrUTSF++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 316 | if (byNewRSR & NEWRSR_BCNHITAID) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 317 | pStatistic->dwNewRsrHITAID++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 318 | if (byNewRSR & NEWRSR_BCNHITAID0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 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 | |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 334 | if (byRSR & RSR_ADDRBROAD) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 335 | pStatistic->dwRsrBroadcast++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 336 | else if (byRSR & RSR_ADDRMULTI) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 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 | } |
Charles Clément | f4a68b9 | 2010-05-18 11:30:20 -0700 | [diff] [blame] | 362 | else if ((1024 <= cbFrameLength) && (cbFrameLength <= ETH_FRAME_LEN + 4)) { |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 363 | pStatistic->dwRsrRxFrmLen1024_1518++; |
Charles Clément | f4a68b9 | 2010-05-18 11:30:20 -0700 | [diff] [blame] | 364 | } else if (cbFrameLength > ETH_FRAME_LEN + 4) { |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 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 |
Jim Lieb | 51b6d9c | 2009-08-12 14:54:10 -0700 | [diff] [blame] | 411 | memcpy(pStatistic->abyCntRxPattern, (PBYTE)pbyBuffer, 10); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 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 { |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 488 | if (byTSR1 & TSR1_TERR) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 489 | pStatistic->dwTsrErr[uIdx]++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 490 | if (byTSR1 & TSR1_RETRYTMO) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 491 | pStatistic->dwTsrRetryTimeout[uIdx]++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 492 | if (byTSR1 & TSR1_TMO) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 493 | pStatistic->dwTsrTransmitTimeout[uIdx]++; |
Jim Lieb | 256a816 | 2009-08-12 14:54:16 -0700 | [diff] [blame] | 494 | if (byTSR1 & ACK_DATA) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 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 |
Jim Lieb | 51b6d9c | 2009-08-12 14:54:10 -0700 | [diff] [blame] | 536 | memcpy(pStatistic->abyCntTxPattern, pbyBuffer, 16); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 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 |
Jim Lieb | 51b6d9c | 2009-08-12 14:54:10 -0700 | [diff] [blame] | 596 | memset(p802_11Counter, 0, sizeof(SDot11Counters)); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 597 | } |