<div dir="ltr"><div>Bruce,</div><div><br></div><div>Is the following Linux update correct per your feedback?<br><br>Linux<br>-----<br><br>To run DPDK applications without root privileges on Linux, perform the following steps:<br><br>1. **Create a DPDK User Group**: Create a new user group for DPDK and add the desired user to this group.<br><br>2. **Set Up Hugepages**: Configure hugepages for the user.<br><br>3. **Bind the NIC to a User-Space Driver**: Use the DPDK tool ``dpdk-devbind.py`` to bind the NIC to a user-space driver like ``vfio-pci`` or ``igb_uio``.<br><br>4. **Adjust Permissions for Specific Files and Directories**:<br> <br> - VFIO entries in ``/dev``, such as ``/dev/vfio/<id>``, where <id> is the VFIO group to which a device used by DPDK belongs.<br> - The hugepage mount directory, typically ``/dev/hugepages`` on many distributions, or any alternative mount point configured by the user, e.g., ``/mnt/huge``, ``/mnt/huge_1G``.<br><br> Note: Running DPDK as non-root on Linux requires IOMMU support through vfio.<br><br>5. **Run the DPDK Application**: Run the desired DPDK application as the user who has been added to the DPDK group.<br><br>FreeBSD<br>-------<br><br>- The userspace-io device files in ``/dev``, for example, ``/dev/uio0``, ``/dev/uio1``, and so on<br>- The userspace contiguous memory device: ``/dev/contigmem``<br><br>Refer to the `DPDK Release Notes <<a href="https://doc.dpdk.org/guides/rel_notes/index.html">https://doc.dpdk.org/guides/rel_notes/index.html</a>>`_ for supported applications.</div><div><br></div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Thanks!<br>David Young<br>Professional Copywriter/Technical Writer<br>Young Copy<br></div><div>+1 (678) 500-9550<br></div><div><a href="https://www.youngcopy.com" target="_blank">https://www.youngcopy.com</a><br></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Nov 3, 2023 at 11:24 AM Bruce Richardson <<a href="mailto:bruce.richardson@intel.com">bruce.richardson@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I haven't reviewed this whole file in detail, as I assume most content is<br>
copy-pasted from existing docs and so is correct. One comment inline below,<br>
though.<br>
<br>
/Bruce<br>
<br>
On Fri, Nov 03, 2023 at 12:01:51AM -0400, David Young wrote:<br>
> ---<br>
> .../appendix/cross_compile_dpdk.rst | 37 +++<br>
> .../appendix/dpdk_meson_build_options.rst | 57 ++++<br>
> .../getting_started_guide/appendix/index.rst | 17 +<br>
> .../running_dpdk_apps_without_root.rst | 36 +++<br>
> .../appendix/vfio_advanced.rst | 295 ++++++++++++++++++<br>
> 5 files changed, 442 insertions(+)<br>
> create mode 100644 doc/guides/getting_started_guide/appendix/cross_compile_dpdk.rst<br>
> create mode 100644 doc/guides/getting_started_guide/appendix/dpdk_meson_build_options.rst<br>
> create mode 100644 doc/guides/getting_started_guide/appendix/index.rst<br>
> create mode 100644 doc/guides/getting_started_guide/appendix/running_dpdk_apps_without_root.rst<br>
> create mode 100644 doc/guides/getting_started_guide/appendix/vfio_advanced.rst<br>
> <br>
> diff --git a/doc/guides/getting_started_guide/appendix/cross_compile_dpdk.rst b/doc/guides/getting_started_guide/appendix/cross_compile_dpdk.rst<br>
> new file mode 100644<br>
> index 0000000000..3e4efe23a4<br>
> --- /dev/null<br>
> +++ b/doc/guides/getting_started_guide/appendix/cross_compile_dpdk.rst<br>
> @@ -0,0 +1,37 @@<br>
> +.. SPDX-License-Identifier: BSD-3-Clause<br>
> + Copyright(c) 2010-2025 Intel Corporation.<br>
> +<br>
> +.. _cross_compile_dpdk:<br>
> +<br>
> +Cross-compiling DPDK for Different Architectures on Linux<br>
> +=========================================================<br>
> +<br>
> +Cross-compiling DPDK for different architectures follows a similar process. Here are the general steps:<br>
> +<br>
> +1. **Get Compiler and Libraries**: Obtain the cross-compiler toolchain and any required libraries specific to the target architecture.<br>
> +<br>
> +2. **Build Using Cross-File**: Use Meson to set up the build with a cross-file specific to the target architecture, and then build with Ninja.<br>
> +<br>
> +Prerequisites<br>
> +-------------<br>
> +<br>
> +- NUMA Library (if required)<br>
> +- Meson and Ninja<br>
> +- pkg-config for the target architecture<br>
> +- Specific GNU or LLVM/Clang toolchain for the target architecture<br>
> +<br>
> +Cross-Compiling DPDK<br>
> +--------------------<br>
> +<br>
> +1. **Set Up the Cross Toolchain**: Download and extract the toolchain for the target architecture. Add it to the PATH.<br>
> +<br>
> +2. **Compile Any Required Libraries**: Compile libraries like NUMA if required.<br>
> +<br>
> +3. **Cross-Compile DPDK with Meson**:<br>
> +<br>
> + .. code-block:: bash<br>
> +<br>
> + meson setup cross-build --cross-file <target_machine_configuration><br>
> + ninja -C cross-build<br>
> +<br>
> +Refer to the specific sections for ARM64, LoongArch, and RISC-V for detailed instructions and architecture-specific considerations.<br>
> \ No newline at end of file<br>
> diff --git a/doc/guides/getting_started_guide/appendix/dpdk_meson_build_options.rst b/doc/guides/getting_started_guide/appendix/dpdk_meson_build_options.rst<br>
> new file mode 100644<br>
> index 0000000000..6669f98371<br>
> --- /dev/null<br>
> +++ b/doc/guides/getting_started_guide/appendix/dpdk_meson_build_options.rst<br>
> @@ -0,0 +1,57 @@<br>
> +.. SPDX-License-Identifier: BSD-3-Clause<br>
> + Copyright(c) 2010-2025 Intel Corporation.<br>
> +<br>
> +.. _dpdk_meson_build_options:<br>
> +<br>
> +DPDK Meson Build Configuration Options<br>
> +======================================<br>
> +<br>
> +DPDK provides a number of build configuration options that can be adjusted using the Meson build system. These options can be listed by running ``meson configure`` inside a configured build<br>
> +folder.<br>
> +<br>
> +Changing the Build Type<br>
> +-----------------------<br>
> +<br>
> +To change the build type from the default "release" to a regular "debug" build,<br>
> +you can either:<br>
> +<br>
> +- Pass ``-Dbuildtype=debug`` or ``--buildtype=debug`` to meson when configuring the build folder initially.<br>
> +- Run ``meson configure -Dbuildtype=debug`` inside the build folder after the initial meson run.<br>
> +<br>
> +Platform Options<br>
> +----------------<br>
> +<br>
> +The "platform" option specifies a set of configuration parameters that will be used. <br>
> +The valid values are:<br>
> +<br>
> +- ``-Dplatform=native`` will tailor the configuration to the build machine.<br>
> +- ``-Dplatform=generic`` will use configuration that works on all machines of the same architecture as the build machine.<br>
> +- ``-Dplatform=<SoC>`` will use configuration optimized for a particular SoC.<br>
> +<br>
> +Consult the "socs" dictionary in ``config/arm/meson.build`` to see which SoCs are supported.<br>
> +<br>
> +Overriding Platform Parameters<br>
> +------------------------------<br>
> +<br>
> +The values determined by the platform parameter may be overwritten. For example,<br>
> +to set the ``max_lcores`` value to 256, you can either:<br>
> +<br>
> +- Pass ``-Dmax_lcores=256`` to meson when configuring the build folder initially.<br>
> +- Run ``meson configure -Dmax_lcores=256`` inside the build folder after the initial meson run.<br>
> +<br>
> +Building Sample Applications<br>
> +----------------------------<br>
> +<br>
> +Some of the DPDK sample applications in the examples directory can be automatically built as<br>
> +part of a meson build. To do so, pass a comma-separated list of the examples to build to the<br>
> +``-Dexamples`` meson option as below::<br>
> +<br>
> + meson setup -Dexamples=l2fwd,l3fwd build<br>
> +<br>
> +There is also a special value "all" to request that all example applications whose dependencies<br>
> +are met on the current system are built. When ``-Dexamples=all`` is set as a meson option,<br>
> +meson will check each example application to see if it can be built, and add all which can be<br>
> +built to the list of tasks in the ninja build configuration file.<br>
> +<br>
> +For a complete list of options, run ``meson configure`` inside your configured build<br>
> +folder.<br>
> \ No newline at end of file<br>
> diff --git a/doc/guides/getting_started_guide/appendix/index.rst b/doc/guides/getting_started_guide/appendix/index.rst<br>
> new file mode 100644<br>
> index 0000000000..23bb1fcf78<br>
> --- /dev/null<br>
> +++ b/doc/guides/getting_started_guide/appendix/index.rst<br>
> @@ -0,0 +1,17 @@<br>
> +.. SPDX-License-Identifier: BSD-3-Clause<br>
> + Copyright(c) 2010-2025 Intel Corporation.<br>
> +<br>
> +.. _appendix:<br>
> +<br>
> +Appendix<br>
> +========<br>
> +<br>
> +This section covers specific guides related to DPDK.<br>
> +<br>
> +.. toctree::<br>
> + :maxdepth: 2<br>
> +<br>
> + dpdk_meson_build_options<br>
> + running_dpdk_apps_without_root<br>
> + vfio_advanced<br>
> + cross_compile_dpdk<br>
> \ No newline at end of file<br>
> diff --git a/doc/guides/getting_started_guide/appendix/running_dpdk_apps_without_root.rst b/doc/guides/getting_started_guide/appendix/running_dpdk_apps_without_root.rst<br>
> new file mode 100644<br>
> index 0000000000..9f214bbdc8<br>
> --- /dev/null<br>
> +++ b/doc/guides/getting_started_guide/appendix/running_dpdk_apps_without_root.rst<br>
> @@ -0,0 +1,36 @@<br>
> +.. SPDX-License-Identifier: BSD-3-Clause<br>
> + Copyright(c) 2010-2025 Intel Corporation.<br>
> +<br>
> +.. _running_dpdk_apps_without_root:<br>
> +<br>
> +Running DPDK Applications Without Root Privileges<br>
> +=================================================<br>
> +<br>
> +Although applications using the DPDK use network ports and other hardware resources<br>
> +directly, with a number of small permission adjustments, <br>
> +it is possible to run these applications as a user other than “root”. <br>
> +To do so, the ownership, or permissions, on the following file system objects should be<br>
> +adjusted so the user account being used to run the DPDK application has<br>
> +access to them:<br>
> +<br>
<br>
The text above implies that we would just be listing a set of files to<br>
change. For FreeBSD that is the case, but for Linux, not so much! :-)<br>
<br>
I'd change the linux section to be a similar list of files to FreeBSD:<br>
<br>
* VFIO entries in /dev, /dev/vfio/<id>, where id is the VFIO group to which<br>
a device used by DPDK belongs.<br>
* the hugepage mount directory: /dev/hugepages on many distributions, or<br>
any alternative mount point configured by the user, e.g. /mnt/huge,<br>
/mnt/huge_1G<br>
<br>
We also need to note that to run as non-root on linux, you need to use DPDK<br>
with iommu support through vfio.<br>
<br>
> +Linux<br>
> +-----<br>
> +<br>
> +1. **Create a DPDK User Group**: Create a new user group for DPDK and add the desired user to this group.<br>
> +<br>
> +2. **Set Up Hugepages**: Configure hugepages for the user.<br>
> +<br>
> +3. **Bind the NIC to a User-Space Driver**: Use the DPDK tool ``dpdk-devbind.py`` to bind the NIC to a user-space driver like ``vfio-pci`` or ``igb_uio``.<br>
> +<br>
> +4. **Set Permissions for UIO/VFIO Devices**: Change the ownership and permissions of the UIO or VFIO devices to allow access by the DPDK user group.<br>
> +<br>
> +5. **Run the DPDK Application**: Run the desired DPDK application as the user who has been added to the DPDK group.<br>
> +<br>
> +FreeBSD<br>
> +-------<br>
> +<br>
> +- The userspace-io device files in ``/dev``, for example, ``/dev/uio0``, ``/dev/uio1``, and so on<br>
> +- The userspace contiguous memory device: ``/dev/contigmem``<br>
> +<br>
> +<br>
> +Refer to the `DPDK Release Notes <<a href="https://doc.dpdk.org/guides/rel_notes/index.html" rel="noreferrer" target="_blank">https://doc.dpdk.org/guides/rel_notes/index.html</a>>`_ for supported applications.<br>
<br>
<snip for brevity><br>
</blockquote></div>