Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/propolis/src/hw/virtio/bits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ pub const VIRTIO_NET_F_STATUS: u64 = 1 << 16;
pub const VIRTIO_NET_F_CTRL_VQ: u64 = 1 << 17;
pub const VIRTIO_NET_F_CTRL_RX: u64 = 1 << 18;
pub const VIRTIO_NET_F_CTRL_VLAN: u64 = 1 << 19;
pub const VIRTIO_NET_F_CTRL_RX_EXTRA: u64 = 1 << 20;
pub const VIRTIO_NET_F_GUEST_ANNOUNCE: u64 = 1 << 21;
pub const VIRTIO_NET_F_MQ: u64 = 1 << 22;

// virtio-block feature bits
Expand Down
12 changes: 8 additions & 4 deletions lib/propolis/src/hw/virtio/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,11 @@ impl VqUsed {
mem.write(self.gpa_flags, &value);
}

/// Disables notifications on this queue; returns the previous state.
/// Disables notifications on this queue; returns whether notfications were
/// enabled before.
fn disable_notify(&self, mem: &MemCtx) -> bool {
let flags = self.flags(mem);
let current = flags.contains(UsedFlags::NO_NOTIFY);
let current = !flags.contains(UsedFlags::NO_NOTIFY);
self.set_flags(flags | UsedFlags::NO_NOTIFY, mem);
current
}
Expand Down Expand Up @@ -326,6 +327,7 @@ impl VirtQueue {
used.reset();
self.live.store(false, Ordering::Release);
self.enabled.store(false, Ordering::Release);
self.is_control.store(false, Ordering::Release);
}

pub(super) fn enable(&self) {
Expand Down Expand Up @@ -564,7 +566,9 @@ impl VirtQueue {
used.interrupt.as_ref().map(|x| x.read())
}

/// Disables interrupts (notifications) on the `Used` ring
/// Disables interrupts (notifications) on the `Used` ring.
///
/// Returns `true` if notifications were previously enabled.
pub(super) fn disable_intr(&self, mem: &MemCtx) -> bool {
let used = self.used.lock().unwrap();
used.disable_notify(mem)
Expand Down Expand Up @@ -1060,7 +1064,7 @@ impl VirtQueues {
// section 5.1.2). None of the other devices currently handle queues
// specially in this way, but we should come up with some better
// mechanism here.
if qid + 1 == len {
if qid + 1 == self.max_capacity() {
Some(self.get_control())
} else {
self.queues[..len].get(qid)
Expand Down
Loading
Loading