The First Rust-Written Network PHY Driver Set To Land In Linux 6.8

Written by Michael Larabel in Linux Networking on 17 December 2023 at 02:21 PM EST. 164 Comments
LINUX NETWORKING
Since Linux 6.1 when the very initial Rust infrastructure was added to the Linux kernel there's been a lot of other plumbing and house keeping merged since for enabling kernel drivers to be written in the Rust programming language. With the upcoming Linux 6.8 kernel cycle, the first Rust network driver is set to be introduced.

Merged this week to net-next.git ahead of Linux 6.8 is landing the "net-phy-rust" branch. This features Rust abstractions necessary for network PHY drivers. There are Rust bindings for the phylib code and other bits needed to enable PHY drivers written in Rust.

That work culminates with adding a Rust version of the Asix PHY driver. The existing ax88796b C driver code was rewritten in the Rust programming language. The Rust version is equivalent to the C version, which will remain the default unless the user builds the kernel with the Rust version.

The Rust ASIX PHY driver comes in at around 135 lines of Rust code plus the various build system bits. Enabling this Rust ASIX PHY driver can be done using the "AX88796B_RUST_PHY" Kconfig switch that will build the driver as ax88796b_rust.


The AX88796B driver is used for supporting the Asix Electronics PHY found within the X-Surf 100 AX88796B package. The AX88796B a 100M fast Ethernet controller used for embedded and industrial applications from HVAC controls to security systems and other industrial control systems. So this isn't the most exciting network hardware around (and the hardware has already been supported by a C driver), but this Rust PHY driver is a start and gets the ball rolling on the interfaces/bindings in place for other memory-safe network drivers to be crafted moving forward. There has been other Rust happenings in the networking subsystem. Look for this new driver in Linux 6.8.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week