From 8e8105a4deb9813d114dde83581a08f528b9f4ff Mon Sep 17 00:00:00 2001 From: zhengjiebing Date: Tue, 28 May 2024 21:50:27 +0800 Subject: [PATCH] modify max data len --- 0137-modify-max-data-len.patch | 60 ++++++++++++++++++++++++++++++++++ lwip.spec | 5 ++- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 0137-modify-max-data-len.patch diff --git a/0137-modify-max-data-len.patch b/0137-modify-max-data-len.patch new file mode 100644 index 0000000..9e43d24 --- /dev/null +++ b/0137-modify-max-data-len.patch @@ -0,0 +1,60 @@ +diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c +index 0bbeefc..2d32c69 100644 +--- a/src/core/ipv4/ip4.c ++++ b/src/core/ipv4/ip4.c +@@ -1091,6 +1091,10 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d + } + #if GAZELLE_ENABLE + } ++ if (netif->mtu && (p->tot_len > netif->mtu)) { ++ u8_t nxt_hlen = (proto == IP_PROTO_TCP ? TCP_HLEN : UDP_HLEN); ++ pbuf_set_tso(p, netif->mtu - IP_HLEN - nxt_hlen); ++ } + #endif + #endif /* IP_FRAG */ + #if GAZELLE_ENABLE +diff --git a/src/core/ipv6/ip6.c b/src/core/ipv6/ip6.c +index 9017d87..d369673 100644 +--- a/src/core/ipv6/ip6.c ++++ b/src/core/ipv6/ip6.c +@@ -1286,6 +1286,10 @@ ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest, + } + #if GAZELLE_ENABLE + } ++ if (netif->mtu6 && (p->tot_len > netif->mtu6)) { ++ u8_t nxt_hlen = (nexth == IP_PROTO_TCP ? TCP_HLEN : UDP_HLEN); ++ pbuf_set_tso(p, netif->mtu6 - IP6_HLEN - nxt_hlen); ++ } + #endif + #endif /* LWIP_IPV6_FRAG */ + +diff --git a/src/include/dpdk_cksum.h b/src/include/dpdk_cksum.h +index 115155d..e3cb304 100644 +--- a/src/include/dpdk_cksum.h ++++ b/src/include/dpdk_cksum.h +@@ -61,6 +61,12 @@ static inline void pbuf_set_vlan(struct pbuf *p, u16_t vlan_tci) + PBUF_TO_MBUF(p)->vlan_tci = vlan_tci; + } + ++static inline void pbuf_set_tso(struct pbuf *p, u16_t mss) ++{ ++ PBUF_TO_MBUF(p)->ol_flags |= RTE_MBUF_F_TX_TCP_SEG; ++ PBUF_TO_MBUF(p)->tso_segsz = mss; ++} ++ + #if CHECKSUM_CHECK_IP_HW + // for ip4_input + static inline u64_t is_cksum_ipbad(struct pbuf *p) { +diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h +index 4655388..9f2447f 100644 +--- a/src/include/lwipopts.h ++++ b/src/include/lwipopts.h +@@ -215,7 +215,7 @@ + #define TCP_OVERSIZE TCP_MSS + #define LWIP_NETIF_TX_SINGLE_PBUF 1 + +-#define TCP_MSS (FRAME_MTU - IP6_HLEN - TCP_HLEN - VLAN_LEN) ++#define TCP_MSS (FRAME_MTU - IP_HLEN - TCP_HLEN) + + #define TCP_WND (2500 * TCP_MSS) + diff --git a/lwip.spec b/lwip.spec index 20b6d2a..632c139 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: 29 +Release: 30 License: BSD URL: http://savannah.nongnu.org/projects/lwip/ Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip @@ -177,6 +177,9 @@ cd %{_builddir}/%{name}-%{version}/src %{_libdir}/liblwip.a %changelog +* Wed May 29 2024 zhengjiebing - 2.2.0-30 +- modify max data len + * Fri May 24 2024 zhengjiebing - 2.2.0-29 - fix vlan filter bug -- Gitee