diff --git a/0042-expand-recv-win.patch b/0042-expand-recv-win.patch new file mode 100644 index 0000000..38438ac --- /dev/null +++ b/0042-expand-recv-win.patch @@ -0,0 +1,39 @@ +From 288d56ebd68f366d3fa2ee1521120016fb21bf31 Mon Sep 17 00:00:00 2001 +From: wuchangsheng +Date: Sat, 17 Dec 2022 19:14:36 +0800 +Subject: [PATCH 1/2] expand recv win + +--- + src/include/lwip/opt.h | 2 +- + src/include/lwipopts.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h +index 9d41a09..718816b 100644 +--- a/src/include/lwip/opt.h ++++ b/src/include/lwip/opt.h +@@ -1483,7 +1483,7 @@ + */ + #if !defined LWIP_WND_SCALE || defined __DOXYGEN__ + #define LWIP_WND_SCALE 1 +-#define TCP_RCV_SCALE 0 ++#define TCP_RCV_SCALE 6 + #endif + + /** +diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h +index d7b9635..907c630 100644 +--- a/src/include/lwipopts.h ++++ b/src/include/lwipopts.h +@@ -95,7 +95,7 @@ + + #define TCP_MSS (FRAME_MTU - IP_HLEN - TCP_HLEN) + +-#define TCP_WND (40 * TCP_MSS) ++#define TCP_WND (2500 * TCP_MSS) + + #define TCP_SND_BUF (2500 * TCP_MSS) + +-- +2.8.4.windows.1 + diff --git a/0043-add-prefetch.patch b/0043-add-prefetch.patch new file mode 100644 index 0000000..082503f --- /dev/null +++ b/0043-add-prefetch.patch @@ -0,0 +1,62 @@ +From 3d63cb611a0b7a3cde0bb9e74b0ec83501966c51 Mon Sep 17 00:00:00 2001 +From: wuchangsheng +Date: Sun, 18 Dec 2022 18:50:33 +0800 +Subject: [PATCH 2/2] add prefetch + +--- + src/core/pbuf.c | 7 +++++++ + src/core/tcp_out.c | 6 ++++++ + 2 files changed, 13 insertions(+) + +diff --git a/src/core/pbuf.c b/src/core/pbuf.c +index 404c8a7..ad75aa6 100644 +--- a/src/core/pbuf.c ++++ b/src/core/pbuf.c +@@ -83,6 +83,9 @@ + #if LWIP_CHECKSUM_ON_COPY + #include "lwip/inet_chksum.h" + #endif ++#if USE_LIBOS ++#include ++#endif + + #include + +@@ -750,6 +753,10 @@ pbuf_free(struct pbuf *p) + /* de-allocate all consecutive pbufs from the head of the chain that + * obtain a zero reference count after decrementing*/ + while (p != NULL) { ++#if USE_LIBOS ++ if (p->next) ++ rte_prefetch0(p->next); ++#endif + LWIP_PBUF_REF_T ref; + SYS_ARCH_DECL_PROTECT(old_level); + /* Since decrementing ref cannot be guaranteed to be a single machine operation +diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c +index 55053d8..3c4dc4b 100644 +--- a/src/core/tcp_out.c ++++ b/src/core/tcp_out.c +@@ -82,6 +82,7 @@ + + #if USE_LIBOS + #include "lwipsock.h" ++#include + #if CHECKSUM_GEN_TCP_HW + #include "dpdk_cksum.h" + #endif +@@ -1762,6 +1763,11 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif + } + #endif + ++#if USE_LIBOS ++ /* pbuf into mbuf. ref dpdk_common.h */ ++ rte_prefetch0((uint8_t *)(seg->p) - sizeof(struct rte_mbuf) - sizeof(uint64_t) * 2); ++#endif ++ + /* Set retransmission timer running if it is not currently enabled + This must be set before checking the route. */ + if (pcb->rtime < 0) { +-- +2.8.4.windows.1 + diff --git a/lwip.spec b/lwip.spec index a83980f..2155d2e 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: 30 +Release: 31 License: BSD URL: http://savannah.nongnu.org/projects/lwip/ Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip @@ -53,6 +53,8 @@ Patch9037: 0038-add-tso.patch Patch9038: 0039-optimize-app-thread-write-buff-block.patch Patch9039: 0040-add-huge-snd_buf.patch Patch9040: 0041-optimite-pcb-list-limit-send-size-and-ack-now.patch +Patch9041: 0042-expand-recv-win.patch +Patch9042: 0043-add-prefetch.patch BuildRequires: gcc-c++ dos2unix dpdk-devel @@ -110,6 +112,8 @@ find %{_builddir}/%{name}-%{version} -type f -exec dos2unix -q {} \; %patch9038 -p1 %patch9039 -p1 %patch9040 -p1 +%patch9041 -p1 +%patch9042 -p1 %build cd %{_builddir}/%{name}-%{version}/src @@ -125,6 +129,9 @@ cd %{_builddir}/%{name}-%{version}/src %{_libdir}/liblwip.a %changelog +* Sun Dec 18 2022 wuchangsheng - 2.1.3-31 +- expand rcv wnd size and add prefetch + * Tue Dec 13 2022 wuchangsheng - 2.1.3-30 - optimite pcb unsent and unacked list fast rexmit all pkts