From 17e9c49f86b679cfa78c59326d906eb0768f2596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarom=C3=ADr=20Smr=C4=8Dek?= <4plague@gmail.com> Date: Wed, 27 Sep 2023 15:52:21 +0200 Subject: [PATCH] Renamed dp_service to dpservice-bin --- Dockerfile | 7 +++---- docs/deployment/README.md | 2 +- docs/deployment/commandline.md | 6 +++--- docs/development/building.md | 2 +- docs/development/debugging.md | 4 ++-- docs/development/kernel.md | 2 +- docs/development/running.md | 10 +++++----- docs/testing/README.md | 6 +++--- docs/testing/grpc_client.md | 2 +- docs/testing/mellanox.md | 8 ++++---- docs/testing/performance.md | 10 +++++----- hack/dp_conf_generate.py | 6 +++--- include/dp_conf.h | 2 +- src/dp_error.c | 2 +- src/dp_service.c | 2 +- src/meson.build | 6 +++--- test/dp_service.py | 2 +- 17 files changed, 39 insertions(+), 40 deletions(-) diff --git a/Dockerfile b/Dockerfile index 90e3adfca..050694c28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -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/* \ @@ -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"] diff --git a/docs/deployment/README.md b/docs/deployment/README.md index 6bfb1fb0f..dbdfc62ef 100644 --- a/docs/deployment/README.md +++ b/docs/deployment/README.md @@ -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. diff --git a/docs/deployment/commandline.md b/docs/deployment/commandline.md index 045c6c230..f89c55f58 100644 --- a/docs/deployment/commandline.md +++ b/docs/deployment/commandline.md @@ -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) @@ -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. diff --git a/docs/development/building.md b/docs/development/building.md index ce302c5a2..f4590b509 100644 --- a/docs/development/building.md +++ b/docs/development/building.md @@ -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 diff --git a/docs/development/debugging.md b/docs/development/debugging.md index 4a959a7f2..69e5b0c0a 100644 --- a/docs/development/debugging.md +++ b/docs/development/debugging.md @@ -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 diff --git a/docs/development/kernel.md b/docs/development/kernel.md index a6cfc48f2..4a26cd825 100644 --- a/docs/development/kernel.md +++ b/docs/development/kernel.md @@ -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 diff --git a/docs/development/running.md b/docs/development/running.md index 02f6dcf45..a8e6d9594 100644 --- a/docs/development/running.md +++ b/docs/development/running.md @@ -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 @@ -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/). @@ -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). diff --git a/docs/testing/README.md b/docs/testing/README.md index 2e1427f2b..7fa681687 100644 --- a/docs/testing/README.md +++ b/docs/testing/README.md @@ -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 diff --git a/docs/testing/grpc_client.md b/docs/testing/grpc_client.md index d9bd5cd08..d8dfa0106 100644 --- a/docs/testing/grpc_client.md +++ b/docs/testing/grpc_client.md @@ -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). diff --git a/docs/testing/mellanox.md b/docs/testing/mellanox.md index 9ea2c4b6e..ee4dff817 100644 --- a/docs/testing/mellanox.md +++ b/docs/testing/mellanox.md @@ -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`. @@ -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, ...). diff --git a/docs/testing/performance.md b/docs/testing/performance.md index 68cde5c82..26afb7605 100644 --- a/docs/testing/performance.md +++ b/docs/testing/performance.md @@ -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. diff --git a/hack/dp_conf_generate.py b/hack/dp_conf_generate.py index 579bf28b2..d2a931c76 100755 --- a/hack/dp_conf_generate.py +++ b/hack/dp_conf_generate.py @@ -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)") @@ -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.") diff --git a/include/dp_conf.h b/include/dp_conf.h index 1d6eeb212..55aac92bf 100644 --- a/include/dp_conf.h +++ b/include/dp_conf.h @@ -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 */ }; diff --git a/src/dp_error.c b/src/dp_error.c index c4fbcd6b9..e5c56de5b 100644 --- a/src/dp_error.c +++ b/src/dp_error.c @@ -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) diff --git a/src/dp_service.c b/src/dp_service.c index 9659df4cf..2a64608b0 100644 --- a/src/dp_service.c +++ b/src/dp_service.c @@ -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]; diff --git a/src/meson.build b/src/meson.build index 0bdbba6e6..e6e9c8d71 100644 --- a/src/meson.build +++ b/src/meson.build @@ -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 diff --git a/test/dp_service.py b/test/dp_service.py index 0c3e6453f..f4f0ad0b7 100755 --- a/test/dp_service.py +++ b/test/dp_service.py @@ -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}"'