RE: [RFC PATCH 09/13] hv_sock: set VMADDR_CID_HOST in the hvs_remote_addr_init()
From: Dexuan Cui
Date: Thu Oct 03 2019 - 15:37:10 EST
> From: Stefano Garzarella <sgarzare@xxxxxxxxxx>
> Sent: Friday, September 27, 2019 4:27 AM
> To: netdev@xxxxxxxxxxxxxxx
> Cc: linux-hyperv@xxxxxxxxxxxxxxx; KY Srinivasan <kys@xxxxxxxxxxxxx>; Stefan
> Hajnoczi <stefanha@xxxxxxxxxx>; Sasha Levin <sashal@xxxxxxxxxx>;
> linux-kernel@xxxxxxxxxxxxxxx; kvm@xxxxxxxxxxxxxxx; David S. Miller
> <davem@xxxxxxxxxxxxx>; virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx; Stephen
> Hemminger <sthemmin@xxxxxxxxxxxxx>; Jason Wang
> <jasowang@xxxxxxxxxx>; Michael S. Tsirkin <mst@xxxxxxxxxx>; Haiyang
> Zhang <haiyangz@xxxxxxxxxxxxx>; Dexuan Cui <decui@xxxxxxxxxxxxx>;
> Jorgen Hansen <jhansen@xxxxxxxxxx>
> Subject: [RFC PATCH 09/13] hv_sock: set VMADDR_CID_HOST in the
> hvs_remote_addr_init()
>
> Remote peer is always the host, so we set VMADDR_CID_HOST as
> remote CID instead of VMADDR_CID_ANY.
>
> Signed-off-by: Stefano Garzarella <sgarzare@xxxxxxxxxx>
> ---
> net/vmw_vsock/hyperv_transport.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/vmw_vsock/hyperv_transport.c
> b/net/vmw_vsock/hyperv_transport.c
> index 4f47af2054dd..306310794522 100644
> --- a/net/vmw_vsock/hyperv_transport.c
> +++ b/net/vmw_vsock/hyperv_transport.c
> @@ -186,7 +186,8 @@ static void hvs_remote_addr_init(struct sockaddr_vm
> *remote,
> static u32 host_ephemeral_port = MIN_HOST_EPHEMERAL_PORT;
> struct sock *sk;
>
> - vsock_addr_init(remote, VMADDR_CID_ANY, VMADDR_PORT_ANY);
> + /* Remote peer is always the host */
> + vsock_addr_init(remote, VMADDR_CID_HOST, VMADDR_PORT_ANY);
>
> while (1) {
> /* Wrap around ? */
> --
Looks good to me, since hv_sock doesn't really use the CID in the
transport layer.
Reviewed-by: Dexuan Cui <decui@xxxxxxxxxxxxx>