1 Star 0 Fork 32

sky/gazelle_1

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0022-tools-gazelle_setup-adapt-non-ltran-mode.patch 7.20 KB
一键复制 编辑 原始数据 按行查看 历史
From 1ebdb7124823835cd29d62c8a81a0b8010c1d754 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Fri, 20 Oct 2023 19:44:52 +0800
Subject: [PATCH] tools: gazelle_setup adapt non ltran mode
---
tools/gazelle_common.sh | 40 ++++++++++++++++++++--------------------
tools/gazelle_setup.sh | 38 ++++++++++++++++++--------------------
2 files changed, 38 insertions(+), 40 deletions(-)
diff --git a/tools/gazelle_common.sh b/tools/gazelle_common.sh
index b4c011a..fac0d68 100644
--- a/tools/gazelle_common.sh
+++ b/tools/gazelle_common.sh
@@ -231,18 +231,18 @@ install_nic_mod() {
}
create_mnt_huge() {
- msg_show "Creating /mnt/hugepages and mounting as hugetlbfs"
- sudo mkdir -p /mnt/hugepages
- sudo mkdir -p /mnt/hugepages-2M
+ msg_show "Creating /mnt/hugepages-ltran and mounting as hugetlbfs"
+ sudo mkdir -p /mnt/hugepages-ltran
+ sudo mkdir -p /mnt/hugepages-lstack
- grep -s "/mnt/hugepages " /proc/mounts > /dev/null
+ grep -s "/mnt/hugepages-ltran " /proc/mounts > /dev/null
if [ $? -ne 0 ]; then
- sudo mount -t hugetlbfs nodev /mnt/hugepages
+ sudo mount -t hugetlbfs nodev /mnt/hugepages-ltran
fi
- grep -s "/mnt/hugepages-2M " /proc/mounts > /dev/null
+ grep -s "/mnt/hugepages-lstack " /proc/mounts > /dev/null
if [ $? -ne 0 ]; then
- sudo mount -t hugetlbfs nodev /mnt/hugepages-2M
+ sudo mount -t hugetlbfs nodev /mnt/hugepages-lstack
fi
}
@@ -285,21 +285,21 @@ set_numa_pages() {
# Removes all reserved hugepages.
clear_huge_pages() {
- msg_show "Unmounting /mnt/hugepages and removing directory"
- grep -s "/mnt/hugepages " /proc/mounts > /dev/null
+ msg_show "Unmounting /mnt/hugepages-ltran and removing directory"
+ grep -s "/mnt/hugepages-ltran " /proc/mounts > /dev/null
if [ $? -eq 0 ]; then
- sudo umount /mnt/hugepages
+ sudo umount /mnt/hugepages-ltran
if [ $? -ne 0 ]; then
- msg_err "sudo umount /mnt/hugepages failed!"
+ msg_err "sudo umount /mnt/hugepages-ltran failed!"
return 1
fi
fi
- grep -s "/mnt/hugepages-2M " /proc/mounts > /dev/null
+ grep -s "/mnt/hugepages-lstack " /proc/mounts > /dev/null
if [ $? -eq 0 ]; then
- sudo umount /mnt/hugepages-2M
+ sudo umount /mnt/hugepages-lstack
if [ $? -ne 0 ]; then
- msg_err "sudo umount /mnt/hugepages-2M failed!"
+ msg_err "sudo umount /mnt/hugepages-lstack failed!"
return 1
fi
fi
@@ -312,17 +312,17 @@ clear_huge_pages() {
sudo sh .echo_tmp
rm -f .echo_tmp
- if [ -d /mnt/hugepages ]; then
- sudo rm -R /mnt/hugepages
+ if [ -d /mnt/hugepages-ltran ]; then
+ sudo rm -R /mnt/hugepages-ltran
if [ $? -ne 0 ]; then
- msg_err "sudo rm -R /mnt/hugepages failed!"
+ msg_err "sudo rm -R /mnt/hugepages-ltran failed!"
return 1
fi
fi
- if [ -d /mnt/hugepages-2M ]; then
- sudo rm -R /mnt/hugepages-2M
+ if [ -d /mnt/hugepages-lstack ]; then
+ sudo rm -R /mnt/hugepages-lstack
if [ $? -ne 0 ]; then
- msg_err "sudo rm -R /mnt/hugepages failed!"
+ msg_err "sudo rm -R /mnt/hugepages-lstack failed!"
return 1
fi
fi
diff --git a/tools/gazelle_setup.sh b/tools/gazelle_setup.sh
index 014d333..c3ad830 100644
--- a/tools/gazelle_setup.sh
+++ b/tools/gazelle_setup.sh
@@ -66,8 +66,10 @@ show_usage() {
echo " [-l|--lowpower=<low power mode>]"
echo " [--ltrancore=<ltran core>]"
echo " [--lstackcore=<ltran core>]"
+ echo " [--useltran=<use ltran>]"
+ echo " [--listenshadow=<listen shadow>]"
echo "examples:"
- echo " $0 -i eth0 -n 1024,1024 -d 1/0 -k 1/0 -l 1/0 --ltrancore 0,1 --lstackcore 2-3"
+ echo " $0 -i eth0 -n 1024,1024 -d 1/0 -k 1/0 -l 1/0 --ltrancore 0,1 --lstackcore 2-3 --useltran 0/1 --listenshadow 0/1"
}
check_init() {
@@ -155,14 +157,13 @@ check_args() {
g_low_power=${g_low_power:-0}
check_switch_param $g_low_power
ret=$(($? + ret))
- g_useltran=${g_useltran:-1}
+ g_useltran=${g_useltran:-0}
check_switch_param $g_useltran
- g_listen_shadow=${g_listen_shadow:-0}
+ g_listen_shadow=${g_listen_shadow:-1}
check_switch_param $g_listen_shadow
ret=$(($? + ret))
g_ltrancore=${g_ltrancore:-0,1}
g_lstackcore=${g_lstackcore:-2}
- g_wakeupcpus=${g_lstackcore}
if [ $ret -eq 0 ]; then
msg_show "the args is reasonable..."
else
@@ -278,6 +279,12 @@ gen_lstack_conf() {
sed -i "/^gateway_addr/c gateway_addr=\"$g_gateway\"" $CONF_DIR/lstack.conf
sed -i "/^devices/c devices=\"$g_kni_mac\"" $CONF_DIR/lstack.conf
+ if [ ${g_useltran} -eq 0 ]; then
+ sed -i "/^kni_switch/c kni_switch = $g_kni_switch" $CONF_DIR/lstack.conf
+ else
+ sed -i "/^kni_switch/c kni_switch = 0" $CONF_DIR/lstack.conf
+ fi
+
shadow_exist=$(grep listen_shadow $CONF_DIR/lstack.conf)
if [ -n "${shadow_exist}" ];then
sed -i "/^listen_shadow/c listen_shadow = $g_listen_shadow" $CONF_DIR/lstack.conf
@@ -289,20 +296,15 @@ gen_lstack_conf() {
local old_lstackcore=$(grep num_cpus $CONF_DIR/lstack.conf | awk -F= '{print $2}' | awk -F "\"" '{print $2}')
sed -i "/^num_cpus/s/${old_lstackcore}/${g_lstackcore}/" $CONF_DIR/lstack.conf
- # wakeup_cpus
- local old_wakeupcpus=$(grep wakeup_cpus $CONF_DIR/lstack.conf | awk -F= '{print $2}' | awk -F "\"" '{print $2}')
- if [ -n "${g_wakeupcpus}" ]; then
- sed -i "/^wakeup_cpus/s/${old_wakeupcpus}/${g_wakeupcpus}/" $CONF_DIR/lstack.conf
- fi
-
local old_numa=$(grep dpdk_args $CONF_DIR/lstack.conf | awk -F "-socket-mem" '{print $2}' | awk '{print $2}' | awk -F "\"" '{print $2}')
old_numa="\"${old_numa}\","
sed -i "/^dpdk_args/s/${old_numa}/\"${g_hugepages}\",/" $CONF_DIR/lstack.conf
local cpu_count=$(parse_cpu_count ${g_lstackcore})
- local mbuf_pool_size=$(expr 200000 \* ${cpu_count} + 8192)
- sed -i "/^mbuf_pool_size/c mbuf_pool_size=${mbuf_pool_size}" $CONF_DIR/lstack.conf
+ tcp_conn_count=1500
+ mbuf_count_per_conn=$(expr 170 \* ${cpu_count})
- # export LSTACK_CONF_PATH=$CONF_DIR/lstack.conf
+ sed -i "/^tcp_conn_count/c tcp_conn_count=${tcp_conn_count}" $CONF_DIR/lstack.conf
+ sed -i "/^mbuf_count_per_conn/c mbuf_count_per_conn=${mbuf_count_per_conn}" $CONF_DIR/lstack.conf
}
gen_run_param() {
@@ -399,10 +401,6 @@ while true; do
g_lstackcore=$2
shift 2
;;
- --wakeupcpus)
- g_wakeupcpus=$2
- shift 2
- ;;
-h | --help)
show_usage
shift 1
@@ -458,8 +456,8 @@ gen_run_param
msg_show "-----------------"
msg_show "start dpdk"
setup_dpdk
-__chown /mnt/hugepages
-__chown /mnt/hugepages-2M
+__chown /mnt/hugepages-ltran
+__chown /mnt/hugepages-lstack
##############################################
# generate the conf file
@@ -504,7 +502,7 @@ fi
##############################################
# start ltran
if [ $g_useltran -eq 0 ];then
- msg_show "only gen lstack conf"
+ msg_show "gen lstack conf success"
exit 0
fi
msg_show "start ltran on $g_conn_if"
--
2.27.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/nlgwcy/gazelle_1.git
git@gitee.com:nlgwcy/gazelle_1.git
nlgwcy
gazelle_1
gazelle_1
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385