From patchwork Thu Feb 13 12:03:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonios Motakis X-Patchwork-Id: 319995 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DACB82C007C for ; Thu, 13 Feb 2014 23:10:56 +1100 (EST) Received: from localhost ([::1]:45776 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDv82-0001RS-K0 for incoming@patchwork.ozlabs.org; Thu, 13 Feb 2014 07:10:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDv1h-0007uy-R8 for qemu-devel@nongnu.org; Thu, 13 Feb 2014 07:04:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WDv1b-00017u-RG for qemu-devel@nongnu.org; Thu, 13 Feb 2014 07:04:21 -0500 Received: from mail-wi0-f178.google.com ([209.85.212.178]:55511) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDv1b-00017k-Kr for qemu-devel@nongnu.org; Thu, 13 Feb 2014 07:04:15 -0500 Received: by mail-wi0-f178.google.com with SMTP id cc10so8428136wib.5 for ; Thu, 13 Feb 2014 04:04:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=asFarknvj5ZKnIGz4JwboUpEpGrK9OiytsUpOBUHgLU=; b=gZfq5820IBfU/Vr9jbT62KHvwkLGd26OLuUuhrYgGRa8mADEhBYcbTNCRPB7St/Uh0 4HTUDejDCz0eUsWjOV/18ed82QOgfaQQg9VPbVCZRRagEwfU5E4FHea2+xS4gAWFwF0+ aF9MKHkjCV2NMl505NZzZlpcs3nPj8URbkVPM3SF9FcSHwT2PZVH0cFCRiMyJpQEOOYu 3zNVek4+I60EEABHdWFgkwknDXfdXSEBd09dyAv3B5Kb7+FkwuG7Awfk8Cw/cqQAODt0 v5soiPnWjPfJ5RGFY9j8IV11/mpdxA+ZIUhZsWY+7cmbJq7e2/t4oFRkjb4xw9U3cevB chNg== X-Gm-Message-State: ALoCoQkXJA9/YjOmz5NoldVHASIZvM0EAwRXeoblc38ExdjgRZxRJCYOtUsqIPO2ybpVVaEfMOc/ X-Received: by 10.194.178.135 with SMTP id cy7mr975956wjc.21.1392293054927; Thu, 13 Feb 2014 04:04:14 -0800 (PST) Received: from localhost.localdomain (home.tvelocity.eu. [82.67.68.96]) by mx.google.com with ESMTPSA id bj3sm4039419wjb.14.2014.02.13.04.04.13 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Feb 2014 04:04:14 -0800 (PST) From: Antonios Motakis To: qemu-devel@nongnu.org, snabb-devel@googlegroups.com Date: Thu, 13 Feb 2014 13:03:21 +0100 Message-Id: <1392293009-13812-11-git-send-email-a.motakis@virtualopensystems.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1392293009-13812-1-git-send-email-a.motakis@virtualopensystems.com> References: <1392293009-13812-1-git-send-email-a.motakis@virtualopensystems.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.212.178 Cc: mst@redhat.com, n.nikolaev@virtualopensystems.com, Nicholas Bellinger , Paolo Bonzini , lukego@gmail.com, Antonios Motakis , tech@virtualopensystems.com Subject: [Qemu-devel] [PATCH v8 10/17] Add mandatory_features to vhost_dev X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 13b4734..4490173 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) { @@ -113,6 +118,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); @@ -348,6 +354,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,