Skip to content
This repository was archived by the owner on Oct 24, 2022. It is now read-only.

Commit 3da9056

Browse files
committed
Reset the Queue on GET_VRING_BASE
According to the vhost-user specs, we should start the vring upon receiving the first kick, and stop it when we receive GET_VRING_BASE. Strictly speaking, we should reset the underlying Queue on the first kick, but it's actually easier to simply do that in GET_VRING_BASE and be ready in case the guest re-initializes the vring. Signed-off-by: Sergio Lopez <[email protected]>
1 parent 724f5c4 commit 3da9056

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,11 @@ impl<S: VhostUserBackend> VhostUserSlaveReqHandlerMut for VhostUserHandler<S> {
789789

790790
self.vrings[index as usize].write().unwrap().call = None;
791791

792+
// Strictly speaking, we should do this upon receiving the first kick,
793+
// but it's actually easier to just do it here so we're ready in case
794+
// the vring gets re-initialized by the guest.
795+
self.vrings[index as usize].write().unwrap().queue.reset();
796+
792797
let next_avail = self.vrings[index as usize]
793798
.read()
794799
.unwrap()

0 commit comments

Comments
 (0)