From f46e5e9becd2bc76e8335f5e8247ba21713b9510 Mon Sep 17 00:00:00 2001 From: rainbow_0206 Date: Mon, 15 Oct 2018 16:49:26 +0800 Subject: Fix: nStackMain parameters should not be fixed Change-Id: I60d16736831fde5af6e657393195ca57242a6d3c Signed-off-by: rainbow_0206 --- .../common/base/include/common/common_mem_buf.h | 4 +++- .../common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c | 15 ++++---------- src/framework/lib_common_mem/common_buf.c | 24 ++++++++++++++++++++-- stacks/lwip_stack/release/script/nstack_fun.sh | 4 ++-- stacks/lwip_stack/release/script/nstack_var.sh | 2 +- 5 files changed, 32 insertions(+), 17 deletions(-) mode change 100644 => 100755 stacks/lwip_stack/release/script/nstack_fun.sh diff --git a/src/framework/common/base/include/common/common_mem_buf.h b/src/framework/common/base/include/common/common_mem_buf.h index f9f1593..c9bb9fd 100644 --- a/src/framework/common/base/include/common/common_mem_buf.h +++ b/src/framework/common/base/include/common/common_mem_buf.h @@ -20,6 +20,7 @@ #ifdef HAL_LIB #else +#include "nsfw_mem_api.h" #include "common_mem_base_type.h" #include "types.h" @@ -64,7 +65,8 @@ typedef struct __common_pal_module_info * @param name * The name of the buf pool. */ -int nscomm_pal_module_init (common_mem_pal_module_info * pinfo, u8 app_mode); +int nscomm_pal_module_init (nsfw_mem_para * para, + common_mem_pal_module_info * pinfo, u8 app_mode); void *nscomm_memzone_data_reserve_name (const char *name, size_t len, int socket_id); diff --git a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c index ba38c32..77ffd19 100644 --- a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c +++ b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c @@ -73,18 +73,11 @@ nsfw_shmem_init (nsfw_mem_para * para) NSCOMM_LOGINF ("nsfw shmem init begin"); - if (NSFW_PROC_MAIN == para->enflag) - { - iret = common_pal_module_init (NULL, app_mode); - } - else - { - LCORE_MASK_SET (rteinfo.ilcoremask, 1); - rteinfo.ucproctype = DMM_PROC_T_SECONDARY; - iret = common_pal_module_init (&rteinfo, app_mode); - } + LCORE_MASK_SET (rteinfo.ilcoremask, 1); + rteinfo.ucproctype = DMM_PROC_T_SECONDARY; + iret = common_pal_module_init (para, &rteinfo, app_mode); - if (NSFW_MEM_OK != iret) + if (DMM_MBUF_RET_OK != iret) { NSCOMM_LOGERR ("rte init fail] ret=0x%x", iret); return NSFW_MEM_ERR; diff --git a/src/framework/lib_common_mem/common_buf.c b/src/framework/lib_common_mem/common_buf.c index 9d9a127..d31ca83 100644 --- a/src/framework/lib_common_mem/common_buf.c +++ b/src/framework/lib_common_mem/common_buf.c @@ -88,7 +88,8 @@ int log_level = LOG_INFO; int -nscomm_pal_module_init (common_mem_pal_module_info * pinfo, u8 app_mode) +nscomm_pal_module_init (nsfw_mem_para * para, + common_mem_pal_module_info * pinfo, u8 app_mode) { char tempargv[PATA_NUM_MAX][PATA_STRLENT]; char *argv[PATA_NUM_MAX]; @@ -100,6 +101,12 @@ nscomm_pal_module_init (common_mem_pal_module_info * pinfo, u8 app_mode) int retVal; char name[10] = { '\0' }; + if (para == NULL) + { + NSCOMM_LOGERR ("para is null"); + return DMM_MBUF_RET_ERR; + } + retVal = MEMSET_S (tempargv, sizeof (tempargv), '\0', sizeof (tempargv)); if (EOK != retVal) { @@ -112,8 +119,21 @@ nscomm_pal_module_init (common_mem_pal_module_info * pinfo, u8 app_mode) NSCOMM_LOGERR ("MEMSET_S failed]ret=%d", retVal); return DMM_MBUF_RET_ERR; } - if (NULL == pinfo) + if (NSFW_PROC_MAIN == para->enflag) { + if (para->iargsnum != 0) + { + if (common_mem_pal_init (para->iargsnum, para->pargs) < 0) + { + COMMON_LOG_PRINT (LOG_ERR, "Cannot init pal\r\n"); + return DMM_MBUF_RET_ERR; + } + else + { + return DMM_MBUF_RET_OK; + } + } + PARA1_SET (argv, tempargv, agindex, "nStackMain"); PARA2_SET (argv, tempargv, agindex, "-c", "0x1"); PARA2_SET (argv, tempargv, agindex, "-n", "4"); diff --git a/stacks/lwip_stack/release/script/nstack_fun.sh b/stacks/lwip_stack/release/script/nstack_fun.sh old mode 100644 new mode 100755 index bb33a6a..5e16283 --- a/stacks/lwip_stack/release/script/nstack_fun.sh +++ b/stacks/lwip_stack/release/script/nstack_fun.sh @@ -332,10 +332,10 @@ run_nStackMain() log $LINENO "$env DPDK_TOOL_DIR=$DPDK_TOOL_DIR" log $LINENO "$env LD_LIBRARY_PATH=$LD_LIBRARY_PATH" log $LINENO "$env DPDK_LIB_PATH=$DPDK_LIB_PATH" - log $LINENO "./bin/nStackMain -c $1 -n 4 --huge-dir=$2 -m $3 stack -c $4 -sleep $5 -bind_cpu $6" + log $LINENO "./nStackMain -c $1 -n 4 --huge-dir=$2 --proc-type=primary --file-prefix nStackMain -m $3 stack -c $4 -sleep $5 -bind_cpu $6" check_file_size $DPDK_FILE cd ..; cd bin/ - ./nStackMain -c $1 -n 4 --huge-dir=$2 -m $3 stack -c $4 -sleep $5 -bind_cpu $6 >> $DPDK_FILE & + ./nStackMain -c $1 -n 4 --huge-dir=$2 --proc-type=primary --file-prefix nStackMain -m $3 stack -c $4 -sleep $5 -bind_cpu $6 >> $DPDK_FILE & } diff --git a/stacks/lwip_stack/release/script/nstack_var.sh b/stacks/lwip_stack/release/script/nstack_var.sh index 4c5c6f6..4fc5888 100644 --- a/stacks/lwip_stack/release/script/nstack_var.sh +++ b/stacks/lwip_stack/release/script/nstack_var.sh @@ -52,7 +52,7 @@ HUGE_PAGES=2048 HUGE_DIR=/mnt/nstackhuge SLEEP_INTERVAL=100 # tcpip thread sleep time, unit: us BIND_CPU=0 -MEM_SIZE=2048 +MEM_SIZE=3072 RTP_CORE_MASK=2 MASTER_EXEC_PATH="/product/gpaas/nStackMaster/bin" -- cgit 1.2.3-korg