base: Migrate e1000d and ixgbed to MSI-X interrupts (P45)
Switch network drivers from legacy INTx to pci_allocate_interrupt_vector which auto-prefers MSI-X > MSI > Legacy. rtl8139d and rtl8168d already used this helper; e1000d and ixgbed were the remaining legacy-only NIC drivers.
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
diff --git a/drivers/net/e1000d/src/main.rs b/drivers/net/e1000d/src/main.rs
|
||||
index c66cccd1..58ab2999 100644
|
||||
--- a/drivers/net/e1000d/src/main.rs
|
||||
+++ b/drivers/net/e1000d/src/main.rs
|
||||
@@ -5,0 +6 @@ use event::{user_data, EventQueue};
|
||||
+use pcid_interface::irq_helpers::pci_allocate_interrupt_vector;
|
||||
@@ -28,5 +28,0 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! {
|
||||
- let irq = pci_config
|
||||
- .func
|
||||
- .legacy_interrupt_line
|
||||
- .expect("e1000d: no legacy interrupts supported");
|
||||
-
|
||||
@@ -35 +31,7 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! {
|
||||
- let mut irq_file = irq.irq_handle("e1000d");
|
||||
+ let irq_file = match pci_allocate_interrupt_vector(&mut pcid_handle, "e1000d") {
|
||||
+ Some(iv) => iv,
|
||||
+ None => {
|
||||
+ log::error!("e1000d: no interrupt vector available, exiting");
|
||||
+ std::process::exit(1);
|
||||
+ }
|
||||
+ };
|
||||
@@ -58 +60 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! {
|
||||
- irq_file.as_raw_fd() as usize,
|
||||
+ irq_file.irq_handle().as_raw_fd() as usize,
|
||||
@@ -79 +81 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! {
|
||||
- irq_file.read(&mut irq).expect("e1000d: IRQ read failed");
|
||||
+ irq_file.irq_handle().read(&mut irq).expect("e1000d: IRQ read failed");
|
||||
@@ -81 +83 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! {
|
||||
- irq_file.write(&mut irq).expect("e1000d: IRQ ack failed");
|
||||
+ irq_file.irq_handle().write(&mut irq).expect("e1000d: IRQ ack failed");
|
||||
diff --git a/drivers/net/ixgbed/src/main.rs b/drivers/net/ixgbed/src/main.rs
|
||||
index 4a6ce74d..f06898ec 100644
|
||||
--- a/drivers/net/ixgbed/src/main.rs
|
||||
+++ b/drivers/net/ixgbed/src/main.rs
|
||||
@@ -5,0 +6 @@ use event::{user_data, EventQueue};
|
||||
+use pcid_interface::irq_helpers::pci_allocate_interrupt_vector;
|
||||
@@ -22,5 +22,0 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! {
|
||||
- let irq = pci_config
|
||||
- .func
|
||||
- .legacy_interrupt_line
|
||||
- .expect("ixgbed: no legacy interrupts supported");
|
||||
-
|
||||
@@ -29 +25,7 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! {
|
||||
- let mut irq_file = irq.irq_handle("ixgbed");
|
||||
+ let irq_file = match pci_allocate_interrupt_vector(&mut pcid_handle, "ixgbed") {
|
||||
+ Some(iv) => iv,
|
||||
+ None => {
|
||||
+ log::error!("ixgbed: no interrupt vector available, exiting");
|
||||
+ std::process::exit(1);
|
||||
+ }
|
||||
+ };
|
||||
@@ -54 +56 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! {
|
||||
- irq_file.as_raw_fd() as usize,
|
||||
+ irq_file.irq_handle().as_raw_fd() as usize,
|
||||
@@ -75 +77 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! {
|
||||
- irq_file.read(&mut irq).unwrap();
|
||||
+ irq_file.irq_handle().read(&mut irq).unwrap();
|
||||
@@ -77 +79 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! {
|
||||
- irq_file.write(&mut irq).unwrap();
|
||||
+ irq_file.irq_handle().write(&mut irq).unwrap();
|
||||
@@ -89,6 +89,8 @@ patches = [
|
||||
"P42-inputd-graceful-fallback.patch",
|
||||
"P43-dhcpd-requires-hard-dep.patch",
|
||||
"P44-acpid-thermal-zones.patch",
|
||||
# P45: Migrate e1000d and ixgbed to MSI-X via pci_allocate_interrupt_vector
|
||||
"P45-net-msix-adoption.patch",
|
||||
]
|
||||
|
||||
[package]
|
||||
|
||||
Reference in New Issue
Block a user