Saturday, February 04, 2012

Update: PandaBoard persistent MAC from smsc95xx kernel module

Some days ago I decided to send an updated and reworked version of my kernel patch for the smsc95xx kernel module - to get a persistent MAC address via the kernel cmdline from u-boot - to the linux kernel mailing list. I should have known better and save me the time: the patch wasn't accepted. You can follow the discussion here.

If you follow the argumentation, we should drop the support for changing the MAC address of a network device via kernel module parameter also from e.g. the following modules: sunhme, fec or ksz884x. And we should then also remove all the 'generate a random MAC for real devices' since it all could be somehow get managed in the user-space, although it's pita to handle this task in user-space since it's currently even hard to find out if a device got a random MAC assigned from the kernel.

I still plan to add the patch to the openSUSE kernel until I've worked out another solution. Feel free to use the patch anyway on your system.


Anonymous said...

Alan already told you the proper solution. Additionally, it's super-easy to extract the MAC address from u-boot setting with a userspace tool (it's even shipped with u-boot). In combination with the normal userspace network setup or with an initrd, this is very easy to do and already done on other ARM based boards.

Danny said...

I guess you mean fw_printenv which is part of u-boot and would print the u-boot env. Unfortunately this tool only reads from NAND and the PandaBoard has no NAND flash to store the env. (yes, u-boot can write to mmc ... have to check this)

What we need (to use it on openSUSE) is a generic solution.

It should work on every system/board and not only the PandaBoard*. And it should also handle the case that there are more than one device with no MAC in EEPROM in the system (which was one argument against the patch, although the patch handled this case). And this is really hard to handle outside the kernel since it's _currently_ impossible to find out if a device got a random MAC address assigned from the kernel.

And to be fair, if this patch isn't the way to go, we should treat the already existing kernel parameter - to set the mac - the same way and should drop them from the kernel. And in the end we should remove all the 'generate a random MAC if the kernel get no address from the HW'-code from the kernel since that all could be handled in userspace!

I don't say it's impossible to do it in userspace (and I already work on a u-boot-->kernel-cmdline-->initrd based solution), but I preferred to fix it in the kernel since the user don't care and it would simply work.