1 Star 0 Fork 48

flying-eagle/lwip

forked from src-openEuler/lwip 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0086-log-add-errevent-log-and-tcp-exception-statistics.patch 2.55 KB
一键复制 编辑 原始数据 按行查看 历史
From d7b0ffc7604075639f3eedbfe63fc0f12b87d23f Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/flying-eagle12138/lwip.git
git@gitee.com:flying-eagle12138/lwip.git
flying-eagle12138
lwip
lwip
master

搜索帮助