blob: 0e7d3da914712991f3c9da69453b466906fc50ac [file] [log] [blame]
Larry Finger364e30e2014-03-28 21:37:41 -05001/******************************************************************************
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
Larry Finger364e30e2014-03-28 21:37:41 -050092extern unsigned char WMM_OUI23A[];
93extern unsigned char WPS_OUI23A[];
94extern unsigned char WFD_OUI23A[];
95extern unsigned char P2P_OUI23A[];
96
97extern unsigned char WMM_INFO_OUI23A[];
98extern 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. */
Carlos E. Garcia69e98df2015-04-24 09:40:42 -0400106/* If you just want to customize the actions(scan period or join actions) about one of the channel plan, */
Larry Finger364e30e2014-03-28 21:37:41 -0500107/* customize them in struct rt_channel_info in the RT_CHANNEL_LIST. */
108/* */
109enum { /* _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
161enum { /* _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
172enum { /* _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
200struct rt_channel_plan {
201 unsigned char Channel[MAX_CHANNEL_NUM];
202 unsigned char Len;
203};
204
205struct rt_channel_plan_2g {
206 unsigned char Channel[MAX_CHANNEL_NUM_2G];
207 unsigned char Len;
208};
209
210struct rt_channel_plan_5g {
211 unsigned char Channel[MAX_CHANNEL_NUM_5G];
212 unsigned char Len;
213};
214
215struct rt_channel_plan_map {
216 unsigned char Index2G;
217 unsigned char Index5G;
218};
219
220enum 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
232enum { /* 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
253enum 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
262struct mlme_handler {
263 char *str;
Jes Sorensene0facfa2014-04-15 19:43:53 +0200264 int (*func)(struct rtw_adapter *padapter, struct recv_frame *precv_frame);
Larry Finger364e30e2014-03-28 21:37:41 -0500265};
266
267struct action_handler {
268 unsigned int num;
Greg Donald4e66cf02014-08-22 10:57:49 -0500269 char *str;
Jes Sorensene0facfa2014-04-15 19:43:53 +0200270 int (*func)(struct rtw_adapter *padapter, struct recv_frame *precv_frame);
Larry Finger364e30e2014-03-28 21:37:41 -0500271};
272
Greg Donald8ce6b2d2014-10-03 10:36:40 -0500273struct ss_res {
Larry Finger364e30e2014-03-28 21:37:41 -0500274 int state;
275 int bss_cnt;
276 int channel_idx;
277 int scan_mode;
278 u8 ssid_num;
279 u8 ch_num;
280 struct cfg80211_ssid ssid[RTW_SSID_SCAN_AMOUNT];
281 struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT];
282};
283
Larry Finger364e30e2014-03-28 21:37:41 -0500284#define WIFI_FW_AUTH_NULL 0x00000100
285#define WIFI_FW_AUTH_STATE 0x00000200
286#define WIFI_FW_AUTH_SUCCESS 0x00000400
287
288#define WIFI_FW_ASSOC_STATE 0x00002000
289#define WIFI_FW_ASSOC_SUCCESS 0x00004000
290
291#define WIFI_FW_LINKING_STATE (WIFI_FW_AUTH_NULL | WIFI_FW_AUTH_STATE | WIFI_FW_AUTH_SUCCESS |WIFI_FW_ASSOC_STATE)
292
293struct FW_Sta_Info {
294 struct sta_info *psta;
295 u32 status;
296 u32 rx_pkt;
297 u32 retry;
298 unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
299};
300
301/*
302 * Usage:
303 * When one iface acted as AP mode and the other iface is STA mode and scanning,
304 * it should switch back to AP's operating channel periodically.
305 * Parameters info:
306 * When the driver scanned RTW_SCAN_NUM_OF_CH channels, it would switch back to AP's operating channel for
307 * RTW_STAY_AP_CH_MILLISECOND * SURVEY_TO milliseconds.
308 * Example:
309 * For chip supports 2.4G + 5GHz and AP mode is operating in channel 1,
310 * RTW_SCAN_NUM_OF_CH is 8, RTW_STAY_AP_CH_MILLISECOND is 3 and SURVEY_TO is 100.
311 * When it's STA mode gets set_scan command,
312 * it would
313 * 1. Doing the scan on channel 1.2.3.4.5.6.7.8
314 * 2. Back to channel 1 for 300 milliseconds
315 * 3. Go through doing site survey on channel 9.10.11.36.40.44.48.52
316 * 4. Back to channel 1 for 300 milliseconds
317 * 5. ... and so on, till survey done.
318 */
319
Greg Donald8ce6b2d2014-10-03 10:36:40 -0500320struct mlme_ext_info {
Larry Finger364e30e2014-03-28 21:37:41 -0500321 u32 state;
322 u32 reauth_count;
323 u32 reassoc_count;
324 u32 link_count;
325 u32 auth_seq;
326 u32 auth_algo; /* 802.11 auth, could be open, shared, auto */
327 u32 authModeToggle;
328 u32 enc_algo;/* encrypt algorithm; */
329 u32 key_index; /* this is only valid for legendary wep, 0~3 for key id. */
330 u32 iv;
331 u8 chg_txt[128];
332 u16 aid;
333 u16 bcn_interval;
334 u16 capability;
335 u8 assoc_AP_vendor;
336 u8 slotTime;
337 u8 preamble_mode;
338 u8 WMM_enable;
339 u8 ERP_enable;
340 u8 ERP_IE;
341 u8 HT_enable;
342 u8 HT_caps_enable;
343 u8 HT_info_enable;
344 u8 HT_protection;
345 u8 turboMode_cts2self;
346 u8 turboMode_rtsen;
347 u8 SM_PS;
Larry Finger364e30e2014-03-28 21:37:41 -0500348 u8 ADDBA_retry_count;
Larry Finger364e30e2014-03-28 21:37:41 -0500349 u8 dialogToken;
350 /* Accept ADDBA Request */
351 bool bAcceptAddbaReq;
352 u8 bwmode_updated;
353 u8 hidden_ssid_mode;
354
355 struct ADDBA_request ADDBA_req;
356 struct WMM_para_element WMM_param;
Jes Sorensen65be27d2014-05-31 18:05:11 +0200357 struct ieee80211_ht_cap ht_cap;
Jes Sorensen4dc5f8b2014-05-31 18:05:13 +0200358 struct ieee80211_ht_operation HT_info;
Larry Finger364e30e2014-03-28 21:37:41 -0500359 struct wlan_bssid_ex network;/* join network or bss_network, if in ap mode, it is the same to cur_network.network */
360 struct FW_Sta_Info FW_sta_info[NUM_STA];
361};
362
363/* The channel information about this channel including joining, scanning, and power constraints. */
364struct rt_channel_info {
365 u8 ChannelNum; /* The channel number. */
366 enum rt_scan_type ScanType; /* Scan type such as passive or active scan. */
367};
368
369int rtw_ch_set_search_ch23a(struct rt_channel_info *ch_set, const u32 ch);
370
371/* P2P_MAX_REG_CLASSES - Maximum number of regulatory classes */
372#define P2P_MAX_REG_CLASSES 10
373
374/* P2P_MAX_REG_CLASS_CHANNELS - Maximum number of channels per regulatory class */
375#define P2P_MAX_REG_CLASS_CHANNELS 20
376
377/* struct p2p_channels - List of supported channels */
378struct p2p_channels {
379 /* struct p2p_reg_class - Supported regulatory class */
380 struct p2p_reg_class {
381 /* reg_class - Regulatory class (IEEE 802.11-2007, Annex J) */
382 u8 reg_class;
383
384 /* channel - Supported channels */
385 u8 channel[P2P_MAX_REG_CLASS_CHANNELS];
386
387 /* channels - Number of channel entries in use */
388 size_t channels;
389 } reg_class[P2P_MAX_REG_CLASSES];
390
391 /* reg_classes - Number of reg_class entries in use */
392 size_t reg_classes;
393};
394
395struct p2p_oper_class_map {
Greg Donaldc895a5d2014-09-16 18:37:41 -0500396 enum hw_mode {IEEE80211G, IEEE80211A} mode;
Larry Finger364e30e2014-03-28 21:37:41 -0500397 u8 op_class;
398 u8 min_chan;
399 u8 max_chan;
400 u8 inc;
401 enum {
402 BW20, BW40PLUS, BW40MINUS
403 } bw;
404};
405
406struct mlme_ext_priv {
407 struct rtw_adapter *padapter;
408 u8 mlmeext_init;
409 atomic_t event_seq;
410 u16 mgnt_seq;
411
412 /* struct fw_priv fwpriv; */
413
414 unsigned char cur_channel;
415 unsigned char cur_bwmode;
416 unsigned char cur_ch_offset;/* PRIME_CHNL_OFFSET */
417 unsigned char cur_wireless_mode; /* NETWORK_TYPE */
418
419 unsigned char max_chan_nums;
420 struct rt_channel_info channel_set[MAX_CHANNEL_NUM];
421 struct p2p_channels channel_list;
422 unsigned char basicrate[NumRates];
423 unsigned char datarate[NumRates];
424
425 struct ss_res sitesurvey_res;
426 struct mlme_ext_info mlmext_info;/* for sta/adhoc mode, including current scanning/connecting/connected related info. */
427 /* for ap mode, network includes ap's cap_info */
428 struct timer_list survey_timer;
429 struct timer_list link_timer;
430 u16 chan_scan_time;
431
432 u8 scan_abort;
433 u8 tx_rate; /* TXRATE when USERATE is set. */
434
435 u32 retry; /* retry for issue probereq */
436
437 u64 TSFValue;
438
Larry Finger364e30e2014-03-28 21:37:41 -0500439 unsigned char bstart_bss;
Larry Finger364e30e2014-03-28 21:37:41 -0500440 u8 update_channel_plan_by_ap_done;
441 /* recv_decache check for Action_public frame */
442 u8 action_public_dialog_token;
443 u16 action_public_rxseq;
444 u8 active_keep_alive_check;
445};
446
Greg Donald4e66cf02014-08-22 10:57:49 -0500447int init_mlme_ext_priv23a(struct rtw_adapter *padapter);
Larry Finger364e30e2014-03-28 21:37:41 -0500448int init_hw_mlme_ext23a(struct rtw_adapter *padapter);
449void free_mlme_ext_priv23a (struct mlme_ext_priv *pmlmeext);
450void init_mlme_ext_timer23a(struct rtw_adapter *padapter);
451void init_addba_retry_timer23a(struct sta_info *psta);
452struct xmit_frame *alloc_mgtxmitframe23a(struct xmit_priv *pxmitpriv);
453
454unsigned char networktype_to_raid23a(unsigned char network_type);
455u8 judge_network_type23a(struct rtw_adapter *padapter, unsigned char *rate,
456 int ratelen);
457void get_rate_set23a(struct rtw_adapter *padapter, unsigned char *pbssrate,
458 int *bssrate_len);
Greg Donaldc895a5d2014-09-16 18:37:41 -0500459void UpdateBrateTbl23a(struct rtw_adapter *padapter, u8 *mBratesOS);
Larry Finger364e30e2014-03-28 21:37:41 -0500460void Update23aTblForSoftAP(u8 *bssrateset, u32 bssratelen);
461
Larry Finger364e30e2014-03-28 21:37:41 -0500462u8 rtw_get_oper_ch23a(struct rtw_adapter *adapter);
463void rtw_set_oper_ch23a(struct rtw_adapter *adapter, u8 ch);
Larry Finger364e30e2014-03-28 21:37:41 -0500464void rtw_set_oper_bw23a(struct rtw_adapter *adapter, u8 bw);
Larry Finger364e30e2014-03-28 21:37:41 -0500465void rtw_set_oper_ch23aoffset23a(struct rtw_adapter *adapter, u8 offset);
466
467void set_channel_bwmode23a(struct rtw_adapter *padapter, unsigned char channel,
468 unsigned char channel_offset, unsigned short bwmode);
469void SelectChannel23a(struct rtw_adapter *padapter, unsigned char channel);
Larry Finger364e30e2014-03-28 21:37:41 -0500470
471unsigned int decide_wait_for_beacon_timeout23a(unsigned int bcn_interval);
472
Larry Finger364e30e2014-03-28 21:37:41 -0500473void clear_cam_entry23a(struct rtw_adapter *padapter, u8 entry);
474
475void invalidate_cam_all23a(struct rtw_adapter *padapter);
Larry Finger364e30e2014-03-28 21:37:41 -0500476
477int allocate_fw_sta_entry23a(struct rtw_adapter *padapter);
478void flush_all_cam_entry23a(struct rtw_adapter *padapter);
479
480bool IsLegal5GChannel(struct rtw_adapter *Adapter, u8 channel);
481
Larry Finger364e30e2014-03-28 21:37:41 -0500482void update_network23a(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src,
483 struct rtw_adapter *padapter, bool update_ie);
484
Larry Finger364e30e2014-03-28 21:37:41 -0500485u8 *get_my_bssid23a(struct wlan_bssid_ex *pnetwork);
Larry Finger364e30e2014-03-28 21:37:41 -0500486
Jes Sorensenf6fe0a42014-05-16 10:04:39 +0200487bool is_client_associated_to_ap23a(struct rtw_adapter *padapter);
488bool is_client_associated_to_ibss23a(struct rtw_adapter *padapter);
489bool is_IBSS_empty23a(struct rtw_adapter *padapter);
Larry Finger364e30e2014-03-28 21:37:41 -0500490
491unsigned char check_assoc_AP23a(u8 *pframe, uint len);
492
Jes Sorensen3cdf2772014-06-09 15:16:03 +0200493int WMM_param_handler23a(struct rtw_adapter *padapter, const u8 *p);
Larry Finger364e30e2014-03-28 21:37:41 -0500494void WMMOnAssocRsp23a(struct rtw_adapter *padapter);
495
Jes Sorensen3cdf2772014-06-09 15:16:03 +0200496void HT_caps_handler23a(struct rtw_adapter *padapter, const u8 *p);
Jes Sorensen7882ef42014-05-31 18:05:17 +0200497void HT_info_handler23a(struct rtw_adapter *padapter, const u8 *p);
Larry Finger364e30e2014-03-28 21:37:41 -0500498void HTOnAssocRsp23a(struct rtw_adapter *padapter);
499
Jes Sorensen7882ef42014-05-31 18:05:17 +0200500void ERP_IE_handler23a(struct rtw_adapter *padapter, const u8 *p);
Larry Finger364e30e2014-03-28 21:37:41 -0500501void VCS_update23a(struct rtw_adapter *padapter, struct sta_info *psta);
502
Jes Sorensen7882ef42014-05-31 18:05:17 +0200503void update_beacon23a_info(struct rtw_adapter *padapter,
504 struct ieee80211_mgmt *mgmt, uint len,
505 struct sta_info *psta);
Jes Sorensenc1465512014-04-15 19:43:58 +0200506int rtw_check_bcn_info23a(struct rtw_adapter *Adapter,
507 struct ieee80211_mgmt *mgmt, u32 packet_len);
Larry Finger364e30e2014-03-28 21:37:41 -0500508void update_IOT_info23a(struct rtw_adapter *padapter);
509void update_capinfo23a(struct rtw_adapter *Adapter, u16 updateCap);
Greg Donald3cd87c12014-12-03 20:19:59 -0600510void update_wireless_mode23a(struct rtw_adapter *padapter);
Larry Finger364e30e2014-03-28 21:37:41 -0500511void update_tx_basic_rate23a(struct rtw_adapter *padapter, u8 modulation);
512void update_bmc_sta_support_rate23a(struct rtw_adapter *padapter, u32 mac_id);
Greg Donald4e66cf02014-08-22 10:57:49 -0500513int update_sta_support_rate23a(struct rtw_adapter *padapter, u8 *pvar_ie,
Larry Finger364e30e2014-03-28 21:37:41 -0500514 uint var_ie_len, int cam_idx);
515
516/* for sta/adhoc mode */
517void update_sta_info23a(struct rtw_adapter *padapter, struct sta_info *psta);
518unsigned int update_basic_rate23a(unsigned char *ptn, unsigned int ptn_sz);
519unsigned int update_supported_rate23a(unsigned char *ptn, unsigned int ptn_sz);
Jes Sorensen65be27d2014-05-31 18:05:11 +0200520unsigned int update_MSC_rate23a(struct ieee80211_ht_cap *ht_cap);
Larry Finger364e30e2014-03-28 21:37:41 -0500521void Update_RA_Entry23a(struct rtw_adapter *padapter, struct sta_info *psta);
522void set_sta_rate23a(struct rtw_adapter *padapter, struct sta_info *psta);
523
Jes Sorensenf66e05d2014-05-16 10:04:34 +0200524int receive_disconnect23a(struct rtw_adapter *padapter,
525 unsigned char *MacAddr, unsigned short reason);
Larry Finger364e30e2014-03-28 21:37:41 -0500526
527unsigned char get_highest_rate_idx23a(u32 mask);
528int support_short_GI23a(struct rtw_adapter *padapter,
Jes Sorensen65be27d2014-05-31 18:05:11 +0200529 struct ieee80211_ht_cap *ht_cap);
Jes Sorensend5789242014-05-16 10:04:35 +0200530bool is_ap_in_tkip23a(struct rtw_adapter *padapter);
531bool is_ap_in_wep23a(struct rtw_adapter *padapter);
532bool should_forbid_n_rate23a(struct rtw_adapter *padapter);
Larry Finger364e30e2014-03-28 21:37:41 -0500533
534void report_join_res23a(struct rtw_adapter *padapter, int res);
535void report_survey_event23a(struct rtw_adapter *padapter,
536 struct recv_frame *precv_frame);
537void report_surveydone_event23a(struct rtw_adapter *padapter);
538void report_del_sta_event23a(struct rtw_adapter *padapter,
539 unsigned char *MacAddr, unsigned short reason);
540void report_add_sta_event23a(struct rtw_adapter *padapter,
541 unsigned char *MacAddr, int cam_idx);
542
Jes Sorensen1ec89112014-05-16 10:04:28 +0200543int set_tx_beacon_cmd23a(struct rtw_adapter*padapter);
Larry Finger364e30e2014-03-28 21:37:41 -0500544unsigned int setup_beacon_frame(struct rtw_adapter *padapter,
545 unsigned char *beacon_frame);
546void update_mgnt_tx_rate23a(struct rtw_adapter *padapter, u8 rate);
547void update_mgntframe_attrib23a(struct rtw_adapter *padapter,
548 struct pkt_attrib *pattrib);
549void dump_mgntframe23a(struct rtw_adapter *padapter,
550 struct xmit_frame *pmgntframe);
551s32 dump_mgntframe23a_and_wait(struct rtw_adapter *padapter,
552 struct xmit_frame *pmgntframe, int timeout_ms);
553s32 dump_mgntframe23a_and_wait_ack23a(struct rtw_adapter *padapter,
554 struct xmit_frame *pmgntframe);
555
Larry Finger364e30e2014-03-28 21:37:41 -0500556void issue_beacon23a(struct rtw_adapter *padapter, int timeout_ms);
Larry Finger364e30e2014-03-28 21:37:41 -0500557int issue_nulldata23a(struct rtw_adapter *padapter, unsigned char *da,
558 unsigned int power_mode, int try_cnt, int wait_ms);
559int issue_qos_nulldata23a(struct rtw_adapter *padapter, unsigned char *da, u16 tid,
560 int try_cnt, int wait_ms);
561int issue_deauth23a(struct rtw_adapter *padapter, unsigned char *da,
562 unsigned short reason);
Larry Finger364e30e2014-03-28 21:37:41 -0500563void issue_action_spct_ch_switch23a(struct rtw_adapter *padapter, u8 *ra,
564 u8 new_ch, u8 ch_offset);
Jes Sorensen0348dc742014-04-26 18:55:06 +0200565void issue_action_BA23a(struct rtw_adapter *padapter,
566 const unsigned char *raddr,
567 unsigned char action, unsigned short status);
Jes Sorensenf66e05d2014-05-16 10:04:34 +0200568int send_delba23a(struct rtw_adapter *padapter, u8 initiator, u8 *addr);
569int send_beacon23a(struct rtw_adapter *padapter);
Larry Finger364e30e2014-03-28 21:37:41 -0500570
Larry Finger364e30e2014-03-28 21:37:41 -0500571void mlmeext_joinbss_event_callback23a(struct rtw_adapter *padapter, int join_res);
572void mlmeext_sta_del_event_callback23a(struct rtw_adapter *padapter);
573void mlmeext_sta_add_event_callback23a(struct rtw_adapter *padapter, struct sta_info *psta);
574
575void linked_status_chk23a(struct rtw_adapter *padapter);
576
577#define set_survey_timer(mlmeext, ms) \
Joe Perchesf8628a42014-05-23 22:13:20 -0700578 /*DBG_8723A("%s set_survey_timer(%p, %d)\n", __func__, (mlmeext), (ms));*/ \
Larry Finger364e30e2014-03-28 21:37:41 -0500579 mod_timer(&mlmeext->survey_timer, jiffies + msecs_to_jiffies(ms));
580
581#define set_link_timer(mlmeext, ms) \
Joe Perchesf8628a42014-05-23 22:13:20 -0700582 /*DBG_8723A("%s set_link_timer(%p, %d)\n", __func__, (mlmeext), (ms));*/ \
Larry Finger364e30e2014-03-28 21:37:41 -0500583 mod_timer(&mlmeext->link_timer, jiffies + msecs_to_jiffies(ms));
584
585int cckrates_included23a(unsigned char *rate, int ratelen);
586int cckratesonly_included23a(unsigned char *rate, int ratelen);
587
588void process_addba_req23a(struct rtw_adapter *padapter, u8 *paddba_req, u8 *addr);
589
Larry Finger364e30e2014-03-28 21:37:41 -0500590void correct_TSF23a(struct rtw_adapter *padapter, struct mlme_ext_priv *pmlmeext);
591
592struct cmd_hdl {
593 uint parmsize;
Jes Sorensen1ec89112014-05-16 10:04:28 +0200594 int (*h2cfuns)(struct rtw_adapter *padapter, const u8 *pbuf);
Larry Finger364e30e2014-03-28 21:37:41 -0500595};
596
597
Jes Sorensen1ec89112014-05-16 10:04:28 +0200598int read_macreg_hdl(struct rtw_adapter *padapter, u8 *pbuf);
599int write_macreg_hdl(struct rtw_adapter *padapter, u8 *pbuf);
600int read_bbreg_hdl(struct rtw_adapter *padapter, u8 *pbuf);
601int write_bbreg_hdl(struct rtw_adapter *padapter, u8 *pbuf);
602int read_rfreg_hdl(struct rtw_adapter *padapter, u8 *pbuf);
603int write_rfreg_hdl(struct rtw_adapter *padapter, u8 *pbuf);
Larry Finger364e30e2014-03-28 21:37:41 -0500604
605
Jes Sorensen1ec89112014-05-16 10:04:28 +0200606int NULL_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
607int join_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
608int disconnect_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
609int createbss_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
610int setopmode_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
611int sitesurvey_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
612int setauth_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
613int setkey_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
614int set_stakey_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
615int set_assocsta_hdl(struct rtw_adapter *padapter, const u8 *pbuf);
616int del_assocsta_hdl(struct rtw_adapter *padapter, const u8 *pbuf);
617int add_ba_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
Larry Finger364e30e2014-03-28 21:37:41 -0500618
Jes Sorensen1ec89112014-05-16 10:04:28 +0200619int mlme_evt_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
620int h2c_msg_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
621int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
622int set_ch_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
623int set_chplan_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
624int led_blink_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
625int set_csa_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf); /* Kurt: Handling DFS channel switch announcement ie. */
626int tdls_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
Larry Finger364e30e2014-03-28 21:37:41 -0500627
628#define GEN_DRV_CMD_HANDLER(size, cmd) {size, &cmd ## _hdl23a},
629#define GEN_MLME_EXT_HANDLER(size, cmd) {size, cmd},
630
631struct C2HEvent_Header {
632#ifdef __LITTLE_ENDIAN
633
634 unsigned int len:16;
635 unsigned int ID:8;
636 unsigned int seq:8;
637
638#elif defined(__BIG_ENDIAN)
639
640 unsigned int seq:8;
641 unsigned int ID:8;
642 unsigned int len:16;
643
644#else
645
646# error "Must be LITTLE or BIG Endian"
647
648#endif
649
650 unsigned int rsvd;
651};
652
Larry Finger364e30e2014-03-28 21:37:41 -0500653enum rtw_c2h_event {
654 GEN_EVT_CODE(_Read_MACREG) = 0, /*0*/
655 GEN_EVT_CODE(_Read_BBREG),
656 GEN_EVT_CODE(_Read_RFREG),
657 GEN_EVT_CODE(_Read_EEPROM),
658 GEN_EVT_CODE(_Read_EFUSE),
659 GEN_EVT_CODE(_Read_CAM), /*5*/
660 GEN_EVT_CODE(_Get_BasicRate),
661 GEN_EVT_CODE(_Get_DataRate),
662 GEN_EVT_CODE(_Survey), /*8*/
663 GEN_EVT_CODE(_SurveyDone), /*9*/
664
665 GEN_EVT_CODE(_JoinBss) , /*10*/
666 GEN_EVT_CODE(_AddSTA),
667 GEN_EVT_CODE(_DelSTA),
668 GEN_EVT_CODE(_AtimDone) ,
669 GEN_EVT_CODE(_TX_Report),
670 GEN_EVT_CODE(_CCX_Report), /*15*/
671 GEN_EVT_CODE(_DTM_Report),
672 GEN_EVT_CODE(_TX_Rate_Statistics),
673 GEN_EVT_CODE(_C2HLBK),
674 GEN_EVT_CODE(_FWDBG),
675 GEN_EVT_CODE(_C2HFEEDBACK), /*20*/
676 GEN_EVT_CODE(_ADDBA),
677 GEN_EVT_CODE(_C2HBCN),
678 GEN_EVT_CODE(_ReportPwrState), /* filen: only for PCIE, USB */
679 GEN_EVT_CODE(_CloseRF), /* filen: only for PCIE, work around ASPM */
680 MAX_C2HEVT
681};
682
683#endif