Dear Kumar Gala,

In message <[EMAIL PROTECTED]> you wrote:
> Move to using the environment variables 'ethaddr', 'eth1addr', etc..
> instead of bd->bi_enetaddr, bi_enet1addr, etc.
> 
> This makes the code a bit more flexible to the number of ethernet
> interfaces.  Right now we assume a max of 10 interfaces.

Hm... where exactly is this artificial limit coming from? Do we really
need it?

> +             for (i = 0; i < CFG_MAX_NUM_ETH; i++) {
> +                     sprintf(enet, "ethernet%d", i);
> +                     sprintf(mac, "eth%daddr",i);
> +
> +                     sprintf(mac, i ? "eth%daddr" : "ethaddr", i);
> +                     tmp = getenv(mac);

for efficientcy, make this the first action in the loop.

> +                     path = fdt_getprop(fdt, node, enet, NULL);
> +
> +                     if (!path) {
> +                             debug("No alias for %s\n", enet);
> +                             continue;
> +                     }
> +                     if (!tmp) {
> +                             debug("No environment variable for %s\n", mac);
> +                             continue;
> +                     }

If we assume,  that  all  existing  interfaces  must  have  addresses
assigned, we could use a "break" here instead of the "continue". That
would be (1) much faster on most boards and (2) would allow us to get
rid of the artifical limit of 10.

What do you think?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [EMAIL PROTECTED]
Let the programmers be many and the managers few -- then all will  be
productive.               -- Geoffrey James, "The Tao of Programming"
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to