[PATCH] net: tftpboot: clear timeout_count on every successful block

Mikhail Kshevetskiy mikhail.kshevetskiy at iopsys.eu
Wed Dec 4 00:27:32 CET 2024


timeout_count is never reset once a tftpboot transfer has started. If for
whatever reason timeouts occur frequently, but the server keeps replying
nonetheless, the transfer may be needlessly aborted.

Reset timer_count on every successful block to avoid this situation.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy at iopsys.eu>
---
 net/tftp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/tftp.c b/net/tftp.c
index 704b20b4ff8..8f948204a6f 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -498,6 +498,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 						tftp_state = STATE_DATA;
 						tftp_remote_port = src;
 					}
+					timeout_count = 0;
 					tftp_send(); /* Send next data block */
 				}
 			}
@@ -657,6 +658,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			net_set_state(NETLOOP_FAIL);
 			break;
 		}
+		timeout_count = 0;
 
 		if (len < tftp_block_size) {
 			tftp_send();
-- 
2.45.2



More information about the U-Boot mailing list