On Sat, Mar 22, 2025 at 12:59:11PM +0200, Gregory Etelson wrote:
> The patch converts include files with DPDK API to RUST and binds new
> RUST API files into raw module under dpdk crate.
> 
> The RUST files and DPDK libraries build from C sources
> allow creation of DPDK application in RUST.
> 
> RUST DPDK application must specify the `dpdk` crate as
> dependency in Cargo.toml file.
> 
> RUST `dpdk` crate is installed into
> $MESON_INSTALL_DESTDIR_PREFIX/$libdir/rust directory.
> 
> Software requirements:
> - clang
> - RUST installation
> - bindgen-cli crate
> 
> RUST dpdk installation instructions:
> 1. Configure DPDK with `-Deanble_rust=true`
> 2. Build and install DPDK. The installation procedure will create
>    $MESON_INSTALL_DESTDIR_PREFIX/$libdir/rust crate.
> 3. Update PKG_CONFIG_PATH to point to DPDK installation.
> 
> Signed-off-by: Gregory Etelson <getel...@nvidia.com>
> ---
> v2:
> Change rust crate name from dpdklib to dpdk.
> Add raw module for to link with C API.
> Add "cargo:rerun-if-changed=build.rs".
> v3:
> Move init_port_config() to Port.
> Move start_port() to Port.
> Remove Cargo.lock from git repository
> Reformat code.
> v4:
> Blocked bindgen to convert stdlib functions with u128 type.
> Allow compilation of C style symbols.
> ---
>  buildtools/meson.build               |   4 +
>  buildtools/rust-env.sh               |  96 ++++++++++++
>  examples/rust/helloworld/Cargo.toml  |   7 +
>  examples/rust/helloworld/build.rs    |  24 +++
>  examples/rust/helloworld/src/main.rs | 219 +++++++++++++++++++++++++++
>  meson_options.txt                    |   2 +
>  6 files changed, 352 insertions(+)
>  create mode 100755 buildtools/rust-env.sh
>  create mode 100644 examples/rust/helloworld/Cargo.toml
>  create mode 100644 examples/rust/helloworld/build.rs
>  create mode 100644 examples/rust/helloworld/src/main.rs
> 

Hi Gregory, some high-level feedback:

* I'd suggest for future revisions splitting this into two patches. The rust
example should be separate from a patch adding the basic rust
infrastructure.

* For the example, I'd suggest that the helloworld rust example should
correspond to the regular "C" helloworld example, i.e just init DPDK and
print helloworld. If we want a basic packet handling example, it should be
an l2fwd one - again to align with the "C" examples.

* However, in terms of the examples, if the idea is to provide higher level
"rustic" APIs for DPDK, the examples should be written to use that. Any use
of the low-level C APIs should be in a testing app only, rather than an example
app. IMHO We want to encourage proper rust usage, not C-code just rewritten to
use a different compiler.

Regards,
/Bruce

Reply via email to