From nobody Mon Feb 9 19:37:35 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 ARC-Seal: i=1; a=rsa-sha256; t=1615459004; cv=none; d=zohomail.com; s=zohoarc; b=OKNsWoWO8pCpQ7k5EgtTJpbVf9Oko1hG6OWL3XrdYDZgQh1DOMJeT3wiZehvVlG303QeNuBRNM/Cdj1ub7bXBs4mAWxddilD4eDmUrLSlazg+EWqEC2TQdIfhCbU7FPCf3OH0+lOn6/+CBU9ZENRB1siKS9tEMfGpCX35T+yjAI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615459004; 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=hnxlQsHD1/OtTtkYAeS1gwTtMqtRpxPUf0HOhg5GQCA=; b=aYMt1QEjwWYaOMR8ozBdIaVzEwMvua/8tpMBwZAtCCUlw9BNrTWkvx0WGs1HHSsOTRA0HbCMLISGqdfmv3LiPbg9GtvOsW/V3WK5Pel7VqTs+MgN4lY8FW6OT+0Q69W2l8aZ0tlmJnJ2MqAKzcLfo5ziPlg90S1wNdd+sybCUUU= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615459004531686.7150338604736; Thu, 11 Mar 2021 02:36:44 -0800 (PST) Received: from localhost ([::1]:48342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKIgN-000887-8e for importer@patchew.org; Thu, 11 Mar 2021 05:36:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46870) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKIcw-0002Yt-00 for qemu-devel@nongnu.org; Thu, 11 Mar 2021 05:33:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45443) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lKIct-0005fp-O2 for qemu-devel@nongnu.org; Thu, 11 Mar 2021 05:33:09 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-231-Rt323LmYPCSUFmj2DfVWhg-1; Thu, 11 Mar 2021 05:33:05 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6800419200C0 for ; Thu, 11 Mar 2021 10:33:04 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0277029400; Thu, 11 Mar 2021 10:33:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615458787; 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=hnxlQsHD1/OtTtkYAeS1gwTtMqtRpxPUf0HOhg5GQCA=; b=F8N7AgNyDO8cp90lD+EMhknu/Et9CC2ftkvTP+KguuQIH4CSToomzS8nxY8EQXs0IFeC3E OTZ4fDcVgiJQECc9yDdGsOOocZIKmjcI1LYhIX712oUSPBDSBnRrnLn2fkXjMh+QuGZJ6s X8jc9TK6M/JdfZ/waP1IGjeAzS/PIzY= X-MC-Unique: Rt323LmYPCSUFmj2DfVWhg-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 5/7] vhost-user: rename message names from "SLAVE" to "BACKEND" Date: Thu, 11 Mar 2021 05:32:48 -0500 Message-Id: <20210311103250.532191-6-pbonzini@redhat.com> In-Reply-To: <20210311103250.532191-1-pbonzini@redhat.com> References: <20210311103250.532191-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.243, 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_H3=0.001, RCVD_IN_MSPIKE_WL=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: marcandre.lureau@redhat.com, stefanha@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Follow the terminology that is used in the specification. Signed-off-by: Paolo Bonzini --- hw/virtio/vhost-user.c | 96 +++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 2fdd5daf74..dff420fce9 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -37,7 +37,7 @@ =20 #define VHOST_MEMORY_BASELINE_NREGIONS 8 #define VHOST_USER_F_PROTOCOL_FEATURES 30 -#define VHOST_USER_SLAVE_MAX_FDS 8 +#define VHOST_USER_BACKEND_MAX_FDS 8 =20 /* * Set maximum number of RAM slots supported to @@ -68,12 +68,12 @@ enum VhostUserProtocolFeature { VHOST_USER_PROTOCOL_F_RARP =3D 2, VHOST_USER_PROTOCOL_F_REPLY_ACK =3D 3, VHOST_USER_PROTOCOL_F_NET_MTU =3D 4, - VHOST_USER_PROTOCOL_F_SLAVE_REQ =3D 5, + VHOST_USER_PROTOCOL_F_BACKEND_REQ =3D 5, VHOST_USER_PROTOCOL_F_CROSS_ENDIAN =3D 6, VHOST_USER_PROTOCOL_F_CRYPTO_SESSION =3D 7, VHOST_USER_PROTOCOL_F_PAGEFAULT =3D 8, VHOST_USER_PROTOCOL_F_CONFIG =3D 9, - VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD =3D 10, + VHOST_USER_PROTOCOL_F_BACKEND_SEND_FD =3D 10, VHOST_USER_PROTOCOL_F_HOST_NOTIFIER =3D 11, VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD =3D 12, VHOST_USER_PROTOCOL_F_RESET_DEVICE =3D 13, @@ -106,7 +106,7 @@ typedef enum VhostUserRequest { VHOST_USER_SET_VRING_ENABLE =3D 18, VHOST_USER_SEND_RARP =3D 19, VHOST_USER_NET_SET_MTU =3D 20, - VHOST_USER_SET_SLAVE_REQ_FD =3D 21, + VHOST_USER_SET_BACKEND_REQ_FD =3D 21, VHOST_USER_IOTLB_MSG =3D 22, VHOST_USER_SET_VRING_ENDIAN =3D 23, VHOST_USER_GET_CONFIG =3D 24, @@ -128,11 +128,11 @@ typedef enum VhostUserRequest { } VhostUserRequest; =20 typedef enum VhostUserSlaveRequest { - VHOST_USER_SLAVE_NONE =3D 0, - VHOST_USER_SLAVE_IOTLB_MSG =3D 1, - VHOST_USER_SLAVE_CONFIG_CHANGE_MSG =3D 2, - VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG =3D 3, - VHOST_USER_SLAVE_MAX + VHOST_USER_BACKEND_NONE =3D 0, + VHOST_USER_BACKEND_IOTLB_MSG =3D 1, + VHOST_USER_BACKEND_CONFIG_CHANGE_MSG =3D 2, + VHOST_USER_BACKEND_VRING_HOST_NOTIFIER_MSG =3D 3, + VHOST_USER_BACKEND_MAX } VhostUserSlaveRequest; =20 typedef struct VhostUserMemoryRegion { @@ -237,7 +237,7 @@ struct vhost_user { struct vhost_dev *dev; /* Shared between vhost devs of the same virtio device */ VhostUserState *user; - int slave_fd; + int backend_fd; NotifierWithReturn postcopy_notifier; struct PostCopyFD postcopy_fd; uint64_t postcopy_client_bases[VHOST_USER_MAX_RAM_SLOTS]; @@ -1317,7 +1317,7 @@ static int vhost_user_reset_device(struct vhost_dev *= dev) return 0; } =20 -static int vhost_user_slave_handle_config_change(struct vhost_dev *dev) +static int vhost_user_backend_handle_config_change(struct vhost_dev *dev) { int ret =3D -1; =20 @@ -1332,9 +1332,9 @@ static int vhost_user_slave_handle_config_change(stru= ct vhost_dev *dev) return ret; } =20 -static int vhost_user_slave_handle_vring_host_notifier(struct vhost_dev *d= ev, - VhostUserVringArea = *area, - int fd) +static int vhost_user_backend_handle_vring_host_notifier(struct vhost_dev = *dev, + VhostUserVringAre= a *area, + int fd) { int queue_idx =3D area->u64 & VHOST_USER_VRING_IDX_MASK; size_t page_size =3D qemu_real_host_page_size; @@ -1392,7 +1392,7 @@ static int vhost_user_slave_handle_vring_host_notifie= r(struct vhost_dev *dev, return 0; } =20 -static void slave_read(void *opaque) +static void backend_read(void *opaque) { struct vhost_dev *dev =3D opaque; struct vhost_user *u =3D dev->opaque; @@ -1401,7 +1401,7 @@ static void slave_read(void *opaque) int size, ret =3D 0; struct iovec iov; struct msghdr msgh; - int fd[VHOST_USER_SLAVE_MAX_FDS]; + int fd[VHOST_USER_BACKEND_MAX_FDS]; char control[CMSG_SPACE(sizeof(fd))]; struct cmsghdr *cmsg; int i, fdsize =3D 0; @@ -1419,11 +1419,11 @@ static void slave_read(void *opaque) iov.iov_len =3D VHOST_USER_HDR_SIZE; =20 do { - size =3D recvmsg(u->slave_fd, &msgh, 0); + size =3D recvmsg(u->backend_fd, &msgh, 0); } while (size < 0 && (errno =3D=3D EINTR || errno =3D=3D EAGAIN)); =20 if (size !=3D VHOST_USER_HDR_SIZE) { - error_report("Failed to read from slave."); + error_report("Failed to read from backend."); goto err; } =20 @@ -1451,24 +1451,24 @@ static void slave_read(void *opaque) =20 /* Read payload */ do { - size =3D read(u->slave_fd, &payload, hdr.size); + size =3D read(u->backend_fd, &payload, hdr.size); } while (size < 0 && (errno =3D=3D EINTR || errno =3D=3D EAGAIN)); =20 if (size !=3D hdr.size) { - error_report("Failed to read payload from slave."); + error_report("Failed to read payload from backend."); goto err; } =20 switch (hdr.request) { - case VHOST_USER_SLAVE_IOTLB_MSG: + case VHOST_USER_BACKEND_IOTLB_MSG: ret =3D vhost_backend_handle_iotlb_msg(dev, &payload.iotlb); break; - case VHOST_USER_SLAVE_CONFIG_CHANGE_MSG : - ret =3D vhost_user_slave_handle_config_change(dev); + case VHOST_USER_BACKEND_CONFIG_CHANGE_MSG : + ret =3D vhost_user_backend_handle_config_change(dev); break; - case VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG: - ret =3D vhost_user_slave_handle_vring_host_notifier(dev, &payload.= area, - fd[0]); + case VHOST_USER_BACKEND_VRING_HOST_NOTIFIER_MSG: + ret =3D vhost_user_backend_handle_vring_host_notifier(dev, &payloa= d.area, + fd[0]); break; default: error_report("Received unexpected msg type: %d.", hdr.request); @@ -1502,11 +1502,11 @@ static void slave_read(void *opaque) iovec[1].iov_len =3D hdr.size; =20 do { - size =3D writev(u->slave_fd, iovec, ARRAY_SIZE(iovec)); + size =3D writev(u->backend_fd, iovec, ARRAY_SIZE(iovec)); } while (size < 0 && (errno =3D=3D EINTR || errno =3D=3D EAGAIN)); =20 if (size !=3D VHOST_USER_HDR_SIZE + hdr.size) { - error_report("Failed to send msg reply to slave."); + error_report("Failed to send msg reply to backend."); goto err; } } @@ -1514,9 +1514,9 @@ static void slave_read(void *opaque) return; =20 err: - qemu_set_fd_handler(u->slave_fd, NULL, NULL, NULL); - close(u->slave_fd); - u->slave_fd =3D -1; + qemu_set_fd_handler(u->backend_fd, NULL, NULL, NULL); + close(u->backend_fd); + u->backend_fd =3D -1; for (i =3D 0; i < fdsize; i++) { if (fd[i] !=3D -1) { close(fd[i]); @@ -1525,10 +1525,10 @@ err: return; } =20 -static int vhost_setup_slave_channel(struct vhost_dev *dev) +static int vhost_setup_backend_channel(struct vhost_dev *dev) { VhostUserMsg msg =3D { - .hdr.request =3D VHOST_USER_SET_SLAVE_REQ_FD, + .hdr.request =3D VHOST_USER_SET_BACKEND_REQ_FD, .hdr.flags =3D VHOST_USER_VERSION, }; struct vhost_user *u =3D dev->opaque; @@ -1537,7 +1537,7 @@ static int vhost_setup_slave_channel(struct vhost_dev= *dev) VHOST_USER_PROTOCOL_F_REPLY_= ACK); =20 if (!virtio_has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_SLAVE_REQ)) { + VHOST_USER_PROTOCOL_F_BACKEND_REQ)) { return 0; } =20 @@ -1546,8 +1546,8 @@ static int vhost_setup_slave_channel(struct vhost_dev= *dev) return -1; } =20 - u->slave_fd =3D sv[0]; - qemu_set_fd_handler(u->slave_fd, slave_read, NULL, dev); + u->backend_fd =3D sv[0]; + qemu_set_fd_handler(u->backend_fd, backend_read, NULL, dev); =20 if (reply_supported) { msg.hdr.flags |=3D VHOST_USER_NEED_REPLY_MASK; @@ -1565,9 +1565,9 @@ static int vhost_setup_slave_channel(struct vhost_dev= *dev) out: close(sv[1]); if (ret) { - qemu_set_fd_handler(u->slave_fd, NULL, NULL, NULL); - close(u->slave_fd); - u->slave_fd =3D -1; + qemu_set_fd_handler(u->backend_fd, NULL, NULL, NULL); + close(u->backend_fd); + u->backend_fd =3D -1; } =20 return ret; @@ -1804,7 +1804,7 @@ static int vhost_user_backend_init(struct vhost_dev *= dev, void *opaque) =20 u =3D g_new0(struct vhost_user, 1); u->user =3D opaque; - u->slave_fd =3D -1; + u->backend_fd =3D -1; u->dev =3D dev; dev->opaque =3D u; =20 @@ -1851,11 +1851,11 @@ static int vhost_user_backend_init(struct vhost_dev= *dev, void *opaque) =20 if (virtio_has_feature(features, VIRTIO_F_IOMMU_PLATFORM) && !(virtio_has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_SLAVE_REQ) && + VHOST_USER_PROTOCOL_F_BACKEND_REQ) && virtio_has_feature(dev->protocol_features, VHOST_USER_PROTOCOL_F_REPLY_ACK))) { error_report("IOMMU support requires reply-ack and " - "slave-req protocol features."); + "backend-req protocol features."); return -1; } =20 @@ -1890,7 +1890,7 @@ static int vhost_user_backend_init(struct vhost_dev *= dev, void *opaque) } =20 if (dev->vq_index =3D=3D 0) { - err =3D vhost_setup_slave_channel(dev); + err =3D vhost_setup_backend_channel(dev); if (err < 0) { return err; } @@ -1919,10 +1919,10 @@ static int vhost_user_backend_cleanup(struct vhost_= dev *dev) close(u->postcopy_fd.fd); u->postcopy_fd.handler =3D NULL; } - if (u->slave_fd >=3D 0) { - qemu_set_fd_handler(u->slave_fd, NULL, NULL, NULL); - close(u->slave_fd); - u->slave_fd =3D -1; + if (u->backend_fd >=3D 0) { + qemu_set_fd_handler(u->backend_fd, NULL, NULL, NULL); + close(u->backend_fd); + u->backend_fd =3D -1; } g_free(u->region_rb); u->region_rb =3D NULL; @@ -2016,7 +2016,7 @@ static int vhost_user_net_set_mtu(struct vhost_dev *d= ev, uint16_t mtu) return -1; } =20 - /* If reply_ack supported, slave has to ack specified MTU is valid */ + /* If reply_ack supported, backend has to ack specified MTU is valid */ if (reply_supported) { return process_message_reply(dev, &msg); } --=20 2.26.2