]> err.no Git - linux-2.6/blobdiff - net/mac80211/ieee80211_i.h
wext: Emit event stream entries correctly when compat.
[linux-2.6] / net / mac80211 / ieee80211_i.h
index 7f10ff5d4a0b346700fdd04116009f1262863432..80a9e7c07b47e99c7230692461befabb6df83e18 100644 (file)
@@ -2,6 +2,7 @@
  * Copyright 2002-2005, Instant802 Networks, Inc.
  * Copyright 2005, Devicescape Software, Inc.
  * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
+ * Copyright 2007-2008 Johannes Berg <johannes@sipsolutions.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -23,7 +24,8 @@
 #include <linux/spinlock.h>
 #include <linux/etherdevice.h>
 #include <net/wireless.h>
-#include "ieee80211_key.h"
+#include <net/iw_handler.h>
+#include "key.h"
 #include "sta_info.h"
 
 /* ieee80211.o internal definitions, etc. These are not included into
@@ -35,9 +37,9 @@
 
 #define WLAN_FC_DATA_PRESENT(fc) (((fc) & 0x4c) == 0x08)
 
-struct ieee80211_local;
+#define IEEE80211_FC(type, subtype) cpu_to_le16(type | subtype)
 
-#define IEEE80211_ALIGN32_PAD(a) ((4 - ((a) & 3)) & 3)
+struct ieee80211_local;
 
 /* Maximum number of broadcast/multicast frames to buffer when some of the
  * associated stations are using power saving. */
@@ -73,15 +75,16 @@ struct ieee80211_fragment_entry {
 struct ieee80211_sta_bss {
        struct list_head list;
        struct ieee80211_sta_bss *hnext;
+       size_t ssid_len;
+
        atomic_t users;
 
        u8 bssid[ETH_ALEN];
        u8 ssid[IEEE80211_MAX_SSID_LEN];
-       size_t ssid_len;
        u16 capability; /* host byte order */
        enum ieee80211_band band;
        int freq;
-       int rssi, signal, noise;
+       int signal, noise, qual;
        u8 *wpa_ie;
        size_t wpa_ie_len;
        u8 *rsn_ie;
@@ -90,6 +93,8 @@ struct ieee80211_sta_bss {
        size_t wmm_ie_len;
        u8 *ht_ie;
        size_t ht_ie_len;
+       u8 *ht_add_ie;
+       size_t ht_add_ie_len;
 #ifdef CONFIG_MAC80211_MESH
        u8 *mesh_id;
        size_t mesh_id_len;
@@ -98,10 +103,10 @@ struct ieee80211_sta_bss {
 #define IEEE80211_MAX_SUPP_RATES 32
        u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
        size_t supp_rates_len;
-       int beacon_int;
        u64 timestamp;
+       int beacon_int;
 
-       int probe_resp;
+       bool probe_resp;
        unsigned long last_update;
 
        /* during assocation, we save an ERP value from a probe response so
@@ -146,7 +151,6 @@ typedef unsigned __bitwise__ ieee80211_tx_result;
 #define IEEE80211_TX_UNICAST           BIT(1)
 #define IEEE80211_TX_PS_BUFFERED       BIT(2)
 #define IEEE80211_TX_PROBE_LAST_FRAG   BIT(3)
-#define IEEE80211_TX_INJECTED          BIT(4)
 
 struct ieee80211_tx_data {
        struct sk_buff *skb;
@@ -154,22 +158,22 @@ struct ieee80211_tx_data {
        struct ieee80211_local *local;
        struct ieee80211_sub_if_data *sdata;
        struct sta_info *sta;
-       u16 fc, ethertype;
        struct ieee80211_key *key;
-       unsigned int flags;
 
-       struct ieee80211_tx_control *control;
        struct ieee80211_channel *channel;
-       struct ieee80211_rate *rate;
+       s8 rate_idx;
        /* use this rate (if set) for last fragment; rate can
         * be set to lower rate for the first fragments, e.g.,
         * when using CTS protection with IEEE 802.11g. */
-       struct ieee80211_rate *last_frag_rate;
+       s8 last_frag_rate_idx;
 
        /* Extra fragments (in addition to the first fragment
         * in skb) */
-       int num_extra_frag;
        struct sk_buff **extra_frag;
+       int num_extra_frag;
+
+       u16 fc, ethertype;
+       unsigned int flags;
 };
 
 
@@ -192,40 +196,24 @@ struct ieee80211_rx_data {
        struct ieee80211_local *local;
        struct ieee80211_sub_if_data *sdata;
        struct sta_info *sta;
-       u16 fc, ethertype;
        struct ieee80211_key *key;
-       unsigned int flags;
-
        struct ieee80211_rx_status *status;
        struct ieee80211_rate *rate;
+
+       u16 fc, ethertype;
+       unsigned int flags;
        int sent_ps_buffered;
        int queue;
-       int load;
        u32 tkip_iv32;
        u16 tkip_iv16;
 };
 
-/* flags used in struct ieee80211_tx_packet_data.flags */
-#define IEEE80211_TXPD_REQ_TX_STATUS   BIT(0)
-#define IEEE80211_TXPD_DO_NOT_ENCRYPT  BIT(1)
-#define IEEE80211_TXPD_REQUEUE         BIT(2)
-#define IEEE80211_TXPD_EAPOL_FRAME     BIT(3)
-#define IEEE80211_TXPD_AMPDU           BIT(4)
-/* Stored in sk_buff->cb */
-struct ieee80211_tx_packet_data {
-       int ifindex;
-       unsigned long jiffies;
-       unsigned int flags;
-       u8 queue;
-};
-
 struct ieee80211_tx_stored_packet {
-       struct ieee80211_tx_control control;
        struct sk_buff *skb;
-       int num_extra_frag;
        struct sk_buff **extra_frag;
-       struct ieee80211_rate *last_frag_rate;
-       unsigned int last_frag_rate_ctrl_probe;
+       s8 last_frag_rate_idx;
+       int num_extra_frag;
+       bool last_frag_rate_ctrl_probe;
 };
 
 struct beacon_data {
@@ -246,8 +234,8 @@ struct ieee80211_if_ap {
         * bitmap_empty :)
         * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */
        u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)];
-       atomic_t num_sta_ps; /* number of stations in PS mode */
        struct sk_buff_head ps_bc_buf;
+       atomic_t num_sta_ps; /* number of stations in PS mode */
        int dtim_count;
        int force_unicast_rateidx; /* forced TX rateidx for unicast frames */
        int max_ratectrl_rateidx; /* max TX rateidx for rate control */
@@ -255,8 +243,8 @@ struct ieee80211_if_ap {
 };
 
 struct ieee80211_if_wds {
-       u8 remote_addr[ETH_ALEN];
        struct sta_info *sta;
+       u8 remote_addr[ETH_ALEN];
 };
 
 struct ieee80211_if_vlan {
@@ -290,12 +278,12 @@ struct mesh_config {
        u8  dot11MeshTTL;
        bool auto_open_plinks;
        /* HWMP parameters */
-       u32 dot11MeshHWMPactivePathTimeout;
-       u16 dot11MeshHWMPpreqMinInterval;
-       u16 dot11MeshHWMPnetDiameterTraversalTime;
        u8  dot11MeshHWMPmaxPREQretries;
        u32 path_refresh_time;
        u16 min_discovery_timeout;
+       u32 dot11MeshHWMPactivePathTimeout;
+       u16 dot11MeshHWMPpreqMinInterval;
+       u16 dot11MeshHWMPnetDiameterTraversalTime;
 };
 
 
@@ -314,23 +302,22 @@ struct mesh_config {
 #define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12)
 #define IEEE80211_STA_PRIVACY_INVOKED  BIT(13)
 struct ieee80211_if_sta {
+       struct timer_list timer;
+       struct work_struct work;
+       u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
+       u8 ssid[IEEE80211_MAX_SSID_LEN];
        enum {
                IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
                IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
                IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED,
                IEEE80211_MESH_UP
        } state;
-       struct timer_list timer;
-       struct work_struct work;
-       u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
-       u8 ssid[IEEE80211_MAX_SSID_LEN];
        size_t ssid_len;
        u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
        size_t scan_ssid_len;
 #ifdef CONFIG_MAC80211_MESH
        struct timer_list mesh_path_timer;
        u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
-       bool accepting_plinks;
        size_t mesh_id_len;
        /* Active Path Selection Protocol Identifier */
        u8 mesh_pp_id[4];
@@ -353,7 +340,8 @@ struct ieee80211_if_sta {
        int preq_queue_len;
        struct mesh_stats mshstats;
        struct mesh_config mshcfg;
-       u8 mesh_seqnum[3];
+       u32 mesh_seqnum;
+       bool accepting_plinks;
 #endif
        u16 aid;
        u16 ap_capab, capab;
@@ -364,16 +352,18 @@ struct ieee80211_if_sta {
        u8 *assocreq_ies, *assocresp_ies;
        size_t assocreq_ies_len, assocresp_ies_len;
 
+       struct sk_buff_head skb_queue;
+
        int auth_tries, assoc_tries;
 
+       unsigned long request;
+
+       unsigned long last_probe;
+
        unsigned int flags;
 #define IEEE80211_STA_REQ_SCAN 0
 #define IEEE80211_STA_REQ_AUTH 1
 #define IEEE80211_STA_REQ_RUN  2
-       unsigned long request;
-       struct sk_buff_head skb_queue;
-
-       unsigned long last_probe;
 
 #define IEEE80211_AUTH_ALG_OPEN BIT(0)
 #define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)
@@ -460,14 +450,11 @@ struct ieee80211_sub_if_data {
                struct ieee80211_if_sta sta;
                u32 mntr_flags;
        } u;
-       int channel_use;
-       int channel_use_raw;
 
 #ifdef CONFIG_MAC80211_DEBUGFS
        struct dentry *debugfsdir;
        union {
                struct {
-                       struct dentry *channel_use;
                        struct dentry *drop_unencrypted;
                        struct dentry *state;
                        struct dentry *bssid;
@@ -486,7 +473,6 @@ struct ieee80211_sub_if_data {
                        struct dentry *num_beacons_sta;
                } sta;
                struct {
-                       struct dentry *channel_use;
                        struct dentry *drop_unencrypted;
                        struct dentry *num_sta_ps;
                        struct dentry *dtim_count;
@@ -496,12 +482,10 @@ struct ieee80211_sub_if_data {
                        struct dentry *num_buffered_multicast;
                } ap;
                struct {
-                       struct dentry *channel_use;
                        struct dentry *drop_unencrypted;
                        struct dentry *peer;
                } wds;
                struct {
-                       struct dentry *channel_use;
                        struct dentry *drop_unencrypted;
                } vlan;
                struct {
@@ -596,17 +580,18 @@ struct ieee80211_local {
        /*
         * The lock only protects the list, hash, timer and counter
         * against manipulation, reads are done in RCU. Additionally,
-        * the lock protects each BSS's TIM bitmap and a few items
-        * in a STA info structure.
+        * the lock protects each BSS's TIM bitmap.
         */
        spinlock_t sta_lock;
        unsigned long num_sta;
        struct list_head sta_list;
+       struct list_head sta_flush_list;
+       struct work_struct sta_flush_work;
        struct sta_info *sta_hash[STA_HASH_SIZE];
        struct timer_list sta_cleanup;
 
-       unsigned long state[NUM_TX_DATA_QUEUES_AMPDU];
-       struct ieee80211_tx_stored_packet pending_packet[NUM_TX_DATA_QUEUES_AMPDU];
+       unsigned long queues_pending[BITS_TO_LONGS(IEEE80211_MAX_QUEUES)];
+       struct ieee80211_tx_stored_packet pending_packet[IEEE80211_MAX_QUEUES];
        struct tasklet_struct tx_pending_tasklet;
 
        /* number of interfaces with corresponding IFF_ flags */
@@ -629,6 +614,13 @@ struct ieee80211_local {
 
        struct list_head interfaces;
 
+       /*
+        * Key lock, protects sdata's key_list and sta_info's
+        * key pointers (write access, they're RCU.)
+        */
+       spinlock_t key_lock;
+
+
        bool sta_sw_scanning;
        bool sta_hw_scanning;
        int scan_channel_idx;
@@ -665,9 +657,6 @@ struct ieee80211_local {
             assoc_led_name[32], radio_led_name[32];
 #endif
 
-       u32 channel_use;
-       u32 channel_use_raw;
-
 #ifdef CONFIG_MAC80211_DEBUGFS
        struct work_struct sta_debugfs_add;
 #endif
@@ -693,8 +682,6 @@ struct ieee80211_local {
        unsigned int rx_expand_skb_head2;
        unsigned int rx_handlers_fragments;
        unsigned int tx_status_drop;
-       unsigned int wme_rx_queue[NUM_RX_DATA_QUEUES];
-       unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES];
 #define I802_DEBUG_INC(c) (c)++
 #else /* CONFIG_MAC80211_DEBUG_COUNTERS */
 #define I802_DEBUG_INC(c) do { } while (0)
@@ -752,8 +739,6 @@ struct ieee80211_local {
                        struct dentry *rx_expand_skb_head2;
                        struct dentry *rx_handlers_fragments;
                        struct dentry *tx_status_drop;
-                       struct dentry *wme_tx_queue;
-                       struct dentry *wme_rx_queue;
 #endif
                        struct dentry *dot11ACKFailureCount;
                        struct dentry *dot11RTSFailureCount;
@@ -766,6 +751,15 @@ struct ieee80211_local {
 #endif
 };
 
+static inline int ieee80211_is_multiqueue(struct ieee80211_local *local)
+{
+#ifdef CONFIG_MAC80211_QOS
+       return netif_is_multiqueue(local->mdev);
+#else
+       return 0;
+#endif
+}
+
 /* this struct represents 802.11n's RA/TID combination */
 struct ieee80211_ra_tid {
        u8 ra[ETH_ALEN];
@@ -835,11 +829,6 @@ static inline struct ieee80211_hw *local_to_hw(
        return &local->hw;
 }
 
-enum ieee80211_link_state_t {
-       IEEE80211_LINK_STATE_XOFF = 0,
-       IEEE80211_LINK_STATE_PENDING,
-};
-
 struct sta_attribute {
        struct attribute attr;
        ssize_t (*show)(const struct sta_info *, char *buf);
@@ -859,39 +848,15 @@ int ieee80211_if_config(struct net_device *dev);
 int ieee80211_if_config_beacon(struct net_device *dev);
 void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
 void ieee80211_if_setup(struct net_device *dev);
-int ieee80211_hw_config_ht(struct ieee80211_local *local, int enable_ht,
-                          struct ieee80211_ht_info *req_ht_cap,
-                          struct ieee80211_ht_bss_info *req_bss_cap);
+u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht,
+                       struct ieee80211_ht_info *req_ht_cap,
+                       struct ieee80211_ht_bss_info *req_bss_cap);
 
 /* ieee80211_ioctl.c */
 extern const struct iw_handler_def ieee80211_iw_handler_def;
+int ieee80211_set_freq(struct net_device *dev, int freq);
 
-
-/* Least common multiple of the used rates (in 100 kbps). This is used to
- * calculate rate_inv values for each rate so that only integers are needed. */
-#define CHAN_UTIL_RATE_LCM 95040
-/* 1 usec is 1/8 * (95040/10) = 1188 */
-#define CHAN_UTIL_PER_USEC 1188
-/* Amount of bits to shift the result right to scale the total utilization
- * to values that will not wrap around 32-bit integers. */
-#define CHAN_UTIL_SHIFT 9
-/* Theoretical maximum of channel utilization counter in 10 ms (stat_time=1):
- * (CHAN_UTIL_PER_USEC * 10000) >> CHAN_UTIL_SHIFT = 23203. So dividing the
- * raw value with about 23 should give utilization in 10th of a percentage
- * (1/1000). However, utilization is only estimated and not all intervals
- * between frames etc. are calculated. 18 seems to give numbers that are closer
- * to the real maximum. */
-#define CHAN_UTIL_PER_10MS 18
-#define CHAN_UTIL_HDR_LONG (202 * CHAN_UTIL_PER_USEC)
-#define CHAN_UTIL_HDR_SHORT (40 * CHAN_UTIL_PER_USEC)
-
-
-/* ieee80211_ioctl.c */
-int ieee80211_set_compression(struct ieee80211_local *local,
-                             struct net_device *dev, struct sta_info *sta);
-int ieee80211_set_freq(struct ieee80211_local *local, int freq);
 /* ieee80211_sta.c */
-#define IEEE80211_FC(type, stype) cpu_to_le16(type | stype)
 void ieee80211_sta_timer(unsigned long data);
 void ieee80211_sta_work(struct work_struct *work);
 void ieee80211_sta_scan_work(struct work_struct *work);
@@ -903,16 +868,18 @@ int ieee80211_sta_set_bssid(struct net_device *dev, u8 *bssid);
 int ieee80211_sta_req_scan(struct net_device *dev, u8 *ssid, size_t ssid_len);
 void ieee80211_sta_req_auth(struct net_device *dev,
                            struct ieee80211_if_sta *ifsta);
-int ieee80211_sta_scan_results(struct net_device *dev, char *buf, size_t len);
+int ieee80211_sta_scan_results(struct net_device *dev,
+                              struct iw_request_info *info,
+                              char *buf, size_t len);
 ieee80211_rx_result ieee80211_sta_rx_scan(
        struct net_device *dev, struct sk_buff *skb,
        struct ieee80211_rx_status *rx_status);
 void ieee80211_rx_bss_list_init(struct net_device *dev);
 void ieee80211_rx_bss_list_deinit(struct net_device *dev);
 int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len);
-struct sta_info * ieee80211_ibss_add_sta(struct net_device *dev,
-                                        struct sk_buff *skb, u8 *bssid,
-                                        u8 *addr);
+struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev,
+                                       struct sk_buff *skb, u8 *bssid,
+                                       u8 *addr, u64 supp_rates);
 int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason);
 int ieee80211_sta_disassociate(struct net_device *dev, u16 reason);
 void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
@@ -928,10 +895,11 @@ void ieee80211_send_addba_request(struct net_device *dev, const u8 *da,
                                  u16 agg_size, u16 timeout);
 void ieee80211_send_delba(struct net_device *dev, const u8 *da, u16 tid,
                                u16 initiator, u16 reason_code);
+
 void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *da,
                                u16 tid, u16 initiator, u16 reason);
-void sta_rx_agg_session_timer_expired(unsigned long data);
 void sta_addba_resp_timer_expired(unsigned long data);
+void ieee80211_sta_tear_down_BA_sessions(struct net_device *dev, u8 *addr);
 u64 ieee80211_sta_get_rates(struct ieee80211_local *local,
                            struct ieee802_11_elems *elems,
                            enum ieee80211_band band);