mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 08:53:29 +00:00
Move network polling code to bottom half
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
9804f053f2
commit
7d24e63216
@ -9,13 +9,10 @@ use aster_bigtcp::device::{Checksum, DeviceCapabilities, Medium};
|
||||
use aster_network::{
|
||||
AnyNetworkDevice, EthernetAddr, RxBuffer, TxBuffer, VirtioNetError, RX_BUFFER_POOL,
|
||||
};
|
||||
use aster_softirq::BottomHalfDisabled;
|
||||
use aster_util::slot_vec::SlotVec;
|
||||
use log::{debug, warn};
|
||||
use ostd::{
|
||||
mm::DmaStream,
|
||||
sync::{LocalIrqDisabled, SpinLock},
|
||||
trap::TrapFrame,
|
||||
};
|
||||
use ostd::{mm::DmaStream, sync::SpinLock, trap::TrapFrame};
|
||||
|
||||
use super::{config::VirtioNetConfig, header::VirtioNetHdr};
|
||||
use crate::{
|
||||
@ -127,10 +124,10 @@ impl NetworkDevice {
|
||||
|
||||
/// Interrupt handlers if network device receives/sends some packet
|
||||
fn handle_send_event(_: &TrapFrame) {
|
||||
aster_network::handle_send_irq(super::DEVICE_NAME);
|
||||
aster_network::raise_send_softirq();
|
||||
}
|
||||
fn handle_recv_event(_: &TrapFrame) {
|
||||
aster_network::handle_recv_irq(super::DEVICE_NAME);
|
||||
aster_network::raise_receive_softirq();
|
||||
}
|
||||
|
||||
device
|
||||
@ -363,7 +360,7 @@ impl Debug for NetworkDevice {
|
||||
}
|
||||
}
|
||||
|
||||
static TX_BUFFER_POOL: SpinLock<LinkedList<DmaStream>, LocalIrqDisabled> =
|
||||
static TX_BUFFER_POOL: SpinLock<LinkedList<DmaStream>, BottomHalfDisabled> =
|
||||
SpinLock::new(LinkedList::new());
|
||||
|
||||
const QUEUE_RECV: u16 = 0;
|
||||
|
@ -3,15 +3,16 @@
|
||||
use alloc::{collections::linked_list::LinkedList, sync::Arc};
|
||||
|
||||
use aster_network::dma_pool::DmaPool;
|
||||
use aster_softirq::BottomHalfDisabled;
|
||||
use ostd::{
|
||||
mm::{DmaDirection, DmaStream},
|
||||
sync::{LocalIrqDisabled, SpinLock},
|
||||
sync::SpinLock,
|
||||
};
|
||||
use spin::Once;
|
||||
|
||||
const RX_BUFFER_LEN: usize = 4096;
|
||||
pub static RX_BUFFER_POOL: Once<Arc<DmaPool>> = Once::new();
|
||||
pub static TX_BUFFER_POOL: Once<SpinLock<LinkedList<DmaStream>, LocalIrqDisabled>> = Once::new();
|
||||
pub static TX_BUFFER_POOL: Once<SpinLock<LinkedList<DmaStream>, BottomHalfDisabled>> = Once::new();
|
||||
|
||||
pub fn init() {
|
||||
const POOL_INIT_SIZE: usize = 32;
|
||||
|
Reference in New Issue
Block a user