From ac2709bf441d85beb675650aa0bbf95ff106f262 Mon Sep 17 00:00:00 2001 From: jiangheng Date: Tue, 28 Nov 2023 16:40:23 +0800 Subject: [PATCH] log: add errevent log and tcp exception statistics --- ...ent-log-and-tcp-exception-statistics.patch | 77 +++++++++++++++++++ lwip.spec | 6 +- 2 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 0085-log-add-errevent-log-and-tcp-exception-statistics.patch diff --git a/0085-log-add-errevent-log-and-tcp-exception-statistics.patch b/0085-log-add-errevent-log-and-tcp-exception-statistics.patch new file mode 100644 index 0000000..17cba3b --- /dev/null +++ b/0085-log-add-errevent-log-and-tcp-exception-statistics.patch @@ -0,0 +1,77 @@ +From d7b0ffc7604075639f3eedbfe63fc0f12b87d23f Mon Sep 17 00:00:00 2001 +From: jiangheng +Date: Tue, 28 Nov 2023 16:34:16 +0800 +Subject: [PATCH] log: add errevent log and tcp exception statistics + +--- + src/api/api_msg.c | 1 + + src/api/sockets.c | 3 ++- + src/core/tcp_in.c | 2 ++ + src/include/lwip/stats.h | 3 +++ + 4 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/src/api/api_msg.c b/src/api/api_msg.c +index 8d98be6..531da40 100644 +--- a/src/api/api_msg.c ++++ b/src/api/api_msg.c +@@ -613,6 +613,7 @@ accept_function(void *arg, struct tcp_pcb *newpcb, err_t err) + sys_mbox_free(&newconn->recvmbox); + sys_mbox_set_invalid(&newconn->recvmbox); + netconn_free(newconn); ++ MIB2_STATS_INC(mib2.tcpacceptmboxfull); + return ERR_MEM; + } else { + /* Register event with callback */ +diff --git a/src/api/sockets.c b/src/api/sockets.c +index 62052f2..65c69d4 100644 +--- a/src/api/sockets.c ++++ b/src/api/sockets.c +@@ -2797,9 +2797,10 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len) + #endif + break; + case NETCONN_EVT_ERROR: ++ LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, ("event_callback: have errevent, err=%d\n", conn->pending_err)); + sock->errevent = 1; + #if GAZELLE_ENABLE +- if (netif_is_rtc_mode(netif_default)) { ++ if (netif_is_rtc_mode(netif_default)) { + add_sock_event_nolock(sock, EPOLLERR); + } else { + add_sock_event(sock, EPOLLERR); +diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c +index 1076f20..03b9942 100644 +--- a/src/core/tcp_in.c ++++ b/src/core/tcp_in.c +@@ -770,6 +770,7 @@ tcp_listen_input(struct tcp_pcb_listen *pcb) + #if TCP_LISTEN_BACKLOG + if (pcb->accepts_pending >= pcb->backlog) { + LWIP_DEBUGF(TCP_DEBUG, ("tcp_listen_input: listen backlog exceeded for port %"U16_F"\n", tcphdr->dest)); ++ MIB2_STATS_INC(mib2.tcplistendrops); + return; + } + #endif /* TCP_LISTEN_BACKLOG */ +@@ -1845,6 +1846,7 @@ tcp_receive(struct tcp_pcb *pcb) + + } else { + /* We get here if the incoming segment is out-of-sequence. */ ++ MIB2_STATS_INC(mib2.tcpoutofseq); + + #if TCP_QUEUE_OOSEQ + /* We queue the segment on the ->ooseq queue. */ +diff --git a/src/include/lwip/stats.h b/src/include/lwip/stats.h +index 5953a74..805836c 100644 +--- a/src/include/lwip/stats.h ++++ b/src/include/lwip/stats.h +@@ -153,6 +153,9 @@ struct stats_mib2 { + u32_t tcpfinackcnt; + u32_t tcpdelayackcnt; + u32_t tcpredusedcnt; ++ u32_t tcpoutofseq; ++ u32_t tcpacceptmboxfull; ++ u32_t tcplistendrops; + + /* UDP */ + u32_t udpindatagrams; +-- +2.27.0 + diff --git a/lwip.spec b/lwip.spec index b7020a1..39d7c61 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.3 -Release: 87 +Release: 88 License: BSD URL: http://savannah.nongnu.org/projects/lwip/ Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip @@ -98,6 +98,7 @@ Patch9080: 0081-ip6-hdr.patch Patch9081: 0082-add-vlanid-in-netif.patch Patch9082: 0083-lwipopts-add-lwip-debug-log-macro.patch Patch9083: 0084-add-tcpslowtmr-log-and-tcpfasttmr-cnt.patch +Patch9084: 0085-log-add-errevent-log-and-tcp-exception-statistics.patch BuildRequires: gcc-c++ dos2unix dpdk-devel @@ -128,6 +129,9 @@ cd %{_builddir}/%{name}-%{version}/src %{_libdir}/liblwip.a %changelog +* Tue Nov 28 2023 jiangheng - 2.1.3-88 +- log: add errevent log and tcp exception statistics + * Tue Nov 28 2023 hankangkang - 2.1.3-87 - lwipopts: add tcpslowtmr log and tcpfasttmr cnt -- Gitee