From: Grant Grundler <grundler@parisc-linux.org>
To: Michael Chan <mchan@broadcom.com>
Cc: 'Grant Grundler' <grundler@parisc-linux.org>,
Matthew Carlson <mcarlson@broadcom.com>,
James Bottomley <James.Bottomley@HansenPartnership.com>,
"linux-netdev@vger.kernel.org" <linux-netdev@vger.kernel.org>,
Parisc List <linux-parisc@vger.kernel.org>
Subject: Re: [PATCH] tg3: fix big endian MAC address collection failure
Date: Sun, 19 Apr 2009 16:32:02 -0600 [thread overview]
Message-ID: <20090419223201.GA22926@lackof.org> (raw)
In-Reply-To: <C27F8246C663564A84BB7AB343977242177D75A059@IRVEXCHCCR01.corp.ad.broadcom.com>
On Sun, Apr 19, 2009 at 12:30:26AM -0700, Michael Chan wrote:
[ Deleted my comments about indirect function calls. ]
...
> We've had a lengthy discussion on this topic with DaveM and jgarzik many
> years ago. Marc is down and I cannot find the archive. It was agreed
> that the function pointer approach is better than a cascade of if -
> else if - else if approach. The Branch target buffers in modern CPUs
> are supposed to be able to predict these function pointer branches
> if we are using the same method in the hot code path.
Ok - thanks. I can look for that.
...
> > The data is not a byte stream (yet) since we used readl() to retrieve
> > the value. Use cpu_to_le32() to convert what was originally an LE byte
> > stream back to a LE byte stream.
> >
> > Using either __raw_read() or readb() would have avoided this
> > confusion.
>
> It's a 32-bit so we cannot use readb(). I don't think the chip will decode
> the byte enables.
Ok. Thanks for clarifying.
> I don't like to use __raw_read() because it does not have
> the same memory barrier as regular readl().
I don't think the memory barrier is necessary in the "get" case.
wmb() is probably needed in the "set" case.
I was thinking that avoiding several byte swaps would make the code
more maintainable and one wmb() could be explained with a comment.
Remember, we are having this conversation because the MAC address
was incorrectly ordered on BE machine. Seems that a "load from NVRAM"
and "Store to HostMem" preserves the byte stream order in the same
way memcpy would. And would be heck of a lot easier to understand.
thanks,
grant
next prev parent reply other threads:[~2009-04-19 22:32 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-13 15:21 [PATCH] tg3: fix big endian MAC address collection failure James Bottomley
2009-04-13 18:00 ` Matt Carlson
2009-04-13 18:04 ` Kyle McMartin
2009-04-13 18:13 ` Matt Carlson
2009-04-13 18:18 ` James Bottomley
2009-04-13 18:24 ` Matt Carlson
2009-04-13 18:15 ` James Bottomley
2009-04-13 18:37 ` Matt Carlson
2009-04-13 20:48 ` James Bottomley
2009-04-14 1:17 ` Matt Carlson
2009-04-14 15:39 ` Grant Grundler
2009-04-14 19:02 ` Matt Carlson
2009-04-18 23:00 ` Grant Grundler
2009-04-19 7:30 ` Michael Chan
2009-04-19 22:32 ` Grant Grundler [this message]
2009-04-20 20:46 ` Matt Carlson
-- strict thread matches above, loose matches on Subject: below --
2009-04-13 15:29 James Bottomley
2009-04-13 21:32 ` David Miller
2009-04-13 21:42 ` James Bottomley
2009-04-13 21:44 ` David Miller
2009-04-13 22:17 ` Michael Chan
2009-04-13 22:32 ` James Bottomley
2009-04-14 1:25 ` Matt Carlson
2009-04-14 1:40 ` David Miller
2009-04-14 2:00 ` Matt Carlson
2009-04-14 2:19 ` Kyle McMartin
2009-04-14 2:51 ` David Miller
2009-04-14 3:56 ` Michael Chan
2009-04-14 3:51 ` James Bottomley
2009-04-14 4:11 ` Michael Chan
2009-04-14 15:26 ` James Bottomley
2009-04-14 15:31 ` Robin Holt
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=20090419223201.GA22926@lackof.org \
--to=grundler@parisc-linux.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=linux-netdev@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=mcarlson@broadcom.com \
--cc=mchan@broadcom.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox