!175 [sync] PR-171: add dataack when recv too many acks with data

From: @openeuler-sync-bot 
Reviewed-by: @wu-changsheng 
Signed-off-by: @wu-changsheng
This commit is contained in:
openeuler-ci-bot 2022-12-20 11:00:55 +00:00 committed by Gitee
commit 4697ceb54f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 96 additions and 1 deletions

View File

@ -0,0 +1,90 @@
From 25b8974efd98150788896f51d5b9a1e23a82e78b Mon Sep 17 00:00:00 2001
From: kircher <majun65@huawei.com>
Date: Tue, 20 Dec 2022 16:36:51 +0800
Subject: [PATCH] add-dataack-when-recv-too-many-acks-with-data
---
src/core/tcp_in.c | 21 +++++++++++++++++++++
src/include/lwip/tcp.h | 1 +
src/include/lwipopts.h | 2 ++
3 files changed, 24 insertions(+)
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 78954bd..d1c5a30 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -1260,6 +1260,7 @@ tcp_receive(struct tcp_pcb *pcb)
s16_t m;
u32_t right_wnd_edge;
int found_dupack = 0;
+ int found_dataack = 0;
LWIP_ASSERT("tcp_receive: invalid pcb", pcb != NULL);
LWIP_ASSERT("tcp_receive: wrong state", pcb->state >= ESTABLISHED);
@@ -1337,11 +1338,30 @@ tcp_receive(struct tcp_pcb *pcb)
}
}
}
+ /* fast rexmit when receive too many acks with data */
+ if (TCP_SEQ_LT(ackno + 1, pcb->snd_nxt)) {
+ if (pcb->snd_wl2 + pcb->snd_wnd == right_wnd_edge) {
+ if (pcb->rtime >= 0) {
+ if (pcb->lastack == ackno) {
+ found_dataack = 1;
+ if ((u8_t)(pcb->dataacks + 1) > pcb->dataacks) {
+ ++pcb->dataacks;
+ }
+ if (pcb->dataacks > MAX_DATA_ACK_NUM) {
+ tcp_rexmit_fast(pcb);
+ }
+ }
+ }
+ }
+ }
/* If Clause (1) or more is true, but not a duplicate ack, reset
* count of consecutive duplicate acks */
if (!found_dupack) {
pcb->dupacks = 0;
}
+ if (!found_dataack) {
+ pcb->dataacks = 0;
+ }
} else if (TCP_SEQ_BETWEEN(ackno, pcb->lastack + 1, pcb->snd_nxt)) {
/* We come here when the ACK acknowledges new data. */
tcpwnd_size_t acked;
@@ -1367,6 +1387,7 @@ tcp_receive(struct tcp_pcb *pcb)
/* Reset the fast retransmit variables. */
pcb->dupacks = 0;
pcb->lastack = ackno;
+ pcb->dataacks = 0;
/* Update the congestion control variables (cwnd and
ssthresh). */
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
index 2a61776..bb9aabc 100644
--- a/src/include/lwip/tcp.h
+++ b/src/include/lwip/tcp.h
@@ -326,6 +326,7 @@ struct tcp_pcb {
/* fast retransmit/recovery */
u8_t dupacks;
+ u8_t dataacks;
u32_t lastack; /* Highest acknowledged seqno. */
/* congestion avoidance/control variables */
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index 907c630..405cf11 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -177,6 +177,8 @@
#define MIN_TSO_SEG_LEN 256
+#define MAX_DATA_ACK_NUM 256
+
/* ---------------------------------------
* ------- NIC offloads --------
* ---------------------------------------
--
2.33.0

View File

@ -4,7 +4,7 @@
Summary: lwip is a small independent implementation of the TCP/IP protocol suite
Name: lwip
Version: 2.1.3
Release: 33
Release: 34
License: BSD
URL: http://savannah.nongnu.org/projects/lwip/
Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip
@ -57,6 +57,7 @@ Patch9041: 0042-expand-recv-win.patch
Patch9042: 0043-add-prefetch.patch
Patch9043: 0044-skip-unnecessary-tcp_route.patch
Patch9044: 0045-add-variable-in-struct-sock.patch
Patch9045: 0046-add-dataack-when-recv-too-many-acks-with-data.patch
BuildRequires: gcc-c++ dos2unix dpdk-devel
@ -118,6 +119,7 @@ find %{_builddir}/%{name}-%{version} -type f -exec dos2unix -q {} \;
%patch9042 -p1
%patch9043 -p1
%patch9044 -p1
%patch9045 -p1
%build
cd %{_builddir}/%{name}-%{version}/src
@ -133,6 +135,9 @@ cd %{_builddir}/%{name}-%{version}/src
%{_libdir}/liblwip.a
%changelog
* Tue Dec 20 2022 kircher<majun65@huawei.com> - 2.1.3-34
- add dataack when recv too many acks with data
* Tue Dec 20 2022 wuchangsheng<wuchangsheng2@huawei.com> - 2.1.3-33
- add variable in struct sock