| 1 |
.. SPDX-License-Identifier: BSD-2-Clause |
| 2 |
.. |
| 3 |
.. Copyright (C) 2022-2025 Linutronix GmbH |
| 4 |
.. Author Kurt Kanzenbach <[email protected]> |
| 5 |
.. |
| 6 |
.. Testbench documentation usage file. |
| 7 |
.. |
| 8 |
|
| 9 |
Usage |
| 10 |
===== |
| 11 |
|
| 12 |
Command Line Usage |
| 13 |
^^^^^^^^^^^^^^^^^^ |
| 14 |
|
| 15 |
The command line arguments for ``reference`` and ``mirror`` are rather simple. The |
| 16 |
PROFINET configuration options are described via external YAML file(s). For a |
| 17 |
detailed explanation of these configuration options, see section |
| 18 |
:ref:`Configuration`. |
| 19 |
|
| 20 |
Usage for ``reference`` application: |
| 21 |
|
| 22 |
.. code:: bash |
| 23 |
|
| 24 |
host: ./reference -h |
| 25 |
usage: reference [options] |
| 26 |
options: |
| 27 |
-h, --help: Print this help text |
| 28 |
-V, --version: Print version |
| 29 |
-c, --config: Path to config file |
| 30 |
|
| 31 |
|
| 32 |
Usage for ``mirror`` application: |
| 33 |
|
| 34 |
.. code:: bash |
| 35 |
|
| 36 |
host: ./mirror -h |
| 37 |
usage: mirror [options] |
| 38 |
options: |
| 39 |
-h, --help: Print this help text |
| 40 |
-V, --version: Print version |
| 41 |
-c, --config: Path to config file |
| 42 |
|
| 43 |
Signal Handling |
| 44 |
^^^^^^^^^^^^^^^ |
| 45 |
|
| 46 |
The ``reference`` and ``mirror`` programs handle the following signals: |
| 47 |
|
| 48 |
.. list-table:: Signal handling |
| 49 |
:widths: 50 100 |
| 50 |
:header-rows: 1 |
| 51 |
|
| 52 |
* - Signal |
| 53 |
- Description |
| 54 |
|
| 55 |
* - SIGINT/SIGTERM |
| 56 |
- Application shutdown. All threads and communucation will be stopped. Can take some time. |
| 57 |
|
| 58 |
* - SIGUSR1 |
| 59 |
- Reset global statistics (e.g. log file). Useful only for testing. |
| 60 |
|
| 61 |
Non-root User |
| 62 |
^^^^^^^^^^^^^ |
| 63 |
|
| 64 |
The ``reference`` and ``mirror`` programs are real time applications, which |
| 65 |
require to have permissions to use real time scheduling priorities, to create |
| 66 |
and use RAW and XDP sockets and to perform memory locking. In order to run the |
| 67 |
Linux RealTime Communication ``Testbench`` as regular user instead of ``root`` the following Linux |
| 68 |
capabilities have to be configured: |
| 69 |
|
| 70 |
- CAP_IPC_LOCK: Memory locking |
| 71 |
- CAP_SYS_NICE: Allow to use real time scheduling priorities |
| 72 |
- CAP_BPF: Allow to attach BPF programs |
| 73 |
- CAP_NET_ADMIN: Allow to use XDP |
| 74 |
- CAP_NET_RAW: Allow to create PACKET sockets |
| 75 |
- Optional CAP_SYS_ADMIN: Allow to use the xdp-dispatcher from libxdp |
| 76 |
|
| 77 |
Example to set the required capabilities: |
| 78 |
|
| 79 |
.. code:: bash |
| 80 |
|
| 81 |
$ setcap CAP_IPC_LOCK,CAP_BPF,CAP_SYS_NICE,CAP_NET_RAW,CAP_NET_ADMIN,CAP_SYS_ADMIN+ep reference |
| 82 |
$ getcap reference |
| 83 |
reference cap_net_admin,cap_net_raw,cap_ipc_lock,cap_sys_admin,cap_sys_nice,cap_bpf=ep |
| 84 |
|
| 85 |
In addition, all the provided sample configurations and tests store the log |
| 86 |
files in ``/var/log`` directory. Make sure that the user has permissions to |
| 87 |
store the log file in that directory or use another location. |
| 88 |
|
| 89 |
Furthermore, the user needs the permissions to access ``/sys/fs/bpf`` |
| 90 |
file system, which is required by the xdp-dispatcher from libxdp. |