From: Ivo van Doorn <ivdoorn@gmail.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org, users@rt2x00.serialmonkey.com
Subject: [PATCH 03/13] rt2x00: Calculate tx status fifo size instead of hardcoding it
Date: Mon, 28 Mar 2011 13:30:36 +0200 [thread overview]
Message-ID: <201103281330.36856.IvDoorn@gmail.com> (raw)
In-Reply-To: <201103281330.10560.IvDoorn@gmail.com>
From: Helmut Schaa <helmut.schaa@googlemail.com>
Instead of hardcoding the tx status fifo size as 512 calculate it based
on the number of tx queues and the number of entries per queue. Also
round the size up to a power of 2 as kfifo would otherwise round it
down.
On rt2800pci this will increase the kfifo size from 512 bytes to 1024
bytes which is then able to hold the tx status for all entries in all
tx queues.
Furthermore, if the number of tx queues or tx entries changes in the
future (use of the MGMT queue for example) the kfifo size doesn't need
to be updated.
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
drivers/net/wireless/rt2x00/rt2x00dev.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 9de9dbe..d63b582 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -27,6 +27,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
+#include <linux/log2.h>
#include "rt2x00.h"
#include "rt2x00lib.h"
@@ -811,13 +812,18 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev)
*/
if (test_bit(DRIVER_REQUIRE_TXSTATUS_FIFO, &rt2x00dev->flags)) {
/*
- * Allocate txstatus fifo and tasklet, we use a size of 512
- * for the kfifo which is big enough to store 512/4=128 tx
- * status reports. In the worst case (tx status for all tx
- * queues gets reported before we've got a chance to handle
- * them) 24*4=384 tx status reports need to be cached.
+ * Allocate the txstatus fifo. In the worst case the tx
+ * status fifo has to hold the tx status of all entries
+ * in all tx queues. Hence, calculate the kfifo size as
+ * tx_queues * entry_num and round up to the nearest
+ * power of 2.
*/
- status = kfifo_alloc(&rt2x00dev->txstatus_fifo, 512,
+ int kfifo_size =
+ roundup_pow_of_two(rt2x00dev->ops->tx_queues *
+ rt2x00dev->ops->tx->entry_num *
+ sizeof(u32));
+
+ status = kfifo_alloc(&rt2x00dev->txstatus_fifo, kfifo_size,
GFP_KERNEL);
if (status)
return status;
--
1.7.2.3
next prev parent reply other threads:[~2011-03-28 11:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-28 11:29 [PATCH 01/13] rt2x00: Limit rt2x00pci rxdone processing to 16 entries at once Ivo van Doorn
2011-03-28 11:30 ` [PATCH 02/13] rt2x00: Limit rt2800pci txdone " Ivo van Doorn
2011-03-28 11:30 ` Ivo van Doorn [this message]
2011-03-28 11:30 ` [PATCH 04/13] rt2x00: Remove DRIVER_SUPPORT_WATCHDOG flag Ivo van Doorn
2011-03-28 11:31 ` [PATCH 05/13] rt2x00: Restructure bw_comp calculationATCHDOG flag Ivo van Doorn
2011-03-28 11:32 ` [PATCH 06/13] rt2x00: Don't recalculate HT40 compensation for each rate Ivo van Doorn
2011-03-28 11:32 ` [PATCH 07/13] rt2x00: Indention cleanup in rt2800lib Ivo van Doorn
2011-03-28 11:33 ` [PATCH 08/13] rt2x00: Remove obsolete rt2x00queue_align_payload Ivo van Doorn
2011-03-28 11:33 ` [PATCH 09/13] rt2x00: Implement tx power temperature compensation Ivo van Doorn
2011-03-28 11:34 ` [PATCH 10/13] rt2x00: Fix STBC transmissions to STAs with Rx STBC > 1 Ivo van Doorn
2011-03-28 11:34 ` [PATCH 11/13] rt2x00: Add support for the ZyXEL NWD-211AN USB Ivo van Doorn
2011-03-28 11:35 ` [PATCH 12/13] rt2x00: Fix tx aggregation problems with some clients Ivo van Doorn
2011-03-28 11:35 ` [PATCH 13/13] rt2x00: Add an error message when trying to send on a full queue Ivo van Doorn
2011-03-29 0:37 ` [PATCH 05/13] rt2x00: Restructure bw_comp calculationATCHDOG flag Julian Calaby
2011-04-02 17:14 ` [PATCH 05/13 v2] rt2x00: Restructure bw_comp calculation 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=201103281330.36856.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).