Return-path: Received: from mail-ew0-f215.google.com ([209.85.219.215]:33312 "EHLO mail-ew0-f215.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933841AbZKXTMz (ORCPT ); Tue, 24 Nov 2009 14:12:55 -0500 Received: by ewy7 with SMTP id 7so80353ewy.28 for ; Tue, 24 Nov 2009 11:12:59 -0800 (PST) Message-ID: <4B0C3035.7010003@gmail.com> Date: Tue, 24 Nov 2009 20:12:53 +0100 From: Gertjan van Wingerde MIME-Version: 1.0 To: Ivo van Doorn CC: users@rt2x00.serialmonkey.com, linux-wireless@vger.kernel.org Subject: Re: [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations. References: <1259012694-14869-1-git-send-email-gwingerde@gmail.com> <1259012694-14869-8-git-send-email-gwingerde@gmail.com> <1259012694-14869-9-git-send-email-gwingerde@gmail.com> <200911241819.29685.IvDoorn@gmail.com> In-Reply-To: <200911241819.29685.IvDoorn@gmail.com> Content-Type: text/plain; charset=ISO-8859-15 Sender: linux-wireless-owner@vger.kernel.org List-ID: On 11/24/09 18:19, Ivo van Doorn wrote: > On Monday 23 November 2009, Gertjan van Wingerde wrote: >> 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 >> Signed-off-by: Gertjan van Wingerde >> --- >> 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 4d841c0..dcfc8c2 100644 >> --- a/drivers/net/wireless/rt2x00/rt2x00.h >> +++ b/drivers/net/wireless/rt2x00/rt2x00.h >> @@ -113,6 +113,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 */ > > Now that I think of it, why do we need 8 byte for L2 padding? > Shouldn't we need the same size for regular alignment, L2 padding only indicates > the padding occurs between header and payload rather then before the header only. > So unless I am mistaken about how I coded the header & payload moving in rt2x00lib, > you always need at most 4 bytes. > Nope. If I read the code right then the header can be moved by more than 4 bytes, namely when the payload needs to be shifted more than the header. In that case the header is shifted an extra 4 bytes to make room for the payload. However, 8 is the obvious maximum. --- Gertjan.