linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivo van Doorn <ivdoorn@gmail.com>
To: Gertjan van Wingerde <gwingerde@gmail.com>
Cc: users@rt2x00.serialmonkey.com, linux-wireless@vger.kernel.org
Subject: Re: [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations.
Date: Tue, 24 Nov 2009 18:19:29 +0100	[thread overview]
Message-ID: <200911241819.29685.IvDoorn@gmail.com> (raw)
In-Reply-To: <1259012694-14869-9-git-send-email-gwingerde@gmail.com>

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 <david@identd.dyndns.org>
> Signed-off-by: Gertjan van Wingerde <gwingerde@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 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.

> +/*
>   * 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 06c43ca..265e66d 100644
> --- a/drivers/net/wireless/rt2x00/rt2x00dev.c
> +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
> @@ -686,7 +686,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.



  reply	other threads:[~2009-11-24 17:19 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-23 21:44 [PATCH v2 0/8] Assorted fixes and cleanups for rt2x00 and mac80211 Gertjan van Wingerde
2009-11-23 21:44 ` [PATCH v2 1/8] rt2x00: Only initialize HT on rt2800 devices that support it Gertjan van Wingerde
2009-11-23 21:44   ` [PATCH v2 2/8] rt2x00: Remove unused variable frame_control from rt2x00mac_tx Gertjan van Wingerde
2009-11-23 21:44     ` [PATCH v2 3/8] rt2x00: Clean up use of rt2x00_intf_is_pci Gertjan van Wingerde
2009-11-23 21:44       ` [PATCH v2 4/8] rt2x00: Fix typo (lengt --> length) in rt2x00queue.c Gertjan van Wingerde
2009-11-23 21:44         ` [PATCH v2 5/8] rt2x00: Whitespace cleanup Gertjan van Wingerde
2009-11-23 21:44           ` [PATCH v2 6/8] rt2x00: Centralize setting of extra TX headroom requested by rt2x00 Gertjan van Wingerde
2009-11-23 21:44             ` [PATCH v2 7/8] mac80211: Add define for TX headroom reserved by mac80211 itself Gertjan van Wingerde
2009-11-23 21:44               ` [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations Gertjan van Wingerde
2009-11-24 17:19                 ` Ivo van Doorn [this message]
2009-11-24 19:12                   ` Gertjan van Wingerde
2009-11-24 20:04                     ` Ivo van Doorn
2009-11-25 19:47                 ` John W. Linville
2009-11-25 21:29                   ` Gertjan van Wingerde
2009-11-25 21:48                     ` John W. Linville
2009-12-20 15:42                 ` [BISECTED] " Markus Baier
2009-12-20 20:20                   ` Gertjan van Wingerde
2009-12-21  0:45                     ` Markus Baier
2009-12-21  6:33                     ` Pavel Roskin
2009-12-21 16:26                       ` Gertjan van Wingerde
2009-12-21 19:17                         ` John W. Linville
2009-12-22  0:22                           ` Gertjan van Wingerde
2009-12-22  5:25                         ` Pavel Roskin
2009-12-22  8:13                           ` Gertjan van Wingerde
2009-12-22 10:55                             ` Markus Baier
2009-12-22 14:18                               ` Gertjan van Wingerde
2009-12-22 15:03                             ` Pavel Roskin
2009-11-23 23:22               ` [PATCH v2 7/8] mac80211: Add define for TX headroom reserved by mac80211 itself Johannes Berg
2009-11-24 17:13             ` [PATCH v2 6/8] rt2x00: Centralize setting of extra TX headroom requested by rt2x00 Ivo van Doorn
2009-11-24 17:13           ` [PATCH v2 5/8] rt2x00: Whitespace cleanup Ivo van Doorn
2009-11-23 22:18   ` [rt2x00-users] [PATCH v2 1/8] rt2x00: Only initialize HT on rt2800 devices that support it David Ellingsworth
2009-11-24 17:12     ` 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=200911241819.29685.IvDoorn@gmail.com \
    --to=ivdoorn@gmail.com \
    --cc=gwingerde@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --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).