!578 [sync] PR-540: add tcp_slowtmr log
From: @openeuler-sync-bot Reviewed-by: @jiangheng12 Signed-off-by: @jiangheng12
This commit is contained in:
commit
5a9fd5d101
135
0084-add-tcpslowtmr-log-and-tcpfasttmr-cnt.patch
Normal file
135
0084-add-tcpslowtmr-log-and-tcpfasttmr-cnt.patch
Normal file
@ -0,0 +1,135 @@
|
||||
From d0edabb1ebfe0cc1f32e91834589b16b209dcfc9 Mon Sep 17 00:00:00 2001
|
||||
From: hantwofish <hankangkang5@huawei.com>
|
||||
Date: Tue, 28 Nov 2023 04:34:02 +0800
|
||||
Subject: [PATCH] add tcpslowtmr log and tcpfasttmr cnt
|
||||
|
||||
---
|
||||
src/core/tcp.c | 18 +++++++++++-------
|
||||
src/include/lwip/stats.h | 3 +++
|
||||
src/include/lwipopts.h | 3 +++
|
||||
3 files changed, 17 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/core/tcp.c b/src/core/tcp.c
|
||||
index 9f1e636..c1b64a3 100644
|
||||
--- a/src/core/tcp.c
|
||||
+++ b/src/core/tcp.c
|
||||
@@ -1393,16 +1393,17 @@ tcp_slowtmr_start:
|
||||
|
||||
if (pcb->state == SYN_SENT && pcb->nrtx >= TCP_SYNMAXRTX) {
|
||||
++pcb_remove;
|
||||
- LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: max SYN retries reached\n"));
|
||||
+ LWIP_DEBUGF(TCP_DEBUG | GAZELLE_DEBUG_SERIOUS, ("tcp_slowtmr: max SYN retries reached loac_port=%u, remote_port=%u\n", pcb->local_port, pcb->remote_port));
|
||||
} else if (pcb->nrtx >= TCP_MAXRTX) {
|
||||
++pcb_remove;
|
||||
- LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: max DATA retries reached\n"));
|
||||
+ LWIP_DEBUGF(TCP_DEBUG | GAZELLE_DEBUG_SERIOUS, ("tcp_slowtmr: max DATA retries reached loac_port=%u, remote_port=%u\n", pcb->local_port, pcb->remote_port));
|
||||
} else {
|
||||
if (pcb->persist_backoff > 0) {
|
||||
LWIP_ASSERT("tcp_slowtimr: persist ticking with in-flight data", pcb->unacked == NULL);
|
||||
LWIP_ASSERT("tcp_slowtimr: persist ticking with empty send buffer", pcb->unsent != NULL);
|
||||
if (pcb->persist_probe >= TCP_MAXRTX) {
|
||||
++pcb_remove; /* max probes reached */
|
||||
+ LWIP_DEBUGF(TCP_DEBUG | GAZELLE_DEBUG_SERIOUS, ("tcp_slowtmr: persist_probe is greater TCP_MAXRTX loac_port=%u, remote_port=%u\n", pcb->local_port, pcb->remote_port));
|
||||
} else {
|
||||
u8_t backoff_cnt = tcp_persist_backoff[pcb->persist_backoff - 1];
|
||||
if (pcb->persist_cnt < backoff_cnt) {
|
||||
@@ -1486,7 +1487,7 @@ tcp_slowtmr_start:
|
||||
if ((u32_t)(tcp_ticks - pcb->tmr) >
|
||||
TCP_FIN_WAIT_TIMEOUT / TCP_SLOW_INTERVAL) {
|
||||
++pcb_remove;
|
||||
- LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: removing pcb stuck in FIN-WAIT-2\n"));
|
||||
+ LWIP_DEBUGF(TCP_DEBUG | GAZELLE_DEBUG_SERIOUS, ("tcp_slowtmr: removing pcb stuck in FIN-WAIT-2 loac_port=%u, remote_port=%u\n", pcb->local_port, pcb->remote_port));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1497,7 +1498,7 @@ tcp_slowtmr_start:
|
||||
(pcb->state == CLOSE_WAIT))) {
|
||||
if ((u32_t)(tcp_ticks - pcb->tmr) >
|
||||
(pcb->keep_idle + TCP_KEEP_DUR(pcb)) / TCP_SLOW_INTERVAL) {
|
||||
- LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: KEEPALIVE timeout. Aborting connection to "));
|
||||
+ LWIP_DEBUGF(TCP_DEBUG | GAZELLE_DEBUG_SERIOUS, ("tcp_slowtmr: KEEPALIVE timeout. Aborting connection to loac_port=%u, remote_port=%u\n", pcb->local_port, pcb->remote_port));
|
||||
ip_addr_debug_print_val(TCP_DEBUG, pcb->remote_ip);
|
||||
LWIP_DEBUGF(TCP_DEBUG, ("\n"));
|
||||
|
||||
@@ -1519,7 +1520,7 @@ tcp_slowtmr_start:
|
||||
#if TCP_QUEUE_OOSEQ
|
||||
if (pcb->ooseq != NULL &&
|
||||
(tcp_ticks - pcb->tmr >= (u32_t)pcb->rto * TCP_OOSEQ_TIMEOUT)) {
|
||||
- LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_slowtmr: dropping OOSEQ queued data\n"));
|
||||
+ LWIP_DEBUGF(TCP_DEBUG | GAZELLE_DEBUG_SERIOUS, ("tcp_slowtmr: dropping OOSEQ queued data loac_port=%u, remote_port=%u\n", pcb->local_port, pcb->remote_port));
|
||||
tcp_free_ooseq(pcb);
|
||||
}
|
||||
#endif /* TCP_QUEUE_OOSEQ */
|
||||
@@ -1529,7 +1530,7 @@ tcp_slowtmr_start:
|
||||
if ((u32_t)(tcp_ticks - pcb->tmr) >
|
||||
TCP_SYN_RCVD_TIMEOUT / TCP_SLOW_INTERVAL) {
|
||||
++pcb_remove;
|
||||
- LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: removing pcb stuck in SYN-RCVD\n"));
|
||||
+ LWIP_DEBUGF(TCP_DEBUG | GAZELLE_DEBUG_SERIOUS, ("tcp_slowtmr: removing pcb stuck in SYN-RCVD loac_port=%u, remote_port=%u\n", pcb->local_port, pcb->remote_port));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1537,7 +1538,7 @@ tcp_slowtmr_start:
|
||||
if (pcb->state == LAST_ACK) {
|
||||
if ((u32_t)(tcp_ticks - pcb->tmr) > 2 * TCP_MSL / TCP_SLOW_INTERVAL) {
|
||||
++pcb_remove;
|
||||
- LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: removing pcb stuck in LAST-ACK\n"));
|
||||
+ LWIP_DEBUGF(TCP_DEBUG | GAZELLE_DEBUG_SERIOUS, ("tcp_slowtmr: removing pcb stuck in LAST-ACK loac_port=%u, remote_port=%u\n", pcb->local_port, pcb->remote_port));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1691,6 +1692,7 @@ tcp_fasttmr_start:
|
||||
/* send delayed ACKs */
|
||||
if (pcb->flags & TF_ACK_DELAY) {
|
||||
LWIP_DEBUGF(TCP_DEBUG, ("tcp_fasttmr: delayed ACK\n"));
|
||||
+ MIB2_STATS_INC(mib2.tcpdelayackcnt);
|
||||
tcp_ack_now(pcb);
|
||||
tcp_output(pcb);
|
||||
tcp_clear_flags(pcb, TF_ACK_DELAY | TF_ACK_NOW);
|
||||
@@ -1698,6 +1700,7 @@ tcp_fasttmr_start:
|
||||
/* send pending FIN */
|
||||
if (pcb->flags & TF_CLOSEPEND) {
|
||||
LWIP_DEBUGF(TCP_DEBUG, ("tcp_fasttmr: pending FIN\n"));
|
||||
+ MIB2_STATS_INC(mib2.tcpfinackcnt);
|
||||
tcp_clear_flags(pcb, TF_CLOSEPEND);
|
||||
tcp_close_shutdown_fin(pcb);
|
||||
}
|
||||
@@ -1707,6 +1710,7 @@ tcp_fasttmr_start:
|
||||
/* If there is data which was previously "refused" by upper layer */
|
||||
if (pcb->refused_data != NULL) {
|
||||
tcp_active_pcbs_changed = 0;
|
||||
+ MIB2_STATS_INC(mib2.tcpredusedcnt);
|
||||
tcp_process_refused_data(pcb);
|
||||
if (tcp_active_pcbs_changed) {
|
||||
/* application callback has changed the pcb list: restart the loop */
|
||||
diff --git a/src/include/lwip/stats.h b/src/include/lwip/stats.h
|
||||
index 4470531..5953a74 100644
|
||||
--- a/src/include/lwip/stats.h
|
||||
+++ b/src/include/lwip/stats.h
|
||||
@@ -150,6 +150,9 @@ struct stats_mib2 {
|
||||
u32_t tcpinsegs;
|
||||
u32_t tcpinerrs;
|
||||
u32_t tcpoutrsts;
|
||||
+ u32_t tcpfinackcnt;
|
||||
+ u32_t tcpdelayackcnt;
|
||||
+ u32_t tcpredusedcnt;
|
||||
|
||||
/* UDP */
|
||||
u32_t udpindatagrams;
|
||||
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
|
||||
index 06b3ae5..5fe647f 100644
|
||||
--- a/src/include/lwipopts.h
|
||||
+++ b/src/include/lwipopts.h
|
||||
@@ -269,6 +269,9 @@
|
||||
#define LWIP_DEBUG 1
|
||||
|
||||
#define GAZELLE_DEBUG LWIP_DBG_ON
|
||||
+#define GAZELLE_DEBUG_WARNING (LWIP_DBG_ON | LWIP_DBG_LEVEL_WARNING)
|
||||
+#define GAZELLE_DEBUG_SERIOUS (LWIP_DBG_ON | LWIP_DBG_LEVEL_SERIOUS)
|
||||
+#define GAZELLE_DEBUG_SEVERE (LWIP_DBG_ON | LWIP_DBG_LEVEL_SEVERE)
|
||||
|
||||
/*
|
||||
------------------------------------
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
Summary: lwip is a small independent implementation of the TCP/IP protocol suite
|
||||
Name: lwip
|
||||
Version: 2.1.3
|
||||
Release: 86
|
||||
Release: 87
|
||||
License: BSD
|
||||
URL: http://savannah.nongnu.org/projects/lwip/
|
||||
Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip
|
||||
@ -97,6 +97,7 @@ Patch9079: 0080-enable-ipv6.patch
|
||||
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
|
||||
|
||||
BuildRequires: gcc-c++ dos2unix dpdk-devel
|
||||
|
||||
@ -127,6 +128,9 @@ cd %{_builddir}/%{name}-%{version}/src
|
||||
%{_libdir}/liblwip.a
|
||||
|
||||
%changelog
|
||||
* Tue Nov 28 2023 hankangkang <hankangkang5@huawei.com> - 2.1.3-87
|
||||
- lwipopts: add tcpslowtmr log and tcpfasttmr cnt
|
||||
|
||||
* Mon Nov 27 2023 yangchen <yangchen145@huawei.com> - 2.1.3-86
|
||||
- lwipopts: add lwip debug log macro
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user