diff --git a/0023-refactor-event-and-checksum-offload-support.patch b/0023-refactor-event-and-checksum-offload-support.patch index ec4fb7e..b092d04 100644 --- a/0023-refactor-event-and-checksum-offload-support.patch +++ b/0023-refactor-event-and-checksum-offload-support.patch @@ -1,704 +1,698 @@ -From bf0f60d944d39a737d18931afbd86103a0344e8c Mon Sep 17 00:00:00 2001 -From: jiangheng -Date: Tue, 29 Mar 2022 21:33:17 +0800 -Subject: [PATCH] 23patch - ---- - src/api/api_msg.c | 9 ++++ - src/api/posix_api.c | 2 + - src/api/sockets.c | 4 +- - src/core/ipv4/icmp.c | 13 ++++++ - src/core/ipv4/ip4.c | 24 ++++++++++- - src/core/ipv4/ip4_frag.c | 23 ++++++++++ - src/core/pbuf.c | 2 +- - src/core/tcp_in.c | 17 ++++++++ - src/core/tcp_out.c | 72 ++++++++++++++++++++++++++++++- - src/include/dpdk_cksum.h | 107 +++++++++++++++++++++++++++++++++++++++++++++++ - src/include/lwip/pbuf.h | 11 ++++- - src/include/lwipopts.h | 30 +++++++++---- - src/include/lwipsock.h | 18 ++++---- - src/netif/ethernet.c | 8 ++++ - 14 files changed, 314 insertions(+), 26 deletions(-) - create mode 100644 src/include/dpdk_cksum.h - -diff --git a/src/api/api_msg.c b/src/api/api_msg.c -index 88b0bc2..36a914b 100644 ---- a/src/api/api_msg.c -+++ b/src/api/api_msg.c -@@ -57,6 +57,7 @@ - #if USE_LIBOS - #include "lwip/sockets.h" - #include "lwipsock.h" -+#include "posix_api.h" - #endif - - #include -@@ -1755,7 +1756,15 @@ lwip_netconn_do_writemore(struct netconn *conn WRITE_DELAYED_PARAM) - } else { - write_more = 0; - } -+#if USE_LIBOS -+ /* vector->ptr is private arg sock */ -+ LWIP_UNUSED_ARG(dataptr); -+ write_more = 0; -+ err = tcp_write(conn->pcb.tcp, conn->current_msg->msg.w.vector->ptr, len, apiflags); -+ conn->current_msg->msg.w.len = len; -+#else - err = tcp_write(conn->pcb.tcp, dataptr, len, apiflags); -+#endif - if (err == ERR_OK) { - conn->current_msg->msg.w.offset += len; - conn->current_msg->msg.w.vector_off += len; -diff --git a/src/api/posix_api.c b/src/api/posix_api.c -index bce07f5..3f85bad 100644 ---- a/src/api/posix_api.c -+++ b/src/api/posix_api.c -@@ -42,6 +42,7 @@ - - #include "lwip/err.h" - #include "lwipsock.h" -+#include "posix_api.h" - - posix_api_t *posix_api; - posix_api_t posix_api_val; -@@ -64,6 +65,7 @@ void posix_api_fork(void) - posix_api->get_socket = chld_get_socket; - } - -+ - int posix_api_init(void) - { - /* the symbol we use here won't be NULL, so we don't need dlerror() -diff --git a/src/api/sockets.c b/src/api/sockets.c -index 597ce15..cebe9de 100644 ---- a/src/api/sockets.c -+++ b/src/api/sockets.c -@@ -65,6 +65,7 @@ - #if USE_LIBOS - #include - #include "lwipsock.h" -+#include "posix_api.h" - #endif - - #include -@@ -2676,9 +2677,6 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len) - check_waiters = 0; - } - sock->sendevent = 1; --#if USE_LIBOS -- add_epoll_event(conn, EPOLLOUT); --#endif - break; - case NETCONN_EVT_SENDMINUS: - sock->sendevent = 0; -@@ -4371,6 +4371,16 @@ void lwip_exit(void) - return; - } - -+static PER_THREAD int g_stack_tid = 0; -+int gettid(void) -+{ -+ if (g_stack_tid == 0) { -+ g_stack_tid = syscall(__NR_gettid); -+ } -+ -+ return (int)g_stack_tid; -+} -+ - #endif /* USE_LIBOS */ - - #endif /* LWIP_SOCKET */ - -diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c -index a462ccd..d471b02 100644 ---- a/src/core/ipv4/icmp.c -+++ b/src/core/ipv4/icmp.c -@@ -51,6 +51,10 @@ - - #include - -+#if USE_LIBOS && CHECKSUM_GEN_IP_HW -+#include "dpdk_cksum.h" -+#endif -+ - #ifdef LWIP_HOOK_FILENAME - #include LWIP_HOOK_FILENAME - #endif -@@ -236,7 +240,16 @@ icmp_input(struct pbuf *p, struct netif *inp) - IPH_CHKSUM_SET(iphdr, 0); - #if CHECKSUM_GEN_IP - IF__NETIF_CHECKSUM_ENABLED(inp, NETIF_CHECKSUM_GEN_IP) { -+#if CHECKSUM_GEN_IP_HW -+ if (get_eth_params_tx_ol() & DEV_TX_OFFLOAD_IPV4_CKSUM) { -+ iph_cksum_set(p, hlen, 1); -+ } else { -+ iph_cksum_set(p, hlen, 0); -+ IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, hlen)); -+ } -+#else - IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, hlen)); -+#endif - } - #endif /* CHECKSUM_GEN_IP */ - -diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c -index c83afbe..1334cdc 100644 ---- a/src/core/ipv4/ip4.c -+++ b/src/core/ipv4/ip4.c -@@ -59,6 +59,10 @@ - - #include - -+#if USE_LIBOS && (CHECKSUM_CHECK_IP_HW || CHECKSUM_GEN_IP_HW) -+#include "dpdk_cksum.h" -+#endif -+ - #ifdef LWIP_HOOK_FILENAME - #include LWIP_HOOK_FILENAME - #endif -@@ -503,8 +507,17 @@ ip4_input(struct pbuf *p, struct netif *inp) - /* verify checksum */ - #if CHECKSUM_CHECK_IP - IF__NETIF_CHECKSUM_ENABLED(inp, NETIF_CHECKSUM_CHECK_IP) { -+#if CHECKSUM_CHECK_IP_HW -+ u64_t ret; -+ if (get_eth_params_rx_ol() & DEV_RX_OFFLOAD_IPV4_CKSUM) { -+ ret = is_cksum_ipbad(p); -+ } else { -+ ret = (u64_t)inet_chksum(iphdr, iphdr_hlen); -+ } -+ if (ret != 0) { -+#else - if (inet_chksum(iphdr, iphdr_hlen) != 0) { -- -+#endif - LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, - ("Checksum (0x%"X16_F") failed, IP packet dropped.\n", inet_chksum(iphdr, iphdr_hlen))); - ip4_debug_print(p); -@@ -972,7 +985,16 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d - IPH_CHKSUM_SET(iphdr, 0); - #if CHECKSUM_GEN_IP - IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_IP) { -+#if CHECKSUM_GEN_IP_HW -+ if (get_eth_params_tx_ol() & DEV_TX_OFFLOAD_IPV4_CKSUM) { -+ iph_cksum_set(p, ip_hlen, 1); -+ } else { -+ iph_cksum_set(p, ip_hlen, 0); -+ IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, ip_hlen)); -+ } -+#else - IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, ip_hlen)); -+#endif - } - #endif /* CHECKSUM_GEN_IP */ - #endif /* CHECKSUM_GEN_IP_INLINE */ -diff --git a/src/core/ipv4/ip4_frag.c b/src/core/ipv4/ip4_frag.c -index a445530..17a4ccd 100644 ---- a/src/core/ipv4/ip4_frag.c -+++ b/src/core/ipv4/ip4_frag.c -@@ -51,6 +51,10 @@ - - #include - -+#if USE_LIBOS && CHECKSUM_GEN_IP_HW -+#include "dpdk_cksum.h" -+#endif -+ - #if IP_REASSEMBLY - /** - * The IP reassembly code currently has the following limitations: -@@ -632,8 +636,17 @@ ip4_reass(struct pbuf *p) - /* @todo: do we need to set/calculate the correct checksum? */ - #if CHECKSUM_GEN_IP - IF__NETIF_CHECKSUM_ENABLED(ip_current_input_netif(), NETIF_CHECKSUM_GEN_IP) { -+#if CHECKSUM_GEN_IP_HW -+ if (get_eth_params_tx_ol() & DEV_TX_OFFLOAD_IPV4_CKSUM) { -+ iph_cksum_set(p, IP_HLEN, 1); -+ } else { -+ iph_cksum_set(p, IP_HLEN, 0); - IPH_CHKSUM_SET(fraghdr, inet_chksum(fraghdr, IP_HLEN)); - } -+#else -+ IPH_CHKSUM_SET(fraghdr, inet_chksum(fraghdr, IP_HLEN)); -+#endif -+ } - #endif /* CHECKSUM_GEN_IP */ - - p = ipr->p; -@@ -862,8 +875,18 @@ ip4_frag(struct pbuf *p, struct netif *netif, const ip4_addr_t *dest) - IPH_CHKSUM_SET(iphdr, 0); - #if CHECKSUM_GEN_IP - IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_IP) { -+#if CHECKSUM_GEN_IP_HW -+ if (get_eth_params_tx_ol() & DEV_TX_OFFLOAD_IPV4_CKSUM) { -+ iph_cksum_set(p, IP_HLEN, 1); -+ } else { -+ iph_cksum_set(p, IP_HLEN, 0); - IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, IP_HLEN)); - } -+ -+#else -+ IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, IP_HLEN)); -+#endif -+ } - #endif /* CHECKSUM_GEN_IP */ - - /* No need for separate header pbuf - we allowed room for it in rambuf -diff --git a/src/core/pbuf.c b/src/core/pbuf.c -index 3a5f375..4687284 100644 ---- a/src/core/pbuf.c -+++ b/src/core/pbuf.c -@@ -282,7 +282,7 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type) - - /* If pbuf is to be allocated in RAM, allocate memory for it. */ - #if USE_LIBOS -- /* alloc mbuf to reduce copy in sending */ -+ /* alloc mbuf avoid send copy */ - p = lwip_alloc_pbuf(layer, length, type); - #else - p = (struct pbuf *)mem_malloc(alloc_len); -diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c -index ce6a8a5..f4897f5 100644 ---- a/src/core/tcp_in.c -+++ b/src/core/tcp_in.c -@@ -64,6 +64,10 @@ - - #include - -+#if USE_LIBOS && CHECKSUM_CHECK_TCP_HW -+#include -+#endif /* CHECKSUM_CHECK_TCP_HW */ -+ - #ifdef LWIP_HOOK_FILENAME - #include LWIP_HOOK_FILENAME - #endif -@@ -172,11 +176,24 @@ tcp_input(struct pbuf *p, struct netif *inp) - #if CHECKSUM_CHECK_TCP - IF__NETIF_CHECKSUM_ENABLED(inp, NETIF_CHECKSUM_CHECK_TCP) { - /* Verify TCP checksum. */ -+#if CHECKSUM_CHECK_TCP_HW -+ u64_t ret; -+ if (get_eth_params_rx_ol() & DEV_RX_OFFLOAD_TCP_CKSUM) { -+ ret = is_cksum_tcpbad(p); -+ } else { -+ ret = (u64_t)ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len, -+ ip_current_src_addr(), ip_current_dest_addr()); -+ -+ } -+ if (ret != 0) { -+ LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packet discarded due to failing checksum\n")); -+#else - u16_t chksum = ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len, - ip_current_src_addr(), ip_current_dest_addr()); - if (chksum != 0) { - LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packet discarded due to failing checksum 0x%04"X16_F"\n", - chksum)); -+#endif - tcp_debug_print(tcphdr); - TCP_STATS_INC(tcp.chkerr); - goto dropped; -diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c -index 6617851..2d341b3 100644 ---- a/src/core/tcp_out.c -+++ b/src/core/tcp_out.c -@@ -80,6 +80,13 @@ - - #include - -+#if USE_LIBOS -+#include "lwipsock.h" -+#if CHECKSUM_GEN_TCP_HW -+#include "dpdk_cksum.h" -+#endif -+#endif -+ - #ifdef LWIP_HOOK_FILENAME - #include LWIP_HOOK_FILENAME - #endif -@@ -660,8 +667,11 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags) - pbuf_cat(p/*header*/, p2/*data*/); - } - #else /* USE_LIBOS */ -- p = (struct pbuf *)arg; -- seglen = p->len; -+ p = write_lwip_data((struct lwip_sock *)arg, len - pos, &apiflags); -+ if (p == NULL) { -+ break; -+ } -+ seglen = p->tot_len; - #endif /* USE_LIBOS */ - - queuelen += pbuf_clen(p); -@@ -789,8 +799,13 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags) - /* - * Finally update the pcb state. - */ -+#if USE_LIBOS -+ pcb->snd_lbb += pos; -+ pcb->snd_buf -= pos; -+#else - pcb->snd_lbb += len; - pcb->snd_buf -= len; -+#endif - pcb->snd_queuelen = queuelen; - - LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_write: %"S16_F" (after enqueued)\n", -@@ -1584,6 +1599,11 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif - - #if CHECKSUM_GEN_TCP - IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) { -+#if CHECKSUM_GEN_TCP_HW -+ if (get_eth_params_tx_ol() & DEV_TX_OFFLOAD_TCP_CKSUM) { -+ tcph_cksum_set(seg->p, TCP_HLEN); -+ seg->tcphdr->chksum = ip_chksum_pseudo_offload(IP_PROTO_TCP,seg->p->tot_len, &pcb->local_ip, &pcb->remote_ip); -+ } else { - #if TCP_CHECKSUM_ON_COPY - u32_t acc; - #if TCP_CHECKSUM_ON_COPY_SANITY_CHECK -@@ -1618,6 +1638,44 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif - seg->tcphdr->chksum = ip_chksum_pseudo(seg->p, IP_PROTO_TCP, - seg->p->tot_len, &pcb->local_ip, &pcb->remote_ip); - #endif /* TCP_CHECKSUM_ON_COPY */ -+ -+ } -+#else -+#if TCP_CHECKSUM_ON_COPY -+ u32_t acc; -+#if TCP_CHECKSUM_ON_COPY_SANITY_CHECK -+ u16_t chksum_slow = ip_chksum_pseudo(seg->p, IP_PROTO_TCP, -+ seg->p->tot_len, &pcb->local_ip, &pcb->remote_ip); -+#endif /* TCP_CHECKSUM_ON_COPY_SANITY_CHECK */ -+ if ((seg->flags & TF_SEG_DATA_CHECKSUMMED) == 0) { -+ LWIP_ASSERT("data included but not checksummed", -+ seg->p->tot_len == TCPH_HDRLEN_BYTES(seg->tcphdr)); -+ } -+ -+ /* rebuild TCP header checksum (TCP header changes for retransmissions!) */ -+ acc = ip_chksum_pseudo_partial(seg->p, IP_PROTO_TCP, -+ seg->p->tot_len, TCPH_HDRLEN_BYTES(seg->tcphdr), &pcb->local_ip, &pcb->remote_ip); -+ /* add payload checksum */ -+ if (seg->chksum_swapped) { -+ seg_chksum_was_swapped = 1; -+ seg->chksum = SWAP_BYTES_IN_WORD(seg->chksum); -+ seg->chksum_swapped = 0; -+ } -+ acc = (u16_t)~acc + seg->chksum; -+ seg->tcphdr->chksum = (u16_t)~FOLD_U32T(acc); -+#if TCP_CHECKSUM_ON_COPY_SANITY_CHECK -+ if (chksum_slow != seg->tcphdr->chksum) { -+ TCP_CHECKSUM_ON_COPY_SANITY_CHECK_FAIL( -+ ("tcp_output_segment: calculated checksum is %"X16_F" instead of %"X16_F"\n", -+ seg->tcphdr->chksum, chksum_slow)); -+ seg->tcphdr->chksum = chksum_slow; -+ } -+#endif /* TCP_CHECKSUM_ON_COPY_SANITY_CHECK */ -+#else /* TCP_CHECKSUM_ON_COPY */ -+ seg->tcphdr->chksum = ip_chksum_pseudo(seg->p, IP_PROTO_TCP, -+ seg->p->tot_len, &pcb->local_ip, &pcb->remote_ip); -+#endif /* TCP_CHECKSUM_ON_COPY */ -+#endif /* CHECKSUM_GEN_TCP_HW */ - } - #endif /* CHECKSUM_GEN_TCP */ - TCP_STATS_INC(tcp.xmit); -@@ -1959,8 +2017,18 @@ tcp_output_control_segment(const struct tcp_pcb *pcb, struct pbuf *p, - #if CHECKSUM_GEN_TCP - IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) { - struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload; -+#if CHECKSUM_GEN_TCP_HW -+ if (get_eth_params_tx_ol() & DEV_TX_OFFLOAD_TCP_CKSUM) { -+ tcph_cksum_set(p, TCP_HLEN); -+ tcphdr->chksum = ip_chksum_pseudo_offload(IP_PROTO_TCP, p->tot_len, src, dst); -+ } else { -+ tcphdr->chksum = ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len, -+ src, dst); -+ } -+#else - tcphdr->chksum = ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len, - src, dst); -+#endif - } - #endif - if (pcb != NULL) { -diff --git a/src/include/dpdk_cksum.h b/src/include/dpdk_cksum.h -new file mode 100644 -index 0000000..e57be4d ---- /dev/null -+++ b/src/include/dpdk_cksum.h -@@ -0,0 +1,108 @@ -+/* -+ * Copyright (c) 2001-2004 Swedish Institute of Computer Science. -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without modification, -+ * are permitted provided that the following conditions are met: -+ * -+ * 1. Redistributions of source code must retain the above copyright notice, -+ * this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright notice, -+ * this list of conditions and the following disclaimer in the documentation -+ * and/or other materials provided with the distribution. -+ * 3. The name of the author may not be used to endorse or promote products -+ * derived from this software without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -+ * OF SUCH DAMAGE. -+ * -+ * This file is part of the lwIP TCP/IP stack. -+ * -+ * Author: Huawei Technologies -+ * -+ */ -+ -+#ifndef __DPDK_CKSUM_H__ -+#define __DPDK_CKSUM_H__ -+ -+#include "lwipopts.h" -+#if USE_LIBOS -+#include -+#include -+ -+#if CHECKSUM_OFFLOAD_ALL -+#include -+#include "lwip/pbuf.h" -+#endif -+ -+extern uint64_t get_eth_params_rx_ol(void); -+extern uint64_t get_eth_params_tx_ol(void); -+#if CHECKSUM_CHECK_IP_HW -+// for ip4_input -+static inline u64_t is_cksum_ipbad(struct pbuf *p) { -+ return p->ol_flags & (PKT_RX_IP_CKSUM_BAD); -+} -+#endif /* CHECKSUM_CHECK_IP_HW */ -+ -+#if CHECKSUM_CHECK_TCP_HW -+// for tcp_input -+static inline u64_t is_cksum_tcpbad(struct pbuf *p) { -+ return p->ol_flags & (PKT_RX_L4_CKSUM_BAD); -+} -+#endif /* CHECKSUM_CHECK_TCP_HW */ -+ -+#if CHECKSUM_GEN_IP_HW -+static inline void ethh_cksum_set(struct pbuf *p, u16_t len) { -+ p->l2_len = len; -+} -+ -+// replaces IPH_CHKSUM_SET -+static inline void iph_cksum_set(struct pbuf *p, u16_t len, bool do_ipcksum) { -+ p->ol_flags |= PKT_TX_IPV4; -+ if (do_ipcksum) { -+ p->ol_flags |= PKT_TX_IP_CKSUM; -+ } -+ p->l3_len = len; -+} -+#endif /* CHECKSUM_GEN_IP_HW */ -+ -+// replace ip_chksum_pseudo -+#if CHECKSUM_GEN_TCP_HW -+#include -+ -+static inline void tcph_cksum_set(struct pbuf *p, u16_t len) { -+ (void)len; -+ p->ol_flags |= PKT_TX_TCP_CKSUM; -+} -+ -+static inline u16_t ip_chksum_pseudo_offload(u8_t proto, u16_t proto_len, -+ const ip_addr_t *src, const ip_addr_t *dst) -+{ -+ struct ipv4_psd_header { -+ uint32_t src_addr; /* IP address of source host. */ -+ uint32_t dst_addr; /* IP address of destination host. */ -+ uint8_t zero; /* zero. */ -+ uint8_t proto; /* L4 protocol type. */ -+ uint16_t len; /* L4 length. */ -+ } psd_hdr; -+ -+ psd_hdr.src_addr = ip4_addr_get_u32(src); -+ psd_hdr.dst_addr = ip4_addr_get_u32(dst); -+ psd_hdr.proto = proto; -+ psd_hdr.len = lwip_htons(proto_len); -+ psd_hdr.zero = 0; -+ -+ return rte_raw_cksum(&psd_hdr, sizeof(psd_hdr)); -+} -+#endif /* CHECKSUM_GEN_TCP_HW */ -+ -+#endif /* USE_LIBOS */ -+#endif /* __DPDK_CKSUM_H__ */ -diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h -index ef2f61a..e68d0bf 100644 ---- a/src/include/lwip/pbuf.h -+++ b/src/include/lwip/pbuf.h -@@ -219,6 +219,14 @@ struct pbuf { - - /** For incoming packets, this contains the input netif's index */ - u8_t if_idx; -+#if USE_LIBOS && CHECKSUM_OFFLOAD_ALL -+ /** checksum offload ol_flags */ -+ u64_t ol_flags; -+ /** checksum offload l2_len */ -+ u64_t l2_len:7; -+ /** checksum offload l3_len */ -+ u64_t l3_len:9; -+#endif /* USE_LIBOS CHECKSUM_OFFLOAD_SWITCH */ - }; - - -@@ -268,9 +276,8 @@ void pbuf_free_ooseq(void); - - /* Initializes the pbuf module. This call is empty for now, but may not be in future. */ - #define pbuf_init() -- - #if USE_LIBOS --struct pbuf *lwip_alloc_pbuf(pbuf_layer l, u16_t length, pbuf_type type); -+struct pbuf *lwip_alloc_pbuf(pbuf_layer layer, uint16_t length, pbuf_type type); - #endif - struct pbuf *pbuf_alloc(pbuf_layer l, u16_t length, pbuf_type type); - struct pbuf *pbuf_alloc_reference(void *payload, u16_t length, pbuf_type type); -diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h -index e0364a2..df587c0 100644 ---- a/src/include/lwipopts.h -+++ b/src/include/lwipopts.h -@@ -129,14 +129,6 @@ - - #define LWIP_STATS_DISPLAY 1 - --#define CHECKSUM_GEN_IP 1 /* master switch */ -- --#define CHECKSUM_GEN_TCP 1 /* master switch */ -- --#define CHECKSUM_CHECK_IP 1 /* master switch */ -- --#define CHECKSUM_CHECK_TCP 1 /* master switch */ -- - #define LWIP_TIMEVAL_PRIVATE 0 - - #define USE_LIBOS 1 -@@ -177,6 +169,28 @@ - - #define ARP_TABLE_SIZE 512 - -+/* --------------------------------------- -+ * ------- NIC offloads -------- -+ * --------------------------------------- -+ */ -+#define LWIP_CHECKSUM_CTRL_PER_NETIF 1 /* checksum ability check before checksum*/ -+ -+// rx cksum -+#define CHECKSUM_CHECK_IP 1 /* master switch */ -+#define CHECKSUM_CHECK_TCP 1 /* master switch */ -+// tx cksum -+#define CHECKSUM_GEN_IP 1 /* master switch */ -+#define CHECKSUM_GEN_TCP 1 /* master switch */ -+ -+// rx offload cksum -+#define CHECKSUM_CHECK_IP_HW (1 && CHECKSUM_CHECK_IP) /* hardware switch */ -+#define CHECKSUM_CHECK_TCP_HW (1 && CHECKSUM_CHECK_TCP) /* hardware switch */ -+// tx offload cksum -+#define CHECKSUM_GEN_IP_HW (1 && CHECKSUM_GEN_IP) /* hardware switch */ -+#define CHECKSUM_GEN_TCP_HW (1 && CHECKSUM_GEN_TCP) /* hardware switch */ -+ -+#define CHECKSUM_OFFLOAD_ALL (CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW || CHECKSUM_CHECK_IP_HW || CHECKSUM_CHECK_TCP_HW) -+ - #if USE_LIBOS - #define PER_THREAD __thread - #else -diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h -index 36bcaed..eec4e8e 100644 ---- a/src/include/lwipsock.h -+++ b/src/include/lwipsock.h -@@ -36,7 +36,7 @@ -+#include - #include "lwip/opt.h" - #include "lwip/api.h" - --#include "posix_api.h" - #include "eventpoll.h" - - /* move some definitions to the lwipsock.h for libnet to use, and -@@ -62,7 +61,8 @@ union lwip_sock_lastdata { - - #if USE_LIBOS - struct protocol_stack; --struct weakup_poll; -+struct wakeup_poll; -+struct rte_ring; - #endif - /** Contains all internal pointers and states used for a socket */ - struct lwip_sock { -@@ -93,16 +93,16 @@ struct lwip_sock { - - #if USE_LIBOS - uint32_t epoll_events; /* registered events */ -- uint32_t events; /* available events */ -- volatile bool have_event; /* avoid recurring events */ -- volatile bool have_rpc_send; /* avoid recurring rpc_send */ -+ volatile uint32_t events; /* available events */ - epoll_data_t ep_data; -- struct weakup_poll *weakup; -+ struct wakeup_poll *wakeup; - struct protocol_stack *stack; -- void *recv_ring; -+ struct rte_ring *recv_ring; -+ struct rte_ring *recv_wait_free; - struct pbuf *recv_lastdata; /* unread data in one pbuf */ - struct pbuf *send_lastdata; /* unread data in one pbuf */ -- void *send_ring; -+ struct rte_ring *send_ring; -+ struct rte_ring *send_idle_ring; - int32_t recv_flags; - int32_t send_flags; - bool wait_close; -@@ -112,7 +112,6 @@ struct lwip_sock { - struct list_node listen_list; - struct list_node recv_list; - struct list_node event_list; -- struct list_node wakeup_list; - struct list_node send_list; - int32_t nextfd; /* listenfd list */ - #endif -@@ -160,6 +159,7 @@ get_socket_without_errno(int s) - - extern void add_recv_list(int32_t fd); - extern ssize_t read_lwip_data(struct lwip_sock *sock, int32_t flags, u8_t apiflags); -+extern struct pbuf *write_lwip_data(struct lwip_sock *sock, uint16_t remain_size, uint8_t *apiflags); - extern void gazelle_clean_sock(int32_t fd); - extern void gazelle_init_sock(int32_t fd); - #endif /* USE_LIBOS */ -diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c -index dd171e2..ab976a8 100644 ---- a/src/netif/ethernet.c -+++ b/src/netif/ethernet.c -@@ -56,6 +56,10 @@ - #include "netif/ppp/pppoe.h" - #endif /* PPPOE_SUPPORT */ - -+#if USE_LIBOS && (CHECKSUM_GEN_TCP_HW || CHECKSUM_GEN_IP_HW) -+#include "dpdk_cksum.h" -+#endif -+ - #ifdef LWIP_HOOK_FILENAME - #include LWIP_HOOK_FILENAME - #endif -@@ -308,6 +312,10 @@ ethernet_output(struct netif * netif, struct pbuf * p, - LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, - ("ethernet_output: sending packet %p\n", (void *)p)); - -+#if CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW -+ ethh_cksum_set(p, sizeof(*ethhdr)); -+#endif -+ - /* send the packet */ - return netif->linkoutput(netif, p); - --- -1.8.3.1 - +From 8dd0a15e60cfee7e7f1be1ea051d0e09031f8fdd Mon Sep 17 00:00:00 2001 +From: jiangheng +Date: Tue, 29 Mar 2022 21:33:17 +0800 +Subject: [PATCH] refactor event and add HW checksum offload + +--- + src/api/api_msg.c | 9 ++++ + src/api/posix_api.c | 2 + + src/api/sockets.c | 4 +- + src/core/ipv4/icmp.c | 13 +++++ + src/core/ipv4/ip4.c | 24 ++++++++- + src/core/ipv4/ip4_frag.c | 23 +++++++++ + src/core/pbuf.c | 9 +++- + src/core/tcp_in.c | 17 +++++++ + src/core/tcp_out.c | 72 +++++++++++++++++++++++++- + src/include/dpdk_cksum.h | 107 +++++++++++++++++++++++++++++++++++++++ + src/include/lwip/pbuf.h | 12 ++++- + src/include/lwipopts.h | 30 ++++++++--- + src/include/lwipsock.h | 18 +++---- + src/netif/ethernet.c | 8 +++ + 14 files changed, 322 insertions(+), 26 deletions(-) + create mode 100644 src/include/dpdk_cksum.h + +diff --git a/src/api/api_msg.c b/src/api/api_msg.c +index 3072dd9..672f022 100644 +--- a/src/api/api_msg.c ++++ b/src/api/api_msg.c +@@ -57,6 +57,7 @@ + #if USE_LIBOS + #include "lwip/sockets.h" + #include "lwipsock.h" ++#include "posix_api.h" + #endif + + #include +@@ -1758,7 +1759,15 @@ lwip_netconn_do_writemore(struct netconn *conn WRITE_DELAYED_PARAM) + } else { + write_more = 0; + } ++#if USE_LIBOS ++ /* vector->ptr is private arg sock */ ++ LWIP_UNUSED_ARG(dataptr); ++ write_more = 0; ++ err = tcp_write(conn->pcb.tcp, conn->current_msg->msg.w.vector->ptr, len, apiflags); ++ conn->current_msg->msg.w.len = len; ++#else + err = tcp_write(conn->pcb.tcp, dataptr, len, apiflags); ++#endif + if (err == ERR_OK) { + conn->current_msg->msg.w.offset += len; + conn->current_msg->msg.w.vector_off += len; +diff --git a/src/api/posix_api.c b/src/api/posix_api.c +index bce07f5..3f85bad 100644 +--- a/src/api/posix_api.c ++++ b/src/api/posix_api.c +@@ -42,6 +42,7 @@ + + #include "lwip/err.h" + #include "lwipsock.h" ++#include "posix_api.h" + + posix_api_t *posix_api; + posix_api_t posix_api_val; +@@ -64,6 +65,7 @@ void posix_api_fork(void) + posix_api->get_socket = chld_get_socket; + } + ++ + int posix_api_init(void) + { + /* the symbol we use here won't be NULL, so we don't need dlerror() +diff --git a/src/api/sockets.c b/src/api/sockets.c +index 21de5d9..3d94454 100644 +--- a/src/api/sockets.c ++++ b/src/api/sockets.c +@@ -65,6 +65,7 @@ + #if USE_LIBOS + #include + #include "lwipsock.h" ++#include "posix_api.h" + #endif + + #include +@@ -2682,9 +2683,6 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len) + check_waiters = 0; + } + sock->sendevent = 1; +-#if USE_LIBOS +- add_epoll_event(conn, EPOLLOUT); +-#endif + break; + case NETCONN_EVT_SENDMINUS: + sock->sendevent = 0; +diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c +index 59b493a..c58ae25 100644 +--- a/src/core/ipv4/icmp.c ++++ b/src/core/ipv4/icmp.c +@@ -51,6 +51,10 @@ + + #include + ++#if USE_LIBOS && CHECKSUM_GEN_IP_HW ++#include "dpdk_cksum.h" ++#endif ++ + #ifdef LWIP_HOOK_FILENAME + #include LWIP_HOOK_FILENAME + #endif +@@ -236,7 +240,16 @@ icmp_input(struct pbuf *p, struct netif *inp) + IPH_CHKSUM_SET(iphdr, 0); + #if CHECKSUM_GEN_IP + IF__NETIF_CHECKSUM_ENABLED(inp, NETIF_CHECKSUM_GEN_IP) { ++#if CHECKSUM_GEN_IP_HW ++ if (get_eth_params_tx_ol() & DEV_TX_OFFLOAD_IPV4_CKSUM) { ++ iph_cksum_set(p, hlen, 1); ++ } else { ++ iph_cksum_set(p, hlen, 0); ++ IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, hlen)); ++ } ++#else + IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, hlen)); ++#endif + } + #endif /* CHECKSUM_GEN_IP */ + +diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c +index c83afbe..1334cdc 100644 +--- a/src/core/ipv4/ip4.c ++++ b/src/core/ipv4/ip4.c +@@ -59,6 +59,10 @@ + + #include + ++#if USE_LIBOS && (CHECKSUM_CHECK_IP_HW || CHECKSUM_GEN_IP_HW) ++#include "dpdk_cksum.h" ++#endif ++ + #ifdef LWIP_HOOK_FILENAME + #include LWIP_HOOK_FILENAME + #endif +@@ -503,8 +507,17 @@ ip4_input(struct pbuf *p, struct netif *inp) + /* verify checksum */ + #if CHECKSUM_CHECK_IP + IF__NETIF_CHECKSUM_ENABLED(inp, NETIF_CHECKSUM_CHECK_IP) { ++#if CHECKSUM_CHECK_IP_HW ++ u64_t ret; ++ if (get_eth_params_rx_ol() & DEV_RX_OFFLOAD_IPV4_CKSUM) { ++ ret = is_cksum_ipbad(p); ++ } else { ++ ret = (u64_t)inet_chksum(iphdr, iphdr_hlen); ++ } ++ if (ret != 0) { ++#else + if (inet_chksum(iphdr, iphdr_hlen) != 0) { +- ++#endif + LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, + ("Checksum (0x%"X16_F") failed, IP packet dropped.\n", inet_chksum(iphdr, iphdr_hlen))); + ip4_debug_print(p); +@@ -972,7 +985,16 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d + IPH_CHKSUM_SET(iphdr, 0); + #if CHECKSUM_GEN_IP + IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_IP) { ++#if CHECKSUM_GEN_IP_HW ++ if (get_eth_params_tx_ol() & DEV_TX_OFFLOAD_IPV4_CKSUM) { ++ iph_cksum_set(p, ip_hlen, 1); ++ } else { ++ iph_cksum_set(p, ip_hlen, 0); ++ IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, ip_hlen)); ++ } ++#else + IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, ip_hlen)); ++#endif + } + #endif /* CHECKSUM_GEN_IP */ + #endif /* CHECKSUM_GEN_IP_INLINE */ +diff --git a/src/core/ipv4/ip4_frag.c b/src/core/ipv4/ip4_frag.c +index a445530..17a4ccd 100644 +--- a/src/core/ipv4/ip4_frag.c ++++ b/src/core/ipv4/ip4_frag.c +@@ -51,6 +51,10 @@ + + #include + ++#if USE_LIBOS && CHECKSUM_GEN_IP_HW ++#include "dpdk_cksum.h" ++#endif ++ + #if IP_REASSEMBLY + /** + * The IP reassembly code currently has the following limitations: +@@ -632,8 +636,17 @@ ip4_reass(struct pbuf *p) + /* @todo: do we need to set/calculate the correct checksum? */ + #if CHECKSUM_GEN_IP + IF__NETIF_CHECKSUM_ENABLED(ip_current_input_netif(), NETIF_CHECKSUM_GEN_IP) { ++#if CHECKSUM_GEN_IP_HW ++ if (get_eth_params_tx_ol() & DEV_TX_OFFLOAD_IPV4_CKSUM) { ++ iph_cksum_set(p, IP_HLEN, 1); ++ } else { ++ iph_cksum_set(p, IP_HLEN, 0); + IPH_CHKSUM_SET(fraghdr, inet_chksum(fraghdr, IP_HLEN)); + } ++#else ++ IPH_CHKSUM_SET(fraghdr, inet_chksum(fraghdr, IP_HLEN)); ++#endif ++ } + #endif /* CHECKSUM_GEN_IP */ + + p = ipr->p; +@@ -862,8 +875,18 @@ ip4_frag(struct pbuf *p, struct netif *netif, const ip4_addr_t *dest) + IPH_CHKSUM_SET(iphdr, 0); + #if CHECKSUM_GEN_IP + IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_IP) { ++#if CHECKSUM_GEN_IP_HW ++ if (get_eth_params_tx_ol() & DEV_TX_OFFLOAD_IPV4_CKSUM) { ++ iph_cksum_set(p, IP_HLEN, 1); ++ } else { ++ iph_cksum_set(p, IP_HLEN, 0); + IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, IP_HLEN)); + } ++ ++#else ++ IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, IP_HLEN)); ++#endif ++ } + #endif /* CHECKSUM_GEN_IP */ + + /* No need for separate header pbuf - we allowed room for it in rambuf +diff --git a/src/core/pbuf.c b/src/core/pbuf.c +index cd6b558..247681d 100644 +--- a/src/core/pbuf.c ++++ b/src/core/pbuf.c +@@ -282,7 +282,7 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type) + + /* If pbuf is to be allocated in RAM, allocate memory for it. */ + #if USE_LIBOS +- /* alloc mbuf to reduce copy in sending */ ++ /* alloc mbuf avoid send copy */ + p = lwip_alloc_pbuf(layer, length, type); + #else + p = (struct pbuf *)mem_malloc(alloc_len); +@@ -1019,6 +1019,13 @@ pbuf_copy_partial_pbuf(struct pbuf *p_to, const struct pbuf *p_from, u16_t copy_ + /* current p_from does not fit into current p_to */ + len_calc = p_to->len - offset_to; + } ++ ++#if USE_LIBOS && (CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW) ++ p_to->l2_len = p_from->l2_len; ++ p_to->l3_len = p_from->l3_len; ++ p_to->ol_flags = p_from->ol_flags; ++#endif ++ + len = (u16_t)LWIP_MIN(copy_len, len_calc); + MEMCPY((u8_t *)p_to->payload + offset_to, (u8_t *)p_from->payload + offset_from, len); + offset_to += len; +diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c +index 0d3a2f1..b1bbe00 100644 +--- a/src/core/tcp_in.c ++++ b/src/core/tcp_in.c +@@ -64,6 +64,10 @@ + + #include + ++#if USE_LIBOS && CHECKSUM_CHECK_TCP_HW ++#include ++#endif /* CHECKSUM_CHECK_TCP_HW */ ++ + #ifdef LWIP_HOOK_FILENAME + #include LWIP_HOOK_FILENAME + #endif +@@ -172,11 +176,24 @@ tcp_input(struct pbuf *p, struct netif *inp) + #if CHECKSUM_CHECK_TCP + IF__NETIF_CHECKSUM_ENABLED(inp, NETIF_CHECKSUM_CHECK_TCP) { + /* Verify TCP checksum. */ ++#if CHECKSUM_CHECK_TCP_HW ++ u64_t ret; ++ if (get_eth_params_rx_ol() & DEV_RX_OFFLOAD_TCP_CKSUM) { ++ ret = is_cksum_tcpbad(p); ++ } else { ++ ret = (u64_t)ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len, ++ ip_current_src_addr(), ip_current_dest_addr()); ++ ++ } ++ if (ret != 0) { ++ LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packet discarded due to failing checksum\n")); ++#else + u16_t chksum = ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len, + ip_current_src_addr(), ip_current_dest_addr()); + if (chksum != 0) { + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packet discarded due to failing checksum 0x%04"X16_F"\n", + chksum)); ++#endif + tcp_debug_print(tcphdr); + TCP_STATS_INC(tcp.chkerr); + goto dropped; +diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c +index b99974d..1b0af8d 100644 +--- a/src/core/tcp_out.c ++++ b/src/core/tcp_out.c +@@ -80,6 +80,13 @@ + + #include + ++#if USE_LIBOS ++#include "lwipsock.h" ++#if CHECKSUM_GEN_TCP_HW ++#include "dpdk_cksum.h" ++#endif ++#endif ++ + #ifdef LWIP_HOOK_FILENAME + #include LWIP_HOOK_FILENAME + #endif +@@ -660,8 +667,11 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags) + pbuf_cat(p/*header*/, p2/*data*/); + } + #else /* USE_LIBOS */ +- p = (struct pbuf *)arg; +- seglen = p->len; ++ p = write_lwip_data((struct lwip_sock *)arg, len - pos, &apiflags); ++ if (p == NULL) { ++ break; ++ } ++ seglen = p->tot_len; + #endif /* USE_LIBOS */ + + queuelen += pbuf_clen(p); +@@ -789,8 +799,13 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags) + /* + * Finally update the pcb state. + */ ++#if USE_LIBOS ++ pcb->snd_lbb += pos; ++ pcb->snd_buf -= pos; ++#else + pcb->snd_lbb += len; + pcb->snd_buf -= len; ++#endif + pcb->snd_queuelen = queuelen; + + LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_write: %"S16_F" (after enqueued)\n", +@@ -1584,6 +1599,11 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif + + #if CHECKSUM_GEN_TCP + IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) { ++#if CHECKSUM_GEN_TCP_HW ++ if (get_eth_params_tx_ol() & DEV_TX_OFFLOAD_TCP_CKSUM) { ++ tcph_cksum_set(seg->p, TCP_HLEN); ++ seg->tcphdr->chksum = ip_chksum_pseudo_offload(IP_PROTO_TCP,seg->p->tot_len, &pcb->local_ip, &pcb->remote_ip); ++ } else { + #if TCP_CHECKSUM_ON_COPY + u32_t acc; + #if TCP_CHECKSUM_ON_COPY_SANITY_CHECK +@@ -1618,6 +1638,44 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif + seg->tcphdr->chksum = ip_chksum_pseudo(seg->p, IP_PROTO_TCP, + seg->p->tot_len, &pcb->local_ip, &pcb->remote_ip); + #endif /* TCP_CHECKSUM_ON_COPY */ ++ ++ } ++#else ++#if TCP_CHECKSUM_ON_COPY ++ u32_t acc; ++#if TCP_CHECKSUM_ON_COPY_SANITY_CHECK ++ u16_t chksum_slow = ip_chksum_pseudo(seg->p, IP_PROTO_TCP, ++ seg->p->tot_len, &pcb->local_ip, &pcb->remote_ip); ++#endif /* TCP_CHECKSUM_ON_COPY_SANITY_CHECK */ ++ if ((seg->flags & TF_SEG_DATA_CHECKSUMMED) == 0) { ++ LWIP_ASSERT("data included but not checksummed", ++ seg->p->tot_len == TCPH_HDRLEN_BYTES(seg->tcphdr)); ++ } ++ ++ /* rebuild TCP header checksum (TCP header changes for retransmissions!) */ ++ acc = ip_chksum_pseudo_partial(seg->p, IP_PROTO_TCP, ++ seg->p->tot_len, TCPH_HDRLEN_BYTES(seg->tcphdr), &pcb->local_ip, &pcb->remote_ip); ++ /* add payload checksum */ ++ if (seg->chksum_swapped) { ++ seg_chksum_was_swapped = 1; ++ seg->chksum = SWAP_BYTES_IN_WORD(seg->chksum); ++ seg->chksum_swapped = 0; ++ } ++ acc = (u16_t)~acc + seg->chksum; ++ seg->tcphdr->chksum = (u16_t)~FOLD_U32T(acc); ++#if TCP_CHECKSUM_ON_COPY_SANITY_CHECK ++ if (chksum_slow != seg->tcphdr->chksum) { ++ TCP_CHECKSUM_ON_COPY_SANITY_CHECK_FAIL( ++ ("tcp_output_segment: calculated checksum is %"X16_F" instead of %"X16_F"\n", ++ seg->tcphdr->chksum, chksum_slow)); ++ seg->tcphdr->chksum = chksum_slow; ++ } ++#endif /* TCP_CHECKSUM_ON_COPY_SANITY_CHECK */ ++#else /* TCP_CHECKSUM_ON_COPY */ ++ seg->tcphdr->chksum = ip_chksum_pseudo(seg->p, IP_PROTO_TCP, ++ seg->p->tot_len, &pcb->local_ip, &pcb->remote_ip); ++#endif /* TCP_CHECKSUM_ON_COPY */ ++#endif /* CHECKSUM_GEN_TCP_HW */ + } + #endif /* CHECKSUM_GEN_TCP */ + TCP_STATS_INC(tcp.xmit); +@@ -1959,8 +2017,18 @@ tcp_output_control_segment(const struct tcp_pcb *pcb, struct pbuf *p, + #if CHECKSUM_GEN_TCP + IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) { + struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload; ++#if CHECKSUM_GEN_TCP_HW ++ if (get_eth_params_tx_ol() & DEV_TX_OFFLOAD_TCP_CKSUM) { ++ tcph_cksum_set(p, TCP_HLEN); ++ tcphdr->chksum = ip_chksum_pseudo_offload(IP_PROTO_TCP, p->tot_len, src, dst); ++ } else { ++ tcphdr->chksum = ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len, ++ src, dst); ++ } ++#else + tcphdr->chksum = ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len, + src, dst); ++#endif + } + #endif + if (pcb != NULL) { +diff --git a/src/include/dpdk_cksum.h b/src/include/dpdk_cksum.h +new file mode 100644 +index 0000000..e57be4d +--- /dev/null ++++ b/src/include/dpdk_cksum.h +@@ -0,0 +1,107 @@ ++/* ++ * Copyright (c) 2001-2004 Swedish Institute of Computer Science. ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without modification, ++ * are permitted provided that the following conditions are met: ++ * ++ * 1. Redistributions of source code must retain the above copyright notice, ++ * this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright notice, ++ * this list of conditions and the following disclaimer in the documentation ++ * and/or other materials provided with the distribution. ++ * 3. The name of the author may not be used to endorse or promote products ++ * derived from this software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED ++ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ++ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT ++ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT ++ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING ++ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY ++ * OF SUCH DAMAGE. ++ * ++ * This file is part of the lwIP TCP/IP stack. ++ * ++ * Author: Huawei Technologies ++ * ++ */ ++ ++#ifndef __DPDK_CKSUM_H__ ++#define __DPDK_CKSUM_H__ ++ ++#include "lwipopts.h" ++#if USE_LIBOS ++#include ++ ++#if CHECKSUM_OFFLOAD_ALL ++#include ++#include "lwip/pbuf.h" ++#endif ++ ++extern uint64_t get_eth_params_rx_ol(void); ++extern uint64_t get_eth_params_tx_ol(void); ++#if CHECKSUM_CHECK_IP_HW ++// for ip4_input ++static inline u64_t is_cksum_ipbad(struct pbuf *p) { ++ return p->ol_flags & (RTE_MBUF_F_RX_IP_CKSUM_BAD); ++} ++#endif /* CHECKSUM_CHECK_IP_HW */ ++ ++#if CHECKSUM_CHECK_TCP_HW ++// for tcp_input ++static inline u64_t is_cksum_tcpbad(struct pbuf *p) { ++ return p->ol_flags & (RTE_MBUF_F_RX_L4_CKSUM_BAD); ++} ++#endif /* CHECKSUM_CHECK_TCP_HW */ ++ ++#if CHECKSUM_GEN_IP_HW ++static inline void ethh_cksum_set(struct pbuf *p, u16_t len) { ++ p->l2_len = len; ++} ++ ++// replaces IPH_CHKSUM_SET ++static inline void iph_cksum_set(struct pbuf *p, u16_t len, bool do_ipcksum) { ++ p->ol_flags |= RTE_MBUF_F_TX_IPV4; ++ if (do_ipcksum) { ++ p->ol_flags |= RTE_MBUF_F_TX_IP_CKSUM; ++ } ++ p->l3_len = len; ++} ++#endif /* CHECKSUM_GEN_IP_HW */ ++ ++// replace ip_chksum_pseudo ++#if CHECKSUM_GEN_TCP_HW ++#include ++ ++static inline void tcph_cksum_set(struct pbuf *p, u16_t len) { ++ (void)len; ++ p->ol_flags |= RTE_MBUF_F_TX_TCP_CKSUM; ++} ++ ++static inline u16_t ip_chksum_pseudo_offload(u8_t proto, u16_t proto_len, ++ const ip_addr_t *src, const ip_addr_t *dst) ++{ ++ struct ipv4_psd_header { ++ uint32_t src_addr; /* IP address of source host. */ ++ uint32_t dst_addr; /* IP address of destination host. */ ++ uint8_t zero; /* zero. */ ++ uint8_t proto; /* L4 protocol type. */ ++ uint16_t len; /* L4 length. */ ++ } psd_hdr; ++ ++ psd_hdr.src_addr = ip4_addr_get_u32(src); ++ psd_hdr.dst_addr = ip4_addr_get_u32(dst); ++ psd_hdr.proto = proto; ++ psd_hdr.len = lwip_htons(proto_len); ++ psd_hdr.zero = 0; ++ ++ return rte_raw_cksum(&psd_hdr, sizeof(psd_hdr)); ++} ++#endif /* CHECKSUM_GEN_TCP_HW */ ++ ++#endif /* USE_LIBOS */ ++#endif /* __DPDK_CKSUM_H__ */ +diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h +index 3894574..87cd960 100644 +--- a/src/include/lwip/pbuf.h ++++ b/src/include/lwip/pbuf.h +@@ -220,6 +220,15 @@ struct pbuf { + /** For incoming packets, this contains the input netif's index */ + u8_t if_idx; + ++#if USE_LIBOS && CHECKSUM_OFFLOAD_ALL ++ /** checksum offload ol_flags */ ++ u64_t ol_flags; ++ /** checksum offload l2_len */ ++ u64_t l2_len:7; ++ /** checksum offload l3_len */ ++ u64_t l3_len:9; ++#endif /* USE_LIBOS CHECKSUM_OFFLOAD_SWITCH */ ++ + /** In case the user needs to store data custom data on a pbuf */ + LWIP_PBUF_CUSTOM_DATA + }; +@@ -271,9 +280,8 @@ void pbuf_free_ooseq(void); + + /* Initializes the pbuf module. This call is empty for now, but may not be in future. */ + #define pbuf_init() +- + #if USE_LIBOS +-struct pbuf *lwip_alloc_pbuf(pbuf_layer l, u16_t length, pbuf_type type); ++struct pbuf *lwip_alloc_pbuf(pbuf_layer layer, uint16_t length, pbuf_type type); + #endif + struct pbuf *pbuf_alloc(pbuf_layer l, u16_t length, pbuf_type type); + struct pbuf *pbuf_alloc_reference(void *payload, u16_t length, pbuf_type type); +diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h +index e0364a2..df587c0 100644 +--- a/src/include/lwipopts.h ++++ b/src/include/lwipopts.h +@@ -129,14 +129,6 @@ + + #define LWIP_STATS_DISPLAY 1 + +-#define CHECKSUM_GEN_IP 1 /* master switch */ +- +-#define CHECKSUM_GEN_TCP 1 /* master switch */ +- +-#define CHECKSUM_CHECK_IP 1 /* master switch */ +- +-#define CHECKSUM_CHECK_TCP 1 /* master switch */ +- + #define LWIP_TIMEVAL_PRIVATE 0 + + #define USE_LIBOS 1 +@@ -177,6 +169,28 @@ + + #define ARP_TABLE_SIZE 512 + ++/* --------------------------------------- ++ * ------- NIC offloads -------- ++ * --------------------------------------- ++ */ ++#define LWIP_CHECKSUM_CTRL_PER_NETIF 1 /* checksum ability check before checksum*/ ++ ++// rx cksum ++#define CHECKSUM_CHECK_IP 1 /* master switch */ ++#define CHECKSUM_CHECK_TCP 1 /* master switch */ ++// tx cksum ++#define CHECKSUM_GEN_IP 1 /* master switch */ ++#define CHECKSUM_GEN_TCP 1 /* master switch */ ++ ++// rx offload cksum ++#define CHECKSUM_CHECK_IP_HW (1 && CHECKSUM_CHECK_IP) /* hardware switch */ ++#define CHECKSUM_CHECK_TCP_HW (1 && CHECKSUM_CHECK_TCP) /* hardware switch */ ++// tx offload cksum ++#define CHECKSUM_GEN_IP_HW (1 && CHECKSUM_GEN_IP) /* hardware switch */ ++#define CHECKSUM_GEN_TCP_HW (1 && CHECKSUM_GEN_TCP) /* hardware switch */ ++ ++#define CHECKSUM_OFFLOAD_ALL (CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW || CHECKSUM_CHECK_IP_HW || CHECKSUM_CHECK_TCP_HW) ++ + #if USE_LIBOS + #define PER_THREAD __thread + #else +diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h +index 36bcaed..eec4e8e 100644 +--- a/src/include/lwipsock.h ++++ b/src/include/lwipsock.h +@@ -36,7 +36,6 @@ + #include "lwip/opt.h" + #include "lwip/api.h" + +-#include "posix_api.h" + #include "eventpoll.h" + + /* move some definitions to the lwipsock.h for libnet to use, and +@@ -62,7 +61,8 @@ union lwip_sock_lastdata { + + #if USE_LIBOS + struct protocol_stack; +-struct weakup_poll; ++struct wakeup_poll; ++struct rte_ring; + #endif + /** Contains all internal pointers and states used for a socket */ + struct lwip_sock { +@@ -93,16 +93,16 @@ struct lwip_sock { + + #if USE_LIBOS + uint32_t epoll_events; /* registered events */ +- uint32_t events; /* available events */ +- volatile bool have_event; /* avoid recurring events */ +- volatile bool have_rpc_send; /* avoid recurring rpc_send */ ++ volatile uint32_t events; /* available events */ + epoll_data_t ep_data; +- struct weakup_poll *weakup; ++ struct wakeup_poll *wakeup; + struct protocol_stack *stack; +- void *recv_ring; ++ struct rte_ring *recv_ring; ++ struct rte_ring *recv_wait_free; + struct pbuf *recv_lastdata; /* unread data in one pbuf */ + struct pbuf *send_lastdata; /* unread data in one pbuf */ +- void *send_ring; ++ struct rte_ring *send_ring; ++ struct rte_ring *send_idle_ring; + int32_t recv_flags; + int32_t send_flags; + bool wait_close; +@@ -112,7 +112,6 @@ struct lwip_sock { + struct list_node listen_list; + struct list_node recv_list; + struct list_node event_list; +- struct list_node wakeup_list; + struct list_node send_list; + int32_t nextfd; /* listenfd list */ + #endif +@@ -160,6 +159,7 @@ get_socket_without_errno(int s) + + extern void add_recv_list(int32_t fd); + extern ssize_t read_lwip_data(struct lwip_sock *sock, int32_t flags, u8_t apiflags); ++extern struct pbuf *write_lwip_data(struct lwip_sock *sock, uint16_t remain_size, uint8_t *apiflags); + extern void gazelle_clean_sock(int32_t fd); + extern void gazelle_init_sock(int32_t fd); + #endif /* USE_LIBOS */ +diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c +index dd171e2..ab976a8 100644 +--- a/src/netif/ethernet.c ++++ b/src/netif/ethernet.c +@@ -56,6 +56,10 @@ + #include "netif/ppp/pppoe.h" + #endif /* PPPOE_SUPPORT */ + ++#if USE_LIBOS && (CHECKSUM_GEN_TCP_HW || CHECKSUM_GEN_IP_HW) ++#include "dpdk_cksum.h" ++#endif ++ + #ifdef LWIP_HOOK_FILENAME + #include LWIP_HOOK_FILENAME + #endif +@@ -308,6 +312,10 @@ ethernet_output(struct netif * netif, struct pbuf * p, + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, + ("ethernet_output: sending packet %p\n", (void *)p)); + ++#if CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW ++ ethh_cksum_set(p, sizeof(*ethhdr)); ++#endif ++ + /* send the packet */ + return netif->linkoutput(netif, p); + +-- +2.23.0 diff --git a/0024-refactor-pkt-read-send-performance.patch b/0024-refactor-pkt-read-send-performance.patch index 3affe2a..529738a 100644 --- a/0024-refactor-pkt-read-send-performance.patch +++ b/0024-refactor-pkt-read-send-performance.patch @@ -199,7 +199,7 @@ index b8a0d28..fc4a9fd 100644 + return 0; + } + -+ ENQUEUE_PTRS(r, &r[1], prod, obj_table, n, void *); ++ __rte_ring_enqueue_elems(r, prod, obj_table, sizeof(void *), n); + + r->prod.tail = prod + n; + @@ -220,7 +220,7 @@ index b8a0d28..fc4a9fd 100644 + return 0; + } + -+ DEQUEUE_PTRS(r, &r[1], cons, obj_table, n, void *); ++ __rte_ring_dequeue_elems(r, cons, obj_table, sizeof(void *), n); + + r->cons.tail = cons + n; + diff --git a/0025-Replace-gettid-with-syscall-SYS_gettid.patch b/0025-Replace-gettid-with-syscall-SYS_gettid.patch new file mode 100644 index 0000000..92abd14 --- /dev/null +++ b/0025-Replace-gettid-with-syscall-SYS_gettid.patch @@ -0,0 +1,57 @@ +From 35300925c26ce9eba9f4f1c9a4181708da771392 Mon Sep 17 00:00:00 2001 +From: Honggang LI +Date: Tue, 12 Jul 2022 10:15:36 +0800 +Subject: [PATCH] Replace gettid() with syscall(SYS_gettid) + +Remove gettid() to address a backport issue for gazelle library. + +Signed-off-by: Honggang LI +--- + src/include/arch/cc.h | 4 ++-- + src/include/lwiplog.h | 3 +-- + 2 files changed, 3 insertions(+), 4 deletions(-) + +diff --git a/src/include/arch/cc.h b/src/include/arch/cc.h +index 222b0c9..aa18573 100644 +--- a/src/include/arch/cc.h ++++ b/src/include/arch/cc.h +@@ -62,7 +62,7 @@ void alloc_memp_##name##_base(void) \ + memp_pools[MEMP_##name] = &memp_ ## name; \ + \ + char mpname[MEMZONE_NAMESIZE] = {0}; \ +- snprintf(mpname, MEMZONE_NAMESIZE, "%d_%s", gettid(), #name); \ ++ snprintf(mpname, MEMZONE_NAMESIZE, "%d_%s", (int)syscall(SYS_gettid), #name); \ + memp_memory_##name##_base = \ + sys_hugepage_malloc(mpname, LWIP_MEM_ALIGN_BUFFER(__size)); \ + memp_pools[MEMP_##name]->base = memp_memory_##name##_base; \ +@@ -73,7 +73,7 @@ PER_THREAD uint8_t *variable_name; \ + void alloc_memory_##variable_name(void) \ + { \ + char mpname[MEMZONE_NAMESIZE] = {0}; \ +- snprintf(mpname, MEMZONE_NAMESIZE, "%d_%s", gettid(), #variable_name); \ ++ snprintf(mpname, MEMZONE_NAMESIZE, "%d_%s", (int)syscall(SYS_gettid), #variable_name); \ + (variable_name) = \ + sys_hugepage_malloc(mpname, LWIP_MEM_ALIGN_BUFFER(size)); \ + } +diff --git a/src/include/lwiplog.h b/src/include/lwiplog.h +index 6fccac8..011ed21 100644 +--- a/src/include/lwiplog.h ++++ b/src/include/lwiplog.h +@@ -35,13 +35,12 @@ + + #include + #include ++#include + + #include + + #include "lwipopts.h" + +-extern int gettid(void); +- + #if USE_DPDK_LOG + + #define LWIP_LOG_WARN LWIP_DBG_LEVEL_WARNING +-- +2.31.1 + diff --git a/0025-del-redundant-wait_close-and-move-epoll_events-pos.patch b/0026-del-redundant-wait_close-and-move-epoll_events-pos.patch similarity index 77% rename from 0025-del-redundant-wait_close-and-move-epoll_events-pos.patch rename to 0026-del-redundant-wait_close-and-move-epoll_events-pos.patch index e965d31..cee127b 100644 --- a/0025-del-redundant-wait_close-and-move-epoll_events-pos.patch +++ b/0026-del-redundant-wait_close-and-move-epoll_events-pos.patch @@ -1,17 +1,17 @@ -From ce10beab87dafafea4f54bb98892615461b8e7ef Mon Sep 17 00:00:00 2001 +From ab62f970793c257c712c357a6976b9aca2e63b98 Mon Sep 17 00:00:00 2001 From: wu-changsheng -Date: Tue, 26 Jul 2022 17:49:36 +0800 -Subject: [PATCH] del-redundant-wait_close-and-move-epoll_events-pos +Date: Tue, 26 Jul 2022 17:36:29 +0800 +Subject: [PATCH] del redundant wait_close and move epoll_events pos --- src/include/lwipsock.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h -index c10ae83..c6702fc 100644 +index 500292d..16e0dd3 100644 --- a/src/include/lwipsock.h +++ b/src/include/lwipsock.h -@@ -99,12 +99,11 @@ struct lwip_sock { +@@ -98,12 +98,11 @@ struct lwip_sock { struct list_node recv_list __rte_cache_aligned; struct list_node event_list __rte_cache_aligned; struct list_node send_list __rte_cache_aligned; diff --git a/0026-modify-EISCONN-condition.patch b/0027-modify-EISCONN-condition.patch similarity index 52% rename from 0026-modify-EISCONN-condition.patch rename to 0027-modify-EISCONN-condition.patch index b817f77..2693e91 100644 --- a/0026-modify-EISCONN-condition.patch +++ b/0027-modify-EISCONN-condition.patch @@ -1,7 +1,18 @@ -diff -Nur lwip-2.1.3-org/src/api/api_msg.c lwip-2.1.3/src/api/api_msg.c ---- lwip-2.1.3-org/src/api/api_msg.c 2022-09-21 14:18:31.456000000 +0000 -+++ lwip-2.1.3/src/api/api_msg.c 2022-09-21 14:19:58.852000000 +0000 -@@ -1417,7 +1417,7 @@ +From b8c388a7adef4dc53d3bb135102da64bf8a08b76 Mon Sep 17 00:00:00 2001 +From: wuchangsheng +Date: Thu, 6 Oct 2022 15:57:33 +0800 +Subject: [PATCH] modify-EISCONN-condition + +--- + src/api/api_msg.c | 2 +- + src/include/lwipsock.h | 2 ++ + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/api/api_msg.c b/src/api/api_msg.c +index 7839526..2dded75 100644 +--- a/src/api/api_msg.c ++++ b/src/api/api_msg.c +@@ -1417,7 +1417,7 @@ lwip_netconn_do_connect(void *m) /* Prevent connect while doing any other action. */ if (msg->conn->state == NETCONN_CONNECT) { err = ERR_ALREADY; @@ -10,10 +21,11 @@ diff -Nur lwip-2.1.3-org/src/api/api_msg.c lwip-2.1.3/src/api/api_msg.c err = ERR_ISCONN; } else { setup_tcp(msg->conn); -diff -Nur lwip-2.1.3-org/src/include/lwipsock.h lwip-2.1.3/src/include/lwipsock.h ---- lwip-2.1.3-org/src/include/lwipsock.h 2022-09-21 14:18:31.440000000 +0000 -+++ lwip-2.1.3/src/include/lwipsock.h 2022-09-21 14:22:30.404000000 +0000 -@@ -98,6 +98,8 @@ +diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h +index 16e0dd3..3c5c44b 100644 +--- a/src/include/lwipsock.h ++++ b/src/include/lwipsock.h +@@ -98,6 +98,8 @@ struct lwip_sock { struct list_node recv_list __rte_cache_aligned; struct list_node event_list __rte_cache_aligned; struct list_node send_list __rte_cache_aligned; @@ -22,3 +34,6 @@ diff -Nur lwip-2.1.3-org/src/include/lwipsock.h lwip-2.1.3/src/include/lwipsock. uint32_t epoll_events; /* registered events, EPOLLONESHOT write frequently */ char pad __rte_cache_aligned; +-- +2.27.0 + diff --git a/0027-per-thread-reassdata-variables.patch b/0028-per-thread-reassdata-variables.patch similarity index 83% rename from 0027-per-thread-reassdata-variables.patch rename to 0028-per-thread-reassdata-variables.patch index 32fa837..28eff78 100644 --- a/0027-per-thread-reassdata-variables.patch +++ b/0028-per-thread-reassdata-variables.patch @@ -1,7 +1,7 @@ -From 464de9f32488b59d927378cdcc2d08d402af3729 Mon Sep 17 00:00:00 2001 +From a554661e9dd189f2d4b5dee8970fd009db89d9aa Mon Sep 17 00:00:00 2001 From: wuchangsheng -Date: Thu, 6 Oct 2022 17:42:58 +0800 -Subject: [PATCH] per-thread-reassdata-variables +Date: Thu, 6 Oct 2022 17:33:16 +0800 +Subject: [PATCH] per thread reassdata variables --- src/core/ipv4/ip4_frag.c | 5 +++++ diff --git a/0028-fix-EISCONN-err-and-remove-same-customized-modificat.patch b/0029-fix-EISCONN-err-and-remove-same-customized-modificat.patch similarity index 88% rename from 0028-fix-EISCONN-err-and-remove-same-customized-modificat.patch rename to 0029-fix-EISCONN-err-and-remove-same-customized-modificat.patch index a9046f7..91ac15e 100644 --- a/0028-fix-EISCONN-err-and-remove-same-customized-modificat.patch +++ b/0029-fix-EISCONN-err-and-remove-same-customized-modificat.patch @@ -1,7 +1,7 @@ -From d062b986786b9b1abf43ec74d1adfabb92463fd0 Mon Sep 17 00:00:00 2001 +From ec2f5414c6c98b63376e4bce9534abc5c01ce13c Mon Sep 17 00:00:00 2001 From: wuchangsheng -Date: Thu, 6 Oct 2022 18:54:52 +0800 -Subject: [PATCH] fix-EISCONN-err-and-remove-same-customized-modificat +Date: Thu, 6 Oct 2022 18:47:06 +0800 +Subject: [PATCH] fix EISCONN err and remove same customized modification --- src/api/api_msg.c | 22 ++-------------------- @@ -9,10 +9,10 @@ Subject: [PATCH] fix-EISCONN-err-and-remove-same-customized-modificat 2 files changed, 6 insertions(+), 49 deletions(-) diff --git a/src/api/api_msg.c b/src/api/api_msg.c -index 3b5075c..65b6309 100644 +index 2dded75..1fedaad 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c -@@ -1331,25 +1331,7 @@ lwip_netconn_do_connected(void *arg, struct tcp_pcb *pcb, err_t err) +@@ -1334,25 +1334,7 @@ lwip_netconn_do_connected(void *arg, struct tcp_pcb *pcb, err_t err) } #if USE_LIBOS @@ -39,7 +39,7 @@ index 3b5075c..65b6309 100644 #endif LWIP_ASSERT("conn->state == NETCONN_CONNECT", conn->state == NETCONN_CONNECT); -@@ -1414,7 +1396,7 @@ lwip_netconn_do_connect(void *m) +@@ -1417,7 +1399,7 @@ lwip_netconn_do_connect(void *m) /* Prevent connect while doing any other action. */ if (msg->conn->state == NETCONN_CONNECT) { err = ERR_ALREADY; @@ -49,10 +49,10 @@ index 3b5075c..65b6309 100644 } else { setup_tcp(msg->conn); diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h -index 202a15e..4736847 100644 +index 3c5c44b..912d471 100644 --- a/src/include/lwipsock.h +++ b/src/include/lwipsock.h -@@ -94,13 +94,14 @@ struct lwip_sock { +@@ -93,13 +93,14 @@ struct lwip_sock { #endif #if USE_LIBOS @@ -68,7 +68,7 @@ index 202a15e..4736847 100644 uint32_t epoll_events; /* registered events, EPOLLONESHOT write frequently */ char pad __rte_cache_aligned; -@@ -125,38 +126,12 @@ struct lwip_sock { +@@ -124,38 +125,12 @@ struct lwip_sock { #if USE_LIBOS extern uint32_t sockets_num; extern struct lwip_sock *sockets; diff --git a/0029-refactor-tcp-new-port.patch b/0030-refactor-tcp-new-port.patch similarity index 83% rename from 0029-refactor-tcp-new-port.patch rename to 0030-refactor-tcp-new-port.patch index 343d680..8d59fbc 100644 --- a/0029-refactor-tcp-new-port.patch +++ b/0030-refactor-tcp-new-port.patch @@ -1,15 +1,15 @@ -From b18cb7d02c10d15873578d61665507f2e341ebe3 Mon Sep 17 00:00:00 2001 +From 68c1fe8794077eab032b542094608338947f3d4f Mon Sep 17 00:00:00 2001 From: wuchangsheng -Date: Thu, 6 Oct 2022 19:52:43 +0800 -Subject: [PATCH] refactor tcp new port +Date: Thu, 6 Oct 2022 19:27:41 +0800 +Subject: [PATCH] fix tcp new port --- src/core/tcp.c | 87 +++++++++++++++++++++++++++++------------- - src/include/reg_sock.h | 3 ++ - 2 files changed, 63 insertions(+), 27 deletions(-) + src/include/reg_sock.h | 1 + + 2 files changed, 61 insertions(+), 27 deletions(-) diff --git a/src/core/tcp.c b/src/core/tcp.c -index 04a7c07..c584585 100644 +index b65ab33..436ef85 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -202,13 +202,26 @@ PER_THREAD u8_t tcp_active_pcbs_changed; @@ -47,7 +47,7 @@ index 04a7c07..c584585 100644 #endif LWIP_ASSERT("tcp_free: LISTEN", pcb->state != LISTEN); #if LWIP_TCP_PCB_NUM_EXT_ARGS -@@ -745,7 +759,11 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) +@@ -746,7 +760,11 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) #endif /* LWIP_IPV6 && LWIP_IPV6_SCOPES */ if (port == 0) { @@ -59,7 +59,7 @@ index 04a7c07..c584585 100644 if (port == 0) { return ERR_BUF; } -@@ -1056,33 +1074,43 @@ tcp_recved(struct tcp_pcb *pcb, u16_t len) +@@ -1057,33 +1075,43 @@ tcp_recved(struct tcp_pcb *pcb, u16_t len) * * @return a new (free) local TCP port number */ @@ -122,7 +122,7 @@ index 04a7c07..c584585 100644 pthread_mutex_unlock(&g_tcp_port_mutex); return tmp_port; -@@ -1168,7 +1196,11 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port, +@@ -1169,7 +1197,11 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port, old_local_port = pcb->local_port; if (pcb->local_port == 0) { @@ -134,7 +134,7 @@ index 04a7c07..c584585 100644 if (pcb->local_port == 0) { return ERR_BUF; } -@@ -1195,10 +1227,6 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port, +@@ -1196,10 +1228,6 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port, #endif /* SO_REUSE */ } @@ -145,7 +145,7 @@ index 04a7c07..c584585 100644 iss = tcp_next_iss(pcb); pcb->rcv_nxt = 0; pcb->snd_nxt = iss; -@@ -1226,6 +1254,10 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port, +@@ -1227,6 +1255,10 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port, /* Send a SYN together with the MSS option. */ ret = tcp_enqueue_flags(pcb, TCP_SYN); if (ret == ERR_OK) { @@ -156,7 +156,7 @@ index 04a7c07..c584585 100644 /* SYN segment was enqueued, changed the pcbs state now */ pcb->state = SYN_SENT; if (old_local_port != 0) { -@@ -2273,10 +2305,6 @@ tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb) +@@ -2277,10 +2309,6 @@ tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb) LWIP_ASSERT("tcp_pcb_remove: invalid pcb", pcb != NULL); LWIP_ASSERT("tcp_pcb_remove: invalid pcblist", pcblist != NULL); @@ -167,7 +167,7 @@ index 04a7c07..c584585 100644 TCP_RMV(pcblist, pcb); tcp_pcb_purge(pcb); -@@ -2297,6 +2325,11 @@ tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb) +@@ -2301,6 +2329,11 @@ tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb) #endif /* TCP_QUEUE_OOSEQ */ } @@ -180,19 +180,10 @@ index 04a7c07..c584585 100644 /* reset the local port to prevent the pcb from being 'bound' */ pcb->local_port = 0; diff --git a/src/include/reg_sock.h b/src/include/reg_sock.h -index 76673da..5d5710d 100644 +index 76673da..e349e85 100644 --- a/src/include/reg_sock.h +++ b/src/include/reg_sock.h -@@ -33,6 +33,8 @@ - #ifndef __REG_SOCK_H__ - #define __REG_SOCK_H__ - -+#include -+ - enum reg_ring_type { - REG_RING_TCP_LISTEN = 0, - REG_RING_TCP_LISTEN_CLOSE, -@@ -58,5 +60,6 @@ struct reg_ring_msg { +@@ -58,5 +58,6 @@ struct reg_ring_msg { }; extern int vdev_reg_xmit(enum reg_ring_type type, struct gazelle_quintuple *qtuple); diff --git a/0030-refactor-add-event-limit-send-pkts-num.patch b/0031-refactor-add-event-limit-send-pkts-num.patch similarity index 87% rename from 0030-refactor-add-event-limit-send-pkts-num.patch rename to 0031-refactor-add-event-limit-send-pkts-num.patch index 921315b..63ba303 100644 --- a/0030-refactor-add-event-limit-send-pkts-num.patch +++ b/0031-refactor-add-event-limit-send-pkts-num.patch @@ -1,6 +1,6 @@ -From 0db924042e5d5750b81081634a8c261d631c9d89 Mon Sep 17 00:00:00 2001 +From 87166f699e0febd36b81d914713b770119ead471 Mon Sep 17 00:00:00 2001 From: wuchangsheng -Date: Thu, 6 Oct 2022 20:23:20 +0800 +Date: Thu, 6 Oct 2022 20:16:06 +0800 Subject: [PATCH] refactor add event, limit send pkts num --- @@ -10,10 +10,10 @@ Subject: [PATCH] refactor add event, limit send pkts num 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/api/sockets.c b/src/api/sockets.c -index fe17c29..f84127c 100644 +index 4d4cea1..d5b69eb 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c -@@ -2659,7 +2659,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len) +@@ -2665,7 +2665,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len) } #if USE_LIBOS if (conn->acceptmbox != NULL && !sys_mbox_empty(conn->acceptmbox)) { @@ -22,7 +22,7 @@ index fe17c29..f84127c 100644 } #endif break; -@@ -2680,7 +2680,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len) +@@ -2686,7 +2686,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len) case NETCONN_EVT_ERROR: sock->errevent = 1; #if USE_LIBOS @@ -32,7 +32,7 @@ index fe17c29..f84127c 100644 break; default: diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c -index 2d341b3..061af5f 100644 +index 1b0af8d..dd780d3 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -1358,8 +1358,16 @@ tcp_output(struct tcp_pcb *pcb) diff --git a/0031-fix-free-pbuf-miss-data.patch b/0032-fix-free-pbuf-miss-data.patch similarity index 93% rename from 0031-fix-free-pbuf-miss-data.patch rename to 0032-fix-free-pbuf-miss-data.patch index 14ec27a..0816127 100644 --- a/0031-fix-free-pbuf-miss-data.patch +++ b/0032-fix-free-pbuf-miss-data.patch @@ -1,6 +1,6 @@ -From 9af71c25a61e34032a66e351ca67a2ed196f715c Mon Sep 17 00:00:00 2001 +From 0c7d7ad7f9a79a557a867a6009aa2aac067d454e Mon Sep 17 00:00:00 2001 From: wuchangsheng -Date: Thu, 6 Oct 2022 21:09:57 +0800 +Date: Thu, 6 Oct 2022 21:07:12 +0800 Subject: [PATCH] fix free pbuf miss data --- @@ -9,7 +9,7 @@ Subject: [PATCH] fix free pbuf miss data 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c -index 061af5f..7ebcfea 100644 +index dd780d3..2834ba3 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -682,11 +682,24 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags) diff --git a/0032-alloc-socket-fail-clean-sock.patch b/0033-alloc-socket-fail-clean-sock.patch similarity index 100% rename from 0032-alloc-socket-fail-clean-sock.patch rename to 0033-alloc-socket-fail-clean-sock.patch diff --git a/0036-add-fs-secure-compilation-option.patch b/0036-add-fs-secure-compilation-option.patch new file mode 100644 index 0000000..3021f6e --- /dev/null +++ b/0036-add-fs-secure-compilation-option.patch @@ -0,0 +1,25 @@ +From c2c7c2f5bbf84f62acc6468113b1f11cdc6b8410 Mon Sep 17 00:00:00 2001 +From: jiangheng +Date: Sat, 22 Oct 2022 16:05:37 +0800 +Subject: [PATCH] add fs secure compilation option + +--- + src/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/Makefile b/src/Makefile +index 1676a71..f445601 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -4,7 +4,7 @@ ROOT_DIR := $(dir $(abspath $(LWIP_DIR))) + LWIP_INC = $(LWIP_DIR)/include + DPDK_INCLUDE_FILE ?= /usr/include/dpdk + +-SEC_FLAGS = -fstack-protector-strong -Werror -Wall -Wl,-z,relro,-z,now -Wl,-z,noexecstack -Wtrampolines -fPIC ++SEC_FLAGS = -fstack-protector-strong -Werror -Wall -Wl,-z,relro,-z,now -Wl,-z,noexecstack -Wtrampolines -fPIC -D_FORTIRY_SOURCE=2 -O2 + + CC = gcc + AR = ar +-- +2.23.0 + diff --git a/0036-enable-ARP-QUEUE-to-avoid-sync-packet-dropped.patch b/0037-enable-ARP-QUEUE-to-avoid-sync-packet-dropped.patch similarity index 100% rename from 0036-enable-ARP-QUEUE-to-avoid-sync-packet-dropped.patch rename to 0037-enable-ARP-QUEUE-to-avoid-sync-packet-dropped.patch diff --git a/0037-add-tso.patch b/0038-add-tso.patch similarity index 95% rename from 0037-add-tso.patch rename to 0038-add-tso.patch index 79627e8..d6a9841 100644 --- a/0037-add-tso.patch +++ b/0038-add-tso.patch @@ -1,7 +1,7 @@ -From 816a5b350a613d9da4e3d5b8d2c03026b8e0254c Mon Sep 17 00:00:00 2001 +From af8ac36acb103aa27b498dafa0ae8ba4332faac8 Mon Sep 17 00:00:00 2001 From: wu-changsheng -Date: Sat, 3 Dec 2022 23:54:25 +0800 -Subject: [PATCH] add tso +Date: Sat, 3 Dec 2022 21:38:09 +0800 +Subject: [PATCH] add-tso --- src/core/ipv4/etharp.c | 17 +++- @@ -71,10 +71,10 @@ index 1334cdc..d823491 100644 LWIP_DEBUGF(IP_DEBUG, ("ip4_output_if: call netif->output()\n")); diff --git a/src/core/tcp.c b/src/core/tcp.c -index 4fece5d..fe54610 100644 +index 7c18408..51ada38 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c -@@ -1755,7 +1755,9 @@ tcp_seg_free(struct tcp_seg *seg) +@@ -1756,7 +1756,9 @@ tcp_seg_free(struct tcp_seg *seg) seg->p = NULL; #endif /* TCP_DEBUG */ } @@ -84,7 +84,7 @@ index 4fece5d..fe54610 100644 } } -@@ -1791,10 +1793,14 @@ tcp_seg_copy(struct tcp_seg *seg) +@@ -1792,10 +1794,14 @@ tcp_seg_copy(struct tcp_seg *seg) LWIP_ASSERT("tcp_seg_copy: invalid seg", seg != NULL); @@ -100,7 +100,7 @@ index 4fece5d..fe54610 100644 pbuf_ref(cseg->p); return cseg; diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c -index 7ebcfea..c4584ea 100644 +index 2834ba3..ee6f40b 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -161,6 +161,40 @@ tcp_route(const struct tcp_pcb *pcb, const ip_addr_t *src, const ip_addr_t *dst) @@ -327,23 +327,23 @@ index 7ebcfea..c4584ea 100644 } else { #if TCP_CHECKSUM_ON_COPY diff --git a/src/include/dpdk_cksum.h b/src/include/dpdk_cksum.h -index 70aab71..7163196 100644 +index e57be4d..83c9c38 100644 --- a/src/include/dpdk_cksum.h +++ b/src/include/dpdk_cksum.h -@@ -79,7 +79,7 @@ static inline void iph_cksum_set(struct pbuf *p, u16_t len, bool do_ipcksum) { +@@ -78,7 +78,7 @@ static inline void iph_cksum_set(struct pbuf *p, u16_t len, bool do_ipcksum) { #include static inline void tcph_cksum_set(struct pbuf *p, u16_t len) { - (void)len; + p->l4_len = len; - p->ol_flags |= PKT_TX_TCP_CKSUM; + p->ol_flags |= RTE_MBUF_F_TX_TCP_CKSUM; } diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h -index e68d0bf..d9d2e71 100644 +index 87cd960..ef879da 100644 --- a/src/include/lwip/pbuf.h +++ b/src/include/lwip/pbuf.h -@@ -222,10 +222,14 @@ struct pbuf { +@@ -223,10 +223,14 @@ struct pbuf { #if USE_LIBOS && CHECKSUM_OFFLOAD_ALL /** checksum offload ol_flags */ u64_t ol_flags; @@ -358,8 +358,8 @@ index e68d0bf..d9d2e71 100644 + u16_t header_off; + u8_t rexmit; #endif /* USE_LIBOS CHECKSUM_OFFLOAD_SWITCH */ - }; + /** In case the user needs to store data custom data on a pbuf */ diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h index a5add21..7c819d0 100644 --- a/src/include/lwipopts.h diff --git a/0038-optimize-app-thread-write-buff-block.patch b/0039-optimize-app-thread-write-buff-block.patch similarity index 84% rename from 0038-optimize-app-thread-write-buff-block.patch rename to 0039-optimize-app-thread-write-buff-block.patch index 6e64b9c..42280e3 100644 --- a/0038-optimize-app-thread-write-buff-block.patch +++ b/0039-optimize-app-thread-write-buff-block.patch @@ -1,7 +1,7 @@ -From f065e072711b0714aa49556afc88d9f1efaa405c Mon Sep 17 00:00:00 2001 -From: wu-changsheng -Date: Sat, 3 Dec 2022 21:58:44 +0800 -Subject: [PATCH] optimize-app-thread-write-buff-block +From be541628552ccc3a8dcd3c6ad6e5a1aed07c4928 Mon Sep 17 00:00:00 2001 +From: wuchangsheng +Date: Sat, 3 Dec 2022 20:35:34 +0800 +Subject: [PATCH 2/2] fix app thread write fail --- src/core/tcp_out.c | 2 +- @@ -10,7 +10,7 @@ Subject: [PATCH] optimize-app-thread-write-buff-block 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c -index c4584ea..a4d511e 100644 +index ee6f40b..f53750b 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -763,7 +763,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags) @@ -23,10 +23,10 @@ index c4584ea..a4d511e 100644 } diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h -index d9d2e71..200dbf2 100644 +index ef879da..10e2af9 100644 --- a/src/include/lwip/pbuf.h +++ b/src/include/lwip/pbuf.h -@@ -230,6 +230,9 @@ struct pbuf { +@@ -231,6 +231,9 @@ struct pbuf { u64_t l4_len:8; u16_t header_off; u8_t rexmit; @@ -34,13 +34,13 @@ index d9d2e71..200dbf2 100644 + u8_t head; + struct pbuf *last; #endif /* USE_LIBOS CHECKSUM_OFFLOAD_SWITCH */ - }; + /** In case the user needs to store data custom data on a pbuf */ diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h -index 9fa4c57..4c578b3 100644 +index 2ffb077..f919330 100644 --- a/src/include/lwipsock.h +++ b/src/include/lwipsock.h -@@ -94,17 +94,30 @@ struct lwip_sock { +@@ -93,17 +93,30 @@ struct lwip_sock { #endif #if USE_LIBOS @@ -80,7 +80,7 @@ index 9fa4c57..4c578b3 100644 struct wakeup_poll *wakeup; epoll_data_t ep_data; struct lwip_sock *listen_next; /* listenfd list */ -@@ -132,7 +145,7 @@ extern ssize_t read_lwip_data(struct lwip_sock *sock, int32_t flags, u8_t apifla +@@ -131,7 +144,7 @@ extern ssize_t read_lwip_data(struct lwip_sock *sock, int32_t flags, u8_t apifla extern struct pbuf *write_lwip_data(struct lwip_sock *sock, uint16_t remain_size, uint8_t *apiflags); extern void gazelle_init_sock(int32_t fd); extern void gazelle_clean_sock(int32_t fd); @@ -90,5 +90,5 @@ index 9fa4c57..4c578b3 100644 struct lwip_sock *get_socket(int s); -- -2.23.0 +2.8.4.windows.1 diff --git a/0039-add-huge-snd_buf.patch b/0040-add-huge-snd_buf.patch similarity index 100% rename from 0039-add-huge-snd_buf.patch rename to 0040-add-huge-snd_buf.patch diff --git a/0040-optimite-pcb-list-limit-send-size-and-ack-now.patch b/0041-optimite-pcb-list-limit-send-size-and-ack-now.patch similarity index 100% rename from 0040-optimite-pcb-list-limit-send-size-and-ack-now.patch rename to 0041-optimite-pcb-list-limit-send-size-and-ack-now.patch diff --git a/0041-expand-recv-win.patch b/0042-expand-recv-win.patch similarity index 100% rename from 0041-expand-recv-win.patch rename to 0042-expand-recv-win.patch diff --git a/0042-add-prefetch.patch b/0043-add-prefetch.patch similarity index 100% rename from 0042-add-prefetch.patch rename to 0043-add-prefetch.patch diff --git a/0043-skip-unnecessary-tcp_route.patch b/0044-skip-unnecessary-tcp_route.patch similarity index 100% rename from 0043-skip-unnecessary-tcp_route.patch rename to 0044-skip-unnecessary-tcp_route.patch diff --git a/0044-add-variable-in-struct-sock.patch b/0045-add-variable-in-struct-sock.patch similarity index 100% rename from 0044-add-variable-in-struct-sock.patch rename to 0045-add-variable-in-struct-sock.patch diff --git a/0045-add-dataack-when-recv-too-many-acks-with-data.patch b/0046-add-dataack-when-recv-too-many-acks-with-data.patch similarity index 89% rename from 0045-add-dataack-when-recv-too-many-acks-with-data.patch rename to 0046-add-dataack-when-recv-too-many-acks-with-data.patch index 9926540..70131e5 100644 --- a/0045-add-dataack-when-recv-too-many-acks-with-data.patch +++ b/0046-add-dataack-when-recv-too-many-acks-with-data.patch @@ -1,6 +1,6 @@ -From fe99dca0fa972f3c934a91e587380f140e093306 Mon Sep 17 00:00:00 2001 +From 1aa27395a4c4b73b6db472c4ae75ed91637a11bf Mon Sep 17 00:00:00 2001 From: kircher -Date: Wed, 21 Dec 2022 17:34:17 +0800 +Date: Wed, 21 Dec 2022 17:50:50 +0800 Subject: [PATCH] add dataack when recv too many acks with data --- @@ -10,10 +10,10 @@ Subject: [PATCH] add dataack when recv too many acks with data 3 files changed, 25 insertions(+) diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c -index a5aebb4..9e84889 100644 +index 78954bd..35ec6d9 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c -@@ -1259,6 +1259,7 @@ tcp_receive(struct tcp_pcb *pcb) +@@ -1260,6 +1260,7 @@ tcp_receive(struct tcp_pcb *pcb) s16_t m; u32_t right_wnd_edge; int found_dupack = 0; @@ -21,7 +21,7 @@ index a5aebb4..9e84889 100644 LWIP_ASSERT("tcp_receive: invalid pcb", pcb != NULL); LWIP_ASSERT("tcp_receive: wrong state", pcb->state >= ESTABLISHED); -@@ -1336,11 +1337,31 @@ tcp_receive(struct tcp_pcb *pcb) +@@ -1337,11 +1338,31 @@ tcp_receive(struct tcp_pcb *pcb) } } } @@ -53,7 +53,7 @@ index a5aebb4..9e84889 100644 } else if (TCP_SEQ_BETWEEN(ackno, pcb->lastack + 1, pcb->snd_nxt)) { /* We come here when the ACK acknowledges new data. */ tcpwnd_size_t acked; -@@ -1366,6 +1387,7 @@ tcp_receive(struct tcp_pcb *pcb) +@@ -1367,6 +1388,7 @@ tcp_receive(struct tcp_pcb *pcb) /* Reset the fast retransmit variables. */ pcb->dupacks = 0; pcb->lastack = ackno; diff --git a/0046-reduce-struct-pbuf-size.patch b/0047-reduce-struct-pbuf-size.patch similarity index 100% rename from 0046-reduce-struct-pbuf-size.patch rename to 0047-reduce-struct-pbuf-size.patch diff --git a/0047-listen-pcb-also-use-pcb_if.patch b/0048-listen-pcb-also-use-pcb_if.patch similarity index 100% rename from 0047-listen-pcb-also-use-pcb_if.patch rename to 0048-listen-pcb-also-use-pcb_if.patch diff --git a/0048-expand-recv-mbox-size.patch b/0049-expand-recv-mbox-size.patch similarity index 100% rename from 0048-expand-recv-mbox-size.patch rename to 0049-expand-recv-mbox-size.patch diff --git a/0049-lwip-reuse-ip-port.patch b/0050-lwip-reuse-ip-port.patch similarity index 92% rename from 0049-lwip-reuse-ip-port.patch rename to 0050-lwip-reuse-ip-port.patch index bfd2d02..08cdcdd 100644 --- a/0049-lwip-reuse-ip-port.patch +++ b/0050-lwip-reuse-ip-port.patch @@ -1,6 +1,6 @@ -From 753be28ab3b124713534079802d6681645a67192 Mon Sep 17 00:00:00 2001 +From 28f8ba80cd733e14e0540c414a18134b3c3fcc94 Mon Sep 17 00:00:00 2001 From: FanBin -Date: Tue, 14 Feb 2023 21:37:10 +0800 +Date: Wed, 15 Feb 2023 10:09:39 +0800 Subject: [PATCH] lwip reuse ip port --- @@ -13,7 +13,7 @@ Subject: [PATCH] lwip reuse ip port 6 files changed, 104 insertions(+), 3 deletions(-) diff --git a/src/core/tcp.c b/src/core/tcp.c -index abfcc00..6dfb058 100644 +index f75d214..3171c5e 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -111,6 +111,7 @@ @@ -24,7 +24,7 @@ index abfcc00..6dfb058 100644 #include #include -@@ -771,6 +772,9 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) +@@ -772,6 +773,9 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) /* Check if the address already is in use (on all lists) */ for (i = 0; i < max_pcb_list; i++) { for (cpcb = *tcp_pcb_lists[i]; cpcb != NULL; cpcb = cpcb->next) { @@ -34,7 +34,7 @@ index abfcc00..6dfb058 100644 if (cpcb->local_port == port) { #if SO_REUSE /* Omit checking for the same port if both pcbs have REUSEADDR set. -@@ -789,6 +793,7 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) +@@ -790,6 +794,7 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) } } } @@ -42,7 +42,7 @@ index abfcc00..6dfb058 100644 } } } -@@ -920,7 +925,18 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) +@@ -921,7 +926,18 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) res = ERR_ALREADY; goto done; } @@ -62,7 +62,7 @@ index abfcc00..6dfb058 100644 if (ip_get_option(pcb, SOF_REUSEADDR)) { /* Since SOF_REUSEADDR allows reusing a local address before the pcb's usage is declared (listen-/connection-pcb), we have to make sure now that -@@ -935,7 +951,7 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) +@@ -936,7 +952,7 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) } } } @@ -71,8 +71,8 @@ index abfcc00..6dfb058 100644 #if USE_LIBOS vdev_reg_done(REG_RING_TCP_LISTEN, pcb); -@@ -954,6 +970,16 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) - lpcb->netif_idx = NETIF_NO_INDEX; +@@ -955,6 +971,16 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) + lpcb->netif_idx = pcb->netif_idx; lpcb->ttl = pcb->ttl; lpcb->tos = pcb->tos; + @@ -88,7 +88,7 @@ index abfcc00..6dfb058 100644 #if LWIP_IPV4 && LWIP_IPV6 IP_SET_TYPE_VAL(lpcb->remote_ip, pcb->local_ip.type); #endif /* LWIP_IPV4 && LWIP_IPV6 */ -@@ -978,7 +1004,15 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) +@@ -979,7 +1005,15 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) lpcb->accepts_pending = 0; tcp_backlog_set(lpcb, backlog); #endif /* TCP_LISTEN_BACKLOG */ @@ -106,7 +106,7 @@ index abfcc00..6dfb058 100644 done: if (err != NULL) { diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c -index c2f451b..8a2b153 100644 +index 35ec6d9..9f5c34a 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -356,6 +356,9 @@ tcp_input(struct pbuf *p, struct netif *inp) @@ -216,7 +216,7 @@ index b242428..97f799e 100644 do { \ hlist_del_init(&(npcb)->tcp_node); \ diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h -index 0b65b01..5f695ef 100644 +index 0b65b01..312320b 100644 --- a/src/include/lwip/tcp.h +++ b/src/include/lwip/tcp.h @@ -252,6 +252,14 @@ struct tcp_pcb_listen { diff --git a/0050-lwip-add-need_tso_send.patch b/0051-lwip-add-need_tso_send.patch similarity index 87% rename from 0050-lwip-add-need_tso_send.patch rename to 0051-lwip-add-need_tso_send.patch index 6b01c4b..5e45768 100644 --- a/0050-lwip-add-need_tso_send.patch +++ b/0051-lwip-add-need_tso_send.patch @@ -1,6 +1,6 @@ -From ca773597e1e63ff2d6d0ebaee4332bcd4596f1e8 Mon Sep 17 00:00:00 2001 +From 590873482f9b6a5e2635a95720acb37b5f516ab0 Mon Sep 17 00:00:00 2001 From: kircher -Date: Tue, 21 Feb 2023 14:32:54 +0800 +Date: Tue, 21 Feb 2023 15:05:41 +0800 Subject: [PATCH] lwip add need_tso_send --- @@ -10,10 +10,10 @@ Subject: [PATCH] lwip add need_tso_send 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/api/api_msg.c b/src/api/api_msg.c -index 65b6309..4a2df95 100644 +index 1fedaad..3a4a473 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c -@@ -1741,6 +1741,7 @@ lwip_netconn_do_writemore(struct netconn *conn WRITE_DELAYED_PARAM) +@@ -1744,6 +1744,7 @@ lwip_netconn_do_writemore(struct netconn *conn WRITE_DELAYED_PARAM) write_more = 0; err = tcp_write(conn->pcb.tcp, conn->current_msg->msg.w.vector->ptr, len, apiflags); conn->current_msg->msg.w.len = len; @@ -22,7 +22,7 @@ index 65b6309..4a2df95 100644 err = tcp_write(conn->pcb.tcp, dataptr, len, apiflags); #endif diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c -index bf1ad42..9dee888 100644 +index c538f2a..bf23381 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -1473,7 +1473,7 @@ tcp_output(struct tcp_pcb *pcb) @@ -59,10 +59,10 @@ index bf1ad42..9dee888 100644 pcb->last_unsent = NULL; tcp_clear_flags(pcb, TF_NAGLEMEMERR); diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h -index 312320b..c2018cb 100644 +index 0b65b01..2fc683d 100644 --- a/src/include/lwip/tcp.h +++ b/src/include/lwip/tcp.h -@@ -417,6 +417,8 @@ struct tcp_pcb { +@@ -409,6 +409,8 @@ struct tcp_pcb { u8_t snd_scale; u8_t rcv_scale; #endif diff --git a/0051-lwip_fnctl-only-support-F_SETFL-F_GETFL.patch b/0052-lwip_fnctl-only-support-F_SETFL-F_GETFL.patch similarity index 100% rename from 0051-lwip_fnctl-only-support-F_SETFL-F_GETFL.patch rename to 0052-lwip_fnctl-only-support-F_SETFL-F_GETFL.patch diff --git a/0052-cleancode-improve-lwipopts.h-readability.patch b/0053-cleancode-improve-lwipopts.h-readability.patch similarity index 93% rename from 0052-cleancode-improve-lwipopts.h-readability.patch rename to 0053-cleancode-improve-lwipopts.h-readability.patch index 4a1e516..6996746 100644 --- a/0052-cleancode-improve-lwipopts.h-readability.patch +++ b/0053-cleancode-improve-lwipopts.h-readability.patch @@ -1,6 +1,6 @@ -From 29ab5ca0c051be02c8c8d31768342a1a87ea3a6e Mon Sep 17 00:00:00 2001 +From b42299206a917ed5876c27617de59fb71f8437a7 Mon Sep 17 00:00:00 2001 From: Lemmy Huang -Date: Thu, 9 Mar 2023 17:15:14 +0800 +Date: Thu, 9 Mar 2023 10:57:16 +0800 Subject: [PATCH] cleancode: improve lwipopts.h readability Signed-off-by: Lemmy Huang @@ -13,7 +13,7 @@ Signed-off-by: Lemmy Huang src/core/ipv4/ip4.c | 6 +- src/core/ipv4/ip4_frag.c | 4 +- src/core/memp.c | 4 +- - src/core/pbuf.c | 6 +- + src/core/pbuf.c | 8 +- src/core/tcp.c | 66 ++++----- src/core/tcp_in.c | 46 +++--- src/core/tcp_out.c | 36 ++--- @@ -35,10 +35,10 @@ Signed-off-by: Lemmy Huang src/include/lwipopts.h | 240 +++++++++++++++++-------------- src/include/lwipsock.h | 8 +- src/netif/ethernet.c | 2 +- - 30 files changed, 338 insertions(+), 316 deletions(-) + 30 files changed, 339 insertions(+), 317 deletions(-) diff --git a/src/api/api_msg.c b/src/api/api_msg.c -index 4a2df95..f059759 100644 +index 3a4a473..1840c9d 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -54,7 +54,7 @@ @@ -77,7 +77,7 @@ index 4a2df95..f059759 100644 LWIP_DEBUGF(API_MSG_DEBUG, ("libos incoming connection established\n")); SET_CONN_TYPE_LIBOS(newconn); #endif -@@ -1330,7 +1330,7 @@ lwip_netconn_do_connected(void *arg, struct tcp_pcb *pcb, err_t err) +@@ -1333,7 +1333,7 @@ lwip_netconn_do_connected(void *arg, struct tcp_pcb *pcb, err_t err) return ERR_VAL; } @@ -86,7 +86,7 @@ index 4a2df95..f059759 100644 gazelle_connected_callback(conn); #endif -@@ -1735,7 +1735,7 @@ lwip_netconn_do_writemore(struct netconn *conn WRITE_DELAYED_PARAM) +@@ -1738,7 +1738,7 @@ lwip_netconn_do_writemore(struct netconn *conn WRITE_DELAYED_PARAM) } else { write_more = 0; } @@ -96,7 +96,7 @@ index 4a2df95..f059759 100644 LWIP_UNUSED_ARG(dataptr); write_more = 0; diff --git a/src/api/sockets.c b/src/api/sockets.c -index 7f13a7c..484d10a 100644 +index 2cb6f22..356e345 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -62,7 +62,7 @@ @@ -231,7 +231,7 @@ index 7f13a7c..484d10a 100644 nsock = &sockets[newsock - LWIP_SOCKET_OFFSET]; /* See event_callback: If data comes in right away after an accept, even -@@ -817,13 +817,13 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags) +@@ -816,13 +816,13 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags) } IPADDR_PORT_TO_SOCKADDR(&tempaddr, &naddr, port); @@ -247,7 +247,7 @@ index 7f13a7c..484d10a 100644 MEMCPY(addr, &tempaddr, *addrlen); LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d) returning new sock=%d addr=", s, newsock)); -@@ -994,10 +994,10 @@ lwip_connect(int s, const struct sockaddr *name, socklen_t namelen) +@@ -993,10 +993,10 @@ lwip_connect(int s, const struct sockaddr *name, socklen_t namelen) return -1; } @@ -260,7 +260,7 @@ index 7f13a7c..484d10a 100644 LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_connect(%d) succeeded\n", s)); sock_set_errno(sock, 0); -@@ -1066,7 +1066,7 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags) +@@ -1065,7 +1065,7 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags) apiflags |= NETCONN_DONTBLOCK; } @@ -269,7 +269,7 @@ index 7f13a7c..484d10a 100644 do { struct pbuf *p; err_t err; -@@ -1147,13 +1147,13 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags) +@@ -1146,13 +1146,13 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags) } while ((recv_left > 0) && !(flags & MSG_PEEK)); lwip_recv_tcp_done: @@ -285,7 +285,7 @@ index 7f13a7c..484d10a 100644 if (apiflags & NETCONN_NOAUTORCVD) { if ((recvd > 0) && !(flags & MSG_PEEK)) { /* ensure window update after copying all data */ -@@ -1189,7 +1189,7 @@ lwip_sock_make_addr(struct netconn *conn, ip_addr_t *fromaddr, u16_t port, +@@ -1188,7 +1188,7 @@ lwip_sock_make_addr(struct netconn *conn, ip_addr_t *fromaddr, u16_t port, #endif /* LWIP_IPV4 && LWIP_IPV6 */ IPADDR_PORT_TO_SOCKADDR(&saddr, fromaddr, port); @@ -294,7 +294,7 @@ index 7f13a7c..484d10a 100644 if (*fromlen < saddr.sa.sa_len) { truncated = 1; } else if (*fromlen > saddr.sa.sa_len) { -@@ -2686,7 +2686,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len) +@@ -2692,7 +2692,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len) if (sock->rcvevent > 1) { check_waiters = 0; } @@ -303,7 +303,7 @@ index 7f13a7c..484d10a 100644 if (conn->acceptmbox != NULL && !sys_mbox_empty(conn->acceptmbox)) { add_sock_event(sock, POLLIN); } -@@ -2708,7 +2708,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len) +@@ -2714,7 +2714,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len) break; case NETCONN_EVT_ERROR: sock->errevent = 1; @@ -312,7 +312,7 @@ index 7f13a7c..484d10a 100644 add_sock_event(sock, EPOLLERR); #endif break; -@@ -2905,7 +2905,7 @@ lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen, u8_t local) +@@ -2911,7 +2911,7 @@ lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen, u8_t local) ip_addr_debug_print_val(SOCKETS_DEBUG, naddr); LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%"U16_F")\n", port)); @@ -321,7 +321,7 @@ index 7f13a7c..484d10a 100644 if (*namelen > saddr.sa.sa_len) { *namelen = saddr.sa.sa_len; } -@@ -3046,7 +3046,7 @@ lwip_sockopt_to_ipopt(int optname) +@@ -3052,7 +3052,7 @@ lwip_sockopt_to_ipopt(int optname) return SOF_KEEPALIVE; case SO_REUSEADDR: return SOF_REUSEADDR; @@ -330,7 +330,7 @@ index 7f13a7c..484d10a 100644 case SO_REUSEPORT: return SO_REUSEPORT; #endif -@@ -3922,7 +3922,7 @@ lwip_setsockopt_impl(int s, int level, int optname, const void *optval, socklen_ +@@ -3928,7 +3928,7 @@ lwip_setsockopt_impl(int s, int level, int optname, const void *optval, socklen_ return err; } @@ -339,7 +339,7 @@ index 7f13a7c..484d10a 100644 int lwip_ioctl(int s, long cmd, ...) { -@@ -3957,7 +3957,7 @@ lwip_ioctl(int s, long cmd, void *argp) +@@ -3963,7 +3963,7 @@ lwip_ioctl(int s, long cmd, void *argp) if (!sock) { return -1; } @@ -348,7 +348,7 @@ index 7f13a7c..484d10a 100644 switch (cmd) { #if LWIP_SO_RCVBUF || LWIP_FIONREAD_LINUXMODE -@@ -4101,7 +4101,7 @@ lwip_fcntl(int s, int cmd, int val) +@@ -4107,7 +4107,7 @@ lwip_fcntl(int s, int cmd, int val) break; default: LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_fcntl(%d, UNIMPL: %d, %d)\n", s, cmd, val)); @@ -357,7 +357,7 @@ index 7f13a7c..484d10a 100644 sock_set_errno(sock, 0); /* not yet implemented, but we return 0 for compatilbe with app */ ret = 0; #else -@@ -4369,7 +4369,7 @@ lwip_socket_drop_registered_mld6_memberships(int s) +@@ -4375,7 +4375,7 @@ lwip_socket_drop_registered_mld6_memberships(int s) } #endif /* LWIP_IPV6_MLD */ @@ -366,8 +366,8 @@ index 7f13a7c..484d10a 100644 void lwip_sock_init(void) { if (sockets_num == 0) { -@@ -4404,6 +4404,6 @@ int gettid(void) - return (int)g_stack_tid; +@@ -4400,6 +4400,6 @@ void lwip_exit(void) + return; } -#endif /* USE_LIBOS */ @@ -375,7 +375,7 @@ index 7f13a7c..484d10a 100644 #endif /* LWIP_SOCKET */ diff --git a/src/api/tcpip.c b/src/api/tcpip.c -index acb174e..53a38ab 100644 +index d3d0b55..fe7a7bd 100644 --- a/src/api/tcpip.c +++ b/src/api/tcpip.c @@ -123,13 +123,13 @@ again: @@ -480,7 +480,7 @@ index f1903e4..5a1a834 100644 while (tmp != NULL) { pbuf_ref(tmp); diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c -index d471b02..919d233 100644 +index c58ae25..402ba69 100644 --- a/src/core/ipv4/icmp.c +++ b/src/core/ipv4/icmp.c @@ -51,7 +51,7 @@ @@ -565,7 +565,7 @@ index 454ba32..fca1b0c 100644 #ifdef LWIP_HOOK_FILENAME #include LWIP_HOOK_FILENAME diff --git a/src/core/pbuf.c b/src/core/pbuf.c -index 7314ce9..65c6287 100644 +index ad75aa6..dd71519 100644 --- a/src/core/pbuf.c +++ b/src/core/pbuf.c @@ -83,7 +83,7 @@ @@ -595,8 +595,17 @@ index 7314ce9..65c6287 100644 if (p->next) rte_prefetch0(p->next); #endif +@@ -1027,7 +1027,7 @@ pbuf_copy_partial_pbuf(struct pbuf *p_to, const struct pbuf *p_from, u16_t copy_ + len_calc = p_to->len - offset_to; + } + +-#if USE_LIBOS && (CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW) ++#if GAZELLE_ENABLE && (CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW) + p_to->l2_len = p_from->l2_len; + p_to->l3_len = p_from->l3_len; + p_to->ol_flags = p_from->ol_flags; diff --git a/src/core/tcp.c b/src/core/tcp.c -index 324e2ee..88ceca7 100644 +index 3171c5e..69a39f6 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -183,7 +183,7 @@ PER_THREAD struct tcp_pcb *tcp_tw_pcbs; @@ -671,7 +680,7 @@ index 324e2ee..88ceca7 100644 TCP_PCB_REMOVE_ACTIVE_HASH(pcb); #endif TCP_PCB_REMOVE_ACTIVE(pcb); -@@ -760,7 +760,7 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) +@@ -761,7 +761,7 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) #endif /* LWIP_IPV6 && LWIP_IPV6_SCOPES */ if (port == 0) { @@ -680,7 +689,7 @@ index 324e2ee..88ceca7 100644 port = tcp_new_port(pcb); #else port = tcp_new_port(); -@@ -772,7 +772,7 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) +@@ -773,7 +773,7 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) /* Check if the address already is in use (on all lists) */ for (i = 0; i < max_pcb_list; i++) { for (cpcb = *tcp_pcb_lists[i]; cpcb != NULL; cpcb = cpcb->next) { @@ -689,7 +698,7 @@ index 324e2ee..88ceca7 100644 continue; #else if (cpcb->local_port == port) { -@@ -926,7 +926,7 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) +@@ -927,7 +927,7 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) goto done; } @@ -698,7 +707,7 @@ index 324e2ee..88ceca7 100644 struct tcp_pcb_listen *first_same_port_pcb = NULL; for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) { if ((lpcb->local_port == pcb->local_port) && -@@ -951,9 +951,9 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) +@@ -952,9 +952,9 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) } } } @@ -710,7 +719,7 @@ index 324e2ee..88ceca7 100644 vdev_reg_done(REG_RING_TCP_LISTEN, pcb); #endif -@@ -971,7 +971,7 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) +@@ -972,7 +972,7 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) lpcb->ttl = pcb->ttl; lpcb->tos = pcb->tos; @@ -719,7 +728,7 @@ index 324e2ee..88ceca7 100644 lpcb->connect_num = 0; lpcb->next_same_port_pcb = NULL; -@@ -991,7 +991,7 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) +@@ -992,7 +992,7 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) /* copy over ext_args to listening pcb */ memcpy(&lpcb->ext_args, &pcb->ext_args, sizeof(pcb->ext_args)); #endif @@ -728,7 +737,7 @@ index 324e2ee..88ceca7 100644 /* pcb transfer to lpcb and reg into tcp_listen_pcbs. freeing pcb shouldn't release sock table in here. * local_port=0 avoid to release sock table in tcp_free */ pcb->local_port = 0; -@@ -1005,7 +1005,7 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) +@@ -1006,7 +1006,7 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) tcp_backlog_set(lpcb, backlog); #endif /* TCP_LISTEN_BACKLOG */ @@ -737,7 +746,7 @@ index 324e2ee..88ceca7 100644 if (first_same_port_pcb != NULL) { TCP_REG_SAMEPORT((struct tcp_pcb_listen *)first_same_port_pcb, (struct tcp_pcb_listen *)lpcb); } else -@@ -1108,7 +1108,7 @@ tcp_recved(struct tcp_pcb *pcb, u16_t len) +@@ -1109,7 +1109,7 @@ tcp_recved(struct tcp_pcb *pcb, u16_t len) * * @return a new (free) local TCP port number */ @@ -746,7 +755,7 @@ index 324e2ee..88ceca7 100644 static u16_t tcp_new_port(struct tcp_pcb *pcb) #else -@@ -1127,7 +1127,7 @@ tcp_new_port(void) +@@ -1128,7 +1128,7 @@ tcp_new_port(void) } if (__atomic_load_n(&port_state[tcp_port - TCP_LOCAL_PORT_RANGE_START], __ATOMIC_ACQUIRE) == 0) { @@ -755,7 +764,7 @@ index 324e2ee..88ceca7 100644 if (port_in_stack_queue(pcb->remote_ip.addr, pcb->local_ip.addr, pcb->remote_port, tcp_port)) { tmp_port = tcp_port; __atomic_store_n(&port_state[tcp_port - TCP_LOCAL_PORT_RANGE_START], 1, __ATOMIC_RELEASE); -@@ -1230,7 +1230,7 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port, +@@ -1231,7 +1231,7 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port, old_local_port = pcb->local_port; if (pcb->local_port == 0) { @@ -764,7 +773,7 @@ index 324e2ee..88ceca7 100644 pcb->local_port = tcp_new_port(pcb); #else pcb->local_port = tcp_new_port(); -@@ -1288,7 +1288,7 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port, +@@ -1289,7 +1289,7 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port, /* Send a SYN together with the MSS option. */ ret = tcp_enqueue_flags(pcb, TCP_SYN); if (ret == ERR_OK) { @@ -773,7 +782,7 @@ index 324e2ee..88ceca7 100644 vdev_reg_done(REG_RING_TCP_CONNECT, pcb); #endif -@@ -1297,7 +1297,7 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port, +@@ -1298,7 +1298,7 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port, if (old_local_port != 0) { TCP_RMV(&tcp_bound_pcbs, pcb); } @@ -782,7 +791,7 @@ index 324e2ee..88ceca7 100644 TCP_REG_ACTIVE_HASH(pcb); #endif TCP_REG_ACTIVE(pcb); -@@ -1515,7 +1515,7 @@ tcp_slowtmr_start: +@@ -1516,7 +1516,7 @@ tcp_slowtmr_start: if (prev != NULL) { LWIP_ASSERT("tcp_slowtmr: middle tcp != tcp_active_pcbs", pcb != tcp_active_pcbs); prev->next = pcb->next; @@ -791,7 +800,7 @@ index 324e2ee..88ceca7 100644 if (pcb->next) pcb->next->prev = prev; //dont set next NULL, it will be used below -@@ -1525,14 +1525,14 @@ tcp_slowtmr_start: +@@ -1526,14 +1526,14 @@ tcp_slowtmr_start: /* This PCB was the first. */ LWIP_ASSERT("tcp_slowtmr: first pcb == tcp_active_pcbs", tcp_active_pcbs == pcb); tcp_active_pcbs = pcb->next; @@ -808,7 +817,7 @@ index 324e2ee..88ceca7 100644 TCP_RMV_ACTIVE_HASH(pcb); #endif -@@ -1545,7 +1545,7 @@ tcp_slowtmr_start: +@@ -1546,7 +1546,7 @@ tcp_slowtmr_start: last_state = pcb->state; pcb2 = pcb; pcb = pcb->next; @@ -817,7 +826,7 @@ index 324e2ee..88ceca7 100644 pcb2->next = NULL; #endif tcp_free(pcb2); -@@ -1599,7 +1599,7 @@ tcp_slowtmr_start: +@@ -1600,7 +1600,7 @@ tcp_slowtmr_start: if (prev != NULL) { LWIP_ASSERT("tcp_slowtmr: middle tcp != tcp_tw_pcbs", pcb != tcp_tw_pcbs); prev->next = pcb->next; @@ -826,7 +835,7 @@ index 324e2ee..88ceca7 100644 if (pcb->next) pcb->next->prev = prev; //dont set next NULL, it will be used below -@@ -1609,7 +1609,7 @@ tcp_slowtmr_start: +@@ -1610,7 +1610,7 @@ tcp_slowtmr_start: /* This PCB was the first. */ LWIP_ASSERT("tcp_slowtmr: first pcb == tcp_tw_pcbs", tcp_tw_pcbs == pcb); tcp_tw_pcbs = pcb->next; @@ -835,7 +844,7 @@ index 324e2ee..88ceca7 100644 if (pcb->next) pcb->next->prev = NULL; //dont set next NULL, it will be used below -@@ -1618,7 +1618,7 @@ tcp_slowtmr_start: +@@ -1619,7 +1619,7 @@ tcp_slowtmr_start: } pcb2 = pcb; pcb = pcb->next; @@ -844,7 +853,7 @@ index 324e2ee..88ceca7 100644 pcb2->next = NULL; #endif tcp_free(pcb2); -@@ -1789,7 +1789,7 @@ tcp_seg_free(struct tcp_seg *seg) +@@ -1790,7 +1790,7 @@ tcp_seg_free(struct tcp_seg *seg) seg->p = NULL; #endif /* TCP_DEBUG */ } @@ -853,7 +862,7 @@ index 324e2ee..88ceca7 100644 memp_free(MEMP_TCP_SEG, seg); #endif } -@@ -1827,7 +1827,7 @@ tcp_seg_copy(struct tcp_seg *seg) +@@ -1828,7 +1828,7 @@ tcp_seg_copy(struct tcp_seg *seg) LWIP_ASSERT("tcp_seg_copy: invalid seg", seg != NULL); @@ -862,7 +871,7 @@ index 324e2ee..88ceca7 100644 cseg = (struct tcp_seg *)((uint8_t *)seg->p + sizeof(struct pbuf_custom)); #else cseg = (struct tcp_seg *)memp_malloc(MEMP_TCP_SEG); -@@ -2367,7 +2367,7 @@ tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb) +@@ -2371,7 +2371,7 @@ tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb) #endif /* TCP_QUEUE_OOSEQ */ } @@ -871,7 +880,7 @@ index 324e2ee..88ceca7 100644 vdev_unreg_done(pcb); release_port(pcb->local_port); #endif -@@ -2379,13 +2379,13 @@ tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb) +@@ -2383,13 +2383,13 @@ tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb) LWIP_ASSERT("tcp_pcb_remove: tcp_pcbs_sane()", tcp_pcbs_sane()); } @@ -888,7 +897,7 @@ index 324e2ee..88ceca7 100644 /** * Calculates a new initial sequence number for new connections. diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c -index 8a2b153..dfd5ce7 100644 +index 9f5c34a..dd83260 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -58,13 +58,13 @@ @@ -1028,7 +1037,7 @@ index 8a2b153..dfd5ce7 100644 vdev_reg_done(REG_RING_TCP_CONNECT, npcb); #endif -@@ -1101,7 +1101,7 @@ tcp_process(struct tcp_pcb *pcb) +@@ -1102,7 +1102,7 @@ tcp_process(struct tcp_pcb *pcb) if (recv_flags & TF_GOT_FIN) { tcp_ack_now(pcb); pcb->state = CLOSE_WAIT; @@ -1037,7 +1046,7 @@ index 8a2b153..dfd5ce7 100644 API_EVENT(((struct netconn *)pcb->callback_arg), NETCONN_EVT_ERROR, 0); #endif } -@@ -1119,7 +1119,7 @@ tcp_process(struct tcp_pcb *pcb) +@@ -1120,7 +1120,7 @@ tcp_process(struct tcp_pcb *pcb) if (recv_flags & TF_GOT_FIN) { /* passive close */ tcp_ack_now(pcb); pcb->state = CLOSE_WAIT; @@ -1046,7 +1055,7 @@ index 8a2b153..dfd5ce7 100644 API_EVENT(((struct netconn *)pcb->callback_arg), NETCONN_EVT_ERROR, 0); #endif } -@@ -1133,7 +1133,7 @@ tcp_process(struct tcp_pcb *pcb) +@@ -1134,7 +1134,7 @@ tcp_process(struct tcp_pcb *pcb) ("TCP connection closed: FIN_WAIT_1 %"U16_F" -> %"U16_F".\n", inseg.tcphdr->src, inseg.tcphdr->dest)); tcp_ack_now(pcb); tcp_pcb_purge(pcb); @@ -1055,7 +1064,7 @@ index 8a2b153..dfd5ce7 100644 TCP_RMV_ACTIVE_HASH(pcb); #endif TCP_RMV_ACTIVE(pcb); -@@ -1154,7 +1154,7 @@ tcp_process(struct tcp_pcb *pcb) +@@ -1155,7 +1155,7 @@ tcp_process(struct tcp_pcb *pcb) LWIP_DEBUGF(TCP_DEBUG, ("TCP connection closed: FIN_WAIT_2 %"U16_F" -> %"U16_F".\n", inseg.tcphdr->src, inseg.tcphdr->dest)); tcp_ack_now(pcb); tcp_pcb_purge(pcb); @@ -1064,7 +1073,7 @@ index 8a2b153..dfd5ce7 100644 TCP_RMV_ACTIVE_HASH(pcb); #endif TCP_RMV_ACTIVE(pcb); -@@ -1167,7 +1167,7 @@ tcp_process(struct tcp_pcb *pcb) +@@ -1168,7 +1168,7 @@ tcp_process(struct tcp_pcb *pcb) if ((flags & TCP_ACK) && ackno == pcb->snd_nxt && pcb->unsent == NULL) { LWIP_DEBUGF(TCP_DEBUG, ("TCP connection closed: CLOSING %"U16_F" -> %"U16_F".\n", inseg.tcphdr->src, inseg.tcphdr->dest)); tcp_pcb_purge(pcb); @@ -1073,7 +1082,7 @@ index 8a2b153..dfd5ce7 100644 TCP_RMV_ACTIVE_HASH(pcb); #endif TCP_RMV_ACTIVE(pcb); -@@ -1376,7 +1376,7 @@ tcp_receive(struct tcp_pcb *pcb) +@@ -1377,7 +1377,7 @@ tcp_receive(struct tcp_pcb *pcb) if (pcb->lastack == ackno) { found_dataack = 1; ++pcb->dataacks; @@ -1082,7 +1091,7 @@ index 8a2b153..dfd5ce7 100644 if (tcp_rexmit(pcb) == ERR_OK) { pcb->rtime = 0; pcb->dataacks = 0; -@@ -1774,7 +1774,7 @@ tcp_receive(struct tcp_pcb *pcb) +@@ -1775,7 +1775,7 @@ tcp_receive(struct tcp_pcb *pcb) recv_flags |= TF_GOT_FIN; if (pcb->state == ESTABLISHED) { /* force passive close or we can move to active close */ pcb->state = CLOSE_WAIT; @@ -1092,7 +1101,7 @@ index 8a2b153..dfd5ce7 100644 #endif } diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c -index 9dee888..59afea5 100644 +index bf23381..1b3c5af 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -80,7 +80,7 @@ @@ -1272,7 +1281,7 @@ index 0542a32..2b80b0a 100644 #else /* LWIP_TIMERS && !LWIP_TIMERS_CUSTOM */ /* Satisfy the TCP code which calls this function */ diff --git a/src/include/arch/sys_arch.h b/src/include/arch/sys_arch.h -index 54eeff1..1cc5a9d 100644 +index fc4a9fd..04e3192 100644 --- a/src/include/arch/sys_arch.h +++ b/src/include/arch/sys_arch.h @@ -76,7 +76,7 @@ int sys_mbox_empty(struct sys_mbox *); @@ -1285,7 +1294,7 @@ index 54eeff1..1cc5a9d 100644 #include diff --git a/src/include/dpdk_cksum.h b/src/include/dpdk_cksum.h -index 7163196..da3ca04 100644 +index 83c9c38..df2e2a5 100644 --- a/src/include/dpdk_cksum.h +++ b/src/include/dpdk_cksum.h @@ -34,7 +34,7 @@ @@ -1294,10 +1303,10 @@ index 7163196..da3ca04 100644 #include "lwipopts.h" -#if USE_LIBOS +#if GAZELLE_ENABLE - #include #include -@@ -104,5 +104,5 @@ static inline u16_t ip_chksum_pseudo_offload(u8_t proto, u16_t proto_len, + #if CHECKSUM_OFFLOAD_ALL +@@ -103,5 +103,5 @@ static inline u16_t ip_chksum_pseudo_offload(u8_t proto, u16_t proto_len, } #endif /* CHECKSUM_GEN_TCP_HW */ @@ -1435,10 +1444,10 @@ index 64d8f31..1763836 100644 /** diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h -index b0bdb28..00e5565 100644 +index 718816b..0376f60 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h -@@ -3518,7 +3518,7 @@ +@@ -3525,7 +3525,7 @@ /** * EPOLL_DEBUG: Enable debugging in epoll.c. */ @@ -1447,7 +1456,7 @@ index b0bdb28..00e5565 100644 #define EPOLL_DEBUG LWIP_DBG_OFF #endif /** -@@ -3528,7 +3528,7 @@ +@@ -3535,7 +3535,7 @@ /** * ETHDEV_DEBUG: Enable debugging in ethdev.c. */ @@ -1456,7 +1465,7 @@ index b0bdb28..00e5565 100644 #define ETHDEV_DEBUG LWIP_DBG_OFF #endif /** -@@ -3538,7 +3538,7 @@ +@@ -3545,7 +3545,7 @@ /** * ETHDEV_DEBUG: Enable debugging in ethdev.c. */ @@ -1465,7 +1474,7 @@ index b0bdb28..00e5565 100644 #define SYSCALL_DEBUG LWIP_DBG_OFF #endif /** -@@ -3548,7 +3548,7 @@ +@@ -3555,7 +3555,7 @@ /** * CONTROL_DEBUG: Enable debugging in control_plane.c. */ @@ -1475,28 +1484,28 @@ index b0bdb28..00e5565 100644 #endif /** diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h -index ed641a3..4f5c8ef 100644 +index 1124408..a2e8e01 100644 --- a/src/include/lwip/pbuf.h +++ b/src/include/lwip/pbuf.h -@@ -219,7 +219,7 @@ struct pbuf { - +@@ -220,7 +220,7 @@ struct pbuf { /** For incoming packets, this contains the input netif's index */ u8_t if_idx; + -#if USE_LIBOS && CHECKSUM_OFFLOAD_ALL +#if GAZELLE_ENABLE && CHECKSUM_OFFLOAD_ALL /** checksum offload ol_flags */ u64_t ol_flags; /* < L2 (MAC) Header Length for non-tunneling pkt. */ -@@ -233,7 +233,7 @@ struct pbuf { +@@ -234,7 +234,7 @@ struct pbuf { u8_t in_write; u8_t head; struct pbuf *last; -#endif /* USE_LIBOS CHECKSUM_OFFLOAD_SWITCH */ +#endif /* GAZELLE_ENABLE CHECKSUM_OFFLOAD_SWITCH */ - }; - -@@ -283,7 +283,7 @@ void pbuf_free_ooseq(void); + /** In case the user needs to store data custom data on a pbuf */ + LWIP_PBUF_CUSTOM_DATA +@@ -287,7 +287,7 @@ void pbuf_free_ooseq(void); /* Initializes the pbuf module. This call is empty for now, but may not be in future. */ #define pbuf_init() @@ -1847,19 +1856,19 @@ index b451554..f7ffc5e 100644 #endif /* LWIP_TIMERS */ diff --git a/src/include/lwiplog.h b/src/include/lwiplog.h -index 6fccac8..d05cfc3 100644 +index 011ed21..f278ff4 100644 --- a/src/include/lwiplog.h +++ b/src/include/lwiplog.h -@@ -42,7 +42,7 @@ +@@ -41,7 +41,7 @@ - extern int gettid(void); + #include "lwipopts.h" -#if USE_DPDK_LOG +#if GAZELLE_USE_DPDK_LOG #define LWIP_LOG_WARN LWIP_DBG_LEVEL_WARNING #define LWIP_LOG_ERROR LWIP_DBG_LEVEL_SERIOUS -@@ -76,6 +76,6 @@ do { LWIP_PLATFORM_LOG(LWIP_LOG_FATAL, "Assertion \"%s\" failed at line %d in %s +@@ -75,6 +75,6 @@ do { LWIP_PLATFORM_LOG(LWIP_LOG_FATAL, "Assertion \"%s\" failed at line %d in %s #define LWIP_PLATFORM_LOG(debug, message) @@ -2186,10 +2195,10 @@ index be58ec3..9cc93bc 100644 #endif /* __LWIPOPTS_H__ */ diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h -index b6fd10a..e0a5edc 100644 +index a807e3e..f78c9cf 100644 --- a/src/include/lwipsock.h +++ b/src/include/lwipsock.h -@@ -60,7 +60,7 @@ union lwip_sock_lastdata { +@@ -59,7 +59,7 @@ union lwip_sock_lastdata { struct pbuf *pbuf; }; @@ -2198,7 +2207,7 @@ index b6fd10a..e0a5edc 100644 struct protocol_stack; struct wakeup_poll; struct rte_ring; -@@ -93,7 +93,7 @@ struct lwip_sock { +@@ -92,7 +92,7 @@ struct lwip_sock { #define LWIP_SOCK_FD_FREE_FREE 2 #endif @@ -2207,7 +2216,7 @@ index b6fd10a..e0a5edc 100644 char pad0 __rte_cache_aligned; /* app thread use */ struct pbuf *recv_lastdata; /* unread data in one pbuf */ -@@ -132,7 +132,7 @@ struct lwip_sock { +@@ -131,7 +131,7 @@ struct lwip_sock { * --------------- LIBNET references ---------------- * -------------------------------------------------- */ @@ -2216,7 +2225,7 @@ index b6fd10a..e0a5edc 100644 extern uint32_t sockets_num; extern struct lwip_sock *sockets; extern void gazelle_connected_callback(struct netconn *conn); -@@ -142,7 +142,7 @@ extern struct pbuf *write_lwip_data(struct lwip_sock *sock, uint16_t remain_size +@@ -141,7 +141,7 @@ extern struct pbuf *write_lwip_data(struct lwip_sock *sock, uint16_t remain_size extern void gazelle_init_sock(int32_t fd); extern void gazelle_clean_sock(int32_t fd); extern void write_lwip_over(struct lwip_sock *sock); diff --git a/0053-reduce-cpu-usage-when-send.patch b/0054-reduce-cpu-usage-when-send.patch similarity index 75% rename from 0053-reduce-cpu-usage-when-send.patch rename to 0054-reduce-cpu-usage-when-send.patch index 4420e7d..94f394f 100644 --- a/0053-reduce-cpu-usage-when-send.patch +++ b/0054-reduce-cpu-usage-when-send.patch @@ -1,6 +1,6 @@ -From 065ce96161dd13655befe0b300213213da9db777 Mon Sep 17 00:00:00 2001 +From d3d6f7fa6e755992fd4b75b56681b5e14aa8ba14 Mon Sep 17 00:00:00 2001 From: jiangheng12 -Date: Fri, 10 Mar 2023 20:31:26 +0800 +Date: Fri, 10 Mar 2023 19:32:48 +0800 Subject: [PATCH] reduce cpu usage when send --- @@ -8,7 +8,7 @@ Subject: [PATCH] reduce cpu usage when send 1 file changed, 2 insertions(+) diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h -index e0a5edc..399b701 100644 +index f78c9cf..810e98f 100644 --- a/src/include/lwipsock.h +++ b/src/include/lwipsock.h @@ -33,6 +33,7 @@ @@ -16,10 +16,10 @@ index e0a5edc..399b701 100644 #define __LWIPSOCK_H__ +#include - #include #include "lwip/opt.h" #include "lwip/api.h" -@@ -111,6 +112,7 @@ struct lwip_sock { + +@@ -110,6 +111,7 @@ struct lwip_sock { struct list_node send_list; struct pbuf *send_lastdata; struct pbuf *send_pre_del; diff --git a/0054-add-pbuf-lock-when-aggregate-pbuf.patch b/0055-add-pbuf-lock-when-aggregate-pbuf.patch similarity index 85% rename from 0054-add-pbuf-lock-when-aggregate-pbuf.patch rename to 0055-add-pbuf-lock-when-aggregate-pbuf.patch index 938ac45..7df6243 100644 --- a/0054-add-pbuf-lock-when-aggregate-pbuf.patch +++ b/0055-add-pbuf-lock-when-aggregate-pbuf.patch @@ -7,11 +7,12 @@ Subject: [PATCH] add pbuf lock when aggregate pbuf src/include/lwip/pbuf.h | 3 ++- src/include/lwipsock.h | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) + diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h -index 4f5c8ef..50d88af 100644 +index a2e8e01..8807a49 100644 --- a/src/include/lwip/pbuf.h +++ b/src/include/lwip/pbuf.h -@@ -230,9 +230,10 @@ struct pbuf { +@@ -231,9 +231,10 @@ struct pbuf { u64_t l4_len:8; u8_t header_off; u8_t rexmit; @@ -21,13 +22,13 @@ index 4f5c8ef..50d88af 100644 struct pbuf *last; + pthread_spinlock_t pbuf_lock; #endif /* GAZELLE_ENABLE CHECKSUM_OFFLOAD_SWITCH */ - }; + /** In case the user needs to store data custom data on a pbuf */ diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h -index 399b701..affb598 100644 +index 810e98f..7e16ec8 100644 --- a/src/include/lwipsock.h +++ b/src/include/lwipsock.h -@@ -105,11 +105,10 @@ struct lwip_sock { +@@ -104,11 +104,10 @@ struct lwip_sock { char pad1 __rte_cache_aligned; /* app and stack thread all use */ diff --git a/0055-fix-tso-small-packet-drop-in-kernel-server.patch b/0056-fix-tso-small-packet-drop-in-kernel-server.patch similarity index 100% rename from 0055-fix-tso-small-packet-drop-in-kernel-server.patch rename to 0056-fix-tso-small-packet-drop-in-kernel-server.patch diff --git a/0056-same-node-gazellectl-a.patch b/0057-same-node-gazellectl-a.patch similarity index 91% rename from 0056-same-node-gazellectl-a.patch rename to 0057-same-node-gazellectl-a.patch index ec015a5..0061f5d 100644 --- a/0056-same-node-gazellectl-a.patch +++ b/0057-same-node-gazellectl-a.patch @@ -1,6 +1,6 @@ -From 1e11d1ee2f26af10f73d779039d48e564b024234 Mon Sep 17 00:00:00 2001 -From: jiangheng -Date: Mon, 13 Mar 2023 19:08:56 +0800 +From 8a68ee510f5da20edf7fa06da701713ef10db930 Mon Sep 17 00:00:00 2001 +From: jiangheng12 +Date: Thu, 16 Mar 2023 19:59:26 +0800 Subject: [PATCH] same node & gazellectl -a --- @@ -11,13 +11,14 @@ Subject: [PATCH] same node & gazellectl -a src/core/tcp.c | 39 +++++++++++++++++++++++++++++++++++++++ src/core/tcp_in.c | 6 ++++++ src/core/tcp_out.c | 11 +++++++++++ - src/include/lwip/pbuf.h | 5 ++++- + src/include/lwip/pbuf.h | 3 +++ src/include/lwip/tcp.h | 10 ++++++++++ src/include/lwipopts.h | 7 +++++++ src/include/lwipsock.h | 37 +++++++++++++++++++++++++++++++++++++ - 11 files changed, 149 insertions(+), 4 deletions(-) + 11 files changed, 148 insertions(+), 3 deletions(-) + diff --git a/src/api/sockets.c b/src/api/sockets.c -index 484d10a..30e5745 100644 +index 356e345..7a5da26 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -605,6 +605,10 @@ alloc_socket(struct netconn *newconn, int accepted, int flags) @@ -93,10 +94,10 @@ index f15b798..e01ea51 100644 /* Add it to end of rambuf's chain, but using pbuf_cat, not pbuf_chain * so that it is removed when pbuf_dechain is later called on rambuf. diff --git a/src/core/netif.c b/src/core/netif.c -index 1a4ea1d..eda8bc0 100644 +index 70392cb..86b74a0 100644 --- a/src/core/netif.c +++ b/src/core/netif.c -@@ -1058,7 +1058,7 @@ netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_callb +@@ -1065,7 +1065,7 @@ netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_callb } #endif /* LWIP_NETIF_LINK_CALLBACK */ @@ -105,7 +106,7 @@ index 1a4ea1d..eda8bc0 100644 /** * @ingroup netif * Send an IP packet to be received on the same netif (loopif-like). -@@ -1166,6 +1166,7 @@ netif_loop_output(struct netif *netif, struct pbuf *p) +@@ -1184,6 +1184,7 @@ netif_loop_output(struct netif *netif, struct pbuf *p) return ERR_OK; } @@ -113,7 +114,7 @@ index 1a4ea1d..eda8bc0 100644 #if LWIP_HAVE_LOOPIF #if LWIP_IPV4 -@@ -1187,7 +1188,7 @@ netif_loop_output_ipv6(struct netif *netif, struct pbuf *p, const ip6_addr_t *ad +@@ -1205,7 +1206,7 @@ netif_loop_output_ipv6(struct netif *netif, struct pbuf *p, const ip6_addr_t *ad #endif /* LWIP_IPV6 */ #endif /* LWIP_HAVE_LOOPIF */ @@ -122,7 +123,7 @@ index 1a4ea1d..eda8bc0 100644 /** * Call netif_poll() in the main loop of your application. This is to prevent * reentering non-reentrant functions like tcp_input(). Packets passed to -@@ -1259,6 +1260,7 @@ netif_poll(struct netif *netif) +@@ -1277,6 +1278,7 @@ netif_poll(struct netif *netif) } SYS_ARCH_UNPROTECT(lev); } @@ -130,7 +131,7 @@ index 1a4ea1d..eda8bc0 100644 #if !LWIP_NETIF_LOOPBACK_MULTITHREADING /** -@@ -1274,7 +1276,6 @@ netif_poll_all(void) +@@ -1292,7 +1294,6 @@ netif_poll_all(void) } } #endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */ @@ -139,7 +140,7 @@ index 1a4ea1d..eda8bc0 100644 #if LWIP_NUM_NETIF_CLIENT_DATA > 0 /** diff --git a/src/core/pbuf.c b/src/core/pbuf.c -index 65c6287..6d8f247 100644 +index dd71519..2385e57 100644 --- a/src/core/pbuf.c +++ b/src/core/pbuf.c @@ -69,6 +69,7 @@ @@ -173,7 +174,7 @@ index 65c6287..6d8f247 100644 #endif /* LWIP_SUPPORT_CUSTOM_PBUF */ { diff --git a/src/core/tcp.c b/src/core/tcp.c -index 88ceca7..656d484 100644 +index 69a39f6..538a664 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -116,6 +116,8 @@ @@ -204,7 +205,7 @@ index 88ceca7..656d484 100644 vdev_unreg_done(pcb); release_port(pcb->local_port); #endif -@@ -995,6 +1009,15 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) +@@ -996,6 +1010,15 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err) /* pcb transfer to lpcb and reg into tcp_listen_pcbs. freeing pcb shouldn't release sock table in here. * local_port=0 avoid to release sock table in tcp_free */ pcb->local_port = 0; @@ -220,7 +221,7 @@ index 88ceca7..656d484 100644 #endif tcp_free(pcb); #if LWIP_CALLBACK_API -@@ -1261,6 +1284,16 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port, +@@ -1262,6 +1285,16 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port, #endif /* SO_REUSE */ } @@ -237,7 +238,7 @@ index 88ceca7..656d484 100644 iss = tcp_next_iss(pcb); pcb->rcv_nxt = 0; pcb->snd_nxt = iss; -@@ -2089,7 +2122,13 @@ tcp_alloc(u8_t prio) +@@ -2090,7 +2123,13 @@ tcp_alloc(u8_t prio) pcb->keep_intvl = TCP_KEEPINTVL_DEFAULT; pcb->keep_cnt = TCP_KEEPCNT_DEFAULT; #endif /* LWIP_TCP_KEEPALIVE */ @@ -252,7 +253,7 @@ index 88ceca7..656d484 100644 } diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c -index dfd5ce7..7a67a23 100644 +index dd83260..719cf04 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -42,6 +42,7 @@ @@ -276,7 +277,7 @@ index dfd5ce7..7a67a23 100644 /* Parse any options in the SYN. */ diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c -index 202a3aa..5b822d6 100644 +index 8100e18..b1c317d 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -725,6 +725,10 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags) @@ -319,18 +320,18 @@ index 202a3aa..5b822d6 100644 if (pcb == NULL || pcb->pcb_if == NULL) { diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h -index 50d88af..ecc51ce 100644 +index 6c4ca44..9321afc 100644 --- a/src/include/lwip/pbuf.h +++ b/src/include/lwip/pbuf.h -@@ -234,6 +234,7 @@ struct pbuf { +@@ -235,6 +235,7 @@ struct pbuf { u8_t head; struct pbuf *last; pthread_spinlock_t pbuf_lock; + struct tcp_pcb *pcb; #endif /* GAZELLE_ENABLE CHECKSUM_OFFLOAD_SWITCH */ - }; -@@ -259,7 +260,9 @@ struct pbuf_custom { + /** In case the user needs to store data custom data on a pbuf */ +@@ -263,7 +264,9 @@ struct pbuf_custom { /** The actual pbuf */ struct pbuf pbuf; /** This function is called when pbuf_free deallocates this pbuf(_custom) */ @@ -385,10 +386,10 @@ index 414ead4..0d2a6d9 100644 + #endif /* __LWIPOPTS_H__ */ diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h -index affb598..0ae5896 100644 +index 7e16ec8..f917d8a 100644 --- a/src/include/lwipsock.h +++ b/src/include/lwipsock.h -@@ -66,7 +66,19 @@ struct protocol_stack; +@@ -65,7 +65,19 @@ struct protocol_stack; struct wakeup_poll; struct rte_ring; #include @@ -408,7 +409,7 @@ index affb598..0ae5896 100644 /** Contains all internal pointers and states used for a socket */ struct lwip_sock { /** sockets currently are built on netconns, each socket has one netconn */ -@@ -121,9 +133,25 @@ struct lwip_sock { +@@ -120,9 +132,25 @@ struct lwip_sock { struct protocol_stack *stack; struct rte_ring *recv_ring; struct rte_ring *send_ring; @@ -434,7 +435,7 @@ index affb598..0ae5896 100644 #ifndef set_errno #define set_errno(err) do { if (err) { errno = (err); } } while(0) #endif -@@ -143,6 +171,15 @@ extern struct pbuf *write_lwip_data(struct lwip_sock *sock, uint16_t remain_size +@@ -142,6 +170,15 @@ extern struct pbuf *write_lwip_data(struct lwip_sock *sock, uint16_t remain_size extern void gazelle_init_sock(int32_t fd); extern void gazelle_clean_sock(int32_t fd); extern void write_lwip_over(struct lwip_sock *sock); @@ -451,5 +452,5 @@ index affb598..0ae5896 100644 struct lwip_sock *get_socket(int s); -- -2.33.0 +2.23.0 diff --git a/0057-lwip-send-recv-thread-bind-numa.patch b/0058-lwip-send-recv-thread-bind-numa.patch similarity index 60% rename from 0057-lwip-send-recv-thread-bind-numa.patch rename to 0058-lwip-send-recv-thread-bind-numa.patch index b74af23..070b327 100644 --- a/0057-lwip-send-recv-thread-bind-numa.patch +++ b/0058-lwip-send-recv-thread-bind-numa.patch @@ -1,17 +1,17 @@ -From c9160774740e802c678acaa9602400ea5c506304 Mon Sep 17 00:00:00 2001 -From: FanBin -Date: Tue, 21 Mar 2023 10:23:27 +0800 -Subject: [PATCH] lwip send/recv thread bind numa +From 0e16f4ec71b0794f48cb7b9e99712c36e40d4d48 Mon Sep 17 00:00:00 2001 +From: kircher +Date: Wed, 22 Mar 2023 15:16:04 +0800 +Subject: [PATCH] lwip-send-recv-thread-bind-numa --- src/include/lwipsock.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h -index 0ae5896..769644f 100644 +index f917d8a..f8480c5 100644 --- a/src/include/lwipsock.h +++ b/src/include/lwipsock.h -@@ -139,6 +139,7 @@ struct lwip_sock { +@@ -138,6 +138,7 @@ struct lwip_sock { const struct rte_memzone *same_node_rx_ring_mz; struct same_node_ring *same_node_tx_ring; const struct rte_memzone *same_node_tx_ring_mz; diff --git a/0058-fix-last_unsent-last_unacked.patch b/0059-fix-last_unsent-last_unacked.patch similarity index 100% rename from 0058-fix-last_unsent-last_unacked.patch rename to 0059-fix-last_unsent-last_unacked.patch diff --git a/0059-lwip-add-udp-multicast.patch b/0060-lwip-add-udp-multicast.patch similarity index 91% rename from 0059-lwip-add-udp-multicast.patch rename to 0060-lwip-add-udp-multicast.patch index 7b34418..94e4e30 100644 --- a/0059-lwip-add-udp-multicast.patch +++ b/0060-lwip-add-udp-multicast.patch @@ -1,7 +1,7 @@ -From df56c06ad1bab9d33a26fac4046265a202766693 Mon Sep 17 00:00:00 2001 +From d9ef907e03f44c30e26190b0c5ad895de716ac5c Mon Sep 17 00:00:00 2001 From: kircher -Date: Sat, 13 May 2023 14:56:33 +0800 -Subject: [PATCH] udp +Date: Fri, 12 May 2023 20:54:51 +0800 +Subject: [PATCH] add udp multicast in support --- src/api/api_msg.c | 5 +++++ @@ -16,7 +16,7 @@ Subject: [PATCH] udp 9 files changed, 78 insertions(+), 8 deletions(-) diff --git a/src/api/api_msg.c b/src/api/api_msg.c -index f059759..bc66eb5 100644 +index 1840c9d..0287c06 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -282,8 +282,13 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p, @@ -34,7 +34,7 @@ index f059759..bc66eb5 100644 } #endif /* LWIP_UDP */ diff --git a/src/api/sockets.c b/src/api/sockets.c -index 30e5745..706c892 100644 +index 7a5da26..a0f9d50 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -54,6 +54,7 @@ @@ -45,7 +45,7 @@ index 30e5745..706c892 100644 #if LWIP_CHECKSUM_ON_COPY #include "lwip/inet_chksum.h" #endif -@@ -1188,7 +1189,7 @@ lwip_recv_tcp_done: +@@ -1187,7 +1188,7 @@ lwip_recv_tcp_done: #endif /* Convert a netbuf's address data to struct sockaddr */ @@ -54,7 +54,7 @@ index 30e5745..706c892 100644 lwip_sock_make_addr(struct netconn *conn, ip_addr_t *fromaddr, u16_t port, struct sockaddr *from, socklen_t *fromlen) { -@@ -1275,6 +1276,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16 +@@ -1274,6 +1275,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16 apiflags = 0; } @@ -62,7 +62,7 @@ index 30e5745..706c892 100644 LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom_udp_raw[UDP/RAW]: top sock->lastdata=%p\n", (void *)sock->lastdata.netbuf)); /* Check if there is data left from the last recv operation. */ buf = sock->lastdata.netbuf; -@@ -1362,6 +1364,18 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16 +@@ -1361,6 +1363,18 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16 sock->lastdata.netbuf = NULL; netbuf_delete(buf); } @@ -81,7 +81,7 @@ index 30e5745..706c892 100644 if (datagram_len) { *datagram_len = buflen; } -@@ -1410,6 +1424,7 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags, +@@ -1409,6 +1423,7 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags, done_socket(sock); return -1; } @@ -89,7 +89,7 @@ index 30e5745..706c892 100644 ret = (ssize_t)LWIP_MIN(LWIP_MIN(len, datagram_len), SSIZE_MAX); if (fromlen) { *fromlen = msg.msg_namelen; -@@ -3950,6 +3965,10 @@ lwip_ioctl(int s, long cmd, ...) +@@ -3956,6 +3971,10 @@ lwip_ioctl(int s, long cmd, ...) struct lwip_sock *sock = posix_api->get_socket(s); u8_t val; @@ -113,7 +113,7 @@ index ebc01a5..57a9670 100644 $(eval $(call register_dir, core, $(SRC))) diff --git a/src/core/udp.c b/src/core/udp.c -index 238e5a4..3c04f7b 100644 +index a5f76b9..1398537 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -65,6 +65,12 @@ @@ -192,11 +192,11 @@ index 238e5a4..3c04f7b 100644 NETIF_RESET_HINTS(netif); diff --git a/src/include/dpdk_cksum.h b/src/include/dpdk_cksum.h -index da3ca04..b317811 100644 +index df2e2a5..e41644b 100644 --- a/src/include/dpdk_cksum.h +++ b/src/include/dpdk_cksum.h -@@ -83,6 +83,10 @@ static inline void tcph_cksum_set(struct pbuf *p, u16_t len) { - p->ol_flags |= PKT_TX_TCP_CKSUM; +@@ -82,6 +82,10 @@ static inline void tcph_cksum_set(struct pbuf *p, u16_t len) { + p->ol_flags |= RTE_MBUF_F_TX_TCP_CKSUM; } +static inline void udph_cksum_set(struct pbuf *p, u16_t len) { @@ -207,7 +207,7 @@ index da3ca04..b317811 100644 const ip_addr_t *src, const ip_addr_t *dst) { diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h -index 00e5565..34cd846 100644 +index 0376f60..38c6e9b 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -133,6 +133,7 @@ @@ -227,7 +227,7 @@ index 00e5565..34cd846 100644 #endif #if !LWIP_IPV4 #undef LWIP_IGMP -@@ -2025,7 +2026,7 @@ +@@ -2030,7 +2031,7 @@ * LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing. */ #if !defined LWIP_SO_RCVBUF || defined __DOXYGEN__ @@ -237,7 +237,7 @@ index 00e5565..34cd846 100644 /** diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h -index ecc51ce..dfbb74c 100644 +index 9321afc..fb21134 100644 --- a/src/include/lwip/pbuf.h +++ b/src/include/lwip/pbuf.h @@ -40,6 +40,8 @@ @@ -249,15 +249,15 @@ index ecc51ce..dfbb74c 100644 #ifdef __cplusplus extern "C" { -@@ -235,6 +237,8 @@ struct pbuf { +@@ -236,6 +238,8 @@ struct pbuf { struct pbuf *last; pthread_spinlock_t pbuf_lock; struct tcp_pcb *pcb; + ip_addr_t addr; + u16_t port; #endif /* GAZELLE_ENABLE CHECKSUM_OFFLOAD_SWITCH */ - }; + /** In case the user needs to store data custom data on a pbuf */ diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h index 58acf0f..36a47eb 100644 --- a/src/include/lwip/sockets.h diff --git a/0061-fix-pbuf-leak-in-udp-connection.patch b/0061-fix-pbuf-leak-in-udp-connection.patch new file mode 100644 index 0000000..a75e3fd --- /dev/null +++ b/0061-fix-pbuf-leak-in-udp-connection.patch @@ -0,0 +1,29 @@ +From 21f7f9a5bdfd5d2f592af19e73647a48fdbb7bf1 Mon Sep 17 00:00:00 2001 +From: kircher +Date: Tue, 16 May 2023 19:07:42 +0800 +Subject: [PATCH] fix pbuf leak in udp connection + +--- + src/core/udp.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/core/udp.c b/src/core/udp.c +index 1398537..9c3cdaa 100644 +--- a/src/core/udp.c ++++ b/src/core/udp.c +@@ -933,8 +933,11 @@ udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *d + /* @todo: must this be increased even if error occurred? */ + MIB2_STATS_INC(mib2.udpoutdatagrams); + ++#if !GAZELLE_ENABLE + /* did we chain a separate header pbuf earlier? */ +- if (q != p) { ++ if (q != p) ++#endif ++ { + /* free the header pbuf */ + pbuf_free(q); + q = NULL; +-- +2.33.0 + diff --git a/0062-drop-netbuf-in-recv_udp-to-fix-mem-overflow.patch b/0062-drop-netbuf-in-recv_udp-to-fix-mem-overflow.patch new file mode 100644 index 0000000..7022817 --- /dev/null +++ b/0062-drop-netbuf-in-recv_udp-to-fix-mem-overflow.patch @@ -0,0 +1,249 @@ +From 2e51934e230013c9df58971df53a08dad108becf Mon Sep 17 00:00:00 2001 +From: kircher +Date: Mon, 29 May 2023 19:58:52 +0800 +Subject: [PATCH] drop-netbuf-in-recv_udp-to-fix-mem-overflow + +--- + src/api/api_lib.c | 14 ++++++++++++++ + src/api/api_msg.c | 15 ++++++++++++--- + src/api/sockets.c | 6 +++--- + src/core/udp.c | 8 ++++++++ + src/include/lwip/api.h | 3 +++ + src/include/lwip/pbuf.h | 4 ++++ + src/include/lwip/sockets.h | 8 ++++---- + src/include/lwipopts.h | 4 ++++ + 8 files changed, 52 insertions(+), 10 deletions(-) + +diff --git a/src/api/api_lib.c b/src/api/api_lib.c +index ffa14d6..afdfc11 100644 +--- a/src/api/api_lib.c ++++ b/src/api/api_lib.c +@@ -655,7 +655,11 @@ netconn_recv_data(struct netconn *conn, void **new_buf, u8_t apiflags) + #if (LWIP_UDP || LWIP_RAW) + { + LWIP_ASSERT("buf != NULL", buf != NULL); ++#if GAZELLE_UDP_ENABLE ++ len = ((struct pbuf *)buf)->tot_len; ++#else /* GAZELLE_UDP_ENABLE */ + len = netbuf_len((struct netbuf *)buf); ++#endif /* GAZELLE_UDP_ENABLE */ + } + #endif /* (LWIP_UDP || LWIP_RAW) */ + +@@ -827,6 +831,16 @@ netconn_recv_udp_raw_netbuf(struct netconn *conn, struct netbuf **new_buf) + return netconn_recv_data(conn, (void **)new_buf, 0); + } + ++#if GAZELLE_UDP_ENABLE ++err_t ++netconn_recv_udp_raw_pbuf_flags(struct netconn *conn, struct pbuf **new_buf, u8_t apiflags) ++{ ++ LWIP_ERROR("netconn_recv_udp_raw_pbuf: invalid conn", (conn != NULL) && ++ NETCONNTYPE_GROUP(netconn_type(conn)) != NETCONN_TCP, return ERR_ARG;); ++ return netconn_recv_data(conn, (void **)new_buf, apiflags); ++} ++#endif /* GAZELLE_UDP_ENABLE */ ++ + /** + * Receive data (in form of a netbuf) from a UDP or RAW netconn + * +diff --git a/src/api/api_msg.c b/src/api/api_msg.c +index 30929be..b82ebf2 100644 +--- a/src/api/api_msg.c ++++ b/src/api/api_msg.c +@@ -253,6 +253,14 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p, + return; + } + ++#if GAZELLE_UDP_ENABLE ++ LWIP_UNUSED_ARG(buf); ++ ip_addr_set(&p->addr, addr); ++ p->port = port; ++ len = p->tot_len; ++ if (sys_mbox_trypost(&conn->recvmbox, p) != ERR_OK) { ++ return; ++#else /* GAZELLE_UDP_ENABLE */ + buf = (struct netbuf *)memp_malloc(MEMP_NETBUF); + if (buf == NULL) { + pbuf_free(p); +@@ -277,17 +285,18 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p, + if (sys_mbox_trypost(&conn->recvmbox, buf) != ERR_OK) { + netbuf_delete(buf); + return; ++#endif /* GAZELLE_UDP_ENABLE */ + } else { + #if LWIP_SO_RCVBUF + SYS_ARCH_INC(conn->recv_avail, len); + #endif /* LWIP_SO_RCVBUF */ +-#if GAZELLE_ENABLE ++#if GAZELLE_UDP_ENABLE + add_recv_list(conn->socket); + LWIP_UNUSED_ARG(len); +-#else ++#else /* GAZELLE_UDP_ENABLE */ + /* Register event with callback */ + API_EVENT(conn, NETCONN_EVT_RCVPLUS, len); +-#endif ++#endif /* GAZELLE_UDP_ENABLE */ + } + } + #endif /* LWIP_UDP */ +diff --git a/src/api/sockets.c b/src/api/sockets.c +index dee9230..17691f7 100644 +--- a/src/api/sockets.c ++++ b/src/api/sockets.c +@@ -1179,7 +1179,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16 + apiflags = 0; + } + +-#if !GAZELLE_ENABLE ++#if !GAZELLE_UDP_ENABLE + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom_udp_raw[UDP/RAW]: top sock->lastdata=%p\n", (void *)sock->lastdata.netbuf)); + /* Check if there is data left from the last recv operation. */ + buf = sock->lastdata.netbuf; +@@ -1267,7 +1267,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16 + sock->lastdata.netbuf = NULL; + netbuf_delete(buf); + } +-#else /* GAZELLE_ENABLE */ ++#else /* GAZELLE_UDP_ENABLE */ + LWIP_UNUSED_ARG(copylen); + LWIP_UNUSED_ARG(buf); + LWIP_UNUSED_ARG(err); +@@ -1278,7 +1278,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16 + return ERR_BUF; + } + +-#endif /* GAZELLE_ENABLE */ ++#endif /* GAZELLE_UDP_ENABLE */ + if (datagram_len) { + *datagram_len = buflen; + } +diff --git a/src/core/udp.c b/src/core/udp.c +index 170c911..1eb459d 100644 +--- a/src/core/udp.c ++++ b/src/core/udp.c +@@ -599,6 +599,7 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, + UDP_STATS_INC(udp.rterr); + return ERR_RTE; + } ++#if GAZELLE_UDP_ENABLE + uint8_t apiflags = 0; + + struct pbuf *udp_pbuf = write_lwip_data((struct lwip_sock *)(p->payload), p->tot_len, &apiflags); +@@ -611,14 +612,21 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, + } + + if (p->port) { ++#if LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP ++ return udp_sendto_if_chksum(pcb, p, &(p->addr), p->port, netif, have_chksum, chksum); ++#else /* LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */ + return udp_sendto_if(pcb, p, &(p->addr), p->port, netif); ++#endif /* LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */ + } else { ++#endif /* GAZELLE_UDP_ENABLE */ + #if LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP + return udp_sendto_if_chksum(pcb, p, dst_ip, dst_port, netif, have_chksum, chksum); + #else /* LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */ + return udp_sendto_if(pcb, p, dst_ip, dst_port, netif); + #endif /* LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */ ++#if GAZELLE_UDP_ENABLE + } ++#endif /* GAZELLE_UDP_ENABLE */ + } + + /** +diff --git a/src/include/lwip/api.h b/src/include/lwip/api.h +index d3c4f02..6090cab 100644 +--- a/src/include/lwip/api.h ++++ b/src/include/lwip/api.h +@@ -338,6 +338,9 @@ err_t netconn_accept(struct netconn *conn, struct netconn **new_conn); + err_t netconn_recv(struct netconn *conn, struct netbuf **new_buf); + err_t netconn_recv_udp_raw_netbuf(struct netconn *conn, struct netbuf **new_buf); + err_t netconn_recv_udp_raw_netbuf_flags(struct netconn *conn, struct netbuf **new_buf, u8_t apiflags); ++#if GAZELLE_UDP_ENABLE ++err_t netconn_recv_udp_raw_pbuf_flags(struct netconn *conn, struct pbuf **new_buf, u8_t apiflags); ++#endif /* GAZELLE_UDP_ENABLE */ + err_t netconn_recv_tcp_pbuf(struct netconn *conn, struct pbuf **new_buf); + err_t netconn_recv_tcp_pbuf_flags(struct netconn *conn, struct pbuf **new_buf, u8_t apiflags); + err_t netconn_tcp_recvd(struct netconn *conn, size_t len); +diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h +index 728c5e4..4747f39 100644 +--- a/src/include/lwip/pbuf.h ++++ b/src/include/lwip/pbuf.h +@@ -40,8 +40,10 @@ + + #include "lwip/opt.h" + #include "lwip/err.h" ++#if GAZELLE_UDP_ENABLE + #include "lwip/ip_addr.h" + #include "lwip/ip6_addr.h" ++#endif /* GAZELLE_UDP_ENABLE */ + + #ifdef __cplusplus + extern "C" { +@@ -238,8 +240,10 @@ struct pbuf { + struct pbuf *last; + pthread_spinlock_t pbuf_lock; + struct tcp_pcb *pcb; ++#if GAZELLE_UDP_ENABLE + ip_addr_t addr; + u16_t port; ++#endif /* GAZELLE_UDP_ENABLE */ + #endif /* GAZELLE_ENABLE CHECKSUM_OFFLOAD_SWITCH */ + + /** In case the user needs to store data custom data on a pbuf */ +diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h +index 643093a..2b6e6be 100644 +--- a/src/include/lwip/sockets.h ++++ b/src/include/lwip/sockets.h +@@ -330,7 +330,7 @@ struct linger { + + + #if LWIP_MULTICAST_TX_OPTIONS +-#if GAZELLE_ENABLE ++#if GAZELLE_UDP_ENABLE + #define IP_MULTICAST_IF 32 + #define IP_MULTICAST_TTL 33 + #define IP_MULTICAST_LOOP 34 +@@ -341,11 +341,11 @@ struct linger { + #define IP_MULTICAST_TTL 5 + #define IP_MULTICAST_IF 6 + #define IP_MULTICAST_LOOP 7 +-#endif /* GAZELLE_ENABLE */ ++#endif /* GAZELLE_UDP_ENABLE */ + #endif /* LWIP_MULTICAST_TX_OPTIONS */ + + #if LWIP_IGMP +-#if GAZELLE_ENABLE ++#if GAZELLE_UDP_ENABLE + #define IP_ADD_MEMBERSHIP 35 + #define IP_DROP_MEMBERSHIP 36 + #else +@@ -354,7 +354,7 @@ struct linger { + */ + #define IP_ADD_MEMBERSHIP 3 + #define IP_DROP_MEMBERSHIP 4 +-#endif /* GAZELLE_ENABLE */ ++#endif /* GAZELLE_UDP_ENABLE */ + + typedef struct ip_mreq { + struct in_addr imr_multiaddr; /* IP multicast address of group */ +diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h +index 6b5a2d1..9804aed 100644 +--- a/src/include/lwipopts.h ++++ b/src/include/lwipopts.h +@@ -63,6 +63,10 @@ + + #define GAZELLE_TCP_MIN_TSO_SEG_LEN 256 + ++ ++#define GAZELLE_UDP_ENABLE 1 ++ ++ + /* + ---------------------------------- + ---------- NIC offloads ---------- +-- +2.33.0 + diff --git a/0060-optimize-avoid-too-many-empty-acks-in-tcp_input.patch b/0063-optimize-avoid-too-many-empty-acks-in-tcp_input.patch similarity index 100% rename from 0060-optimize-avoid-too-many-empty-acks-in-tcp_input.patch rename to 0063-optimize-avoid-too-many-empty-acks-in-tcp_input.patch diff --git a/0064-fix-udp-send-recv-in-multiple-queue.patch b/0064-fix-udp-send-recv-in-multiple-queue.patch new file mode 100644 index 0000000..1b5139f --- /dev/null +++ b/0064-fix-udp-send-recv-in-multiple-queue.patch @@ -0,0 +1,169 @@ +From 71d82a830005540ef92b2bcd7c121c9ff85beb64 Mon Sep 17 00:00:00 2001 +From: j00660176 +Date: Mon, 12 Jun 2023 20:21:23 +0800 +Subject: [PATCH] fix udp send/recv in multiple queue + +--- + src/core/udp.c | 73 +++++++++++++++++++++++++++++++++++++++--- + src/include/lwip/udp.h | 4 +++ + 2 files changed, 73 insertions(+), 4 deletions(-) + +diff --git a/src/core/udp.c b/src/core/udp.c +index fba645b..0b1fa65 100644 +--- a/src/core/udp.c ++++ b/src/core/udp.c +@@ -65,10 +65,12 @@ + + #include + +-#if GAZELLE_ENABLE +-#include "lwipsock.h" ++#if GAZELLE_UDP_ENABLE ++#include + #include ++#include "lwipsock.h" + #include "dpdk_cksum.h" ++#include "reg_sock.h" + #endif + + #ifndef UDP_LOCAL_PORT_RANGE_START +@@ -81,10 +83,24 @@ + + /* last local UDP port */ + static u16_t udp_port = UDP_LOCAL_PORT_RANGE_START; ++#if GAZELLE_UDP_ENABLE ++static pthread_mutex_t g_udp_port_mutex = PTHREAD_MUTEX_INITIALIZER; ++static u8_t port_state[UDP_LOCAL_PORT_RANGE_END - UDP_LOCAL_PORT_RANGE_START + 1] = {0}; ++static void udp_release_port(u16_t port) ++{ ++ if (port >= UDP_LOCAL_PORT_RANGE_START && port <= UDP_LOCAL_PORT_RANGE_END) { ++ port_state[port - UDP_LOCAL_PORT_RANGE_START] = 0; ++ } ++} ++#endif + + /* The list of UDP PCBs */ + /* exported in udp.h (was static) */ ++#if GAZELLE_UDP_ENABLE ++PER_THREAD struct udp_pcb *udp_pcbs; ++#else + struct udp_pcb *udp_pcbs; ++#endif + + /** + * Initialize this module. +@@ -102,6 +118,37 @@ udp_init(void) + * + * @return a new (free) local UDP port number + */ ++#if GAZELLE_UDP_ENABLE ++static u16_t ++udp_new_port(struct udp_pcb *dst_pcb) ++{ ++ u16_t n = 0; ++ u16_t tmp_port = 0; ++ ++ pthread_mutex_lock(&g_udp_port_mutex); ++ do { ++ if (udp_port++ == UDP_LOCAL_PORT_RANGE_END) { ++ udp_port = UDP_LOCAL_PORT_RANGE_START; ++ } ++ ++ if (__atomic_load_n(&port_state[udp_port - UDP_LOCAL_PORT_RANGE_START], __ATOMIC_ACQUIRE) == 0) { ++ if (port_in_stack_queue(dst_pcb->remote_ip.addr, dst_pcb->local_ip.addr, dst_pcb->remote_port, udp_port)) { ++ tmp_port = udp_port; ++ __atomic_store_n(&port_state[udp_port - UDP_LOCAL_PORT_RANGE_START], 1, __ATOMIC_RELEASE); ++ break; ++ } ++ } ++ n++; ++ if (n > UDP_LOCAL_PORT_RANGE_END - UDP_LOCAL_PORT_RANGE_START) { ++ break; ++ } ++ } while (tmp_port == 0); ++ ++ pthread_mutex_unlock(&g_udp_port_mutex); ++ ++ return tmp_port; ++} ++#else + static u16_t + udp_new_port(void) + { +@@ -123,6 +170,7 @@ again: + } + return udp_port; + } ++#endif + + /** Common code to see if the current input packet matches the pcb + * (current input packet is accessed via ip(4/6)_current_* macros) +@@ -789,7 +837,21 @@ udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *d + /* if the PCB is not yet bound to a port, bind it here */ + if (pcb->local_port == 0) { + LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE, ("udp_send: not yet bound to a port, binding now\n")); ++#if GAZELLE_UDP_ENABLE ++ ip_addr_t tmp_local_ip = pcb->local_ip; ++ ip_addr_t tmp_remote_ip = pcb->remote_ip; ++ u16_t tmp_remote_port = pcb->remote_port; ++ ++ pcb->local_ip = netif->ip_addr; ++ pcb->remote_port = dst_port; ++ pcb->remote_ip = *dst_ip; ++#endif + err = udp_bind(pcb, &pcb->local_ip, pcb->local_port); ++#if GAZELLE_UDP_ENABLE ++ pcb->local_ip = tmp_local_ip; ++ pcb->remote_ip = tmp_remote_ip; ++ pcb->remote_port = tmp_remote_port; ++#endif + if (err != ERR_OK) { + LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, ("udp_send: forced port bind failed\n")); + return err; +@@ -941,7 +1003,7 @@ udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *d + /* @todo: must this be increased even if error occurred? */ + MIB2_STATS_INC(mib2.udpoutdatagrams); + +-#if !GAZELLE_ENABLE ++#if !GAZELLE_UDP_ENABLE + /* did we chain a separate header pbuf earlier? */ + if (q != p) + #endif +@@ -1026,7 +1088,7 @@ udp_bind(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) + + /* no port specified? */ + if (port == 0) { +- port = udp_new_port(); ++ port = udp_new_port(pcb); + if (port == 0) { + /* no more ports available in local range */ + LWIP_DEBUGF(UDP_DEBUG, ("udp_bind: out of free UDP ports\n")); +@@ -1252,6 +1314,9 @@ udp_remove(struct udp_pcb *pcb) + } + } + } ++#if GAZELLE_UDP_ENABLE ++ udp_release_port(pcb->local_port); ++#endif + memp_free(MEMP_UDP_PCB, pcb); + } + +diff --git a/src/include/lwip/udp.h b/src/include/lwip/udp.h +index b1c78e5..f588d90 100644 +--- a/src/include/lwip/udp.h ++++ b/src/include/lwip/udp.h +@@ -112,7 +112,11 @@ struct udp_pcb { + void *recv_arg; + }; + /* udp_pcbs export for external reference (e.g. SNMP agent) */ ++#if GAZELLE_UDP_ENABLE ++extern PER_THREAD struct udp_pcb *udp_pcbs; ++#else + extern struct udp_pcb *udp_pcbs; ++#endif + + /* The following functions is the application layer interface to the + UDP code. */ +-- +2.33.0 + diff --git a/0065-fix-udp-recvmbox-size-not-set.patch b/0065-fix-udp-recvmbox-size-not-set.patch new file mode 100644 index 0000000..e8e5663 --- /dev/null +++ b/0065-fix-udp-recvmbox-size-not-set.patch @@ -0,0 +1,24 @@ +From b94a7024bc7dc4984039b4f54aff3dbdcd21d8b8 Mon Sep 17 00:00:00 2001 +From: jiangheng12 +Date: Wed, 14 Jun 2023 18:34:12 +0800 +Subject: [PATCH] fix udp recvmbox size not set + +--- + src/include/lwipopts.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h +index 6b5c769..f0df0e3 100644 +--- a/src/include/lwipopts.h ++++ b/src/include/lwipopts.h +@@ -180,6 +180,7 @@ + --------------------------------- + */ + #define LWIP_UDP 1 ++#define DEFAULT_UDP_RECVMBOX_SIZE 4096 + + + /* +-- +2.23.0 + diff --git a/0066-adapt-to-dpdk-19.11-and-dpdk-21.11.patch b/0066-adapt-to-dpdk-19.11-and-dpdk-21.11.patch new file mode 100644 index 0000000..ebd81af --- /dev/null +++ b/0066-adapt-to-dpdk-19.11-and-dpdk-21.11.patch @@ -0,0 +1,144 @@ +From a8ca1b0361d5b31e437fd70d17860248dd44ddf7 Mon Sep 17 00:00:00 2001 +From: Lemmy Huang +Date: Thu, 15 Jun 2023 09:06:58 +0800 +Subject: [PATCH] adapt to dpdk-19.11 and dpdk-21.11 + +Signed-off-by: Lemmy Huang +--- + src/Makefile | 3 +++ + src/include/arch/sys_arch.h | 1 + + src/include/dpdk_cksum.h | 3 +++ + src/include/dpdk_version.h | 52 +++++++++++++++++++++++++++++++++++++ + src/include/eventpoll.h | 1 + + src/include/reg_sock.h | 2 ++ + 6 files changed, 62 insertions(+) + create mode 100644 src/include/dpdk_version.h + +diff --git a/src/Makefile b/src/Makefile +index f445601b..480470fb 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -19,6 +19,9 @@ ARFLAGS = crDP + ifeq ($(shell $(CC) -dumpmachine | cut -d"-" -f1), x86_64) + CFLAGS += -mssse3 + endif ++ifeq ($(DPDK_VERSION_1911), 1) ++ CFLAGS += -DDPDK_VERSION_1911=1 ++endif + + SRCS = + DIRS = api core netif +diff --git a/src/include/arch/sys_arch.h b/src/include/arch/sys_arch.h +index 04e3192a..5e95f3d3 100644 +--- a/src/include/arch/sys_arch.h ++++ b/src/include/arch/sys_arch.h +@@ -79,6 +79,7 @@ typedef struct sys_thread *sys_thread_t; + #if GAZELLE_ENABLE + extern int eth_dev_poll(void); + #include ++#include "dpdk_version.h" + + /* + gazelle custom rte ring interface +diff --git a/src/include/dpdk_cksum.h b/src/include/dpdk_cksum.h +index e41644b5..b48c9267 100644 +--- a/src/include/dpdk_cksum.h ++++ b/src/include/dpdk_cksum.h +@@ -34,8 +34,11 @@ + #define __DPDK_CKSUM_H__ + + #include "lwipopts.h" ++ + #if GAZELLE_ENABLE ++#include + #include ++#include "dpdk_version.h" + + #if CHECKSUM_OFFLOAD_ALL + #include +diff --git a/src/include/dpdk_version.h b/src/include/dpdk_version.h +new file mode 100644 +index 00000000..43b254a8 +--- /dev/null ++++ b/src/include/dpdk_version.h +@@ -0,0 +1,52 @@ ++/* ++ * Copyright (c) 2001-2004 Swedish Institute of Computer Science. ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without modification, ++ * are permitted provided that the following conditions are met: ++ * ++ * 1. Redistributions of source code must retain the above copyright notice, ++ * this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright notice, ++ * this list of conditions and the following disclaimer in the documentation ++ * and/or other materials provided with the distribution. ++ * 3. The name of the author may not be used to endorse or promote products ++ * derived from this software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED ++ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ++ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT ++ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT ++ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING ++ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY ++ * OF SUCH DAMAGE. ++ * ++ * This file is part of the lwIP TCP/IP stack. ++ * ++ * Author: Huawei Technologies ++ * ++ */ ++ ++#ifndef __DPDK_VERSION_H__ ++#define __DPDK_VERSION_H__ ++ ++#if DPDK_VERSION_1911 ++#define __rte_ring_enqueue_elems(r, prod_head, obj_table, esize, n) \ ++ ENQUEUE_PTRS(r, &r[1], prod_head, (obj_table), n, void *) ++ ++#define __rte_ring_dequeue_elems(r, cons_head, obj_table, esize, n) \ ++ DEQUEUE_PTRS(r, &r[1], cons_head, (obj_table), n, void *) ++ ++#define RTE_MBUF_F_RX_IP_CKSUM_BAD PKT_RX_IP_CKSUM_BAD ++#define RTE_MBUF_F_RX_L4_CKSUM_BAD PKT_RX_L4_CKSUM_BAD ++#define RTE_MBUF_F_TX_IPV4 PKT_TX_IPV4 ++#define RTE_MBUF_F_TX_IP_CKSUM PKT_TX_IP_CKSUM ++#define RTE_MBUF_F_TX_TCP_CKSUM PKT_TX_TCP_CKSUM ++#define RTE_MBUF_F_TX_TCP_SEG PKT_TX_TCP_SEG ++ ++#endif /* DPDK_VERSION_1911 */ ++ ++#endif /* __DPDK_VERSION_H__ */ +diff --git a/src/include/eventpoll.h b/src/include/eventpoll.h +index a10c84bf..dd65a4d5 100644 +--- a/src/include/eventpoll.h ++++ b/src/include/eventpoll.h +@@ -35,6 +35,7 @@ + + #include + ++#include "arch/sys_arch.h" + #include "lwip/api.h" + #include "list.h" + +diff --git a/src/include/reg_sock.h b/src/include/reg_sock.h +index e349e854..5d5710d7 100644 +--- a/src/include/reg_sock.h ++++ b/src/include/reg_sock.h +@@ -33,6 +33,8 @@ + #ifndef __REG_SOCK_H__ + #define __REG_SOCK_H__ + ++#include ++ + enum reg_ring_type { + REG_RING_TCP_LISTEN = 0, + REG_RING_TCP_LISTEN_CLOSE, +-- +2.22.0.windows.1 + diff --git a/backport-bug-54700-Unexpected-expiry-of-pending-ARP-table-ent.patch b/backport-bug-54700-Unexpected-expiry-of-pending-ARP-table-ent.patch deleted file mode 100644 index 0c80786..0000000 --- a/backport-bug-54700-Unexpected-expiry-of-pending-ARP-table-ent.patch +++ /dev/null @@ -1,34 +0,0 @@ -From ffbe075d5623c44bbf37618cce78d09ccd4e6760 Mon Sep 17 00:00:00 2001 -From: Florent Matignon -Date: Thu, 20 Sep 2018 16:40:34 +0200 -Subject: [PATCH] bug #54700: Unexpected expiry of pending ARP table entry -New etharp queries should restart the 5 second timeout on the ARP -table entry if it is still pending. -Signed-off-by: Simon Goldschmidt -Conflict: NA -Reference: https://git.savannah.gnu.org/cgit/lwip.git/commit/?id=ffbe075d5623c44bbf37618cce78d09ccd4e6760 ---- - src/core/ipv4/etharp.c | 8 ++++++++ - 1 file changed, 8 insertions(+) -diff --git a/src/core/ipv4/etharp.c b/src/core/ipv4/etharp.c -index 442aac0..c3a5a10 100644 ---- a/src/core/ipv4/etharp.c -+++ b/src/core/ipv4/etharp.c -@@ -983,6 +983,14 @@ etharp_query(struct netif *netif, const ip4_addr_t *ipaddr, struct pbuf *q) - /* We don't re-send arp request in etharp_tmr, but we still queue packets, - since this failure could be temporary, and the next packet calling - etharp_query again could lead to sending the queued packets. */ -+ } else { -+ /* ARP request successfully sent */ -+ if ((arp_table[i].state == ETHARP_STATE_PENDING) && !is_new_entry) { -+ /* A new ARP request has been sent for a pending entry. Reset the ctime to -+ not let it expire too fast. */ -+ LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: reset ctime for entry %"S16_F"\n", (s16_t)i)); -+ arp_table[i].ctime = 0; -+ } - } - if (q == NULL) { - return result; --- -1.8.3.1 - diff --git a/backport-tcp-Fix-double-free-in-tcp_split_unsent_seg.patch b/backport-tcp-Fix-double-free-in-tcp_split_unsent_seg.patch deleted file mode 100644 index 05addfe..0000000 --- a/backport-tcp-Fix-double-free-in-tcp_split_unsent_seg.patch +++ /dev/null @@ -1,24 +0,0 @@ -From e80d4ff2cc5f8f864e9e996c72b47ebefd2a5175 Mon Sep 17 00:00:00 2001 -From: Erik Ekman -Date: Fri, 19 Jun 2020 15:00:25 +0200 -Subject: [PATCH] tcp: Fix double free in tcp_split_unsent_seg() -Fixes bug #57377 (found by Hiromasa Ito). -Conflict: NA -Reference: https://git.savannah.gnu.org/cgit/lwip.git/commit/?id=e80d4ff2cc5f8f864e9e996c72b47ebefd2a5175 ---- - src/core/tcp_out.c | 1 + - 1 file changed, 1 insertion(+) -diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c -index bfb033b1..d9d1b57b 100644 ---- a/src/core/tcp_out.c -+++ b/src/core/tcp_out.c -@@ -913,6 +913,7 @@ tcp_split_unsent_seg(struct tcp_pcb *pcb, u16_t split) - - seg = tcp_create_segment(pcb, p, remainder_flags, lwip_ntohl(useg->tcphdr->seqno) + split, optflags); - if (seg == NULL) { -+ p = NULL; /* Freed by tcp_create_segment */ - LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_LEVEL_SERIOUS, - ("tcp_split_unsent_seg: could not create new TCP segment\n")); - goto memerr; --- -2.28.0.windows.1 diff --git a/lwip-2.1.2.zip b/lwip-2.1.2.zip deleted file mode 100644 index d728ab5..0000000 Binary files a/lwip-2.1.2.zip and /dev/null differ diff --git a/lwip-2.1.3.zip b/lwip-2.1.3.zip new file mode 100644 index 0000000..9f897f7 Binary files /dev/null and b/lwip-2.1.3.zip differ diff --git a/lwip.spec b/lwip.spec index 0aed7cc..51ea3fa 100644 --- a/lwip.spec +++ b/lwip.spec @@ -3,76 +3,81 @@ Summary: lwip is a small independent implementation of the TCP/IP protocol suite Name: lwip -Version: 2.1.2 -Release: 40 +Version: 2.1.3 +Release: 70 License: BSD URL: http://savannah.nongnu.org/projects/lwip/ Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip -Patch6001: backport-bug-54700-Unexpected-expiry-of-pending-ARP-table-ent.patch -Patch6002: backport-tcp-Fix-double-free-in-tcp_split_unsent_seg.patch -Patch6003: backport-tcp-fix-sequence-number-comparison.patch -Patch6004: backport-tcp-tighten-up-checks-for-received-SYN.patch +Patch6001: backport-tcp-fix-sequence-number-comparison.patch +Patch6002: backport-tcp-tighten-up-checks-for-received-SYN.patch -Patch9001: 0001-add-makefile.patch -Patch9002: 0002-adapt-lstack.patch -Patch9003: 0003-fix-the-occasional-coredump-when-the-lwip-exits.patch -Patch9004: 0004-fix-error-of-deleting-conn-table-in-connect.patch -Patch9005: 0005-syn-rcvd-state-reg-conn-into-conntable.patch -Patch9006: 0006-fix-coredump-in-etharp.patch -Patch9007: 0007-gazelle-fix-epoll_ctl-EPOLLET-mode-error.patch -Patch9008: 0008-gazelle-fix-lwip_accept-memcpy-sockaddr-large.patch -Patch9009: 0009-fix-stack-buffer-overflow-when-memcpy-addr.patch -Patch9010: 0010-fix-the-incomplete-release-of-the-conntable.patch -Patch9011: 0011-remove-gazelle-tcp-conn-func.patch -Patch9012: 0012-fix-incomplete-resource-release-in-lwip-close.patch -Patch9013: 0013-remove-gazelle-syscall-thread.patch -Patch9014: 0014-fix-some-compile-errors.patch -Patch9015: 0015-fix-tcp-port-alloc-issue.patch -Patch9016: 0016-lstack-support-mysql-mode.patch -Patch9017: 0017-support-REUSEPOR-option.patch -Patch9018: 0018-exec-gazelle_init_sock-before-read-event.patch -Patch9019: 0019-gazelle-reduce-copy-in-send.patch -Patch9020: 0020-remove-chose_dlsym_handle-function-set-handle-to-RTL.patch -Patch9021: 0021-refactor-event-if-ring-is-full-the-node-is-added-to-.patch -Patch9022: 0022-notify-app-that-sock-state-changes-to-CLOSE_WAIT.patch -Patch9023: 0023-refactor-event-and-checksum-offload-support.patch -Patch9024: 0024-refactor-pkt-read-send-performance.patch -Patch9025: 0025-del-redundant-wait_close-and-move-epoll_events-pos.patch -Patch9026: 0026-modify-EISCONN-condition.patch -Patch9027: 0027-per-thread-reassdata-variables.patch -Patch9028: 0028-fix-EISCONN-err-and-remove-same-customized-modificat.patch -Patch9029: 0029-refactor-tcp-new-port.patch -Patch9030: 0030-refactor-add-event-limit-send-pkts-num.patch -Patch9031: 0031-fix-free-pbuf-miss-data.patch -Patch9032: 0032-alloc-socket-fail-clean-sock.patch +Patch9000: 0001-add-makefile.patch +Patch9001: 0002-adapt-lstack.patch +Patch9002: 0003-fix-the-occasional-coredump-when-the-lwip-exits.patch +Patch9003: 0004-fix-error-of-deleting-conn-table-in-connect.patch +Patch9004: 0005-syn-rcvd-state-reg-conn-into-conntable.patch +Patch9005: 0006-fix-coredump-in-etharp.patch +Patch9006: 0007-gazelle-fix-epoll_ctl-EPOLLET-mode-error.patch +Patch9007: 0008-gazelle-fix-lwip_accept-memcpy-sockaddr-large.patch +Patch9008: 0009-fix-stack-buffer-overflow-when-memcpy-addr.patch +Patch9009: 0010-fix-the-incomplete-release-of-the-conntable.patch +Patch9010: 0011-remove-gazelle-tcp-conn-func.patch +Patch9011: 0012-fix-incomplete-resource-release-in-lwip-close.patch +Patch9012: 0013-remove-gazelle-syscall-thread.patch +Patch9013: 0014-fix-some-compile-errors.patch +Patch9014: 0015-fix-tcp-port-alloc-issue.patch +Patch9015: 0016-lstack-support-mysql-mode.patch +Patch9016: 0017-support-REUSEPOR-option.patch +Patch9017: 0018-exec-gazelle_init_sock-before-read-event.patch +Patch9018: 0019-gazelle-reduce-copy-in-send.patch +Patch9019: 0020-remove-chose_dlsym_handle-function-set-handle-to-RTL.patch +Patch9020: 0021-refactor-event-if-ring-is-full-the-node-is-added-to-.patch +Patch9021: 0022-notify-app-that-sock-state-changes-to-CLOSE_WAIT.patch +Patch9022: 0023-refactor-event-and-checksum-offload-support.patch +Patch9023: 0024-refactor-pkt-read-send-performance.patch +Patch9024: 0025-Replace-gettid-with-syscall-SYS_gettid.patch +Patch9025: 0026-del-redundant-wait_close-and-move-epoll_events-pos.patch +Patch9026: 0027-modify-EISCONN-condition.patch +Patch9027: 0028-per-thread-reassdata-variables.patch +Patch9028: 0029-fix-EISCONN-err-and-remove-same-customized-modificat.patch +Patch9029: 0030-refactor-tcp-new-port.patch +Patch9030: 0031-refactor-add-event-limit-send-pkts-num.patch +Patch9031: 0032-fix-free-pbuf-miss-data.patch +Patch9032: 0033-alloc-socket-fail-clean-sock.patch Patch9033: 0034-add-accept4-and-epoll_create1.patch Patch9034: 0035-add-writev-and-readv.patch -Patch9035: 0036-enable-ARP-QUEUE-to-avoid-sync-packet-dropped.patch -Patch9036: 0037-add-tso.patch -Patch9037: 0038-optimize-app-thread-write-buff-block.patch -Patch9038: 0039-add-huge-snd_buf.patch -Patch9039: 0040-optimite-pcb-list-limit-send-size-and-ack-now.patch -Patch9040: 0041-expand-recv-win.patch -Patch9041: 0042-add-prefetch.patch -Patch9042: 0043-skip-unnecessary-tcp_route.patch -Patch9043: 0044-add-variable-in-struct-sock.patch -Patch9044: 0045-add-dataack-when-recv-too-many-acks-with-data.patch -Patch9045: 0046-reduce-struct-pbuf-size.patch -Patch9046: 0047-listen-pcb-also-use-pcb_if.patch -Patch9047: 0048-expand-recv-mbox-size.patch -Patch9048: 0049-lwip-reuse-ip-port.patch -Patch9049: 0050-lwip-add-need_tso_send.patch -Patch9050: 0051-lwip_fnctl-only-support-F_SETFL-F_GETFL.patch -Patch9051: 0052-cleancode-improve-lwipopts.h-readability.patch -Patch9052: 0053-reduce-cpu-usage-when-send.patch -Patch9053: 0054-add-pbuf-lock-when-aggregate-pbuf.patch -Patch9054: 0055-fix-tso-small-packet-drop-in-kernel-server.patch -Patch9055: 0056-same-node-gazellectl-a.patch -Patch9056: 0057-lwip-send-recv-thread-bind-numa.patch -Patch9057: 0058-fix-last_unsent-last_unacked.patch -Patch9058: 0059-lwip-add-udp-multicast.patch -Patch9059: 0060-optimize-avoid-too-many-empty-acks-in-tcp_input.patch +Patch9035: 0036-add-fs-secure-compilation-option.patch +Patch9036: 0037-enable-ARP-QUEUE-to-avoid-sync-packet-dropped.patch +Patch9037: 0038-add-tso.patch +Patch9038: 0039-optimize-app-thread-write-buff-block.patch +Patch9039: 0040-add-huge-snd_buf.patch +Patch9040: 0041-optimite-pcb-list-limit-send-size-and-ack-now.patch +Patch9041: 0042-expand-recv-win.patch +Patch9042: 0043-add-prefetch.patch +Patch9043: 0044-skip-unnecessary-tcp_route.patch +Patch9044: 0045-add-variable-in-struct-sock.patch +Patch9045: 0046-add-dataack-when-recv-too-many-acks-with-data.patch +Patch9046: 0047-reduce-struct-pbuf-size.patch +Patch9047: 0048-listen-pcb-also-use-pcb_if.patch +Patch9048: 0049-expand-recv-mbox-size.patch +Patch9049: 0050-lwip-reuse-ip-port.patch +Patch9050: 0051-lwip-add-need_tso_send.patch +Patch9051: 0052-lwip_fnctl-only-support-F_SETFL-F_GETFL.patch +Patch9052: 0053-cleancode-improve-lwipopts.h-readability.patch +Patch9053: 0054-reduce-cpu-usage-when-send.patch +Patch9054: 0055-add-pbuf-lock-when-aggregate-pbuf.patch +Patch9055: 0056-fix-tso-small-packet-drop-in-kernel-server.patch +Patch9056: 0057-same-node-gazellectl-a.patch +Patch9057: 0058-lwip-send-recv-thread-bind-numa.patch +Patch9058: 0059-fix-last_unsent-last_unacked.patch +Patch9059: 0060-lwip-add-udp-multicast.patch +Patch9060: 0061-fix-pbuf-leak-in-udp-connection.patch +Patch9061: 0062-drop-netbuf-in-recv_udp-to-fix-mem-overflow.patch +Patch9062: 0063-optimize-avoid-too-many-empty-acks-in-tcp_input.patch +Patch9063: 0064-fix-udp-send-recv-in-multiple-queue.patch +Patch9064: 0065-fix-udp-recvmbox-size-not-set.patch +Patch9065: 0066-adapt-to-dpdk-19.11-and-dpdk-21.11.patch BuildRequires: gcc-c++ dos2unix dpdk-devel @@ -89,8 +94,7 @@ find %{_builddir}/%{name}-%{version} -type f -exec dos2unix -q {} \; %patch6001 -p1 %patch6002 -p1 -%patch6003 -p1 -%patch6004 -p1 +%patch9000 -p1 %patch9001 -p1 %patch9002 -p1 %patch9003 -p1 @@ -150,8 +154,15 @@ find %{_builddir}/%{name}-%{version} -type f -exec dos2unix -q {} \; %patch9057 -p1 %patch9058 -p1 %patch9059 -p1 +%patch9060 -p1 +%patch9061 -p1 +%patch9062 -p1 +%patch9063 -p1 +%patch9064 -p1 +%patch9065 -p1 %build +export DPDK_VERSION_1911=1 cd %{_builddir}/%{name}-%{version}/src %make_build @@ -165,127 +176,228 @@ cd %{_builddir}/%{name}-%{version}/src %{_libdir}/liblwip.a %changelog -* Sat Jun 10 2023 Lemmy Huang - 2.1.2-40 +* Thu Jun 15 2023 Lemmy Huang - 2.1.3-70 +- adapt to dpdk-19.11 and dpdk-21.11 + +* Wed Jun 14 2023 jiangheng - 2.1.3-69 +- fix udp recvmbox size not set + +* Wed Jun 14 2023 jiangheng - 2.1.3-68 +- fix udp send/recv in mutiple queue + +* Thu Jun 07 2023 Lemmy Huang - 2.1.3-67 - optimize: avoid too many empty acks in tcp_input -* Sat May 13 2023 kircher - 2.1.2-39 +* Tue Jun 06 2023 jiangheng - 2.1.3-66 +- revert cleancode series patches + +* Mon May 29 2023 kircher - 2.1.3-65 +- drop netbuf in recv_udp to fix mem overflow + +* Mon May 29 2023 Lemmy Huang - 2.1.3-64 +- cleancode: refactor memp + +* Mon May 29 2023 Lemmy Huang - 2.1.3-63 +- cleancode: refactor OFFLOAD_CHECKSUM GAZELLE_TCP_DATAACKS_REXMIT GAZELLE_TCP_NEW_PORT + +* Mon May 29 2023 Lemmy Huang - 2.1.3-62 +- fix spec patch9069 + +* Mon May 29 2023 Lemmy Huang - 2.1.3-61 +- cleancode: refactor sys_now and lwip_ioctl + +* Mon May 29 2023 Lemmy Huang - 2.1.3-60 +- cleancode: refactor GAZELLE_TCP_PCB_HASH + +* Mon May 29 2023 Lemmy Huang - 2.1.3-59 +- cleancode: refactor options define + +* Thu May 25 2023 Lemmy Huang - 2.1.3-58 +- cleancode: refactor gazelle_hlist.h + +* Thu May 25 2023 Lemmy Huang - 2.1.3-57 +- cleancode: refactor gazelle_list.h + +* Wed May 24 2023 Lemmy Huang - 2.1.3-56 +- cleancode: refactor gazelle_posix_api.h + +* Tue May 23 2023 Lemmy Huang - 2.1.3-55 +- cleancode: refactor lwipsock.h + +* Tue May 23 2023 Lemmy Huang - 2.1.3-54 +- cleancode: remove perf +- cleancode: rename gazelle files in lwip + +* Tue May 23 2023 Lemmy Huang - 2.1.3-53 +- cleancode: improving makefile readability + +* Mon May 16 2023 kircher - 2.1.3-52 +- fix pbuf leak in udp connection + +* Fri May 12 2023 kircher - 2.1.3-51 - add udp multicast support in lwip -* Sat Apr 01 2023 jiangheng - 2.1.2-38 +* Sat Apr 01 2023 jiangheng - 2.1.3-50 - fix last_unsent/last_unacked error - fix send failed due to pcb->nrtx > TCP_MAXRTX -* Tue Mar 21 2023 kircher - 2.1.2-37 -- lwip send/recv thread bind numa +* Wed Mar 22 2023 kircher - 2.1.3-49 +- lwip send recv thread bind numa -* Mon Mar 13 2023 jiangheng - 2.1.2-36 +* Mon Mar 13 2023 jiangheng - 2.1.3-48 - add same node ring & gazellectl -a -* Mon Mar 13 2023 jiangheng - 2.1.2-35 +* Mon Mar 13 2023 jiangheng - 2.1.3-47 - fix tso small packet drop in kernel server -* Mon Mar 13 2023 jiangheng - 2.1.2-34 -- add pbuf lock when aggregate pbuf +* Mon Mar 13 2023 jiangheng - 2.1.3-46 +- use pbuf lock when aggregate pbuf -* Fri Mar 10 2023 jiangheng - 2.1.2-33 +* Fri Mar 10 2023 jiangheng - 2.1.3-45 - reduce cpu usage when send -* Thu Mar 9 2023 Lemmy Huang - 2.1.2-32 +* Thu Mar 9 2023 Lemmy Huang - 2.1.3-44 - cleancode: improve lwipopts.h readability -* Tue Wed 22 2023 jiangheng - 2.1.2-31 +* Tue Wed 22 2023 jiangheng - 2.1.3-43 - lwip_fnctl only suport F_SETFL,F_GETFL, other opt return 0 for compitable -* Tue Feb 21 2023 majun - 2.1.2-30 +* Tue Feb 21 2023 majun - 2.1.3-42 - add lwip need_tso_send -* Tue Feb 14 2023 majun - 2.1.2-29 +* Tue Feb 14 2023 majun - 2.1.3-41 - add lwip reuse ip port -* Sat Feb 11 2023 majun - 2.1.2-28 +* Sat Feb 11 2023 majun - 2.1.3-40 - fix TSO snd_nxt incorrectly update -* Fri Dec 30 2022 wuchangsheng - 2.1.2-27 +* Fri Dec 30 2022 wuchangsheng - 2.1.3-39 - expand recv mbox size -* Wed Dec 21 2022 jiangheng - 2.1.2-26 -- move pcb_if to ip_pcb to let listen pcb use it +* Wed Dec 21 2022 jiangheng - 2.1.3-38 +- move pcb_if to ip_pcb to let listen pcb can use it -* Wed Dec 21 2022 wuchangsheng - 2.1.2-25 +* Wed Dec 21 2022 wuchangsheng - 2.1.3-37 - reduce struct pbuf size -* Wed Dec 21 2022 kircher - 2.1.2-24 +* Wed Dec 21 2022 kircher - 2.1.3-36 - do not update cwnd when send dataack -* Tue Dec 20 2022 kircher - 2.1.2-23 -- fix dataack is always lower than 256 +* Tue Dec 20 2022 kircher - 2.1.3-35 +- fix the dataack is always lower than 256 -* Tue Dec 20 2022 kircher - 2.1.2-22 +* Tue Dec 20 2022 kircher - 2.1.3-34 - add dataack when recv too many acks with data -* Tue Dec 20 2022 wuchangsheng - 2.1.2-21 +* Tue Dec 20 2022 wuchangsheng - 2.1.3-33 - add variable in struct sock -* Mon Dec 19 2022 kircher - 2.1.2-20 +* Mon Dec 19 2022 kircher - 2.1.3-32 - skip unnecessary tcp_route -* Sun Dec 18 2022 wuchangsheng - 2.1.2-19 -- expand rcv wnd size and prefetch +* Sun Dec 18 2022 wuchangsheng - 2.1.3-31 +- expand rcv wnd size and add prefetch -* Tue Dec 13 2022 wuchangsheng - 2.1.2-18 +* Tue Dec 13 2022 wuchangsheng - 2.1.3-30 - optimite pcb unsent and unacked list fast rexmit all pkts -* Wed Dec 7 2022 zhujunhao - 2.1.2-17 -- add huge snd buf +* Tue Dec 6 2022 zhujunhao - 2.1.3-29 +- add huge snd_buf -* Sat Dec 3 2022 wuchangsheng - 2.1.2-16 +* Sat Dec 3 2022 wuchangsheng - 2.1.3-28 - add tso define -* Wed Nov 23 2022 jiangheng - 2.1.2-15 +* Thu Dec 01 2022 jiangheng - 2.1.3-27 +- remove lwip-2.1.3.tar.gz + +* Sat Nov 26 2022 jiangheng - 2.1.3-26 +- replace lwip-2.1.3.tar.gz to lwip-2.1.3.zip + +* Wed Nov 23 2022 jiangheng - 2.1.3-25 - enable ARP QUEUE to avoid packet dropped -* Wed Oct 19 2022 zhujunhao - 2.1.2-14 +* Sat Oct 22 2022 jiangheng - 2.1.3-24 +- add fs secure compilation option + +* Wed Oct 19 2022 zhujunhao - 2.1.3-23 - add writev and readv -* Sat Oct 15 2022 zhujunhao - 2.1.2-13 +* Sat Oct 15 2022 zhujunhao - 2.1.3-22 - add epoll_create1 and accetp4 -* Tue Oct 11 2022 wuchangsheng - 2.1.2-12 +* Tue Oct 11 2022 wuchangsheng - 2.1.3-21 - alloc socket fail clean sock -* Thu Oct 6 2022 wuchangsheng - 2.1.2-11 +* Thu Oct 6 2022 wuchangsheng - 2.1.3-20 - fix miss data due to free pbuf close debug -* Thu Oct 6 2022 wuchangsheng - 2.1.2-10 +* Thu Oct 6 2022 wuchangsheng - 2.1.3-19 - refactor add event limit send pkts num max 10 -* Thu Oct 6 2022 wuchangsheng - 2.1.2-9 +* Thu Oct 6 2022 wuchangsheng - 2.1.3-18 - fix multithread duplicate port num support select appropriate port num to rss same as nic -* Thu Oct 6 2022 wuchangsheng - 2.1.2-8 +* Thu Oct 6 2022 wuchangsheng - 2.1.3-17 - fix EISCONN conditon err remove same customized modification -* Thu Oct 6 2022 wuchangsheng - 2.1.2-7 +* Thu Oct 6 2022 wuchangsheng - 2.1.3-16 - per thread reassdata variables -* Thu Sep 22 2022 zhujunhao - 2.1.2-6 +* Thu Oct 6 2022 wuchangsheng - 2.1.3-15 - modify EISCONN path condition - add in_send and send_flag value for gazelle + add in_send and send_flag value in sock -* Tue Jul 26 2022 wuchangsheng - 2.1.2-5 +* Tue Jul 26 2022 wuchangsheng - 2.1.3-14 - del redundant wait_close in lwip_sock move epoll_events into cache aligned area -* Fri Jul 8 2022 xiusailong - 2.1.2-4 -- refactor pkt read send performance +* Tue Jul 12 2022 Honggang Li - 2.1.3-13 +- Replace gettid() with syscall() -* Tue Jun 07 2022 xiusailong - 2.1.2-3 -- support gazelle feature +* Fri Jul 8 2022 xiusailong - 2.1.3-12 +- sync two patches from 20.03-LTS-SP1 + +* Thu Jul 7 2022 wuchangsheng - 2.1.3-11 +- refactor refactor pkt read send performance + +* Tue Mar 29 2022 jiangheng - 2.1.3-10 +- refactor event +- add HW checksum offload support + +* Tue Mar 15 2022 jiangheng - 2.1.3-9 +- notify app that sock state changes to CLOSE_WAIT + +* Tue Mar 15 2022 jiangheng - 2.1.3-8 +- refactor event,if ring is full, node is added to list + +* Mon Mar 07 2022 jiangheng - 2.1.3-7 +- remove chose_dlsym_handle function as it is redundant + +* Mon Mar 07 2022 wu-changsheng - 2.1.3-6 +- gazelle reduce copy in send + +* Mon Mar 07 2022 jiangheng - 2.1.3-5 +- exec gazelle_sock_init before read event + +* Thu Mar 03 2022 jiangheng - 2.1.3-4 +- support REUSEPOR option +- fix rpc msg too much +- fix recrruing events + +* Thu Feb 24 2022 jiangheng - 2.1.3-3 +- remove kernel socket interface +- support the mode that listen and accept thread be separaten + +* Fri Dec 31 2021 jiangheng - 2.1.3-2 +- adapt to lstack + +* Fri Nov 26 2021 jiangheng - 2.1.3-1 +- update to 2.1.3 * Mon Sep 06 2021 jiangheng - 2.1.2-2 - backport some patches from community