All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Chan" <mchan@broadcom.com>
To: "James Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: "David Miller" <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-parisc@vger.kernel.org" <linux-parisc@vger.kernel.org>,
	"Matthew Carlson" <mcarlson@broadcom.com>
Subject: Re: [PATCH] tg3: fix big endian MAC address collection failure
Date: Mon, 13 Apr 2009 15:17:39 -0700	[thread overview]
Message-ID: <1239661059.9237.4.camel@HP1> (raw)
In-Reply-To: <1239658951.3278.104.camel@mulgrave.int.hansenpartnership.com>


On Mon, 2009-04-13 at 14:42 -0700, James Bottomley wrote:

> ---
> On Mon, 2009-04-13 at 11:37 -0700, Matt Carlson wrote:
> > But that is exactly what the code is doing.  tg3_nvram_read_be32() will
> > return the data in bytestream format.  A memcpy() should be all that is
> > needed to transport the data to a different memory location.
> 
> But not the one you've done.  cpu_to_be32 is a nop pass through on our
> architecture, so tg3_nvram_read_be32 is equivalent to tg3_nvram_read on
> our architecture (i.e. identical to the code that was doing the read in
> 2.6.29).  However, the memcpy is the wrong way around for us.  If you
> look at an example, the original code said

The old tg3_nvram_read() had a swab32() after the readl().  The new
tg3_nvram_read() no longer has the swab32().  There were too many layers
of swapping in the old code and that's why Matt wanted to clean it up.

James, can do dump out the nvram content on the parisc?

ethtool -e eth0 length 0x90

Thanks.

> 
> dev_addr[0] = hi >> 16;
> dev_addr[1] = hi >> 24
> 
> So MSB-1 and MSB.  However, on a BE machine these are at offset one and
> zero from the start of the word.  The replacement memcopy is:
> 
> memcpy(&dev->dev_addr[0], ((char *)&hi) + 2, 2)
> 
> i.e. offset 3 and 4, which actually copies LSB-1 and LSB into there.
> You can follow similar logic to show that the lo copy is wrong too.
> 
> Perhaps the fix is just to put the tg3_nvram_read() back as well as the
> original by loads?
> ---
> 
> James
> 
> 
> 



  parent reply	other threads:[~2009-04-13 22:17 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-13 15:29 [PATCH] tg3: fix big endian MAC address collection failure 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 [this message]
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
  -- strict thread matches above, loose matches on Subject: below --
2009-04-13 15:21 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
2009-04-20 20:46                     ` Matt Carlson

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=1239661059.9237.4.camel@HP1 \
    --to=mchan@broadcom.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=davem@davemloft.net \
    --cc=linux-parisc@vger.kernel.org \
    --cc=mcarlson@broadcom.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.