diff options
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | doc/Build_DMM.md | 2 | ||||
-rw-r--r-- | docker/dmm_image/README.md | 13 | ||||
-rw-r--r-- | docker/dmm_image/centos/Dockerfile | 17 | ||||
-rw-r--r-- | scripts/csit/README.txt | 34 | ||||
-rwxr-xr-x | scripts/csit/install_prereq.sh | 28 | ||||
-rwxr-xr-x | scripts/csit/kill_given_proc.sh | 31 | ||||
-rwxr-xr-x | scripts/csit/run/run_dmm.sh | 87 | ||||
-rwxr-xr-x | scripts/csit/run/run_dmm_with_lwip.sh | 94 | ||||
-rwxr-xr-x | scripts/csit/setup_hugepage.sh | 38 | ||||
-rw-r--r-- | scripts/csit/template.sh | 83 | ||||
-rw-r--r-- | src/framework/common/base/include/common/common_mem_api.h | 2 | ||||
-rw-r--r-- | src/framework/lib_common_mem/common_api.c | 2 | ||||
-rw-r--r-- | src/nSocket/nstack/nstack.c | 2 | ||||
-rw-r--r-- | src/nSocket/nstack/nstack_fd_mng.c | 2 | ||||
-rw-r--r-- | src/nSocket/nstack/nstack_socket.c | 2 | ||||
-rw-r--r-- | stacks/lwip_stack/lwip_src/socket/stackx_protocol_api.c | 2 |
17 files changed, 435 insertions, 10 deletions
@@ -32,15 +32,15 @@ instances and the app/socket-to-stack-mappings, which are provided via the orche different transport layer protocol and also provide the flexibility to choose a protocol stack from manybased on functional/performance requirements. # 3. Quick Start -Refer doc/Build_DMM.md + * [Refer doc/Build_DMM.md.](https://git.fd.io/dmm/plain/doc/Build_DMM.md) # 4. Involved * [Bi-Weekly DMM Metting.](https://wiki.fd.io/view/DMM/Meettng) * [Join the DMM Mailing List.](https://lists.fd.io/g/dmm-dev) * [Join fdio-dmm IRC channel.](https://wiki.fd.io/view/IRC) * [Browse the code.](https://git.fd.io/dmm/tree/) - * [18.07 Release Plan](https://wiki.fd.io/view/Projects/dmm/Release_Plans/Release_Plan_18.07) - + * [18.10 Release Plan](https://wiki.fd.io/view/Projects/dmm/Release_Plans/Release_Plan_18.10) + # 5. More Information - https://wiki.fd.io/view/DMM - https://wiki.fd.io/view/Project_Proposals/DMM diff --git a/doc/Build_DMM.md b/doc/Build_DMM.md index b74d5fb..fb35d2f 100644 --- a/doc/Build_DMM.md +++ b/doc/Build_DMM.md @@ -95,7 +95,7 @@ Check hugepage info sudo mkdir -p /var/run/ip_module ``` -# 6. Biuld and Run the APP +# 6. Build and Run the APP - Link the app with the lib **libnStackAPI.so** first, you can refer to app_example/perf-test diff --git a/docker/dmm_image/README.md b/docker/dmm_image/README.md new file mode 100644 index 0000000..0b674b2 --- /dev/null +++ b/docker/dmm_image/README.md @@ -0,0 +1,13 @@ +# How to build the image of dmm +Note: Make sure your computer can connect to the network +```sh + #cd dmm/docker/dmm_image/centos + #docker build -t "dmm:tag" . +``` + +# How to use the image of dmm +```sh + #docker run -i -t --network=host -v /sys/bus/pci/devices:/sys/bus/pci/devices -v /sys/devices/system/node:/sys/devices/system/node -v /mnt/nstackhuge:/mnt/nstackhuge -v /dev:/dev --privileged dmm:tag /bin/bash +``` + +Then we will enter a container and we can build dmm and run the app. diff --git a/docker/dmm_image/centos/Dockerfile b/docker/dmm_image/centos/Dockerfile new file mode 100644 index 0000000..de772fe --- /dev/null +++ b/docker/dmm_image/centos/Dockerfile @@ -0,0 +1,17 @@ +FROM docker.io/centos:latest + +RUN yum install -y git vim sudo ethtool + +RUN yum install -y kernel-devel-`uname -r` +RUN yum install -y kernel-`uname -r` + +RUN git config --global http.sslVerify false +RUN git config --global user.email "you@example.com" +RUN git config --global user.name "Your Name" + +RUN git clone https://gerrit.fd.io/r/dmm + +RUN mkdir -p /var/run/ip_module/ +RUN mkdir -p /var/log/nStack/ip_module/ + +RUN cd /dmm/scripts/ && bash -x build.sh && cd /dmm/ && git clean -dfx ./ && git checkout ./ diff --git a/scripts/csit/README.txt b/scripts/csit/README.txt new file mode 100644 index 0000000..0f91dbb --- /dev/null +++ b/scripts/csit/README.txt @@ -0,0 +1,34 @@ +################################################# +# Considerations: + + 1. Considers each file inside the path "dmm/scripts/csit/run/" as a single test case. + 2. Considers all files inside "dmm/scripts/csit/run/" as Test scripts, + So any helper files can be written in the path "dmm/scripts/csit/" + 3. Considers a test case as SUCCESS only when both the client and server echoes + DMM_CSIT_TEST_PASSED during verification. + +################################################# +# Call stack of each test script from CSIT script: + +=============================================================================== +./test_script.sh action which_node interface_name dut1_ip dut2_ip +=============================================================================== +./test_script.sh setup 0 dut1_to_dut2_if_name dut1_ip dut2_ip +./test_script.sh setup 1 dut2_to_dut1_if_name dut1_ip dut2_ip +./test_script.sh run 0 dut1_to_dut2_if_name dut1_ip dut2_ip +./test_script.sh run 1 dut2_to_dut1_if_name dut1_ip dut2_ip +./test_script.sh verify 0 +./test_script.sh verify 1 +./test_script.sh log 0 +./test_script.sh log 1 +./test_script.sh cleanup 0 +./test_script.sh cleanup 1 + +[0-dut1, 1-dut2] + +################################################# +# Want to write a new Test case ? + + 1. make a new script in "dmm/scripts/csit/run/" with the help of + "dmm/scripts/csit/template.sh". + 2. And handle all the actions in it(can go through existing scripts for reference).
\ No newline at end of file diff --git a/scripts/csit/install_prereq.sh b/scripts/csit/install_prereq.sh new file mode 100755 index 0000000..b03769b --- /dev/null +++ b/scripts/csit/install_prereq.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -x +SCRIPT_DIR=`dirname $(readlink -f $0)` +ROOTDIR=$SCRIPT_DIR/../../../ + +cd ${ROOTDIR} +chmod +x *.deb +sudo dpkg -i libnuma1_2.0.11-1ubuntu1.1_amd64.deb +sudo dpkg -i libnuma-dev_2.0.11-1ubuntu1.1_amd64.deb +sudo dpkg -i ethtool_4.5-1_amd64.deb +sudo dpkg -i lsof_4.89+dfsg-0.1_amd64.deb + +DPDK_DOWNLOAD_PATH=$(cat $ROOTDIR/dmm/scripts/build_dpdk.sh | grep DPDK_DOWNLOAD_PATH= | cut -d "=" -f2) +sudo rm /tmp/dpdk +mkdir -p $DPDK_DOWNLOAD_PATH +mv $ROOTDIR/dpdk-18.02.tar.xz $DPDK_DOWNLOAD_PATH +# install DPDK +cp -f $ROOTDIR/dmm/scripts/build_dpdk.sh $ROOTDIR/dmm/scripts/build_dpdk_csit.sh +sed -i 's!wget.*!#comment wget!1' $ROOTDIR/dmm/scripts/build_dpdk_csit.sh +bash -x $ROOTDIR/dmm/scripts/build_dpdk_csit.sh + +sudo modprobe uio +sudo modprobe uio_pci_generic +sudo insmod $DPDK_DOWNLOAD_PATH/dpdk-18.02/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko + +bash $SCRIPT_DIR/kill_given_proc.sh vs_epoll +bash $SCRIPT_DIR/setup_hugepage.sh diff --git a/scripts/csit/kill_given_proc.sh b/scripts/csit/kill_given_proc.sh new file mode 100755 index 0000000..772643a --- /dev/null +++ b/scripts/csit/kill_given_proc.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +proc_name=$1 +sudo pgrep $proc_name +if [ $? -eq "0" ]; then + success=false + sudo pkill $proc_name + echo "RC = $?" + for attempt in {1..5}; do + echo "Checking if '$proc_name' is still alive, attempt nr ${attempt}" + sudo pgrep $proc_name + if [ $? -eq "1" ]; then + echo "'$proc_name' is dead" + success=true + break + fi + echo "'$proc_name' is still alive, waiting 1 second" + sleep 1 + done + if [ "$success" = false ]; then + echo "The command sudo pkill '$proc_name' failed" + sudo pkill -9 $proc_name + echo "RC = $?" + exit 1 + fi +else + echo "'$proc_name' is not running" +fi + +sleep 2 +exit 0
\ No newline at end of file diff --git a/scripts/csit/run/run_dmm.sh b/scripts/csit/run/run_dmm.sh new file mode 100755 index 0000000..fb65f65 --- /dev/null +++ b/scripts/csit/run/run_dmm.sh @@ -0,0 +1,87 @@ +#!/bin/bash + +set -x + +################################################# +# Store arguments values +# verify, log, cleanup actions gets first two arguments + +action=$1 #action: [setup, run, verify, cleanup] +node=$2 #node: [0 - dut1 node, 1 - dut2 node] +ifname=$3 #dut1 interface name when node is 0 /dut2 interface name when node is 1 +dut1_if_ip=$4 #dut1 interface ip +dut2_if_ip=$5 #dut2 interface ip + +################################################# +# Get path details + +RUN_DIR=`dirname $(readlink -f $0)` +CSIT_SCRIPT_DIR=$RUN_DIR/.. +ROOTDIR=$CSIT_SCRIPT_DIR/../../../ +APP_DIR=${ROOTDIR}/dmm/config/app_test +LIB_PATH=${ROOTDIR}/dmm/release/lib64 +DMM_SCRIPT_DIR=$ROOTDIR/dmm/scripts + +################################################# +# Setup preparation + +if [ "x$action" == "xsetup" ]; then + ip addr + lspci -nn + lsmod | grep uio + bash $CSIT_SCRIPT_DIR/kill_given_proc.sh vs_epoll + bash $CSIT_SCRIPT_DIR/setup_hugepage.sh + + cp -f $DMM_SCRIPT_DIR/prep_app_test.sh $DMM_SCRIPT_DIR/prep_app_test_csit.sh + sed -i 's!.*check_hugepage.sh!#skip hugepage check!1' $DMM_SCRIPT_DIR/prep_app_test_csit.sh + sed -i 's!enp0s8!'$ifname'!1' $DMM_SCRIPT_DIR/prep_app_test_csit.sh + bash -x $DMM_SCRIPT_DIR/prep_app_test_csit.sh +fi + +################################################# +# Execution + +if [ "x$action" == "xrun" ]; then + cd $APP_DIR + ls -l + #only for kernal stack + if [ "x$node" == "x0" ]; then + sudo LD_LIBRARY_PATH=${LIB_PATH} ./vs_epoll -p 20000 -d ${dut2_if_ip} -a 10000 -s ${dut1_if_ip} -l 200 -t 50000 -i 0 -f 1 -r 20000 -n 1 -w 10 -u 10000 -e 10 -x 1 + else + sudo LD_LIBRARY_PATH=${LIB_PATH} ./vc_common -p 20000 -d ${dut1_if_ip} -a 10000 -s ${dut2_if_ip} -l 200 -t 50000 -i 0 -f 1 -r 20000 -n 1 -w 10 -u 10000 -e 10 -x 1 + fi +fi + +################################################# +# Verification + +if [ "x$action" == "xverify" ]; then + if [ "x$node" == "x1" ]; then + sudo cat $RUN_DIR/log_$(basename $0).txt | grep "send 50000" + if [ $? == 0 ]; then + echo "DMM_CSIT_TEST_PASSED" + else + echo "DMM_CSIT_TEST_FAILED" + fi + elif [ "x$node" == "x0" ]; then + echo "DMM_CSIT_TEST_PASSED" + fi +fi + +################################################# +# Print Log + +if [ "x$action" == "xlog" ]; then + echo "print log" +fi + +################################################# +# Cleanup + +if [ "x$action" == "xcleanup" ]; then + if [ "x$node" == "x0" ]; then + bash $CSIT_SCRIPT_DIR/kill_given_proc.sh vs_epoll + fi +fi + +exit 0
\ No newline at end of file diff --git a/scripts/csit/run/run_dmm_with_lwip.sh b/scripts/csit/run/run_dmm_with_lwip.sh new file mode 100755 index 0000000..1174697 --- /dev/null +++ b/scripts/csit/run/run_dmm_with_lwip.sh @@ -0,0 +1,94 @@ +#!/bin/bash + +set -x + +################################################# +# Store arguments values +# verify, log, cleanup actions gets first two arguments[action, node] + +action=$1 #action: [setup, run, verify, cleanup] +node=$2 #node: [0 - dut1 node, 1 - dut2 node] +ifname=$3 #dut1 interface name(when node is 0)/dut2 interface name(when node is 1) +dut1_if_ip=$4 #dut1 interface ip +dut2_if_ip=$5 #dut2 interface ip + +################################################# +# Get path details + +RUN_DIR=`dirname $(readlink -f $0)` +CSIT_SCRIPT_DIR=$RUN_DIR/.. +ROOTDIR=$CSIT_SCRIPT_DIR/../../../ +APP_DIR=${ROOTDIR}/dmm/stacks/lwip_stack/app_test/ +LIB_PATH=${APP_DIR}/../release/lib64/ +VAG_DIR=${ROOTDIR}/dmm/stacks/lwip_stack/vagrant +LOG_PATH=/var/log/nStack + +################################################# +# Setup preparation + +if [ "x$action" == "xsetup" ]; then + bash $CSIT_SCRIPT_DIR/kill_given_proc.sh vs_epoll + bash $CSIT_SCRIPT_DIR/setup_hugepage.sh + cat /proc/meminfo + cp -f $VAG_DIR/start_nstackMain.sh $VAG_DIR/start_nstackMain_csit.sh + sed -i 's!.*check_hugepage.sh!#skip hugepage check!1' $VAG_DIR/start_nstackMain_csit.sh + sed -i 's!ifname=.*!ifname='$ifname'!1' $VAG_DIR/start_nstackMain_csit.sh + sudo LD_LIBRARY_PATH=${LIB_PATH} bash $VAG_DIR/start_nstackMain_csit.sh || exit 1 + sleep 5 + + #after nstackmain + echo "after nstackmain" + ip addr + lspci -nn + lsmod | grep uio + cat /proc/meminfo | grep Huge + /tmp/dpdk/dpdk-18.02/usertools/dpdk-devbind.py --status +fi + +################################################# +# Execution + +if [ "x$action" == "xrun" ]; then + cd ${APP_DIR} + if [ "x$node" == "x0" ]; then + sudo LD_LIBRARY_PATH=${LIB_PATH} ./vs_epoll -p 20000 -d ${dut2_if_ip} -a 10000 -s ${dut1_if_ip} -l 200 -t 50000 -i 0 -f 1 -r 20000 -n 1 -w 10 -u 10000 -e 10 -x 1 + else + sudo LD_LIBRARY_PATH=${LIB_PATH} ./vc_common -p 20000 -d ${dut1_if_ip} -a 10000 -s ${dut2_if_ip} -l 200 -t 50 -i 0 -f 1 -r 20000 -n 1 -w 10 -u 10000 -e 10 -x 1 + fi +fi + +################################################# +# Verification + +if [ "x$action" == "xverify" ]; then + if [ "x$node" == "x1" ]; then + cat $RUN_DIR/log_$(basename $0).txt | grep "send 50" + if [ $? == 0 ]; then + echo "DMM_CSIT_TEST_PASSED" + else + echo "DMM_CSIT_TEST_FAILED" + fi + elif [ "x$node" == "x0" ]; then + echo "DMM_CSIT_TEST_PASSED" + fi +fi + +################################################# +# Print Log + +if [ "x$action" == "xlog" ]; then + cat $LOG_PATH/running.log +fi + +################################################# +# Cleanup + +if [ "x$action" == "xcleanup" ]; then + if [ "x$node" == "x0" ]; then + bash $CSIT_SCRIPT_DIR/kill_given_proc.sh vs_epoll + fi + sudo bash $APP_DIR/../release/stop_nstack.sh + sudo rm $LOG_PATH/running.log +fi + +exit 0 diff --git a/scripts/csit/setup_hugepage.sh b/scripts/csit/setup_hugepage.sh new file mode 100755 index 0000000..b03c100 --- /dev/null +++ b/scripts/csit/setup_hugepage.sh @@ -0,0 +1,38 @@ +#!/bin/bash -x + +# check and setup the hugepages +SYS_HUGEPAGE=$(cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages) +hugepageFree=$(cat /sys/kernel/mm/hugepages/hugepages-2048kB/free_hugepages) + +MOUNT=$(mount | grep /mnt/nstackhuge) +count=$(mount | grep /mnt/nstackhuge | wc -l) + +while [ "${MOUNT}" != "" ] || [ "${count}" -ne 0 ] +do + sudo umount /mnt/nstackhuge + sleep 1 + MOUNT=$(mount | grep /mnt/nstackhuge) + count=$[$count -1] +done + +if [ ${SYS_HUGEPAGE} -lt 1536 ] || [ $hugepageFree -eq 0 ]; then + + sock_count=$(lscpu | grep 'Socket(s):' | head -1 | awk '{print $2}') + ls -l /sys/devices/system/node/ + + while [ "${sock_count}" -ne 0 ] + do + sock_count=$[$sock_count - 1] + echo 1536 | sudo tee /sys/devices/system/node/node"$sock_count"/hugepages/hugepages-2048kB/nr_hugepages + done + + sudo mkdir -p /mnt/nstackhuge + sudo mount -t hugetlbfs -o pagesize=2M none /mnt/nstackhuge/ + test $? -eq 0 || exit 1 +else + sudo mkdir -p /mnt/nstackhuge + sudo mount -t hugetlbfs -o pagesize=2M none /mnt/nstackhuge/ +fi + +cat /proc/meminfo +exit 0 diff --git a/scripts/csit/template.sh b/scripts/csit/template.sh new file mode 100644 index 0000000..106167c --- /dev/null +++ b/scripts/csit/template.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +set -x +################################################# +# Store arguments values +# verify, log, cleanup actions gets first two arguments + +action=$1 #action: [setup, run, verify, cleanup] +node=$2 #node: [0 - dut1 node, 1 - dut2 node] +ifname=$3 #dut1 interface name when node is 0 /dut2 interface name when node is 1 +dut1_if_ip=$4 #dut1 interface ip +dut2_if_ip=$5 #dut2 interface ip + +################################################# +# Get path details + +RUN_DIR=`dirname $(readlink -f $0)` +CSIT_SCRIPT_DIR=$RUN_DIR/.. +ROOTDIR=$CSIT_SCRIPT_DIR/../../../ +APP_DIR=${ROOTDIR}/dmm/config/app_test +LIB_PATH=${ROOTDIR}/dmm/release/lib64 +DMM_SCRIPT_DIR=$ROOTDIR/dmm/scripts + +################################################# +# Setup preparation + +if [ "x$action" == "xsetup" ]; then + #Handle setup preparation here + echo "performing setup" +fi + +################################################# +# Execution + +if [ "x$action" == "xrun" ]; then + # Call your executables here to run the test case + if [ "x$node" == "x0" ]; then + #call server executable + echo "server execution " + elif [ "x$node" == "x1" ]; then + #call client executable + echo "client execution" + fi +fi + +################################################# +# Verification + +if [ "x$action" == "xverify" ]; then + if [ "x$node" == "x1" ]; then + #Handle client verification + if [ $? == 0 ]; then + echo "DMM_CSIT_TEST_PASSED" #must echo this + else + echo "DMM_CSIT_TEST_FAILED" + fi + elif [ "x$node" == "x0" ]; then + #Handle server verification + if [ $? == 0 ]; then + echo "DMM_CSIT_TEST_PASSED" #must echo this + else + echo "DMM_CSIT_TEST_FAILED" + fi + fi +fi + +################################################# +# Print Log + +if [ "x$action" == "xlog" ]; then + #Handle print log + echo "DMM logs" +fi + +################################################# +# Cleanup + +if [ "x$action" == "xcleanup" ]; then + #Handle cleanup + echo "performing cleanup" +fi + +exit 0
\ No newline at end of file diff --git a/src/framework/common/base/include/common/common_mem_api.h b/src/framework/common/base/include/common/common_mem_api.h index d143732..40b01b9 100644 --- a/src/framework/common/base/include/common/common_mem_api.h +++ b/src/framework/common/base/include/common/common_mem_api.h @@ -90,7 +90,7 @@ get_sys_pid () return g_sys_host_pid; } -pid_t updata_sys_pid (); +pid_t update_sys_pid (); u32_t sys_now (void); #define sys_sem_t sys_sem_t_v2 diff --git a/src/framework/lib_common_mem/common_api.c b/src/framework/lib_common_mem/common_api.c index 566b8be..cfb869d 100644 --- a/src/framework/lib_common_mem/common_api.c +++ b/src/framework/lib_common_mem/common_api.c @@ -275,7 +275,7 @@ sys_get_hostpid_from_file (pid_t pid) } pid_t -updata_sys_pid () +update_sys_pid () { g_sys_host_pid = SYS_HOST_INITIAL_PID; return get_sys_pid (); diff --git a/src/nSocket/nstack/nstack.c b/src/nSocket/nstack/nstack.c index 4198266..225c297 100644 --- a/src/nSocket/nstack/nstack.c +++ b/src/nSocket/nstack/nstack.c @@ -769,7 +769,7 @@ nstack_fw_init () } common_mem_rwlock_read_lock (get_fork_lock ()); - updata_sys_pid (); + update_sys_pid (); u8 proc_type = NSFW_PROC_APP; nsfw_mem_para stinfo = { 0 }; diff --git a/src/nSocket/nstack/nstack_fd_mng.c b/src/nSocket/nstack/nstack_fd_mng.c index ba9b8f1..86e045d 100644 --- a/src/nSocket/nstack/nstack_fd_mng.c +++ b/src/nSocket/nstack/nstack_fd_mng.c @@ -180,7 +180,7 @@ nstack_fork_init_parent (pid_t ppid) void nstack_fork_init_child (pid_t ppid) { - pid_t cpid = updata_sys_pid (); + pid_t cpid = update_sys_pid (); NSSOC_LOGDBG ("parent_pid=%d, child_pid=%d", ppid, cpid); nsfw_mgr_clr_fd_lock (); diff --git a/src/nSocket/nstack/nstack_socket.c b/src/nSocket/nstack/nstack_socket.c index cd1557b..c967d64 100644 --- a/src/nSocket/nstack/nstack_socket.c +++ b/src/nSocket/nstack/nstack_socket.c @@ -2797,7 +2797,7 @@ nstack_fork (void) pid = nsfw_base_fork (); if (pid == 0) { - updata_sys_pid (); + update_sys_pid (); } NSSOC_LOGERR ("g_nStackInfo has not initialized]parent_pid=%d, pid=%d", parent_pid, pid); diff --git a/stacks/lwip_stack/lwip_src/socket/stackx_protocol_api.c b/stacks/lwip_stack/lwip_src/socket/stackx_protocol_api.c index 920d73d..0be8d7b 100644 --- a/stacks/lwip_stack/lwip_src/socket/stackx_protocol_api.c +++ b/stacks/lwip_stack/lwip_src/socket/stackx_protocol_api.c @@ -56,7 +56,7 @@ sbr_init_protocol () int sbr_fork_protocol () { - pid_t pid = updata_sys_pid (); + pid_t pid = update_sys_pid (); NSSBR_LOGINF ("update pid in child]pid=%d", pid); return sbr_fork_stackx (); |