Re: [PATCH 1/1] Drivers: hv: vmbus: enable VMBus protocol version 5.0

From: Stephen Hemminger
Date: Sun May 13 2018 - 13:24:29 EST


On Sat, 12 May 2018 02:30:33 -0700
kys@xxxxxxxxxxxxxxxxx wrote:

> int vmbus_post_msg(void *buffer, size_t buflen, bool can_sleep)
> {
> + struct vmbus_channel_message_header *hdr;
> union hv_connection_id conn_id;
> int ret = 0;
> int retries = 0;
> u32 usec = 1;
>
> conn_id.asu32 = 0;
> - conn_id.u.id = VMBUS_MESSAGE_CONNECTION_ID;
> + conn_id.u.id = vmbus_connection.msg_conn_id;
>
> /*
> * hv_post_message() can have transient failures because of
> @@ -372,6 +400,18 @@ int vmbus_post_msg(void *buffer, size_t buflen, bool can_sleep)
>
> switch (ret) {
> case HV_STATUS_INVALID_CONNECTION_ID:
> + /*
> + * See vmbus_negotiate_version(): VMBus protocol 5.0
> + * requires that we must use
> + * VMBUS_MESSAGE_CONNECTION_ID_4 for the Initiate
> + * Contact message, but on old hosts that only
> + * support VMBus protocol 4.0 or lower, here we get
> + * HV_STATUS_INVALID_CONNECTION_ID and we should
> + * return an error immediately without retrying.
> + */
> + hdr = (struct vmbus_channel_message_header *)buffer;

Hate to pick o the details, but buffer is void * so cast is not necessary here.