summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2020-08-11 11:36:47 +0000
committerAlyssa Ross <hi@alyssa.is>2021-05-11 12:19:51 +0000
commit0f21b0549f00c57557f0702cdde4ac95c87fe57f (patch)
tree35dbfe4681e50cabb35e3090d3f67a3466c06ac5
parentfe5750a3854c98635755cd9d0ceb05de896c0e67 (diff)
downloadcrosvm-0f21b0549f00c57557f0702cdde4ac95c87fe57f.tar
crosvm-0f21b0549f00c57557f0702cdde4ac95c87fe57f.tar.gz
crosvm-0f21b0549f00c57557f0702cdde4ac95c87fe57f.tar.bz2
crosvm-0f21b0549f00c57557f0702cdde4ac95c87fe57f.tar.lz
crosvm-0f21b0549f00c57557f0702cdde4ac95c87fe57f.tar.xz
crosvm-0f21b0549f00c57557f0702cdde4ac95c87fe57f.tar.zst
crosvm-0f21b0549f00c57557f0702cdde4ac95c87fe57f.zip
vhost_rs: vhost_user: Add missing protocol features
Based on cloud-hypervisor/vhost
c3a835b55dc56aa0de04a9c0695368a6403e8e93.

> vhost_user: Add missing protocol features
>
> The spec recently introduced some new protocol features, which we need
> to be listed if we don't want to run into any issue when getting the
> list of supported features from the backend.
-rw-r--r--devices/src/virtio/vhost_user/net.rs10
-rw-r--r--vhost_rs/src/vhost_user/message.rs11
2 files changed, 18 insertions, 3 deletions
diff --git a/devices/src/virtio/vhost_user/net.rs b/devices/src/virtio/vhost_user/net.rs
index 4d222d2..f2a3d79 100644
--- a/devices/src/virtio/vhost_user/net.rs
+++ b/devices/src/virtio/vhost_user/net.rs
@@ -20,8 +20,8 @@ use super::handler::*;
 use super::vu_common_ctrl::*;
 use super::{Error, Result};
 use crate::{pci::MsixConfig, virtio::Interrupt};
-use vhost_rs::vhost_user::message::VhostUserVirtioFeatures;
-use vhost_rs::vhost_user::{Master, VhostUserMaster};
+use vhost_rs::vhost_user::message::{VhostUserProtocolFeatures, VhostUserVirtioFeatures};
+use vhost_rs::vhost_user::{Master, VhostUserMaster, VhostUserMasterReqHandler};
 use vhost_rs::VhostBackend;
 use virtio_bindings::virtio_net;
 use virtio_bindings::virtio_ring;
@@ -78,9 +78,13 @@ impl<'a> Net {
         let mut acked_features = 0;
         if backend_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);
         }
diff --git a/vhost_rs/src/vhost_user/message.rs b/vhost_rs/src/vhost_user/message.rs
index 834397f..b3ed27a 100644
--- a/vhost_rs/src/vhost_user/message.rs
+++ b/vhost_rs/src/vhost_user/message.rs
@@ -346,6 +346,17 @@ bitflags! {
         const SLAVE_SEND_FD = 0x0000_0400;
         /// Allow the slave to register a host notifier.
         const HOST_NOTIFIER = 0x0000_0800;
+        /// Support inflight shmfd.
+        const INFLIGHT_SHMFD = 0x0000_1000;
+        /// Support resetting the device.
+        const RESET_DEVICE = 0x0000_2000;
+        /// Support inband notifications.
+        const INBAND_NOTIFICATIONS = 0x0000_4000;
+        /// Support configuring memory slots.
+        const CONFIGURE_MEM_SLOTS = 0x0000_8000;
+        /// Support reporting status.
+        const STATUS = 0x0001_0000;
+
     }
 }