1 Star 0 Fork 32

Ren Zhijie/gazelle

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0115-add-socket-accept-fail-cnt.patch 2.07 KB
一键复制 编辑 原始数据 按行查看 历史
yinbin6 提交于 2024-01-20 14:40 . sync adpat dpdk 23.11
From 53457e3ab329eb944579ffe55ddc4435e0bca0a1 Mon Sep 17 00:00:00 2001
From: hantwofish <hankangkang5@huawei.com>
Date: Wed, 10 Jan 2024 09:12:34 +0800
Subject: [PATCH] add socket accept fail cnt
---
src/common/gazelle_dfx_msg.h | 1 +
src/lstack/core/lstack_protocol_stack.c | 2 ++
src/ltran/ltran_dfx.c | 1 +
3 files changed, 4 insertions(+)
diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
index 478c440..1d3249d 100644
--- a/src/common/gazelle_dfx_msg.h
+++ b/src/common/gazelle_dfx_msg.h
@@ -72,6 +72,7 @@ struct gazelle_stack_stat {
uint64_t tx_drop;
uint64_t tx;
uint64_t tx_prepare_fail;
+ uint64_t accept_fail;
};
struct gazelle_wakeup_stat {
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index f849bcd..0d845dd 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -792,9 +792,11 @@ void stack_accept(struct rpc_msg *msg)
{
int32_t fd = msg->args[MSG_ARG_0].i;
msg->result = -1;
+ struct protocol_stack *stack = get_protocol_stack();
int32_t accept_fd = lwip_accept4(fd, msg->args[MSG_ARG_1].p, msg->args[MSG_ARG_2].p, msg->args[MSG_ARG_3].i);
if (accept_fd < 0) {
+ stack->stats.accept_fail++;
LSTACK_LOG(ERR, LSTACK, "fd %d ret %d\n", fd, accept_fd);
return;
}
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
index 5e22e20..461912f 100644
--- a/src/ltran/ltran_dfx.c
+++ b/src/ltran/ltran_dfx.c
@@ -646,6 +646,7 @@ static void show_lstack_stats(struct gazelle_stack_dfx_data *lstack_stat)
printf("send_pkts_fail: %-13"PRIu64" ", lstack_stat->data.pkts.stack_stat.send_pkts_fail);
printf("mbuf_pool_freecnt: %-10"PRIu32" ", lstack_stat->data.pkts.mbufpool_avail_cnt);
printf("rpc_pool_freecnt: %-12"PRIu32" \n", lstack_stat->data.pkts.rpcpool_avail_cnt);
+ printf("accpet_fail: %-12"PRIu64" \n", lstack_stat->data.pkts.stack_stat.accept_fail);
}
static void gazelle_print_lstack_stat_detail(struct gazelle_stack_dfx_data *lstack_stat,
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/byterzj/gazelle.git
git@gitee.com:byterzj/gazelle.git
byterzj
gazelle
gazelle
master

搜索帮助