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