[dpdk-dev,2/3] vhost: support sending fds via send_vhost_message()

Message ID 20180306104327.14470-3-tiwei.bie@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply patch file failure

Commit Message

Tiwei Bie March 6, 2018, 10:43 a.m. UTC
  This function will be used to send fds to QEMU via slave channel.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 lib/librte_vhost/vhost_user.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Maxime Coquelin March 29, 2018, 12:23 p.m. UTC | #1
On 03/06/2018 11:43 AM, Tiwei Bie wrote:
> This function will be used to send fds to QEMU via slave channel.
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>

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

Thanks,
Maxime

> ---
>   lib/librte_vhost/vhost_user.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
> index 8b07b6c43..e3a1dfbfb 100644
> --- a/lib/librte_vhost/vhost_user.c
> +++ b/lib/librte_vhost/vhost_user.c
> @@ -1308,13 +1308,13 @@ read_vhost_message(int sockfd, struct VhostUserMsg *msg)
>   }
>   
>   static int
> -send_vhost_message(int sockfd, struct VhostUserMsg *msg)
> +send_vhost_message(int sockfd, struct VhostUserMsg *msg, int *fds, int fd_num)
>   {
>   	if (!msg)
>   		return 0;
>   
>   	return send_fd_message(sockfd, (char *)msg,
> -		VHOST_USER_HDR_SIZE + msg->size, NULL, 0);
> +		VHOST_USER_HDR_SIZE + msg->size, fds, fd_num);
>   }
>   
>   static int
> @@ -1328,7 +1328,7 @@ send_vhost_reply(int sockfd, struct VhostUserMsg *msg)
>   	msg->flags |= VHOST_USER_VERSION;
>   	msg->flags |= VHOST_USER_REPLY_MASK;
>   
> -	return send_vhost_message(sockfd, msg);
> +	return send_vhost_message(sockfd, msg, NULL, 0);
>   }
>   
>   /*
> @@ -1643,7 +1643,7 @@ vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm)
>   		},
>   	};
>   
> -	ret = send_vhost_message(dev->slave_req_fd, &msg);
> +	ret = send_vhost_message(dev->slave_req_fd, &msg, NULL, 0);
>   	if (ret < 0) {
>   		RTE_LOG(ERR, VHOST_CONFIG,
>   				"Failed to send IOTLB miss message (%d)\n",
>
  
Maxime Coquelin March 29, 2018, 12:27 p.m. UTC | #2
On 03/06/2018 11:43 AM, Tiwei Bie wrote:
> This function will be used to send fds to QEMU via slave channel.
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
>   lib/librte_vhost/vhost_user.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)

Applied to dpdk-next-virtio/master, so this is one less patch
to carry on when QEMU part will be accepted.

I'll apply patch 1 once you have provided more info on the reason of the
change, no need to resubmit patch 1, I'll reword the commit message with
your info.

Thanks,
Maxime
  

Patch

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 8b07b6c43..e3a1dfbfb 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -1308,13 +1308,13 @@  read_vhost_message(int sockfd, struct VhostUserMsg *msg)
 }
 
 static int
-send_vhost_message(int sockfd, struct VhostUserMsg *msg)
+send_vhost_message(int sockfd, struct VhostUserMsg *msg, int *fds, int fd_num)
 {
 	if (!msg)
 		return 0;
 
 	return send_fd_message(sockfd, (char *)msg,
-		VHOST_USER_HDR_SIZE + msg->size, NULL, 0);
+		VHOST_USER_HDR_SIZE + msg->size, fds, fd_num);
 }
 
 static int
@@ -1328,7 +1328,7 @@  send_vhost_reply(int sockfd, struct VhostUserMsg *msg)
 	msg->flags |= VHOST_USER_VERSION;
 	msg->flags |= VHOST_USER_REPLY_MASK;
 
-	return send_vhost_message(sockfd, msg);
+	return send_vhost_message(sockfd, msg, NULL, 0);
 }
 
 /*
@@ -1643,7 +1643,7 @@  vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm)
 		},
 	};
 
-	ret = send_vhost_message(dev->slave_req_fd, &msg);
+	ret = send_vhost_message(dev->slave_req_fd, &msg, NULL, 0);
 	if (ret < 0) {
 		RTE_LOG(ERR, VHOST_CONFIG,
 				"Failed to send IOTLB miss message (%d)\n",