summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2012-08-03 10:59:08 +0000
committerJoe Hershberger <joe.hershberger@ni.com>2012-09-24 13:55:43 -0500
commitf8be7d659c45720edb91503d2a480fc198e7ee9d (patch)
treec38ce492840a95d7ff7cd8242703096d3c4e488f /drivers
parent2c8fe5120f8da013cbd789be2f10cce880972836 (diff)
downloadu-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 'drivers')
-rw-r--r--drivers/net/netconsole.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 8fcf31c..da82aa9 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -44,6 +44,11 @@ static short nc_out_port; /* target output port */
static short nc_in_port; /* source input port */
static const char *output_packet; /* used by first send udp */
static int output_packet_len;
+/*
+ * Start with a default last protocol.
+ * We are only interested in NETCONS or not.
+ */
+enum proto_t net_loop_last_protocol = BOOTP;
static void nc_wait_arp_handler(uchar *pkt, unsigned dest,
IPaddr_t sip, unsigned src,
@@ -136,8 +141,13 @@ static void nc_send_packet(const char *buf, int len)
}
if (eth->state != ETH_STATE_ACTIVE) {
- if (eth_init(gd->bd) < 0)
- return;
+ if (eth_is_on_demand_init()) {
+ if (eth_init(gd->bd) < 0)
+ return;
+ eth_set_last_protocol(NETCONS);
+ } else
+ eth_init_state_only(gd->bd);
+
inited = 1;
}
pkt = (uchar *)NetTxPacket + NetEthHdrSize() + IP_UDP_HDR_SIZE;
@@ -146,8 +156,12 @@ static void nc_send_packet(const char *buf, int len)
ip = nc_ip;
NetSendUDPPacket(ether, ip, nc_out_port, nc_in_port, len);
- if (inited)
- eth_halt();
+ if (inited) {
+ if (eth_is_on_demand_init())
+ eth_halt();
+ else
+ eth_halt_state_only();
+ }
}
static int nc_start(void)