!1352 [sync] PR-1316: fix no ack response when lcoal only receive but not send data

From: @openeuler-sync-bot 
Reviewed-by: @jiangheng12 
Signed-off-by: @jiangheng12
This commit is contained in:
openeuler-ci-bot 2024-11-26 02:06:54 +00:00 committed by Gitee
commit c2d4e4762f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 84 additions and 1 deletions

View File

@ -0,0 +1,78 @@
From 3be67e87cf076c53aa98d6f5a0585c96d57823e0 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Wed, 23 Oct 2024 20:52:19 +0800
Subject: [PATCH] fix no ack response when lcoal only receive but not send data
---
src/core/tcp.c | 1 +
src/core/tcp_in.c | 9 +++++++--
src/core/tcp_out.c | 3 ++-
src/include/lwip/tcp.h | 1 +
4 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/core/tcp.c b/src/core/tcp.c
index 849a210..b41036e 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
@@ -2163,6 +2163,7 @@ tcp_alloc(u8_t prio)
#endif
#if GAZELLE_TCP_PINGPONG_MODE
pcb->lrcvtime = 0;
+ pcb->lsndtime = 0;
pcb->pingpong = 0;
#endif
pcb_tci_init(pcb);
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index fa2a88b..d0d1e03 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -1766,12 +1766,17 @@ tcp_receive(struct tcp_pcb *pcb)
/* Acknowledge the segment(s). */
#if GAZELLE_TCP_PINGPONG_MODE
+ pcb->lrcvtime = sys_now();
if (tcp_in_pingpong(pcb)) {
- tcp_clear_flags(pcb, TF_ACK_NOW | TF_ACK_DELAY);
+ if (TIME_BEFORE(pcb->lsndtime + TCP_ATO_MS, pcb->lrcvtime)) {
+ tcp_exit_pingpong(pcb);
+ tcp_ack_now(pcb);
+ } else {
+ tcp_clear_flags(pcb, TF_ACK_NOW | TF_ACK_DELAY);
+ }
} else {
tcp_ack(pcb);
}
- pcb->lrcvtime = sys_now();
#else
tcp_ack(pcb);
#endif
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index 1a55748..93ef958 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -1833,8 +1833,9 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
#endif
#if GAZELLE_TCP_PINGPONG_MODE
+ pcb->lsndtime = sys_now();
if (!tcp_in_pingpong(pcb)) {
- if (TIME_BEFORE(sys_now(), pcb->lrcvtime + TCP_ATO_MS)) {
+ if (TIME_BEFORE(pcb->lsndtime, pcb->lrcvtime + TCP_ATO_MS)) {
tcp_enter_pingpong(pcb);
}
}
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
index a332e80..4e41037 100644
--- a/src/include/lwip/tcp.h
+++ b/src/include/lwip/tcp.h
@@ -304,6 +304,7 @@ struct tcp_pcb {
#define TIME_BEFORE(t, compare_to) ((((u32_t)((t)-(compare_to))) > 0x7fffffff) ? 1 : 0)
#define TCP_ATO_MS 200
u32_t lrcvtime;
+ u32_t lsndtime;
#define TCP_PINGPONG_THRESH 3
u8_t pingpong;
#endif
--
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.2.0
Release: 63
Release: 64
License: BSD
URL: http://savannah.nongnu.org/projects/lwip/
Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip
@ -188,6 +188,8 @@ Patch9172: 0173-IGMP-fix-problem-that-can-not-join-the-sixteen-igmp-.patch
Patch9173: 0174-bugfix-Codedump-occurs-when-the-GAZELLE_TCP_REUSE_IP.patch
Patch9174: 0175-fix-IFNAMSIZ-definition-conflict-between-lwip-and-ke.patch
Patch9175: 0176-fix-no-ack-response-when-lcoal-only-receive-but-not-.patch
BuildRequires: gcc-c++ dos2unix dpdk-devel
#Requires:
@ -216,6 +218,9 @@ cd %{_builddir}/%{name}-%{version}/src
%{_libdir}/liblwip.a
%changelog
* Fri Nov 15 2024 jiangheng <jiangheng14@huawei.com> - 2.2.0-64
- fix no ack response when lcoal only receive but not send data
* Mon Nov 11 2024 yangchen <yangchen145@huawei.com> - 2.2.0-63
- fix IFNAMSIZ definition conflict between lwip and kernel