Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c50f7fb2 authored by Haiyang Zhang's avatar Haiyang Zhang Committed by Greg Kroah-Hartman
Browse files

staging: hv: Convert camel cased struct fields in channel_mgmt.h to lower cases



staging: hv: Convert camel cased struct fields in channel_mgmt.h to lower cases

Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: default avatarHank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a32d4aca
Loading
Loading
Loading
Loading
+151 −151
Original line number Diff line number Diff line
@@ -74,21 +74,21 @@ static void vmbus_setevent(struct vmbus_channel *channel)
{
	struct hv_monitor_page *monitorpage;

	if (channel->OfferMsg.MonitorAllocated) {
	if (channel->offermsg.monitor_allocated) {
		/* Each u32 represents 32 channels */
		set_bit(channel->OfferMsg.ChildRelId & 31,
		set_bit(channel->offermsg.child_relid & 31,
			(unsigned long *) gVmbusConnection.SendInterruptPage +
			(channel->OfferMsg.ChildRelId >> 5));
			(channel->offermsg.child_relid >> 5));

		monitorpage = gVmbusConnection.MonitorPages;
		monitorpage++; /* Get the child to parent monitor page */

		set_bit(channel->MonitorBit,
		set_bit(channel->monitor_bit,
			(unsigned long *)&monitorpage->TriggerGroup
					[channel->MonitorGroup].Pending);
					[channel->monitor_grp].Pending);

	} else {
		VmbusSetEvent(channel->OfferMsg.ChildRelId);
		VmbusSetEvent(channel->offermsg.child_relid);
	}
}

@@ -97,19 +97,19 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel)
{
	struct hv_monitor_page *monitorPage;

	if (Channel->OfferMsg.MonitorAllocated) {
	if (Channel->offermsg.monitor_allocated) {
		/* Each u32 represents 32 channels */
		clear_bit(Channel->OfferMsg.ChildRelId & 31,
		clear_bit(Channel->offermsg.child_relid & 31,
			  (unsigned long *)gVmbusConnection.SendInterruptPage +
			  (Channel->OfferMsg.ChildRelId >> 5));
			  (Channel->offermsg.child_relid >> 5));

		monitorPage =
			(struct hv_monitor_page *)gVmbusConnection.MonitorPages;
		monitorPage++; /* Get the child to parent monitor page */

		clear_bit(Channel->MonitorBit,
		clear_bit(Channel->monitor_bit,
			  (unsigned long *)&monitorPage->TriggerGroup
					[Channel->MonitorGroup].Pending);
					[Channel->monitor_grp].Pending);
	}
}

@@ -121,42 +121,42 @@ void vmbus_get_debug_info(struct vmbus_channel *channel,
			      struct vmbus_channel_debug_info *debuginfo)
{
	struct hv_monitor_page *monitorpage;
	u8 monitor_group = (u8)channel->OfferMsg.MonitorId / 32;
	u8 monitor_offset = (u8)channel->OfferMsg.MonitorId % 32;
	u8 monitor_group = (u8)channel->offermsg.monitorid / 32;
	u8 monitor_offset = (u8)channel->offermsg.monitorid % 32;
	/* u32 monitorBit	= 1 << monitorOffset; */

	debuginfo->RelId = channel->OfferMsg.ChildRelId;
	debuginfo->State = channel->State;
	memcpy(&debuginfo->InterfaceType,
	       &channel->OfferMsg.Offer.InterfaceType, sizeof(struct hv_guid));
	memcpy(&debuginfo->InterfaceInstance,
	       &channel->OfferMsg.Offer.InterfaceInstance,
	debuginfo->relid = channel->offermsg.child_relid;
	debuginfo->state = channel->state;
	memcpy(&debuginfo->interfacetype,
	       &channel->offermsg.offer.InterfaceType, sizeof(struct hv_guid));
	memcpy(&debuginfo->interface_instance,
	       &channel->offermsg.offer.InterfaceInstance,
	       sizeof(struct hv_guid));

	monitorpage = (struct hv_monitor_page *)gVmbusConnection.MonitorPages;

	debuginfo->MonitorId = channel->OfferMsg.MonitorId;
	debuginfo->monitorid = channel->offermsg.monitorid;

	debuginfo->ServerMonitorPending =
	debuginfo->servermonitor_pending =
			monitorpage->TriggerGroup[monitor_group].Pending;
	debuginfo->ServerMonitorLatency =
	debuginfo->servermonitor_latency =
			monitorpage->Latency[monitor_group][monitor_offset];
	debuginfo->ServerMonitorConnectionId =
	debuginfo->servermonitor_connectionid =
			monitorpage->Parameter[monitor_group]
					[monitor_offset].ConnectionId.u.Id;

	monitorpage++;

	debuginfo->ClientMonitorPending =
	debuginfo->clientmonitor_pending =
			monitorpage->TriggerGroup[monitor_group].Pending;
	debuginfo->ClientMonitorLatency =
	debuginfo->clientmonitor_latency =
			monitorpage->Latency[monitor_group][monitor_offset];
	debuginfo->ClientMonitorConnectionId =
	debuginfo->clientmonitor_connectionid =
			monitorpage->Parameter[monitor_group]
					[monitor_offset].ConnectionId.u.Id;

	RingBufferGetDebugInfo(&channel->Inbound, &debuginfo->Inbound);
	RingBufferGetDebugInfo(&channel->Outbound, &debuginfo->Outbound);
	RingBufferGetDebugInfo(&channel->inbound, &debuginfo->inbound);
	RingBufferGetDebugInfo(&channel->outbound, &debuginfo->outbound);
}

/*
@@ -176,8 +176,8 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
	/* ASSERT(!(SendRingBufferSize & (PAGE_SIZE - 1))); */
	/* ASSERT(!(RecvRingBufferSize & (PAGE_SIZE - 1))); */

	newchannel->OnChannelCallback = onchannelcallback;
	newchannel->ChannelCallbackContext = context;
	newchannel->onchannel_callback = onchannelcallback;
	newchannel->channel_callback_context = context;

	/* Allocate the ring buffer */
	out = osd_PageAlloc((send_ringbuffer_size + recv_ringbuffer_size)
@@ -189,17 +189,17 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,

	in = (void *)((unsigned long)out + send_ringbuffer_size);

	newchannel->RingBufferPages = out;
	newchannel->RingBufferPageCount = (send_ringbuffer_size +
	newchannel->ringbuffer_pages = out;
	newchannel->ringbuffer_pagecount = (send_ringbuffer_size +
					   recv_ringbuffer_size) >> PAGE_SHIFT;

	ret = RingBufferInit(&newchannel->Outbound, out, send_ringbuffer_size);
	ret = RingBufferInit(&newchannel->outbound, out, send_ringbuffer_size);
	if (ret != 0) {
		err = ret;
		goto errorout;
	}

	ret = RingBufferInit(&newchannel->Inbound, in, recv_ringbuffer_size);
	ret = RingBufferInit(&newchannel->inbound, in, recv_ringbuffer_size);
	if (ret != 0) {
		err = ret;
		goto errorout;
@@ -210,13 +210,13 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
	DPRINT_DBG(VMBUS, "Establishing ring buffer's gpadl for channel %p...",
		   newchannel);

	newchannel->RingBufferGpadlHandle = 0;
	newchannel->ringbuffer_gpadlhandle = 0;

	ret = vmbus_establish_gpadl(newchannel,
					 newchannel->Outbound.RingBuffer,
					 newchannel->outbound.RingBuffer,
					 send_ringbuffer_size +
					 recv_ringbuffer_size,
					 &newchannel->RingBufferGpadlHandle);
					 &newchannel->ringbuffer_gpadlhandle);

	if (ret != 0) {
		err = ret;
@@ -225,12 +225,12 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,

	DPRINT_DBG(VMBUS, "channel %p <relid %d gpadl 0x%x send ring %p "
		   "size %d recv ring %p size %d, downstreamoffset %d>",
		   newchannel, newchannel->OfferMsg.ChildRelId,
		   newchannel->RingBufferGpadlHandle,
		   newchannel->Outbound.RingBuffer,
		   newchannel->Outbound.RingSize,
		   newchannel->Inbound.RingBuffer,
		   newchannel->Inbound.RingSize,
		   newchannel, newchannel->offermsg.child_relid,
		   newchannel->ringbuffer_gpadlhandle,
		   newchannel->outbound.RingBuffer,
		   newchannel->outbound.RingSize,
		   newchannel->inbound.RingBuffer,
		   newchannel->inbound.RingSize,
		   send_ringbuffer_size);

	/* Create and init the channel open message */
@@ -242,20 +242,20 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
		goto errorout;
	}

	openInfo->WaitEvent = osd_WaitEventCreate();
	if (!openInfo->WaitEvent) {
	openInfo->waitevent = osd_WaitEventCreate();
	if (!openInfo->waitevent) {
		err = -ENOMEM;
		goto errorout;
	}

	openMsg = (struct vmbus_channel_open_channel *)openInfo->Msg;
	openMsg->Header.MessageType = ChannelMessageOpenChannel;
	openMsg->OpenId = newchannel->OfferMsg.ChildRelId; /* FIXME */
	openMsg->ChildRelId = newchannel->OfferMsg.ChildRelId;
	openMsg->RingBufferGpadlHandle = newchannel->RingBufferGpadlHandle;
	openMsg->DownstreamRingBufferPageOffset = send_ringbuffer_size >>
	openMsg = (struct vmbus_channel_open_channel *)openInfo->msg;
	openMsg->header.msgtype = CHANNELMSG_OPENCHANNEL;
	openMsg->openid = newchannel->offermsg.child_relid; /* FIXME */
	openMsg->child_relid = newchannel->offermsg.child_relid;
	openMsg->ringbuffer_gpadlhandle = newchannel->ringbuffer_gpadlhandle;
	openMsg->downstream_ringbuffer_pageoffset = send_ringbuffer_size >>
						  PAGE_SHIFT;
	openMsg->ServerContextAreaGpadlHandle = 0; /* TODO */
	openMsg->server_contextarea_gpadlhandle = 0; /* TODO */

	if (userdatalen > MAX_USER_DEFINED_BYTES) {
		err = -EINVAL;
@@ -263,10 +263,10 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
	}

	if (userdatalen)
		memcpy(openMsg->UserData, userdata, userdatalen);
		memcpy(openMsg->userdata, userdata, userdatalen);

	spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
	list_add_tail(&openInfo->MsgListEntry,
	list_add_tail(&openInfo->msglistentry,
		      &gVmbusConnection.ChannelMsgList);
	spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);

@@ -280,26 +280,26 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
	}

	/* FIXME: Need to time-out here */
	osd_WaitEventWait(openInfo->WaitEvent);
	osd_WaitEventWait(openInfo->waitevent);

	if (openInfo->Response.OpenResult.Status == 0)
	if (openInfo->response.open_result.status == 0)
		DPRINT_INFO(VMBUS, "channel <%p> open success!!", newchannel);
	else
		DPRINT_INFO(VMBUS, "channel <%p> open failed - %d!!",
			    newchannel, openInfo->Response.OpenResult.Status);
			    newchannel, openInfo->response.open_result.status);

Cleanup:
	spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
	list_del(&openInfo->MsgListEntry);
	list_del(&openInfo->msglistentry);
	spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);

	kfree(openInfo->WaitEvent);
	kfree(openInfo->waitevent);
	kfree(openInfo);
	return 0;

errorout:
	RingBufferCleanup(&newchannel->Outbound);
	RingBufferCleanup(&newchannel->Inbound);
	RingBufferCleanup(&newchannel->outbound);
	RingBufferCleanup(&newchannel->inbound);
	osd_PageFree(out, (send_ringbuffer_size + recv_ringbuffer_size)
		     >> PAGE_SHIFT);
	kfree(openInfo);
@@ -322,7 +322,7 @@ static void dump_gpadl_body(struct vmbus_channel_gpadl_body *gpadl, u32 len)

	for (i = 0; i < pfncount; i++)
		DPRINT_DBG(VMBUS, "gpadl body  - %d) pfn %llu",
			   i, gpadl->Pfn[i]);
			   i, gpadl->pfn[i]);
}

/*
@@ -336,18 +336,18 @@ static void dump_gpadl_header(struct vmbus_channel_gpadl_header *gpadl)

	DPRINT_DBG(VMBUS,
		   "gpadl header - relid %d, range count %d, range buflen %d",
		   gpadl->ChildRelId, gpadl->RangeCount, gpadl->RangeBufLen);
	for (i = 0; i < gpadl->RangeCount; i++) {
		pagecount = gpadl->Range[i].ByteCount >> PAGE_SHIFT;
		   gpadl->child_relid, gpadl->rangecount, gpadl->range_buflen);
	for (i = 0; i < gpadl->rangecount; i++) {
		pagecount = gpadl->range[i].ByteCount >> PAGE_SHIFT;
		pagecount = (pagecount > 26) ? 26 : pagecount;

		DPRINT_DBG(VMBUS, "gpadl range %d - len %d offset %d "
			   "page count %d", i, gpadl->Range[i].ByteCount,
			   gpadl->Range[i].ByteOffset, pagecount);
			   "page count %d", i, gpadl->range[i].ByteCount,
			   gpadl->range[i].ByteOffset, pagecount);

		for (j = 0; j < pagecount; j++)
			DPRINT_DBG(VMBUS, "%d) pfn %llu", j,
				   gpadl->Range[i].PfnArray[j]);
				   gpadl->range[i].PfnArray[j]);
	}
}

@@ -391,18 +391,18 @@ static int create_gpadl_header(void *kbuffer, u32 size,
		if (!msgheader)
			goto nomem;

		INIT_LIST_HEAD(&msgheader->SubMsgList);
		msgheader->MessageSize = msgsize;
		INIT_LIST_HEAD(&msgheader->submsglist);
		msgheader->msgsize = msgsize;

		gpadl_header = (struct vmbus_channel_gpadl_header *)
			msgheader->Msg;
		gpadl_header->RangeCount = 1;
		gpadl_header->RangeBufLen = sizeof(struct gpa_range) +
			msgheader->msg;
		gpadl_header->rangecount = 1;
		gpadl_header->range_buflen = sizeof(struct gpa_range) +
					 pagecount * sizeof(u64);
		gpadl_header->Range[0].ByteOffset = 0;
		gpadl_header->Range[0].ByteCount = size;
		gpadl_header->range[0].ByteOffset = 0;
		gpadl_header->range[0].ByteCount = size;
		for (i = 0; i < pfncount; i++)
			gpadl_header->Range[0].PfnArray[i] = pfn+i;
			gpadl_header->range[0].PfnArray[i] = pfn+i;
		*msginfo = msgheader;
		*messagecount = 1;

@@ -428,10 +428,10 @@ static int create_gpadl_header(void *kbuffer, u32 size,
			/* FIXME: we probably need to more if this fails */
			if (!msgbody)
				goto nomem;
			msgbody->MessageSize = msgsize;
			msgbody->msgsize = msgsize;
			(*messagecount)++;
			gpadl_body =
				(struct vmbus_channel_gpadl_body *)msgbody->Msg;
				(struct vmbus_channel_gpadl_body *)msgbody->msg;

			/*
			 * FIXME:
@@ -440,11 +440,11 @@ static int create_gpadl_header(void *kbuffer, u32 size,
			 */
			/* gpadl_body->Gpadl = kbuffer; */
			for (i = 0; i < pfncurr; i++)
				gpadl_body->Pfn[i] = pfn + pfnsum + i;
				gpadl_body->pfn[i] = pfn + pfnsum + i;

			/* add to msg header */
			list_add_tail(&msgbody->MsgListEntry,
				      &msgheader->SubMsgList);
			list_add_tail(&msgbody->msglistentry,
				      &msgheader->submsglist);
			pfnsum += pfncurr;
			pfnleft -= pfncurr;
		}
@@ -456,17 +456,17 @@ static int create_gpadl_header(void *kbuffer, u32 size,
		msgheader = kzalloc(msgsize, GFP_KERNEL);
		if (msgheader == NULL)
			goto nomem;
		msgheader->MessageSize = msgsize;
		msgheader->msgsize = msgsize;

		gpadl_header = (struct vmbus_channel_gpadl_header *)
			msgheader->Msg;
		gpadl_header->RangeCount = 1;
		gpadl_header->RangeBufLen = sizeof(struct gpa_range) +
			msgheader->msg;
		gpadl_header->rangecount = 1;
		gpadl_header->range_buflen = sizeof(struct gpa_range) +
					 pagecount * sizeof(u64);
		gpadl_header->Range[0].ByteOffset = 0;
		gpadl_header->Range[0].ByteCount = size;
		gpadl_header->range[0].ByteOffset = 0;
		gpadl_header->range[0].ByteCount = size;
		for (i = 0; i < pagecount; i++)
			gpadl_header->Range[0].PfnArray[i] = pfn+i;
			gpadl_header->range[0].PfnArray[i] = pfn+i;

		*msginfo = msgheader;
		*messagecount = 1;
@@ -508,21 +508,21 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
	if (ret)
		return ret;

	msginfo->WaitEvent = osd_WaitEventCreate();
	if (!msginfo->WaitEvent) {
	msginfo->waitevent = osd_WaitEventCreate();
	if (!msginfo->waitevent) {
		ret = -ENOMEM;
		goto Cleanup;
	}

	gpadlmsg = (struct vmbus_channel_gpadl_header *)msginfo->Msg;
	gpadlmsg->Header.MessageType = ChannelMessageGpadlHeader;
	gpadlmsg->ChildRelId = channel->OfferMsg.ChildRelId;
	gpadlmsg->Gpadl = next_gpadl_handle;
	gpadlmsg = (struct vmbus_channel_gpadl_header *)msginfo->msg;
	gpadlmsg->header.msgtype = CHANNELMSG_GPADL_HEADER;
	gpadlmsg->child_relid = channel->offermsg.child_relid;
	gpadlmsg->gpadl = next_gpadl_handle;

	dump_gpadl_header(gpadlmsg);

	spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
	list_add_tail(&msginfo->MsgListEntry,
	list_add_tail(&msginfo->msglistentry,
		      &gVmbusConnection.ChannelMsgList);

	spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
@@ -530,9 +530,9 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
		   kbuffer, size, msgcount);

	DPRINT_DBG(VMBUS, "Sending GPADL Header - len %zd",
		   msginfo->MessageSize - sizeof(*msginfo));
		   msginfo->msgsize - sizeof(*msginfo));

	ret = VmbusPostMessage(gpadlmsg, msginfo->MessageSize -
	ret = VmbusPostMessage(gpadlmsg, msginfo->msgsize -
			       sizeof(*msginfo));
	if (ret != 0) {
		DPRINT_ERR(VMBUS, "Unable to open channel - %d", ret);
@@ -540,48 +540,48 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
	}

	if (msgcount > 1) {
		list_for_each(curr, &msginfo->SubMsgList) {
		list_for_each(curr, &msginfo->submsglist) {

			/* FIXME: should this use list_entry() instead ? */
			submsginfo = (struct vmbus_channel_msginfo *)curr;
			gpadl_body =
			     (struct vmbus_channel_gpadl_body *)submsginfo->Msg;
			     (struct vmbus_channel_gpadl_body *)submsginfo->msg;

			gpadl_body->Header.MessageType =
				ChannelMessageGpadlBody;
			gpadl_body->Gpadl = next_gpadl_handle;
			gpadl_body->header.msgtype =
				CHANNELMSG_GPADL_BODY;
			gpadl_body->gpadl = next_gpadl_handle;

			DPRINT_DBG(VMBUS, "Sending GPADL Body - len %zd",
				   submsginfo->MessageSize -
				   submsginfo->msgsize -
				   sizeof(*submsginfo));

			dump_gpadl_body(gpadl_body, submsginfo->MessageSize -
			dump_gpadl_body(gpadl_body, submsginfo->msgsize -
				      sizeof(*submsginfo));
			ret = VmbusPostMessage(gpadl_body,
					       submsginfo->MessageSize -
					       submsginfo->msgsize -
					       sizeof(*submsginfo));
			if (ret != 0)
				goto Cleanup;

		}
	}
	osd_WaitEventWait(msginfo->WaitEvent);
	osd_WaitEventWait(msginfo->waitevent);

	/* At this point, we received the gpadl created msg */
	DPRINT_DBG(VMBUS, "Received GPADL created "
		   "(relid %d, status %d handle %x)",
		   channel->OfferMsg.ChildRelId,
		   msginfo->Response.GpadlCreated.CreationStatus,
		   gpadlmsg->Gpadl);
		   channel->offermsg.child_relid,
		   msginfo->response.gpadl_created.creation_status,
		   gpadlmsg->gpadl);

	*gpadl_handle = gpadlmsg->Gpadl;
	*gpadl_handle = gpadlmsg->gpadl;

Cleanup:
	spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
	list_del(&msginfo->MsgListEntry);
	list_del(&msginfo->msglistentry);
	spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);

	kfree(msginfo->WaitEvent);
	kfree(msginfo->waitevent);
	kfree(msginfo);
	return ret;
}
@@ -604,20 +604,20 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
	if (!info)
		return -ENOMEM;

	info->WaitEvent = osd_WaitEventCreate();
	if (!info->WaitEvent) {
	info->waitevent = osd_WaitEventCreate();
	if (!info->waitevent) {
		kfree(info);
		return -ENOMEM;
	}

	msg = (struct vmbus_channel_gpadl_teardown *)info->Msg;
	msg = (struct vmbus_channel_gpadl_teardown *)info->msg;

	msg->Header.MessageType = ChannelMessageGpadlTeardown;
	msg->ChildRelId = channel->OfferMsg.ChildRelId;
	msg->Gpadl = gpadl_handle;
	msg->header.msgtype = CHANNELMSG_GPADL_TEARDOWN;
	msg->child_relid = channel->offermsg.child_relid;
	msg->gpadl = gpadl_handle;

	spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
	list_add_tail(&info->MsgListEntry,
	list_add_tail(&info->msglistentry,
		      &gVmbusConnection.ChannelMsgList);
	spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);

@@ -628,14 +628,14 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
		/* something... */
	}

	osd_WaitEventWait(info->WaitEvent);
	osd_WaitEventWait(info->waitevent);

	/* Received a torndown response */
	spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
	list_del(&info->MsgListEntry);
	list_del(&info->msglistentry);
	spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);

	kfree(info->WaitEvent);
	kfree(info->waitevent);
	kfree(info);
	return ret;
}
@@ -652,7 +652,7 @@ void vmbus_close(struct vmbus_channel *channel)
	int ret;

	/* Stop callback and cancel the timer asap */
	channel->OnChannelCallback = NULL;
	channel->onchannel_callback = NULL;
	del_timer_sync(&channel->poll_timer);

	/* Send a closing message */
@@ -665,9 +665,9 @@ void vmbus_close(struct vmbus_channel *channel)

	/* info->waitEvent = osd_WaitEventCreate(); */

	msg = (struct vmbus_channel_close_channel *)info->Msg;
	msg->Header.MessageType = ChannelMessageCloseChannel;
	msg->ChildRelId = channel->OfferMsg.ChildRelId;
	msg = (struct vmbus_channel_close_channel *)info->msg;
	msg->header.msgtype = CHANNELMSG_CLOSECHANNEL;
	msg->child_relid = channel->offermsg.child_relid;

	ret = VmbusPostMessage(msg, sizeof(struct vmbus_channel_close_channel));
	if (ret != 0) {
@@ -676,17 +676,17 @@ void vmbus_close(struct vmbus_channel *channel)
	}

	/* Tear down the gpadl for the channel's ring buffer */
	if (channel->RingBufferGpadlHandle)
	if (channel->ringbuffer_gpadlhandle)
		vmbus_teardown_gpadl(channel,
					  channel->RingBufferGpadlHandle);
					  channel->ringbuffer_gpadlhandle);

	/* TODO: Send a msg to release the childRelId */

	/* Cleanup the ring buffers for this channel */
	RingBufferCleanup(&channel->Outbound);
	RingBufferCleanup(&channel->Inbound);
	RingBufferCleanup(&channel->outbound);
	RingBufferCleanup(&channel->inbound);

	osd_PageFree(channel->RingBufferPages, channel->RingBufferPageCount);
	osd_PageFree(channel->ringbuffer_pages, channel->ringbuffer_pagecount);

	kfree(info);

@@ -696,9 +696,9 @@ void vmbus_close(struct vmbus_channel *channel)
	 * caller will free the channel
	 */

	if (channel->State == CHANNEL_OPEN_STATE) {
	if (channel->state == CHANNEL_OPEN_STATE) {
		spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
		list_del(&channel->ListEntry);
		list_del(&channel->listentry);
		spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);

		free_channel(channel);
@@ -752,10 +752,10 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer,
	sg_set_buf(&bufferlist[2], &aligned_data,
		   packetlen_aligned - packetlen);

	ret = RingBufferWrite(&channel->Outbound, bufferlist, 3);
	ret = RingBufferWrite(&channel->outbound, bufferlist, 3);

	/* TODO: We should determine if this is optional */
	if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound))
	if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound))
		vmbus_setevent(channel);

	return ret;
@@ -817,10 +817,10 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
	sg_set_buf(&bufferlist[2], &aligned_data,
		packetlen_aligned - packetlen);

	ret = RingBufferWrite(&channel->Outbound, bufferlist, 3);
	ret = RingBufferWrite(&channel->outbound, bufferlist, 3);

	/* TODO: We should determine if this is optional */
	if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound))
	if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound))
		vmbus_setevent(channel);

	return ret;
@@ -886,10 +886,10 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,
	sg_set_buf(&bufferlist[2], &aligned_data,
		packetlen_aligned - packetlen);

	ret = RingBufferWrite(&channel->Outbound, bufferlist, 3);
	ret = RingBufferWrite(&channel->outbound, bufferlist, 3);

	/* TODO: We should determine if this is optional */
	if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound))
	if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound))
		vmbus_setevent(channel);

	return ret;
@@ -923,7 +923,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer,

	spin_lock_irqsave(&channel->inbound_lock, flags);

	ret = RingBufferPeek(&channel->Inbound, &desc,
	ret = RingBufferPeek(&channel->inbound, &desc,
			     sizeof(struct vmpacket_descriptor));
	if (ret != 0) {
		spin_unlock_irqrestore(&channel->inbound_lock, flags);
@@ -940,7 +940,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer,

	DPRINT_DBG(VMBUS, "packet received on channel %p relid %d <type %d "
		   "flag %d tid %llx pktlen %d datalen %d> ",
		   channel, channel->OfferMsg.ChildRelId, desc.Type,
		   channel, channel->offermsg.child_relid, desc.Type,
		   desc.Flags, desc.TransactionId, packetlen, userlen);

	*buffer_actual_len = userlen;
@@ -956,7 +956,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer,
	*requestid = desc.TransactionId;

	/* Copy over the packet to the user buffer */
	ret = RingBufferRead(&channel->Inbound, buffer, userlen,
	ret = RingBufferRead(&channel->inbound, buffer, userlen,
			     (desc.DataOffset8 << 3));

	spin_unlock_irqrestore(&channel->inbound_lock, flags);
@@ -983,7 +983,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer,

	spin_lock_irqsave(&channel->inbound_lock, flags);

	ret = RingBufferPeek(&channel->Inbound, &desc,
	ret = RingBufferPeek(&channel->inbound, &desc,
			     sizeof(struct vmpacket_descriptor));
	if (ret != 0) {
		spin_unlock_irqrestore(&channel->inbound_lock, flags);
@@ -999,7 +999,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer,

	DPRINT_DBG(VMBUS, "packet received on channel %p relid %d <type %d "
		   "flag %d tid %llx pktlen %d datalen %d> ",
		   channel, channel->OfferMsg.ChildRelId, desc.Type,
		   channel, channel->offermsg.child_relid, desc.Type,
		   desc.Flags, desc.TransactionId, packetlen, userlen);

	*buffer_actual_len = packetlen;
@@ -1015,7 +1015,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer,
	*requestid = desc.TransactionId;

	/* Copy over the entire packet to the user buffer */
	ret = RingBufferRead(&channel->Inbound, buffer, packetlen, 0);
	ret = RingBufferRead(&channel->inbound, buffer, packetlen, 0);

	spin_unlock_irqrestore(&channel->inbound_lock, flags);
	return 0;
@@ -1030,7 +1030,7 @@ void vmbus_onchannel_event(struct vmbus_channel *channel)
	dump_vmbus_channel(channel);
	/* ASSERT(Channel->OnChannelCallback); */

	channel->OnChannelCallback(channel->ChannelCallbackContext);
	channel->onchannel_callback(channel->channel_callback_context);

	mod_timer(&channel->poll_timer, jiffies + usecs_to_jiffies(100));
}
@@ -1042,8 +1042,8 @@ void vmbus_ontimer(unsigned long data)
{
	struct vmbus_channel *channel = (struct vmbus_channel *)data;

	if (channel->OnChannelCallback)
		channel->OnChannelCallback(channel->ChannelCallbackContext);
	if (channel->onchannel_callback)
		channel->onchannel_callback(channel->channel_callback_context);
}

/*
@@ -1051,7 +1051,7 @@ void vmbus_ontimer(unsigned long data)
 */
static void dump_vmbus_channel(struct vmbus_channel *channel)
{
	DPRINT_DBG(VMBUS, "Channel (%d)", channel->OfferMsg.ChildRelId);
	DumpRingInfo(&channel->Outbound, "Outbound ");
	DumpRingInfo(&channel->Inbound, "Inbound ");
	DPRINT_DBG(VMBUS, "Channel (%d)", channel->offermsg.child_relid);
	DumpRingInfo(&channel->outbound, "Outbound ");
	DumpRingInfo(&channel->inbound, "Inbound ");
}
+93 −93

File changed.

Preview size limit exceeded, changes collapsed.

+122 −122

File changed.

Preview size limit exceeded, changes collapsed.

+19 −19
Original line number Diff line number Diff line
@@ -95,19 +95,19 @@ int VmbusConnect(void)
		goto Cleanup;
	}

	msgInfo->WaitEvent = osd_WaitEventCreate();
	if (!msgInfo->WaitEvent) {
	msgInfo->waitevent = osd_WaitEventCreate();
	if (!msgInfo->waitevent) {
		ret = -ENOMEM;
		goto Cleanup;
	}

	msg = (struct vmbus_channel_initiate_contact *)msgInfo->Msg;
	msg = (struct vmbus_channel_initiate_contact *)msgInfo->msg;

	msg->Header.MessageType = ChannelMessageInitiateContact;
	msg->VMBusVersionRequested = VMBUS_REVISION_NUMBER;
	msg->InterruptPage = virt_to_phys(gVmbusConnection.InterruptPage);
	msg->MonitorPage1 = virt_to_phys(gVmbusConnection.MonitorPages);
	msg->MonitorPage2 = virt_to_phys(
	msg->header.msgtype = CHANNELMSG_INITIATE_CONTACT;
	msg->vmbus_version_requested = VMBUS_REVISION_NUMBER;
	msg->interrupt_page = virt_to_phys(gVmbusConnection.InterruptPage);
	msg->monitor_page1 = virt_to_phys(gVmbusConnection.MonitorPages);
	msg->monitor_page2 = virt_to_phys(
			(void *)((unsigned long)gVmbusConnection.MonitorPages +
				 PAGE_SIZE));

@@ -116,30 +116,30 @@ int VmbusConnect(void)
	 * receive the response before returning from this routine
	 */
	spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
	list_add_tail(&msgInfo->MsgListEntry,
	list_add_tail(&msgInfo->msglistentry,
		      &gVmbusConnection.ChannelMsgList);

	spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);

	DPRINT_DBG(VMBUS, "Vmbus connection - interrupt pfn %llx, "
		   "monitor1 pfn %llx,, monitor2 pfn %llx",
		   msg->InterruptPage, msg->MonitorPage1, msg->MonitorPage2);
		   msg->interrupt_page, msg->monitor_page1, msg->monitor_page2);

	DPRINT_DBG(VMBUS, "Sending channel initiate msg...");
	ret = VmbusPostMessage(msg,
			       sizeof(struct vmbus_channel_initiate_contact));
	if (ret != 0) {
		list_del(&msgInfo->MsgListEntry);
		list_del(&msgInfo->msglistentry);
		goto Cleanup;
	}

	/* Wait for the connection response */
	osd_WaitEventWait(msgInfo->WaitEvent);
	osd_WaitEventWait(msgInfo->waitevent);

	list_del(&msgInfo->MsgListEntry);
	list_del(&msgInfo->msglistentry);

	/* Check if successful */
	if (msgInfo->Response.VersionResponse.VersionSupported) {
	if (msgInfo->response.version_response.version_supported) {
		DPRINT_INFO(VMBUS, "Vmbus connected!!");
		gVmbusConnection.ConnectState = Connected;

@@ -151,7 +151,7 @@ int VmbusConnect(void)
		goto Cleanup;
	}

	kfree(msgInfo->WaitEvent);
	kfree(msgInfo->waitevent);
	kfree(msgInfo);
	return 0;

@@ -172,7 +172,7 @@ Cleanup:
	}

	if (msgInfo) {
		kfree(msgInfo->WaitEvent);
		kfree(msgInfo->waitevent);
		kfree(msgInfo);
	}

@@ -195,7 +195,7 @@ int VmbusDisconnect(void)
	if (!msg)
		return -ENOMEM;

	msg->MessageType = ChannelMessageUnload;
	msg->msgtype = CHANNELMSG_UNLOAD;

	ret = VmbusPostMessage(msg,
			       sizeof(struct vmbus_channel_message_header));
@@ -226,8 +226,8 @@ struct vmbus_channel *GetChannelFromRelId(u32 relId)
	unsigned long flags;

	spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
	list_for_each_entry(channel, &gVmbusConnection.ChannelList, ListEntry) {
		if (channel->OfferMsg.ChildRelId == relId) {
	list_for_each_entry(channel, &gVmbusConnection.ChannelList, listentry) {
		if (channel->offermsg.child_relid == relId) {
			foundChannel = channel;
			break;
		}
+6 −6
Original line number Diff line number Diff line
@@ -271,15 +271,15 @@ static int __init init_hyperv_utils(void)
	if (!dmi_check_system(hv_utils_dmi_table))
		return -ENODEV;

	hv_cb_utils[HV_SHUTDOWN_MSG].channel->OnChannelCallback =
	hv_cb_utils[HV_SHUTDOWN_MSG].channel->onchannel_callback =
		&shutdown_onchannelcallback;
	hv_cb_utils[HV_SHUTDOWN_MSG].callback = &shutdown_onchannelcallback;

	hv_cb_utils[HV_TIMESYNC_MSG].channel->OnChannelCallback =
	hv_cb_utils[HV_TIMESYNC_MSG].channel->onchannel_callback =
		&timesync_onchannelcallback;
	hv_cb_utils[HV_TIMESYNC_MSG].callback = &timesync_onchannelcallback;

	hv_cb_utils[HV_HEARTBEAT_MSG].channel->OnChannelCallback =
	hv_cb_utils[HV_HEARTBEAT_MSG].channel->onchannel_callback =
		&heartbeat_onchannelcallback;
	hv_cb_utils[HV_HEARTBEAT_MSG].callback = &heartbeat_onchannelcallback;

@@ -290,15 +290,15 @@ static void exit_hyperv_utils(void)
{
	printk(KERN_INFO "De-Registered HyperV Utility Driver\n");

	hv_cb_utils[HV_SHUTDOWN_MSG].channel->OnChannelCallback =
	hv_cb_utils[HV_SHUTDOWN_MSG].channel->onchannel_callback =
		&chn_cb_negotiate;
	hv_cb_utils[HV_SHUTDOWN_MSG].callback = &chn_cb_negotiate;

	hv_cb_utils[HV_TIMESYNC_MSG].channel->OnChannelCallback =
	hv_cb_utils[HV_TIMESYNC_MSG].channel->onchannel_callback =
		&chn_cb_negotiate;
	hv_cb_utils[HV_TIMESYNC_MSG].callback = &chn_cb_negotiate;

	hv_cb_utils[HV_HEARTBEAT_MSG].channel->OnChannelCallback =
	hv_cb_utils[HV_HEARTBEAT_MSG].channel->onchannel_callback =
		&chn_cb_negotiate;
	hv_cb_utils[HV_HEARTBEAT_MSG].callback = &chn_cb_negotiate;
}
Loading