1 Star 0 Fork 96

sky/gazelle_kylin_src

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0141-fix-data-flow-error-when-use-NIC-in-kernel.patch 1.81 KB
一键复制 编辑 原始数据 按行查看 历史
compile_success 提交于 2023-12-04 02:54 . add select and timeout for kylin
From aab5985a79d6002b048e35db7376cdb0e3aa4a1d Mon Sep 17 00:00:00 2001
From: kircher <majun65@huawei.com>
Date: Wed, 16 Nov 2022 21:47:46 +0800
Subject: [PATCH] fix data flow error when use NIC in kernel
---
src/lstack/api/lstack_epoll.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c
index 8d5439b..19dd69a 100644
--- a/src/lstack/api/lstack_epoll.c
+++ b/src/lstack/api/lstack_epoll.c
@@ -456,8 +456,10 @@ int32_t lstack_epoll_wait(int32_t epfd, struct epoll_event* events, int32_t maxe
wakeup->stat.app_events += lwip_num;
if (__atomic_load_n(&wakeup->have_kernel_event, __ATOMIC_ACQUIRE)) {
- __atomic_store_n(&wakeup->have_kernel_event, false, __ATOMIC_RELEASE);
kernel_num = posix_api->epoll_wait_fn(epfd, &events[lwip_num], maxevents - lwip_num, 0);
+ if (!kernel_num) {
+ __atomic_store_n(&wakeup->have_kernel_event, false, __ATOMIC_RELEASE);
+ }
}
if (lwip_num + kernel_num > 0) {
@@ -657,12 +659,14 @@ int32_t lstack_poll(struct pollfd *fds, nfds_t nfds, int32_t timeout)
lwip_num = poll_lwip_event(fds, nfds);
if (__atomic_load_n(&wakeup->have_kernel_event, __ATOMIC_ACQUIRE)) {
- __atomic_store_n(&wakeup->have_kernel_event, false, __ATOMIC_RELEASE);
kernel_num = posix_api->epoll_wait_fn(wakeup->epollfd, wakeup->events, nfds, 0);
for (int32_t i = 0; i < kernel_num; i++) {
uint32_t index = wakeup->events[i].data.u32;
fds[index].revents = wakeup->events[i].events;
}
+ if (!kernel_num) {
+ __atomic_store_n(&wakeup->have_kernel_event, false, __ATOMIC_RELEASE);
+ }
}
if (lwip_num + kernel_num > 0) {
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/nlgwcy/gazelle_kylin_src.git
git@gitee.com:nlgwcy/gazelle_kylin_src.git
nlgwcy
gazelle_kylin_src
gazelle_kylin_src
master

搜索帮助