-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpvirtq.rs
More file actions
54 lines (43 loc) · 1.22 KB
/
pvirtq.rs
File metadata and controls
54 lines (43 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! Packed virtqueue definitions
use bitfield_struct::bitfield;
use crate::{RingEventFlags, le16, le32, le64, virtq};
/// Packed Virtqueue Descriptor
#[doc(alias = "pvirtq_desc")]
#[repr(C)]
pub struct Desc {
/// Buffer Address.
pub addr: le64,
/// Buffer Length.
pub len: le32,
/// Buffer ID.
pub id: le16,
/// The flags depending on descriptor type.
pub flags: virtq::DescF,
}
/// Event Suppression Descriptor
#[doc(alias = "pvirtq_event_suppress")]
#[repr(C)]
pub struct EventSuppress {
/// If desc_event_flags set to RING_EVENT_FLAGS_DESC
pub desc: EventSuppressDesc,
pub flags: EventSuppressFlags,
}
/// Event Suppression Flags
#[bitfield(u16, repr = le16, from = le16::from_ne, into = le16::to_ne)]
pub struct EventSuppressDesc {
/// Descriptor Ring Change Event Offset
#[bits(15)]
pub desc_event_off: u16,
/// Descriptor Ring Change Event Wrap Counter
#[bits(1)]
pub desc_event_wrap: u8,
}
#[bitfield(u16, repr = le16, from = le16::from_ne, into = le16::to_ne)]
pub struct EventSuppressFlags {
/// Descriptor Ring Change Event Flags
#[bits(2)]
pub desc_event_flags: RingEventFlags,
/// Reserved, set to 0
#[bits(14)]
pub reserved: u16,
}