From aba4b69d01457ab2988e91c8592e5d2ffb10f569 Mon Sep 17 00:00:00 2001 From: Detlev Zundel Date: Wed, 31 Mar 2010 17:56:08 +0200 Subject: net: Trivial coding style issue with empty for statement Signed-off-by: Detlev Zundel Signed-off-by: Ben Warren --- net/eth.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'net') diff --git a/net/eth.c b/net/eth.c index b650a20247..aff698724d 100644 --- a/net/eth.c +++ b/net/eth.c @@ -1,5 +1,5 @@ /* - * (C) Copyright 2001-2004 + * (C) Copyright 2001-2010 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * See file CREDITS for list of people who contributed to this @@ -173,7 +173,8 @@ int eth_register(struct eth_device* dev) } #endif } else { - for (d=eth_devices; d->next!=eth_devices; d=d->next); + for (d=eth_devices; d->next!=eth_devices; d=d->next) + ; d->next = dev; } -- cgit From 9739946cc5b616c026d433bd07d193cf452ddea0 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 8 Mar 2010 14:07:00 -0500 Subject: ./net/net.c - make Microsoft dns servers happy with random_port() numbers For some reason, (which I can't find any documentation on), if U-Boot gives a port number higher than 17500 to a Microsoft DNS server, the server will reply to port 17500, and U-Boot will ignore things (since that isn't the port it asked the DNS server to reply to). This fixes that by ensuring the random port number is less than 17500. Signed-off-by: Robin Getz Signed-off-by: Ben Warren --- net/net.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'net') diff --git a/net/net.c b/net/net.c index 7d2220d48d..cda731986b 100644 --- a/net/net.c +++ b/net/net.c @@ -1872,11 +1872,13 @@ void copy_filename (char *dst, char *src, int size) #if defined(CONFIG_CMD_NFS) || defined(CONFIG_CMD_SNTP) || defined(CONFIG_CMD_DNS) /* - * make port a little random, but use something trivial to compute + * make port a little random (1024-17407) + * This keeps the math somewhat trivial to compute, and seems to work with + * all supported protocols/clients/servers */ unsigned int random_port(void) { - return 1024 + (get_timer(0) % 0x8000);; + return 1024 + (get_timer(0) % 0x4000); } #endif -- cgit From ecee9324d73555e744593f3e0d387bec4c566f55 Mon Sep 17 00:00:00 2001 From: Ben Warren Date: Mon, 26 Apr 2010 11:11:46 -0700 Subject: Program net device MAC addresses after initializing Add a new function to the eth_device struct for programming a network controller's hardware address. After all network devices have been initialized and the proper MAC address for each has been determined, make a device driver call to program the address into the device. Only device instances with valid unicast addresses will be programmed. Signed-off-by: Ben Warren Acked-by: Detlev Zundel Tested-by: Prafulla Wadaskar Tested-by: Heiko Schocher Tested-by: Thomas Chou --- net/eth.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'net') diff --git a/net/eth.c b/net/eth.c index aff698724d..45e4a26d6f 100644 --- a/net/eth.c +++ b/net/eth.c @@ -60,6 +60,14 @@ int eth_getenv_enetaddr_by_index(int index, uchar *enetaddr) return eth_getenv_enetaddr(enetvar, enetaddr); } +static int eth_mac_skip(int index) +{ + char enetvar[15]; + char *skip_state; + sprintf(enetvar, index ? "eth%dmacskip" : "ethmacskip", index); + return ((skip_state = getenv(enetvar)) != NULL); +} + #ifdef CONFIG_NET_MULTI /* @@ -242,6 +250,11 @@ int eth_initialize(bd_t *bis) memcpy(dev->enetaddr, env_enetaddr, 6); } + if (dev->write_hwaddr && + !eth_mac_skip(eth_number) && + is_valid_ether_addr(dev->enetaddr)) { + dev->write_hwaddr(dev); + } eth_number++; dev = dev->next; -- cgit