From: Ulrich Kunitz <kune@deine-taler.de>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Daniel Drake <dsd@gentoo.org>,
"David S. Miller" <davem@davemloft.net>,
netdev <netdev@vger.kernel.org>,
linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: wireless vs. alignment requirements
Date: Sat, 24 Nov 2007 14:11:29 +0100 [thread overview]
Message-ID: <20071124131128.GA28785@deine-taler.de> (raw)
In-Reply-To: <1195850001.4149.165.camel@johannes.berg>
Johannes,
> Hence, going back to the 802.11 header and the IP header alignment
> requirement, if we get the IP header alignment requirement right now I
> cannot possibly see any way we would use compare_ether_addr() on an
> address that is not at least two-byte aligned as required.
ACK. I agree completely.
The problem with the zd1211rw driver is, that it copies the
complete frame received from the device into the SKB and pulls
later the five bytes ZD1211 uses for the PLCP information.
This causes the 802.11 header to be on an odd address. The
reported problems are caused by this.
The zd1211rw-mac80211 is not affected, because the PLCP header is
not copied into the skb and this way the 802.11 header becomes
correctly aligned.
Here is a patch, which should solve the zd1211rw alignment issues.
It compiles, but it is not tested right now, because I got the
idea while writing this e-mail. An official submission will
follow.
Uli
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index a903645..fb54cd7 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -1166,15 +1166,22 @@ static void do_rx(unsigned long mac_ptr)
int zd_mac_rx_irq(struct zd_mac *mac, const u8 *buffer, unsigned int length)
{
struct sk_buff *skb;
+ unsigned int length_to_reserve;
- skb = dev_alloc_skb(sizeof(struct zd_rt_hdr) + length);
+ /* This ensures that there is enough place for the radiotap header
+ * and the the 802.11 header is aligned by four following the
+ * five-byte ZD1211-specific PLCP header.
+ */
+ length_to_reserve = ((sizeof(struct zd_rt_hdr) + 3) & ~3) + 3;
+
+ skb = dev_alloc_skb(length_to_reserve + length);
if (!skb) {
struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
dev_warn(zd_mac_dev(mac), "Could not allocate skb.\n");
ieee->stats.rx_dropped++;
return -ENOMEM;
}
- skb_reserve(skb, sizeof(struct zd_rt_hdr));
+ skb_reserve(skb, length_to_reserve);
memcpy(__skb_put(skb, length), buffer, length);
skb_queue_tail(&mac->rx_queue, skb);
tasklet_schedule(&mac->rx_tasklet);
--
Uli Kunitz
prev parent reply other threads:[~2007-11-24 13:41 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-23 0:09 [PATCH] add compare_ether_addr_unaligned Daniel Drake
2007-11-23 4:11 ` Stephen Hemminger
2007-11-23 13:26 ` Herbert Xu
2007-11-26 10:39 ` Herbert Xu
2007-11-23 20:33 ` wireless vs. alignment requirements Johannes Berg
[not found] ` <1195850001.4149.165.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2007-11-24 6:15 ` Herbert Xu
2007-11-24 8:33 ` Johannes Berg
2007-11-24 13:32 ` Herbert Xu
[not found] ` <20071124133200.GA27531-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2007-11-24 13:49 ` Johannes Berg
2007-11-24 13:51 ` David Miller
2007-11-24 14:13 ` Herbert Xu
[not found] ` <20071124141319.GA27819-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2007-11-24 20:11 ` Stephen Hemminger
[not found] ` <4748855C.5090103-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2007-11-24 21:33 ` Johannes Berg
2007-11-25 1:08 ` Herbert Xu
[not found] ` <20071125010814.GD31668-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2007-11-25 21:21 ` Stephen Hemminger
[not found] ` <4749E768.9040002-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2007-11-26 1:38 ` Herbert Xu
2007-11-27 17:16 ` H. Peter Anvin
2007-11-27 17:16 ` H. Peter Anvin
[not found] ` <474C50D7.5010901-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
2007-11-27 18:39 ` Stephen Hemminger
[not found] ` <20071127103940.314c7844-s08KbqtN0aBORcJjwVk881hTQxXnIo14@public.gmane.org>
2007-11-28 2:42 ` H. Peter Anvin
2007-11-29 13:11 ` Herbert Xu
2007-11-29 17:50 ` H. Peter Anvin
2007-11-30 0:26 ` Herbert Xu
[not found] ` <20071130002621.GI23769-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2007-11-30 0:28 ` H. Peter Anvin
[not found] ` <474F5932.1030103-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
2007-11-30 0:34 ` Herbert Xu
[not found] ` <20071130003426.GJ23769-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2007-11-30 0:41 ` H. Peter Anvin
2007-11-24 21:13 ` Johannes Berg
[not found] ` <1195938799.4149.197.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2007-11-25 1:44 ` Herbert Xu
[not found] ` <20071125014446.GA32104-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2007-11-25 11:00 ` Johannes Berg
[not found] ` <1195988428.4149.225.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2007-11-25 11:22 ` Herbert Xu
2007-11-25 13:54 ` Johannes Berg
[not found] ` <1195998864.4149.229.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2007-11-25 14:01 ` Herbert Xu
2007-11-25 17:04 ` Johannes Berg
[not found] ` <1196010257.4149.234.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2007-11-26 1:36 ` Herbert Xu
2007-11-24 13:11 ` Ulrich Kunitz [this message]
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=20071124131128.GA28785@deine-taler.de \
--to=kune@deine-taler.de \
--cc=davem@davemloft.net \
--cc=dsd@gentoo.org \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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).