From: Sergey Vlasov <vsu@altlinux.ru>
To: Ivan Vecera <ivecera@redhat.com>
Cc: Alan Jenkins <sourcejedi.lkml@googlemail.com>,
Francois Romieu <romieu@fr.zoreil.com>,
marty <marty@goodoldmarty.com>,
linux-hotplug@vger.kernel.org, netdev <netdev@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Mikael Pettersson <mikpe@it.uu.se>
Subject: Re: r8189 mac address changes persist across reboot (was: duplicate MAC addresses)
Date: Wed, 2 Sep 2009 18:32:53 +0400 [thread overview]
Message-ID: <20090902143253.GA3239@newmaster.mivlgu.local> (raw)
In-Reply-To: <4A9CD443.6030603@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3231 bytes --]
On Tue, Sep 01, 2009 at 09:58:59AM +0200, Ivan Vecera wrote:
> Alan Jenkins napsal(a):
[...]
> > Looking at r8169.c confirms this. It doesn't appear to initialize the
> > MAC address register from elsewhere; it just uses the current value.
> > It will also report this initial value as the "permanent" MAC address,
> > which your report suggests is wrong. I think your problem is a bug in
> > r8169.
> >
> > Francois, I found a datasheet for the 8139; it was claimed to be
> > similar and it does indeed appear so. The datasheet suggests that the
> > driver needs to provoke "auto-load" from the EEPROM at load time.
> > Could you please have a look at fixing this, so that MAC address
> > changes do not persist over a reboot?
> >
> Using auto-loading method is not possible for all new Realtek products
> (mainly for PCI-E chipsets). I asked the Realtek engineers and this
> is the answer:
> Q: Is it possible to use HW register at offset 50h to reload the MAC
> address from EEPROM or somewhere else? I mean the usage of Auto-load
> mode (bits EEM1=0 and EEM0=1 in 50h HW reg).
> A: Current new LANs don't load mac address throught autoload command.
> You need to read it out from external eeprom or internal efuse then
> put it back to ID0~ID5.
>
> So you need to read the MAC address from the EEPROM and then write it into
> ID0-ID5 registers. I already created the patch that initializes the MAC
> address from EEPROM but there were some issues with this patch so it was
> reverted. Mikael reported that the MAC address from its adapter (on Thecus
> n2100) is read only partly (first 3 bytes were correct but the rest were
> zeros). Later we found that the MAC address is correct and there are really
> 3 correct bytes + 3 zeros in EEPROM. The Thecus n2100 system probably uses
> only these 3 bytes and the remaining 3 bytes fills in by itself (they are
> probably stored somewhere in the firmware).
Unfortunately, this kind of crap (crucial information such as MAC
addresses stored in places known only to some proprietary firmware) is
too common with recent devices (e.g., forcedeth has the same problem
even on PCs).
> I have tested my patch with several different realtek NICs without any
> problem but what should we do with embedded system like the n2100 that
> initializes the MAC in other way.
>
> There are 2 possibilities:
> 1) There could be an additional module param to enable/disable the MAC
> initialization
> 2) The MAC address read from EEPROM will be checked against the current
> MAC address in ID0-5 registers. And the current MAC will be replaced
> by the one from EEPROM only if the first 3 bytes (OUI part) are
> different.
3) Try the same solution as forcedeth does - save original contents
of MAC address registers in rtl8169_init_one() (we already have
perm_addr available for this; forcedeth uses a separate variable
due to its "reversed MAC" brain damage), then restore MAC to its
initial state in rtl8169_remove_one() (to handle module reload)
and rtl_shutdown() (for soft reboot or kexec), and hope that on an
unexpected hard reboot the firmware will reinit the chip properly.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
prev parent reply other threads:[~2009-09-02 14:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-23 10:14 r8189 mac address changes persist across reboot (was: duplicate MAC addresses) Alan Jenkins
2009-09-01 7:58 ` Ivan Vecera
2009-09-01 10:37 ` Alan Jenkins
2009-09-02 14:32 ` Sergey Vlasov [this message]
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=20090902143253.GA3239@newmaster.mivlgu.local \
--to=vsu@altlinux.ru \
--cc=ivecera@redhat.com \
--cc=linux-hotplug@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marty@goodoldmarty.com \
--cc=mikpe@it.uu.se \
--cc=netdev@vger.kernel.org \
--cc=romieu@fr.zoreil.com \
--cc=sourcejedi.lkml@googlemail.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;
as well as URLs for NNTP newsgroup(s).