diff --git a/0030-refactor-add-event-limit-send-pkts-num.patch b/0030-refactor-add-event-limit-send-pkts-num.patch new file mode 100644 index 0000000000000000000000000000000000000000..921315bc683b4476962ddea1e70ba6dbb29ba485 --- /dev/null +++ b/0030-refactor-add-event-limit-send-pkts-num.patch @@ -0,0 +1,71 @@ +From 0db924042e5d5750b81081634a8c261d631c9d89 Mon Sep 17 00:00:00 2001 +From: wuchangsheng +Date: Thu, 6 Oct 2022 20:23:20 +0800 +Subject: [PATCH] refactor add event, limit send pkts num + +--- + src/api/sockets.c | 4 ++-- + src/core/tcp_out.c | 8 ++++++++ + src/include/eventpoll.h | 3 ++- + 3 files changed, 12 insertions(+), 3 deletions(-) + +diff --git a/src/api/sockets.c b/src/api/sockets.c +index fe17c29..f84127c 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) + } + #if USE_LIBOS + if (conn->acceptmbox != NULL && !sys_mbox_empty(conn->acceptmbox)) { +- add_epoll_event(conn, POLLIN); ++ add_sock_event(sock, POLLIN); + } + #endif + break; +@@ -2680,7 +2680,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len) + case NETCONN_EVT_ERROR: + sock->errevent = 1; + #if USE_LIBOS +- add_epoll_event(conn, EPOLLERR); ++ add_sock_event(sock, EPOLLERR); + #endif + break; + default: +diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c +index 2d341b3..061af5f 100644 +--- a/src/core/tcp_out.c ++++ b/src/core/tcp_out.c +@@ -1358,8 +1358,16 @@ tcp_output(struct tcp_pcb *pcb) + for (; useg->next != NULL; useg = useg->next); + } + /* data available and window allows it to be sent? */ ++#if USE_LIBOS ++ /* avoid send cose too much time, limit send pkts num max 10 */ ++ uint16_t send_pkt = 0; ++ while (seg != NULL && send_pkt < 10 && ++ lwip_ntohl(seg->tcphdr->seqno) - pcb->lastack + seg->len <= wnd) { ++ send_pkt++; ++#else + while (seg != NULL && + lwip_ntohl(seg->tcphdr->seqno) - pcb->lastack + seg->len <= wnd) { ++#endif + LWIP_ASSERT("RST not expected here!", + (TCPH_FLAGS(seg->tcphdr) & TCP_RST) == 0); + /* Stop sending if the nagle algorithm would prevent it +diff --git a/src/include/eventpoll.h b/src/include/eventpoll.h +index aacc1d2..a10c84b 100644 +--- a/src/include/eventpoll.h ++++ b/src/include/eventpoll.h +@@ -63,7 +63,8 @@ struct libos_epoll { + int efd; /* eventfd */ + }; + +-extern void add_epoll_event(struct netconn*, uint32_t); ++struct lwip_sock; ++extern void add_sock_event(struct lwip_sock *sock, uint32_t event); + extern int32_t lstack_epoll_close(int32_t); + + #endif /* __EVENTPOLL_H__ */ +-- +2.27.0 + diff --git a/lwip.spec b/lwip.spec index 76e1abbe997fd2f1fd7979dc3410cc987503f53e..724879a925a0bbc0e2f15090652ef575e0b58cda 100644 --- a/lwip.spec +++ b/lwip.spec @@ -4,7 +4,7 @@ Summary: lwip is a small independent implementation of the TCP/IP protocol suite Name: lwip Version: 2.1.2 -Release: 9 +Release: 10 License: BSD URL: http://savannah.nongnu.org/projects/lwip/ Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip @@ -43,6 +43,7 @@ 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 BuildRequires: gcc-c++ dos2unix dpdk-devel @@ -90,6 +91,7 @@ find %{_builddir}/%{name}-%{version} -type f -exec dos2unix -q {} \; %patch9027 -p1 %patch9028 -p1 %patch9029 -p1 +%patch9030 -p1 %build cd %{_builddir}/%{name}-%{version}/src @@ -105,6 +107,10 @@ cd %{_builddir}/%{name}-%{version}/src %{_libdir}/liblwip.a %changelog +* Thu Oct 6 2022 wuchangsheng - 2.1.2-10 +- refactor add event + limit send pkts num max 10 + * Thu Oct 6 2022 wuchangsheng - 2.1.2-9 - fix multithread duplicate port num support select appropriate port num to rss same as nic