• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/staging/otus/80211core/
1/*
2 * Copyright (c) 2007-2008 Atheros Communications Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _STRUCT_H
18#define _STRUCT_H
19
20#include "../oal_marc.h"
21
22#define ZM_SW_LOOP_BACK                     0 /* 1=>enable, 0=>disable */
23#define ZM_PCI_LOOP_BACK                    0 /* 1=>enable, 0=>disable */
24#define ZM_PROTOCOL_RESPONSE_SIMULATION     0
25
26#define ZM_RX_FRAME_SIZE               1600
27
28extern const u8_t zg11bRateTbl[4];
29extern const u8_t zg11gRateTbl[8];
30
31#define ZM_DRIVER_CORE_MAJOR_VERSION        1
32#define ZM_DRIVER_CORE_MINOR_VERSION        1
33#define ZM_DRIVER_CORE_BRANCH_MAJOR_VERSION 3
34#define ZM_DRIVER_CORE_BRANCH_MINOR_VERSION 39
35
36#ifndef ZM_VTXQ_SIZE
37#define ZM_VTXQ_SIZE                        1024 //2^N
38#endif
39
40#define ZM_VTXQ_SIZE_MASK                   (ZM_VTXQ_SIZE-1)
41#define ZM_VMMQ_SIZE                        8 //2^N
42#define ZM_VMMQ_SIZE_MASK                   (ZM_VMMQ_SIZE-1)
43
44#include "cagg.h"
45
46#define ZM_AGG_POOL_SIZE                    20
47#define ZM_RATE_TABLE_SIZE                  32
48
49#define ZM_MAX_BUF_DISCRETE_NUMBER          5
50
51
52
53
54
55
56
57
58
59/**********************************************************************************/
60/* IBSS macros                                                     */
61/**********************************************************************************/
62#define ZM_IBSS_PEER_ALIVE_COUNTER     4
63
64/**********************************************************************************/
65/* BIT mapping related macros                                                     */
66/**********************************************************************************/
67
68#define ZM_BIT_0       0x1
69#define ZM_BIT_1       0x2
70#define ZM_BIT_2       0x4
71#define ZM_BIT_3       0x8
72#define ZM_BIT_4       0x10
73#define ZM_BIT_5       0x20
74#define ZM_BIT_6       0x40
75#define ZM_BIT_7       0x80
76#define ZM_BIT_8       0x100
77#define ZM_BIT_9       0x200
78#define ZM_BIT_10      0x400
79#define ZM_BIT_11      0x800
80#define ZM_BIT_12      0x1000
81#define ZM_BIT_13      0x2000
82#define ZM_BIT_14      0x4000
83#define ZM_BIT_15      0x8000
84#define ZM_BIT_16      0x10000
85#define ZM_BIT_17      0x20000
86#define ZM_BIT_18      0x40000
87#define ZM_BIT_19      0x80000
88#define ZM_BIT_20      0x100000
89#define ZM_BIT_21      0x200000
90#define ZM_BIT_22      0x400000
91#define ZM_BIT_23      0x800000
92#define ZM_BIT_24      0x1000000
93#define ZM_BIT_25      0x2000000
94#define ZM_BIT_26      0x4000000
95#define ZM_BIT_27      0x8000000
96#define ZM_BIT_28      0x10000000
97#define ZM_BIT_29      0x20000000   //WPA support
98#define ZM_BIT_30      0x40000000
99#define ZM_BIT_31      0x80000000
100
101
102/**********************************************************************************/
103/* MAC address related macros                                                     */
104/**********************************************************************************/
105#define ZM_MAC_BYTE_TO_WORD(macb, macw)   macw[0] = macb[0] + (macb[1] << 8); \
106                                          macw[1] = macb[2] + (macb[3] << 8); \
107                                          macw[2] = macb[4] + (macb[5] << 8);
108
109#define ZM_MAC_WORD_TO_BYTE(macw, macb)   macb[0] = (u8_t) (macw[0] & 0xff); \
110                                          macb[1] = (u8_t) (macw[0] >> 8);   \
111                                          macb[2] = (u8_t) (macw[1] & 0xff); \
112                                          macb[3] = (u8_t) (macw[1] >> 8);   \
113                                          macb[4] = (u8_t) (macw[2] & 0xff); \
114                                          macb[5] = (u8_t) (macw[2] >> 8);
115
116#define ZM_MAC_0(macw)   ((u8_t)(macw[0] & 0xff))
117#define ZM_MAC_1(macw)   ((u8_t)(macw[0] >> 8))
118#define ZM_MAC_2(macw)   ((u8_t)(macw[1] & 0xff))
119#define ZM_MAC_3(macw)   ((u8_t)(macw[1] >> 8))
120#define ZM_MAC_4(macw)   ((u8_t)(macw[2] & 0xff))
121#define ZM_MAC_5(macw)   ((u8_t)(macw[2] >> 8))
122
123#define ZM_IS_MULTICAST_OR_BROADCAST(mac) (mac[0] & 0x01)
124#define ZM_IS_MULTICAST(mac) ((mac[0] & 0x01) && (((u8_t)mac[0]) != 0xFF))
125
126#define ZM_MAC_EQUAL(mac1, mac2)   ((mac1[0]==mac2[0])&&(mac1[1]==mac2[1])&&(mac1[2]==mac2[2]))
127#define ZM_MAC_NOT_EQUAL(mac1, mac2)   ((mac1[0]!=mac2[0])||(mac1[1]!=mac2[1])||(mac1[2]!=mac2[2]))
128/**********************************************************************************/
129/* MAC address related mac'ros (end)                                               */
130/**********************************************************************************/
131#define ZM_BYTE_TO_WORD(A, B)   ((A<<8)+B)
132#define ZM_ROL32( A, n ) \
133        ( ((A) << (n)) | ( ((A)>>(32-(n)))  & ( (1UL << (n)) - 1 ) ) )
134#define ZM_ROR32( A, n ) ZM_ROL32( (A), 32-(n) )
135#define ZM_LO8(v16)  ((u8_t)((v16) & 0xFF))
136#define ZM_HI8(v16)  ((u8_t)(((v16)>>8)&0xFF))
137
138#ifdef ZM_ENABLE_BUFFER_TRACE
139extern void zfwBufTrace(zdev_t* dev, zbuf_t *buf, u8_t *functionName);
140#define ZM_BUFFER_TRACE(dev, buf)       zfwBufTrace(dev, buf, __func__);
141#else
142#define ZM_BUFFER_TRACE(dev, buf)
143#endif
144
145/* notification events to heart beat function */
146#define ZM_BSSID_LIST_SCAN         0x01
147
148/* CAM mode */
149#define ZM_CAM_AP                       0x1
150#define ZM_CAM_STA                      0x2
151#define ZM_CAM_HOST                     0x4
152
153/* finite state machine for adapter */
154#define ZM_STA_STATE_DISCONNECT           1
155#define ZM_STA_STATE_CONNECTING           2
156#define ZM_STA_STATE_CONNECTED            3
157
158/* Event definitions for  finite state machine */
159#define ZM_EVENT_TIMEOUT_SCAN             0x0000
160#define ZM_EVENT_TIMEOUT_BG_SCAN          0x0001
161#define ZN_EVENT_TIMEOUT_RECONNECT        0x0002
162#define ZM_EVENT_TIMEOUT_INIT_SCAN        0x0003
163#define ZM_EVENT_TIMEOUT_AUTH             0x0004
164#define ZM_EVENT_TIMEOUT_ASSO             0x0005
165#define ZM_EVENT_TIMEOUT_AUTO_SCAN        0x0006
166#define ZM_EVENT_TIMEOUT_MIC_FAIL         0x0007
167#define ZM_EVENT_TIMEOUT_CHECK_AP         0x0008
168#define ZM_EVENT_CONNECT                  0x0009
169#define ZM_EVENT_INIT_SCAN                0x000a
170#define ZM_EVENT_SCAN                     0x000b
171#define ZM_EVENT_BG_SCAN                  0x000c
172#define ZM_EVENT_DISCONNECT               0x000d
173#define ZM_EVENT_WPA_MIC_FAIL             0x000e
174#define ZM_EVENT_AP_ALIVE                 0x000f
175#define ZM_EVENT_CHANGE_TO_AP             0x0010
176#define ZM_EVENT_CHANGE_TO_STA            0x0011
177#define ZM_EVENT_IDLE                     0x0012
178#define ZM_EVENT_AUTH                     0x0013
179#define ZM_EVENT_ASSO_RSP                 0x0014
180#define ZM_EVENT_WPA_PK_OK                0x0015
181#define ZM_EVENT_WPA_GK_OK                0x0016
182#define ZM_EVENT_RCV_BEACON               0x0017
183#define ZM_EVENT_RCV_PROBE_RSP            0x0018
184#define ZM_EVENT_SEND_DATA                0x0019
185#define ZM_EVENT_AUTO_SCAN                0x001a
186#define ZM_EVENT_MIC_FAIL1                0x001d
187#define ZM_EVENT_MIC_FAIL2                0x001e
188#define ZM_EVENT_IBSS_MONITOR             0x001f
189#define ZM_EVENT_IN_SCAN                  0x0020
190#define ZM_EVENT_CM_TIMER                 0x0021
191#define ZM_EVENT_CM_DISCONNECT            0x0022
192#define ZM_EVENT_CM_BLOCK_TIMER           0x0023
193#define ZM_EVENT_TIMEOUT_ADDBA            0x0024
194#define ZM_EVENT_TIMEOUT_PERFORMANCE      0x0025
195#define ZM_EVENT_SKIP_COUNTERMEASURE	  0x0026
196#define ZM_EVENT_NONE                     0xffff
197
198/* Actions after call finite state machine */
199#define ZM_ACTION_NONE                    0x0000
200#define ZM_ACTION_QUEUE_DATA              0x0001
201#define ZM_ACTION_DROP_DATA               0x0002
202
203/* Timers for finite state machine */
204#define ZM_TICK_ZERO                      0
205#define ZM_TICK_INIT_SCAN_END             8
206#define ZM_TICK_NEXT_BG_SCAN              50
207#define ZM_TICK_BG_SCAN_END               8
208#define ZM_TICK_AUTH_TIMEOUT              4
209#define ZM_TICK_ASSO_TIMEOUT              4
210#define ZM_TICK_AUTO_SCAN                 300
211#define ZM_TICK_MIC_FAIL_TIMEOUT          6000
212#define ZM_TICK_CHECK_AP1                 150
213#define ZM_TICK_CHECK_AP2                 350
214#define ZM_TICK_CHECK_AP3                 250
215#define ZM_TICK_IBSS_MONITOR              160
216#define ZM_TICK_IN_SCAN                   4
217#define ZM_TICK_CM_TIMEOUT                6000
218#define ZM_TICK_CM_DISCONNECT             200
219#define ZM_TICK_CM_BLOCK_TIMEOUT          6000
220
221/* Fix bug#33338 Counter Measure Issur */
222#ifdef NDIS_CM_FOR_XP
223#define ZM_TICK_CM_TIMEOUT_OFFSET        2160
224#define ZM_TICK_CM_DISCONNECT_OFFSET     72
225#define ZM_TICK_CM_BLOCK_TIMEOUT_OFFSET  2160
226#else
227#define ZM_TICK_CM_TIMEOUT_OFFSET        0
228#define ZM_TICK_CM_DISCONNECT_OFFSET     0
229#define ZM_TICK_CM_BLOCK_TIMEOUT_OFFSET  0
230#endif
231
232#define ZM_TIME_ACTIVE_SCAN               30 //ms
233#define ZM_TIME_PASSIVE_SCAN              110 //ms
234
235/* finite state machine for BSS connect */
236#define ZM_STA_CONN_STATE_NONE            0
237#define ZM_STA_CONN_STATE_AUTH_OPEN       1
238#define ZM_STA_CONN_STATE_AUTH_SHARE_1    2
239#define ZM_STA_CONN_STATE_AUTH_SHARE_2    3
240#define ZM_STA_CONN_STATE_ASSOCIATE       4
241#define ZM_STA_CONN_STATE_SSID_NOT_FOUND  5
242#define ZM_STA_CONN_STATE_AUTH_COMPLETED  6
243
244/* finite state machine for WPA handshaking */
245#define ZM_STA_WPA_STATE_INIT             0
246#define ZM_STA_WPA_STATE_PK_OK            1
247#define ZM_STA_WPA_STATE_GK_OK            2
248
249/* various timers */
250#define ZM_INTERVAL_CONNECT_TIMEOUT          20   /* 200 milisecond */
251
252/* IBSS definitions */
253#define ZM_IBSS_PARTNER_LOST                 0
254#define ZM_IBSS_PARTNER_ALIVE                1
255#define ZM_IBSS_PARTNER_CHECK                2
256
257#define ZM_BCMC_ARRAY_SIZE                  16 /* Must be 2^N */
258#define ZM_UNI_ARRAY_SIZE                   16 /* Must be 2^N */
259
260#define ZM_MAX_DEFRAG_ENTRIES               4  /* 2^N */
261#define ZM_DEFRAG_AGING_TIME_SEC            5  /* 5 seconds */
262
263#define ZM_MAX_WPAIE_SIZE                   128
264/* WEP related definitions */
265#define ZM_USER_KEY_DEFAULT                 64
266#define ZM_USER_KEY_PK                      0                /* Pairwise Key */
267#define ZM_USER_KEY_GK                      1                /* Group Key */
268/* AP WLAN Type */
269#define ZM_WLAN_TYPE_PURE_B                 2
270#define ZM_WLAN_TYPE_PURE_G                 1
271#define ZM_WLAN_TYPE_MIXED                  0
272
273/* HAL State */
274#define ZM_HAL_STATE_INIT                   0
275#define ZM_HAL_STATE_RUNNING                1
276
277/* AP Capability */
278#define ZM_All11N_AP                        0x01
279#define ZM_XR_AP                            0x02
280#define ZM_SuperG_AP                        0x04
281
282/* MPDU Density */
283#define ZM_MPDU_DENSITY_NONE                0
284#define ZM_MPDU_DENSITY_1_8US               1
285#define ZM_MPDU_DENSITY_1_4US               2
286#define ZM_MPDU_DENSITY_1_2US               3
287#define ZM_MPDU_DENSITY_1US                 4
288#define ZM_MPDU_DENSITY_2US                 5
289#define ZM_MPDU_DENSITY_4US                 6
290#define ZM_MPDU_DENSITY_8US                 7
291
292/* Software Encryption */
293#define ZM_SW_TKIP_ENCRY_EN                0x01
294#define ZM_SW_TKIP_DECRY_EN                0x02
295#define ZM_SW_WEP_ENCRY_EN                 0x04
296#define ZM_SW_WEP_DECRY_EN                 0x08
297
298/* Default Support Rate */
299#define ZM_DEFAULT_SUPPORT_RATE_ZERO       0x0
300#define ZM_DEFAULT_SUPPORT_RATE_DISCONNECT 0x1
301#define ZM_DEFAULT_SUPPORT_RATE_IBSS_B     0x2
302#define ZM_DEFAULT_SUPPORT_RATE_IBSS_AG    0x3
303
304/* security related definitions */
305struct zsTkipSeed
306{
307    u8_t   tk[32];     /* key */
308    u8_t   ta[6];
309    u16_t  ttak[5];
310    u16_t  ppk[6];
311    u16_t  iv16,iv16tmp;
312    u32_t  iv32,iv32tmp;
313};
314
315struct zsMicVar
316{
317    u32_t  k0, k1;        // Key
318    u32_t  left, right;   // Current state
319    u32_t  m;             // Message accumulator (single word)
320    u16_t  nBytes;        // # bytes in M
321};
322
323struct zsDefragEntry
324{
325    u8_t    fragCount;
326    u8_t    addr[6];
327    u16_t   seqNum;
328    zbuf_t* fragment[8];
329    u32_t   tick;
330};
331
332struct zsDefragList
333{
334    struct zsDefragEntry   defragEntry[ZM_MAX_DEFRAG_ENTRIES];
335    u8_t                   replaceNum;
336};
337
338#define ZM_MAX_OPPOSITE_COUNT      16
339#define ZM_MAX_TX_SAMPLES          15
340#define ZM_TX_RATE_DOWN_CRITERIA   80
341#define ZM_TX_RATE_UP_CRITERIA    200
342
343
344#define ZM_MAX_PROBE_HIDDEN_SSID_SIZE 2
345struct zsSsidList
346{
347    u8_t            ssid[32];
348    u8_t            ssidLen;
349};
350
351struct zsWrapperSetting
352{
353    u8_t            bDesiredBssid;
354    u8_t            desiredBssid[6];
355    u16_t           bssid[3];
356    u8_t            ssid[32];
357    u8_t            ssidLen;
358    u8_t            authMode;
359    u8_t            wepStatus;
360    u8_t            encryMode;
361    u8_t            wlanMode;
362    u16_t           frequency;
363    u16_t           beaconInterval;
364    u8_t            dtim;
365    u8_t            preambleType;
366    u16_t           atimWindow;
367
368    struct zsSsidList probingSsidList[ZM_MAX_PROBE_HIDDEN_SSID_SIZE];
369
370    u8_t            dropUnencryptedPkts;
371    u8_t            ibssJoinOnly;
372    u32_t           adhocMode;
373    u8_t            countryIsoName[4];
374    u16_t           autoSetFrequency;
375
376    /* AP */
377    u8_t            bRateBasic;
378    u8_t            gRateBasic;
379    u32_t           nRateBasic;
380    u8_t            bgMode;
381
382    /* Common */
383    u8_t            staWmeEnabled;
384    u8_t            staWmeQosInfo;
385    u8_t            apWmeEnabled;
386
387
388    /* rate information: added in the future */
389};
390
391struct zsWrapperFeatureCtrl
392{
393    u8_t           bIbssGMode;
394};
395
396#define  ZM_MAX_PS_STA            16
397#define  ZM_PS_QUEUE_SIZE         32
398
399struct zsStaPSEntity
400{
401    u8_t           bUsed;
402    u8_t           macAddr[6];
403    u8_t           bDataQueued;
404};
405
406struct zsStaPSList
407{
408    u8_t           count;
409    struct zsStaPSEntity    entity[ZM_MAX_PS_STA];
410};
411
412#define ZM_MAX_TIMER_COUNT   32
413
414/* double linked list */
415struct zsTimerEntry
416{
417    u16_t   event;
418    u32_t   timer;
419    struct zsTimerEntry *pre;
420    struct zsTimerEntry *next;
421};
422
423struct zsTimerList
424{
425    u8_t   freeCount;
426    struct zsTimerEntry list[ZM_MAX_TIMER_COUNT];
427    struct zsTimerEntry *head;
428    struct zsTimerEntry *tail;
429};
430
431/* Multicast list */
432#define ZM_MAX_MULTICAST_LIST_SIZE     64
433
434struct zsMulticastAddr
435{
436    u8_t addr[6];
437};
438
439struct zsMulticastList
440{
441    u8_t   size;
442    struct zsMulticastAddr macAddr[ZM_MAX_MULTICAST_LIST_SIZE];
443};
444
445enum ieee80211_cwm_mode {
446    CWM_MODE20,
447    CWM_MODE2040,
448    CWM_MODE40,
449    CWM_MODEMAX
450
451};
452
453enum ieee80211_cwm_extprotspacing {
454    CWM_EXTPROTSPACING20,
455    CWM_EXTPROTSPACING25,
456    CWM_EXTPROTSPACINGMAX
457};
458
459enum ieee80211_cwm_width {
460    CWM_WIDTH20,
461    CWM_WIDTH40
462};
463
464enum ieee80211_cwm_extprotmode {
465    CWM_EXTPROTNONE,  /* no protection */
466    CWM_EXTPROTCTSONLY,   /* CTS to self */
467    CWM_EXTPROTRTSCTS,    /* RTS-CTS */
468    CWM_EXTPROTMAX
469};
470
471struct ieee80211_cwm {
472
473    /* Configuration */
474    enum ieee80211_cwm_mode         cw_mode;            /* CWM mode */
475    u8_t                            cw_extoffset;       /* CWM Extension Channel Offset */
476    enum ieee80211_cwm_extprotmode  cw_extprotmode;     /* CWM Extension Channel Protection Mode */
477    enum ieee80211_cwm_extprotspacing cw_extprotspacing;/* CWM Extension Channel Protection Spacing */
478    u32_t                           cw_enable;          /* CWM State Machine Enabled */
479    u32_t                           cw_extbusythreshold;/* CWM Extension Channel Busy Threshold */
480
481    /* State */
482    enum ieee80211_cwm_width        cw_width;           /* CWM channel width */
483};
484
485
486/* AP : STA database structure */
487struct zsStaTable
488{
489    u32_t time;     /* tick time */
490    //u32_t phyCtrl;   /* Tx PHY CTRL */
491    u16_t addr[3];  /* STA MAC address */
492    u16_t state;    /* aut/asoc */
493    //u16_t retry;    /* Retry count */
494    struct zsRcCell rcCell;
495
496    u8_t valid;     /* Valid flag : 1=>valid */
497    u8_t psMode;    /* STA power saving mode */
498    u8_t staType;   /* 0=>11b, 1=>11g, 2=>11n */
499    u8_t qosType;   /* 0=>Legacy, 1=>WME */
500    u8_t qosInfo;   /* WME QoS info */
501    u8_t vap;       /* Virtual AP ID */
502    u8_t encryMode; /* Encryption type for this STA */
503    u8_t keyIdx;
504    struct zsMicVar     txMicKey;
505    struct zsMicVar     rxMicKey;
506    u16_t iv16;
507    u32_t iv32;
508#ifdef ZM_ENABLE_CENC
509    /* CENC */
510    u8_t cencKeyIdx;
511    u32_t txiv[4];
512    u32_t rxiv[4];
513#endif //ZM_ENABLE_CENC
514};
515
516struct zdStructWds
517{
518    u8_t    wdsBitmap;                      /* Set bit-N to 1 to enable WDS */
519    u8_t    encryMode[ZM_MAX_WDS_SUPPORT];  /* WDS encryption mode */
520    u16_t   macAddr[ZM_MAX_WDS_SUPPORT][3]; /* WDS neighbor MAC address */
521};
522
523    // htcapinfo 16bits
524#define HTCAP_AdvCodingCap          0x0001
525#define HTCAP_SupChannelWidthSet    0x0002
526#define HTCAP_DynamicSMPS           0x0004
527#define HTCAP_SMEnabled             0x000C
528#define HTCAP_GreenField            0x0010
529#define HTCAP_ShortGIfor20MHz       0x0020
530#define HTCAP_ShortGIfor40MHz       0x0040
531#define HTCAP_TxSTBC                0x0080
532#define HTCAP_RxOneStream           0x0100
533#define HTCAP_RxTwoStream           0x0200
534#define HTCAP_RxThreeStream         0x0300
535#define HTCAP_DelayedBlockACK       0x0400
536#define HTCAP_MaxAMSDULength        0x0800
537#define HTCAP_DSSSandCCKin40MHz     0x1000
538#define HTCAP_PSMPSup               0x2000
539#define HTCAP_STBCControlFrameSup   0x4000
540#define HTCAP_LSIGTXOPProtectionSUP 0x8000
541    // Ampdu HT Parameter Info 8bits
542#define HTCAP_MaxRxAMPDU0           0x00
543#define HTCAP_MaxRxAMPDU1           0x01
544#define HTCAP_MaxRxAMPDU2           0x02
545#define HTCAP_MaxRxAMPDU3           0x03
546    // PCO 8bits
547#define HTCAP_PCO                   0x01
548#define HTCAP_TransmissionTime1     0x02
549#define HTCAP_TransmissionTime2     0x04
550#define HTCAP_TransmissionTime3     0x06
551    // MCS FeedBack 8bits
552#define HTCAP_PlusHTCSupport        0x04
553#define HTCAP_RDResponder           0x08
554    // TX Beamforming 0 8bits
555#define HTCAP_TxBFCapable           0x01
556#define HTCAP_RxStaggeredSoundCap   0x02
557#define HTCAP_TxStaggeredSoundCap   0x04
558#define HTCAP_RxZLFCapable          0x08
559#define HTCAP_TxZLFCapable          0x10
560#define HTCAP_ImplicitTxBFCapable   0x20
561    // Tx Beamforming 1 8bits
562#define HTCAP_ExplicitCSITxBFCap    0x01
563#define HTCAP_ExpUncompSteerMatrCap 0x02
564    // Antenna Selection Capabilities 8bits
565#define HTCAP_AntennaSelectionCap       0x01
566#define HTCAP_ExplicitCSITxASCap        0x02
567#define HTCAP_AntennaIndFeeTxASCap      0x04
568#define HTCAP_ExplicitCSIFeedbackCap    0x08
569#define HTCAP_AntennaIndFeedbackCap     0x10
570#define HTCAP_RxASCap                   0x20
571#define HTCAP_TxSoundPPDUsCap           0x40
572
573
574
575struct zsHTCapability
576{
577    u8_t ElementID;
578    u8_t Length;
579    // HT Capability Info
580    u16_t HtCapInfo;
581    u8_t AMPDUParam;
582    u8_t MCSSet[16];    //16 bytes
583    // Extended HT Capability Info
584    u8_t PCO;
585    u8_t MCSFeedBack;
586
587    u8_t TxBFCap[4];
588    u8_t AselCap;
589};
590
591union zuHTCapability
592{
593    struct zsHTCapability Data;
594    u8_t Byte[28];
595};
596
597    //channelinfo 8bits
598#define ExtHtCap_ExtChannelOffsetAbove  0x01
599#define ExtHtCap_ExtChannelOffsetBelow  0x03
600#define ExtHtCap_RecomTxWidthSet        0x04
601#define ExtHtCap_RIFSMode               0x08
602#define ExtHtCap_ControlAccessOnly      0x10
603    //operatinginfo 16bits
604#define ExtHtCap_NonGFDevicePresent     0x0004
605    //beaconinfo 16bits
606#define ExtHtCap_DualBeacon             0x0040
607#define ExtHtCap_DualSTBCProtection     0x0080
608#define ExtHtCap_SecondaryBeacon        0x0100
609#define ExtHtCap_LSIGTXOPProtectFullSup 0x0200
610#define ExtHtCap_PCOActive              0x0400
611#define ExtHtCap_PCOPhase               0x0800
612
613
614struct zsExtHTCapability
615{
616    u8_t    ElementID;
617    u8_t    Length;
618    u8_t    ControlChannel;
619    u8_t    ChannelInfo;
620    u16_t   OperatingInfo;
621    u16_t   BeaconInfo;
622    // Supported MCS Set
623    u8_t    MCSSet[16];
624};
625
626union zuExtHTCapability
627{
628    struct zsExtHTCapability Data;
629    u8_t Byte[24];
630};
631
632struct InformationElementSta {
633    struct zsHTCapability       HtCap;
634    struct zsExtHTCapability    HtInfo;
635};
636
637struct InformationElementAp {
638    struct zsHTCapability       HtCap;
639};
640
641#define ZM_MAX_FREQ_REQ_QUEUE  32
642typedef void (*zfpFreqChangeCompleteCb)(zdev_t* dev);
643
644struct zsWlanDevFreqControl
645{
646    u16_t                     freqReqQueue[ZM_MAX_FREQ_REQ_QUEUE];
647    u8_t                     freqReqBw40[ZM_MAX_FREQ_REQ_QUEUE];
648    u8_t                     freqReqExtOffset[ZM_MAX_FREQ_REQ_QUEUE];
649    zfpFreqChangeCompleteCb   freqChangeCompCb[ZM_MAX_FREQ_REQ_QUEUE];
650    u8_t                      freqReqQueueHead;
651    u8_t                      freqReqQueueTail;
652};
653
654struct zsWlanDevAp
655{
656    u16_t   protectedObss;    /* protected overlap BSS */
657    u16_t   staAgingTimeSec;  /* in second, STA will be deathed if it does not */
658                              /* active for this long time                     */
659    u16_t   staProbingTimeSec;/* in second, STA will be probed if it does not  */
660                              /* active for this long time                     */
661    u8_t    authSharing;      /* authentication on going*/
662    u8_t    bStaAssociated;   /* 11b STA associated */
663    u8_t    gStaAssociated;   /* 11g STA associated */
664    u8_t    nStaAssociated;   /* 11n STA associated */
665    u16_t   protectionMode;   /* AP protection mode flag */
666    u16_t   staPowerSaving;   /* Set associated power saving STA count */
667
668
669
670    zbuf_t*  uniArray[ZM_UNI_ARRAY_SIZE]; /* array to store unicast frames */
671    u16_t   uniHead;
672    u16_t   uniTail;
673
674    /* HT Capability Info */
675    union zuHTCapability HTCap; //CWYang(+)
676
677    /* Extended HT Capability Info */
678    union zuExtHTCapability ExtHTCap; //CWYang(+)
679
680    /* STA table */
681    struct zsStaTable staTable[ZM_MAX_STA_SUPPORT];
682
683    /* WDS */
684    struct zdStructWds wds;
685    /* WPA */
686    u8_t wpaIe[ZM_MAX_AP_SUPPORT][ZM_MAX_WPAIE_SIZE];
687    u8_t wpaLen[ZM_MAX_AP_SUPPORT];
688    u8_t stawpaIe[ZM_MAX_AP_SUPPORT][ZM_MAX_WPAIE_SIZE];
689    u8_t stawpaLen[ZM_MAX_AP_SUPPORT];
690    u8_t wpaSupport[ZM_MAX_AP_SUPPORT];
691
692    //struct zsTkipSeed   bcSeed;
693    u8_t bcKeyIndex[ZM_MAX_AP_SUPPORT];
694    u8_t bcHalKeyIdx[ZM_MAX_AP_SUPPORT];
695    struct zsMicVar     bcMicKey[ZM_MAX_AP_SUPPORT];
696    u16_t iv16[ZM_MAX_AP_SUPPORT];
697    u32_t iv32[ZM_MAX_AP_SUPPORT];
698
699#ifdef ZM_ENABLE_CENC
700    /* CENC */
701    u32_t txiv[ZM_MAX_AP_SUPPORT][4];
702#endif //ZM_ENABLE_CENC
703
704    /* Virtual AP */
705    u8_t    beaconCounter;
706    u8_t    vapNumber;
707    u8_t    apBitmap;                         /* Set bit-N to 1 to enable VAP */
708    u8_t    hideSsid[ZM_MAX_AP_SUPPORT];
709    u8_t    authAlgo[ZM_MAX_AP_SUPPORT];
710    u8_t    ssid[ZM_MAX_AP_SUPPORT][32];      /* SSID */
711    u8_t    ssidLen[ZM_MAX_AP_SUPPORT];       /* SSID length */
712    u8_t    encryMode[ZM_MAX_AP_SUPPORT];
713    u8_t    wepStatus[ZM_MAX_AP_SUPPORT];
714    u16_t   capab[ZM_MAX_AP_SUPPORT];         /* Capability */
715    u8_t    timBcmcBit[ZM_MAX_AP_SUPPORT];    /* BMCM bit of TIM */
716    u8_t    wlanType[ZM_MAX_AP_SUPPORT];
717
718    /* Array to store BC or MC frames */
719    zbuf_t*  bcmcArray[ZM_MAX_AP_SUPPORT][ZM_BCMC_ARRAY_SIZE];
720    u16_t   bcmcHead[ZM_MAX_AP_SUPPORT];
721    u16_t   bcmcTail[ZM_MAX_AP_SUPPORT];
722
723    u8_t                    qosMode;                          /* 1=>WME */
724    u8_t                    uapsdEnabled;
725    struct zsQueue*         uapsdQ;
726
727    u8_t                    challengeText[128];
728
729    struct InformationElementAp ie[ZM_MAX_STA_SUPPORT];
730
731
732};
733
734#define ZM_MAX_BLOCKING_AP_LIST_SIZE    4 /* 2^N */
735struct zsBlockingAp
736{
737    u8_t addr[6];
738    u8_t weight;
739};
740
741#define ZM_SCAN_MGR_SCAN_NONE           0
742#define ZM_SCAN_MGR_SCAN_INTERNAL       1
743#define ZM_SCAN_MGR_SCAN_EXTERNAL       2
744
745struct zsWlanDevStaScanMgr
746{
747    u8_t                    scanReqs[2];
748    u8_t                    currScanType;
749    u8_t                    scanStartDelay;
750};
751
752#define ZM_PS_MSG_STATE_ACTIVE          0
753#define ZM_PS_MSG_STATE_SLEEP           1
754#define ZM_PS_MSG_STATE_T1              2
755#define ZM_PS_MSG_STATE_T2              3
756#define ZM_PS_MSG_STATE_S1              4
757
758#define ZM_PS_MAX_SLEEP_PERIODS         3       // The number of beacon periods
759
760struct zsWlanDevStaPSMgr
761{
762    u8_t                    state;
763    u8_t                    isSleepAllowed;
764    u8_t                    maxSleepPeriods;
765    u8_t                    ticks;
766    u32_t                   lastTxUnicastFrm;
767    u32_t                   lastTxMulticastFrm;
768    u32_t                   lastTxBroadcastFrm;
769    u8_t                    tempWakeUp; /*enable when wake up but still in ps mode */
770    u16_t                   sleepAllowedtick;
771};
772
773struct zsWlanDevSta
774{
775    u32_t                   beaconTxCnt;  /* Transmitted beacon counter (in IBSS) */
776    u8_t                    txBeaconInd;  /* In IBSS mode, true means that we just transmit a beacon during
777                                             last beacon period.
778                                           */
779    u16_t                   beaconCnt;    /* receive beacon count, will be perodically reset */
780    u16_t                   bssid[3];     /* BSSID of connected AP */
781    u8_t                    ssid[32];     /* SSID */
782    u8_t                    ssidLen;      /* SSID length */
783    u8_t                    mTxRate;      /* Tx rate for multicast */
784    u8_t                    uTxRate;      /* Tx rate for unicast */
785    u8_t                    mmTxRate;     /* Tx rate for management frame */
786    u8_t                    bChannelScan;
787    u8_t                    bScheduleScan;
788
789    u8_t                    InternalScanReq;
790    u16_t                   activescanTickPerChannel;
791    u16_t                   passiveScanTickPerChannel;
792    u16_t                   scanFrequency;
793    u32_t                   connPowerInHalfDbm;
794
795    u16_t                   currentFrequency;
796    u16_t                   currentBw40;
797    u16_t                   currentExtOffset;
798
799    u8_t                    bPassiveScan;
800
801    struct zsBlockingAp     blockingApList[ZM_MAX_BLOCKING_AP_LIST_SIZE];
802
803    //struct zsBssInfo        bssInfoPool[ZM_MAX_BSS];
804    struct zsBssInfo*       bssInfoArray[ZM_MAX_BSS];
805    struct zsBssList        bssList;
806    u8_t                    bssInfoArrayHead;
807    u8_t                    bssInfoArrayTail;
808    u8_t                    bssInfoFreeCount;
809
810    u8_t                    authMode;
811    u8_t                    currentAuthMode;
812    u8_t                    wepStatus;
813    u8_t                    encryMode;
814    u8_t                    keyId;
815#ifdef ZM_ENABLE_IBSS_WPA2PSK
816    u8_t                    ibssWpa2Psk;
817#endif
818#ifdef ZM_ENABLE_CENC
819    u8_t                    cencKeyId; //CENC
820#endif //ZM_ENABLE_CENC
821    u8_t                    dropUnencryptedPkts;
822    u8_t                    ibssJoinOnly;
823    u8_t                    adapterState;
824    u8_t                    oldAdapterState;
825    u8_t                    connectState;
826    u8_t                    connectRetry;
827    u8_t                    wpaState;
828    u8_t                    wpaIe[ZM_MAX_IE_SIZE + 2];
829    u8_t                    rsnIe[ZM_MAX_IE_SIZE + 2];
830    u8_t                    challengeText[255+2];
831    u8_t                    capability[2];
832    //u8_t                    connectingHiddenAP;
833    //u8_t                    scanWithSSID;
834    u16_t                   aid;
835    u32_t                   mgtFrameCount;
836    u8_t                    bProtectionMode;
837	u32_t					NonNAPcount;
838	u8_t					RTSInAGGMode;
839    u32_t                   connectTimer;
840    u16_t                   atimWindow;
841    u8_t                    desiredBssid[6];
842    u8_t                    bDesiredBssid;
843    struct zsTkipSeed       txSeed;
844    struct zsTkipSeed       rxSeed[4];
845    struct zsMicVar         txMicKey;
846    struct zsMicVar         rxMicKey[4];
847    u16_t                   iv16;
848    u32_t                   iv32;
849    struct zsOppositeInfo   oppositeInfo[ZM_MAX_OPPOSITE_COUNT];
850    u8_t                    oppositeCount;
851    u8_t                    bssNotFoundCount;     /* sitesurvey for search desired ISBB threshold */
852    u16_t                   rxBeaconCount;
853    u8_t                    beaconMissState;
854    u32_t                   rxBeaconTotal;
855    u8_t                    bIsSharedKey;
856    u8_t                    connectTimeoutCount;
857
858    u8_t                    recvAtim;
859
860    /* ScanMgr Control block */
861    struct zsWlanDevStaScanMgr scanMgr;
862    struct zsWlanDevStaPSMgr   psMgr;
863
864    // The callback would be called if receiving an unencrypted packets but
865    // the station is in encrypted mode. The wrapper could decide whether
866    // to drop the packet by its OS setting.
867    zfpStaRxSecurityCheckCb pStaRxSecurityCheckCb;
868
869    /* WME */
870    u8_t                    apWmeCapability; //bit-0 => a WME AP
871                                             //bit-7 => a UAPSD AP
872    u8_t                    wmeParameterSetCount;
873
874    u8_t                    wmeEnabled;
875    #define ZM_STA_WME_ENABLE_BIT       0x1
876    #define ZM_STA_UAPSD_ENABLE_BIT     0x2
877    u8_t                    wmeQosInfo;
878
879    u8_t                    wmeConnected;
880    u8_t                    qosInfo;
881    struct zsQueue*         uapsdQ;
882
883    /* countermeasures */
884    u8_t                    cmMicFailureCount;
885    u8_t                    cmDisallowSsidLength;
886    u8_t                    cmDisallowSsid[32];
887
888    /* power-saving mode */
889    u8_t                    powerSaveMode;
890    zbuf_t*                 staPSDataQueue[ZM_PS_QUEUE_SIZE];
891    u8_t                    staPSDataCount;
892
893    /* IBSS power-saving mode */
894    /* record the STA which has entered the PS mode */
895    struct zsStaPSList      staPSList;
896    /* queue the data of the PS STAs */
897    zbuf_t*                  ibssPSDataQueue[ZM_PS_QUEUE_SIZE];
898    u8_t                    ibssPSDataCount;
899    u8_t                    ibssPrevPSDataCount;
900    u8_t                    bIbssPSEnable;
901    /* BIT_15: ON/OFF, BIT_0~14: Atim Timer */
902    u16_t                   ibssAtimTimer;
903
904    /* WPA2 */
905    struct zsPmkidInfo      pmkidInfo;
906
907    /* Multicast list related objects */
908    struct zsMulticastList  multicastList;
909
910    /* XP packet filter feature : */
911    /* 1=>enable: All multicast address packets, not just the ones enumerated in the multicast address list. */
912    /* 0=>disable */
913    u8_t                    bAllMulticast;
914
915    /* reassociation flag */
916    u8_t                    connectByReasso;
917    u8_t                    failCntOfReasso;
918
919	/* for HT configure control setting */
920    u8_t                    preambleTypeHT;  /* HT: 0 Mixed mode    1 Green field */
921	u8_t                    htCtrlBandwidth;
922	u8_t                    htCtrlSTBC;
923	u8_t                    htCtrlSG;
924    u8_t                    defaultTA;
925
926    u8_t                    connection_11b;
927
928    u8_t                    EnableHT;
929    u8_t                    SG40;
930    u8_t                    HT2040;
931    /* for WPA setting */
932    u8_t                    wpaSupport;
933    u8_t                    wpaLen;
934
935    /* IBSS related objects */
936    u8_t                    ibssDelayedInd;
937    struct zsPartnerNotifyEvent ibssDelayedIndEvent;
938    u8_t                    ibssPartnerStatus;
939
940    u8_t                    bAutoReconnect;
941
942    u8_t                    flagFreqChanging;
943    u8_t                    flagKeyChanging;
944    struct zsBssInfo        ibssBssDesc;
945    u8_t                    ibssBssIsCreator;
946    u16_t                   ibssReceiveBeaconCount;
947    u8_t                    ibssSiteSurveyStatus;
948
949    u8_t                    disableProbingWithSsid;
950#ifdef ZM_ENABLE_CENC
951    /* CENC */
952    u8_t                    cencIe[ZM_MAX_IE_SIZE + 2];
953#endif //ZM_ENABLE_CENC
954    u32_t txiv[4];  //Tx PN Sequence
955    u32_t rxiv[4];  //Rx PN Sequence
956    u32_t rxivGK[4];//Broadcast Rx PN Sequence
957    u8_t  wepKey[4][32];    // For Software WEP
958	u8_t  SWEncryMode[4];
959
960    /* 802.11d */
961    u8_t b802_11D;
962
963    /* 802.11h */
964    u8_t TPCEnable;
965    u8_t DFSEnable;
966    u8_t DFSDisableTx;
967
968    /* Owl AP */
969    u8_t athOwlAp;
970
971    /* Enable BA response in driver */
972    u8_t enableDrvBA;
973
974    /* HT Capability Info */
975    union zuHTCapability HTCap; //CWYang(+)
976
977    /* Extended HT Capability Info */
978    union zuExtHTCapability ExtHTCap; //CWYang(+)
979
980    struct InformationElementSta   ie;
981
982#define ZM_CACHED_FRAMEBODY_SIZE   200
983    u8_t                    asocReqFrameBody[ZM_CACHED_FRAMEBODY_SIZE];
984    u16_t                   asocReqFrameBodySize;
985    u8_t                    asocRspFrameBody[ZM_CACHED_FRAMEBODY_SIZE];
986    u16_t                   asocRspFrameBodySize;
987    u8_t                    beaconFrameBody[ZM_CACHED_FRAMEBODY_SIZE];
988    u16_t                   beaconFrameBodySize;
989
990    u8_t                    ac0PriorityHigherThanAc2;
991    u8_t                    SWEncryptEnable;
992
993    u8_t                    leapEnabled;
994
995    u32_t                    TotalNumberOfReceivePackets;
996    u32_t                    TotalNumberOfReceiveBytes;
997    u32_t                    avgSizeOfReceivePackets;
998
999    u32_t                    ReceivedPacketRateCounter;
1000    u32_t                    ReceivedPktRatePerSecond;
1001
1002    /* #2 Record the sequence number to determine whether the unicast frame is separated by RIFS or not */
1003#define    ZM_RIFS_STATE_DETECTING    0
1004#define    ZM_RIFS_STATE_DETECTED     1
1005#define    ZM_RIFS_TIMER_TIMEOUT      4480          // <Driver time>4480ms <Real time>7s
1006    u8_t                    rifsState;
1007    u8_t                    rifsLikeFrameCnt;
1008    u16_t                   rifsLikeFrameSequence[3];
1009    u32_t                   rifsTimer;
1010    u32_t                   rifsCount;
1011
1012    /* RX filter desired by upper layers.  Note this contains some bits which must be filtered
1013       by sw since the hw supports only a subset of possible filter actions.= */
1014    u32_t  osRxFilter;
1015
1016    u8_t   bSafeMode;
1017
1018    u32_t  ibssAdditionalIESize;
1019    u8_t   ibssAdditionalIE[256];
1020}; //struct zsWlanDevSta
1021
1022#define ZM_CMD_QUEUE_SIZE                   256  //Roger Check, test 64 when ready
1023
1024#define ZM_OID_READ                         1
1025#define ZM_OID_WRITE                        2
1026#define ZM_OID_INTERNAL_WRITE               3
1027#define ZM_CMD_SET_FREQUENCY                4
1028#define ZM_CMD_SET_KEY                      5
1029#define ZM_CWM_READ                         6
1030#define ZM_MAC_READ                         7
1031#define ZM_ANI_READ                         8
1032#define ZM_EEPROM_READ                      9
1033#define ZM_EEPROM_WRITE                     0x0A
1034#define ZM_OID_CHAN							0x30
1035#define ZM_OID_SYNTH						0x32
1036#define ZM_OID_TALLY						0x81
1037#define ZM_OID_TALLY_APD					0x82
1038
1039#define ZM_OID_DKTX_STATUS                  0x92
1040#define ZM_OID_FLASH_CHKSUM                 0xD0
1041#define ZM_OID_FLASH_READ                   0xD1
1042#define ZM_OID_FLASH_PROGRAM                0xD2
1043#define ZM_OID_FW_DL_INIT                   0xD3
1044
1045/* Driver to Firmware OID */
1046#define ZM_CMD_ECHO         0x80
1047#define ZM_CMD_TALLY        0x81
1048#define ZM_CMD_TALLY_APD    0x82
1049#define ZM_CMD_CONFIG       0x83
1050#define ZM_CMD_RREG         0x00
1051#define ZM_CMD_WREG         0x01
1052#define ZM_CMD_RMEM         0x02
1053#define ZM_CMD_WMEM         0x03
1054#define ZM_CMD_BITAND       0x04
1055#define ZM_CMD_BITOR        0x05
1056#define ZM_CMD_EKEY         0x28
1057#define ZM_CMD_DKEY         0x29
1058#define ZM_CMD_FREQUENCY    0x30
1059#define ZM_CMD_RF_INIT      0x31
1060#define ZM_CMD_SYNTH        0x32
1061#define ZM_CMD_FREQ_STRAT   0x33
1062#define ZM_CMD_RESET        0x90
1063#define ZM_CMD_DKRESET      0x91
1064#define ZM_CMD_DKTX_STATUS  0x92
1065#define ZM_CMD_FDC          0xA0
1066#define ZM_CMD_WREEPROM     0xB0
1067#define ZM_CMD_WFLASH       0xB0
1068#define ZM_CMD_FLASH_ERASE  0xB1
1069#define ZM_CMD_FLASH_PROG   0xB2
1070#define ZM_CMD_FLASH_CHKSUM 0xB3
1071#define ZM_CMD_FLASH_READ   0xB4
1072#define ZM_CMD_FW_DL_INIT   0xB5
1073#define ZM_CMD_MEM_WREEPROM 0xBB
1074
1075
1076/* duplicate filter table column */
1077#define ZM_FILTER_TABLE_COL                 2 /* 2^n */
1078/* duplicate filter table Row */
1079#define ZM_FILTER_TABLE_ROW                 8 /* 2^n */
1080
1081/* duplicate filter table structure */
1082struct zsRxFilter
1083{
1084    u16_t addr[3];
1085    u16_t seq;
1086    u8_t up;
1087};
1088
1089struct zsWlanDev
1090{
1091    /* AP global variables */
1092    struct zsWlanDevAp ap;
1093    /* STA global variables */
1094    struct zsWlanDevSta sta;
1095    /* save wrapper setting */
1096    struct zsWrapperSetting ws;
1097    /* features determined by wrapper (vendor) */
1098    struct zsWrapperFeatureCtrl wfc;
1099    /* Traffic Monitor tally */
1100    struct zsTrafTally trafTally;
1101    /* Communication tally */
1102    struct zsCommTally commTally;
1103    /* Duplicate frame filter table */
1104    struct zsRxFilter rxFilterTbl[ZM_FILTER_TABLE_COL][ZM_FILTER_TABLE_ROW];
1105    /* Regulatory table */
1106    struct zsRegulationTable  regulationTable;
1107
1108    /* */
1109    struct zsWlanDevFreqControl freqCtrl;
1110
1111    enum devState state;
1112
1113    u8_t  halState;
1114    u8_t  wlanMode;         /* AP/INFRASTRUCTURE/IBSS/PSEUDO */
1115    u16_t macAddr[3];       /* MAC address */
1116    u16_t beaconInterval;   /* beacon Interval */
1117    u8_t dtim;              /* DTIM period */
1118    u8_t            CurrentDtimCount;
1119    u8_t  preambleType;
1120    u8_t  preambleTypeInUsed;
1121    u8_t  maxTxPower2;	    /* 2.4 GHz Max Tx power (Unit: 0.5 dBm) */
1122    u8_t  maxTxPower5;	    /* 5 GHz Max Tx power (Unit: 0.5 dBm) */
1123    u8_t  connectMode;
1124    u32_t supportMode;
1125
1126    u8_t bRate;             /* 11b Support Rate bit map */
1127    u8_t bRateBasic;        /* 11b Basic Rate bit map */
1128    u8_t gRate;             /* 11g Support Rate bit map */
1129    u8_t gRateBasic;        /* 11g Basic Rate bit map */
1130    /* channel index point to the item in regulation table */
1131    u8_t channelIndex;
1132
1133    /* channel management */
1134    u8_t    BandWidth40;
1135    u8_t    ExtOffset;      //1 above, 3 below, 0 not present
1136    u16_t   frequency;      /* operation frequency */
1137
1138    u8_t erpElement;        /* ERP information element data */
1139
1140    u8_t disableSelfCts;    /* set to 1 to disable Self-CTS */
1141    u8_t bgMode;
1142
1143	/* private test flag */
1144    u32_t enableProtectionMode;   /* force enable/disable self cts */
1145	u32_t checksumTest;     /* OTUS checksum test 1=>zero checksum 0=>normal */
1146	u32_t rxPacketDump;     /* rx packet dump */
1147
1148    u8_t enableAggregation; /* force enable/disable A-MSPU */
1149    u8_t enableWDS;         /* force enable/disable WDS testing */
1150	u8_t enableTxPathMode;  /* OTUS special testing mode 1=>diable, 0=>enable: ZM_SYSTEM_TEST_MODE */
1151    u8_t enableHALDbgInfo;  /*  */
1152
1153    u32_t forceTxTPC;       /* force tx packet send TPC */
1154
1155    u16_t seq[4];
1156    u16_t mmseq;
1157
1158    /* driver core time tick */
1159    u32_t tick;
1160    u16_t tickIbssSendBeacon;
1161    u16_t tickIbssReceiveBeacon;
1162
1163    /* RTS threshold */
1164    u16_t rtsThreshold;
1165
1166    /* fragmentation threshold,  256 <= value <= 2346, 0=disabled */
1167    u16_t fragThreshold;
1168
1169    /* Tx Rate */
1170    u16_t txMCS;
1171    u16_t txMT;
1172    u32_t CurrentTxRateKbps; //CWYang(+)
1173    /* Rx Rate */
1174    u32_t CurrentRxRateKbps; //Janet(+)
1175    u8_t CurrentRxRateUpdated;
1176    u8_t modulationType;
1177    u8_t rxInfo;
1178    u16_t rateField;
1179
1180    /* timer related objects */
1181    struct zsTimerList  timerList;
1182    u8_t                bTimerReady;
1183
1184    /* for defragmentation */
1185    struct zsDefragList defragTable;
1186
1187    /* Data struct for Interface Dependent Layer */
1188    //struct zsIdlStruct idlStruct;
1189
1190    /* Signal Strength/Quality Related Parameters */
1191    u8_t SignalStrength; //CWYang(+)
1192    u8_t SignalQuality;  //CWYang(+)
1193
1194
1195
1196    /* QoS */
1197    zbuf_t* vtxq[4][ZM_VTXQ_SIZE];
1198    u16_t vtxqHead[4];
1199    u16_t vtxqTail[4];
1200    u16_t qosDropIpFrag[4];
1201
1202    /* Management Tx queue */
1203    zbuf_t* vmmq[ZM_VMMQ_SIZE];
1204    u16_t vmmqHead;
1205    u16_t vmmqTail;
1206
1207    u8_t                vtxqPushing;
1208
1209    /*
1210     * add by honda
1211     * 1. Aggregate queues
1212     * 2. STA's associated information and queue number
1213     * 3. rx aggregation re-ordering queue
1214     */
1215    struct aggQueue    *aggQPool[ZM_AGG_POOL_SIZE];
1216    u8_t                aggInitiated;
1217    u8_t                addbaComplete;
1218    u8_t                addbaCount;
1219    u8_t                aggState;
1220    u8_t                destLock;
1221    struct aggSta       aggSta[ZM_MAX_STA_SUPPORT];
1222    struct agg_tid_rx  *tid_rx[ZM_AGG_POOL_SIZE];
1223    struct aggTally     agg_tal;
1224    struct destQ        destQ;
1225    struct baw_enabler *baw_enabler;
1226    struct ieee80211_cwm    cwm;
1227    u16_t               reorder;
1228    u16_t               seq_debug;
1229    /* rate control */
1230    u32_t txMPDU[ZM_RATE_TABLE_SIZE];
1231    u32_t txFail[ZM_RATE_TABLE_SIZE];
1232    u32_t PER[ZM_RATE_TABLE_SIZE];
1233    u16_t probeCount;
1234    u16_t probeSuccessCount;
1235    u16_t probeInterval;
1236    u16_t success_probing;
1237    /*
1238     * end of add by honda
1239     */
1240
1241    /* airopeek sniffer mode for upper sw */
1242    u32_t               swSniffer;   /* window: airoPeek */
1243    u32_t               XLinkMode;
1244
1245    /* MDK mode */
1246    /* init by 0=>normal driver 1=>MDK driver */
1247    u32_t               modeMDKEnable;
1248
1249    u32_t               heartBeatNotification;
1250
1251    /* pointer for HAL Plus private memory */
1252    void* hpPrivate;
1253
1254    /* for WPA setting */
1255    //u8_t                    wpaSupport[ZM_MAX_AP_SUPPORT];
1256    //u8_t                    wpaLen[ZM_MAX_AP_SUPPORT];
1257    //u8_t                    wpaIe[ZM_MAX_AP_SUPPORT][ZM_MAX_IE_SIZE];
1258
1259    struct zsLedStruct      ledStruct;
1260
1261    /* ani flag */
1262    u8_t aniEnable;
1263    u16_t txq_threshold;
1264
1265	//Skip Mic Error Check
1266	u8_t	TKIP_Group_KeyChanging;
1267
1268	u8_t    dynamicSIFSEnable;
1269
1270	u8_t    queueFlushed;
1271
1272    u16_t (*zfcbAuthNotify)(zdev_t* dev, u16_t* macAddr);
1273    u16_t (*zfcbAsocNotify)(zdev_t* dev, u16_t* macAddr, u8_t* body, u16_t bodySize, u16_t port);
1274    u16_t (*zfcbDisAsocNotify)(zdev_t* dev, u8_t* macAddr, u16_t port);
1275    u16_t (*zfcbApConnectNotify)(zdev_t* dev, u8_t* macAddr, u16_t port);
1276    void (*zfcbConnectNotify)(zdev_t* dev, u16_t status, u16_t* bssid);
1277    void (*zfcbScanNotify)(zdev_t* dev, struct zsScanResult* result);
1278    void (*zfcbMicFailureNotify)(zdev_t* dev, u16_t* addr, u16_t status);
1279    void (*zfcbApMicFailureNotify)(zdev_t* dev, u8_t* addr, zbuf_t* buf);
1280    void (*zfcbIbssPartnerNotify)(zdev_t* dev, u16_t status, struct zsPartnerNotifyEvent *event);
1281    void (*zfcbMacAddressNotify)(zdev_t* dev, u8_t* addr);
1282    void (*zfcbSendCompleteIndication)(zdev_t* dev, zbuf_t* buf);
1283    void (*zfcbRecvEth)(zdev_t* dev, zbuf_t* buf, u16_t port);
1284    void (*zfcbRecv80211)(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo);
1285    void (*zfcbRestoreBufData)(zdev_t* dev, zbuf_t* buf);
1286#ifdef ZM_ENABLE_CENC
1287    u16_t (*zfcbCencAsocNotify)(zdev_t* dev, u16_t* macAddr, u8_t* body,
1288            u16_t bodySize, u16_t port);
1289#endif //ZM_ENABLE_CENC
1290    u8_t (*zfcbClassifyTxPacket)(zdev_t* dev, zbuf_t* buf);
1291    void (*zfcbHwWatchDogNotify)(zdev_t* dev);
1292};
1293
1294
1295struct zsWlanKey
1296{
1297    u8_t key;
1298};
1299
1300
1301/* These macros are defined here for backward compatibility */
1302/* Please leave them alone */
1303/* For Tx packet allocated in upper layer layer */
1304#define zmw_tx_buf_readb(dev, buf, offset) zmw_buf_readb(dev, buf, offset)
1305#define zmw_tx_buf_readh(dev, buf, offset) zmw_buf_readh(dev, buf, offset)
1306#define zmw_tx_buf_writeb(dev, buf, offset, value) zmw_buf_writeb(dev, buf, offset, value)
1307#define zmw_tx_buf_writeh(dev, buf, offset, value) zmw_buf_writeh(dev, buf, offset, value)
1308
1309/* For Rx packet allocated in driver */
1310#define zmw_rx_buf_readb(dev, buf, offset) zmw_buf_readb(dev, buf, offset)
1311#define zmw_rx_buf_readh(dev, buf, offset) zmw_buf_readh(dev, buf, offset)
1312#define zmw_rx_buf_writeb(dev, buf, offset, value) zmw_buf_writeb(dev, buf, offset, value)
1313#define zmw_rx_buf_writeh(dev, buf, offset, value) zmw_buf_writeh(dev, buf, offset, value)
1314
1315#endif /* #ifndef _STRUCT_H */
1316