Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus
[linux-btrfs-devel.git] / drivers / staging / rtl8712 / sta_info.h
blob79ad1593214ff09d670e024e922d70635e2e2ae9
1 #ifndef __STA_INFO_H_
2 #define __STA_INFO_H_
4 #include "osdep_service.h"
5 #include "drv_types.h"
6 #include "wifi.h"
8 #define NUM_STA 32
9 #define NUM_ACL 64
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.
15 struct wlan_acl_node {
16 struct list_head list;
17 u8 addr[ETH_ALEN];
18 u8 mode;
21 struct wlan_acl_pool {
22 struct wlan_acl_node aclnode[NUM_ACL];
25 struct stainfo_stats {
27 uint rx_pkts;
28 uint rx_bytes;
29 u64 tx_pkts;
30 uint tx_bytes;
33 struct 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
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
79 struct 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
98 static inline u32 wifi_mac_hash(u8 *mac)
100 u32 x;
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;
113 u32 _r8712_init_sta_priv(struct sta_priv *pstapriv);
114 u32 _r8712_free_sta_priv(struct sta_priv *pstapriv);
115 struct sta_info *r8712_alloc_stainfo(struct sta_priv *pstapriv,
116 u8 *hwaddr);
117 void r8712_free_stainfo(struct _adapter *padapter , struct sta_info *psta);
118 void r8712_free_all_stainfo(struct _adapter *padapter);
119 struct sta_info *r8712_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr);
120 void r8712_init_bcmc_stainfo(struct _adapter *padapter);
121 struct sta_info *r8712_get_bcmc_stainfo(struct _adapter *padapter);
122 u8 r8712_access_ctrl(struct wlan_acl_pool *pacl_list, u8 * mac_addr);
124 #endif /* _STA_INFO_H_ */