From patchwork Wed Jul 1 20:23:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 72692 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 60142A0350; Wed, 1 Jul 2020 22:28:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7F7E01D644; Wed, 1 Jul 2020 22:24:50 +0200 (CEST) Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by dpdk.org (Postfix) with ESMTP id A58FB1D64D for ; Wed, 1 Jul 2020 22:24:46 +0200 (CEST) Received: by mail-pl1-f194.google.com with SMTP id g17so10337936plq.12 for ; Wed, 01 Jul 2020 13:24:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eF0AB4Lhijf609Uqbof2wS0MYQrDAEdeCVHPhJiA+rA=; b=aVSL24qhKdQVkL3DM+cjoqPI65Qn8eSFvqbj8tIjKpHH3IYHHbE94bBdeZ04F+0419 Qa5IO0oQoJ+il2npoFKlj6UO4jTM7MHt47BbG5jmjTp0Ws1y35gJdrSPSxeu0me/Xi/x 3FGZd86JXMmJ0oLZAjsWsZpCIZG3U3rV/Yu7zQ/mTkiBrMHp0VKlx/T1SQPrCb7JBftl w45qL+s74z4v3bdHbTOTt6RLJ7bKvPcoWviP51N521/Psh31UDVVmBS41yrSqYUftWcv d6doiHEHThFFYEhsNJf1YXKdoadoqOp9AMyMT2t7TpWTPOOUm/vmPlqz+3WOaZ/V8jEH vQ1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eF0AB4Lhijf609Uqbof2wS0MYQrDAEdeCVHPhJiA+rA=; b=lpHmkgT9tHI7zC8AnQBZ3OC8ijH5qI/g0nnlYj3KGGsxCIUbCx8n9Y/cRnGWxeCweB G+S317xnVqZGNqyJMAja52RNou2iHlG6l/kEmahOCRQoJUemKaIVzofgI+xjVXx5zcta 7gmxucduapq/K+kwFviP2pMf9a8Iby5PYFmqJQso0O7085YI+WcLCH9qbOXEhTznCaDA HHJf+ji/IZXt05C2XWez2xYXbpnpm0WRj3v+GI+G/bDoepw8kSElE6/4AeqfLD3+4u8/ /KGL2PIaZQaUzpKzsQ3uqCKT1GC/VnaexzFKz0HAKLsc7K7P8ow+tJMKy7pWgFadEWgm ePRg== X-Gm-Message-State: AOAM531YoJ3OBR4r2J7fyn1MvTV9ItFz1H4yWX7JvgoYB0u4L8Sr8VLp r1dT4QzJJLovq8v5Z1CKUFWenwr7vO4= X-Google-Smtp-Source: ABdhPJxuBVPDDk0c1PaarL5EQBTqHx/tj2qrEkI9CeSAfuOcAWlgZw0oFx/vsN/0brVLJgWMUBJPvw== X-Received: by 2002:a17:90b:3755:: with SMTP id ne21mr29275001pjb.218.1593635085111; Wed, 01 Jul 2020 13:24:45 -0700 (PDT) Received: from hermes.corp.microsoft.com (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id g8sm6584803pgr.70.2020.07.01.13.24.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2020 13:24:44 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Wed, 1 Jul 2020 13:23:59 -0700 Message-Id: <20200701202359.17006-28-stephen@networkplumber.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200701202359.17006-1-stephen@networkplumber.org> References: <20200604210200.25405-1-stephen@networkplumber.org> <20200701202359.17006-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 27/27] vhost: rename SLAVE to CLIENT X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The vhost is a client server architecture so replace the term slave with client. Signed-off-by: Stephen Hemminger --- drivers/vdpa/ifc/ifcvf_vdpa.c | 4 +- drivers/vdpa/mlx5/mlx5_vdpa.c | 4 +- lib/librte_vhost/rte_vhost.h | 16 ++--- lib/librte_vhost/rte_vhost_version.map | 2 +- lib/librte_vhost/vhost.c | 4 +- lib/librte_vhost/vhost.h | 4 +- lib/librte_vhost/vhost_crypto.c | 2 +- lib/librte_vhost/vhost_user.c | 96 +++++++++++++------------- lib/librte_vhost/vhost_user.h | 41 +++++------ 9 files changed, 87 insertions(+), 86 deletions(-) diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c index de54dc8aab6c..6c02b99f5e44 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c @@ -1071,8 +1071,8 @@ ifcvf_get_vdpa_features(struct rte_vdpa_device *vdev, uint64_t *features) #define VDPA_SUPPORTED_PROTOCOL_FEATURES \ (1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK | \ - 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_REQ | \ - 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD | \ + 1ULL << VHOST_USER_PROTOCOL_F_CLIENT_REQ | \ + 1ULL << VHOST_USER_PROTOCOL_F_CLIENT_SEND_FD | \ 1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER | \ 1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD) static int diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c index dbd36ab0c95e..8fd2de9ba98f 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa.c @@ -34,8 +34,8 @@ (1ULL << VIRTIO_NET_F_MTU)) #define MLX5_VDPA_PROTOCOL_FEATURES \ - ((1ULL << VHOST_USER_PROTOCOL_F_SLAVE_REQ) | \ - (1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD) | \ + ((1ULL << VHOST_USER_PROTOCOL_F_CLIENT_REQ) | \ + (1ULL << VHOST_USER_PROTOCOL_F_CLIENT_SEND_FD) | \ (1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER) | \ (1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD) | \ (1ULL << VHOST_USER_PROTOCOL_F_MQ) | \ diff --git a/lib/librte_vhost/rte_vhost.h b/lib/librte_vhost/rte_vhost.h index 8a5c332c83ac..b952e6d47021 100644 --- a/lib/librte_vhost/rte_vhost.h +++ b/lib/librte_vhost/rte_vhost.h @@ -74,8 +74,8 @@ extern "C" { #define VHOST_USER_PROTOCOL_F_NET_MTU 4 #endif -#ifndef VHOST_USER_PROTOCOL_F_SLAVE_REQ -#define VHOST_USER_PROTOCOL_F_SLAVE_REQ 5 +#ifndef VHOST_USER_PROTOCOL_F_CLIENT_REQ +#define VHOST_USER_PROTOCOL_F_CLIENT_REQ 5 #endif #ifndef VHOST_USER_PROTOCOL_F_CRYPTO_SESSION @@ -90,8 +90,8 @@ extern "C" { #define VHOST_USER_PROTOCOL_F_CONFIG 9 #endif -#ifndef VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD -#define VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD 10 +#ifndef VHOST_USER_PROTOCOL_F_CLIENT_SEND_FD +#define VHOST_USER_PROTOCOL_F_CLIENT_SEND_FD 10 #endif #ifndef VHOST_USER_PROTOCOL_F_HOST_NOTIFIER @@ -249,9 +249,9 @@ typedef enum rte_vhost_msg_result (*rte_vhost_msg_handle)(int vid, void *msg); * Optional vhost user message handlers. */ struct rte_vhost_user_extern_ops { - /* Called prior to the master message handling. */ + /* Called prior to the server message handling. */ rte_vhost_msg_handle pre_msg_handle; - /* Called after the master message handling. */ + /* Called after the server message handling. */ rte_vhost_msg_handle post_msg_handle; }; @@ -1008,13 +1008,13 @@ rte_vhost_get_vdpa_device(int vid); * @param vid * vhost device ID * @param need_reply - * wait for the master response the status of this operation + * wait for the server response the status of this operation * @return * 0 on success, < 0 on failure */ __rte_experimental int -rte_vhost_slave_config_change(int vid, bool need_reply); +rte_vhost_client_config_change(int vid, bool need_reply); #ifdef __cplusplus } diff --git a/lib/librte_vhost/rte_vhost_version.map b/lib/librte_vhost/rte_vhost_version.map index 86784405a1e8..74973ce9b8ec 100644 --- a/lib/librte_vhost/rte_vhost_version.map +++ b/lib/librte_vhost/rte_vhost_version.map @@ -65,7 +65,7 @@ EXPERIMENTAL { rte_vhost_clr_inflight_desc_packed; rte_vhost_get_vhost_ring_inflight; rte_vhost_get_vring_base_from_inflight; - rte_vhost_slave_config_change; + rte_vhost_client_config_change; rte_vdpa_find_device_by_name; rte_vdpa_get_rte_device; rte_vdpa_get_queue_num; diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index 0d822d6a3f48..3d111d714bf1 100644 --- a/lib/librte_vhost/vhost.c +++ b/lib/librte_vhost/vhost.c @@ -632,9 +632,9 @@ vhost_new_device(void) vhost_devices[i] = dev; dev->vid = i; dev->flags = VIRTIO_DEV_BUILTIN_VIRTIO_NET; - dev->slave_req_fd = -1; + dev->client_req_fd = -1; dev->postcopy_ufd = -1; - rte_spinlock_init(&dev->slave_req_lock); + rte_spinlock_init(&dev->client_req_lock); return i; } diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index 0344636997a6..a0902d1535c4 100644 --- a/lib/librte_vhost/vhost.h +++ b/lib/librte_vhost/vhost.h @@ -356,8 +356,8 @@ struct virtio_net { uint32_t max_guest_pages; struct guest_page *guest_pages; - int slave_req_fd; - rte_spinlock_t slave_req_lock; + int client_req_fd; + rte_spinlock_t client_req_lock; int postcopy_ufd; int postcopy_listening; diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c index 0f9df4059d0b..8e4fc1bf015a 100644 --- a/lib/librte_vhost/vhost_crypto.c +++ b/lib/librte_vhost/vhost_crypto.c @@ -460,7 +460,7 @@ vhost_crypto_msg_post_handler(int vid, void *msg) return RTE_VHOST_MSG_RESULT_ERR; } - switch (vmsg->request.master) { + switch (vmsg->request.server) { case VHOST_USER_CRYPTO_CREATE_SESS: vhost_crypto_create_sess(vcrypto, &vmsg->payload.crypto_session); diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 6039a8fdb9cb..56da81cd1e17 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -7,11 +7,11 @@ * The vhost-user protocol connection is an external interface, so it must be * robust against invalid inputs. * - * This is important because the vhost-user master is only one step removed + * This is important because the vhost-user server is only one step removed * from the guest. Malicious guests that have escaped will then launch further - * attacks from the vhost-user master. + * attacks from the vhost-user server. * - * Even in deployments where guests are trusted, a bug in the vhost-user master + * Even in deployments where guests are trusted, a bug in the vhost-user server * can still cause invalid messages to be sent. Such messages must not * compromise the stability of the DPDK application by causing crashes, memory * corruption, or other problematic behavior. @@ -78,7 +78,7 @@ static const char *vhost_message_str[VHOST_USER_MAX] = { [VHOST_USER_SET_VRING_ENABLE] = "VHOST_USER_SET_VRING_ENABLE", [VHOST_USER_SEND_RARP] = "VHOST_USER_SEND_RARP", [VHOST_USER_NET_SET_MTU] = "VHOST_USER_NET_SET_MTU", - [VHOST_USER_SET_SLAVE_REQ_FD] = "VHOST_USER_SET_SLAVE_REQ_FD", + [VHOST_USER_SET_CLIENT_REQ_FD] = "VHOST_USER_SET_CLIENT_REQ_FD", [VHOST_USER_IOTLB_MSG] = "VHOST_USER_IOTLB_MSG", [VHOST_USER_CRYPTO_CREATE_SESS] = "VHOST_USER_CRYPTO_CREATE_SESS", [VHOST_USER_CRYPTO_CLOSE_SESS] = "VHOST_USER_CRYPTO_CLOSE_SESS", @@ -114,7 +114,7 @@ validate_msg_fds(struct VhostUserMsg *msg, int expected_fds) VHOST_LOG_CONFIG(ERR, " Expect %d FDs for request %s, received %d\n", expected_fds, - vhost_message_str[msg->request.master], + vhost_message_str[msg->request.server], msg->fd_num); close_msg_fds(msg); @@ -215,9 +215,9 @@ vhost_backend_cleanup(struct virtio_net *dev) dev->inflight_info = NULL; } - if (dev->slave_req_fd >= 0) { - close(dev->slave_req_fd); - dev->slave_req_fd = -1; + if (dev->client_req_fd >= 0) { + close(dev->client_req_fd); + dev->client_req_fd = -1; } if (dev->postcopy_ufd >= 0) { @@ -346,7 +346,7 @@ vhost_user_set_features(struct virtio_net **pdev, struct VhostUserMsg *msg, return RTE_VHOST_MSG_RESULT_OK; /* - * Error out if master tries to change features while device is + * Error out if server tries to change features while device is * in running state. The exception being VHOST_F_LOG_ALL, which * is enabled when the live-migration starts. */ @@ -1235,10 +1235,10 @@ vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *msg, if (validate_msg_fds(&ack_msg, 0) != 0) goto err_mmap; - if (ack_msg.request.master != VHOST_USER_SET_MEM_TABLE) { + if (ack_msg.request.server != VHOST_USER_SET_MEM_TABLE) { VHOST_LOG_CONFIG(ERR, "Bad qemu ack on postcopy set-mem-table (%d)\n", - ack_msg.request.master); + ack_msg.request.server); goto err_mmap; } @@ -2049,14 +2049,14 @@ vhost_user_set_protocol_features(struct virtio_net **pdev, { struct virtio_net *dev = *pdev; uint64_t protocol_features = msg->payload.u64; - uint64_t slave_protocol_features = 0; + uint64_t client_protocol_features = 0; if (validate_msg_fds(msg, 0) != 0) return RTE_VHOST_MSG_RESULT_ERR; rte_vhost_driver_get_protocol_features(dev->ifname, - &slave_protocol_features); - if (protocol_features & ~slave_protocol_features) { + &client_protocol_features); + if (protocol_features & ~client_protocol_features) { VHOST_LOG_CONFIG(ERR, "(%d) received invalid protocol features.\n", dev->vid); @@ -2228,15 +2228,15 @@ vhost_user_set_req_fd(struct virtio_net **pdev, struct VhostUserMsg *msg, if (fd < 0) { VHOST_LOG_CONFIG(ERR, - "Invalid file descriptor for slave channel (%d)\n", + "Invalid file descriptor for client channel (%d)\n", fd); return RTE_VHOST_MSG_RESULT_ERR; } - if (dev->slave_req_fd >= 0) - close(dev->slave_req_fd); + if (dev->client_req_fd >= 0) + close(dev->client_req_fd); - dev->slave_req_fd = fd; + dev->client_req_fd = fd; return RTE_VHOST_MSG_RESULT_OK; } @@ -2472,7 +2472,7 @@ static vhost_message_handler_t vhost_message_handlers[VHOST_USER_MAX] = { [VHOST_USER_SET_VRING_ENABLE] = vhost_user_set_vring_enable, [VHOST_USER_SEND_RARP] = vhost_user_send_rarp, [VHOST_USER_NET_SET_MTU] = vhost_user_net_set_mtu, - [VHOST_USER_SET_SLAVE_REQ_FD] = vhost_user_set_req_fd, + [VHOST_USER_SET_CLIENT_REQ_FD] = vhost_user_set_req_fd, [VHOST_USER_IOTLB_MSG] = vhost_user_iotlb_msg, [VHOST_USER_POSTCOPY_ADVISE] = vhost_user_set_postcopy_advise, [VHOST_USER_POSTCOPY_LISTEN] = vhost_user_set_postcopy_listen, @@ -2541,16 +2541,16 @@ send_vhost_reply(int sockfd, struct VhostUserMsg *msg) } static int -send_vhost_slave_message(struct virtio_net *dev, struct VhostUserMsg *msg) +send_vhost_client_message(struct virtio_net *dev, struct VhostUserMsg *msg) { int ret; if (msg->flags & VHOST_USER_NEED_REPLY) - rte_spinlock_lock(&dev->slave_req_lock); + rte_spinlock_lock(&dev->client_req_lock); - ret = send_vhost_message(dev->slave_req_fd, msg); + ret = send_vhost_message(dev->client_req_fd, msg); if (ret < 0 && (msg->flags & VHOST_USER_NEED_REPLY)) - rte_spinlock_unlock(&dev->slave_req_lock); + rte_spinlock_unlock(&dev->client_req_lock); return ret; } @@ -2564,7 +2564,7 @@ vhost_user_check_and_alloc_queue_pair(struct virtio_net *dev, { uint32_t vring_idx; - switch (msg->request.master) { + switch (msg->request.server) { case VHOST_USER_SET_VRING_KICK: case VHOST_USER_SET_VRING_CALL: case VHOST_USER_SET_VRING_ERR: @@ -2667,7 +2667,7 @@ vhost_user_msg_handler(int vid, int fd) } ret = 0; - request = msg.request.master; + request = msg.request.server; if (request > VHOST_USER_NONE && request < VHOST_USER_MAX && vhost_message_str[request]) { if (request != VHOST_USER_IOTLB_MSG) @@ -2710,7 +2710,7 @@ vhost_user_msg_handler(int vid, int fd) case VHOST_USER_SET_VRING_ENABLE: case VHOST_USER_SEND_RARP: case VHOST_USER_NET_SET_MTU: - case VHOST_USER_SET_SLAVE_REQ_FD: + case VHOST_USER_SET_CLIENT_REQ_FD: if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) { vhost_user_lock_all_queue_pairs(dev); unlock_required = 1; @@ -2850,7 +2850,7 @@ vhost_user_msg_handler(int vid, int fd) return 0; } -static int process_slave_message_reply(struct virtio_net *dev, +static int process_client_message_reply(struct virtio_net *dev, const struct VhostUserMsg *msg) { struct VhostUserMsg msg_reply; @@ -2859,11 +2859,11 @@ static int process_slave_message_reply(struct virtio_net *dev, if ((msg->flags & VHOST_USER_NEED_REPLY) == 0) return 0; - ret = read_vhost_message(dev->slave_req_fd, &msg_reply); + ret = read_vhost_message(dev->client_req_fd, &msg_reply); if (ret <= 0) { if (ret < 0) VHOST_LOG_CONFIG(ERR, - "vhost read slave message reply failed\n"); + "vhost read client message reply failed\n"); else VHOST_LOG_CONFIG(INFO, "vhost peer closed\n"); @@ -2872,10 +2872,10 @@ static int process_slave_message_reply(struct virtio_net *dev, } ret = 0; - if (msg_reply.request.slave != msg->request.slave) { + if (msg_reply.request.client != msg->request.client) { VHOST_LOG_CONFIG(ERR, "Received unexpected msg type (%u), expected %u\n", - msg_reply.request.slave, msg->request.slave); + msg_reply.request.client, msg->request.client); ret = -1; goto out; } @@ -2883,7 +2883,7 @@ static int process_slave_message_reply(struct virtio_net *dev, ret = msg_reply.payload.u64 ? -1 : 0; out: - rte_spinlock_unlock(&dev->slave_req_lock); + rte_spinlock_unlock(&dev->client_req_lock); return ret; } @@ -2892,7 +2892,7 @@ vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm) { int ret; struct VhostUserMsg msg = { - .request.slave = VHOST_USER_SLAVE_IOTLB_MSG, + .request.client = VHOST_USER_CLIENT_IOTLB_MSG, .flags = VHOST_USER_VERSION, .size = sizeof(msg.payload.iotlb), .payload.iotlb = { @@ -2902,7 +2902,7 @@ vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm) }, }; - ret = send_vhost_message(dev->slave_req_fd, &msg); + ret = send_vhost_message(dev->client_req_fd, &msg); if (ret < 0) { VHOST_LOG_CONFIG(ERR, "Failed to send IOTLB miss message (%d)\n", @@ -2914,11 +2914,11 @@ vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm) } static int -vhost_user_slave_config_change(struct virtio_net *dev, bool need_reply) +vhost_user_client_config_change(struct virtio_net *dev, bool need_reply) { int ret; struct VhostUserMsg msg = { - .request.slave = VHOST_USER_SLAVE_CONFIG_CHANGE_MSG, + .request.client = VHOST_USER_CLIENT_CONFIG_CHANGE_MSG, .flags = VHOST_USER_VERSION, .size = 0, }; @@ -2926,7 +2926,7 @@ vhost_user_slave_config_change(struct virtio_net *dev, bool need_reply) if (need_reply) msg.flags |= VHOST_USER_NEED_REPLY; - ret = send_vhost_slave_message(dev, &msg); + ret = send_vhost_client_message(dev, &msg); if (ret < 0) { VHOST_LOG_CONFIG(ERR, "Failed to send config change (%d)\n", @@ -2934,11 +2934,11 @@ vhost_user_slave_config_change(struct virtio_net *dev, bool need_reply) return ret; } - return process_slave_message_reply(dev, &msg); + return process_client_message_reply(dev, &msg); } int -rte_vhost_slave_config_change(int vid, bool need_reply) +rte_vhost_client_config_change(int vid, bool need_reply) { struct virtio_net *dev; @@ -2946,17 +2946,17 @@ rte_vhost_slave_config_change(int vid, bool need_reply) if (!dev) return -ENODEV; - return vhost_user_slave_config_change(dev, need_reply); + return vhost_user_client_config_change(dev, need_reply); } -static int vhost_user_slave_set_vring_host_notifier(struct virtio_net *dev, +static int vhost_user_client_set_vring_host_notifier(struct virtio_net *dev, int index, int fd, uint64_t offset, uint64_t size) { int ret; struct VhostUserMsg msg = { - .request.slave = VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG, + .request.client = VHOST_USER_CLIENT_VRING_HOST_NOTIFIER_MSG, .flags = VHOST_USER_VERSION | VHOST_USER_NEED_REPLY, .size = sizeof(msg.payload.area), .payload.area = { @@ -2973,14 +2973,14 @@ static int vhost_user_slave_set_vring_host_notifier(struct virtio_net *dev, msg.fd_num = 1; } - ret = send_vhost_slave_message(dev, &msg); + ret = send_vhost_client_message(dev, &msg); if (ret < 0) { VHOST_LOG_CONFIG(ERR, "Failed to set host notifier (%d)\n", ret); return ret; } - return process_slave_message_reply(dev, &msg); + return process_client_message_reply(dev, &msg); } int rte_vhost_host_notifier_ctrl(int vid, uint16_t qid, bool enable) @@ -3002,9 +3002,9 @@ int rte_vhost_host_notifier_ctrl(int vid, uint16_t qid, bool enable) if (!(dev->features & (1ULL << VIRTIO_F_VERSION_1)) || !(dev->features & (1ULL << VHOST_USER_F_PROTOCOL_FEATURES)) || !(dev->protocol_features & - (1ULL << VHOST_USER_PROTOCOL_F_SLAVE_REQ)) || + (1ULL << VHOST_USER_PROTOCOL_F_CLIENT_REQ)) || !(dev->protocol_features & - (1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD)) || + (1ULL << VHOST_USER_PROTOCOL_F_CLIENT_SEND_FD)) || !(dev->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER))) return -ENOTSUP; @@ -3034,7 +3034,7 @@ int rte_vhost_host_notifier_ctrl(int vid, uint16_t qid, bool enable) goto disable; } - if (vhost_user_slave_set_vring_host_notifier(dev, i, + if (vhost_user_client_set_vring_host_notifier(dev, i, vfio_device_fd, offset, size) < 0) { ret = -EFAULT; goto disable; @@ -3043,7 +3043,7 @@ int rte_vhost_host_notifier_ctrl(int vid, uint16_t qid, bool enable) } else { disable: for (i = q_start; i <= q_last; i++) { - vhost_user_slave_set_vring_host_notifier(dev, i, -1, + vhost_user_client_set_vring_host_notifier(dev, i, -1, 0, 0); } } diff --git a/lib/librte_vhost/vhost_user.h b/lib/librte_vhost/vhost_user.h index 1f65efa4a935..91aa8e24ea48 100644 --- a/lib/librte_vhost/vhost_user.h +++ b/lib/librte_vhost/vhost_user.h @@ -14,16 +14,17 @@ #define VHOST_MEMORY_MAX_NREGIONS 8 -#define VHOST_USER_PROTOCOL_FEATURES ((1ULL << VHOST_USER_PROTOCOL_F_MQ) | \ - (1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD) |\ - (1ULL << VHOST_USER_PROTOCOL_F_RARP) | \ - (1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK) | \ - (1ULL << VHOST_USER_PROTOCOL_F_NET_MTU) | \ - (1ULL << VHOST_USER_PROTOCOL_F_SLAVE_REQ) | \ - (1ULL << VHOST_USER_PROTOCOL_F_CRYPTO_SESSION) | \ - (1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD) | \ - (1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER) | \ - (1ULL << VHOST_USER_PROTOCOL_F_PAGEFAULT)) +#define VHOST_USER_PROTOCOL_FEATURES \ + ((1ULL << VHOST_USER_PROTOCOL_F_MQ) | \ + (1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD) | \ + (1ULL << VHOST_USER_PROTOCOL_F_RARP) | \ + (1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK) | \ + (1ULL << VHOST_USER_PROTOCOL_F_NET_MTU) | \ + (1ULL << VHOST_USER_PROTOCOL_F_CLIENT_REQ) | \ + (1ULL << VHOST_USER_PROTOCOL_F_CRYPTO_SESSION) | \ + (1ULL << VHOST_USER_PROTOCOL_F_CLIENT_SEND_FD) | \ + (1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER) | \ + (1ULL << VHOST_USER_PROTOCOL_F_PAGEFAULT)) typedef enum VhostUserRequest { VHOST_USER_NONE = 0, @@ -47,7 +48,7 @@ typedef enum VhostUserRequest { VHOST_USER_SET_VRING_ENABLE = 18, VHOST_USER_SEND_RARP = 19, VHOST_USER_NET_SET_MTU = 20, - VHOST_USER_SET_SLAVE_REQ_FD = 21, + VHOST_USER_SET_CLIENT_REQ_FD = 21, VHOST_USER_IOTLB_MSG = 22, VHOST_USER_CRYPTO_CREATE_SESS = 26, VHOST_USER_CRYPTO_CLOSE_SESS = 27, @@ -59,13 +60,13 @@ typedef enum VhostUserRequest { VHOST_USER_MAX = 33 } VhostUserRequest; -typedef enum VhostUserSlaveRequest { - VHOST_USER_SLAVE_NONE = 0, - VHOST_USER_SLAVE_IOTLB_MSG = 1, - VHOST_USER_SLAVE_CONFIG_CHANGE_MSG = 2, - VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG = 3, - VHOST_USER_SLAVE_MAX -} VhostUserSlaveRequest; +typedef enum VhostUserClientRequest { + VHOST_USER_CLIENT_NONE = 0, + VHOST_USER_CLIENT_IOTLB_MSG = 1, + VHOST_USER_CLIENT_CONFIG_CHANGE_MSG = 2, + VHOST_USER_CLIENT_VRING_HOST_NOTIFIER_MSG = 3, + VHOST_USER_CLIENT_MAX +} VhostUserClientRequest; typedef struct VhostUserMemoryRegion { uint64_t guest_phys_addr; @@ -124,8 +125,8 @@ typedef struct VhostUserInflight { typedef struct VhostUserMsg { union { - uint32_t master; /* a VhostUserRequest value */ - uint32_t slave; /* a VhostUserSlaveRequest value*/ + uint32_t server; /* a VhostUserRequest value */ + uint32_t client; /* a VhostUserClientRequest value*/ } request; #define VHOST_USER_VERSION_MASK 0x3