summaryrefslogtreecommitdiffstats
path: root/stacks/lwip_stack/doc/README.md
blob: a76b18a20b1ff387834b118852b9aff2e22bd864 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
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)