Subject: Re: [PATCH] ks8842: Add module param for setting mac address

From: Richard Röjfors<[email-masked]>
Date: Sun, 18 Apr 2010 23:35:47 +0200

On 04/18/2010 09:50 PM, Ben Hutchings wrote:
> On Sun, 2010-04-18 at 19:25 +0200, Richard Röjfors wrote:
>> This patch adds a module parameter for setting the MAC address.
>>
>> To ensure this MAC address is used, the MAC address is written
>> after each hardware reset.
> [...]
>
> This is not an accepted way of setting the MAC address.

I agree it's not the cleanest way of doing this, I saw  some of the
other drivers do like this.

>  The accepted ways to initialise a network controller's address are:
>
> 1. a. Controller reads it from dedicated NVRAM.  Driver reads it from
>        controller.
>     b. Driver reads it from dedicated NVRAM.

Not possible with the current hardware.

> 2. Platform firmware or boot loader passes platform data (OpenFirmware,
>     device tree, etc.) to the kernel, which includes the assigned MAC
>     address.  Driver uses kernel functions to read it from platform data.

On our system (X86 based) the ks8842 is connected via a FPGA, the FPGA is
connected via PCI express. The system has a standard BIOS.
In linux we have a MFD driver chunking up the PCI memory space into
platform devices. In that case we would need to feed the data as a param
to the MFD driver which copies into the platform data of the ks8842, would
be doable.

> 3. Platform firmware or boot loader programs it into the controller.
>     Driver reads it from the controller.

We use standard BIOS and boot loaders from the X86 distros -> more or less
not doable.

> 4. Driver generates random address.

That's the current fallback if none is given and the random address
in the chip isn't valid.

>
> In any case, userland can change the MAC address later.

If we don't need to have a known MAC before the root FS is mounted.

--Richard