Expand description
smoltcp integration layer.
This module provides the bridge between MorpheusX network device drivers and the smoltcp TCP/IP stack.
§Components
DeviceAdapter- AdaptsNetworkDeviceto smoltcp’sDevicetraitNetInterface- Full IP stack with TCP sockets and DHCP
§Usage
ⓘ
use morpheus_network::stack::{NetInterface, NetConfig};
use morpheus_network::device::virtio::VirtioNetDevice;
use morpheus_network::device::hal::StaticHal;
use dma_pool::DmaPool;
// Initialize DMA pool from caves in our PE image
unsafe { DmaPool::init_from_caves(image_base, image_end) };
// Initialize HAL
StaticHal::init();
// Create device
let device = VirtioNetDevice::<StaticHal, _>::new(transport)?;
// Create interface with DHCP
let mut iface = NetInterface::new(device, NetConfig::dhcp());
// Poll until IP configured
while !iface.has_ip() {
iface.poll(get_time_ms());
}Re-exports§
pub use crate::device::pci::ecam_bases;
Modules§
- Full smoltcp network interface with TCP/IP stack.
Structs§
- A single debug log entry
- Ring buffer for debug logs
- Thin adapter that exposes a
NetworkDeviceto smoltcp. - Full network interface with IP stack.
- Ring buffer for packet statistics - tracks recent activity without overflow
Enums§
- Network interface configuration.
- Network interface state.
Constants§
- Maximum length of a single debug message
- Number of messages in the ring buffer
- Maximum number of concurrent TCP sockets.
- MTU 🔒
- Ring buffer size for packet counters (must be power of 2 for efficient masking)
Statics§
Functions§
- Push a debug message to the ring buffer (AND write to serial)
- Check if there are pending debug messages
- Clear all debug messages
- Pop the next debug message from the ring buffer (FIFO order) Returns None if buffer is empty
- Get current debug init stage.
- Get the number of DHCP discover packets sent.
- Get the number of packets received.
- Set debug init stage and log it
- Get the number of TX errors that have occurred.
- Get the number of packets transmitted.