Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix: update VirtQueue.avail.used_event to support VIRTIO_F_EVENT_IDX #121

Merged
merged 1 commit into from
Dec 22, 2023
Merged
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
9 changes: 8 additions & 1 deletion src/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
pub fn new<T: Transport>(
transport: &mut T,
idx: u16,
indirect: bool,

Check warning on line 74 in src/queue.rs

View workflow job for this annotation

GitHub Actions / build

unused variable: `indirect`

Check warning on line 74 in src/queue.rs

View workflow job for this annotation

GitHub Actions / build

unused variable: `indirect`
event_idx: bool,
) -> Result<Self> {
if transport.queue_used(idx) {
Expand Down Expand Up @@ -530,6 +530,12 @@
}
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 @@
/// 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
Loading