From: "Etelson, Gregory" <getelson@nvidia.com>
To: "Van Haaren, Harry" <harry.van.haaren@intel.com>
Cc: Gregory Etelson <getelson@nvidia.com>,
"dev@dpdk.org" <dev@dpdk.org>,
"thomas@monjalon.net" <thomas@monjalon.net>,
"mkashani@nvidia.com" <mkashani@nvidia.com>,
"Richardson, Bruce" <bruce.richardson@intel.com>
Subject: Re: [PATCH] rust: support DPDK API
Date: Fri, 7 Mar 2025 18:56:46 +0200 (IST) [thread overview]
Message-ID: <7231c395-9534-981b-adf9-c43cae444284@nvidia.com> (raw)
In-Reply-To: <PH8PR11MB68034D4DDB371E3197C7F82ED7CA2@PH8PR11MB6803.namprd11.prod.outlook.com>
Hello Harry,
>
>> From: Gregory Etelson <getelson@nvidia.com>
>> Sent: Thursday, March 6, 2025 1:37 PM
>> To: dev@dpdk.org <dev@dpdk.org>
>> Cc: getelson@nvidia.com <getelson@nvidia.com>; thomas@monjalon.net <thomas@monjalon.net>; mkashani@nvidia.com <mkashani@nvidia.com>; Richardson, Bruce <bruce.richardson@intel.com>
>> Subject: [PATCH] rust: support DPDK API
>
> Cool, I like this subject, great!
>
>> The patch converts include files with DPDK API to RUST and binds new
>> RUST API files info dpdklib package.
>>
>> The RUST dpdklib files and DPDK libraries build from C sources
>> allow creation of DPDK application in RUST.
>>
>> RUST DPDK application must specify the `dpdklib` package as
>> dependency in Cargo.toml file.
>>
>> RUST `dpdklib` package is installed into
>> MESON_INSTALL_DESTDIR_PREFIX/rust directory.
>>
>> Software requirements:
>> - clang
>> - RUST installation
>> - bindgen-cli crate
>>
>> RUST dpdklib installation instructions:
>> 1. Configure DPDK with `-Deanble_rust=true`
>> 2. Build and install DPDK. The installation procedure will create
>> MESON_INSTALL_DESTDIR_PREFIX/rust directory.
>> 3. Update PKG_CONFIG_PATH to point to DPDK installation.
>
> Interesting approach to automate it; are there specific reasons that this approach was taken,
> or did this just seem the easiest/best way to include "Rust support" into upstream DPDK?
> Alternatives could be (*not* suggesting to rework the patch!) a dpdk-sys
> crate where the bindgen etc is done externally to DPDK itself. Many existing
> approaches (some examples: https://youtu.be/lb6xn2xQ-NQ?t=130) use that method.
>
> I kind of like (this approach) of having the binding generation upstream with DPDK itself;
> it makes the Rust support upstream and keeps it close to DPDK... however it
> means that it is "the one" official/DPDK-community-approved library/crate.
>
My reason for adding the crate directly into upstream DPDK branch was to produce
a single centralized RUST version of DPDK API.
If DPDK API files are converted externally, there is no control over the result.
Internal crate can help smoothing bindgen translation - DPDK files can be
adjusted to reduce manual translation corrections.
The crate content will be automatically updated after DPDK API change.
Also, internal crate will increate overall RUST awareness in DPDK comunity.
> There's some nice tidy-ups to cleanup the namespaces possible if this is "the crate".
> Perhaps (sorry, borderline bikeshed-topics..) renames for clarity & readability, e.g.:
> dpdklib::rte_eal::rte_eal_init()
The crate exports existing DPDK API to RUST application as it is.
This way RUST application receives stable DPDK API - the same one C applications
have.
> to
> dpdk::eal::init()
>
That is not current DPDK API.
>> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
>
> I'll get to a testing & review in the next days, however I'd like to ask some bigger picture
> questions, to understand/provide input on approach, and how big an effor to expect here!
> See above linked youtube video - I had sketched out some API concepts for exposing a
> "safe Rust API" wrapper around the DPDK C API, which also encodes threading requirements.
>
> Some questions:
> - Is there an overaching "we're trying to achieve X with Rust", or specifically "safe Rust"?
> - Is this patch the "get DPDK + Rust working", with follow up patches for "safe wrappers" the intention?
> - Or is this patch all to expect for now?
The goal was to create RUST application over existing DPDK API.
The patch converts DPDK API files required for the helloworld example.
Additional API files will be added on demand.
>
> Again, thanks for the patch, I think Rust is important for DPDK & infrastructure software,
> and will try make time to help test/review/discuss this patch, and the wider Rust effort!
>
> Regards, -Harry
>
> <snip code itself>
>
Regards,
Gregory
next prev parent reply other threads:[~2025-03-07 16:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-06 13:37 Gregory Etelson
2025-03-06 19:26 ` Van Haaren, Harry
2025-03-07 16:56 ` Etelson, Gregory [this message]
2025-03-07 15:54 ` Van Haaren, Harry
2025-03-07 16:20 ` Bruce Richardson
2025-03-07 18:15 ` Etelson, Gregory
2025-03-07 18:00 ` Etelson, Gregory
2025-03-08 14:28 ` Igor Gutorov
2025-03-08 19:14 ` Etelson, Gregory
2025-03-08 18:50 ` [PATCH v2] rust: support raw " Gregory Etelson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7231c395-9534-981b-adf9-c43cae444284@nvidia.com \
--to=getelson@nvidia.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=harry.van.haaren@intel.com \
--cc=mkashani@nvidia.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).