]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
rt2x00: Move beacon and atim queue defines into rt2x00
authorIvo van Doorn <ivdoorn@gmail.com>
Sun, 3 Feb 2008 14:54:57 +0000 (15:54 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 29 Feb 2008 20:19:29 +0000 (15:19 -0500)
As Johannes Berg indicated the BEACON and AFTER_BEACON
queue indeces in mac80211 should be removed because they
are too hardware specific. This patch adds the queue index
defines into rt2x00queue.h and removes the dependency of
the defines inside mac80211.h.

Also move rt2x00pci_beacon_update() into rt2400pci and
rt2500pci individually since it is no longer a generic
function since rt61 and rt2800 no longer use that.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 files changed:
drivers/net/wireless/rt2x00/rt2400pci.c
drivers/net/wireless/rt2x00/rt2500pci.c
drivers/net/wireless/rt2x00/rt2500usb.c
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00dev.c
drivers/net/wireless/rt2x00/rt2x00mac.c
drivers/net/wireless/rt2x00/rt2x00pci.c
drivers/net/wireless/rt2x00/rt2x00pci.h
drivers/net/wireless/rt2x00/rt2x00queue.c
drivers/net/wireless/rt2x00/rt2x00queue.h
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c

index 61766ed800e34951584464ea0774d09cf97e4991..feb8c09a33ad103fdbb971dc26337628ca74869d 100644 (file)
@@ -1041,11 +1041,11 @@ static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
  * TX data initialization
  */
 static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
-                                   unsigned int queue)
+                                   const unsigned int queue)
 {
        u32 reg;
 
-       if (queue == IEEE80211_TX_QUEUE_BEACON) {
+       if (queue == RT2X00_BCN_QUEUE_BEACON) {
                rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
                if (!rt2x00_get_field32(reg, CSR14_BEACON_GEN)) {
                        rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 1);
@@ -1060,7 +1060,7 @@ static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&reg, TXCSR0_KICK_TX,
                           (queue == IEEE80211_TX_QUEUE_DATA1));
        rt2x00_set_field32(&reg, TXCSR0_KICK_ATIM,
-                          (queue == IEEE80211_TX_QUEUE_AFTER_BEACON));
+                          (queue == RT2X00_BCN_QUEUE_ATIM));
        rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
 }
 
@@ -1165,7 +1165,7 @@ static irqreturn_t rt2400pci_interrupt(int irq, void *dev_instance)
         * 3 - Atim ring transmit done interrupt.
         */
        if (rt2x00_get_field32(reg, CSR7_TXDONE_ATIMRING))
-               rt2400pci_txdone(rt2x00dev, IEEE80211_TX_QUEUE_AFTER_BEACON);
+               rt2400pci_txdone(rt2x00dev, RT2X00_BCN_QUEUE_ATIM);
 
        /*
         * 4 - Priority ring transmit done interrupt.
@@ -1510,6 +1510,49 @@ static void rt2400pci_reset_tsf(struct ieee80211_hw *hw)
        rt2x00pci_register_write(rt2x00dev, CSR17, 0);
 }
 
+static int rt2400pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
+                                  struct ieee80211_tx_control *control)
+{
+       struct rt2x00_dev *rt2x00dev = hw->priv;
+       struct rt2x00_intf *intf = vif_to_intf(control->vif);
+       struct queue_entry_priv_pci_tx *priv_tx;
+       struct skb_frame_desc *skbdesc;
+
+       if (unlikely(!intf->beacon))
+               return -ENOBUFS;
+
+       priv_tx = intf->beacon->priv_data;
+
+       /*
+        * Fill in skb descriptor
+        */
+       skbdesc = get_skb_frame_desc(skb);
+       memset(skbdesc, 0, sizeof(*skbdesc));
+       skbdesc->data = skb->data;
+       skbdesc->data_len = skb->len;
+       skbdesc->desc = priv_tx->desc;
+       skbdesc->desc_len = intf->beacon->queue->desc_size;
+       skbdesc->entry = intf->beacon;
+
+       /*
+        * mac80211 doesn't provide the control->queue variable
+        * for beacons. Set our own queue identification so
+        * it can be used during descriptor initialization.
+        */
+       control->queue = RT2X00_BCN_QUEUE_BEACON;
+       rt2x00lib_write_tx_desc(rt2x00dev, skb, control);
+
+       /*
+        * Enable beacon generation.
+        * Write entire beacon with descriptor to register,
+        * and kick the beacon generator.
+        */
+       memcpy(priv_tx->data, skb->data, skb->len);
+       rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, control->queue);
+
+       return 0;
+}
+
 static int rt2400pci_tx_last_beacon(struct ieee80211_hw *hw)
 {
        struct rt2x00_dev *rt2x00dev = hw->priv;
@@ -1535,7 +1578,7 @@ static const struct ieee80211_ops rt2400pci_mac80211_ops = {
        .get_tx_stats           = rt2x00mac_get_tx_stats,
        .get_tsf                = rt2400pci_get_tsf,
        .reset_tsf              = rt2400pci_reset_tsf,
-       .beacon_update          = rt2x00pci_beacon_update,
+       .beacon_update          = rt2400pci_beacon_update,
        .tx_last_beacon         = rt2400pci_tx_last_beacon,
 };
 
index 6a558bf74f11e835cabf33c97ea4b81c70f15bae..36c64f751b1d25cc225a17d11c4e85ca892a70b4 100644 (file)
@@ -252,7 +252,7 @@ static void rt2500pci_config_intf(struct rt2x00_dev *rt2x00dev,
                                  const unsigned int flags)
 {
        struct data_queue *queue =
-           rt2x00queue_get_queue(rt2x00dev, IEEE80211_TX_QUEUE_BEACON);
+           rt2x00queue_get_queue(rt2x00dev, RT2X00_BCN_QUEUE_BEACON);
        unsigned int bcn_preload;
        u32 reg;
 
@@ -1195,11 +1195,11 @@ static void rt2500pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
  * TX data initialization
  */
 static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
-                                   unsigned int queue)
+                                   const unsigned int queue)
 {
        u32 reg;
 
-       if (queue == IEEE80211_TX_QUEUE_BEACON) {
+       if (queue == RT2X00_BCN_QUEUE_BEACON) {
                rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
                if (!rt2x00_get_field32(reg, CSR14_BEACON_GEN)) {
                        rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 1);
@@ -1214,7 +1214,7 @@ static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&reg, TXCSR0_KICK_TX,
                           (queue == IEEE80211_TX_QUEUE_DATA1));
        rt2x00_set_field32(&reg, TXCSR0_KICK_ATIM,
-                          (queue == IEEE80211_TX_QUEUE_AFTER_BEACON));
+                          (queue == RT2X00_BCN_QUEUE_ATIM));
        rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
 }
 
@@ -1316,7 +1316,7 @@ static irqreturn_t rt2500pci_interrupt(int irq, void *dev_instance)
         * 3 - Atim ring transmit done interrupt.
         */
        if (rt2x00_get_field32(reg, CSR7_TXDONE_ATIMRING))
-               rt2500pci_txdone(rt2x00dev, IEEE80211_TX_QUEUE_AFTER_BEACON);
+               rt2500pci_txdone(rt2x00dev, RT2X00_BCN_QUEUE_ATIM);
 
        /*
         * 4 - Priority ring transmit done interrupt.
@@ -1822,6 +1822,49 @@ static void rt2500pci_reset_tsf(struct ieee80211_hw *hw)
        rt2x00pci_register_write(rt2x00dev, CSR17, 0);
 }
 
+static int rt2500pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
+                                  struct ieee80211_tx_control *control)
+{
+       struct rt2x00_dev *rt2x00dev = hw->priv;
+       struct rt2x00_intf *intf = vif_to_intf(control->vif);
+       struct queue_entry_priv_pci_tx *priv_tx;
+       struct skb_frame_desc *skbdesc;
+
+       if (unlikely(!intf->beacon))
+               return -ENOBUFS;
+
+       priv_tx = intf->beacon->priv_data;
+
+       /*
+        * Fill in skb descriptor
+        */
+       skbdesc = get_skb_frame_desc(skb);
+       memset(skbdesc, 0, sizeof(*skbdesc));
+       skbdesc->data = skb->data;
+       skbdesc->data_len = skb->len;
+       skbdesc->desc = priv_tx->desc;
+       skbdesc->desc_len = intf->beacon->queue->desc_size;
+       skbdesc->entry = intf->beacon;
+
+       /*
+        * mac80211 doesn't provide the control->queue variable
+        * for beacons. Set our own queue identification so
+        * it can be used during descriptor initialization.
+        */
+       control->queue = RT2X00_BCN_QUEUE_BEACON;
+       rt2x00lib_write_tx_desc(rt2x00dev, skb, control);
+
+       /*
+        * Enable beacon generation.
+        * Write entire beacon with descriptor to register,
+        * and kick the beacon generator.
+        */
+       memcpy(priv_tx->data, skb->data, skb->len);
+       rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, control->queue);
+
+       return 0;
+}
+
 static int rt2500pci_tx_last_beacon(struct ieee80211_hw *hw)
 {
        struct rt2x00_dev *rt2x00dev = hw->priv;
@@ -1847,7 +1890,7 @@ static const struct ieee80211_ops rt2500pci_mac80211_ops = {
        .get_tx_stats           = rt2x00mac_get_tx_stats,
        .get_tsf                = rt2500pci_get_tsf,
        .reset_tsf              = rt2500pci_reset_tsf,
-       .beacon_update          = rt2x00pci_beacon_update,
+       .beacon_update          = rt2500pci_beacon_update,
        .tx_last_beacon         = rt2500pci_tx_last_beacon,
 };
 
index 31258ee24ee3457a8908259c5669067ebe0f5303..38c968ee50f1d9230c9a9a8816238828af46b881 100644 (file)
@@ -1100,11 +1100,11 @@ static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev,
  * TX data initialization
  */
 static void rt2500usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
-                                   unsigned int queue)
+                                   const unsigned int queue)
 {
        u16 reg;
 
-       if (queue != IEEE80211_TX_QUEUE_BEACON)
+       if (queue != RT2X00_BCN_QUEUE_BEACON)
                return;
 
        rt2500usb_register_read(rt2x00dev, TXRX_CSR19, &reg);
@@ -1758,11 +1758,11 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw,
        skbdesc->entry = intf->beacon;
 
        /*
-        * Just in case mac80211 doesn't set this correctly,
-        * but we need this queue set for the descriptor
-        * initialization.
+        * mac80211 doesn't provide the control->queue variable
+        * for beacons. Set our own queue identification so
+        * it can be used during descriptor initialization.
         */
-       control->queue = IEEE80211_TX_QUEUE_BEACON;
+       control->queue = RT2X00_BCN_QUEUE_BEACON;
        rt2x00lib_write_tx_desc(rt2x00dev, skb, control);
 
        /*
index 2363ca4903cc4e37d110cd3547b3a3ae2f524a93..b0e4ea7c9dca64234da64d4410443602ffc121c5 100644 (file)
@@ -526,7 +526,7 @@ struct rt2x00lib_ops {
        int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev,
                                struct sk_buff *skb);
        void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev,
-                              unsigned int queue);
+                              const unsigned int queue);
 
        /*
         * RX control handlers
@@ -906,10 +906,11 @@ static inline u16 get_duration_res(const unsigned int size, const u8 rate)
 /**
  * rt2x00queue_get_queue - Convert mac80211 queue index to rt2x00 queue
  * @rt2x00dev: Pointer to &struct rt2x00_dev.
- * @queue: mac80211 queue index (see &enum ieee80211_tx_queue).
+ * @queue: mac80211/rt2x00 queue index
+ *     (see &enum ieee80211_tx_queue and &enum rt2x00_bcn_queue).
  */
 struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev,
-                                        const enum ieee80211_tx_queue queue);
+                                        const unsigned int queue);
 
 /**
  * rt2x00queue_get_entry - Get queue entry where the given index points to.
index 1bc8c14e6aec9efd17045333806baf0b64460991..0df8062b1a8ec164024b86dc9c3759e867168a8c 100644 (file)
@@ -679,7 +679,7 @@ void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev,
         * Beacons and probe responses require the tsf timestamp
         * to be inserted into the frame.
         */
-       if (control->queue == IEEE80211_TX_QUEUE_BEACON ||
+       if (control->queue == RT2X00_BCN_QUEUE_BEACON ||
            is_probe_resp(frame_control))
                __set_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc.flags);
 
index 65a2bcd18aa19a9d096b87904a82dfe5e67122ca..8c24d3b36d289785487c760965a18ea472ae9e26 100644 (file)
@@ -164,7 +164,7 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
        struct rt2x00_dev *rt2x00dev = hw->priv;
        struct rt2x00_intf *intf = vif_to_intf(conf->vif);
        struct data_queue *queue =
-           rt2x00queue_get_queue(rt2x00dev, IEEE80211_TX_QUEUE_BEACON);
+           rt2x00queue_get_queue(rt2x00dev, RT2X00_BCN_QUEUE_BEACON);
        struct queue_entry *entry = NULL;
        unsigned int i;
 
index 764147dd5aea44f21ac832fbcb2729855a327728..275c8a1e6638d0ee493299120f25d35c33defd77 100644 (file)
 #include "rt2x00.h"
 #include "rt2x00pci.h"
 
-/*
- * Beacon handlers.
- */
-int rt2x00pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
-                           struct ieee80211_tx_control *control)
-{
-       struct rt2x00_dev *rt2x00dev = hw->priv;
-       struct rt2x00_intf *intf = vif_to_intf(control->vif);
-       struct queue_entry_priv_pci_tx *priv_tx;
-       struct skb_frame_desc *skbdesc;
-
-       if (unlikely(!intf->beacon))
-               return -ENOBUFS;
-
-       priv_tx = intf->beacon->priv_data;
-
-       /*
-        * Fill in skb descriptor
-        */
-       skbdesc = get_skb_frame_desc(skb);
-       memset(skbdesc, 0, sizeof(*skbdesc));
-       skbdesc->data = skb->data;
-       skbdesc->data_len = skb->len;
-       skbdesc->desc = priv_tx->desc;
-       skbdesc->desc_len = intf->beacon->queue->desc_size;
-       skbdesc->entry = intf->beacon;
-
-       /*
-        * Just in case mac80211 doesn't set this correctly,
-        * but we need this queue set for the descriptor
-        * initialization.
-        */
-       control->queue = IEEE80211_TX_QUEUE_BEACON;
-       rt2x00lib_write_tx_desc(rt2x00dev, skb, control);
-
-       /*
-        * Enable beacon generation.
-        * Write entire beacon with descriptor to register,
-        * and kick the beacon generator.
-        */
-       memcpy(priv_tx->data, skb->data, skb->len);
-       rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, control->queue);
-
-       return 0;
-}
-EXPORT_SYMBOL_GPL(rt2x00pci_beacon_update);
-
 /*
  * TX data handlers.
  */
index 3b1597ffb4f215a1f3a22ee35d464dc9c7db566e..71335e16b05892fd5167bc2854a162a1e29e4be5 100644 (file)
@@ -87,12 +87,6 @@ rt2x00pci_register_multiwrite(struct rt2x00_dev *rt2x00dev,
        memcpy_toio(rt2x00dev->csr_addr + offset, value, length);
 }
 
-/*
- * Beacon handlers.
- */
-int rt2x00pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
-                           struct ieee80211_tx_control *control);
-
 /*
  * TX data handlers.
  */
index 921eca35719d2d2a6ad8d3f861971f42c05239be..52bb57ddc05f0d792bf958fa797717fc6c4d0ed7 100644 (file)
@@ -30,7 +30,7 @@
 #include "rt2x00lib.h"
 
 struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev,
-                                        const enum ieee80211_tx_queue queue)
+                                        const unsigned int queue)
 {
        int atim = test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags);
 
@@ -40,9 +40,9 @@ struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev,
        if (!rt2x00dev->bcn)
                return NULL;
 
-       if (queue == IEEE80211_TX_QUEUE_BEACON)
+       if (queue == RT2X00_BCN_QUEUE_BEACON)
                return &rt2x00dev->bcn[0];
-       else if (queue == IEEE80211_TX_QUEUE_AFTER_BEACON && atim)
+       else if (queue == RT2X00_BCN_QUEUE_ATIM && atim)
                return &rt2x00dev->bcn[1];
 
        return NULL;
index 75af48eddc2562ce56d1c42ae184dae2c89ba739..956e0be8aadd6d716998d85a55cd1b3c2f7c33f6 100644 (file)
@@ -66,6 +66,21 @@ enum data_queue_qid {
        QID_OTHER = 15,
 };
 
+/**
+ * enum rt2x00_bcn_queue: Beacon queue index
+ *
+ * Start counting with a high offset, this because this enumeration
+ * supplements &enum ieee80211_tx_queue and we should prevent value
+ * conflicts.
+ *
+ * @RT2X00_BCN_QUEUE_BEACON: Beacon queue
+ * @RT2X00_BCN_QUEUE_ATIM: Atim queue (sends frame after beacon)
+ */
+enum rt2x00_bcn_queue {
+       RT2X00_BCN_QUEUE_BEACON = 100,
+       RT2X00_BCN_QUEUE_ATIM = 101,
+};
+
 /**
  * struct skb_frame_desc: Descriptor information for the skb buffer
  *
index 534e1647b7cf160b4b8146074df40968e009b581..59e87a1d96a43e9844f79d452bea4353dd7b6674 100644 (file)
@@ -1582,11 +1582,11 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
  * TX data initialization
  */
 static void rt61pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
-                                 unsigned int queue)
+                                 const unsigned int queue)
 {
        u32 reg;
 
-       if (queue == IEEE80211_TX_QUEUE_BEACON) {
+       if (queue == RT2X00_BCN_QUEUE_BEACON) {
                /*
                 * For Wi-Fi faily generated beacons between participating
                 * stations. Set TBTT phase adaptive adjustment step to 8us.
@@ -2431,11 +2431,11 @@ static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
        skbdesc->entry = intf->beacon;
 
        /*
-        * Just in case the ieee80211 doesn't set this,
-        * but we need this queue set for the descriptor
-        * initialization.
+        * mac80211 doesn't provide the control->queue variable
+        * for beacons. Set our own queue identification so
+        * it can be used during descriptor initialization.
         */
-       control->queue = IEEE80211_TX_QUEUE_BEACON;
+       control->queue = RT2X00_BCN_QUEUE_BEACON;
        rt2x00lib_write_tx_desc(rt2x00dev, skb, control);
 
        /*
index b519a4bfc2127f1cad9311feab9504abfc912f7a..4b5bde8b53de085626a20ffa49756f0c670fc6a2 100644 (file)
@@ -1326,11 +1326,11 @@ static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev,
  * TX data initialization
  */
 static void rt73usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
-                                 unsigned int queue)
+                                 const unsigned int queue)
 {
        u32 reg;
 
-       if (queue != IEEE80211_TX_QUEUE_BEACON)
+       if (queue != RT2X00_BCN_QUEUE_BEACON)
                return;
 
        /*
@@ -2031,11 +2031,11 @@ static int rt73usb_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
        skbdesc->entry = intf->beacon;
 
        /*
-        * Just in case the ieee80211 doesn't set this,
-        * but we need this queue set for the descriptor
-        * initialization.
+        * mac80211 doesn't provide the control->queue variable
+        * for beacons. Set our own queue identification so
+        * it can be used during descriptor initialization.
         */
-       control->queue = IEEE80211_TX_QUEUE_BEACON;
+       control->queue = RT2X00_BCN_QUEUE_BEACON;
        rt2x00lib_write_tx_desc(rt2x00dev, skb, control);
 
        /*