113776c11Slogin use alloc::string::String; 213776c11Slogin use smoltcp::{ 313776c11Slogin iface, 413776c11Slogin wire::{self, EthernetAddress}, 513776c11Slogin }; 613776c11Slogin 7*e32effb1SLoGin use super::base::device::Device; 891e9d4abSLoGin use crate::libs::spinlock::SpinLock; 991e9d4abSLoGin use system_error::SystemError; 1013776c11Slogin 1177799ccaSWu Mianzhi mod dma; 1277799ccaSWu Mianzhi pub mod e1000e; 13e2841179SLoGin pub mod irq_handle; 1413776c11Slogin pub mod virtio_net; 1513776c11Slogin 16*e32effb1SLoGin pub trait NetDevice: Device { 1713776c11Slogin /// @brief 获取网卡的MAC地址 1813776c11Slogin fn mac(&self) -> EthernetAddress; 1913776c11Slogin 2013776c11Slogin fn name(&self) -> String; 2113776c11Slogin 2213776c11Slogin /// @brief 获取网卡的id 2313776c11Slogin fn nic_id(&self) -> usize; 2413776c11Slogin 2513776c11Slogin fn poll(&self, sockets: &mut iface::SocketSet) -> Result<(), SystemError>; 2613776c11Slogin 2713776c11Slogin fn update_ip_addrs(&self, ip_addrs: &[wire::IpCidr]) -> Result<(), SystemError>; 2813776c11Slogin 2913776c11Slogin /// @brief 获取smoltcp的网卡接口类型 3013776c11Slogin fn inner_iface(&self) -> &SpinLock<smoltcp::iface::Interface>; 3113776c11Slogin // fn as_any_ref(&'static self) -> &'static dyn core::any::Any; 3213776c11Slogin } 33