Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update DPDK to 22.11 #385

Merged
merged 10 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 28 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM debian:11-slim as builder
FROM debian:12-slim as builder

ARG DPDK_VER=21.11
ARG DPDK_VER=22.11
ARG DPSERVICE_FEATURES=""

WORKDIR /workspace

# Install prerequisite packages
RUN apt-get update && apt-get install -y --no-install-recommends ON \
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends ON \
libibverbs-dev \
libmnl-dev \
libnuma-dev \
Expand Down Expand Up @@ -37,7 +37,7 @@ curl \
build-essential \
pkg-config \
protobuf-compiler-grpc \
libgrpc++1 \
libgrpc++1.51 \
libgrpc++-dev \
linux-headers-${OSARCH} \
&& rm -rf /var/lib/apt/lists/*
Expand All @@ -50,13 +50,12 @@ ENV DPDK_DIR=/workspace/dpdk-${DPDK_VER}

# Copy DPDK patches
COPY hack/*.patch hack/
RUN cd $DPDK_DIR && patch -p1 < ../hack/dpdk_21_11_clang.patch
RUN cd $DPDK_DIR && patch -p1 < ../hack/dpdk_21_11_log.patch
RUN cd $DPDK_DIR && patch -p1 < ../hack/dpdk_21_11_xstats_mem_leak.patch
RUN cd $DPDK_DIR && patch -p1 < ../hack/dpdk_21_11_graph_alloc.patch
RUN cd $DPDK_DIR && patch -p1 < ../hack/dpdk_22_11_gcc12.patch
RUN cd $DPDK_DIR && patch -p1 < ../hack/dpdk_22_11_log.patch
RUN cd $DPDK_DIR && patch -p1 < ../hack/dpdk_22_11_telemetry_key.patch

# Compile DPDK
RUN cd $DPDK_DIR && meson -Dmax_ethports=132 -Dplatform=generic -Ddisable_drivers=common/dpaax,\
RUN cd $DPDK_DIR && meson setup -Dmax_ethports=132 -Dplatform=generic -Ddisable_drivers=common/dpaax,\
common/cpt,common/iavf,\
common/octeontx,common/octeontx2,common/cnxk,common/qat,regex/octeontx2,net/cnxk,dma/cnxk,\
common/sfc_efx,common/auxiliary,common/dpaa,common/fslmc,common/ifpga,common/vdev,common/vmbus,\
Expand All @@ -68,7 +67,7 @@ net/octeontx_ep,net/pcap,net/pfe,net/qede,net/sfc,net/softnic,net/thunderx,net/t
net/vdev_ntsvc,net/vhost,net/virtio,net/vmxnet3,net/bnx2x,net/netsvc,net/vdev_netsvc,\
crypto/dpaa_sec,crypto/bcmfs,crypto/caam_jr,crypto/cnxk,dpaa_sec,crypto/dpaa2_sec,crypto/nitrox,\
crypto/null,crypto/octeontx,crypto/octeontx2,crypto/scheduler,crypto/virtio -Ddisable_libs=power,\
vhost,gpudev build
vhost,gpudev build -Ddisable_apps="*" -Dtests=false
RUN cd $DPDK_DIR/build && ninja
RUN cd $DPDK_DIR/build && ninja install

Expand All @@ -77,7 +76,7 @@ COPY hack/rel_download.sh hack/rel_download.sh
RUN --mount=type=secret,id=github_token,dst=/run/secrets/github_token \
sh -c 'GITHUB_TOKEN=$(if [ -f /run/secrets/github_token ]; then cat /run/secrets/github_token; else echo ""; fi) \
&& ./hack/rel_download.sh -dir=exporter -owner=onmetal -repo=prometheus-dpdk-exporter -pat=$GITHUB_TOKEN \
&& ./hack/rel_download.sh -dir=client -owner=onmetal -repo=dpservice-cli -pat=$GITHUB_TOKEN \'
&& ./hack/rel_download.sh -dir=client -owner=onmetal -repo=dpservice-cli -strip=2 -pat=$GITHUB_TOKEN'

# Now copy the rest to enable DPDK layer caching
COPY meson.build meson.build
Expand All @@ -97,7 +96,7 @@ FROM builder AS testbuilder
RUN rm -rf build && meson setup build $DPSERVICE_FEATURES --buildtype=release && cd ./build && ninja
RUN rm -rf build && CC=clang CXX=clang++ meson setup build $DPSERVICE_FEATURES && cd ./build && ninja

FROM debian:11-slim as tester
FROM debian:12-slim as tester

RUN apt-get update && apt-get install -y --no-install-recommends ON \
libibverbs-dev \
Expand All @@ -106,7 +105,7 @@ libnuma1 \
pciutils \
procps \
libuuid1 \
libgrpc++1 \
libgrpc++1.51 \
iproute2 \
udev \
gawk \
Expand All @@ -117,37 +116,41 @@ python3-scapy \

WORKDIR /
COPY --from=testbuilder /workspace/test ./test
COPY --from=testbuilder /workspace/build/src/dp_service ./build/src/dp_service
COPY --from=testbuilder /workspace/build/src/dpservice-bin ./build/src/dpservice-bin
COPY --from=testbuilder /workspace/client/* ./build
COPY --from=testbuilder /usr/local/lib /usr/local/lib
COPY --from=testbuilder /lib/* /lib/
COPY --from=testbuilder /workspace/client/github.com/onmetal/* ./build
RUN ldconfig

WORKDIR /test
ENTRYPOINT ["pytest-3", "-x", "-v"]

FROM debian:11-slim as production
FROM debian:12-slim as production

RUN apt-get update && apt-get install -y --no-install-recommends ON \
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends ON \
libibverbs-dev \
numactl \
libnuma1 \
pciutils \
procps \
libuuid1 \
libgrpc++1 \
libgrpc++1.51 \
iproute2 \
udev \
gawk \
bash-completion \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /
COPY --from=builder /workspace/build/src/dp_service .
COPY --from=builder /workspace/build/tools/dp_grpc_client /workspace/build/tools/dump/dpservice-dump .
COPY --from=builder /workspace/hack/prepare.sh .
COPY --from=builder /workspace/build/src/dpservice-bin \
/workspace/build/tools/dump/dpservice-dump \
/workspace/client/* \
/workspace/exporter/* \
/workspace/hack/prepare.sh \
/usr/local/bin
COPY --from=builder /usr/local/lib /usr/local/lib
COPY --from=builder /lib/* /lib/
COPY --from=builder /workspace/exporter/* /workspace/client/github.com/onmetal/* .
RUN ldconfig

ENTRYPOINT ["/dp_service"]
# Ensure bash-completion is working in operations
RUN echo 'PATH=${PATH}:/\nsource /etc/bash_completion\nsource <(dpservice-cli completion bash)' >> /root/.bashrc

ENTRYPOINT ["dpservice-bin"]
10 changes: 6 additions & 4 deletions config/default/dp-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ spec:
- name: init-dp-service
image: dp-service
imagePullPolicy: IfNotPresent
command: ['/prepare.sh']
command:
- prepare.sh
volumeMounts:
- mountPath: /dev
name: hugepages
Expand Down Expand Up @@ -58,8 +59,9 @@ spec:
livenessProbe:
exec:
command:
- /dp_grpc_client
- --is_initialized
- dpservice-cli
- get
- init
initialDelaySeconds: 10
periodSeconds: 10
- name: prometheus-agent
Expand All @@ -78,7 +80,7 @@ spec:
name: https
protocol: TCP
command:
- /prometheus-dpdk-exporter
- prometheus-dpdk-exporter
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview
This is a beta version which
- Uses [DPDK Graph Framework](https://doc.dpdk.org/guides/prog_guide/graph_lib.html) for the data plane. DPDK version 21.11 LTS or higher needed.
- Uses [DPDK Graph Framework](https://doc.dpdk.org/guides/prog_guide/graph_lib.html) for the data plane. DPDK version 22.11 LTS or higher needed.
- [rte_flow](https://doc.dpdk.org/guides/prog_guide/rte_flow.html) offloading between the virtual network interfaces on a single heypervisor.
- Uses GRPC to add virtual interfaces, loadbalancers, NAT Gateways and routes. There is a golang based GRPC
test client (CLI) which can connect to the GRPC server
Expand Down
7 changes: 6 additions & 1 deletion docs/deployment/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Dataplane Service deployment
This repository only provides a compiled binary of `dp_service`. To properly use it, you need to use the provided Docker file to generate an image and run it using the [metalnet project](https://github.com/onmetal/metalnet).
This repository only provides a compiled binary of `dpservice-bin`. To properly use it, you need to use the provided Docker file to generate an image and run it using the [metalnet project](https://github.com/onmetal/metalnet).

All command-line arguments and configuration files are already handled by the Docker image.

For development, direct use of dp-service is covered by the [development section](../development/).

## Command-line tools
All tool binaries are designed to be prefixed with `dpservice-` to enable the operator to simply type `dps<TAB>` for list of possible tools.

The provided Docker image contains `dpservice-bin` as the main process (already started by being the entrypoint), `dpservice-cli` to gRPC communication with the main process, and `dpservice-dump` to provide a way to see the actual traffic handled by dp-service.
4 changes: 2 additions & 2 deletions docs/deployment/commandline.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Dataplane Service Command-line Options
`dp_service` accepts two sets of options separated by `--`. The first set contains DPDK options, the second `dp_service` options proper. Both sets support `--help`
`dpservice-bin` accepts two sets of options separated by `--`. The first set contains DPDK options, the second `dpservice-bin` options proper. Both sets support `--help`

## EAL Options
For more information on EAL options, please see [the official docs](https://doc.dpdk.org/guides/linux_gsg/linux_eal_parameters.html)
Expand All @@ -8,5 +8,5 @@ For more information on EAL options, please see [the official docs](https://doc.
All options are described in `dpservice-bin --help`, see [the markdown version of it](help_dpservice-bin.md)

## Configuration file
Unless an environment variable `DP_CONF` is set to override the path, `dp_service` uses `/tmp/dp_service.conf` to read configuration before processing any arguments.
Unless an environment variable `DP_CONF` is set to override the path, `dpservice-bin` uses `/tmp/dp_service.conf` to read configuration before processing any arguments.
This way you can provide any arguments via such file and simplify the commandline use. The helper script `prepare.sh` generates such a file for Mellanox users.
2 changes: 1 addition & 1 deletion docs/deployment/telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The socket to use is of type `SOCK_SEQPACKET` (5), the file path is `/var/run/dp
To send telemetry requests, a node name with a parameter (must be zero if not present) is sent and a JSON responses can be read:
```
# echo "/dp_service/nat/used_port_count,0" | socat - UNIX:/var/run/dpdk/rte/dpdk_telemetry.v2,socktype=5
{"version":"DPDK 21.11.0","pid":1369006,"max_output_len":16384}{"/dp_service/nat/used_port_count":{"vm1":1,"vm2":0,"vm3":0}}
{"version":"DPDK 22.11.0","pid":1369006,"max_output_len":16384}{"/dp_service/nat/used_port_count":{"vm1":1,"vm2":0,"vm3":0}}
```

For the complete list of commands (telemetry nodes), send `/,0`.
14 changes: 8 additions & 6 deletions docs/development/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ Dp-service currently only supports x86 architecture (amd64 instruction set actua


### DPDK
The dataplane service is built upon the [DPDK library](https://dpdk.org). Currently, the only supported version is 21.x. Unfortunately, some patching is needed, thus it needs to be built from source. Building from source also has the advantage of easier debugging later.
The dataplane service is built upon the [DPDK library](https://dpdk.org). Currently, the only supported version is 22.11 LTS. Unfortunately, some patching is needed, thus it needs to be built from source. Building from source also has the advantage of easier debugging later.
```bash
git clone https://github.com/onmetal/net-dpservice.git
wget http://fast.dpdk.org/rel/dpdk-21.11.2.tar.xz
tar xf dpdk-21.11.2.tar.xz
cd dpdk-stable-21.11.2
patch -p1 < ../net-dpservice/hack/dpdk_21_11_log.patch
wget https://fast.dpdk.org/rel/dpdk-22.11.3.tar.xz
tar xf dpdk-22.11.3.tar.xz
cd dpdk-stable-22.11.3
patch -p1 < ../net-dpservice/hack/dpdk_22_11_gcc12.patch
patch -p1 < ../net-dpservice/hack/dpdk_22_11_log.patch
patch -p1 < ../net-dpservice/hack/dpdk_22_11_telemetry_key.patch
meson setup build
ninja -C build
sudo ninja -C build install
Expand All @@ -56,7 +58,7 @@ ninja -C build
Now you can try [running the service](running.md).

### Usermode dpservice
For [easier debugging](debugging.md) you can configure meson to build additional `dp_service_user` binary that does not require root privileges to run.
For [easier debugging](debugging.md) you can configure meson to build additional `dpservice-user` binary that does not require root privileges to run.
```bash
meson setup --reconfigure -Denable_usermode=true build
ninja -C build
Expand Down
4 changes: 2 additions & 2 deletions docs/development/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ You can use a pattern, like `*:8` for all debug messages (including DPDK). To on


## Run the service as a user
There is an option in the [build system](building#usermode-dpservice) to generate an additional binary `dp_service_user` that can be run as user instead of root. This is not only a safer way to debug, but enables you to easily use any GUI on top of `gdb` just like any other program.
There is an option in the [build system](building#usermode-dpservice) to generate an additional binary `dpservice-user` that can be run as user instead of root. This is not only a safer way to debug, but enables you to easily use any GUI on top of `gdb` just like any other program.

The drawback here is that you need to put the same capabilites to the `gdb` process as the `dp_service_user` binary has. For the most current list of capabilities please see the `hack/set_cap.sh` helper script.
The drawback here is that you need to put the same capabilites to the `gdb` process as the `dpservice-user` binary has. For the most current list of capabilities please see the `hack/set_cap.sh` helper script.


## Debugging the test-suite
Expand Down
2 changes: 1 addition & 1 deletion docs/development/kernel.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ If you want to use this timer in your DPDK-based programs, enable `CONFIG_HPET`


## FS capabilities
To run `dp_service` as a user, [linux capabilites](https://man7.org/linux/man-pages/man7/capabilities.7.html) are employed. For that to happen, your filesystem needs to support security labels. For Ext4, the right option is `CONFIG_EXT4_FS_SECURITY`. Other filesystems should have a similar option available.
To run `dpservice-bin` as a user, [linux capabilites](https://man7.org/linux/man-pages/man7/capabilities.7.html) are employed. For that to happen, your filesystem needs to support security labels. For Ext4, the right option is `CONFIG_EXT4_FS_SECURITY`. Other filesystems should have a similar option available.


## Caveats
Expand Down
10 changes: 5 additions & 5 deletions docs/development/running.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ For VMs to be able to connect to virtual functions, you need to make them access


## Command-line arguments
Unless run via `dp_service_user`, all `dp_service` commands need to be run as root.
Unless run via `dpservice-user`, all `dpservice-bin` commands need to be run as root.

For details about command-line arguments [see here](../deployment/commandline.md) or use `dp_service --help` for EAL options and `dp_service -- --help` for the actual service options.
For details about command-line arguments [see here](../deployment/commandline.md) or use `dpservice-bin --help` for EAL options and `dpservice-bin -- --help` for the actual service options.

Currently, dp-service only supports Mellanoc NICs and virtual interfaces for testing. Thus most arguments are not needed and are being provided another way.

### Mellanox cards
To prepare Mellanox cards to work with `dp_service` a `prepare.sh` script in `hack/` is provided. It should create appropriate number of virtual interfaces and put them into *switchdev mode*. For more information and/or troubleshooting, please see [Mellanox specific documentation](mellanox.md)
To prepare Mellanox cards to work with `dpservice-bin` a `prepare.sh` script in `hack/` is provided. It should create appropriate number of virtual interfaces and put them into *switchdev mode*. For more information and/or troubleshooting, please see [Mellanox specific documentation](mellanox.md)

In order to have this preparation happen automatically on every boot, you can use the `hack/preparedp.service` systemd unit.
```bash
Expand All @@ -54,7 +54,7 @@ systemctl daemon-reload
systemctl enable preparedp.service
```

Then you can simply run `dp_service -l0,1 -- --no-stats --no-offload` for the most basic setup. See help output for more info.
Then you can simply run `dpservice-bin -l0,1 -- --no-stats --no-offload` for the most basic setup. See help output for more info.

### Virtual interfaces
For automated testing and some working setups, virtual interfaces are used and thus no more setup is needed. The whole command-line is generated by [test-scripts](../testing/).
Expand All @@ -64,7 +64,7 @@ If you want to run the service using the same arguments as the automated tests a
### Manual invocation
Without the help of scripts or config files, you can run the service directly (adjust the interface names according to your machine):
```bash
./dp_service -a 0000:3b:00.0,representor=0-5 -a 0000:3b:00.1 -l 0,1 -- --pf0=enp59s0f1 --pf1=enp59s0f1 --vf-pattern=enp59s0f0_ --ipv6=2a10:afc0:e01f:209:: --no-stats --no-offload
./dpservice-bin -a 0000:3b:00.0,representor=0-5 -a 0000:3b:00.1 -l 0,1 -- --pf0=enp59s0f1 --pf1=enp59s0f1 --vf-pattern=enp59s0f0_ --ipv6=2a10:afc0:e01f:209:: --no-stats --no-offload
```

`-a` arguments set the PCI addresses of the smartnic's ports along with the VF range specification (6 VFs in this example).
Expand Down
6 changes: 3 additions & 3 deletions docs/testing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ Running that command will show you full test output for reporting or fixing the
### Pytest
Developers might consider running `pytest` directly in the `test/` directory to see more detailed information (via `-v` or even full output (via `-s`). With no positional arguments, all tests will run, specify individual unit-test files for making the testing set smaller. When multiple tests are broken, consider using the stop-at-first-error argument `-x`.

Since one test-run only applies to a specific set of options for `dp_service`, argument specifying the type of underlay tunnel (`--tun-opt`, default `ipip`) and whether or not port redundancy should be utilized (`--port-redundancy`) are needed to fully test all code paths.
Since one test-run only applies to a specific set of options for `dpservice-bin`, argument specifying the type of underlay tunnel (`--tun-opt`, default `ipip`) and whether or not port redundancy should be utilized (`--port-redundancy`) are needed to fully test all code paths.

If one should want to instead run your own `dp_service` instance (e.g. for running under a debugger), the `--attach` argument connects to an already running service instead of starting its own. This comes with the caveat of ensuring the right arguments are passed to the service at startup.
If one should want to instead run your own `dpservice-bin` instance (e.g. for running under a debugger), the `--attach` argument connects to an already running service instead of starting its own. This comes with the caveat of ensuring the right arguments are passed to the service at startup.


## GRPC test client
If you want to do some manual testing, you need to use GRPC to communicate with the `dp_service` process. A simple client is provided by this repository. For more information about the client, see [this section](grpc_client.md).
If you want to do some manual testing, you need to use GRPC to communicate with the `dpservice-bin` process. A simple client is provided by this repository. For more information about the client, see [this section](grpc_client.md).


## Mellanox test setup
Expand Down
2 changes: 1 addition & 1 deletion docs/testing/grpc_client.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Dataplane Service GRPC Client

To communicate with the `dp_service` process, you need to use GRPC (running on localhost at default port 1337).
To communicate with the `dpservice-bin` process, you need to use GRPC (running on localhost at default port 1337).

There is a golang command-line client [dpservice-cli](https://github.com/onmetal/dpservice-cli/), with full [command-line documentation](https://github.com/onmetal/dpservice-cli/tree/osc-main/docs/commands#dpservice-cli-commands).

Expand Down
Loading
Loading