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