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:
@@ -14,7 +14,7 @@ use std::thread::sleep;
|
||||
use std::time::{Duration, Instant};
|
||||
use std::vec::Vec;
|
||||
use vhost::vhost_user::message::{
|
||||
VhostUserInflight, VhostUserProtocolFeatures, VhostUserVirtioFeatures,
|
||||
VhostUserHeaderFlag, VhostUserInflight, VhostUserProtocolFeatures, VhostUserVirtioFeatures,
|
||||
};
|
||||
use vhost::vhost_user::{Master, MasterReqHandler, VhostUserMaster, VhostUserMasterReqHandler};
|
||||
use vhost::{VhostBackend, VhostUserMemoryRegionInfo, VringConfigData};
|
||||
@@ -95,12 +95,18 @@ pub fn negotiate_features_vhost_user(
|
||||
vu.set_protocol_features(acked_protocol_features)
|
||||
.map_err(Error::VhostUserSetProtocolFeatures)?;
|
||||
|
||||
acked_protocol_features.bits()
|
||||
acked_protocol_features
|
||||
} 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)]
|
||||
@@ -230,6 +236,10 @@ pub fn reinitialize_vhost_user<S: VhostUserMasterReqHandler>(
|
||||
{
|
||||
vu.set_protocol_features(acked_protocol_features)
|
||||
.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