mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vhost_user_backend: move protocol_features to the backend
Extend VhostUserBackend trait with protocol_features(), so device backend implementations can freely define which protocol features they want to support. Signed-off-by: Sergio Lopez <slp@redhat.com>
This commit is contained in:
committed by
Rob Bradford
parent
85e936d4bd
commit
08bebaae4f
@@ -433,6 +433,10 @@ impl VhostUserBackend for VhostUserNetBackend {
|
|||||||
| VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits()
|
| VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn protocol_features(&self) -> VhostUserProtocolFeatures {
|
||||||
|
VhostUserProtocolFeatures::all()
|
||||||
|
}
|
||||||
|
|
||||||
fn update_memory(&mut self, mem: GuestMemoryMmap) -> VhostUserBackendResult<()> {
|
fn update_memory(&mut self, mem: GuestMemoryMmap) -> VhostUserBackendResult<()> {
|
||||||
self.mem = Some(mem);
|
self.mem = Some(mem);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -62,6 +62,9 @@ pub trait VhostUserBackend: Send + Sync + 'static {
|
|||||||
/// Virtio features.
|
/// Virtio features.
|
||||||
fn features(&self) -> u64;
|
fn features(&self) -> u64;
|
||||||
|
|
||||||
|
/// Virtio protocol features.
|
||||||
|
fn protocol_features(&self) -> VhostUserProtocolFeatures;
|
||||||
|
|
||||||
/// Update guest memory regions.
|
/// Update guest memory regions.
|
||||||
fn update_memory(&mut self, mem: GuestMemoryMmap) -> result::Result<(), io::Error>;
|
fn update_memory(&mut self, mem: GuestMemoryMmap) -> result::Result<(), io::Error>;
|
||||||
|
|
||||||
@@ -500,7 +503,7 @@ impl<S: VhostUserBackend> VhostUserSlaveReqHandler for VhostUserHandler<S> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_protocol_features(&mut self) -> VhostUserResult<VhostUserProtocolFeatures> {
|
fn get_protocol_features(&mut self) -> VhostUserResult<VhostUserProtocolFeatures> {
|
||||||
Ok(VhostUserProtocolFeatures::all())
|
Ok(self.backend.read().unwrap().protocol_features())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_protocol_features(&mut self, features: u64) -> VhostUserResult<()> {
|
fn set_protocol_features(&mut self, features: u64) -> VhostUserResult<()> {
|
||||||
|
|||||||
Reference in New Issue
Block a user