X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=net%2Fnet.c;h=fba111edfba263846f00e178852740efc3b08349;hb=c5a75339cf1595ee89a3513cd4fd84c10c0cd910;hp=a365df058624b665b517d09b862fe57366be77b1;hpb=e536ab8849b2b4f6d68bbc8e1d1f9bc033db06bd;p=platform%2Fkernel%2Fu-boot.git diff --git a/net/net.c b/net/net.c index a365df0..fba111e 100644 --- a/net/net.c +++ b/net/net.c @@ -83,9 +83,11 @@ #include #include +#include #include #include #include +#include #if defined(CONFIG_STATUS_LED) #include #include @@ -105,7 +107,6 @@ #if defined(CONFIG_CMD_SNTP) #include "sntp.h" #endif -#include "tftp.h" DECLARE_GLOBAL_DATA_PTR; @@ -164,7 +165,7 @@ ushort net_our_vlan = 0xFFFF; ushort net_native_vlan = 0xFFFF; /* Boot File name */ -char net_boot_file_name[128]; +char net_boot_file_name[1024]; /* The actual transferred size of the bootfile (in bytes) */ u32 net_boot_file_size; /* Boot file size in blocks as reported by the DHCP server */ @@ -208,6 +209,9 @@ int __maybe_unused net_busy_flag; static int on_bootfile(const char *name, const char *value, enum env_op op, int flags) { + if (flags & H_PROGRAMMATIC) + return 0; + switch (op) { case env_op_create: case env_op_overwrite: @@ -222,6 +226,92 @@ static int on_bootfile(const char *name, const char *value, enum env_op op, } U_BOOT_ENV_CALLBACK(bootfile, on_bootfile); +static int on_ipaddr(const char *name, const char *value, enum env_op op, + int flags) +{ + if (flags & H_PROGRAMMATIC) + return 0; + + net_ip = string_to_ip(value); + + return 0; +} +U_BOOT_ENV_CALLBACK(ipaddr, on_ipaddr); + +static int on_gatewayip(const char *name, const char *value, enum env_op op, + int flags) +{ + if (flags & H_PROGRAMMATIC) + return 0; + + net_gateway = string_to_ip(value); + + return 0; +} +U_BOOT_ENV_CALLBACK(gatewayip, on_gatewayip); + +static int on_netmask(const char *name, const char *value, enum env_op op, + int flags) +{ + if (flags & H_PROGRAMMATIC) + return 0; + + net_netmask = string_to_ip(value); + + return 0; +} +U_BOOT_ENV_CALLBACK(netmask, on_netmask); + +static int on_serverip(const char *name, const char *value, enum env_op op, + int flags) +{ + if (flags & H_PROGRAMMATIC) + return 0; + + net_server_ip = string_to_ip(value); + + return 0; +} +U_BOOT_ENV_CALLBACK(serverip, on_serverip); + +static int on_nvlan(const char *name, const char *value, enum env_op op, + int flags) +{ + if (flags & H_PROGRAMMATIC) + return 0; + + net_native_vlan = string_to_vlan(value); + + return 0; +} +U_BOOT_ENV_CALLBACK(nvlan, on_nvlan); + +static int on_vlan(const char *name, const char *value, enum env_op op, + int flags) +{ + if (flags & H_PROGRAMMATIC) + return 0; + + net_our_vlan = string_to_vlan(value); + + return 0; +} +U_BOOT_ENV_CALLBACK(vlan, on_vlan); + +#if defined(CONFIG_CMD_DNS) +static int on_dnsip(const char *name, const char *value, enum env_op op, + int flags) +{ + if (flags & H_PROGRAMMATIC) + return 0; + + net_dns_server = string_to_ip(value); + + return 0; +} +U_BOOT_ENV_CALLBACK(dnsip, on_dnsip); +#endif + /* * Check if autoload is enabled. If so, use either NFS or TFTP to download * the boot file. @@ -252,22 +342,6 @@ void net_auto_load(void) static void net_init_loop(void) { - static int env_changed_id; - int env_id = get_env_id(); - - /* update only when the environment has changed */ - if (env_changed_id != env_id) { - net_ip = getenv_ip("ipaddr"); - net_gateway = getenv_ip("gatewayip"); - net_netmask = getenv_ip("netmask"); - net_server_ip = getenv_ip("serverip"); - net_native_vlan = getenv_vlan("nvlan"); - net_our_vlan = getenv_vlan("vlan"); -#if defined(CONFIG_CMD_DNS) - net_dns_server = getenv_ip("dnsip"); -#endif - env_changed_id = env_id; - } if (eth_get_dev()) memcpy(net_ethaddr, eth_get_ethaddr(), 6); @@ -468,6 +542,9 @@ restart: #ifdef CONFIG_SHOW_ACTIVITY show_activity(1); #endif + if (arp_timeout_check() > 0) + time_start = get_timer(0); + /* * Check the ethernet for a new packet. The ethernet * receive routine will process it. @@ -492,11 +569,10 @@ restart: /* include a debug print as well incase the debug messages are directed to stderr */ debug_cond(DEBUG_INT_STATE, "--- net_loop Abort!\n"); + ret = -EINTR; goto done; } - arp_timeout_check(); - /* * Check for a timeout, and run the timeout handler * if we have one.