Skip to content

Commit e094c9d

Browse files
authored
Merge pull request #757 from iqiyi/devel
Release v1.9.0
2 parents 8c4ea56 + 471d8f1 commit e094c9d

File tree

113 files changed

+3685
-4353
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+3685
-4353
lines changed

.github/workflows/build.yaml

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,44 +16,19 @@ jobs:
1616
build-basic:
1717
runs-on: self-hosted
1818
env:
19-
RTE_SDK: /data/dpdk/intel/dpdk-stable-18.11.2
20-
RTE_TARGET: x86_64-native-linuxapp-gcc
19+
PKG_CONFIG_PATH: /data/dpdk/dpdklib/lib64/pkgconfig
2120
steps:
2221
- uses: actions/checkout@v2
2322
- name: make
24-
run: make -j32
23+
run: make -j
2524

26-
build-mlnx:
27-
runs-on: self-hosted
28-
env:
29-
RTE_SDK: /data/dpdk/mlnx/dpdk-stable-18.11.2
30-
RTE_TARGET: x86_64-native-linuxapp-gcc
31-
steps:
32-
- uses: actions/checkout@v2
33-
- name: config
34-
run: sed -i 's/^CONFIG_MLX5=./CONFIG_MLX5=y/' src/config.mk
35-
- name: make
36-
run: make -j32
37-
3825
build-debug:
3926
runs-on: self-hosted
4027
env:
41-
RTE_SDK: /data/dpdk/intel/dpdk-stable-18.11.2
42-
RTE_TARGET: x86_64-native-linuxapp-gcc
28+
PKG_CONFIG_PATH: /data/dpdk/dpdklib/lib64/pkgconfig
4329
steps:
4430
- uses: actions/checkout@v2
4531
- name: config
4632
run: sed -i 's/#CFLAGS +=/CFLAGS +=/' src/config.mk && sed -i 's/^#DEBUG := 1/DEBUG := 1/' src/Makefile
4733
- name: make
48-
run: make -j32
49-
50-
build-olddpdk:
51-
runs-on: self-hosted
52-
env:
53-
RTE_SDK: /data/dpdk/intel/dpdk-stable-17.11.6
54-
RTE_TARGET: x86_64-native-linuxapp-gcc
55-
steps:
56-
- uses: actions/checkout@v2
57-
- name: make
58-
run: make -j32
59-
34+
run: make -j

.github/workflows/run.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ jobs:
1616
run-dpvs:
1717
runs-on: self-hosted
1818
env:
19-
RTE_SDK: /data/dpdk/intel/dpdk-stable-18.11.2
20-
RTE_TARGET: x86_64-native-linuxapp-gcc
19+
PKG_CONFIG_PATH: /data/dpdk/dpdklib/lib64/pkgconfig
2120
steps:
2221
- uses: actions/checkout@v2
2322
- name: make
24-
run: make -j32
23+
run: make -j
2524
- name: install
2625
run: make install
2726
- name: run-dpvs

README.md

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
`DPVS` is a high performance **Layer-4 load balancer** based on [DPDK](http://dpdk.org). It's derived from Linux Virtual Server [LVS](http://www.linuxvirtualserver.org/) and its modification [alibaba/LVS](https://github.com/alibaba/LVS).
88

9-
> The name `DPVS` comes from "DPDK-LVS".
9+
> Notes: The name `DPVS` comes from "DPDK-LVS".
1010
1111
![dpvs.png](./pic/dpvs.png)
1212

@@ -52,7 +52,9 @@ This *quick start* is tested with the environment below.
5252
Other environments should also be OK if DPDK works, please check [dpdk.org](http://www.dpdk.org) for more info.
5353

5454
* Please check this link for NICs supported by DPDK: http://dpdk.org/doc/nics.
55-
* Note `flow-director` ([fdir](http://dpdk.org/doc/guides/nics/overview.html#id1)) is needed for `FNAT` and `SNAT` mode with multi-cores.
55+
* Note `flow control` ([rte_flow](http://dpdk.org/doc/guides/nics/overview.html#id1)) is needed for `FNAT` and `SNAT` mode with multi-cores.
56+
57+
> Notes: To let dpvs work properly with multi-cores, rte_flow items must support "ipv4, ipv6, tcp, udp" four items, and rte_flow actions must support "drop, queue" at least.
5658
5759
## Clone DPVS
5860

@@ -65,48 +67,49 @@ Well, let's start from DPDK then.
6567

6668
## DPDK setup.
6769

68-
Currently, `dpdk-stable-18.11.2` is recommended for `DPVS`. `dpdk-stable-17.11.2` and `dpdk-stable-17.11.6` are supported until the lifecycle end of DPVS v1.8.
70+
Currently, `dpdk-stable-20.11.1` is recommended for `DPVS`, and we will not support dpdk version earlier than dpdk-20.11 any more. If you are still using earlier dpdk versions, such as `dpdk-stable-17.11.2`, `dpdk-stable-17.11.6` and `dpdk-stable-18.11.2`, please use earlier dpvs releases, such as [v1.8.10](https://github.com/iqiyi/dpvs/releases/tag/v1.8.10).
6971

70-
> You can skip this section if experienced with DPDK, and refer the [link](http://dpdk.org/doc/guides/linux_gsg/index.html) for details.
72+
> Notes: You can skip this section if experienced with DPDK, and refer the [link](http://dpdk.org/doc/guides/linux_gsg/index.html) for details.
7173
7274
```bash
73-
$ wget https://fast.dpdk.org/rel/dpdk-18.11.2.tar.xz # download from dpdk.org if link failed.
74-
$ tar xf dpdk-18.11.2.tar.xz
75+
$ wget https://fast.dpdk.org/rel/dpdk-20.11.1.tar.xz # download from dpdk.org if link failed.
76+
$ tar xf dpdk-20.11.1.tar.xz
7577
```
7678

7779
### DPDK patchs
7880

7981
There are some patches for DPDK to support extra features needed by DPVS. Apply them if needed. For example, there's a patch for DPDK `kni` driver for hardware multicast, apply it if you are to launch `ospfd` on `kni` device.
8082

81-
> Assuming we are in DPVS root directory and dpdk-stable-18.11.2 is under it, please note it's not mandatory, just for convenience.
83+
> Notes: Assuming we are in DPVS root directory and dpdk-stable-20.11.1 is under it, please note it's not mandatory, just for convenience.
8284
8385
```
8486
$ cd <path-of-dpvs>
85-
$ cp patch/dpdk-stable-18.11.2/*.patch dpdk-stable-18.11.2/
86-
$ cd dpdk-stable-18.11.2/
87+
$ cp patch/dpdk-stable-20.11.1/*.patch dpdk-stable-20.11.1/
88+
$ cd dpdk-stable-20.11.1/
8789
$ patch -p1 < 0001-kni-use-netlink-event-for-multicast-driver-part.patch
88-
$ patch -p1 < 0002-net-support-variable-IP-header-len-for-checksum-API.patch
90+
$ patch -p1 < 0002-pdump-change-dpdk-pdump-tool-for-dpvs.patch
8991
$ ...
9092
```
9193

92-
> It's advised to patch all if your are not sure about what they are meant for.
94+
> Tips: It's advised to patch all if your are not sure about what they are meant for.
9395
9496
### DPDK build and install
9597

96-
Now build DPDK and export `RTE_SDK` env variable for DPDK app (DPVS).
98+
Use meson-ninja to build DPDK libraries, and export environment variable `PKG_CONFIG_PATH` for DPDK app (DPVS). The `dpdk.mk` in DPVS checks the presence of libdpdk.
9799

98100
```bash
99-
$ cd dpdk-stable-18.11.2/
100-
$ make config T=x86_64-native-linuxapp-gcc
101-
Configuration done
102-
$ make # or make -j40 to save time, where 40 is the cpu core number.
103-
$ export RTE_SDK=$PWD
104-
$ export RTE_TARGET=build
101+
$ cd dpdk-stable-20.11.1
102+
$ mkdir dpdklib # user desired install folder
103+
$ mkdir dpdkbuild # user desired build folder
104+
$ meson -Denable_kmods=true -Dprefix=dpdklib dpdkbuild
105+
$ ninja -C dpdkbuild
106+
$ cd dpdkbuild; ninja install
107+
$ export PKG_CONFIG_PATH=$(pwd)/../dpdklib/lib64/pkgconfig/libdpdk.pc
105108
```
106109

107-
In our tutorial, `RTE_TARGET` is set to the default "build", thus DPDK libs and header files can be found in `dpdk-stable-18.11.2/build`.
110+
> Tips: You can use script [dpdk-build.sh](./scripts/dpdk-build.sh) to facilitate dpdk build. Run `dpdk-build.sh -h` for the usage of the script.
108111
109-
Now to set up DPDK hugepage, our test environment is NUMA system. For single-node system please refer to the [link](http://dpdk.org/doc/guides/linux_gsg/sys_reqs.html).
112+
Next is to set up DPDK hugepage. Our test environment is NUMA system. For single-node system please refer to the [link](http://dpdk.org/doc/guides/linux_gsg/sys_reqs.html).
110113

111114
```bash
112115
$ # for NUMA machine
@@ -117,40 +120,41 @@ $ mkdir /mnt/huge
117120
$ mount -t hugetlbfs nodev /mnt/huge
118121
```
119122

120-
Install kernel modules and bind NIC with `igb_uio` driver. Quick start uses only one NIC, normally we use 2 for FNAT cluster, even 4 for bonding mode. For example, suppose the NIC we would use to run DPVS is eth0, in the meantime, we still keep another standalone NIC eth1 for debugging.
123+
Install kernel modules and bind NIC with `uio_pci_generic` driver. Quick start uses only one NIC, normally we use two for FNAT cluster, even four for bonding mode. For example, suppose the NIC we would use to run DPVS is eth0, in the meantime, we still keep another standalone NIC eth1 for debugging.
121124

122125
```bash
123-
$ modprobe uio
124-
$ cd dpdk-stable-18.11.2
126+
$ modprobe uio_pci_generic
125127

126-
$ insmod build/kmod/igb_uio.ko
127-
$ insmod build/kmod/rte_kni.ko carrier=on
128+
$ cd dpdk-stable-20.11.1
129+
$ insmod dpdkbuild/kernel/linux/kni/rte_kni.ko carrier=on
128130

129131
$ ./usertools/dpdk-devbind.py --status
130-
$ ifconfig eth0 down # assuming eth0 is 0000:06:00.0
131-
$ ./usertools/dpdk-devbind.py -b igb_uio 0000:06:00.0
132+
$ ifconfig eth0 down # assuming eth0 is 0000:06:00.0
133+
$ ./usertools/dpdk-devbind.py -b uio_pci_generic 0000:06:00.0
132134
```
133135

134-
> Note that a kernel parameter `carrier` is added to `rte_kni.ko` since [DPDK v18.11](https://elixir.bootlin.com/dpdk/v18.11/source/kernel/linux/kni/kni_misc.c), and the default value for it is "off". We need to load `rte_kni.ko` with the extra parameter `carrier=on` to make KNI devices work properly.
136+
> Notes:
137+
> 1. An alternative to the `uio_pci_generic` is `igb_uio`, which is moved to a separated repository [dpdk-kmods](http://git.dpdk.org/dpdk-kmods).
138+
> 2. A kernel module parameter `carrier` is added to `rte_kni.ko` since [DPDK v18.11](https://elixir.bootlin.com/dpdk/v18.11/source/kernel/linux/kni/kni_misc.c), and the default value for it is "off". We need to load `rte_kni.ko` with the extra parameter `carrier=on` to make KNI devices work properly.
135139
136140
`dpdk-devbind.py -u` can be used to unbind driver and switch it back to Linux driver like `ixgbe`. You can also use `lspci` or `ethtool -i eth0` to check the NIC PCI bus-id. Please refer to [DPDK site](http://www.dpdk.org) for more details.
137141

138-
> Note: PMD of Mellanox NIC is built on top of libibverbs using the Raw Ethernet Accelerated Verbs AP. It doesn't rely on UIO/VFIO driver. Thus, Mellanox NICs should not bind the `igb_uio` driver. Refer to [Mellanox DPDK](https://community.mellanox.com/s/article/mellanox-dpdk) for details.
142+
> Notes: PMD of Mellanox NIC is built on top of libibverbs using the Raw Ethernet Accelerated Verbs AP. It doesn't rely on UIO/VFIO driver. Thus, Mellanox NICs should not bind the `igb_uio` driver. Refer to [Mellanox DPDK](https://community.mellanox.com/s/article/mellanox-dpdk) for details.
139143
140144
## Build DPVS
141145

142-
It's simple, just set `RTE_SDK` and build it.
146+
It's simple, just set `PKG_CONFIG_PATH` and build it.
143147

144148
```bash
145-
$ cd dpdk-stable-18.11.2/
146-
$ export RTE_SDK=$PWD
149+
$ export PKG_CONFIG_PATH=<path-of-libdpdk.pc> # normally located at dpdklib/lib64/pkgconfig/libdpdk.pc
147150
$ cd <path-of-dpvs>
148151

149-
$ make # or "make -j40" to speed up.
152+
$ make # or "make -j" to speed up
150153
$ make install
151154
```
152-
153-
> Build dependencies may be needed, such as `automake`, `libnl3`, `libnl-genl-3.0`, `openssl`, `popt` and `numactl`. You can install the missing dependencies by using the package manager of the system, e.g., `yum install popt-devel` (CentOS).
155+
> Notes:
156+
> 1. Build dependencies may be needed, such as `pkg-config`(version 0.29.2+),`automake`, `libnl3`, `libnl-genl-3.0`, `openssl`, `popt` and `numactl`. You can install the missing dependencies by using the package manager of the system, e.g., `yum install popt-devel` (CentOS).
157+
> 2. Early `pkg-config` versions (v0.29.2 before) may cause dpvs build failure. If so, please upgrade this tool.
154158
155159
Output files are installed to `dpvs/bin`.
156160

@@ -196,7 +200,7 @@ EAL: Error - exiting with code: 1
196200
```
197201
>It means the NIC count of DPVS does not match `/etc/dpvs.conf`. Please use `dpdk-devbind` to adjust the NIC number or modify `dpvs.conf`. We'll improve this part to make DPVS more "clever" to avoid modify config file when NIC count does not match.
198202
199-
What config items does `dpvs.conf` support and how to configure them? Well, `DPVS` maintains a config item file `conf/dpvs.conf.items` which lists all supported config entries and corresponding feasible values.
203+
What config items does `dpvs.conf` support? How to configure them? Well, `DPVS` maintains a config item file `conf/dpvs.conf.items` which lists all supported config entries and corresponding feasible values. Besides, some config sample files maintained as `./conf/dpvs.*.sample` show the configurations of dpvs in some specified cases.
200204

201205
## Test Full-NAT (FNAT) Load Balancer
202206

conf/dpvs.bond.conf.sample

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ global_defs {
2222
netif_defs {
2323
<init> pktpool_size 1048575
2424
<init> pktpool_cache 256
25+
<init> fdir_mode perfect
2526

2627
<init> device dpdk0 {
2728
rx {
@@ -33,11 +34,6 @@ netif_defs {
3334
queue_number 8
3435
descriptor_number 1024
3536
}
36-
fdir {
37-
mode perfect
38-
pballoc 64k
39-
status matched
40-
}
4137
! mtu 1500
4238
! promisc_mode
4339
! kni_name dpdk0.kni
@@ -53,11 +49,6 @@ netif_defs {
5349
queue_number 8
5450
descriptor_number 1024
5551
}
56-
fdir {
57-
mode perfect
58-
pballoc 64k
59-
status matched
60-
}
6152
! mtu 1500
6253
! promisc_mode
6354
! kni_name dpdk1.kni
@@ -74,11 +65,6 @@ netif_defs {
7465
queue_number 8
7566
descriptor_number 1024
7667
}
77-
fdir {
78-
mode perfect
79-
pballoc 64k
80-
status matched
81-
}
8268
! mtu 1500
8369
! promisc_mode
8470
! kni_name dpdk2.kni
@@ -94,11 +80,6 @@ netif_defs {
9480
queue_number 8
9581
descriptor_number 1024
9682
}
97-
fdir {
98-
mode perfect
99-
pballoc 64k
100-
status matched
101-
}
10283
! mtu 1500
10384
! promisc_mode
10485
! kni_name dpdk3.kni
@@ -109,6 +90,7 @@ netif_defs {
10990
slave dpdk0
11091
slave dpdk1
11192
primary dpdk0
93+
! numa_node 1 ! /sys/bus/pci/devices/[slaves' pci]/numa_node
11294
kni_name bond0.kni
11395
}
11496

@@ -117,6 +99,7 @@ netif_defs {
11799
slave dpdk2
118100
slave dpdk3
119101
primary dpdk2
102+
! numa_node 1 ! /sys/bus/pci/devices/[slaves' pci]/numa_node
120103
kni_name bond1.kni
121104
}
122105
}
@@ -250,7 +233,7 @@ worker_defs {
250233
<init> worker cpu8 {
251234
type slave
252235
cpu_id 8
253-
icmp_redirect_core
236+
! icmp_redirect_core
254237
port bond0 {
255238
rx_queue_ids 7
256239
tx_queue_ids 7
@@ -386,5 +369,6 @@ ipvs_defs {
386369

387370
! sa_pool config
388371
sa_pool {
389-
pool_hash_size 16
372+
pool_hash_size 16
373+
flow_enable on
390374
}

conf/dpvs.conf.items

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ global_defs {
2222
netif_defs {
2323
<init> pktpool_size 2097151 <65535, 1023-134217728>
2424
<init> pktpool_cache 256 <256, 32-8192>
25+
<init> fdir_mode perfect <perfect, perfect|signature> # only for ixgbe
2526

2627
<init> device dpdk0 {
2728
rx {
@@ -34,12 +35,6 @@ netif_defs {
3435
queue_number 6 <16, 0-16>
3536
descriptor_number 512 <512, 16-8192>
3637
}
37-
fdir {
38-
<init> filter on <on, on/off>
39-
mode perfect <perfect, none|signature|perfect|perfect_mac_vlan|perfect_tunnel>
40-
pballoc 64k <64k, 64k|128k|256k>
41-
status matched <matched, close|matched|always>
42-
}
4338
! mtu 1500 <1500,0-9000>
4439
! promisc_mode <disable>
4540
! kni_name dpdk0.kni <char[32]>
@@ -61,12 +56,17 @@ netif_defs {
6156
! kni_name dpdk1.kni
6257
}
6358

64-
<init> device bond0 {
59+
<init> bonding bond0 {
6560
mode 4 <0-6>
6661
slave dpdk0 <device name>
6762
slave dpdk1 <device name>
6863
primary dpdk0 <device name, use primary slave queue conf for bond>
64+
numa_node 0 <0, int value from /sys/bus/pci/devices/[pci_bus]/numa_node>
6965
kni_name bond0.kni <char[32]>
66+
67+
! supported options:
68+
! dedicated_queues=on|enable|off|disable, default on
69+
options OPT1=VAL1;OPT2=VAL2;...
7070
}
7171
}
7272

@@ -262,4 +262,5 @@ ipvs_defs {
262262

263263
sa_pool {
264264
<init> pool_hash_size 16 <16, 1-128>
265+
<init> flow_enable on <on, on|off>
265266
}

0 commit comments

Comments
 (0)