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