mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 11:22:26 +00:00
vm-virtio: Add set_protocol_features in vhost-user-net
While implement vhost-user-net backend with Tap interface, it keeps failed to enable the tx vring, since there is a checking in slave_req_handler.rs to require acked_protocol_features to be setup as a pre-requirement, which is filled by set_protocol_features call. Add this call in vhost-user-net device implementation to address the issue. Signed-off-by: Cathy Zhang <cathy.zhang@intel.com>
This commit is contained in:
parent
9ff42060e0
commit
d724511a91
@ -19,7 +19,7 @@ use super::super::{ActivateError, ActivateResult, Queue, VirtioDevice, VirtioDev
|
|||||||
use super::handler::*;
|
use super::handler::*;
|
||||||
use super::vu_common_ctrl::*;
|
use super::vu_common_ctrl::*;
|
||||||
use super::{Error, Result};
|
use super::{Error, Result};
|
||||||
use vhost_rs::vhost_user::message::VhostUserVirtioFeatures;
|
use vhost_rs::vhost_user::message::{VhostUserProtocolFeatures, VhostUserVirtioFeatures};
|
||||||
use vhost_rs::vhost_user::{Master, VhostUserMaster, VhostUserMasterReqHandler};
|
use vhost_rs::vhost_user::{Master, VhostUserMaster, VhostUserMasterReqHandler};
|
||||||
use vhost_rs::VhostBackend;
|
use vhost_rs::VhostBackend;
|
||||||
use virtio_bindings::bindings::virtio_net;
|
use virtio_bindings::bindings::virtio_net;
|
||||||
@ -82,9 +82,13 @@ impl Net {
|
|||||||
let mut acked_features = 0;
|
let mut acked_features = 0;
|
||||||
if avail_features & VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits() != 0 {
|
if avail_features & VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits() != 0 {
|
||||||
acked_features |= VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits();
|
acked_features |= VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits();
|
||||||
vhost_user_net
|
let mut protocol_features = vhost_user_net
|
||||||
.get_protocol_features()
|
.get_protocol_features()
|
||||||
.map_err(Error::VhostUserGetProtocolFeatures)?;
|
.map_err(Error::VhostUserGetProtocolFeatures)?;
|
||||||
|
protocol_features &= VhostUserProtocolFeatures::MQ;
|
||||||
|
vhost_user_net
|
||||||
|
.set_protocol_features(protocol_features)
|
||||||
|
.map_err(Error::VhostUserSetProtocolFeatures)?;
|
||||||
} else {
|
} else {
|
||||||
return Err(Error::VhostUserProtocolNotSupport);
|
return Err(Error::VhostUserProtocolNotSupport);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user