diff options
-rw-r--r-- | doc/DMM_DeveloperManual.md | 22 | ||||
-rwxr-xr-x | scripts/build.sh | 64 | ||||
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/framework/include/nstack_log.h | 6 |
4 files changed, 50 insertions, 44 deletions
diff --git a/doc/DMM_DeveloperManual.md b/doc/DMM_DeveloperManual.md index 4032172..22fba2b 100644 --- a/doc/DMM_DeveloperManual.md +++ b/doc/DMM_DeveloperManual.md @@ -226,8 +226,8 @@ When the protocol stack(a.k.a stackx) is integrated into DMM, there are some cha to be done in DMM. These are as follows: The first step is adding new protocol stack module information into DMM. This information can be -pushed to DMM using command line interface and **g\_nstack\_module\_desc** -will store these configuration information, e.g. registration function name, lib path, etc. +registed to DMM and **g\_nstack\_module\_desc** will store these configuration information, +e.g. registration function name, lib path, etc. ``` @@ -418,7 +418,7 @@ Below are the details of hook functions provided by protocol stack. ###**ep\_ctl** ``` -int (*ep_ctl)(int proFD, int ctl_ops, struct epoll_event *event, void *pdata);` +unsigned int (*ep_ctl) (int epFD, int proFD, int ctl_ops, struct epoll_event * event, void *pdata); ``` **Description:** @@ -442,7 +442,7 @@ value to the protocol stack event notification API when an event occurs. **Interface Definition:** ``` -void (*ep_getevt)(int epFD, int profd, unsigned int events); +unsigned int (*ep_getevt) (int epFD, int profd, unsigned int events); ``` **Description:** @@ -791,7 +791,7 @@ u8 nsfw_recycle_reg_fun (u16 rec_type, nsfw_recycle_fun fun); typedef nsfw_rcc_stat (*nsfw_recycle_fun) (u32 exit_pid, void *pdata, u16 rec_type); -``` +``` This function will be called when APP process exit notification will be send to StackX process. ###**4.2.7 nRD** @@ -814,7 +814,7 @@ typedef struct __nstack_rd_stack_info int stack_id; /*when route info not found, high priority stack was chose, same priority chose fist input one */ int priority; /*0: highest: route info not found choose first */ -} nstack_rd_stack_info; +} nstack_rd_stack_info; /*rd local data*/ typedef struct __rd_local_data { @@ -996,11 +996,11 @@ stack itself. The standard socket APIs defined by DMM are as follows: int epoll\_ctl(int, int, int, struct epoll\_event \*) | same as corresponding POSIX apis int epoll\_wait(int, struct epoll\_event \*, int, int) | same as corresponding POSIX apis pid\_t fork(void) | Before/after calling base fork() need to handle other processing like ref\_count etc. - + **6. Log & Debug**<br> ============================ -nStack uses GLOG framework to provide multi level logs. Supported log levels are debug, info, -warning, error and emergency. Logs will be stored at /product/gpaas/log/nStack. To enable log, +nStack uses GLOG framework to provide multi level logs. Supported log levels are debug, info, +warning, error and emergency. Logs will be stored at /product/gpaas/log/nStack. To enable log, need to set the environment variables NSTACK\_LOG\_ON ``` export NSTACK_LOG_ON=DBG @@ -1017,7 +1017,7 @@ struct nstack_logs struct nstack_logs g_nstack_logs[MAX_LOG_MODULE] = { {0, 0, 0, 0}, {0xFFFF, 0, 0, 0} }; /* Clear compile warning */ -Module types: +Module types: typedef enum _LOG_MODULE { NSOCKET = 1, @@ -1048,4 +1048,4 @@ export NSTACK_LOG_FILE_FLAG=1 Also we can memntioned the file name for App log. ``` export NSTACK_APP_LOG_PATH=/path_to_log -```
\ No newline at end of file +``` diff --git a/scripts/build.sh b/scripts/build.sh index 806b616..4224535 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -74,13 +74,6 @@ elif [ "$OS_ID" == "opensuse" ]; then sudo yum install -y git cmake gcc g++ automake libtool wget lsof lshw pciutils net-tools tcpdump vim sudo yum-utils pcre-devel zlib-devel fi -#set and check env -sudo sysctl -w vm.nr_hugepages=1024 -HUGEPAGES=`sysctl -n vm.nr_hugepages` -if [ $HUGEPAGES != 1024 ]; then - echo "ERROR: Unable to get 1024 hugepages, only got $HUGEPAGES. Cannot finish." - exit -fi #DPDK will be having dependancy on linux headers if [ "$OS_ID" == "ubuntu" ]; then @@ -95,28 +88,6 @@ elif [ "$OS_ID" == "opensuse" ]; then sudo yum install -y kernel-headers fi -hugepageTotal=$(cat /proc/meminfo | grep -c "HugePages_Total: 0") -if [ $hugepageTotal -ne 0 ]; then - echo "HugePages_Total is zero" - exit -fi - -hugepageFree=$(cat /proc/meminfo | grep -c "HugePages_Free: 0") -if [ $hugepageFree -ne 0 ]; then - echo "HugePages_Free is zero" - exit -fi - -hugepageSize=$(cat /proc/meminfo | grep -c "Hugepagesize: 0 kB") -if [ $hugepageSize -ne 0 ]; then - echo "Hugepagesize is zero" - exit -fi - - -sudo mkdir /mnt/nstackhuge -p -sudo mount -t hugetlbfs -o pagesize=2M none /mnt/nstackhuge/ -sudo mkdir -p /var/run/ip_module/ #===========build DPDK================ @@ -144,8 +115,6 @@ else fi fi -export LD_LIBRARY_PATH=$LIB_PATH -export NSTACK_LOG_ON=DBG #===========build DMM================= echo "DMM build started....." @@ -158,6 +127,39 @@ if [ "$OS_ID" == "centos" ]; then make pkg-rpm fi +#===========check running env ================= +sudo sysctl -w vm.nr_hugepages=1024 +HUGEPAGES=`sysctl -n vm.nr_hugepages` +if [ $HUGEPAGES != 1024 ]; then + echo "ERROR: Unable to get 1024 hugepages, only got $HUGEPAGES. Cannot finish." + exit +fi +hugepageTotal=$(cat /proc/meminfo | grep -c "HugePages_Total: 0") +if [ $hugepageTotal -ne 0 ]; then + echo "HugePages_Total is zero" + exit +fi + +hugepageFree=$(cat /proc/meminfo | grep -c "HugePages_Free: 0") +if [ $hugepageFree -ne 0 ]; then + echo "HugePages_Free is zero" + exit +fi + +hugepageSize=$(cat /proc/meminfo | grep -c "Hugepagesize: 0 kB") +if [ $hugepageSize -ne 0 ]; then + echo "Hugepagesize is zero" + exit +fi + + +sudo mkdir /mnt/nstackhuge -p +sudo mount -t hugetlbfs -o pagesize=2M none /mnt/nstackhuge/ +sudo mkdir -p /var/run/ip_module/ + +export LD_LIBRARY_PATH=$LIB_PATH +export NSTACK_LOG_ON=DBG + ############### Preapre APP test directory echo -e "\e[41m Preapring APP test directory.....\e[0m" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bf2eb01..d085679 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -40,7 +40,7 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,noexecstack -mcmodel=medium") SET(COMPLE_CONFIG ${PROJECT_SOURCE_DIR}/src/framework/common/include/compile_config.h) ADD_DEFINITIONS(-include ${COMM_CONFIG}) ADD_DEFINITIONS(-include ${COMPLE_CONFIG}) -ADD_DEFINITIONS(-D_GNU_SOURCE -D_FORTIFY_SOURCE=2) +ADD_DEFINITIONS(-D_GNU_SOURCE -DNSTACK_GETVER_VERSION="18.04" -D_FORTIFY_SOURCE=2) #LINK_DIRECTORIES(${LIB_PATH_SHARED} ${LIB_PATH_STATIC}) if(WITH_SECUREC_LIB) diff --git a/src/framework/include/nstack_log.h b/src/framework/include/nstack_log.h index d0c2649..67e5b29 100644 --- a/src/framework/include/nstack_log.h +++ b/src/framework/include/nstack_log.h @@ -39,7 +39,11 @@ #include "glog/nstack_glog_in.h" #define NSTACK_GETVER_MODULE "nStack" -#define NSTACK_GETVER_VERSION "VPP2.0 V100R002C10B053" + +#ifndef NSTACK_GETVER_VERSION + #error "need define version first" +#endif + #define NSTACK_GETVER_BUILDTIME "[" __DATE__ "]" "[" __TIME__ "]" #define NSTACK_VERSION NSTACK_GETVER_VERSION " (" NSTACK_GETVER_MODULE ") " NSTACK_GETVER_BUILDTIME |