From patchwork Fri Jan 12 14:56:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 859999 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 3zJ5Z74mgPz9t3G for ; Sat, 13 Jan 2018 02:02:07 +1100 (AEDT) Received: from localhost ([::1]:46280 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ea0qL-0002uS-NZ for incoming@patchwork.ozlabs.org; Fri, 12 Jan 2018 10:02:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44386) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ea0o3-0001Mg-CU for qemu-devel@nongnu.org; Fri, 12 Jan 2018 09:59:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ea0nz-0002ls-Hm for qemu-devel@nongnu.org; Fri, 12 Jan 2018 09:59:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38608) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ea0nz-0002l0-BX for qemu-devel@nongnu.org; Fri, 12 Jan 2018 09:59:39 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 51AE1C0517A6; Fri, 12 Jan 2018 14:59:38 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C6F54C8; Fri, 12 Jan 2018 14:58:56 +0000 (UTC) From: Maxime Coquelin To: qemu-devel@nongnu.org Date: Fri, 12 Jan 2018 15:56:57 +0100 Message-Id: <20180112145658.17121-4-maxime.coquelin@redhat.com> In-Reply-To: <20180112145658.17121-1-maxime.coquelin@redhat.com> References: <20180112145658.17121-1-maxime.coquelin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 12 Jan 2018 14:59:38 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 3/4] vhost-net: add vhost_net_set_queue_num helper X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mst@redhat.com, Maxime Coquelin , zhengxiang9@huawei.com, mlureau@redhat.com, pbonzini@redhat.com, lersek@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This patch adds a new help to notify the backend with the number of queue pairs setup by the guest driver. Signed-off-by: Maxime Coquelin --- hw/net/vhost_net.c | 17 +++++++++++++++++ include/net/vhost_net.h | 1 + 2 files changed, 18 insertions(+) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index e037db63a3..d60e237a34 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -124,6 +124,18 @@ uint64_t vhost_net_get_max_queues(VHostNetState *net) return net->dev.max_queues; } +int vhost_net_set_queue_num(NetClientState *nc, uint64_t queues) +{ + VHostNetState *net = get_vhost_net(nc); + const VhostOps *vhost_ops = net->dev.vhost_ops; + + if (vhost_ops->vhost_set_queue_num) { + return vhost_ops->vhost_set_queue_num(&net->dev, queues); + } + + return 0; +} + uint64_t vhost_net_get_acked_features(VHostNetState *net) { return net->dev.acked_features; @@ -456,6 +468,11 @@ uint64_t vhost_net_get_max_queues(VHostNetState *net) return 1; } +int vhost_net_set_queue_num(NetClientState *nc, uint64_t queues) +{ + return 0; +} + struct vhost_net *vhost_net_init(VhostNetOptions *options) { error_report("vhost-net support is not compiled in"); diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h index afc1499eb9..39e639d014 100644 --- a/include/net/vhost_net.h +++ b/include/net/vhost_net.h @@ -15,6 +15,7 @@ typedef struct VhostNetOptions { } VhostNetOptions; uint64_t vhost_net_get_max_queues(VHostNetState *net); +int vhost_net_set_queue_num(NetClientState *nc, uint64_t queues); struct vhost_net *vhost_net_init(VhostNetOptions *options); int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, int total_queues);