> From: Gregory Etelson > Sent: Sunday, April 20, 2025 9:57 AM > To: Van Haaren, Harry > Cc: dev@dpdk.org; Richardson, Bruce; owen.hilyard@unh.edu > Subject: Re: [PATCH] rust: RFC/demo of safe API for Dpdk Eal, Eth and Rxq > > 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" :) > Several changes: > DPDK configuration is split to 3 mandatory steps: > port configuration in > Port::configure(&mut self, rxq_num: u16, txq_num: u16) -> Result<(), String> > Rx queues configuration in > Port::config_rxqs(&mut self, desc_num: u16, mempool: DpdkMempool) -> Result<(), String> > Tx queues configuration in > Port::config_txqs(&mut self, desc_num: u16) -> Result<(), String> > In the IO thread, I renamed the `enable_polling()` to `activate()` for Rx/Tx symmetry. > I renamed `port` and `q` struct members to `port_id`, `queue_id` Those seem reasonable changes; no particular concerns. We can do always do "more more more" type-safety in making it impossible to mis-configure (at compile time). While type-safety is nice, it will complicate the code too: finding the right tradeoff is key. For me, having the "Rxq" be pollable only from the correct thread (compile-time check) is the most valuable. The configuration is "nice to have", but good/simple examples will help users start quickly too, particularly if the APIs are simple. > Build steps: > > Apply https://github.com/getelson-at-mellanox/rdpdk/blob/safe-q/dpdk-patches/0001-rust-export-missing-port-objects.patch to DPDK source. > Install DPDK > Set PKG_CONFIG_PATH to DPDK installation > > Activation: > > # cargo run --example echo -- -a I haven't tried these steps yet, sorry (lack of time at the moment). > Regards, > Gregory Thanks again! -Harry