add d80211 from a recent wireless-dev checkout
[openwrt/svn-archive/archive.git] / package / d80211 / 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 #include <linux/list.h>
13 #include <linux/types.h>
14 #include <linux/if_ether.h>
15 #include "ieee80211_key.h"
16
17 /* Stations flags (struct sta_info::flags) */
18 #define WLAN_STA_AUTH BIT(0)
19 #define WLAN_STA_ASSOC BIT(1)
20 #define WLAN_STA_PS BIT(2)
21 #define WLAN_STA_TIM BIT(3) /* TIM bit is on for PS stations */
22 #define WLAN_STA_PERM BIT(4) /* permanent; do not remove entry on expiration */
23 #define WLAN_STA_AUTHORIZED BIT(5) /* If 802.1X is used, this flag is
24 * controlling whether STA is authorized to
25 * send and receive non-IEEE 802.1X frames
26 */
27 #define WLAN_STA_SHORT_PREAMBLE BIT(7)
28 #define WLAN_STA_WME BIT(9)
29 #define WLAN_STA_WDS BIT(27)
30
31
32 struct sta_info {
33 struct list_head list;
34 struct kobject kobj;
35 struct sta_info *hnext; /* next entry in hash table list */
36
37 struct ieee80211_local *local;
38
39 u8 addr[ETH_ALEN];
40 u16 aid; /* STA's unique AID (1..2007), 0 = not yet assigned */
41 u32 flags; /* WLAN_STA_ */
42
43 struct sk_buff_head ps_tx_buf; /* buffer of TX frames for station in
44 * power saving state */
45 int pspoll; /* whether STA has send a PS Poll frame */
46 struct sk_buff_head tx_filtered; /* buffer of TX frames that were
47 * already given to low-level driver,
48 * but were filtered */
49 int clear_dst_mask;
50
51 unsigned long rx_packets, tx_packets; /* number of RX/TX MSDUs */
52 unsigned long rx_bytes, tx_bytes;
53 unsigned long tx_retry_failed, tx_retry_count;
54 unsigned long tx_filtered_count;
55
56 unsigned int wep_weak_iv_count; /* number of RX frames with weak IV */
57
58 unsigned long last_rx;
59 u32 supp_rates; /* bitmap of supported rates in local->curr_rates */
60 int txrate; /* index in local->curr_rates */
61 int last_txrate; /* last rate used to send a frame to this STA */
62 int last_nonerp_idx;
63
64 struct net_device *dev; /* which net device is this station associated
65 * to */
66
67 struct ieee80211_key *key;
68
69 u32 tx_num_consecutive_failures;
70 u32 tx_num_mpdu_ok;
71 u32 tx_num_mpdu_fail;
72
73 struct rate_control_ref *rate_ctrl;
74 void *rate_ctrl_priv;
75
76 /* last received seq/frag number from this STA (per RX queue) */
77 __le16 last_seq_ctrl[NUM_RX_DATA_QUEUES];
78 unsigned long num_duplicates; /* number of duplicate frames received
79 * from this STA */
80 unsigned long tx_fragments; /* number of transmitted MPDUs */
81 unsigned long rx_fragments; /* number of received MPDUs */
82 unsigned long rx_dropped; /* number of dropped MPDUs from this STA */
83
84 int last_rssi; /* RSSI of last received frame from this STA */
85 int last_signal; /* signal of last received frame from this STA */
86 int last_noise; /* noise of last received frame from this STA */
87 int last_ack_rssi[3]; /* RSSI of last received ACKs from this STA */
88 unsigned long last_ack;
89 int channel_use;
90 int channel_use_raw;
91
92 int antenna_sel;
93
94
95 int key_idx_compression; /* key table index for compression and TX
96 * filtering; used only if sta->key is not
97 * set */
98
99 unsigned int sysfs_registered:1;
100 unsigned int assoc_ap:1; /* whether this is an AP that we are
101 * associated with as a client */
102
103 #ifdef CONFIG_HOSTAPD_WPA_TESTING
104 u32 wpa_trigger;
105 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
106
107 #ifdef CONFIG_D80211_DEBUG_COUNTERS
108 unsigned int wme_rx_queue[NUM_RX_DATA_QUEUES];
109 unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES];
110 #endif /* CONFIG_D80211_DEBUG_COUNTERS */
111
112 int vlan_id;
113
114 u16 listen_interval;
115 };
116
117
118 /* Maximum number of concurrently registered stations */
119 #define MAX_STA_COUNT 2007
120
121 #define STA_HASH_SIZE 256
122 #define STA_HASH(sta) (sta[5])
123
124
125 /* Maximum number of frames to buffer per power saving station */
126 #define STA_MAX_TX_BUFFER 128
127
128 /* Minimum buffered frame expiry time. If STA uses listen interval that is
129 * smaller than this value, the minimum value here is used instead. */
130 #define STA_TX_BUFFER_EXPIRE (10 * HZ)
131
132 /* How often station data is cleaned up (e.g., expiration of buffered frames)
133 */
134 #define STA_INFO_CLEANUP_INTERVAL (10 * HZ)
135
136 struct sta_info * sta_info_get(struct ieee80211_local *local, u8 *addr);
137 int sta_info_min_txrate_get(struct ieee80211_local *local);
138 void sta_info_put(struct sta_info *sta);
139 struct sta_info * sta_info_add(struct ieee80211_local *local,
140 struct net_device *dev, u8 *addr, gfp_t gfp);
141 void sta_info_free(struct sta_info *sta, int locked);
142 void sta_info_release(struct kobject *kobj);
143 void sta_info_init(struct ieee80211_local *local);
144 int sta_info_start(struct ieee80211_local *local);
145 void sta_info_stop(struct ieee80211_local *local);
146 void sta_info_remove_aid_ptr(struct sta_info *sta);
147 void sta_info_flush(struct ieee80211_local *local, struct net_device *dev);
148
149 #endif /* STA_INFO_H */