From nobody Mon Feb 9 17:25:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630792370818909.0571194001604; Sat, 4 Sep 2021 14:52:50 -0700 (PDT) Received: from localhost ([::1]:36992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMdaj-0003vK-Sg for importer@patchew.org; Sat, 04 Sep 2021 17:52:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35572) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMdLv-000789-Lz for qemu-devel@nongnu.org; Sat, 04 Sep 2021 17:37:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50803) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMdLt-0001gs-2j for qemu-devel@nongnu.org; Sat, 04 Sep 2021 17:37:31 -0400 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-39-AqVAdjyQMVmtF9B24AH8iA-1; Sat, 04 Sep 2021 17:37:27 -0400 Received: by mail-ed1-f71.google.com with SMTP id o11-20020a056402038b00b003c9e6fd522bso1356607edv.19 for ; Sat, 04 Sep 2021 14:37:27 -0700 (PDT) Received: from redhat.com ([2.55.150.176]) by smtp.gmail.com with ESMTPSA id q6sm1521890ejm.106.2021.09.04.14.37.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Sep 2021 14:37:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630791448; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DfR+OS/tguqo24I2t3557CNvlcUjLWWgLMMyFe3f2DA=; b=OUjLVgNcv4I6oGzFljMm5UL2gbeOKqHZXURhyUaJGhb9qTpPYHeStj/HM4NH8W5uFrHfcN unrPvNpWHRR5dWzKhXYOpNtD1cjcCn7LY/ksRveWXgmHBKU/Q5DMiPzfsTbChS6F9YgaPs Zl85hxCbWne6Aj3U6olJjvMdCje/FtM= X-MC-Unique: AqVAdjyQMVmtF9B24AH8iA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=DfR+OS/tguqo24I2t3557CNvlcUjLWWgLMMyFe3f2DA=; b=FaLDX5Y5i04vivGN3ouVFl6YA7Eh6aA5Pq66RhiJNz6SDCoOeceWi0kMDs7BWPP47G bwcQ0rS9lbKWpRpG4oSCmaXguKIhpP7VPAB4RP/ZSHFWSUOrYYbLOlyNceZ1Yk/i/OmB DSq8Rgb36NjnqK0S22aEMFgJHD919e5FdrxsQxJNdz/toVXB4YzzbVbEcBkWu/eOmhcc fVmP54rnEk8BoVWu4IoL/mQS39TYcNm51lSqW8uV3ueW2+2CTjSEk4VKbhHlpANQkYIa m54Ft6eXVDl6GrVS0oSZtt32T2Zy0ZW37LHkubRRHhrI1mbiaKL8OIIbNEDD8G3R7jdt uhHw== X-Gm-Message-State: AOAM533TOCyjXlTL8wA1E5dPulX83xNBYshguJCyYvFWY8MYDoi5eMmH foaq6mfE02XBl56tjqh1NlEcU+nFW0nF/YP3sYY6cCW1sLwjSJwOyRd5EQvDpgfXRrbm1e9rhpQ Xika2PpTeqBt2Uksp2qnFs3t/fOO0fzwugJY+dC8hHWH/Xkd1HdkTY4dDi2Gy X-Received: by 2002:a17:906:680a:: with SMTP id k10mr5978908ejr.298.1630791445742; Sat, 04 Sep 2021 14:37:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwessc/3wByNsrSQ7BTVzg6qkW58e43/dxwiVDVhMwVQEPG4y7+A/1EdDGIzjKqtSZNRN+L9g== X-Received: by 2002:a17:906:680a:: with SMTP id k10mr5978889ejr.298.1630791445524; Sat, 04 Sep 2021 14:37:25 -0700 (PDT) Date: Sat, 4 Sep 2021 17:37:22 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 29/35] vhost_net: do not assume nvqs is always 2 Message-ID: <20210904213506.486886-30-mst@redhat.com> References: <20210904213506.486886-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210904213506.486886-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang , Eli Cohen , Stefano Garzarella Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1630792371578100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jason Wang This patch switches to initialize dev.nvqs from the VhostNetOptions instead of assuming it was 2. This is useful for implementing control virtqueue support which will be a single vhost_net structure with a single cvq. Note that nvqs is still set to 2 for all users and this patch does not change functionality. Reviewed-by: Stefano Garzarella Reviewed-by: Eli Cohen Signed-off-by: Jason Wang Message-Id: <20210903091031.47303-6-jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/net/vhost_net.h | 1 + hw/net/vhost_net.c | 2 +- net/tap.c | 1 + net/vhost-user.c | 1 + net/vhost-vdpa.c | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h index 172b0051d8..fba40cf695 100644 --- a/include/net/vhost_net.h +++ b/include/net/vhost_net.h @@ -14,6 +14,7 @@ typedef struct VhostNetOptions { VhostBackendType backend_type; NetClientState *net_backend; uint32_t busyloop_timeout; + unsigned int nvqs; void *opaque; } VhostNetOptions; =20 diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 6ed0c39836..386ec2eaa2 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -165,9 +165,9 @@ struct vhost_net *vhost_net_init(VhostNetOptions *optio= ns) goto fail; } net->nc =3D options->net_backend; + net->dev.nvqs =3D options->nvqs; =20 net->dev.max_queues =3D 1; - net->dev.nvqs =3D 2; net->dev.vqs =3D net->vqs; =20 if (backend_kernel) { diff --git a/net/tap.c b/net/tap.c index f5686bbf77..f716be3e3f 100644 --- a/net/tap.c +++ b/net/tap.c @@ -749,6 +749,7 @@ static void net_init_tap_one(const NetdevTapOptions *ta= p, NetClientState *peer, qemu_set_nonblock(vhostfd); } options.opaque =3D (void *)(uintptr_t)vhostfd; + options.nvqs =3D 2; =20 s->vhost_net =3D vhost_net_init(&options); if (!s->vhost_net) { diff --git a/net/vhost-user.c b/net/vhost-user.c index 6adfcd623a..4a939124d2 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -85,6 +85,7 @@ static int vhost_user_start(int queues, NetClientState *n= cs[], options.net_backend =3D ncs[i]; options.opaque =3D be; options.busyloop_timeout =3D 0; + options.nvqs =3D 2; net =3D vhost_net_init(&options); if (!net) { error_report("failed to init vhost_net for queue %d", i); diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 72829884d7..395117debd 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -104,6 +104,7 @@ static int vhost_vdpa_add(NetClientState *ncs, void *be) options.net_backend =3D ncs; options.opaque =3D be; options.busyloop_timeout =3D 0; + options.nvqs =3D 2; =20 net =3D vhost_net_init(&options); if (!net) { --=20 MST