Compare commits

..

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
f9d12d3efd
!1152 [sync] PR-1140: sync update gazelle max numa nodes 8
From: @openeuler-sync-bot 
Reviewed-by: @compile_success 
Signed-off-by: @compile_success
2025-03-05 01:28:57 +00:00
yinbin
71fa5d085f sync update gazelle max numa nodes 8
(cherry picked from commit 26d5d01d849a92f24bac7fc68b38890f0193908e)
2025-03-04 21:11:25 +08:00
openeuler-ci-bot
4df56aade3
!1145 [sync] PR-1139: sync SIGNAL: block SIGSEGV during exit process
From: @openeuler-sync-bot 
Reviewed-by: @compile_success 
Signed-off-by: @compile_success
2025-03-04 13:10:22 +00:00
yinbin
2ad4d8b8db sync SIGNAL: block SIGSEGV during exit process
(cherry picked from commit 0997bc86367e1038eec8bbdc0ec0773b3a95c331)
2025-03-04 20:06:35 +08:00
openeuler-ci-bot
e4a1af38bb
!1136 [sync] PR-1131: sync DUMP: fix abnomal printing in the dump process.
From: @openeuler-sync-bot 
Reviewed-by: @jiangheng12 
Signed-off-by: @jiangheng12
2025-01-18 13:25:27 +00:00
yinbin
3960eb3399 sync DUMP: fix abnomal printing in the dump process.
(cherry picked from commit 8b299f18d5aa647bc82d60712ede06139c6b1bd7)
2025-01-17 19:53:26 +08:00
openeuler-ci-bot
4631e4f885
!1127 [sync] PR-1123: sync DUMP: fix build error of oe2003 because of micro is not defined.
Merge pull request !1127 from openeuler-sync-bot/sync-pr1123-master-to-openEuler-24.03-LTS
2024-12-19 07:16:44 +00:00
yinbin
4780c8d500 sync DUMP: fix build error of oe2003 because of micro is not defined.
(cherry picked from commit 9d1790502c1e67e1ffc0fae157c7d454070139dd)
2024-12-19 14:12:01 +08:00
openeuler-ci-bot
c49acccf99
!1119 [sync] PR-1115: sync kernerl bind: add ipv6 add check
From: @openeuler-sync-bot 
Reviewed-by: @jiangheng12, @compile_success 
Signed-off-by: @jiangheng12
2024-12-18 13:06:48 +00:00
yinbin
c2057605b8 sync Connect: execute lwip connect if dst_ip and host_ip are in the same network.
(cherry picked from commit 674a95ff9395859b5b14ede0ed1be07a0fa13ea4)
2024-12-18 19:05:13 +08:00
17 changed files with 1187 additions and 1 deletions

View File

@ -0,0 +1,65 @@
From 6dce1a0ac071e365cb96551b04f555dec3658d85 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Thu, 12 Dec 2024 16:39:48 +0800
Subject: [PATCH] fix a contention issue when rpc pools are added to
rpc_pool_array
---
src/lstack/core/lstack_thread_rpc.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/src/lstack/core/lstack_thread_rpc.c b/src/lstack/core/lstack_thread_rpc.c
index d342af4..050594e 100644
--- a/src/lstack/core/lstack_thread_rpc.c
+++ b/src/lstack/core/lstack_thread_rpc.c
@@ -31,7 +31,9 @@ struct rpc_pool_array {
int cur_count;
};
-static struct rpc_pool_array g_rpc_pool_array;
+static struct rpc_pool_array g_rpc_pool_array = {
+ .lock = PTHREAD_MUTEX_INITIALIZER,
+};
static PER_THREAD struct rpc_msg_pool *g_rpc_pool = NULL;
static struct rpc_stats g_rpc_stats;
@@ -41,13 +43,6 @@ struct rpc_stats *rpc_stats_get(void)
return &g_rpc_stats;
}
-static inline void rpc_pool_array_add(struct rpc_msg_pool *pool)
-{
- pthread_mutex_lock(&g_rpc_pool_array.lock);
- g_rpc_pool_array.array[g_rpc_pool_array.cur_count++] = pool;
- pthread_mutex_unlock(&g_rpc_pool_array.lock);
-}
-
__rte_always_inline
static struct rpc_msg *get_rpc_msg(struct rpc_msg_pool *rpc_pool)
{
@@ -73,7 +68,9 @@ static void rpc_msg_init(struct rpc_msg *msg, rpc_func_t func, struct rpc_msg_po
static struct rpc_msg_pool *rpc_msg_pool_init(void)
{
struct rpc_msg_pool *rpc_pool;
+ pthread_mutex_lock(&g_rpc_pool_array.lock);
if (g_rpc_pool_array.cur_count >= RPC_POOL_MAX_COUNT) {
+ pthread_mutex_unlock(&g_rpc_pool_array.lock);
return g_rpc_pool_array.array[rte_gettid() % RPC_POOL_MAX_COUNT];
}
@@ -90,9 +87,11 @@ static struct rpc_msg_pool *rpc_msg_pool_init(void)
goto END;
}
- rpc_pool_array_add(rpc_pool);
+ g_rpc_pool_array.array[g_rpc_pool_array.cur_count++] = rpc_pool;
+ pthread_mutex_unlock(&g_rpc_pool_array.lock);
return rpc_pool;
END:
+ pthread_mutex_unlock(&g_rpc_pool_array.lock);
g_rpc_stats.call_alloc_fail++;
return NULL;
}
--
2.33.0

View File

@ -0,0 +1,24 @@
From fd8004b7b7e78d08a7ad59a4561a3b539e806f06 Mon Sep 17 00:00:00 2001
From: hankangkang <hankangkang5@huawei.com>
Date: Thu, 12 Dec 2024 09:14:25 +0800
Subject: [PATCH] openGauss unsupport_tcp_optname
---
src/lstack/api/lstack_wrap.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
index 4416bd8..95e77b6 100644
--- a/src/lstack/api/lstack_wrap.c
+++ b/src/lstack/api/lstack_wrap.c
@@ -426,6 +426,7 @@ static bool unsupport_tcp_optname(int32_t optname)
if ((optname == TCP_QUICKACK) ||
(optname == TCP_INFO) ||
(optname == TCP_MAXSEG) ||
+ (optname == TCP_USER_TIMEOUT) ||
(optname == TCP_CONGESTION)) {
return true;
}
--
2.33.0

View File

@ -0,0 +1,48 @@
From bf5bf036eed0f7c15e7441c0c4ddbd5d7e48b3dd Mon Sep 17 00:00:00 2001
From: hankangkang <hankangkang5@huawei.com>
Date: Thu, 12 Dec 2024 11:40:09 +0800
Subject: [PATCH] kernerl bind: add ipv6 add check
---
src/lstack/api/lstack_wrap.c | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
index 4b57e60..05fa6ef 100644
--- a/src/lstack/api/lstack_wrap.c
+++ b/src/lstack/api/lstack_wrap.c
@@ -174,14 +174,25 @@ static int kernel_bind_process(int32_t s, const struct sockaddr *name, socklen_t
struct lwip_sock *sock = lwip_get_socket(s);
int times = 10;
int ret = 0;
+ bool share_ip = true;
+
+ /* lwip and kernel share IP, and exchange mbuf through virtual-NIC.
+ * lstack not sense if ltran enable kni, so only checks use_ltran. */
+
+ if (!get_global_cfg_params()->use_ltran && !get_global_cfg_params()->kni_switch &&
+ !get_global_cfg_params()->flow_bifurcation) {
+ share_ip = false;
+ }
ret = posix_api->bind_fn(s, name, namelen);
- /* maybe kni addr, ipv6 addr maybe is tentative,need to wait a few seconds */
- if (name->sa_family == AF_INET6 && ret < 0 && errno == EADDRNOTAVAIL) {
- LSTACK_LOG(WARNING, LSTACK, "virtio_user addr is tentative, please wait... \n");
- while (ret != 0 && times-- > 0) {
- sleep(1);
- ret = posix_api->bind_fn(s, name, namelen);
+ if (ret < 0 && errno == EADDRNOTAVAIL) {
+ /* ipv6 addr of virtual-NIC maybe is tentative, need to wait a few seconds */
+ if (name->sa_family == AF_INET6 && share_ip) {
+ LSTACK_LOG(WARNING, LSTACK, "virtio_user addr is tentative, please wait... \n");
+ while (ret != 0 && times-- > 0) {
+ sleep(1);
+ ret = posix_api->bind_fn(s, name, namelen);
+ }
}
}
--
2.33.0

View File

@ -0,0 +1,132 @@
From 434a2509c25f265adb5d7b9398cb3bf8e379b387 Mon Sep 17 00:00:00 2001
From: yinbin <yinbin8@huawei.com>
Date: Sat, 14 Dec 2024 16:55:18 +0800
Subject: [PATCH] Connect: execute lwip connect if dst_ip and host_ip are in
the same network.
---
src/lstack/api/lstack_wrap.c | 82 ++++++++++++++++++++++++++----------
1 file changed, 59 insertions(+), 23 deletions(-)
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
index 8077753..97e927a 100644
--- a/src/lstack/api/lstack_wrap.c
+++ b/src/lstack/api/lstack_wrap.c
@@ -256,7 +256,7 @@ static int32_t do_bind(int32_t s, const struct sockaddr *name, socklen_t namelen
return g_wrap_api->bind_fn(s, name, namelen);
}
-static bool kernel_ip_route(const struct sockaddr *addr)
+static bool kernel_ip_match(const struct sockaddr *addr)
{
struct ifaddrs *ifap;
struct ifaddrs *ifa;
@@ -298,7 +298,27 @@ static bool kernel_ip_route(const struct sockaddr *addr)
freeifaddrs(ifap);
return false;
}
-static bool is_relatived_kernel_ip(const struct sockaddr *dst_addr)
+
+static bool lwip_ip_route(const struct sockaddr *dst_addr)
+{
+ uint32_t host_ip;
+ uint32_t host_mask;
+ uint32_t dst_ip;
+
+ host_ip = get_global_cfg_params()->host_addr.addr;
+ host_mask = get_global_cfg_params()->netmask.addr;
+ if (dst_addr->sa_family == AF_INET) {
+ dst_ip = ((struct sockaddr_in *)dst_addr) ->sin_addr.s_addr;
+ /* if dst_addr and host_addr are in the same network, return ture. */
+ if ((host_ip & host_mask) == (dst_ip & host_mask)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+static bool kernel_ip_route(const struct sockaddr *dst_addr)
{
struct ifaddrs *ifap;
struct ifaddrs *ifa;
@@ -339,8 +359,34 @@ static bool is_relatived_kernel_ip(const struct sockaddr *dst_addr)
freeifaddrs(ifap);
return ret;
}
+
+static bool should_enter_kernel_connect(const struct sockaddr *addr)
+{
+ int32_t remote_port;
+ char listen_ring_name[RING_NAME_LEN];
+
+ remote_port = htons(((struct sockaddr_in *)addr)->sin_port);
+ snprintf_s(listen_ring_name, sizeof(listen_ring_name), sizeof(listen_ring_name) - 1,
+ "listen_rx_ring_%d", remote_port);
+ if (kernel_ip_match(addr) && rte_ring_lookup(listen_ring_name) == NULL) {
+ return true;
+ }
+
+ if (lwip_ip_route(addr)) {
+ return false;
+ }
+
+ if (kernel_ip_route(addr)) {
+ return true;
+ }
+
+ return false;
+}
+
static int32_t do_connect(int32_t s, const struct sockaddr *addr, socklen_t addrlen)
{
+ int32_t ret = 0;
+
if (addr == NULL) {
GAZELLE_RETURN(EINVAL);
}
@@ -350,30 +396,20 @@ static int32_t do_connect(int32_t s, const struct sockaddr *addr, socklen_t addr
return posix_api->connect_fn(s, addr, addrlen);
}
- int32_t ret = 0;
- int32_t remote_port;
- bool is_kernel = kernel_ip_route(addr);
- bool is_to_kernel_connect = is_relatived_kernel_ip(addr);
-
- remote_port = htons(((struct sockaddr_in *)addr)->sin_port);
-
- char listen_ring_name[RING_NAME_LEN];
- snprintf_s(listen_ring_name, sizeof(listen_ring_name), sizeof(listen_ring_name) - 1,
- "listen_rx_ring_%d", remote_port);
-
- if ((is_kernel && rte_ring_lookup(listen_ring_name) == NULL) || is_to_kernel_connect) {
+ if (should_enter_kernel_connect(addr)) {
ret = posix_api->connect_fn(s, addr, addrlen);
POSIX_SET_TYPE(sock, POSIX_KERNEL);
+ return ret;
+ }
+
+ /* When the socket is POSIX_LWIP_OR_KERNEL, connect to lwip first and then connect to kernel. */
+ ret = g_wrap_api->connect_fn(s, addr, addrlen);
+ if (ret == 0 || (ret != 0 && errno == EINPROGRESS)) {
+ POSIX_SET_TYPE(sock, POSIX_LWIP);
} else {
- /* When the socket is POSIX_LWIP_OR_KERNEL, connect to lwip first and then connect to kernel. */
- ret = g_wrap_api->connect_fn(s, addr, addrlen);
- if (ret == 0 || (ret != 0 && errno == EINPROGRESS)) {
- POSIX_SET_TYPE(sock, POSIX_LWIP);
- } else {
- ret = posix_api->connect_fn(s, addr, addrlen);
- if (ret == 0) {
- POSIX_SET_TYPE(sock, POSIX_KERNEL);
- }
+ ret = posix_api->connect_fn(s, addr, addrlen);
+ if (ret == 0) {
+ POSIX_SET_TYPE(sock, POSIX_KERNEL);
}
}
return ret;
--
2.33.0

View File

@ -0,0 +1,26 @@
From 2def683d0139084f48dc15d118af1d78e687e1f0 Mon Sep 17 00:00:00 2001
From: yinbin <yinbin8@huawei.com>
Date: Wed, 18 Dec 2024 19:54:29 +0800
Subject: [PATCH] DUMP: fix build error of oe2003 because of micro is not
defined.
---
src/lstack/core/lstack_dump.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/lstack/core/lstack_dump.c b/src/lstack/core/lstack_dump.c
index d415ddc..969ca2b 100644
--- a/src/lstack/core/lstack_dump.c
+++ b/src/lstack/core/lstack_dump.c
@@ -14,6 +14,8 @@
#include <sys/time.h>
#include <execinfo.h>
+#include <rte_cycles.h>
+
#include "lstack_cfg.h"
#include "lstack_log.h"
--
2.33.0

View File

@ -0,0 +1,310 @@
From bfc5d283ad9558d169bdb70e6b43876f5aa0062c Mon Sep 17 00:00:00 2001
From: yinbin <yinbin8@huawei.com>
Date: Tue, 31 Dec 2024 14:45:58 +0800
Subject: [PATCH] SIGNAL: Adjust sigaction function to keep lstack signal
function executed successfully.
---
src/lstack/api/lstack_unistd.c | 91 ++++++++++++++++++----
src/lstack/core/lstack_dump.c | 4 +-
src/lstack/core/lstack_protocol_stack.c | 23 +++++-
src/lstack/core/lstack_stack_stat.c | 24 +++---
src/lstack/core/lstack_thread_rpc.c | 1 +
src/lstack/include/lstack_protocol_stack.h | 3 +
6 files changed, 117 insertions(+), 29 deletions(-)
diff --git a/src/lstack/api/lstack_unistd.c b/src/lstack/api/lstack_unistd.c
index 47d80ec..90e603e 100644
--- a/src/lstack/api/lstack_unistd.c
+++ b/src/lstack/api/lstack_unistd.c
@@ -26,23 +26,54 @@
static int g_hijack_signal[] = { SIGTERM, SIGINT, SIGSEGV, SIGBUS, SIGFPE, SIGILL, SIGKILL};
#define HIJACK_SIGNAL_COUNT (sizeof(g_hijack_signal) / sizeof(g_hijack_signal[0]))
+static struct sigaction g_register_sigactions[NSIG]; // NSIG is the signal counts of system, normally equal 65 in Linux.
+static void lstack_sig_default_handler(int sig);
+
+static bool sig_is_registered(int sig)
+{
+ if (g_register_sigactions[sig].sa_handler != NULL &&
+ g_register_sigactions[sig].sa_handler != (void *) lstack_sig_default_handler) {
+ return true;
+ }
+ return false;
+}
+
static inline bool match_hijack_signal(int sig)
{
unsigned int i;
for (i = 0; i < HIJACK_SIGNAL_COUNT; i++) {
if (sig == g_hijack_signal[i]) {
- return 1;
+ return true;
}
}
- return 0;
+ return false;
}
-static void lstack_sig_default_handler(int sig)
+/* When operations such as pressing Ctrl+C or Kill are executed, we don't need to dump the stack. */
+bool sig_need_dump(int sig)
{
+ if (sig == SIGINT || sig == SIGTERM || sig == SIGKILL) {
+ return false;
+ }
+ return true;
+}
+
+static void lstack_sigaction_default_handler(int sig, siginfo_t *info, void *context)
+{
+ static bool skip_process_exit = false;
+
+ /* avoiding sig function being executed twice. */
+ if (!skip_process_exit) {
+ skip_process_exit = true;
+ } else {
+ return;
+ }
+
LSTACK_LOG(ERR, LSTACK, "lstack dumped, caught signal: %d\n", sig);
- /* When operations such as pressing Ctrl+C or Kill, the call stack exit is not displayed. */
- if (sig != SIGINT && sig != SIGTERM && sig != SIGKILL) {
+ stack_stop();
+
+ if (sig_need_dump(sig)) {
/* dump stack info */
dump_stack();
@@ -50,17 +81,31 @@ static void lstack_sig_default_handler(int sig)
dump_lstack();
}
+ if (sig_is_registered(sig)) {
+ if (g_register_sigactions[sig].sa_flags & SA_SIGINFO) {
+ g_register_sigactions[sig].sa_sigaction(sig, info, context);
+ } else {
+ g_register_sigactions[sig].sa_handler(sig);
+ }
+ }
+
if (get_global_cfg_params() && get_global_cfg_params()->is_primary) {
delete_primary_path();
}
control_fd_close();
+ stack_exit();
lwip_exit();
gazelle_exit();
(void)kill(getpid(), sig);
}
+static void lstack_sig_default_handler(int sig)
+{
+ lstack_sigaction_default_handler(sig, NULL, NULL);
+}
+
static void pthread_block_sig(int sig)
{
sigset_t mask;
@@ -105,18 +150,34 @@ int lstack_sigaction(int sig_num, const struct sigaction *action, struct sigacti
{
struct sigaction new_action;
- if ((match_hijack_signal(sig_num) != 0) && (action && action->sa_handler == SIG_DFL)) {
+ if (match_hijack_signal(sig_num) && action != NULL) {
new_action = *action;
- new_action.sa_flags |= SA_RESETHAND;
- new_action.sa_handler = lstack_sig_default_handler;
- return posix_api->sigaction_fn(sig_num, &new_action, old_action);
- }
- /* SA_INTERRUPT is deprecated, use SA_RESETHAND instead. */
- if ((match_hijack_signal(sig_num) != 0) && (action && action->sa_flags == SA_INTERRUPT)) {
- new_action = *action;
- new_action.sa_flags |= SA_RESETHAND;
- return posix_api->sigaction_fn(sig_num, &new_action, old_action);
+ if (action->sa_handler == SIG_DFL) {
+ new_action = *action;
+ new_action.sa_flags |= SA_RESETHAND;
+ new_action.sa_handler = lstack_sig_default_handler;
+ return posix_api->sigaction_fn(sig_num, &new_action, old_action);
+ }
+
+ /* SA_INTERRUPT is deprecated, use SA_RESETHAND instead. */
+ if (action->sa_flags == SA_INTERRUPT) {
+ new_action = *action;
+ new_action.sa_flags |= SA_RESETHAND;
+ return posix_api->sigaction_fn(sig_num, &new_action, old_action);
+ }
+
+ if (sig_need_dump(sig_num)) {
+ g_register_sigactions[sig_num] = new_action;
+
+ /* If SA_SIGINFO is setted, we use sa_sigaction. */
+ if (action->sa_flags & SA_SIGINFO) {
+ new_action.sa_sigaction = lstack_sigaction_default_handler;
+ } else {
+ new_action.sa_handler = lstack_sig_default_handler;
+ }
+ return posix_api->sigaction_fn(sig_num, &new_action, old_action);
+ }
}
return posix_api->sigaction_fn(sig_num, action, old_action);
diff --git a/src/lstack/core/lstack_dump.c b/src/lstack/core/lstack_dump.c
index d415ddc..2a4477d 100644
--- a/src/lstack/core/lstack_dump.c
+++ b/src/lstack/core/lstack_dump.c
@@ -23,14 +23,16 @@
#define DUMP_BACKTRACE_SIZE 64
static const char *dump_command[] = {
- "gazellectl lstack show 1",
"gazellectl lstack show 1 -s",
"gazellectl lstack show 1 -x",
+ "gazellectl lstack show 1 -v",
+ "gazellectl lstack show 1 -I",
"gazellectl lstack show 1 -p UDP",
"gazellectl lstack show 1 -p TCP",
"gazellectl lstack show 1 -p ICMP",
"gazellectl lstack show 1 -p IP",
"gazellectl lstack show 1 -p ETHARP",
+ "gazellectl lstack show 1",
"gazellectl lstack show 1 -c"
};
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index 2c60a49..1eebac4 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -51,7 +51,7 @@ static void stack_set_state(struct protocol_stack *stack, enum rte_lcore_state_t
__atomic_store_n(&stack->state, state, __ATOMIC_RELEASE);
}
-static enum rte_lcore_state_t stack_get_state(struct protocol_stack *stack)
+enum rte_lcore_state_t stack_get_state(struct protocol_stack *stack)
{
return __atomic_load_n(&stack->state, __ATOMIC_ACQUIRE);
}
@@ -777,17 +777,32 @@ OUT2:
return -1;
}
-void stack_exit(void)
+static void stack_all_fds_close(struct protocol_stack *stack)
{
- /* close all fd */
for (int i = 3; i < GAZELLE_MAX_CLIENTS + GAZELLE_RESERVED_CLIENTS; i++) {
struct lwip_sock *sock = lwip_get_socket(i);
- if (!POSIX_IS_CLOSED(sock) && sock->stack == get_protocol_stack()) {
+ if (!POSIX_IS_CLOSED(sock) && sock->stack == stack) {
lwip_close(i);
}
}
}
+void stack_exit(void)
+{
+ struct protocol_stack *stack = get_protocol_stack();
+ if (stack != NULL) {
+ stack_all_fds_close(stack);
+ }
+}
+
+void stack_stop(void)
+{
+ struct protocol_stack *stack = get_protocol_stack();
+ if (stack != NULL) {
+ stack_set_state(stack, WAIT);
+ }
+}
+
void stack_group_exit(void)
{
int i;
diff --git a/src/lstack/core/lstack_stack_stat.c b/src/lstack/core/lstack_stack_stat.c
index c88da8f..b1eb60e 100644
--- a/src/lstack/core/lstack_stack_stat.c
+++ b/src/lstack/core/lstack_stack_stat.c
@@ -30,6 +30,7 @@
#include "lstack_dpdk.h"
#include "lstack_stack_stat.h"
#include "lstack_virtio.h"
+#include "lstack_dump.h"
void time_stamp_transfer_pbuf(struct pbuf *pbuf_old, struct pbuf *pbuf_new)
{
@@ -263,11 +264,13 @@ static void get_stack_stats(struct gazelle_stack_dfx_data *dfx, struct protocol_
int32_t rpc_call_result = rpc_msgcnt(&stack->rpc_queue);
dfx->data.pkts.call_msg_cnt = (rpc_call_result < 0) ? 0 : rpc_call_result;
- rpc_call_result = rpc_call_mbufpoolsize(&stack->dfx_rpc_queue);
- dfx->data.pkts.mbufpool_avail_cnt = (rpc_call_result < 0) ? 0 : rpc_call_result;
+ if (stack_get_state(stack) == RUNNING) {
+ rpc_call_result = rpc_call_mbufpoolsize(&stack->dfx_rpc_queue);
+ dfx->data.pkts.mbufpool_avail_cnt = (rpc_call_result < 0) ? 0 : rpc_call_result;
- rpc_call_result = rpc_call_recvlistcnt(&stack->dfx_rpc_queue);
- dfx->data.pkts.recv_list_cnt = (rpc_call_result < 0) ? 0 : rpc_call_result;
+ rpc_call_result = rpc_call_recvlistcnt(&stack->dfx_rpc_queue);
+ dfx->data.pkts.recv_list_cnt = (rpc_call_result < 0) ? 0 : rpc_call_result;
+ }
dfx->data.pkts.conn_num = stack->conn_num;
}
@@ -343,11 +346,14 @@ static void get_stack_dfx_data(struct gazelle_stack_dfx_data *dfx, struct protoc
}
break;
case GAZELLE_STAT_LSTACK_SHOW_CONN:
- rpc_call_result = rpc_call_conntable(&stack->dfx_rpc_queue, dfx->data.conn.conn_list,
- GAZELLE_LSTACK_MAX_CONN);
- dfx->data.conn.conn_num = (rpc_call_result < 0) ? 0 : rpc_call_result;
- rpc_call_result = rpc_call_connnum(&stack->dfx_rpc_queue);
- dfx->data.conn.total_conn_num = (rpc_call_result < 0) ? 0 : rpc_call_result;
+ if (stack_get_state(stack) == RUNNING) {
+ rpc_call_result = rpc_call_conntable(&stack->dfx_rpc_queue, dfx->data.conn.conn_list,
+ GAZELLE_LSTACK_MAX_CONN);
+ dfx->data.conn.conn_num = (rpc_call_result < 0) ? 0 : rpc_call_result;
+ rpc_call_result = rpc_call_connnum(&stack->dfx_rpc_queue);
+ dfx->data.conn.total_conn_num = (rpc_call_result < 0) ? 0 : rpc_call_result;
+ }
+
break;
case GAZELLE_STAT_LSTACK_SHOW_LATENCY:
ret = memcpy_s(&dfx->data.latency, sizeof(dfx->data.latency), &stack->latency, sizeof(stack->latency));
diff --git a/src/lstack/core/lstack_thread_rpc.c b/src/lstack/core/lstack_thread_rpc.c
index 26bd16a..9f871af 100644
--- a/src/lstack/core/lstack_thread_rpc.c
+++ b/src/lstack/core/lstack_thread_rpc.c
@@ -146,6 +146,7 @@ static struct rpc_msg *rpc_msg_alloc_except(rpc_func_t func)
static void stack_exit_by_rpc(struct rpc_msg *msg)
{
+ stack_stop();
stack_exit();
}
diff --git a/src/lstack/include/lstack_protocol_stack.h b/src/lstack/include/lstack_protocol_stack.h
index 068e9d2..c7c7efe 100644
--- a/src/lstack/include/lstack_protocol_stack.h
+++ b/src/lstack/include/lstack_protocol_stack.h
@@ -120,10 +120,13 @@ void thread_bind_stack(struct protocol_stack *stack);
int stack_group_init(void);
void stack_group_exit(void);
void stack_exit(void);
+void stack_stop(void);
int stack_setup_thread(void);
int stack_setup_app_thread(void);
int stack_polling(unsigned wakeup_tick);
+enum rte_lcore_state_t stack_get_state(struct protocol_stack *stack);
+
#endif
--
2.33.0

View File

@ -0,0 +1,35 @@
From 036485b74b382574f1b88b10b5cfed5a0efb2562 Mon Sep 17 00:00:00 2001
From: yinbin <yinbin8@huawei.com>
Date: Thu, 2 Jan 2025 17:47:13 +0800
Subject: [PATCH] SIGNAL: Adjust hijack sigal table to hijack SIGABRT SIGQUIT
and delet SIGKILL
---
src/lstack/api/lstack_unistd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/lstack/api/lstack_unistd.c b/src/lstack/api/lstack_unistd.c
index 90e603e..0837a6b 100644
--- a/src/lstack/api/lstack_unistd.c
+++ b/src/lstack/api/lstack_unistd.c
@@ -23,7 +23,7 @@
#include "lstack_control_plane.h"
#include "lstack_dump.h"
-static int g_hijack_signal[] = { SIGTERM, SIGINT, SIGSEGV, SIGBUS, SIGFPE, SIGILL, SIGKILL};
+static int g_hijack_signal[] = { SIGTERM, SIGINT, SIGSEGV, SIGBUS, SIGFPE, SIGILL, SIGABRT, SIGQUIT};
#define HIJACK_SIGNAL_COUNT (sizeof(g_hijack_signal) / sizeof(g_hijack_signal[0]))
static struct sigaction g_register_sigactions[NSIG]; // NSIG is the signal counts of system, normally equal 65 in Linux.
@@ -52,7 +52,7 @@ static inline bool match_hijack_signal(int sig)
/* When operations such as pressing Ctrl+C or Kill are executed, we don't need to dump the stack. */
bool sig_need_dump(int sig)
{
- if (sig == SIGINT || sig == SIGTERM || sig == SIGKILL) {
+ if (sig == SIGINT || sig == SIGTERM || sig == SIGQUIT) {
return false;
}
return true;
--
2.33.0

View File

@ -0,0 +1,25 @@
From b514eab8bb012067d6f40f3d6a7ec925e9b2093e Mon Sep 17 00:00:00 2001
From: yinbin <yinbin8@huawei.com>
Date: Fri, 10 Jan 2025 14:04:44 +0800
Subject: [PATCH] DUMP: fix abnomal printing in the dump process.
---
src/lstack/core/lstack_dump.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lstack/core/lstack_dump.c b/src/lstack/core/lstack_dump.c
index 2a4477d..56eb305 100644
--- a/src/lstack/core/lstack_dump.c
+++ b/src/lstack/core/lstack_dump.c
@@ -94,7 +94,7 @@ static int dump_command_excute(const char *command)
/* get and print command output */
if (fgets(buffer, sizeof(buffer), fp) != NULL) {
- LSTACK_LOG(INFO, LSTACK, "\r %s", buffer);
+ LSTACK_LOG(INFO, LSTACK, "\r\033[K %s", buffer);
} else if (feof(fp)) {
break;
} else {
--
2.33.0

View File

@ -0,0 +1,25 @@
From ff847f26a675fe7a1eca24cda2aad5904435ea74 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Mon, 13 Jan 2025 14:19:47 +0800
Subject: [PATCH] fix the memory leak when using strdup
---
src/lstack/core/lstack_cfg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
index 9a935f1..3d49cc3 100644
--- a/src/lstack/core/lstack_cfg.c
+++ b/src/lstack/core/lstack_cfg.c
@@ -398,7 +398,7 @@ static int32_t parse_devices(void)
sprintf(temp_dev + strlen(temp_dev), "%02x%s",
((struct sockaddr_ll *)ifa->ifa_addr)->sll_addr[i], i < (ETHER_ADDR_LEN - 1) ? ":" : "");
}
- dev = strdup_assert_return(temp_dev);
+ dev = temp_dev;
break;
}
--
2.33.0

View File

@ -0,0 +1,74 @@
From 51e3c4f57dfcd6400df17bbebe18f544b90e134f Mon Sep 17 00:00:00 2001
From: yinbin <yinbin8@huawei.com>
Date: Tue, 14 Jan 2025 10:19:27 +0800
Subject: [PATCH] Stack: unset stack_stop, while stacks exit by rpc message.
---
src/lstack/api/lstack_unistd.c | 2 +-
src/lstack/core/lstack_protocol_stack.c | 3 ++-
src/lstack/core/lstack_thread_rpc.c | 1 -
src/lstack/include/lstack_protocol_stack.h | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/lstack/api/lstack_unistd.c b/src/lstack/api/lstack_unistd.c
index 0837a6b..d8b5d8e 100644
--- a/src/lstack/api/lstack_unistd.c
+++ b/src/lstack/api/lstack_unistd.c
@@ -71,7 +71,7 @@ static void lstack_sigaction_default_handler(int sig, siginfo_t *info, void *con
LSTACK_LOG(ERR, LSTACK, "lstack dumped, caught signal: %d\n", sig);
- stack_stop();
+ stack_wait();
if (sig_need_dump(sig)) {
/* dump stack info */
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index 1eebac4..fcc0ad7 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -795,7 +795,7 @@ void stack_exit(void)
}
}
-void stack_stop(void)
+void stack_wait(void)
{
struct protocol_stack *stack = get_protocol_stack();
if (stack != NULL) {
@@ -824,6 +824,7 @@ void stack_group_exit(void)
stack_exit();
}
+ /* Waiting all stacks' status transfer to WAIT, which means stacks are ready to exit. */
for (i = 0; i < stack_group->stack_num; i++) {
if (stack_group->stacks[i] == NULL || stack == stack_group->stacks[i]) {
continue;
diff --git a/src/lstack/core/lstack_thread_rpc.c b/src/lstack/core/lstack_thread_rpc.c
index 9f871af..26bd16a 100644
--- a/src/lstack/core/lstack_thread_rpc.c
+++ b/src/lstack/core/lstack_thread_rpc.c
@@ -146,7 +146,6 @@ static struct rpc_msg *rpc_msg_alloc_except(rpc_func_t func)
static void stack_exit_by_rpc(struct rpc_msg *msg)
{
- stack_stop();
stack_exit();
}
diff --git a/src/lstack/include/lstack_protocol_stack.h b/src/lstack/include/lstack_protocol_stack.h
index c7c7efe..c9c50c9 100644
--- a/src/lstack/include/lstack_protocol_stack.h
+++ b/src/lstack/include/lstack_protocol_stack.h
@@ -120,7 +120,7 @@ void thread_bind_stack(struct protocol_stack *stack);
int stack_group_init(void);
void stack_group_exit(void);
void stack_exit(void);
-void stack_stop(void);
+void stack_wait(void);
int stack_setup_thread(void);
int stack_setup_app_thread(void);
--
2.33.0

View File

@ -0,0 +1,58 @@
From 5d7e406a138567a9959c994af4fb574f7f075bed Mon Sep 17 00:00:00 2001
From: yinbin <yinbin8@huawei.com>
Date: Wed, 15 Jan 2025 11:16:43 +0800
Subject: [PATCH] SIGNAL: block SIGSEGV during exit process
---
src/lstack/api/lstack_unistd.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/lstack/api/lstack_unistd.c b/src/lstack/api/lstack_unistd.c
index d8b5d8e..e3b9b1f 100644
--- a/src/lstack/api/lstack_unistd.c
+++ b/src/lstack/api/lstack_unistd.c
@@ -58,6 +58,15 @@ bool sig_need_dump(int sig)
return true;
}
+static void pthread_block_sig(int sig)
+{
+ sigset_t mask;
+
+ sigemptyset(&mask);
+ sigaddset(&mask, sig);
+ pthread_sigmask(SIG_BLOCK, &mask, NULL);
+}
+
static void lstack_sigaction_default_handler(int sig, siginfo_t *info, void *context)
{
static bool skip_process_exit = false;
@@ -81,6 +90,9 @@ static void lstack_sigaction_default_handler(int sig, siginfo_t *info, void *con
dump_lstack();
}
+ /* App sig_handler may access invalid memory address in gazelle threads,
+ * so we block this signal avoiding getting stuck during exit. */
+ pthread_block_sig(SIGSEGV);
if (sig_is_registered(sig)) {
if (g_register_sigactions[sig].sa_flags & SA_SIGINFO) {
g_register_sigactions[sig].sa_sigaction(sig, info, context);
@@ -106,15 +118,6 @@ static void lstack_sig_default_handler(int sig)
lstack_sigaction_default_handler(sig, NULL, NULL);
}
-static void pthread_block_sig(int sig)
-{
- sigset_t mask;
-
- sigemptyset(&mask);
- sigaddset(&mask, sig);
- pthread_sigmask(SIG_BLOCK, &mask, NULL);
-}
-
static void pthread_unblock_sig(int sig)
{
sigset_t mask;
--
2.33.0

View File

@ -0,0 +1,191 @@
From a237d1d8515d602e152546f182b1769fd31fa8b7 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Sat, 18 Jan 2025 21:32:23 +0800
Subject: [PATCH] add xdp tx checksum/tso offload
---
src/lstack/core/lstack_cfg.c | 20 ++++++++++----------
src/lstack/core/lstack_dpdk.c | 21 ++++++---------------
src/lstack/include/lstack_cfg.h | 8 ++++++++
src/lstack/include/lstack_dpdk.h | 1 -
src/lstack/netif/lstack_ethdev.c | 11 +++++++++--
src/lstack/netif/lstack_vdev.c | 2 +-
6 files changed, 34 insertions(+), 29 deletions(-)
diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
index 3d49cc3..04ceb89 100644
--- a/src/lstack/core/lstack_cfg.c
+++ b/src/lstack/core/lstack_cfg.c
@@ -91,7 +91,6 @@ static int32_t parse_flow_bifurcation(void);
static int32_t parse_stack_interrupt(void);
static int32_t parse_stack_num(void);
static int32_t parse_xdp_eth_name(void);
-static bool xdp_eth_enabled(void);
#define PARSE_ARG(_arg, _arg_string, _default_val, _min_val, _max_val, _ret) \
do { \
@@ -1491,6 +1490,7 @@ static int dpdk_dev_get_iface_name(char *vdev_str)
char *iface_value = NULL;
char *next_token = NULL;
char vdev_str_cp[strlen(vdev_str) + 1];
+ int idx = 0;
/* To prevent the original string from being modified, use a copied string. */
if (strcpy_s(vdev_str_cp, sizeof(vdev_str_cp), vdev_str) != 0) {
@@ -1498,7 +1498,15 @@ static int dpdk_dev_get_iface_name(char *vdev_str)
return -1;
}
- token = strtok_s(vdev_str_cp, ",", &next_token);
+ while (vdev_str_cp[idx] == ' ') {
+ idx++;
+ }
+
+ if (strncmp(&vdev_str_cp[idx], "net_af_xdp", strlen("net_af_xdp")) != 0) {
+ return 0;
+ }
+
+ token = strtok_s(&vdev_str_cp[idx], ",", &next_token);
while (token != NULL) {
if (strncmp(token, VDEV_ARG_IFACE, strlen(VDEV_ARG_IFACE)) == 0) {
iface_value = token + strlen(VDEV_ARG_IFACE) + 1;
@@ -1535,11 +1543,3 @@ static int32_t parse_xdp_eth_name(void)
return ret;
}
-
-static bool xdp_eth_enabled(void)
-{
- if (strlen(g_config_params.xdp_eth_name)) {
- return true;
- }
- return false;
-}
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
index 3023a6c..fcb78ca 100644
--- a/src/lstack/core/lstack_dpdk.c
+++ b/src/lstack/core/lstack_dpdk.c
@@ -52,7 +52,6 @@
struct eth_params {
uint16_t port_id;
- bool is_xdp;
uint16_t nb_queues;
uint16_t nb_rx_desc;
@@ -155,7 +154,12 @@ struct rte_mempool *create_pktmbuf_mempool(const char *name, uint32_t nb_mbuf,
}
/* time stamp before pbuf_custom as priv_data */
- uint16_t private_size = RTE_ALIGN(sizeof(struct mbuf_private), RTE_CACHE_LINE_SIZE);
+ uint16_t private_size = sizeof(struct mbuf_private);
+ if (xdp_eth_enabled()) {
+ /* reserved for xdp metadata, see struct xsk_tx_metadata in /usr/include/linux/if_xdp.h */
+ private_size += 24;
+ }
+ private_size = RTE_ALIGN(private_size, RTE_CACHE_LINE_SIZE);
pool = rte_pktmbuf_pool_create(pool_name, nb_mbuf, mbuf_cache_size, private_size, MBUF_SZ, numa_id);
if (pool == NULL) {
LSTACK_LOG(ERR, LSTACK, "cannot create %s pool rte_err=%d\n", pool_name, rte_errno);
@@ -400,16 +404,6 @@ static int eth_params_rss(struct rte_eth_conf *conf, struct rte_eth_dev_info *de
return rss_enable;
}
-bool dpdk_nic_is_xdp(void)
-{
- struct protocol_stack_group *stack_group = get_protocol_stack_group();
- /* eth_params is null in ltran mode */
- if (stack_group->eth_params == NULL) {
- return false;
- }
- return stack_group->eth_params->is_xdp;
-}
-
static int eth_params_init(struct eth_params *eth_params, uint16_t port_id, uint16_t nb_queues, int *rss_enable)
{
struct rte_eth_dev_info dev_info;
@@ -439,9 +433,6 @@ static int eth_params_init(struct eth_params *eth_params, uint16_t port_id, uint
eth_params->conf.intr_conf.rxq = get_global_cfg_params()->stack_interrupt;
eth_params_checksum(&eth_params->conf, &dev_info);
- if (strcmp(dev_info.driver_name, "net_af_xdp") == 0) {
- eth_params->is_xdp = true;
- }
if (!get_global_cfg_params()->tuple_filter) {
*rss_enable = eth_params_rss(&eth_params->conf, &dev_info);
diff --git a/src/lstack/include/lstack_cfg.h b/src/lstack/include/lstack_cfg.h
index 07a97cb..d59407b 100644
--- a/src/lstack/include/lstack_cfg.h
+++ b/src/lstack/include/lstack_cfg.h
@@ -165,6 +165,14 @@ static inline uint8_t use_ltran(void)
return get_global_cfg_params()->use_ltran;
}
+static inline bool xdp_eth_enabled(void)
+{
+ if (strlen(get_global_cfg_params()->xdp_eth_name)) {
+ return true;
+ }
+ return false;
+}
+
int cfg_init(void);
int gazelle_param_init(int *argc, char **argv);
int gazelle_copy_param(const char *param, bool is_double, int *argc, char argv[][PATH_MAX]);
diff --git a/src/lstack/include/lstack_dpdk.h b/src/lstack/include/lstack_dpdk.h
index c2142d6..6251be7 100644
--- a/src/lstack/include/lstack_dpdk.h
+++ b/src/lstack/include/lstack_dpdk.h
@@ -64,7 +64,6 @@ int32_t dpdk_init_lstack_kni(void);
void dpdk_nic_xstats_get(struct gazelle_stack_dfx_data *dfx, uint16_t port_id);
void dpdk_nic_features_get(struct gazelle_stack_dfx_data *dfx, uint16_t port_id);
-bool dpdk_nic_is_xdp(void);
uint32_t dpdk_pktmbuf_mempool_num(void);
uint32_t dpdk_total_socket_memory(void);
diff --git a/src/lstack/netif/lstack_ethdev.c b/src/lstack/netif/lstack_ethdev.c
index 315cced..3b859d2 100644
--- a/src/lstack/netif/lstack_ethdev.c
+++ b/src/lstack/netif/lstack_ethdev.c
@@ -364,14 +364,21 @@ static err_t eth_dev_init(struct netif *netif)
netif->hwaddr_len = ETHER_ADDR_LEN;
- if (dpdk_nic_is_xdp()) {
+ if (xdp_eth_enabled()) {
netif_set_rxol_flags(netif, RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
RTE_ETH_RX_OFFLOAD_UDP_CKSUM |
RTE_ETH_RX_OFFLOAD_IPV4_CKSUM);
+ netif_set_txol_flags(netif, RTE_ETH_TX_OFFLOAD_TCP_CKSUM | RTE_ETH_TX_OFFLOAD_TCP_TSO);
+ /* 16: see kernel MAX_SKB_FRAGS define in skbuff.h */
+ netif_set_max_pbuf_frags(netif, 16);
} else {
netif_set_rxol_flags(netif, get_protocol_stack_group()->rx_offload);
+ netif_set_txol_flags(netif, get_protocol_stack_group()->tx_offload);
+ /* 40: dpdk pmd support 40 max segs */
+ netif_set_max_pbuf_frags(netif, 40);
}
- netif_set_txol_flags(netif, get_protocol_stack_group()->tx_offload);
+ netif_set_min_tso_seglen(netif, 256);
+
if (get_global_cfg_params()->stack_mode_rtc) {
netif_set_rtc_mode(netif);
}
diff --git a/src/lstack/netif/lstack_vdev.c b/src/lstack/netif/lstack_vdev.c
index b1d1a1b..2eaeb1f 100644
--- a/src/lstack/netif/lstack_vdev.c
+++ b/src/lstack/netif/lstack_vdev.c
@@ -147,7 +147,7 @@ static uint32_t vdev_rx_poll(struct protocol_stack *stack, struct rte_mbuf **pkt
}
if (get_protocol_stack_group()->rx_offload == 0 || /* skip gro when tcp/ip cksum offloads disable */
- dpdk_nic_is_xdp() || /* kernel has done GRO */
+ xdp_eth_enabled() || /* kernel has done GRO */
(get_global_cfg_params()->vlan_mode >= 0
&& !(get_protocol_stack_group()->rx_offload & RTE_ETH_RX_OFFLOAD_VLAN_STRIP))) {
return pkt_num;
--
2.33.0

View File

@ -0,0 +1,35 @@
From 4ad01c9c13f3f0837d19194463d6493ee5f1c243 Mon Sep 17 00:00:00 2001
From: yinbin <yinbin8@huawei.com>
Date: Tue, 21 Jan 2025 11:43:02 +0800
Subject: [PATCH] RTC-mode: fix gazellectl can't print connenct info
---
src/lstack/core/lstack_protocol_stack.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index fcc0ad7..cb1b2b8 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -704,6 +704,7 @@ int stack_setup_app_thread(void)
{
static PER_THREAD int first_flags = 1;
static _Atomic uint32_t queue_id = 0;
+ struct protocol_stack *stack;
if (likely(first_flags == 0)) {
return 0;
@@ -723,6 +724,10 @@ int stack_setup_app_thread(void)
free(t_params);
return -1;
}
+
+ stack = get_protocol_stack();
+ stack_set_state(stack, RUNNING);
+
atomic_fetch_add(&g_stack_group.stack_num, 1);
free(t_params);
return 0;
--
2.33.0

View File

@ -0,0 +1,25 @@
From 76c84f12bbcaf36f367252adc0a6da1bfee05de1 Mon Sep 17 00:00:00 2001
From: yinbin <yinbin8@huawei.com>
Date: Sat, 15 Feb 2025 16:41:13 +0800
Subject: [PATCH] Connect: fix benchmark_dws connect failed
---
src/lstack/api/lstack_wrap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
index 97e927a..e90c523 100644
--- a/src/lstack/api/lstack_wrap.c
+++ b/src/lstack/api/lstack_wrap.c
@@ -404,7 +404,7 @@ static int32_t do_connect(int32_t s, const struct sockaddr *addr, socklen_t addr
/* When the socket is POSIX_LWIP_OR_KERNEL, connect to lwip first and then connect to kernel. */
ret = g_wrap_api->connect_fn(s, addr, addrlen);
- if (ret == 0 || (ret != 0 && errno == EINPROGRESS)) {
+ if (ret == 0 || (ret != 0 && (errno == EINPROGRESS || errno == EISCONN))) {
POSIX_SET_TYPE(sock, POSIX_LWIP);
} else {
ret = posix_api->connect_fn(s, addr, addrlen);
--
2.33.0

View File

@ -0,0 +1,33 @@
From 3619605574d0c624513a10ecd543cc2bc1608f7b Mon Sep 17 00:00:00 2001
From: yinbin <yinbin8@huawei.com>
Date: Fri, 24 Jan 2025 14:18:26 +0800
Subject: [PATCH] Protocal: fixing deathlock between protocol threads and app
thread
---
src/lstack/core/lstack_lwip.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index 648da58..3bb943f 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -267,7 +267,14 @@ struct pbuf *do_lwip_alloc_pbuf(pbuf_layer layer, uint16_t length, pbuf_type typ
static inline bool pbuf_allow_append(struct pbuf *pbuf, uint16_t remain_size)
{
- pthread_spin_lock(&pbuf->pbuf_lock);
+ int ret;
+
+ /* Using pthread_spin_trylock to avoid deadlock between app thread and lstack threads */
+ ret = pthread_spin_trylock(&pbuf->pbuf_lock);
+ if (ret != 0) {
+ return false;
+ }
+
if (pbuf->tot_len > remain_size) {
pthread_spin_unlock(&pbuf->pbuf_lock);
return false;
--
2.33.0

View File

@ -0,0 +1,38 @@
From 9e8c4da250bb57f0ba6d59a98d0f601a853d4f7e Mon Sep 17 00:00:00 2001
From: compile_success <980965867@qq.com>
Date: Tue, 4 Mar 2025 08:14:18 +0000
Subject: [PATCH] update gazelle max numa nodes 8
---
src/common/gazelle_opt.h | 2 +-
src/common/gazelle_reg_msg.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/common/gazelle_opt.h b/src/common/gazelle_opt.h
index 98f1afd..d6b1c44 100644
--- a/src/common/gazelle_opt.h
+++ b/src/common/gazelle_opt.h
@@ -110,6 +110,6 @@
#define SLEEP_US_BEFORE_LINK_UP 10000
#define CPUS_MAX_NUM 640
-#define GAZELLE_MAX_NUMA_NODES 4
+#define GAZELLE_MAX_NUMA_NODES 8
#endif /* _GAZELLE_OPT_H_ */
diff --git a/src/common/gazelle_reg_msg.h b/src/common/gazelle_reg_msg.h
index 2ba47cc..ecd1e35 100644
--- a/src/common/gazelle_reg_msg.h
+++ b/src/common/gazelle_reg_msg.h
@@ -33,7 +33,7 @@
#define OPT_VDEV "--vdev"
#define VDEV_ARG_IFACE "iface"
-#define GAZELLE_MAX_NUMA_NODES 4
+#define GAZELLE_MAX_NUMA_NODES 8
#define SOCKET_MEM_STRLEN (GAZELLE_MAX_NUMA_NODES * 10)
/* types for msg from lstack to ltran */
--
2.33.0

View File

@ -2,7 +2,7 @@
Name: gazelle
Version: 1.0.2
Release: 79
Release: 84
Summary: gazelle is a high performance user-mode stack
License: MulanPSL-2.0
URL: https://gitee.com/openeuler/gazelle
@ -322,6 +322,22 @@ Patch9302: 0302-fix-rpc-pool-leak-when-thread-exits.patch
Patch9303: 0303-fix-epoll-and-recv-threads-blocked-on-the-same-semap.patch
Patch9304: 0304-fix-errno-ETIMEFOUT.patch
Patch9305: 0305-cfg-notify-that-it-s-unsupported-when-stack_num-1.patch
Patch9306: 0306-fix-a-contention-issue-when-rpc-pools-are-added-to-r.patch
Patch9307: 0307-openGauss-unsupport_tcp_optname.patch
Patch9308: 0308-kernerl-bind-add-ipv6-add-check.patch
Patch9309: 0309-Connect-execute-lwip-connect-if-dst_ip-and-host_ip-a.patch
Patch9310: 0310-DUMP-fix-build-error-of-oe2003-because-of-micro-is-n.patch
Patch9311: 0311-SIGNAL-Adjust-sigaction-function-to-keep-lstack-sign.patch
Patch9312: 0312-SIGNAL-Adjust-hijack-sigal-table-to-hijack-SIGABRT-S.patch
Patch9313: 0313-DUMP-fix-abnomal-printing-in-the-dump-process.patch
Patch9314: 0314-fix-the-memory-leak-when-using-strdup.patch
Patch9315: 0315-Stack-unset-stack_stop-while-stacks-exit-by-rpc-mess.patch
Patch9316: 0316-SIGNAL-block-SIGSEGV-during-exit-process.patch
Patch9317: 0317-add-xdp-tx-checksum-tso-offload.patch
Patch9318: 0318-RTC-mode-fix-gazellectl-can-t-print-connenct-info.patch
Patch9319: 0319-Connect-fix-benchmark_dws-connect-failed.patch
Patch9320: 0320-Protocal-fixing-deathlock-between-protocol-threads-a.patch
Patch9321: 0321-update-gazelle-max-numa-nodes-8.patch
%description
%{name} is a high performance user-mode stack.
@ -363,6 +379,32 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b
%config(noreplace) %{conf_path}/ltran.conf
%changelog
* Tue Mar 04 2025 yinbin6 <yinbin8@huawei.com> - 1.0.2-84
- update gazelle max numa nodes 8
- Protocal: fixing deathlock between protocol threads and app thread
- Connect: fix benchmark_dws connect failed
- RTC-mode: fix gazellectl can't print connenct info
- add xdp tx checksum/tso offload
* Fri Jan 17 2025 yinbin6 <yinbin8@huawei.com> - 1.0.2-83
- SIGNAL: block SIGSEGV during exit process
- Stack: unset stack_stop, while stacks exit by rpc message.
- fix the memory leak when using strdup
* Fri Jan 10 2025 yinbin6 <yinbin8@huawei.com> - 1.0.2-82
- DUMP: fix abnomal printing in the dump process.
- SIGNAL: Adjust hijack sigal table to hijack SIGABRT SIGQUIT and delet SIGKILL
- SIGNAL: Adjust sigaction function to keep lstack signal function executed successfully.
* Thu Dec 19 2024 yinbin6 <yinbin8@huawei.com> - 1.0.2-81
- DUMP: fix build error of oe2003 because of micro is not defined.
* Wed Dec 18 2024 yinbin6 <yinbin8@huawei.com> - 1.0.2-80
- Connect: execute lwip connect if dst_ip and host_ip are in the same network.
- kernerl bind: add ipv6 add check
- openGauss unsupport_tcp_optname
- fix a contention issue when rpc pools are added to rpc_pool_array
* Wed Dec 11 2024 yinbin6 <yinbin8@huawei.com> - 1.0.2-79
- cfg: notify that it's unsupported, when stack_num > 1
- fix errno == ETIMEFOUT