mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: vhost_user: Set NEED_REPLY when REPLY_ACK is supported
Now that vhost crate allows the caller to set the header flags, we can set NEED_REPLY whenever the REPLY_ACK protocol feature is supported from both ends. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Generated
+1
-1
@@ -1111,7 +1111,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "vhost"
|
name = "vhost"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/rust-vmm/vhost?branch=master#a8ff939161d41fc2f449b80e461d013c1e19f666"
|
source = "git+https://github.com/rust-vmm/vhost?branch=master#e294ed66fcc12e033957f20034ae5fef5bb9eeac"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"libc",
|
"libc",
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use std::thread::sleep;
|
|||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
use vhost::vhost_user::message::{
|
use vhost::vhost_user::message::{
|
||||||
VhostUserInflight, VhostUserProtocolFeatures, VhostUserVirtioFeatures,
|
VhostUserHeaderFlag, VhostUserInflight, VhostUserProtocolFeatures, VhostUserVirtioFeatures,
|
||||||
};
|
};
|
||||||
use vhost::vhost_user::{Master, MasterReqHandler, VhostUserMaster, VhostUserMasterReqHandler};
|
use vhost::vhost_user::{Master, MasterReqHandler, VhostUserMaster, VhostUserMasterReqHandler};
|
||||||
use vhost::{VhostBackend, VhostUserMemoryRegionInfo, VringConfigData};
|
use vhost::{VhostBackend, VhostUserMemoryRegionInfo, VringConfigData};
|
||||||
@@ -95,12 +95,18 @@ pub fn negotiate_features_vhost_user(
|
|||||||
vu.set_protocol_features(acked_protocol_features)
|
vu.set_protocol_features(acked_protocol_features)
|
||||||
.map_err(Error::VhostUserSetProtocolFeatures)?;
|
.map_err(Error::VhostUserSetProtocolFeatures)?;
|
||||||
|
|
||||||
acked_protocol_features.bits()
|
acked_protocol_features
|
||||||
} else {
|
} else {
|
||||||
0
|
VhostUserProtocolFeatures::empty()
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok((acked_features, acked_protocol_features))
|
if avail_protocol_features.contains(VhostUserProtocolFeatures::REPLY_ACK)
|
||||||
|
&& acked_protocol_features.contains(VhostUserProtocolFeatures::REPLY_ACK)
|
||||||
|
{
|
||||||
|
vu.set_hdr_flags(VhostUserHeaderFlag::NEED_REPLY);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok((acked_features, acked_protocol_features.bits()))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
@@ -230,6 +236,10 @@ pub fn reinitialize_vhost_user<S: VhostUserMasterReqHandler>(
|
|||||||
{
|
{
|
||||||
vu.set_protocol_features(acked_protocol_features)
|
vu.set_protocol_features(acked_protocol_features)
|
||||||
.map_err(Error::VhostUserSetProtocolFeatures)?;
|
.map_err(Error::VhostUserSetProtocolFeatures)?;
|
||||||
|
|
||||||
|
if acked_protocol_features.contains(VhostUserProtocolFeatures::REPLY_ACK) {
|
||||||
|
vu.set_hdr_flags(VhostUserHeaderFlag::NEED_REPLY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user