FreeBSD/sys/dev/hyperv/vmbus/hv_connection.c
/**
 * Send a msg on the vmbus's message connection
 */
Send a msg on the vmbus's message connection
Send a msg on the vmbus ' s message connection
int hv_vmbus_post_message(void *buffer, size_t bufferLen)
{
	hv_vmbus_connection_id connId;
	sbintime_t time = SBT_1MS;
	int retries;
	int ret;
	connId.as_uint32_t = 0;
	connId.u.id = HV_VMBUS_MESSAGE_CONNECTION_ID;
	for (retries = 0; retries < 20; retries++) {
		ret = hv_vmbus_post_msg_via_msg_ipc(connId,
		    VMBUS_MSGTYPE_CHANNEL, buffer, bufferLen);
		if (ret == HV_STATUS_SUCCESS)
			return (0);
		pause_sbt("pstmsg", time, 0, C_HARDCLOCK);
		if (time < SBT_1S * 2)
			time *= 2;
	}
	KASSERT(ret == HV_STATUS_SUCCESS,
		("Error VMBUS: Message Post Failed, ret=%d\n", ret));
	return (EAGAIN);
}
int hv_vmbus_post_message ( void * buffer , size_t bufferLen ) { hv_vmbus_connection_id connId ; sbintime_t time = SBT_1MS ; int retries ; int ret ; connId . as_uint32_t = 0 ; connId . u . id = HV_VMBUS_MESSAGE_CONNECTION_ID ; for ( retries = 0 ; retries < 20 ; retries ++ ) { ret = hv_vmbus_post_msg_via_msg_ipc ( connId , VMBUS_MSGTYPE_CHANNEL , buffer , bufferLen ) ; if ( ret == HV_STATUS_SUCCESS ) return ( 0 ) ; pause_sbt ( " " , time , 0 , C_HARDCLOCK ) ; if ( time < SBT_1S * 2 ) time *= 2 ; } KASSERT ( ret == HV_STATUS_SUCCESS , ( " \n " , ret ) ) ; return ( EAGAIN ) ; }
Send a msg on the vmbus's message connection
Send a msg on the vmbus ' s message connection
/*
	 * We retry to cope with transient failures caused by host side's
	 * insufficient resources. 20 times should suffice in practice.
	 */