From: Gertjan van Wingerde <gwingerde@gmail.com>
To: "John W. Linville" <linville@tuxdriver.com>,
Wireless list <linux-wireless@vger.kernel.org>,
rt2x00 users list <users@rt2x00.serialmonkey.com>
Cc: Ivo van Doorn <ivdoorn@gmail.com>,
Gertjan van Wingerde <gwingerde@gmail.com>
Subject: [PATCH 2/6] rt2x00: Properly request tx headroom for alignment operations.
Date: Wed, 30 Dec 2009 11:36:30 +0100 [thread overview]
Message-ID: <1262169394-11647-3-git-send-email-gwingerde@gmail.com> (raw)
In-Reply-To: <1262169394-11647-2-git-send-email-gwingerde@gmail.com>
Current rt2x00 drivers may result in a "ieee80211_tx_status: headroom too
small" error message when a frame needs to be properly aligned before
transmitting it.
This is because the space needed to ensure proper alignment isn't
requested from mac80211.
Fix this by adding sufficient amount of alignment space to the amount
of headroom requested for TX frames.
Reported-by: David Ellingsworth <david@identd.dyndns.org>
Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <ivdoorn@gmail.com>
---
drivers/net/wireless/rt2x00/rt2x00.h | 6 ++++++
drivers/net/wireless/rt2x00/rt2x00dev.c | 12 +++++++++++-
2 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index b4c6e0a..096da85 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -119,6 +119,12 @@
( ((unsigned long)((__skb)->data + (__header))) & 3 )
/*
+ * Constants for extra TX headroom for alignment purposes.
+ */
+#define RT2X00_ALIGN_SIZE 4 /* Only whole frame needs alignment */
+#define RT2X00_L2PAD_SIZE 8 /* Both header & payload need alignment */
+
+/*
* Standard timing and size defines.
* These values should follow the ieee80211 specifications.
*/
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index d7711e4..b93731b 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -688,7 +688,17 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev)
/*
* Initialize extra TX headroom required.
*/
- rt2x00dev->hw->extra_tx_headroom = rt2x00dev->ops->extra_tx_headroom;
+ rt2x00dev->hw->extra_tx_headroom =
+ max_t(unsigned int, IEEE80211_TX_STATUS_HEADROOM,
+ rt2x00dev->ops->extra_tx_headroom);
+
+ /*
+ * Take TX headroom required for alignment into account.
+ */
+ if (test_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags))
+ rt2x00dev->hw->extra_tx_headroom += RT2X00_L2PAD_SIZE;
+ else if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags))
+ rt2x00dev->hw->extra_tx_headroom += RT2X00_ALIGN_SIZE;
/*
* Register HW.
--
1.6.6
next prev parent reply other threads:[~2009-12-30 10:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-30 10:36 [PATCH 0/6] rt2x00 fixes and cleanups Gertjan van Wingerde
2009-12-30 10:36 ` [PATCH 1/6] rt2x00: use correct headroom for transmission Gertjan van Wingerde
2009-12-30 10:36 ` Gertjan van Wingerde [this message]
2009-12-30 10:36 ` [PATCH 3/6] rt2x00: RF3052 is a valid RF chipset for USB devices as well Gertjan van Wingerde
2009-12-30 10:36 ` [PATCH 4/6] rt2x00: Unify rt2800 WPDMA ready waiting functions Gertjan van Wingerde
2009-12-30 10:36 ` [PATCH 5/6] rt2x00: Fix LED configuration setting for rt2800 Gertjan van Wingerde
2009-12-30 10:36 ` [PATCH 6/6] rt2x00: Make rt2800_init_led static and don't export it Gertjan van Wingerde
2009-12-30 20:42 ` Ivo van Doorn
2009-12-30 20:42 ` [PATCH 5/6] rt2x00: Fix LED configuration setting for rt2800 Ivo van Doorn
2009-12-30 20:42 ` [PATCH 4/6] rt2x00: Unify rt2800 WPDMA ready waiting functions Ivo van Doorn
2009-12-30 20:41 ` [PATCH 3/6] rt2x00: RF3052 is a valid RF chipset for USB devices as well Ivo van Doorn
2009-12-30 20:41 ` [PATCH 1/6] rt2x00: use correct headroom for transmission 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=1262169394-11647-3-git-send-email-gwingerde@gmail.com \
--to=gwingerde@gmail.com \
--cc=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).