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