From: Alyssa Ross <hi@alyssa.is>
To: devel@spectrum-os.org
Subject: [RFC PATCH 2/4] vhost_rs: vhost_user: Add missing protocol features
Date: Wed, 12 May 2021 17:08:10 +0000 [thread overview]
Message-ID: <20210512170812.192540-3-hi@alyssa.is> (raw)
In-Reply-To: <20210512170812.192540-1-hi@alyssa.is>
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.
---
devices/src/virtio/vhost_user/net.rs | 10 +++++++---
vhost_rs/src/vhost_user/message.rs | 11 +++++++++++
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 4d222d22..f2a3d79c 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 834397f4..b3ed27a5 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;
+
}
}
--
2.31.0
next prev parent reply other threads:[~2021-05-13 0:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-12 17:08 [RFC PATCH crosvm 0/4] Implement vhost-user-net Alyssa Ross
2021-05-12 17:08 ` [RFC PATCH 1/4] devices: port vhost-user-net from cloud-hypervisor Alyssa Ross
2021-05-12 17:08 ` Alyssa Ross [this message]
2021-05-12 17:08 ` [RFC PATCH 3/4] devices: vhost-user: Vring should be enabled after initialization Alyssa Ross
2021-05-12 17:08 ` [RFC PATCH 4/4] crosvm: use vhost-user-net instead of virtio-net Alyssa Ross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210512170812.192540-3-hi@alyssa.is \
--to=hi@alyssa.is \
--cc=devel@spectrum-os.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://spectrum-os.org/git/crosvm
https://spectrum-os.org/git/doc
https://spectrum-os.org/git/mktuntap
https://spectrum-os.org/git/nixpkgs
https://spectrum-os.org/git/spectrum
https://spectrum-os.org/git/ucspi-vsock
https://spectrum-os.org/git/www
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).