crates

e1000e

check proofs license minimum Rust version

The logic of a driver for Intel's e1000e network controllers, the 82574L that QEMU's -device e1000e presents and the Sunrise Point I219, with no register access of its own. It holds the register offsets and bits, the descriptor formats and the direct memory access (DMA) region's layout. It also holds the whole receive and transmit ring logic behind two small traits (DirectMemoryAccessRegion and Tails), and the I219 bring-up sequences ported from FreeBSD's Intel shared code and its if_em.c driver. You supply the volatile register accesses and the DMA memory; everything computed from them is here, no_std, and tested on the host against a simulated device.

Getting started

cargo build and cargo test need no setup beyond a Rust toolchain at the minimum version below. The Kani proofs under "What is proven" are the only part that needs extra tools.

EXAMPLES

Claim a device, then judge each receive descriptor's status word before trusting its length. This example is a doctest, so cargo test runs it.

use e1000e::{
    RECEIVE_STATUS_DESCRIPTOR_DONE, RECEIVE_STATUS_END_OF_PACKET, ReceiveVerdict, VENDOR_INTEL,
    is_supported_device, model_name,
    receive_verdict,
};

assert!(is_supported_device(VENDOR_INTEL, 0x10d3));
assert_eq!(model_name(0x10d3), Some("82574L (QEMU's e1000e)"));

let word = |len: u64, status: u8| len | (status as u64) << 32;
let done = RECEIVE_STATUS_DESCRIPTOR_DONE | RECEIVE_STATUS_END_OF_PACKET;
assert_eq!(receive_verdict(word(60, done), 1518), ReceiveVerdict::Frame(60));
assert_eq!(receive_verdict(word(60, 0), 1518), ReceiveVerdict::NotYet);
assert_eq!(receive_verdict(word(0xffff, done), 1518), ReceiveVerdict::Drop);

For the rings, implement DirectMemoryAccessRegion over the DMA memory and Tails over the queue registers, then drive a DataPlane with start, receive and transmit. Each trait's documentation states the contract an implementation keeps: every access volatile, and the barrier each architecture needs. examples/host_ring.rs drives both rings against a fake device (cargo run --example host_ring), and docs/bring-up.md gives the register order a driver performs before start. docs/qemu.md runs the same data plane against QEMU's emulated 82574L from a small bare-metal program, tests/qemu-smoke/, which sends a frame and receives the reply.

What is proven

These Kani harnesses cover the input a device or a caller controls.

The proofs need Kani, which rustup does not install. Run cargo install --locked kani-verifier --version 0.68.0, then cargo kani setup. The setup step downloads a model checker, so it needs network access. CI uses version 0.68.0, and another version may verify differently. Setup also downloads the Kani release's pinned nightly Rust toolchain and a C Bounded Model Checker (CBMC) bundle. A full cargo kani run takes about nine minutes on a desktop machine. It prints an unstable-feature warning and an "unsupported constructs" note about code the proofs never reach, and it still succeeds.

Rerun them with cargo kani, or one of them with cargo kani --harness <name>. Each harness has a falsification record at falsifications/<module.path>.<harness>.patch. Applying it with patch -p1 < <file> from the crate root makes that harness fail at its own assertion, which shows the proof checks something; the patch header names the assertion. patch -R -p1 < <file> takes it out again.

The simulated device tests the non-volatile memory (NVM) reads, the reset, the ultra-low-power (ULP) and PHY workaround sequences, and transmit descriptor status. No model checker covers them.

Sources

The author read offsets, bits, descriptor layouts and device ids on 2026-10-04 (UTC) instead of recalling them. The sources were Linux's drivers/net/ethernet/intel/e1000e/regs.h, defines.h and hw.h. The author cross-checked them the same day against FreeBSD's BSD-licensed sys/dev/e1000/: e1000_regs.h, and the SPT (Sunrise Point) class of e1000_api.c. That class holds every I219 row of DEVICE_IDS and two Comet Lake ids (0x0d53, 0x0d55) the crate does not claim. The crate copies no Linux code.

QEMU's hw/net/e1000e_core.c and hw/net/e1000x_common.c say what the emulated 82574L does with them. QEMU uses legacy descriptors unless software sets RFCTL.EXTEN, and it receives only with RCTL.EN, link up and bus mastering.

The author did not read Intel's own I219 datasheet. Where the I219 likely differs from the 82574L, the item says so.

The I219 needs a port rather than a reading of registers. It is a media access control (MAC) block inside the platform controller hub, talking to a separate PHY that it shares with the Management Engine, and it carries workarounds that only field exposure finds. For platform_controller_hub, the author read only FreeBSD's Intel shared code (BSD-3-Clause) and its if_em.c and if_em.h (BSD-2-Clause). The author did not consult Linux's e1000e, which is GPL, for any of it. Each item in platform_controller_hub names the FreeBSD function it follows.

The author read everything from sys/dev/e1000/ on FreeBSD's main: ultra_low_power, flush and reset on 2026-10-04, the rest on 2026-10-05. The last commit touching e1000_ich8lan.c then was 46cf612d (2026-08-30). The author copied the notice of if_em.c and if_em.h from freebsd/freebsd-src@9da2c05a748f and compared it against that source on 2026-11-04.

BUGS

Minimum Rust version

Rust 1.88.

License

Licensed under either of MIT (LICENSE-MIT) or Apache-2.0 (LICENSE-APACHE), at your option. The files under src/platform_controller_hub/ adapt FreeBSD's Intel shared code and if_em.c and if_em.h. They also carry Intel's BSD-3-Clause notice (LICENSE-BSD-3-Clause-Intel) and the BSD-2-Clause notice of if_em.c and if_em.h (Intel, Nicole Graziano, Kevin Bowling; LICENSE-BSD-2-Clause-FreeBSD). A binary redistribution must reproduce both notices. Their SPDX expression is BSD-2-Clause AND BSD-3-Clause. The manifest's license field names all three: (MIT OR Apache-2.0) AND BSD-3-Clause AND BSD-2-Clause.