113776c11Slogin use alloc::string::String; 213776c11Slogin use smoltcp::{ 313776c11Slogin iface, 413776c11Slogin wire::{self, EthernetAddress}, 513776c11Slogin }; 613776c11Slogin 713776c11Slogin use crate::{libs::spinlock::SpinLock, syscall::SystemError}; 813776c11Slogin 9a03c4f9dSLoGin use super::base::device::driver::Driver; 1013776c11Slogin 11*77799ccaSWu Mianzhi mod dma; 12*77799ccaSWu Mianzhi pub mod e1000e; 1313776c11Slogin pub mod virtio_net; 1413776c11Slogin 1513776c11Slogin pub trait NetDriver: Driver { 1613776c11Slogin /// @brief 获取网卡的MAC地址 1713776c11Slogin fn mac(&self) -> EthernetAddress; 1813776c11Slogin 1913776c11Slogin fn name(&self) -> String; 2013776c11Slogin 2113776c11Slogin /// @brief 获取网卡的id 2213776c11Slogin fn nic_id(&self) -> usize; 2313776c11Slogin 2413776c11Slogin fn poll(&self, sockets: &mut iface::SocketSet) -> Result<(), SystemError>; 2513776c11Slogin 2613776c11Slogin fn update_ip_addrs(&self, ip_addrs: &[wire::IpCidr]) -> Result<(), SystemError>; 2713776c11Slogin 2813776c11Slogin /// @brief 获取smoltcp的网卡接口类型 2913776c11Slogin fn inner_iface(&self) -> &SpinLock<smoltcp::iface::Interface>; 3013776c11Slogin // fn as_any_ref(&'static self) -> &'static dyn core::any::Any; 3113776c11Slogin } 32