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