Skip to content

Commit

Permalink
Merge pull request #121 from DeathWish5/dev
Browse files Browse the repository at this point in the history
Bug fix: update VirtQueue.avail.used_event to support VIRTIO_F_EVENT_IDX
  • Loading branch information
equation314 authored Dec 22, 2023
2 parents 501d359 + 3ce80bd commit 61ece50
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,12 @@ impl<H: Hal, const SIZE: usize> VirtQueue<H, SIZE> {
}
self.last_used_idx = self.last_used_idx.wrapping_add(1);

if self.event_idx {
unsafe {
(*self.avail.as_ptr()).used_event = self.last_used_idx;
}
}

Ok(len)
}
}
Expand Down Expand Up @@ -759,7 +765,8 @@ struct AvailRing<const SIZE: usize> {
/// A driver MUST NOT decrement the idx.
idx: u16,
ring: [u16; SIZE],
used_event: u16, // unused
/// Only used if `VIRTIO_F_EVENT_IDX` is negotiated.
used_event: u16,
}

/// The used ring is where the device returns buffers once it is done with them:
Expand Down

0 comments on commit 61ece50

Please sign in to comment.