136 lines
6.0 KiB
Diff
136 lines
6.0 KiB
Diff
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
|
|
|