]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/rtl8723au/include/rtw_mlme_ext.h
Merge branch 'for-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata
[karo-tx-linux.git] / drivers / staging / rtl8723au / include / rtw_mlme_ext.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  ******************************************************************************/
15 #ifndef __RTW_MLME_EXT_H_
16 #define __RTW_MLME_EXT_H_
17
18 #include <osdep_service.h>
19 #include <drv_types.h>
20 #include <wlan_bssdef.h>
21
22
23 /*      Commented by Albert 20101105 */
24 /*      Increase the SURVEY_TO value from 100 to 150  ( 100ms to 150ms ) */
25 /*      The Realtek 8188CE SoftAP will spend around 100ms to send the probe response after receiving the probe request. */
26 /*      So, this driver tried to extend the dwell time for each scanning channel. */
27 /*      This will increase the chance to receive the probe response from SoftAP. */
28
29 #define SURVEY_TO               (100)
30 #define REAUTH_TO               (300) /* 50) */
31 #define REASSOC_TO              (300) /* 50) */
32 /* define DISCONNECT_TO (3000) */
33 #define ADDBA_TO                        (2000)
34
35 #define LINKED_TO (1) /* unit:2 sec, 1x2=2 sec */
36
37 #define REAUTH_LIMIT    (4)
38 #define REASSOC_LIMIT   (4)
39 #define READDBA_LIMIT   (2)
40
41 #define ROAMING_LIMIT   8
42
43 #define DYNAMIC_FUNC_DISABLE                    (0x0)
44
45 /*  ====== enum odm_ability ======== */
46 /*  BB ODM section BIT 0-15 */
47 #define DYNAMIC_BB_DIG                          BIT(0)
48 #define DYNAMIC_BB_RA_MASK                      BIT(1)
49 #define DYNAMIC_BB_DYNAMIC_TXPWR        BIT(2)
50 #define DYNAMIC_BB_BB_FA_CNT                    BIT(3)
51
52 #define         DYNAMIC_BB_RSSI_MONITOR         BIT(4)
53 #define         DYNAMIC_BB_CCK_PD                       BIT(5)
54 #define         DYNAMIC_BB_ANT_DIV                      BIT(6)
55 #define         DYNAMIC_BB_PWR_SAVE                     BIT(7)
56 #define         DYNAMIC_BB_PWR_TRAIN                    BIT(8)
57 #define         DYNAMIC_BB_RATE_ADAPTIVE                BIT(9)
58 #define         DYNAMIC_BB_PATH_DIV                     BIT(10)
59 #define         DYNAMIC_BB_PSD                          BIT(11)
60
61 /*  MAC DM section BIT 16-23 */
62 #define         DYNAMIC_MAC_struct edca_turboURBO               BIT(16)
63 #define         DYNAMIC_MAC_EARLY_MODE          BIT(17)
64
65 /*  RF ODM section BIT 24-31 */
66 #define         DYNAMIC_RF_TX_PWR_TRACK         BIT(24)
67 #define         DYNAMIC_RF_RX_GAIN_TRACK                BIT(25)
68 #define         DYNAMIC_RF_CALIBRATION          BIT(26)
69
70 #define         DYNAMIC_ALL_FUNC_ENABLE         0xFFFFFFF
71
72 #define _HW_STATE_NOLINK_               0x00
73 #define _HW_STATE_ADHOC_                0x01
74 #define _HW_STATE_STATION_      0x02
75 #define _HW_STATE_AP_                   0x03
76
77
78 #define         _1M_RATE_       0
79 #define         _2M_RATE_       1
80 #define         _5M_RATE_       2
81 #define         _11M_RATE_      3
82 #define         _6M_RATE_       4
83 #define         _9M_RATE_       5
84 #define         _12M_RATE_      6
85 #define         _18M_RATE_      7
86 #define         _24M_RATE_      8
87 #define         _36M_RATE_      9
88 #define         _48M_RATE_      10
89 #define         _54M_RATE_      11
90
91
92 extern unsigned char WMM_OUI23A[];
93 extern unsigned char WPS_OUI23A[];
94 extern unsigned char WFD_OUI23A[];
95 extern unsigned char P2P_OUI23A[];
96
97 extern unsigned char WMM_INFO_OUI23A[];
98 extern unsigned char WMM_PARA_OUI23A[];
99
100
101 /*  */
102 /*  Channel Plan Type. */
103 /*  Note: */
104 /*      We just add new channel plan when the new channel plan is different from any of the following */
105 /*      channel plan. */
106 /*      If you just wnat to customize the acitions(scan period or join actions) about one of the channel plan, */
107 /*      customize them in struct rt_channel_info in the RT_CHANNEL_LIST. */
108 /*  */
109 enum  { /* _RT_CHANNEL_DOMAIN */
110         /*  old channel plan mapping ===== */
111         RT_CHANNEL_DOMAIN_FCC = 0x00,
112         RT_CHANNEL_DOMAIN_IC = 0x01,
113         RT_CHANNEL_DOMAIN_ETSI = 0x02,
114         RT_CHANNEL_DOMAIN_SPAIN = 0x03,
115         RT_CHANNEL_DOMAIN_FRANCE = 0x04,
116         RT_CHANNEL_DOMAIN_MKK = 0x05,
117         RT_CHANNEL_DOMAIN_MKK1 = 0x06,
118         RT_CHANNEL_DOMAIN_ISRAEL = 0x07,
119         RT_CHANNEL_DOMAIN_TELEC = 0x08,
120         RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN = 0x09,
121         RT_CHANNEL_DOMAIN_WORLD_WIDE_13 = 0x0A,
122         RT_CHANNEL_DOMAIN_TAIWAN = 0x0B,
123         RT_CHANNEL_DOMAIN_CHINA = 0x0C,
124         RT_CHANNEL_DOMAIN_SINGAPORE_INDIA_MEXICO = 0x0D,
125         RT_CHANNEL_DOMAIN_KOREA = 0x0E,
126         RT_CHANNEL_DOMAIN_TURKEY = 0x0F,
127         RT_CHANNEL_DOMAIN_JAPAN = 0x10,
128         RT_CHANNEL_DOMAIN_FCC_NO_DFS = 0x11,
129         RT_CHANNEL_DOMAIN_JAPAN_NO_DFS = 0x12,
130         RT_CHANNEL_DOMAIN_WORLD_WIDE_5G = 0x13,
131         RT_CHANNEL_DOMAIN_TAIWAN_NO_DFS = 0x14,
132
133         /*  new channel plan mapping, (2GDOMAIN_5GDOMAIN) ===== */
134         RT_CHANNEL_DOMAIN_WORLD_NULL = 0x20,
135         RT_CHANNEL_DOMAIN_ETSI1_NULL = 0x21,
136         RT_CHANNEL_DOMAIN_FCC1_NULL = 0x22,
137         RT_CHANNEL_DOMAIN_MKK1_NULL = 0x23,
138         RT_CHANNEL_DOMAIN_ETSI2_NULL = 0x24,
139         RT_CHANNEL_DOMAIN_FCC1_FCC1 = 0x25,
140         RT_CHANNEL_DOMAIN_WORLD_ETSI1 = 0x26,
141         RT_CHANNEL_DOMAIN_MKK1_MKK1 = 0x27,
142         RT_CHANNEL_DOMAIN_WORLD_KCC1 = 0x28,
143         RT_CHANNEL_DOMAIN_WORLD_FCC2 = 0x29,
144         RT_CHANNEL_DOMAIN_WORLD_FCC3 = 0x30,
145         RT_CHANNEL_DOMAIN_WORLD_FCC4 = 0x31,
146         RT_CHANNEL_DOMAIN_WORLD_FCC5 = 0x32,
147         RT_CHANNEL_DOMAIN_WORLD_FCC6 = 0x33,
148         RT_CHANNEL_DOMAIN_FCC1_FCC7 = 0x34,
149         RT_CHANNEL_DOMAIN_WORLD_ETSI2 = 0x35,
150         RT_CHANNEL_DOMAIN_WORLD_ETSI3 = 0x36,
151         RT_CHANNEL_DOMAIN_MKK1_MKK2 = 0x37,
152         RT_CHANNEL_DOMAIN_MKK1_MKK3 = 0x38,
153         RT_CHANNEL_DOMAIN_FCC1_NCC1 = 0x39,
154         RT_CHANNEL_DOMAIN_FCC1_NCC2 = 0x40,
155         RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN_2G = 0x41,
156         /*  Add new channel plan above this line=============== */
157         RT_CHANNEL_DOMAIN_MAX,
158         RT_CHANNEL_DOMAIN_REALTEK_DEFINE = 0x7F,
159 };
160
161 enum { /* _RT_CHANNEL_DOMAIN_2G */
162         RT_CHANNEL_DOMAIN_2G_WORLD = 0x00,              /* Worldwird 13 */
163         RT_CHANNEL_DOMAIN_2G_ETSI1 = 0x01,              /* Europe */
164         RT_CHANNEL_DOMAIN_2G_FCC1 = 0x02,               /* US */
165         RT_CHANNEL_DOMAIN_2G_MKK1 = 0x03,               /* Japan */
166         RT_CHANNEL_DOMAIN_2G_ETSI2 = 0x04,              /* France */
167         RT_CHANNEL_DOMAIN_2G_NULL = 0x05,
168         /*  Add new channel plan above this line=============== */
169         RT_CHANNEL_DOMAIN_2G_MAX,
170 };
171
172 enum { /* _RT_CHANNEL_DOMAIN_5G */
173         RT_CHANNEL_DOMAIN_5G_NULL = 0x00,
174         RT_CHANNEL_DOMAIN_5G_ETSI1 = 0x01,              /* Europe */
175         RT_CHANNEL_DOMAIN_5G_ETSI2 = 0x02,              /* Australia, New Zealand */
176         RT_CHANNEL_DOMAIN_5G_ETSI3 = 0x03,              /* Russia */
177         RT_CHANNEL_DOMAIN_5G_FCC1 = 0x04,               /* US */
178         RT_CHANNEL_DOMAIN_5G_FCC2 = 0x05,               /* FCC o/w DFS Channels */
179         RT_CHANNEL_DOMAIN_5G_FCC3 = 0x06,               /* India, Mexico */
180         RT_CHANNEL_DOMAIN_5G_FCC4 = 0x07,               /* Venezuela */
181         RT_CHANNEL_DOMAIN_5G_FCC5 = 0x08,               /* China */
182         RT_CHANNEL_DOMAIN_5G_FCC6 = 0x09,               /* Israel */
183         RT_CHANNEL_DOMAIN_5G_FCC7_IC1 = 0x0A,   /* US, Canada */
184         RT_CHANNEL_DOMAIN_5G_KCC1 = 0x0B,               /* Korea */
185         RT_CHANNEL_DOMAIN_5G_MKK1 = 0x0C,               /* Japan */
186         RT_CHANNEL_DOMAIN_5G_MKK2 = 0x0D,               /* Japan (W52, W53) */
187         RT_CHANNEL_DOMAIN_5G_MKK3 = 0x0E,               /* Japan (W56) */
188         RT_CHANNEL_DOMAIN_5G_NCC1 = 0x0F,               /* Taiwan */
189         RT_CHANNEL_DOMAIN_5G_NCC2 = 0x10,               /* Taiwan o/w DFS */
190         /*  Add new channel plan above this line=============== */
191         /*  Driver Self Defined ===== */
192         RT_CHANNEL_DOMAIN_5G_FCC = 0x11,
193         RT_CHANNEL_DOMAIN_5G_JAPAN_NO_DFS = 0x12,
194         RT_CHANNEL_DOMAIN_5G_FCC4_NO_DFS = 0x13,
195         RT_CHANNEL_DOMAIN_5G_MAX,
196 };
197
198 #define rtw_is_channel_plan_valid(chplan) (chplan<RT_CHANNEL_DOMAIN_MAX || chplan == RT_CHANNEL_DOMAIN_REALTEK_DEFINE)
199
200 struct rt_channel_plan {
201         unsigned char   Channel[MAX_CHANNEL_NUM];
202         unsigned char   Len;
203 };
204
205 struct rt_channel_plan_2g {
206         unsigned char   Channel[MAX_CHANNEL_NUM_2G];
207         unsigned char   Len;
208 };
209
210 struct rt_channel_plan_5g {
211         unsigned char   Channel[MAX_CHANNEL_NUM_5G];
212         unsigned char   Len;
213 };
214
215 struct rt_channel_plan_map {
216         unsigned char   Index2G;
217         unsigned char   Index5G;
218 };
219
220 enum Associated_AP {
221         atherosAP       = 0,
222         broadcomAP      = 1,
223         ciscoAP         = 2,
224         marvellAP       = 3,
225         ralinkAP        = 4,
226         realtekAP       = 5,
227         airgocapAP      = 6,
228         unknownAP       = 7,
229         maxAP,
230 };
231
232 enum { /* HT_IOT_PEER_E */
233         HT_IOT_PEER_UNKNOWN             = 0,
234         HT_IOT_PEER_REALTEK             = 1,
235         HT_IOT_PEER_REALTEK_92SE        = 2,
236         HT_IOT_PEER_BROADCOM            = 3,
237         HT_IOT_PEER_RALINK              = 4,
238         HT_IOT_PEER_ATHEROS             = 5,
239         HT_IOT_PEER_CISCO               = 6,
240         HT_IOT_PEER_MERU                = 7,
241         HT_IOT_PEER_MARVELL             = 8,
242         HT_IOT_PEER_REALTEK_SOFTAP      = 9,/*  peer is RealTek SOFT_AP, by Bohn, 2009.12.17 */
243         HT_IOT_PEER_SELF_SOFTAP         = 10, /*  Self is SoftAP */
244         HT_IOT_PEER_AIRGO               = 11,
245         HT_IOT_PEER_INTEL               = 12,
246         HT_IOT_PEER_RTK_APCLIENT        = 13,
247         HT_IOT_PEER_REALTEK_81XX        = 14,
248         HT_IOT_PEER_REALTEK_WOW         = 15,
249         HT_IOT_PEER_TENDA               = 16,
250         HT_IOT_PEER_MAX                 = 17
251 };
252
253 enum SCAN_STATE {
254         SCAN_DISABLE = 0,
255         SCAN_START = 1,
256         SCAN_TXNULL = 2,
257         SCAN_PROCESS = 3,
258         SCAN_COMPLETE = 4,
259         SCAN_STATE_MAX,
260 };
261
262 struct mlme_handler {
263         char *str;
264         int (*func)(struct rtw_adapter *padapter, struct recv_frame *precv_frame);
265 };
266
267 struct action_handler {
268         unsigned int   num;
269         char* str;
270         int (*func)(struct rtw_adapter *padapter, struct recv_frame *precv_frame);
271 };
272
273 struct  ss_res
274 {
275         int     state;
276         int     bss_cnt;
277         int     channel_idx;
278         int     scan_mode;
279         u8 ssid_num;
280         u8 ch_num;
281         struct cfg80211_ssid ssid[RTW_SSID_SCAN_AMOUNT];
282         struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT];
283 };
284
285 /* define AP_MODE                               0x0C */
286 /* define STATION_MODE  0x08 */
287 /* define AD_HOC_MODE           0x04 */
288 /* define NO_LINK_MODE  0x00 */
289
290 #define         WIFI_FW_NULL_STATE                      _HW_STATE_NOLINK_
291 #define WIFI_FW_STATION_STATE           _HW_STATE_STATION_
292 #define WIFI_FW_AP_STATE                                _HW_STATE_AP_
293 #define WIFI_FW_ADHOC_STATE                     _HW_STATE_ADHOC_
294
295 #define WIFI_FW_AUTH_NULL                       0x00000100
296 #define WIFI_FW_AUTH_STATE                      0x00000200
297 #define WIFI_FW_AUTH_SUCCESS                    0x00000400
298
299 #define WIFI_FW_ASSOC_STATE                     0x00002000
300 #define WIFI_FW_ASSOC_SUCCESS           0x00004000
301
302 #define WIFI_FW_LINKING_STATE           (WIFI_FW_AUTH_NULL | WIFI_FW_AUTH_STATE | WIFI_FW_AUTH_SUCCESS |WIFI_FW_ASSOC_STATE)
303
304 struct FW_Sta_Info {
305         struct sta_info *psta;
306         u32     status;
307         u32     rx_pkt;
308         u32     retry;
309         unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
310 };
311
312 /*
313  * Usage:
314  * When one iface acted as AP mode and the other iface is STA mode and scanning,
315  * it should switch back to AP's operating channel periodically.
316  * Parameters info:
317  * When the driver scanned RTW_SCAN_NUM_OF_CH channels, it would switch back to AP's operating channel for
318  * RTW_STAY_AP_CH_MILLISECOND * SURVEY_TO milliseconds.
319  * Example:
320  * For chip supports 2.4G + 5GHz and AP mode is operating in channel 1,
321  * RTW_SCAN_NUM_OF_CH is 8, RTW_STAY_AP_CH_MILLISECOND is 3 and SURVEY_TO is 100.
322  * When it's STA mode gets set_scan command,
323  * it would
324  * 1. Doing the scan on channel 1.2.3.4.5.6.7.8
325  * 2. Back to channel 1 for 300 milliseconds
326  * 3. Go through doing site survey on channel 9.10.11.36.40.44.48.52
327  * 4. Back to channel 1 for 300 milliseconds
328  * 5. ... and so on, till survey done.
329  */
330
331 struct mlme_ext_info
332 {
333         u32     state;
334         u32     reauth_count;
335         u32     reassoc_count;
336         u32     link_count;
337         u32     auth_seq;
338         u32     auth_algo;      /*  802.11 auth, could be open, shared, auto */
339         u32     authModeToggle;
340         u32     enc_algo;/* encrypt algorithm; */
341         u32     key_index;      /*  this is only valid for legendary wep, 0~3 for key id. */
342         u32     iv;
343         u8      chg_txt[128];
344         u16     aid;
345         u16     bcn_interval;
346         u16     capability;
347         u8      assoc_AP_vendor;
348         u8      slotTime;
349         u8      preamble_mode;
350         u8      WMM_enable;
351         u8      ERP_enable;
352         u8      ERP_IE;
353         u8      HT_enable;
354         u8      HT_caps_enable;
355         u8      HT_info_enable;
356         u8      HT_protection;
357         u8      turboMode_cts2self;
358         u8      turboMode_rtsen;
359         u8      SM_PS;
360         u8      ADDBA_retry_count;
361         u8      dialogToken;
362         /*  Accept ADDBA Request */
363         bool bAcceptAddbaReq;
364         u8      bwmode_updated;
365         u8      hidden_ssid_mode;
366
367         struct ADDBA_request            ADDBA_req;
368         struct WMM_para_element WMM_param;
369         struct HT_caps_element  HT_caps;
370         struct HT_info_element          HT_info;
371         struct wlan_bssid_ex                    network;/* join network or bss_network, if in ap mode, it is the same to cur_network.network */
372         struct FW_Sta_Info              FW_sta_info[NUM_STA];
373 };
374
375 /*  The channel information about this channel including joining, scanning, and power constraints. */
376 struct rt_channel_info {
377         u8              ChannelNum;             /*  The channel number. */
378         enum rt_scan_type ScanType;             /*  Scan type such as passive or active scan. */
379 };
380
381 int rtw_ch_set_search_ch23a(struct rt_channel_info *ch_set, const u32 ch);
382
383 /*  P2P_MAX_REG_CLASSES - Maximum number of regulatory classes */
384 #define P2P_MAX_REG_CLASSES 10
385
386 /*  P2P_MAX_REG_CLASS_CHANNELS - Maximum number of channels per regulatory class */
387 #define P2P_MAX_REG_CLASS_CHANNELS 20
388
389 /*   struct p2p_channels - List of supported channels */
390 struct p2p_channels {
391         /*  struct p2p_reg_class - Supported regulatory class */
392         struct p2p_reg_class {
393                 /*  reg_class - Regulatory class (IEEE 802.11-2007, Annex J) */
394                 u8 reg_class;
395
396                 /*  channel - Supported channels */
397                 u8 channel[P2P_MAX_REG_CLASS_CHANNELS];
398
399                 /*  channels - Number of channel entries in use */
400                 size_t channels;
401         } reg_class[P2P_MAX_REG_CLASSES];
402
403         /*  reg_classes - Number of reg_class entries in use */
404         size_t reg_classes;
405 };
406
407 struct p2p_oper_class_map {
408         enum hw_mode {IEEE80211G,IEEE80211A} mode;
409         u8 op_class;
410         u8 min_chan;
411         u8 max_chan;
412         u8 inc;
413         enum {
414                 BW20, BW40PLUS, BW40MINUS
415         } bw;
416 };
417
418 struct mlme_ext_priv {
419         struct rtw_adapter      *padapter;
420         u8      mlmeext_init;
421         atomic_t                event_seq;
422         u16     mgnt_seq;
423
424         /* struct fw_priv       fwpriv; */
425
426         unsigned char   cur_channel;
427         unsigned char   cur_bwmode;
428         unsigned char   cur_ch_offset;/* PRIME_CHNL_OFFSET */
429         unsigned char   cur_wireless_mode;      /*  NETWORK_TYPE */
430
431         unsigned char   max_chan_nums;
432         struct rt_channel_info          channel_set[MAX_CHANNEL_NUM];
433         struct p2p_channels channel_list;
434         unsigned char   basicrate[NumRates];
435         unsigned char   datarate[NumRates];
436
437         struct ss_res           sitesurvey_res;
438         struct mlme_ext_info    mlmext_info;/* for sta/adhoc mode, including current scanning/connecting/connected related info. */
439                                                      /* for ap mode, network includes ap's cap_info */
440         struct timer_list               survey_timer;
441         struct timer_list               link_timer;
442         u16                     chan_scan_time;
443
444         u8      scan_abort;
445         u8      tx_rate; /*  TXRATE when USERATE is set. */
446
447         u32     retry; /* retry for issue probereq */
448
449         u64 TSFValue;
450
451         unsigned char bstart_bss;
452         u8 update_channel_plan_by_ap_done;
453         /* recv_decache check for Action_public frame */
454         u8 action_public_dialog_token;
455         u16      action_public_rxseq;
456         u8 active_keep_alive_check;
457 };
458
459 int init_mlme_ext_priv23a(struct rtw_adapter* padapter);
460 int init_hw_mlme_ext23a(struct rtw_adapter *padapter);
461 void free_mlme_ext_priv23a (struct mlme_ext_priv *pmlmeext);
462 void init_mlme_ext_timer23a(struct rtw_adapter *padapter);
463 void init_addba_retry_timer23a(struct sta_info *psta);
464 struct xmit_frame *alloc_mgtxmitframe23a(struct xmit_priv *pxmitpriv);
465
466 unsigned char networktype_to_raid23a(unsigned char network_type);
467 u8 judge_network_type23a(struct rtw_adapter *padapter, unsigned char *rate,
468                       int ratelen);
469 void get_rate_set23a(struct rtw_adapter *padapter, unsigned char *pbssrate,
470                   int *bssrate_len);
471 void UpdateBrateTbl23a(struct rtw_adapter *padapter,u8 *mBratesOS);
472 void Update23aTblForSoftAP(u8 *bssrateset, u32 bssratelen);
473
474 void Set_MSR23a(struct rtw_adapter *padapter, u8 type);
475
476 u8 rtw_get_oper_ch23a(struct rtw_adapter *adapter);
477 void rtw_set_oper_ch23a(struct rtw_adapter *adapter, u8 ch);
478 u8 rtw_get_oper_bw23a(struct rtw_adapter *adapter);
479 void rtw_set_oper_bw23a(struct rtw_adapter *adapter, u8 bw);
480 u8 rtw_get_oper_ch23aoffset(struct rtw_adapter *adapter);
481 void rtw_set_oper_ch23aoffset23a(struct rtw_adapter *adapter, u8 offset);
482
483 void set_channel_bwmode23a(struct rtw_adapter *padapter, unsigned char channel,
484                         unsigned char channel_offset, unsigned short bwmode);
485 void SelectChannel23a(struct rtw_adapter *padapter, unsigned char channel);
486
487 unsigned int decide_wait_for_beacon_timeout23a(unsigned int bcn_interval);
488
489 void clear_cam_entry23a(struct rtw_adapter *padapter, u8 entry);
490
491 void invalidate_cam_all23a(struct rtw_adapter *padapter);
492
493 int allocate_fw_sta_entry23a(struct rtw_adapter *padapter);
494 void flush_all_cam_entry23a(struct rtw_adapter *padapter);
495
496 bool IsLegal5GChannel(struct rtw_adapter *Adapter, u8 channel);
497
498 int collect_bss_info23a(struct rtw_adapter *padapter,
499                         struct recv_frame *precv_frame,
500                         struct wlan_bssid_ex *bssid);
501 void update_network23a(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src,
502                     struct rtw_adapter *padapter, bool update_ie);
503
504 u8 *get_my_bssid23a(struct wlan_bssid_ex *pnetwork);
505 u16 get_beacon_interval23a(struct wlan_bssid_ex *bss);
506
507 bool is_client_associated_to_ap23a(struct rtw_adapter *padapter);
508 bool is_client_associated_to_ibss23a(struct rtw_adapter *padapter);
509 bool is_IBSS_empty23a(struct rtw_adapter *padapter);
510
511 unsigned char check_assoc_AP23a(u8 *pframe, uint len);
512
513 int WMM_param_handler23a(struct rtw_adapter *padapter, u8 *p);
514 void WMMOnAssocRsp23a(struct rtw_adapter *padapter);
515
516 void HT_caps_handler23a(struct rtw_adapter *padapter, u8 *p);
517 void HT_info_handler23a(struct rtw_adapter *padapter, u8 *p);
518 void HTOnAssocRsp23a(struct rtw_adapter *padapter);
519
520 void ERP_IE_handler23a(struct rtw_adapter *padapter, u8 *p);
521 void VCS_update23a(struct rtw_adapter *padapter, struct sta_info *psta);
522
523 void update_beacon23a_info(struct rtw_adapter *padapter, u8 *pframe, uint len,
524                         struct sta_info *psta);
525 int rtw_check_bcn_info23a(struct rtw_adapter *Adapter,
526                           struct ieee80211_mgmt *mgmt, u32 packet_len);
527 void update_IOT_info23a(struct rtw_adapter *padapter);
528 void update_capinfo23a(struct rtw_adapter *Adapter, u16 updateCap);
529 void update_wireless_mode23a(struct rtw_adapter * padapter);
530 void update_tx_basic_rate23a(struct rtw_adapter *padapter, u8 modulation);
531 void update_bmc_sta_support_rate23a(struct rtw_adapter *padapter, u32 mac_id);
532 int update_sta_support_rate23a(struct rtw_adapter *padapter, u8* pvar_ie,
533                             uint var_ie_len, int cam_idx);
534
535 /* for sta/adhoc mode */
536 void update_sta_info23a(struct rtw_adapter *padapter, struct sta_info *psta);
537 unsigned int update_basic_rate23a(unsigned char *ptn, unsigned int ptn_sz);
538 unsigned int update_supported_rate23a(unsigned char *ptn, unsigned int ptn_sz);
539 unsigned int update_MSC_rate23a(struct HT_caps_element *pHT_caps);
540 void Update_RA_Entry23a(struct rtw_adapter *padapter, struct sta_info *psta);
541 void set_sta_rate23a(struct rtw_adapter *padapter, struct sta_info *psta);
542
543 int receive_disconnect23a(struct rtw_adapter *padapter,
544                           unsigned char *MacAddr, unsigned short reason);
545
546 unsigned char get_highest_rate_idx23a(u32 mask);
547 int support_short_GI23a(struct rtw_adapter *padapter,
548                      struct HT_caps_element *pHT_caps);
549 bool is_ap_in_tkip23a(struct rtw_adapter *padapter);
550 bool is_ap_in_wep23a(struct rtw_adapter *padapter);
551 bool should_forbid_n_rate23a(struct rtw_adapter *padapter);
552
553 void report_join_res23a(struct rtw_adapter *padapter, int res);
554 void report_survey_event23a(struct rtw_adapter *padapter,
555                          struct recv_frame *precv_frame);
556 void report_surveydone_event23a(struct rtw_adapter *padapter);
557 void report_del_sta_event23a(struct rtw_adapter *padapter,
558                           unsigned char *MacAddr, unsigned short reason);
559 void report_add_sta_event23a(struct rtw_adapter *padapter,
560                           unsigned char *MacAddr, int cam_idx);
561
562 int set_tx_beacon_cmd23a(struct rtw_adapter*padapter);
563 unsigned int setup_beacon_frame(struct rtw_adapter *padapter,
564                                 unsigned char *beacon_frame);
565 void update_mgnt_tx_rate23a(struct rtw_adapter *padapter, u8 rate);
566 void update_mgntframe_attrib23a(struct rtw_adapter *padapter,
567                              struct pkt_attrib *pattrib);
568 void dump_mgntframe23a(struct rtw_adapter *padapter,
569                     struct xmit_frame *pmgntframe);
570 s32 dump_mgntframe23a_and_wait(struct rtw_adapter *padapter,
571                             struct xmit_frame *pmgntframe, int timeout_ms);
572 s32 dump_mgntframe23a_and_wait_ack23a(struct rtw_adapter *padapter,
573                                 struct xmit_frame *pmgntframe);
574
575 void issue_beacon23a(struct rtw_adapter *padapter, int timeout_ms);
576 int issue_nulldata23a(struct rtw_adapter *padapter, unsigned char *da,
577                    unsigned int power_mode, int try_cnt, int wait_ms);
578 int issue_qos_nulldata23a(struct rtw_adapter *padapter, unsigned char *da, u16 tid,
579                        int try_cnt, int wait_ms);
580 int issue_deauth23a(struct rtw_adapter *padapter, unsigned char *da,
581                  unsigned short reason);
582 void issue_action_spct_ch_switch23a(struct rtw_adapter *padapter, u8 *ra,
583                                  u8 new_ch, u8 ch_offset);
584 void issue_action_BA23a(struct rtw_adapter *padapter,
585                         const unsigned char *raddr,
586                         unsigned char action, unsigned short status);
587 int send_delba23a(struct rtw_adapter *padapter, u8 initiator, u8 *addr);
588 int send_beacon23a(struct rtw_adapter *padapter);
589
590 void mlmeext_joinbss_event_callback23a(struct rtw_adapter *padapter, int join_res);
591 void mlmeext_sta_del_event_callback23a(struct rtw_adapter *padapter);
592 void mlmeext_sta_add_event_callback23a(struct rtw_adapter *padapter, struct sta_info *psta);
593
594 void linked_status_chk23a(struct rtw_adapter *padapter);
595
596 #define set_survey_timer(mlmeext, ms) \
597         /*DBG_8723A("%s set_survey_timer(%p, %d)\n", __func__, (mlmeext), (ms));*/ \
598         mod_timer(&mlmeext->survey_timer, jiffies + msecs_to_jiffies(ms));
599
600 #define set_link_timer(mlmeext, ms) \
601         /*DBG_8723A("%s set_link_timer(%p, %d)\n", __func__, (mlmeext), (ms));*/ \
602         mod_timer(&mlmeext->link_timer, jiffies + msecs_to_jiffies(ms));
603
604 int cckrates_included23a(unsigned char *rate, int ratelen);
605 int cckratesonly_included23a(unsigned char *rate, int ratelen);
606
607 void process_addba_req23a(struct rtw_adapter *padapter, u8 *paddba_req, u8 *addr);
608
609 void correct_TSF23a(struct rtw_adapter *padapter, struct mlme_ext_priv *pmlmeext);
610
611 struct cmd_hdl {
612         uint    parmsize;
613         int (*h2cfuns)(struct rtw_adapter *padapter, const u8 *pbuf);
614 };
615
616
617 int read_macreg_hdl(struct rtw_adapter *padapter, u8 *pbuf);
618 int write_macreg_hdl(struct rtw_adapter *padapter, u8 *pbuf);
619 int read_bbreg_hdl(struct rtw_adapter *padapter, u8 *pbuf);
620 int write_bbreg_hdl(struct rtw_adapter *padapter, u8 *pbuf);
621 int read_rfreg_hdl(struct rtw_adapter *padapter, u8 *pbuf);
622 int write_rfreg_hdl(struct rtw_adapter *padapter, u8 *pbuf);
623
624
625 int NULL_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
626 int join_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
627 int disconnect_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
628 int createbss_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
629 int setopmode_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
630 int sitesurvey_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
631 int setauth_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
632 int setkey_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
633 int set_stakey_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
634 int set_assocsta_hdl(struct rtw_adapter *padapter, const u8 *pbuf);
635 int del_assocsta_hdl(struct rtw_adapter *padapter, const u8 *pbuf);
636 int add_ba_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
637
638 int mlme_evt_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
639 int h2c_msg_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
640 int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
641 int set_ch_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
642 int set_chplan_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
643 int led_blink_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
644 int set_csa_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);       /* Kurt: Handling DFS channel switch announcement ie. */
645 int tdls_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
646
647 #define GEN_DRV_CMD_HANDLER(size, cmd)  {size, &cmd ## _hdl23a},
648 #define GEN_MLME_EXT_HANDLER(size, cmd) {size, cmd},
649
650 struct C2HEvent_Header {
651 #ifdef __LITTLE_ENDIAN
652
653         unsigned int len:16;
654         unsigned int ID:8;
655         unsigned int seq:8;
656
657 #elif defined(__BIG_ENDIAN)
658
659         unsigned int seq:8;
660         unsigned int ID:8;
661         unsigned int len:16;
662
663 #else
664
665 #  error "Must be LITTLE or BIG Endian"
666
667 #endif
668
669         unsigned int rsvd;
670 };
671
672 enum rtw_c2h_event {
673         GEN_EVT_CODE(_Read_MACREG) = 0, /*0*/
674         GEN_EVT_CODE(_Read_BBREG),
675         GEN_EVT_CODE(_Read_RFREG),
676         GEN_EVT_CODE(_Read_EEPROM),
677         GEN_EVT_CODE(_Read_EFUSE),
678         GEN_EVT_CODE(_Read_CAM),                        /*5*/
679         GEN_EVT_CODE(_Get_BasicRate),
680         GEN_EVT_CODE(_Get_DataRate),
681         GEN_EVT_CODE(_Survey),   /*8*/
682         GEN_EVT_CODE(_SurveyDone),       /*9*/
683
684         GEN_EVT_CODE(_JoinBss) , /*10*/
685         GEN_EVT_CODE(_AddSTA),
686         GEN_EVT_CODE(_DelSTA),
687         GEN_EVT_CODE(_AtimDone) ,
688         GEN_EVT_CODE(_TX_Report),
689         GEN_EVT_CODE(_CCX_Report),                      /*15*/
690         GEN_EVT_CODE(_DTM_Report),
691         GEN_EVT_CODE(_TX_Rate_Statistics),
692         GEN_EVT_CODE(_C2HLBK),
693         GEN_EVT_CODE(_FWDBG),
694         GEN_EVT_CODE(_C2HFEEDBACK),               /*20*/
695         GEN_EVT_CODE(_ADDBA),
696         GEN_EVT_CODE(_C2HBCN),
697         GEN_EVT_CODE(_ReportPwrState),          /* filen: only for PCIE, USB */
698         GEN_EVT_CODE(_CloseRF),                         /* filen: only for PCIE, work around ASPM */
699         MAX_C2HEVT
700 };
701
702 #endif