From nobody Sat Feb 7 06:13:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=linux.alibaba.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1661511609556832.6128745213005; Fri, 26 Aug 2022 04:00:09 -0700 (PDT) Received: from localhost ([::1]:45948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRX4K-0006NC-GW for importer@patchew.org; Fri, 26 Aug 2022 07:00:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58228) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRX0z-0002jM-H9 for qemu-devel@nongnu.org; Fri, 26 Aug 2022 06:56:41 -0400 Received: from out30-57.freemail.mail.aliyun.com ([115.124.30.57]:54124) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRX0r-00016M-Ct for qemu-devel@nongnu.org; Fri, 26 Aug 2022 06:56:38 -0400 Received: from localhost(mailfrom:kangjie.xu@linux.alibaba.com fp:SMTPD_---0VNIqN4C_1661511381) by smtp.aliyun-inc.com; Fri, 26 Aug 2022 18:56:22 +0800 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R171e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018045168; MF=kangjie.xu@linux.alibaba.com; NM=1; PH=DS; RN=6; SR=0; TI=SMTPD_---0VNIqN4C_1661511381; From: Kangjie Xu To: qemu-devel@nongnu.org Cc: mst@redhat.com, jasowang@redhat.com, arei.gonglei@huawei.com, hengqi@linux.alibaba.com, xuanzhuo@linux.alibaba.com Subject: [PATCH 1/8] docs: vhost-user: add VHOST_USER_RESET_VRING message Date: Fri, 26 Aug 2022 18:56:13 +0800 Message-Id: <015b59aa0f722c00187081f0346b86014ba42d8d.1661510725.git.kangjie.xu@linux.alibaba.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=115.124.30.57; envelope-from=kangjie.xu@linux.alibaba.com; helo=out30-57.freemail.mail.aliyun.com X-Spam_score_int: -98 X-Spam_score: -9.9 X-Spam_bar: --------- X-Spam_report: (-9.9 / 5.0 requ) BAYES_00=-1.9, ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, UNPARSEABLE_RELAY=0.001, USER_IN_DEF_SPF_WL=-7.5 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-ZM-MESSAGEID: 1661511610388100001 Content-Type: text/plain; charset="utf-8" To support the reset operation for an individual virtqueue, we introduce a new message VHOST_USER_RESET_VRING. This message is submitted by the front-end to reset an individual virtqueue to initial states in the back-end. The reply is needed to ensure that the reset operation is complete. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- docs/interop/vhost-user.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst index 3f18ab424e..ce7991b9d3 100644 --- a/docs/interop/vhost-user.rst +++ b/docs/interop/vhost-user.rst @@ -1422,6 +1422,16 @@ Front-end message types query the back-end for its device status as defined in the Virtio specification. =20 +``VHOST_USER_RESET_VRING`` + :id: 41 + :equivalent ioctl: N/A + :request payload: vring state description + :reply payload: ``u64`` + + When the feature ``VIRTIO_F_RING_RESET`` feature has been successfully + negotiated, this message is submitted by the front-end to reset an + individual virtqueue to initial states in the back-end. It will ask + for a reply to ensure the virtqueue is successfully reset in the back-en= d. =20 Back-end message types ---------------------- --=20 2.32.0 From nobody Sat Feb 7 06:13:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=linux.alibaba.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 166151205293575.10239503137586; Fri, 26 Aug 2022 04:07:32 -0700 (PDT) Received: from localhost ([::1]:43302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRXBT-0003M4-8j for importer@patchew.org; Fri, 26 Aug 2022 07:07:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRX0z-0002el-HD for qemu-devel@nongnu.org; Fri, 26 Aug 2022 06:56:41 -0400 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]:51830) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRX0q-00016N-R6 for qemu-devel@nongnu.org; Fri, 26 Aug 2022 06:56:35 -0400 Received: from localhost(mailfrom:kangjie.xu@linux.alibaba.com fp:SMTPD_---0VNIuqEt_1661511382) by smtp.aliyun-inc.com; Fri, 26 Aug 2022 18:56:23 +0800 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R211e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018046056; MF=kangjie.xu@linux.alibaba.com; NM=1; PH=DS; RN=6; SR=0; TI=SMTPD_---0VNIuqEt_1661511382; From: Kangjie Xu To: qemu-devel@nongnu.org Cc: mst@redhat.com, jasowang@redhat.com, arei.gonglei@huawei.com, hengqi@linux.alibaba.com, xuanzhuo@linux.alibaba.com Subject: [PATCH 2/8] net: virtio: rename vhost_set_vring_enable to vhost_set_dev_enable Date: Fri, 26 Aug 2022 18:56:14 +0800 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=115.124.30.42; envelope-from=kangjie.xu@linux.alibaba.com; helo=out30-42.freemail.mail.aliyun.com X-Spam_score_int: -98 X-Spam_score: -9.9 X-Spam_bar: --------- X-Spam_report: (-9.9 / 5.0 requ) BAYES_00=-1.9, ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, UNPARSEABLE_RELAY=0.001, USER_IN_DEF_SPF_WL=-7.5 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-ZM-MESSAGEID: 1661512055674100001 Content-Type: text/plain; charset="utf-8" Previously, vhost_set_vring_enable will enable/disable all vrings in a device, which causes ambiguity. So we rename it to vhost_set_dev_enable. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- backends/cryptodev-vhost.c | 12 ++++++------ hw/net/vhost_net-stub.c | 2 +- hw/net/vhost_net.c | 8 ++++---- hw/net/virtio-net.c | 4 ++-- hw/virtio/vhost-user.c | 4 ++-- include/hw/virtio/vhost-backend.h | 6 +++--- include/net/vhost_net.h | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/backends/cryptodev-vhost.c b/backends/cryptodev-vhost.c index bc13e466b4..b83e939760 100644 --- a/backends/cryptodev-vhost.c +++ b/backends/cryptodev-vhost.c @@ -147,9 +147,9 @@ cryptodev_vhost_set_vq_index(CryptoDevBackendVhost *cry= pto, } =20 static int -vhost_set_vring_enable(CryptoDevBackendClient *cc, - CryptoDevBackend *b, - uint16_t queue, int enable) +vhost_set_dev_enable(CryptoDevBackendClient *cc, + CryptoDevBackend *b, + uint16_t queue, int enable) { CryptoDevBackendVhost *crypto =3D cryptodev_get_vhost(cc, b, queue); @@ -162,8 +162,8 @@ vhost_set_vring_enable(CryptoDevBackendClient *cc, } =20 vhost_ops =3D crypto->dev.vhost_ops; - if (vhost_ops->vhost_set_vring_enable) { - return vhost_ops->vhost_set_vring_enable(&crypto->dev, enable); + if (vhost_ops->vhost_set_dev_enable) { + return vhost_ops->vhost_set_dev_enable(&crypto->dev, enable); } =20 return 0; @@ -219,7 +219,7 @@ int cryptodev_vhost_start(VirtIODevice *dev, int total_= queues) =20 if (cc->vring_enable) { /* restore vring enable state */ - r =3D vhost_set_vring_enable(cc, b, i, cc->vring_enable); + r =3D vhost_set_dev_enable(cc, b, i, cc->vring_enable); =20 if (r < 0) { goto err_start; diff --git a/hw/net/vhost_net-stub.c b/hw/net/vhost_net-stub.c index 89d71cfb8e..ac5f217dc1 100644 --- a/hw/net/vhost_net-stub.c +++ b/hw/net/vhost_net-stub.c @@ -92,7 +92,7 @@ VHostNetState *get_vhost_net(NetClientState *nc) return 0; } =20 -int vhost_set_vring_enable(NetClientState *nc, int enable) +int vhost_set_dev_enable(NetClientState *nc, int enable) { return 0; } diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 74c5147d6e..c0c1456172 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -379,7 +379,7 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *= ncs, =20 if (peer->vring_enable) { /* restore vring enable state */ - r =3D vhost_set_vring_enable(peer, peer->vring_enable); + r =3D vhost_set_dev_enable(peer, peer->vring_enable); =20 if (r < 0) { vhost_net_stop_one(get_vhost_net(peer), dev); @@ -491,15 +491,15 @@ VHostNetState *get_vhost_net(NetClientState *nc) return vhost_net; } =20 -int vhost_set_vring_enable(NetClientState *nc, int enable) +int vhost_set_dev_enable(NetClientState *nc, int enable) { VHostNetState *net =3D get_vhost_net(nc); const VhostOps *vhost_ops =3D net->dev.vhost_ops; =20 nc->vring_enable =3D enable; =20 - if (vhost_ops && vhost_ops->vhost_set_vring_enable) { - return vhost_ops->vhost_set_vring_enable(&net->dev, enable); + if (vhost_ops && vhost_ops->vhost_set_dev_enable) { + return vhost_ops->vhost_set_dev_enable(&net->dev, enable); } =20 return 0; diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 7817206596..6ab796b399 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -696,7 +696,7 @@ static int peer_attach(VirtIONet *n, int index) } =20 if (nc->peer->info->type =3D=3D NET_CLIENT_DRIVER_VHOST_USER) { - vhost_set_vring_enable(nc->peer, 1); + vhost_set_dev_enable(nc->peer, 1); } =20 if (nc->peer->info->type !=3D NET_CLIENT_DRIVER_TAP) { @@ -719,7 +719,7 @@ static int peer_detach(VirtIONet *n, int index) } =20 if (nc->peer->info->type =3D=3D NET_CLIENT_DRIVER_VHOST_USER) { - vhost_set_vring_enable(nc->peer, 0); + vhost_set_dev_enable(nc->peer, 0); } =20 if (nc->peer->info->type !=3D NET_CLIENT_DRIVER_TAP) { diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index bd24741be8..794519359b 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1198,7 +1198,7 @@ static int vhost_user_set_vring_base(struct vhost_dev= *dev, return vhost_set_vring(dev, VHOST_USER_SET_VRING_BASE, ring); } =20 -static int vhost_user_set_vring_enable(struct vhost_dev *dev, int enable) +static int vhost_user_set_dev_enable(struct vhost_dev *dev, int enable) { int i; =20 @@ -2627,7 +2627,7 @@ const VhostOps user_ops =3D { .vhost_set_owner =3D vhost_user_set_owner, .vhost_reset_device =3D vhost_user_reset_device, .vhost_get_vq_index =3D vhost_user_get_vq_index, - .vhost_set_vring_enable =3D vhost_user_set_vring_enable, + .vhost_set_dev_enable =3D vhost_user_set_dev_enable, .vhost_requires_shm_log =3D vhost_user_requires_shm_log, .vhost_migration_done =3D vhost_user_migration_done, .vhost_backend_can_merge =3D vhost_user_can_merge, diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-ba= ckend.h index eab46d7f0b..b49432045f 100644 --- a/include/hw/virtio/vhost-backend.h +++ b/include/hw/virtio/vhost-backend.h @@ -81,8 +81,8 @@ typedef int (*vhost_set_backend_cap_op)(struct vhost_dev = *dev); typedef int (*vhost_set_owner_op)(struct vhost_dev *dev); typedef int (*vhost_reset_device_op)(struct vhost_dev *dev); typedef int (*vhost_get_vq_index_op)(struct vhost_dev *dev, int idx); -typedef int (*vhost_set_vring_enable_op)(struct vhost_dev *dev, - int enable); +typedef int (*vhost_set_dev_enable_op)(struct vhost_dev *dev, + int enable); typedef bool (*vhost_requires_shm_log_op)(struct vhost_dev *dev); typedef int (*vhost_migration_done_op)(struct vhost_dev *dev, char *mac_addr); @@ -155,7 +155,7 @@ typedef struct VhostOps { vhost_set_owner_op vhost_set_owner; vhost_reset_device_op vhost_reset_device; vhost_get_vq_index_op vhost_get_vq_index; - vhost_set_vring_enable_op vhost_set_vring_enable; + vhost_set_dev_enable_op vhost_set_dev_enable; vhost_requires_shm_log_op vhost_requires_shm_log; vhost_migration_done_op vhost_migration_done; vhost_backend_can_merge_op vhost_backend_can_merge; diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h index 40b9a40074..22a1fcd39e 100644 --- a/include/net/vhost_net.h +++ b/include/net/vhost_net.h @@ -42,7 +42,7 @@ void vhost_net_virtqueue_mask(VHostNetState *net, VirtIOD= evice *dev, int vhost_net_notify_migration_done(VHostNetState *net, char* mac_addr); VHostNetState *get_vhost_net(NetClientState *nc); =20 -int vhost_set_vring_enable(NetClientState * nc, int enable); +int vhost_set_dev_enable(NetClientState *nc, int enable); =20 uint64_t vhost_net_get_acked_features(VHostNetState *net); =20 --=20 2.32.0 From nobody Sat Feb 7 06:13:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=linux.alibaba.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1661511651811851.2962311881017; Fri, 26 Aug 2022 04:00:51 -0700 (PDT) Received: from localhost ([::1]:57916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRX4z-0006vH-S0 for importer@patchew.org; Fri, 26 Aug 2022 07:00:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRX0y-0002j9-Ux for qemu-devel@nongnu.org; Fri, 26 Aug 2022 06:56:41 -0400 Received: from out30-44.freemail.mail.aliyun.com ([115.124.30.44]:40234) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRX0q-00017k-RC for qemu-devel@nongnu.org; Fri, 26 Aug 2022 06:56:37 -0400 Received: from localhost(mailfrom:kangjie.xu@linux.alibaba.com fp:SMTPD_---0VNIuqFN_1661511383) by smtp.aliyun-inc.com; Fri, 26 Aug 2022 18:56:24 +0800 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R621e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018045170; MF=kangjie.xu@linux.alibaba.com; NM=1; PH=DS; RN=6; SR=0; TI=SMTPD_---0VNIuqFN_1661511383; From: Kangjie Xu To: qemu-devel@nongnu.org Cc: mst@redhat.com, jasowang@redhat.com, arei.gonglei@huawei.com, hengqi@linux.alibaba.com, xuanzhuo@linux.alibaba.com Subject: [PATCH 3/8] vhost-user: add op to enable or disable a single vring Date: Fri, 26 Aug 2022 18:56:15 +0800 Message-Id: <15257adb0733b425d9ab217111174dbf9215499b.1661510725.git.kangjie.xu@linux.alibaba.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=115.124.30.44; envelope-from=kangjie.xu@linux.alibaba.com; helo=out30-44.freemail.mail.aliyun.com X-Spam_score_int: -98 X-Spam_score: -9.9 X-Spam_bar: --------- X-Spam_report: (-9.9 / 5.0 requ) BAYES_00=-1.9, ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, UNPARSEABLE_RELAY=0.001, USER_IN_DEF_SPF_WL=-7.5 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-ZM-MESSAGEID: 1661511652813100001 Content-Type: text/plain; charset="utf-8" There is only vhost_set_dev_enable op in VhostOps. Thus, we introduce the interface vhost_set_vring_enable to set the enable status for a single vring. Resetting a single vq will rely on this interface. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/virtio/vhost-user.c | 25 ++++++++++++++++++------- include/hw/virtio/vhost-backend.h | 3 +++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 794519359b..3f140d5085 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1198,6 +1198,22 @@ static int vhost_user_set_vring_base(struct vhost_de= v *dev, return vhost_set_vring(dev, VHOST_USER_SET_VRING_BASE, ring); } =20 +static int vhost_user_set_vring_enable(struct vhost_dev *dev, + int index, + int enable) +{ + if (index < dev->vq_index || index >=3D dev->vq_index + dev->nvqs) { + return -EINVAL; + } + + struct vhost_vring_state state =3D { + .index =3D index, + .num =3D enable, + }; + + return vhost_set_vring(dev, VHOST_USER_SET_VRING_ENABLE, &state); +} + static int vhost_user_set_dev_enable(struct vhost_dev *dev, int enable) { int i; @@ -1207,13 +1223,7 @@ static int vhost_user_set_dev_enable(struct vhost_de= v *dev, int enable) } =20 for (i =3D 0; i < dev->nvqs; ++i) { - int ret; - struct vhost_vring_state state =3D { - .index =3D dev->vq_index + i, - .num =3D enable, - }; - - ret =3D vhost_set_vring(dev, VHOST_USER_SET_VRING_ENABLE, &state); + int ret =3D vhost_user_set_vring_enable(dev, dev->vq_index + i, en= able); if (ret < 0) { /* * Restoring the previous state is likely infeasible, as well = as @@ -2627,6 +2637,7 @@ const VhostOps user_ops =3D { .vhost_set_owner =3D vhost_user_set_owner, .vhost_reset_device =3D vhost_user_reset_device, .vhost_get_vq_index =3D vhost_user_get_vq_index, + .vhost_set_vring_enable =3D vhost_user_set_vring_enable, .vhost_set_dev_enable =3D vhost_user_set_dev_enable, .vhost_requires_shm_log =3D vhost_user_requires_shm_log, .vhost_migration_done =3D vhost_user_migration_done, diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-ba= ckend.h index b49432045f..dad7191bac 100644 --- a/include/hw/virtio/vhost-backend.h +++ b/include/hw/virtio/vhost-backend.h @@ -81,6 +81,8 @@ typedef int (*vhost_set_backend_cap_op)(struct vhost_dev = *dev); typedef int (*vhost_set_owner_op)(struct vhost_dev *dev); typedef int (*vhost_reset_device_op)(struct vhost_dev *dev); typedef int (*vhost_get_vq_index_op)(struct vhost_dev *dev, int idx); +typedef int (*vhost_set_vring_enable_op)(struct vhost_dev *dev, + int index, int enable); typedef int (*vhost_set_dev_enable_op)(struct vhost_dev *dev, int enable); typedef bool (*vhost_requires_shm_log_op)(struct vhost_dev *dev); @@ -155,6 +157,7 @@ typedef struct VhostOps { vhost_set_owner_op vhost_set_owner; vhost_reset_device_op vhost_reset_device; vhost_get_vq_index_op vhost_get_vq_index; + vhost_set_vring_enable_op vhost_set_vring_enable; vhost_set_dev_enable_op vhost_set_dev_enable; vhost_requires_shm_log_op vhost_requires_shm_log; vhost_migration_done_op vhost_migration_done; --=20 2.32.0 From nobody Sat Feb 7 06:13:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=linux.alibaba.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1661512410518992.2344126639437; Fri, 26 Aug 2022 04:13:30 -0700 (PDT) Received: from localhost ([::1]:38390 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRXHE-0001pk-Dy for importer@patchew.org; Fri, 26 Aug 2022 07:13:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58222) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRX0z-0002jC-Ph for qemu-devel@nongnu.org; Fri, 26 Aug 2022 06:56:41 -0400 Received: from out30-44.freemail.mail.aliyun.com ([115.124.30.44]:49356) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRX0r-00017y-Bn for qemu-devel@nongnu.org; Fri, 26 Aug 2022 06:56:37 -0400 Received: from localhost(mailfrom:kangjie.xu@linux.alibaba.com fp:SMTPD_---0VNJ-pqO_1661511384) by smtp.aliyun-inc.com; Fri, 26 Aug 2022 18:56:25 +0800 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R871e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018046050; MF=kangjie.xu@linux.alibaba.com; NM=1; PH=DS; RN=6; SR=0; TI=SMTPD_---0VNJ-pqO_1661511384; From: Kangjie Xu To: qemu-devel@nongnu.org Cc: mst@redhat.com, jasowang@redhat.com, arei.gonglei@huawei.com, hengqi@linux.alibaba.com, xuanzhuo@linux.alibaba.com Subject: [PATCH 4/8] vhost-user: introduce vhost_reset_vring() interface Date: Fri, 26 Aug 2022 18:56:16 +0800 Message-Id: <3f38dc0f2c7a8cf117265899f9cd51893d85310e.1661510725.git.kangjie.xu@linux.alibaba.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=115.124.30.44; envelope-from=kangjie.xu@linux.alibaba.com; helo=out30-44.freemail.mail.aliyun.com X-Spam_score_int: -98 X-Spam_score: -9.9 X-Spam_bar: --------- X-Spam_report: (-9.9 / 5.0 requ) BAYES_00=-1.9, ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, UNPARSEABLE_RELAY=0.001, USER_IN_DEF_SPF_WL=-7.5 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-ZM-MESSAGEID: 1661512411912100001 Content-Type: text/plain; charset="utf-8" Introduce the interface vhost_reset_vring(). The interface is a wrapper to send a VHOST_USER_RESET_VRING message to the back-end. It will reset an individual vring in the back-end. Meanwhile, it will wait for a reply to ensure the reset has been completed. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/virtio/vhost-user.c | 41 +++++++++++++++++++++++++++++++ include/hw/virtio/vhost-backend.h | 3 +++ 2 files changed, 44 insertions(+) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 3f140d5085..b49076fdc4 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -126,6 +126,7 @@ typedef enum VhostUserRequest { VHOST_USER_GET_MAX_MEM_SLOTS =3D 36, VHOST_USER_ADD_MEM_REG =3D 37, VHOST_USER_REM_MEM_REG =3D 38, + VHOST_USER_RESET_VRING =3D 41, VHOST_USER_MAX } VhostUserRequest; =20 @@ -1508,6 +1509,45 @@ static int vhost_user_get_max_memslots(struct vhost_= dev *dev, return 0; } =20 +static int vhost_user_reset_vring(struct vhost_dev *dev, + struct vhost_vring_state *ring) +{ + int ret; + VhostUserMsg msg =3D { + .hdr.request =3D VHOST_USER_RESET_VRING, + .hdr.flags =3D VHOST_USER_VERSION, + .payload.state =3D *ring, + .hdr.size =3D sizeof(msg.payload.state), + }; + + if (!virtio_has_feature(dev->acked_features, VIRTIO_F_RING_RESET)) { + return -ENOTSUP; + } + + ret =3D vhost_user_write(dev, &msg, NULL, 0); + if (ret < 0) { + return ret; + } + + ret =3D vhost_user_read(dev, &msg); + if (ret < 0) { + return ret; + } + + if (msg.hdr.request !=3D VHOST_USER_RESET_VRING) { + error_report("Received unexpected msg type. Expected %d received %= d", + VHOST_USER_RESET_VRING, msg.hdr.request); + return -EPROTO; + } + + if (msg.hdr.size !=3D sizeof(msg.payload.state)) { + error_report("Received bad msg size."); + return -EPROTO; + } + + return 0; +} + static int vhost_user_reset_device(struct vhost_dev *dev) { VhostUserMsg msg =3D { @@ -2635,6 +2675,7 @@ const VhostOps user_ops =3D { .vhost_set_features =3D vhost_user_set_features, .vhost_get_features =3D vhost_user_get_features, .vhost_set_owner =3D vhost_user_set_owner, + .vhost_reset_vring =3D vhost_user_reset_vring, .vhost_reset_device =3D vhost_user_reset_device, .vhost_get_vq_index =3D vhost_user_get_vq_index, .vhost_set_vring_enable =3D vhost_user_set_vring_enable, diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-ba= ckend.h index dad7191bac..ec65a55a77 100644 --- a/include/hw/virtio/vhost-backend.h +++ b/include/hw/virtio/vhost-backend.h @@ -79,6 +79,8 @@ typedef int (*vhost_get_features_op)(struct vhost_dev *de= v, uint64_t *features); typedef int (*vhost_set_backend_cap_op)(struct vhost_dev *dev); typedef int (*vhost_set_owner_op)(struct vhost_dev *dev); +typedef int (*vhost_reset_vring_op)(struct vhost_dev *dev, + struct vhost_vring_state *ring); typedef int (*vhost_reset_device_op)(struct vhost_dev *dev); typedef int (*vhost_get_vq_index_op)(struct vhost_dev *dev, int idx); typedef int (*vhost_set_vring_enable_op)(struct vhost_dev *dev, @@ -156,6 +158,7 @@ typedef struct VhostOps { vhost_set_backend_cap_op vhost_set_backend_cap; vhost_set_owner_op vhost_set_owner; vhost_reset_device_op vhost_reset_device; + vhost_reset_vring_op vhost_reset_vring; vhost_get_vq_index_op vhost_get_vq_index; vhost_set_vring_enable_op vhost_set_vring_enable; vhost_set_dev_enable_op vhost_set_dev_enable; --=20 2.32.0 From nobody Sat Feb 7 06:13:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=linux.alibaba.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1661512056350967.863093021863; Fri, 26 Aug 2022 04:07:36 -0700 (PDT) Received: from localhost ([::1]:55134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRXBX-0003bt-6F for importer@patchew.org; Fri, 26 Aug 2022 07:07:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRX0z-0002jd-Kf for qemu-devel@nongnu.org; Fri, 26 Aug 2022 06:56:41 -0400 Received: from out30-131.freemail.mail.aliyun.com ([115.124.30.131]:48524) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRX0s-00018A-88 for qemu-devel@nongnu.org; Fri, 26 Aug 2022 06:56:38 -0400 Received: from localhost(mailfrom:kangjie.xu@linux.alibaba.com fp:SMTPD_---0VNJ-pqc_1661511385) by smtp.aliyun-inc.com; Fri, 26 Aug 2022 18:56:26 +0800 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R821e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018046059; MF=kangjie.xu@linux.alibaba.com; NM=1; PH=DS; RN=6; SR=0; TI=SMTPD_---0VNJ-pqc_1661511385; From: Kangjie Xu To: qemu-devel@nongnu.org Cc: mst@redhat.com, jasowang@redhat.com, arei.gonglei@huawei.com, hengqi@linux.alibaba.com, xuanzhuo@linux.alibaba.com Subject: [PATCH 5/8] vhost-net: vhost-user: update vhost_net_virtqueue_reset() Date: Fri, 26 Aug 2022 18:56:17 +0800 Message-Id: <15a36a72635b8ee3d927a83b3109e04433313d89.1661510725.git.kangjie.xu@linux.alibaba.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=115.124.30.131; envelope-from=kangjie.xu@linux.alibaba.com; helo=out30-131.freemail.mail.aliyun.com X-Spam_score_int: -98 X-Spam_score: -9.9 X-Spam_bar: --------- X-Spam_report: (-9.9 / 5.0 requ) BAYES_00=-1.9, ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, UNPARSEABLE_RELAY=0.001, USER_IN_DEF_SPF_WL=-7.5 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-ZM-MESSAGEID: 1661512056778100003 Content-Type: text/plain; charset="utf-8" Update vhost_net_virtqueue_reset() for vhost-user scenario. In order to reuse some functions, we process the idx for vhost-user scenario because vhost_get_vq_index behave differently for vhost-user. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/net/vhost_net.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index c0c1456172..8ad5743f7c 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -522,19 +522,28 @@ void vhost_net_virtqueue_reset(VirtIODevice *vdev, Ne= tClientState *nc, VHostNetState *net =3D get_vhost_net(nc->peer); const VhostOps *vhost_ops =3D net->dev.vhost_ops; struct vhost_vring_file file =3D { .fd =3D -1 }; - int idx; + struct vhost_vring_state state; + int idx, r; =20 /* should only be called after backend is connected */ assert(vhost_ops); =20 idx =3D vhost_ops->vhost_get_vq_index(&net->dev, vq_index); + if (net->nc->info->type =3D=3D NET_CLIENT_DRIVER_VHOST_USER) { + idx -=3D net->dev.vq_index; + } =20 if (net->nc->info->type =3D=3D NET_CLIENT_DRIVER_TAP) { file.index =3D idx; - int r =3D vhost_net_set_backend(&net->dev, &file); + r =3D vhost_net_set_backend(&net->dev, &file); assert(r >=3D 0); } =20 + if (vhost_ops->vhost_reset_vring) { + state.index =3D net->dev.vq_index + idx; + r =3D vhost_ops->vhost_reset_vring(&net->dev, &state); + } + vhost_virtqueue_unmap(&net->dev, vdev, net->dev.vqs + idx, idx); } =20 --=20 2.32.0 From nobody Sat Feb 7 06:13:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=linux.alibaba.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1661512437062570.1096505810096; Fri, 26 Aug 2022 04:13:57 -0700 (PDT) Received: from localhost ([::1]:45576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRXHg-0002lp-1G for importer@patchew.org; Fri, 26 Aug 2022 07:13:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRX0z-0002j8-NZ for qemu-devel@nongnu.org; Fri, 26 Aug 2022 06:56:41 -0400 Received: from out30-57.freemail.mail.aliyun.com ([115.124.30.57]:38930) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRX0q-00018P-RA for qemu-devel@nongnu.org; Fri, 26 Aug 2022 06:56:37 -0400 Received: from localhost(mailfrom:kangjie.xu@linux.alibaba.com fp:SMTPD_---0VNIr6si_1661511386) by smtp.aliyun-inc.com; Fri, 26 Aug 2022 18:56:27 +0800 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R191e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018045170; MF=kangjie.xu@linux.alibaba.com; NM=1; PH=DS; RN=6; SR=0; TI=SMTPD_---0VNIr6si_1661511386; From: Kangjie Xu To: qemu-devel@nongnu.org Cc: mst@redhat.com, jasowang@redhat.com, arei.gonglei@huawei.com, hengqi@linux.alibaba.com, xuanzhuo@linux.alibaba.com Subject: [PATCH 6/8] vhost-net: vhost-user: update vhost_net_virtqueue_restart() Date: Fri, 26 Aug 2022 18:56:18 +0800 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=115.124.30.57; envelope-from=kangjie.xu@linux.alibaba.com; helo=out30-57.freemail.mail.aliyun.com X-Spam_score_int: -98 X-Spam_score: -9.9 X-Spam_bar: --------- X-Spam_report: (-9.9 / 5.0 requ) BAYES_00=-1.9, ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, UNPARSEABLE_RELAY=0.001, USER_IN_DEF_SPF_WL=-7.5 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-ZM-MESSAGEID: 1661512438026100001 Content-Type: text/plain; charset="utf-8" Update vhost_net_virtqueue_restart() for vhost-user scenario. In order to reuse some functions, we process the idx for vhost-user case. It is because vhost_get_vq_index behave differently in vhost-user. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/net/vhost_net.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 8ad5743f7c..13b9c11e68 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -563,6 +563,9 @@ int vhost_net_virtqueue_restart(VirtIODevice *vdev, Net= ClientState *nc, assert(vhost_ops); =20 idx =3D vhost_ops->vhost_get_vq_index(&net->dev, vq_index); + if (net->nc->info->type =3D=3D NET_CLIENT_DRIVER_VHOST_USER) { + idx -=3D net->dev.vq_index; + } =20 r =3D vhost_virtqueue_start(&net->dev, vdev, @@ -572,6 +575,15 @@ int vhost_net_virtqueue_restart(VirtIODevice *vdev, Ne= tClientState *nc, goto err_start; } =20 + if (vhost_ops->vhost_set_vring_enable) { + r =3D vhost_ops->vhost_set_vring_enable(&net->dev, + net->dev.vq_index + idx, + 1); + if (r < 0) { + goto err_start; + } + } + if (net->nc->info->type =3D=3D NET_CLIENT_DRIVER_TAP) { file.index =3D idx; file.fd =3D net->backend; --=20 2.32.0 From nobody Sat Feb 7 06:13:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=linux.alibaba.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1661512159889813.0714826190695; Fri, 26 Aug 2022 04:09:19 -0700 (PDT) Received: from localhost ([::1]:46116 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRXDC-0004bi-Pk for importer@patchew.org; Fri, 26 Aug 2022 07:09:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRX0z-0002jD-HP for qemu-devel@nongnu.org; Fri, 26 Aug 2022 06:56:41 -0400 Received: from out30-132.freemail.mail.aliyun.com ([115.124.30.132]:46855) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRX0r-00018W-Cq for qemu-devel@nongnu.org; Fri, 26 Aug 2022 06:56:37 -0400 Received: from localhost(mailfrom:kangjie.xu@linux.alibaba.com fp:SMTPD_---0VNIovfA_1661511387) by smtp.aliyun-inc.com; Fri, 26 Aug 2022 18:56:28 +0800 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R161e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018046050; MF=kangjie.xu@linux.alibaba.com; NM=1; PH=DS; RN=6; SR=0; TI=SMTPD_---0VNIovfA_1661511387; From: Kangjie Xu To: qemu-devel@nongnu.org Cc: mst@redhat.com, jasowang@redhat.com, arei.gonglei@huawei.com, hengqi@linux.alibaba.com, xuanzhuo@linux.alibaba.com Subject: [PATCH 7/8] virtio-net: vhost-user: update queue_reset and queue_enable Date: Fri, 26 Aug 2022 18:56:19 +0800 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=115.124.30.132; envelope-from=kangjie.xu@linux.alibaba.com; helo=out30-132.freemail.mail.aliyun.com X-Spam_score_int: -98 X-Spam_score: -9.9 X-Spam_bar: --------- X-Spam_report: (-9.9 / 5.0 requ) BAYES_00=-1.9, ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, UNPARSEABLE_RELAY=0.001, USER_IN_DEF_SPF_WL=-7.5 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-ZM-MESSAGEID: 1661512161483100001 Content-Type: text/plain; charset="utf-8" Update virtio_net_queue_reset() and virtio_net_queue_enable() for vhost-user scenario. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/net/virtio-net.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 6ab796b399..19a2132180 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -550,7 +550,8 @@ static void virtio_net_queue_reset(VirtIODevice *vdev, = uint32_t queue_index) } =20 if (get_vhost_net(nc->peer) && - nc->peer->info->type =3D=3D NET_CLIENT_DRIVER_TAP) { + (nc->peer->info->type =3D=3D NET_CLIENT_DRIVER_TAP || + nc->peer->info->type =3D=3D NET_CLIENT_DRIVER_VHOST_USER)) { vhost_net_virtqueue_reset(vdev, nc, queue_index); } =20 @@ -568,7 +569,8 @@ static void virtio_net_queue_enable(VirtIODevice *vdev,= uint32_t queue_index) } =20 if (get_vhost_net(nc->peer) && - nc->peer->info->type =3D=3D NET_CLIENT_DRIVER_TAP) { + (nc->peer->info->type =3D=3D NET_CLIENT_DRIVER_TAP || + nc->peer->info->type =3D=3D NET_CLIENT_DRIVER_VHOST_USER)) { r =3D vhost_net_virtqueue_restart(vdev, nc, queue_index); if (r < 0) { error_report("unable to restart vhost net virtqueue: %d, " --=20 2.32.0 From nobody Sat Feb 7 06:13:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=linux.alibaba.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 166151217209388.82536898385456; Fri, 26 Aug 2022 04:09:32 -0700 (PDT) Received: from localhost ([::1]:55838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRXDO-0004y5-Lo for importer@patchew.org; Fri, 26 Aug 2022 07:09:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58230) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRX0z-0002jO-HE for qemu-devel@nongnu.org; Fri, 26 Aug 2022 06:56:41 -0400 Received: from out199-6.us.a.mail.aliyun.com ([47.90.199.6]:23031) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRX0t-00019U-OJ for qemu-devel@nongnu.org; Fri, 26 Aug 2022 06:56:38 -0400 Received: from localhost(mailfrom:kangjie.xu@linux.alibaba.com fp:SMTPD_---0VNIuqGo_1661511388) by smtp.aliyun-inc.com; Fri, 26 Aug 2022 18:56:29 +0800 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R621e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018046056; MF=kangjie.xu@linux.alibaba.com; NM=1; PH=DS; RN=6; SR=0; TI=SMTPD_---0VNIuqGo_1661511388; From: Kangjie Xu To: qemu-devel@nongnu.org Cc: mst@redhat.com, jasowang@redhat.com, arei.gonglei@huawei.com, hengqi@linux.alibaba.com, xuanzhuo@linux.alibaba.com Subject: [PATCH 8/8] vhost: vhost-user: enable vq reset feature Date: Fri, 26 Aug 2022 18:56:20 +0800 Message-Id: <95197eab1da9b4ac13dbbda4067789fb71cf4471.1661510725.git.kangjie.xu@linux.alibaba.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=47.90.199.6; envelope-from=kangjie.xu@linux.alibaba.com; helo=out199-6.us.a.mail.aliyun.com X-Spam_score_int: -98 X-Spam_score: -9.9 X-Spam_bar: --------- X-Spam_report: (-9.9 / 5.0 requ) BAYES_00=-1.9, ENV_AND_HDR_SPF_MATCH=-0.5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, UNPARSEABLE_RELAY=0.001, USER_IN_DEF_SPF_WL=-7.5 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-ZM-MESSAGEID: 1661512173691100001 Content-Type: text/plain; charset="utf-8" Add virtqueue reset feature for vhost-user. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/net/vhost_net.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 13b9c11e68..745cb4375b 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -74,6 +74,7 @@ static const int user_feature_bits[] =3D { VIRTIO_NET_F_MTU, VIRTIO_F_IOMMU_PLATFORM, VIRTIO_F_RING_PACKED, + VIRTIO_F_RING_RESET, VIRTIO_NET_F_RSS, VIRTIO_NET_F_HASH_REPORT, =20 --=20 2.32.0