]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - net/tftp.c
net: tftp: Move tftp.h file from ./net to ./include/net
[karo-tx-uboot.git] / net / tftp.c
index 3e99e7309116c333576a366735214ccb66c6fdc3..181f0f363e70d7ad45044910d1216def34e412a7 100644 (file)
@@ -10,7 +10,7 @@
 #include <command.h>
 #include <mapmem.h>
 #include <net.h>
-#include "tftp.h"
+#include <net/tftp.h>
 #include "bootp.h"
 #ifdef CONFIG_SYS_DIRECT_FLASH_TFTP
 #include <flash.h>
 /* Well known TFTP port # */
 #define WELL_KNOWN_PORT        69
 /* Millisecs to timeout for lost pkt */
-#define TIMEOUT                5000UL
+#define TIMEOUT                100UL
 #ifndef        CONFIG_NET_RETRY_COUNT
 /* # of timeouts before giving up */
-# define TIMEOUT_COUNT 10
+# define TIMEOUT_COUNT 1000
 #else
 # define TIMEOUT_COUNT  (CONFIG_NET_RETRY_COUNT * 2)
 #endif
@@ -249,6 +249,8 @@ static void show_block_marker(void)
        if (tftp_tsize) {
                ulong pos = tftp_cur_block * tftp_block_size +
                        tftp_block_wrap_offset;
+               if (pos > tftp_tsize)
+                       pos = tftp_tsize;
 
                while (tftp_tsize_num_hash < pos * 50 / tftp_tsize) {
                        putc('#');
@@ -709,10 +711,10 @@ void tftp_start(enum proto_t protocol)
        if (ep != NULL)
                timeout_ms = simple_strtol(ep, NULL, 10);
 
-       if (timeout_ms < 1000) {
-               printf("TFTP timeout (%ld ms) too low, set min = 1000 ms\n",
+       if (timeout_ms < 10) {
+               printf("TFTP timeout (%ld ms) too low, set min = 10 ms\n",
                       timeout_ms);
-               timeout_ms = 1000;
+               timeout_ms = 10;
        }
 
        debug("TFTP blocksize = %i, timeout = %ld ms\n",