[PATCH] rust: RFC/demo of safe API for Dpdk Eal, Eth and Rxq

Etelson, Gregory getelson at nvidia.com
Sun Apr 27 20:50:06 CEST 2025


Hello Harry,

> > I implemented a working echo server with your API.
> > The code is here: https://github.com/getelson-at-mellanox/rdpdk/tree/safe-q
> 
> Ah cool! Great to see the API working.
> 
> Reviewing the "echo.rs" code, the MbuffMempoolHandle ergonomics can perhaps be improved,
> I'll try work on that and have some API suggestions to the mailing list soon.
> 
> I see the echo.rs code uses a normal "std::thread::spawn" (not DPDK lcores), there is
> some design to do here to ensuring that best practices are used;
> - any dataplane threads are registered as lcores (for best performance, mempool caches etc)
> - registered lcores are also unregistered when a thread ends (potentially allowing lcore-id reuse??)
> I haven't thought about this much, but had a brief discussion with Bruce (who is on holidays now).
> 
> Suggesting that mempools & lcores are the two next up API sets to "Rustify" :)
>

I see 2 issues with the DPDK lcore API:

Unsafe "extern" lcore callback is not considered as new thread and compiler 
will not run arguments Send verifications.

Also lcore arguments use generic 'void *' pointer.

Maybe Rust DPDK library needs native lcore implementation.

Differnet thread agrument types can we wrapped with a macro call.
Example is here: 
https://github.com/getelson-at-mellanox/rdpdk/blob/37494bcae1fcf06bb4338519f931c2130105e576/examples/echo.rs#L88

Regards,
Gregory



More information about the dev mailing list