Public bug reported:

Impact:

The RaspberryPi3+ board came with an usb's to ethernet lan78xx nic
adapter - thhis chip has no external eeprom, nor internal preprogrammed
mac address and as such, after every reboot, it generates a random new
ethernet mac address.

Supposedly, the lan78xx driver is able to read its mac address from the
device tree passed to the kernel (see d093067 "lan78xx: Read MAC address
from DT if present"), making it possible to have reproducible/fixed mac
addresses, but unfortunately this feature isn't working in our
Xenial/raspi2 kernel (while it's working fine in Bionc/raspi2).

After some debugging i found that the usb_net struct backing the lan78xx
driver, had no clue about the dt node it was associated, making this
piece of code constantly evaluates to NULL:

static void lan78xx_init_mac_address(struct lan78xx_net *dev)
...
mac_addr = of_get_mac_address(dev->udev->dev.of_node);
...

There "of_node" was always NULL.

After more debugging, i found that the feature to bind usb_net devices
and device tree nodes was introduced in the Linux 4.6 cycle, and as such
Xenial didn't have it.

Fix:

Apply the patch and recompile

How to test:

Upon boot of the RaspberryPi3+ board (and after the dtb has been loaded
into memory), stop at the uboot prompt and check the usbeether device
node:

U-Boot> fdt print /soc/usb/usb1@1/usb1_1@1/usbether@1
usbether@1 {
        local-mac-address = [b8 27 eb ce 07 ba];
        compatible = "usb424,7800";
        reg = <0x00000001>;
        microchip,eee-enabled;
        microchip,tx-lpi-timer = <0x00000258>;
        phandle = <0x00000024>;
};

the "local-mac-address" has been filled by the Broadcom bootloader, and
contains the lan78xx's mac address.

Then proceed with the boot routine, readh the user prompt, and check
eth0's mac address:

$ ifconfig eth0 | grep HWaddr
eth0      Link encap:Ethernet  HWaddr b8:27:eb:ce:07:ba  

If it's the same as above, then the fix worked.

Regression:

The patch itself has been upstream since v4.6-rc1, and it changes a very
small portion of code, so i'll say it's regression potential is very low
/ none.

** Affects: linux-raspi2 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1798578

Title:
  rpi3b+: can't set mac addrss from device tree

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux-raspi2/+bug/1798578/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to