diff options
author | Joe Hershberger <joe.hershberger@ni.com> | 2012-08-03 10:59:08 +0000 |
---|---|---|
committer | Joe Hershberger <joe.hershberger@ni.com> | 2012-09-24 13:55:43 -0500 |
commit | f8be7d659c45720edb91503d2a480fc198e7ee9d (patch) | |
tree | c38ce492840a95d7ff7cd8242703096d3c4e488f /net/net.c | |
parent | 2c8fe5120f8da013cbd789be2f10cce880972836 (diff) | |
download | u-boot-imx-f8be7d659c45720edb91503d2a480fc198e7ee9d.zip u-boot-imx-f8be7d659c45720edb91503d2a480fc198e7ee9d.tar.gz u-boot-imx-f8be7d659c45720edb91503d2a480fc198e7ee9d.tar.bz2 |
net: Improve the speed of netconsole
Previously u-boot would initialize the network interface for every
network operation and then shut it down again. This makes sense for
most operations where the network in not known to be needed soon after
the operation is complete. In the case of netconsole, it will use the
network for every interaction with the shell or every printf. This
means that the network is being reinitialized very often. On many
devices, this intialization is very slow.
This patch checks for consecutive netconsole actions and leaves the
ethernet hardware initialized between them. It will still behave the
same old way for all other network operations and any time another
network operation happens between netconsole operations.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'net/net.c')
-rw-r--r-- | net/net.c | 26 |
1 files changed, 20 insertions, 6 deletions
@@ -315,12 +315,15 @@ int NetLoop(enum proto_t protocol) bootstage_mark_name(BOOTSTAGE_ID_ETH_START, "eth_start"); net_init(); - eth_halt(); - eth_set_current(); - if (eth_init(bd) < 0) { + if (eth_is_on_demand_init() || protocol != NETCONS) { eth_halt(); - return -1; - } + eth_set_current(); + if (eth_init(bd) < 0) { + eth_halt(); + return -1; + } + } else + eth_init_state_only(bd); restart: net_set_state(NETLOOP_CONTINUE); @@ -460,6 +463,9 @@ restart: net_cleanup_loop(); eth_halt(); + /* Invalidate the last protocol */ + eth_set_last_protocol(BOOTP); + puts("\nAbort\n"); /* include a debug print as well incase the debug messages are directed to stderr */ @@ -517,13 +523,21 @@ restart: sprintf(buf, "%lX", (unsigned long)load_addr); setenv("fileaddr", buf); } - eth_halt(); + if (protocol != NETCONS) + eth_halt(); + else + eth_halt_state_only(); + + eth_set_last_protocol(protocol); + ret = NetBootFileXferSize; debug_cond(DEBUG_INT_STATE, "--- NetLoop Success!\n"); goto done; case NETLOOP_FAIL: net_cleanup_loop(); + /* Invalidate the last protocol */ + eth_set_last_protocol(BOOTP); debug_cond(DEBUG_INT_STATE, "--- NetLoop Fail!\n"); goto done; |