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

Re: Annoying problem with udev



On Mon, 2010-11-29 at 21:09 +0000, Richard Mortimer wrote:
> 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

Hi Richard, 

That sounds clear to me but I am not a coder myself. But able to patch the cassini.c and compile the kernel for testing. I have a suggestion, it doesn't look nice and it's for testing purpose only. But can we put the code as a extra check on top of the use_random_mac_addr function itself?

use_random_mac_addr:
        if (found & VPD_FOUND_MAC)
                goto done;

        /* Sun MAC prefix then 3 random bytes. */
        pr_info("MAC address not found in ROM VPD\n");
        dev_addr[0] = 0x08;
        dev_addr[1] = 0x00;
        dev_addr[2] = 0x20;
        get_random_bytes(dev_addr + 3, 3);
done:
        writel(0, cp->regs + REG_BIM_LOCAL_DEV_EN);
        return phy_type;
}


Reply to: