加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0165-LOG-modified-gazelle-log-level-and-add-item-in-mib2.patch 6.63 KB
一键复制 编辑 原始数据 按行查看 历史
From a04a281ad4eaf2e4a3a8a53504d836bbeed8fada Mon Sep 17 00:00:00 2001
From: yinbin <yinbin8@huawei.com>
Date: Wed, 18 Sep 2024 14:35:11 +0800
Subject: [PATCH] LOG: modified gazelle log level and add item in mib2
---
src/api/sockets.c | 2 +-
src/core/tcp.c | 12 ++++++++----
src/core/tcp_in.c | 12 ++++--------
src/include/lwip/stats.h | 8 ++++++++
4 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 3e64f66..3fc2192 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -2695,7 +2695,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
break;
case NETCONN_EVT_ERROR:
if ((conn->pending_err != ERR_OK) && (conn->pending_err != ERR_RST)) {
- LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, ("event_callback: have errevent, err=%d, fd=%d\n", conn->pending_err, conn->callback_arg.socket));
+ LWIP_DEBUGF(GAZELLE_DEBUG_WARNING, ("event_callback: have errevent, err=%d, fd=%d\n", conn->pending_err, conn->callback_arg.socket));
}
sock->errevent = 1;
#if GAZELLE_ENABLE
diff --git a/src/core/tcp.c b/src/core/tcp.c
index a35f19a..d499a51 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
@@ -1399,10 +1399,12 @@ tcp_slowtmr_start:
if (pcb->state == SYN_SENT && pcb->nrtx >= TCP_SYNMAXRTX) {
++pcb_remove;
- LWIP_DEBUGF(TCP_DEBUG | GAZELLE_DEBUG_SERIOUS, ("tcp_slowtmr: max SYN retries reached local_port=%u, remote_port=%u\n", pcb->local_port, pcb->remote_port));
+ LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: max SYN retries reached local_port=%u, remote_port=%u\n", pcb->local_port, pcb->remote_port));
+ MIB2_STATS_INC(mib2.tcpfreepcbinsynmaxrtx);
} else if (pcb->nrtx >= TCP_MAXRTX) {
++pcb_remove;
- LWIP_DEBUGF(TCP_DEBUG | GAZELLE_DEBUG_SERIOUS, ("tcp_slowtmr: max DATA retries reached local_port=%u, remote_port=%u\n", pcb->local_port, pcb->remote_port));
+ LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: max DATA retries reached local_port=%u, remote_port=%u\n", pcb->local_port, pcb->remote_port));
+ MIB2_STATS_INC(mib2.tcpfreepcbinmaxrtx);
} else {
if (pcb->persist_backoff > 0) {
LWIP_ASSERT("tcp_slowtimr: persist ticking with in-flight data", pcb->unacked == NULL);
@@ -1504,7 +1506,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 | GAZELLE_DEBUG_SERIOUS, ("tcp_slowtmr: KEEPALIVE timeout. Aborting connection to local_port=%u, remote_port=%u\n", pcb->local_port, pcb->remote_port));
+ LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: KEEPALIVE timeout. Aborting connection to local_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"));
@@ -1526,7 +1528,8 @@ 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_DEBUG | GAZELLE_DEBUG_SERIOUS, ("tcp_slowtmr: dropping OOSEQ queued data local_port=%u, remote_port=%u\n", pcb->local_port, pcb->remote_port));
+ LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: dropping OOSEQ queued data local_port=%u, remote_port=%u\n", pcb->local_port, pcb->remote_port));
+ MIB2_STATS_INC(mib2.tcpooseqdatadrop);
tcp_free_ooseq(pcb);
}
#endif /* TCP_QUEUE_OOSEQ */
@@ -1588,6 +1591,7 @@ tcp_slowtmr_start:
pcb->local_port, pcb->remote_port));
tcp_rst(pcb, pcb->snd_nxt, pcb->rcv_nxt, &pcb->local_ip, &pcb->remote_ip,
pcb->local_port, pcb->remote_port);
+ MIB2_STATS_INC(mib2.tcprstinkeepalivetimeout);
}
err_arg = pcb->callback_arg;
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 05c97d0..68b5e6e 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -594,7 +594,6 @@ tcp_input(struct pbuf *p, struct netif *inp)
pbuf_free(rest);
}
#endif /* TCP_QUEUE_OOSEQ && LWIP_WND_SCALE */
- LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, ("tcp_input: received data although already closed, send RST\n"));
tcp_abort(pcb);
goto aborted;
}
@@ -771,7 +770,8 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
SYN at a time when we have more memory available. */
if (npcb == NULL) {
err_t err;
- LWIP_DEBUGF(TCP_DEBUG | GAZELLE_DEBUG_SERIOUS, ("tcp_listen_input: could not allocate PCB\n"));
+ LWIP_DEBUGF(TCP_DEBUG, ("tcp_listen_input: could not allocate PCB\n"));
+ MIB2_STATS_INC(mib2.tcpallocpcbfails);
TCP_STATS_INC(tcp.memerr);
TCP_EVENT_ACCEPT(pcb, NULL, pcb->callback_arg, ERR_MEM, err);
LWIP_UNUSED_ARG(err); /* err not useful here */
@@ -879,11 +879,9 @@ tcp_timewait_input(struct tcp_pcb *pcb)
should be sent in reply */
if (TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt, pcb->rcv_nxt + pcb->rcv_wnd)) {
/* If the SYN is in the window it is an error, send a reset */
- LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS,
- ("tcp_timewait_input: SYN in TIME_WAIT, send RST, local_port=%d, remote_port=%d\n",
- tcphdr->dest, tcphdr->src));
tcp_rst(pcb, ackno, seqno + tcplen, ip_current_dest_addr(),
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
+ MIB2_STATS_INC(mib2.tcprstwrongsynintimewait);
return;
}
} else if (flags & TCP_FIN) {
@@ -1117,11 +1115,9 @@ tcp_process(struct tcp_pcb *pcb)
}
} else {
/* incorrect ACK number, send RST */
- LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS,
- ("tcp_process: incorrect ACK number in SYN_RCVD, send RST, ackno=%d, lastack=%d, snd_nxt=%d, local_port=%d, remote_port=%d\n",
- ackno, pcb->lastack, pcb->snd_nxt, tcphdr->dest, tcphdr->src));
tcp_rst(pcb, ackno, seqno + tcplen, ip_current_dest_addr(),
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
+ MIB2_STATS_INC(mib2.tcprstwrongackinsynrcvd);
}
}
break;
diff --git a/src/include/lwip/stats.h b/src/include/lwip/stats.h
index 6b3f18e..a83a442 100644
--- a/src/include/lwip/stats.h
+++ b/src/include/lwip/stats.h
@@ -166,6 +166,14 @@ struct stats_mib2 {
u32_t tcpacceptmboxfull;
u32_t tcplistendrops;
u32_t tcpinemptyacks;
+ /* GAZELLE TCP */
+ u32_t tcprstinkeepalivetimeout;
+ u32_t tcprstwrongsynintimewait;
+ u32_t tcprstwrongackinsynrcvd;
+ u32_t tcpooseqdatadrop;
+ u32_t tcpfreepcbinsynmaxrtx;
+ u32_t tcpfreepcbinmaxrtx;
+ u32_t tcpallocpcbfails;
/* UDP */
u32_t udpindatagrams;
--
2.34.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化