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: 10161233 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A7BF0605BD for ; Fri, 12 Jan 2018 15:03:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7CE75288ED for ; Fri, 12 Jan 2018 15:03:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4EC462894E; Fri, 12 Jan 2018 15:03:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2336628A82 for ; Fri, 12 Jan 2018 15:02:51 +0000 (UTC) Received: from localhost ([::1]:46376 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ea0r4-0004U2-C9 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 12 Jan 2018 10:02:50 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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);