linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 05/17] rt2x00: Ensure TX-ed frames are returned in the original state.
Date: Mon, 13 Dec 2010 12:33:12 +0100	[thread overview]
Message-ID: <201012131233.13651.IvDoorn@gmail.com> (raw)
In-Reply-To: <201012131232.50201.IvDoorn@gmail.com>

From: Gertjan van Wingerde <gwingerde@gmail.com>

Recent changes to the TX-done code of rt2x00 resulted in TX-ed frames not
being returned to mac80211 in the original state, and therefore with
insufficient headroom for re-transmissions.

Fix this by reverting the changes done and by ensuring we remove the inserted
L2pad by moving the header backwards instead of the data forwards.

At the same time also make sure that the rt2x00queue_remove_l2pad will not
move any memory when a frame has no data at all.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Cc: Jay Hung <Jay_Hung@ralinktech.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
 drivers/net/wireless/rt2x00/rt2x00queue.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index a3d79c7..35133d8 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -199,15 +199,18 @@ void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length)
 
 void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length)
 {
-	unsigned int l2pad = L2PAD_SIZE(header_length);
+	/*
+	 * L2 padding is only present if the skb contains more than just the
+	 * IEEE 802.11 header.
+	 */
+	unsigned int l2pad = (skb->len > header_length) ?
+				L2PAD_SIZE(header_length) : 0;
 
 	if (!l2pad)
 		return;
 
-	memmove(skb->data + header_length, skb->data + header_length + l2pad,
-				skb->len - header_length - l2pad);
-
-	skb_trim(skb, skb->len - l2pad);
+	memmove(skb->data + l2pad, skb->data, header_length);
+	skb_pull(skb, l2pad);
 }
 
 static void rt2x00queue_create_tx_descriptor_seq(struct queue_entry *entry,
-- 
1.7.2.3


  reply	other threads:[~2010-12-13 11:40 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-13 11:31 [PATCH 01/17] rt2x00: Add rt2800 EEPROM definition Ivo van Doorn
2010-12-13 11:31 ` [PATCH 02/17] rt2x00: Implement get_survey callback for rt2800 Ivo van Doorn
2010-12-13 11:32   ` [PATCH 03/17] rt2x00: Add RF chip definition Ivo van Doorn
2010-12-13 11:32     ` [PATCH 04/17] rt2x00: fix hang when unplugging USB device in use Ivo van Doorn
2010-12-13 11:33       ` Ivo van Doorn [this message]
2010-12-13 11:33         ` [PATCH 06/17] rt2x00: Don't frequently reset beacon interval in AdHoc mode Ivo van Doorn
2010-12-13 11:34           ` [PATCH 07/17] rt2x00: trivial: add missing \n on warnings Ivo van Doorn
2010-12-13 11:34             ` [PATCH 08/17] rt2x00: Introduce 3 queue commands in drivers (start, kick, stop) Ivo van Doorn
2010-12-13 11:34               ` [PATCH 09/17] rt2x00: Reorganize queue callback functions Ivo van Doorn
2010-12-13 11:35                 ` [PATCH 10/17] rt2x00: Protect queue control with mutex Ivo van Doorn
2010-12-13 11:35                   ` [PATCH 11/17] rt2x00: Add "flush" queue command Ivo van Doorn
2010-12-13 11:36                     ` [PATCH 12/17] rt2x00: Cleanup RX index counting Ivo van Doorn
2010-12-13 11:36                       ` [PATCH 13/17] rt2x00: Introduce extra queue entry sanity flag Ivo van Doorn
2010-12-13 11:36                         ` [PATCH 14/17] rt2x00: Fix WMM Queue naming Ivo van Doorn
2010-12-13 11:38                           ` [PATCH 15/17] rt2x00: remove stray semicolon Ivo van Doorn
2010-12-13 11:39                             ` [PATCH 16/17] rt2x00: Pad beacon to multiple of 32 bits Ivo van Doorn
2010-12-13 11:39                               ` [PATCH 17/17] rt2x00: Fix firmware loading regression on x86_64 Ivo van Doorn
2010-12-14 17:49                           ` [PATCH 14/17] rt2x00: Fix WMM Queue naming Helmut Schaa
2010-12-14 18:44                             ` Ivo Van Doorn
2010-12-14 18:57                               ` Helmut Schaa
2010-12-14 19:24                               ` Johannes Stezenbach
2010-12-15 16:38                                 ` Ivo Van Doorn
2010-12-13 12:27       ` [PATCH 04/17] rt2x00: fix hang when unplugging USB device in use Walter Goldens
2010-12-13 12:36         ` Ivo Van Doorn
2010-12-13 13:16           ` Walter Goldens
2010-12-16 13:04             ` Walter Goldens
2010-12-16 14:10               ` wimaxd daemon bug Alexander Khryukin
2010-12-17 13:58                 ` Alexander Khryukin
2010-12-16 20:43               ` [PATCH 04/17] rt2x00: fix hang when unplugging USB device in use Ivo Van Doorn
2010-12-17 11:56                 ` Walter Goldens
2010-12-17 15:02                   ` Johannes Stezenbach
2010-12-17 16:33                     ` Walter Goldens

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=201012131233.13651.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).