Move network polling code to bottom half

This commit is contained in:
jiangjianfeng
2025-02-20 07:00:53 +00:00
committed by Tate, Hongliang Tian
parent 9804f053f2
commit 7d24e63216
16 changed files with 122 additions and 85 deletions

View File

@ -2,12 +2,13 @@
use alloc::{collections::linked_list::LinkedList, sync::Arc};
use aster_softirq::BottomHalfDisabled;
use ostd::{
mm::{
Daddr, DmaDirection, DmaStream, FrameAllocOptions, HasDaddr, Infallible, VmReader,
VmWriter, PAGE_SIZE,
},
sync::{LocalIrqDisabled, SpinLock},
sync::SpinLock,
Pod,
};
use spin::Once;
@ -17,14 +18,14 @@ use crate::dma_pool::{DmaPool, DmaSegment};
pub struct TxBuffer {
dma_stream: DmaStream,
nbytes: usize,
pool: &'static SpinLock<LinkedList<DmaStream>, LocalIrqDisabled>,
pool: &'static SpinLock<LinkedList<DmaStream>, BottomHalfDisabled>,
}
impl TxBuffer {
pub fn new<H: Pod>(
header: &H,
packet: &[u8],
pool: &'static SpinLock<LinkedList<DmaStream>, LocalIrqDisabled>,
pool: &'static SpinLock<LinkedList<DmaStream>, BottomHalfDisabled>,
) -> Self {
let header = header.as_bytes();
let nbytes = header.len() + packet.len();