/* 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
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('#');
#ifdef CONFIG_MCAST_TFTP
mcast_cleanup();
#endif
- NetStartAgain();
+ net_start_again();
}
/*
printf("First block is not block 1 (%ld)\n",
tftp_cur_block);
puts("Starting again\n\n");
- NetStartAgain();
+ net_start_again();
break;
}
}
tftp_prev_block = tftp_cur_block;
timeout_count_max = TIMEOUT_COUNT;
- NetSetTimeout(timeout_ms, tftp_timeout_handler);
+ net_set_timeout_handler(timeout_ms, tftp_timeout_handler);
store_block(tftp_cur_block - 1, pkt + 2, len);
/* try to double it and retry */
tftp_mcast_bitmap_size <<= 1;
mcast_cleanup();
- NetStartAgain();
+ net_start_again();
return;
}
tftp_prev_block = tftp_cur_block;
#ifdef CONFIG_MCAST_TFTP
mcast_cleanup();
#endif
- NetStartAgain();
+ net_start_again();
break;
}
break;
restart("Retry count exceeded");
} else {
puts("T ");
- NetSetTimeout(timeout_ms, tftp_timeout_handler);
+ net_set_timeout_handler(timeout_ms, tftp_timeout_handler);
if (tftp_state != STATE_RECV_WRQ)
tftp_send();
}
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",
time_start = get_timer(0);
timeout_count_max = tftp_timeout_count_max;
- NetSetTimeout(timeout_ms, tftp_timeout_handler);
+ net_set_timeout_handler(timeout_ms, tftp_timeout_handler);
net_set_udp_handler(tftp_handler);
#ifdef CONFIG_CMD_TFTPPUT
net_set_icmp_handler(icmp_handler);
timeout_count_max = TIMEOUT_COUNT;
timeout_count = 0;
timeout_ms = TIMEOUT;
- NetSetTimeout(timeout_ms, tftp_timeout_handler);
+ net_set_timeout_handler(timeout_ms, tftp_timeout_handler);
/* Revert tftp_block_size to dflt */
tftp_block_size = TFTP_BLOCK_SIZE;
printf("Fail to set mcast, revert to TFTP\n");
tftp_mcast_disabled = 1;
mcast_cleanup();
- NetStartAgain();
+ net_start_again();
}
}
tftp_mcast_master_client = simple_strtoul((char *)mc, NULL, 10);