LOG: modified gazelle log level and add item in mib2

(cherry picked from commit 0e4a490bf1996cdffb51f59a8e45bf12e12d964a)
This commit is contained in:
yinbin 2024-09-18 14:40:28 +08:00 committed by openeuler-sync-bot
parent a21403778d
commit 648cc8428a
2 changed files with 146 additions and 1 deletions

View File

@ -0,0 +1,141 @@
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

View File

@ -4,7 +4,7 @@
Summary: lwip is a small independent implementation of the TCP/IP protocol suite
Name: lwip
Version: 2.2.0
Release: 54
Release: 55
License: BSD
URL: http://savannah.nongnu.org/projects/lwip/
Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip
@ -176,6 +176,7 @@ Patch9160: 0161-fix-the-definition-of-IPV6_V6ONLY.patch
Patch9161: 0162-check-if-mem_init-returns-errno.patch
Patch9162: 0163-LWIPOPTS-support-setsockopt-SO_SNDTIMEO.patch
Patch9163: 0164-LWIPOPTS-support-setsockopt-SO_SNDBUF.patch
Patch9164: 0165-LOG-modified-gazelle-log-level-and-add-item-in-mib2.patch
BuildRequires: gcc-c++ dos2unix dpdk-devel
@ -205,6 +206,9 @@ cd %{_builddir}/%{name}-%{version}/src
%{_libdir}/liblwip.a
%changelog
* Wed Sep 18 2024 yinbin <yinbin8@huawei.com> - 2.2.0-55
- LOG: modified gazelle log level and add item in mib2
* Tue Sep 10 2024 yinbin <yinbin8@huawei.com> - 2.2.0-54
- LWIPOPTS support setsockopt SO_SNDTIMEO
- LWIPOPTS support setsockopt SO_SNDBUF