Skip to content

Commit 6ddc860

Browse files
authored
Merge pull request #933 from iqiyi/devel
release v1.9.6
2 parents 30e5588 + b7216d1 commit 6ddc860

File tree

387 files changed

+46338
-1045
lines changed

Some content is hidden

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

387 files changed

+46338
-1045
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ jobs:
2222
- name: make
2323
run: make -j
2424

25-
build-debug:
25+
build-all:
2626
runs-on: self-hosted
2727
env:
2828
PKG_CONFIG_PATH: /data/dpdk/dpdklib/lib64/pkgconfig
2929
steps:
3030
- uses: actions/checkout@v2
3131
- name: config
32-
run: sed -i 's/#CFLAGS +=/CFLAGS +=/' src/config.mk && sed -i 's/^#DEBUG := 1/DEBUG := 1/' src/Makefile
32+
run: sed -i 's/=n$/=y/' config.mk
3333
- name: make
3434
run: make -j

Dockerfile

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
# Important Notes:
2+
#
3+
# Two local dependencies should be ready before build container image with the Dockerfile.
4+
# - MLNX_OFED: Please download it from the official website
5+
# `https://network.nvidia.com/products/infiniband-drivers/linux/mlnx_ofed/`
6+
# to the local fileserver indicated by the ARG `MLNX_OFED`.
7+
# We cannot download it in the Dockerfile automatically for the authentication
8+
# restriction of the website.
9+
# - RPM_PKGCONFIG: The `pkg-config` tool of v0.29.2 is required to build DPVS.
10+
# However, the default installation version on centos7 is v0.27.1. You need to
11+
# download it or build the v0.29.2 RPM from source and put it to the the local
12+
# fileserver indicated by the ARG `RPM_PKGCONFIG`. Alternatively, building a
13+
# binary `pkg-config` and installing it in the local binary path is also ok.
14+
#
15+
# No kernel dependencies of dpdk/dpvs or network driver are built and installed.
16+
# You should ensure the host has installed the drivers before running a dpvs
17+
# container on it.
18+
#
19+
20+
ARG BASE_IMAGE=centos:centos7.9.2009
21+
22+
###### `builder` stage builds the docker image for DPVS devel environments ######
23+
FROM $BASE_IMAGE as builder
24+
25+
# replace it with the address of your own file server
26+
ARG FILE_SERVER=127.0.0.1
27+
28+
LABEL maintainer="IQiYi/QLB team"
29+
LABEL email="iig_cloud_qlb@qiyi.com"
30+
LABEL project="https://github.com/iqiyi/dpvs"
31+
LABEL image_maker="docker build --target builder -t github.com/iqiyi/dpvs-builder:{version} ."
32+
33+
# download the tarball from https://network.nvidia.com/products/infiniband-drivers/linux/mlnx_ofed/
34+
# FIXME: remove thefile server dependency
35+
ARG MLNX_OFED=http://$FILE_SERVER/deploy/MLNX_OFED/MLNX_OFED_LINUX-5.6-2.0.9.0-rhel7.9-x86_64.tgz
36+
37+
# the pkgconfig default installed version is 0.27.1 on centos7, update it to 0.29.2
38+
# the 0.29.2 rpm is built from source based on the rpm spec file of 0.27.1.
39+
# FIXME: remove the file server dependency
40+
ARG RPM_PKGCONFIG=http://$FILE_SERVER/deploy/rpms/centos7/pkgconfig-0.29.2-1.el7.x86_64.rpm
41+
42+
# golang install files
43+
ARG GO_PACKAGE=https://go.dev/dl/go1.20.4.linux-amd64.tar.gz
44+
45+
# go-swagger binary
46+
ARG GO_SWAGGER_BIN=https://github.com/go-swagger/go-swagger/releases/download/v0.30.4/swagger_darwin_amd64
47+
48+
ENV PKG_CONFIG_PATH=/dpvs/dpdk/dpdklib/lib64/pkgconfig
49+
ENV PATH=$PATH:/usr/local/go/bin
50+
51+
COPY . /dpvs/
52+
WORKDIR /dpvs
53+
54+
RUN set -x \
55+
&& yum install -y epel-release \
56+
&& yum install -y tcl tk iproute wget vim patch meson python36 emacs-filesystem \
57+
gcc make lsof libnl3 ethtool libpcap pciutils numactl-libs numactl-devel \
58+
openssl-devel automake popt-devel ninja-build meson libnl3-devel cgdb git \
59+
&& mkdir deps \
60+
&& rpm -Uvh $RPM_PKGCONFIG \
61+
&& wget $GO_PACKAGE -P deps \
62+
&& tar -C /usr/local -xzf deps/go*.gz \
63+
&& curl -L -o /usr/local/bin/swagger $GO_SWAGGER_BIN \
64+
&& chmod 544 /usr/local/bin/swagger \
65+
&& wget $MLNX_OFED -P deps \
66+
&& tar xf deps/$(basename $MLNX_OFED) -C deps \
67+
&& pushd deps/$(basename $MLNX_OFED | sed 's/.tgz//') \
68+
&& ./mlnxofedinstall --user-space-only --upstream-libs \
69+
--dpdk --without-fw-update --force \
70+
&& popd \
71+
&& sed -i 's/Denable_kmods=true/Denable_kmods=false/' scripts/dpdk-build.sh \
72+
&& ./scripts/dpdk-build.sh \
73+
&& sed -i 's/CONFIG_DPVS_AGENT=n/CONFIG_DPVS_AGENT=y/' config.mk \
74+
&& make -j && make install \
75+
&& rm -rf deps && yum clean all
76+
77+
RUN set -x \
78+
&& mkdir libraries \
79+
&& ldd bin/dpvs | grep "=> /" | awk '{print $3}' | xargs -I '{}' cp '{}' libraries \
80+
&& ldd bin/ipvsadm | grep "=> /" | awk '{print $3}' | xargs -I '{}' cp '{}' libraries \
81+
&& ldd bin/dpip | grep "=> /" | awk '{print $3}' | xargs -I '{}' cp '{}' libraries \
82+
&& ldd bin/keepalived | grep "=> /" | awk '{print $3}' | xargs -I '{}' cp '{}' libraries
83+
84+
ENTRYPOINT ["/bin/bash"]
85+
86+
87+
###### `runner` stage builds the docker image for DPVS product environments ######
88+
#
89+
# docker run --name dpvs \
90+
# -d --privileged --network host \
91+
# -v /dev:/dev \
92+
# -v /sys:/sys \
93+
# -v /lib/modules:/lib/modules \
94+
# -v {dpvs-directory}:/dpvs \
95+
# github.com/iqiyi/dpvs:{version} \
96+
# -c /dpvs/dpvs.conf -p /dpvs/dpvs.pid -x /dpvs/dpvs.ipc \
97+
# -- -a {nic-pci-bus-id}
98+
#
99+
# docker run --name ipvsadm \
100+
# --rm --network none \
101+
# -v {dpvs-directory}:/dpvs \
102+
# -e DPVS_IPC_FILE=/dpvs/dpvs.ipc \
103+
# --entrypoint=/usr/bin/ipvsadm \
104+
# github.com/iqiyi/dpvs:{version} \
105+
# ...
106+
#
107+
# docker run --name dpip \
108+
# --rm --network none \
109+
# -v {dpvs-directory}:/dpvs \
110+
# -e DPVS_IPC_FILE=/dpvs/dpvs.ipc \
111+
# --entrypoint=/usr/bin/dpip \
112+
# github.com/iqiyi/dpvs:{version} \
113+
# ...
114+
#
115+
# docker run --name keepalived \
116+
# -d --privileged --network host \
117+
# --cap-add=NET_ADMIN --cap-add=NET_BROADCAST --cap-add=NET_RAW \
118+
# -v {dpvs-directory}:/dpvs \
119+
# -e DPVS_IPC_FILE=/dpvs/dpvs.ipc \
120+
# --entrypoint=/usr/bin/keepalived github.com/iqiyi/dpvs:{version} \
121+
# -D -n -f /dpvs/keepalived.conf \
122+
# --log-console --log-facility=6 \
123+
# --pid=/dpvs/keepalived.pid \
124+
# --vrrp_pid=/dpvs/vrrp.pid \
125+
# --checkers_pid=/dpvs/checkers.pid
126+
#
127+
# docker run --name dpvs-agent \
128+
# -d --network host \
129+
# -v {dpvs-directory}:/dpvs \
130+
# --entrypoint=/usr/bin/dpvs-agent \
131+
# github.com/iqiyi/dpvs:{version} \
132+
# --log-dir=/dpvs/logs/dpvs-agent \
133+
# --ipc-sockopt-path=/dpvs/dpvs.ipc\
134+
# --host=0.0.0.0 --port=6601
135+
#
136+
# docker run --name healthcheck \
137+
# -d --network host \
138+
# -v {dpvs-directory}:/dpvs \
139+
# --entrypoint=/usr/bin/healthcheck \
140+
# github.com/iqiyi/dpvs:{version} \
141+
# -log_dir=/dpvs/logs/healthcheck \
142+
# -lb_iface_addr=localhost:6601
143+
#
144+
FROM $BASE_IMAGE as runner
145+
146+
LABEL maintainer="IQiYi/QLB team"
147+
LABEL email="iig_cloud_qlb@qiyi.com"
148+
LABEL project="https://github.com/iqiyi/dpvs"
149+
LABEL image_maker="docker build --target runner -t github.com/iqiyi/dpvs:{version} ."
150+
151+
RUN set -x \
152+
&& yum install -y iproute wget ncat nmap tcpdump socat \
153+
&& yum clean all
154+
155+
COPY --from=builder /dpvs/bin/ /usr/bin
156+
COPY --from=builder /dpvs/libraries /usr/lib64
157+
158+
# Other available entrypoint are:
159+
# * /usr/bin/keepalived
160+
# * /usr/bin/dpvs-agent
161+
# * /usr/bin/healthcheck
162+
# * /usr/bin/ipvsadm
163+
# * /usr/bin/dpip
164+
# * /bin/bash
165+
# use `docker run --entrypoint ...` to override the default entrypoint.
166+
167+
ENTRYPOINT ["/usr/bin/dpvs"]

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
MAKE = make
2222
CC = gcc
2323
LD = ld
24+
RM = rm
2425

2526
SUBDIRS = src tools
2627

@@ -29,6 +30,8 @@ export INSDIR
2930

3031
export KERNEL = $(shell /bin/uname -r)
3132

33+
include $(CURDIR)/config.mk
34+
3235
all:
3336
for i in $(SUBDIRS); do $(MAKE) -C $$i || exit 1; done
3437

@@ -43,3 +46,6 @@ distclean:
4346
install:all
4447
-mkdir -p $(INSDIR)
4548
for i in $(SUBDIRS); do $(MAKE) -C $$i install || exit 1; done
49+
50+
uninstall:
51+
-$(RM) -f $(TARGET) $(INSDIR)/*

conf/dpvs.bond.conf.sample

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ netif_defs {
3737
}
3838
! mtu 1500
3939
! promisc_mode
40+
! allmulticast
4041
! kni_name dpdk0.kni
4142
}
4243

@@ -52,6 +53,7 @@ netif_defs {
5253
}
5354
! mtu 1500
5455
! promisc_mode
56+
! allmulticast
5557
! kni_name dpdk1.kni
5658
}
5759

@@ -68,6 +70,7 @@ netif_defs {
6870
}
6971
! mtu 1500
7072
! promisc_mode
73+
! allmulticast
7174
! kni_name dpdk2.kni
7275
}
7376

@@ -83,6 +86,7 @@ netif_defs {
8386
}
8487
! mtu 1500
8588
! promisc_mode
89+
! allmulticast
8690
! kni_name dpdk3.kni
8791
}
8892

@@ -309,9 +313,6 @@ ctrl_defs {
309313
sync_msg_timeout_us 20000
310314
priority_level low
311315
}
312-
ipc_msg {
313-
<init> unix_domain /var/run/dpvs_ctrl
314-
}
315316
}
316317

317318
! ipvs config
@@ -330,6 +331,7 @@ ipvs_defs {
330331
uoa_mode opp
331332
uoa_max_trail 3
332333
timeout {
334+
oneway 60
333335
normal 300
334336
last 3
335337
}
@@ -356,7 +358,7 @@ ipvs_defs {
356358
mss 1452
357359
ttl 63
358360
sack
359-
! wscale
361+
! wscale 0
360362
! timestamp
361363
}
362364
! defer_rs_syn

conf/dpvs.conf.items

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ netif_defs {
4040
}
4141
! mtu 1500 <1500,0-9000>
4242
! promisc_mode <disable>
43+
! allmulticast <disable>
4344
! kni_name dpdk0.kni <char[32]>
4445
}
4546

@@ -56,6 +57,7 @@ netif_defs {
5657
}
5758
! mtu 1500
5859
! promisc_mode
60+
! allmulticast <disable>
5961
! kni_name dpdk1.kni
6062
}
6163

@@ -211,9 +213,6 @@ ctrl_defs {
211213
sync_msg_timeout_us 2000 <2000, 1-∞>
212214
priority_level low <low, low|norm|high|ign>
213215
}
214-
ipc_msg {
215-
<init> unix_domain /var/run/dpvs_ctrl </var/run/dpvs_ctrl, max chars: 256>
216-
}
217216
}
218217

219218
! ipvs config
@@ -232,6 +231,7 @@ ipvs_defs {
232231
uoa_mode opp <opp for private protocol by default, or ipo for IP-option mode>
233232
uoa_max_trail 3 <max trails for send UOA for a connection>
234233
timeout { <1-31535999>
234+
oneway 300 <300>
235235
normal 300 <300>
236236
last 3 <3>
237237
}
@@ -258,10 +258,10 @@ ipvs_defs {
258258
mss 1452 <1452, 1-65535>
259259
ttl 63 <63, 1-255>
260260
sack <enable>
261-
! wscale <disable>
261+
! wscale <0, 0-14>
262262
! timestamp <disable>
263263
}
264-
close_client_window <enable>
264+
!close_client_window <disable>
265265
!defer_rs_syn <disable>
266266
rs_syn_max_retry 3 <3, 1-99>
267267
ack_storm_thresh 10 <10, 1-999>

conf/dpvs.conf.sample

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ netif_defs {
3737
}
3838
! mtu 1500
3939
! promisc_mode
40+
! allmulticast
4041
kni_name dpdk0.kni
4142
}
4243

@@ -52,6 +53,7 @@ netif_defs {
5253
}
5354
! mtu 1500
5455
! promisc_mode
56+
! allmulticast
5557
kni_name dpdk1.kni
5658
}
5759

@@ -275,9 +277,6 @@ ctrl_defs {
275277
sync_msg_timeout_us 20000
276278
priority_level low
277279
}
278-
ipc_msg {
279-
<init> unix_domain /var/run/dpvs_ctrl
280-
}
281280
}
282281

283282
! ipvs config
@@ -296,6 +295,7 @@ ipvs_defs {
296295
uoa_mode opp
297296
uoa_max_trail 3
298297
timeout {
298+
oneway 60
299299
normal 300
300300
last 3
301301
}
@@ -322,7 +322,7 @@ ipvs_defs {
322322
mss 1452
323323
ttl 63
324324
sack
325-
! wscale
325+
! wscale 0
326326
! timestamp
327327
}
328328
close_client_window

conf/dpvs.conf.single-bond.sample

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ netif_defs {
3535
}
3636
! mtu 1500
3737
! promisc_mode
38+
! allmulticast
3839
! kni_name dpdk0.kni
3940
}
4041

@@ -50,6 +51,7 @@ netif_defs {
5051
}
5152
! mtu 1500
5253
! promisc_mode
54+
! allmulticast
5355
! kni_name dpdk2.kni
5456
}
5557

@@ -216,9 +218,6 @@ ctrl_defs {
216218
sync_msg_timeout_us 20000
217219
priority_level low
218220
}
219-
ipc_msg {
220-
<init> unix_domain /var/run/dpvs_ctrl
221-
}
222221
}
223222

224223
! ipvs config
@@ -237,6 +236,7 @@ ipvs_defs {
237236
uoa_mode opp
238237
uoa_max_trail 3
239238
timeout {
239+
oneway 60
240240
normal 300
241241
last 3
242242
}
@@ -263,7 +263,7 @@ ipvs_defs {
263263
mss 1452
264264
ttl 63
265265
sack
266-
! wscale
266+
! wscale 0
267267
! timestamp
268268
}
269269
close_client_window

0 commit comments

Comments
 (0)