From: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
To: maxime.coquelin@redhat.com, chenbo.xia@intel.com
Cc: dev@dpdk.org, Nobuhiro MIKI <nmiki@yahoo-corp.jp>
Subject: [PATCH 2/2] vhost: refactor to follow new naming convention
Date: Thu, 9 Mar 2023 11:07:21 +0900 [thread overview]
Message-ID: <20230309020721.22164-3-nmiki@yahoo-corp.jp> (raw)
In-Reply-To: <20230309020721.22164-1-nmiki@yahoo-corp.jp>
Simply replace '_slave_' with '_backend_'.
Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
---
drivers/vdpa/ifc/ifcvf_vdpa.c | 2 +-
lib/vhost/rte_vhost.h | 2 +-
lib/vhost/version.map | 2 +-
lib/vhost/vhost.c | 4 +--
lib/vhost/vhost.h | 4 +--
lib/vhost/vhost_user.c | 62 +++++++++++++++++------------------
lib/vhost/vhost_user.h | 6 ++--
7 files changed, 41 insertions(+), 41 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..cc2ec99c315c 100644
--- a/lib/vhost/rte_vhost.h
+++ b/lib/vhost/rte_vhost.h
@@ -1066,7 +1066,7 @@ rte_vhost_get_vdpa_device(int vid);
*/
__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_user.c b/lib/vhost/vhost_user.c
index cd4104ea5ce0..1ce1a5924f74 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -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) {
@@ -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;
}
@@ -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..cd8610129789 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;
@@ -137,7 +137,7 @@ struct vhost_user_config {
typedef struct VhostUserMsg {
union {
uint32_t master; /* a VhostUserRequest value */
- uint32_t slave; /* a VhostUserSlaveRequest value*/
+ uint32_t backend; /* a VhostUserBackendRequest value*/
} request;
#define VHOST_USER_VERSION_MASK 0x3
--
2.31.1
next prev parent reply other threads:[~2023-03-09 2:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-09 2:07 [PATCH 0/2] vhost: fix names " Nobuhiro MIKI
2023-03-09 2:07 ` [PATCH 1/2] vhost: fix constants to follow new naming convension Nobuhiro MIKI
2023-03-09 3:06 ` Xia, Chenbo
2023-03-09 2:07 ` Nobuhiro MIKI [this message]
2023-03-09 3:03 ` [PATCH 2/2] vhost: refactor to follow new naming convention Xia, Chenbo
2023-03-09 4:51 ` Nobuhiro MIKI
2023-03-09 2:40 ` [PATCH 0/2] vhost: fix names " Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230309020721.22164-3-nmiki@yahoo-corp.jp \
--to=nmiki@yahoo-corp.jp \
--cc=chenbo.xia@intel.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).