From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Stephen Hemminger <shemminger@osdl.org>
Cc: netdev@vger.kernel.org
Subject: Re: sky2 problem on powerpc
Date: Mon, 04 Sep 2006 17:21:09 +1000 [thread overview]
Message-ID: <1157354470.22705.26.camel@localhost.localdomain> (raw)
In-Reply-To: <1157347462.22705.16.camel@localhost.localdomain>
> Because if you look at the definition for:
>
> struct sky2_rx_le {
> __le32 addr;
> __le16 length;
> u8 ctrl;
> u8 opcode;
> } __attribute((packed));
>
> (As an example)
>
> If the chips does LE accesses, then marking "lenght" as being an LE
> value isn't enough. It also needs to be swapped with ctrl and opcode.
> The layout then becomes:
>
> struct sky2_rx_le {
> __le32 addr;
> u8 opcode;
> u8 ctrl;
> __le16 length;
> } __attribute((packed));
And of course, I'm stupid... the structure layout in memory is well
defined and the chip is accessing it just fine... The problem are
actually related to
- That special "reverse" descriptor bit one can set in the chip....
That will indeed cause my scenario above to happen by causing the chip
to do a 32 bits byteswap it seems. But if we set this bit, we must also
remove all of the cpu_to_le/le_to_cpu conversions used to access
descriptors.
- I've decided not to set that bit for now, thus disabled the code
doing so (and thus requiring be/le conversions). We have cases where
they are missing, and thus it's not working.
I'm trying to get it right now, will send a patch if I can get something
working. At one point, I suppose I'll have the choice of either letting
the HW do the 32 bits flip, which involves playing #ifdef __BIG_ENDIAN
with the structures in sky2.h or just ignore that bit and do cpu_to_le*
when needed. I'm tempted to do the later...
Ben
--
VGER BF report: U 0.526041
next prev parent reply other threads:[~2006-09-04 7:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-04 5:24 sky2 problem on powerpc Benjamin Herrenschmidt
2006-09-04 7:21 ` Benjamin Herrenschmidt [this message]
2006-09-04 7:42 ` Benjamin Herrenschmidt
2006-09-04 21:05 ` Segher Boessenkool
2006-09-04 21:33 ` Benjamin Herrenschmidt
2006-09-05 3:41 ` Stephen Hemminger
2006-09-05 3:47 ` Benjamin Herrenschmidt
2006-09-05 4:15 ` Stephen Hemminger
2006-09-05 21:11 ` Benjamin Herrenschmidt
2006-09-05 21:36 ` Stephen Hemminger
2006-09-05 22:00 ` Benjamin Herrenschmidt
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=1157354470.22705.26.camel@localhost.localdomain \
--to=benh@kernel.crashing.org \
--cc=netdev@vger.kernel.org \
--cc=shemminger@osdl.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).