linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shaddy Baddah <shaddy_baddah@hotmail.com>
To: Johannes Berg <johannes@sipsolutions.net>,
	linux-wireless@vger.kernel.org
Subject: Re: zd1211rw (2.6.26 sparc64): unaligned access (zd_mac_rx)
Date: Mon, 10 Nov 2008 01:20:48 +1100	[thread overview]
Message-ID: <BAY104-DAV13111B5239758324EF2350991B0@phx.gbl> (raw) (sfid-20081109_152106_673161_702761DF)
Message-ID: <4916F1C0.1040703@hotmail.com> (raw)
In-Reply-To: <1226220992.3614.16.camel@johannes.berg>

Hi,

On 09/11/08 19:56, Johannes Berg wrote:
> Yes, I think you're right, it appears that the 802.11 header isn't
> aligned on a 2-byte boundary, which is extremely strange. Can you, with
> your patch applied, do something like
> 
> 	printk(KERN_DEBUG "%p\n", skb->data);
> 
> before this code in zd_mac.c:
> 
>         memcpy(skb_put(skb, length), buffer, length);
> 
>         ieee80211_rx_irqsafe(hw, skb, &stats);

I have done this... but I think that there is too much output to place 
here. What I can tell you with confidence is that every value is 4-byte 
aligned.

However, I modify filter_ack() in zd_mac.c so that the code looks like this:

         for (skb = q->next; skb != (struct sk_buff *)q; skb = skb->next) {
                 struct ieee80211_hdr *tx_hdr;

                 tx_hdr = (struct ieee80211_hdr *)skb->data;
         printk(KERN_DEBUG "%s:%u: skb %p skb->data %p tx_hdr->addr2 %p 
rx_hdr->addr1 %p\n", __FILE__, __LINE__, skb, skb->data, tx_hdr->addr2, 
rx_hdr->addr1);
                 //if (likely(!memcmp(tx_hdr->addr2, rx_hdr->addr1, 
ETH_ALEN)))
                 if (likely(!compare_ether_addr(tx_hdr->addr2, 
rx_hdr->addr1)))
                 {

(note, I re-instated the compare_ether_addr() so that I could be sure 
that the unaligned access corresponded with whatever values I was seeing 
in the print).

Here is the output of the first print from this location that I see in 
syslog:

Nov 10 00:47:17 trad kernel: [ 8239.534950] 
drivers/net/wireless/zd1211rw/zd_mac.c:639: skb fffff8003d0d8fc0 
skb->data fffff8003d874cdb tx_hdr->addr2 fffff8003d874ce5 rx_hdr->addr1 
fffff8003f3e0009
Nov 10 00:47:17 trad kernel: [ 8239.534986] Kernel unaligned access at 
TPC[100f5bd0] zd_mac_rx+0x1b0/0x398 [zd1211rw]
Nov 10 00:47:17 trad kernel: [ 8239.637697] Kernel unaligned access at 
TPC[100f5bd4] zd_mac_rx+0x1b4/0x398 [zd1211rw]
Nov 10 00:47:17 trad kernel: [ 8239.740208] Kernel unaligned access at 
TPC[100f5bd8] zd_mac_rx+0x1b8/0x398 [zd1211rw]
Nov 10 00:47:17 trad kernel: [ 8239.842417] Kernel unaligned access at 
TPC[100f5bdc] zd_mac_rx+0x1bc/0x398 [zd1211rw]
Nov 10 00:47:17 trad kernel: [ 8239.944583] Kernel unaligned access at 
TPC[100f5be0] zd_mac_rx+0x1c0/0x398 [zd1211rw]

So you can see that skb->data is not even 2-byte aligned. And my debug 
leads me to believe that the problem is this line in zd_mac_tx_to_dev():

                  skb_pull(skb, sizeof(struct zd_ctrlset));

A before and after of this line gives me this output:

Nov 10 00:47:17 trad kernel: [ 8239.534065] 
drivers/net/wireless/zd1211rw/zd_mac.c:376: skb fffff8003d0d8fc0 
skb->data fffff8003d874cd0
Nov 10 00:47:17 trad kernel: [ 8239.534092] 
drivers/net/wireless/zd1211rw/zd_mac.c:390: skb fffff8003d0d8fc0 
skb->data fffff8003d874cdb

Perhaps there needs to be some padding there?

Also, I've just had a look at the git version of zd_mac.c, and I notice 
it is all change there again. I would feel uncomfortable having studied 
the 2.6.26 code to have to start again. Is it expected that I use the 
latest available via git?

Thanks in advance,
Shaddy


  parent reply	other threads:[~2008-11-09 14:21 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-25  8:54 zd1211rw (2.6.26 sparc64): unaligned access (zd_mac_rx) Shaddy Baddah
2008-10-25  9:17 ` Johannes Berg
2008-10-25 11:25   ` Sebastian Andrzej Siewior
2008-10-25 12:05     ` Johannes Berg
2008-10-26 22:00       ` Sebastian Andrzej Siewior
2008-10-27  7:00         ` Johannes Berg
2008-10-25 11:21 ` Sebastian Andrzej Siewior
2008-10-25 11:25   ` Michael Buesch
2008-10-25 11:28     ` Sebastian Andrzej Siewior
2008-10-25 11:31       ` Michael Buesch
2008-10-25 11:38         ` Sebastian Andrzej Siewior
2008-10-25 15:13       ` Shaddy Baddah
     [not found]         ` <491589ED.4090904@hotmail.com>
2008-11-08 12:45           ` Shaddy Baddah
2008-11-08 13:11           ` Johannes Berg
     [not found]             ` <491653A6.20705@hotmail.com>
2008-11-09  3:06               ` Shaddy Baddah
     [not found]                 ` <49165436.4040306@hotmail.com>
2008-11-09  3:08                   ` Shaddy Baddah
2008-11-09 12:00                 ` Michael Buesch
2008-11-09  8:56               ` Johannes Berg
2008-11-09  9:03                 ` Johannes Berg
2008-11-09 12:02                   ` Michael Buesch
2008-11-09 18:31                     ` Johannes Berg
     [not found]                 ` <4916F1C0.1040703@hotmail.com>
2008-11-09 14:20                   ` Shaddy Baddah [this message]
     [not found]                   ` <49184F82.9070102@hotmail.com>
2008-11-10 15:13                     ` Shaddy Baddah
     [not found]                       ` <492F82EA.4030902@hotmail.com>
2008-11-28  5:34                         ` Shaddy Baddah
2008-11-28  7:10                           ` David Miller
2008-11-28 22:44                           ` Michael Buesch
     [not found]                             ` <49310454.60906@hotmail.com>
2008-11-29  8:59                               ` Shaddy Baddah
2008-11-29  9:50                               ` Johannes Berg
     [not found]                                 ` <49313C0E.9030309@hotmail.com>
2008-11-29 12:56                                   ` Shaddy Baddah
     [not found]       ` <492F856D.9020200@hotmail.com>
2008-11-28  5:45         ` Shaddy Baddah
2008-11-28  6:47         ` Harvey Harrison

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=BAY104-DAV13111B5239758324EF2350991B0@phx.gbl \
    --to=shaddy_baddah@hotmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@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).