Thread (4 messages) flat view 4 messages, 3 authors, 2025-08-15

Re: Seeking guidance on Rust porting for network driver as a learning project

From: Andrew Lunn <andrew@lunn.ch>
Date: 2025-08-15 19:23:29

On Fri, Aug 15, 2025 at 09:10:34PM +0200, Andrew Lunn wrote:
quoted
If there are any maintainers or experienced folks willing to offer
guidance or suggest a suitable driver for this kind of project, I’d
be very grateful.
The problem is, network devices make use of a very large number of
APIs into core Linux. It is hard to write a Rust networking driver
until there are rust bindings for all these APIs.

To stand any chance of writing a networking driver in Rust, you need
to find a really simple device. How far has Rust got with I2C or SPI?
Is it possible to write a simple Rust I2C or SPI client driver? If so,
maybe look for an I2C or SPI network device which is currently
unsupported. That will simplify things a lot.

Or maybe see if you can find a USB Ethernet dongle which is currently
unsupported, that would make use of usbnet to provide most of the
code. You then need a Rust binding onto usbnet, plus a number of other
Rust bindings onto anything else needed.
Another idea might be an Ethernet switch which is not supported by DSA
at the moment. Such drivers tend to only call a few APIs. You need to
be able to read/write registers in the switch, which is generally
MDIO, SPI, or I2C. And you need to implement a subset of struct
dsa_switch_ops. DSA switch drivers don't actually handle frames, which
makes them a lot simpler in terms of Rust bindings.

	Andrew
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help