rt2x00: Fix for rt2800usb for SHARED_KEY_TABLE initializations
[pandora-kernel.git] / drivers / net / wireless / rt2x00 / rt2x00lib.h
index d83e379..eeb2881 100644 (file)
 
 /*
  * Interval defines
- * Both the link tuner as the rfkill will be called once per second.
  */
-#define LINK_TUNE_INTERVAL     ( round_jiffies_relative(HZ) )
-#define RFKILL_POLL_INTERVAL   ( 1000 )
+#define LINK_TUNE_INTERVAL     round_jiffies_relative(HZ)
 
 /*
  * rt2x00_rate: Per rate device information
@@ -48,6 +46,7 @@ struct rt2x00_rate {
        unsigned short ratemask;
 
        unsigned short plcp;
+       unsigned short mcs;
 };
 
 extern const struct rt2x00_rate rt2x00_supported_rates[12];
@@ -57,6 +56,14 @@ static inline const struct rt2x00_rate *rt2x00_get_rate(const u16 hw_value)
        return &rt2x00_supported_rates[hw_value & 0xff];
 }
 
+#define RATE_MCS(__mode, __mcs) \
+       ( (((__mode) & 0x00ff) << 8) | ((__mcs) & 0x00ff) )
+
+static inline int rt2x00_get_rate_mcs(const u16 mcs_value)
+{
+       return (mcs_value & 0x00ff);
+}
+
 /*
  * Radio control handlers.
  */
@@ -81,7 +88,7 @@ void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev,
                          struct rt2x00_intf *intf,
                          struct ieee80211_bss_conf *conf);
 void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
-                             struct antenna_setup *ant);
+                             struct antenna_setup ant);
 void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
                      struct ieee80211_conf *conf,
                      const unsigned int changed_flags);
@@ -112,6 +119,23 @@ void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb);
  */
 void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb);
 
+/**
+ * rt2x00queue_payload_align - Align 802.11 payload to 4-byte boundary
+ * @skb: The skb to align
+ * @l2pad: Should L2 padding be used
+ * @header_length: Length of 802.11 header
+ *
+ * This function prepares the @skb to be send to the device or mac80211.
+ * If @l2pad is set to true padding will occur between the 802.11 header
+ * and payload. Otherwise the padding will be done in front of the 802.11
+ * header.
+ * When @l2pad is set the function will check for the &SKBDESC_L2_PADDED
+ * flag in &skb_frame_desc. If that flag is set, the padding is removed
+ * and the flag cleared. Otherwise the padding is added and the flag is set.
+ */
+void rt2x00queue_payload_align(struct sk_buff *skb,
+                              bool l2pad, unsigned int header_length);
+
 /**
  * rt2x00queue_write_tx_frame - Write TX frame to hardware
  * @queue: Queue over which the frame should be send
@@ -295,10 +319,12 @@ void rt2x00crypto_create_tx_descriptor(struct queue_entry *entry,
                                       struct txentry_desc *txdesc);
 unsigned int rt2x00crypto_tx_overhead(struct rt2x00_dev *rt2x00dev,
                                      struct sk_buff *skb);
-void rt2x00crypto_tx_copy_iv(struct sk_buff *skb, unsigned int iv_len);
-void rt2x00crypto_tx_remove_iv(struct sk_buff *skb, unsigned int iv_len);
-void rt2x00crypto_tx_insert_iv(struct sk_buff *skb);
-void rt2x00crypto_rx_insert_iv(struct sk_buff *skb, unsigned int align,
+void rt2x00crypto_tx_copy_iv(struct sk_buff *skb,
+                            struct txentry_desc *txdesc);
+void rt2x00crypto_tx_remove_iv(struct sk_buff *skb,
+                              struct txentry_desc *txdesc);
+void rt2x00crypto_tx_insert_iv(struct sk_buff *skb, unsigned int header_length);
+void rt2x00crypto_rx_insert_iv(struct sk_buff *skb, bool l2pad,
                               unsigned int header_length,
                               struct rxdone_entry_desc *rxdesc);
 #else
@@ -319,21 +345,21 @@ static inline unsigned int rt2x00crypto_tx_overhead(struct rt2x00_dev *rt2x00dev
 }
 
 static inline void rt2x00crypto_tx_copy_iv(struct sk_buff *skb,
-                                          unsigned int iv_len)
+                                          struct txentry_desc *txdesc)
 {
 }
 
 static inline void rt2x00crypto_tx_remove_iv(struct sk_buff *skb,
-                                            unsigned int iv_len)
+                                            struct txentry_desc *txdesc)
 {
 }
 
-static inline void rt2x00crypto_tx_insert_iv(struct sk_buff *skb)
+static inline void rt2x00crypto_tx_insert_iv(struct sk_buff *skb,
+                                            unsigned int header_length)
 {
 }
 
-static inline void rt2x00crypto_rx_insert_iv(struct sk_buff *skb,
-                                            unsigned int align,
+static inline void rt2x00crypto_rx_insert_iv(struct sk_buff *skb, bool l2pad,
                                             unsigned int header_length,
                                             struct rxdone_entry_desc *rxdesc)
 {
@@ -341,30 +367,34 @@ static inline void rt2x00crypto_rx_insert_iv(struct sk_buff *skb,
 #endif /* CONFIG_RT2X00_LIB_CRYPTO */
 
 /*
- * RFkill handlers.
+ * HT handlers.
  */
-#ifdef CONFIG_RT2X00_LIB_RFKILL
-void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev);
-void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev);
-void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev);
-void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev);
+#ifdef CONFIG_RT2X00_LIB_HT
+void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
+                                  struct txentry_desc *txdesc,
+                                  const struct rt2x00_rate *hwrate);
 #else
-static inline void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev)
+static inline void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
+                                                struct txentry_desc *txdesc,
+                                                const struct rt2x00_rate *hwrate)
 {
 }
+#endif /* CONFIG_RT2X00_LIB_HT */
 
-static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev)
-{
-}
-
-static inline void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev)
+/*
+ * RFkill handlers.
+ */
+static inline void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev)
 {
+       if (test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags))
+               wiphy_rfkill_start_polling(rt2x00dev->hw->wiphy);
 }
 
-static inline void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev)
+static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev)
 {
+       if (test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags))
+               wiphy_rfkill_stop_polling(rt2x00dev->hw->wiphy);
 }
-#endif /* CONFIG_RT2X00_LIB_RFKILL */
 
 /*
  * LED handlers