92 lines
2.9 KiB
Diff
92 lines
2.9 KiB
Diff
From 3208a2f1ada7c8c388bdea356d38c9edef1e05dd Mon Sep 17 00:00:00 2001
|
|
From: jiangheng <jiangheng14@huawei.com>
|
|
Date: Sun, 8 Oct 2023 19:48:45 +0800
|
|
Subject: [PATCH] cfg: add run-to-completion mode configure
|
|
|
|
---
|
|
src/lstack/core/lstack_cfg.c | 30 ++++++++++++++++++++++++++++++
|
|
src/lstack/include/lstack_cfg.h | 1 +
|
|
src/lstack/lstack.conf | 2 ++
|
|
3 files changed, 33 insertions(+)
|
|
|
|
diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
|
|
index 0eca86e..951e6e8 100644
|
|
--- a/src/lstack/core/lstack_cfg.c
|
|
+++ b/src/lstack/core/lstack_cfg.c
|
|
@@ -76,6 +76,7 @@ static int32_t parse_use_sockmap(void);
|
|
static int32_t parse_udp_enable(void);
|
|
static int32_t parse_nic_rxqueue_size(void);
|
|
static int32_t parse_nic_txqueue_size(void);
|
|
+static int32_t parse_stack_thread_mode(void);
|
|
|
|
#define PARSE_ARG(_arg, _arg_string, _default_val, _min_val, _max_val, _ret) \
|
|
do { \
|
|
@@ -135,6 +136,7 @@ static struct config_vector_t g_config_tbl[] = {
|
|
{ "udp_enable", parse_udp_enable },
|
|
{ "nic_rxqueue_size", parse_nic_rxqueue_size},
|
|
{ "nic_txqueue_size", parse_nic_txqueue_size},
|
|
+ { "stack_thread_mode", parse_stack_thread_mode },
|
|
{ NULL, NULL }
|
|
};
|
|
|
|
@@ -1183,3 +1185,31 @@ static int32_t parse_nic_txqueue_size(void)
|
|
NIC_QUEUE_SIZE_MIN, NIC_QUEUE_SIZE_MAX, ret);
|
|
return ret;
|
|
}
|
|
+
|
|
+static int32_t parse_stack_thread_mode(void)
|
|
+{
|
|
+ const config_setting_t *thread_mode = NULL;
|
|
+ const char *args = NULL;
|
|
+
|
|
+ thread_mode = config_lookup(&g_config, "stack_thread_mode");
|
|
+ if (thread_mode == NULL) {
|
|
+ g_config_params.stack_mode_rtc = false;
|
|
+ return 0;
|
|
+ }
|
|
+
|
|
+ args = config_setting_get_string(thread_mode);
|
|
+ if (args == NULL) {
|
|
+ return -EINVAL;
|
|
+ }
|
|
+
|
|
+ if (strncmp(args, "run-to-completion", strlen("run-to-completion") + 1) == 0) {
|
|
+ g_config_params.stack_mode_rtc = true;
|
|
+ } else if (strncmp(args, "run-to-wakeup", strlen("run-to-wakeup") + 1) == 0) {
|
|
+ g_config_params.stack_mode_rtc = false;
|
|
+ } else {
|
|
+ LSTACK_LOG(ERR, LSTACK, "stack_mode_rtc only support run-to-completion or run-to-wakeup\n");
|
|
+ return -EINVAL;
|
|
+ }
|
|
+
|
|
+ return 0;
|
|
+}
|
|
diff --git a/src/lstack/include/lstack_cfg.h b/src/lstack/include/lstack_cfg.h
|
|
index e48a501..1d895ec 100644
|
|
--- a/src/lstack/include/lstack_cfg.h
|
|
+++ b/src/lstack/include/lstack_cfg.h
|
|
@@ -116,6 +116,7 @@ struct cfg_params {
|
|
bool use_sockmap;
|
|
bool udp_enable;
|
|
struct cfg_nic_params nic;
|
|
+ bool stack_mode_rtc;
|
|
};
|
|
|
|
struct cfg_params *get_global_cfg_params(void);
|
|
diff --git a/src/lstack/lstack.conf b/src/lstack/lstack.conf
|
|
index ad574e1..48973fe 100644
|
|
--- a/src/lstack/lstack.conf
|
|
+++ b/src/lstack/lstack.conf
|
|
@@ -10,6 +10,8 @@
|
|
|
|
dpdk_args=["--socket-mem", "2048,0,0,0", "--huge-dir", "/mnt/hugepages-lstack", "--proc-type", "primary", "--legacy-mem", "--map-perfect"]
|
|
|
|
+stack_thread_mode="run-to-wakeup"
|
|
+
|
|
use_ltran=1
|
|
kni_switch=0
|
|
|
|
--
|
|
2.23.0
|
|
|