Merge remote-tracking branch 'staging/staging-next'
[deliverable/linux.git] / drivers / staging / rtl8188eu / include / rtw_mlme_ext.h
CommitLineData
4218e5be
LF
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 *
4218e5be
LF
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/* ====== ODM_ABILITY_E ======== */
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_TRA 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_EDCA_TURBO 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
92extern unsigned char RTW_WPA_OUI[];
93extern unsigned char WMM_OUI[];
94extern unsigned char WPS_OUI[];
95extern unsigned char WFD_OUI[];
96extern unsigned char P2P_OUI[];
97
98extern unsigned char WMM_INFO_OUI[];
99extern unsigned char WMM_PARA_OUI[];
100
101/* Channel Plan Type. */
102/* Note: */
103/* We just add new channel plan when the new channel plan is different
104 * from any of the following channel plan. */
f7bba924 105/* If you just want to customize the actions(scan period or join actions)
4218e5be
LF
106 * about one of the channel plan, */
107/* customize them in struct rt_channel_info in the RT_CHANNEL_LIST. */
108enum RT_CHANNEL_DOMAIN {
109 /* old channel plan mapping ===== */
110 RT_CHANNEL_DOMAIN_FCC = 0x00,
111 RT_CHANNEL_DOMAIN_IC = 0x01,
112 RT_CHANNEL_DOMAIN_ETSI = 0x02,
113 RT_CHANNEL_DOMAIN_SPAIN = 0x03,
114 RT_CHANNEL_DOMAIN_FRANCE = 0x04,
115 RT_CHANNEL_DOMAIN_MKK = 0x05,
116 RT_CHANNEL_DOMAIN_MKK1 = 0x06,
117 RT_CHANNEL_DOMAIN_ISRAEL = 0x07,
118 RT_CHANNEL_DOMAIN_TELEC = 0x08,
119 RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN = 0x09,
120 RT_CHANNEL_DOMAIN_WORLD_WIDE_13 = 0x0A,
121 RT_CHANNEL_DOMAIN_TAIWAN = 0x0B,
122 RT_CHANNEL_DOMAIN_CHINA = 0x0C,
123 RT_CHANNEL_DOMAIN_SINGAPORE_INDIA_MEXICO = 0x0D,
124 RT_CHANNEL_DOMAIN_KOREA = 0x0E,
125 RT_CHANNEL_DOMAIN_TURKEY = 0x0F,
126 RT_CHANNEL_DOMAIN_JAPAN = 0x10,
127 RT_CHANNEL_DOMAIN_FCC_NO_DFS = 0x11,
128 RT_CHANNEL_DOMAIN_JAPAN_NO_DFS = 0x12,
129 RT_CHANNEL_DOMAIN_WORLD_WIDE_5G = 0x13,
130 RT_CHANNEL_DOMAIN_TAIWAN_NO_DFS = 0x14,
131
132 /* new channel plan mapping, (2GDOMAIN_5GDOMAIN) ===== */
133 RT_CHANNEL_DOMAIN_WORLD_NULL = 0x20,
134 RT_CHANNEL_DOMAIN_ETSI1_NULL = 0x21,
135 RT_CHANNEL_DOMAIN_FCC1_NULL = 0x22,
136 RT_CHANNEL_DOMAIN_MKK1_NULL = 0x23,
137 RT_CHANNEL_DOMAIN_ETSI2_NULL = 0x24,
138 RT_CHANNEL_DOMAIN_FCC1_FCC1 = 0x25,
139 RT_CHANNEL_DOMAIN_WORLD_ETSI1 = 0x26,
140 RT_CHANNEL_DOMAIN_MKK1_MKK1 = 0x27,
141 RT_CHANNEL_DOMAIN_WORLD_KCC1 = 0x28,
142 RT_CHANNEL_DOMAIN_WORLD_FCC2 = 0x29,
143 RT_CHANNEL_DOMAIN_WORLD_FCC3 = 0x30,
144 RT_CHANNEL_DOMAIN_WORLD_FCC4 = 0x31,
145 RT_CHANNEL_DOMAIN_WORLD_FCC5 = 0x32,
146 RT_CHANNEL_DOMAIN_WORLD_FCC6 = 0x33,
147 RT_CHANNEL_DOMAIN_FCC1_FCC7 = 0x34,
148 RT_CHANNEL_DOMAIN_WORLD_ETSI2 = 0x35,
149 RT_CHANNEL_DOMAIN_WORLD_ETSI3 = 0x36,
150 RT_CHANNEL_DOMAIN_MKK1_MKK2 = 0x37,
151 RT_CHANNEL_DOMAIN_MKK1_MKK3 = 0x38,
152 RT_CHANNEL_DOMAIN_FCC1_NCC1 = 0x39,
153 RT_CHANNEL_DOMAIN_FCC1_NCC2 = 0x40,
154 RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN_2G = 0x41,
155 /* Add new channel plan above this line=============== */
156 RT_CHANNEL_DOMAIN_MAX,
157 RT_CHANNEL_DOMAIN_REALTEK_DEFINE = 0x7F,
158};
159
160enum RT_CHANNEL_DOMAIN_2G {
161 RT_CHANNEL_DOMAIN_2G_WORLD = 0x00, /* Worldwide 13 */
162 RT_CHANNEL_DOMAIN_2G_ETSI1 = 0x01, /* Europe */
163 RT_CHANNEL_DOMAIN_2G_FCC1 = 0x02, /* US */
164 RT_CHANNEL_DOMAIN_2G_MKK1 = 0x03, /* Japan */
165 RT_CHANNEL_DOMAIN_2G_ETSI2 = 0x04, /* France */
166 RT_CHANNEL_DOMAIN_2G_NULL = 0x05,
167 /* Add new channel plan above this line=============== */
168 RT_CHANNEL_DOMAIN_2G_MAX,
169};
170
171#define rtw_is_channel_plan_valid(chplan) \
172 (chplan < RT_CHANNEL_DOMAIN_MAX || \
173 chplan == RT_CHANNEL_DOMAIN_REALTEK_DEFINE)
174
175struct rt_channel_plan {
176 unsigned char Channel[MAX_CHANNEL_NUM];
177 unsigned char Len;
178};
179
180struct rt_channel_plan_2g {
181 unsigned char Channel[MAX_CHANNEL_NUM_2G];
182 unsigned char Len;
183};
184
185struct rt_channel_plan_map {
186 unsigned char Index2G;
187};
188
ed701c4a
HPGE
189static const struct {
190 int channel_plan;
191 char *name;
192} channel_table[] = { { RT_CHANNEL_DOMAIN_FCC, "US" },
193 { RT_CHANNEL_DOMAIN_ETSI, "EU" },
194 { RT_CHANNEL_DOMAIN_MKK, "JP" },
195 { RT_CHANNEL_DOMAIN_CHINA, "CN"} };
196
4218e5be
LF
197enum Associated_AP {
198 atherosAP = 0,
199 broadcomAP = 1,
200 ciscoAP = 2,
201 marvellAP = 3,
202 ralinkAP = 4,
203 realtekAP = 5,
204 airgocapAP = 6,
205 unknownAP = 7,
206 maxAP,
207};
208
209enum HT_IOT_PEER {
210 HT_IOT_PEER_UNKNOWN = 0,
211 HT_IOT_PEER_REALTEK = 1,
212 HT_IOT_PEER_REALTEK_92SE = 2,
213 HT_IOT_PEER_BROADCOM = 3,
214 HT_IOT_PEER_RALINK = 4,
215 HT_IOT_PEER_ATHEROS = 5,
216 HT_IOT_PEER_CISCO = 6,
217 HT_IOT_PEER_MERU = 7,
218 HT_IOT_PEER_MARVELL = 8,
219 HT_IOT_PEER_REALTEK_SOFTAP = 9,/* peer is RealTek SOFT_AP */
220 HT_IOT_PEER_SELF_SOFTAP = 10, /* Self is SoftAP */
221 HT_IOT_PEER_AIRGO = 11,
222 HT_IOT_PEER_INTEL = 12,
223 HT_IOT_PEER_RTK_APCLIENT = 13,
224 HT_IOT_PEER_REALTEK_81XX = 14,
225 HT_IOT_PEER_REALTEK_WOW = 15,
226 HT_IOT_PEER_TENDA = 16,
227 HT_IOT_PEER_MAX = 17
228};
229
230enum SCAN_STATE {
231 SCAN_DISABLE = 0,
232 SCAN_START = 1,
233 SCAN_TXNULL = 2,
234 SCAN_PROCESS = 3,
235 SCAN_COMPLETE = 4,
236 SCAN_STATE_MAX,
237};
238
239struct mlme_handler {
240 unsigned int num;
241 char *str;
f31cca8e 242 unsigned int (*func)(struct adapter *adapt, struct recv_frame *frame);
4218e5be
LF
243};
244
245struct action_handler {
246 unsigned int num;
c7333c11 247 char *str;
f31cca8e 248 unsigned int (*func)(struct adapter *adapt, struct recv_frame *frame);
4218e5be
LF
249};
250
251struct ss_res {
252 int state;
253 int bss_cnt;
254 int channel_idx;
255 int scan_mode;
256 u8 ssid_num;
257 u8 ch_num;
258 struct ndis_802_11_ssid ssid[RTW_SSID_SCAN_AMOUNT];
259 struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT];
260};
261
262/* define AP_MODE 0x0C */
263/* define STATION_MODE 0x08 */
264/* define AD_HOC_MODE 0x04 */
265/* define NO_LINK_MODE 0x00 */
266
267#define WIFI_FW_NULL_STATE _HW_STATE_NOLINK_
268#define WIFI_FW_STATION_STATE _HW_STATE_STATION_
269#define WIFI_FW_AP_STATE _HW_STATE_AP_
270#define WIFI_FW_ADHOC_STATE _HW_STATE_ADHOC_
271
272#define WIFI_FW_AUTH_NULL 0x00000100
273#define WIFI_FW_AUTH_STATE 0x00000200
274#define WIFI_FW_AUTH_SUCCESS 0x00000400
275
276#define WIFI_FW_ASSOC_STATE 0x00002000
277#define WIFI_FW_ASSOC_SUCCESS 0x00004000
278
279#define WIFI_FW_LINKING_STATE (WIFI_FW_AUTH_NULL | \
280 WIFI_FW_AUTH_STATE | \
281 WIFI_FW_AUTH_SUCCESS | \
282 WIFI_FW_ASSOC_STATE)
283
284struct FW_Sta_Info {
285 struct sta_info *psta;
286 u32 status;
287 u32 rx_pkt;
288 u32 retry;
289 unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
290};
291
292/*
293 * Usage:
294 * When one iface acted as AP mode and the other iface is STA mode and scanning,
295 * it should switch back to AP's operating channel periodically.
296 * Parameters info:
297 * When the driver scanned RTW_SCAN_NUM_OF_CH channels, it would switch back to
298 * AP's operating channel for
299 * RTW_STAY_AP_CH_MILLISECOND * SURVEY_TO milliseconds.
300 * Example:
301 * For chip supports 2.4G + 5GHz and AP mode is operating in channel 1,
302 * RTW_SCAN_NUM_OF_CH is 8, RTW_STAY_AP_CH_MS is 3 and SURVEY_TO is 100.
303 * When it's STA mode gets set_scan command,
304 * it would
305 * 1. Doing the scan on channel 1.2.3.4.5.6.7.8
306 * 2. Back to channel 1 for 300 milliseconds
307 * 3. Go through doing site survey on channel 9.10.11.36.40.44.48.52
308 * 4. Back to channel 1 for 300 milliseconds
309 * 5. ... and so on, till survey done.
310 */
311
312struct mlme_ext_info {
313 u32 state;
314 u32 reauth_count;
315 u32 reassoc_count;
316 u32 link_count;
317 u32 auth_seq;
318 u32 auth_algo; /* 802.11 auth, could be open, shared, auto */
319 u32 authModeToggle;
320 u32 enc_algo;/* encrypt algorithm; */
321 u32 key_index; /* this is only valid for legacy wep,
322 * 0~3 for key id. */
323 u32 iv;
324 u8 chg_txt[128];
325 u16 aid;
326 u16 bcn_interval;
327 u16 capability;
328 u8 assoc_AP_vendor;
329 u8 slotTime;
330 u8 preamble_mode;
331 u8 WMM_enable;
332 u8 ERP_enable;
333 u8 ERP_IE;
334 u8 HT_enable;
335 u8 HT_caps_enable;
336 u8 HT_info_enable;
337 u8 HT_protection;
338 u8 turboMode_cts2self;
339 u8 turboMode_rtsen;
340 u8 SM_PS;
341 u8 agg_enable_bitmap;
342 u8 ADDBA_retry_count;
343 u8 candidate_tid_bitmap;
344 u8 dialogToken;
345 /* Accept ADDBA Request */
d6c6ad96 346 bool accept_addba_req;
4218e5be
LF
347 u8 bwmode_updated;
348 u8 hidden_ssid_mode;
349
350 struct ADDBA_request ADDBA_req;
351 struct WMM_para_element WMM_param;
3d3cd94d 352 struct ieee80211_ht_cap HT_caps;
4218e5be
LF
353 struct HT_info_element HT_info;
354 struct wlan_bssid_ex network;/* join network or bss_network,
355 * if in ap mode, it is the same
356 * as cur_network.network */
357 struct FW_Sta_Info FW_sta_info[NUM_STA];
358};
359
360/* The channel information about this channel including joining,
361 * scanning, and power constraints. */
362struct rt_channel_info {
363 u8 ChannelNum; /* The channel number. */
364 enum rt_scan_type ScanType; /* Scan type such as passive
365 * or active scan. */
366 u32 rx_count;
367};
368
369int rtw_ch_set_search_ch(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 chan 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 {
396 enum hw_mode {IEEE80211G} mode;
397 u8 op_class;
398 u8 min_chan;
399 u8 max_chan;
400 u8 inc;
401 enum {BW20, BW40PLUS, BW40MINUS} bw;
402};
403
404struct mlme_ext_priv {
405 struct adapter *padapter;
406 u8 mlmeext_init;
6fe58d68 407 atomic_t event_seq;
4218e5be
LF
408 u16 mgnt_seq;
409
410 unsigned char cur_channel;
411 unsigned char cur_bwmode;
412 unsigned char cur_ch_offset;/* PRIME_CHNL_OFFSET */
413 unsigned char cur_wireless_mode; /* NETWORK_TYPE */
414
415 unsigned char oper_channel; /* saved chan info when call
416 * set_channel_bw */
417 unsigned char oper_bwmode;
418 unsigned char oper_ch_offset;/* PRIME_CHNL_OFFSET */
419
420 unsigned char max_chan_nums;
421 struct rt_channel_info channel_set[MAX_CHANNEL_NUM];
422 struct p2p_channels channel_list;
423 unsigned char basicrate[NumRates];
424 unsigned char datarate[NumRates];
425
426 struct ss_res sitesurvey_res;
427 struct mlme_ext_info mlmext_info;/* for sta/adhoc mode, including
428 * current scan/connecting/connected
429 * related info. For ap mode,
430 * network includes ap's cap_info*/
431 struct timer_list survey_timer;
432 struct timer_list link_timer;
433 u16 chan_scan_time;
434
435 u8 scan_abort;
436 u8 tx_rate; /* TXRATE when USERATE is set. */
437
438 u32 retry; /* retry for issue probereq */
439
440 u64 TSFValue;
441
442#ifdef CONFIG_88EU_AP_MODE
443 unsigned char bstart_bss;
444#endif
445 u8 update_channel_plan_by_ap_done;
446 /* recv_decache check for Action_public frame */
447 u8 action_public_dialog_token;
448 u16 action_public_rxseq;
449 u8 active_keep_alive_check;
450};
451
452int init_mlme_ext_priv(struct adapter *adapter);
453int init_hw_mlme_ext(struct adapter *padapter);
7be921a2 454void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext);
ebea63f6
JP
455void init_mlme_ext_timer(struct adapter *padapter);
456void init_addba_retry_timer(struct adapter *adapt, struct sta_info *sta);
457struct xmit_frame *alloc_mgtxmitframe(struct xmit_priv *pxmitpriv);
4218e5be
LF
458
459unsigned char networktype_to_raid(unsigned char network_type);
460u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int len);
461void get_rate_set(struct adapter *padapter, unsigned char *pbssrate, int *len);
462void UpdateBrateTbl(struct adapter *padapter, u8 *mBratesOS);
463void UpdateBrateTblForSoftAP(u8 *bssrateset, u32 bssratelen);
464
465void Save_DM_Func_Flag(struct adapter *padapter);
466void Restore_DM_Func_Flag(struct adapter *padapter);
467void Switch_DM_Func(struct adapter *padapter, u32 mode, u8 enable);
468
469void Set_MSR(struct adapter *padapter, u8 type);
470
471u8 rtw_get_oper_ch(struct adapter *adapter);
472void rtw_set_oper_ch(struct adapter *adapter, u8 ch);
473u8 rtw_get_oper_bw(struct adapter *adapter);
474void rtw_set_oper_bw(struct adapter *adapter, u8 bw);
475u8 rtw_get_oper_choffset(struct adapter *adapter);
476void rtw_set_oper_choffset(struct adapter *adapter, u8 offset);
477
478void set_channel_bwmode(struct adapter *padapter, unsigned char channel,
479 unsigned char channel_offset, unsigned short bwmode);
480void SelectChannel(struct adapter *padapter, unsigned char channel);
481void SetBWMode(struct adapter *padapter, unsigned short bwmode,
482 unsigned char channel_offset);
483
484unsigned int decide_wait_for_beacon_timeout(unsigned int bcn_interval);
485
486void write_cam(struct adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 *key);
487void clear_cam_entry(struct adapter *padapter, u8 entry);
488
489void invalidate_cam_all(struct adapter *padapter);
c7333c11 490void CAM_empty_entry(struct adapter *Adapter, u8 ucIndex);
4218e5be
LF
491
492int allocate_fw_sta_entry(struct adapter *padapter);
493void flush_all_cam_entry(struct adapter *padapter);
494
4218e5be
LF
495void update_network(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src,
496 struct adapter *adapter, bool update_ie);
497
498int get_bsstype(unsigned short capability);
4218e5be
LF
499u16 get_beacon_interval(struct wlan_bssid_ex *bss);
500
501int is_client_associated_to_ap(struct adapter *padapter);
502int is_client_associated_to_ibss(struct adapter *padapter);
503int is_IBSS_empty(struct adapter *padapter);
504
505unsigned char check_assoc_AP(u8 *pframe, uint len);
506
507int WMM_param_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE);
508void WMMOnAssocRsp(struct adapter *padapter);
509
510void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE);
511void HT_info_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE);
512void HTOnAssocRsp(struct adapter *padapter);
513
514void ERP_IE_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE);
515void VCS_update(struct adapter *padapter, struct sta_info *psta);
516
517void update_beacon_info(struct adapter *padapter, u8 *pframe, uint len,
74df1cd7 518 struct sta_info *psta);
4218e5be
LF
519int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len);
520void update_IOT_info(struct adapter *padapter);
521void update_capinfo(struct adapter *adapter, u16 updatecap);
522void update_wireless_mode(struct adapter *padapter);
523void update_tx_basic_rate(struct adapter *padapter, u8 modulation);
524void update_bmc_sta_support_rate(struct adapter *padapter, u32 mac_id);
525int update_sta_support_rate(struct adapter *padapter, u8 *pvar_ie,
526 uint var_ie_len, int cam_idx);
527
528/* for sta/adhoc mode */
529void update_sta_info(struct adapter *padapter, struct sta_info *psta);
530unsigned int update_basic_rate(unsigned char *ptn, unsigned int ptn_sz);
531unsigned int update_supported_rate(unsigned char *ptn, unsigned int ptn_sz);
3d3cd94d 532unsigned int update_MSC_rate(struct ieee80211_ht_cap *pHT_caps);
4218e5be
LF
533void Update_RA_Entry(struct adapter *padapter, u32 mac_id);
534void set_sta_rate(struct adapter *padapter, struct sta_info *psta);
535
4218e5be 536unsigned char get_highest_rate_idx(u32 mask);
3d3cd94d 537int support_short_GI(struct adapter *padapter, struct ieee80211_ht_cap *caps);
4218e5be
LF
538unsigned int is_ap_in_tkip(struct adapter *padapter);
539unsigned int is_ap_in_wep(struct adapter *padapter);
540unsigned int should_forbid_n_rate(struct adapter *padapter);
541
542void report_join_res(struct adapter *padapter, int res);
f31cca8e
LF
543void report_survey_event(struct adapter *padapter,
544 struct recv_frame *precv_frame);
4218e5be
LF
545void report_surveydone_event(struct adapter *padapter);
546void report_del_sta_event(struct adapter *padapter,
547 unsigned char *addr, unsigned short reason);
c7333c11 548void report_add_sta_event(struct adapter *padapter, unsigned char *addr,
4218e5be
LF
549 int cam_idx);
550
551void beacon_timing_control(struct adapter *padapter);
ebea63f6 552u8 set_tx_beacon_cmd(struct adapter *padapter);
4218e5be
LF
553unsigned int setup_beacon_frame(struct adapter *padapter,
554 unsigned char *beacon_frame);
555void update_mgnt_tx_rate(struct adapter *padapter, u8 rate);
556void update_mgntframe_attrib(struct adapter *padapter,
557 struct pkt_attrib *pattrib);
782eddd7 558
4218e5be
LF
559int issue_nulldata(struct adapter *padapter, unsigned char *da,
560 unsigned int power_mode, int try_cnt, int wait_ms);
561int issue_qos_nulldata(struct adapter *padapter, unsigned char *da,
562 u16 tid, int try_cnt, int wait_ms);
563int issue_deauth(struct adapter *padapter, unsigned char *da,
564 unsigned short reason);
4218e5be
LF
565unsigned int send_delba(struct adapter *padapter, u8 initiator, u8 *addr);
566unsigned int send_beacon(struct adapter *padapter);
567
4218e5be
LF
568void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res);
569void mlmeext_sta_del_event_callback(struct adapter *padapter);
570void mlmeext_sta_add_event_callback(struct adapter *padapter,
571 struct sta_info *psta);
572
573void linked_status_chk(struct adapter *padapter);
574
28af7ea8
VT
575void survey_timer_hdl(unsigned long data);
576void link_timer_hdl(unsigned long data);
577void addba_timer_hdl(unsigned long data);
4218e5be
LF
578
579#define set_survey_timer(mlmeext, ms) \
4d4efe3e
VT
580 mod_timer(&mlmeext->survey_timer, jiffies + \
581 msecs_to_jiffies(ms))
4218e5be
LF
582
583#define set_link_timer(mlmeext, ms) \
4d4efe3e
VT
584 mod_timer(&mlmeext->link_timer, jiffies + \
585 msecs_to_jiffies(ms))
4218e5be
LF
586
587int cckrates_included(unsigned char *rate, int ratelen);
588int cckratesonly_included(unsigned char *rate, int ratelen);
589
590void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr);
591
592void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len);
593void correct_TSF(struct adapter *padapter, struct mlme_ext_priv *pmlmeext);
594
595struct cmd_hdl {
596 uint parmsize;
597 u8 (*h2cfuns)(struct adapter *padapter, u8 *pbuf);
598};
599
600u8 read_macreg_hdl(struct adapter *padapter, u8 *pbuf);
601u8 write_macreg_hdl(struct adapter *padapter, u8 *pbuf);
602u8 read_bbreg_hdl(struct adapter *padapter, u8 *pbuf);
603u8 write_bbreg_hdl(struct adapter *padapter, u8 *pbuf);
604u8 read_rfreg_hdl(struct adapter *padapter, u8 *pbuf);
605u8 write_rfreg_hdl(struct adapter *padapter, u8 *pbuf);
4218e5be
LF
606u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf);
607u8 disconnect_hdl(struct adapter *padapter, u8 *pbuf);
608u8 createbss_hdl(struct adapter *padapter, u8 *pbuf);
609u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf);
610u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf);
611u8 setauth_hdl(struct adapter *padapter, u8 *pbuf);
612u8 setkey_hdl(struct adapter *padapter, u8 *pbuf);
613u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf);
614u8 set_assocsta_hdl(struct adapter *padapter, u8 *pbuf);
615u8 del_assocsta_hdl(struct adapter *padapter, u8 *pbuf);
616u8 add_ba_hdl(struct adapter *padapter, unsigned char *pbuf);
617
618u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf);
619u8 h2c_msg_hdl(struct adapter *padapter, unsigned char *pbuf);
620u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf);
621u8 set_ch_hdl(struct adapter *padapter, u8 *pbuf);
622u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf);
623u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf);
624/* Handling DFS channel switch announcement ie. */
625u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf);
626u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf);
627
628#define GEN_DRV_CMD_HANDLER(size, cmd) {size, &cmd ## _hdl},
629#define GEN_MLME_EXT_HANDLER(size, cmd) {size, cmd},
630
631#ifdef _RTW_CMD_C_
632
633static struct cmd_hdl wlancmds[] = {
7be921a2
JH
634 GEN_MLME_EXT_HANDLER(sizeof(struct wlan_bssid_ex), join_cmd_hdl)
635 GEN_MLME_EXT_HANDLER(sizeof(struct disconnect_parm), disconnect_hdl)
636 GEN_MLME_EXT_HANDLER(sizeof(struct wlan_bssid_ex), createbss_hdl)
637 GEN_MLME_EXT_HANDLER(sizeof(struct setopmode_parm), setopmode_hdl)
638 GEN_MLME_EXT_HANDLER(sizeof(struct sitesurvey_parm), sitesurvey_cmd_hdl)
639 GEN_MLME_EXT_HANDLER(sizeof(struct setauth_parm), setauth_hdl)
640 GEN_MLME_EXT_HANDLER(sizeof(struct setkey_parm), setkey_hdl)
641 GEN_MLME_EXT_HANDLER(sizeof(struct set_stakey_parm), set_stakey_hdl)
642 GEN_MLME_EXT_HANDLER(sizeof(struct set_assocsta_parm), NULL)
4218e5be 643 GEN_MLME_EXT_HANDLER(sizeof(struct addBaReq_parm), add_ba_hdl)
7c8b4f4a 644 GEN_MLME_EXT_HANDLER(sizeof(struct set_ch_parm), set_ch_hdl)
645 GEN_MLME_EXT_HANDLER(sizeof(struct wlan_bssid_ex), tx_beacon_hdl)
646 GEN_MLME_EXT_HANDLER(0, mlme_evt_hdl)
647 GEN_MLME_EXT_HANDLER(0, rtw_drvextra_cmd_hdl)
7c8b4f4a 648 GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelPlan_param), set_chplan_hdl)
4218e5be
LF
649};
650
651#endif
652
653struct C2HEvent_Header {
654#ifdef __LITTLE_ENDIAN
655 unsigned int len:16;
656 unsigned int ID:8;
657 unsigned int seq:8;
658#elif defined(__BIG_ENDIAN)
659 unsigned int seq:8;
660 unsigned int ID:8;
661 unsigned int len:16;
662#endif
663 unsigned int rsvd;
664};
665
666void rtw_dummy_event_callback(struct adapter *adapter, u8 *pbuf);
667void rtw_fwdbg_event_callback(struct adapter *adapter, u8 *pbuf);
668
669enum rtw_c2h_event {
670 GEN_EVT_CODE(_Read_MACREG) = 0, /*0*/
671 GEN_EVT_CODE(_Read_BBREG),
672 GEN_EVT_CODE(_Read_RFREG),
673 GEN_EVT_CODE(_Read_EEPROM),
674 GEN_EVT_CODE(_Read_EFUSE),
675 GEN_EVT_CODE(_Read_CAM), /*5*/
676 GEN_EVT_CODE(_Get_BasicRate),
677 GEN_EVT_CODE(_Get_DataRate),
678 GEN_EVT_CODE(_Survey), /*8*/
679 GEN_EVT_CODE(_SurveyDone), /*9*/
680
e703f237 681 GEN_EVT_CODE(_JoinBss), /*10*/
4218e5be
LF
682 GEN_EVT_CODE(_AddSTA),
683 GEN_EVT_CODE(_DelSTA),
684 GEN_EVT_CODE(_AtimDone),
685 GEN_EVT_CODE(_TX_Report),
686 GEN_EVT_CODE(_CCX_Report), /*15*/
687 GEN_EVT_CODE(_DTM_Report),
688 GEN_EVT_CODE(_TX_Rate_Statistics),
689 GEN_EVT_CODE(_C2HLBK),
690 GEN_EVT_CODE(_FWDBG),
691 GEN_EVT_CODE(_C2HFEEDBACK), /*20*/
692 GEN_EVT_CODE(_ADDBA),
693 GEN_EVT_CODE(_C2HBCN),
694 GEN_EVT_CODE(_ReportPwrState), /* filen: only for PCIE, USB */
695 GEN_EVT_CODE(_CloseRF), /* filen: only for PCIE,
696 * work around ASPM */
697 MAX_C2HEVT
698};
699
700
701#ifdef _RTW_MLME_EXT_C_
702
703static struct fwevent wlanevents[] = {
704 {0, rtw_dummy_event_callback}, /*0*/
705 {0, NULL},
706 {0, NULL},
707 {0, NULL},
708 {0, NULL},
709 {0, NULL},
710 {0, NULL},
711 {0, NULL},
712 {0, &rtw_survey_event_callback}, /*8*/
7be921a2 713 {sizeof(struct surveydone_event), &rtw_surveydone_event_callback},/*9*/
4218e5be
LF
714 {0, &rtw_joinbss_event_callback}, /*10*/
715 {sizeof(struct stassoc_event), &rtw_stassoc_event_callback},
716 {sizeof(struct stadel_event), &rtw_stadel_event_callback},
717 {0, &rtw_atimdone_event_callback},
718 {0, rtw_dummy_event_callback},
719 {0, NULL}, /*15*/
720 {0, NULL},
721 {0, NULL},
722 {0, NULL},
723 {0, rtw_fwdbg_event_callback},
724 {0, NULL}, /*20*/
725 {0, NULL},
726 {0, NULL},
727 {0, &rtw_cpwm_event_callback},
d7a380b2 728 {0, NULL},
4218e5be
LF
729};
730
731#endif/* _RTL_MLME_EXT_C_ */
732
733#endif /* __RTW_MLME_EXT_H_ */
This page took 0.543211 seconds and 5 git commands to generate.