10 Star 4 Fork 33

src-openEuler/gazelle

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0055-add-gazelle-log.patch 4.05 KB
一键复制 编辑 原始数据 按行查看 历史
yinbin6 提交于 2023-11-29 15:01 . sync support vlan offload
From c136185db539fe2a7de58a4677b293f0c24f0e2a Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Mon, 20 Nov 2023 09:56:50 +0800
Subject: [PATCH] add gazelle log
---
src/lstack/api/lstack_epoll.c | 3 +++
src/lstack/core/lstack_protocol_stack.c | 12 +++++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c
index f2c4a8b..eacbe33 100644
--- a/src/lstack/api/lstack_epoll.c
+++ b/src/lstack/api/lstack_epoll.c
@@ -821,6 +821,7 @@ int32_t lstack_poll(struct pollfd *fds, nfds_t nfds, int32_t timeout)
if (wakeup == NULL) {
wakeup = calloc(1, sizeof(struct wakeup_poll));
if (wakeup == NULL) {
+ LSTACK_LOG(ERR, LSTACK, "calloc failed errno=%d\n", errno);
GAZELLE_RETURN(EINVAL);
}
@@ -938,10 +939,12 @@ static nfds_t fds_select2poll(int maxfd, fd_set *readfds, fd_set *writefds, fd_s
int lstack_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeval)
{
if (maxfd == 0) {
+ LSTACK_LOG(ERR, LSTACK, "select maxfd is zero\n");
return 0;
}
if (maxfd < 0 || maxfd > FD_SETSIZE || (readfds == NULL && writefds == NULL && exceptfds == NULL)) {
+ LSTACK_LOG(ERR, LSTACK, "select input param error, fd num=%d\n", maxfd);
GAZELLE_RETURN(EINVAL);
}
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index 74a17d4..aedf9c5 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -325,6 +325,7 @@ static int32_t init_stack_value(struct protocol_stack *stack, void *arg)
stack->epollfd = posix_api->epoll_create_fn(GAZELLE_LSTACK_MAX_CONN);
if (stack->epollfd < 0) {
+ LSTACK_LOG(ERR, LSTACK, "kernel epoll_create failed\n");
return -1;
}
@@ -349,10 +350,12 @@ static int32_t init_stack_value(struct protocol_stack *stack, void *arg)
}
if (pktmbuf_pool_init(stack, stack_group->stack_num) != 0) {
+ LSTACK_LOG(ERR, LSTACK, "pktmbuf_pool_init failed\n");
return -1;
}
if (create_shared_ring(stack) != 0) {
+ LSTACK_LOG(ERR, LSTACK, "create_shared_ring failed\n");
return -1;
}
@@ -583,6 +586,7 @@ int32_t stack_group_init(void)
if (get_global_cfg_params()->is_primary) {
if (stack_group_init_mempool() != 0) {
+ LSTACK_LOG(ERR, LSTACK, "stack group init mempool failed\n");
return -1;
}
}
@@ -789,7 +793,8 @@ void stack_getsockopt(struct rpc_msg *msg)
msg->result = lwip_getsockopt(msg->args[MSG_ARG_0].i, msg->args[MSG_ARG_1].i, msg->args[MSG_ARG_2].i,
msg->args[MSG_ARG_3].p, msg->args[MSG_ARG_4].p);
if (msg->result != 0) {
- LSTACK_LOG(ERR, LSTACK, "tid %ld, fd %d fail %ld\n", get_stack_tid(), msg->args[MSG_ARG_0].i, msg->result);
+ LSTACK_LOG(ERR, LSTACK, "tid %ld, fd %d, level %d, optname %d, fail %ld\n", get_stack_tid(),
+ msg->args[MSG_ARG_0].i, msg->args[MSG_ARG_1].i, msg->args[MSG_ARG_2].i, msg->result);
}
}
@@ -798,7 +803,8 @@ void stack_setsockopt(struct rpc_msg *msg)
msg->result = lwip_setsockopt(msg->args[MSG_ARG_0].i, msg->args[MSG_ARG_1].i, msg->args[MSG_ARG_2].i,
msg->args[MSG_ARG_3].cp, msg->args[MSG_ARG_4].socklen);
if (msg->result != 0) {
- LSTACK_LOG(ERR, LSTACK, "tid %ld, fd %d fail %ld\n", get_stack_tid(), msg->args[MSG_ARG_0].i, msg->result);
+ LSTACK_LOG(ERR, LSTACK, "tid %ld, fd %d, level %d, optname %d, fail %ld\n", get_stack_tid(),
+ msg->args[MSG_ARG_0].i, msg->args[MSG_ARG_1].i, msg->args[MSG_ARG_2].i, msg->result);
}
}
@@ -834,7 +840,7 @@ void stack_send(struct rpc_msg *msg)
struct lwip_sock *sock = get_socket(fd);
if (sock == NULL) {
msg->result = -1;
- LSTACK_LOG(ERR, LSTACK, "stack_send: sock error!\n");
+ LSTACK_LOG(ERR, LSTACK, "get sock error! fd=%d, len=%ld\n", fd, len);
rpc_msg_free(msg);
return;
}
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/gazelle.git
git@gitee.com:src-openeuler/gazelle.git
src-openeuler
gazelle
gazelle
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385