From nobody Mon May 13 14:17:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1662477145; cv=none; d=zohomail.com; s=zohoarc; b=gpoQTsWTZzPcB6bMX1Nr5X4teizMA3vJ6mfqtnetTXhe+521rPsJ0HAPhqGrQVHOzRV1X9aDhIrZZizB7niVMAZYyt7VKoDxESk699aYg4ZnjqYaPFrplz9G+yQvXSez9UZRbToe50U/OHbGl08+KwHyJ/0BhcB+ljswmX/YU6A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662477145; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DDWpdsL5OU9Ybva9CnjAjGSBsvyRnTO2bo8Ew4VpQPs=; b=ikB/uMNrO2Fv/2K2oIbqUHFsFsiCFiokqtd7dNlLAuGjx4NxB+X6dflm+ZUHOZPwqOA2oRxSch4wbkh0Fz+mMWZp3xnQkCNnphhoKbl8WlwJzI02I3D+vh/1N2mHxwxBAAoggCbHkxy7bFeeMZYmkxHw0wNSd+pV17UEaJ93Z4c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1662477145372415.46725249778956; Tue, 6 Sep 2022 08:12:25 -0700 (PDT) Received: from localhost ([::1]:49918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVaFT-0001wm-B6 for importer@patchew.org; Tue, 06 Sep 2022 11:12:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVaAr-0004g5-MI for qemu-devel@nongnu.org; Tue, 06 Sep 2022 11:07:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:27997) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVaAo-0002GC-6G for qemu-devel@nongnu.org; Tue, 06 Sep 2022 11:07:35 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-609-bf_b9Cu3OkufuJ_HzoezEw-1; Tue, 06 Sep 2022 11:07:29 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3D48585A58A; Tue, 6 Sep 2022 15:07:28 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.195.176]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6457740D296C; Tue, 6 Sep 2022 15:07:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662476853; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DDWpdsL5OU9Ybva9CnjAjGSBsvyRnTO2bo8Ew4VpQPs=; b=Sqz9KtnJwd7aPGki7/DGleYO5GRuStrqnsi+bgRMFx4AS2ukvfTRs/ID1ucPgpLfeyb4BI cHTFfV+v9DeAhtsCrT3ZUC5dyskgponpW3OguMQtgCcJ0SgY2QTzI7kiTRIawWM69y0/h0 xdkhlbhxoug3ATNZuUKBnnCS701DxRU= X-MC-Unique: bf_b9Cu3OkufuJ_HzoezEw-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Harpreet Singh Anand , Stefano Garzarella , Si-Wei Liu , Jason Wang , Parav Pandit , Liuxiangdong , Laurent Vivier , Zhu Lingshan , Cindy Lu , Eli Cohen , "Michael S. Tsirkin" , Paolo Bonzini , "Gonglei (Arei)" , Cornelia Huck , Gautam Dawar Subject: [PATCH v4 1/6] vdpa: Make VhostVDPAState cvq_cmd_in_buffer control ack type Date: Tue, 6 Sep 2022 17:07:14 +0200 Message-Id: <20220906150719.1134955-2-eperezma@redhat.com> In-Reply-To: <20220906150719.1134955-1-eperezma@redhat.com> References: <20220906150719.1134955-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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=170.10.129.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1662477147589100001 This allows to simplify the code. Rename to status while we're at it. Signed-off-by: Eugenio P=C3=A9rez --- v3: Rename it to status. --- net/vhost-vdpa.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 6ce68fcd3f..535315c1d0 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -35,7 +35,9 @@ typedef struct VhostVDPAState { VHostNetState *vhost_net; =20 /* Control commands shadow buffers */ - void *cvq_cmd_out_buffer, *cvq_cmd_in_buffer; + void *cvq_cmd_out_buffer; + virtio_net_ctrl_ack *status; + bool started; } VhostVDPAState; =20 @@ -158,7 +160,7 @@ static void vhost_vdpa_cleanup(NetClientState *nc) struct vhost_dev *dev =3D &s->vhost_net->dev; =20 qemu_vfree(s->cvq_cmd_out_buffer); - qemu_vfree(s->cvq_cmd_in_buffer); + qemu_vfree(s->status); if (dev->vq_index + dev->nvqs =3D=3D dev->vq_index_end) { g_clear_pointer(&s->vhost_vdpa.iova_tree, vhost_iova_tree_delete); } @@ -310,7 +312,7 @@ static int vhost_vdpa_net_cvq_start(NetClientState *nc) return r; } =20 - r =3D vhost_vdpa_cvq_map_buf(&s->vhost_vdpa, s->cvq_cmd_in_buffer, + r =3D vhost_vdpa_cvq_map_buf(&s->vhost_vdpa, s->status, vhost_vdpa_net_cvq_cmd_page_len(), true); if (unlikely(r < 0)) { vhost_vdpa_cvq_unmap_buf(&s->vhost_vdpa, s->cvq_cmd_out_buffer); @@ -327,7 +329,7 @@ static void vhost_vdpa_net_cvq_stop(NetClientState *nc) =20 if (s->vhost_vdpa.shadow_vqs_enabled) { vhost_vdpa_cvq_unmap_buf(&s->vhost_vdpa, s->cvq_cmd_out_buffer); - vhost_vdpa_cvq_unmap_buf(&s->vhost_vdpa, s->cvq_cmd_in_buffer); + vhost_vdpa_cvq_unmap_buf(&s->vhost_vdpa, s->status); } } =20 @@ -340,7 +342,7 @@ static ssize_t vhost_vdpa_net_cvq_add(VhostVDPAState *s= , size_t out_len, .iov_len =3D out_len, }; const struct iovec in =3D { - .iov_base =3D s->cvq_cmd_in_buffer, + .iov_base =3D s->status, .iov_len =3D sizeof(virtio_net_ctrl_ack), }; VhostShadowVirtqueue *svq =3D g_ptr_array_index(s->vhost_vdpa.shadow_v= qs, 0); @@ -396,7 +398,7 @@ static int vhost_vdpa_net_load(NetClientState *nc) return dev_written; } =20 - return *((virtio_net_ctrl_ack *)s->cvq_cmd_in_buffer) !=3D VIRTIO_= NET_OK; + return *s->status !=3D VIRTIO_NET_OK; } =20 return 0; @@ -491,8 +493,7 @@ static int vhost_vdpa_net_handle_ctrl_avail(VhostShadow= Virtqueue *svq, goto out; } =20 - memcpy(&status, s->cvq_cmd_in_buffer, sizeof(status)); - if (status !=3D VIRTIO_NET_OK) { + if (*s->status !=3D VIRTIO_NET_OK) { return VIRTIO_NET_ERR; } =20 @@ -549,9 +550,9 @@ static NetClientState *net_vhost_vdpa_init(NetClientSta= te *peer, s->cvq_cmd_out_buffer =3D qemu_memalign(qemu_real_host_page_size(), vhost_vdpa_net_cvq_cmd_page_le= n()); memset(s->cvq_cmd_out_buffer, 0, vhost_vdpa_net_cvq_cmd_page_len()= ); - s->cvq_cmd_in_buffer =3D qemu_memalign(qemu_real_host_page_size(), - vhost_vdpa_net_cvq_cmd_page_le= n()); - memset(s->cvq_cmd_in_buffer, 0, vhost_vdpa_net_cvq_cmd_page_len()); + s->status =3D qemu_memalign(qemu_real_host_page_size(), + vhost_vdpa_net_cvq_cmd_page_len()); + memset(s->status, 0, vhost_vdpa_net_cvq_cmd_page_len()); =20 s->vhost_vdpa.shadow_vq_ops =3D &vhost_vdpa_net_svq_ops; s->vhost_vdpa.shadow_vq_ops_opaque =3D s; --=20 2.31.1 From nobody Mon May 13 14:17:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1662476990; cv=none; d=zohomail.com; s=zohoarc; b=fqPOxhndDuXVT8WTXv+OOKtrPj8wbMlxvRjoWrjJFFgM7DNeU+eLcCgeDUkdkgR1eRkWZG0CooEkRKgt9cq0gDzEV/JXAIfgUqLo+xjk9rP9nUyBrjv6sZyKg1iYbKnfYRgEkeeyOthr93gwzdyQB/YM5TW53TiUsbOhXF6djDE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662476990; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=947XT4qKSHAoxN6t9wuk7kVV5CX4QvokhO/FmmUQDNI=; b=ns0g2FcOwTUrrtrAYZ8ktJDqGA7Ns+ACzZSmkk/CFqxBTTi+Ll8fm2DiKz5JSRHb13MyQ47+CXfV+3H/TWMGU0uMQEb3WDvmAt9+Bcu9NYFi0p6KVQ8ZJ2uPS4ARZXxo80un8JnJO948spJLAqvgTXv/7333B/swh4riHv0+r4E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1662476990777645.2612000546434; Tue, 6 Sep 2022 08:09:50 -0700 (PDT) Received: from localhost ([::1]:39124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVaCz-0006oi-EP for importer@patchew.org; Tue, 06 Sep 2022 11:09:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37790) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVaAq-0004gJ-Fx for qemu-devel@nongnu.org; Tue, 06 Sep 2022 11:07:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:54636) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVaAo-0002GE-6U for qemu-devel@nongnu.org; Tue, 06 Sep 2022 11:07:36 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-433-G_6ilHrxMoed4Ee-UZ6eNQ-1; Tue, 06 Sep 2022 11:07:32 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 66C748007CE; Tue, 6 Sep 2022 15:07:31 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.195.176]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9827C40D296C; Tue, 6 Sep 2022 15:07:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662476853; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=947XT4qKSHAoxN6t9wuk7kVV5CX4QvokhO/FmmUQDNI=; b=LShCGX8Ek5Txv13EeBy59IDE0mHhSOqJVjptLqtPUzNlXRjYf8Z/90c7ieZ4dZkHFo5pH0 lswNvwQJg8fPy25K4s6Adc579py2sMqNlmlFEINTXCBnhoUTsczu48PGLeWHnnBdZf4n91 z1xL7Wgo2kdhWAof/Kf+SITzduyXSFk= X-MC-Unique: G_6ilHrxMoed4Ee-UZ6eNQ-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Harpreet Singh Anand , Stefano Garzarella , Si-Wei Liu , Jason Wang , Parav Pandit , Liuxiangdong , Laurent Vivier , Zhu Lingshan , Cindy Lu , Eli Cohen , "Michael S. Tsirkin" , Paolo Bonzini , "Gonglei (Arei)" , Cornelia Huck , Gautam Dawar Subject: [PATCH v4 2/6] vdpa: extract vhost_vdpa_net_load_mac from vhost_vdpa_net_load Date: Tue, 6 Sep 2022 17:07:15 +0200 Message-Id: <20220906150719.1134955-3-eperezma@redhat.com> In-Reply-To: <20220906150719.1134955-1-eperezma@redhat.com> References: <20220906150719.1134955-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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=170.10.129.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1662476992637100001 Since there may be many commands we need to issue to load the NIC state, let's split them in individual functions Signed-off-by: Eugenio P=C3=A9rez -- v2: Add vhost_vdpa_net_load_cmd helper v3: Move ctrl header definition to vhost_vdpa_net_load_cmd --- net/vhost-vdpa.c | 62 +++++++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 535315c1d0..e799e744cd 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -365,12 +365,47 @@ static ssize_t vhost_vdpa_net_cvq_add(VhostVDPAState = *s, size_t out_len, return vhost_svq_poll(svq); } =20 +static ssize_t vhost_vdpa_net_load_cmd(VhostVDPAState *s, uint8_t class, + uint8_t cmd, const void *data, + size_t data_size) +{ + const struct virtio_net_ctrl_hdr ctrl =3D { + .class =3D class, + .cmd =3D cmd, + }; + + assert(data_size < vhost_vdpa_net_cvq_cmd_page_len() - sizeof(ctrl)); + + memcpy(s->cvq_cmd_out_buffer, &ctrl, sizeof(ctrl)); + memcpy(s->cvq_cmd_out_buffer + sizeof(ctrl), data, data_size); + + return vhost_vdpa_net_cvq_add(s, sizeof(ctrl) + data_size, + sizeof(virtio_net_ctrl_ack)); +} + +static int vhost_vdpa_net_load_mac(VhostVDPAState *s, const VirtIONet *n) +{ + uint64_t features =3D n->parent_obj.guest_features; + if (features & BIT_ULL(VIRTIO_NET_F_CTRL_MAC_ADDR)) { + ssize_t dev_written =3D vhost_vdpa_net_load_cmd(s, VIRTIO_NET_CTRL= _MAC, + VIRTIO_NET_CTRL_MAC_ADDR= _SET, + n->mac, sizeof(n->mac)); + if (unlikely(dev_written < 0)) { + return dev_written; + } + + return *s->status !=3D VIRTIO_NET_OK; + } + + return 0; +} + static int vhost_vdpa_net_load(NetClientState *nc) { VhostVDPAState *s =3D DO_UPCAST(VhostVDPAState, nc, nc); - const struct vhost_vdpa *v =3D &s->vhost_vdpa; + struct vhost_vdpa *v =3D &s->vhost_vdpa; const VirtIONet *n; - uint64_t features; + int r; =20 assert(nc->info->type =3D=3D NET_CLIENT_DRIVER_VHOST_VDPA); =20 @@ -379,26 +414,9 @@ static int vhost_vdpa_net_load(NetClientState *nc) } =20 n =3D VIRTIO_NET(v->dev->vdev); - features =3D n->parent_obj.guest_features; - if (features & BIT_ULL(VIRTIO_NET_F_CTRL_MAC_ADDR)) { - const struct virtio_net_ctrl_hdr ctrl =3D { - .class =3D VIRTIO_NET_CTRL_MAC, - .cmd =3D VIRTIO_NET_CTRL_MAC_ADDR_SET, - }; - char *cursor =3D s->cvq_cmd_out_buffer; - ssize_t dev_written; - - memcpy(cursor, &ctrl, sizeof(ctrl)); - cursor +=3D sizeof(ctrl); - memcpy(cursor, n->mac, sizeof(n->mac)); - - dev_written =3D vhost_vdpa_net_cvq_add(s, sizeof(ctrl) + sizeof(n-= >mac), - sizeof(virtio_net_ctrl_ack)); - if (unlikely(dev_written < 0)) { - return dev_written; - } - - return *s->status !=3D VIRTIO_NET_OK; + r =3D vhost_vdpa_net_load_mac(s, n); + if (unlikely(r < 0)) { + return r; } =20 return 0; --=20 2.31.1 From nobody Mon May 13 14:17:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1662477413; cv=none; d=zohomail.com; s=zohoarc; b=fa4RmyxzbGRdXg6kLe3tx4iOhRSjHErLp2x/L/CxAIQoD+wYtmMZ5DlMcZZsyTuHMb8JPw4cEQM43dB2HPBAZxVs/adkyUT04wtvIopjIY1HCY9zBLL6WUqaYihBXeltJyJ+H7CdVh31DQTzbG8XSYpcqyuioSDi2NRsmOuyavA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662477413; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1bseDS+wOobKWNpI52Cr9QlPEX2vQfsnWTkOXDELPEw=; b=czuQ640MVDXliONQBEO2NQ71FmJI/GGWqWUXRG9uTV4cvw6I2y9x6Y6fdq7D+OFPkX3zT/KA0gbS7zPoMv2A3bKIHcMzeMv+Vw/eOfVyF2s8ZcR5R9NTa3Z9nVTKci2wnXFE6AWbca3+TC4vk3dRpShPB1uNbTa8MGpcb9COErA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1662477413481686.79910820649; Tue, 6 Sep 2022 08:16:53 -0700 (PDT) Received: from localhost ([::1]:52880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVaJo-0007oM-FV for importer@patchew.org; Tue, 06 Sep 2022 11:16:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37796) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVaAz-0004tH-5f for qemu-devel@nongnu.org; Tue, 06 Sep 2022 11:07:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:32788) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVaAt-0002IL-NZ for qemu-devel@nongnu.org; Tue, 06 Sep 2022 11:07:44 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-564-vdB46o3OMHSQY6kin3r9hA-1; Tue, 06 Sep 2022 11:07:35 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8AD313C01D86; Tue, 6 Sep 2022 15:07:34 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.195.176]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC47040D296C; Tue, 6 Sep 2022 15:07:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662476859; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1bseDS+wOobKWNpI52Cr9QlPEX2vQfsnWTkOXDELPEw=; b=B4Zb+7pLivnlVgzn7bK3KxP4Ii3UNPDaiTOY8oqxQolCsOdoqWoi6KQI7OEUgwoYe6OG4S X1rLdildy8GKS/DdHKowIMzDZBa4vwUuT6HhdmYcShr8cjvfF/LgfSmWs4EvIopk7yOKWR zSb/UBM7VWrov4NdrZkHU352QaVHGzY= X-MC-Unique: vdB46o3OMHSQY6kin3r9hA-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Harpreet Singh Anand , Stefano Garzarella , Si-Wei Liu , Jason Wang , Parav Pandit , Liuxiangdong , Laurent Vivier , Zhu Lingshan , Cindy Lu , Eli Cohen , "Michael S. Tsirkin" , Paolo Bonzini , "Gonglei (Arei)" , Cornelia Huck , Gautam Dawar Subject: [PATCH v4 3/6] vdpa: Add vhost_vdpa_net_load_mq Date: Tue, 6 Sep 2022 17:07:16 +0200 Message-Id: <20220906150719.1134955-4-eperezma@redhat.com> In-Reply-To: <20220906150719.1134955-1-eperezma@redhat.com> References: <20220906150719.1134955-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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=170.10.133.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1662477414590100001 Same way as with the MAC, restore the expected number of queues at device's start. Signed-off-by: Eugenio P=C3=A9rez --- net/vhost-vdpa.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index e799e744cd..3950e4f25d 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -400,6 +400,28 @@ static int vhost_vdpa_net_load_mac(VhostVDPAState *s, = const VirtIONet *n) return 0; } =20 +static int vhost_vdpa_net_load_mq(VhostVDPAState *s, + const VirtIONet *n) +{ + struct virtio_net_ctrl_mq mq; + uint64_t features =3D n->parent_obj.guest_features; + ssize_t dev_written; + + if (!(features & BIT_ULL(VIRTIO_NET_F_MQ))) { + return 0; + } + + mq.virtqueue_pairs =3D cpu_to_le16(n->curr_queue_pairs); + dev_written =3D vhost_vdpa_net_load_cmd(s, VIRTIO_NET_CTRL_MQ, + VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET,= &mq, + sizeof(mq)); + if (unlikely(dev_written < 0)) { + return dev_written; + } + + return *s->status !=3D VIRTIO_NET_OK; +} + static int vhost_vdpa_net_load(NetClientState *nc) { VhostVDPAState *s =3D DO_UPCAST(VhostVDPAState, nc, nc); @@ -418,6 +440,10 @@ static int vhost_vdpa_net_load(NetClientState *nc) if (unlikely(r < 0)) { return r; } + r =3D vhost_vdpa_net_load_mq(s, n); + if (unlikely(r)) { + return r; + } =20 return 0; } --=20 2.31.1 From nobody Mon May 13 14:17:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1662477261; cv=none; d=zohomail.com; s=zohoarc; b=QBXBW350HRIj950Hmw47H2gcZpWKRlrrzs/A9dei3wE7hrrdMXK+CZS9n4TwEP8W1IfEndd6LzFOSHmIHJFKA4ysbcQJ4EuvxbEG9wgrIn7hnDVY5n7XcRiP+vuAt7UXvDYpQrvjq5+FUdvtHN8DP+6T6biAVye2DXBEAgF218k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662477261; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ssNtCJXhbLSC8S4I9ANaar9bo1LEaJNUSGxPwa2T81w=; b=PKi1nFkH2ZRvmtRgmvhvHjHv9PWA2AAmr15I5WQvSI4sLz37U2YyqQQCNxsGXFh5VHys2SeMBNss3n0/oqrxvqYKVsxpThalj0283Ew+2mXqdLpf8f7pgrc3OxhrgorjPk5StJvsAX52QjRd81TGABqaHmKCLfqA7TL9TyyowDQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1662477261082902.5267750923009; Tue, 6 Sep 2022 08:14:21 -0700 (PDT) Received: from localhost ([::1]:53452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVaHL-0004jA-Ql for importer@patchew.org; Tue, 06 Sep 2022 11:14:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37794) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVaAx-0004sW-MF for qemu-devel@nongnu.org; Tue, 06 Sep 2022 11:07:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:20781) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVaAw-0002IU-90 for qemu-devel@nongnu.org; Tue, 06 Sep 2022 11:07:43 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-574-2RkxXbX1MZia2e1q8fvOzA-1; Tue, 06 Sep 2022 11:07:38 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B0AAC1818341; Tue, 6 Sep 2022 15:07:37 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.195.176]) by smtp.corp.redhat.com (Postfix) with ESMTP id D05D440D296C; Tue, 6 Sep 2022 15:07:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662476861; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ssNtCJXhbLSC8S4I9ANaar9bo1LEaJNUSGxPwa2T81w=; b=Rd/5LXsrYAdQ1J5j27qJbhtZEG81hvUzE/ivlxXe5ZewErtkwDhZjpwmoru4GpD9zy/qI9 146A2l9/P8qfpgBSkWHrV6jKScivIfoCcJCN5YSsZHjT+9D7kT60S+s7ao/OWP/mGBukRL XlEtX+EWgwjmIHlRDe2b9bWCh81O4Ig= X-MC-Unique: 2RkxXbX1MZia2e1q8fvOzA-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Harpreet Singh Anand , Stefano Garzarella , Si-Wei Liu , Jason Wang , Parav Pandit , Liuxiangdong , Laurent Vivier , Zhu Lingshan , Cindy Lu , Eli Cohen , "Michael S. Tsirkin" , Paolo Bonzini , "Gonglei (Arei)" , Cornelia Huck , Gautam Dawar Subject: [PATCH v4 4/6] vdpa: validate MQ CVQ commands Date: Tue, 6 Sep 2022 17:07:17 +0200 Message-Id: <20220906150719.1134955-5-eperezma@redhat.com> In-Reply-To: <20220906150719.1134955-1-eperezma@redhat.com> References: <20220906150719.1134955-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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=170.10.133.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1662477261689100001 So we are sure we can update the device model properly before sending to the device. Signed-off-by: Eugenio P=C3=A9rez --- net/vhost-vdpa.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 3950e4f25d..c6cbe2fb5c 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -486,6 +486,15 @@ static bool vhost_vdpa_net_cvq_validate_cmd(const void= *out_buf, size_t len) __func__, ctrl.cmd); }; break; + case VIRTIO_NET_CTRL_MQ: + switch (ctrl.cmd) { + case VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET: + return true; + default: + qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid mq cmd %u\n", + __func__, ctrl.cmd); + }; + break; default: qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid control class %u\n", __func__, ctrl.class); --=20 2.31.1 From nobody Mon May 13 14:17:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1662477676; cv=none; d=zohomail.com; s=zohoarc; b=jhjQMtW6cf/ocCaaMsdCoADZMg1MrKzk2IV1Cv/eEDHIboPKXa7AUE8JYOZqFVHAcFP/Gpxwt1KUT1ThghIoxlFfchv/AFmfvosDvfnK+OAk+2Y+ADfrY9icwVd3jOn+1b5Y/DyXRWcSVlzA8oSw8+iGe6+z1GPNU1MeHZRAQH0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662477676; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=98v2Byg4txCUkMYx+EdCgVj34yNLWuRwxgR2JKC9H/I=; b=eqWpb+o0RUFWYL43zCHxuN7FZIPdg/3qvSc7u98pu3kst/bqZ6uq0wceZGMyD1C6AI2PIvtsTHhelxp4EAg/cTTtpPfZjreqkGbBz+Dih4CWFEVI7lORFzekW5kIhkb292xpT9kqzHQWu/h00qFbRjmQI+lEIP5Z3A5GFS+9Fw0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1662477676237852.2996816286842; Tue, 6 Sep 2022 08:21:16 -0700 (PDT) Received: from localhost ([::1]:48790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVaO3-0003Jp-7J for importer@patchew.org; Tue, 06 Sep 2022 11:21:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVaB0-0004yS-Ht for qemu-devel@nongnu.org; Tue, 06 Sep 2022 11:07:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:41321) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVaAy-0002Ij-TT for qemu-devel@nongnu.org; Tue, 06 Sep 2022 11:07:46 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-519-ZZFcPEb5MEKa8fgeOwj4gA-1; Tue, 06 Sep 2022 11:07:41 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EA4C4101A56C; Tue, 6 Sep 2022 15:07:40 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.195.176]) by smtp.corp.redhat.com (Postfix) with ESMTP id 017D140D296C; Tue, 6 Sep 2022 15:07:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662476863; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=98v2Byg4txCUkMYx+EdCgVj34yNLWuRwxgR2JKC9H/I=; b=X/8Q83p/ZJPhWYr8lU8CRi+6bsJzaC+t2KeaBXqMyjbecHGzrUx1ziToHWBKf0+7EWJXAy UqbWEBBedRgBci8W+DZcBruHdgbvGbUWEbPOHoOYGTCxofB9lSzpVnSfnurE2vjz78B9CV yq97aPA4JKxSqAOUtwozcMuC6JhmNQg= X-MC-Unique: ZZFcPEb5MEKa8fgeOwj4gA-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Harpreet Singh Anand , Stefano Garzarella , Si-Wei Liu , Jason Wang , Parav Pandit , Liuxiangdong , Laurent Vivier , Zhu Lingshan , Cindy Lu , Eli Cohen , "Michael S. Tsirkin" , Paolo Bonzini , "Gonglei (Arei)" , Cornelia Huck , Gautam Dawar Subject: [PATCH v4 5/6] virtio-net: Update virtio-net curr_queue_pairs in vdpa backends Date: Tue, 6 Sep 2022 17:07:18 +0200 Message-Id: <20220906150719.1134955-6-eperezma@redhat.com> In-Reply-To: <20220906150719.1134955-1-eperezma@redhat.com> References: <20220906150719.1134955-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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=170.10.129.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1662477676865100001 It was returned as error before. Instead of it, simply update the corresponding field so qemu can send it in the migration data. Signed-off-by: Eugenio P=C3=A9rez Acked-by: Si-Wei Liu --- hw/net/virtio-net.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index dd0d056fde..63a8332cd0 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1412,19 +1412,14 @@ static int virtio_net_handle_mq(VirtIONet *n, uint8= _t cmd, return VIRTIO_NET_ERR; } =20 - /* Avoid changing the number of queue_pairs for vdpa device in - * userspace handler. A future fix is needed to handle the mq - * change in userspace handler with vhost-vdpa. Let's disable - * the mq handling from userspace for now and only allow get - * done through the kernel. Ripples may be seen when falling - * back to userspace, but without doing it qemu process would - * crash on a recursive entry to virtio_net_set_status(). - */ + n->curr_queue_pairs =3D queue_pairs; if (nc->peer && nc->peer->info->type =3D=3D NET_CLIENT_DRIVER_VHOST_VD= PA) { - return VIRTIO_NET_ERR; + /* + * Avoid updating the backend for a vdpa device: We're only intere= sted + * in updating the device model queues. + */ + return VIRTIO_NET_OK; } - - n->curr_queue_pairs =3D queue_pairs; /* stop the backend before changing the number of queue_pairs to avoid= handling a * disabled queue */ virtio_net_set_status(vdev, vdev->status); --=20 2.31.1 From nobody Mon May 13 14:17:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1662477636; cv=none; d=zohomail.com; s=zohoarc; b=AwPCPiQc/oVx8IYqBqfLTx/6cIIzGxnEudwsDSMW5IheLlrhexvJ5O53Nkaxj42QCa+YVdMjEMPOrmRyHnIGf8vQAjA7495BjWRH5xI6cDIXMFjUchdWzCWQLtl7ezH8HpFMJtKY9xkOLdFNrXMihmQRiofSczYZ8gfwsCtT7MQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662477636; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0EiC9qsa92qPMgZCmBJglnW5RyionM1aBUgNqKB3yf0=; b=RA7jyzgz9KYxsHsnxboj4A4JH4HjLmw0lvLkjkkmBpmC41tAShaV376eQiPsaXdnSwEE3hpMSiPAIftbu1QdWkus9p0yia2FSDdoxU64s6GqGzmk+/+99JppKbe6onqSXzQL1fXnMp5iQSZJCw4/n5MfeMGU7fA9KXoTDtbbZVU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1662477636009603.6337289779027; Tue, 6 Sep 2022 08:20:36 -0700 (PDT) Received: from localhost ([::1]:57738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVaNO-0001ox-V8 for importer@patchew.org; Tue, 06 Sep 2022 11:20:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVaB2-00054l-JA for qemu-devel@nongnu.org; Tue, 06 Sep 2022 11:07:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:36844) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVaB1-0002J7-0d for qemu-devel@nongnu.org; Tue, 06 Sep 2022 11:07:48 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-571-nZA8FE5sNjGeoKqZMqzY_A-1; Tue, 06 Sep 2022 11:07:44 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0A54F3C025C8; Tue, 6 Sep 2022 15:07:44 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.195.176]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3BD4E40D296D; Tue, 6 Sep 2022 15:07:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662476866; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0EiC9qsa92qPMgZCmBJglnW5RyionM1aBUgNqKB3yf0=; b=ZRbDiNUSJO35Hyw4z0qdrPzJal56wmGcJQxMDL8wVLdHZGUxqTxUEFlxS2dpa7pbVW+dx8 cSVd56wQoGdEYXPaam5iH7QR2uF7jL8E6oOodz/r9kIHfcMlc558mrOMuiE7f0cQD5Q8va tblcLD3jyWv6O67AUzLncswGcg1Hf7k= X-MC-Unique: nZA8FE5sNjGeoKqZMqzY_A-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Harpreet Singh Anand , Stefano Garzarella , Si-Wei Liu , Jason Wang , Parav Pandit , Liuxiangdong , Laurent Vivier , Zhu Lingshan , Cindy Lu , Eli Cohen , "Michael S. Tsirkin" , Paolo Bonzini , "Gonglei (Arei)" , Cornelia Huck , Gautam Dawar Subject: [PATCH v4 6/6] vdpa: Allow MQ feature in SVQ Date: Tue, 6 Sep 2022 17:07:19 +0200 Message-Id: <20220906150719.1134955-7-eperezma@redhat.com> In-Reply-To: <20220906150719.1134955-1-eperezma@redhat.com> References: <20220906150719.1134955-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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=170.10.129.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1662477638984100001 Finally enable SVQ with MQ feature. Signed-off-by: Eugenio P=C3=A9rez --- net/vhost-vdpa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index c6cbe2fb5c..4bc3fd01a8 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -94,6 +94,7 @@ static const uint64_t vdpa_svq_device_features =3D BIT_ULL(VIRTIO_NET_F_MRG_RXBUF) | BIT_ULL(VIRTIO_NET_F_STATUS) | BIT_ULL(VIRTIO_NET_F_CTRL_VQ) | + BIT_ULL(VIRTIO_NET_F_MQ) | BIT_ULL(VIRTIO_F_ANY_LAYOUT) | BIT_ULL(VIRTIO_NET_F_CTRL_MAC_ADDR) | BIT_ULL(VIRTIO_NET_F_RSC_EXT) | --=20 2.31.1