!196 [sync] PR-194: add RXTX_NB_MBUF_MAX to limit mbuf_pool_size to its range

From: @openeuler-sync-bot 
Reviewed-by: @wu-changsheng 
Signed-off-by: @wu-changsheng
This commit is contained in:
openeuler-ci-bot 2022-12-17 07:53:28 +00:00 committed by Gitee
commit 78a2feda70
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,40 @@
From 546cde6494913a9d5b1c12578385ca586ee999ef Mon Sep 17 00:00:00 2001
From: kircher <majun65@huawei.com>
Date: Sat, 17 Dec 2022 15:25:26 +0800
Subject: [PATCH] add RXTX_NB_MBUF_MAX to limit mbuf_pool_size to its range
---
src/common/gazelle_opt.h | 1 +
src/lstack/core/lstack_cfg.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/common/gazelle_opt.h b/src/common/gazelle_opt.h
index a23b329..7e55422 100644
--- a/src/common/gazelle_opt.h
+++ b/src/common/gazelle_opt.h
@@ -48,6 +48,7 @@
#define RTE_TEST_RX_DESC_DEFAULT 4096
#define RXTX_NB_MBUF_DEFAULT (128 * 2000) /* mbuf per connect * connect num. size of mbuf is 2536 Byte */
+#define RXTX_NB_MBUF_MAX (2560 * 2000)
#define MBUF_MAX_DATA_LEN 1460
diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
index 52a34a4..9c23115 100644
--- a/src/lstack/core/lstack_cfg.c
+++ b/src/lstack/core/lstack_cfg.c
@@ -717,8 +717,8 @@ static int32_t parse_rxtx_pool_size(void)
}
int32_t val = config_setting_get_int(arg);
- if (val <= 0) {
- LSTACK_PRE_LOG(LSTACK_ERR, "cfg mbuf_pool_size %d invaild.\n", val);
+ if (val <= 0 || val > RXTX_NB_MBUF_MAX) {
+ LSTACK_PRE_LOG(LSTACK_ERR, "cfg mbuf_pool_size %d invaild, it should be in (0,%d].\n", val, RXTX_NB_MBUF_MAX);
return -EINVAL;
}
--
2.33.0

View File

@ -2,7 +2,7 @@
Name: gazelle
Version: 1.0.1
Release: 33
Release: 34
Summary: gazelle is a high performance user-mode stack
License: MulanPSL-2.0
URL: https://gitee.com/openeuler/gazelle
@ -172,6 +172,7 @@ Patch9154: 0154-fix-kernel-event-thread-bind-numa-failed.patch
Patch9155: 0155-stack-thread-parms-config-by-conf.patch
Patch9156: 0156-ltran-rxtx-mbuf-pool-size-config-by-conf.patch
Patch9157: 0157-move-select_thread_path-after-posix_api_init.patch
Patch9158: 0158-add-RXTX_NB_MBUF_MAX-to-limit-mbuf_pool_size-to-its-.patch
%description
%{name} is a high performance user-mode stack.
@ -212,6 +213,9 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b
%config(noreplace) %{conf_path}/ltran.conf
%changelog
* Sat Dec 17 2022 kircher <majun65@huawei.com> - 1.0.1-34
- add RXTX_NB_MBUF_MAX to limit mbuf_pool_size to its range
* Fri Dec 16 2022 kircher <majun65@huawei.com> - 1.0.1-33
- move select_thread_path after posix_api_init