fix the ackdata is always lower than 256

(cherry picked from commit 95e74662b2c90b7b692cebe82c344614034a83ce)
This commit is contained in:
kircher 2022-12-20 19:00:20 +08:00 committed by openeuler-sync-bot
parent 4697ceb54f
commit 272d5ebfb9
2 changed files with 15 additions and 14 deletions

View File

@ -1,16 +1,16 @@
From 25b8974efd98150788896f51d5b9a1e23a82e78b Mon Sep 17 00:00:00 2001 From bf16309bdb9c2571e91d50cec7b379d93559d573 Mon Sep 17 00:00:00 2001
From: kircher <majun65@huawei.com> From: kircher <majun65@huawei.com>
Date: Tue, 20 Dec 2022 16:36:51 +0800 Date: Tue, 20 Dec 2022 18:52:59 +0800
Subject: [PATCH] add-dataack-when-recv-too-many-acks-with-data Subject: [PATCH] add dataack when recv too many acks with data
--- ---
src/core/tcp_in.c | 21 +++++++++++++++++++++ src/core/tcp_in.c | 19 +++++++++++++++++++
src/include/lwip/tcp.h | 1 + src/include/lwip/tcp.h | 1 +
src/include/lwipopts.h | 2 ++ src/include/lwipopts.h | 2 ++
3 files changed, 24 insertions(+) 3 files changed, 22 insertions(+)
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 78954bd..d1c5a30 100644 index 78954bd..dcd564b 100644
--- a/src/core/tcp_in.c --- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c +++ b/src/core/tcp_in.c
@@ -1260,6 +1260,7 @@ tcp_receive(struct tcp_pcb *pcb) @@ -1260,6 +1260,7 @@ tcp_receive(struct tcp_pcb *pcb)
@ -21,7 +21,7 @@ index 78954bd..d1c5a30 100644
LWIP_ASSERT("tcp_receive: invalid pcb", pcb != NULL); LWIP_ASSERT("tcp_receive: invalid pcb", pcb != NULL);
LWIP_ASSERT("tcp_receive: wrong state", pcb->state >= ESTABLISHED); LWIP_ASSERT("tcp_receive: wrong state", pcb->state >= ESTABLISHED);
@@ -1337,11 +1338,30 @@ tcp_receive(struct tcp_pcb *pcb) @@ -1337,11 +1338,28 @@ tcp_receive(struct tcp_pcb *pcb)
} }
} }
} }
@ -31,9 +31,7 @@ index 78954bd..d1c5a30 100644
+ if (pcb->rtime >= 0) { + if (pcb->rtime >= 0) {
+ if (pcb->lastack == ackno) { + if (pcb->lastack == ackno) {
+ found_dataack = 1; + found_dataack = 1;
+ if ((u8_t)(pcb->dataacks + 1) > pcb->dataacks) { + ++pcb->dataacks;
+ ++pcb->dataacks;
+ }
+ if (pcb->dataacks > MAX_DATA_ACK_NUM) { + if (pcb->dataacks > MAX_DATA_ACK_NUM) {
+ tcp_rexmit_fast(pcb); + tcp_rexmit_fast(pcb);
+ } + }
@ -52,7 +50,7 @@ index 78954bd..d1c5a30 100644
} else if (TCP_SEQ_BETWEEN(ackno, pcb->lastack + 1, pcb->snd_nxt)) { } else if (TCP_SEQ_BETWEEN(ackno, pcb->lastack + 1, pcb->snd_nxt)) {
/* We come here when the ACK acknowledges new data. */ /* We come here when the ACK acknowledges new data. */
tcpwnd_size_t acked; tcpwnd_size_t acked;
@@ -1367,6 +1387,7 @@ tcp_receive(struct tcp_pcb *pcb) @@ -1367,6 +1385,7 @@ tcp_receive(struct tcp_pcb *pcb)
/* Reset the fast retransmit variables. */ /* Reset the fast retransmit variables. */
pcb->dupacks = 0; pcb->dupacks = 0;
pcb->lastack = ackno; pcb->lastack = ackno;
@ -61,14 +59,14 @@ index 78954bd..d1c5a30 100644
/* Update the congestion control variables (cwnd and /* Update the congestion control variables (cwnd and
ssthresh). */ ssthresh). */
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
index 2a61776..bb9aabc 100644 index 2a61776..97cb882 100644
--- a/src/include/lwip/tcp.h --- a/src/include/lwip/tcp.h
+++ b/src/include/lwip/tcp.h +++ b/src/include/lwip/tcp.h
@@ -326,6 +326,7 @@ struct tcp_pcb { @@ -326,6 +326,7 @@ struct tcp_pcb {
/* fast retransmit/recovery */ /* fast retransmit/recovery */
u8_t dupacks; u8_t dupacks;
+ u8_t dataacks; + u32_t dataacks;
u32_t lastack; /* Highest acknowledged seqno. */ u32_t lastack; /* Highest acknowledged seqno. */
/* congestion avoidance/control variables */ /* congestion avoidance/control variables */

View File

@ -4,7 +4,7 @@
Summary: lwip is a small independent implementation of the TCP/IP protocol suite Summary: lwip is a small independent implementation of the TCP/IP protocol suite
Name: lwip Name: lwip
Version: 2.1.3 Version: 2.1.3
Release: 34 Release: 35
License: BSD License: BSD
URL: http://savannah.nongnu.org/projects/lwip/ URL: http://savannah.nongnu.org/projects/lwip/
Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip
@ -135,6 +135,9 @@ cd %{_builddir}/%{name}-%{version}/src
%{_libdir}/liblwip.a %{_libdir}/liblwip.a
%changelog %changelog
* Tue Dec 20 2022 kircher<majun65@huawei.com> - 2.1.3-35
- fix the dataack is always lower than 256
* Tue Dec 20 2022 kircher<majun65@huawei.com> - 2.1.3-34 * Tue Dec 20 2022 kircher<majun65@huawei.com> - 2.1.3-34
- add dataack when recv too many acks with data - add dataack when recv too many acks with data