mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Francois Romieu <romieu@fr.zoreil.com>
To: Krzysztof Halasa <khc@pm.waw.pl>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	jgarzik@pobox.com, David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Alistair John Strachan <alistair@devzero.co.uk>,
	Ivan Vecera <ivecera@redhat.com>,
	Chuck Ebbert <cebbert@redhat.com>,
	Petr Vandrovec <petr@vandrovec.name>,
	Plamen Petrov <pvp-lsts@fs.ru.acad.bg>,
	Ilpo J?rvinen <ilpo.jarvinen@helsinki.fi>,
	"J.A. Magall?n" <jamagallon@ono.com>,
	Jiri Slaby <jirislaby@gmail.com>,
	Simon Arlott <simon@fire.lp0.eu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Edward Hsu <edward_hsu@realtek.com.tw>
Subject: Re: [PATCH 1/1] r8169: revert "read MAC address from EEPROM on init"
Date: Sun, 26 Oct 2008 23:22:24 +0100	[thread overview]
Message-ID: <20081026222224.GC24790@electric-eye.fr.zoreil.com> (raw)
In-Reply-To: <m3wsfvhx8c.fsf@maximus.localdomain>

Krzysztof Halasa <khc@pm.waw.pl> :
[...]
> Ahh, just PCI VPD.
> 
> IMHO the above shouldn't hurt anyone, in theory. You only write to
> VPD_ADDR, and to change actual VPD data (i.e., EEPROM), you need to
> write to VPD_DATA.
> 
> Anyone should be allowed to do that even for unknown PCI devices
> without a problem.

Theorically, yes.

In practice I noticed rather different behaviors between a 8168b and
a 8110s when I tried accessing the eeprom through plain old bitbang
a few months ago (i.e. ok on the 8110, lots of zero on the 8168b).

> > -static void rtl_init_mac_address(struct rtl8169_private *tp,
> 
> > -	if (!(cfg1  & VPD)) {
> > -		if (netif_msg_probe(tp))
> > -			dev_info(&pdev->dev, "VPD access disabled, enabling\n");
> > -		RTL_W8(Cfg9346, Cfg9346_Unlock);
> > -		RTL_W8(Config1, cfg1 | VPD);
> > -		RTL_W8(Cfg9346, Cfg9346_Lock);
> 
> Now I wonder what do they say the above does exactly.
> Unfortunately the docs don't seem to be public.

Realtek's legal department has changed his mind :o(

>From what I had received beforehand:

RTL8169:  R/W Set to enable Vital Product Data. The VPD data is stored in
          93C46 or 93c56 from within offset 40h-7fh.

RTL8168C: R (huh ?) Set to enable Vital Product Data. Always 1.

[...]
> > -	if (netif_msg_probe(tp)) {
> > -		DECLARE_MAC_BUF(buf);
> > -
> > -		dev_info(&pdev->dev, "MAC address found in EEPROM: %s\n",
> > -			 print_mac(buf, mac));
> > -	}
> > -
> > -	if (is_valid_ether_addr(mac))
> > -		rtl_rar_set(tp, mac);
> > -}
> 
> No RTL_W8(Config1, cfg1 | ~VPD) to disable (perhaps R/W) access?

Apparently not. See above.

> Though obviously first reading a good address from the EEPROM and then
> erasing first 32 bits is a different story.

Yes.

> I wonder if changing the MAC address by hand works (using ifconfig, to
> arbitrary address).

It does. It can be quite sticky. That was the whole point of the
patch.

-- 
Ueimor

  parent reply	other threads:[~2008-10-26 22:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-26 16:02 Francois Romieu
2008-10-26 16:26 ` Jeff Garzik
     [not found] ` <m3wsfvhx8c.fsf@maximus.localdomain>
2008-10-26 22:22   ` Francois Romieu [this message]
2008-10-27 14:49     ` Krzysztof Halasa
2008-10-27 22:29 ` Krzysztof Halasa

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=20081026222224.GC24790@electric-eye.fr.zoreil.com \
    --to=romieu@fr.zoreil.com \
    --cc=akpm@linux-foundation.org \
    --cc=alistair@devzero.co.uk \
    --cc=cebbert@redhat.com \
    --cc=davem@davemloft.net \
    --cc=edward_hsu@realtek.com.tw \
    --cc=ilpo.jarvinen@helsinki.fi \
    --cc=ivecera@redhat.com \
    --cc=jamagallon@ono.com \
    --cc=jgarzik@pobox.com \
    --cc=jirislaby@gmail.com \
    --cc=khc@pm.waw.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=petr@vandrovec.name \
    --cc=pvp-lsts@fs.ru.acad.bg \
    --cc=simon@fire.lp0.eu \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®