mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-04-01 20:04:37 +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.
|
||||
fn max_queue_size(&self) -> usize;
|
||||
|
||||
/// Virtio features.
|
||||
/// Available virtio features.
|
||||
fn features(&self) -> u64;
|
||||
|
||||
/// Acked virtio features.
|
||||
fn acked_features(&mut self, _features: u64) {}
|
||||
|
||||
/// Virtio protocol features.
|
||||
fn protocol_features(&self) -> VhostUserProtocolFeatures;
|
||||
|
||||
@ -577,6 +580,11 @@ impl<S: VhostUserBackend> VhostUserSlaveReqHandler for VhostUserHandler<S> {
|
||||
vring.write().unwrap().enabled = vring_enabled;
|
||||
}
|
||||
|
||||
self.backend
|
||||
.write()
|
||||
.unwrap()
|
||||
.acked_features(self.acked_features);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user