summaryrefslogtreecommitdiff
path: root/net/tftp.c
diff options
context:
space:
mode:
authorMinkyu Kang <mk7.kang@samsung.com>2010-03-23 19:09:13 +0900
committerMinkyu Kang <mk7.kang@samsung.com>2010-03-23 19:09:13 +0900
commit45e565337a90bbca0c1bb712b5e008b7c0b18bd5 (patch)
tree8bcaee16cda9d8f90f5b596566ad2122c6d8d86b /net/tftp.c
parent995a4b1d83a08223c82c1e15778b02e85e5bba51 (diff)
parentd650da2dd4af99967aabc43cccbd8f160eb4cea6 (diff)
Merge branch 'master' of git://git.denx.de/u-boot-arm
Conflicts: cpu/arm920t/ep93xx/timer.c Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
Diffstat (limited to 'net/tftp.c')
-rw-r--r--net/tftp.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/net/tftp.c b/net/tftp.c
index a02463b003f..ed559b71d57 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -211,7 +211,7 @@ TftpSend (void)
pkt += 5 /*strlen("octet")*/ + 1;
strcpy ((char *)pkt, "timeout");
pkt += 7 /*strlen("timeout")*/ + 1;
- sprintf((char *)pkt, "%lu", TIMEOUT / 1000);
+ sprintf((char *)pkt, "%lu", TftpTimeoutMSecs / 1000);
debug("send option \"timeout %s\"\n", (char *)pkt);
pkt += strlen((char *)pkt) + 1;
#ifdef CONFIG_TFTP_TSIZE
@@ -413,7 +413,6 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len)
}
TftpLastBlock = TftpBlock;
- TftpTimeoutMSecs = TIMEOUT;
TftpTimeoutCountMax = TIMEOUT_COUNT;
NetSetTimeout (TftpTimeoutMSecs, TftpTimeout);
@@ -528,10 +527,25 @@ TftpStart (void)
{
char *ep; /* Environment pointer */
- /* Allow the user to choose tftpblocksize */
+ /*
+ * Allow the user to choose TFTP blocksize and timeout.
+ * TFTP protocol has a minimal timeout of 1 second.
+ */
if ((ep = getenv("tftpblocksize")) != NULL)
TftpBlkSizeOption = simple_strtol(ep, NULL, 10);
- debug("tftp block size is %i\n", TftpBlkSizeOption);
+
+ if ((ep = getenv("tftptimeout")) != NULL)
+ TftpTimeoutMSecs = simple_strtol(ep, NULL, 10);
+
+ if (TftpTimeoutMSecs < 1000) {
+ printf("TFTP timeout (%ld ms) too low, "
+ "set minimum = 1000 ms\n",
+ TftpTimeoutMSecs);
+ TftpTimeoutMSecs = 1000;
+ }
+
+ debug("TFTP blocksize = %i, timeout = %ld ms\n",
+ TftpBlkSizeOption, TftpTimeoutMSecs);
TftpServerIP = NetServerIP;
if (BootFile[0] == '\0') {
@@ -588,7 +602,6 @@ TftpStart (void)
puts ("Loading: *\b");
- TftpTimeoutMSecs = TftpRRQTimeoutMSecs;
TftpTimeoutCountMax = TftpRRQTimeoutCountMax;
NetSetTimeout (TftpTimeoutMSecs, TftpTimeout);