rt2x00: Reorganize queue callback functions
authorIvo van Doorn <ivdoorn@gmail.com>
Mon, 13 Dec 2010 11:34:54 +0000 (12:34 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 13 Dec 2010 20:23:35 +0000 (15:23 -0500)
As part of the queue refactoring, change the queue callback
function names to have 3 different actions: start, kick & stop.

We can now also remove the STATE_RADIO_RX_ON/STATE_RADIO_RX_OFF
device_state flags, and replace the usage with using the
start_queue/stop_queue callback functions.
This streamlines the RX queue handling to the
similar approach as all other queues.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 files changed:
drivers/net/wireless/rt2x00/rt2400pci.c
drivers/net/wireless/rt2x00/rt2500pci.c
drivers/net/wireless/rt2x00/rt2500usb.c
drivers/net/wireless/rt2x00/rt2800pci.c
drivers/net/wireless/rt2x00/rt2800usb.c
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00config.c
drivers/net/wireless/rt2x00/rt2x00dev.c
drivers/net/wireless/rt2x00/rt2x00mac.c
drivers/net/wireless/rt2x00/rt2x00queue.c
drivers/net/wireless/rt2x00/rt2x00reg.h
drivers/net/wireless/rt2x00/rt2x00usb.c
drivers/net/wireless/rt2x00/rt2x00usb.h
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c

index 35d9a06a76afe551f0f999a96f0e76792446bdc9..2fc6ca5e0968b18b5233fdcdd9e5da5ae81ba8ab 100644 (file)
@@ -1058,12 +1058,6 @@ static int rt2400pci_set_device_state(struct rt2x00_dev *rt2x00dev,
        case STATE_RADIO_OFF:
                rt2400pci_disable_radio(rt2x00dev);
                break;
-       case STATE_RADIO_RX_ON:
-               rt2400pci_start_queue(rt2x00dev->rx);
-               break;
-       case STATE_RADIO_RX_OFF:
-               rt2400pci_stop_queue(rt2x00dev->rx);
-               break;
        case STATE_RADIO_IRQ_ON:
        case STATE_RADIO_IRQ_ON_ISR:
        case STATE_RADIO_IRQ_OFF:
@@ -1672,10 +1666,11 @@ static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = {
        .link_stats             = rt2400pci_link_stats,
        .reset_tuner            = rt2400pci_reset_tuner,
        .link_tuner             = rt2400pci_link_tuner,
+       .start_queue            = rt2400pci_start_queue,
+       .kick_queue             = rt2400pci_kick_queue,
+       .stop_queue             = rt2400pci_stop_queue,
        .write_tx_desc          = rt2400pci_write_tx_desc,
        .write_beacon           = rt2400pci_write_beacon,
-       .kick_tx_queue          = rt2400pci_kick_queue,
-       .kill_tx_queue          = rt2400pci_stop_queue,
        .fill_rxdone            = rt2400pci_fill_rxdone,
        .config_filter          = rt2400pci_config_filter,
        .config_intf            = rt2400pci_config_intf,
index bee7ce14028dea5c54bc92ffceeec91c6a65c5ee..d67f91192338466bdf791fa2e60ac167a8827c8b 100644 (file)
@@ -1213,12 +1213,6 @@ static int rt2500pci_set_device_state(struct rt2x00_dev *rt2x00dev,
        case STATE_RADIO_OFF:
                rt2500pci_disable_radio(rt2x00dev);
                break;
-       case STATE_RADIO_RX_ON:
-               rt2500pci_start_queue(rt2x00dev->rx);
-               break;
-       case STATE_RADIO_RX_OFF:
-               rt2500pci_stop_queue(rt2x00dev->rx);
-               break;
        case STATE_RADIO_IRQ_ON:
        case STATE_RADIO_IRQ_ON_ISR:
        case STATE_RADIO_IRQ_OFF:
@@ -1969,10 +1963,11 @@ static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = {
        .link_stats             = rt2500pci_link_stats,
        .reset_tuner            = rt2500pci_reset_tuner,
        .link_tuner             = rt2500pci_link_tuner,
+       .start_queue            = rt2500pci_start_queue,
+       .kick_queue             = rt2500pci_kick_queue,
+       .stop_queue             = rt2500pci_stop_queue,
        .write_tx_desc          = rt2500pci_write_tx_desc,
        .write_beacon           = rt2500pci_write_beacon,
-       .kick_tx_queue          = rt2500pci_kick_queue,
-       .kill_tx_queue          = rt2500pci_stop_queue,
        .fill_rxdone            = rt2500pci_fill_rxdone,
        .config_filter          = rt2500pci_config_filter,
        .config_intf            = rt2500pci_config_intf,
index 52bd0ed0872b3c01d846f58a53c601acd1a6483f..a56b38f9bf29a3dad7402e690d9a70e911965372 100644 (file)
@@ -1057,12 +1057,6 @@ static int rt2500usb_set_device_state(struct rt2x00_dev *rt2x00dev,
        case STATE_RADIO_OFF:
                rt2500usb_disable_radio(rt2x00dev);
                break;
-       case STATE_RADIO_RX_ON:
-               rt2500usb_start_queue(rt2x00dev->rx);
-               break;
-       case STATE_RADIO_RX_OFF:
-               rt2500usb_stop_queue(rt2x00dev->rx);
-               break;
        case STATE_RADIO_IRQ_ON:
        case STATE_RADIO_IRQ_ON_ISR:
        case STATE_RADIO_IRQ_OFF:
@@ -1845,11 +1839,12 @@ static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = {
        .link_stats             = rt2500usb_link_stats,
        .reset_tuner            = rt2500usb_reset_tuner,
        .watchdog               = rt2x00usb_watchdog,
+       .start_queue            = rt2500usb_start_queue,
+       .kick_queue             = rt2x00usb_kick_queue,
+       .stop_queue             = rt2500usb_stop_queue,
        .write_tx_desc          = rt2500usb_write_tx_desc,
        .write_beacon           = rt2500usb_write_beacon,
        .get_tx_data_len        = rt2500usb_get_tx_data_len,
-       .kick_tx_queue          = rt2x00usb_kick_tx_queue,
-       .kill_tx_queue          = rt2500usb_stop_queue,
        .fill_rxdone            = rt2500usb_fill_rxdone,
        .config_shared_key      = rt2500usb_config_key,
        .config_pairwise_key    = rt2500usb_config_key,
index a7105974a2a16182120ccf0e330fbc82bd6980bf..15eef7212bb1fbf00e089bfddca72f796f5d52d2 100644 (file)
@@ -537,12 +537,6 @@ static int rt2800pci_set_device_state(struct rt2x00_dev *rt2x00dev,
                rt2800pci_disable_radio(rt2x00dev);
                rt2800pci_set_state(rt2x00dev, STATE_SLEEP);
                break;
-       case STATE_RADIO_RX_ON:
-               rt2800pci_start_queue(rt2x00dev->rx);
-               break;
-       case STATE_RADIO_RX_OFF:
-               rt2800pci_stop_queue(rt2x00dev->rx);
-               break;
        case STATE_RADIO_IRQ_ON:
        case STATE_RADIO_IRQ_ON_ISR:
        case STATE_RADIO_IRQ_OFF:
@@ -1004,11 +998,12 @@ static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = {
        .link_stats             = rt2800_link_stats,
        .reset_tuner            = rt2800_reset_tuner,
        .link_tuner             = rt2800_link_tuner,
+       .start_queue            = rt2800pci_start_queue,
+       .kick_queue             = rt2800pci_kick_queue,
+       .stop_queue             = rt2800pci_stop_queue,
        .write_tx_desc          = rt2800pci_write_tx_desc,
        .write_tx_data          = rt2800_write_tx_data,
        .write_beacon           = rt2800_write_beacon,
-       .kick_tx_queue          = rt2800pci_kick_queue,
-       .kill_tx_queue          = rt2800pci_stop_queue,
        .fill_rxdone            = rt2800pci_fill_rxdone,
        .config_shared_key      = rt2800_config_shared_key,
        .config_pairwise_key    = rt2800_config_pairwise_key,
index ee51936d8d1b10fbe11c326d83ee32dbb1261ca7..60b5503136888a9325e7396eebc75c6dabc6bdfc 100644 (file)
@@ -254,12 +254,6 @@ static int rt2800usb_set_device_state(struct rt2x00_dev *rt2x00dev,
                rt2800usb_disable_radio(rt2x00dev);
                rt2800usb_set_state(rt2x00dev, STATE_SLEEP);
                break;
-       case STATE_RADIO_RX_ON:
-               rt2800usb_start_queue(rt2x00dev->rx);
-               break;
-       case STATE_RADIO_RX_OFF:
-               rt2800usb_stop_queue(rt2x00dev->rx);
-               break;
        case STATE_RADIO_IRQ_ON:
        case STATE_RADIO_IRQ_ON_ISR:
        case STATE_RADIO_IRQ_OFF:
@@ -626,12 +620,13 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = {
        .reset_tuner            = rt2800_reset_tuner,
        .link_tuner             = rt2800_link_tuner,
        .watchdog               = rt2800usb_watchdog,
+       .start_queue            = rt2800usb_start_queue,
+       .kick_queue             = rt2x00usb_kick_queue,
+       .stop_queue             = rt2800usb_stop_queue,
        .write_tx_desc          = rt2800usb_write_tx_desc,
        .write_tx_data          = rt2800usb_write_tx_data,
        .write_beacon           = rt2800_write_beacon,
        .get_tx_data_len        = rt2800usb_get_tx_data_len,
-       .kick_tx_queue          = rt2x00usb_kick_tx_queue,
-       .kill_tx_queue          = rt2800usb_stop_queue,
        .fill_rxdone            = rt2800usb_fill_rxdone,
        .config_shared_key      = rt2800_config_shared_key,
        .config_pairwise_key    = rt2800_config_pairwise_key,
index e72117f3fdf59d2d6c9f134bc182854c9d2456db..b72f59ba4e1e616152cba9a79b4dc6ce8fb5e3f6 100644 (file)
@@ -567,7 +567,14 @@ struct rt2x00lib_ops {
                             struct link_qual *qual);
        void (*link_tuner) (struct rt2x00_dev *rt2x00dev,
                            struct link_qual *qual, const u32 count);
+
+       /*
+        * Data queue handlers.
+        */
        void (*watchdog) (struct rt2x00_dev *rt2x00dev);
+       void (*start_queue) (struct data_queue *queue);
+       void (*kick_queue) (struct data_queue *queue);
+       void (*stop_queue) (struct data_queue *queue);
 
        /*
         * TX control handlers
@@ -579,8 +586,6 @@ struct rt2x00lib_ops {
        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 data_queue *queue);
-       void (*kill_tx_queue) (struct data_queue *queue);
 
        /*
         * RX control handlers
index a238e908c85402ca51e5206d47bd005d94de5c7a..d2f1f0ad2bc854a3123bbb081f3c82186f8d9bd4 100644 (file)
@@ -146,8 +146,7 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
         * else the changes will be ignored by the device.
         */
        if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
-               rt2x00dev->ops->lib->set_device_state(rt2x00dev,
-                                                     STATE_RADIO_RX_OFF);
+               rt2x00dev->ops->lib->stop_queue(rt2x00dev->rx);
 
        /*
         * Write new antenna setup to device and reset the link tuner.
@@ -161,8 +160,7 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
        memcpy(active, &config, sizeof(config));
 
        if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
-               rt2x00dev->ops->lib->set_device_state(rt2x00dev,
-                                                     STATE_RADIO_RX_ON);
+               rt2x00dev->ops->lib->start_queue(rt2x00dev->rx);
 }
 
 void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
index bd3afc92f4343af8b006bf5597136ceafb6312fb..2c5f246408e8eda86f33ef28654e0414852ba383 100644 (file)
@@ -68,7 +68,7 @@ int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev)
        /*
         * Enable RX.
         */
-       rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_RX_ON);
+       rt2x00dev->ops->lib->start_queue(rt2x00dev->rx);
        rt2x00link_start_tuner(rt2x00dev);
 
        /*
@@ -104,7 +104,7 @@ void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev)
         * Disable RX.
         */
        rt2x00link_stop_tuner(rt2x00dev);
-       rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_RX_OFF);
+       rt2x00dev->ops->lib->stop_queue(rt2x00dev->rx);
 
        /*
         * Disable radio.
index 7ad4b276156ed1f49b51f1834d14f85098422806..6713f1ab128435e62e358076859ea08fccc36f2b 100644 (file)
@@ -352,7 +352,7 @@ int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed)
         * if for any reason the link tuner must be reset, this will be
         * handled by rt2x00lib_config().
         */
-       rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_RX_OFF);
+       rt2x00dev->ops->lib->stop_queue(rt2x00dev->rx);
 
        /*
         * When we've just turned on the radio, we want to reprogram
@@ -370,7 +370,7 @@ int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed)
        rt2x00lib_config_antenna(rt2x00dev, rt2x00dev->default_ant);
 
        /* Turn RX back on */
-       rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_RX_ON);
+       rt2x00dev->ops->lib->start_queue(rt2x00dev->rx);
 
        return 0;
 }
@@ -727,7 +727,7 @@ void rt2x00mac_flush(struct ieee80211_hw *hw, bool drop)
         * any pending frames to be transmitted.
         */
        tx_queue_for_each(rt2x00dev, queue) {
-               rt2x00dev->ops->lib->kick_tx_queue(queue);
+               rt2x00dev->ops->lib->kick_queue(queue);
        }
 
        /**
index 35133d8558b5af9c9de3c2b4872033a877f62ab4..2af6cea0d2da5472a18d7bcddce10ebd49bd1fea 100644 (file)
@@ -471,7 +471,7 @@ static void rt2x00queue_kick_tx_queue(struct data_queue *queue,
         */
        if (rt2x00queue_threshold(queue) ||
            !test_bit(ENTRY_TXD_BURST, &txdesc->flags))
-               queue->rt2x00dev->ops->lib->kick_tx_queue(queue);
+               queue->rt2x00dev->ops->lib->kick_queue(queue);
 }
 
 int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
@@ -585,7 +585,7 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
        rt2x00queue_free_skb(intf->beacon);
 
        if (!enable_beacon) {
-               rt2x00dev->ops->lib->kill_tx_queue(intf->beacon->queue);
+               rt2x00dev->ops->lib->stop_queue(intf->beacon->queue);
                mutex_unlock(&intf->beacon_skb_mutex);
                return 0;
        }
@@ -761,7 +761,7 @@ void rt2x00queue_stop_queues(struct rt2x00_dev *rt2x00dev)
        struct data_queue *queue;
 
        txall_queue_for_each(rt2x00dev, queue)
-               rt2x00dev->ops->lib->kill_tx_queue(queue);
+               rt2x00dev->ops->lib->stop_queue(queue);
 }
 
 void rt2x00queue_init_queues(struct rt2x00_dev *rt2x00dev)
index ed71be95136d619019346d8bcea318372369a063..e8259ae48ced96504e1157dfa08c0dd94772d82b 100644 (file)
@@ -83,8 +83,6 @@ enum dev_state {
  */
        STATE_RADIO_ON,
        STATE_RADIO_OFF,
-       STATE_RADIO_RX_ON,
-       STATE_RADIO_RX_OFF,
        STATE_RADIO_IRQ_ON,
        STATE_RADIO_IRQ_OFF,
        STATE_RADIO_IRQ_ON_ISR,
index 12958a45e450ac5355840d1979a8376e8819bd37..d4361dc0773e6536f4e24b19753da463a2f1f0b1 100644 (file)
@@ -261,12 +261,22 @@ static void rt2x00usb_kick_tx_entry(struct queue_entry *entry)
        }
 }
 
-void rt2x00usb_kick_tx_queue(struct data_queue *queue)
+void rt2x00usb_kick_queue(struct data_queue *queue)
 {
-       rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX,
-                                  rt2x00usb_kick_tx_entry);
+       switch (queue->qid) {
+       case QID_AC_BE:
+       case QID_AC_BK:
+       case QID_AC_VI:
+       case QID_AC_VO:
+               if (!rt2x00queue_empty(queue))
+                       rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX,
+                                                  rt2x00usb_kick_tx_entry);
+               break;
+       default:
+               break;
+       }
 }
-EXPORT_SYMBOL_GPL(rt2x00usb_kick_tx_queue);
+EXPORT_SYMBOL_GPL(rt2x00usb_kick_queue);
 
 static void rt2x00usb_kill_entry(struct queue_entry *entry)
 {
@@ -422,11 +432,7 @@ void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev)
        rt2x00usb_vendor_request_sw(rt2x00dev, USB_RX_CONTROL, 0, 0,
                                    REGISTER_TIMEOUT);
 
-       /*
-        * The USB version of also works
-        * on the RX queue.
-        */
-       rt2x00dev->ops->lib->kill_tx_queue(rt2x00dev->rx);
+       rt2x00dev->ops->lib->stop_queue(rt2x00dev->rx);
 }
 EXPORT_SYMBOL_GPL(rt2x00usb_disable_radio);
 
index 656a35f421a34d55ba39559ad5e81080ee221cb6..05a5424d9b76b99afe53bc53219d285a4d44775c 100644 (file)
@@ -378,13 +378,13 @@ struct queue_entry_priv_usb_bcn {
 };
 
 /**
- * rt2x00usb_kick_tx_queue - Kick data queue
+ * rt2x00usb_kick_queue - Kick data queue
  * @queue: Data queue to kick
  *
  * This will walk through all entries of the queue and push all pending
  * frames to the hardware as a single burst.
  */
-void rt2x00usb_kick_tx_queue(struct data_queue *queue);
+void rt2x00usb_kick_queue(struct data_queue *queue);
 
 /**
  * rt2x00usb_stop_queue - Stop data queue
index 044f500ff1ab3b83a2d02992c4ce38e8824f1096..7156b78812332017765ffae2339534c4252bf003 100644 (file)
@@ -1832,12 +1832,6 @@ static int rt61pci_set_device_state(struct rt2x00_dev *rt2x00dev,
        case STATE_RADIO_OFF:
                rt61pci_disable_radio(rt2x00dev);
                break;
-       case STATE_RADIO_RX_ON:
-               rt61pci_start_queue(rt2x00dev->rx);
-               break;
-       case STATE_RADIO_RX_OFF:
-               rt61pci_stop_queue(rt2x00dev->rx);
-               break;
        case STATE_RADIO_IRQ_ON:
        case STATE_RADIO_IRQ_ON_ISR:
        case STATE_RADIO_IRQ_OFF:
@@ -2900,10 +2894,11 @@ static const struct rt2x00lib_ops rt61pci_rt2x00_ops = {
        .link_stats             = rt61pci_link_stats,
        .reset_tuner            = rt61pci_reset_tuner,
        .link_tuner             = rt61pci_link_tuner,
+       .start_queue            = rt61pci_start_queue,
+       .kick_queue             = rt61pci_kick_queue,
+       .stop_queue             = rt61pci_stop_queue,
        .write_tx_desc          = rt61pci_write_tx_desc,
        .write_beacon           = rt61pci_write_beacon,
-       .kick_tx_queue          = rt61pci_kick_queue,
-       .kill_tx_queue          = rt61pci_stop_queue,
        .fill_rxdone            = rt61pci_fill_rxdone,
        .config_shared_key      = rt61pci_config_shared_key,
        .config_pairwise_key    = rt61pci_config_pairwise_key,
index e9b1e3d5f47ce02b4e8717c09000fc9e8197dc6c..f55e74ef02e04155275c5c90fb141734aaefa9b8 100644 (file)
@@ -1441,12 +1441,6 @@ static int rt73usb_set_device_state(struct rt2x00_dev *rt2x00dev,
        case STATE_RADIO_OFF:
                rt73usb_disable_radio(rt2x00dev);
                break;
-       case STATE_RADIO_RX_ON:
-               rt73usb_start_queue(rt2x00dev->rx);
-               break;
-       case STATE_RADIO_RX_OFF:
-               rt73usb_stop_queue(rt2x00dev->rx);
-               break;
        case STATE_RADIO_IRQ_ON:
        case STATE_RADIO_IRQ_ON_ISR:
        case STATE_RADIO_IRQ_OFF:
@@ -2312,11 +2306,12 @@ static const struct rt2x00lib_ops rt73usb_rt2x00_ops = {
        .reset_tuner            = rt73usb_reset_tuner,
        .link_tuner             = rt73usb_link_tuner,
        .watchdog               = rt2x00usb_watchdog,
+       .start_queue            = rt73usb_start_queue,
+       .kick_queue             = rt2x00usb_kick_queue,
+       .stop_queue             = rt73usb_stop_queue,
        .write_tx_desc          = rt73usb_write_tx_desc,
        .write_beacon           = rt73usb_write_beacon,
        .get_tx_data_len        = rt73usb_get_tx_data_len,
-       .kick_tx_queue          = rt2x00usb_kick_tx_queue,
-       .kill_tx_queue          = rt73usb_stop_queue,
        .fill_rxdone            = rt73usb_fill_rxdone,
        .config_shared_key      = rt73usb_config_shared_key,
        .config_pairwise_key    = rt73usb_config_pairwise_key,