From cff9209833e43c2d025165c7890410c0ac3775eb Mon Sep 17 00:00:00 2001 From: jiangheng Date: Wed, 23 Oct 2024 20:57:14 +0800 Subject: [PATCH] fix no ack response when lcoal only receive but not send data --- ...nse-when-lcoal-only-receive-but-not-.patch | 78 +++++++++++++++++++ lwip.spec | 7 +- 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 0176-fix-no-ack-response-when-lcoal-only-receive-but-not-.patch diff --git a/0176-fix-no-ack-response-when-lcoal-only-receive-but-not-.patch b/0176-fix-no-ack-response-when-lcoal-only-receive-but-not-.patch new file mode 100644 index 0000000..8a48fd8 --- /dev/null +++ b/0176-fix-no-ack-response-when-lcoal-only-receive-but-not-.patch @@ -0,0 +1,78 @@ +From 3be67e87cf076c53aa98d6f5a0585c96d57823e0 Mon Sep 17 00:00:00 2001 +From: jiangheng +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 + diff --git a/lwip.spec b/lwip.spec index 36c1be8..7ac3755 100644 --- a/lwip.spec +++ b/lwip.spec @@ -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 - 2.2.0-64 +- fix no ack response when lcoal only receive but not send data + * Mon Nov 11 2024 yangchen - 2.2.0-63 - fix IFNAMSIZ definition conflict between lwip and kernel -- Gitee