rt2x00: Fix rt2500usb HW crypto: WEP 128 & AES
[safe/jmp/linux-2.6] / drivers / net / wireless / rt2x00 / rt2x00.h
index ced0a52..39ecf3b 100644 (file)
@@ -44,7 +44,7 @@
 /*
  * Module information.
  */
-#define DRV_VERSION    "2.2.0"
+#define DRV_VERSION    "2.2.3"
 #define DRV_PROJECT    "http://rt2x00.serialmonkey.com"
 
 /*
        DEBUG_PRINTK(__dev, KERN_DEBUG, "EEPROM recovery", __msg, ##__args)
 
 /*
+ * Duration calculations
+ * The rate variable passed is: 100kbs.
+ * To convert from bytes to bits we multiply size with 8,
+ * then the size is multiplied with 10 to make the
+ * real rate -> rate argument correction.
+ */
+#define GET_DURATION(__size, __rate)   (((__size) * 8 * 10) / (__rate))
+#define GET_DURATION_RES(__size, __rate)(((__size) * 8 * 10) % (__rate))
+
+/*
  * Standard timing and size defines.
  * These values should follow the ieee80211 specifications.
  */
 #define DIFS                   ( PIFS + SLOT_TIME )
 #define SHORT_DIFS             ( SHORT_PIFS + SHORT_SLOT_TIME )
 #define EIFS                   ( SIFS + DIFS + \
-                                 (8 * (IEEE80211_HEADER + ACK_SIZE)) )
+                                 GET_DURATION(IEEE80211_HEADER + ACK_SIZE, 10) )
 #define SHORT_EIFS             ( SIFS + SHORT_DIFS + \
-                                 (8 * (IEEE80211_HEADER + ACK_SIZE)) )
+                                 GET_DURATION(IEEE80211_HEADER + ACK_SIZE, 10) )
 
 /*
  * Chipset identification
@@ -348,13 +358,6 @@ struct rt2x00_intf {
        spinlock_t lock;
 
        /*
-        * BSS configuration. Copied from the structure
-        * passed to us through the bss_info_changed()
-        * callback funtion.
-        */
-       struct ieee80211_bss_conf conf;
-
-       /*
         * MAC of the device.
         */
        u8 mac[ETH_ALEN];
@@ -433,18 +436,6 @@ struct rt2x00lib_conf {
 
        struct rf_channel rf;
        struct channel_info channel;
-
-       struct antenna_setup ant;
-
-       enum ieee80211_band band;
-
-       u32 basic_rates;
-       u32 slot_time;
-
-       short sifs;
-       short pifs;
-       short difs;
-       short eifs;
 };
 
 /*
@@ -456,6 +447,15 @@ struct rt2x00lib_erp {
 
        int ack_timeout;
        int ack_consume_time;
+
+       u64 basic_rates;
+
+       int slot_time;
+
+       short sifs;
+       short pifs;
+       short difs;
+       short eifs;
 };
 
 /*
@@ -483,7 +483,7 @@ struct rt2x00intf_conf {
        /*
         * Interface type
         */
-       enum ieee80211_if_types type;
+       enum nl80211_iftype type;
 
        /*
         * TSF sync value, this is dependant on the operation type.
@@ -533,10 +533,8 @@ struct rt2x00lib_ops {
        /*
         * queue initialization handlers
         */
-       void (*init_rxentry) (struct rt2x00_dev *rt2x00dev,
-                             struct queue_entry *entry);
-       void (*init_txentry) (struct rt2x00_dev *rt2x00dev,
-                             struct queue_entry *entry);
+       bool (*get_entry_state) (struct queue_entry *entry);
+       void (*clear_entry) (struct queue_entry *entry);
 
        /*
         * Radio control handlers.
@@ -557,8 +555,7 @@ struct rt2x00lib_ops {
                               struct txentry_desc *txdesc);
        int (*write_tx_data) (struct queue_entry *entry);
        void (*write_beacon) (struct queue_entry *entry);
-       int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev,
-                               struct sk_buff *skb);
+       int (*get_tx_data_len) (struct queue_entry *entry);
        void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev,
                               const enum data_queue_qid queue);
 
@@ -589,16 +586,11 @@ struct rt2x00lib_ops {
 
        void (*config_erp) (struct rt2x00_dev *rt2x00dev,
                            struct rt2x00lib_erp *erp);
+       void (*config_ant) (struct rt2x00_dev *rt2x00dev,
+                           struct antenna_setup *ant);
        void (*config) (struct rt2x00_dev *rt2x00dev,
                        struct rt2x00lib_conf *libconf,
-                       const unsigned int flags);
-#define CONFIG_UPDATE_PHYMODE          ( 1 << 1 )
-#define CONFIG_UPDATE_CHANNEL          ( 1 << 2 )
-#define CONFIG_UPDATE_TXPOWER          ( 1 << 3 )
-#define CONFIG_UPDATE_ANTENNA          ( 1 << 4 )
-#define CONFIG_UPDATE_SLOT_TIME        ( 1 << 5 )
-#define CONFIG_UPDATE_BEACON_INT       ( 1 << 6 )
-#define CONFIG_UPDATE_ALL              0xffff
+                       const unsigned int changed_flags);
 };
 
 /*
@@ -629,14 +621,13 @@ enum rt2x00_flags {
        /*
         * Device state flags
         */
-       DEVICE_PRESENT,
-       DEVICE_REGISTERED_HW,
-       DEVICE_INITIALIZED,
-       DEVICE_STARTED,
-       DEVICE_STARTED_SUSPEND,
-       DEVICE_ENABLED_RADIO,
-       DEVICE_DISABLED_RADIO_HW,
-       DEVICE_DIRTY_CONFIG,
+       DEVICE_STATE_PRESENT,
+       DEVICE_STATE_REGISTERED_HW,
+       DEVICE_STATE_INITIALIZED,
+       DEVICE_STATE_STARTED,
+       DEVICE_STATE_STARTED_SUSPEND,
+       DEVICE_STATE_ENABLED_RADIO,
+       DEVICE_STATE_DISABLED_RADIO_HW,
 
        /*
         * Driver requirements
@@ -662,6 +653,7 @@ enum rt2x00_flags {
        CONFIG_EXTERNAL_LNA_BG,
        CONFIG_DOUBLE_ANTENNA,
        CONFIG_DISABLE_LINK_TUNING,
+       CONFIG_CRYPTO_COPY_IV,
 };
 
 /*
@@ -739,8 +731,7 @@ struct rt2x00_dev {
 
        /*
         * This is the default TX/RX antenna setup as indicated
-        * by the device's EEPROM. When mac80211 sets its
-        * antenna value to 0 we should be using these values.
+        * by the device's EEPROM.
         */
        struct antenna_setup default_ant;
 
@@ -755,16 +746,15 @@ struct rt2x00_dev {
        } csr;
 
        /*
-        * Mutex to protect register accesses on USB devices.
-        * There are 2 reasons this is needed, one is to ensure
-        * use of the csr_cache (for USB devices) by one thread
-        * isn't corrupted by another thread trying to access it.
-        * The other is that access to BBP and RF registers
-        * require multiple BUS transactions and if another thread
-        * attempted to access one of those registers at the same
-        * time one of the writes could silently fail.
+        * Mutex to protect register accesses.
+        * For PCI and USB devices it protects against concurrent indirect
+        * register access (BBP, RF, MCU) since accessing those
+        * registers require multiple calls to the CSR registers.
+        * For USB devices it also protects the csr_cache since that
+        * field is used for normal CSR access and it cannot support
+        * multiple callers simultaneously.
         */
-       struct mutex usb_cache_mutex;
+       struct mutex csr_mutex;
 
        /*
         * Current packet filter configuration for the device.
@@ -804,9 +794,9 @@ struct rt2x00_dev {
        u32 *rf;
 
        /*
-        * USB Max frame size (for rt2500usb & rt73usb).
+        * LNA gain
         */
-       u16 usb_maxpacket;
+       short lna_gain;
 
        /*
         * Current TX power value.
@@ -814,6 +804,12 @@ struct rt2x00_dev {
        u16 tx_power;
 
        /*
+        * Current retry values.
+        */
+       u8 short_retry;
+       u8 long_retry;
+
+       /*
         * Rssi <-> Dbm offset
         */
        u8 rssi_offset;
@@ -934,23 +930,6 @@ static inline u16 rt2x00_check_rev(const struct rt2x00_chip *chipset,
                !!(chipset->rev & 0x0000f));
 }
 
-/*
- * Duration calculations
- * The rate variable passed is: 100kbs.
- * To convert from bytes to bits we multiply size with 8,
- * then the size is multiplied with 10 to make the
- * real rate -> rate argument correction.
- */
-static inline u16 get_duration(const unsigned int size, const u8 rate)
-{
-       return ((size * 8 * 10) / rate);
-}
-
-static inline u16 get_duration_res(const unsigned int size, const u8 rate)
-{
-       return ((size * 8 * 10) % rate);
-}
-
 /**
  * rt2x00queue_map_txskb - Map a skb into DMA for TX purposes.
  * @rt2x00dev: Pointer to &struct rt2x00_dev.
@@ -993,7 +972,7 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
                            struct ieee80211_if_init_conf *conf);
 void rt2x00mac_remove_interface(struct ieee80211_hw *hw,
                                struct ieee80211_if_init_conf *conf);
-int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf);
+int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed);
 int rt2x00mac_config_interface(struct ieee80211_hw *hw,
                               struct ieee80211_vif *vif,
                               struct ieee80211_if_conf *conf);