From: Marcel Apfelbaum <marcel@redhat.com>
To: qemu-devel@nongnu.org
Cc: jasowang@redhat.com, famz@redhat.com, mst@redhat.com
Subject: [Qemu-devel] [PATCH] vhost-user: sync backend features
Date: Wed, 29 Jul 2015 20:11:58 +0300 [thread overview]
Message-ID: <1438189918-2087-1-git-send-email-marcel@redhat.com> (raw)
Complete vhost-user negotiation by syncing the features
supported by the backend.
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
---
To be used on top of:
[PATCH 0/4] vhost-user: protocol updates
https://lists.gnu.org/archive/html/qemu-devel/2015-07/msg03842.html
Currently the vhost-user supported features are not evaluated.
The way I see it, and please correct me, the best way to do
this is to:
1. get the backend features on vhost init
2. Instead of simply copying them during features ack,
check that that all backend features are supported by current QEMU
3. All other code should remain the same.
Thanks,
Marcel
hw/net/vhost_net.c | 3 ++-
hw/virtio/vhost-user.c | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index c864237..1ea5866 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -118,7 +118,8 @@ uint64_t vhost_net_get_features(struct vhost_net *net, uint64_t features)
void vhost_net_ack_features(struct vhost_net *net, uint64_t features)
{
- net->dev.acked_features = net->dev.backend_features;
+ vhost_ack_features(&net->dev, vhost_net_get_feature_bits(net),
+ net->dev.backend_features);
vhost_ack_features(&net->dev, vhost_net_get_feature_bits(net), features);
}
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index c4428a1..077457b 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -358,9 +358,9 @@ static int vhost_user_init(struct vhost_dev *dev, void *opaque)
return err;
}
- if (__virtio_has_feature(msg.u64, VHOST_USER_F_PROTOCOL_FEATURES)) {
- dev->backend_features |= 1ULL << VHOST_USER_F_PROTOCOL_FEATURES;
+ dev->backend_features = msg.u64;
+ if (__virtio_has_feature(msg.u64, VHOST_USER_F_PROTOCOL_FEATURES)) {
msg.request = VHOST_USER_GET_PROTOCOL_FEATURES;
msg.flags = VHOST_USER_VERSION;
msg.size = 0;
--
2.1.0
next reply other threads:[~2015-07-29 17:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-29 17:11 Marcel Apfelbaum [this message]
2015-07-29 17:20 ` [Qemu-devel] [PATCH] vhost-user: sync backend features Michael S. Tsirkin
2015-07-29 17:43 ` Marcel Apfelbaum
2015-07-29 18:05 ` Michael S. Tsirkin
2015-07-29 18:11 ` Marcel Apfelbaum
2015-07-29 18:15 ` Michael S. Tsirkin
2015-07-29 18:20 ` Marcel Apfelbaum
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=1438189918-2087-1-git-send-email-marcel@redhat.com \
--to=marcel@redhat.com \
--cc=famz@redhat.com \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.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.
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).