DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nikolay Nikolaev <nicknickolaev@gmail.com>
To: maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 1/5] vhost: unify VhostUserMsg usage
Date: Thu, 19 Jul 2018 22:13:27 +0300	[thread overview]
Message-ID: <153202760738.21481.2953475302358332226.stgit@T460> (raw)
In-Reply-To: <153202755842.21481.1772155561595981441.stgit@T460>

Use the typedef version of struct VhostUserMsg. Also unify the related
parameter name.

Signed-off-by: Nikolay Nikolaev <nicknickolaev@gmail.com>
---
 lib/librte_vhost/vhost_user.c |   50 +++++++++++++++++++++--------------------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index dc53ff712..d51616695 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -778,10 +778,10 @@ vhost_memory_changed(struct VhostUserMemory *new,
 }
 
 static int
-vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *pmsg)
+vhost_user_set_mem_table(struct virtio_net **pdev, VhostUserMsg *msg)
 {
 	struct virtio_net *dev = *pdev;
-	struct VhostUserMemory memory = pmsg->payload.memory;
+	struct VhostUserMemory memory = msg->payload.memory;
 	struct rte_vhost_mem_region *reg;
 	void *mmap_addr;
 	uint64_t mmap_size;
@@ -802,7 +802,7 @@ vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *pmsg)
 			"(%d) memory regions not changed\n", dev->vid);
 
 		for (i = 0; i < memory.nregions; i++)
-			close(pmsg->fds[i]);
+			close(msg->fds[i]);
 
 		return 0;
 	}
@@ -838,7 +838,7 @@ vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *pmsg)
 	dev->mem->nregions = memory.nregions;
 
 	for (i = 0; i < memory.nregions; i++) {
-		fd  = pmsg->fds[i];
+		fd  = msg->fds[i];
 		reg = &dev->mem->regions[i];
 
 		reg->guest_phys_addr = memory.regions[i].guest_phys_addr;
@@ -987,16 +987,16 @@ virtio_is_ready(struct virtio_net *dev)
 }
 
 static void
-vhost_user_set_vring_call(struct virtio_net *dev, struct VhostUserMsg *pmsg)
+vhost_user_set_vring_call(struct virtio_net *dev, VhostUserMsg *msg)
 {
 	struct vhost_vring_file file;
 	struct vhost_virtqueue *vq;
 
-	file.index = pmsg->payload.u64 & VHOST_USER_VRING_IDX_MASK;
-	if (pmsg->payload.u64 & VHOST_USER_VRING_NOFD_MASK)
+	file.index = msg->payload.u64 & VHOST_USER_VRING_IDX_MASK;
+	if (msg->payload.u64 & VHOST_USER_VRING_NOFD_MASK)
 		file.fd = VIRTIO_INVALID_EVENTFD;
 	else
-		file.fd = pmsg->fds[0];
+		file.fd = msg->fds[0];
 	RTE_LOG(INFO, VHOST_CONFIG,
 		"vring call idx:%d file:%d\n", file.index, file.fd);
 
@@ -1008,17 +1008,17 @@ vhost_user_set_vring_call(struct virtio_net *dev, struct VhostUserMsg *pmsg)
 }
 
 static void
-vhost_user_set_vring_kick(struct virtio_net **pdev, struct VhostUserMsg *pmsg)
+vhost_user_set_vring_kick(struct virtio_net **pdev, VhostUserMsg *msg)
 {
 	struct vhost_vring_file file;
 	struct vhost_virtqueue *vq;
 	struct virtio_net *dev = *pdev;
 
-	file.index = pmsg->payload.u64 & VHOST_USER_VRING_IDX_MASK;
-	if (pmsg->payload.u64 & VHOST_USER_VRING_NOFD_MASK)
+	file.index = msg->payload.u64 & VHOST_USER_VRING_IDX_MASK;
+	if (msg->payload.u64 & VHOST_USER_VRING_NOFD_MASK)
 		file.fd = VIRTIO_INVALID_EVENTFD;
 	else
-		file.fd = pmsg->fds[0];
+		file.fd = msg->fds[0];
 	RTE_LOG(INFO, VHOST_CONFIG,
 		"vring kick idx:%d file:%d\n", file.index, file.fd);
 
@@ -1145,7 +1145,7 @@ vhost_user_set_vring_enable(struct virtio_net *dev,
 
 static void
 vhost_user_get_protocol_features(struct virtio_net *dev,
-				 struct VhostUserMsg *msg)
+				 VhostUserMsg *msg)
 {
 	uint64_t features, protocol_features;
 
@@ -1176,7 +1176,7 @@ vhost_user_set_protocol_features(struct virtio_net *dev,
 }
 
 static int
-vhost_user_set_log_base(struct virtio_net *dev, struct VhostUserMsg *msg)
+vhost_user_set_log_base(struct virtio_net *dev, VhostUserMsg *msg)
 {
 	int fd = msg->fds[0];
 	uint64_t size, off;
@@ -1243,7 +1243,7 @@ vhost_user_set_log_base(struct virtio_net *dev, struct VhostUserMsg *msg)
  * a flag 'broadcast_rarp' to let rte_vhost_dequeue_burst() inject it.
  */
 static int
-vhost_user_send_rarp(struct virtio_net *dev, struct VhostUserMsg *msg)
+vhost_user_send_rarp(struct virtio_net *dev, VhostUserMsg *msg)
 {
 	uint8_t *mac = (uint8_t *)&msg->payload.u64;
 	struct rte_vdpa_device *vdpa_dev;
@@ -1272,7 +1272,7 @@ vhost_user_send_rarp(struct virtio_net *dev, struct VhostUserMsg *msg)
 }
 
 static int
-vhost_user_net_set_mtu(struct virtio_net *dev, struct VhostUserMsg *msg)
+vhost_user_net_set_mtu(struct virtio_net *dev, VhostUserMsg *msg)
 {
 	if (msg->payload.u64 < VIRTIO_MIN_MTU ||
 			msg->payload.u64 > VIRTIO_MAX_MTU) {
@@ -1288,7 +1288,7 @@ vhost_user_net_set_mtu(struct virtio_net *dev, struct VhostUserMsg *msg)
 }
 
 static int
-vhost_user_set_req_fd(struct virtio_net *dev, struct VhostUserMsg *msg)
+vhost_user_set_req_fd(struct virtio_net *dev, VhostUserMsg *msg)
 {
 	int fd = msg->fds[0];
 
@@ -1354,7 +1354,7 @@ is_vring_iotlb_invalidate(struct vhost_virtqueue *vq,
 }
 
 static int
-vhost_user_iotlb_msg(struct virtio_net **pdev, struct VhostUserMsg *msg)
+vhost_user_iotlb_msg(struct virtio_net **pdev, VhostUserMsg *msg)
 {
 	struct virtio_net *dev = *pdev;
 	struct vhost_iotlb_msg *imsg = &msg->payload.iotlb;
@@ -1400,7 +1400,7 @@ vhost_user_iotlb_msg(struct virtio_net **pdev, struct VhostUserMsg *msg)
 
 /* return bytes# of read on success or negative val on failure. */
 static int
-read_vhost_message(int sockfd, struct VhostUserMsg *msg)
+read_vhost_message(int sockfd, VhostUserMsg *msg)
 {
 	int ret;
 
@@ -1429,7 +1429,7 @@ read_vhost_message(int sockfd, struct VhostUserMsg *msg)
 }
 
 static int
-send_vhost_message(int sockfd, struct VhostUserMsg *msg, int *fds, int fd_num)
+send_vhost_message(int sockfd, VhostUserMsg *msg, int *fds, int fd_num)
 {
 	if (!msg)
 		return 0;
@@ -1439,7 +1439,7 @@ send_vhost_message(int sockfd, struct VhostUserMsg *msg, int *fds, int fd_num)
 }
 
 static int
-send_vhost_reply(int sockfd, struct VhostUserMsg *msg)
+send_vhost_reply(int sockfd, VhostUserMsg *msg)
 {
 	if (!msg)
 		return 0;
@@ -1453,7 +1453,7 @@ send_vhost_reply(int sockfd, struct VhostUserMsg *msg)
 }
 
 static int
-send_vhost_slave_message(struct virtio_net *dev, struct VhostUserMsg *msg,
+send_vhost_slave_message(struct virtio_net *dev, VhostUserMsg *msg,
 			 int *fds, int fd_num)
 {
 	int ret;
@@ -1544,7 +1544,7 @@ int
 vhost_user_msg_handler(int vid, int fd)
 {
 	struct virtio_net *dev;
-	struct VhostUserMsg msg;
+	VhostUserMsg msg;
 	struct rte_vdpa_device *vdpa_dev;
 	int did = -1;
 	int ret;
@@ -1832,7 +1832,7 @@ int
 vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm)
 {
 	int ret;
-	struct VhostUserMsg msg = {
+	VhostUserMsg msg = {
 		.request.slave = VHOST_USER_SLAVE_IOTLB_MSG,
 		.flags = VHOST_USER_VERSION,
 		.size = sizeof(msg.payload.iotlb),
@@ -1862,7 +1862,7 @@ static int vhost_user_slave_set_vring_host_notifier(struct virtio_net *dev,
 	int *fdp = NULL;
 	size_t fd_num = 0;
 	int ret;
-	struct VhostUserMsg msg = {
+	VhostUserMsg msg = {
 		.request.slave = VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG,
 		.flags = VHOST_USER_VERSION | VHOST_USER_NEED_REPLY,
 		.size = sizeof(msg.payload.area),

  reply	other threads:[~2018-07-19 19:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-19 19:13 [dpdk-dev] [PATCH v2 0/5] vhost_user.c code cleanup Nikolay Nikolaev
2018-07-19 19:13 ` Nikolay Nikolaev [this message]
2018-09-10 15:04   ` [dpdk-dev] [PATCH v2 1/5] vhost: unify VhostUserMsg usage Maxime Coquelin
2018-07-19 19:13 ` [dpdk-dev] [PATCH v2 2/5] vhost: make message handling functions prepare the reply Nikolay Nikolaev
2018-09-10 15:08   ` Maxime Coquelin
2018-07-19 19:13 ` [dpdk-dev] [PATCH v2 3/5] vhost: handle unsupported message types in functions Nikolay Nikolaev
2018-09-10 15:15   ` Maxime Coquelin
2018-07-19 19:13 ` [dpdk-dev] [PATCH v2 4/5] vhost: unify message handling function signature Nikolay Nikolaev
2018-09-10 15:24   ` Maxime Coquelin
2018-07-19 19:13 ` [dpdk-dev] [PATCH v2 5/5] vhost: message handling implemented as a callback array Nikolay Nikolaev
2018-09-10 15:32   ` Maxime Coquelin
2018-09-10 16:09     ` Ilya Maximets
2018-09-10 16:43       ` Maxime Coquelin
2018-09-11  1:51         ` Tiwei Bie
2018-09-11  9:38 ` [dpdk-dev] [PATCH v2 0/5] vhost_user.c code cleanup Maxime Coquelin
2018-09-12 15:34   ` Nikolay Nikolaev

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=153202760738.21481.2953475302358332226.stgit@T460 \
    --to=nicknickolaev@gmail.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=tiwei.bie@intel.com \
    --cc=zhihong.wang@intel.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).