[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Annoying problem with udev





On 29/11/2010 20:27, Frans van Berckel wrote:
On Mon, 2010-11-29 at 17:05 +0000, Richard Mortimer wrote:
Both devices have local-mac-address properties in the device tree. That
suggests that there is something wrong with the logic in driver itself.

<snip>

I had a quick look at the 2.3.36 driver on kernel.org

http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.36.y.git;a=history;f=drivers/net/cassini.c;h=28c88eeec757361fb2fa3db11a63b57c97b892fb;hb=HEAD

and a cursory look at that shows code for parsing local-mac-address
(circa line 3290). I haven't looked very deeply but it seems like the
driver is failing to read the VPD rom and falling back onto a random
address.

There doesn't seem to be anything obvious in the recent history that
suggests where this might have been fixed.

Next step would likely be to try a 2.6.36 kernel to see whether it
already has a fix etc.

Thanks for looking into it Richard, but the stable 2.6.36.1 does not boot at all, with a serial console on Sparc64. But that's outside the scoop of the cassini driver stuff we are looking for.

Hi,

Having had another glance at the code I suspect that 2.6.36.1 will not get the MAC addresses right either but we really need to confirm that before pushing upstream.

Unfortunately I don't have a build infrastructure setup or a machine to compile/test against but I suspect that the eventual fix will be fairly simple to do. Basically when cas_get_vpd_info in cassini.c fails to read the MAC from the ROM and drops down to the "use_random_mac_addr" label it should test for the local-mac-address property in the same way that gem_get_device_address does in gem.c. If that doesn't work then fallback to the current random address.

i.e. insert the following (with a bit of cleanup to make the of_node available at that point and fall through to the random address stuff instead of the KERN_ERR bit).

#if defined(CONFIG_SPARC) || defined(CONFIG_PPC_PMAC)
        struct net_device *dev = gp->dev;
        const unsigned char *addr;

        addr = of_get_property(gp->of_node, "local-mac-address", NULL);
        if (addr == NULL) {
#ifdef CONFIG_SPARC
                addr = idprom->id_ethaddr;
#else
                printk("\n");
                printk(KERN_ERR "%s: can't get mac-address\n", dev->name);
                return -1;
#endif
        }
        memcpy(dev->dev_addr, addr, 6);
#endif

Regards

Richard


Reply to: