]>
Commit | Line | Data |
---|---|---|
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 | * | |
14 | * You should have received a copy of the GNU General Public License along with | |
15 | * this program; if not, write to the Free Software Foundation, Inc., | |
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA | |
17 | * | |
18 | * | |
19 | ******************************************************************************/ | |
20 | #ifndef __RTW_MLME_H_ | |
21 | #define __RTW_MLME_H_ | |
22 | ||
23 | #include <osdep_service.h> | |
24 | #include <mlme_osdep.h> | |
25 | #include <drv_types.h> | |
26 | #include <wlan_bssdef.h> | |
27 | ||
28 | #define MAX_BSS_CNT 128 | |
29 | #define MAX_JOIN_TIMEOUT 6500 | |
30 | ||
31 | /* Increase the scanning timeout because of increasing the SURVEY_TO value. */ | |
32 | ||
33 | #define SCANNING_TIMEOUT 8000 | |
34 | ||
35 | #define SCAN_INTERVAL (30) /* unit:2sec, 30*2=60sec */ | |
36 | ||
37 | #define SCANQUEUE_LIFETIME 20 /* unit:sec */ | |
38 | ||
39 | #define WIFI_NULL_STATE 0x00000000 | |
40 | ||
41 | #define WIFI_ASOC_STATE 0x00000001 /* Under Linked state */ | |
42 | #define WIFI_REASOC_STATE 0x00000002 | |
43 | #define WIFI_SLEEP_STATE 0x00000004 | |
44 | #define WIFI_STATION_STATE 0x00000008 | |
45 | ||
46 | #define WIFI_AP_STATE 0x00000010 | |
47 | #define WIFI_ADHOC_STATE 0x00000020 | |
48 | #define WIFI_ADHOC_MASTER_STATE 0x00000040 | |
49 | #define WIFI_UNDER_LINKING 0x00000080 | |
50 | ||
51 | #define WIFI_UNDER_WPS 0x00000100 | |
52 | #define WIFI_STA_ALIVE_CHK_STATE 0x00000400 | |
53 | #define WIFI_SITE_MONITOR 0x00000800 /* to indicate the station is under site surveying */ | |
54 | ||
55 | #define WIFI_MP_STATE 0x00010000 | |
f7bba924 MI |
56 | #define WIFI_MP_CTX_BACKGROUND 0x00020000 /* in continuous tx background */ |
57 | #define WIFI_MP_CTX_ST 0x00040000 /* in continuous tx with single-tone */ | |
58 | #define WIFI_MP_CTX_BACKGROUND_PENDING 0x00080000 /* pending in continuous tx background due to out of skb */ | |
59 | #define WIFI_MP_CTX_CCK_HW 0x00100000 /* in continuous tx */ | |
60 | #define WIFI_MP_CTX_CCK_CS 0x00200000 /* in continuous tx with carrier suppression */ | |
4218e5be LF |
61 | #define WIFI_MP_LPBK_STATE 0x00400000 |
62 | ||
63 | #define _FW_UNDER_LINKING WIFI_UNDER_LINKING | |
64 | #define _FW_LINKED WIFI_ASOC_STATE | |
65 | #define _FW_UNDER_SURVEY WIFI_SITE_MONITOR | |
66 | ||
67 | enum dot11AuthAlgrthmNum { | |
68 | dot11AuthAlgrthm_Open = 0, | |
69 | dot11AuthAlgrthm_Shared, | |
70 | dot11AuthAlgrthm_8021X, | |
71 | dot11AuthAlgrthm_Auto, | |
72 | dot11AuthAlgrthm_WAPI, | |
73 | dot11AuthAlgrthm_MaxNum | |
74 | }; | |
75 | ||
76 | /* Scan type including active and passive scan. */ | |
77 | enum rt_scan_type { | |
78 | SCAN_PASSIVE, | |
79 | SCAN_ACTIVE, | |
80 | SCAN_MIX, | |
81 | }; | |
82 | ||
83 | enum SCAN_RESULT_TYPE { | |
84 | SCAN_RESULT_P2P_ONLY = 0, /* Will return all the P2P devices. */ | |
85 | SCAN_RESULT_ALL = 1, /* Will return all the scanned device, | |
86 | * include AP. */ | |
87 | SCAN_RESULT_WFD_TYPE = 2 /* Will just return the correct WFD | |
88 | * device. */ | |
89 | /* If this device is Miracast sink | |
90 | * device, it will just return all the | |
91 | * Miracast source devices. */ | |
92 | }; | |
93 | ||
94 | /* | |
95 | there are several "locks" in mlme_priv, | |
96 | since mlme_priv is a shared resource between many threads, | |
97 | like ISR/Call-Back functions, the OID handlers, and even timer functions. | |
98 | ||
99 | Each _queue has its own locks, already. | |
100 | Other items are protected by mlme_priv.lock. | |
101 | ||
102 | To avoid possible dead lock, any thread trying to modifiying mlme_priv | |
103 | SHALL not lock up more than one lock at a time! | |
104 | */ | |
105 | ||
106 | #define traffic_threshold 10 | |
107 | #define traffic_scan_period 500 | |
108 | ||
4218e5be LF |
109 | struct rt_link_detect { |
110 | u32 NumTxOkInPeriod; | |
111 | u32 NumRxOkInPeriod; | |
112 | u32 NumRxUnicastOkInPeriod; | |
113 | bool bBusyTraffic; | |
114 | bool bTxBusyTraffic; | |
115 | bool bRxBusyTraffic; | |
116 | bool bHigherBusyTraffic; /* For interrupt migration purpose. */ | |
117 | bool bHigherBusyRxTraffic; /* We may disable Tx interrupt according | |
118 | * to Rx traffic. */ | |
119 | bool bHigherBusyTxTraffic; /* We may disable Tx interrupt according | |
120 | * to Tx traffic. */ | |
121 | }; | |
122 | ||
123 | struct profile_info { | |
124 | u8 ssidlen; | |
1f4c095a TJP |
125 | u8 ssid[WLAN_SSID_MAXLEN]; |
126 | u8 peermac[ETH_ALEN]; | |
4218e5be LF |
127 | }; |
128 | ||
129 | struct tx_invite_req_info { | |
130 | u8 token; | |
131 | u8 benable; | |
1f4c095a | 132 | u8 go_ssid[WLAN_SSID_MAXLEN]; |
4218e5be | 133 | u8 ssidlen; |
1f4c095a TJP |
134 | u8 go_bssid[ETH_ALEN]; |
135 | u8 peer_macaddr[ETH_ALEN]; | |
4218e5be LF |
136 | u8 operating_ch; /* This information will be set by using the |
137 | * p2p_set op_ch=x */ | |
138 | u8 peer_ch; /* The listen channel for peer P2P device */ | |
139 | }; | |
140 | ||
141 | struct tx_invite_resp_info { | |
142 | u8 token; /* Used to record the dialog token of p2p invitation | |
143 | * request frame. */ | |
144 | }; | |
145 | ||
146 | struct tx_provdisc_req_info { | |
147 | u16 wps_config_method_request; /* Used when sending the | |
148 | * provisioning request frame*/ | |
149 | u16 peer_channel_num[2]; /* The channel number which the | |
150 | * receiver stands. */ | |
151 | struct ndis_802_11_ssid ssid; | |
152 | u8 peerDevAddr[ETH_ALEN]; /* Peer device address */ | |
153 | u8 peerIFAddr[ETH_ALEN]; /* Peer interface address */ | |
154 | u8 benable; /* This provision discovery | |
155 | * request frame is trigger | |
156 | * to send or not */ | |
157 | }; | |
158 | ||
159 | /* When peer device issue prov_disc_req first, we should store the following | |
160 | * information */ | |
161 | /* The UI must know this information to know which config method the | |
162 | * remote p2p device needs. */ | |
163 | struct rx_provdisc_req_info { | |
164 | u8 peerDevAddr[ETH_ALEN]; /* Peer device address */ | |
165 | u8 strconfig_method_desc_of_prov_disc_req[4]; /* description | |
166 | * for the config method located in the provisioning | |
167 | * discovery request frame. */ | |
168 | }; | |
169 | ||
170 | struct tx_nego_req_info { | |
171 | u16 peer_channel_num[2]; /* The channel number. */ | |
172 | u8 peerDevAddr[ETH_ALEN]; /* Peer device address */ | |
173 | u8 benable; /* This negotiation request frame is | |
174 | * trigger to send or not */ | |
175 | }; | |
176 | ||
177 | struct group_id_info { | |
1f4c095a | 178 | u8 go_device_addr[ETH_ALEN]; /* The GO's device address of |
4218e5be | 179 | * this P2P group */ |
1f4c095a | 180 | u8 ssid[WLAN_SSID_MAXLEN]; /* The SSID of this P2P group */ |
4218e5be LF |
181 | }; |
182 | ||
183 | struct scan_limit_info { | |
184 | u8 scan_op_ch_only; /* When this flag is set, the driver | |
185 | * should only scan the op. channel */ | |
186 | u8 operation_ch[2]; /* Store the op. chan of invitation */ | |
187 | }; | |
188 | ||
189 | struct wifidirect_info { | |
190 | struct adapter *padapter; | |
191 | struct timer_list find_phase_timer; | |
192 | struct timer_list restore_p2p_state_timer; | |
193 | ||
194 | /* Used to do the scanning. After confirming the peer is availalble, | |
195 | * the driver transmits the P2P frame to peer. */ | |
196 | struct timer_list pre_tx_scan_timer; | |
197 | struct timer_list reset_ch_sitesurvey; | |
198 | struct timer_list reset_ch_sitesurvey2; /* Just for resetting the scan | |
199 | * limit function by using p2p nego */ | |
200 | struct tx_provdisc_req_info tx_prov_disc_info; | |
201 | struct rx_provdisc_req_info rx_prov_disc_info; | |
202 | struct tx_invite_req_info invitereq_info; | |
203 | /* Store the profile information of persistent group */ | |
204 | struct profile_info profileinfo[P2P_MAX_PERSISTENT_GROUP_NUM]; | |
205 | struct tx_invite_resp_info inviteresp_info; | |
206 | struct tx_nego_req_info nego_req_info; | |
207 | /* Store the group id info when doing the group negot handshake. */ | |
208 | struct group_id_info groupid_info; | |
209 | /* Used for get the limit scan channel from the Invitation procedure */ | |
210 | struct scan_limit_info rx_invitereq_info; | |
211 | /* Used for get the limit scan chan from the P2P negotiation handshake*/ | |
212 | struct scan_limit_info p2p_info; | |
213 | enum P2P_ROLE role; | |
214 | enum P2P_STATE pre_p2p_state; | |
215 | enum P2P_STATE p2p_state; | |
216 | /* The device address should be the mac address of this device. */ | |
217 | u8 device_addr[ETH_ALEN]; | |
218 | u8 interface_addr[ETH_ALEN]; | |
219 | u8 social_chan[4]; | |
220 | u8 listen_channel; | |
221 | u8 operating_channel; | |
222 | u8 listen_dwell; /* This value should be between 1 and 3 */ | |
223 | u8 support_rate[8]; | |
224 | u8 p2p_wildcard_ssid[P2P_WILDCARD_SSID_LEN]; | |
225 | u8 intent; /* should only include the intent value. */ | |
226 | u8 p2p_peer_interface_addr[ETH_ALEN]; | |
227 | u8 p2p_peer_device_addr[ETH_ALEN]; | |
228 | u8 peer_intent; /* Included the intent value and tie breaker value. */ | |
229 | /* Device name for displaying on searching device screen */ | |
230 | u8 device_name[WPS_MAX_DEVICE_NAME_LEN]; | |
231 | u8 device_name_len; | |
232 | u8 profileindex; /* Used to point to the index of profileinfo array */ | |
233 | u8 peer_operating_ch; | |
234 | u8 find_phase_state_exchange_cnt; | |
f7bba924 | 235 | /* The device password ID for group negotiation */ |
4218e5be LF |
236 | u16 device_password_id_for_nego; |
237 | u8 negotiation_dialog_token; | |
238 | /* SSID information for group negotitation */ | |
239 | u8 nego_ssid[WLAN_SSID_MAXLEN]; | |
240 | u8 nego_ssidlen; | |
241 | u8 p2p_group_ssid[WLAN_SSID_MAXLEN]; | |
242 | u8 p2p_group_ssid_len; | |
243 | /* Flag to know if the persistent function should be supported or not.*/ | |
244 | u8 persistent_supported; | |
245 | /* In the Sigma test, the Sigma will provide this enable from the | |
246 | * sta_set_p2p CAPI. */ | |
247 | /* 0: disable */ | |
248 | /* 1: enable */ | |
249 | u8 session_available; /* Flag to set the WFD session available to | |
250 | * enable or disable "by Sigma" */ | |
251 | /* In the Sigma test, the Sigma will disable the session available | |
252 | * by using the sta_preset CAPI. */ | |
253 | /* 0: disable */ | |
254 | /* 1: enable */ | |
255 | u8 wfd_tdls_enable; /* Flag to enable or disable the TDLS by WFD Sigma*/ | |
256 | /* 0: disable */ | |
257 | /* 1: enable */ | |
258 | u8 wfd_tdls_weaksec; /* Flag to enable or disable the weak security | |
259 | * function for TDLS by WFD Sigma */ | |
260 | /* 0: disable */ | |
261 | /* In this case, the driver can't issue the tdsl | |
262 | * setup request frame. */ | |
263 | /* 1: enable */ | |
264 | /* In this case, the driver can issue the tdls | |
265 | * setup request frame */ | |
266 | /* even the current security is weak security. */ | |
267 | ||
268 | /* This field will store the WPS value (PIN value or PBC) that UI had | |
269 | * got from the user. */ | |
270 | enum P2P_WPSINFO ui_got_wps_info; | |
271 | u16 supported_wps_cm; /* This field describes the WPS config method | |
272 | * which this driver supported. */ | |
273 | /* The value should be the combination of config | |
274 | * method defined in page104 of WPS v2.0 spec.*/ | |
275 | /* This field will contain the length of body of P2P Channel List | |
276 | * attribute of group negotiation response frame. */ | |
277 | uint channel_list_attr_len; | |
278 | /* This field will contain the body of P2P Channel List attribute of | |
279 | * group negotitation response frame. */ | |
280 | /* We will use the channel_cnt and channel_list fields when constructing | |
281 | * the group negotiation confirm frame. */ | |
282 | u8 channel_list_attr[100]; | |
283 | enum P2P_PS_MODE p2p_ps_mode; /* indicate p2p ps mode */ | |
284 | enum P2P_PS_STATE p2p_ps_state; /* indicate p2p ps state */ | |
285 | u8 noa_index; /* Identifies and instance of Notice of Absence timing. */ | |
286 | u8 ctwindow; /* Client traffic window. A period of time in TU after TBTT. */ | |
287 | u8 opp_ps; /* opportunistic power save. */ | |
288 | u8 noa_num; /* number of NoA descriptor in P2P IE. */ | |
289 | u8 noa_count[P2P_MAX_NOA_NUM]; /* Count for owner, Type of client. */ | |
290 | /* Max duration for owner, preferred or min acceptable duration for | |
291 | * client. */ | |
292 | u32 noa_duration[P2P_MAX_NOA_NUM]; | |
293 | /* Length of interval for owner, preferred or max acceptable interval | |
294 | * of client. */ | |
295 | u32 noa_interval[P2P_MAX_NOA_NUM]; | |
296 | /* schedule expressed in terms of the lower 4 bytes of the TSF timer. */ | |
297 | u32 noa_start_time[P2P_MAX_NOA_NUM]; | |
298 | }; | |
299 | ||
4218e5be LF |
300 | struct mlme_priv { |
301 | spinlock_t lock; | |
302 | int fw_state; /* shall we protect this variable? maybe not necessarily... */ | |
303 | u8 bScanInProcess; | |
304 | u8 to_join; /* flag */ | |
305 | u8 to_roaming; /* roaming trying times */ | |
306 | ||
307 | u8 *nic_hdl; | |
308 | ||
309 | u8 not_indic_disco; | |
310 | struct list_head *pscanned; | |
311 | struct __queue free_bss_pool; | |
312 | struct __queue scanned_queue; | |
313 | u8 *free_bss_buf; | |
314 | u32 num_of_scanned; | |
315 | ||
316 | struct ndis_802_11_ssid assoc_ssid; | |
317 | u8 assoc_bssid[6]; | |
318 | ||
319 | struct wlan_network cur_network; | |
320 | ||
321 | u32 scan_interval; | |
322 | ||
323 | struct timer_list assoc_timer; | |
324 | ||
325 | uint assoc_by_bssid; | |
326 | uint assoc_by_rssi; | |
327 | ||
328 | struct timer_list scan_to_timer; /* driver itself handles scan_timeout status. */ | |
329 | u32 scan_start_time; /* used to evaluate the time spent in scanning */ | |
330 | ||
331 | struct qos_priv qospriv; | |
332 | ||
333 | /* Number of non-HT AP/stations */ | |
334 | int num_sta_no_ht; | |
335 | ||
336 | /* Number of HT AP/stations 20 MHz */ | |
337 | /* int num_sta_ht_20mhz; */ | |
338 | ||
339 | int num_FortyMHzIntolerant; | |
340 | struct ht_priv htpriv; | |
341 | struct rt_link_detect LinkDetectInfo; | |
342 | struct timer_list dynamic_chk_timer; /* dynamic/periodic check timer */ | |
343 | ||
344 | u8 key_mask; /* use for ips to set wep key after ips_leave */ | |
345 | u8 acm_mask; /* for wmm acm mask */ | |
346 | u8 ChannelPlan; | |
347 | enum rt_scan_type scan_mode; /* active: 1, passive: 0 */ | |
348 | ||
349 | /* u8 probereq_wpsie[MAX_WPS_IE_LEN];added in probe req */ | |
350 | /* int probereq_wpsie_len; */ | |
351 | u8 *wps_probe_req_ie; | |
352 | u32 wps_probe_req_ie_len; | |
353 | ||
354 | u8 *assoc_req; | |
355 | u32 assoc_req_len; | |
356 | u8 *assoc_rsp; | |
357 | u32 assoc_rsp_len; | |
358 | ||
1f4c095a | 359 | #if defined(CONFIG_88EU_AP_MODE) |
4218e5be LF |
360 | /* Number of associated Non-ERP stations (i.e., stations using 802.11b |
361 | * in 802.11g BSS) */ | |
362 | int num_sta_non_erp; | |
363 | ||
364 | /* Number of associated stations that do not support Short Slot Time */ | |
365 | int num_sta_no_short_slot_time; | |
366 | ||
367 | /* Number of associated stations that do not support Short Preamble */ | |
368 | int num_sta_no_short_preamble; | |
369 | ||
370 | int olbc; /* Overlapping Legacy BSS Condition */ | |
371 | ||
372 | /* Number of HT assoc sta that do not support greenfield */ | |
373 | int num_sta_ht_no_gf; | |
374 | ||
375 | /* Number of associated non-HT stations */ | |
376 | /* int num_sta_no_ht; */ | |
377 | ||
378 | /* Number of HT associated stations 20 MHz */ | |
379 | int num_sta_ht_20mhz; | |
380 | ||
381 | /* Overlapping BSS information */ | |
382 | int olbc_ht; | |
383 | ||
384 | u16 ht_op_mode; | |
385 | ||
386 | u8 *wps_beacon_ie; | |
387 | /* u8 *wps_probe_req_ie; */ | |
388 | u8 *wps_probe_resp_ie; | |
389 | u8 *wps_assoc_resp_ie; | |
390 | ||
391 | u32 wps_beacon_ie_len; | |
392 | u32 wps_probe_resp_ie_len; | |
393 | u32 wps_assoc_resp_ie_len; | |
394 | ||
395 | u8 *p2p_beacon_ie; | |
396 | u8 *p2p_probe_req_ie; | |
397 | u8 *p2p_probe_resp_ie; | |
398 | u8 *p2p_go_probe_resp_ie; /* for GO */ | |
399 | u8 *p2p_assoc_req_ie; | |
400 | ||
401 | u32 p2p_beacon_ie_len; | |
402 | u32 p2p_probe_req_ie_len; | |
403 | u32 p2p_probe_resp_ie_len; | |
404 | u32 p2p_go_probe_resp_ie_len; /* for GO */ | |
405 | u32 p2p_assoc_req_ie_len; | |
406 | spinlock_t bcn_update_lock; | |
407 | u8 update_bcn; | |
408 | #endif /* if defined (CONFIG_88EU_AP_MODE) */ | |
409 | }; | |
410 | ||
411 | #ifdef CONFIG_88EU_AP_MODE | |
412 | ||
413 | struct hostapd_priv { | |
414 | struct adapter *padapter; | |
415 | }; | |
416 | ||
417 | int hostapd_mode_init(struct adapter *padapter); | |
418 | void hostapd_mode_unload(struct adapter *padapter); | |
419 | #endif | |
420 | ||
421 | extern unsigned char WPA_TKIP_CIPHER[4]; | |
422 | extern unsigned char RSN_TKIP_CIPHER[4]; | |
423 | extern unsigned char REALTEK_96B_IE[]; | |
424 | extern unsigned char MCS_rate_2R[16]; | |
425 | extern unsigned char MCS_rate_1R[16]; | |
426 | ||
427 | void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf); | |
428 | void rtw_survey_event_callback(struct adapter *adapter, u8 *pbuf); | |
429 | void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf); | |
430 | void rtw_joinbss_event_callback(struct adapter *adapter, u8 *pbuf); | |
431 | void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf); | |
432 | void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf); | |
433 | void rtw_atimdone_event_callback(struct adapter *adapter, u8 *pbuf); | |
434 | void rtw_cpwm_event_callback(struct adapter *adapter, u8 *pbuf); | |
435 | void indicate_wx_scan_complete_event(struct adapter *padapter); | |
436 | void rtw_indicate_wx_assoc_event(struct adapter *padapter); | |
437 | void rtw_indicate_wx_disassoc_event(struct adapter *padapter); | |
438 | int event_thread(void *context); | |
4218e5be LF |
439 | void rtw_free_network_queue(struct adapter *adapter, u8 isfreeall); |
440 | int rtw_init_mlme_priv(struct adapter *adapter); | |
1f4c095a | 441 | void rtw_free_mlme_priv(struct mlme_priv *pmlmepriv); |
4218e5be LF |
442 | int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv); |
443 | int rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, | |
444 | int keyid, u8 set_tx); | |
445 | int rtw_set_auth(struct adapter *adapter, struct security_priv *psecuritypriv); | |
446 | ||
447 | static inline u8 *get_bssid(struct mlme_priv *pmlmepriv) | |
448 | { /* if sta_mode:pmlmepriv->cur_network.network.MacAddress=> bssid */ | |
449 | /* if adhoc_mode:pmlmepriv->cur_network.network.MacAddress=> ibss mac address */ | |
450 | return pmlmepriv->cur_network.network.MacAddress; | |
451 | } | |
452 | ||
453 | static inline int check_fwstate(struct mlme_priv *pmlmepriv, int state) | |
454 | { | |
455 | if (pmlmepriv->fw_state & state) | |
456 | return true; | |
457 | ||
458 | return false; | |
459 | } | |
460 | ||
461 | static inline int get_fwstate(struct mlme_priv *pmlmepriv) | |
462 | { | |
463 | return pmlmepriv->fw_state; | |
464 | } | |
465 | ||
466 | /* | |
467 | * No Limit on the calling context, | |
468 | * therefore set it to be the critical section... | |
469 | * | |
470 | * ### NOTE:#### (!!!!) | |
471 | * MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock | |
472 | */ | |
473 | static inline void set_fwstate(struct mlme_priv *pmlmepriv, int state) | |
474 | { | |
475 | pmlmepriv->fw_state |= state; | |
476 | /* FOR HW integration */ | |
3f35c7ff | 477 | if (_FW_UNDER_SURVEY == state) |
4218e5be LF |
478 | pmlmepriv->bScanInProcess = true; |
479 | } | |
480 | ||
481 | static inline void _clr_fwstate_(struct mlme_priv *pmlmepriv, int state) | |
482 | { | |
483 | pmlmepriv->fw_state &= ~state; | |
484 | /* FOR HW integration */ | |
3f35c7ff | 485 | if (_FW_UNDER_SURVEY == state) |
4218e5be LF |
486 | pmlmepriv->bScanInProcess = false; |
487 | } | |
488 | ||
489 | /* | |
490 | * No Limit on the calling context, | |
491 | * therefore set it to be the critical section... | |
492 | */ | |
493 | static inline void clr_fwstate(struct mlme_priv *pmlmepriv, int state) | |
494 | { | |
7057dcb3 | 495 | spin_lock_bh(&pmlmepriv->lock); |
4218e5be LF |
496 | if (check_fwstate(pmlmepriv, state) == true) |
497 | pmlmepriv->fw_state ^= state; | |
e02bcf61 | 498 | spin_unlock_bh(&pmlmepriv->lock); |
4218e5be LF |
499 | } |
500 | ||
501 | static inline void clr_fwstate_ex(struct mlme_priv *pmlmepriv, int state) | |
502 | { | |
7057dcb3 | 503 | spin_lock_bh(&pmlmepriv->lock); |
4218e5be | 504 | _clr_fwstate_(pmlmepriv, state); |
e02bcf61 | 505 | spin_unlock_bh(&pmlmepriv->lock); |
4218e5be LF |
506 | } |
507 | ||
508 | static inline void up_scanned_network(struct mlme_priv *pmlmepriv) | |
509 | { | |
7057dcb3 | 510 | spin_lock_bh(&pmlmepriv->lock); |
4218e5be | 511 | pmlmepriv->num_of_scanned++; |
e02bcf61 | 512 | spin_unlock_bh(&pmlmepriv->lock); |
4218e5be LF |
513 | } |
514 | ||
515 | static inline void down_scanned_network(struct mlme_priv *pmlmepriv) | |
516 | { | |
7057dcb3 | 517 | spin_lock_bh(&pmlmepriv->lock); |
4218e5be | 518 | pmlmepriv->num_of_scanned--; |
e02bcf61 | 519 | spin_unlock_bh(&pmlmepriv->lock); |
4218e5be LF |
520 | } |
521 | ||
522 | static inline void set_scanned_network_val(struct mlme_priv *pmlmepriv, int val) | |
523 | { | |
7057dcb3 | 524 | spin_lock_bh(&pmlmepriv->lock); |
4218e5be | 525 | pmlmepriv->num_of_scanned = val; |
e02bcf61 | 526 | spin_unlock_bh(&pmlmepriv->lock); |
4218e5be LF |
527 | } |
528 | ||
529 | u16 rtw_get_capability(struct wlan_bssid_ex *bss); | |
530 | void rtw_update_scanned_network(struct adapter *adapter, | |
531 | struct wlan_bssid_ex *target); | |
532 | void rtw_disconnect_hdl_under_linked(struct adapter *adapter, | |
533 | struct sta_info *psta, u8 free_assoc); | |
534 | void rtw_generate_random_ibss(u8 *pibss); | |
535 | struct wlan_network *rtw_find_network(struct __queue *scanned_queue, u8 *addr); | |
536 | struct wlan_network *rtw_get_oldest_wlan_network(struct __queue *scanned_queue); | |
537 | ||
538 | void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue); | |
539 | void rtw_indicate_disconnect(struct adapter *adapter); | |
540 | void rtw_indicate_connect(struct adapter *adapter); | |
1f4c095a | 541 | void rtw_indicate_scan_done(struct adapter *padapter, bool aborted); |
4218e5be LF |
542 | void rtw_scan_abort(struct adapter *adapter); |
543 | ||
544 | int rtw_restruct_sec_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, | |
545 | uint in_len); | |
546 | int rtw_restruct_wmm_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, | |
547 | uint in_len, uint initial_out_len); | |
548 | void rtw_init_registrypriv_dev_network(struct adapter *adapter); | |
549 | ||
550 | void rtw_update_registrypriv_dev_network(struct adapter *adapter); | |
551 | ||
552 | void rtw_get_encrypt_decrypt_from_registrypriv(struct adapter *adapter); | |
553 | ||
28af7ea8 VT |
554 | void _rtw_join_timeout_handler(unsigned long data); |
555 | void rtw_scan_timeout_handler(unsigned long data); | |
4218e5be | 556 | |
28af7ea8 | 557 | void rtw_dynamic_check_timer_handlder(unsigned long data); |
4218e5be LF |
558 | #define rtw_is_scan_deny(adapter) false |
559 | #define rtw_clear_scan_deny(adapter) do {} while (0) | |
560 | #define rtw_set_scan_deny_timer_hdl(adapter) do {} while (0) | |
561 | #define rtw_set_scan_deny(adapter, ms) do {} while (0) | |
562 | ||
4218e5be LF |
563 | void rtw_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv); |
564 | ||
1f4c095a | 565 | struct wlan_network *_rtw_alloc_network(struct mlme_priv *pmlmepriv); |
4218e5be | 566 | |
4218e5be LF |
567 | void _rtw_free_network_nolock(struct mlme_priv *pmlmepriv, |
568 | struct wlan_network *pnetwork); | |
569 | ||
4218e5be LF |
570 | int rtw_if_up(struct adapter *padapter); |
571 | ||
4218e5be | 572 | u8 *rtw_get_capability_from_ie(u8 *ie); |
4218e5be LF |
573 | u8 *rtw_get_beacon_interval_from_ie(u8 *ie); |
574 | ||
4218e5be LF |
575 | void rtw_joinbss_reset(struct adapter *padapter); |
576 | ||
577 | unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, | |
578 | u8 *out_ie, uint in_len, uint *pout_len); | |
579 | void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len); | |
580 | void rtw_issue_addbareq_cmd(struct adapter *padapter, | |
581 | struct xmit_frame *pxmitframe); | |
582 | ||
583 | int rtw_is_same_ibss(struct adapter *adapter, struct wlan_network *pnetwork); | |
584 | int is_same_network(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst); | |
585 | ||
586 | void rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network); | |
587 | void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network); | |
588 | ||
3f35c7ff | 589 | void rtw_stassoc_hw_rpt(struct adapter *adapter, struct sta_info *psta); |
4218e5be LF |
590 | |
591 | #endif /* __RTL871X_MLME_H_ */ |