1 Star 0 Fork 32

misaka00251/gazelle

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0170-add-rcv-nxt-dfx-info.patch 4.62 KB
一键复制 编辑 原始数据 按行查看 历史
吴昌盛 提交于 2022-12-22 23:40 . free-recv-pkts-bluks
From aab7dc09d29f1281d8843c67d56f9f69540f5801 Mon Sep 17 00:00:00 2001
From: wu-changsheng <wuchangsheng2@huawei.com>
Date: Thu, 22 Dec 2022 23:10:19 +0800
Subject: [PATCH 1/4] add-rcv-nxt-dfx-info
---
src/common/gazelle_dfx_msg.h | 1 +
src/lstack/core/lstack_lwip.c | 3 ++-
src/lstack/include/lstack_dpdk.h | 2 --
src/ltran/ltran_dfx.c | 9 +++++----
4 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
index 9225b53..674f2d7 100644
--- a/src/common/gazelle_dfx_msg.h
+++ b/src/common/gazelle_dfx_msg.h
@@ -164,6 +164,7 @@ struct gazelle_stat_lstack_conn_info {
uint32_t snd_buf;
uint32_t lastack;
uint32_t snd_nxt;
+ uint32_t rcv_nxt;
int32_t fd;
uint32_t events;
uint32_t epoll_events;
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index 018b6c6..bb6fe44 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -755,7 +755,7 @@ static void put_pbufs_into_recv_ring(struct lwip_sock *sock, struct pbuf *pbufs[
last_pbuf->last = new_pbuf->last;
gazelle_ring_lastover(last_pbuf);
- if (last_pbuf->tot_len > SOCK_READ_MAXLEN) {
+ if (last_pbuf->tot_len > TCP_WND) {
sock->read_wait = true;
}
}
@@ -1111,6 +1111,7 @@ static void copy_pcb_to_conn(struct gazelle_stat_lstack_conn_info *conn, const s
conn->snd_buf = pcb->snd_buf;
conn->lastack = pcb->lastack;
conn->snd_nxt = pcb->snd_nxt;
+ conn->rcv_nxt = pcb->rcv_nxt;
if (netconn != NULL && netconn->recvmbox != NULL) {
conn->recv_cnt = rte_ring_count(netconn->recvmbox->ring);
diff --git a/src/lstack/include/lstack_dpdk.h b/src/lstack/include/lstack_dpdk.h
index ac068b8..c3bc527 100644
--- a/src/lstack/include/lstack_dpdk.h
+++ b/src/lstack/include/lstack_dpdk.h
@@ -24,8 +24,6 @@
#define MAX_PACKET_SZ 2048
-#define SOCK_READ_MAXLEN 0x200000
-
#define RING_SIZE(x) ((x) - 1)
#define MBUF_SZ (MAX_PACKET_SZ + RTE_PKTMBUF_HEADROOM)
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
index 7dda51c..53d1b47 100644
--- a/src/ltran/ltran_dfx.c
+++ b/src/ltran/ltran_dfx.c
@@ -880,7 +880,8 @@ static void gazelle_print_lstack_stat_conn(void *buf, const struct gazelle_stat_
do {
printf("\n------ stack tid: %6u ------time=%lu\n", stat->tid, time.tv_sec * 1000000 + time.tv_usec);
printf("No. Proto lwip_recv recv_ring in_send send_ring cwn rcv_wnd snd_wnd snd_buf snd_nxt"
- " lastack events epoll_ev evlist fd Local Address Foreign Address State\n");
+ " lastack rcv_nxt events epoll_ev evlist fd Local Address "
+ "Foreign Address State\n");
uint32_t unread_pkts = 0;
uint32_t unsend_pkts = 0;
for (i = 0; i < conn->conn_num && i < GAZELLE_LSTACK_MAX_CONN; i++) {
@@ -889,16 +890,16 @@ static void gazelle_print_lstack_stat_conn(void *buf, const struct gazelle_stat_
rip.s_addr = conn_info->rip;
lip.s_addr = conn_info->lip;
if ((conn_info->state == GAZELLE_ACTIVE_LIST) || (conn_info->state == GAZELLE_TIME_WAIT_LIST)) {
- printf("%-6utcp %-10u%-10u%-8u%-10u%-9d%-9d%-10d%-10d%-15u%-15u%-10x%-10x%-7d%-7d"
+ printf("%-6utcp %-10u%-10u%-8u%-10u%-9d%-9d%-10d%-10d%-15u%-15u%-15u%-10x%-10x%-7d%-7d"
"%s:%hu %s:%hu %s\n", i, conn_info->recv_cnt, conn_info->recv_ring_cnt, conn_info->in_send,
conn_info->send_ring_cnt, conn_info->cwn, conn_info->rcv_wnd, conn_info->snd_wnd,
- conn_info->snd_buf, conn_info->snd_nxt, conn_info->lastack, conn_info->events,
+ conn_info->snd_buf, conn_info->snd_nxt, conn_info->lastack, conn_info->rcv_nxt, conn_info->events,
conn_info->epoll_events, conn_info->eventlist, conn_info->fd,
inet_ntop(AF_INET, &lip, str_ip, sizeof(str_ip)), conn_info->l_port,
inet_ntop(AF_INET, &rip, str_rip, sizeof(str_rip)), conn_info->r_port,
tcp_state_to_str(conn_info->tcp_sub_state));
} else if (conn_info->state == GAZELLE_LISTEN_LIST) {
- printf("%-6utcp %-57u%-7d%s:%hu 0.0.0.0:* LISTEN\n", i, conn_info->recv_cnt,
+ printf("%-6utcp %-147u%-7d%s:%hu 0.0.0.0:* LISTEN\n", i, conn_info->recv_cnt,
conn_info->fd, inet_ntop(AF_INET, &lip, str_ip, sizeof(str_ip)), conn_info->l_port);
} else {
printf("Got unknow tcp conn::%s:%5hu, state:%u\n",
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/misaka00251/gazelle.git
git@gitee.com:misaka00251/gazelle.git
misaka00251
gazelle
gazelle
master

搜索帮助