From d724511a9122930860f6f423bff59ad7790e3801 Mon Sep 17 00:00:00 2001 From: Cathy Zhang Date: Tue, 24 Sep 2019 07:39:41 +0800 Subject: [PATCH] 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 --- vm-virtio/src/vhost_user/net.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vm-virtio/src/vhost_user/net.rs b/vm-virtio/src/vhost_user/net.rs index 53143a344..9fc77ba3d 100644 --- a/vm-virtio/src/vhost_user/net.rs +++ b/vm-virtio/src/vhost_user/net.rs @@ -19,7 +19,7 @@ use super::super::{ActivateError, ActivateResult, Queue, VirtioDevice, VirtioDev use super::handler::*; use super::vu_common_ctrl::*; 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::VhostBackend; use virtio_bindings::bindings::virtio_net; @@ -82,9 +82,13 @@ impl Net { let mut acked_features = 0; if avail_features & VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits() != 0 { acked_features |= VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits(); - vhost_user_net + let mut protocol_features = vhost_user_net .get_protocol_features() .map_err(Error::VhostUserGetProtocolFeatures)?; + protocol_features &= VhostUserProtocolFeatures::MQ; + vhost_user_net + .set_protocol_features(protocol_features) + .map_err(Error::VhostUserSetProtocolFeatures)?; } else { return Err(Error::VhostUserProtocolNotSupport); }