support udp pkglen > mtu: modify netbuf_alloc size

This commit is contained in:
yangchen 2024-03-06 16:21:07 +08:00 committed by jiangheng
parent 3a29228de1
commit 5042819c0a
2 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,38 @@
From 1e4e2fe5d7239da26edf89f554f929c10e0d5573 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
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

View File

@ -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 <yangchen145@huawei.com> - 2.2.0-5
- support udp pkglen > mtu: modify netbuf_alloc size
* Tue Mar 5 2024 yangchen <yangchen145@huawei.com> - 2.2.0-4
- support udp pkglen > mtu: modify IP_REASS_MAX_PBUFS