diff options
author | Tom Rini <trini@konsulko.com> | 2015-10-29 16:30:33 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2015-10-29 16:30:33 -0400 |
commit | 0eb4cf9c14315e1976a116de75da6f420ac0e8dd (patch) | |
tree | 3933d354a6be71cbe66d583fec3f5b2479e596ee /net/tftp.c | |
parent | 446d37c1acc76680770400fd90e6c502e49d72df (diff) | |
parent | ac1d31380618f3f68bf7f05b73b6ab0cdeab0e9f (diff) |
Merge branch 'master' of git://git.denx.de/u-boot-net
Diffstat (limited to 'net/tftp.c')
-rw-r--r-- | net/tftp.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/net/tftp.c b/net/tftp.c index 1a5113179a..f2889fe4c9 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -602,7 +602,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip, } tftp_prev_block = tftp_cur_block; - timeout_count_max = TIMEOUT_COUNT; + timeout_count_max = tftp_timeout_count_max; net_set_timeout_handler(timeout_ms, tftp_timeout_handler); store_block(tftp_cur_block - 1, pkt + 2, len); @@ -697,12 +697,14 @@ static void tftp_timeout_handler(void) void tftp_start(enum proto_t protocol) { +#if CONFIG_NET_TFTP_VARS char *ep; /* Environment pointer */ /* * Allow the user to choose TFTP blocksize and timeout. * TFTP protocol has a minimal timeout of 1 second. */ + ep = getenv("tftpblocksize"); if (ep != NULL) tftp_block_size_option = simple_strtol(ep, NULL, 10); @@ -717,6 +719,17 @@ void tftp_start(enum proto_t protocol) timeout_ms = 1000; } + ep = getenv("tftptimeoutcountmax"); + if (ep != NULL) + tftp_timeout_count_max = simple_strtol(ep, NULL, 10); + + if (tftp_timeout_count_max < 0) { + printf("TFTP timeout count max (%d ms) negative, set to 0\n", + tftp_timeout_count_max); + tftp_timeout_count_max = 0; + } +#endif + debug("TFTP blocksize = %i, timeout = %ld ms\n", tftp_block_size_option, timeout_ms); @@ -842,7 +855,7 @@ void tftp_start_server(void) puts("Loading: *\b"); - timeout_count_max = TIMEOUT_COUNT; + timeout_count_max = tftp_timeout_count_max; timeout_count = 0; timeout_ms = TIMEOUT; net_set_timeout_handler(timeout_ms, tftp_timeout_handler); |