!289 [sync] PR-284: fix last_unsent/last_unacked error

From: @openeuler-sync-bot 
Reviewed-by: @jiangheng12 
Signed-off-by: @jiangheng12
This commit is contained in:
openeuler-ci-bot 2023-04-11 01:11:03 +00:00 committed by Gitee
commit 67c7538105
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 121 additions and 1 deletions

View File

@ -0,0 +1,114 @@
From f1692b0c380241699f70adbf7796cb2c7b3a5c94 Mon Sep 17 00:00:00 2001
From: jiangheng12 <jiangheng14@huawei.com>
Date: Sat, 1 Apr 2023 16:59:28 +0800
Subject: [PATCH] fix last_unsent/last_unacked
---
src/core/tcp_in.c | 25 +++++++++++++------------
src/core/tcp_out.c | 18 +++++++++++++-----
2 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 719cf04..7e7d70a 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -1375,18 +1375,19 @@ 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;
- ++pcb->dataacks;
- if (pcb->dataacks > GAZELLE_TCP_MAX_DATA_ACK_NUM) {
- if (tcp_rexmit(pcb) == ERR_OK) {
- pcb->rtime = 0;
- pcb->dataacks = 0;
+ } else {
+ /* 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;
+ ++pcb->dataacks;
+ if ((pcb->dataacks > GAZELLE_TCP_MAX_DATA_ACK_NUM) && (pcb->nrtx < (TCP_MAXRTX / 2))) {
+ if (tcp_rexmit(pcb) == ERR_OK) {
+ pcb->rtime = 0;
+ pcb->dataacks = 0;
+ }
}
}
}
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index b1c317d..6250e6b 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -1444,10 +1444,7 @@ tcp_output(struct tcp_pcb *pcb)
pcb->persist_backoff = 0;
/* useg should point to last segment on unacked queue */
- useg = pcb->unacked;
- if (useg != NULL) {
- for (; useg->next != NULL; useg = useg->next);
- }
+ useg = pcb->last_unacked;
/* data available and window allows it to be sent? */
#if GAZELLE_ENABLE
@@ -1515,7 +1512,11 @@ tcp_output(struct tcp_pcb *pcb)
return err;
}
+ if (pcb->last_unsent == pcb->unsent) {
+ pcb->last_unsent = last_seg->next;
+ }
pcb->unsent = last_seg->next;
+
if (pcb->state != SYN_SENT) {
tcp_clear_flags(pcb, TF_ACK_DELAY | TF_ACK_NOW);
}
@@ -1535,6 +1536,7 @@ tcp_output(struct tcp_pcb *pcb)
if (TCP_TCPLEN(tmp_seg) > 0) {
tmp_seg->next = NULL;
if (pcb->unacked == NULL) {
+ pcb->last_unacked = tmp_seg;
pcb->unacked = tmp_seg;
useg = tmp_seg;
} else {
@@ -1550,6 +1552,9 @@ tcp_output(struct tcp_pcb *pcb)
} else {
/* add segment to tail of unacked list */
useg->next = tmp_seg;
+ if (pcb->last_unacked == useg) {
+ pcb->last_unacked = tmp_seg;
+ }
useg = useg->next;
}
}
@@ -1603,6 +1608,9 @@ end_loop:
#if TCP_OVERSIZE_DBGCHECK
seg->oversize_left = 0;
#endif /* TCP_OVERSIZE_DBGCHECK */
+ if (pcb->last_unsent == pcb->unsent) {
+ pcb->last_unsent = seg->next;
+ }
pcb->unsent = seg->next;
if (pcb->state != SYN_SENT) {
tcp_clear_flags(pcb, TF_ACK_DELAY | TF_ACK_NOW);
@@ -1709,7 +1717,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
int seg_chksum_was_swapped = 0;
#endif
-#if USE_LIBOS
+#if GAZELLE_ENABLE
lstack_calculate_aggregate(1, seg->len);
#endif
--
2.23.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: 49
Release: 50
License: BSD
URL: http://savannah.nongnu.org/projects/lwip/
Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip
@ -70,6 +70,7 @@ Patch9054: 0055-add-pbuf-lock-when-aggregate-pbuf.patch
Patch9055: 0056-fix-tso-small-packet-drop-in-kernel-server.patch
Patch9056: 0057-same-node-gazellectl-a.patch
Patch9057: 0058-lwip-send-recv-thread-bind-numa.patch
Patch9058: 0059-fix-last_unsent-last_unacked.patch
BuildRequires: gcc-c++ dos2unix dpdk-devel
@ -144,6 +145,7 @@ find %{_builddir}/%{name}-%{version} -type f -exec dos2unix -q {} \;
%patch9055 -p1
%patch9056 -p1
%patch9057 -p1
%patch9058 -p1
%build
cd %{_builddir}/%{name}-%{version}/src
@ -159,6 +161,10 @@ cd %{_builddir}/%{name}-%{version}/src
%{_libdir}/liblwip.a
%changelog
* Sat Apr 01 2023 jiangheng <jiangheng14@huawei.com> - 2.1.3-50
- fix last_unsent/last_unacked error
- fix send failed due to pcb->nrtx > TCP_MAXRTX
* Wed Mar 22 2023 kircher <majun65@huawei.com> - 2.1.3-49
- lwip send recv thread bind numa