linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benoit PAPILLAULT <benoit.papillault@free.fr>
To: lrodriguez@atheros.com
Cc: jmalinen@atheros.com, linux-wireless@vger.kernel.org,
	ath9k-devel@lists.ath9k.org
Subject: Re: [PATCH] ath9k: This patch fix RX unpadding for any received frame.
Date: Tue, 24 Nov 2009 15:51:14 +0100	[thread overview]
Message-ID: <4B0BF2E2.20307@free.fr> (raw)
In-Reply-To: <1259074158-2101-1-git-send-email-benoit.papillault@free.fr>

Oops... Disregard this one, it has been already applied.

Regards, Benoit.

Benoit Papillault a écrit :
> From: Benoit PAPILLAULT <benoit@benoit-laptop.(none)>
>
> It has been tested with a 802.11 frame generator and by checking the FCS field
> of each received frame with the value reported by the Atheros hardware. This
> patch is useful if you are trying to analyze non standard 802.11 frame going
> over the air.
>
> Signed-off-by: Benoit PAPILLAULT <benoit@benoit-laptop.(none)>
> ---
>  drivers/net/wireless/ath/ath9k/common.c |   19 ++++++++++++++-----
>  1 files changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c
> index 2f1e161..4a13632 100644
> --- a/drivers/net/wireless/ath/ath9k/common.c
> +++ b/drivers/net/wireless/ath/ath9k/common.c
> @@ -231,26 +231,35 @@ void ath9k_cmn_rx_skb_postprocess(struct ath_common *common,
>  {
>  	struct ath_hw *ah = common->ah;
>  	struct ieee80211_hdr *hdr;
> -	int hdrlen, padsize;
> +	int hdrlen, padpos, padsize;
>  	u8 keyix;
>  	__le16 fc;
>  
>  	/* see if any padding is done by the hw and remove it */
>  	hdr = (struct ieee80211_hdr *) skb->data;
>  	hdrlen = ieee80211_get_hdrlen_from_skb(skb);
> +	padpos = 24;
>  	fc = hdr->frame_control;
> +	if ((fc & cpu_to_le16(IEEE80211_FCTL_FROMDS|IEEE80211_FCTL_TODS)) ==
> +	    cpu_to_le16(IEEE80211_FCTL_FROMDS|IEEE80211_FCTL_TODS)) {
> +	  padpos += 6; /* ETH_ALEN */
> +	}
> +	if ((fc & cpu_to_le16(IEEE80211_STYPE_QOS_DATA|IEEE80211_FCTL_FTYPE)) ==
> +	    cpu_to_le16(IEEE80211_STYPE_QOS_DATA|IEEE80211_FTYPE_DATA)) {
> +	  padpos += 2;
> +	}
>  
>  	/* The MAC header is padded to have 32-bit boundary if the
>  	 * packet payload is non-zero. The general calculation for
>  	 * padsize would take into account odd header lengths:
> -	 * padsize = (4 - hdrlen % 4) % 4; However, since only
> +	 * padsize = (4 - padpos % 4) % 4; However, since only
>  	 * even-length headers are used, padding can only be 0 or 2
>  	 * bytes and we can optimize this a bit. In addition, we must
>  	 * not try to remove padding from short control frames that do
>  	 * not have payload. */
> -	padsize = hdrlen & 3;
> -	if (padsize && hdrlen >= 24) {
> -		memmove(skb->data + padsize, skb->data, hdrlen);
> +	padsize = padpos & 3;
> +	if (padsize && skb->len>=padpos+padsize+FCS_LEN) {
> +		memmove(skb->data + padsize, skb->data, padpos);
>  		skb_pull(skb, padsize);
>  	}
>  
>   


  parent reply	other threads:[~2009-11-24 14:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-24 14:49 [PATCH] ath9k: This patch fix RX unpadding for any received frame Benoit Papillault
2009-11-24 14:49 ` [PATCH 2/2] ath9k: Proper padding/unpadding for the TX/RX path Benoit Papillault
2009-11-24 14:51 ` Benoit PAPILLAULT [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-11-19 21:19 [PATCH] ath9k: This patch fix RX unpadding for any received frame Benoit Papillault
2009-11-19 21:25 ` John W. Linville
2009-11-19 21:36   ` Benoit PAPILLAULT
2009-11-20 17:17 ` Luis R. Rodriguez
2009-11-20 21:22   ` Benoit PAPILLAULT

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=4B0BF2E2.20307@free.fr \
    --to=benoit.papillault@free.fr \
    --cc=ath9k-devel@lists.ath9k.org \
    --cc=jmalinen@atheros.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lrodriguez@atheros.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).