All of lore.kernel.org
 help / color / mirror / Atom feed
From: Senthil Balasubramanian <senthilkumar@atheros.com>
To: Jouni Malinen <jouni.malinen@atheros.com>
Cc: "John W. Linville" <linville@tuxdriver.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"ath9k-devel@venema.h4ckr.net" <ath9k-devel@venema.h4ckr.net>
Subject: Re: [PATCH] ath9k: Do not remove header padding on RX from short frames
Date: Fri, 12 Dec 2008 15:54:05 +0530	[thread overview]
Message-ID: <20081212102405.GA10231@senthil-lnx.users.atheros.com> (raw)
In-Reply-To: <20081211162213.GA28193@jm.kir.nu>

On Thu, Dec 11, 2008 at 09:52:13PM +0530, Jouni Malinen wrote:
> The 802.11 header is only padded to 32-bit boundary when the frame has
> a non-zero length payload. In other words, control frames (e.g., ACK)
> do not have a padding and we should not try to remove it. This fixes
> monitor mode for short control frames. In addition, the hdrlen&3 use
> is described in more detail to make it easier to understand how the
> padding length is calculated.
> 
> Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
> 
> ---
>  drivers/net/wireless/ath9k/recv.c |   12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> --- wireless-testing.orig/drivers/net/wireless/ath9k/recv.c     2008-12-11 11:35:56.000000000 +0200
> +++ wireless-testing/drivers/net/wireless/ath9k/recv.c  2008-12-11 12:18:02.000000000 +0200
> @@ -571,8 +571,16 @@ int ath_rx_tasklet(struct ath_softc *sc,
>                 hdr = (struct ieee80211_hdr *)skb->data;
>                 hdrlen = ieee80211_get_hdrlen_from_skb(skb);
> 
> -               if (hdrlen & 3) {
> -                       padsize = hdrlen % 4;
> +               /* 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
> +                * 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) {
I think "if(padsize && hdrlen > 24)" should be sufficient here as padsize is
anyway zero for hdlen==24.
>                         memmove(skb->data + padsize, skb->data, hdrlen);
>                         skb_pull(skb, padsize);
>                 }
> 
> --
> Jouni Malinen                                            PGP id EFC895FA
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Senthil Balasubramanian <senthilkumar@atheros.com>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [PATCH] ath9k: Do not remove header padding on RX from short	frames
Date: Fri, 12 Dec 2008 15:54:05 +0530	[thread overview]
Message-ID: <20081212102405.GA10231@senthil-lnx.users.atheros.com> (raw)
In-Reply-To: <20081211162213.GA28193@jm.kir.nu>

On Thu, Dec 11, 2008 at 09:52:13PM +0530, Jouni Malinen wrote:
> The 802.11 header is only padded to 32-bit boundary when the frame has
> a non-zero length payload. In other words, control frames (e.g., ACK)
> do not have a padding and we should not try to remove it. This fixes
> monitor mode for short control frames. In addition, the hdrlen&3 use
> is described in more detail to make it easier to understand how the
> padding length is calculated.
> 
> Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
> 
> ---
>  drivers/net/wireless/ath9k/recv.c |   12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> --- wireless-testing.orig/drivers/net/wireless/ath9k/recv.c     2008-12-11 11:35:56.000000000 +0200
> +++ wireless-testing/drivers/net/wireless/ath9k/recv.c  2008-12-11 12:18:02.000000000 +0200
> @@ -571,8 +571,16 @@ int ath_rx_tasklet(struct ath_softc *sc,
>                 hdr = (struct ieee80211_hdr *)skb->data;
>                 hdrlen = ieee80211_get_hdrlen_from_skb(skb);
> 
> -               if (hdrlen & 3) {
> -                       padsize = hdrlen % 4;
> +               /* 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
> +                * 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) {
I think "if(padsize && hdrlen > 24)" should be sufficient here as padsize is
anyway zero for hdlen==24.
>                         memmove(skb->data + padsize, skb->data, hdrlen);
>                         skb_pull(skb, padsize);
>                 }
> 
> --
> Jouni Malinen                                            PGP id EFC895FA
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2008-12-12 10:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-11 16:22 [PATCH] ath9k: Do not remove header padding on RX from short frames Jouni Malinen
2008-12-11 16:22 ` [ath9k-devel] " Jouni Malinen
2008-12-11 19:49 ` Bob Copeland
2008-12-11 19:49   ` [ath9k-devel] " Bob Copeland
2008-12-11 20:10   ` Jouni Malinen
2008-12-11 20:10     ` [ath9k-devel] " Jouni Malinen
2008-12-13 15:28     ` [ath9k-devel] 2.6.28-rc8-wl Connection status bug? Brian
2008-12-12 10:24 ` Senthil Balasubramanian [this message]
2008-12-12 10:24   ` [ath9k-devel] [PATCH] ath9k: Do not remove header padding on RX from short frames Senthil Balasubramanian

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=20081212102405.GA10231@senthil-lnx.users.atheros.com \
    --to=senthilkumar@atheros.com \
    --cc=ath9k-devel@venema.h4ckr.net \
    --cc=jouni.malinen@atheros.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.