aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/build_dpdk1805.sh82
-rw-r--r--src/framework/common/base/include/common/common_mem_buf.h4
-rw-r--r--src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c15
-rw-r--r--src/framework/include/nstack_log.h14
-rw-r--r--src/framework/lib_common_mem/common_buf.c24
-rw-r--r--stacks/lwip_stack/lwip_src/api/spl_sbr.c6
-rw-r--r--stacks/lwip_stack/lwip_src/core/spl_pbuf.c2
-rw-r--r--stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c8
-rw-r--r--stacks/lwip_stack/lwip_src/netif/spl_hal.c22
-rwxr-xr-xstacks/lwip_stack/release/script/nstack_fun.sh4
-rwxr-xr-xstacks/lwip_stack/release/script/nstack_var.sh6
-rwxr-xr-xstacks/lwip_stack/release/upgrade_nstack.sh452
-rw-r--r--stacks/lwip_stack/src/io_adpt/dpdk.c100
13 files changed, 155 insertions, 584 deletions
diff --git a/scripts/build_dpdk1805.sh b/scripts/build_dpdk1805.sh
deleted file mode 100755
index 2727877..0000000
--- a/scripts/build_dpdk1805.sh
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/bin/bash -x
-#########################################################################
-#
-# Copyright (c) 2018 Huawei Technologies Co.,Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at:
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#########################################################################
-
-echo "check whether dpdk installed"
-cur_directory=${PWD}
-check_dpdk=$(rpm -qa | grep dpdk)
-if [ -z "$check_dpdk" ]; then
- echo "system will install the dpdk"
-else
- echo "system has installed the dpdk"
- echo "$check_dpdk"
- exit 0
-fi
-
-cd ~
-mkdir -p rpmbuild/SOURCES
-
-cd ~/rpmbuild/SOURCES
-
-if [ ! -s dpdk-18.05.tar.gz ]; then
-wget http://dpdk.org/browse/dpdk/snapshot/dpdk-18.05.tar.gz
-fi
-
-tar xzvf dpdk-18.05.tar.gz
-cp dpdk-18.05/pkg/dpdk.spec ~/rpmbuild/SOURCES/
-
-echo "modify the spec"
-
-#get rid of the dependence of texlive-collection
-sed -i '/BuildRequires: texlive-collection/s/^/#&/' dpdk.spec
-
-#delete something of generating doc
-sed -i '/%{target} doc/s/^/#&/' dpdk.spec
-sed -i '70d' dpdk.spec
-sed -i '69a datadir=%{_datadir}/dpdk' dpdk.spec
-sed -i '70a # datadir=%{_datadir}/dpdk docdir=%{_docdir}/dpdk' dpdk.spec
-sed -i '/%files doc/s/^/#&/' dpdk.spec
-sed -i '/%doc %{_docdir}/s/^/#&/' dpdk.spec
-
-sed -i '54a sed -i '\''s!CONFIG_RTE_EXEC_ENV=.*!CONFIG_RTE_EXEC_ENV=y!1'\'' config/common_base' dpdk.spec
-sed -i '55a sed -i '\''s!CONFIG_RTE_BUILD_SHARED_LIB=.*!CONFIG_RTE_BUILD_SHARED_LIB=y!1'\'' config/common_base' dpdk.spec
-sed -i '56a sed -i '\''s!CONFIG_RTE_LIBRTE_EAL=.*!CONFIG_RTE_LIBRTE_EAL=y!1'\'' config/common_base' dpdk.spec
-sed -i '57a sed -i '\''s!CONFIG_RTE_EAL_PMD_PATH=.*!CONFIG_RTE_EAL_PMD_PATH="/tmp/dpdk/drivers/"!1'\'' config/common_base' dpdk.spec
-sed -i '58a sed -i '\''s!CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=.*!CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=n!1'\'' config/common_base' dpdk.spec
-
-echo "build the dependence"
-#sudo yum-builddep -y dpdk.spec
-sudo yum install -y libpcap-devel python-sphinx inkscape kernel-devel-`uname -r` doxygen libnuma-devel kernel-`uname -r`
-
-
-echo "generate the rpm package"
-rpmbuild -ba dpdk.spec --define "_sourcedir ${PWD}"
-if [ $? -eq 0 ]; then
- echo "dpdk rpm build success"
-else
- echo "dpdk rpm build error"
- exit 1
-fi
-
-echo "install the rpm"
-cd ../RPMS/x86_64/
-sudo rpm -ivh dpdk-18.05-1.x86_64.rpm || exit 1
-sudo rpm -ivh dpdk-devel-18.05-1.x86_64.rpm || exit 1
-
-mkdir -p /tmp/dpdk/drivers/
-cp -f /usr/lib64/librte_mempool_ring.so /tmp/dpdk/drivers/
-
-cd ${cur_directory}
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/include/nstack_log.h b/src/framework/include/nstack_log.h
index 4e1ba81..9473aa4 100644
--- a/src/framework/include/nstack_log.h
+++ b/src/framework/include/nstack_log.h
@@ -318,11 +318,11 @@ extern int ctrl_log_switch;
#define NSMON_LOGWAR(fmt, ...) NS_LOGPID(MASTER,"NSMON",NSLOG_WAR,fmt,##__VA_ARGS__)
#define NSMON_LOGERR(fmt, ...) NS_LOGPID(MASTER,"NSMON",NSLOG_ERR,fmt,##__VA_ARGS__)
-#define NSPOL_LOGINF(debug,fmt, ...)NS_LOG_STACKX(debug,STACKX,"NSPOL",NSLOG_INF,fmt,##__VA_ARGS__)
-#define NSPOL_LOGDBG(debug,fmt, ...) NS_LOG_STACKX(debug,STACKX,"NSPOL",NSLOG_DBG,fmt,##__VA_ARGS__)
-#define NSPOL_LOGWAR(debug,fmt, ...) NS_LOG_STACKX(debug,STACKX,"NSPOL",NSLOG_WAR,fmt,##__VA_ARGS__)
-#define NSPOL_LOGERR(fmt, ...) NS_LOGPID(STACKX,"NSPOL",NSLOG_ERR,fmt,##__VA_ARGS__)
-#define NSPOL_LOGEMG(fmt, ...) NS_LOGPID(STACKX,"NSPOL",NSLOG_EMG,fmt,##__VA_ARGS__)
+#define NSPOL_LOGINF(debug,fmt, ...)NS_LOG_STACKX(debug,STACKX,"NSLWIP",NSLOG_INF,fmt,##__VA_ARGS__)
+#define NSPOL_LOGDBG(debug,fmt, ...) NS_LOG_STACKX(debug,STACKX,"NSLWIP",NSLOG_DBG,fmt,##__VA_ARGS__)
+#define NSPOL_LOGWAR(debug,fmt, ...) NS_LOG_STACKX(debug,STACKX,"NSLWIP",NSLOG_WAR,fmt,##__VA_ARGS__)
+#define NSPOL_LOGERR(fmt, ...) NS_LOGPID(STACKX,"NSLWIP",NSLOG_ERR,fmt,##__VA_ARGS__)
+#define NSPOL_LOGEMG(fmt, ...) NS_LOGPID(STACKX,"NSLWIP",NSLOG_EMG,fmt,##__VA_ARGS__)
#define NSOPR_LOGINF(fmt, ...) NS_LOGPID(OPERATION,"NSOPR",NSLOG_INF,fmt,##__VA_ARGS__)
#define NSOPR_LOGDBG(fmt, ...) NS_LOGPID(OPERATION,"NSOPR",NSLOG_DBG,fmt,##__VA_ARGS__)
@@ -403,10 +403,10 @@ extern int ctrl_log_switch;
} \
#define INITPOL_LOGINF(init_module_name, function, err_string, err_value, status) \
- INIT_LOG_ASSEM(STACKX,"NSPOL",NSLOG_INF,init_module_name , function, err_string, err_value, status)\
+ INIT_LOG_ASSEM(STACKX,"NSLWIP",NSLOG_INF,init_module_name , function, err_string, err_value, status)\
#define INITPOL_LOGERR(init_module_name, function, err_string, err_value, status) \
- INIT_LOG_ASSEM(STACKX,"NSPOL",NSLOG_ERR,init_module_name , function, err_string, err_value, status)\
+ INIT_LOG_ASSEM(STACKX,"NSLWIP",NSLOG_ERR,init_module_name , function, err_string, err_value, status)\
#define INITTCP_LOGINF(init_module_name , function, err_string, err_value, status) \
INIT_LOG_ASSEM(LOGTCP,"NSTCP",NSLOG_INF,init_module_name , function, err_string, err_value, status)\
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/lwip_src/api/spl_sbr.c b/stacks/lwip_stack/lwip_src/api/spl_sbr.c
index 4c510a5..4c1be2f 100644
--- a/stacks/lwip_stack/lwip_src/api/spl_sbr.c
+++ b/stacks/lwip_stack/lwip_src/api/spl_sbr.c
@@ -157,7 +157,7 @@ _do_send (data_com_msg * m)
msg_send_buf *_m = (msg_send_buf *) m->buffer;
if (cpcb == NULL)
{
- NS_LOG_CTRL (LOG_CTRL_SEND, STACKX, "NSPOL", NSLOG_ERR,
+ NS_LOG_CTRL (LOG_CTRL_SEND, STACKX, "NSLWIP", NSLOG_ERR,
"failed to find target pcb, drop the message]"
"module=%u, major=%u, minor=%u",
m->param.module_type,
@@ -192,7 +192,7 @@ _do_write (data_com_msg * m)
msg_write_buf *_m = (msg_write_buf *) m->buffer;
if ((tpcb == NULL) || (cpcb == NULL))
{
- NS_LOG_CTRL (LOG_CTRL_WRITE, STACKX, "NSPOL", NSLOG_ERR,
+ NS_LOG_CTRL (LOG_CTRL_WRITE, STACKX, "NSLWIP", NSLOG_ERR,
"failed to find target pcb, drop the message]"
"module=%u, major=%u, minor=%u",
m->param.module_type,
@@ -225,7 +225,7 @@ _do_recv (data_com_msg * m)
if ((tpcb == NULL) || (cpcb == NULL))
{
- NS_LOG_CTRL (LOG_CTRL_RECV, STACKX, "NSPOL", NSLOG_ERR,
+ NS_LOG_CTRL (LOG_CTRL_RECV, STACKX, "NSLWIP", NSLOG_ERR,
"failed to find target pcb, drop the message]"
"module=%u, major=%u, minor=%u",
m->param.module_type,
diff --git a/stacks/lwip_stack/lwip_src/core/spl_pbuf.c b/stacks/lwip_stack/lwip_src/core/spl_pbuf.c
index 54589e8..e4aa014 100644
--- a/stacks/lwip_stack/lwip_src/core/spl_pbuf.c
+++ b/stacks/lwip_stack/lwip_src/core/spl_pbuf.c
@@ -89,7 +89,7 @@ spl_pbuf_alloc_hugepage (spl_pbuf_layer layer, u16_t length,
{
/* last_log_prt_time and unprint_log_count indeed have multi-thread issue,
* but their values don't have precision requirement. No risk. */
- NS_LOG_CTRL (LOG_CTRL_HUGEPAGE_ALLOC_FAIL, STACKX, "NSPOL", NSLOG_ERR,
+ NS_LOG_CTRL (LOG_CTRL_HUGEPAGE_ALLOC_FAIL, STACKX, "NSLWIP", NSLOG_ERR,
"pbuf_alloc_huge: Could not allocate PBUF for SPL_PBUF_HUGE");
return NULL;
diff --git a/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c b/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c
index 03b5998..e2334ea 100644
--- a/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c
+++ b/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c
@@ -996,13 +996,13 @@ int
init_configuration_reader ()
{
int error_number = 0;
- INITPOL_LOGINF ("RTP", "init_configuration_reader", NULL_STRING,
+ INITPOL_LOGINF ("CONFIGURATION", "init_configuration_reader", NULL_STRING,
LOG_INVALID_VALUE, MODULE_INIT_START);
g_config_data = &g_ip_module_buff;
if (init_ip_module_unix_socket_path () < 0)
{
- INITPOL_LOGERR ("RTP", "init_configuration_reader",
+ INITPOL_LOGERR ("CONFIGURATION", "init_configuration_reader",
"Error when init path", LOG_INVALID_VALUE,
MODULE_INIT_FAIL);
return -1;
@@ -1012,7 +1012,7 @@ init_configuration_reader ()
if (listen_fd < 0)
{
error_number = errno;
- INITPOL_LOGERR ("RTP", "init_configuration_reader",
+ INITPOL_LOGERR ("CONFIGURATION", "init_configuration_reader",
"when listening ip_module_unix_socket", error_number,
MODULE_INIT_FAIL);
return -1;
@@ -1027,7 +1027,7 @@ init_configuration_reader ()
return -1;
}
- INITPOL_LOGINF ("RTP", "init_configuration_reader", NULL_STRING,
+ INITPOL_LOGINF ("CONFIGURATION", "init_configuration_reader", NULL_STRING,
LOG_INVALID_VALUE, MODULE_INIT_SUCCESS);
return 0;
}
diff --git a/stacks/lwip_stack/lwip_src/netif/spl_hal.c b/stacks/lwip_stack/lwip_src/netif/spl_hal.c
index c7cfca1..596962e 100644
--- a/stacks/lwip_stack/lwip_src/netif/spl_hal.c
+++ b/stacks/lwip_stack/lwip_src/netif/spl_hal.c
@@ -379,7 +379,7 @@ spl_hal_port_zone_init ()
nsfw_mem_zone create_port_zone;
nsfw_mem_zone create_port_info;
struct stackx_port_info *mz_port_info;
- INITPOL_LOGINF ("RTP", "spl_hal_port_zone_init", NULL_STRING,
+ INITPOL_LOGINF ("HAL", "spl_hal_port_zone_init", NULL_STRING,
LOG_INVALID_VALUE, MODULE_INIT_START);
if ((CUR_CFG_HAL_PORT_NUM < 1)
@@ -408,7 +408,7 @@ spl_hal_port_zone_init ()
if (NULL == p_stackx_port_zone)
{
- INITPOL_LOGERR ("RTP", "spl_hal_port_zone_init",
+ INITPOL_LOGERR ("HAL", "spl_hal_port_zone_init",
"Cannot create memory zone for MP_STACKX_PORT_ZONE information",
LOG_INVALID_VALUE, MODULE_INIT_FAIL);
common_exit (EXIT_FAILURE,
@@ -421,7 +421,7 @@ spl_hal_port_zone_init ()
if (EOK != retVal)
{
- INITPOL_LOGERR ("RTP", "spl_hal_port_zone_init", "MEMSET_S return fail",
+ INITPOL_LOGERR ("HAL", "spl_hal_port_zone_init", "MEMSET_S return fail",
retVal, MODULE_INIT_FAIL);
nsfw_mem_zone_release (&create_port_zone.stname);
return -1;
@@ -445,7 +445,7 @@ spl_hal_port_zone_init ()
if (NULL == mz_port_info)
{
- INITPOL_LOGERR ("RTP", "spl_hal_port_zone_init",
+ INITPOL_LOGERR ("HAL", "spl_hal_port_zone_init",
"Cannot create memory zone for MP_STACKX_PORT_INFO information",
LOG_INVALID_VALUE, MODULE_INIT_FAIL);
common_exit (EXIT_FAILURE,
@@ -458,7 +458,7 @@ spl_hal_port_zone_init ()
if (EOK != retVal)
{
- INITPOL_LOGERR ("RTP", "spl_hal_port_zone_init", "MEMSET_S return fail",
+ INITPOL_LOGERR ("HAL", "spl_hal_port_zone_init", "MEMSET_S return fail",
retVal, MODULE_INIT_FAIL);
nsfw_mem_zone_release (&create_port_info.stname);
nsfw_mem_zone_release (&create_port_zone.stname);
@@ -470,7 +470,7 @@ spl_hal_port_zone_init ()
p_stackx_port_zone->stackx_one_port = mz_port_info;
- INITPOL_LOGINF ("RTP", "spl_hal_port_zone_init", NULL_STRING,
+ INITPOL_LOGINF ("HAL", "spl_hal_port_zone_init", NULL_STRING,
LOG_INVALID_VALUE, MODULE_INIT_SUCCESS);
return 0;
@@ -495,7 +495,7 @@ spl_hal_init (int argc, char *argv[])
/* Init DPDK */
argc = uStackArgIndex--;
- INITPOL_LOGINF ("RTP", "hal_init_global", NULL_STRING, LOG_INVALID_VALUE,
+ INITPOL_LOGINF ("HAL", "hal_init_global", NULL_STRING, LOG_INVALID_VALUE,
MODULE_INIT_START);
for (idx_init = 0; idx_init < argc; idx_init++)
@@ -1326,7 +1326,7 @@ spl_hal_port_setup ()
unsigned int i;
struct stackx_port_info *p_port_info = NULL;
- INITPOL_LOGINF ("RTP", "spl_hal_port_setup", NULL_STRING, LOG_INVALID_VALUE,
+ INITPOL_LOGINF ("HAL", "spl_hal_port_setup", NULL_STRING, LOG_INVALID_VALUE,
MODULE_INIT_START);
for (i = num_ports_NIC_start; i < num_ports_NIC; i++)
@@ -1337,7 +1337,7 @@ spl_hal_port_setup ()
{
NSPOL_LOGERR ("Error initialising]nic_id=%u", i);
- INITPOL_LOGERR ("RTP", "spl_hal_port_setup", NULL_STRING,
+ INITPOL_LOGERR ("HAL", "spl_hal_port_setup", NULL_STRING,
LOG_INVALID_VALUE, MODULE_INIT_FAIL);
return -1;
@@ -1353,7 +1353,7 @@ spl_hal_port_setup ()
{
NSPOL_LOGERR ("bond port init failed!");
- INITPOL_LOGERR ("RTP", "spl_hal_port_setup", NULL_STRING,
+ INITPOL_LOGERR ("HAL", "spl_hal_port_setup", NULL_STRING,
LOG_INVALID_VALUE, MODULE_INIT_FAIL);
return -1;
@@ -1361,7 +1361,7 @@ spl_hal_port_setup ()
spl_hal_capa_init ();
- INITPOL_LOGINF ("RTP", "spl_hal_port_setup", NULL_STRING, LOG_INVALID_VALUE,
+ INITPOL_LOGINF ("HAL", "spl_hal_port_setup", NULL_STRING, LOG_INVALID_VALUE,
MODULE_INIT_SUCCESS);
return 0;
diff --git a/stacks/lwip_stack/release/script/nstack_fun.sh b/stacks/lwip_stack/release/script/nstack_fun.sh
index bb33a6a..5e16283 100755
--- 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..9a1c612 100755
--- a/stacks/lwip_stack/release/script/nstack_var.sh
+++ b/stacks/lwip_stack/release/script/nstack_var.sh
@@ -26,10 +26,10 @@ DPDK_FILE_NAME=nstack_dpdk.log
export VM_ID=agent-node-x
-export DPDK_INSTALL_PATH="/tmp/dpdk/dpdk-18.02/"
+export DPDK_INSTALL_PATH="/usr/share/dpdk/"
export DPDK_LIB_PATH=${DPDK_INSTALL_PATH}/x86_64-native-linuxapp-gcc/lib
export DPDK_TOOL_DIR=${DPDK_INSTALL_PATH}/usertools
-export DPDK_MOD_PATH=${DPDK_INSTALL_PATH}/x86_64-native-linuxapp-gcc/kmod
+export DPDK_MOD_PATH=/usr/lib/modules/`uname -r`/extra/dpdk
cur_user=`whoami`
if [ "root" != "${cur_user}" ]
@@ -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"
diff --git a/stacks/lwip_stack/release/upgrade_nstack.sh b/stacks/lwip_stack/release/upgrade_nstack.sh
deleted file mode 100755
index 9302da6..0000000
--- a/stacks/lwip_stack/release/upgrade_nstack.sh
+++ /dev/null
@@ -1,452 +0,0 @@
-#!/bin/bash
-
-. ./script/nstack_var.sh
-. ./script/nstack_fun.sh
-
-VERSION_CHK=0
-UPG_MASTER=0
-
-# OLD_VERSION indicates the nStackServer version, in order to support Version upgrade and rollback feature
-# OLD_VERSION=1 B031~newest
-# OLD_VERSION=0 B020~B030
-OLD_VERSION=1
-cur_user=`whoami`
-
-upg_pre_chk()
-{
- ##########check input info###########################
- if [ -z "${DST_VER_PATH}" ]; then
- log $LINENO "dst ${DST_VER_PATH} path error!"
- return 1
- fi
-
- if [ "x${UPG_RBK}" != "x1" -a "x${UPG_RBK}" != "x2" ]; then
- log $LINENO "type error ${UPG_RBK}!"
- return 1
- fi
-
- ##########check src version info######################
- SRC_STOP_FILE=${SRC_VER_PATH}/stop_nstack.sh
- if [ ! -f "$SRC_STOP_FILE" ]; then
- log $LINENO "${SRC_STOP_FILE} path error!"
- return 1
- fi
-
- MASTER_PATH=`get_nstack_bin nStackMaster`
- if [ -z "${MASTER_PATH}" ]; then
- log $LINENO "master not start"
- return 1
- fi
-
- if [ ! -d "${MASTER_PATH}${MASTERBIN}" ]; then
- log $LINENO "${MASTER_PATH} path error!"
- return 1
- fi
-
- SRC_VERSION=`get_version 1`
- if [ -z "${SRC_VERSION}" ]; then
- log $LINENO "get srcVersion error"
- exit 1
- fi
-
- ###########check dst version info######################
- DST_RUN_FILE=${DST_VER_PATH}/script/run_nstack_main.sh
- if [ ! -f "$DST_RUN_FILE" ]; then
- log $LINENO "${DST_RUN_FILE} path error. Try the path of older nstack version then."
- DST_RUN_FILE=${DST_VER_PATH}/bin/run_nstack_main.sh
- OLD_VERSION=0
- if [ ! -f "$DST_RUN_FILE" ]; then
- log $LINENO "${DST_RUN_FILE} older path error!"
- return 1
- fi
- fi
-
- DST_STOP_FILE=${DST_VER_PATH}/stop_nstack.sh
- if [ ! -f "$DST_STOP_FILE" ]; then
- log $LINENO "${DST_STOP_FILE} path error!"
- return 1
- fi
-
- DST_STAT_FILE=${DST_VER_PATH}/start_nstack.sh
- if [ ! -f "$DST_STAT_FILE" ]; then
- log $LINENO "${DST_STAT_FILE} path error!"
- return 1
- fi
-
- if [ ! -x "${DST_VER_PATH}/bin/nStackCtrl" ]; then
- log $LINENO "${DST_VER_PATH} path nStackCtrl exec error!"
- return 1
- fi
-
- DST_VERSION=`get_version 4 ${DST_VER_PATH}/bin/nStackCtrl`
- if [ -z "${DST_VERSION}" ]; then
- log $LINENO "get dstversion error"
- return 1
- fi
-}
-
-restart_upgrade()
-{
- local monipid=`pidof monit`
- local stop_moni=0
- if [ ! -z "${monipid}" ]; then
- for i in `seq 60`
- do
- if [ ${cur_user} = "paas" ]; then
- stop_fin=`/var/ICTS_BASE/Monit/bin/monit summary | grep nstack | grep "Not monitored"`
- else
- stop_fin=`su paas -s /bin/bash -c "/var/ICTS_BASE/Monit/bin/monit summary" | grep nstack | grep "Not monitored"`
- fi
- if [ -n "${stop_fin}" ]; then
- break;
- fi
-
- if [ $stop_moni -eq 0 ]; then
- if [ ${cur_user} = "paas" ]; then
- /var/ICTS_BASE/Monit/bin/monit unmonitor nstack
- else
- su paas -s /bin/bash -c "/var/ICTS_BASE/Monit/bin/monit unmonitor nstack"
- fi
- stop_moni=1
- log $LINENO "stop monit"
- fi
-
- sleep 1
- done
- cd ${SRC_VER_PATH}
- ./stop_nstack.sh
- cd -
- cd ${DST_VER_PATH}
- if [ -n "${LOG_PATH}" ]; then
- ./start_nstack.sh -l $LOG_PATH -i $hostinfo_path
- else
- ./start_nstack.sh -i $hostinfo_path
- fi
- cd -
-
- log $LINENO "with monit restart"
- if [ $stop_moni -eq 1 ]; then
- if [ ${cur_user} = "paas" ]; then
- /var/ICTS_BASE/Monit/bin/monit monitor nstack
- else
- su paas -s /bin/bash -c "/var/ICTS_BASE/Monit/bin/monit monitor nstack"
- fi
- log $LINENO "monit restart"
- fi
- else
- cd ${SRC_VER_PATH}
- ./stop_nstack.sh
- cd -
- cd ${DST_VER_PATH}
- if [ -n "${LOG_PATH}" ]; then
- ./start_nstack.sh -l $LOG_PATH -i $hostinfo_path
- else
- ./start_nstack.sh -i $hostinfo_path
- fi
- cd -
- log $LINENO "none monit restart"
- fi
- return 0
-}
-
-run_upgrade()
-{
-
- if [ -n "${DST_RUN_FILE}" ]; then
- if [ $OLD_VERSION -ge 1 ]; then
- ln -s -f "$DST_RUN_FILE" "${DST_VER_PATH}/script/${RUN_NSTACK_FILE}"
- else
- ln -s -f "$DST_RUN_FILE" "${DST_VER_PATH}/bin/${RUN_NSTACK_FILE}"
- fi
- if [ $? -ne 0 ]; then
- log $LINENO "dst version link failed!"
- return 1
- fi
- fi
-
- # copy old config to avoid config change issue
- copy_config $SRC_VER_PATH $DST_VER_PATH
-
- ./bin/nStackCtrl --module vermgr -t $UPG_RBK -s $SRC_VERSION -d $DST_VERSION
- ret=$?
- if [ $ret -eq 121 ]; then
- restart_upgrade
- WAIT_TIME=50
- RESTART_MASTER=1
- return 0
- fi
-
- if [ $ret -ne 0 ]; then
- log $LINENO "nStackCtrl send vermsg err $ret code"
- return 1
- fi
-
- nStackMain_pid=`pidof nStackMain`
- if [ -n "${DST_RUN_FILE}" ]; then
- ln -s -f "$DST_RUN_FILE" "${MASTER_PATH}${RUN_NSTACK_FILE}"
- if [ $? -ne 0 ]; then
- log $LINENO "link failed!"
- kill -9 $nStackMain_pid
- return 1
- fi
- fi
- kill -9 $nStackMain_pid
- return 0
-}
-
-after_upg_chk()
-{
- for i in `seq $WAIT_TIME`
- do
- NEW_DST_VERSION=`get_version 1`
- if [ -n "${NEW_DST_VERSION}" ]; then
- if [ "$NEW_DST_VERSION" != "$DST_VERSION" ]; then
- log $LINENO "new version:$NEW_DST_VERSION maybe error! expect version is:$DST_VERSION"
- else
- break;
- fi
- fi
- sleep 1
- done
-
- if [ -z "${NEW_DST_VERSION}" ]; then
- log $LINENO "nStackCtrl get dstVersion error"
- return 1
- fi
-
- if [ "$NEW_DST_VERSION" != "$DST_VERSION" -a $VERSION_CHK -eq 1 ]; then
- log $LINENO "new version:$NEW_DST_VERSION maybe error! expect version is:$DST_VERSION"
- return 1
- fi
-
- DST_MAIN_PATH=`get_nstack_bin nStackMain`
- if [ -z "${DST_MAIN_PATH}" ]; then
- log $LINENO "main not start"
- return 1
- fi
-
- if [ "$DST_MAIN_PATH" != "${DST_VER_PATH}/bin/" ]; then
- log $LINENO "main start failed run;$DST_MAIN_PATH expect:${DST_VER_PATH}/script !"
- return 1
- fi
-}
-
-
-run_upgrade_master()
-{
- core_mask=`get_core_mask`
- START_TYPE="secondary"
- ./bin/nStackCtrl --module vermgr -t $UPG_RBK -s $SRC_VERSION -d $DST_VERSION -p 2
- ret=$?
- if [ $ret -ne 0 ]; then
- log $LINENO "nStackMaster nStackCtrl send vermsg err $ret code"
- return 1
- fi
-
- nStackMaster_pid=`pidof nStackMaster`
- kill -9 $nStackMaster_pid
- cd ${DST_VER_PATH}/script/
- ./run_nstack_master.sh ${core_mask} $HUGE_DIR $MEM_SIZE $START_TYPE
- log $LINENO "./script/run_nstack_master.sh ${core_mask} $HUGE_DIR $MEM_SIZE $START_TYPE"
- cd -
- return 0
-}
-
-
-after_upg_master_chk()
-{
- for i in `seq 10`
- do
- NEW_MAS_VERSION=`get_version 2`
- if [ -n "${NEW_MAS_VERSION}" ]; then
- if [ "$NEW_MAS_VERSION" != "$DST_VERSION" ]; then
- log $LINENO "new version:$NEW_MAS_VERSION maybe error! expect version is:$DST_VERSION"
- else
- break;
- fi
- fi
- sleep 1
- done
-
- if [ -z "${NEW_MAS_VERSION}" ]; then
- log $LINENO "nStackCtrl get dstVersion error"
- return 1
- fi
-
- if [ "$NEW_MAS_VERSION" != "$DST_VERSION" -a $VERSION_CHK -eq 1 ]; then
- log $LINENO "new version:$NEW_MAS_VERSION maybe error! expect version is:$DST_VERSION"
- return 1
- fi
-
- DST_MAS_PATH=`get_nstack_bin nStackMaster`
- if [ -z "${DST_MAS_PATH}" ]; then
- log $LINENO "master not start"
- return 1
- fi
-
- if [ "$DST_MAS_PATH" != "${DST_VER_PATH}/script/" ]; then
- log $LINENO "main start failed run;$DST_MAS_PATH expect:${DST_VER_PATH}/script !"
- return 1
- fi
- return 0
-}
-
-opr_suc()
-{
- log $LINENO "operation successful $SRC_VERSION to $NEW_DST_VERSION"
-}
-
-mod_log_path()
-{
- local dst_proc=$1
- local dst_log_path=$2
- ./bin/nStackCtrl --module setlog -n maspath -v ${dst_log_path} -p $dst_proc
- ret=$?
- if [ $ret -ne 0 ]; then
- log $LINENO "mod_log_path error err $ret code"
- return 1
- fi
- return 0
-}
-
-ini_file_path="invalid_path_upgrade"
-
-while getopts 's:d:t:l:i:' opt
-do
- case $opt in
- s)
- SRC_VER_PATH=`get_abs_path $OPTARG`
- ;;
- :)
- echo "-$OPTARG needs an argument"
- exit 1
- ;;
- d)
- DST_VER_PATH=`get_abs_path $OPTARG`
- ;;
- :)
- echo "-$OPTARG needs an argument"
- exit 1
- ;;
- t)
- UPG_RBK=$OPTARG
- ;;
- :)
- echo "-$OPTARG needs an argument"
- exit 1
- ;;
- l)
- LOG_PATH=`get_abs_path $OPTARG`
- ;;
- :)
- echo "-$OPTARG needs an argument"
- exit 1
- ;;
- i)
- ini_file_path=`get_abs_path $OPTARG`
- ;;
- :)
- echo "-$OPTARG needs an argument"
- exit 1
- ;;
- *)
- echo "command not recognized"
- usage
- exit 1
- ;;
- esac
-done
-
-if [ -z $ini_file_path ]; then
- hostinfo_path="invalid_path_upgrade"
- else
- hostinfo_path=$ini_file_path
-fi
-
-(
-flock -e -n 201
-if [ $? -eq 1 ]
-then
- log $LINENO "another upgrade process is running now, exit"
- exit 1
-fi
-
-if [ -n "${LOG_PATH}" ]; then
- modify_nstack_log_path ${LOG_PATH}
-fi
-modify_log_var
-) 201>>./uplockfile
-
-if [ -f "uplockfile" ]; then
- rm uplockfile
-fi
-
-. ./script/nstack_var.sh
-
-RESTART_MASTER=0
-WAIT_TIME=60
-
-log $LINENO "######################upgrade nstack######################"
-log $LINENO "src ver path ${SRC_VER_PATH},dst ver path ${DST_VER_PATH}, type ${UPG_RBK}, log path ${LOG_PATH}"
-
-upg_pre_chk
-ret=$?
-if [ $ret -ne 0 ]; then
- log $LINENO "pre_chk error err $ret code"
- exit 1
-fi
-
-if [ "${DST_VERSION}" = "${SRC_VERSION}" -a $VERSION_CHK -eq 1 ]; then
- log $LINENO "version equal ${DST_VERSION} ${SRC_VERSION}"
- exit 0
-fi
-log $LINENO "prepare ok"
-
-log $LINENO "src ver $SRC_VERSION with master path $MASTER_PATH,dst ver $DST_VERSION,dst run file $DST_RUN_FILE, type ${UPG_RBK}"
-run_upgrade
-ret=$?
-if [ $ret -ne 0 ]; then
- log $LINENO "run_proc error err $ret code"
- exit 1
-fi
-
-log $LINENO "wait new version start"
-sleep 2
-after_upg_chk
-ret=$?
-if [ $ret -ne 0 ]; then
- log $LINENO "after_chk error err $ret code"
- exit 1
-fi
-
-if [ $RESTART_MASTER -ne 0 ]; then
- log $LINENO "master has restart!"
- opr_suc
- exit 0
-fi
-
-if [ $UPG_MASTER -eq 0 ]; then
- if [ -n "${LOG_PATH}" ]; then
- mod_log_path 2 ${LOG_PATH}
- fi
- opr_suc
- exit 0
-fi
-
-run_upgrade_master
-ret=$?
-if [ $ret -ne 0 ]; then
- log $LINENO "run_proc master error err $ret code"
- exit 1
-fi
-
-log $LINENO "wait new version master start"
-sleep 2
-after_upg_master_chk
-ret=$?
-if [ $ret -ne 0 ]; then
- log $LINENO "after_chk master error err $ret code"
- exit 1
-fi
-
-opr_suc
diff --git a/stacks/lwip_stack/src/io_adpt/dpdk.c b/stacks/lwip_stack/src/io_adpt/dpdk.c
index da2cfb6..d199513 100644
--- a/stacks/lwip_stack/src/io_adpt/dpdk.c
+++ b/stacks/lwip_stack/src/io_adpt/dpdk.c
@@ -191,6 +191,82 @@ NSTACK_STATIC struct rte_eth_conf port_conf_default_bond = {
};
/*****************************************************************************
+* Prototype : dpdk_mbuf_to_file
+* Description : write the packet data into a file
+* Input : uint16_t pkt_number
+* struct rte_mbuf **pkts
+* Output : None
+* Return Value :
+* Calls :
+* Called By :
+*
+*****************************************************************************/
+NSTACK_STATIC void
+dpdk_mbuf_to_file (uint16_t pkt_number, struct rte_mbuf **pkts)
+{
+ char line[100] = { 0 };
+ FILE *f = NULL;
+ struct rte_mbuf *p = NULL;
+ uint16_t len = 0, offset, i;
+ uint16_t pktlen = 0;
+ uint16_t start = 0;
+ uint16_t number = 0;
+ unsigned char *data = NULL;
+
+ f = fopen ("/var/log/nStack/packet.txt", "a+");
+ if (f == NULL)
+ {
+ NSHAL_LOGERR ("can not open the file:%s", "packet.txt");
+ return;
+ }
+
+ for (i = 0; i < pkt_number; i++)
+ {
+ pktlen = 0;
+ p = pkts[i];
+ while (p)
+ {
+ len = 0;
+ data = rte_pktmbuf_mtod (p, unsigned char *);
+ while (len < p->data_len)
+ {
+ start = pktlen % 16; /* start of the line */
+ if (start == 0)
+ {
+ number = SNPRINTF_S (line, sizeof (line), sizeof (line) - 1,
+ "%08X", len);
+ }
+
+ for (offset = 0;
+ ((offset + start) < 16) && ((len + offset) < p->data_len);
+ offset++)
+ {
+ number +=
+ SNPRINTF_S (line + number, sizeof (line),
+ sizeof (line) - 1, " %02X",
+ data[len + offset]);
+ }
+
+ fprintf (f, "%s", line);
+ if ((offset + start) == 16)
+ fprintf (f, "\n");
+
+ len += offset;
+ pktlen += offset;
+ (void) MEMSET_S (line, sizeof (line), 0, sizeof (line));
+ }
+
+ p = p->next;
+
+ }
+ fprintf (f, "\n");
+ }
+
+ fclose (f);
+ return;
+}
+
+/*****************************************************************************
* Prototype : hal_rte_eth_rx_burst
* Description : a copy of rte_eth_rx_burst, because this function invokes
a global(rte_eth_devices), which cannt be access by dlsym
@@ -207,13 +283,13 @@ NSTACK_STATIC struct rte_eth_conf port_conf_default_bond = {
*****************************************************************************/
NSTACK_STATIC inline uint16_t
hal_rte_eth_rx_burst (uint8_t port_id, uint16_t queue_id,
- struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
+ struct rte_mbuf ** rx_pkts, const uint16_t nb_pkts)
{
#ifdef RTE_ETHDEV_RXTX_CALLBACKS
struct rte_eth_rxtx_callback *cb;
#endif
int16_t nb_rx;
-
+ char *pst_capture_packet = NULL;
struct rte_eth_dev *dev = &rte_eth_devices[port_id];
if (NULL == dev->rx_pkt_burst)
@@ -250,6 +326,11 @@ hal_rte_eth_rx_burst (uint8_t port_id, uint16_t queue_id,
}
#endif
+ //pst_capture_packet = getenv ("NSTACK_CAPTURE_PACKET");
+ if (pst_capture_packet && strcmp (pst_capture_packet, "1") == 0)
+ {
+ dpdk_mbuf_to_file (nb_rx, rx_pkts);
+ }
return (uint16_t) nb_rx;
}
@@ -274,7 +355,8 @@ hal_rte_eth_tx_burst (uint8_t port_id, uint16_t queue_id,
#ifdef RTE_ETHDEV_RXTX_CALLBACKS
struct rte_eth_rxtx_callback *cb;
#endif
-
+ int16_t nb_tx = 0;
+ char *pst_capture_packet = NULL;
struct rte_eth_dev *dev = &rte_eth_devices[port_id];
if (NULL == dev->tx_pkt_burst)
@@ -309,8 +391,16 @@ hal_rte_eth_tx_burst (uint8_t port_id, uint16_t queue_id,
}
#endif
- return (*dev->tx_pkt_burst) (dev->data->tx_queues[queue_id], tx_pkts,
- nb_pkts);
+ nb_tx = (*dev->tx_pkt_burst) (dev->data->tx_queues[queue_id], tx_pkts,
+ nb_pkts);
+
+ //pst_capture_packet = getenv ("NSTACK_CAPTURE_PACKET");
+ if (pst_capture_packet && strcmp (pst_capture_packet, "1") == 0)
+ {
+ dpdk_mbuf_to_file (nb_tx, tx_pkts);
+ }
+
+ return nb_tx;
}
/*****************************************************************************