diff options
Diffstat (limited to 'stacks')
-rw-r--r-- | stacks/lwip_stack/CMakeLists.txt | 2 | ||||
-rw-r--r-- | stacks/lwip_stack/doc/README.md | 120 | ||||
-rw-r--r-- | stacks/lwip_stack/doc/dmm_lwip.png | bin | 0 -> 52940 bytes | |||
-rw-r--r-- | stacks/lwip_stack/lwip_src/api/spl_api_msg.c | 96 | ||||
-rw-r--r-- | stacks/lwip_stack/lwip_src/core/spl_pbuf.c | 14 | ||||
-rw-r--r-- | stacks/lwip_stack/lwip_src/include/stackx/spl_pbuf.h | 3 | ||||
-rw-r--r-- | stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c | 6 | ||||
-rw-r--r-- | stacks/lwip_stack/lwip_src/socket/stackx_event.c | 117 | ||||
-rw-r--r-- | stacks/lwip_stack/release/script/nstack_var.sh | 2 | ||||
-rw-r--r-- | stacks/lwip_stack/release/start_nstack.sh | 11 | ||||
-rw-r--r-- | stacks/lwip_stack/release/stop_nstack.sh | 6 | ||||
-rw-r--r-- | stacks/lwip_stack/run_stackx.txt | 140 | ||||
-rw-r--r-- | stacks/lwip_stack/src/alarm/alarm.c | 4 | ||||
-rw-r--r-- | stacks/lwip_stack/src/maintain/fw_mt_config.c | 38 | ||||
-rw-r--r-- | stacks/lwip_stack/src/sbr/sbr_protocol_api.h | 2 | ||||
-rw-r--r-- | stacks/lwip_stack/src/sbr/sbr_socket.c | 2 | ||||
-rwxr-xr-x | stacks/lwip_stack/vagrant/start_nstackMain.sh | 7 |
17 files changed, 370 insertions, 200 deletions
diff --git a/stacks/lwip_stack/CMakeLists.txt b/stacks/lwip_stack/CMakeLists.txt index 814e5a5..297d2d9 100644 --- a/stacks/lwip_stack/CMakeLists.txt +++ b/stacks/lwip_stack/CMakeLists.txt @@ -61,8 +61,6 @@ execute_process( COMMAND cp -rf ${CMAKE_CURRENT_LIST_DIR}/../../release/include ${CMAKE_CURRENT_LIST_DIR}/src/ COMMAND cp ${CMAKE_CURRENT_LIST_DIR}/../../release/lib64/libnStackAPI.so ${CMAKE_CURRENT_LIST_DIR}/release/lib64/ COMMAND cp ${CMAKE_CURRENT_LIST_DIR}/../../release/lib64/libdmm_api.so ${CMAKE_CURRENT_LIST_DIR}/release/lib64/ - COMMAND cp ${CMAKE_CURRENT_LIST_DIR}/../../build/libnStackMaintain.a ${CMAKE_CURRENT_LIST_DIR}/release/lib64/ - COMMAND cp ${CMAKE_CURRENT_LIST_DIR}/../../build/libsocket.a ${CMAKE_CURRENT_LIST_DIR}/build/ COMMAND echo "stacklwip prepare ok" ) execute_process( diff --git a/stacks/lwip_stack/doc/README.md b/stacks/lwip_stack/doc/README.md new file mode 100644 index 0000000..e9bb31e --- /dev/null +++ b/stacks/lwip_stack/doc/README.md @@ -0,0 +1,120 @@ +# 1. What is lwIP +lwIP is a light-weight implementation of the TCP/IP protocol suite. +lwIP is freely available (under a BSD-style license) in C source +code format and can be downloaded from the development homepage. +The focus of the lwIP TCP/IP implementation is to reduce the RAM +usage while still having a full scale TCP. + +# 2. How to use lwIP + +## How to integrate lwIP into DMM +The file CMakeList.txt defined the compiling process, including downloading +the lwip 2.7.0 code and pushing the helper files into it, or modify +lwip files. + +Currently lwip will not be build as separate lib, instead it'll be part +of the excutable namely "nStackMain". +lwip Stack will run in pipeline mode. Application will run in one process +and lwip will run as "nStackMain" process. Below picture depicts +a birds eye view of lwip in DMM pipeline mode. + + +## Compile +```sh + #cd dmm/build && cmake .. + #make + #cd ../stacks/lwip_stack/build && cmake .. + #make +``` + +## Test +- Steps 1: update some environment variables +```sh + #export LD_LIBRARY_PATH=${dmm}/stacks/lwip_stack/release/lib64/ + #export LD_PRELOAD=${dmm}/release/lib64/libnStackAPI.so + #export NSTACK_MOD_CFG_FILE=${dmm}/stacks/lwip_stack/app_conf/module_config.json + #export NSTACK_MOD_CFG_RD=${dmm}/stacks/lwip_stack/app_conf/rd_config.json + #export NSTACK_LOG_ON=DBG (optional enable debug) +``` +- Steps 2: Modify rd_config.json(located at dmm/stacks/lwip_stack/app_config/) +```sh + #vim rd_config.json + Eg. set "subnet": "192.168.21.1/24" +``` +Note: + Means dmm chose lwip_stack if subnet matches 192.168.21.* + +- Steps 3: Run nStackMain(lwip stack)) +```sh + #cp ${dmm}/stacks/lwip_stack/release/configure/ip_data.json ${dmm}/stacks/lwip_stack/release/bin/ + #cp ${dmm}/stacks/lwip_stack/release/configure/network_data_tonStack.json ${dmm}/stacks/lwip_stack/release/bin/ + +``` +Modify ip_data.json +``` +Change ref_nic => to interface name which you want to use +Change ip_cidr => ip address you want to use. +``` +Modify network network_data_tonStack.json +``` +Change ref_nic => to interface name which you want to use +Change subnet => Subnet (ip_cidr belongs to this subnet) +Change gateway, range-start, range-end, dst, gw accordingly. This information will be used by DMM to configure network. +``` +Run the process: +``` + #cd ${dmm}/stacks/lwip_stack/release + #./start_nstack.sh +``` + +- Steps 4: Communication test between machine A(as server) with machine B + (as client) + +##### Run in machine A +```sh + #./dmm/release/bin/vs_epoll -p 20000 -d 192.168.21.180 -a 10000 -s 192.168.21.181 -l 1000 -t 500000 -i 0 -f 1 -r 20000 -n 1 -w 10 -u 50000 -e 10 -x 1 +``` +Note: + Means the current machine would be server, and it's +destination address is 192.168.21.180 (client address), +source address is 192.168.21.181(server address) + +##### Run in machine B +``` + #./dmm/release/bin/vc_common -p 20000 -d 192.168.21.181 -a 10000 -s 192.168.21.180 -l 1000 -t 500000 -i 0 -f 1 -r 20000 -n 1 -w 10 -u 50000 -e 10 -x 1 +``` +Note: + Means the current machine would be client, and it's +destination address is 192.168.21.181 (server address), +source address is 192.168.21.180(client address) + +# 3. Document description + +(dmm/stacks/lwip_stack/doc) + +## CMakeLists.txt +Control file for Cmake compiling. + +## config folder +##### module_config.json +- module_config.json is for configuring dmm protocol stack module. + +##### rd_config.json +- rd_config.json is to choose which module is better to go through, if subnet matches, It will go through lwip protocol stack when RD type is nstack-dpdk + +## lwip helper files. +lwip helper files is implmentation and modification of some supportive functions to run lwip with dmm. + +## lwip_stack/src folder + +- Implmetation of nStackMain process which provides the framework to hold lwip stack. + +## lwip_stack/lwip_src +- Downloaded opensource lwip 2.7.0. code. + +# 4. More Information +https://wiki.fd.io/view/DMM +https://savannah.nongnu.org/projects/lwip/ +http://lwip.wikia.com/wiki/LwIP_Wiki +[DMM_DeveloperManual.md](../../doc/DMM_DeveloperManual.md) + diff --git a/stacks/lwip_stack/doc/dmm_lwip.png b/stacks/lwip_stack/doc/dmm_lwip.png Binary files differnew file mode 100644 index 0000000..403eed3 --- /dev/null +++ b/stacks/lwip_stack/doc/dmm_lwip.png diff --git a/stacks/lwip_stack/lwip_src/api/spl_api_msg.c b/stacks/lwip_stack/lwip_src/api/spl_api_msg.c index 0986ed4..1c9bf92 100644 --- a/stacks/lwip_stack/lwip_src/api/spl_api_msg.c +++ b/stacks/lwip_stack/lwip_src/api/spl_api_msg.c @@ -414,7 +414,7 @@ spl_recv_udp (void *arg, struct udp_pcb *pcb, struct pbuf *p, { struct spl_netbuf *buf; spl_netconn_t *conn = (spl_netconn_t *) arg; - struct spl_pbuf *spb = NULL; //?? + struct spl_pbuf *spl_pb = NULL; //?? if (NULL == pcb) { @@ -432,12 +432,28 @@ spl_recv_udp (void *arg, struct udp_pcb *pcb, struct pbuf *p, /* //@TODO: malloc and Copy splbuf */ struct common_pcb *cpcb = (struct common_pcb *) (conn->comm_pcb_data); - buf = (struct spl_netbuf *) ((char *) p + sizeof (struct spl_pbuf)); - buf->p = spb; + u16_t proc_id = spl_get_lcore_id (); + + spl_pb = spl_pbuf_alloc_hugepage (SPL_PBUF_TRANSPORT, + p->tot_len + + g_offSetArry[SPL_PBUF_TRANSPORT], + SPL_PBUF_HUGE, proc_id, conn); + + if (!spl_pb) + { + NSPOL_LOGINF (TCP_DEBUG, "spl_pbuf_alloc_hugepage Failed!!!"); + return; + } + + pbuf_to_splpbuf_copy (spl_pb, p); + pbuf_free (p); + + buf = (struct spl_netbuf *) ((char *) spl_pb + sizeof (struct spl_pbuf)); + buf->p = spl_pb; spl_ip_addr_set (&buf->addr, ipaddr); buf->port = port; - err_t ret = sp_enqueue (cpcb, (void *) p); + err_t ret = sp_enqueue (cpcb, (void *) spl_pb); if (ret != ERR_OK) { NSPOL_LOGDBG (UDP_DEBUG, "mbox post failed"); @@ -1808,6 +1824,56 @@ do_listen (struct common_pcb *cpcb, msg_listen * lmsg) } /** + * Send some data on UDP pcb contained in a netconn + * Called from do_send + * + * @param msg the api_msg_msg pointing to the connection + */ +void +spl_udp_send (struct common_pcb *cpcb, msg_send_buf * smsg) +{ + struct spl_pbuf *p_from = smsg->p; + spl_netconn_t *conn = cpcb->conn; + struct udp_pcb *upcb = (struct udp_pcb *) (cpcb->conn->private_data); + data_com_msg *m = MSG_ENTRY (smsg, data_com_msg, buffer); + struct pbuf *p_to = NULL; + err_t err = ERR_OK; + + //allocate pbuf and copy spl_pbuf, send , free pbuf and spl_pbuf + do + { + p_to = pbuf_alloc (PBUF_TRANSPORT, p_from->len, PBUF_RAM); + if (NULL == p_to) + { + NSPOL_LOGERR ("pbuf is NULL]conn=%p,pcb=%p", conn, upcb); + return; + } + + err = splpbuf_to_pbuf_transport_copy (p_to, p_from); + if (err != ERR_OK) + { + SET_MSG_ERR (m, conn->last_err); + return; + } + + if (ip_addr_isany (&smsg->addr)) + { + SET_MSG_ERR (m, udp_send (upcb, p_to)); + } + else + { + SET_MSG_ERR (m, + udp_sendto (upcb, p_to, (ip_addr_t *) & smsg->addr, + smsg->port)); + } + + p_from = (struct spl_pbuf *) ADDR_SHTOL (p_from->next_a); + } + while (p_from != NULL); + +} + +/** * Send some data on a RAW or UDP pcb contained in a netconn * Called from netconn_send * @@ -1825,8 +1891,8 @@ do_send (struct common_pcb *cpcb, msg_send_buf * smsg) if (SPL_ERR_IS_FATAL (conn->last_err)) { SET_MSG_ERR (m, conn->last_err); - spl_pbuf_free (p); - return; + NSPOL_LOGERR ("Invalid param]msg->conn=%p", conn); + goto err_return; } switch (SPL_NETCONNTYPE_GROUP (cpcb->type)) @@ -1840,20 +1906,8 @@ do_send (struct common_pcb *cpcb, msg_send_buf * smsg) ss_set_local_ip (conn, smsg->local_ip.addr); } - //spl_ip_addr_t *destIP = &smsg->addr; + spl_udp_send (cpcb, smsg); - //@TODO udp send need to update like TCP. copy pbuf here. Once testing done for TCP we'll update it here. - if (ip_addr_isany (&smsg->addr)) - { - //SET_MSG_ERR(m, udp_send(upcb, p)); - /* destIP.addr == IPADDR_ANY means it is from stackx_send - and the destination is stored in remote_ip and remote port */ - //destIP = &upcb->remote_ip; - } - else - { - //SET_MSG_ERR(m, udp_sendto(upcb, p, &smsg->addr, smsg->port)); - } break; } @@ -1862,6 +1916,10 @@ do_send (struct common_pcb *cpcb, msg_send_buf * smsg) break; } +err_return: + pbuf_free_safe (smsg->p); + ASYNC_MSG_FREE (m); + return; } diff --git a/stacks/lwip_stack/lwip_src/core/spl_pbuf.c b/stacks/lwip_stack/lwip_src/core/spl_pbuf.c index 03e30ed..54589e8 100644 --- a/stacks/lwip_stack/lwip_src/core/spl_pbuf.c +++ b/stacks/lwip_stack/lwip_src/core/spl_pbuf.c @@ -369,6 +369,20 @@ spl_pbuf_copy (struct spl_pbuf * p_to, struct spl_pbuf * p_from) } err_t +splpbuf_to_pbuf_transport_copy (struct pbuf * p_to, struct spl_pbuf * p_from) +{ + if (EOK != MEMMOVE_S ((u8_t *) p_to->payload, + p_to->len, (u8_t *) ADDR_SHTOL (p_from->payload_a), + p_from->len)) + { + NSPOL_LOGERR ("MEMMOVE_S failed"); + return ERR_MEM; + } + + return ERR_OK; +} + +err_t splpbuf_to_pbuf_copy (struct pbuf * p_to, struct spl_pbuf * p_from) { u32_t offset_to = 0; diff --git a/stacks/lwip_stack/lwip_src/include/stackx/spl_pbuf.h b/stacks/lwip_stack/lwip_src/include/stackx/spl_pbuf.h index 01fe242..79deace 100644 --- a/stacks/lwip_stack/lwip_src/include/stackx/spl_pbuf.h +++ b/stacks/lwip_stack/lwip_src/include/stackx/spl_pbuf.h @@ -48,6 +48,9 @@ struct spl_pbuf *spl_pbuf_alloc_hugepage (spl_pbuf_layer l, u16_t length, spl_pbuf_type type, u16_t thread_index, void *net_conn); struct pbuf *spl_convert_spl_pbuf_to_pbuf (struct spl_pbuf *p_from); +err_t +splpbuf_to_pbuf_transport_copy (struct pbuf *p_to, struct spl_pbuf *p_from); + err_t pbuf_to_splpbuf_copy (struct spl_pbuf *p_to, struct pbuf *p_from); err_t splpbuf_to_pbuf_copy (struct pbuf *p_to, struct spl_pbuf *p_from); spl_pbuf_layer get_pbuf_layer_from_pbuf_payload (struct pbuf *buf); 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 d5b228b..03b5998 100644 --- a/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c +++ b/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c @@ -823,13 +823,7 @@ read_fn (i32 fd) return; } - const char *old_hbt_cnt = "6"; - const char *new_hbt_cnt = "60"; - nsfw_set_soft_para (NSFW_PROC_MASTER, NSFW_HBT_COUNT_PARAM, - (void *) new_hbt_cnt, sizeof (u16)); (void) read_configuration (); // if it returns -1, the err desc info will be wrote to g_config_data, so no need to check return value. - nsfw_set_soft_para (NSFW_PROC_MASTER, NSFW_HBT_COUNT_PARAM, - (void *) old_hbt_cnt, sizeof (u16)); offset = 0; left = MAX_IP_MODULE_BUFF_SIZE; diff --git a/stacks/lwip_stack/lwip_src/socket/stackx_event.c b/stacks/lwip_stack/lwip_src/socket/stackx_event.c index 93e47a3..1967ecc 100644 --- a/stacks/lwip_stack/lwip_src/socket/stackx_event.c +++ b/stacks/lwip_stack/lwip_src/socket/stackx_event.c @@ -17,13 +17,112 @@ #include "stackx_spl_share.h" #include "common_pal_bitwide_adjust.h" #include "stackx_event.h" -#include <netinet/in.h> - -#define FREE_FD_SET(readfd, writefd, exceptfd) {\ - if(readfd)\ - free(readfd);\ - if(writefd)\ - free(writefd);\ - if(exceptfd)\ - free(exceptfd);\ + +#define FREE_FD_SET(readfd, writefd, exceptfd) {\ +if(readfd)\ +free(readfd);\ +if(writefd)\ +free(writefd);\ +if(exceptfd)\ +free(exceptfd);\ +} + +int +lwip_try_select (int fdsize, fd_set * fdread, fd_set * fdwrite, + fd_set * fderr, struct timeval *timeout) +{ + int i; + int nready = 0; + nstack_fd_set *read_out; + nstack_fd_set *write_out; + nstack_fd_set *err_out; + nstack_fd_set *readfd = (nstack_fd_set *) fdread; + nstack_fd_set *writefd = (nstack_fd_set *) fdwrite; + nstack_fd_set *exceptfd = (nstack_fd_set *) fderr; + sbr_socket_t *sock; + spl_netconn_t *conn; + + if ((fdsize >= NSTACK_SETSIZE) || (fdsize < 0)) + { + return 0; + } + read_out = malloc (sizeof (nstack_fd_set)); + write_out = malloc (sizeof (nstack_fd_set)); + err_out = malloc (sizeof (nstack_fd_set)); + if ((!read_out) || (!write_out) || (!err_out)) + { + NSPOL_LOGERR ("malloc nstack_fd_set fail"); + FREE_FD_SET (read_out, write_out, err_out); + return -1; + } + int ret = NSTACK_FD_ZERO (read_out); + int ret1 = NSTACK_FD_ZERO (write_out); + int ret2 = NSTACK_FD_ZERO (err_out); + + if ((EOK != ret) || (EOK != ret1) || (EOK != ret2)) + { + NSPOL_LOGERR ("NSTACK_FD_ZERO fail"); + FREE_FD_SET (read_out, write_out, err_out); + return -1; + } + + for (i = 0; i < fdsize; i++) + { + if (!((readfd && NSTACK_FD_ISSET (i, readfd)) + || (writefd && NSTACK_FD_ISSET (i, writefd)) + || (exceptfd && NSTACK_FD_ISSET (i, exceptfd)))) + { + continue; + } + sock = sbr_lookup_sk (i); + if (sock == NULL) + { + errno = EBADF; + FREE_FD_SET (read_out, write_out, err_out); + return -1; + } + conn = sbr_get_conn (sock); + if (!conn) + { + errno = EBADF; + FREE_FD_SET (read_out, write_out, err_out); + return -1; + } + if (readfd && NSTACK_FD_ISSET (i, readfd) && + ((sbr_get_fd_share (sock)->lastdata != NULL) + || (conn->rcvevent > 0))) + { + NSTACK_FD_SET (i, read_out); + nready++; + } + if (writefd && NSTACK_FD_ISSET (i, writefd) && (conn->sendevent != 0)) + { + NSTACK_FD_SET (i, write_out); + nready++; + } + if (exceptfd && NSTACK_FD_ISSET (i, exceptfd) && (conn->errevent != 0)) + { + NSTACK_FD_SET (i, write_out); + nready++; + } + } + + //TODO: need to handle fd_set and nstack_fd_set memory issue + if (readfd) + { + *readfd = *read_out; + } + + if (writefd) + { + *writefd = *write_out; + } + + if (exceptfd) + { + *exceptfd = *err_out; + } + + FREE_FD_SET (read_out, write_out, err_out); + return nready; } diff --git a/stacks/lwip_stack/release/script/nstack_var.sh b/stacks/lwip_stack/release/script/nstack_var.sh index 15ef2f0..4c5c6f6 100644 --- a/stacks/lwip_stack/release/script/nstack_var.sh +++ b/stacks/lwip_stack/release/script/nstack_var.sh @@ -26,7 +26,7 @@ DPDK_FILE_NAME=nstack_dpdk.log export VM_ID=agent-node-x -export DPDK_INSTALL_PATH="/root/dpdk/dpdk-18.02" +export DPDK_INSTALL_PATH="/tmp/dpdk/dpdk-18.02/" 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 diff --git a/stacks/lwip_stack/release/start_nstack.sh b/stacks/lwip_stack/release/start_nstack.sh index c005f25..db0c084 100644 --- a/stacks/lwip_stack/release/start_nstack.sh +++ b/stacks/lwip_stack/release/start_nstack.sh @@ -1,9 +1,11 @@ #!/bin/bash -. ./script/nstack_var.sh -. ./script/nstack_fun.sh script_path=$(cd "$(dirname "$0")"; pwd) + +. ${script_path}/script/nstack_var.sh +. ${script_path}/script/nstack_fun.sh + config_name=${script_path}/script/nstack_var.sh if [ ! -e $config_name ]; then log $LINENO "nstack_var.sh not exit, plz check!" @@ -59,7 +61,7 @@ if [ -f "lockfile" ]; then rm lockfile fi -. ./script/nstack_var.sh +. ${script_path}/script/nstack_var.sh ######################################################## @@ -115,8 +117,7 @@ install_config core_mask=1 START_TYPE="primary" log $LINENO "./script/run_nstack_main.sh ${core_mask} $HUGE_DIR $MEM_SIZE $START_TYPE" -cd script -./run_nstack_main.sh $HUGE_DIR $MEM_SIZE +${script_path}/script/run_nstack_main.sh $HUGE_DIR $MEM_SIZE print_pid=$(ps -ux | grep nStackMain | awk '{print $2}' | awk 'NR == 2') echo "nStackMain PID:$print_pid" diff --git a/stacks/lwip_stack/release/stop_nstack.sh b/stacks/lwip_stack/release/stop_nstack.sh index 9b9fe94..48d1af7 100644 --- a/stacks/lwip_stack/release/stop_nstack.sh +++ b/stacks/lwip_stack/release/stop_nstack.sh @@ -1,9 +1,11 @@ #!/bin/bash -. ./script/nstack_var.sh -. ./script/nstack_fun.sh script_path=$(cd "$(dirname "$0")"; pwd) + +. ${script_path}/script/nstack_var.sh +. ${script_path}/script/nstack_fun.sh + config_name=${script_path}/script/nstack_var.sh if [ ! -e $config_name ]; then log $LINENO "$config_name not exit, plz pay attention and add back!,or it has resourcce leak." diff --git a/stacks/lwip_stack/run_stackx.txt b/stacks/lwip_stack/run_stackx.txt index 7322635..71cdd20 100644 --- a/stacks/lwip_stack/run_stackx.txt +++ b/stacks/lwip_stack/run_stackx.txt @@ -14,118 +14,36 @@ # limitations under the License. ######################################################################### -#build DPDK -#Note: build path /root/dpdk/ , install path /root/dpdk_install/tmp -=================================================================== -if [ -d /root/dpdk_install/tmp ]; then - rm -rf /root/dpdk_install/tmp -fi - -mkdir -p /root/dpdk - -cd /root/dpdk -rm -rf dpdk-16.04/ -wget https://fast.dpdk.org/rel/dpdk-16.04.tar.xz -tar xvf dpdk-16.04.tar.xz -cd dpdk-16.04/ - -sed -i 's!CONFIG_RTE_EXEC_ENV=.*!CONFIG_RTE_EXEC_ENV=y!1' config/common_base -sed -i 's!CONFIG_RTE_BUILD_SHARED_LIB=.*!CONFIG_RTE_BUILD_SHARED_LIB=y!1' config/common_base -sed -i 's!CONFIG_RTE_LIBRTE_EAL=.*!CONFIG_RTE_LIBRTE_EAL=y!1' config/common_base - -make install T=x86_64-native-linuxapp-gcc DESTDIR=/root/dpdk_install/tmp -cd x86_64-native-linuxapp-gcc -make - -cp -r /root/dpdk/dpdk-16.04/tools/dpdk_nic_bind.py /root/dpdk/dpdk-16.04/tools/dpdk-devbind.py - -mount -t hugetlbfs -o pagesize=1G none /mnt/nstackhuge/ -mkdir /var/run/ip_module - -#verify hugepages 8GB free hugepages are required -================================================= -cat /proc/meminfo - -#build DMM -============ -#got to DMM/ - -cd thirdparty/glog/glog-0.3.4/ -sudo autoreconf -ivf - -cd - -cd build/ - -cmake .. -make -j 8 - -#build stackx -================ -cd ../thirdparty/glog/glog-0.3.4/ -sudo autoreconf -ivf - -cd - -cd ../stacks/lwip_stack/build/ - -cmake .. -make -j 8 - -#run app +#build DPDK, DMM, lwip stack by calling build script: +==================================================== + cd dmm/stacks/lwip_stack/vagrant + build.sh + +#update interface name if required(default enp0s8) in dmm/stacks/lwip_stack/vagrant/start_nstackMain.sh +#Start nStackMain: +================= + 1.for the first time (to configure json files and start nStackMain) + cd dmm/stacks/lwip_stack/vagrant + ./start_nstackMain.sh + + 2.from secod time: + cd dmm/stacks/lwip_stack/release + ./start_nstack.sh + +#get configured client/server ip from dmm/stacks/lwip_stack/release/bin/ip_data.json +#can get the log path details from dmm/stacks/lwip_stack/release/bin/nStackConfig.json + +#run app: ======== -cd ../ -chmod +x release_tar.sh -./release_tar.sh - -tar -zxf nStackServer.tar.gz - -cd nStackServer/ -cp configure/*.json bin/ - -##make json file changes -#I have copied the working configs in the path /home/sharath/working_config/ - -#server -cp -r /home/sharath/working_config/server/ip_data.json bin/ -cp -r /home/sharath/working_config/server/network_data_tonStack.json bin/ -cp -r /home/sharath/working_config/server/nStackConfig.json bin/ - -#client -cp -r /home/sharath/working_config/client/ip_data.json bin/ -cp -r /home/sharath/working_config/client/network_data_tonStack.json bin/ -cp -r /home/sharath/working_config/client/nStackConfig.json bin/ - -#dpdk download path : /root/dpdk/dpdk-16.04/ -sed -i 's!export DPDK_INSTALL_PATH.*!export DPDK_INSTALL_PATH="/root/dpdk/dpdk-16.04"!1' ../release/script/nstack_var.sh + cd dmm/stacks/lwip_stack/app_test -cd ../../../release/bin/ -cp ../configure/*.json . + #server + ./vs_epoll -p 20000 -d {client_ip} -a 10000 -s {ser_ip} -l 200 -t 5000000 -i 0 -f 1 -r 20000 -n 1 -w 10 -u 10000 -e 10 -x 1 -#server -cp -r /home/sharath/working_config/server/module_config.json . -cp -r /home/sharath/working_config/server/nStackConfig.json . -cp -r /home/sharath/working_config/server/rd_config.json . + #client + ./vc_epoll -p 20000 -d {ser_ip} -a 10000 -s {client_ip} -l 200 -t 50000 -i 1000 -f 1 -r 20000 -n 1 -w 10 -u 10000 -e 10 -x 1 -#client -cp -r /home/sharath/working_config/client/module_config.json . -cp -r /home/sharath/working_config/client/nStackConfig.json . -cp -r /home/sharath/working_config/client/rd_config.json . - -cd - -./stop_nstack.sh -./start_nstack.sh - -#verify process up -ps aux | grep nS - -cd bin -./nStackCtrl -a add -p ./network_data_tonStack.json -t network -./nStackCtrl -a add -p ./ip_data.json -t ip - -cd ../../../../release/bin/ -cp ../../stacks/lwip_stack/release/lib64/libnstack.so . - -#server -./vs_epoll -p 20000 -d 192.168.1.207 -a 10000 -s 192.168.1.206 -l 200 -t 5000000 -i 0 -f 1 -r 20000 -n 1 -w 10 -u 10000 -e 10 -x 1 - -#client -./vc_epoll -p 20000 -d 192.168.1.206 -a 10000 -s 192.168.1.207 -l 200 -t 50000 -i 1000 -f 1 -r 20000 -n 1 -w 10 -u 10000 -e 10 -x 1 +#stop nStackMain: +================ + cd dmm/stacks/lwip_stack/release + ./stop_nstack.sh diff --git a/stacks/lwip_stack/src/alarm/alarm.c b/stacks/lwip_stack/src/alarm/alarm.c index 5f89cdd..c158144 100644 --- a/stacks/lwip_stack/src/alarm/alarm.c +++ b/stacks/lwip_stack/src/alarm/alarm.c @@ -158,11 +158,9 @@ ns_alarm_module_init (void *param) switch (proc_type) { case NSFW_PROC_MAIN: - - case NSFW_PROC_MASTER: case NSFW_PROC_CTRL: - /* [S138713][p00329905][20171219]modify ip address to vm id */ + /* modify ip address to vm id */ pst_vm_id = getenv ("VM_ID"); if (INVALID_STR_LEN (pst_vm_id, MIN_VM_ID_LEN, MAX_VM_ID_LEN)) diff --git a/stacks/lwip_stack/src/maintain/fw_mt_config.c b/stacks/lwip_stack/src/maintain/fw_mt_config.c index 400eaa0..403a46e 100644 --- a/stacks/lwip_stack/src/maintain/fw_mt_config.c +++ b/stacks/lwip_stack/src/maintain/fw_mt_config.c @@ -558,8 +558,7 @@ init_base_config (cfg_module_param * param) { /* initial default config */ /* omc_ctrl single log file should be 10M */ - if (param->proc_type == NSFW_PROC_MASTER - || param->proc_type == NSFW_PROC_CTRL) + if (param->proc_type == NSFW_PROC_CTRL) { init_master_def_config_items (); } @@ -684,26 +683,6 @@ init_main_log_cfg_para () set_log_init_para (&log_para); } -NSTACK_STATIC void -init_master_log_cfg_para () -{ - struct log_init_para log_para; - log_para.mon_log_size = g_cfg_item_info[CFG_SEG_LOG][0].value; - log_para.mon_log_count = g_cfg_item_info[CFG_SEG_LOG][1].value; - - /* log path valid check */ - if (0 == access (g_cfg_item_info[CFG_SEG_PATH][0].pvalue, W_OK)) - { - log_para.mon_log_path = g_cfg_item_info[CFG_SEG_PATH][0].pvalue; - } - else - { - log_para.mon_log_path = g_cfg_item_info[CFG_SEG_PATH][0].default_str; - } - - set_log_init_para (&log_para); -} - /* nStackCtrl is the diff process with main, cannot use main process info, need get the configure info respectively */ /* omc_ctrl single log file should be 10M */ @@ -739,17 +718,6 @@ init_module_cfg_nstackmain () init_main_log_cfg_para (); } -/*===========config init for nstack master=============*/ - -NSTACK_STATIC void -init_module_cfg_nstackmaster () -{ - /* init config data */ - init_module_cfg_default (); - - init_master_log_cfg_para (); -} - /*===========config init for nstack ctrl=============*/ /* nStackCtrl is the diff process with main, @@ -776,10 +744,6 @@ config_module_init (cfg_module_param * param) init_module_cfg_nstackmain (); break; - case NSFW_PROC_MASTER: - init_module_cfg_nstackmaster (); - break; - case NSFW_PROC_CTRL: init_module_cfg_nstackctrl (); break; diff --git a/stacks/lwip_stack/src/sbr/sbr_protocol_api.h b/stacks/lwip_stack/src/sbr/sbr_protocol_api.h index 0eac1c4..95ca565 100644 --- a/stacks/lwip_stack/src/sbr/sbr_protocol_api.h +++ b/stacks/lwip_stack/src/sbr/sbr_protocol_api.h @@ -91,6 +91,8 @@ int sbr_init_protocol (); int sbr_fork_protocol (); sbr_fdopt *sbr_get_fdopt (int domain, int type, int protocol); void sbr_app_touch_in (void); /*app send its version info to nStackMain */ +int lwip_try_select (int fdsize, fd_set * fdread, fd_set * fdwrite, + fd_set * fderr, struct timeval *timeout); #ifdef __cplusplus /* *INDENT-OFF* */ diff --git a/stacks/lwip_stack/src/sbr/sbr_socket.c b/stacks/lwip_stack/src/sbr/sbr_socket.c index e088224..6f867ab 100644 --- a/stacks/lwip_stack/src/sbr/sbr_socket.c +++ b/stacks/lwip_stack/src/sbr/sbr_socket.c @@ -1065,7 +1065,7 @@ SBR_INTERCEPT (int, select, (int nfds, fd_set * readfd, fd_set * writefd, fd_set * exceptfd, struct timeval * timeout)) { - return -1; + return lwip_try_select (nfds, readfd, writefd, exceptfd, timeout); } SBR_INTERCEPT (unsigned int, ep_getevt, diff --git a/stacks/lwip_stack/vagrant/start_nstackMain.sh b/stacks/lwip_stack/vagrant/start_nstackMain.sh index 72d1375..00d4370 100755 --- a/stacks/lwip_stack/vagrant/start_nstackMain.sh +++ b/stacks/lwip_stack/vagrant/start_nstackMain.sh @@ -60,9 +60,8 @@ elif [ "$OS_ID" == "ubuntu" ]; then fi cd $LWIP_BUILD_DIR/../ -bash ./release_tar.sh -cd nStackServer/script -sed -i 's!/root/dpdk/dpdk-18.02!'$DPDK_DOWNLOAD_PATH'/dpdk-18.02!1' nstack_var.sh +cd release/script +sed -i 's!DPDK_INSTALL_PATH=.*!DPDK_INSTALL_PATH='$DPDK_DOWNLOAD_PATH'/dpdk-18.02!1' nstack_var.sh cd ../ chmod 775 * @@ -105,7 +104,7 @@ sudo mkdir -p /var/log/nStack/ip_module/ export LD_LIBRARY_PATH=$LIB_PATH export NSTACK_LOG_ON=DBG -cd $LWIP_BUILD_DIR/../nStackServer +cd $LWIP_BUILD_DIR/../release bash -x ./stop_nstack.sh bash -x ./start_nstack.sh check_result=$(pgrep nStackMain) |