diff --git a/drivers/net/ixgbed/src/main.rs b/drivers/net/ixgbed/src/main.rs index c0d509264f..a4ea879be7 100644 --- a/drivers/net/ixgbed/src/main.rs +++ b/drivers/net/ixgbed/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; @@ -19,18 +20,15 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! { let mut name = pci_config.func.name(); name.push_str("_ixgbe"); - // Allocate one interrupt vector. pcid_interface::pci_allocate_interrupt_vector - // prefers MSI-X when the device advertises it and falls back to MSI and - // legacy INTX otherwise, so this single line makes the driver work on - // every modern 82599/X540/X550 board that has MSI-X wired. - let irq = pci_config - .func - .pci_allocate_interrupt_vector(1) - .expect("ixgbed: failed to allocate an interrupt vector"); + // Allocate one interrupt vector via the pcid_interface helper. Prefers + // MSI-X when the device advertises it and falls back to MSI and legacy + // INTX otherwise, so this single call makes the driver work on every + // modern 82599/X540/X550 board that has MSI-X wired. + let irq_vector = pci_allocate_interrupt_vector(&mut pcid_handle, "ixgbed"); println!(" + IXGBE {}", pci_config.func.display()); - let mut irq_file = irq.irq_handle("ixgbed"); + let mut irq_file = irq_vector.irq_handle(); let mapped_bar = unsafe { pcid_handle.map_bar(0) }; let address = mapped_bar.ptr.as_ptr();