mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-05 21:15:45 +00:00
vhost_user_backend: Allow backends to know features that can be used
Previous to adding a a trait method to inform the backends of the acked features backends can use features than the guest has not enabled which could lead to unpredictable results. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
9d88ba7afb
commit
b94d9a30d3
@ -64,9 +64,12 @@ pub trait VhostUserBackend: Send + Sync + 'static {
|
|||||||
/// Depth of each queue.
|
/// Depth of each queue.
|
||||||
fn max_queue_size(&self) -> usize;
|
fn max_queue_size(&self) -> usize;
|
||||||
|
|
||||||
/// Virtio features.
|
/// Available virtio features.
|
||||||
fn features(&self) -> u64;
|
fn features(&self) -> u64;
|
||||||
|
|
||||||
|
/// Acked virtio features.
|
||||||
|
fn acked_features(&mut self, _features: u64) {}
|
||||||
|
|
||||||
/// Virtio protocol features.
|
/// Virtio protocol features.
|
||||||
fn protocol_features(&self) -> VhostUserProtocolFeatures;
|
fn protocol_features(&self) -> VhostUserProtocolFeatures;
|
||||||
|
|
||||||
@ -577,6 +580,11 @@ impl<S: VhostUserBackend> VhostUserSlaveReqHandler for VhostUserHandler<S> {
|
|||||||
vring.write().unwrap().enabled = vring_enabled;
|
vring.write().unwrap().enabled = vring_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.backend
|
||||||
|
.write()
|
||||||
|
.unwrap()
|
||||||
|
.acked_features(self.acked_features);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user