ef6906d56de3dc24cc4d5b74e734a292f1da633f
[openwrt.git] / target / linux / package / ieee80211-dscape / src / sta_info.h
1 /*
2  * Copyright 2002-2005, Devicescape Software, Inc.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  */
8
9 #ifndef STA_INFO_H
10 #define STA_INFO_H
11
12 /* Stations flags (struct sta_info::flags) */
13 #define WLAN_STA_AUTH BIT(0)
14 #define WLAN_STA_ASSOC BIT(1)
15 #define WLAN_STA_PS BIT(2)
16 #define WLAN_STA_TIM BIT(3) /* TIM bit is on for PS stations */
17 #define WLAN_STA_PERM BIT(4) /* permanent; do not remove entry on expiration */
18 #define WLAN_STA_AUTHORIZED BIT(5) /* If 802.1X is used, this flag is
19                                     * controlling whether STA is authorized to
20                                     * send and receive non-IEEE 802.1X frames
21                                     */
22 #define WLAN_STA_SHORT_PREAMBLE BIT(7)
23 #define WLAN_STA_WME BIT(9)
24 #define WLAN_STA_XR BIT(26)
25 #define WLAN_STA_WDS BIT(27)
26
27
28 struct sta_info {
29         struct list_head list;
30         struct sta_info *hnext; /* next entry in hash table list */
31         atomic_t users; /* number of users (do not remove if > 0) */
32
33         u8 addr[ETH_ALEN];
34         u16 aid; /* STA's unique AID (1..2007), 0 = not yet assigned */
35         u32 flags; /* WLAN_STA_ */
36
37         struct sk_buff_head ps_tx_buf; /* buffer of TX frames for station in
38                                         * power saving state */
39         int pspoll; /* whether STA has send a PS Poll frame */
40         struct sk_buff_head tx_filtered; /* buffer of TX frames that were
41                                           * already given to low-level driver,
42                                           * but were filtered */
43         int clear_dst_mask;
44
45         unsigned long rx_packets, tx_packets; /* number of RX/TX MSDUs */
46         unsigned long rx_bytes, tx_bytes;
47         unsigned long tx_retry_failed, tx_retry_count;
48         unsigned long tx_filtered_count;
49
50         unsigned int wep_weak_iv_count; /* number of RX frames with weak IV */
51
52         unsigned long last_rx;
53         u32 supp_rates; /* bitmap of supported rates in local->curr_rates */
54         int txrate; /* index in local->curr_rates */
55         int last_txrate; /* last rate used to send a frame to this STA */
56         int last_nonerp_idx;
57
58         struct net_device *dev; /* which net device is this station associated
59                                  * to */
60
61         struct ieee80211_key *key;
62
63         u32 tx_num_consecutive_failures;
64         u32 tx_num_mpdu_ok;
65         u32 tx_num_mpdu_fail;
66
67         void *rate_ctrl_priv;
68
69         /* last received seq/frag number from this STA (per RX queue) */
70         u16 last_seq_ctrl[NUM_RX_DATA_QUEUES];
71         unsigned long num_duplicates; /* number of duplicate frames received
72                                        * from this STA */
73         unsigned long tx_fragments; /* number of transmitted MPDUs */
74         unsigned long rx_fragments; /* number of received MPDUs */
75         unsigned long rx_dropped; /* number of dropped MPDUs from this STA */
76
77         int last_rssi; /* RSSI of last received frame from this STA */
78         int last_ack_rssi[3]; /* RSSI of last received ACKs from this STA */
79         unsigned long last_ack;
80         int channel_use;
81         int channel_use_raw;
82
83         int antenna_sel;
84
85
86         int key_idx_compression; /* key table index for compression and TX
87                                   * filtering; used only if sta->key is not
88                                   * set */
89
90         int proc_entry_added:1;
91         int assoc_ap:1; /* whether this is an AP that we are associated with
92                          * as a client */
93
94 #ifdef CONFIG_HOSTAPD_WPA_TESTING
95         u32 wpa_trigger;
96 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
97
98 #ifdef CONFIG_IEEE80211_DEBUG_COUNTERS
99         unsigned int wme_rx_queue[NUM_RX_DATA_QUEUES];
100         unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES];
101 #endif /* CONFIG_IEEE80211_DEBUG_COUNTERS */
102
103         int vlan_id;
104 };
105
106
107 /* Maximum number of concurrently registered stations */
108 #define MAX_STA_COUNT 2007
109
110 /* Maximum number of AIDs to use for STAs; must be 2007 or lower
111  * (IEEE 802.11 beacon format limitation) */
112 #define MAX_AID_TABLE_SIZE 2007
113
114 #define STA_HASH_SIZE 256
115 #define STA_HASH(sta) (sta[5])
116
117
118 /* Maximum number of frames to buffer per power saving station */
119 #define STA_MAX_TX_BUFFER 128
120
121 /* Buffered frame expiry time */
122 #define STA_TX_BUFFER_EXPIRE (10 * HZ)
123
124 /* How often station data is cleaned up (e.g., expiration of buffered frames)
125  */
126 #define STA_INFO_CLEANUP_INTERVAL (10 * HZ)
127
128
129 struct sta_info * sta_info_get(struct ieee80211_local *local, u8 *addr);
130 int sta_info_min_txrate_get(struct ieee80211_local *local);
131 void sta_info_release(struct ieee80211_local *local, struct sta_info *sta);
132 struct sta_info * sta_info_add(struct ieee80211_local *local,
133                                struct net_device *dev, u8 *addr);
134 void sta_info_free(struct ieee80211_local *local, struct sta_info *sta,
135                    int locked);
136 void sta_info_init(struct ieee80211_local *local);
137 void sta_info_start(struct ieee80211_local *local);
138 void sta_info_stop(struct ieee80211_local *local);
139 void sta_info_remove_aid_ptr(struct sta_info *sta);
140 void sta_info_flush(struct ieee80211_local *local, struct net_device *dev);
141
142 #endif /* STA_INFO_H */