]> Pileus Git - ~andy/linux/commitdiff
rt2x00: Optimize calls to rt2x00queue_get_queue
authorHelmut Schaa <helmut.schaa@googlemail.com>
Thu, 3 Mar 2011 18:38:55 +0000 (19:38 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 4 Mar 2011 19:06:46 +0000 (14:06 -0500)
In some cases (tx path for example) we don't need to check for non-tx
queues in rt2x00queue_get_queue. Hence, introduce a new method
rt2x00queue_get_tx_queue that is only valid for tx queues and use it in
places where only tx queues are valid.

Furthermore, this new method is quite short and as such can be inlined
to avoid the function call overhead.

This only converts the txdone functions of drivers that don't use an ATIM
queue and the generic tx path.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2800lib.c
drivers/net/wireless/rt2x00/rt2800pci.c
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00mac.c
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c

index dbee3f12d6368a6bdcb5c445b9de065285a92e9a..76ced6dcee052e514c2781434f85c39ecbc7aa1e 100644 (file)
@@ -751,7 +751,7 @@ void rt2800_txdone(struct rt2x00_dev *rt2x00dev)
                if (pid >= QID_RX)
                        continue;
 
-               queue = rt2x00queue_get_queue(rt2x00dev, pid);
+               queue = rt2x00queue_get_tx_queue(rt2x00dev, pid);
                if (unlikely(!queue))
                        continue;
 
@@ -3974,7 +3974,7 @@ int rt2800_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,
        if (queue_idx >= 4)
                return 0;
 
-       queue = rt2x00queue_get_queue(rt2x00dev, queue_idx);
+       queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx);
 
        /* Update WMM TXOP register */
        offset = WMM_TXOP0_CFG + (sizeof(u32) * (!!(queue_idx & 2)));
index 6c634c3a2e01ed64a46a31fe965e442fd1a9ad29..5b53d005559bf2312df97a9a4b975b4252d1b28c 100644 (file)
@@ -736,7 +736,7 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev)
                        break;
                }
 
-               queue = rt2x00queue_get_queue(rt2x00dev, qid);
+               queue = rt2x00queue_get_tx_queue(rt2x00dev, qid);
                if (unlikely(queue == NULL)) {
                        /*
                         * The queue is NULL, this shouldn't happen. Stop
index 19453d23e90d493d00c816025baef28b582f1e29..2f5d8de5ef14de59e98f91e7c58c81a58874a96a 100644 (file)
@@ -1062,6 +1062,23 @@ void rt2x00queue_map_txskb(struct queue_entry *entry);
  */
 void rt2x00queue_unmap_skb(struct queue_entry *entry);
 
+/**
+ * rt2x00queue_get_tx_queue - Convert tx queue index to queue pointer
+ * @rt2x00dev: Pointer to &struct rt2x00_dev.
+ * @queue: rt2x00 queue index (see &enum data_queue_qid).
+ *
+ * Returns NULL for non tx queues.
+ */
+static inline struct data_queue *
+rt2x00queue_get_tx_queue(struct rt2x00_dev *rt2x00dev,
+                        const enum data_queue_qid queue)
+{
+       if (queue < rt2x00dev->ops->tx_queues && rt2x00dev->tx)
+               return &rt2x00dev->tx[queue];
+
+       return NULL;
+}
+
 /**
  * rt2x00queue_get_queue - Convert queue index to queue pointer
  * @rt2x00dev: Pointer to &struct rt2x00_dev.
index c2c35838c2f390cddc9b5e73d35d251f2ce3369e..7714198b9d3e494c4c047760e8de9f524e177023 100644 (file)
@@ -122,7 +122,7 @@ void rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
            test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags))
                queue = rt2x00queue_get_queue(rt2x00dev, QID_ATIM);
        else
-               queue = rt2x00queue_get_queue(rt2x00dev, qid);
+               queue = rt2x00queue_get_tx_queue(rt2x00dev, qid);
        if (unlikely(!queue)) {
                ERROR(rt2x00dev,
                      "Attempt to send packet over invalid queue %d.\n"
@@ -692,7 +692,7 @@ int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,
        struct rt2x00_dev *rt2x00dev = hw->priv;
        struct data_queue *queue;
 
-       queue = rt2x00queue_get_queue(rt2x00dev, queue_idx);
+       queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx);
        if (unlikely(!queue))
                return -EINVAL;
 
index 927a4a3e0eeb40b1aef2e8fd1afb154be2436ed1..2ed845b1ea3cf849159ac210762884ed2fb4b89f 100644 (file)
@@ -2190,7 +2190,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
                 * queue identication number.
                 */
                type = rt2x00_get_field32(reg, STA_CSR4_PID_TYPE);
-               queue = rt2x00queue_get_queue(rt2x00dev, type);
+               queue = rt2x00queue_get_tx_queue(rt2x00dev, type);
                if (unlikely(!queue))
                        continue;
 
@@ -2917,7 +2917,7 @@ static int rt61pci_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,
        if (queue_idx >= 4)
                return 0;
 
-       queue = rt2x00queue_get_queue(rt2x00dev, queue_idx);
+       queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx);
 
        /* Update WMM TXOP register */
        offset = AC_TXOP_CSR0 + (sizeof(u32) * (!!(queue_idx & 2)));
index 6e9981a1dd7f2fb0675d69d850418d57e73e2087..a799c262c1dbc6278b1dd714b773bc95af76ef27 100644 (file)
@@ -2247,7 +2247,7 @@ static int rt73usb_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,
        if (queue_idx >= 4)
                return 0;
 
-       queue = rt2x00queue_get_queue(rt2x00dev, queue_idx);
+       queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx);
 
        /* Update WMM TXOP register */
        offset = AC_TXOP_CSR0 + (sizeof(u32) * (!!(queue_idx & 2)));