xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8822be/include/sta_info.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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 __STA_INFO_H_
21 #define __STA_INFO_H_
22 
23 
24 #define IBSS_START_MAC_ID	2
25 #define NUM_STA MACID_NUM_SW_LIMIT
26 
27 #ifndef CONFIG_RTW_MACADDR_ACL
28 	#define CONFIG_RTW_MACADDR_ACL 1
29 #endif
30 #define NUM_ACL 16
31 #define RTW_ACL_MODE_DISABLED				0
32 #define RTW_ACL_MODE_ACCEPT_UNLESS_LISTED	1
33 #define RTW_ACL_MODE_DENY_UNLESS_LISTED		2
34 
35 #ifdef CONFIG_TDLS
36 	#define MAX_ALLOWED_TDLS_STA_NUM	4
37 #endif
38 
39 enum sta_info_update_type {
40 	STA_INFO_UPDATE_NONE = 0,
41 	STA_INFO_UPDATE_BW = BIT(0),
42 	STA_INFO_UPDATE_RATE = BIT(1),
43 	STA_INFO_UPDATE_PROTECTION_MODE = BIT(2),
44 	STA_INFO_UPDATE_CAP = BIT(3),
45 	STA_INFO_UPDATE_HT_CAP = BIT(4),
46 	STA_INFO_UPDATE_VHT_CAP = BIT(5),
47 	STA_INFO_UPDATE_ALL = STA_INFO_UPDATE_BW
48 			      | STA_INFO_UPDATE_RATE
49 			      | STA_INFO_UPDATE_PROTECTION_MODE
50 			      | STA_INFO_UPDATE_CAP
51 			      | STA_INFO_UPDATE_HT_CAP
52 			      | STA_INFO_UPDATE_VHT_CAP,
53 	STA_INFO_UPDATE_MAX
54 };
55 
56 struct rtw_wlan_acl_node {
57 	_list		        list;
58 	u8       addr[ETH_ALEN];
59 	u8       valid;
60 };
61 
62 struct wlan_acl_pool {
63 	int mode;
64 	int num;
65 	struct rtw_wlan_acl_node aclnode[NUM_ACL];
66 	_queue	acl_node_q;
67 };
68 
69 typedef struct _RSSI_STA {
70 	s32	UndecoratedSmoothedPWDB;
71 	s32	UndecoratedSmoothedCCK;
72 	s32	UndecoratedSmoothedOFDM;
73 	u8	OFDM_pkt;
74 	u8	CCK_pkt;
75 	u16	CCK_sum_power;
76 	u8	bsend_rssi;
77 	u64	PacketMap;
78 	u8	ValidBit;
79 } RSSI_STA, *PRSSI_STA;
80 
81 struct	stainfo_stats	{
82 
83 	u64 rx_mgnt_pkts;
84 	u64 rx_beacon_pkts;
85 	u64 rx_probereq_pkts;
86 	u64 rx_probersp_pkts;
87 	u64 rx_probersp_bm_pkts;
88 	u64 rx_probersp_uo_pkts;
89 	u64 rx_ctrl_pkts;
90 	u64 rx_data_pkts;
91 	u64 rx_data_last_pkts;		/* For Read & Clear requirement in proc_get_rx_stat() */
92 	u64 rx_data_qos_pkts[TID_NUM];
93 	u64	last_rx_mgnt_pkts;
94 	u64 last_rx_beacon_pkts;
95 	u64 last_rx_probereq_pkts;
96 	u64 last_rx_probersp_pkts;
97 	u64 last_rx_probersp_bm_pkts;
98 	u64 last_rx_probersp_uo_pkts;
99 	u64	last_rx_ctrl_pkts;
100 	u64	last_rx_data_pkts;
101 	u64 last_rx_data_qos_pkts[TID_NUM];
102 #ifdef CONFIG_TDLS
103 	u64 rx_tdls_disc_rsp_pkts;
104 	u64 last_rx_tdls_disc_rsp_pkts;
105 #endif
106 	u64	rx_bytes;
107 	u64	rx_drops;
108 
109 	u64	tx_pkts;
110 	u64	tx_bytes;
111 	u64  tx_drops;
112 
113 	u32 duplicate_cnt;	/* Read & Clear, in proc_get_rx_stat() */
114 	u32 rxratecnt[128];	/* Read & Clear, in proc_get_rx_stat() */
115 	u32 tx_ok_cnt;		/* Read & Clear, in proc_get_tx_stat() */
116 	u32 tx_fail_cnt;	/* Read & Clear, in proc_get_tx_stat() */
117 	u32 tx_retry_cnt;	/* Read & Clear, in proc_get_tx_stat() */
118 };
119 
120 #ifndef DBG_SESSION_TRACKER
121 	#define DBG_SESSION_TRACKER 0
122 #endif
123 
124 /* session tracker status */
125 #define ST_STATUS_NONE		0
126 #define ST_STATUS_CHECK		BIT0
127 #define ST_STATUS_ESTABLISH	BIT1
128 #define ST_STATUS_EXPIRE	BIT2
129 
130 #define ST_EXPIRE_MS (10 * 1000)
131 
132 struct session_tracker {
133 	_list list; /* session_tracker_queue */
134 	u32 local_naddr;
135 	u16 local_port;
136 	u32 remote_naddr;
137 	u16 remote_port;
138 	u32 set_time;
139 	u8 status;
140 };
141 
142 /* session tracker cmd */
143 #define ST_CMD_ADD 0
144 #define ST_CMD_DEL 1
145 #define ST_CMD_CHK 2
146 
147 struct st_cmd_parm {
148 	u8 cmd;
149 	struct sta_info *sta;
150 	u32 local_naddr; /* TODO: IPV6 */
151 	u16 local_port;
152 	u32 remote_naddr; /* TODO: IPV6 */
153 	u16 remote_port;
154 };
155 
156 typedef bool (*st_match_rule)(_adapter *adapter, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port);
157 
158 struct st_register {
159 	u8 s_proto;
160 	st_match_rule rule;
161 };
162 
163 #define SESSION_TRACKER_REG_ID_WFD 0
164 #define SESSION_TRACKER_REG_ID_NUM 1
165 
166 struct st_ctl_t {
167 	struct st_register reg[SESSION_TRACKER_REG_ID_NUM];
168 	_queue tracker_q;
169 };
170 
171 void rtw_st_ctl_init(struct st_ctl_t *st_ctl);
172 void rtw_st_ctl_deinit(struct st_ctl_t *st_ctl);
173 void rtw_st_ctl_register(struct st_ctl_t *st_ctl, u8 st_reg_id, struct st_register *reg);
174 void rtw_st_ctl_unregister(struct st_ctl_t *st_ctl, u8 st_reg_id);
175 bool rtw_st_ctl_chk_reg_s_proto(struct st_ctl_t *st_ctl, u8 s_proto);
176 bool rtw_st_ctl_chk_reg_rule(struct st_ctl_t *st_ctl, _adapter *adapter, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port);
177 void dump_st_ctl(void *sel, struct st_ctl_t *st_ctl);
178 
179 #ifdef CONFIG_TDLS
180 struct TDLS_PeerKey {
181 	u8 kck[16]; /* TPK-KCK */
182 	u8 tk[16]; /* TPK-TK; only CCMP will be used */
183 } ;
184 #endif /* CONFIG_TDLS */
185 
186 #ifdef DBG_RX_DFRAME_RAW_DATA
187 struct sta_recv_dframe_info {
188 
189 	u8 sta_data_rate;
190 	u8 sta_sgi;
191 	u8 sta_bw_mode;
192 	s8 sta_mimo_signal_strength[4];
193 	s8 sta_RxPwr[4];
194 	u8 sta_ofdm_snr[4];
195 };
196 #endif
197 
198 struct sta_info {
199 
200 	_lock	lock;
201 	_list	list; /* free_sta_queue */
202 	_list	hash_list; /* sta_hash */
203 	/* _list asoc_list; */ /* 20061114 */
204 	/* _list sleep_list; */ /* sleep_q */
205 	/* _list wakeup_list; */ /* wakeup_q */
206 	_adapter *padapter;
207 
208 	struct sta_xmit_priv sta_xmitpriv;
209 	struct sta_recv_priv sta_recvpriv;
210 
211 #ifdef DBG_RX_DFRAME_RAW_DATA
212 	struct sta_recv_dframe_info  sta_dframe_info;
213 #endif
214 	_queue sleep_q;
215 	unsigned int sleepq_len;
216 
217 	uint state;
218 	uint aid;
219 	uint mac_id;
220 	uint qos_option;
221 	u8	hwaddr[ETH_ALEN];
222 	u16 hwseq;
223 	u8	ra_rpt_linked;
224 
225 	uint	ieee8021x_blocked;	/* 0: allowed, 1:blocked */
226 	uint	dot118021XPrivacy; /* aes, tkip... */
227 	union Keytype	dot11tkiptxmickey;
228 	union Keytype	dot11tkiprxmickey;
229 	union Keytype	dot118021x_UncstKey;
230 	union pn48		dot11txpn;			/* PN48 used for Unicast xmit */
231 #ifdef CONFIG_GTK_OL
232 	u8 kek[RTW_KEK_LEN];
233 	u8 kck[RTW_KCK_LEN];
234 	u8 replay_ctr[RTW_REPLAY_CTR_LEN];
235 #endif /* CONFIG_GTK_OL */
236 #ifdef CONFIG_IEEE80211W
237 	union pn48		dot11wtxpn;			/* PN48 used for Unicast mgmt xmit. */
238 	_timer dot11w_expire_timer;
239 #endif /* CONFIG_IEEE80211W */
240 	union pn48		dot11rxpn;			/* PN48 used for Unicast recv. */
241 
242 
243 	u8	bssrateset[16];
244 	u32	bssratelen;
245 	s32  rssi;
246 	s32	signal_quality;
247 
248 	u8	cts2self;
249 	u8	rtsen;
250 
251 	u8	raid;
252 	u8	init_rate;
253 	u64	ra_mask;
254 	u8	wireless_mode;	/* NETWORK_TYPE */
255 	u8	bw_mode;
256 
257 	u8	ldpc;
258 	u8	stbc;
259 
260 #ifdef CONFIG_BEAMFORMING
261 	u16 txbf_paid;
262 	u16 txbf_gid;
263 #endif
264 
265 	struct stainfo_stats sta_stats;
266 
267 #ifdef CONFIG_TDLS
268 	u32	tdls_sta_state;
269 	u8	SNonce[32];
270 	u8	ANonce[32];
271 	u32	TDLS_PeerKey_Lifetime;
272 	u32	TPK_count;
273 	_timer	TPK_timer;
274 	struct TDLS_PeerKey	tpk;
275 #ifdef CONFIG_TDLS_CH_SW
276 	u16	ch_switch_time;
277 	u16	ch_switch_timeout;
278 	/* u8	option; */
279 	_timer	ch_sw_timer;
280 	_timer	delay_timer;
281 	_timer	stay_on_base_chnl_timer;
282 	_timer	ch_sw_monitor_timer;
283 #endif
284 	_timer handshake_timer;
285 	u8 alive_count;
286 	_timer	pti_timer;
287 	u8	TDLS_RSNIE[20];	/* Save peer's RSNIE, used for sending TDLS_SETUP_RSP */
288 #endif /* CONFIG_TDLS */
289 
290 	/* for A-MPDU TX, ADDBA timeout check	 */
291 	_timer addba_retry_timer;
292 
293 	/* for A-MPDU Rx reordering buffer control */
294 	struct recv_reorder_ctrl recvreorder_ctrl[TID_NUM];
295 	ATOMIC_T continual_no_rx_packet[TID_NUM];
296 	/* for A-MPDU Tx */
297 	/* unsigned char		ampdu_txen_bitmap; */
298 	u16	BA_starting_seqctrl[16];
299 
300 
301 #ifdef CONFIG_80211N_HT
302 	struct ht_priv	htpriv;
303 #endif
304 
305 #ifdef CONFIG_80211AC_VHT
306 	struct vht_priv	vhtpriv;
307 #endif
308 
309 	/* Notes:	 */
310 	/* STA_Mode: */
311 	/* curr_network(mlme_priv/security_priv/qos/ht) + sta_info: (STA & AP) CAP/INFO	 */
312 	/* scan_q: AP CAP/INFO */
313 
314 	/* AP_Mode: */
315 	/* curr_network(mlme_priv/security_priv/qos/ht) : AP CAP/INFO */
316 	/* sta_info: (AP & STA) CAP/INFO */
317 
318 	unsigned int expire_to;
319 
320 #ifdef CONFIG_AP_MODE
321 
322 	_list asoc_list;
323 	_list auth_list;
324 
325 	unsigned int auth_seq;
326 	unsigned int authalg;
327 	unsigned char chg_txt[128];
328 
329 	u16 capability;
330 	int flags;
331 
332 	int dot8021xalg;/* 0:disable, 1:psk, 2:802.1x */
333 	int wpa_psk;/* 0:disable, bit(0): WPA, bit(1):WPA2 */
334 	int wpa_group_cipher;
335 	int wpa2_group_cipher;
336 	int wpa_pairwise_cipher;
337 	int wpa2_pairwise_cipher;
338 
339 	u8 bpairwise_key_installed;
340 
341 #ifdef CONFIG_NATIVEAP_MLME
342 	u8 wpa_ie[32];
343 
344 	u8 nonerp_set;
345 	u8 no_short_slot_time_set;
346 	u8 no_short_preamble_set;
347 	u8 no_ht_gf_set;
348 	u8 no_ht_set;
349 	u8 ht_20mhz_set;
350 	u8 ht_40mhz_intolerant;
351 #endif /* CONFIG_NATIVEAP_MLME */
352 
353 #ifdef CONFIG_ATMEL_RC_PATCH
354 	u8 flag_atmel_rc;
355 #endif
356 
357 	u8 qos_info;
358 
359 	u8 max_sp_len;
360 	u8 uapsd_bk;/* BIT(0): Delivery enabled, BIT(1): Trigger enabled */
361 	u8 uapsd_be;
362 	u8 uapsd_vi;
363 	u8 uapsd_vo;
364 
365 	u8 has_legacy_ac;
366 	unsigned int sleepq_ac_len;
367 
368 #ifdef CONFIG_P2P
369 	/* p2p priv data */
370 	u8 is_p2p_device;
371 	u8 p2p_status_code;
372 
373 	/* p2p client info */
374 	u8 dev_addr[ETH_ALEN];
375 	/* u8 iface_addr[ETH_ALEN]; */ /* = hwaddr[ETH_ALEN] */
376 	u8 dev_cap;
377 	u16 config_methods;
378 	u8 primary_dev_type[8];
379 	u8 num_of_secdev_type;
380 	u8 secdev_types_list[32];/* 32/8 == 4; */
381 	u16 dev_name_len;
382 	u8 dev_name[32];
383 #endif /* CONFIG_P2P */
384 
385 #ifdef CONFIG_WFD
386 	u8 op_wfd_mode;
387 #endif
388 
389 #ifdef CONFIG_TX_MCAST2UNI
390 	u8 under_exist_checking;
391 #endif /* CONFIG_TX_MCAST2UNI */
392 
393 	u8 keep_alive_trycnt;
394 
395 #ifdef CONFIG_AUTO_AP_MODE
396 	u8 isrc; /* this device is rc */
397 	u16 pid; /* pairing id */
398 #endif
399 
400 #endif /* CONFIG_AP_MODE	 */
401 
402 #ifdef CONFIG_IOCTL_CFG80211
403 	u8 *passoc_req;
404 	u32 assoc_req_len;
405 #endif
406 
407 	/* for DM */
408 	RSSI_STA	 rssi_stat;
409 
410 	/* ODM_STA_INFO_T */
411 	/* ================ODM Relative Info======================= */
412 	/* Please be care, dont declare too much structure here. It will cost memory * STA support num. */
413 	/*  */
414 	/*  */
415 	/* 2011/10/20 MH Add for ODM STA info.	 */
416 	/*  */
417 	/* Driver Write */
418 	u8		bValid;				/* record the sta status link or not? */
419 	/* u8		WirelessMode;		 */ /* */
420 	u8		IOTPeer;			/* Enum value.	HT_IOT_PEER_E */
421 	/* ODM Write */
422 	/* 1 PHY_STATUS_INFO */
423 	u8		RSSI_Path[4];		/*  */
424 	u8		RSSI_Ave;
425 	u8		RXEVM[4];
426 	u8		RXSNR[4];
427 
428 	u8		rssi_level;			/* for Refresh RA mask */
429 	/* ODM Write */
430 	/* 1 TX_INFO (may changed by IC) */
431 	/* TX_INFO_T		pTxInfo;				 */ /* Define in IC folder. Move lower layer. */
432 	/*  */
433 	/* ================ODM Relative Info======================= */
434 	/*  */
435 
436 	/* To store the sequence number of received management frame */
437 	u16 RxMgmtFrameSeqNum;
438 
439 	struct st_ctl_t st_ctl;
440 };
441 
442 #define sta_rx_pkts(sta) \
443 	(sta->sta_stats.rx_mgnt_pkts \
444 	 + sta->sta_stats.rx_ctrl_pkts \
445 	 + sta->sta_stats.rx_data_pkts)
446 
447 #define sta_last_rx_pkts(sta) \
448 	(sta->sta_stats.last_rx_mgnt_pkts \
449 	 + sta->sta_stats.last_rx_ctrl_pkts \
450 	 + sta->sta_stats.last_rx_data_pkts)
451 
452 #define sta_rx_data_pkts(sta) \
453 	(sta->sta_stats.rx_data_pkts)
454 
455 #define sta_rx_data_qos_pkts(sta, i) \
456 	(sta->sta_stats.rx_data_qos_pkts[i])
457 
458 #define sta_last_rx_data_pkts(sta) \
459 	(sta->sta_stats.last_rx_data_pkts)
460 
461 #define sta_last_rx_data_qos_pkts(sta, i) \
462 	(sta->sta_stats.last_rx_data_qos_pkts[i])
463 
464 #define sta_rx_mgnt_pkts(sta) \
465 	(sta->sta_stats.rx_mgnt_pkts)
466 
467 #define sta_last_rx_mgnt_pkts(sta) \
468 	(sta->sta_stats.last_rx_mgnt_pkts)
469 
470 #define sta_rx_beacon_pkts(sta) \
471 	(sta->sta_stats.rx_beacon_pkts)
472 
473 #define sta_last_rx_beacon_pkts(sta) \
474 	(sta->sta_stats.last_rx_beacon_pkts)
475 
476 #define sta_rx_probereq_pkts(sta) \
477 	(sta->sta_stats.rx_probereq_pkts)
478 
479 #define sta_last_rx_probereq_pkts(sta) \
480 	(sta->sta_stats.last_rx_probereq_pkts)
481 
482 #define sta_rx_probersp_pkts(sta) \
483 	(sta->sta_stats.rx_probersp_pkts)
484 
485 #define sta_last_rx_probersp_pkts(sta) \
486 	(sta->sta_stats.last_rx_probersp_pkts)
487 
488 #define sta_rx_probersp_bm_pkts(sta) \
489 	(sta->sta_stats.rx_probersp_bm_pkts)
490 
491 #define sta_last_rx_probersp_bm_pkts(sta) \
492 	(sta->sta_stats.last_rx_probersp_bm_pkts)
493 
494 #define sta_rx_probersp_uo_pkts(sta) \
495 	(sta->sta_stats.rx_probersp_uo_pkts)
496 
497 #define sta_last_rx_probersp_uo_pkts(sta) \
498 	(sta->sta_stats.last_rx_probersp_uo_pkts)
499 
500 #define sta_update_last_rx_pkts(sta) \
501 	do { \
502 		sta->sta_stats.last_rx_mgnt_pkts = sta->sta_stats.rx_mgnt_pkts; \
503 		sta->sta_stats.last_rx_beacon_pkts = sta->sta_stats.rx_beacon_pkts; \
504 		sta->sta_stats.last_rx_probereq_pkts = sta->sta_stats.rx_probereq_pkts; \
505 		sta->sta_stats.last_rx_probersp_pkts = sta->sta_stats.rx_probersp_pkts; \
506 		sta->sta_stats.last_rx_probersp_bm_pkts = sta->sta_stats.rx_probersp_bm_pkts; \
507 		sta->sta_stats.last_rx_probersp_uo_pkts = sta->sta_stats.rx_probersp_uo_pkts; \
508 		sta->sta_stats.last_rx_ctrl_pkts = sta->sta_stats.rx_ctrl_pkts; \
509 		sta->sta_stats.last_rx_data_pkts = sta->sta_stats.rx_data_pkts; \
510 	} while (0)
511 
512 #define STA_RX_PKTS_ARG(sta) \
513 	sta->sta_stats.rx_mgnt_pkts \
514 	, sta->sta_stats.rx_ctrl_pkts \
515 	, sta->sta_stats.rx_data_pkts
516 
517 #define STA_LAST_RX_PKTS_ARG(sta) \
518 	sta->sta_stats.last_rx_mgnt_pkts \
519 	, sta->sta_stats.last_rx_ctrl_pkts \
520 	, sta->sta_stats.last_rx_data_pkts
521 
522 #define STA_RX_PKTS_DIFF_ARG(sta) \
523 	sta->sta_stats.rx_mgnt_pkts - sta->sta_stats.last_rx_mgnt_pkts \
524 	, sta->sta_stats.rx_ctrl_pkts - sta->sta_stats.last_rx_ctrl_pkts \
525 	, sta->sta_stats.rx_data_pkts - sta->sta_stats.last_rx_data_pkts
526 
527 #define STA_PKTS_FMT "(m:%llu, c:%llu, d:%llu)"
528 
529 #ifdef CONFIG_WFD
530 	#define STA_OP_WFD_MODE(sta) (sta)->op_wfd_mode
531 	#define STA_SET_OP_WFD_MODE(sta, mode) (sta)->op_wfd_mode = (mode)
532 #else
533 	#define STA_OP_WFD_MODE(sta) 0
534 	#define STA_SET_OP_WFD_MODE(sta, mode) do {} while (0)
535 #endif
536 
537 struct	sta_priv {
538 
539 	u8 *pallocated_stainfo_buf;
540 	u8 *pstainfo_buf;
541 	_queue	free_sta_queue;
542 
543 	_lock sta_hash_lock;
544 	_list   sta_hash[NUM_STA];
545 	int asoc_sta_count;
546 	_queue sleep_q;
547 	_queue wakeup_q;
548 
549 	_adapter *padapter;
550 
551 	u32 adhoc_expire_to;
552 
553 #ifdef CONFIG_AP_MODE
554 	_list asoc_list;
555 	_list auth_list;
556 	_lock asoc_list_lock;
557 	_lock auth_list_lock;
558 	u8 asoc_list_cnt;
559 	u8 auth_list_cnt;
560 
561 	unsigned int auth_to;  /* sec, time to expire in authenticating. */
562 	unsigned int assoc_to; /* sec, time to expire before associating. */
563 	unsigned int expire_to; /* sec , time to expire after associated. */
564 
565 	/* pointers to STA info; based on allocated AID or NULL if AID free
566 	 * AID is in the range 1-2007, so sta_aid[0] corresponders to AID 1
567 	 * and so on
568 	 */
569 	struct sta_info *sta_aid[NUM_STA];
570 
571 	u16 sta_dz_bitmap;/* only support 15 stations, staion aid bitmap for sleeping sta. */
572 	u16 tim_bitmap;/* only support 15 stations, aid=0~15 mapping bit0~bit15	 */
573 
574 	u16 max_num_sta;
575 
576 #if CONFIG_RTW_MACADDR_ACL
577 	struct wlan_acl_pool acl_list;
578 #endif
579 
580 #endif
581 
582 #ifdef CONFIG_ATMEL_RC_PATCH
583 	u8 atmel_rc_pattern[6];
584 #endif
585 	struct sta_info *c2h_sta;
586 	struct submit_ctx *gotc2h;
587 };
588 
589 
wifi_mac_hash(u8 * mac)590 __inline static u32 wifi_mac_hash(u8 *mac)
591 {
592 	u32 x;
593 
594 	x = mac[0];
595 	x = (x << 2) ^ mac[1];
596 	x = (x << 2) ^ mac[2];
597 	x = (x << 2) ^ mac[3];
598 	x = (x << 2) ^ mac[4];
599 	x = (x << 2) ^ mac[5];
600 
601 	x ^= x >> 8;
602 	x  = x & (NUM_STA - 1);
603 
604 	return x;
605 }
606 
607 
608 extern u32	_rtw_init_sta_priv(struct sta_priv *pstapriv);
609 extern u32	_rtw_free_sta_priv(struct sta_priv *pstapriv);
610 
611 #define stainfo_offset_valid(offset) (offset < NUM_STA && offset >= 0)
612 int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta);
613 struct sta_info *rtw_get_stainfo_by_offset(struct sta_priv *stapriv, int offset);
614 
615 extern struct sta_info *rtw_alloc_stainfo(struct	sta_priv *pstapriv, u8 *hwaddr);
616 extern u32	rtw_free_stainfo(_adapter *padapter , struct sta_info *psta);
617 extern void rtw_free_all_stainfo(_adapter *padapter);
618 extern struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr);
619 extern u32 rtw_init_bcmc_stainfo(_adapter *padapter);
620 extern struct sta_info *rtw_get_bcmc_stainfo(_adapter *padapter);
621 
622 #if CONFIG_RTW_MACADDR_ACL
623 	extern u8 rtw_access_ctrl(_adapter *adapter, u8 *mac_addr);
624 #endif
625 
626 #endif /* _STA_INFO_H_ */
627