From 2a42ad20b9730706ad371ae3787d4597c4e42276 Mon Sep 17 00:00:00 2001 From: sharath reddy Date: Tue, 4 Jun 2019 11:53:49 +0530 Subject: Feature: 19.04 part-2 Change-Id: I0b52a6bb67c25c7955d58e29eb81a3cc9efea9e9 Signed-off-by: sharath reddy --- stacks/lwip_stack/doc/README.md | 125 +++++++++++++++++++++++++++++++++++++ stacks/lwip_stack/doc/dmm_lwip.png | Bin 0 -> 52940 bytes 2 files changed, 125 insertions(+) create mode 100644 stacks/lwip_stack/doc/README.md create mode 100644 stacks/lwip_stack/doc/dmm_lwip.png (limited to 'stacks/lwip_stack/doc') diff --git a/stacks/lwip_stack/doc/README.md b/stacks/lwip_stack/doc/README.md new file mode 100644 index 0000000..a76b18a --- /dev/null +++ b/stacks/lwip_stack/doc/README.md @@ -0,0 +1,125 @@ +# 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. +![Lwip in DMM framework](dmm_lwip.png) + +## 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/configure/module_config.json + #export NSTACK_MOD_CFG_RD=${dmm}/stacks/lwip_stack/configure/rd_config.json + #export NSTACK_LOG_ON=DBG (optional enable debug) +``` +- Steps 2: Modify rd_config.json(located at dmm/stacks/lwip_stack/configure/) +```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 +``` + +If you want to run it with vhost-user, you can run the start_nstack.sh with parameters as follow. +``` + #./start_nstack.sh --vdev virtio_user,mac=fa:16:3e:5f:b3:08,path=/tmp/unix/sock1.sock,queues=8,queue_size=1024 --no-pci +``` + +- 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 new file mode 100644 index 0000000..403eed3 Binary files /dev/null and b/stacks/lwip_stack/doc/dmm_lwip.png differ -- cgit 1.2.3-korg