• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 	u8 wfd_tdls_enable; /* Flag to enable or disable the TDLS by WFD Sigma*/
247 			    /* 0: disable */
248 			    /*	1: enable */
249 	u8 wfd_tdls_weaksec; /* Flag to enable or disable the weak security
250 			      * function for TDLS by WFD Sigma */
251 			     /* 0: disable */
252 			     /* In this case, the driver can't issue the tdsl
253 			      * setup request frame. */
254 			     /*	1: enable */
255 			     /* In this case, the driver can issue the tdls
256 			      * setup request frame */
257 			     /*	even the current security is weak security. */
258 
259 	/* This field will store the WPS value (PIN value or PBC) that UI had
260 	 * got from the user. */
261 	enum	P2P_WPSINFO ui_got_wps_info;
262 	u16 supported_wps_cm;	/* This field describes the WPS config method
263 				 * which this driver supported. */
264 				/* The value should be the combination of config
265 				 * method defined in page104 of WPS v2.0 spec.*/
266 	/* This field will contain the length of body of P2P Channel List
267 	 * attribute of group negotiation response frame. */
268 	uint channel_list_attr_len;
269 	/* This field will contain the body of P2P Channel List attribute of
270 	 * group negotitation response frame. */
271 	/* We will use the channel_cnt and channel_list fields when constructing
272 	 * the group negotiation confirm frame. */
273 	u8 channel_list_attr[100];
274 	enum P2P_PS_MODE p2p_ps_mode; /*  indicate p2p ps mode */
275 	enum P2P_PS_STATE p2p_ps_state; /*  indicate p2p ps state */
276 	u8 noa_index; /*  Identifies and instance of Notice of Absence timing. */
277 	u8 ctwindow; /*  Client traffic window. A period of time in TU after TBTT. */
278 	u8 opp_ps; /*  opportunistic power save. */
279 	u8 noa_num; /*  number of NoA descriptor in P2P IE. */
280 	u8 noa_count[P2P_MAX_NOA_NUM]; /*  Count for owner, Type of client. */
281 	/* Max duration for owner, preferred or min acceptable duration for
282 	 * client. */
283 	u32 noa_duration[P2P_MAX_NOA_NUM];
284 	/* Length of interval for owner, preferred or max acceptable interval
285 	 * of client. */
286 	u32 noa_interval[P2P_MAX_NOA_NUM];
287 	/* schedule expressed in terms of the lower 4 bytes of the TSF timer. */
288 	u32 noa_start_time[P2P_MAX_NOA_NUM];
289 };
290 
291 struct tdls_ss_record {	/* signal strength record */
292 	u8 macaddr[ETH_ALEN];
293 	u8 RxPWDBAll;
294 	u8 is_tdls_sta;	/*  true: direct link sta, false: else */
295 };
296 
297 struct tdls_info {
298 	u8 ap_prohibited;
299 	uint setup_state;
300 	u8 sta_cnt;
301 	u8 sta_maximum;	/*  1:tdls sta is equal (NUM_STA-1), reach max direct link number; 0: else; */
302 	struct tdls_ss_record	ss_record;
303 	u8 macid_index;	/* macid entry that is ready to write */
304 	u8 clear_cam;	/* cam entry that is trying to clear, using it in direct link teardown */
305 	u8 ch_sensing;
306 	u8 cur_channel;
307 	u8 candidate_ch;
308 	u8 collect_pkt_num[MAX_CHANNEL_NUM];
309 	spinlock_t cmd_lock;
310 	spinlock_t hdl_lock;
311 	u8 watchdog_count;
312 	u8 dev_discovered;		/* WFD_TDLS: for sigma test */
313 	u8 enable;
314 };
315 
316 struct qos_priv {
317 	/* bit mask option: u-apsd,
318 	 * s-apsd, ts, block ack... */
319 	unsigned int qos_option;
320 };
321 
322 struct mlme_priv {
323 	spinlock_t lock;
324 	int fw_state;	/* shall we protect this variable? maybe not necessarily... */
325 	u8 bScanInProcess;
326 	u8 to_join; /* flag */
327 	u8 to_roaming; /*  roaming trying times */
328 
329 	u8 *nic_hdl;
330 
331 	u8 not_indic_disco;
332 	struct list_head *pscanned;
333 	struct __queue free_bss_pool;
334 	struct __queue scanned_queue;
335 	u8 *free_bss_buf;
336 	u8	key_mask; /* use to restore wep key after hal_init */
337 	u32	num_of_scanned;
338 
339 	struct ndis_802_11_ssid	assoc_ssid;
340 	u8	assoc_bssid[6];
341 
342 	struct wlan_network	cur_network;
343 	struct wlan_network *cur_network_scanned;
344 
345 	u32	scan_interval;
346 
347 	struct timer_list assoc_timer;
348 
349 	uint assoc_by_bssid;
350 	uint assoc_by_rssi;
351 
352 	struct timer_list scan_to_timer; /*  driver itself handles scan_timeout status. */
353 	u32 scan_start_time; /*  used to evaluate the time spent in scanning */
354 
355 	struct qos_priv qospriv;
356 
357 	/* Number of non-HT AP/stations */
358 	int num_sta_no_ht;
359 
360 	/* Number of HT AP/stations 20 MHz */
361 	/* int num_sta_ht_20mhz; */
362 
363 	int num_FortyMHzIntolerant;
364 	struct ht_priv	htpriv;
365 	struct rt_link_detect LinkDetectInfo;
366 	struct timer_list dynamic_chk_timer; /* dynamic/periodic check timer */
367 
368 	u8	acm_mask; /*  for wmm acm mask */
369 	u8	ChannelPlan;
370 	enum rt_scan_type scan_mode; /*  active: 1, passive: 0 */
371 
372 	/* u8 probereq_wpsie[MAX_WPS_IE_LEN];added in probe req */
373 	/* int probereq_wpsie_len; */
374 	u8 *wps_probe_req_ie;
375 	u32 wps_probe_req_ie_len;
376 
377 	u8 *assoc_req;
378 	u32 assoc_req_len;
379 	u8 *assoc_rsp;
380 	u32 assoc_rsp_len;
381 
382 #if defined (CONFIG_88EU_AP_MODE)
383 	/* Number of associated Non-ERP stations (i.e., stations using 802.11b
384 	 * in 802.11g BSS) */
385 	int num_sta_non_erp;
386 
387 	/* Number of associated stations that do not support Short Slot Time */
388 	int num_sta_no_short_slot_time;
389 
390 	/* Number of associated stations that do not support Short Preamble */
391 	int num_sta_no_short_preamble;
392 
393 	int olbc; /* Overlapping Legacy BSS Condition */
394 
395 	/* Number of HT assoc sta that do not support greenfield */
396 	int num_sta_ht_no_gf;
397 
398 	/* Number of associated non-HT stations */
399 	/* int num_sta_no_ht; */
400 
401 	/* Number of HT associated stations 20 MHz */
402 	int num_sta_ht_20mhz;
403 
404 	/* Overlapping BSS information */
405 	int olbc_ht;
406 
407 	u16 ht_op_mode;
408 
409 	u8 *wps_beacon_ie;
410 	/* u8 *wps_probe_req_ie; */
411 	u8 *wps_probe_resp_ie;
412 	u8 *wps_assoc_resp_ie;
413 
414 	u32 wps_beacon_ie_len;
415 	u32 wps_probe_resp_ie_len;
416 	u32 wps_assoc_resp_ie_len;
417 
418 	u8 *p2p_beacon_ie;
419 	u8 *p2p_probe_req_ie;
420 	u8 *p2p_probe_resp_ie;
421 	u8 *p2p_go_probe_resp_ie; /* for GO */
422 	u8 *p2p_assoc_req_ie;
423 
424 	u32 p2p_beacon_ie_len;
425 	u32 p2p_probe_req_ie_len;
426 	u32 p2p_probe_resp_ie_len;
427 	u32 p2p_go_probe_resp_ie_len; /* for GO */
428 	u32 p2p_assoc_req_ie_len;
429 	spinlock_t bcn_update_lock;
430 	u8		update_bcn;
431 #endif /* if defined (CONFIG_88EU_AP_MODE) */
432 };
433 
434 #ifdef CONFIG_88EU_AP_MODE
435 
436 struct hostapd_priv {
437 	struct adapter *padapter;
438 };
439 
440 int hostapd_mode_init(struct adapter *padapter);
441 void hostapd_mode_unload(struct adapter *padapter);
442 #endif
443 
444 extern unsigned char WPA_TKIP_CIPHER[4];
445 extern unsigned char RSN_TKIP_CIPHER[4];
446 extern unsigned char REALTEK_96B_IE[];
447 extern unsigned char	MCS_rate_2R[16];
448 extern unsigned char	MCS_rate_1R[16];
449 
450 void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf);
451 void rtw_survey_event_callback(struct adapter *adapter, u8 *pbuf);
452 void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf);
453 void rtw_joinbss_event_callback(struct adapter *adapter, u8 *pbuf);
454 void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf);
455 void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf);
456 void indicate_wx_scan_complete_event(struct adapter *padapter);
457 void rtw_indicate_wx_assoc_event(struct adapter *padapter);
458 void rtw_indicate_wx_disassoc_event(struct adapter *padapter);
459 int event_thread(void *context);
460 void rtw_join_timeout_handler (struct timer_list *t);
461 void _rtw_scan_timeout_handler (struct timer_list *t);
462 void rtw_free_network_queue(struct adapter *adapter, u8 isfreeall);
463 int rtw_init_mlme_priv(struct adapter *adapter);
464 void rtw_free_mlme_priv (struct mlme_priv *pmlmepriv);
465 int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv);
466 int rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv,
467 		int keyid, u8 set_tx);
468 int rtw_set_auth(struct adapter *adapter, struct security_priv *psecuritypriv);
469 
get_bssid(struct mlme_priv * pmlmepriv)470 static inline u8 *get_bssid(struct mlme_priv *pmlmepriv)
471 {	/* if sta_mode:pmlmepriv->cur_network.network.MacAddress=> bssid */
472 	/*  if adhoc_mode:pmlmepriv->cur_network.network.MacAddress=> ibss mac address */
473 	return pmlmepriv->cur_network.network.MacAddress;
474 }
475 
check_fwstate(struct mlme_priv * pmlmepriv,int state)476 static inline int check_fwstate(struct mlme_priv *pmlmepriv, int state)
477 {
478 	if (pmlmepriv->fw_state & state)
479 		return true;
480 
481 	return false;
482 }
483 
get_fwstate(struct mlme_priv * pmlmepriv)484 static inline int get_fwstate(struct mlme_priv *pmlmepriv)
485 {
486 	return pmlmepriv->fw_state;
487 }
488 
489 /*
490  * No Limit on the calling context,
491  * therefore set it to be the critical section...
492  *
493  * ### NOTE:#### (!!!!)
494  * MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock
495  */
set_fwstate(struct mlme_priv * pmlmepriv,int state)496 static inline void set_fwstate(struct mlme_priv *pmlmepriv, int state)
497 {
498 	pmlmepriv->fw_state |= state;
499 	/* FOR HW integration */
500 	if (_FW_UNDER_SURVEY==state)
501 		pmlmepriv->bScanInProcess = true;
502 }
503 
_clr_fwstate_(struct mlme_priv * pmlmepriv,int state)504 static inline void _clr_fwstate_(struct mlme_priv *pmlmepriv, int state)
505 {
506 	pmlmepriv->fw_state &= ~state;
507 	/* FOR HW integration */
508 	if (_FW_UNDER_SURVEY==state)
509 		pmlmepriv->bScanInProcess = false;
510 }
511 
512 /*
513  * No Limit on the calling context,
514  * therefore set it to be the critical section...
515  */
clr_fwstate(struct mlme_priv * pmlmepriv,int state)516 static inline void clr_fwstate(struct mlme_priv *pmlmepriv, int state)
517 {
518 	spin_lock_bh(&pmlmepriv->lock);
519 	if (check_fwstate(pmlmepriv, state))
520 		pmlmepriv->fw_state ^= state;
521 	spin_unlock_bh(&pmlmepriv->lock);
522 }
523 
clr_fwstate_ex(struct mlme_priv * pmlmepriv,int state)524 static inline void clr_fwstate_ex(struct mlme_priv *pmlmepriv, int state)
525 {
526 	spin_lock_bh(&pmlmepriv->lock);
527 	_clr_fwstate_(pmlmepriv, state);
528 	spin_unlock_bh(&pmlmepriv->lock);
529 }
530 
up_scanned_network(struct mlme_priv * pmlmepriv)531 static inline void up_scanned_network(struct mlme_priv *pmlmepriv)
532 {
533 	spin_lock_bh(&pmlmepriv->lock);
534 	pmlmepriv->num_of_scanned++;
535 	spin_unlock_bh(&pmlmepriv->lock);
536 }
537 
down_scanned_network(struct mlme_priv * pmlmepriv)538 static inline void down_scanned_network(struct mlme_priv *pmlmepriv)
539 {
540 	spin_lock_bh(&pmlmepriv->lock);
541 	pmlmepriv->num_of_scanned--;
542 	spin_unlock_bh(&pmlmepriv->lock);
543 }
544 
set_scanned_network_val(struct mlme_priv * pmlmepriv,int val)545 static inline void set_scanned_network_val(struct mlme_priv *pmlmepriv, int val)
546 {
547 	spin_lock_bh(&pmlmepriv->lock);
548 	pmlmepriv->num_of_scanned = val;
549 	spin_unlock_bh(&pmlmepriv->lock);
550 }
551 
552 u16 rtw_get_capability(struct wlan_bssid_ex *bss);
553 void rtw_update_scanned_network(struct adapter *adapter,
554 				struct wlan_bssid_ex *target);
555 void rtw_disconnect_hdl_under_linked(struct adapter *adapter,
556 				     struct sta_info *psta, u8 free_assoc);
557 void rtw_generate_random_ibss(u8 *pibss);
558 struct wlan_network *rtw_find_network(struct __queue *scanned_queue, u8 *addr);
559 struct wlan_network *rtw_get_oldest_wlan_network(struct __queue *scanned_queue);
560 
561 void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue);
562 void rtw_indicate_disconnect(struct adapter *adapter);
563 void rtw_indicate_connect(struct adapter *adapter);
564 void rtw_indicate_scan_done( struct adapter *padapter, bool aborted);
565 void rtw_scan_abort(struct adapter *adapter);
566 
567 int rtw_restruct_sec_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie,
568 			uint in_len);
569 int rtw_restruct_wmm_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie,
570 		        uint in_len, uint initial_out_len);
571 void rtw_init_registrypriv_dev_network(struct adapter *adapter);
572 
573 void rtw_update_registrypriv_dev_network(struct adapter *adapter);
574 
575 void rtw_get_encrypt_decrypt_from_registrypriv(struct adapter *adapter);
576 
577 void _rtw_join_timeout_handler(struct adapter *adapter);
578 void rtw_scan_timeout_handler(struct adapter *adapter);
579 
580  void rtw_dynamic_check_timer_handlder(struct adapter *adapter);
581 #define rtw_is_scan_deny(adapter) false
582 #define rtw_clear_scan_deny(adapter) do {} while (0)
583 #define rtw_set_scan_deny_timer_hdl(adapter) do {} while (0)
584 #define rtw_set_scan_deny(adapter, ms) do {} while (0)
585 
586 int _rtw_init_mlme_priv(struct adapter *padapter);
587 
588 void rtw_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv);
589 
590 void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv);
591 
592 int _rtw_enqueue_network(struct __queue *queue, struct wlan_network *pnetwork);
593 
594 struct wlan_network *_rtw_dequeue_network(struct __queue *queue);
595 
596  struct wlan_network *_rtw_alloc_network(struct mlme_priv *pmlmepriv);
597 
598 void _rtw_free_network(struct mlme_priv *pmlmepriv,
599 		       struct wlan_network *pnetwork, u8 isfreeall);
600 void _rtw_free_network_nolock(struct mlme_priv *pmlmepriv,
601 			      struct wlan_network *pnetwork);
602 
603 struct wlan_network* _rtw_find_network(struct __queue *scanned_queue, u8 *addr);
604 
605 void _rtw_free_network_queue(struct adapter *padapter, u8 isfreeall);
606 
607 int rtw_if_up(struct adapter *padapter);
608 
609 u8 *rtw_get_capability_from_ie(u8 *ie);
610 u8 *rtw_get_timestampe_from_ie(u8 *ie);
611 u8 *rtw_get_beacon_interval_from_ie(u8 *ie);
612 
613 void rtw_joinbss_reset(struct adapter *padapter);
614 
615 unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie,
616 				   u8 *out_ie, uint in_len, uint *pout_len);
617 void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len);
618 void rtw_issue_addbareq_cmd(struct adapter *padapter,
619 			    struct xmit_frame *pxmitframe);
620 
621 int rtw_is_same_ibss(struct adapter *adapter, struct wlan_network *pnetwork);
622 int is_same_network(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst);
623 
624 void rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network);
625 void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network);
626 void rtw_set_roaming(struct adapter *adapter, u8 to_roaming);
627 u8 rtw_to_roaming(struct adapter *adapter);
628 
629 void rtw_sta_media_status_rpt(struct adapter *adapter, struct sta_info *psta,
630 			      u32 mstatus);
631 
632 #endif /* __RTL871X_MLME_H_ */
633