From 5042819c0ae05f6a0b00678601f93f9e802ebde4 Mon Sep 17 00:00:00 2001 From: yangchen Date: Wed, 6 Mar 2024 16:21:07 +0800 Subject: [PATCH] support udp pkglen > mtu: modify netbuf_alloc size --- ...-pkglen-mtu-modify-netbuf_alloc-size.patch | 38 +++++++++++++++++++ lwip.spec | 6 ++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 0112-support-udp-pkglen-mtu-modify-netbuf_alloc-size.patch diff --git a/0112-support-udp-pkglen-mtu-modify-netbuf_alloc-size.patch b/0112-support-udp-pkglen-mtu-modify-netbuf_alloc-size.patch new file mode 100644 index 0000000..58068f9 --- /dev/null +++ b/0112-support-udp-pkglen-mtu-modify-netbuf_alloc-size.patch @@ -0,0 +1,38 @@ +From 1e4e2fe5d7239da26edf89f554f929c10e0d5573 Mon Sep 17 00:00:00 2001 +From: yangchen +Date: Wed, 6 Mar 2024 18:25:19 +0800 +Subject: [PATCH] support udp pkglen > mtu: modify netbuf_alloc size + +--- + src/api/sockets.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/api/sockets.c b/src/api/sockets.c +index 923518c..66f6e2c 100644 +--- a/src/api/sockets.c ++++ b/src/api/sockets.c +@@ -1891,7 +1891,13 @@ lwip_sendto(int s, const void *data, size_t size, int flags, + /* make the buffer point to the data that should be sent */ + #if LWIP_NETIF_TX_SINGLE_PBUF + /* Allocate a new netbuf and copy the data into it. */ ++#if GAZELLE_ENABLE ++ /* In the gazelle scenario, only use buf.p->payload and buf.p->tot_len, and ++ buf.p->payload stores the sock pointer info. Don't need to alloc short_size */ ++ if (netbuf_alloc(&buf, 0) == NULL) { ++#else + if (netbuf_alloc(&buf, short_size) == NULL) { ++#endif + err = ERR_MEM; + } else { + #if LWIP_CHECKSUM_ON_COPY +@@ -1905,6 +1911,7 @@ lwip_sendto(int s, const void *data, size_t size, int flags, + /* In the gazelle scenario, the payload is stored in send_ring, + and the payload stores the sock pointer information. */ + buf.p->payload = (void *)sock; ++ buf.p->tot_len = short_size; + #else + MEMCPY(buf.p->payload, data, short_size); + #endif +-- +2.33.0 + diff --git a/lwip.spec b/lwip.spec index 6e53d4c..2173183 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: 4 +Release: 5 License: BSD URL: http://savannah.nongnu.org/projects/lwip/ Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip @@ -123,6 +123,7 @@ Patch9107: 0108-fix-receive-fin-packet-process-error.patch Patch9108: 0109-support-udp-recv-zero-packets.patch Patch9109: 0110-adapt-lwip-2.2.0.patch Patch9110: 0111-support-udp-pkglen-mtu-modify-IP_REASS_MAX_PBUFS.patch +Patch9111: 0112-support-udp-pkglen-mtu-modify-netbuf_alloc-size.patch BuildRequires: gcc-c++ dos2unix dpdk-devel @@ -152,6 +153,9 @@ cd %{_builddir}/%{name}-%{version}/src %{_libdir}/liblwip.a %changelog +* Wed Mar 6 2024 yangchen - 2.2.0-5 +- support udp pkglen > mtu: modify netbuf_alloc size + * Tue Mar 5 2024 yangchen - 2.2.0-4 - support udp pkglen > mtu: modify IP_REASS_MAX_PBUFS