update README
fix some bugs
refactor pkt read send to improve performance
refactor kernle event toimproveperformance
(cherry picked from commit a8c66704608ca83c799adab88be6214bccdcfa44)
59 lines
2.0 KiB
Diff
59 lines
2.0 KiB
Diff
From 17fa541e456acccae61669fcc403b44e4aabb2d5 Mon Sep 17 00:00:00 2001
|
|
From: wuchangsheng <wuchangsheng2@huawei.com>
|
|
Date: Thu, 21 Apr 2022 16:59:44 +0800
|
|
Subject: [PATCH 08/18] add kernel path in epoll funcs
|
|
|
|
---
|
|
src/lstack/api/lstack_wrap.c | 21 ++++++++++++++++++---
|
|
1 file changed, 18 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
|
|
index 0164069..f623da3 100644
|
|
--- a/src/lstack/api/lstack_wrap.c
|
|
+++ b/src/lstack/api/lstack_wrap.c
|
|
@@ -77,6 +77,15 @@ static inline enum KERNEL_LWIP_PATH select_path(int fd)
|
|
|
|
static inline int32_t do_epoll_create(int32_t size)
|
|
{
|
|
+ if (posix_api == NULL) {
|
|
+ /* link liblstack.so using LD_PRELOAD mode will read liblstack.so,
|
|
+ poisx_api need to be initialized here */
|
|
+ if (posix_api_init() != 0) {
|
|
+ LSTACK_PRE_LOG(LSTACK_ERR, "posix_api_init failed\n");
|
|
+ }
|
|
+ return posix_api->epoll_create_fn(size);
|
|
+ }
|
|
+
|
|
if (unlikely(posix_api->is_chld)) {
|
|
return posix_api->epoll_create_fn(size);
|
|
}
|
|
@@ -90,16 +99,22 @@ static inline int32_t do_epoll_ctl(int32_t epfd, int32_t op, int32_t fd, struct
|
|
return posix_api->epoll_ctl_fn(epfd, op, fd, event);
|
|
}
|
|
|
|
+ struct lwip_sock *sock = get_socket_by_fd(epfd);
|
|
+ if (sock == NULL || sock->wakeup == NULL) {
|
|
+ return posix_api->epoll_ctl_fn(epfd, op, fd, event);
|
|
+ }
|
|
+
|
|
return lstack_epoll_ctl(epfd, op, fd, event);
|
|
}
|
|
|
|
static inline int32_t do_epoll_wait(int32_t epfd, struct epoll_event* events, int32_t maxevents, int32_t timeout)
|
|
{
|
|
- if (events == NULL || maxevents == 0) {
|
|
- GAZELLE_RETURN(EINVAL);
|
|
+ if (unlikely(posix_api->is_chld)) {
|
|
+ return posix_api->epoll_wait_fn(epfd, events, maxevents, timeout);
|
|
}
|
|
|
|
- if (unlikely(posix_api->is_chld)) {
|
|
+ struct lwip_sock *sock = get_socket_by_fd(epfd);
|
|
+ if (sock == NULL || sock->wakeup == NULL) {
|
|
return posix_api->epoll_wait_fn(epfd, events, maxevents, timeout);
|
|
}
|
|
|
|
--
|
|
2.23.0
|
|
|