mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-20 04:56:32 +00:00
Refactor virtio drivers with DMA APIs
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
5e127b2da0
commit
cd1575bc6d
@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use aster_frame::vm::{DmaCoherent, DmaStream, DmaStreamSlice, HasDaddr};
|
||||
use aster_network::{DmaSegment, RxBuffer, TxBuffer};
|
||||
|
||||
/// A DMA-capable buffer.
|
||||
///
|
||||
@ -29,3 +30,21 @@ impl DmaBuf for DmaCoherent {
|
||||
self.nbytes()
|
||||
}
|
||||
}
|
||||
|
||||
impl DmaBuf for DmaSegment {
|
||||
fn len(&self) -> usize {
|
||||
self.size()
|
||||
}
|
||||
}
|
||||
|
||||
impl DmaBuf for TxBuffer {
|
||||
fn len(&self) -> usize {
|
||||
self.nbytes()
|
||||
}
|
||||
}
|
||||
|
||||
impl DmaBuf for RxBuffer {
|
||||
fn len(&self) -> usize {
|
||||
self.buf_len()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user