[PATCH 07/21] Revert "net: wget: Support retransmission a dropped packet"

Simon Glass sjg at chromium.org
Sat Aug 10 22:51:51 CEST 2024


This breaks the wget tests, so revert it until a proper fix can be
figured out.

This reverts commit cab7867cff33f9c21025102ea9ca3b26e362fb52.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 net/wget.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/net/wget.c b/net/wget.c
index f1dd7abeff6..5eabb413116 100644
--- a/net/wget.c
+++ b/net/wget.c
@@ -49,7 +49,6 @@ static unsigned long content_length;
 static unsigned int packets;
 
 static unsigned int initial_data_seq_num;
-static unsigned int next_data_seq_num;
 
 static enum  wget_state current_wget_state;
 
@@ -272,18 +271,17 @@ static void wget_connected(uchar *pkt, unsigned int tcp_seq_num,
 
 		current_wget_state = WGET_TRANSFERRING;
 
-		initial_data_seq_num = tcp_seq_num + hlen;
-		next_data_seq_num    = tcp_seq_num + len;
-
 		if (strstr((char *)pkt, http_ok) == 0) {
 			debug_cond(DEBUG_WGET,
 				   "wget: Connected Bad Xfer\n");
+			initial_data_seq_num = tcp_seq_num + hlen;
 			wget_loop_state = NETLOOP_FAIL;
 			wget_send(action, tcp_seq_num, tcp_ack_num, len);
 		} else {
 			debug_cond(DEBUG_WGET,
 				   "wget: Connctd pkt %p  hlen %x\n",
 				   pkt, hlen);
+			initial_data_seq_num = tcp_seq_num + hlen;
 
 			pos = strstr((char *)pkt, content_len);
 			if (!pos) {
@@ -397,13 +395,9 @@ static void wget_handler(uchar *pkt, u16 dport,
 			   "wget: Transferring, seq=%x, ack=%x,len=%x\n",
 			   tcp_seq_num, tcp_ack_num, len);
 
-		if (next_data_seq_num != tcp_seq_num) {
-			debug_cond(DEBUG_WGET, "wget: seq=%x packet was lost\n", next_data_seq_num);
-			return;
-		}
-		next_data_seq_num = tcp_seq_num + len;
-
-		if (store_block(pkt, tcp_seq_num - initial_data_seq_num, len) != 0) {
+		if (tcp_seq_num >= initial_data_seq_num &&
+		    store_block(pkt, tcp_seq_num - initial_data_seq_num,
+				len) != 0) {
 			wget_fail("wget: store error\n",
 				  tcp_seq_num, tcp_ack_num, action);
 			net_set_state(NETLOOP_FAIL);
-- 
2.34.1



More information about the U-Boot mailing list