* [PATCH] ath9k: Do not remove header padding on RX from short frames
@ 2008-12-11 16:22 Jouni Malinen
2008-12-11 19:49 ` Bob Copeland
2008-12-12 10:24 ` Senthil Balasubramanian
0 siblings, 2 replies; 4+ messages in thread
From: Jouni Malinen @ 2008-12-11 16:22 UTC (permalink / raw)
To: John W. Linville; +Cc: linux-wireless, ath9k-devel
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) {
memmove(skb->data + padsize, skb->data, hdrlen);
skb_pull(skb, padsize);
}
--
Jouni Malinen PGP id EFC895FA
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ath9k: Do not remove header padding on RX from short frames
2008-12-11 16:22 [PATCH] ath9k: Do not remove header padding on RX from short frames Jouni Malinen
@ 2008-12-11 19:49 ` Bob Copeland
2008-12-11 20:10 ` Jouni Malinen
2008-12-12 10:24 ` Senthil Balasubramanian
1 sibling, 1 reply; 4+ messages in thread
From: Bob Copeland @ 2008-12-11 19:49 UTC (permalink / raw)
To: Jouni Malinen
Cc: John W. Linville, linux-wireless, ath9k-devel, Patrick McHardy
On Thu, Dec 11, 2008 at 11:22 AM, Jouni Malinen
<jouni.malinen@atheros.com> 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.
Thanks Jouni, that clears up the question of the same code in ath5k
(http://marc.info/?l=linux-wireless&m=122888546315200&w=2).
--
Bob Copeland %% www.bobcopeland.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ath9k: Do not remove header padding on RX from short frames
2008-12-11 19:49 ` Bob Copeland
@ 2008-12-11 20:10 ` Jouni Malinen
0 siblings, 0 replies; 4+ messages in thread
From: Jouni Malinen @ 2008-12-11 20:10 UTC (permalink / raw)
To: Bob Copeland
Cc: John W. Linville, linux-wireless@vger.kernel.org,
ath9k-devel@venema.h4ckr.net, Patrick McHardy
On Thu, 2008-12-11 at 11:49 -0800, Bob Copeland wrote:
> On Thu, Dec 11, 2008 at 11:22 AM, Jouni Malinen
> <jouni.malinen@atheros.com> wrote:
> > The 802.11 header is only padded to 32-bit boundary when the frame has
> > a non-zero length payload.
> Thanks Jouni, that clears up the question of the same code in ath5k
> (http://marc.info/?l=linux-wireless&m=122888546315200&w=2).
Yes, the same rules on 802.11 header padding applies to ath5k.
- Jouni
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ath9k: Do not remove header padding on RX from short frames
2008-12-11 16:22 [PATCH] ath9k: Do not remove header padding on RX from short frames Jouni Malinen
2008-12-11 19:49 ` Bob Copeland
@ 2008-12-12 10:24 ` Senthil Balasubramanian
1 sibling, 0 replies; 4+ messages in thread
From: Senthil Balasubramanian @ 2008-12-12 10:24 UTC (permalink / raw)
To: Jouni Malinen
Cc: John W. Linville, linux-wireless@vger.kernel.org,
ath9k-devel@venema.h4ckr.net
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-12-12 10:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-11 16:22 [PATCH] ath9k: Do not remove header padding on RX from short frames Jouni Malinen
2008-12-11 19:49 ` Bob Copeland
2008-12-11 20:10 ` Jouni Malinen
2008-12-12 10:24 ` Senthil Balasubramanian
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).