From patchwork Tue May 27 12:06:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Nikolaev X-Patchwork-Id: 352894 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 3978A1400A3 for ; Tue, 27 May 2014 22:10:12 +1000 (EST) Received: from localhost ([::1]:33873 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WpGCn-0004Kl-Rc for incoming@patchwork.ozlabs.org; Tue, 27 May 2014 08:10:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43862) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WpG9H-0007Hu-0K for qemu-devel@nongnu.org; Tue, 27 May 2014 08:06:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WpG9A-00088o-Us for qemu-devel@nongnu.org; Tue, 27 May 2014 08:06:30 -0400 Received: from mail-we0-f178.google.com ([74.125.82.178]:42850) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WpG9A-00088c-HH for qemu-devel@nongnu.org; Tue, 27 May 2014 08:06:24 -0400 Received: by mail-we0-f178.google.com with SMTP id u56so9313326wes.37 for ; Tue, 27 May 2014 05:06:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-type :content-transfer-encoding; bh=lvXkw2ojv2XcSe+/TtCv3D0eUPZmFlM+kAefSAvG8PQ=; b=Owvgnkgvr776Nlt8Y+BaqT6rIWo5iWIGT63wsg9IJBjhMqBMst3qU6QR7XkSIfvSEP ofucjNf+l2XwRZRgTQCmP8RRDHvTY2afgS5Q0nGk9yHsfgbunbmNm263vmMzqX/ZrcXu h/Bm0BruPQBjMaEeA1t2ENW2zy2ALrWrC/E/3WLgMwiK0Xu+upx8oCl0ioTvtPDpUCgl mEA5Fcrk94eWQkwDg7ojts2k7IuPx4VVvxQ9qKTHm2sAMinZVZTnjAKUfND+6sGQ0FMn CNoL8JMUUSfZP3P9MLQB/iXRCO5IAlDv4avh+4wO5YEXWUJbMPnfFvniTFyJfsJWShZg NiVw== X-Gm-Message-State: ALoCoQle0dOrgmqy9LRpmKyJNAu8q5oNPHE2yGZx0d1k6eYnjq7hUIgFID5XlfNx7ImdbnGOkTSL X-Received: by 10.194.236.169 with SMTP id uv9mr39264509wjc.46.1401192383459; Tue, 27 May 2014 05:06:23 -0700 (PDT) Received: from [0.0.14.236] ([82.146.27.14]) by mx.google.com with ESMTPSA id c7sm34561439wjf.19.2014.05.27.05.06.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 May 2014 05:06:22 -0700 (PDT) From: Nikolay Nikolaev To: snabb-devel@googlegroups.com, qemu-devel@nongnu.org Date: Tue, 27 May 2014 15:06:16 +0300 Message-ID: <20140527120611.15172.3427.stgit@3820> In-Reply-To: <20140527120050.15172.94908.stgit@3820> References: <20140527120050.15172.94908.stgit@3820> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.178 Cc: a.motakis@virtualopensystems.com, luke@snabb.co, tech@virtualopensystems.com, n.nikolaev@virtualopensystems.com, mst@redhat.com Subject: [Qemu-devel] [PATCH v10 13/18] vhost-net: vhost-user feature bits support 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 Handle the feature bits negotiation when using vhost-user. Allow the underlying implementation to have a finer control over all the bits except the VIRTIO_NET_F_MAC. Signed-off-by: Nikolay Nikolaev --- hw/net/vhost_net.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 2ec36d3..5f06736 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -54,6 +54,38 @@ static const int kernel_feature_bits[] = { VHOST_INVALID_FEATURE_BIT }; +/* Features supported by others. */ +const int user_feature_bits[] = { + VIRTIO_F_NOTIFY_ON_EMPTY, + VIRTIO_RING_F_INDIRECT_DESC, + VIRTIO_RING_F_EVENT_IDX, + + VIRTIO_F_ANY_LAYOUT, + VIRTIO_NET_F_CSUM, + VIRTIO_NET_F_GUEST_CSUM, + VIRTIO_NET_F_GSO, + VIRTIO_NET_F_GUEST_TSO4, + VIRTIO_NET_F_GUEST_TSO6, + VIRTIO_NET_F_GUEST_ECN, + VIRTIO_NET_F_GUEST_UFO, + VIRTIO_NET_F_HOST_TSO4, + VIRTIO_NET_F_HOST_TSO6, + VIRTIO_NET_F_HOST_ECN, + VIRTIO_NET_F_HOST_UFO, + VIRTIO_NET_F_MRG_RXBUF, + VIRTIO_NET_F_STATUS, + VIRTIO_NET_F_CTRL_VQ, + VIRTIO_NET_F_CTRL_RX, + VIRTIO_NET_F_CTRL_VLAN, + VIRTIO_NET_F_CTRL_RX_EXTRA, + VIRTIO_NET_F_CTRL_MAC_ADDR, + VIRTIO_NET_F_CTRL_GUEST_OFFLOADS, + + VIRTIO_NET_F_MQ, + + VHOST_INVALID_FEATURE_BIT +}; + static const int *vhost_net_get_feature_bits(struct vhost_net *net) { const int *feature_bits = 0; @@ -62,6 +94,9 @@ static const int *vhost_net_get_feature_bits(struct vhost_net *net) case NET_CLIENT_OPTIONS_KIND_TAP: feature_bits = kernel_feature_bits; break; + case NET_CLIENT_OPTIONS_KIND_VHOST_USER: + feature_bits = user_feature_bits; + break; default: error_report("Feature bits not defined for this type: %d", net->nc->info->type);