diff --git a/0180-tso-max-frags-is-configurable.patch b/0180-tso-max-frags-is-configurable.patch new file mode 100644 index 0000000000000000000000000000000000000000..e94c266814dcc5cfbfbc49705e85b8434b3602f4 --- /dev/null +++ b/0180-tso-max-frags-is-configurable.patch @@ -0,0 +1,91 @@ +From 5d09d36ddf74da9c5fa87a6dd5bc104fe99bdce6 Mon Sep 17 00:00:00 2001 +From: jiangheng +Date: Sat, 18 Jan 2025 20:55:43 +0800 +Subject: [PATCH] tso: max frags is configurable + +--- + src/core/netif.c | 10 ++++++++++ + src/core/tcp_out.c | 4 ++-- + src/include/lwip/netif.h | 6 +++++- + src/include/lwipopts.h | 5 ----- + 4 files changed, 17 insertions(+), 8 deletions(-) + +diff --git a/src/core/netif.c b/src/core/netif.c +index eba9a0b..b79ab57 100644 +--- a/src/core/netif.c ++++ b/src/core/netif.c +@@ -1117,6 +1117,16 @@ netif_set_txol_flags(struct netif *netif, u64_t flags) + { + netif->txol_flags |= flags; + } ++ ++void netif_set_max_pbuf_frags(struct netif *netif, u8_t max_frags) ++{ ++ netif->max_pbuf_frags = max_frags; ++} ++ ++void netif_set_min_tso_seglen(struct netif *netif, u16_t min_tso_seglen) ++{ ++ netif->min_tso_seglen = min_tso_seglen; ++} + #endif + + #if LWIP_NETIF_LINK_CALLBACK +diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c +index 93ef958..cf93482 100644 +--- a/src/core/tcp_out.c ++++ b/src/core/tcp_out.c +@@ -1578,8 +1578,8 @@ tcp_output(struct tcp_pcb *pcb) + struct tcp_seg *last_seg = NULL; + u16_t last_seg_len = 0; + u8_t pbuf_chain_len = 0; +- while (seg != NULL && seg_seqno - pcb->lastack + seg->len <= wnd && pbuf_chain_len < GAZELLE_TCP_MAX_PBUF_CHAIN_LEN) { +- if (last_seg_len != 0 && (last_seg_len + seg->len < 1460) && seg->len < GAZELLE_TCP_MIN_TSO_SEG_LEN) { ++ while (seg != NULL && seg_seqno - pcb->lastack + seg->len <= wnd && pbuf_chain_len < netif->max_pbuf_frags) { ++ if (last_seg_len != 0 && (last_seg_len + seg->len < 1460) && seg->len < netif->min_tso_seglen) { + break; + } + +diff --git a/src/include/lwip/netif.h b/src/include/lwip/netif.h +index 3deefb0..75157de 100644 +--- a/src/include/lwip/netif.h ++++ b/src/include/lwip/netif.h +@@ -372,6 +372,9 @@ struct netif { + /** vlan id is an attribute of NIC. The variable 'netif_hints' is not used because it is assigned by pcb, + * while non transport layers without pcb cannot be enabled */ + u16_t vlan_tci; ++ ++ u8_t max_pbuf_frags; ++ u16_t min_tso_seglen; + #endif + /** descriptive abbreviation */ + char name[2]; +@@ -508,7 +511,8 @@ void netif_set_vlan_tci(struct netif *netif, u16_t vlan_tci); + void netif_set_rtc_mode(struct netif *netif); + void netif_set_rxol_flags(struct netif *netif, u64_t flags); + void netif_set_txol_flags(struct netif *netif, u64_t flags); +- ++void netif_set_min_tso_seglen(struct netif *netif, u16_t min_tso_seglen); ++void netif_set_max_pbuf_frags(struct netif *netif, u8_t max_frags); + #endif + + #if LWIP_NETIF_STATUS_CALLBACK +diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h +index 572d550..2ac48f5 100644 +--- a/src/include/lwipopts.h ++++ b/src/include/lwipopts.h +@@ -55,11 +55,6 @@ + + #define GAZELLE_TCP_NEW_PORT 1 + +-#define GAZELLE_TCP_MAX_PBUF_CHAIN_LEN 40 +- +-#define GAZELLE_TCP_MIN_TSO_SEG_LEN 256 +- +- + #define GAZELLE_UDP_ENABLE 1 + #define GAZELLE_UDP_NEW_PORT 1 + +-- +2.33.0 + diff --git a/lwip.spec b/lwip.spec index 2a6e545cfc817cdf1de604a1b1d5e73471fa6c40..f88116cbcde1655b82507827e7917f1d736024f2 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: 68 +Release: 69 License: BSD URL: http://savannah.nongnu.org/projects/lwip/ Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip @@ -194,6 +194,8 @@ Patch9177: 0177-pingpong-fix-spelling-error.patch Patch9178: 0178-add-recv_block-in-lwip_sock.patch Patch9179: 0179-fix-pcb.tcp-null-pointer-error-when-netperf-recv-RST.patch +Patch9180: 0180-tso-max-frags-is-configurable.patch + BuildRequires: gcc-c++ dos2unix dpdk-devel #Requires: @@ -222,6 +224,9 @@ cd %{_builddir}/%{name}-%{version}/src %{_libdir}/liblwip.a %changelog +* Sat Jan 18 2025 jiangheng - 2.2.0-69 +- tso: max frags is configurable + * Tue Jan 14 2025 yangchen - 2.2.0-68 - fix pcb.tcp null pointer error when netperf recv RST