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>
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 02b18ec..68c673e 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -75,7 +75,12 @@
static const unsigned long baudrate_table[] = CONFIG_SYS_BAUDRATE_TABLE;
#define N_BAUDRATES (sizeof(baudrate_table) / sizeof(baudrate_table[0]))
+static int env_id = 1;
+int get_env_id (void)
+{
+ return env_id;
+}
/************************************************************************
* Command interface: print one or all environment variables
*/
@@ -160,6 +165,7 @@
return 1;
}
+ env_id++;
/*
* search if variable with this name already exists
*/