From 2b5c3921014b857132dba15921941de072ebacc2 Mon Sep 17 00:00:00 2001 From: zhengjiebing Date: Tue, 16 Jan 2024 09:15:35 +0800 Subject: [PATCH] optimize enqueue way for unacked and unsent queue (cherry picked from commit cb830e3e612cca7ba4ad838f59bfd11212b3ad6b) --- ...enqueue-for-unacked-and-unsent-queue.patch | 62 +++++++++++++++++++ lwip.spec | 6 +- 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 0104-optimize-enqueue-for-unacked-and-unsent-queue.patch diff --git a/0104-optimize-enqueue-for-unacked-and-unsent-queue.patch b/0104-optimize-enqueue-for-unacked-and-unsent-queue.patch new file mode 100644 index 0000000..a0ecbdf --- /dev/null +++ b/0104-optimize-enqueue-for-unacked-and-unsent-queue.patch @@ -0,0 +1,62 @@ + src/core/tcp_out.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c +index e5c407e..f1d501b 100644 +--- a/src/core/tcp_out.c ++++ b/src/core/tcp_out.c +@@ -1633,6 +1633,10 @@ tcp_output(struct tcp_pcb *pcb) + pbuf_remove_header(new_seg.p, new_seg.p->tot_len - new_seg.len - TCP_HLEN); + new_seg.p->tot_len = new_seg.p->len; + ++ struct tcp_seg **cur_seg = NULL; ++ if (pcb->unacked != NULL) { ++ cur_seg = &(pcb->unacked); ++ } + for (int start = pbuf_chain_len; start > 0; start--) { + struct tcp_seg *tmp_seg = start_seg; + start_seg = start_seg->next; +@@ -1643,10 +1647,10 @@ tcp_output(struct tcp_pcb *pcb) + pcb->last_unacked = tmp_seg; + pcb->unacked = tmp_seg; + useg = tmp_seg; ++ cur_seg = &(pcb->unacked); + } else { + if (TCP_SEQ_LT(lwip_ntohl(tmp_seg->tcphdr->seqno), lwip_ntohl(useg->tcphdr->seqno))) { + /* add segment to before tail of unacked list, keeping the list sorted */ +- struct tcp_seg **cur_seg = &(pcb->unacked); + while (*cur_seg && + TCP_SEQ_LT(lwip_ntohl((*cur_seg)->tcphdr->seqno), lwip_ntohl(tmp_seg->tcphdr->seqno))) { + cur_seg = &((*cur_seg)->next ); +@@ -2157,7 +2161,10 @@ tcp_rexmit(struct tcp_pcb *pcb) + } + + seg = pcb->unacked; ++#if GAZELLE_ENABLE ++ cur_seg = &(pcb->unsent); + while (seg) { ++#endif + /* Give up if the segment is still referenced by the netif driver + due to deferred transmission. */ + if (tcp_output_segment_busy(seg)) { +@@ -2174,7 +2181,9 @@ tcp_rexmit(struct tcp_pcb *pcb) + pcb->last_unacked = pcb->unacked->next; + pcb->unacked = pcb->unacked->next; + ++#if !GAZELLE_ENABLE + cur_seg = &(pcb->unsent); ++#endif + while (*cur_seg && + TCP_SEQ_LT(lwip_ntohl((*cur_seg)->tcphdr->seqno), lwip_ntohl(seg->tcphdr->seqno))) { + cur_seg = &((*cur_seg)->next); +@@ -2190,8 +2199,10 @@ tcp_rexmit(struct tcp_pcb *pcb) + } + #endif /* TCP_OVERSIZE */ + ++#if GAZELLE_ENABLE + seg = pcb->unacked; + } ++#endif + + if (pcb->nrtx < 0xFF) { + ++pcb->nrtx; diff --git a/lwip.spec b/lwip.spec index 9d21241..cc346da 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.1.3 -Release: 108 +Release: 109 License: BSD URL: http://savannah.nongnu.org/projects/lwip/ Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip @@ -120,6 +120,7 @@ Patch9101: 0102-dfx-add-tcp_in-empty-ack-cnt-and-del-rst-invalid-log.patch Patch6005: backport-tcp_in-fix-ooseq-update-error.patch Patch9102: 0103-adapt-for-dpdk-23.11.patch +Patch9103: 0104-optimize-enqueue-for-unacked-and-unsent-queue.patch BuildRequires: gcc-c++ dos2unix dpdk-devel @@ -149,6 +150,9 @@ cd %{_builddir}/%{name}-%{version}/src %{_libdir}/liblwip.a %changelog +* Tue Jan 16 2024 zhengjiebing - 2.1.3-109 +- optimize enqueue way for unacked and unsent queue + * Mon Jan 15 2024 jiangheng - 2.1.3-108 - adapt for dpdk-23.11