/* * tftpput in u-boot has two issues. It never resets the timeout, so * tftpput must complete within the timeout perious (by defaut 5 seconds) * and it does not properly handle the block wrap at 65535 back to zero, * so it will transmit data forever, or at least a very long time, if * the timeout is set long enough, or the timeout issue is patched by * itself. */ diff -Naru old/net/tftp.c new/net/tftp.c --- old/net/tftp.c 2017-07-05 15:52:28.865818329 -0500 +++ new/net/tftp.c 2017-07-11 16:15:27.870430395 -0500 @@ -499,10 +499,15 @@ int block = ntohs(*s); int ack_ok = (tftp_cur_block == block); + /* update_block_number needs tftp_prev_block */ + tftp_prev_block = tftp_cur_block; tftp_cur_block = (unsigned short)(block + 1); update_block_number(); - if (ack_ok) + if (ack_ok) { + /* We got the ACK, so reset the timeout */ + net_set_timeout_handler(timeout_ms, tftp_timeout_handler); tftp_send(); /* Send next data block */ + } } } #endif