DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v2 0/2] vhost: fix names to follow new naming convention
@ 2023-03-09  5:16 Nobuhiro MIKI
  2023-03-09  5:16 ` [PATCH v2 1/2] vhost: fix constants " Nobuhiro MIKI
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Nobuhiro MIKI @ 2023-03-09  5:16 UTC (permalink / raw)
  To: maxime.coquelin, chenbo.xia; +Cc: dev, stephen, Nobuhiro MIKI

In this series, we simply replace 'master' with 'frontend' and
'slave' with 'backend' so that vhost user protocol message,
protocol names follow the new naming conventions.

v2:
- Update .mailmap in patch 1
- Replace 'master' with 'frontend' in patch 2

Nobuhiro MIKI (2):
  vhost: fix constants to follow new naming convention
  vhost: refactor to follow new naming convention

 .mailmap                        |  2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c   |  6 +--
 drivers/vdpa/mlx5/mlx5_vdpa.c   |  4 +-
 drivers/vdpa/sfc/sfc_vdpa_ops.c |  4 +-
 lib/vhost/rte_vhost.h           | 16 +++---
 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          | 90 ++++++++++++++++-----------------
 lib/vhost/vhost_user.h          | 22 ++++----
 11 files changed, 78 insertions(+), 78 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/2] vhost: fix constants to follow new naming convention
  2023-03-09  5:16 [PATCH v2 0/2] vhost: fix names to follow new naming convention Nobuhiro MIKI
@ 2023-03-09  5:16 ` Nobuhiro MIKI
  2023-03-09  5:36   ` Xia, Chenbo
  2023-03-09 16:33   ` Maxime Coquelin
  2023-03-09  5:16 ` [PATCH v2 2/2] vhost: refactor " Nobuhiro MIKI
  2023-03-16 14:47 ` [PATCH v2 0/2] vhost: fix names " Maxime Coquelin
  2 siblings, 2 replies; 8+ messages in thread
From: Nobuhiro MIKI @ 2023-03-09  5:16 UTC (permalink / raw)
  To: maxime.coquelin, chenbo.xia; +Cc: dev, stephen, Nobuhiro MIKI

DPDK apps (e.g. dpdk-skeleton) output this name
during negotiation. But, it is not consistent when
debugging using QEMU as a front-end, for example.
This is because QEMU already follows new naming convention [1].

Some type names and variable names, such as VhostUserSlaveRequest,
are still in old naming convention. But, in this patch we
only focus on constants.

[1] https://qemu-project.gitlab.io/qemu/interop/vhost-user.html

Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
 .mailmap                        |  2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c   |  4 ++--
 drivers/vdpa/mlx5/mlx5_vdpa.c   |  4 ++--
 drivers/vdpa/sfc/sfc_vdpa_ops.c |  4 ++--
 lib/vhost/rte_vhost.h           |  8 ++++----
 lib/vhost/vhost_user.c          | 14 +++++++-------
 lib/vhost/vhost_user.h          | 14 +++++++-------
 7 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/.mailmap b/.mailmap
index 8e7d78f37eef..3400241a6908 100644
--- a/.mailmap
+++ b/.mailmap
@@ -980,7 +980,7 @@ Nithin Dabilpuram <ndabilpuram@marvell.com> <nithin.dabilpuram@caviumnetworks.co
 Nitin Saxena <nitin.saxena@caviumnetworks.com>
 Nitzan Weller <nitzanwe@mellanox.com>
 Noa Ezra <noae@mellanox.com>
-Nobuhiro Miki <nmiki@yahoo-corp.jp>
+Nobuhiro MIKI <nmiki@yahoo-corp.jp>
 Norbert Ciosek <norbertx.ciosek@intel.com>
 Odi Assli <odia@nvidia.com>
 Ognjen Joldzic <ognjen.joldzic@gmail.com>
diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index 4a87673682fc..fe4d278c5380 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -1315,8 +1315,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_BACKEND_REQ | \
+		 1ULL << VHOST_USER_PROTOCOL_F_BACKEND_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/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c
index f8dfa9513311..f1737f82a8ae 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa.c
@@ -37,8 +37,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_BACKEND_REQ) | \
+			     (1ULL << VHOST_USER_PROTOCOL_F_BACKEND_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/drivers/vdpa/sfc/sfc_vdpa_ops.c b/drivers/vdpa/sfc/sfc_vdpa_ops.c
index 6401d4e16f25..e88c7eeaa609 100644
--- a/drivers/vdpa/sfc/sfc_vdpa_ops.c
+++ b/drivers/vdpa/sfc/sfc_vdpa_ops.c
@@ -21,8 +21,8 @@
 /* These protocol features are needed to enable notifier ctrl */
 #define SFC_VDPA_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_BACKEND_REQ) | \
+		 (1ULL << VHOST_USER_PROTOCOL_F_BACKEND_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/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h
index a395843fe96d..ed255fc6c51f 100644
--- a/lib/vhost/rte_vhost.h
+++ b/lib/vhost/rte_vhost.h
@@ -80,8 +80,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_BACKEND_REQ
+#define VHOST_USER_PROTOCOL_F_BACKEND_REQ	5
 #endif
 
 #ifndef VHOST_USER_PROTOCOL_F_CRYPTO_SESSION
@@ -96,8 +96,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_BACKEND_SEND_FD
+#define VHOST_USER_PROTOCOL_F_BACKEND_SEND_FD 10
 #endif
 
 #ifndef VHOST_USER_PROTOCOL_F_HOST_NOTIFIER
diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index 9e361082dc9b..cd4104ea5ce0 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -2846,7 +2846,7 @@ VHOST_MESSAGE_HANDLER(VHOST_USER_GET_QUEUE_NUM, vhost_user_get_queue_num, false)
 VHOST_MESSAGE_HANDLER(VHOST_USER_SET_VRING_ENABLE, vhost_user_set_vring_enable, false) \
 VHOST_MESSAGE_HANDLER(VHOST_USER_SEND_RARP, vhost_user_send_rarp, false) \
 VHOST_MESSAGE_HANDLER(VHOST_USER_NET_SET_MTU, vhost_user_net_set_mtu, false) \
-VHOST_MESSAGE_HANDLER(VHOST_USER_SET_SLAVE_REQ_FD, vhost_user_set_req_fd, true) \
+VHOST_MESSAGE_HANDLER(VHOST_USER_SET_BACKEND_REQ_FD, vhost_user_set_req_fd, true) \
 VHOST_MESSAGE_HANDLER(VHOST_USER_IOTLB_MSG, vhost_user_iotlb_msg, false) \
 VHOST_MESSAGE_HANDLER(VHOST_USER_GET_CONFIG, vhost_user_get_config, false) \
 VHOST_MESSAGE_HANDLER(VHOST_USER_SET_CONFIG, vhost_user_set_config, false) \
@@ -3143,7 +3143,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_BACKEND_REQ_FD:
 		if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) {
 			vhost_user_lock_all_queue_pairs(dev);
 			unlock_required = 1;
@@ -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_SLAVE_IOTLB_MSG,
+			.request.slave = VHOST_USER_BACKEND_IOTLB_MSG,
 			.flags = VHOST_USER_VERSION,
 			.size = sizeof(ctx.msg.payload.iotlb),
 			.payload.iotlb = {
@@ -3334,7 +3334,7 @@ rte_vhost_slave_config_change(int vid, bool need_reply)
 {
 	struct vhu_msg_context ctx = {
 		.msg = {
-			.request.slave = VHOST_USER_SLAVE_CONFIG_CHANGE_MSG,
+			.request.slave = VHOST_USER_BACKEND_CONFIG_CHANGE_MSG,
 			.flags = VHOST_USER_VERSION,
 			.size = 0,
 		}
@@ -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_SLAVE_VRING_HOST_NOTIFIER_MSG,
+			.request.slave = VHOST_USER_BACKEND_VRING_HOST_NOTIFIER_MSG,
 			.flags = VHOST_USER_VERSION | VHOST_USER_NEED_REPLY,
 			.size = sizeof(ctx.msg.payload.area),
 			.payload.area = {
@@ -3410,9 +3410,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_BACKEND_REQ)) ||
 	    !(dev->protocol_features &
-			(1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD)) ||
+			(1ULL << VHOST_USER_PROTOCOL_F_BACKEND_SEND_FD)) ||
 	    !(dev->protocol_features &
 			(1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER)))
 		return -ENOTSUP;
diff --git a/lib/vhost/vhost_user.h b/lib/vhost/vhost_user.h
index 8ecca6859707..8e418414ba94 100644
--- a/lib/vhost/vhost_user.h
+++ b/lib/vhost/vhost_user.h
@@ -18,9 +18,9 @@
 					 (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_BACKEND_REQ) | \
 					 (1ULL << VHOST_USER_PROTOCOL_F_CRYPTO_SESSION) | \
-					 (1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD) | \
+					 (1ULL << VHOST_USER_PROTOCOL_F_BACKEND_SEND_FD) | \
 					 (1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER) | \
 					 (1ULL << VHOST_USER_PROTOCOL_F_PAGEFAULT) | \
 					 (1ULL << VHOST_USER_PROTOCOL_F_STATUS))
@@ -47,7 +47,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_BACKEND_REQ_FD = 21,
 	VHOST_USER_IOTLB_MSG = 22,
 	VHOST_USER_GET_CONFIG = 24,
 	VHOST_USER_SET_CONFIG = 25,
@@ -63,10 +63,10 @@ typedef enum VhostUserRequest {
 } 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_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;
 
 typedef struct VhostUserMemoryRegion {
-- 
2.31.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 2/2] vhost: refactor to follow new naming convention
  2023-03-09  5:16 [PATCH v2 0/2] vhost: fix names to follow new naming convention Nobuhiro MIKI
  2023-03-09  5:16 ` [PATCH v2 1/2] vhost: fix constants " Nobuhiro MIKI
@ 2023-03-09  5:16 ` Nobuhiro MIKI
  2023-03-09  5:36   ` Xia, Chenbo
  2023-03-09 16:33   ` Maxime Coquelin
  2023-03-16 14:47 ` [PATCH v2 0/2] vhost: fix names " Maxime Coquelin
  2 siblings, 2 replies; 8+ messages in thread
From: Nobuhiro MIKI @ 2023-03-09  5:16 UTC (permalink / raw)
  To: maxime.coquelin, chenbo.xia; +Cc: dev, stephen, Nobuhiro MIKI

Simply replace 'master' with 'frontend' and 'slave' with 'backend'.

Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
 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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH v2 1/2] vhost: fix constants to follow new naming convention
  2023-03-09  5:16 ` [PATCH v2 1/2] vhost: fix constants " Nobuhiro MIKI
@ 2023-03-09  5:36   ` Xia, Chenbo
  2023-03-09 16:33   ` Maxime Coquelin
  1 sibling, 0 replies; 8+ messages in thread
From: Xia, Chenbo @ 2023-03-09  5:36 UTC (permalink / raw)
  To: Nobuhiro MIKI, maxime.coquelin; +Cc: dev, stephen

> -----Original Message-----
> From: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
> Sent: Thursday, March 9, 2023 1:17 PM
> To: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>
> Cc: dev@dpdk.org; stephen@networkplumber.org; Nobuhiro MIKI <nmiki@yahoo-
> corp.jp>
> Subject: [PATCH v2 1/2] vhost: fix constants to follow new naming
> convention
> 
> DPDK apps (e.g. dpdk-skeleton) output this name
> during negotiation. But, it is not consistent when
> debugging using QEMU as a front-end, for example.
> This is because QEMU already follows new naming convention [1].
> 
> Some type names and variable names, such as VhostUserSlaveRequest,
> are still in old naming convention. But, in this patch we
> only focus on constants.
> 
> [1] https://qemu-project.gitlab.io/qemu/interop/vhost-user.html
> 
> Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  .mailmap                        |  2 +-
>  drivers/vdpa/ifc/ifcvf_vdpa.c   |  4 ++--
>  drivers/vdpa/mlx5/mlx5_vdpa.c   |  4 ++--
>  drivers/vdpa/sfc/sfc_vdpa_ops.c |  4 ++--
>  lib/vhost/rte_vhost.h           |  8 ++++----
>  lib/vhost/vhost_user.c          | 14 +++++++-------
>  lib/vhost/vhost_user.h          | 14 +++++++-------
>  7 files changed, 25 insertions(+), 25 deletions(-)
> 
> diff --git a/.mailmap b/.mailmap
> index 8e7d78f37eef..3400241a6908 100644
> --- a/.mailmap
> +++ b/.mailmap
> @@ -980,7 +980,7 @@ Nithin Dabilpuram <ndabilpuram@marvell.com>
> <nithin.dabilpuram@caviumnetworks.co
>  Nitin Saxena <nitin.saxena@caviumnetworks.com>
>  Nitzan Weller <nitzanwe@mellanox.com>
>  Noa Ezra <noae@mellanox.com>
> -Nobuhiro Miki <nmiki@yahoo-corp.jp>
> +Nobuhiro MIKI <nmiki@yahoo-corp.jp>
>  Norbert Ciosek <norbertx.ciosek@intel.com>
>  Odi Assli <odia@nvidia.com>
>  Ognjen Joldzic <ognjen.joldzic@gmail.com>
> diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
> index 4a87673682fc..fe4d278c5380 100644
> --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> @@ -1315,8 +1315,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_BACKEND_REQ | \
> +		 1ULL << VHOST_USER_PROTOCOL_F_BACKEND_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/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c
> index f8dfa9513311..f1737f82a8ae 100644
> --- a/drivers/vdpa/mlx5/mlx5_vdpa.c
> +++ b/drivers/vdpa/mlx5/mlx5_vdpa.c
> @@ -37,8 +37,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_BACKEND_REQ) | \
> +			     (1ULL << VHOST_USER_PROTOCOL_F_BACKEND_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/drivers/vdpa/sfc/sfc_vdpa_ops.c
> b/drivers/vdpa/sfc/sfc_vdpa_ops.c
> index 6401d4e16f25..e88c7eeaa609 100644
> --- a/drivers/vdpa/sfc/sfc_vdpa_ops.c
> +++ b/drivers/vdpa/sfc/sfc_vdpa_ops.c
> @@ -21,8 +21,8 @@
>  /* These protocol features are needed to enable notifier ctrl */
>  #define SFC_VDPA_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_BACKEND_REQ) | \
> +		 (1ULL << VHOST_USER_PROTOCOL_F_BACKEND_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/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h
> index a395843fe96d..ed255fc6c51f 100644
> --- a/lib/vhost/rte_vhost.h
> +++ b/lib/vhost/rte_vhost.h
> @@ -80,8 +80,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_BACKEND_REQ
> +#define VHOST_USER_PROTOCOL_F_BACKEND_REQ	5
>  #endif
> 
>  #ifndef VHOST_USER_PROTOCOL_F_CRYPTO_SESSION
> @@ -96,8 +96,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_BACKEND_SEND_FD
> +#define VHOST_USER_PROTOCOL_F_BACKEND_SEND_FD 10
>  #endif
> 
>  #ifndef VHOST_USER_PROTOCOL_F_HOST_NOTIFIER
> diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
> index 9e361082dc9b..cd4104ea5ce0 100644
> --- a/lib/vhost/vhost_user.c
> +++ b/lib/vhost/vhost_user.c
> @@ -2846,7 +2846,7 @@ VHOST_MESSAGE_HANDLER(VHOST_USER_GET_QUEUE_NUM,
> vhost_user_get_queue_num, false)
>  VHOST_MESSAGE_HANDLER(VHOST_USER_SET_VRING_ENABLE,
> vhost_user_set_vring_enable, false) \
>  VHOST_MESSAGE_HANDLER(VHOST_USER_SEND_RARP, vhost_user_send_rarp, false)
> \
>  VHOST_MESSAGE_HANDLER(VHOST_USER_NET_SET_MTU, vhost_user_net_set_mtu,
> false) \
> -VHOST_MESSAGE_HANDLER(VHOST_USER_SET_SLAVE_REQ_FD, vhost_user_set_req_fd,
> true) \
> +VHOST_MESSAGE_HANDLER(VHOST_USER_SET_BACKEND_REQ_FD,
> vhost_user_set_req_fd, true) \
>  VHOST_MESSAGE_HANDLER(VHOST_USER_IOTLB_MSG, vhost_user_iotlb_msg, false)
> \
>  VHOST_MESSAGE_HANDLER(VHOST_USER_GET_CONFIG, vhost_user_get_config, false)
> \
>  VHOST_MESSAGE_HANDLER(VHOST_USER_SET_CONFIG, vhost_user_set_config, false)
> \
> @@ -3143,7 +3143,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_BACKEND_REQ_FD:
>  		if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) {
>  			vhost_user_lock_all_queue_pairs(dev);
>  			unlock_required = 1;
> @@ -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_SLAVE_IOTLB_MSG,
> +			.request.slave = VHOST_USER_BACKEND_IOTLB_MSG,
>  			.flags = VHOST_USER_VERSION,
>  			.size = sizeof(ctx.msg.payload.iotlb),
>  			.payload.iotlb = {
> @@ -3334,7 +3334,7 @@ rte_vhost_slave_config_change(int vid, bool
> need_reply)
>  {
>  	struct vhu_msg_context ctx = {
>  		.msg = {
> -			.request.slave = VHOST_USER_SLAVE_CONFIG_CHANGE_MSG,
> +			.request.slave = VHOST_USER_BACKEND_CONFIG_CHANGE_MSG,
>  			.flags = VHOST_USER_VERSION,
>  			.size = 0,
>  		}
> @@ -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_SLAVE_VRING_HOST_NOTIFIER_MSG,
> +			.request.slave =
> VHOST_USER_BACKEND_VRING_HOST_NOTIFIER_MSG,
>  			.flags = VHOST_USER_VERSION | VHOST_USER_NEED_REPLY,
>  			.size = sizeof(ctx.msg.payload.area),
>  			.payload.area = {
> @@ -3410,9 +3410,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_BACKEND_REQ)) ||
>  	    !(dev->protocol_features &
> -			(1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD)) ||
> +			(1ULL << VHOST_USER_PROTOCOL_F_BACKEND_SEND_FD)) ||
>  	    !(dev->protocol_features &
>  			(1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER)))
>  		return -ENOTSUP;
> diff --git a/lib/vhost/vhost_user.h b/lib/vhost/vhost_user.h
> index 8ecca6859707..8e418414ba94 100644
> --- a/lib/vhost/vhost_user.h
> +++ b/lib/vhost/vhost_user.h
> @@ -18,9 +18,9 @@
>  					 (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_BACKEND_REQ)
> | \
>  					 (1ULL <<
> VHOST_USER_PROTOCOL_F_CRYPTO_SESSION) | \
> -					 (1ULL <<
> VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD) | \
> +					 (1ULL <<
> VHOST_USER_PROTOCOL_F_BACKEND_SEND_FD) | \
>  					 (1ULL <<
> VHOST_USER_PROTOCOL_F_HOST_NOTIFIER) | \
>  					 (1ULL << VHOST_USER_PROTOCOL_F_PAGEFAULT) |
> \
>  					 (1ULL << VHOST_USER_PROTOCOL_F_STATUS))
> @@ -47,7 +47,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_BACKEND_REQ_FD = 21,
>  	VHOST_USER_IOTLB_MSG = 22,
>  	VHOST_USER_GET_CONFIG = 24,
>  	VHOST_USER_SET_CONFIG = 25,
> @@ -63,10 +63,10 @@ typedef enum VhostUserRequest {
>  } 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_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;
> 
>  typedef struct VhostUserMemoryRegion {
> --
> 2.31.1

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH v2 2/2] vhost: refactor to follow new naming convention
  2023-03-09  5:16 ` [PATCH v2 2/2] vhost: refactor " Nobuhiro MIKI
@ 2023-03-09  5:36   ` Xia, Chenbo
  2023-03-09 16:33   ` Maxime Coquelin
  1 sibling, 0 replies; 8+ messages in thread
From: Xia, Chenbo @ 2023-03-09  5:36 UTC (permalink / raw)
  To: Nobuhiro MIKI, maxime.coquelin; +Cc: dev, stephen

> -----Original Message-----
> From: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
> Sent: Thursday, March 9, 2023 1:17 PM
> To: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>
> Cc: dev@dpdk.org; stephen@networkplumber.org; Nobuhiro MIKI <nmiki@yahoo-
> corp.jp>
> Subject: [PATCH v2 2/2] vhost: refactor to follow new naming convention
> 
> Simply replace 'master' with 'frontend' and 'slave' with 'backend'.
> 
> Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  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

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/2] vhost: fix constants to follow new naming convention
  2023-03-09  5:16 ` [PATCH v2 1/2] vhost: fix constants " Nobuhiro MIKI
  2023-03-09  5:36   ` Xia, Chenbo
@ 2023-03-09 16:33   ` Maxime Coquelin
  1 sibling, 0 replies; 8+ messages in thread
From: Maxime Coquelin @ 2023-03-09 16:33 UTC (permalink / raw)
  To: Nobuhiro MIKI, chenbo.xia; +Cc: dev, stephen



On 3/9/23 06:16, Nobuhiro MIKI wrote:
> DPDK apps (e.g. dpdk-skeleton) output this name
> during negotiation. But, it is not consistent when
> debugging using QEMU as a front-end, for example.
> This is because QEMU already follows new naming convention [1].
> 
> Some type names and variable names, such as VhostUserSlaveRequest,
> are still in old naming convention. But, in this patch we
> only focus on constants.
> 
> [1] https://qemu-project.gitlab.io/qemu/interop/vhost-user.html
> 
> Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>   .mailmap                        |  2 +-
>   drivers/vdpa/ifc/ifcvf_vdpa.c   |  4 ++--
>   drivers/vdpa/mlx5/mlx5_vdpa.c   |  4 ++--
>   drivers/vdpa/sfc/sfc_vdpa_ops.c |  4 ++--
>   lib/vhost/rte_vhost.h           |  8 ++++----
>   lib/vhost/vhost_user.c          | 14 +++++++-------
>   lib/vhost/vhost_user.h          | 14 +++++++-------
>   7 files changed, 25 insertions(+), 25 deletions(-)
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] vhost: refactor to follow new naming convention
  2023-03-09  5:16 ` [PATCH v2 2/2] vhost: refactor " Nobuhiro MIKI
  2023-03-09  5:36   ` Xia, Chenbo
@ 2023-03-09 16:33   ` Maxime Coquelin
  1 sibling, 0 replies; 8+ messages in thread
From: Maxime Coquelin @ 2023-03-09 16:33 UTC (permalink / raw)
  To: Nobuhiro MIKI, chenbo.xia; +Cc: dev, stephen



On 3/9/23 06:16, Nobuhiro MIKI wrote:
> Simply replace 'master' with 'frontend' and 'slave' with 'backend'.
> 
> Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>   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(-)
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/2] vhost: fix names to follow new naming convention
  2023-03-09  5:16 [PATCH v2 0/2] vhost: fix names to follow new naming convention Nobuhiro MIKI
  2023-03-09  5:16 ` [PATCH v2 1/2] vhost: fix constants " Nobuhiro MIKI
  2023-03-09  5:16 ` [PATCH v2 2/2] vhost: refactor " Nobuhiro MIKI
@ 2023-03-16 14:47 ` Maxime Coquelin
  2 siblings, 0 replies; 8+ messages in thread
From: Maxime Coquelin @ 2023-03-16 14:47 UTC (permalink / raw)
  To: Nobuhiro MIKI, chenbo.xia; +Cc: dev, stephen



On 3/9/23 06:16, Nobuhiro MIKI wrote:
> In this series, we simply replace 'master' with 'frontend' and
> 'slave' with 'backend' so that vhost user protocol message,
> protocol names follow the new naming conventions.
> 
> v2:
> - Update .mailmap in patch 1
> - Replace 'master' with 'frontend' in patch 2
> 
> Nobuhiro MIKI (2):
>    vhost: fix constants to follow new naming convention
>    vhost: refactor to follow new naming convention
> 
>   .mailmap                        |  2 +-
>   drivers/vdpa/ifc/ifcvf_vdpa.c   |  6 +--
>   drivers/vdpa/mlx5/mlx5_vdpa.c   |  4 +-
>   drivers/vdpa/sfc/sfc_vdpa_ops.c |  4 +-
>   lib/vhost/rte_vhost.h           | 16 +++---
>   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          | 90 ++++++++++++++++-----------------
>   lib/vhost/vhost_user.h          | 22 ++++----
>   11 files changed, 78 insertions(+), 78 deletions(-)
> 

Applied to dpdk-next-virtio/main.

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-03-16 14:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-09  5:16 [PATCH v2 0/2] vhost: fix names to follow new naming convention Nobuhiro MIKI
2023-03-09  5:16 ` [PATCH v2 1/2] vhost: fix constants " Nobuhiro MIKI
2023-03-09  5:36   ` Xia, Chenbo
2023-03-09 16:33   ` Maxime Coquelin
2023-03-09  5:16 ` [PATCH v2 2/2] vhost: refactor " Nobuhiro MIKI
2023-03-09  5:36   ` Xia, Chenbo
2023-03-09 16:33   ` Maxime Coquelin
2023-03-16 14:47 ` [PATCH v2 0/2] vhost: fix names " Maxime Coquelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).