Received: from eggs.gnu.org ([2001:4830:134:3::10]:54285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKu9a-0002ks-FO for qemu-devel@nongnu.org; Tue, 04 Mar 2014 13:33:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WKu9U-0007XX-Aq for qemu-devel@nongnu.org; Tue, 04 Mar 2014 13:33:22 -0500 Received: from mail-wg0-f50.google.com ([74.125.82.50]:61770) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKu9U-0007XL-4v for qemu-devel@nongnu.org; Tue, 04 Mar 2014 13:33:16 -0500 Received: by mail-wg0-f50.google.com with SMTP id x13so1212384wgg.33 for ; Tue, 04 Mar 2014 10:33:15 -0800 (PST) From: Antonios Motakis Date: Tue, 4 Mar 2014 19:22:56 +0100 Message-Id: <1393957383-16685-14-git-send-email-a.motakis@virtualopensystems.com> In-Reply-To: <1393957383-16685-1-git-send-email-a.motakis@virtualopensystems.com> References: <1393957383-16685-1-git-send-email-a.motakis@virtualopensystems.com> Subject: [Qemu-devel] [PATCH v9 13/20] Add mandatory_features to vhost_dev List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, snabb-devel@googlegroups.com Cc: mst@redhat.com, n.nikolaev@virtualopensystems.com, Nicholas Bellinger , Paolo Bonzini , lukego@gmail.com, Antonios Motakis , tech@virtualopensystems.com This will be used in a following patch to ensure that a vhost-user client reconnecting to QEMU supports the features that were exposed by the first client that initiated the virtio-net session. Signed-off-by: Antonios Motakis Signed-off-by: Nikolay Nikolaev --- hw/net/vhost_net.c | 10 ++++++++++ include/hw/virtio/vhost.h | 1 + include/net/vhost_net.h | 2 ++ 3 files changed, 13 insertions(+) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 0fb4fa5..38e1e8a 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -80,6 +80,11 @@ void vhost_net_ack_features(struct vhost_net *net, unsigned features) } } +unsigned long long vhost_net_features(VHostNetState *net) +{ + return net->dev.features; +} + static int vhost_net_get_fd(NetClientState *backend) { switch (backend->info->type) { @@ -112,6 +117,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options) net->dev.nvqs = 2; net->dev.vqs = net->vqs; + net->dev.mandatory_features = options->mandatory_features; r = vhost_dev_init(&net->dev, options->opaque, options->force); @@ -347,6 +353,10 @@ unsigned vhost_net_get_features(struct vhost_net *net, unsigned features) void vhost_net_ack_features(struct vhost_net *net, unsigned features) { } +unsigned long long vhost_net_features(struct vhost_net *net) +{ + return 0; +} bool vhost_net_virtqueue_pending(VHostNetState *net, int idx) { diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index 97641b6..0068d40 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -41,6 +41,7 @@ struct vhost_dev { unsigned long long features; unsigned long long acked_features; unsigned long long backend_features; + unsigned long long mandatory_features; bool started; bool log_enabled; vhost_log_chunk_t *log; diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h index 2067ee2..b39bb45 100644 --- a/include/net/vhost_net.h +++ b/include/net/vhost_net.h @@ -10,6 +10,7 @@ typedef struct VhostNetOptions { NetClientState *net_backend; void *opaque; bool force; + unsigned long long mandatory_features; } VhostNetOptions; struct vhost_net *vhost_net_init(VhostNetOptions *options); @@ -22,6 +23,7 @@ void vhost_net_cleanup(VHostNetState *net); unsigned vhost_net_get_features(VHostNetState *net, unsigned features); void vhost_net_ack_features(VHostNetState *net, unsigned features); +unsigned long long vhost_net_features(VHostNetState *net); bool vhost_net_virtqueue_pending(VHostNetState *net, int n); void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev, -- 1.8.3.2