mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-30 10:43:56 +00:00
Move network polling code to bottom half
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
9804f053f2
commit
7d24e63216
@ -6,7 +6,8 @@ use alloc::{
|
||||
};
|
||||
use core::ops::{Deref, DerefMut};
|
||||
|
||||
use ostd::sync::{LocalIrqDisabled, SpinLock, SpinLockGuard};
|
||||
use aster_softirq::BottomHalfDisabled;
|
||||
use ostd::sync::{SpinLock, SpinLockGuard};
|
||||
use smoltcp::{
|
||||
socket::{tcp::State, PollAt},
|
||||
time::Duration,
|
||||
@ -34,7 +35,7 @@ pub type TcpConnection<E> = Socket<TcpConnectionInner<E>, E>;
|
||||
|
||||
/// States needed by [`TcpConnectionBg`].
|
||||
pub struct TcpConnectionInner<E: Ext> {
|
||||
socket: SpinLock<RawTcpSocketExt<E>, LocalIrqDisabled>,
|
||||
socket: SpinLock<RawTcpSocketExt<E>, BottomHalfDisabled>,
|
||||
poll_key: PollKey,
|
||||
connection_key: ConnectionKey,
|
||||
}
|
||||
@ -243,7 +244,7 @@ impl<E: Ext> TcpConnectionInner<E> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn lock(&self) -> SpinLockGuard<RawTcpSocketExt<E>, LocalIrqDisabled> {
|
||||
pub(super) fn lock(&self) -> SpinLockGuard<RawTcpSocketExt<E>, BottomHalfDisabled> {
|
||||
self.socket.lock()
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
use alloc::{boxed::Box, collections::btree_map::BTreeMap, sync::Arc, vec::Vec};
|
||||
|
||||
use ostd::sync::{LocalIrqDisabled, SpinLock};
|
||||
use aster_softirq::BottomHalfDisabled;
|
||||
use ostd::sync::SpinLock;
|
||||
use smoltcp::{
|
||||
socket::PollAt,
|
||||
time::Duration,
|
||||
@ -35,7 +36,7 @@ pub struct TcpBacklog<E: Ext> {
|
||||
|
||||
/// States needed by [`TcpListenerBg`].
|
||||
pub struct TcpListenerInner<E: Ext> {
|
||||
pub(super) backlog: SpinLock<TcpBacklog<E>, LocalIrqDisabled>,
|
||||
pub(super) backlog: SpinLock<TcpBacklog<E>, BottomHalfDisabled>,
|
||||
listener_key: ListenerKey,
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,8 @@
|
||||
use alloc::{boxed::Box, sync::Arc};
|
||||
use core::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
use ostd::sync::{LocalIrqDisabled, SpinLock};
|
||||
use aster_softirq::BottomHalfDisabled;
|
||||
use ostd::sync::SpinLock;
|
||||
use smoltcp::{
|
||||
iface::Context,
|
||||
socket::udp::UdpMetadata,
|
||||
@ -22,7 +23,7 @@ pub type UdpSocket<E> = Socket<UdpSocketInner, E>;
|
||||
|
||||
/// States needed by [`UdpSocketBg`].
|
||||
pub struct UdpSocketInner {
|
||||
socket: SpinLock<Box<RawUdpSocket>, LocalIrqDisabled>,
|
||||
socket: SpinLock<Box<RawUdpSocket>, BottomHalfDisabled>,
|
||||
need_dispatch: AtomicBool,
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user