Created by: Alic3r3L1cwhk
This pull request introduces a major architectural refactor and feature expansion for the network subsystem, aligning it with Solaris FireEngine/Crossbow and Linux kernel designs, and adds a new PLIC (interrupt controller) driver. It also updates documentation to reflect these changes, including a detailed breakdown of the new network stack, device abstraction, and future roadmap. Key highlights include a new block+wakeup socket model, a NetDevice trait for network drivers, dynamic device registration, flow counters, and PLIC-based interrupt support.
Network Subsystem Refactor and Enhancements:
- Introduced a new
NetDevicetrait (os/src/drivers/net/net_device.rs) to abstract network devices, following Solaris GLDv3's minimal interface, and implemented dynamic registration through a globalNET_DEVICESBTreeMap. This enables support for multiple network devices and easier extension [1] [2]. - Refactored the VirtIO-Net driver to implement the
NetDevicetrait (VirtIONetDevice), and provided a compatibility layer for smoltcp integration during migration [1] [2]. - Added per-socket block+wakeup synchronization using
WaitQueue, replacing busy-wait yield polling, which improves CPU efficiency and aligns with Solaris squeue and Linuxsock->sk_wqmodels. - Implemented flow counters for RX/TX packets and bytes, with atomic operations for thread safety, and exposed a function to retrieve traffic statistics [1] [2] [3].
Interrupt Controller (PLIC) Support:
- Added a new PLIC driver (
os/src/drivers/plic.rs) for configuring and handling hardware interrupts, including device IRQ registration, priority setting, and claim/complete operations. The VirtIO-Net driver now registers its IRQ with the PLIC [1] [2].
Documentation and Roadmap Updates:
- Updated
README.mdto document the new network architecture, device abstraction, flow counters, block+wakeup model, and PLIC-driven interrupts. Added a new section on the network subsystem's completion status and design highlights [1] [2] [3] [4]. - Revised the project structure and next-step recommendations to prioritize SMP multicore support and VFS refactoring, and to reflect the increased syscall count and new user programs [1] [2] [3] [4].
Miscellaneous:
- Removed kernel-side DNS support and the
socket-dnsfeature, delegating DNS resolution to user space for better Linux compatibility [1] [2]. - Increased the number of user programs linked in the system from 7 to 10.
These changes lay the groundwork for advanced networking features, improved scalability, and future multicore support.
References:
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]