feat: e1000d MSI/MSI-X migration — use pci_allocate_interrupt_vector
e1000d was the last NIC driver using legacy IRQ (irq.irq_handle()). Migrated to pci_allocate_interrupt_vector which tries MSI-X first, then MSI, then falls back to legacy INTx — matching rtl8168d, rtl8139d, ihdad, ihdgd, and nvmed. 63-line patch at local/patches/base/P6-e1000d-msi-migration.patch, symlinked and wired into recipes/core/base/recipe.toml.
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
diff --git a/drivers/net/e1000d/src/main.rs b/drivers/net/e1000d/src/main.rs
|
||||
index 373ea9b3..f62eaad7 100644
|
||||
--- a/drivers/net/e1000d/src/main.rs
|
||||
+++ b/drivers/net/e1000d/src/main.rs
|
||||
@@ -3,6 +3,7 @@ use std::os::unix::io::AsRawFd;
|
||||
|
||||
use driver_network::NetworkScheme;
|
||||
use event::{user_data, EventQueue};
|
||||
+use pcid_interface::irq_helpers::pci_allocate_interrupt_vector;
|
||||
use pcid_interface::PciFunctionHandle;
|
||||
|
||||
pub mod device;
|
||||
@@ -25,14 +26,11 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! {
|
||||
common::file_level(),
|
||||
);
|
||||
|
||||
- let irq = pci_config
|
||||
- .func
|
||||
- .legacy_interrupt_line
|
||||
- .expect("e1000d: no legacy interrupts supported");
|
||||
+ let irq_vector = pci_allocate_interrupt_vector(&mut pcid_handle, "e1000d");
|
||||
|
||||
log::info!("E1000 {}", pci_config.func.display());
|
||||
|
||||
- let mut irq_file = irq.irq_handle("e1000d");
|
||||
+ let irq_file = irq_vector.irq_handle();
|
||||
|
||||
let address = unsafe { pcid_handle.map_bar(0) }.ptr.as_ptr() as usize;
|
||||
|
||||
@@ -53,9 +51,11 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! {
|
||||
|
||||
let event_queue = EventQueue::<Source>::new().expect("e1000d: failed to create event queue");
|
||||
|
||||
+ let irq_fd = irq_vector.irq_handle().as_raw_fd();
|
||||
+
|
||||
event_queue
|
||||
.subscribe(
|
||||
- irq_file.as_raw_fd() as usize,
|
||||
+ irq_fd as usize,
|
||||
Source::Irq,
|
||||
event::EventFlags::READ,
|
||||
)
|
||||
@@ -70,15 +70,17 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! {
|
||||
|
||||
libredox::call::setrens(0, 0).expect("e1000d: failed to enter null namespace");
|
||||
|
||||
- scheme.tick().unwrap();
|
||||
+ scheme.tick().expect("e1000d: tick failed");
|
||||
+
|
||||
+ let mut irq_file = irq_vector.irq_handle();
|
||||
|
||||
for event in event_queue.map(|e| e.expect("e1000d: failed to get event")) {
|
||||
match event.user_data {
|
||||
Source::Irq => {
|
||||
let mut irq = [0; 8];
|
||||
- irq_file.read(&mut irq).unwrap();
|
||||
+ irq_file.read(&mut irq).expect("e1000d: IRQ read failed");
|
||||
if unsafe { scheme.adapter().irq() } {
|
||||
- irq_file.write(&mut irq).unwrap();
|
||||
+ irq_file.write(&mut irq).expect("e1000d: IRQ ack failed");
|
||||
|
||||
scheme.tick().expect("e1000d: failed to handle IRQ")
|
||||
}
|
||||
@@ -5,6 +5,7 @@ patches = [
|
||||
"P0-daemon-fix-init-notify-unwrap.patch",
|
||||
"P0-workspace-add-bootstrap.patch",
|
||||
"P0-init-continuous-scheduling.patch",
|
||||
"P6-e1000d-msi-migration.patch",
|
||||
# TODO: P1 patches (11) exist in local/patches/base/ but need rebase
|
||||
# after redox.patch removal. ACPI (5), PCI/IRQ (3), xHCI (3) — 1144 lines.
|
||||
# P1-acpid-acpi-core.patch
|
||||
|
||||
Reference in New Issue
Block a user