aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorHelmut Schaa <helmut.schaa@googlemail.com>2011-03-03 13:38:55 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-03-04 14:06:46 -0500
commit11f818e0eb50864c7e6f8af38d8f8822f992906a (patch)
tree25e5da8f41a1304240c164d26128805e42cf7832 /drivers/net
parentadde5882bc6c21de7ee80ee15dfd58c7e9a472ac (diff)
rt2x00: Optimize calls to rt2x00queue_get_queue
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>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h17
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c2
6 files changed, 25 insertions, 8 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index dbee3f12d636..76ced6dcee05 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -751,7 +751,7 @@ void rt2800_txdone(struct rt2x00_dev *rt2x00dev)
751 if (pid >= QID_RX) 751 if (pid >= QID_RX)
752 continue; 752 continue;
753 753
754 queue = rt2x00queue_get_queue(rt2x00dev, pid); 754 queue = rt2x00queue_get_tx_queue(rt2x00dev, pid);
755 if (unlikely(!queue)) 755 if (unlikely(!queue))
756 continue; 756 continue;
757 757
@@ -3974,7 +3974,7 @@ int rt2800_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,
3974 if (queue_idx >= 4) 3974 if (queue_idx >= 4)
3975 return 0; 3975 return 0;
3976 3976
3977 queue = rt2x00queue_get_queue(rt2x00dev, queue_idx); 3977 queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx);
3978 3978
3979 /* Update WMM TXOP register */ 3979 /* Update WMM TXOP register */
3980 offset = WMM_TXOP0_CFG + (sizeof(u32) * (!!(queue_idx & 2))); 3980 offset = WMM_TXOP0_CFG + (sizeof(u32) * (!!(queue_idx & 2)));
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index 6c634c3a2e01..5b53d005559b 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -736,7 +736,7 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev)
736 break; 736 break;
737 } 737 }
738 738
739 queue = rt2x00queue_get_queue(rt2x00dev, qid); 739 queue = rt2x00queue_get_tx_queue(rt2x00dev, qid);
740 if (unlikely(queue == NULL)) { 740 if (unlikely(queue == NULL)) {
741 /* 741 /*
742 * The queue is NULL, this shouldn't happen. Stop 742 * The queue is NULL, this shouldn't happen. Stop
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 19453d23e90d..2f5d8de5ef14 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -1063,6 +1063,23 @@ void rt2x00queue_map_txskb(struct queue_entry *entry);
1063void rt2x00queue_unmap_skb(struct queue_entry *entry); 1063void rt2x00queue_unmap_skb(struct queue_entry *entry);
1064 1064
1065/** 1065/**
1066 * rt2x00queue_get_tx_queue - Convert tx queue index to queue pointer
1067 * @rt2x00dev: Pointer to &struct rt2x00_dev.
1068 * @queue: rt2x00 queue index (see &enum data_queue_qid).
1069 *
1070 * Returns NULL for non tx queues.
1071 */
1072static inline struct data_queue *
1073rt2x00queue_get_tx_queue(struct rt2x00_dev *rt2x00dev,
1074 const enum data_queue_qid queue)
1075{
1076 if (queue < rt2x00dev->ops->tx_queues && rt2x00dev->tx)
1077 return &rt2x00dev->tx[queue];
1078
1079 return NULL;
1080}
1081
1082/**
1066 * rt2x00queue_get_queue - Convert queue index to queue pointer 1083 * rt2x00queue_get_queue - Convert queue index to queue pointer
1067 * @rt2x00dev: Pointer to &struct rt2x00_dev. 1084 * @rt2x00dev: Pointer to &struct rt2x00_dev.
1068 * @queue: rt2x00 queue index (see &enum data_queue_qid). 1085 * @queue: rt2x00 queue index (see &enum data_queue_qid).
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index c2c35838c2f3..7714198b9d3e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -122,7 +122,7 @@ void rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
122 test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags)) 122 test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags))
123 queue = rt2x00queue_get_queue(rt2x00dev, QID_ATIM); 123 queue = rt2x00queue_get_queue(rt2x00dev, QID_ATIM);
124 else 124 else
125 queue = rt2x00queue_get_queue(rt2x00dev, qid); 125 queue = rt2x00queue_get_tx_queue(rt2x00dev, qid);
126 if (unlikely(!queue)) { 126 if (unlikely(!queue)) {
127 ERROR(rt2x00dev, 127 ERROR(rt2x00dev,
128 "Attempt to send packet over invalid queue %d.\n" 128 "Attempt to send packet over invalid queue %d.\n"
@@ -692,7 +692,7 @@ int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,
692 struct rt2x00_dev *rt2x00dev = hw->priv; 692 struct rt2x00_dev *rt2x00dev = hw->priv;
693 struct data_queue *queue; 693 struct data_queue *queue;
694 694
695 queue = rt2x00queue_get_queue(rt2x00dev, queue_idx); 695 queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx);
696 if (unlikely(!queue)) 696 if (unlikely(!queue))
697 return -EINVAL; 697 return -EINVAL;
698 698
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 927a4a3e0eeb..2ed845b1ea3c 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2190,7 +2190,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
2190 * queue identication number. 2190 * queue identication number.
2191 */ 2191 */
2192 type = rt2x00_get_field32(reg, STA_CSR4_PID_TYPE); 2192 type = rt2x00_get_field32(reg, STA_CSR4_PID_TYPE);
2193 queue = rt2x00queue_get_queue(rt2x00dev, type); 2193 queue = rt2x00queue_get_tx_queue(rt2x00dev, type);
2194 if (unlikely(!queue)) 2194 if (unlikely(!queue))
2195 continue; 2195 continue;
2196 2196
@@ -2917,7 +2917,7 @@ static int rt61pci_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,
2917 if (queue_idx >= 4) 2917 if (queue_idx >= 4)
2918 return 0; 2918 return 0;
2919 2919
2920 queue = rt2x00queue_get_queue(rt2x00dev, queue_idx); 2920 queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx);
2921 2921
2922 /* Update WMM TXOP register */ 2922 /* Update WMM TXOP register */
2923 offset = AC_TXOP_CSR0 + (sizeof(u32) * (!!(queue_idx & 2))); 2923 offset = AC_TXOP_CSR0 + (sizeof(u32) * (!!(queue_idx & 2)));
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 6e9981a1dd7f..a799c262c1db 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2247,7 +2247,7 @@ static int rt73usb_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,
2247 if (queue_idx >= 4) 2247 if (queue_idx >= 4)
2248 return 0; 2248 return 0;
2249 2249
2250 queue = rt2x00queue_get_queue(rt2x00dev, queue_idx); 2250 queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx);
2251 2251
2252 /* Update WMM TXOP register */ 2252 /* Update WMM TXOP register */
2253 offset = AC_TXOP_CSR0 + (sizeof(u32) * (!!(queue_idx & 2))); 2253 offset = AC_TXOP_CSR0 + (sizeof(u32) * (!!(queue_idx & 2)));