
Dear Kumar Gala,
In message Pine.LNX.4.64.0808181422320.28491@blarg.am.freescale.net 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