diff options
author | Simon Glass <sjg@chromium.org> | 2011-05-03 15:21:16 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-24 09:56:42 -0700 |
commit | eb8430bab0ce7af39642417923f93760f9828901 (patch) | |
tree | 0d8a4c2bff5bbb21d0fa68a80a3b6ee926ebe6f9 /net | |
parent | 58be262c52e89dd2cf11e82f1bd6ade27c21d44f (diff) |
Add tftp speed indication
This prints a tftp speed indication after the download completes. This is the
3.6 MiB/s indicator below.
Tegra2 (SeaBoard) # tftp ...
Using asx0 device
TFTP from server 172.22.72.144; our IP address is 172.22.73.81
Filename '/tftpboot/uImage-user-seaboard-1'.
Load address: 0x408000
Loading: ################################################# 3.6 MiB/s
done
BUG=chromium-os:13228
TEST=Boot on Seaboard, make sure message appears. Use 'time tftp ...' to make
sure that speed reported is approximately right.
Change-Id: I5e96e2ef6aa196a6fd8486f2dae0fe11f7464f20
Reviewed-on: http://gerrit.chromium.org/gerrit/225
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/tftp.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/net/tftp.c b/net/tftp.c index a893e020fd6..b3cd8647afc 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -38,6 +38,10 @@ static ulong TftpTimeoutMSecs = TIMEOUT; static int TftpTimeoutCountMax = TIMEOUT_COUNT; +#ifdef CONFIG_TFTP_SPEED +static ulong time_start; /* Record time we started tftp */ +#endif + /* * These globals govern the timeout behavior when attempting a connection to a * TFTP server. TftpRRQTimeoutMSecs specifies the number of milliseconds to @@ -511,6 +515,15 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src, } #endif puts("\ndone\n"); +#ifdef CONFIG_TFTP_SPEED + time_start = get_timer(time_start); + if (time_start > 0) { + puts (" "); + print_size(NetBootFileXferSize / + time_start * 1000, "/s"); + } +#endif + puts("\ndone\n"); NetState = NETLOOP_SUCCESS; } break; @@ -645,6 +658,9 @@ TftpStart(void) puts("Loading: *\b"); +#ifdef CONFIG_TFTP_SPEED + time_start = get_timer(0); +#endif TftpTimeoutCountMax = TftpRRQTimeoutCountMax; NetSetTimeout(TftpTimeoutMSecs, TftpTimeout); |