Skip to content

Commit

Permalink
Renamed dp_service to dpservice-bin
Browse files Browse the repository at this point in the history
  • Loading branch information
PlagueCZ committed Sep 27, 2023
1 parent 034f2be commit 17e9c49
Show file tree
Hide file tree
Showing 17 changed files with 39 additions and 40 deletions.
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ python3-scapy \

WORKDIR /
COPY --from=builder /workspace/test ./test
COPY --from=builder /workspace/build/src/dp_service ./build/src/dp_service
COPY --from=builder /workspace/build/src/dpservice-bin ./build/src/dpservice-bin
COPY --from=builder /workspace/client/* ./build
COPY --from=builder /usr/local/lib /usr/local/lib
RUN ldconfig
Expand All @@ -137,8 +137,7 @@ bash-completion \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /
COPY --from=builder /workspace/build/src/dp_service \
/workspace/build/tools/dp_grpc_client \
COPY --from=builder /workspace/build/src/dpservice-bin \
/workspace/build/tools/dp_graphtrace \
/workspace/client/* \
/workspace/exporter/* \
Expand All @@ -150,4 +149,4 @@ RUN ldconfig
# Ensure bash-completion is working in operations
RUN echo 'PATH=${PATH}:/\nsource /etc/bash_completion\nsource <(dpservice-cli completion bash)' >> /root/.bashrc

ENTRYPOINT ["dp_service"]
ENTRYPOINT ["dpservice-bin"]
2 changes: 1 addition & 1 deletion docs/deployment/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 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.

Expand Down
6 changes: 3 additions & 3 deletions docs/deployment/commandline.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Dataplane Service Command-line Options
> This file has been generated by dp_conf_generate.py. As such it should fully reflect the current `dp_service` argument parser.
> This file has been generated by dp_conf_generate.py. As such it should fully reflect the current `dpservice-bin` argument parser.
`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 Down Expand Up @@ -32,5 +32,5 @@ For more information on EAL options, please see [the official docs](https://doc.
| --flow-timeout | SECONDS | inactive flow timeout (except TCP established flows) | |

## 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/development/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,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
8 changes: 4 additions & 4 deletions docs/testing/mellanox.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ As dp-service is intended as a virtual router for hosting VMs, testing on real h
It is also possible to run the whole set of tests that `meson test` runs using `pytest`. See below for details.

## Hardware setup
To simplify starting `dp_service`, it accepts a configuration file (currently hardcoded `/tmp/dp_service.conf`) so that most command-line arguments concerning hardware options are not needed.
To simplify starting `dpservice-bin`, it accepts a configuration file (currently hardcoded `/tmp/dp_service.conf`) so that most command-line arguments concerning hardware options are not needed.

This file is generated for you by calling a shell script, `hack/prepare.sh`.

Expand All @@ -14,12 +14,12 @@ This script also sets up hugepages, Mellanox's virtual functions (VFs), and eswi
## Virtual machines
For a VM to use a VF, that VF must use VFIO driver. Let the address of an available VF be `01:00.2`. Then the easiest way to do this is via `dpdk-devbind -b vfio-pci 01:00.2`. KVM should then be able to bind to a VF using vfio: `-net none -device vfio-pci,host=01:00.02`.

If running `dp_service_user`, don't forget to adjust privileges for the appropriate `/dev/vfio/?` devices.
If running `dpservice-user`, don't forget to adjust privileges for the appropriate `/dev/vfio/?` devices.

You can then register the VM in the running service via [grpc](grpc_client.md):
```bash
./dp_grpc_client --init
./dp_grpc_client --addmachine test10 --vm_pci 0000:01:00.0_representor_vf0 --vni 123 --ipv4 192.168.123.10 --ipv6 2001::10
dpservice-cli init
dpservice-cli add interface --id test10 --device 0000:01:00.0_representor_vf0 --vni 123 --ipv4 192.168.123.10 --ipv6 2001::10
```

If you set two VMs like this, they should be able to connect to each other (ping, netcat, ...).
Expand Down
10 changes: 5 additions & 5 deletions docs/testing/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ Isolating CPU core that is used by DPDK application and removing it from Linux s
This approach does not bring observable performance enhancement. It is possibly due to it is experimented on a machine with few tasks.

## Compilation optimization
By default, DPDK library is configured to compile as the release mode. dp-service needs to be configured in the release mode as well using `meson build --buildtype=release`.
By default, DPDK library is configured to compile as the release mode. dp-service needs to be configured in the release mode as well using `meson setup --buildtype=release build`.

This brings observable performance enhancement.

Additional flags (-march=native -mcpu=native -mtune=native) to compile source code for the native platform can be also added into meson build file.
Additional flags (`-march=native`, `-mcpu=native`, `-mtune=native`) to compile source code for the native platform can be also added into meson build file.
```
project('dp_service', 'c', 'cpp',
default_options: ['c_args=-Wno-deprecated-declarations -march=native -mcpu=native -mtune=native -Werror -Wno-format-truncation', 'cpp_args=-fpermissive'],
...
perfflags = [ '-march=native', '-mcpu=native', '-mtune=native' ]
cflags += perfflags
cxxflags += perfflags
```

This does not bring observable performance enhancement.
Expand Down
6 changes: 3 additions & 3 deletions hack/dp_conf_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ def generate_h(options):

def generate_md(options):
print("# Dataplane Service Command-line Options")
print("> This file has been generated by dp_conf_generate.py. As such it should fully reflect the current `dp_service` argument parser.")
print("> This file has been generated by dp_conf_generate.py. As such it should fully reflect the current `dpservice-bin` argument parser.")
print("")
print("`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`")
print("`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`")
print("")
print("## EAL Options")
print("For more information on EAL options, please see [the official docs](https://doc.dpdk.org/guides/linux_gsg/linux_eal_parameters.html)")
Expand All @@ -190,7 +190,7 @@ def generate_md(options):
print(f"| {opts} | {option.arg} | {option.help_str} | {option.help_choices} |")
print("")
print("## Configuration file")
print("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.")
print("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.")
print("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.")


Expand Down
2 changes: 1 addition & 1 deletion include/dp_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct dp_conf_dhcp_dns {
};

enum dp_conf_runmode {
DP_CONF_RUNMODE_NORMAL, /**< Start dp_service normally */
DP_CONF_RUNMODE_NORMAL, /**< Start dpservice normally */
DP_CONF_RUNMODE_EXIT, /**< End succesfully (e.g. for --help etc.) */
DP_CONF_RUNMODE_ERROR /**< Error parsing arguments */
};
Expand Down
2 changes: 1 addition & 1 deletion src/dp_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const char *dp_strerror(int error)
else if (error >= -_DP_GRPC_ERRCODES)
return dp_grpc_strerror(error+_DP_GRPC_ERRCODES);
else
return "General dp_service error";
return "General dpservice error";
}

const char *dp_strerror_verbose(int error)
Expand Down
2 changes: 1 addition & 1 deletion src/dp_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static int dp_args_add_mellanox(int *orig_argc, char ***orig_argv)
return DP_ERROR;
}

// add original dp_service args
// add original dpservice args
if (argend >= 0) {
for (int j = argend; j < argc; ++j)
dp_argv[curarg++] = argv[j];
Expand Down
6 changes: 3 additions & 3 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ if get_option('enable_virtual_services')
]
endif

exe = executable('dp_service',
exe = executable('dpservice-bin',
sources: [ dp_sources, grpc_generated ],
include_directories: [ includes ],
dependencies: [ dpdk_dep, proto_dep, grpc_dep, grpccpp_dep, thread_dep, libuuid_dep ]
)

if get_option('enable_usermode')
custom_target('dp_service_user',
custom_target('dpservice-user',
depends: exe,
input: exe,
output: 'dp_service_user',
output: 'dpservice-user',
command: [ '../hack/set_cap.sh', '@INPUT@', '@OUTPUT@' ],
build_by_default: true,
console: true
Expand Down
2 changes: 1 addition & 1 deletion test/dp_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, build_path, port_redundancy, fast_flow_timeout,
script_path = os.path.dirname(os.path.abspath(__file__))
self.cmd = f"gdb -x {script_path}/gdbinit --args "

self.cmd += f'{self.build_path}/src/dp_service -l 0,1 --log-level=user*:8'
self.cmd += f'{self.build_path}/src/dpservice-bin -l 0,1 --log-level=user*:8'
if not self.hardware:
self.cmd += (f' --no-pci'
f' --vdev={PF0.pci},iface={PF0.tap},mac="{PF0.mac}"'
Expand Down

0 comments on commit 17e9c49

Please sign in to comment.