]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mac80211: clean up get_tx_stats callback
authorJohannes Berg <johannes@sipsolutions.net>
Tue, 29 Apr 2008 15:18:59 +0000 (17:18 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 7 May 2008 19:02:26 +0000 (15:02 -0400)
The callback takes a ieee80211_tx_queue_stats with a contained
array of ieee80211_tx_queue_stats_data, remove the former, rename
the latter to ieee80211_tx_queue_stats and make tx_stats() take
the array directly.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 files changed:
drivers/net/wireless/adm8211.c
drivers/net/wireless/ath5k/base.c
drivers/net/wireless/ath5k/base.h
drivers/net/wireless/b43/dma.c
drivers/net/wireless/b43/pio.c
drivers/net/wireless/b43legacy/dma.c
drivers/net/wireless/b43legacy/pio.c
drivers/net/wireless/iwlwifi/iwl3945-base.c
drivers/net/wireless/iwlwifi/iwl4965-base.c
drivers/net/wireless/p54/p54.h
drivers/net/wireless/p54/p54common.c
drivers/net/wireless/rt2x00/rt2x00mac.c
include/net/mac80211.h

index 5c0d2b082750d550d7025b3e6716179ea6ea274a..d93a1de77eb08afc95d1ffc26a5d3e722b567241 100644 (file)
@@ -306,11 +306,10 @@ static int adm8211_get_tx_stats(struct ieee80211_hw *dev,
                                struct ieee80211_tx_queue_stats *stats)
 {
        struct adm8211_priv *priv = dev->priv;
-       struct ieee80211_tx_queue_stats_data *data = &stats->data[0];
 
-       data->len = priv->cur_tx - priv->dirty_tx;
-       data->limit = priv->tx_ring_size - 2;
-       data->count = priv->dirty_tx;
+       stats[0].len = priv->cur_tx - priv->dirty_tx;
+       stats[0].limit = priv->tx_ring_size - 2;
+       stats[0].count = priv->dirty_tx;
 
        return 0;
 }
index 3854619f3514889c7ac3e23ea501deff74516442..3201c16043401fc741a47e1e477cbaaa8835e159 100644 (file)
@@ -1335,7 +1335,7 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
 
        spin_lock_bh(&txq->lock);
        list_add_tail(&bf->list, &txq->q);
-       sc->tx_stats.data[txq->qnum].len++;
+       sc->tx_stats[txq->qnum].len++;
        if (txq->link == NULL) /* is this first packet? */
                ath5k_hw_put_tx_buf(ah, txq->qnum, bf->daddr);
        else /* no, so only link it */
@@ -1566,7 +1566,7 @@ ath5k_txq_drainq(struct ath5k_softc *sc, struct ath5k_txq *txq)
                ath5k_txbuf_free(sc, bf);
 
                spin_lock_bh(&sc->txbuflock);
-               sc->tx_stats.data[txq->qnum].len--;
+               sc->tx_stats[txq->qnum].len--;
                list_move_tail(&bf->list, &sc->txbuf);
                sc->txbuf_len++;
                spin_unlock_bh(&sc->txbuflock);
@@ -1979,10 +1979,10 @@ ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq)
                }
 
                ieee80211_tx_status(sc->hw, skb, &txs);
-               sc->tx_stats.data[txq->qnum].count++;
+               sc->tx_stats[txq->qnum].count++;
 
                spin_lock(&sc->txbuflock);
-               sc->tx_stats.data[txq->qnum].len--;
+               sc->tx_stats[txq->qnum].len--;
                list_move_tail(&bf->list, &sc->txbuf);
                sc->txbuf_len++;
                spin_unlock(&sc->txbuflock);
index 3a97558930188302bdd00f61df9b6fe2bb29da28..ecb17495488cebfed16cec8e5c512f3aa181b813 100644 (file)
@@ -92,7 +92,8 @@ struct ath5k_softc {
        struct pci_dev          *pdev;          /* for dma mapping */
        void __iomem            *iobase;        /* address of the device */
        struct mutex            lock;           /* dev-level lock */
-       struct ieee80211_tx_queue_stats tx_stats;
+       /* FIXME: how many does it really need? */
+       struct ieee80211_tx_queue_stats tx_stats[16];
        struct ieee80211_low_level_stats ll_stats;
        struct ieee80211_hw     *hw;            /* IEEE 802.11 common */
        struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
index 6dcbb3c87e7207a01cf64f2269f3cea1438cfe04..f50e2014ffbe9b29ca03961e9c6b9c775127bf3c 100644 (file)
@@ -1427,18 +1427,16 @@ void b43_dma_get_tx_stats(struct b43_wldev *dev,
 {
        const int nr_queues = dev->wl->hw->queues;
        struct b43_dmaring *ring;
-       struct ieee80211_tx_queue_stats_data *data;
        unsigned long flags;
        int i;
 
        for (i = 0; i < nr_queues; i++) {
-               data = &(stats->data[i]);
                ring = select_ring_by_priority(dev, i);
 
                spin_lock_irqsave(&ring->lock, flags);
-               data->len = ring->used_slots / SLOTS_PER_PACKET;
-               data->limit = ring->nr_slots / SLOTS_PER_PACKET;
-               data->count = ring->nr_tx_packets;
+               stats[i].len = ring->used_slots / SLOTS_PER_PACKET;
+               stats[i].limit = ring->nr_slots / SLOTS_PER_PACKET;
+               stats[i].count = ring->nr_tx_packets;
                spin_unlock_irqrestore(&ring->lock, flags);
        }
 }
index fcacafb043467559768582090a7c7586b51b1e06..08c8a087f30e5f1c1cc0abe32e803cb7cb630b9a 100644 (file)
@@ -611,18 +611,16 @@ void b43_pio_get_tx_stats(struct b43_wldev *dev,
 {
        const int nr_queues = dev->wl->hw->queues;
        struct b43_pio_txqueue *q;
-       struct ieee80211_tx_queue_stats_data *data;
        unsigned long flags;
        int i;
 
        for (i = 0; i < nr_queues; i++) {
-               data = &(stats->data[i]);
                q = select_queue_by_priority(dev, i);
 
                spin_lock_irqsave(&q->lock, flags);
-               data->len = B43_PIO_MAX_NR_TXPACKETS - q->free_packet_slots;
-               data->limit = B43_PIO_MAX_NR_TXPACKETS;
-               data->count = q->nr_tx_packets;
+               stats[i].len = B43_PIO_MAX_NR_TXPACKETS - q->free_packet_slots;
+               stats[i].limit = B43_PIO_MAX_NR_TXPACKETS;
+               stats[i].count = q->nr_tx_packets;
                spin_unlock_irqrestore(&q->lock, flags);
        }
 }
index c990f87b107acff6603a24a70b8f402144f64d9c..d6686f713b6d5582d63205487e0818e40b21da50 100644 (file)
@@ -1455,18 +1455,16 @@ void b43legacy_dma_get_tx_stats(struct b43legacy_wldev *dev,
 {
        const int nr_queues = dev->wl->hw->queues;
        struct b43legacy_dmaring *ring;
-       struct ieee80211_tx_queue_stats_data *data;
        unsigned long flags;
        int i;
 
        for (i = 0; i < nr_queues; i++) {
-               data = &(stats->data[i]);
                ring = priority_to_txring(dev, i);
 
                spin_lock_irqsave(&ring->lock, flags);
-               data->len = ring->used_slots / SLOTS_PER_PACKET;
-               data->limit = ring->nr_slots / SLOTS_PER_PACKET;
-               data->count = ring->nr_tx_packets;
+               stats[i].len = ring->used_slots / SLOTS_PER_PACKET;
+               stats[i].limit = ring->nr_slots / SLOTS_PER_PACKET;
+               stats[i].count = ring->nr_tx_packets;
                spin_unlock_irqrestore(&ring->lock, flags);
        }
 }
index bcdd54eb2edb52683804712201f8ee78260c853b..8d3d27d3cd67ea93914c5ce7fc5183ea6c766a8d 100644 (file)
@@ -525,13 +525,11 @@ void b43legacy_pio_get_tx_stats(struct b43legacy_wldev *dev,
 {
        struct b43legacy_pio *pio = &dev->pio;
        struct b43legacy_pioqueue *queue;
-       struct ieee80211_tx_queue_stats_data *data;
 
        queue = pio->queue1;
-       data = &(stats->data[0]);
-       data->len = B43legacy_PIO_MAXTXPACKETS - queue->nr_txfree;
-       data->limit = B43legacy_PIO_MAXTXPACKETS;
-       data->count = queue->nr_tx_packets;
+       stats[0].len = B43legacy_PIO_MAXTXPACKETS - queue->nr_txfree;
+       stats[0].limit = B43legacy_PIO_MAXTXPACKETS;
+       stats[0].count = queue->nr_tx_packets;
 }
 
 static void pio_rx_error(struct b43legacy_pioqueue *queue,
index 67fd267c99cab567fa3f261d450ce954c0afe114..bad367cfbee3d859d5e6b82d7e74af004c0ba1b2 100644 (file)
@@ -7217,9 +7217,9 @@ static int iwl3945_mac_get_tx_stats(struct ieee80211_hw *hw,
                q = &txq->q;
                avail = iwl3945_queue_space(q);
 
-               stats->data[i].len = q->n_window - avail;
-               stats->data[i].limit = q->n_window - q->high_mark;
-               stats->data[i].count = q->n_window;
+               stats[i].len = q->n_window - avail;
+               stats[i].limit = q->n_window - q->high_mark;
+               stats[i].count = q->n_window;
 
        }
        spin_unlock_irqrestore(&priv->lock, flags);
index f887a4e54ba2bd2190c53896547040693a5ca6a0..64cb905cdaedbd5f010f918bcc0ebcc5f1e60f4f 100644 (file)
@@ -6420,9 +6420,9 @@ static int iwl4965_mac_get_tx_stats(struct ieee80211_hw *hw,
                q = &txq->q;
                avail = iwl4965_queue_space(q);
 
-               stats->data[i].len = q->n_window - avail;
-               stats->data[i].limit = q->n_window - q->high_mark;
-               stats->data[i].count = q->n_window;
+               stats[i].len = q->n_window - avail;
+               stats[i].limit = q->n_window - q->high_mark;
+               stats[i].count = q->n_window;
 
        }
        spin_unlock_irqrestore(&priv->lock, flags);
index 06d2c67f4c81d00603790d38dbfe08adeb67df2d..c6f27b9022f921d246a3ea70bdfc7684208df4ea 100644 (file)
@@ -64,7 +64,7 @@ struct p54_common {
        unsigned int tx_hdr_len;
        void *cached_vdcf;
        unsigned int fw_var;
-       struct ieee80211_tx_queue_stats tx_stats;
+       struct ieee80211_tx_queue_stats tx_stats[4];
 };
 
 int p54_rx(struct ieee80211_hw *dev, struct sk_buff *skb);
index 63f9badf3f523a77eb513f1293da991f35008903..59a26978f8771b01c43a4e79514553c23e5e9e35 100644 (file)
@@ -146,10 +146,10 @@ void p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw)
 
        if (priv->fw_var >= 0x300) {
                /* Firmware supports QoS, use it! */
-               priv->tx_stats.data[0].limit = 3;
-               priv->tx_stats.data[1].limit = 4;
-               priv->tx_stats.data[2].limit = 3;
-               priv->tx_stats.data[3].limit = 1;
+               priv->tx_stats[0].limit = 3;
+               priv->tx_stats[1].limit = 4;
+               priv->tx_stats[2].limit = 3;
+               priv->tx_stats[3].limit = 1;
                dev->queues = 4;
        }
 }
@@ -379,7 +379,7 @@ static void inline p54_wake_free_queues(struct ieee80211_hw *dev)
         * But, what if some are full? */
 
        for (i = 0; i < dev->queues; i++)
-               if (priv->tx_stats.data[i].len < priv->tx_stats.data[i].limit)
+               if (priv->tx_stats[i].len < priv->tx_stats[i].limit)
                        ieee80211_wake_queue(dev, i);
 }
 
@@ -417,8 +417,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
                        memcpy(&status.control, range->control,
                               sizeof(status.control));
                        kfree(range->control);
-                       priv->tx_stats.data[status.control.queue].len--;
-
+                       priv->tx_stats[status.control.queue].len--;
                        entry_hdr = (struct p54_control_hdr *) entry->data;
                        entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data;
                        if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) != 0)
@@ -555,7 +554,7 @@ static void p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb,
 static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
                  struct ieee80211_tx_control *control)
 {
-       struct ieee80211_tx_queue_stats_data *current_queue;
+       struct ieee80211_tx_queue_stats *current_queue;
        struct p54_common *priv = dev->priv;
        struct p54_control_hdr *hdr;
        struct p54_tx_control_allocdata *txhdr;
@@ -563,7 +562,7 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
        size_t padding, len;
        u8 rate;
 
-       current_queue = &priv->tx_stats.data[control->queue];
+       current_queue = &priv->tx_stats[control->queue];
        if (unlikely(current_queue->len > current_queue->limit))
                return NETDEV_TX_BUSY;
        current_queue->len++;
@@ -967,11 +966,8 @@ static int p54_get_tx_stats(struct ieee80211_hw *dev,
                            struct ieee80211_tx_queue_stats *stats)
 {
        struct p54_common *priv = dev->priv;
-       unsigned int i;
 
-       for (i = 0; i < dev->queues; i++)
-               memcpy(&stats->data[i], &priv->tx_stats.data[i],
-                       sizeof(stats->data[i]));
+       memcpy(stats, &priv->tx_stats, sizeof(stats[0]) * dev->queues);
 
        return 0;
 }
@@ -1008,7 +1004,7 @@ struct ieee80211_hw *p54_init_common(size_t priv_data_len)
        dev->channel_change_time = 1000;        /* TODO: find actual value */
        dev->max_rssi = 127;
 
-       priv->tx_stats.data[0].limit = 5;
+       priv->tx_stats[0].limit = 5;
        dev->queues = 1;
 
        dev->extra_tx_headroom = sizeof(struct p54_control_hdr) + 4 +
index d4ceab7646e7cfffe3f3f218cf32d162720236ab..7bc5129484f25ff2c3a435f12f2ed79d4c142e93 100644 (file)
@@ -457,9 +457,9 @@ int rt2x00mac_get_tx_stats(struct ieee80211_hw *hw,
        unsigned int i;
 
        for (i = 0; i < hw->queues; i++) {
-               stats->data[i].len = rt2x00dev->tx[i].length;
-               stats->data[i].limit = rt2x00dev->tx[i].limit;
-               stats->data[i].count = rt2x00dev->tx[i].count;
+               stats[i].len = rt2x00dev->tx[i].length;
+               stats[i].limit = rt2x00dev->tx[i].limit;
+               stats[i].count = rt2x00dev->tx[i].count;
        }
 
        return 0;
index 740c11ca066c05cd43d5971aa8a8d74b376cba63..346a7563ef0251d3af2e66f2e9a7b0a23c28129f 100644 (file)
@@ -117,13 +117,13 @@ struct ieee80211_tx_queue_params {
 };
 
 /**
- * struct ieee80211_tx_queue_stats_data - transmit queue statistics
+ * struct ieee80211_tx_queue_stats - transmit queue statistics
  *
  * @len: number of packets in queue
  * @limit: queue length limit
  * @count: number of frames sent
  */
-struct ieee80211_tx_queue_stats_data {
+struct ieee80211_tx_queue_stats {
        unsigned int len;
        unsigned int limit;
        unsigned int count;
@@ -165,10 +165,6 @@ enum ieee80211_tx_queue {
        NUM_TX_DATA_QUEUES_AMPDU = 16
 };
 
-struct ieee80211_tx_queue_stats {
-       struct ieee80211_tx_queue_stats_data data[NUM_TX_DATA_QUEUES_AMPDU];
-};
-
 struct ieee80211_low_level_stats {
        unsigned int dot11ACKFailureCount;
        unsigned int dot11RTSFailureCount;
@@ -1083,9 +1079,8 @@ enum ieee80211_ampdu_mlme_action {
  * @get_tx_stats: Get statistics of the current TX queue status. This is used
  *     to get number of currently queued packets (queue length), maximum queue
  *     size (limit), and total number of packets sent using each TX queue
- *     (count). This information is used for WMM to find out which TX
- *     queues have room for more packets and by hostapd to provide
- *     statistics about the current queueing state to external programs.
+ *     (count). The 'stats' pointer points to an array that has hw->queues +
+ *     hw->ampdu_queues items.
  *
  * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently,
  *     this is only used for IBSS mode debugging and, as such, is not a