fishinabarrel / linux-kernel-module-rust

Framework for writing Linux kernel modules in safe Rust
GNU General Public License v2.0
1.33k stars 119 forks source link

Add skb bindings and safe smsc9512 driver #261

Open geofft opened 4 years ago

geofft commented 4 years ago

https://github.com/lizhuohua/linux-kernel-module-rust/tree/master/smsc9512 is a Rust driver for the onboard NIC on the Raspberry Pi 2 and 3 (it is in fact a USB Ethernet device despite being onboard), based on an older version of this project. It's mostly unsafe code, but it looks like it's mostly unsafe because there aren't safe skb (socket buffer) bindings, and skb seems like the sort of thing that would very much benefit from Rust's safety tools.

Let's write a safe skb abstraction and then try to port that driver over (which would also require getting things going for ARM, probably).

I'm pretty sure I have an RPi 2 somewhere in this apartment....