| Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 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 <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) | 
| Johannes Berg | c9ee23d | 2007-08-28 17:01:55 -0400 | [diff] [blame] | 29 | /* whether this is an AP that we are associated with as a client */ | 
|  | 30 | #define WLAN_STA_ASSOC_AP BIT(8) | 
| Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 31 | #define WLAN_STA_WME BIT(9) | 
|  | 32 | #define WLAN_STA_WDS BIT(27) | 
|  | 33 |  | 
|  | 34 |  | 
|  | 35 | struct sta_info { | 
|  | 36 | struct kref kref; | 
|  | 37 | struct list_head list; | 
|  | 38 | struct sta_info *hnext; /* next entry in hash table list */ | 
|  | 39 |  | 
|  | 40 | struct ieee80211_local *local; | 
|  | 41 |  | 
|  | 42 | u8 addr[ETH_ALEN]; | 
|  | 43 | u16 aid; /* STA's unique AID (1..2007), 0 = not yet assigned */ | 
|  | 44 | u32 flags; /* WLAN_STA_ */ | 
|  | 45 |  | 
|  | 46 | struct sk_buff_head ps_tx_buf; /* buffer of TX frames for station in | 
|  | 47 | * power saving state */ | 
|  | 48 | int pspoll; /* whether STA has send a PS Poll frame */ | 
|  | 49 | struct sk_buff_head tx_filtered; /* buffer of TX frames that were | 
|  | 50 | * already given to low-level driver, | 
|  | 51 | * but were filtered */ | 
|  | 52 | int clear_dst_mask; | 
|  | 53 |  | 
|  | 54 | unsigned long rx_packets, tx_packets; /* number of RX/TX MSDUs */ | 
|  | 55 | unsigned long rx_bytes, tx_bytes; | 
|  | 56 | unsigned long tx_retry_failed, tx_retry_count; | 
|  | 57 | unsigned long tx_filtered_count; | 
|  | 58 |  | 
|  | 59 | unsigned int wep_weak_iv_count; /* number of RX frames with weak IV */ | 
|  | 60 |  | 
|  | 61 | unsigned long last_rx; | 
|  | 62 | u32 supp_rates; /* bitmap of supported rates in local->curr_rates */ | 
|  | 63 | int txrate; /* index in local->curr_rates */ | 
|  | 64 | int last_txrate; /* last rate used to send a frame to this STA */ | 
|  | 65 | int last_nonerp_idx; | 
|  | 66 |  | 
|  | 67 | struct net_device *dev; /* which net device is this station associated | 
|  | 68 | * to */ | 
|  | 69 |  | 
|  | 70 | struct ieee80211_key *key; | 
|  | 71 |  | 
|  | 72 | u32 tx_num_consecutive_failures; | 
|  | 73 | u32 tx_num_mpdu_ok; | 
|  | 74 | u32 tx_num_mpdu_fail; | 
|  | 75 |  | 
|  | 76 | struct rate_control_ref *rate_ctrl; | 
|  | 77 | void *rate_ctrl_priv; | 
|  | 78 |  | 
|  | 79 | /* last received seq/frag number from this STA (per RX queue) */ | 
|  | 80 | __le16 last_seq_ctrl[NUM_RX_DATA_QUEUES]; | 
|  | 81 | unsigned long num_duplicates; /* number of duplicate frames received | 
|  | 82 | * from this STA */ | 
|  | 83 | unsigned long tx_fragments; /* number of transmitted MPDUs */ | 
|  | 84 | unsigned long rx_fragments; /* number of received MPDUs */ | 
|  | 85 | unsigned long rx_dropped; /* number of dropped MPDUs from this STA */ | 
|  | 86 |  | 
|  | 87 | int last_rssi; /* RSSI of last received frame from this STA */ | 
|  | 88 | int last_signal; /* signal of last received frame from this STA */ | 
|  | 89 | int last_noise; /* noise of last received frame from this STA */ | 
|  | 90 | int last_ack_rssi[3]; /* RSSI of last received ACKs from this STA */ | 
|  | 91 | unsigned long last_ack; | 
|  | 92 | int channel_use; | 
|  | 93 | int channel_use_raw; | 
|  | 94 |  | 
| Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 95 | #ifdef CONFIG_MAC80211_DEBUG_COUNTERS | 
|  | 96 | unsigned int wme_rx_queue[NUM_RX_DATA_QUEUES]; | 
|  | 97 | unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES]; | 
|  | 98 | #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */ | 
|  | 99 |  | 
| Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 100 | u16 listen_interval; | 
| Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 101 |  | 
|  | 102 | #ifdef CONFIG_MAC80211_DEBUGFS | 
|  | 103 | struct sta_info_debugfsdentries { | 
|  | 104 | struct dentry *dir; | 
|  | 105 | struct dentry *flags; | 
|  | 106 | struct dentry *num_ps_buf_frames; | 
|  | 107 | struct dentry *last_ack_rssi; | 
|  | 108 | struct dentry *last_ack_ms; | 
|  | 109 | struct dentry *inactive_ms; | 
|  | 110 | struct dentry *last_seq_ctrl; | 
|  | 111 | #ifdef CONFIG_MAC80211_DEBUG_COUNTERS | 
|  | 112 | struct dentry *wme_rx_queue; | 
|  | 113 | struct dentry *wme_tx_queue; | 
|  | 114 | #endif | 
|  | 115 | } debugfs; | 
|  | 116 | #endif | 
| Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 117 | }; | 
|  | 118 |  | 
|  | 119 |  | 
|  | 120 | /* Maximum number of concurrently registered stations */ | 
|  | 121 | #define MAX_STA_COUNT 2007 | 
|  | 122 |  | 
|  | 123 | #define STA_HASH_SIZE 256 | 
|  | 124 | #define STA_HASH(sta) (sta[5]) | 
|  | 125 |  | 
|  | 126 |  | 
|  | 127 | /* Maximum number of frames to buffer per power saving station */ | 
|  | 128 | #define STA_MAX_TX_BUFFER 128 | 
|  | 129 |  | 
|  | 130 | /* Minimum buffered frame expiry time. If STA uses listen interval that is | 
|  | 131 | * smaller than this value, the minimum value here is used instead. */ | 
|  | 132 | #define STA_TX_BUFFER_EXPIRE (10 * HZ) | 
|  | 133 |  | 
|  | 134 | /* How often station data is cleaned up (e.g., expiration of buffered frames) | 
|  | 135 | */ | 
|  | 136 | #define STA_INFO_CLEANUP_INTERVAL (10 * HZ) | 
|  | 137 |  | 
| Michael Wu | be8755e | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 138 | static inline void __sta_info_get(struct sta_info *sta) | 
|  | 139 | { | 
|  | 140 | kref_get(&sta->kref); | 
|  | 141 | } | 
|  | 142 |  | 
| Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 143 | struct sta_info * sta_info_get(struct ieee80211_local *local, u8 *addr); | 
|  | 144 | int sta_info_min_txrate_get(struct ieee80211_local *local); | 
|  | 145 | void sta_info_put(struct sta_info *sta); | 
|  | 146 | struct sta_info * sta_info_add(struct ieee80211_local *local, | 
|  | 147 | struct net_device *dev, u8 *addr, gfp_t gfp); | 
| Michael Wu | be8755e | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 148 | void sta_info_remove(struct sta_info *sta); | 
|  | 149 | void sta_info_free(struct sta_info *sta); | 
| Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 150 | void sta_info_init(struct ieee80211_local *local); | 
|  | 151 | int sta_info_start(struct ieee80211_local *local); | 
|  | 152 | void sta_info_stop(struct ieee80211_local *local); | 
|  | 153 | void sta_info_remove_aid_ptr(struct sta_info *sta); | 
|  | 154 | void sta_info_flush(struct ieee80211_local *local, struct net_device *dev); | 
|  | 155 |  | 
|  | 156 | #endif /* STA_INFO_H */ |