diff --git a/0111-support-udp-pkglen-mtu-modify-IP_REASS_MAX_PBUFS.patch b/0111-support-udp-pkglen-mtu-modify-IP_REASS_MAX_PBUFS.patch new file mode 100644 index 0000000..895ab7e --- /dev/null +++ b/0111-support-udp-pkglen-mtu-modify-IP_REASS_MAX_PBUFS.patch @@ -0,0 +1,26 @@ +From b619f034c74d53bd6d8b572cb47fdb58fd90d7ae Mon Sep 17 00:00:00 2001 +From: yangchen +Date: Wed, 6 Mar 2024 11:00:56 +0800 +Subject: [PATCH] support udp pkglen > mtu: modify IP_REASS_MAX_PBUFS + +--- + src/include/lwipopts.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h +index 28b8aca..d067dea 100644 +--- a/src/include/lwipopts.h ++++ b/src/include/lwipopts.h +@@ -171,6 +171,9 @@ + + #define IP_HLEN 20 + ++/* the max pbuf num of a udp pbuf chain is ((65535 + MBUF_MAX_DATA_LEN - 1) / MBUF_MAX_DATA_LEN) */ ++#define IP_REASS_MAX_PBUFS 46 ++ + /* + ------------------------------------- + ----------- IPv6 options ----------- +-- +2.33.0 + 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/0113-fix-duplicate-pbuf_free-in-udp_sendto.patch b/0113-fix-duplicate-pbuf_free-in-udp_sendto.patch new file mode 100644 index 0000000..30c7aa5 --- /dev/null +++ b/0113-fix-duplicate-pbuf_free-in-udp_sendto.patch @@ -0,0 +1,24 @@ +From 3b0bca4b38276c95f1305247ebf8a3db02ff5d83 Mon Sep 17 00:00:00 2001 +From: liyunqing +Date: Thu, 7 Mar 2024 11:18:00 +0800 +Subject: [PATCH] fix duplicate pbuf_free in udp_sendto + +--- + src/core/udp.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/core/udp.c b/src/core/udp.c +index 440f909..ff5c99b 100644 +--- a/src/core/udp.c ++++ b/src/core/udp.c +@@ -680,7 +680,6 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, + struct pbuf *udp_pbuf = do_lwip_get_from_sendring((struct lwip_sock *)(p->payload), p->tot_len, &apiflags); + do_lwip_get_from_sendring_over((struct lwip_sock *)(p->payload)); + +- pbuf_free(p); + p = udp_pbuf; + if (p == NULL) { + return ERR_MEM; +-- +2.27.0 + diff --git a/0114-sync-recv-flags-with-linux-kernel.patch b/0114-sync-recv-flags-with-linux-kernel.patch new file mode 100644 index 0000000..33266c9 --- /dev/null +++ b/0114-sync-recv-flags-with-linux-kernel.patch @@ -0,0 +1,40 @@ +From 931c9ff6d250685ce29cf10e3e03ecaae70419ea Mon Sep 17 00:00:00 2001 +From: liyunqing +Date: Tue, 27 Feb 2024 15:40:33 +0800 +Subject: [PATCH] sync recv flags with linux kernel + +--- + src/include/lwip/sockets.h | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h +index 89b6eb5..4466f11 100644 +--- a/src/include/lwip/sockets.h ++++ b/src/include/lwip/sockets.h +@@ -281,14 +281,22 @@ struct linger { + #define IPPROTO_UDPLITE 136 + #define IPPROTO_RAW 255 + ++#if GAZELLE_ENABLE + /* Flags we can use with send and recv. */ ++#define MSG_PEEK 0x02 /* Peeks at an incoming message */ ++#define MSG_WAITALL 0x100 /* Unimplemented: Requests that the function block until the full amount of data requested can be returned */ ++#define MSG_OOB 0x01 /* Unimplemented: Requests out-of-band data. The significance and semantics of out-of-band data are protocol-specific */ ++#define MSG_DONTWAIT 0x40 /* Nonblocking i/o for this operation only */ ++#define MSG_MORE 0x8000 /* Sender will send more */ ++#define MSG_NOSIGNAL 0x4000 /* Uninmplemented: Requests not to send the SIGPIPE signal if an attempt to send is made on a stream-oriented socket that is no longer connected. */ ++#else + #define MSG_PEEK 0x01 /* Peeks at an incoming message */ + #define MSG_WAITALL 0x02 /* Unimplemented: Requests that the function block until the full amount of data requested can be returned */ + #define MSG_OOB 0x04 /* Unimplemented: Requests out-of-band data. The significance and semantics of out-of-band data are protocol-specific */ + #define MSG_DONTWAIT 0x08 /* Nonblocking i/o for this operation only */ + #define MSG_MORE 0x10 /* Sender will send more */ + #define MSG_NOSIGNAL 0x20 /* Uninmplemented: Requests not to send the SIGPIPE signal if an attempt to send is made on a stream-oriented socket that is no longer connected. */ +- ++#endif /* GAZELLE_ENABLE */ + + /* + * Options for level IPPROTO_IP +-- +2.27.0 + diff --git a/lwip.spec b/lwip.spec index 40bdbb0..77092c5 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: 3 +Release: 7 License: BSD URL: http://savannah.nongnu.org/projects/lwip/ Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip @@ -122,6 +122,10 @@ Patch9106: 0107-fix-move-lpcb-to-the-front-of-list-error.patch 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 +Patch9112: 0113-fix-duplicate-pbuf_free-in-udp_sendto.patch +Patch9113: 0114-sync-recv-flags-with-linux-kernel.patch BuildRequires: gcc-c++ dos2unix dpdk-devel @@ -151,6 +155,18 @@ cd %{_builddir}/%{name}-%{version}/src %{_libdir}/liblwip.a %changelog +* Mon Mar 11 2024 liyunqing - 2.2.0-7 +- sync macros with kernel defined which use in recv and send + +* Thu Mar 7 2024 liyunqing - 2.2.0-6 +- fix duplicate pbuf_free in udp_sendto + +* 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 + * Tue Mar 5 2024 jiangheng - 2.2.0-3 - remove backport patches - sys_mbox_new return error when rte ring create failed