Merge branch 'tip/perf/urgent-3' of git://git.kernel.org/pub/scm/linux/kernel/git...
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rt2x00 / rt2x00.h
index c21af38cc5af57364694c8bc46e19867e2c8150d..94fe589acfaabff06eac097fe7e3ae3e2f7ea310 100644 (file)
@@ -1,5 +1,6 @@
 /*
-       Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
+       Copyright (C) 2010 Willow Garage <http://www.willowgarage.com>
+       Copyright (C) 2004 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
        Copyright (C) 2004 - 2009 Gertjan van Wingerde <gwingerde@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
@@ -35,6 +36,7 @@
 #include <linux/mutex.h>
 #include <linux/etherdevice.h>
 #include <linux/input-polldev.h>
+#include <linux/kfifo.h>
 
 #include <net/mac80211.h>
 
@@ -212,8 +214,9 @@ struct channel_info {
        unsigned int flags;
 #define GEOGRAPHY_ALLOWED      0x00000001
 
-       short tx_power1;
-       short tx_power2;
+       short max_power;
+       short default_power1;
+       short default_power2;
 };
 
 /*
@@ -335,6 +338,11 @@ struct link {
 
        /*
         * Work structure for scheduling periodic watchdog monitoring.
+        * This work must be scheduled on the kernel workqueue, while
+        * all other work structures must be queued on the mac80211
+        * workqueue. This guarantees that the watchdog can schedule
+        * other work structures and wait for their completion in order
+        * to bring the device/driver back into the desired state.
         */
        struct delayed_work watchdog_work;
 };
@@ -455,6 +463,7 @@ struct rt2x00lib_erp {
        short eifs;
 
        u16 beacon_int;
+       u16 ht_opmode;
 };
 
 /*
@@ -519,6 +528,11 @@ struct rt2x00lib_ops {
         */
        irq_handler_t irq_handler_thread;
 
+       /*
+        * TX status tasklet handler.
+        */
+       void (*txstatus_tasklet) (unsigned long data);
+
        /*
         * Device init handlers.
         */
@@ -558,18 +572,15 @@ struct rt2x00lib_ops {
        /*
         * TX control handlers
         */
-       void (*write_tx_desc) (struct rt2x00_dev *rt2x00dev,
-                              struct sk_buff *skb,
+       void (*write_tx_desc) (struct queue_entry *entry,
                               struct txentry_desc *txdesc);
        void (*write_tx_data) (struct queue_entry *entry,
                               struct txentry_desc *txdesc);
        void (*write_beacon) (struct queue_entry *entry,
                              struct txentry_desc *txdesc);
        int (*get_tx_data_len) (struct queue_entry *entry);
-       void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev,
-                              const enum data_queue_qid queue);
-       void (*kill_tx_queue) (struct rt2x00_dev *rt2x00dev,
-                              const enum data_queue_qid queue);
+       void (*kick_tx_queue) (struct data_queue *queue);
+       void (*kill_tx_queue) (struct data_queue *queue);
 
        /*
         * RX control handlers
@@ -597,7 +608,8 @@ struct rt2x00lib_ops {
 #define CONFIG_UPDATE_BSSID            ( 1 << 3 )
 
        void (*config_erp) (struct rt2x00_dev *rt2x00dev,
-                           struct rt2x00lib_erp *erp);
+                           struct rt2x00lib_erp *erp,
+                           u32 changed);
        void (*config_ant) (struct rt2x00_dev *rt2x00dev,
                            struct antenna_setup *ant);
        void (*config) (struct rt2x00_dev *rt2x00dev,
@@ -651,6 +663,7 @@ enum rt2x00_flags {
        DRIVER_REQUIRE_DMA,
        DRIVER_REQUIRE_COPY_IV,
        DRIVER_REQUIRE_L2PAD,
+       DRIVER_REQUIRE_TXSTATUS_FIFO,
 
        /*
         * Driver features
@@ -698,6 +711,7 @@ struct rt2x00_dev {
        struct ieee80211_hw *hw;
        struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
        enum ieee80211_band curr_band;
+       int curr_freq;
 
        /*
         * If enabled, the debugfs interface structures
@@ -849,11 +863,6 @@ struct rt2x00_dev {
         */
        struct ieee80211_low_level_stats low_level_stats;
 
-       /*
-        * RX configuration information.
-        */
-       struct ieee80211_rx_status rx_status;
-
        /*
         * Scheduled work.
         * NOTE: intf_work will use ieee80211_iterate_active_interfaces()
@@ -862,6 +871,12 @@ struct rt2x00_dev {
         */
        struct work_struct intf_work;
 
+       /**
+        * Scheduled work for TX/RX done handling (USB devices)
+        */
+       struct work_struct rxdone_work;
+       struct work_struct txdone_work;
+
        /*
         * Data queue arrays for RX, TX and Beacon.
         * The Beacon array also contains the Atim queue
@@ -882,6 +897,16 @@ struct rt2x00_dev {
         * and interrupt thread routine.
         */
        u32 irqvalue[2];
+
+       /*
+        * FIFO for storing tx status reports between isr and tasklet.
+        */
+       struct kfifo txstatus_fifo;
+
+       /*
+        * Tasklet for processing tx status reports (rt2800pci).
+        */
+       struct tasklet_struct txstatus_tasklet;
 };
 
 /*
@@ -1016,17 +1041,15 @@ static inline bool rt2x00_is_soc(struct rt2x00_dev *rt2x00dev)
 
 /**
  * rt2x00queue_map_txskb - Map a skb into DMA for TX purposes.
- * @rt2x00dev: Pointer to &struct rt2x00_dev.
- * @skb: The skb to map.
+ * @entry: Pointer to &struct queue_entry
  */
-void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb);
+void rt2x00queue_map_txskb(struct queue_entry *entry);
 
 /**
  * rt2x00queue_unmap_skb - Unmap a skb from DMA.
- * @rt2x00dev: Pointer to &struct rt2x00_dev.
- * @skb: The skb to unmap.
+ * @entry: Pointer to &struct queue_entry
  */
-void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb);
+void rt2x00queue_unmap_skb(struct queue_entry *entry);
 
 /**
  * rt2x00queue_get_queue - Convert queue index to queue pointer
@@ -1069,10 +1092,11 @@ static inline void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
  */
 void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev);
 void rt2x00lib_pretbtt(struct rt2x00_dev *rt2x00dev);
+void rt2x00lib_dmadone(struct queue_entry *entry);
 void rt2x00lib_txdone(struct queue_entry *entry,
                      struct txdone_entry_desc *txdesc);
-void rt2x00lib_rxdone(struct rt2x00_dev *rt2x00dev,
-                     struct queue_entry *entry);
+void rt2x00lib_txdone_noinfo(struct queue_entry *entry, u32 status);
+void rt2x00lib_rxdone(struct queue_entry *entry);
 
 /*
  * mac80211 handlers.