Retire base monolith patch in favor of 27 individual P2 patches
The 17,046-line redox.patch monolith is no longer referenced in the base recipe. All 27 individual P2 patches are now listed explicitly in recipe.toml with symlinks to local/patches/base/. Coverage gap closed: ixgbed/src/device.rs was the only file not covered by any individual patch. Added P2-ixgbed-error-handling.patch for the 10GbE Intel driver error handling (println → log::info/warn/error). Build verified: CI=1 make r.base completes successfully with the new patch list. The monolith file is preserved as backup but no longer applied.
This commit is contained in:
@@ -0,0 +1,162 @@
|
||||
# P2-ixgbed-error-handling.patch
|
||||
#
|
||||
# 10GbE Intel ixgbe driver error handling: replace println!/unwrap()/expect()
|
||||
# with log::info!/log::error!/log::warn! and proper error propagation.
|
||||
# This file was the only gap in the base patch split coverage.
|
||||
|
||||
diff --git a/drivers/net/ixgbed/src/device.rs b/drivers/net/ixgbed/src/device.rs
|
||||
index 0d59b46d..fc7c009f 100644
|
||||
--- a/drivers/net/ixgbed/src/device.rs
|
||||
+++ b/drivers/net/ixgbed/src/device.rs
|
||||
@@ -3,7 +3,7 @@ use std::time::{Duration, Instant};
|
||||
use std::{cmp, mem, ptr, slice, thread};
|
||||
|
||||
use driver_network::NetworkAdapter;
|
||||
-use syscall::error::Result;
|
||||
+use syscall::error::{Error, Result, EIO};
|
||||
|
||||
use common::dma::Dma;
|
||||
|
||||
@@ -45,7 +45,12 @@ impl NetworkAdapter for Intel8259x {
|
||||
|
||||
if (status & IXGBE_RXDADV_STAT_DD) != 0 {
|
||||
if (status & IXGBE_RXDADV_STAT_EOP) == 0 {
|
||||
- panic!("increase buffer size or decrease MTU")
|
||||
+ log::error!("ixgbed: received fragmented packet, skipping descriptor");
|
||||
+ desc.read.pkt_addr = self.receive_buffer[self.receive_index].physical() as u64;
|
||||
+ desc.read.hdr_addr = 0;
|
||||
+ self.write_reg(IXGBE_RDT(0), self.receive_index as u32);
|
||||
+ self.receive_index = wrap_ring(self.receive_index, self.receive_ring.len());
|
||||
+ return Ok(None);
|
||||
}
|
||||
|
||||
let data = unsafe {
|
||||
@@ -132,13 +137,25 @@ impl Intel8259x {
|
||||
.map(|_| Ok(unsafe { Dma::zeroed()?.assume_init() }))
|
||||
.collect::<Result<Vec<_>>>()?
|
||||
.try_into()
|
||||
- .unwrap_or_else(|_| unreachable!()),
|
||||
+ .map_err(|v: Vec<_>| {
|
||||
+ log::error!(
|
||||
+ "ixgbed: internal error: DMA buffer array conversion failed (got {} items, expected 32)",
|
||||
+ v.len()
|
||||
+ );
|
||||
+ Error::new(EIO)
|
||||
+ })?,
|
||||
receive_ring: unsafe { Dma::zeroed()?.assume_init() },
|
||||
transmit_buffer: (0..32)
|
||||
.map(|_| Ok(unsafe { Dma::zeroed()?.assume_init() }))
|
||||
.collect::<Result<Vec<_>>>()?
|
||||
.try_into()
|
||||
- .unwrap_or_else(|_| unreachable!()),
|
||||
+ .map_err(|v: Vec<_>| {
|
||||
+ log::error!(
|
||||
+ "ixgbed: internal error: DMA buffer array conversion failed (got {} items, expected 32)",
|
||||
+ v.len()
|
||||
+ );
|
||||
+ Error::new(EIO)
|
||||
+ })?,
|
||||
receive_index: 0,
|
||||
transmit_ring: unsafe { Dma::zeroed()?.assume_init() },
|
||||
transmit_ring_free: 32,
|
||||
@@ -166,7 +183,7 @@ impl Intel8259x {
|
||||
|
||||
if (status & IXGBE_RXDADV_STAT_DD) != 0 {
|
||||
if (status & IXGBE_RXDADV_STAT_EOP) == 0 {
|
||||
- panic!("increase buffer size or decrease MTU")
|
||||
+ log::error!("ixgbed: received fragmented packet, buffer too small");
|
||||
}
|
||||
|
||||
return unsafe { desc.wb.upper.length as usize };
|
||||
@@ -205,13 +222,8 @@ impl Intel8259x {
|
||||
self.mac_address = mac;
|
||||
}
|
||||
|
||||
- /// Returns the register at `self.base` + `register`.
|
||||
- ///
|
||||
- /// # Panics
|
||||
- ///
|
||||
- /// Panics if `self.base` + `register` does not belong to the mapped memory of the PCIe device.
|
||||
fn read_reg(&self, register: u32) -> u32 {
|
||||
- assert!(
|
||||
+ debug_assert!(
|
||||
register as usize <= self.size - 4 as usize,
|
||||
"MMIO access out of bounds"
|
||||
);
|
||||
@@ -219,13 +231,8 @@ impl Intel8259x {
|
||||
unsafe { ptr::read_volatile((self.base + register as usize) as *mut u32) }
|
||||
}
|
||||
|
||||
- /// Sets the register at `self.base` + `register`.
|
||||
- ///
|
||||
- /// # Panics
|
||||
- ///
|
||||
- /// Panics if `self.base` + `register` does not belong to the mapped memory of the PCIe device.
|
||||
fn write_reg(&self, register: u32, data: u32) -> u32 {
|
||||
- assert!(
|
||||
+ debug_assert!(
|
||||
register as usize <= self.size - 4 as usize,
|
||||
"MMIO access out of bounds"
|
||||
);
|
||||
@@ -279,7 +286,7 @@ impl Intel8259x {
|
||||
|
||||
let mac = self.get_mac_addr();
|
||||
|
||||
- println!(
|
||||
+ log::info!(
|
||||
" - MAC: {:>02X}:{:>02X}:{:>02X}:{:>02X}:{:>02X}:{:>02X}",
|
||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]
|
||||
);
|
||||
@@ -438,13 +445,11 @@ impl Intel8259x {
|
||||
}
|
||||
|
||||
/// Sets the rx queues` descriptors and enables the queues.
|
||||
- ///
|
||||
- /// # Panics
|
||||
- /// Panics if length of `self.receive_ring` is not a power of 2.
|
||||
fn start_rx_queue(&mut self, queue_id: u16) {
|
||||
- if self.receive_ring.len() & (self.receive_ring.len() - 1) != 0 {
|
||||
- panic!("number of receive queue entries must be a power of 2");
|
||||
- }
|
||||
+ debug_assert!(
|
||||
+ self.receive_ring.len() & (self.receive_ring.len() - 1) == 0,
|
||||
+ "number of receive queue entries must be a power of 2"
|
||||
+ );
|
||||
|
||||
for i in 0..self.receive_ring.len() {
|
||||
self.receive_ring[i].read.pkt_addr = self.receive_buffer[i].physical() as u64;
|
||||
@@ -466,13 +471,11 @@ impl Intel8259x {
|
||||
}
|
||||
|
||||
/// Enables the tx queues.
|
||||
- ///
|
||||
- /// # Panics
|
||||
- /// Panics if length of `self.transmit_ring` is not a power of 2.
|
||||
fn start_tx_queue(&mut self, queue_id: u16) {
|
||||
- if self.transmit_ring.len() & (self.transmit_ring.len() - 1) != 0 {
|
||||
- panic!("number of receive queue entries must be a power of 2");
|
||||
- }
|
||||
+ debug_assert!(
|
||||
+ self.transmit_ring.len() & (self.transmit_ring.len() - 1) == 0,
|
||||
+ "number of transmit queue entries must be a power of 2"
|
||||
+ );
|
||||
|
||||
for i in 0..self.transmit_ring.len() {
|
||||
self.transmit_ring[i].read.buffer_addr = self.transmit_buffer[i].physical() as u64;
|
||||
@@ -506,14 +509,14 @@ impl Intel8259x {
|
||||
|
||||
/// Waits for the link to come up.
|
||||
fn wait_for_link(&self) {
|
||||
- println!(" - waiting for link");
|
||||
+ log::info!(" - waiting for link");
|
||||
let time = Instant::now();
|
||||
let mut speed = self.get_link_speed();
|
||||
while speed == 0 && time.elapsed().as_secs() < 10 {
|
||||
thread::sleep(Duration::from_millis(100));
|
||||
speed = self.get_link_speed();
|
||||
}
|
||||
- println!(" - link speed is {} Mbit/s", self.get_link_speed());
|
||||
+ log::info!(" - link speed is {} Mbit/s", self.get_link_speed());
|
||||
}
|
||||
|
||||
/// Enables or disables promisc mode of this device.
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-ac97d-ihdad-main.patch
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-acpid-core-refactor.patch
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-boot-logging.patch
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-hwd-misc.patch
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-ihdad-device-refactor.patch
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-ihdad-hda-stream.patch
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-init-acpid-wiring.patch
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-init-subsystems.patch
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-inputd.patch
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-ixgbed-error-handling.patch
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-logd.patch
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-misc-daemon-fixes.patch
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-network-driver-mains.patch
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-network-error-handling.patch
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-pcid-cfg-access.patch
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-pcid-driver-interface.patch
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-ps2d-improvements.patch
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-storage-driver-mains.patch
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-storage-error-handling.patch
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-usb-pm-and-drivers.patch
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-virtio-core-vbox.patch
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P2-xhcid-remaining.patch
|
||||
@@ -1,7 +1,35 @@
|
||||
[source]
|
||||
git = "https://gitlab.redox-os.org/redox-os/base.git"
|
||||
rev = "463f76b9608a896e6f6c9f63457f57f6409873c7"
|
||||
patches = ["redox.patch", "P2-boot-runtime-fixes.patch", "P2-acpi-i2c-resources.patch", "P2-daemon-ready-graceful.patch", "P2-daemon-hardening.patch", "P2-acpi-defer-aml.patch"]
|
||||
patches = [
|
||||
"P2-ac97d-ihdad-main.patch",
|
||||
"P2-acpi-defer-aml.patch",
|
||||
"P2-acpi-i2c-resources.patch",
|
||||
"P2-acpid-core-refactor.patch",
|
||||
"P2-boot-logging.patch",
|
||||
"P2-boot-runtime-fixes.patch",
|
||||
"P2-daemon-hardening.patch",
|
||||
"P2-daemon-ready-graceful.patch",
|
||||
"P2-hwd-misc.patch",
|
||||
"P2-ihdad-device-refactor.patch",
|
||||
"P2-ihdad-hda-stream.patch",
|
||||
"P2-init-acpid-wiring.patch",
|
||||
"P2-init-subsystems.patch",
|
||||
"P2-inputd.patch",
|
||||
"P2-ixgbed-error-handling.patch",
|
||||
"P2-logd.patch",
|
||||
"P2-misc-daemon-fixes.patch",
|
||||
"P2-network-driver-mains.patch",
|
||||
"P2-network-error-handling.patch",
|
||||
"P2-pcid-cfg-access.patch",
|
||||
"P2-pcid-driver-interface.patch",
|
||||
"P2-ps2d-improvements.patch",
|
||||
"P2-storage-driver-mains.patch",
|
||||
"P2-storage-error-handling.patch",
|
||||
"P2-usb-pm-and-drivers.patch",
|
||||
"P2-virtio-core-vbox.patch",
|
||||
"P2-xhcid-remaining.patch",
|
||||
]
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
|
||||
Reference in New Issue
Block a user