14 Star 5 Fork 32

src-openEuler/gazelle

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0019-cfg-add-run-to-completion-mode-configure.patch 2.91 KB
一键复制 编辑 原始数据 按行查看 历史
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/gazelle.git
git@gitee.com:src-openeuler/gazelle.git
src-openeuler
gazelle
gazelle
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385