From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 137F041E30; Thu, 9 Mar 2023 06:17:28 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BD78242B8E; Thu, 9 Mar 2023 06:17:16 +0100 (CET) Received: from corp-ob09.yahoo-corp.jp (corp-ob09.yahoo-corp.jp [182.22.125.216]) by mails.dpdk.org (Postfix) with ESMTP id 2AC6F4111C for ; Thu, 9 Mar 2023 06:17:09 +0100 (CET) Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01lp2175.outbound.protection.outlook.com [104.47.23.175]) by corp-ob09.yahoo-corp.jp (Postfix) with ESMTPS id 9F55619FB187; Thu, 9 Mar 2023 14:17:08 +0900 (JST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tlr7O/YfnnEMrEX0qsidu5Jmuyd5Ryt5Bdlh15Cr/U6QMYpGQI6x3x0Lnmhakz2CuKfavOfNI+QCElDYd87s+npAB9P+x0JSWfRHf7lVo/LzLa0XwxPizfFFRU3IwhAQWYGWImQZa5qFKf1KAC28iYGA2ylz8MLpOglJlEzUjZnYhNHE7rdSGIjWzgd3gOGbXSF8jtDd/lNB62hWL9IUeExqns19vL0yCyse7KOO4Y+xflh+yJEVjKk0YKv7d1e9s0vKBpPadcmdwhlNYdF6Llji5+4BcTLQ1c75AaLSH1+TQHsKkUvCKkcfLEwTgJxY2x+6oWcUqBXKxmj4lEbmQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8INzdGptvH0pQRBaCuJeCEqNb1ANm3zuWrOeMQNphd0=; b=WEQvaASqGYnjyUK8iZXYoC9YNK/+fJTFJuj7snY5oaVgE3XR/htO+fWPMPKnIxB/eotoLYRCWyJluitXprm/9yWCNUTfKebmGpSCploUOYxm+TXl1maBMshQLvRwvXXK7a2gMNsLx3fsafOQg/q01QrWsdEdHG0dIe8nq/+A1dC4uJb9ge1RL7FYA4W9ejn3h6bwjHWZrtOcFoi6vUrELFMpHHEmKq7ivVhvCFuQtQRskrE+zgxFXXq9tXgPiZt7FanaTgWy24do9mA/GuYZ+5zWV+u2YIVSvhOOrKITFmm/V2GurMdc7Y6EKyItyCZztFambw6VnnwIcqef3vpNBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=yahoo-corp.jp; dmarc=pass action=none header.from=yahoo-corp.jp; dkim=pass header.d=yahoo-corp.jp; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo-corp.jp; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8INzdGptvH0pQRBaCuJeCEqNb1ANm3zuWrOeMQNphd0=; b=LPcvkaUo+tdvGWUJfrjmGzudRscNnUVwy95oEEpmmoknA9r6xxzpfj3g3mMr3FVufB9qWAVANCB6zoMnWY5hCnImmNzlAEGdBzYDymoTD9eWkbGZI1QaSCoC68RdRZiQuDWl7rhgwcB3UL26+m1/4zZoatq1QN4WTn1aUWEQhkI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=yahoo-corp.jp; Received: from TY2PR01MB4107.jpnprd01.prod.outlook.com (2603:1096:404:d8::23) by TYTPR01MB10990.jpnprd01.prod.outlook.com (2603:1096:400:3a2::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.19; Thu, 9 Mar 2023 05:17:07 +0000 Received: from TY2PR01MB4107.jpnprd01.prod.outlook.com ([fe80::61fe:e4c3:a819:6ce6]) by TY2PR01MB4107.jpnprd01.prod.outlook.com ([fe80::61fe:e4c3:a819:6ce6%7]) with mapi id 15.20.6178.019; Thu, 9 Mar 2023 05:17:07 +0000 From: Nobuhiro MIKI To: maxime.coquelin@redhat.com, chenbo.xia@intel.com Cc: dev@dpdk.org, stephen@networkplumber.org, Nobuhiro MIKI Subject: [PATCH v2 2/2] vhost: refactor to follow new naming convention Date: Thu, 9 Mar 2023 14:16:43 +0900 Message-Id: <20230309051643.70171-3-nmiki@yahoo-corp.jp> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230309051643.70171-1-nmiki@yahoo-corp.jp> References: <20230309051643.70171-1-nmiki@yahoo-corp.jp> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: TYCPR01CA0114.jpnprd01.prod.outlook.com (2603:1096:405:4::30) To TY2PR01MB4107.jpnprd01.prod.outlook.com (2603:1096:404:d8::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TY2PR01MB4107:EE_|TYTPR01MB10990:EE_ X-MS-Office365-Filtering-Correlation-Id: a5bfe017-0d1c-4633-607f-08db205d86d9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v7WZkv7bvmxH65JioWy2+ol1oF0KWJzw0dHA/uDKN5i69Dcwnb4JI3RvSAc1ut1EKZ4EhCwuySq2y4c47ugbNq/jmWFK4ZhQxe3hOfJpfcmDiwumYYR96AqY6iIFeGsSW+HKQR1WexqkfdPtBTriWwRcwx1ufOQprAyPMW8vaqN4F5oIdqoStBS4uh9hmr3IKaHJ/VFNC/tsM0Ie0eNettUfEYT1sXlOHtG8nDi0WsrOe8zfqP2DgXHcN7NYos9fx+yqdL80LAmEJXxXbGK83udUBCrUyJ7aXbk1DZZaJlHwtis+snoNwuUuk2MFaiDqkR7RPSDaSMojionP7cl3ENRCaZ82Wk/rQ4eYPJzmsXj/sC4HkGTgpo3maIQMcKu4zbtV/CUvSb5F4dhbBfzEuPIqmvzJyIFjJPt35pyZiYFVdcauZHZydZ9LoTZET8JDQQNFfUV2mA/lKJbraMmmPBW+ysN/b1qBURc5pdRO9qqbWyfnI+3wthMViqBUO66U5oa1++iEicSFYxRZyw/nwZ8HRAACeN7UskTq0eBR5N47Svt8ISrgObJrd3KHDfvIfzNFycongFtE4fRLjmchM/tzJOUOS4XXI2Bqu7ao320F9ulbudjPdQzKfq/9HKdB+XCv26MlFYR3z7f5uSaUkax3V7ddzoGTj+tvB+cbJAb9bBP/DIsxYLjDMwTwWj2GADwrOv2H0fy9HY3gJucXzg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TY2PR01MB4107.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(136003)(39860400002)(346002)(396003)(366004)(376002)(451199018)(36756003)(38350700002)(38100700002)(86362001)(82960400001)(6512007)(6506007)(1076003)(26005)(83380400001)(186003)(6666004)(2616005)(316002)(52116002)(5660300002)(478600001)(6486002)(41300700001)(4326008)(107886003)(8936002)(30864003)(2906002)(66946007)(66556008)(66476007)(8676002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Qtr6iduzODrM4sp7UIecZdYgVinOds8wh6IRk53uK2XqQH0BH4KBWLmQqa+G?= =?us-ascii?Q?0bcLrzOc/n9/Ub4MvR2G8sPT+01QdECahnk2kf+nrFD2aOORJoB3Lpqlbv88?= =?us-ascii?Q?D+Gx2vOxbtRFl/Jvndbdymkz2yVgD9Y7ypqPGceZVZdIeWFXv/LSV6p+ovnY?= =?us-ascii?Q?iOJ2OD5iANm7w+PFdmE6vrp5wGf8HztkcKv1zJr/rG/csiJQ2Sslr+EOpHlw?= =?us-ascii?Q?W50lMMAjQLchXavGJ+mpuFSBN5XyxiFqQ07zn++oMmoXhtwnKtArhwU+A4US?= =?us-ascii?Q?LdkHvsRs4P/8sJcEymY2MNwCJwe3vBXDKVcyMzuGFUCSto8YJIKMkZXoyTL8?= =?us-ascii?Q?FDwSUxygzxjV7sLWkzhxBSfcxM0GvYDta7uZ6hOA9c8BJ8EDfXZDDWPoPoLN?= =?us-ascii?Q?m+wVVLthJ+j0EaL4lOy7slJqLDgRrRLSFaRijhkf3mJh5BWJ0oWOAt5qdLHQ?= =?us-ascii?Q?caRchFiHMq93VGX+QWEZ0QI0/fIcG3ijaulZcql5g31uTYxID+eWQ6HWg9aZ?= =?us-ascii?Q?tu2tbwvfuh8hyaFuhm3ZS3VS21JqmfJ5TfyYx37Jh0PonDN/snCD+kUr8rR3?= =?us-ascii?Q?+h9532ztV/bEPnZ9Q2Oau3KwQkBt+2xPT0DlzDhaiqL/MKfA5RKYzykjJAj9?= =?us-ascii?Q?uStkJ1YpOJB2BY0UjT99sh3bUNheNTjcI8rOgBnePlBpK71wtJc9IdQHJrdf?= =?us-ascii?Q?YOCsy+ctg7eadj6BxFNszrv/DROKiV2zEXwIjC+y1v2GoCJkJMoO9OGoH7hV?= =?us-ascii?Q?qyPT9WhIuze+S8zDkqPudqOfxtw/h6iIzTRUVz6BCo7kpGtbviw2vCWOY7uF?= =?us-ascii?Q?wGiiaModXBCq72k99b0PC8VqjP6R+AzpRg4mjm4p9ZcIFTbkdLBPx0hGtsAk?= =?us-ascii?Q?M2Ib6ciIcKAml+4E+4Y38w9XTPa9HtID8HEJyj/iPkQZqgfO/Fyw0Z36SLsy?= =?us-ascii?Q?tb5CtwvIXo/S08t68ospcd0m/4gdUcNyw7Xuvi8PVp0c3P/lJfBcWYIjzndP?= =?us-ascii?Q?IpdEiewhEygytJUNn3zEO71PHVMV4Epe34VxAmObndVbsz08BOGahy5bUA6H?= =?us-ascii?Q?+Z8nkzPrCYBCFzETsne18yHruIdOTi6onZXiDlIVGPZVqap8WoSjLndACG0t?= =?us-ascii?Q?j8/Mcnhm49MSF7HmpT7dJKKzJIyLBX525SCgt3L+T1sA94juGrYMHijBtNBh?= =?us-ascii?Q?xT4pYGfQdT+7AD5cnFNVJXAd7i1O5V+ednqz8i2aIE1AszmCmZgGPhYOpFTs?= =?us-ascii?Q?2cFnisaAeTOhm/wq6pT1iCab5hRnLUY4i3xGZp+WUOmLuJZPdpBeN9oYfEfL?= =?us-ascii?Q?WoOwWmEXMMQ1GhyIRnrdCUorN+B0IEau1IgESeaFGU94tnWoY6c5AuD92Kqu?= =?us-ascii?Q?rs2yVE0T9m8kHuX/LWUkLDYsGp1LKgdz8mMlpR2V9EBjhXufMxrf3l2urj03?= =?us-ascii?Q?jMjamEeTuvXYB6KmbyYbeHBZVELvRmhIagtuTy46K+WmB8xUJ4w/l/pJx2hk?= =?us-ascii?Q?Np22DWtC0WrJdMFO93c4dMl/EfGk+v6MhulTCYBmTt86gLEGwS6HoIIStikl?= =?us-ascii?Q?1N3K6CtpHnYcqYPnIVnWSsggUp79DOu96+IjQnHm?= X-OriginatorOrg: yahoo-corp.jp X-MS-Exchange-CrossTenant-Network-Message-Id: a5bfe017-0d1c-4633-607f-08db205d86d9 X-MS-Exchange-CrossTenant-AuthSource: TY2PR01MB4107.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2023 05:17:07.1372 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a208d369-cd4e-4f87-b119-98eaf31df2c3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PoV3oPY0e/v/rNZXlQhwjQGdYe0LUdJPhbHecWptMtpcQP2lMaG+QPU7TMFbjyRSfNyKDn+TqyejvK4z5phgGw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYTPR01MB10990 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Simply replace 'master' with 'frontend' and 'slave' with 'backend'. Signed-off-by: Nobuhiro MIKI Acked-by: Stephen Hemminger --- drivers/vdpa/ifc/ifcvf_vdpa.c | 2 +- lib/vhost/rte_vhost.h | 8 ++-- lib/vhost/version.map | 2 +- lib/vhost/vhost.c | 4 +- lib/vhost/vhost.h | 4 +- lib/vhost/vhost_crypto.c | 2 +- lib/vhost/vhost_user.c | 82 +++++++++++++++++------------------ lib/vhost/vhost_user.h | 8 ++-- 8 files changed, 56 insertions(+), 56 deletions(-) diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c index fe4d278c5380..e4133568c1aa 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c @@ -605,7 +605,7 @@ virtio_interrupt_handler(struct ifcvf_internal *internal) int vid = internal->vid; int ret; - ret = rte_vhost_slave_config_change(vid, 1); + ret = rte_vhost_backend_config_change(vid, 1); if (ret) DRV_LOG(ERR, "failed to notify the guest about configuration space change."); } diff --git a/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h index ed255fc6c51f..58a5d4be92f8 100644 --- a/lib/vhost/rte_vhost.h +++ b/lib/vhost/rte_vhost.h @@ -264,9 +264,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 frontend message handling. */ rte_vhost_msg_handle pre_msg_handle; - /* Called after the master message handling. */ + /* Called after the frontend message handling. */ rte_vhost_msg_handle post_msg_handle; }; @@ -1060,13 +1060,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 frontend 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_backend_config_change(int vid, bool need_reply); /** * Retrieve names of statistics of a Vhost virtqueue. diff --git a/lib/vhost/version.map b/lib/vhost/version.map index d779a5cf3a0a..d322a4a888cd 100644 --- a/lib/vhost/version.map +++ b/lib/vhost/version.map @@ -68,7 +68,7 @@ EXPERIMENTAL { global: rte_vhost_crypto_driver_start; - rte_vhost_slave_config_change; + rte_vhost_backend_config_change; rte_vhost_async_channel_register; rte_vhost_async_channel_unregister; rte_vhost_submit_enqueue_burst; diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index 358672bb176b..ef3794381751 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -701,9 +701,9 @@ vhost_new_device(void) dev->vid = i; dev->flags = VIRTIO_DEV_BUILTIN_VIRTIO_NET; - dev->slave_req_fd = -1; + dev->backend_req_fd = -1; dev->postcopy_ufd = -1; - rte_spinlock_init(&dev->slave_req_lock); + rte_spinlock_init(&dev->backend_req_lock); return i; } diff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h index a31d810531d7..8fdab13c7097 100644 --- a/lib/vhost/vhost.h +++ b/lib/vhost/vhost.h @@ -499,8 +499,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 backend_req_fd; + rte_spinlock_t backend_req_lock; int postcopy_ufd; int postcopy_listening; diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c index f02bf865c349..9bf5ef67b9ad 100644 --- a/lib/vhost/vhost_crypto.c +++ b/lib/vhost/vhost_crypto.c @@ -451,7 +451,7 @@ vhost_crypto_msg_post_handler(int vid, void *msg) return RTE_VHOST_MSG_RESULT_ERR; } - switch (ctx->msg.request.master) { + switch (ctx->msg.request.frontend) { case VHOST_USER_CRYPTO_CREATE_SESS: vhost_crypto_create_sess(vcrypto, &ctx->msg.payload.crypto_session); diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index cd4104ea5ce0..92ed4f02a68c 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/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 frontend 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 frontend. * - * 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 frontend * 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. @@ -95,7 +95,7 @@ validate_msg_fds(struct virtio_net *dev, struct vhu_msg_context *ctx, int expect VHOST_LOG_CONFIG(dev->ifname, ERR, "expect %d FDs for request %s, received %d\n", - expected_fds, vhost_message_handlers[ctx->msg.request.master].description, + expected_fds, vhost_message_handlers[ctx->msg.request.frontend].description, ctx->fd_num); close_msg_fds(ctx); @@ -226,9 +226,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->backend_req_fd >= 0) { + close(dev->backend_req_fd); + dev->backend_req_fd = -1; } if (dev->postcopy_ufd >= 0) { @@ -349,7 +349,7 @@ vhost_user_set_features(struct virtio_net **pdev, return RTE_VHOST_MSG_RESULT_OK; /* - * Error out if master tries to change features while device is + * Error out if frontend 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. */ @@ -1192,10 +1192,10 @@ vhost_user_postcopy_register(struct virtio_net *dev, int main_fd, if (validate_msg_fds(dev, &ack_ctx, 0) != 0) return -1; - if (ack_ctx.msg.request.master != VHOST_USER_SET_MEM_TABLE) { + if (ack_ctx.msg.request.frontend != VHOST_USER_SET_MEM_TABLE) { VHOST_LOG_CONFIG(dev->ifname, ERR, "bad qemu ack on postcopy set-mem-table (%d)\n", - ack_ctx.msg.request.master); + ack_ctx.msg.request.frontend); return -1; } @@ -2257,11 +2257,11 @@ vhost_user_set_protocol_features(struct virtio_net **pdev, { struct virtio_net *dev = *pdev; uint64_t protocol_features = ctx->msg.payload.u64; - uint64_t slave_protocol_features = 0; + uint64_t backend_protocol_features = 0; rte_vhost_driver_get_protocol_features(dev->ifname, - &slave_protocol_features); - if (protocol_features & ~slave_protocol_features) { + &backend_protocol_features); + if (protocol_features & ~backend_protocol_features) { VHOST_LOG_CONFIG(dev->ifname, ERR, "received invalid protocol features.\n"); return RTE_VHOST_MSG_RESULT_ERR; } @@ -2458,14 +2458,14 @@ vhost_user_set_req_fd(struct virtio_net **pdev, if (fd < 0) { VHOST_LOG_CONFIG(dev->ifname, ERR, - "invalid file descriptor for slave channel (%d)\n", fd); + "invalid file descriptor for backend channel (%d)\n", fd); return RTE_VHOST_MSG_RESULT_ERR; } - if (dev->slave_req_fd >= 0) - close(dev->slave_req_fd); + if (dev->backend_req_fd >= 0) + close(dev->backend_req_fd); - dev->slave_req_fd = fd; + dev->backend_req_fd = fd; return RTE_VHOST_MSG_RESULT_OK; } @@ -2931,46 +2931,46 @@ send_vhost_reply(struct virtio_net *dev, int sockfd, struct vhu_msg_context *ctx } static int -send_vhost_slave_message(struct virtio_net *dev, struct vhu_msg_context *ctx) +send_vhost_backend_message(struct virtio_net *dev, struct vhu_msg_context *ctx) { - return send_vhost_message(dev, dev->slave_req_fd, ctx); + return send_vhost_message(dev, dev->backend_req_fd, ctx); } static int -send_vhost_slave_message_process_reply(struct virtio_net *dev, struct vhu_msg_context *ctx) +send_vhost_backend_message_process_reply(struct virtio_net *dev, struct vhu_msg_context *ctx) { struct vhu_msg_context msg_reply; int ret; - rte_spinlock_lock(&dev->slave_req_lock); - ret = send_vhost_slave_message(dev, ctx); + rte_spinlock_lock(&dev->backend_req_lock); + ret = send_vhost_backend_message(dev, ctx); if (ret < 0) { VHOST_LOG_CONFIG(dev->ifname, ERR, "failed to send config change (%d)\n", ret); goto out; } - ret = read_vhost_message(dev, dev->slave_req_fd, &msg_reply); + ret = read_vhost_message(dev, dev->backend_req_fd, &msg_reply); if (ret <= 0) { if (ret < 0) VHOST_LOG_CONFIG(dev->ifname, ERR, - "vhost read slave message reply failed\n"); + "vhost read backend message reply failed\n"); else VHOST_LOG_CONFIG(dev->ifname, INFO, "vhost peer closed\n"); ret = -1; goto out; } - if (msg_reply.msg.request.slave != ctx->msg.request.slave) { + if (msg_reply.msg.request.backend != ctx->msg.request.backend) { VHOST_LOG_CONFIG(dev->ifname, ERR, "received unexpected msg type (%u), expected %u\n", - msg_reply.msg.request.slave, ctx->msg.request.slave); + msg_reply.msg.request.backend, ctx->msg.request.backend); ret = -1; goto out; } ret = msg_reply.msg.payload.u64 ? -1 : 0; out: - rte_spinlock_unlock(&dev->slave_req_lock); + rte_spinlock_unlock(&dev->backend_req_lock); return ret; } @@ -2983,7 +2983,7 @@ vhost_user_check_and_alloc_queue_pair(struct virtio_net *dev, { uint32_t vring_idx; - switch (ctx->msg.request.master) { + switch (ctx->msg.request.frontend) { case VHOST_USER_SET_VRING_KICK: case VHOST_USER_SET_VRING_CALL: case VHOST_USER_SET_VRING_ERR: @@ -3080,14 +3080,14 @@ vhost_user_msg_handler(int vid, int fd) } } - ctx.msg.request.master = VHOST_USER_NONE; + ctx.msg.request.frontend = VHOST_USER_NONE; ret = read_vhost_message(dev, fd, &ctx); if (ret == 0) { VHOST_LOG_CONFIG(dev->ifname, INFO, "vhost peer closed\n"); return -1; } - request = ctx.msg.request.master; + request = ctx.msg.request.frontend; if (request > VHOST_USER_NONE && request < RTE_DIM(vhost_message_handlers)) msg_handler = &vhost_message_handlers[request]; else @@ -3307,7 +3307,7 @@ vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm) int ret; struct vhu_msg_context ctx = { .msg = { - .request.slave = VHOST_USER_BACKEND_IOTLB_MSG, + .request.backend = VHOST_USER_BACKEND_IOTLB_MSG, .flags = VHOST_USER_VERSION, .size = sizeof(ctx.msg.payload.iotlb), .payload.iotlb = { @@ -3318,7 +3318,7 @@ vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm) }, }; - ret = send_vhost_message(dev, dev->slave_req_fd, &ctx); + ret = send_vhost_message(dev, dev->backend_req_fd, &ctx); if (ret < 0) { VHOST_LOG_CONFIG(dev->ifname, ERR, "failed to send IOTLB miss message (%d)\n", @@ -3330,11 +3330,11 @@ vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm) } int -rte_vhost_slave_config_change(int vid, bool need_reply) +rte_vhost_backend_config_change(int vid, bool need_reply) { struct vhu_msg_context ctx = { .msg = { - .request.slave = VHOST_USER_BACKEND_CONFIG_CHANGE_MSG, + .request.backend = VHOST_USER_BACKEND_CONFIG_CHANGE_MSG, .flags = VHOST_USER_VERSION, .size = 0, } @@ -3347,10 +3347,10 @@ rte_vhost_slave_config_change(int vid, bool need_reply) return -ENODEV; if (!need_reply) { - ret = send_vhost_slave_message(dev, &ctx); + ret = send_vhost_backend_message(dev, &ctx); } else { ctx.msg.flags |= VHOST_USER_NEED_REPLY; - ret = send_vhost_slave_message_process_reply(dev, &ctx); + ret = send_vhost_backend_message_process_reply(dev, &ctx); } if (ret < 0) @@ -3358,7 +3358,7 @@ rte_vhost_slave_config_change(int vid, bool need_reply) return ret; } -static int vhost_user_slave_set_vring_host_notifier(struct virtio_net *dev, +static int vhost_user_backend_set_vring_host_notifier(struct virtio_net *dev, int index, int fd, uint64_t offset, uint64_t size) @@ -3366,7 +3366,7 @@ static int vhost_user_slave_set_vring_host_notifier(struct virtio_net *dev, int ret; struct vhu_msg_context ctx = { .msg = { - .request.slave = VHOST_USER_BACKEND_VRING_HOST_NOTIFIER_MSG, + .request.backend = VHOST_USER_BACKEND_VRING_HOST_NOTIFIER_MSG, .flags = VHOST_USER_VERSION | VHOST_USER_NEED_REPLY, .size = sizeof(ctx.msg.payload.area), .payload.area = { @@ -3384,7 +3384,7 @@ static int vhost_user_slave_set_vring_host_notifier(struct virtio_net *dev, ctx.fd_num = 1; } - ret = send_vhost_slave_message_process_reply(dev, &ctx); + ret = send_vhost_backend_message_process_reply(dev, &ctx); if (ret < 0) VHOST_LOG_CONFIG(dev->ifname, ERR, "failed to set host notifier (%d)\n", ret); @@ -3444,7 +3444,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_backend_set_vring_host_notifier(dev, i, vfio_device_fd, offset, size) < 0) { ret = -EFAULT; goto disable; @@ -3453,7 +3453,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_backend_set_vring_host_notifier(dev, i, -1, 0, 0); } } diff --git a/lib/vhost/vhost_user.h b/lib/vhost/vhost_user.h index 8e418414ba94..a0987a58f9e8 100644 --- a/lib/vhost/vhost_user.h +++ b/lib/vhost/vhost_user.h @@ -62,12 +62,12 @@ typedef enum VhostUserRequest { VHOST_USER_GET_STATUS = 40, } VhostUserRequest; -typedef enum VhostUserSlaveRequest { +typedef enum VhostUserBackendRequest { VHOST_USER_BACKEND_NONE = 0, VHOST_USER_BACKEND_IOTLB_MSG = 1, VHOST_USER_BACKEND_CONFIG_CHANGE_MSG = 2, VHOST_USER_BACKEND_VRING_HOST_NOTIFIER_MSG = 3, -} VhostUserSlaveRequest; +} VhostUserBackendRequest; typedef struct VhostUserMemoryRegion { uint64_t guest_phys_addr; @@ -136,8 +136,8 @@ struct vhost_user_config { typedef struct VhostUserMsg { union { - uint32_t master; /* a VhostUserRequest value */ - uint32_t slave; /* a VhostUserSlaveRequest value*/ + uint32_t frontend; /* a VhostUserRequest value */ + uint32_t backend; /* a VhostUserBackendRequest value*/ } request; #define VHOST_USER_VERSION_MASK 0x3 -- 2.31.1