diff options
-rw-r--r-- | doc/TestAppUserGuide.md | 38 | ||||
-rw-r--r-- | release/include/nsocket_dmm_api.h | 128 | ||||
-rw-r--r-- | scripts/build.sh | 5 | ||||
-rw-r--r-- | src/nSocket/CMakeLists.txt | 4 |
4 files changed, 24 insertions, 151 deletions
diff --git a/doc/TestAppUserGuide.md b/doc/TestAppUserGuide.md index fc0d061..c56cf92 100644 --- a/doc/TestAppUserGuide.md +++ b/doc/TestAppUserGuide.md @@ -1,17 +1,20 @@ # 1. Introduction: -This document will help to test sample app with DMM. +This document will help to configure the stack module and protocol routing module, +and run sample app with DMM. # 2. Configuration files: There are two configuration files need to modify for setting up the topology. -release\\configure +release/configure -**module\_config.json** is the stack module config file. +**module_config.json** is the stack module config file. -**rd\_config.json** is the rd config file. +**rd_config.json** is the rd config file. + +Copy the two json files to release/bin and configure in next step. <!-- --> @@ -19,7 +22,7 @@ release\\configure We need to setup configuration as given below. -# 3.1 module\_config.json for example: +# 3.1 module_config.json for example: ``` { @@ -30,7 +33,7 @@ We need to setup configuration as given below. "stack_name": "kernel", "function_name": "kernel_stack_register", "libname": "", /*library name, if loadtype is static, this maybe - null, */ /* else must give a library name*/ + null, else must give a library name*/ "loadtype": "static", /*library load type: static or dynamic*/ "deploytype": "1", "maxfd": "1024", @@ -42,22 +45,23 @@ We need to setup configuration as given below. } ``` -# 3.2 rd\_config.json for example: +# 3.2 rd_config.json for example: ``` { "ip_route": [ { "subnet": "192.165.1.1/16", - "type": "nstack-kernel", /*output interface type, nstack-kernel: - indicate that this ip */ /* should go through linux protocol, - nstack-dpdk: go through stackx protocol*/ + "type": "nstack-kernel", + /* output interface type, + nstack-kernel: indicate this ip should go through kernel protocol + nstack-dpdk: go through stackx protocol*/ }, { "subnet": "172.16.25.125/16", "type": "nstack-kernel", } -] + ] "prot_route": [ { "proto_type": "11", @@ -80,7 +84,7 @@ After building the DMM, inside the DMM/release directory below perf-test app wil *kc_epoll, ks_epoll, vc_epoll, vs_epoll* -Examples : +Examples: **With Kernel stack:** @@ -104,7 +108,7 @@ client: #./vc_epoll -p 20000 -d 172.16.25.126 -a 10000 -s 172.16.25.125 -l 200 -t 5000000 -i 0 -f 1 -r 20000 -n 1 -w 10 -u 10000 -e 10 -x 1 ``` -- **NGNIX**: +- **NGNIX with DMM nStack**: Nginx build process: @@ -118,7 +122,7 @@ Nginx build process: #make install ``` Note: - + a. ./configure **--with-ld-opt="-L /root/xxx/DMM/release/lib64/ -lnStackAPI"** can be done if you want to use nStack otherwise just give the ./configure. b. Make sure before building edit the configurtaion if you want specific server IP. For Ex: @@ -127,7 +131,7 @@ Note: nginx.conf file modifiecations: listen 172.16.25.125:80 - + *step 2: run the nginx code* ``` @@ -137,7 +141,7 @@ Note: #./nginx ``` Note: - + if you want to run ./nginx with nStack then perform following before run a. export LD_LIBRARY_PATH=/root/xxx/DMM/release/lib64/ b. export NSTACK_LOG_ON=DBG ##to display nStack consol logs. @@ -151,7 +155,7 @@ Note: At client board, perform below command and check the output: ``` - #curl http://172.16.25.125:80/ + #curl http://172.16.25.125:80/ ``` Note: diff --git a/release/include/nsocket_dmm_api.h b/release/include/nsocket_dmm_api.h deleted file mode 100644 index ffdb709..0000000 --- a/release/include/nsocket_dmm_api.h +++ /dev/null @@ -1,128 +0,0 @@ -/* -* -* 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. -*/ - -#ifndef __NSOCKET_DMM_API_H__ -#define __NSOCKET_DMM_API_H__ - -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/epoll.h> -#include <unistd.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -typedef enum -{ - NSTACK_MODEL_TYPE1 = 1, /*nSocket and stack belong to the same process */ - NSTACK_MODEL_TYPE2 = 2, /*nSocket and stack belong to different processes, - *and nStack don't take care the communication between stack and stack adpt - */ - NSTACK_MODEL_TYPE3 = 3, /*nSocket and stack belong to different processes, and sbr was spplied to communicate whit stack */ - NSTACK_MODEL_INVALID, -} nstack_model_deploy_type; - -typedef enum -{ - MBUF_TRANSPORT, - MBUF_UDP, - MBUF_IP, - MBUF_LINK, - MBUF_RAW, - MBUF_MAX_LAYER, -} mbuf_layer; - -/* - *Standard api interface definition. - *these interface is provided by Protocol stack to nStack - */ -typedef struct __nstack_socket_ops -{ -#undef NSTACK_MK_DECL -#define NSTACK_MK_DECL(ret, fn, args) ret (*pf##fn) args -#include "declare_syscalls.h" -} nstack_socket_ops; - -/* - *Interactive interface for Protocol stack and nStack defined here - *these interface is provided by Protocol stack to nStack - */ -typedef struct __nstack_extern_ops -{ - int (*module_init) (void); /*stack module init */ - int (*fork_init_child) (pid_t p, pid_t c); /*after fork, stack child process init again if needed. */ - void (*fork_parent_fd) (int s, pid_t p); /*after fork, stack parent process proc again if needed. */ - void (*fork_child_fd) (int s, pid_t p, pid_t c); /*after fork, child record pid for recycle if needed. */ - void (*fork_free_fd) (int s, pid_t p, pid_t c); /*for SOCK_CLOEXEC when fork if needed. */ - unsigned int (*ep_ctl) (int epFD, int proFD, int ctl_ops, struct epoll_event * event, void *pdata); /*when fd add to epoll fd, triggle stack to proc if need */ - unsigned int (*ep_getevt) (int epFD, int profd, unsigned int events); /*check whether some events exist really */ - int (*peak) (int s); /*used for stack-x , isource maybe no need */ -} nstack_extern_ops; - -/* - *The event notify interface provided to the protocol stack by nStack - *these interface is provided by nStack to Protocol stack - */ -typedef struct __nstack_event_cb -{ - void *handle; /*current so file handler */ - int type; /*nstack is assigned to the protocol stack and needs to be passed to nstack when the event is reported */ - int (*event_cb) (void *pdata, int events); -} nstack_event_cb; - -typedef struct __nstack_proc_cb -{ - nstack_socket_ops socket_ops; /*posix socket api */ - nstack_extern_ops extern_ops; /*other proc callback */ -} nstack_proc_cb; - -/* - *Module registration interface. - *ouput param:posix_ps,proc_ops - *input param:event_ops - */ -typedef int (*nstack_stack_registe_fn) (nstack_proc_cb * proc_fun, - nstack_event_cb * event_ops); -typedef void (*io_send_fn) (void *pbuf, void *pargs); -typedef void (*io_recv_cb) (void **pbuf, void *pargs); -typedef int (*recycle_fun) (unsigned int exit_pid, void *pdata, - unsigned short rec_type); - -/*structure type of mbuf*/ -typedef enum -{ - MBUF_TYPE_DPDK, /*mbuf structure type of DPDK */ - MBUF_TYPE_STACKPOOL, /*mbuf structure type of stack-x */ - MBUF_TYPE_INVALID, -} mbuf_type; - -typedef struct -{ - int (*event_notify) (void *pdata, int events); /*event notify */ - int (*ep_pdata_free) (void *pdata); /*pdata free */ - void (*obj_recycle_reg) (unsigned char priority, unsigned short rec_type, void *data, recycle_fun cb_fun); /*source recycle */ - void *(*mbuf_alloc) (mbuf_layer layer, unsigned short length, mbuf_type Type, unsigned short thread_index); /*zero copy memory alloc */ - void (*mbuf_free) (void *p, mbuf_type Type); /*zero copy memory free */ - void (*pkt_send_cb) (void *pbuf, mbuf_type inType, mbuf_type outType, - void *pargs, io_send_fn io_send); - void (*pkt_recv_cb) (void **pbuf, mbuf_type inType, mbuf_type outType, - void *pargs, io_recv_cb io_recv); -} nStack_adpt_fun; - -extern int nstack_adpt_init (nstack_model_deploy_type deploy_type, - nStack_adpt_fun * out_ops, int flag); - -#endif diff --git a/scripts/build.sh b/scripts/build.sh index 07bbe0c..9240061 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -95,9 +95,6 @@ make install T=x86_64-native-linuxapp-gcc DESTDIR=${DPDK_INSTALL_PATH} cd x86_64-native-linuxapp-gcc make -mkdir ${DPDK_INSTALL_PATH}/lib64/ -cp -r ${DPDK_INSTALL_PATH}/lib/* ${DPDK_INSTALL_PATH}/lib64/ - export LD_LIBRARY_PATH=$LIB_PATH export NSTACK_LOG_ON=DBG @@ -117,4 +114,4 @@ make -j 8 #DPDK install path need to be updated below if it is changed sed -i 's!export DPDK_INSTALL_PATH.*!export DPDK_INSTALL_PATH="/root/dpdk_install/tmp/"!1' ../thirdparty/stackpool/release/script/nstack_var.sh -echo "DMM build finished....."
\ No newline at end of file +echo "DMM build finished....." diff --git a/src/nSocket/CMakeLists.txt b/src/nSocket/CMakeLists.txt index 35b34c6..1063f58 100644 --- a/src/nSocket/CMakeLists.txt +++ b/src/nSocket/CMakeLists.txt @@ -18,7 +18,7 @@ if(WITH_HAL_LIB) else() SET(PAL_H_DIRECTORIES "${DMM_DPDK_INSTALL_DIR}/include/dpdk/") - SET(DPDK_LIB_DIRECTORIES "${DMM_DPDK_INSTALL_DIR}/lib64") + SET(DPDK_LIB_DIRECTORIES "${DMM_DPDK_INSTALL_DIR}/lib") SET(DPDK_LIBS "${DPDK_LIB_DIRECTORIES}/librte_eal.so") list(APPEND DPDK_LIBS "${DPDK_LIB_DIRECTORIES}/librte_mempool.so") list(APPEND DPDK_LIBS "${DPDK_LIB_DIRECTORIES}/librte_mbuf.so") @@ -48,4 +48,4 @@ TARGET_LINK_LIBRARIES( dmm_api -Wl,--no-whole-archive,-lstdc++ ${DPDK_LIBS}) -ADD_DEPENDENCIES(nStackAPI dmm_api)
\ No newline at end of file +ADD_DEPENDENCIES(nStackAPI dmm_api) |