From: Ivo van Doorn <ivdoorn@gmail.com>
To: "John W. Linville" <linville@tuxdriver.com>,
linux-wireless@vger.kernel.org
Cc: users@rt2x00.serialmonkey.com
Subject: [PATCH 01/19] rt2x00: Optimize calls to rt2x00queue_get_queue
Date: Thu, 3 Mar 2011 19:38:55 +0100 [thread overview]
Message-ID: <201103031938.56423.IvDoorn@gmail.com> (raw)
From: Helmut Schaa <helmut.schaa@googlemail.com>
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>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 4 ++--
drivers/net/wireless/rt2x00/rt2800pci.c | 2 +-
drivers/net/wireless/rt2x00/rt2x00.h | 17 +++++++++++++++++
drivers/net/wireless/rt2x00/rt2x00mac.c | 4 ++--
drivers/net/wireless/rt2x00/rt61pci.c | 4 ++--
drivers/net/wireless/rt2x00/rt73usb.c | 2 +-
6 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index af9cef0..7dba354 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)
if (pid >= QID_RX)
continue;
- queue = rt2x00queue_get_queue(rt2x00dev, pid);
+ queue = rt2x00queue_get_tx_queue(rt2x00dev, pid);
if (unlikely(!queue))
continue;
@@ -3957,7 +3957,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)));
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index cc7c90c..a768deb 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)
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
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 1df432c..391669b 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);
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.
* @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 1b3edef..6715b77 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -122,7 +122,7 @@ int 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"
@@ -693,7 +693,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;
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index dd2164d..674239e 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2182,7 +2182,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;
@@ -2909,7 +2909,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)));
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 5ff72de..61c964d 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2239,7 +2239,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)));
--
1.7.2.3
next reply other threads:[~2011-03-03 18:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-03 18:38 Ivo van Doorn [this message]
2011-03-03 18:39 ` [PATCH 02/19] rt2x00: Make use of unlikely during tx status processing Ivo van Doorn
2011-03-03 18:39 ` [PATCH 03/19] rt2x00: Remove useless NULL check Ivo van Doorn
2011-03-03 18:40 ` [PATCH 04/19] rt2x00: Add unlikely macro to special case tx status handling Ivo van Doorn
2011-03-03 18:41 ` [PATCH 05/19] rt2x00: Use unlikely for unexpected error condition in rt2x00_mac_tx Ivo van Doorn
2011-03-03 18:42 ` [PATCH 06/19] rt2x00: Generate sw sequence numbers only for devices that need it Ivo van Doorn
2011-03-03 18:42 ` [PATCH 07/19] rt2x00: Optimize TX descriptor handling Ivo van Doorn
2011-03-03 18:42 ` [PATCH 08/19] rt2x00: Optimize TX descriptor memory layout Ivo van Doorn
2011-03-03 18:43 ` [PATCH 09/19] rt2x00: Move TX descriptor field "ifs" into plcp substruct Ivo van Doorn
2011-03-03 18:43 ` [PATCH 10/19] rt2x00: Don't call ieee80211_get_tx_rate for MCS rates Ivo van Doorn
2011-03-03 18:44 ` [PATCH 11/19] rt2x00: Use an enum instead of u16 for the rate_mode TX descriptor field Ivo van Doorn
2011-03-03 18:44 ` [PATCH 12/19] rt2x00: Fix rt2800 key assignment in multi bssid setups Ivo van Doorn
2011-03-03 18:44 ` [PATCH 13/19] rt2x00: Remove now unused crypto.aid field Ivo van Doorn
2011-03-03 18:45 ` [PATCH 14/19] rt2x00: Revise irqmask locking for PCI devices Ivo van Doorn
2011-03-03 18:45 ` [PATCH 15/19] rt2x00: Fix comment in rt2800pci Ivo van Doorn
2011-03-03 18:46 ` [PATCH 16/19] rt2x00: Don't treat ATIM queue as second beacon queue Ivo van Doorn
2011-03-03 18:46 ` [PATCH 17/19] rt2x00: Include ATIM queue support in rt2x00queue_get_tx_queue Ivo van Doorn
2011-03-03 18:46 ` [PATCH 18/19] rt2x00: Optimize getting the beacon queue structure Ivo van Doorn
2011-03-03 18:47 ` [PATCH 19/19] rt2x00: Remove unused rt2x00queue_get_queue function Ivo van Doorn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201103031938.56423.IvDoorn@gmail.com \
--to=ivdoorn@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=users@rt2x00.serialmonkey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).