diff options
author | Heiko Schocher <hs@denx.de> | 2009-02-10 09:38:52 +0100 |
---|---|---|
committer | Ben Warren <biggerbadderben@gmail.com> | 2009-02-22 23:49:33 -0800 |
commit | 2f70c49e5b9813635ad73666aa30f304c7fdeda9 (patch) | |
tree | 57b6d6625de2648dab93e71cf74a7329c81c6adc /net/eth.c | |
parent | ad2d16393e9f684e4a9255f42e8bfdd819b67a87 (diff) | |
download | u-boot-imx-2f70c49e5b9813635ad73666aa30f304c7fdeda9.zip u-boot-imx-2f70c49e5b9813635ad73666aa30f304c7fdeda9.tar.gz u-boot-imx-2f70c49e5b9813635ad73666aa30f304c7fdeda9.tar.bz2 |
netloop: speed up NetLoop
NetLoop polls every cycle with getenv some environment variables.
This is horribly slow, especially when the environment is big.
This patch reads only the environment variables in NetLoop,
when they were changed.
Also moved the init part of the NetLoop function in a seperate
function.
Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Diffstat (limited to 'net/eth.c')
-rw-r--r-- | net/eth.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -28,6 +28,9 @@ #if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI) +static char *act = NULL; +static int env_changed_id = 0; + /* * CPU and board-specific Ethernet initializations. Aliased function * signals caller to move on @@ -461,13 +464,17 @@ void eth_try_another(int first_restart) #ifdef CONFIG_NET_MULTI void eth_set_current(void) { - char *act; struct eth_device* old_current; + int env_id; if (!eth_current) /* XXX no current */ return; - act = getenv("ethact"); + env_id = get_env_id(); + if ((act == NULL) || (env_changed_id != env_id)) { + act = getenv("ethact"); + env_changed_id = env_id; + } if (act != NULL) { old_current = eth_current; do { |