mac80211: New stat counters for multicast and unicast forwarded frames
[pandora-kernel.git] / net / mac80211 / ieee80211_i.h
index 327aabc..93e618a 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/spinlock.h>
 #include <linux/etherdevice.h>
 #include <net/cfg80211.h>
-#include <net/iw_handler.h>
 #include <net/mac80211.h>
 #include "key.h"
 #include "sta_info.h"
@@ -213,7 +212,9 @@ struct ieee80211_if_vlan {
 };
 
 struct mesh_stats {
-       __u32 fwded_frames;             /* Mesh forwarded frames */
+       __u32 fwded_mcast;              /* Mesh forwarded multicast frames */
+       __u32 fwded_unicast;            /* Mesh forwarded unicast frames */
+       __u32 fwded_frames;             /* Mesh total forwarded frames */
        __u32 dropped_frames_ttl;       /* Not transmitted since mesh_ttl == 0*/
        __u32 dropped_frames_no_route;  /* Not transmitted, no route found */
        atomic_t estab_plinks;
@@ -247,18 +248,22 @@ struct ieee80211_mgd_work {
 
        int tries;
 
+       u8 key[WLAN_KEY_LEN_WEP104];
+       u8 key_len, key_idx;
+
        /* must be last */
        u8 ie[0]; /* for auth or assoc frame, not probe */
 };
 
 /* flags used in struct ieee80211_if_managed.flags */
 enum ieee80211_sta_flags {
-       IEEE80211_STA_PROBEREQ_POLL     = BIT(3),
-       IEEE80211_STA_CONTROL_PORT      = BIT(4),
-       IEEE80211_STA_WMM_ENABLED       = BIT(5),
-       IEEE80211_STA_DISABLE_11N       = BIT(6),
-       IEEE80211_STA_CSA_RECEIVED      = BIT(7),
-       IEEE80211_STA_MFP_ENABLED       = BIT(8),
+       IEEE80211_STA_BEACON_POLL       = BIT(0),
+       IEEE80211_STA_CONNECTION_POLL   = BIT(1),
+       IEEE80211_STA_CONTROL_PORT      = BIT(2),
+       IEEE80211_STA_WMM_ENABLED       = BIT(3),
+       IEEE80211_STA_DISABLE_11N       = BIT(4),
+       IEEE80211_STA_CSA_RECEIVED      = BIT(5),
+       IEEE80211_STA_MFP_ENABLED       = BIT(6),
 };
 
 /* flags for MLME request */
@@ -268,13 +273,20 @@ enum ieee80211_sta_request {
 
 struct ieee80211_if_managed {
        struct timer_list timer;
+       struct timer_list conn_mon_timer;
+       struct timer_list bcn_mon_timer;
        struct timer_list chswitch_timer;
        struct work_struct work;
+       struct work_struct monitor_work;
        struct work_struct chswitch_work;
        struct work_struct beacon_loss_work;
 
+       unsigned long probe_timeout;
+       int probe_send_count;
+
        struct mutex mtx;
        struct ieee80211_bss *associated;
+       struct ieee80211_mgd_work *old_associate_work;
        struct list_head work_list;
 
        u8 bssid[ETH_ALEN];
@@ -289,8 +301,6 @@ struct ieee80211_if_managed {
 
        unsigned long request;
 
-       unsigned long last_beacon;
-
        unsigned int flags;
 
        u32 beacon_crc;
@@ -321,6 +331,7 @@ struct ieee80211_if_ibss {
 
        bool fixed_bssid;
        bool fixed_channel;
+       bool privacy;
 
        u8 bssid[ETH_ALEN];
        u8 ssid[IEEE80211_MAX_SSID_LEN];
@@ -346,7 +357,7 @@ struct ieee80211_if_mesh {
 
        unsigned long timers_running;
 
-       bool housekeeping;
+       unsigned long wrkq_flags;
 
        u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
        size_t mesh_id_len;
@@ -497,6 +508,8 @@ struct ieee80211_sub_if_data {
 #ifdef CONFIG_MAC80211_MESH
        struct dentry *mesh_stats_dir;
        struct {
+               struct dentry *fwded_mcast;
+               struct dentry *fwded_unicast;
                struct dentry *fwded_frames;
                struct dentry *dropped_frames_ttl;
                struct dentry *dropped_frames_no_route;
@@ -559,12 +572,44 @@ enum queue_stop_reason {
        IEEE80211_QUEUE_STOP_REASON_CSA,
        IEEE80211_QUEUE_STOP_REASON_AGGREGATION,
        IEEE80211_QUEUE_STOP_REASON_SUSPEND,
-       IEEE80211_QUEUE_STOP_REASON_PENDING,
        IEEE80211_QUEUE_STOP_REASON_SKB_ADD,
 };
 
-struct ieee80211_master_priv {
-       struct ieee80211_local *local;
+/**
+ * mac80211 scan flags - currently active scan mode
+ *
+ * @SCAN_SW_SCANNING: We're currently in the process of scanning but may as
+ *     well be on the operating channel
+ * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to
+ *     determine if we are on the operating channel or not
+ * @SCAN_OFF_CHANNEL: We're off our operating channel for scanning,
+ *     gets only set in conjunction with SCAN_SW_SCANNING
+ */
+enum {
+       SCAN_SW_SCANNING,
+       SCAN_HW_SCANNING,
+       SCAN_OFF_CHANNEL,
+};
+
+/**
+ * enum mac80211_scan_state - scan state machine states
+ *
+ * @SCAN_DECISION: Main entry point to the scan state machine, this state
+ *     determines if we should keep on scanning or switch back to the
+ *     operating channel
+ * @SCAN_SET_CHANNEL: Set the next channel to be scanned
+ * @SCAN_SEND_PROBE: Send probe requests and wait for probe responses
+ * @SCAN_LEAVE_OPER_CHANNEL: Leave the operating channel, notify the AP
+ *     about us leaving the channel and stop all associated STA interfaces
+ * @SCAN_ENTER_OPER_CHANNEL: Enter the operating channel again, notify the
+ *     AP about us being back and restart all associated STA interfaces
+ */
+enum mac80211_scan_state {
+       SCAN_DECISION,
+       SCAN_SET_CHANNEL,
+       SCAN_SEND_PROBE,
+       SCAN_LEAVE_OPER_CHANNEL,
+       SCAN_ENTER_OPER_CHANNEL,
 };
 
 struct ieee80211_local {
@@ -575,17 +620,33 @@ struct ieee80211_local {
 
        const struct ieee80211_ops *ops;
 
+       /*
+        * private workqueue to mac80211. mac80211 makes this accessible
+        * via ieee80211_queue_work()
+        */
+       struct workqueue_struct *workqueue;
+
        unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES];
        /* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */
        spinlock_t queue_stop_reason_lock;
 
-       struct net_device *mdev; /* wmaster# - "master" 802.11 device */
        int open_count;
        int monitors, cooked_mntrs;
        /* number of interfaces with corresponding FIF_ flags */
-       int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss;
+       int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll;
        unsigned int filter_flags; /* FIF_* */
        struct iw_statistics wstats;
+
+       /* protects the aggregated multicast list and filter calls */
+       spinlock_t filter_lock;
+
+       /* used for uploading changed mc list */
+       struct work_struct reconfig_filter;
+
+       /* aggregated multicast list */
+       struct dev_addr_list *mc_list;
+       int mc_count;
+
        bool tim_in_locked_section; /* see ieee80211_beacon_get() */
 
        /*
@@ -624,6 +685,7 @@ struct ieee80211_local {
        struct list_head sta_list;
        struct sta_info *sta_hash[STA_HASH_SIZE];
        struct timer_list sta_cleanup;
+       int sta_generation;
 
        struct sk_buff_head pending[IEEE80211_MAX_QUEUES];
        struct tasklet_struct tx_pending_tasklet;
@@ -658,9 +720,9 @@ struct ieee80211_local {
 
        /* Scanning and BSS list */
        struct mutex scan_mtx;
-       bool sw_scanning, hw_scanning;
+       unsigned long scanning;
        struct cfg80211_ssid scan_ssid;
-       struct cfg80211_scan_request int_scan_req;
+       struct cfg80211_scan_request *int_scan_req;
        struct cfg80211_scan_request *scan_req;
        struct ieee80211_channel *scan_channel;
        const u8 *orig_ies;
@@ -668,7 +730,7 @@ struct ieee80211_local {
        int scan_channel_idx;
        int scan_ies_len;
 
-       enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
+       enum mac80211_scan_state next_scan_state;
        struct delayed_work scan_work;
        struct ieee80211_sub_if_data *scan_sdata;
        enum nl80211_channel_type oper_channel_type;
@@ -805,10 +867,6 @@ struct ieee80211_local {
 static inline struct ieee80211_sub_if_data *
 IEEE80211_DEV_TO_SUB_IF(struct net_device *dev)
 {
-       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-
-       BUG_ON(!local || local->mdev == dev);
-
        return netdev_priv(dev);
 }
 
@@ -908,9 +966,6 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
 void ieee80211_configure_filter(struct ieee80211_local *local);
 u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
 
-/* wireless extensions */
-extern const struct iw_handler_def ieee80211_iw_handler_def;
-
 /* STA code */
 void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
 int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
@@ -988,7 +1043,6 @@ void ieee80211_recalc_idle(struct ieee80211_local *local);
 /* tx handling */
 void ieee80211_clear_tx_pending(struct ieee80211_local *local);
 void ieee80211_tx_pending(unsigned long data);
-int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev);
 int ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev);
 int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev);
 
@@ -1093,8 +1147,8 @@ int ieee80211_add_pending_skbs(struct ieee80211_local *local,
 
 void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
                         u16 transaction, u16 auth_alg,
-                        u8 *extra, size_t extra_len,
-                        const u8 *bssid, int encrypt);
+                        u8 *extra, size_t extra_len, const u8 *bssid,
+                        const u8 *key, u8 key_len, u8 key_idx);
 int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
                             const u8 *ie, size_t ie_len);
 void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,