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 <slp@redhat.com>
This commit is contained in:
parent
4feeb77a20
commit
17131359eb
1 changed files with 8 additions and 0 deletions
|
|
@ -396,6 +396,14 @@ where
|
|||
self.vrings[index as usize].set_kick(None);
|
||||
self.vrings[index as usize].set_call(None);
|
||||
|
||||
// Strictly speaking, we should do this upon receiving the first kick,
|
||||
// but it's actually easier to just do it here so we're ready in case
|
||||
// the vring gets re-initialized by the guest.
|
||||
self.vrings[index as usize]
|
||||
.get_mut()
|
||||
.get_queue_mut()
|
||||
.reset();
|
||||
|
||||
let next_avail = self.vrings[index as usize].queue_next_avail();
|
||||
|
||||
Ok(VhostUserVringState::new(index, u32::from(next_avail)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue