PageRenderTime 124ms CodeModel.GetById 20ms app.highlight 80ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/staging/rtl8712/sta_info.h

https://bitbucket.org/wisechild/galaxy-nexus
C++ Header | 125 lines | 98 code | 14 blank | 13 comment | 0 complexity | 6953f58441b3e02563e6000f4d64d520 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
  1#ifndef __STA_INFO_H_
  2#define __STA_INFO_H_
  3
  4#include "osdep_service.h"
  5#include "drv_types.h"
  6#include "wifi.h"
  7
  8#define NUM_STA 32
  9#define NUM_ACL 64
 10
 11
 12/* if mode ==0, then the sta is allowed once the addr is hit.
 13 * if mode ==1, then the sta is rejected once the addr is non-hit.
 14 */
 15struct wlan_acl_node {
 16	struct list_head list;
 17	u8       addr[ETH_ALEN];
 18	u8       mode;
 19};
 20
 21struct wlan_acl_pool {
 22	struct wlan_acl_node aclnode[NUM_ACL];
 23};
 24
 25struct	stainfo_stats {
 26
 27	uint	rx_pkts;
 28	uint	rx_bytes;
 29	u64	tx_pkts;
 30	uint	tx_bytes;
 31};
 32
 33struct sta_info {
 34	spinlock_t lock;
 35	struct list_head list; /*free_sta_queue*/
 36	struct list_head hash_list; /*sta_hash*/
 37	struct sta_xmit_priv sta_xmitpriv;
 38	struct sta_recv_priv sta_recvpriv;
 39	uint state;
 40	uint aid;
 41	u8	mac_id;
 42	u8	qos_option;
 43	u8	hwaddr[ETH_ALEN];
 44	uint	ieee8021x_blocked;	/*0: allowed, 1:blocked */
 45	uint	XPrivacy; /*aes, tkip...*/
 46	union Keytype	tkiptxmickey;
 47	union Keytype	tkiprxmickey;
 48	union Keytype	x_UncstKey;
 49	union pn48		txpn;	/* PN48 used for Unicast xmit.*/
 50	union pn48		rxpn;	/* PN48 used for Unicast recv.*/
 51	u8	bssrateset[16];
 52	uint	bssratelen;
 53	s32  rssi;
 54	s32	signal_quality;
 55	struct stainfo_stats sta_stats;
 56	/*for A-MPDU Rx reordering buffer control */
 57	struct recv_reorder_ctrl recvreorder_ctrl[16];
 58	struct ht_priv	htpriv;
 59	/* Notes:
 60	 * STA_Mode:
 61	 * curr_network(mlme_priv/security_priv/qos/ht)
 62	 *   + sta_info: (STA & AP) CAP/INFO
 63	 * scan_q: AP CAP/INFO
 64	 * AP_Mode:
 65	 * curr_network(mlme_priv/security_priv/qos/ht) : AP CAP/INFO
 66	 * sta_info: (AP & STA) CAP/INFO
 67	 */
 68#ifdef CONFIG_R8712_AP
 69	struct list_head asoc_list;
 70	struct list_head auth_list;
 71	unsigned int expire_to;
 72	unsigned int auth_seq;
 73	unsigned int authalg;
 74	unsigned char chg_txt[128];
 75	unsigned int tx_ra_bitmap;
 76#endif
 77};
 78
 79struct	sta_priv {
 80	u8 *pallocated_stainfo_buf;
 81	u8 *pstainfo_buf;
 82	struct  __queue	free_sta_queue;
 83	spinlock_t sta_hash_lock;
 84	struct list_head sta_hash[NUM_STA];
 85	int asoc_sta_count;
 86	struct  __queue sleep_q;
 87	struct  __queue wakeup_q;
 88	struct _adapter *padapter;
 89#ifdef CONFIG_R8712_AP
 90	struct list_head asoc_list;
 91	struct list_head auth_list;
 92	unsigned int auth_to;  /* sec, time to expire in authenticating. */
 93	unsigned int assoc_to; /* sec, time to expire before associating. */
 94	unsigned int expire_to; /* sec , time to expire after associated. */
 95#endif
 96};
 97
 98static inline u32 wifi_mac_hash(u8 *mac)
 99{
100	u32 x;
101
102	x = mac[0];
103	x = (x << 2) ^ mac[1];
104	x = (x << 2) ^ mac[2];
105	x = (x << 2) ^ mac[3];
106	x = (x << 2) ^ mac[4];
107	x = (x << 2) ^ mac[5];
108	x ^= x >> 8;
109	x  = x & (NUM_STA - 1);
110	return x;
111}
112
113u32 _r8712_init_sta_priv(struct sta_priv *pstapriv);
114u32 _r8712_free_sta_priv(struct sta_priv *pstapriv);
115struct sta_info *r8712_alloc_stainfo(struct sta_priv *pstapriv,
116				     u8 *hwaddr);
117void r8712_free_stainfo(struct _adapter *padapter , struct sta_info *psta);
118void r8712_free_all_stainfo(struct _adapter *padapter);
119struct sta_info *r8712_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr);
120void r8712_init_bcmc_stainfo(struct _adapter *padapter);
121struct sta_info *r8712_get_bcmc_stainfo(struct _adapter *padapter);
122u8 r8712_access_ctrl(struct wlan_acl_pool *pacl_list, u8 * mac_addr);
123
124#endif /* _STA_INFO_H_ */
125