Merge 3.9-rc3 into staging-next
[firefly-linux-kernel-4.4.55.git] / drivers / staging / vt6656 / mib.h
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.h
20  *
21  * Purpose: Implement MIB Data Structure
22  *
23  * Author: Tevin Chen
24  *
25  * Date: May 21, 1996
26  *
27  */
28
29 #ifndef __MIB_H__
30 #define __MIB_H__
31
32 #include "tether.h"
33 #include "desc.h"
34
35 /*---------------------  Export Definitions -------------------------*/
36
37
38 //
39 // USB counter
40 //
41 typedef struct tagSUSBCounter {
42     u32 dwCrc;
43
44 } SUSBCounter, *PSUSBCounter;
45
46
47
48 //
49 // 802.11 counter
50 //
51
52
53 typedef struct tagSDot11Counters {
54   /* unsigned long Length; // Length of structure */
55     unsigned long long   TransmittedFragmentCount;
56     unsigned long long   MulticastTransmittedFrameCount;
57     unsigned long long   FailedCount;
58     unsigned long long   RetryCount;
59     unsigned long long   MultipleRetryCount;
60     unsigned long long   RTSSuccessCount;
61     unsigned long long   RTSFailureCount;
62     unsigned long long   ACKFailureCount;
63     unsigned long long   FrameDuplicateCount;
64     unsigned long long   ReceivedFragmentCount;
65     unsigned long long   MulticastReceivedFrameCount;
66     unsigned long long   FCSErrorCount;
67     unsigned long long   TKIPLocalMICFailures;
68     unsigned long long   TKIPRemoteMICFailures;
69     unsigned long long   TKIPICVErrors;
70     unsigned long long   TKIPReplays;
71     unsigned long long   CCMPFormatErrors;
72     unsigned long long   CCMPReplays;
73     unsigned long long   CCMPDecryptErrors;
74     unsigned long long   FourWayHandshakeFailures;
75   /*
76    * unsigned long long   WEPUndecryptableCount;
77    * unsigned long long   WEPICVErrorCount;
78    * unsigned long long   DecryptSuccessCount;
79    * unsigned long long   DecryptFailureCount;
80    */
81 } SDot11Counters, *PSDot11Counters;
82
83
84 //
85 // MIB2 counter
86 //
87 typedef struct tagSMib2Counter {
88     signed long    ifIndex;
89     char    ifDescr[256];               // max size 255 plus zero ending
90                                         // e.g. "interface 1"
91     signed long    ifType;
92     signed long    ifMtu;
93     u32   ifSpeed;
94     u8    ifPhysAddress[ETH_ALEN];
95     signed long    ifAdminStatus;
96     signed long    ifOperStatus;
97     u32   ifLastChange;
98     u32   ifInOctets;
99     u32   ifInUcastPkts;
100     u32   ifInNUcastPkts;
101     u32   ifInDiscards;
102     u32   ifInErrors;
103     u32   ifInUnknownProtos;
104     u32   ifOutOctets;
105     u32   ifOutUcastPkts;
106     u32   ifOutNUcastPkts;
107     u32   ifOutDiscards;
108     u32   ifOutErrors;
109     u32   ifOutQLen;
110     u32   ifSpecific;
111 } SMib2Counter, *PSMib2Counter;
112
113 // Value in the ifType entry
114 #define WIRELESSLANIEEE80211b      6           //
115
116 // Value in the ifAdminStatus/ifOperStatus entry
117 #define UP                  1           //
118 #define DOWN                2           //
119 #define TESTING             3           //
120
121
122 //
123 // RMON counter
124 //
125 typedef struct tagSRmonCounter {
126     signed long    etherStatsIndex;
127     u32   etherStatsDataSource;
128     u32   etherStatsDropEvents;
129     u32   etherStatsOctets;
130     u32   etherStatsPkts;
131     u32   etherStatsBroadcastPkts;
132     u32   etherStatsMulticastPkts;
133     u32   etherStatsCRCAlignErrors;
134     u32   etherStatsUndersizePkts;
135     u32   etherStatsOversizePkts;
136     u32   etherStatsFragments;
137     u32   etherStatsJabbers;
138     u32   etherStatsCollisions;
139     u32   etherStatsPkt64Octets;
140     u32   etherStatsPkt65to127Octets;
141     u32   etherStatsPkt128to255Octets;
142     u32   etherStatsPkt256to511Octets;
143     u32   etherStatsPkt512to1023Octets;
144     u32   etherStatsPkt1024to1518Octets;
145     u32   etherStatsOwners;
146     u32   etherStatsStatus;
147 } SRmonCounter, *PSRmonCounter;
148
149 //
150 // Custom counter
151 //
152 typedef struct tagSCustomCounters {
153     unsigned long       Length;
154
155     unsigned long long   ullTsrAllOK;
156
157     unsigned long long   ullRsr11M;
158     unsigned long long   ullRsr5M;
159     unsigned long long   ullRsr2M;
160     unsigned long long   ullRsr1M;
161
162     unsigned long long   ullRsr11MCRCOk;
163     unsigned long long   ullRsr5MCRCOk;
164     unsigned long long   ullRsr2MCRCOk;
165     unsigned long long   ullRsr1MCRCOk;
166
167     unsigned long long   ullRsr54M;
168     unsigned long long   ullRsr48M;
169     unsigned long long   ullRsr36M;
170     unsigned long long   ullRsr24M;
171     unsigned long long   ullRsr18M;
172     unsigned long long   ullRsr12M;
173     unsigned long long   ullRsr9M;
174     unsigned long long   ullRsr6M;
175
176     unsigned long long   ullRsr54MCRCOk;
177     unsigned long long   ullRsr48MCRCOk;
178     unsigned long long   ullRsr36MCRCOk;
179     unsigned long long   ullRsr24MCRCOk;
180     unsigned long long   ullRsr18MCRCOk;
181     unsigned long long   ullRsr12MCRCOk;
182     unsigned long long   ullRsr9MCRCOk;
183     unsigned long long   ullRsr6MCRCOk;
184
185 } SCustomCounters, *PSCustomCounters;
186
187
188 //
189 // Custom counter
190 //
191 typedef struct tagSISRCounters {
192     unsigned long   Length;
193
194     u32   dwIsrTx0OK;
195     u32   dwIsrAC0TxOK;
196     u32   dwIsrBeaconTxOK;
197     u32   dwIsrRx0OK;
198     u32   dwIsrTBTTInt;
199     u32   dwIsrSTIMERInt;
200     u32   dwIsrWatchDog;
201     u32   dwIsrUnrecoverableError;
202     u32   dwIsrSoftInterrupt;
203     u32   dwIsrMIBNearfull;
204     u32   dwIsrRxNoBuf;
205
206     u32   dwIsrUnknown;               // unknown interrupt count
207
208     u32   dwIsrRx1OK;
209     u32   dwIsrATIMTxOK;
210     u32   dwIsrSYNCTxOK;
211     u32   dwIsrCFPEnd;
212     u32   dwIsrATIMEnd;
213     u32   dwIsrSYNCFlushOK;
214     u32   dwIsrSTIMER1Int;
215     /////////////////////////////////////
216 } SISRCounters, *PSISRCounters;
217
218
219 // Value in the etherStatsStatus entry
220 #define VALID               1           //
221 #define CREATE_REQUEST      2           //
222 #define UNDER_CREATION      3           //
223 #define INVALID             4           //
224
225
226 //
227 // Tx packet information
228 //
229 typedef struct tagSTxPktInfo {
230     u8    byBroadMultiUni;
231     u16    wLength;
232     u16    wFIFOCtl;
233     u8    abyDestAddr[ETH_ALEN];
234 } STxPktInfo, *PSTxPktInfo;
235
236
237 #define MAX_RATE            12
238 //
239 // statistic counter
240 //
241 typedef struct tagSStatCounter {
242     //
243     // ISR status count
244     //
245
246     SISRCounters ISRStat;
247
248     // RSR status count
249     //
250     u32   dwRsrFrmAlgnErr;
251     u32   dwRsrErr;
252     u32   dwRsrCRCErr;
253     u32   dwRsrCRCOk;
254     u32   dwRsrBSSIDOk;
255     u32   dwRsrADDROk;
256     u32   dwRsrBCNSSIDOk;
257     u32   dwRsrLENErr;
258     u32   dwRsrTYPErr;
259
260     u32   dwNewRsrDECRYPTOK;
261     u32   dwNewRsrCFP;
262     u32   dwNewRsrUTSF;
263     u32   dwNewRsrHITAID;
264     u32   dwNewRsrHITAID0;
265
266     u32   dwRsrLong;
267     u32   dwRsrRunt;
268
269     u32   dwRsrRxControl;
270     u32   dwRsrRxData;
271     u32   dwRsrRxManage;
272
273     u32   dwRsrRxPacket;
274     u32   dwRsrRxOctet;
275     u32   dwRsrBroadcast;
276     u32   dwRsrMulticast;
277     u32   dwRsrDirected;
278     // 64-bit OID
279     unsigned long long   ullRsrOK;
280
281     // for some optional OIDs (64 bits) and DMI support
282     unsigned long long   ullRxBroadcastBytes;
283     unsigned long long   ullRxMulticastBytes;
284     unsigned long long   ullRxDirectedBytes;
285     unsigned long long   ullRxBroadcastFrames;
286     unsigned long long   ullRxMulticastFrames;
287     unsigned long long   ullRxDirectedFrames;
288
289     u32   dwRsrRxFragment;
290     u32   dwRsrRxFrmLen64;
291     u32   dwRsrRxFrmLen65_127;
292     u32   dwRsrRxFrmLen128_255;
293     u32   dwRsrRxFrmLen256_511;
294     u32   dwRsrRxFrmLen512_1023;
295     u32   dwRsrRxFrmLen1024_1518;
296
297     // TSR status count
298     //
299     u32   dwTsrTotalRetry;        // total collision retry count
300     u32   dwTsrOnceRetry;         // this packet only occur one collision
301     u32   dwTsrMoreThanOnceRetry; // this packet occur more than one collision
302     u32   dwTsrRetry;             // this packet has ever occur collision,
303                                          // that is (dwTsrOnceCollision0 + dwTsrMoreThanOnceCollision0)
304     u32   dwTsrACKData;
305     u32   dwTsrErr;
306     u32   dwAllTsrOK;
307     u32   dwTsrRetryTimeout;
308     u32   dwTsrTransmitTimeout;
309
310     u32   dwTsrTxPacket;
311     u32   dwTsrTxOctet;
312     u32   dwTsrBroadcast;
313     u32   dwTsrMulticast;
314     u32   dwTsrDirected;
315
316     // RD/TD count
317     u32   dwCntRxFrmLength;
318     u32   dwCntTxBufLength;
319
320     u8    abyCntRxPattern[16];
321     u8    abyCntTxPattern[16];
322
323
324
325     // Software check....
326     u32   dwCntRxDataErr;             // rx buffer data software compare CRC err count
327     u32   dwCntDecryptErr;            // rx buffer data software compare CRC err count
328     u32   dwCntRxICVErr;              // rx buffer data software compare CRC err count
329
330
331     // 64-bit OID
332     unsigned long long   ullTsrOK;
333
334     // for some optional OIDs (64 bits) and DMI support
335     unsigned long long   ullTxBroadcastFrames;
336     unsigned long long   ullTxMulticastFrames;
337     unsigned long long   ullTxDirectedFrames;
338     unsigned long long   ullTxBroadcastBytes;
339     unsigned long long   ullTxMulticastBytes;
340     unsigned long long   ullTxDirectedBytes;
341
342     // for autorate
343     u32   dwTxOk[MAX_RATE+1];
344     u32   dwTxFail[MAX_RATE+1];
345     u32   dwTxRetryCount[8];
346
347     STxPktInfo  abyTxPktInfo[16];
348
349     SUSBCounter USB_EP0Stat;
350     SUSBCounter USB_BulkInStat;
351     SUSBCounter USB_BulkOutStat;
352     SUSBCounter USB_InterruptStat;
353
354     SCustomCounters CustomStat;
355
356        //Tx count:
357   unsigned long TxNoRetryOkCount;         /* success tx no retry ! */
358   unsigned long TxRetryOkCount;           /* success tx but retry ! */
359   unsigned long TxFailCount;              /* fail tx ? */
360       //Rx count:
361   unsigned long RxOkCnt;                  /* success rx ! */
362   unsigned long RxFcsErrCnt;              /* fail rx ? */
363       //statistic
364     unsigned long SignalStren;
365     unsigned long LinkQuality;
366
367 } SStatCounter, *PSStatCounter;
368
369 /*---------------------  Export Classes  ----------------------------*/
370
371 /*---------------------  Export Variables  --------------------------*/
372
373 /*---------------------  Export Functions  --------------------------*/
374
375 void STAvClearAllCounter(PSStatCounter pStatistic);
376
377 void STAvUpdateIsrStatCounter(PSStatCounter pStatistic,
378                               u8 byIsr0,
379                               u8 byIsr1);
380
381 void STAvUpdateRDStatCounter(PSStatCounter pStatistic,
382                              u8 byRSR, u8 byNewRSR, u8 byRxSts,
383                              u8 byRxRate, u8 * pbyBuffer,
384                              unsigned int cbFrameLength);
385
386 void STAvUpdateRDStatCounterEx(PSStatCounter pStatistic,
387                                u8 byRSR, u8 byNewRSR, u8 byRxSts,
388                                u8 byRxRate, u8 * pbyBuffer,
389                                unsigned int cbFrameLength);
390
391 void STAvUpdateTDStatCounter(PSStatCounter pStatistic, u8 byPktNum,
392                              u8 byRate, u8 byTSR);
393
394 void
395 STAvUpdate802_11Counter(
396     PSDot11Counters         p802_11Counter,
397     PSStatCounter           pStatistic,
398     u8                    byRTSSuccess,
399     u8                    byRTSFail,
400     u8                    byACKFail,
401     u8                    byFCSErr
402     );
403
404 void STAvClear802_11Counter(PSDot11Counters p802_11Counter);
405 void STAvUpdateUSBCounter(PSUSBCounter pUsbCounter, int ntStatus);
406
407 #endif /* __MIB_H__ */