From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B4C56A0519; Fri, 3 Jul 2020 09:36:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3AD4F1DA16; Fri, 3 Jul 2020 09:36:28 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id 84B011DA0F for ; Fri, 3 Jul 2020 09:36:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593761786; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=4ZANtfm7RV74UtYBC4CgI0qzhxMBLG9FRNoLtV9b4jg=; b=WKuA+DVZhYE7WIgA5aqkIFYCmgmeVu62zCSJWWmKSt36hKU33UFF2hgYv2eRz53XcxwYmP 9RBxF2AjXIaOTQZfke1lA+Mm/vV0RMUInlFQMuZs1Dzbjx23I1KLIsBa1izSILKhwq7RG+ XtHhDgF/LyIocJFMEtZ+8UkZDy5q/vY= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-285-bVwX6vFePuCz816XD15xZA-1; Fri, 03 Jul 2020 03:36:24 -0400 X-MC-Unique: bVwX6vFePuCz816XD15xZA-1 Received: by mail-wm1-f72.google.com with SMTP id v11so15610167wmb.1 for ; Fri, 03 Jul 2020 00:36:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:autocrypt:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4ZANtfm7RV74UtYBC4CgI0qzhxMBLG9FRNoLtV9b4jg=; b=QrZ3C1NpVTka+81gNSfwXLPF2NeCLnSxccykB5eJE04YTwSg4yzT6S/pnsX8QJCoTU JTT84Y0YmzUudO6weaCyXmzVsyc1d43suRf8ASkjs3m66PugAabuC8EZ3QDOSELGJ/73 LI4/GdMeusDglFvcCiwC6/jCn+C3qikLAqcaDAfYna9vQxy5z1bYEmsY3UliNkqTrf1c 5Ap5r1POWDbrIoD0wqR/EJklCZF9ZmMoJnwnrZ5z3AySV39Vz7HRmCywM+Ry9EVtgnHt W2LbUhpCC9oiZfhJXgJDE2plC8fYiZagrc5cNphYIhLQRWbOLOQQSb+zwKAe9tIfWHy0 91tg== X-Gm-Message-State: AOAM5332Ys8YBT2c5W6L54V3fzXZF3iG+q36AOW4Rb019gO9y1Z0bJof cptIk59mD2FpNjbuWH23bLxtKTRxE3QJ4Dmq4Bh/koIzh73gb9fSzd3nA89CGNF4SDZq2JnsgB4 MftA= X-Received: by 2002:adf:fa89:: with SMTP id h9mr34801846wrr.120.1593761781851; Fri, 03 Jul 2020 00:36:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwe3zVSCXhVkUScmoRLE3CQ3ri8F9gNjYzzA9AynB8ZNL0Uf3Dxx9GIzL1jpDmTG8X/8vWhMg== X-Received: by 2002:adf:fa89:: with SMTP id h9mr34801820wrr.120.1593761781433; Fri, 03 Jul 2020 00:36:21 -0700 (PDT) Received: from amorenoz.users.ipa.redhat.com ([94.73.58.18]) by smtp.gmail.com with ESMTPSA id c2sm13428843wrv.47.2020.07.03.00.36.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Jul 2020 00:36:20 -0700 (PDT) To: "Xia, Chenbo" , Stephen Hemminger , "dev@dpdk.org" References: <20200604210200.25405-1-stephen@networkplumber.org> <20200701202359.17006-1-stephen@networkplumber.org> <20200701202359.17006-28-stephen@networkplumber.org> From: Adrian Moreno Autocrypt: addr=amorenoz@redhat.com; prefer-encrypt=mutual; keydata= mQENBF1syNUBCADQ9dk3fDMxOZ/+OQpmbanpodYxEv8IRtDz8PXw8YX7UyGfozOpLjQ8Fftj ZxuubYNbt2QVbSgviFilFdNWu2eTnN/JaGtfhmTOLPVoakkPHZF8lbgImMoch7L0fH8wN2IM KPxQyPNlX+K9FD5brHsV1lfe1TwAxmhcvLW8yNrVq+9eDIDykxc7tH4exIqXgZroahGxMHKy c8Ti2kJka/t6pDfRaY0J+6J7I1nrn6GXXSMNA45EH8+0N/QlcXhP3rfftnoPeVmpjswzvJqY FNjf/Q5VPLx7RX0Qx+y8mMB2JcChV5Bl7D7x5EUbItj6+Sy7QfOgCtPegk9HSrBCNYaLABEB AAG0I0FkcmlhbiBNb3Jlbm8gPGFtb3Jlbm96QHJlZGhhdC5jb20+iQFUBBMBCAA+FiEEogUD gihhmbOPHy26d5C5fbYeFsUFAl1syNUCGwMFCQHhM4AFCwkIBwIGFQoJCAsCBBYCAwECHgEC F4AACgkQd5C5fbYeFsX7qwgArGHSkX+ILNcujkVzjTG4OtkpJMPFlkn/1PxSEKD0jLuzx14B COzpg/Mqj3Re/QBuOas+ci9bsUA0/2nORtmmEBvzDOJpR5FH1jaGCx8USlY4WM6QqEDNZgTw hsy9KhjFzFjMk+oo3HyItXA+Uq9yrRBTjNBGTXxezMRcMuUZ4MIAfY0IRBglL2BufiuL43jD BvTENNFLoQ/wFV7qkFWSkv+8IjTsxr7M6XUo1QLd29Hn0dvwssN579HL1+BP46i2REpzeBEG L75iVChi+YnIQQNMJ9NYarVabZx4Y1Gn8+7B/1SNArDV+IDgnYgt7E58otoV2Ap310dmtuvE VbxGpbkBDQRdbMjVAQgAqyp9oA7WDu7/Y9T4Ommt69iZx8os7shUIfdgPEy5xrcPn6qGwN1/ HQ4j8nWfBG9uuX1X0RXUZIUEtYTxtED4yaCQMTqDUf9cBAwAA2mYxBfoiNYx8YqxM+sT0/J4 2qmDd+y+20UR4yzHE8AmIbspTzDFIJDAi+jKSR8F355z0sfW7CIMDC4ZWrPsskjEy1YN/U10 r6tRRH1kNyrCSbTG0d9MtcQO58h7DLXuzUhErB+BtG52A04t5cweIJTJC+koV5XPeilzlHnm RFoj0ncruGa9Odns21BNt3cy9wLfK+aUnWuAB1uc6bJGQPiAwjkilz7g7MBRUuIQ2Zt7HGLc SwARAQABiQE8BBgBCAAmFiEEogUDgihhmbOPHy26d5C5fbYeFsUFAl1syNUCGwwFCQHhM4AA CgkQd5C5fbYeFsUlSwf8CH+u/IXaE7WeWxwFkMaORfW8cM4q0xrL3M6yRGuQNW+kMjnrvK9U J9G+L1/5uTRbDQ/4LdoKqize8LjehA+iF6ba4t9Npikh8fLKWgaJfQ/hPhH4C3O5gWPOLTW6 ylGxiuER4CdFwQIoAMMslhFA7G+teeOKBq36E+1+zrybI6Xy1UBSlpDK9j4CtTnMQejjuSQb Qhle+l8VroaUHq869wjAhRHHhqmtJKggI+OvzgQpDIwfHIDypb1BuKydi2W6cVYEALUYyCLS dTBDhzj8zR5tPCsga8J7+TclQzkWOiI2C6ZtiWrMsL/Uym3uXk5nsoc7lSj7yLd/MrBRhYfP JQ== Message-ID: Date: Fri, 3 Jul 2020 09:36:20 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=amorenoz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [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" On 7/2/20 1:17 PM, Xia, Chenbo wrote: > Hi Stephen, > > Thanks for working on this! The slave/master naming of vhost is defined > by vhost-user spec, which is maintained by QEMU. I think if we want to > change it. The spec in QEMU should first be changed, then as an implementation > of the spec, we could easily change it. Also, using server/client to be the > new version may cause some code confusion in vhost. Because vhost > traditionally can act as a socket server or client (you can see the names in the code) > and the vhost-user slave/master generally refers to vhost-user pmd/QEMU. > So it may make the code hard to understand. Do you think this make sense? > I agree, we need to come up with a way of distinguishing between the vhost vs socket roles. Maybe the virtio original virtio terminiology "driver/device" could be used. Other ways to refer to the vhost pair is "frontend/backend". Adrián > Thanks! > Chenbo > >> -----Original Message----- >> From: dev On Behalf Of Stephen Hemminger >> Sent: Thursday, July 2, 2020 4:24 AM >> To: dev@dpdk.org >> Cc: Stephen Hemminger >> Subject: [dpdk-dev] [PATCH v4 27/27] vhost: rename SLAVE to CLIENT >> >> 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 >> -- >> 2.26.2 > -- Adrián Moreno