Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[linux-btrfs-devel.git] / drivers / staging / rtl8712 / sta_info.h
blob48d6a14c8f5fd51c98926cec5f14ce01b422a6d3
1 /******************************************************************************
3 * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
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.
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.
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
18 * Modifications for inclusion into the Linux staging tree are
19 * Copyright(c) 2010 Larry Finger. All rights reserved.
21 * Contact information:
22 * WLAN FAE <wlanfae@realtek.com>
23 * Larry Finger <Larry.Finger@lwfinger.net>
25 ******************************************************************************/
26 #ifndef __STA_INFO_H_
27 #define __STA_INFO_H_
29 #include "osdep_service.h"
30 #include "drv_types.h"
31 #include "wifi.h"
33 #define NUM_STA 32
34 #define NUM_ACL 64
37 /* if mode ==0, then the sta is allowed once the addr is hit.
38 * if mode ==1, then the sta is rejected once the addr is non-hit.
40 struct wlan_acl_node {
41 struct list_head list;
42 u8 addr[ETH_ALEN];
43 u8 mode;
46 struct wlan_acl_pool {
47 struct wlan_acl_node aclnode[NUM_ACL];
50 struct stainfo_stats {
52 uint rx_pkts;
53 uint rx_bytes;
54 u64 tx_pkts;
55 uint tx_bytes;
58 struct sta_info {
59 spinlock_t lock;
60 struct list_head list; /*free_sta_queue*/
61 struct list_head hash_list; /*sta_hash*/
62 struct sta_xmit_priv sta_xmitpriv;
63 struct sta_recv_priv sta_recvpriv;
64 uint state;
65 uint aid;
66 uint mac_id;
67 uint qos_option;
68 u8 hwaddr[ETH_ALEN];
69 uint ieee8021x_blocked; /*0: allowed, 1:blocked */
70 uint XPrivacy; /*aes, tkip...*/
71 union Keytype tkiptxmickey;
72 union Keytype tkiprxmickey;
73 union Keytype x_UncstKey;
74 union pn48 txpn; /* PN48 used for Unicast xmit.*/
75 union pn48 rxpn; /* PN48 used for Unicast recv.*/
76 u8 bssrateset[16];
77 uint bssratelen;
78 s32 rssi;
79 s32 signal_quality;
80 struct stainfo_stats sta_stats;
81 /*for A-MPDU Rx reordering buffer control */
82 struct recv_reorder_ctrl recvreorder_ctrl[16];
83 struct ht_priv htpriv;
84 /* Notes:
85 * STA_Mode:
86 * curr_network(mlme_priv/security_priv/qos/ht)
87 * + sta_info: (STA & AP) CAP/INFO
88 * scan_q: AP CAP/INFO
89 * AP_Mode:
90 * curr_network(mlme_priv/security_priv/qos/ht) : AP CAP/INFO
91 * sta_info: (AP & STA) CAP/INFO
93 #ifdef CONFIG_R8712_AP
94 struct list_head asoc_list;
95 struct list_head auth_list;
96 unsigned int expire_to;
97 unsigned int auth_seq;
98 unsigned int authalg;
99 unsigned char chg_txt[128];
100 unsigned int tx_ra_bitmap;
101 #endif
104 struct sta_priv {
105 u8 *pallocated_stainfo_buf;
106 u8 *pstainfo_buf;
107 struct __queue free_sta_queue;
108 spinlock_t sta_hash_lock;
109 struct list_head sta_hash[NUM_STA];
110 int asoc_sta_count;
111 struct __queue sleep_q;
112 struct __queue wakeup_q;
113 struct _adapter *padapter;
114 #ifdef CONFIG_R8712_AP
115 struct list_head asoc_list;
116 struct list_head auth_list;
117 unsigned int auth_to; /* sec, time to expire in authenticating. */
118 unsigned int assoc_to; /* sec, time to expire before associating. */
119 unsigned int expire_to; /* sec , time to expire after associated. */
120 #endif
123 static inline u32 wifi_mac_hash(u8 *mac)
125 u32 x;
127 x = mac[0];
128 x = (x << 2) ^ mac[1];
129 x = (x << 2) ^ mac[2];
130 x = (x << 2) ^ mac[3];
131 x = (x << 2) ^ mac[4];
132 x = (x << 2) ^ mac[5];
133 x ^= x >> 8;
134 x = x & (NUM_STA - 1);
135 return x;
138 u32 _r8712_init_sta_priv(struct sta_priv *pstapriv);
139 u32 _r8712_free_sta_priv(struct sta_priv *pstapriv);
140 struct sta_info *r8712_alloc_stainfo(struct sta_priv *pstapriv,
141 u8 *hwaddr);
142 void r8712_free_stainfo(struct _adapter *padapter , struct sta_info *psta);
143 void r8712_free_all_stainfo(struct _adapter *padapter);
144 struct sta_info *r8712_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr);
145 void r8712_init_bcmc_stainfo(struct _adapter *padapter);
146 struct sta_info *r8712_get_bcmc_stainfo(struct _adapter *padapter);
147 u8 r8712_access_ctrl(struct wlan_acl_pool *pacl_list, u8 * mac_addr);
149 #endif /* _STA_INFO_H_ */