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: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Haiyang Zhang 2010-11-08 14:04:38 -08:00 committed by Greg Kroah-Hartman
parent a32d4acab4
commit c50f7fb284
6 changed files with 410 additions and 410 deletions

View File

@ -74,21 +74,21 @@ static void vmbus_setevent(struct vmbus_channel *channel)
{ {
struct hv_monitor_page *monitorpage; struct hv_monitor_page *monitorpage;
if (channel->OfferMsg.MonitorAllocated) { if (channel->offermsg.monitor_allocated) {
/* Each u32 represents 32 channels */ /* Each u32 represents 32 channels */
set_bit(channel->OfferMsg.ChildRelId & 31, set_bit(channel->offermsg.child_relid & 31,
(unsigned long *) gVmbusConnection.SendInterruptPage + (unsigned long *) gVmbusConnection.SendInterruptPage +
(channel->OfferMsg.ChildRelId >> 5)); (channel->offermsg.child_relid >> 5));
monitorpage = gVmbusConnection.MonitorPages; monitorpage = gVmbusConnection.MonitorPages;
monitorpage++; /* Get the child to parent monitor page */ monitorpage++; /* Get the child to parent monitor page */
set_bit(channel->MonitorBit, set_bit(channel->monitor_bit,
(unsigned long *)&monitorpage->TriggerGroup (unsigned long *)&monitorpage->TriggerGroup
[channel->MonitorGroup].Pending); [channel->monitor_grp].Pending);
} else { } 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; struct hv_monitor_page *monitorPage;
if (Channel->OfferMsg.MonitorAllocated) { if (Channel->offermsg.monitor_allocated) {
/* Each u32 represents 32 channels */ /* Each u32 represents 32 channels */
clear_bit(Channel->OfferMsg.ChildRelId & 31, clear_bit(Channel->offermsg.child_relid & 31,
(unsigned long *)gVmbusConnection.SendInterruptPage + (unsigned long *)gVmbusConnection.SendInterruptPage +
(Channel->OfferMsg.ChildRelId >> 5)); (Channel->offermsg.child_relid >> 5));
monitorPage = monitorPage =
(struct hv_monitor_page *)gVmbusConnection.MonitorPages; (struct hv_monitor_page *)gVmbusConnection.MonitorPages;
monitorPage++; /* Get the child to parent monitor page */ monitorPage++; /* Get the child to parent monitor page */
clear_bit(Channel->MonitorBit, clear_bit(Channel->monitor_bit,
(unsigned long *)&monitorPage->TriggerGroup (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 vmbus_channel_debug_info *debuginfo)
{ {
struct hv_monitor_page *monitorpage; struct hv_monitor_page *monitorpage;
u8 monitor_group = (u8)channel->OfferMsg.MonitorId / 32; u8 monitor_group = (u8)channel->offermsg.monitorid / 32;
u8 monitor_offset = (u8)channel->OfferMsg.MonitorId % 32; u8 monitor_offset = (u8)channel->offermsg.monitorid % 32;
/* u32 monitorBit = 1 << monitorOffset; */ /* u32 monitorBit = 1 << monitorOffset; */
debuginfo->RelId = channel->OfferMsg.ChildRelId; debuginfo->relid = channel->offermsg.child_relid;
debuginfo->State = channel->State; debuginfo->state = channel->state;
memcpy(&debuginfo->InterfaceType, memcpy(&debuginfo->interfacetype,
&channel->OfferMsg.Offer.InterfaceType, sizeof(struct hv_guid)); &channel->offermsg.offer.InterfaceType, sizeof(struct hv_guid));
memcpy(&debuginfo->InterfaceInstance, memcpy(&debuginfo->interface_instance,
&channel->OfferMsg.Offer.InterfaceInstance, &channel->offermsg.offer.InterfaceInstance,
sizeof(struct hv_guid)); sizeof(struct hv_guid));
monitorpage = (struct hv_monitor_page *)gVmbusConnection.MonitorPages; 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; monitorpage->TriggerGroup[monitor_group].Pending;
debuginfo->ServerMonitorLatency = debuginfo->servermonitor_latency =
monitorpage->Latency[monitor_group][monitor_offset]; monitorpage->Latency[monitor_group][monitor_offset];
debuginfo->ServerMonitorConnectionId = debuginfo->servermonitor_connectionid =
monitorpage->Parameter[monitor_group] monitorpage->Parameter[monitor_group]
[monitor_offset].ConnectionId.u.Id; [monitor_offset].ConnectionId.u.Id;
monitorpage++; monitorpage++;
debuginfo->ClientMonitorPending = debuginfo->clientmonitor_pending =
monitorpage->TriggerGroup[monitor_group].Pending; monitorpage->TriggerGroup[monitor_group].Pending;
debuginfo->ClientMonitorLatency = debuginfo->clientmonitor_latency =
monitorpage->Latency[monitor_group][monitor_offset]; monitorpage->Latency[monitor_group][monitor_offset];
debuginfo->ClientMonitorConnectionId = debuginfo->clientmonitor_connectionid =
monitorpage->Parameter[monitor_group] monitorpage->Parameter[monitor_group]
[monitor_offset].ConnectionId.u.Id; [monitor_offset].ConnectionId.u.Id;
RingBufferGetDebugInfo(&channel->Inbound, &debuginfo->Inbound); RingBufferGetDebugInfo(&channel->inbound, &debuginfo->inbound);
RingBufferGetDebugInfo(&channel->Outbound, &debuginfo->Outbound); 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(!(SendRingBufferSize & (PAGE_SIZE - 1))); */
/* ASSERT(!(RecvRingBufferSize & (PAGE_SIZE - 1))); */ /* ASSERT(!(RecvRingBufferSize & (PAGE_SIZE - 1))); */
newchannel->OnChannelCallback = onchannelcallback; newchannel->onchannel_callback = onchannelcallback;
newchannel->ChannelCallbackContext = context; newchannel->channel_callback_context = context;
/* Allocate the ring buffer */ /* Allocate the ring buffer */
out = osd_PageAlloc((send_ringbuffer_size + recv_ringbuffer_size) 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); in = (void *)((unsigned long)out + send_ringbuffer_size);
newchannel->RingBufferPages = out; newchannel->ringbuffer_pages = out;
newchannel->RingBufferPageCount = (send_ringbuffer_size + newchannel->ringbuffer_pagecount = (send_ringbuffer_size +
recv_ringbuffer_size) >> PAGE_SHIFT; recv_ringbuffer_size) >> PAGE_SHIFT;
ret = RingBufferInit(&newchannel->Outbound, out, send_ringbuffer_size); ret = RingBufferInit(&newchannel->outbound, out, send_ringbuffer_size);
if (ret != 0) { if (ret != 0) {
err = ret; err = ret;
goto errorout; goto errorout;
} }
ret = RingBufferInit(&newchannel->Inbound, in, recv_ringbuffer_size); ret = RingBufferInit(&newchannel->inbound, in, recv_ringbuffer_size);
if (ret != 0) { if (ret != 0) {
err = ret; err = ret;
goto errorout; 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...", DPRINT_DBG(VMBUS, "Establishing ring buffer's gpadl for channel %p...",
newchannel); newchannel);
newchannel->RingBufferGpadlHandle = 0; newchannel->ringbuffer_gpadlhandle = 0;
ret = vmbus_establish_gpadl(newchannel, ret = vmbus_establish_gpadl(newchannel,
newchannel->Outbound.RingBuffer, newchannel->outbound.RingBuffer,
send_ringbuffer_size + send_ringbuffer_size +
recv_ringbuffer_size, recv_ringbuffer_size,
&newchannel->RingBufferGpadlHandle); &newchannel->ringbuffer_gpadlhandle);
if (ret != 0) { if (ret != 0) {
err = ret; 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 " DPRINT_DBG(VMBUS, "channel %p <relid %d gpadl 0x%x send ring %p "
"size %d recv ring %p size %d, downstreamoffset %d>", "size %d recv ring %p size %d, downstreamoffset %d>",
newchannel, newchannel->OfferMsg.ChildRelId, newchannel, newchannel->offermsg.child_relid,
newchannel->RingBufferGpadlHandle, newchannel->ringbuffer_gpadlhandle,
newchannel->Outbound.RingBuffer, newchannel->outbound.RingBuffer,
newchannel->Outbound.RingSize, newchannel->outbound.RingSize,
newchannel->Inbound.RingBuffer, newchannel->inbound.RingBuffer,
newchannel->Inbound.RingSize, newchannel->inbound.RingSize,
send_ringbuffer_size); send_ringbuffer_size);
/* Create and init the channel open message */ /* Create and init the channel open message */
@ -242,20 +242,20 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
goto errorout; goto errorout;
} }
openInfo->WaitEvent = osd_WaitEventCreate(); openInfo->waitevent = osd_WaitEventCreate();
if (!openInfo->WaitEvent) { if (!openInfo->waitevent) {
err = -ENOMEM; err = -ENOMEM;
goto errorout; goto errorout;
} }
openMsg = (struct vmbus_channel_open_channel *)openInfo->Msg; openMsg = (struct vmbus_channel_open_channel *)openInfo->msg;
openMsg->Header.MessageType = ChannelMessageOpenChannel; openMsg->header.msgtype = CHANNELMSG_OPENCHANNEL;
openMsg->OpenId = newchannel->OfferMsg.ChildRelId; /* FIXME */ openMsg->openid = newchannel->offermsg.child_relid; /* FIXME */
openMsg->ChildRelId = newchannel->OfferMsg.ChildRelId; openMsg->child_relid = newchannel->offermsg.child_relid;
openMsg->RingBufferGpadlHandle = newchannel->RingBufferGpadlHandle; openMsg->ringbuffer_gpadlhandle = newchannel->ringbuffer_gpadlhandle;
openMsg->DownstreamRingBufferPageOffset = send_ringbuffer_size >> openMsg->downstream_ringbuffer_pageoffset = send_ringbuffer_size >>
PAGE_SHIFT; PAGE_SHIFT;
openMsg->ServerContextAreaGpadlHandle = 0; /* TODO */ openMsg->server_contextarea_gpadlhandle = 0; /* TODO */
if (userdatalen > MAX_USER_DEFINED_BYTES) { if (userdatalen > MAX_USER_DEFINED_BYTES) {
err = -EINVAL; err = -EINVAL;
@ -263,10 +263,10 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
} }
if (userdatalen) if (userdatalen)
memcpy(openMsg->UserData, userdata, userdatalen); memcpy(openMsg->userdata, userdata, userdatalen);
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
list_add_tail(&openInfo->MsgListEntry, list_add_tail(&openInfo->msglistentry,
&gVmbusConnection.ChannelMsgList); &gVmbusConnection.ChannelMsgList);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); 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 */ /* 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); DPRINT_INFO(VMBUS, "channel <%p> open success!!", newchannel);
else else
DPRINT_INFO(VMBUS, "channel <%p> open failed - %d!!", DPRINT_INFO(VMBUS, "channel <%p> open failed - %d!!",
newchannel, openInfo->Response.OpenResult.Status); newchannel, openInfo->response.open_result.status);
Cleanup: Cleanup:
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
list_del(&openInfo->MsgListEntry); list_del(&openInfo->msglistentry);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
kfree(openInfo->WaitEvent); kfree(openInfo->waitevent);
kfree(openInfo); kfree(openInfo);
return 0; return 0;
errorout: errorout:
RingBufferCleanup(&newchannel->Outbound); RingBufferCleanup(&newchannel->outbound);
RingBufferCleanup(&newchannel->Inbound); RingBufferCleanup(&newchannel->inbound);
osd_PageFree(out, (send_ringbuffer_size + recv_ringbuffer_size) osd_PageFree(out, (send_ringbuffer_size + recv_ringbuffer_size)
>> PAGE_SHIFT); >> PAGE_SHIFT);
kfree(openInfo); 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++) for (i = 0; i < pfncount; i++)
DPRINT_DBG(VMBUS, "gpadl body - %d) pfn %llu", 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, DPRINT_DBG(VMBUS,
"gpadl header - relid %d, range count %d, range buflen %d", "gpadl header - relid %d, range count %d, range buflen %d",
gpadl->ChildRelId, gpadl->RangeCount, gpadl->RangeBufLen); gpadl->child_relid, gpadl->rangecount, gpadl->range_buflen);
for (i = 0; i < gpadl->RangeCount; i++) { for (i = 0; i < gpadl->rangecount; i++) {
pagecount = gpadl->Range[i].ByteCount >> PAGE_SHIFT; pagecount = gpadl->range[i].ByteCount >> PAGE_SHIFT;
pagecount = (pagecount > 26) ? 26 : pagecount; pagecount = (pagecount > 26) ? 26 : pagecount;
DPRINT_DBG(VMBUS, "gpadl range %d - len %d offset %d " DPRINT_DBG(VMBUS, "gpadl range %d - len %d offset %d "
"page count %d", i, gpadl->Range[i].ByteCount, "page count %d", i, gpadl->range[i].ByteCount,
gpadl->Range[i].ByteOffset, pagecount); gpadl->range[i].ByteOffset, pagecount);
for (j = 0; j < pagecount; j++) for (j = 0; j < pagecount; j++)
DPRINT_DBG(VMBUS, "%d) pfn %llu", 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) if (!msgheader)
goto nomem; goto nomem;
INIT_LIST_HEAD(&msgheader->SubMsgList); INIT_LIST_HEAD(&msgheader->submsglist);
msgheader->MessageSize = msgsize; msgheader->msgsize = msgsize;
gpadl_header = (struct vmbus_channel_gpadl_header *) gpadl_header = (struct vmbus_channel_gpadl_header *)
msgheader->Msg; msgheader->msg;
gpadl_header->RangeCount = 1; gpadl_header->rangecount = 1;
gpadl_header->RangeBufLen = sizeof(struct gpa_range) + gpadl_header->range_buflen = sizeof(struct gpa_range) +
pagecount * sizeof(u64); pagecount * sizeof(u64);
gpadl_header->Range[0].ByteOffset = 0; gpadl_header->range[0].ByteOffset = 0;
gpadl_header->Range[0].ByteCount = size; gpadl_header->range[0].ByteCount = size;
for (i = 0; i < pfncount; i++) for (i = 0; i < pfncount; i++)
gpadl_header->Range[0].PfnArray[i] = pfn+i; gpadl_header->range[0].PfnArray[i] = pfn+i;
*msginfo = msgheader; *msginfo = msgheader;
*messagecount = 1; *messagecount = 1;
@ -428,10 +428,10 @@ static int create_gpadl_header(void *kbuffer, u32 size,
/* FIXME: we probably need to more if this fails */ /* FIXME: we probably need to more if this fails */
if (!msgbody) if (!msgbody)
goto nomem; goto nomem;
msgbody->MessageSize = msgsize; msgbody->msgsize = msgsize;
(*messagecount)++; (*messagecount)++;
gpadl_body = gpadl_body =
(struct vmbus_channel_gpadl_body *)msgbody->Msg; (struct vmbus_channel_gpadl_body *)msgbody->msg;
/* /*
* FIXME: * FIXME:
@ -440,11 +440,11 @@ static int create_gpadl_header(void *kbuffer, u32 size,
*/ */
/* gpadl_body->Gpadl = kbuffer; */ /* gpadl_body->Gpadl = kbuffer; */
for (i = 0; i < pfncurr; i++) for (i = 0; i < pfncurr; i++)
gpadl_body->Pfn[i] = pfn + pfnsum + i; gpadl_body->pfn[i] = pfn + pfnsum + i;
/* add to msg header */ /* add to msg header */
list_add_tail(&msgbody->MsgListEntry, list_add_tail(&msgbody->msglistentry,
&msgheader->SubMsgList); &msgheader->submsglist);
pfnsum += pfncurr; pfnsum += pfncurr;
pfnleft -= pfncurr; pfnleft -= pfncurr;
} }
@ -456,17 +456,17 @@ static int create_gpadl_header(void *kbuffer, u32 size,
msgheader = kzalloc(msgsize, GFP_KERNEL); msgheader = kzalloc(msgsize, GFP_KERNEL);
if (msgheader == NULL) if (msgheader == NULL)
goto nomem; goto nomem;
msgheader->MessageSize = msgsize; msgheader->msgsize = msgsize;
gpadl_header = (struct vmbus_channel_gpadl_header *) gpadl_header = (struct vmbus_channel_gpadl_header *)
msgheader->Msg; msgheader->msg;
gpadl_header->RangeCount = 1; gpadl_header->rangecount = 1;
gpadl_header->RangeBufLen = sizeof(struct gpa_range) + gpadl_header->range_buflen = sizeof(struct gpa_range) +
pagecount * sizeof(u64); pagecount * sizeof(u64);
gpadl_header->Range[0].ByteOffset = 0; gpadl_header->range[0].ByteOffset = 0;
gpadl_header->Range[0].ByteCount = size; gpadl_header->range[0].ByteCount = size;
for (i = 0; i < pagecount; i++) for (i = 0; i < pagecount; i++)
gpadl_header->Range[0].PfnArray[i] = pfn+i; gpadl_header->range[0].PfnArray[i] = pfn+i;
*msginfo = msgheader; *msginfo = msgheader;
*messagecount = 1; *messagecount = 1;
@ -508,21 +508,21 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
if (ret) if (ret)
return ret; return ret;
msginfo->WaitEvent = osd_WaitEventCreate(); msginfo->waitevent = osd_WaitEventCreate();
if (!msginfo->WaitEvent) { if (!msginfo->waitevent) {
ret = -ENOMEM; ret = -ENOMEM;
goto Cleanup; goto Cleanup;
} }
gpadlmsg = (struct vmbus_channel_gpadl_header *)msginfo->Msg; gpadlmsg = (struct vmbus_channel_gpadl_header *)msginfo->msg;
gpadlmsg->Header.MessageType = ChannelMessageGpadlHeader; gpadlmsg->header.msgtype = CHANNELMSG_GPADL_HEADER;
gpadlmsg->ChildRelId = channel->OfferMsg.ChildRelId; gpadlmsg->child_relid = channel->offermsg.child_relid;
gpadlmsg->Gpadl = next_gpadl_handle; gpadlmsg->gpadl = next_gpadl_handle;
dump_gpadl_header(gpadlmsg); dump_gpadl_header(gpadlmsg);
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
list_add_tail(&msginfo->MsgListEntry, list_add_tail(&msginfo->msglistentry,
&gVmbusConnection.ChannelMsgList); &gVmbusConnection.ChannelMsgList);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
@ -530,9 +530,9 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
kbuffer, size, msgcount); kbuffer, size, msgcount);
DPRINT_DBG(VMBUS, "Sending GPADL Header - len %zd", 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)); sizeof(*msginfo));
if (ret != 0) { if (ret != 0) {
DPRINT_ERR(VMBUS, "Unable to open channel - %d", ret); 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) { if (msgcount > 1) {
list_for_each(curr, &msginfo->SubMsgList) { list_for_each(curr, &msginfo->submsglist) {
/* FIXME: should this use list_entry() instead ? */ /* FIXME: should this use list_entry() instead ? */
submsginfo = (struct vmbus_channel_msginfo *)curr; submsginfo = (struct vmbus_channel_msginfo *)curr;
gpadl_body = gpadl_body =
(struct vmbus_channel_gpadl_body *)submsginfo->Msg; (struct vmbus_channel_gpadl_body *)submsginfo->msg;
gpadl_body->Header.MessageType = gpadl_body->header.msgtype =
ChannelMessageGpadlBody; CHANNELMSG_GPADL_BODY;
gpadl_body->Gpadl = next_gpadl_handle; gpadl_body->gpadl = next_gpadl_handle;
DPRINT_DBG(VMBUS, "Sending GPADL Body - len %zd", DPRINT_DBG(VMBUS, "Sending GPADL Body - len %zd",
submsginfo->MessageSize - submsginfo->msgsize -
sizeof(*submsginfo)); sizeof(*submsginfo));
dump_gpadl_body(gpadl_body, submsginfo->MessageSize - dump_gpadl_body(gpadl_body, submsginfo->msgsize -
sizeof(*submsginfo)); sizeof(*submsginfo));
ret = VmbusPostMessage(gpadl_body, ret = VmbusPostMessage(gpadl_body,
submsginfo->MessageSize - submsginfo->msgsize -
sizeof(*submsginfo)); sizeof(*submsginfo));
if (ret != 0) if (ret != 0)
goto Cleanup; goto Cleanup;
} }
} }
osd_WaitEventWait(msginfo->WaitEvent); osd_WaitEventWait(msginfo->waitevent);
/* At this point, we received the gpadl created msg */ /* At this point, we received the gpadl created msg */
DPRINT_DBG(VMBUS, "Received GPADL created " DPRINT_DBG(VMBUS, "Received GPADL created "
"(relid %d, status %d handle %x)", "(relid %d, status %d handle %x)",
channel->OfferMsg.ChildRelId, channel->offermsg.child_relid,
msginfo->Response.GpadlCreated.CreationStatus, msginfo->response.gpadl_created.creation_status,
gpadlmsg->Gpadl); gpadlmsg->gpadl);
*gpadl_handle = gpadlmsg->Gpadl; *gpadl_handle = gpadlmsg->gpadl;
Cleanup: Cleanup:
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
list_del(&msginfo->MsgListEntry); list_del(&msginfo->msglistentry);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
kfree(msginfo->WaitEvent); kfree(msginfo->waitevent);
kfree(msginfo); kfree(msginfo);
return ret; return ret;
} }
@ -604,20 +604,20 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
if (!info) if (!info)
return -ENOMEM; return -ENOMEM;
info->WaitEvent = osd_WaitEventCreate(); info->waitevent = osd_WaitEventCreate();
if (!info->WaitEvent) { if (!info->waitevent) {
kfree(info); kfree(info);
return -ENOMEM; return -ENOMEM;
} }
msg = (struct vmbus_channel_gpadl_teardown *)info->Msg; msg = (struct vmbus_channel_gpadl_teardown *)info->msg;
msg->Header.MessageType = ChannelMessageGpadlTeardown; msg->header.msgtype = CHANNELMSG_GPADL_TEARDOWN;
msg->ChildRelId = channel->OfferMsg.ChildRelId; msg->child_relid = channel->offermsg.child_relid;
msg->Gpadl = gpadl_handle; msg->gpadl = gpadl_handle;
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
list_add_tail(&info->MsgListEntry, list_add_tail(&info->msglistentry,
&gVmbusConnection.ChannelMsgList); &gVmbusConnection.ChannelMsgList);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
@ -628,14 +628,14 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
/* something... */ /* something... */
} }
osd_WaitEventWait(info->WaitEvent); osd_WaitEventWait(info->waitevent);
/* Received a torndown response */ /* Received a torndown response */
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
list_del(&info->MsgListEntry); list_del(&info->msglistentry);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
kfree(info->WaitEvent); kfree(info->waitevent);
kfree(info); kfree(info);
return ret; return ret;
} }
@ -652,7 +652,7 @@ void vmbus_close(struct vmbus_channel *channel)
int ret; int ret;
/* Stop callback and cancel the timer asap */ /* Stop callback and cancel the timer asap */
channel->OnChannelCallback = NULL; channel->onchannel_callback = NULL;
del_timer_sync(&channel->poll_timer); del_timer_sync(&channel->poll_timer);
/* Send a closing message */ /* Send a closing message */
@ -665,9 +665,9 @@ void vmbus_close(struct vmbus_channel *channel)
/* info->waitEvent = osd_WaitEventCreate(); */ /* info->waitEvent = osd_WaitEventCreate(); */
msg = (struct vmbus_channel_close_channel *)info->Msg; msg = (struct vmbus_channel_close_channel *)info->msg;
msg->Header.MessageType = ChannelMessageCloseChannel; msg->header.msgtype = CHANNELMSG_CLOSECHANNEL;
msg->ChildRelId = channel->OfferMsg.ChildRelId; msg->child_relid = channel->offermsg.child_relid;
ret = VmbusPostMessage(msg, sizeof(struct vmbus_channel_close_channel)); ret = VmbusPostMessage(msg, sizeof(struct vmbus_channel_close_channel));
if (ret != 0) { if (ret != 0) {
@ -676,17 +676,17 @@ void vmbus_close(struct vmbus_channel *channel)
} }
/* Tear down the gpadl for the channel's ring buffer */ /* Tear down the gpadl for the channel's ring buffer */
if (channel->RingBufferGpadlHandle) if (channel->ringbuffer_gpadlhandle)
vmbus_teardown_gpadl(channel, vmbus_teardown_gpadl(channel,
channel->RingBufferGpadlHandle); channel->ringbuffer_gpadlhandle);
/* TODO: Send a msg to release the childRelId */ /* TODO: Send a msg to release the childRelId */
/* Cleanup the ring buffers for this channel */ /* Cleanup the ring buffers for this channel */
RingBufferCleanup(&channel->Outbound); RingBufferCleanup(&channel->outbound);
RingBufferCleanup(&channel->Inbound); RingBufferCleanup(&channel->inbound);
osd_PageFree(channel->RingBufferPages, channel->RingBufferPageCount); osd_PageFree(channel->ringbuffer_pages, channel->ringbuffer_pagecount);
kfree(info); kfree(info);
@ -696,9 +696,9 @@ void vmbus_close(struct vmbus_channel *channel)
* caller will free the 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); spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
list_del(&channel->ListEntry); list_del(&channel->listentry);
spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
free_channel(channel); free_channel(channel);
@ -752,10 +752,10 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer,
sg_set_buf(&bufferlist[2], &aligned_data, sg_set_buf(&bufferlist[2], &aligned_data,
packetlen_aligned - packetlen); packetlen_aligned - packetlen);
ret = RingBufferWrite(&channel->Outbound, bufferlist, 3); ret = RingBufferWrite(&channel->outbound, bufferlist, 3);
/* TODO: We should determine if this is optional */ /* TODO: We should determine if this is optional */
if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound)) if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound))
vmbus_setevent(channel); vmbus_setevent(channel);
return ret; return ret;
@ -817,10 +817,10 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
sg_set_buf(&bufferlist[2], &aligned_data, sg_set_buf(&bufferlist[2], &aligned_data,
packetlen_aligned - packetlen); packetlen_aligned - packetlen);
ret = RingBufferWrite(&channel->Outbound, bufferlist, 3); ret = RingBufferWrite(&channel->outbound, bufferlist, 3);
/* TODO: We should determine if this is optional */ /* TODO: We should determine if this is optional */
if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound)) if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound))
vmbus_setevent(channel); vmbus_setevent(channel);
return ret; return ret;
@ -886,10 +886,10 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,
sg_set_buf(&bufferlist[2], &aligned_data, sg_set_buf(&bufferlist[2], &aligned_data,
packetlen_aligned - packetlen); packetlen_aligned - packetlen);
ret = RingBufferWrite(&channel->Outbound, bufferlist, 3); ret = RingBufferWrite(&channel->outbound, bufferlist, 3);
/* TODO: We should determine if this is optional */ /* TODO: We should determine if this is optional */
if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound)) if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound))
vmbus_setevent(channel); vmbus_setevent(channel);
return ret; return ret;
@ -923,7 +923,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer,
spin_lock_irqsave(&channel->inbound_lock, flags); spin_lock_irqsave(&channel->inbound_lock, flags);
ret = RingBufferPeek(&channel->Inbound, &desc, ret = RingBufferPeek(&channel->inbound, &desc,
sizeof(struct vmpacket_descriptor)); sizeof(struct vmpacket_descriptor));
if (ret != 0) { if (ret != 0) {
spin_unlock_irqrestore(&channel->inbound_lock, flags); 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 " DPRINT_DBG(VMBUS, "packet received on channel %p relid %d <type %d "
"flag %d tid %llx pktlen %d datalen %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); desc.Flags, desc.TransactionId, packetlen, userlen);
*buffer_actual_len = userlen; *buffer_actual_len = userlen;
@ -956,7 +956,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer,
*requestid = desc.TransactionId; *requestid = desc.TransactionId;
/* Copy over the packet to the user buffer */ /* Copy over the packet to the user buffer */
ret = RingBufferRead(&channel->Inbound, buffer, userlen, ret = RingBufferRead(&channel->inbound, buffer, userlen,
(desc.DataOffset8 << 3)); (desc.DataOffset8 << 3));
spin_unlock_irqrestore(&channel->inbound_lock, flags); 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); spin_lock_irqsave(&channel->inbound_lock, flags);
ret = RingBufferPeek(&channel->Inbound, &desc, ret = RingBufferPeek(&channel->inbound, &desc,
sizeof(struct vmpacket_descriptor)); sizeof(struct vmpacket_descriptor));
if (ret != 0) { if (ret != 0) {
spin_unlock_irqrestore(&channel->inbound_lock, flags); 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 " DPRINT_DBG(VMBUS, "packet received on channel %p relid %d <type %d "
"flag %d tid %llx pktlen %d datalen %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); desc.Flags, desc.TransactionId, packetlen, userlen);
*buffer_actual_len = packetlen; *buffer_actual_len = packetlen;
@ -1015,7 +1015,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer,
*requestid = desc.TransactionId; *requestid = desc.TransactionId;
/* Copy over the entire packet to the user buffer */ /* 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); spin_unlock_irqrestore(&channel->inbound_lock, flags);
return 0; return 0;
@ -1030,7 +1030,7 @@ void vmbus_onchannel_event(struct vmbus_channel *channel)
dump_vmbus_channel(channel); dump_vmbus_channel(channel);
/* ASSERT(Channel->OnChannelCallback); */ /* ASSERT(Channel->OnChannelCallback); */
channel->OnChannelCallback(channel->ChannelCallbackContext); channel->onchannel_callback(channel->channel_callback_context);
mod_timer(&channel->poll_timer, jiffies + usecs_to_jiffies(100)); 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; struct vmbus_channel *channel = (struct vmbus_channel *)data;
if (channel->OnChannelCallback) if (channel->onchannel_callback)
channel->OnChannelCallback(channel->ChannelCallbackContext); 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) static void dump_vmbus_channel(struct vmbus_channel *channel)
{ {
DPRINT_DBG(VMBUS, "Channel (%d)", channel->OfferMsg.ChildRelId); DPRINT_DBG(VMBUS, "Channel (%d)", channel->offermsg.child_relid);
DumpRingInfo(&channel->Outbound, "Outbound "); DumpRingInfo(&channel->outbound, "Outbound ");
DumpRingInfo(&channel->Inbound, "Inbound "); DumpRingInfo(&channel->inbound, "Inbound ");
} }

View File

@ -251,8 +251,8 @@ static struct vmbus_channel *alloc_channel(void)
channel->poll_timer.data = (unsigned long)channel; channel->poll_timer.data = (unsigned long)channel;
channel->poll_timer.function = vmbus_ontimer; channel->poll_timer.function = vmbus_ontimer;
channel->ControlWQ = create_workqueue("hv_vmbus_ctl"); channel->controlwq = create_workqueue("hv_vmbus_ctl");
if (!channel->ControlWQ) { if (!channel->controlwq) {
kfree(channel); kfree(channel);
return NULL; return NULL;
} }
@ -268,7 +268,7 @@ static inline void release_channel(void *context)
struct vmbus_channel *channel = context; struct vmbus_channel *channel = context;
DPRINT_DBG(VMBUS, "releasing channel (%p)", channel); DPRINT_DBG(VMBUS, "releasing channel (%p)", channel);
destroy_workqueue(channel->ControlWQ); destroy_workqueue(channel->controlwq);
DPRINT_DBG(VMBUS, "channel released (%p)", channel); DPRINT_DBG(VMBUS, "channel released (%p)", channel);
kfree(channel); kfree(channel);
@ -325,12 +325,12 @@ static void vmbus_process_offer(void *context)
/* Make sure this is a new offer */ /* Make sure this is a new offer */
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
list_for_each_entry(channel, &gVmbusConnection.ChannelList, ListEntry) { list_for_each_entry(channel, &gVmbusConnection.ChannelList, listentry) {
if (!memcmp(&channel->OfferMsg.Offer.InterfaceType, if (!memcmp(&channel->offermsg.offer.InterfaceType,
&newchannel->OfferMsg.Offer.InterfaceType, &newchannel->offermsg.offer.InterfaceType,
sizeof(struct hv_guid)) && sizeof(struct hv_guid)) &&
!memcmp(&channel->OfferMsg.Offer.InterfaceInstance, !memcmp(&channel->offermsg.offer.InterfaceInstance,
&newchannel->OfferMsg.Offer.InterfaceInstance, &newchannel->offermsg.offer.InterfaceInstance,
sizeof(struct hv_guid))) { sizeof(struct hv_guid))) {
fnew = false; fnew = false;
break; break;
@ -338,14 +338,14 @@ static void vmbus_process_offer(void *context)
} }
if (fnew) if (fnew)
list_add_tail(&newchannel->ListEntry, list_add_tail(&newchannel->listentry,
&gVmbusConnection.ChannelList); &gVmbusConnection.ChannelList);
spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
if (!fnew) { if (!fnew) {
DPRINT_DBG(VMBUS, "Ignoring duplicate offer for relid (%d)", DPRINT_DBG(VMBUS, "Ignoring duplicate offer for relid (%d)",
newchannel->OfferMsg.ChildRelId); newchannel->offermsg.child_relid);
free_channel(newchannel); free_channel(newchannel);
return; return;
} }
@ -355,27 +355,27 @@ static void vmbus_process_offer(void *context)
* We need to set the DeviceObject field before calling * We need to set the DeviceObject field before calling
* VmbusChildDeviceAdd() * VmbusChildDeviceAdd()
*/ */
newchannel->DeviceObject = VmbusChildDeviceCreate( newchannel->device_obj = VmbusChildDeviceCreate(
&newchannel->OfferMsg.Offer.InterfaceType, &newchannel->offermsg.offer.InterfaceType,
&newchannel->OfferMsg.Offer.InterfaceInstance, &newchannel->offermsg.offer.InterfaceInstance,
newchannel); newchannel);
DPRINT_DBG(VMBUS, "child device object allocated - %p", DPRINT_DBG(VMBUS, "child device object allocated - %p",
newchannel->DeviceObject); newchannel->device_obj);
/* /*
* Add the new device to the bus. This will kick off device-driver * Add the new device to the bus. This will kick off device-driver
* binding which eventually invokes the device driver's AddDevice() * binding which eventually invokes the device driver's AddDevice()
* method. * method.
*/ */
ret = VmbusChildDeviceAdd(newchannel->DeviceObject); ret = VmbusChildDeviceAdd(newchannel->device_obj);
if (ret != 0) { if (ret != 0) {
DPRINT_ERR(VMBUS, DPRINT_ERR(VMBUS,
"unable to add child device object (relid %d)", "unable to add child device object (relid %d)",
newchannel->OfferMsg.ChildRelId); newchannel->offermsg.child_relid);
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
list_del(&newchannel->ListEntry); list_del(&newchannel->listentry);
spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
free_channel(newchannel); free_channel(newchannel);
@ -385,11 +385,11 @@ static void vmbus_process_offer(void *context)
* so that when we do close the channel normally, we * so that when we do close the channel normally, we
* can cleanup properly * can cleanup properly
*/ */
newchannel->State = CHANNEL_OPEN_STATE; newchannel->state = CHANNEL_OPEN_STATE;
/* Open IC channels */ /* Open IC channels */
for (cnt = 0; cnt < MAX_MSG_TYPES; cnt++) { for (cnt = 0; cnt < MAX_MSG_TYPES; cnt++) {
if (memcmp(&newchannel->OfferMsg.Offer.InterfaceType, if (memcmp(&newchannel->offermsg.offer.InterfaceType,
&hv_cb_utils[cnt].data, &hv_cb_utils[cnt].data,
sizeof(struct hv_guid)) == 0 && sizeof(struct hv_guid)) == 0 &&
vmbus_open(newchannel, 2 * PAGE_SIZE, vmbus_open(newchannel, 2 * PAGE_SIZE,
@ -413,7 +413,7 @@ static void vmbus_process_rescind_offer(void *context)
{ {
struct vmbus_channel *channel = context; struct vmbus_channel *channel = context;
VmbusChildDeviceRemove(channel->DeviceObject); VmbusChildDeviceRemove(channel->device_obj);
} }
/* /*
@ -434,7 +434,7 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr)
offer = (struct vmbus_channel_offer_channel *)hdr; offer = (struct vmbus_channel_offer_channel *)hdr;
for (i = 0; i < MAX_NUM_DEVICE_CLASSES_SUPPORTED; i++) { for (i = 0; i < MAX_NUM_DEVICE_CLASSES_SUPPORTED; i++) {
if (memcmp(&offer->Offer.InterfaceType, if (memcmp(&offer->offer.InterfaceType,
&gSupportedDeviceClasses[i], sizeof(struct hv_guid)) == 0) { &gSupportedDeviceClasses[i], sizeof(struct hv_guid)) == 0) {
fsupported = 1; fsupported = 1;
break; break;
@ -443,12 +443,12 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr)
if (!fsupported) { if (!fsupported) {
DPRINT_DBG(VMBUS, "Ignoring channel offer notification for " DPRINT_DBG(VMBUS, "Ignoring channel offer notification for "
"child relid %d", offer->ChildRelId); "child relid %d", offer->child_relid);
return; return;
} }
guidtype = &offer->Offer.InterfaceType; guidtype = &offer->offer.InterfaceType;
guidinstance = &offer->Offer.InterfaceInstance; guidinstance = &offer->offer.InterfaceInstance;
DPRINT_INFO(VMBUS, "Channel offer notification - " DPRINT_INFO(VMBUS, "Channel offer notification - "
"child relid %d monitor id %d allocated %d, " "child relid %d monitor id %d allocated %d, "
@ -456,8 +456,8 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr)
"%02x%02x%02x%02x%02x%02x%02x%02x} " "%02x%02x%02x%02x%02x%02x%02x%02x} "
"instance {%02x%02x%02x%02x-%02x%02x-%02x%02x-" "instance {%02x%02x%02x%02x-%02x%02x-%02x%02x-"
"%02x%02x%02x%02x%02x%02x%02x%02x}", "%02x%02x%02x%02x%02x%02x%02x%02x}",
offer->ChildRelId, offer->MonitorId, offer->child_relid, offer->monitorid,
offer->MonitorAllocated, offer->monitor_allocated,
guidtype->data[3], guidtype->data[2], guidtype->data[3], guidtype->data[2],
guidtype->data[1], guidtype->data[0], guidtype->data[1], guidtype->data[0],
guidtype->data[5], guidtype->data[4], guidtype->data[5], guidtype->data[4],
@ -484,13 +484,13 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr)
DPRINT_DBG(VMBUS, "channel object allocated - %p", newchannel); DPRINT_DBG(VMBUS, "channel object allocated - %p", newchannel);
memcpy(&newchannel->OfferMsg, offer, memcpy(&newchannel->offermsg, offer,
sizeof(struct vmbus_channel_offer_channel)); sizeof(struct vmbus_channel_offer_channel));
newchannel->MonitorGroup = (u8)offer->MonitorId / 32; newchannel->monitor_grp = (u8)offer->monitorid / 32;
newchannel->MonitorBit = (u8)offer->MonitorId % 32; newchannel->monitor_bit = (u8)offer->monitorid % 32;
/* TODO: Make sure the offer comes from our parent partition */ /* TODO: Make sure the offer comes from our parent partition */
osd_schedule_callback(newchannel->ControlWQ, vmbus_process_offer, osd_schedule_callback(newchannel->controlwq, vmbus_process_offer,
newchannel); newchannel);
} }
@ -505,14 +505,14 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr)
struct vmbus_channel *channel; struct vmbus_channel *channel;
rescind = (struct vmbus_channel_rescind_offer *)hdr; rescind = (struct vmbus_channel_rescind_offer *)hdr;
channel = GetChannelFromRelId(rescind->ChildRelId); channel = GetChannelFromRelId(rescind->child_relid);
if (channel == NULL) { if (channel == NULL) {
DPRINT_DBG(VMBUS, "channel not found for relId %d", DPRINT_DBG(VMBUS, "channel not found for relId %d",
rescind->ChildRelId); rescind->child_relid);
return; return;
} }
osd_schedule_callback(channel->ControlWQ, osd_schedule_callback(channel->controlwq,
vmbus_process_rescind_offer, vmbus_process_rescind_offer,
channel); channel);
} }
@ -545,7 +545,7 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr)
unsigned long flags; unsigned long flags;
result = (struct vmbus_channel_open_result *)hdr; result = (struct vmbus_channel_open_result *)hdr;
DPRINT_DBG(VMBUS, "vmbus open result - %d", result->Status); DPRINT_DBG(VMBUS, "vmbus open result - %d", result->status);
/* /*
* Find the open msg, copy the result and signal/unblock the wait event * Find the open msg, copy the result and signal/unblock the wait event
@ -556,17 +556,17 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr)
/* FIXME: this should probably use list_entry() instead */ /* FIXME: this should probably use list_entry() instead */
msginfo = (struct vmbus_channel_msginfo *)curr; msginfo = (struct vmbus_channel_msginfo *)curr;
requestheader = requestheader =
(struct vmbus_channel_message_header *)msginfo->Msg; (struct vmbus_channel_message_header *)msginfo->msg;
if (requestheader->MessageType == ChannelMessageOpenChannel) { if (requestheader->msgtype == CHANNELMSG_OPENCHANNEL) {
openmsg = openmsg =
(struct vmbus_channel_open_channel *)msginfo->Msg; (struct vmbus_channel_open_channel *)msginfo->msg;
if (openmsg->ChildRelId == result->ChildRelId && if (openmsg->child_relid == result->child_relid &&
openmsg->OpenId == result->OpenId) { openmsg->openid == result->openid) {
memcpy(&msginfo->Response.OpenResult, memcpy(&msginfo->response.open_result,
result, result,
sizeof(struct vmbus_channel_open_result)); sizeof(struct vmbus_channel_open_result));
osd_WaitEventSet(msginfo->WaitEvent); osd_WaitEventSet(msginfo->waitevent);
break; break;
} }
} }
@ -592,7 +592,7 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr)
gpadlcreated = (struct vmbus_channel_gpadl_created *)hdr; gpadlcreated = (struct vmbus_channel_gpadl_created *)hdr;
DPRINT_DBG(VMBUS, "vmbus gpadl created result - %d", DPRINT_DBG(VMBUS, "vmbus gpadl created result - %d",
gpadlcreated->CreationStatus); gpadlcreated->creation_status);
/* /*
* Find the establish msg, copy the result and signal/unblock the wait * Find the establish msg, copy the result and signal/unblock the wait
@ -604,19 +604,19 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr)
/* FIXME: this should probably use list_entry() instead */ /* FIXME: this should probably use list_entry() instead */
msginfo = (struct vmbus_channel_msginfo *)curr; msginfo = (struct vmbus_channel_msginfo *)curr;
requestheader = requestheader =
(struct vmbus_channel_message_header *)msginfo->Msg; (struct vmbus_channel_message_header *)msginfo->msg;
if (requestheader->MessageType == ChannelMessageGpadlHeader) { if (requestheader->msgtype == CHANNELMSG_GPADL_HEADER) {
gpadlheader = gpadlheader =
(struct vmbus_channel_gpadl_header *)requestheader; (struct vmbus_channel_gpadl_header *)requestheader;
if ((gpadlcreated->ChildRelId == if ((gpadlcreated->child_relid ==
gpadlheader->ChildRelId) && gpadlheader->child_relid) &&
(gpadlcreated->Gpadl == gpadlheader->Gpadl)) { (gpadlcreated->gpadl == gpadlheader->gpadl)) {
memcpy(&msginfo->Response.GpadlCreated, memcpy(&msginfo->response.gpadl_created,
gpadlcreated, gpadlcreated,
sizeof(struct vmbus_channel_gpadl_created)); sizeof(struct vmbus_channel_gpadl_created));
osd_WaitEventSet(msginfo->WaitEvent); osd_WaitEventSet(msginfo->waitevent);
break; break;
} }
} }
@ -652,17 +652,17 @@ static void vmbus_ongpadl_torndown(
/* FIXME: this should probably use list_entry() instead */ /* FIXME: this should probably use list_entry() instead */
msginfo = (struct vmbus_channel_msginfo *)curr; msginfo = (struct vmbus_channel_msginfo *)curr;
requestheader = requestheader =
(struct vmbus_channel_message_header *)msginfo->Msg; (struct vmbus_channel_message_header *)msginfo->msg;
if (requestheader->MessageType == ChannelMessageGpadlTeardown) { if (requestheader->msgtype == CHANNELMSG_GPADL_TEARDOWN) {
gpadl_teardown = gpadl_teardown =
(struct vmbus_channel_gpadl_teardown *)requestheader; (struct vmbus_channel_gpadl_teardown *)requestheader;
if (gpadl_torndown->Gpadl == gpadl_teardown->Gpadl) { if (gpadl_torndown->gpadl == gpadl_teardown->gpadl) {
memcpy(&msginfo->Response.GpadlTorndown, memcpy(&msginfo->response.gpadl_torndown,
gpadl_torndown, gpadl_torndown,
sizeof(struct vmbus_channel_gpadl_torndown)); sizeof(struct vmbus_channel_gpadl_torndown));
osd_WaitEventSet(msginfo->WaitEvent); osd_WaitEventSet(msginfo->waitevent);
break; break;
} }
} }
@ -694,16 +694,16 @@ static void vmbus_onversion_response(
/* FIXME: this should probably use list_entry() instead */ /* FIXME: this should probably use list_entry() instead */
msginfo = (struct vmbus_channel_msginfo *)curr; msginfo = (struct vmbus_channel_msginfo *)curr;
requestheader = requestheader =
(struct vmbus_channel_message_header *)msginfo->Msg; (struct vmbus_channel_message_header *)msginfo->msg;
if (requestheader->MessageType == if (requestheader->msgtype ==
ChannelMessageInitiateContact) { CHANNELMSG_INITIATE_CONTACT) {
initiate = initiate =
(struct vmbus_channel_initiate_contact *)requestheader; (struct vmbus_channel_initiate_contact *)requestheader;
memcpy(&msginfo->Response.VersionResponse, memcpy(&msginfo->response.version_response,
version_response, version_response,
sizeof(struct vmbus_channel_version_response)); sizeof(struct vmbus_channel_version_response));
osd_WaitEventSet(msginfo->WaitEvent); osd_WaitEventSet(msginfo->waitevent);
} }
} }
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
@ -711,24 +711,24 @@ static void vmbus_onversion_response(
/* Channel message dispatch table */ /* Channel message dispatch table */
static struct vmbus_channel_message_table_entry static struct vmbus_channel_message_table_entry
gChannelMessageTable[ChannelMessageCount] = { gChannelMessageTable[CHANNELMSG_COUNT] = {
{ChannelMessageInvalid, NULL}, {CHANNELMSG_INVALID, NULL},
{ChannelMessageOfferChannel, vmbus_onoffer}, {CHANNELMSG_OFFERCHANNEL, vmbus_onoffer},
{ChannelMessageRescindChannelOffer, vmbus_onoffer_rescind}, {CHANNELMSG_RESCIND_CHANNELOFFER, vmbus_onoffer_rescind},
{ChannelMessageRequestOffers, NULL}, {CHANNELMSG_REQUESTOFFERS, NULL},
{ChannelMessageAllOffersDelivered, vmbus_onoffers_delivered}, {CHANNELMSG_ALLOFFERS_DELIVERED, vmbus_onoffers_delivered},
{ChannelMessageOpenChannel, NULL}, {CHANNELMSG_OPENCHANNEL, NULL},
{ChannelMessageOpenChannelResult, vmbus_onopen_result}, {CHANNELMSG_OPENCHANNEL_RESULT, vmbus_onopen_result},
{ChannelMessageCloseChannel, NULL}, {CHANNELMSG_CLOSECHANNEL, NULL},
{ChannelMessageGpadlHeader, NULL}, {CHANNELMSG_GPADL_HEADER, NULL},
{ChannelMessageGpadlBody, NULL}, {CHANNELMSG_GPADL_BODY, NULL},
{ChannelMessageGpadlCreated, vmbus_ongpadl_created}, {CHANNELMSG_GPADL_CREATED, vmbus_ongpadl_created},
{ChannelMessageGpadlTeardown, NULL}, {CHANNELMSG_GPADL_TEARDOWN, NULL},
{ChannelMessageGpadlTorndown, vmbus_ongpadl_torndown}, {CHANNELMSG_GPADL_TORNDOWN, vmbus_ongpadl_torndown},
{ChannelMessageRelIdReleased, NULL}, {CHANNELMSG_RELID_RELEASED, NULL},
{ChannelMessageInitiateContact, NULL}, {CHANNELMSG_INITIATE_CONTACT, NULL},
{ChannelMessageVersionResponse, vmbus_onversion_response}, {CHANNELMSG_VERSION_RESPONSE, vmbus_onversion_response},
{ChannelMessageUnload, NULL}, {CHANNELMSG_UNLOAD, NULL},
}; };
/* /*
@ -745,23 +745,23 @@ void vmbus_onmessage(void *context)
hdr = (struct vmbus_channel_message_header *)msg->u.Payload; hdr = (struct vmbus_channel_message_header *)msg->u.Payload;
size = msg->Header.PayloadSize; size = msg->Header.PayloadSize;
DPRINT_DBG(VMBUS, "message type %d size %d", hdr->MessageType, size); DPRINT_DBG(VMBUS, "message type %d size %d", hdr->msgtype, size);
if (hdr->MessageType >= ChannelMessageCount) { if (hdr->msgtype >= CHANNELMSG_COUNT) {
DPRINT_ERR(VMBUS, DPRINT_ERR(VMBUS,
"Received invalid channel message type %d size %d", "Received invalid channel message type %d size %d",
hdr->MessageType, size); hdr->msgtype, size);
print_hex_dump_bytes("", DUMP_PREFIX_NONE, print_hex_dump_bytes("", DUMP_PREFIX_NONE,
(unsigned char *)msg->u.Payload, size); (unsigned char *)msg->u.Payload, size);
kfree(msg); kfree(msg);
return; return;
} }
if (gChannelMessageTable[hdr->MessageType].messageHandler) if (gChannelMessageTable[hdr->msgtype].messageHandler)
gChannelMessageTable[hdr->MessageType].messageHandler(hdr); gChannelMessageTable[hdr->msgtype].messageHandler(hdr);
else else
DPRINT_ERR(VMBUS, "Unhandled channel message type %d", DPRINT_ERR(VMBUS, "Unhandled channel message type %d",
hdr->MessageType); hdr->msgtype);
/* Free the msg that was allocated in VmbusOnMsgDPC() */ /* Free the msg that was allocated in VmbusOnMsgDPC() */
kfree(msg); kfree(msg);
@ -782,15 +782,15 @@ int vmbus_request_offers(void)
if (!msginfo) if (!msginfo)
return -ENOMEM; return -ENOMEM;
msginfo->WaitEvent = osd_WaitEventCreate(); msginfo->waitevent = osd_WaitEventCreate();
if (!msginfo->WaitEvent) { if (!msginfo->waitevent) {
kfree(msginfo); kfree(msginfo);
return -ENOMEM; return -ENOMEM;
} }
msg = (struct vmbus_channel_message_header *)msginfo->Msg; msg = (struct vmbus_channel_message_header *)msginfo->msg;
msg->MessageType = ChannelMessageRequestOffers; msg->msgtype = CHANNELMSG_REQUESTOFFERS;
/*SpinlockAcquire(gVmbusConnection.channelMsgLock); /*SpinlockAcquire(gVmbusConnection.channelMsgLock);
INSERT_TAIL_LIST(&gVmbusConnection.channelMsgList, INSERT_TAIL_LIST(&gVmbusConnection.channelMsgList,
@ -817,7 +817,7 @@ int vmbus_request_offers(void)
Cleanup: Cleanup:
if (msginfo) { if (msginfo) {
kfree(msginfo->WaitEvent); kfree(msginfo->waitevent);
kfree(msginfo); kfree(msginfo);
} }
@ -837,17 +837,17 @@ void vmbus_release_unattached_channels(void)
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
list_for_each_entry_safe(channel, pos, &gVmbusConnection.ChannelList, list_for_each_entry_safe(channel, pos, &gVmbusConnection.ChannelList,
ListEntry) { listentry) {
if (channel == start) if (channel == start)
break; break;
if (!channel->DeviceObject->Driver) { if (!channel->device_obj->Driver) {
list_del(&channel->ListEntry); list_del(&channel->listentry);
DPRINT_INFO(VMBUS, DPRINT_INFO(VMBUS,
"Releasing unattached device object %p", "Releasing unattached device object %p",
channel->DeviceObject); channel->device_obj);
VmbusChildDeviceRemove(channel->DeviceObject); VmbusChildDeviceRemove(channel->device_obj);
free_channel(channel); free_channel(channel);
} else { } else {
if (!start) if (!start)

View File

@ -33,60 +33,60 @@
/* Version 1 messages */ /* Version 1 messages */
enum vmbus_channel_message_type { enum vmbus_channel_message_type {
ChannelMessageInvalid = 0, CHANNELMSG_INVALID = 0,
ChannelMessageOfferChannel = 1, CHANNELMSG_OFFERCHANNEL = 1,
ChannelMessageRescindChannelOffer = 2, CHANNELMSG_RESCIND_CHANNELOFFER = 2,
ChannelMessageRequestOffers = 3, CHANNELMSG_REQUESTOFFERS = 3,
ChannelMessageAllOffersDelivered = 4, CHANNELMSG_ALLOFFERS_DELIVERED = 4,
ChannelMessageOpenChannel = 5, CHANNELMSG_OPENCHANNEL = 5,
ChannelMessageOpenChannelResult = 6, CHANNELMSG_OPENCHANNEL_RESULT = 6,
ChannelMessageCloseChannel = 7, CHANNELMSG_CLOSECHANNEL = 7,
ChannelMessageGpadlHeader = 8, CHANNELMSG_GPADL_HEADER = 8,
ChannelMessageGpadlBody = 9, CHANNELMSG_GPADL_BODY = 9,
ChannelMessageGpadlCreated = 10, CHANNELMSG_GPADL_CREATED = 10,
ChannelMessageGpadlTeardown = 11, CHANNELMSG_GPADL_TEARDOWN = 11,
ChannelMessageGpadlTorndown = 12, CHANNELMSG_GPADL_TORNDOWN = 12,
ChannelMessageRelIdReleased = 13, CHANNELMSG_RELID_RELEASED = 13,
ChannelMessageInitiateContact = 14, CHANNELMSG_INITIATE_CONTACT = 14,
ChannelMessageVersionResponse = 15, CHANNELMSG_VERSION_RESPONSE = 15,
ChannelMessageUnload = 16, CHANNELMSG_UNLOAD = 16,
#ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD #ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
ChannelMessageViewRangeAdd = 17, CHANNELMSG_VIEWRANGE_ADD = 17,
ChannelMessageViewRangeRemove = 18, CHANNELMSG_VIEWRANGE_REMOVE = 18,
#endif #endif
ChannelMessageCount CHANNELMSG_COUNT
}; };
struct vmbus_channel_message_header { struct vmbus_channel_message_header {
enum vmbus_channel_message_type MessageType; enum vmbus_channel_message_type msgtype;
u32 Padding; u32 padding;
} __attribute__((packed)); } __attribute__((packed));
/* Query VMBus Version parameters */ /* Query VMBus Version parameters */
struct vmbus_channel_query_vmbus_version { struct vmbus_channel_query_vmbus_version {
struct vmbus_channel_message_header Header; struct vmbus_channel_message_header header;
u32 Version; u32 version;
} __attribute__((packed)); } __attribute__((packed));
/* VMBus Version Supported parameters */ /* VMBus Version Supported parameters */
struct vmbus_channel_version_supported { struct vmbus_channel_version_supported {
struct vmbus_channel_message_header Header; struct vmbus_channel_message_header header;
bool VersionSupported; bool version_supported;
} __attribute__((packed)); } __attribute__((packed));
/* Offer Channel parameters */ /* Offer Channel parameters */
struct vmbus_channel_offer_channel { struct vmbus_channel_offer_channel {
struct vmbus_channel_message_header Header; struct vmbus_channel_message_header header;
struct vmbus_channel_offer Offer; struct vmbus_channel_offer offer;
u32 ChildRelId; u32 child_relid;
u8 MonitorId; u8 monitorid;
bool MonitorAllocated; bool monitor_allocated;
} __attribute__((packed)); } __attribute__((packed));
/* Rescind Offer parameters */ /* Rescind Offer parameters */
struct vmbus_channel_rescind_offer { struct vmbus_channel_rescind_offer {
struct vmbus_channel_message_header Header; struct vmbus_channel_message_header header;
u32 ChildRelId; u32 child_relid;
} __attribute__((packed)); } __attribute__((packed));
/* /*
@ -100,43 +100,43 @@ struct vmbus_channel_rescind_offer {
/* Open Channel parameters */ /* Open Channel parameters */
struct vmbus_channel_open_channel { struct vmbus_channel_open_channel {
struct vmbus_channel_message_header Header; struct vmbus_channel_message_header header;
/* Identifies the specific VMBus channel that is being opened. */ /* Identifies the specific VMBus channel that is being opened. */
u32 ChildRelId; u32 child_relid;
/* ID making a particular open request at a channel offer unique. */ /* ID making a particular open request at a channel offer unique. */
u32 OpenId; u32 openid;
/* GPADL for the channel's ring buffer. */ /* GPADL for the channel's ring buffer. */
u32 RingBufferGpadlHandle; u32 ringbuffer_gpadlhandle;
/* GPADL for the channel's server context save area. */ /* GPADL for the channel's server context save area. */
u32 ServerContextAreaGpadlHandle; u32 server_contextarea_gpadlhandle;
/* /*
* The upstream ring buffer begins at offset zero in the memory * The upstream ring buffer begins at offset zero in the memory
* described by RingBufferGpadlHandle. The downstream ring buffer * described by RingBufferGpadlHandle. The downstream ring buffer
* follows it at this offset (in pages). * follows it at this offset (in pages).
*/ */
u32 DownstreamRingBufferPageOffset; u32 downstream_ringbuffer_pageoffset;
/* User-specific data to be passed along to the server endpoint. */ /* User-specific data to be passed along to the server endpoint. */
unsigned char UserData[MAX_USER_DEFINED_BYTES]; unsigned char userdata[MAX_USER_DEFINED_BYTES];
} __attribute__((packed)); } __attribute__((packed));
/* Open Channel Result parameters */ /* Open Channel Result parameters */
struct vmbus_channel_open_result { struct vmbus_channel_open_result {
struct vmbus_channel_message_header Header; struct vmbus_channel_message_header header;
u32 ChildRelId; u32 child_relid;
u32 OpenId; u32 openid;
u32 Status; u32 status;
} __attribute__((packed)); } __attribute__((packed));
/* Close channel parameters; */ /* Close channel parameters; */
struct vmbus_channel_close_channel { struct vmbus_channel_close_channel {
struct vmbus_channel_message_header Header; struct vmbus_channel_message_header header;
u32 ChildRelId; u32 child_relid;
} __attribute__((packed)); } __attribute__((packed));
/* Channel Message GPADL */ /* Channel Message GPADL */
@ -151,72 +151,72 @@ struct vmbus_channel_close_channel {
* follow-up packet that contains more. * follow-up packet that contains more.
*/ */
struct vmbus_channel_gpadl_header { struct vmbus_channel_gpadl_header {
struct vmbus_channel_message_header Header; struct vmbus_channel_message_header header;
u32 ChildRelId; u32 child_relid;
u32 Gpadl; u32 gpadl;
u16 RangeBufLen; u16 range_buflen;
u16 RangeCount; u16 rangecount;
struct gpa_range Range[0]; struct gpa_range range[0];
} __attribute__((packed)); } __attribute__((packed));
/* This is the followup packet that contains more PFNs. */ /* This is the followup packet that contains more PFNs. */
struct vmbus_channel_gpadl_body { struct vmbus_channel_gpadl_body {
struct vmbus_channel_message_header Header; struct vmbus_channel_message_header header;
u32 MessageNumber; u32 msgnumber;
u32 Gpadl; u32 gpadl;
u64 Pfn[0]; u64 pfn[0];
} __attribute__((packed)); } __attribute__((packed));
struct vmbus_channel_gpadl_created { struct vmbus_channel_gpadl_created {
struct vmbus_channel_message_header Header; struct vmbus_channel_message_header header;
u32 ChildRelId; u32 child_relid;
u32 Gpadl; u32 gpadl;
u32 CreationStatus; u32 creation_status;
} __attribute__((packed)); } __attribute__((packed));
struct vmbus_channel_gpadl_teardown { struct vmbus_channel_gpadl_teardown {
struct vmbus_channel_message_header Header; struct vmbus_channel_message_header header;
u32 ChildRelId; u32 child_relid;
u32 Gpadl; u32 gpadl;
} __attribute__((packed)); } __attribute__((packed));
struct vmbus_channel_gpadl_torndown { struct vmbus_channel_gpadl_torndown {
struct vmbus_channel_message_header Header; struct vmbus_channel_message_header header;
u32 Gpadl; u32 gpadl;
} __attribute__((packed)); } __attribute__((packed));
#ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD #ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
struct vmbus_channel_view_range_add { struct vmbus_channel_view_range_add {
struct vmbus_channel_message_header Header; struct vmbus_channel_message_header header;
PHYSICAL_ADDRESS ViewRangeBase; PHYSICAL_ADDRESS viewrange_base;
u64 ViewRangeLength; u64 viewrange_length;
u32 ChildRelId; u32 child_relid;
} __attribute__((packed)); } __attribute__((packed));
struct vmbus_channel_view_range_remove { struct vmbus_channel_view_range_remove {
struct vmbus_channel_message_header Header; struct vmbus_channel_message_header header;
PHYSICAL_ADDRESS ViewRangeBase; PHYSICAL_ADDRESS viewrange_base;
u32 ChildRelId; u32 child_relid;
} __attribute__((packed)); } __attribute__((packed));
#endif #endif
struct vmbus_channel_relid_released { struct vmbus_channel_relid_released {
struct vmbus_channel_message_header Header; struct vmbus_channel_message_header header;
u32 ChildRelId; u32 child_relid;
} __attribute__((packed)); } __attribute__((packed));
struct vmbus_channel_initiate_contact { struct vmbus_channel_initiate_contact {
struct vmbus_channel_message_header Header; struct vmbus_channel_message_header header;
u32 VMBusVersionRequested; u32 vmbus_version_requested;
u32 Padding2; u32 padding2;
u64 InterruptPage; u64 interrupt_page;
u64 MonitorPage1; u64 monitor_page1;
u64 MonitorPage2; u64 monitor_page2;
} __attribute__((packed)); } __attribute__((packed));
struct vmbus_channel_version_response { struct vmbus_channel_version_response {
struct vmbus_channel_message_header Header; struct vmbus_channel_message_header header;
bool VersionSupported; bool version_supported;
} __attribute__((packed)); } __attribute__((packed));
enum vmbus_channel_state { enum vmbus_channel_state {
@ -226,54 +226,54 @@ enum vmbus_channel_state {
}; };
struct vmbus_channel { struct vmbus_channel {
struct list_head ListEntry; struct list_head listentry;
struct hv_device *DeviceObject; struct hv_device *device_obj;
struct timer_list poll_timer; /* SA-111 workaround */ struct timer_list poll_timer; /* SA-111 workaround */
enum vmbus_channel_state State; enum vmbus_channel_state state;
struct vmbus_channel_offer_channel OfferMsg; struct vmbus_channel_offer_channel offermsg;
/* /*
* These are based on the OfferMsg.MonitorId. * These are based on the OfferMsg.MonitorId.
* Save it here for easy access. * Save it here for easy access.
*/ */
u8 MonitorGroup; u8 monitor_grp;
u8 MonitorBit; u8 monitor_bit;
u32 RingBufferGpadlHandle; u32 ringbuffer_gpadlhandle;
/* Allocated memory for ring buffer */ /* Allocated memory for ring buffer */
void *RingBufferPages; void *ringbuffer_pages;
u32 RingBufferPageCount; u32 ringbuffer_pagecount;
struct hv_ring_buffer_info Outbound; /* send to parent */ struct hv_ring_buffer_info outbound; /* send to parent */
struct hv_ring_buffer_info Inbound; /* receive from parent */ struct hv_ring_buffer_info inbound; /* receive from parent */
spinlock_t inbound_lock; spinlock_t inbound_lock;
struct workqueue_struct *ControlWQ; struct workqueue_struct *controlwq;
/* Channel callback are invoked in this workqueue context */ /* Channel callback are invoked in this workqueue context */
/* HANDLE dataWorkQueue; */ /* HANDLE dataWorkQueue; */
void (*OnChannelCallback)(void *context); void (*onchannel_callback)(void *context);
void *ChannelCallbackContext; void *channel_callback_context;
}; };
struct vmbus_channel_debug_info { struct vmbus_channel_debug_info {
u32 RelId; u32 relid;
enum vmbus_channel_state State; enum vmbus_channel_state state;
struct hv_guid InterfaceType; struct hv_guid interfacetype;
struct hv_guid InterfaceInstance; struct hv_guid interface_instance;
u32 MonitorId; u32 monitorid;
u32 ServerMonitorPending; u32 servermonitor_pending;
u32 ServerMonitorLatency; u32 servermonitor_latency;
u32 ServerMonitorConnectionId; u32 servermonitor_connectionid;
u32 ClientMonitorPending; u32 clientmonitor_pending;
u32 ClientMonitorLatency; u32 clientmonitor_latency;
u32 ClientMonitorConnectionId; u32 clientmonitor_connectionid;
struct hv_ring_buffer_debug_info Inbound; struct hv_ring_buffer_debug_info inbound;
struct hv_ring_buffer_debug_info Outbound; struct hv_ring_buffer_debug_info outbound;
}; };
/* /*
@ -282,28 +282,28 @@ struct vmbus_channel_debug_info {
*/ */
struct vmbus_channel_msginfo { struct vmbus_channel_msginfo {
/* Bookkeeping stuff */ /* Bookkeeping stuff */
struct list_head MsgListEntry; struct list_head msglistentry;
/* So far, this is only used to handle gpadl body message */ /* So far, this is only used to handle gpadl body message */
struct list_head SubMsgList; struct list_head submsglist;
/* Synchronize the request/response if needed */ /* Synchronize the request/response if needed */
struct osd_waitevent *WaitEvent; struct osd_waitevent *waitevent;
union { union {
struct vmbus_channel_version_supported VersionSupported; struct vmbus_channel_version_supported version_supported;
struct vmbus_channel_open_result OpenResult; struct vmbus_channel_open_result open_result;
struct vmbus_channel_gpadl_torndown GpadlTorndown; struct vmbus_channel_gpadl_torndown gpadl_torndown;
struct vmbus_channel_gpadl_created GpadlCreated; struct vmbus_channel_gpadl_created gpadl_created;
struct vmbus_channel_version_response VersionResponse; struct vmbus_channel_version_response version_response;
} Response; } response;
u32 MessageSize; u32 msgsize;
/* /*
* The channel message that goes out on the "wire". * The channel message that goes out on the "wire".
* It will contain at minimum the VMBUS_CHANNEL_MESSAGE_HEADER header * It will contain at minimum the VMBUS_CHANNEL_MESSAGE_HEADER header
*/ */
unsigned char Msg[0]; unsigned char msg[0];
}; };

View File

@ -95,19 +95,19 @@ int VmbusConnect(void)
goto Cleanup; goto Cleanup;
} }
msgInfo->WaitEvent = osd_WaitEventCreate(); msgInfo->waitevent = osd_WaitEventCreate();
if (!msgInfo->WaitEvent) { if (!msgInfo->waitevent) {
ret = -ENOMEM; ret = -ENOMEM;
goto Cleanup; goto Cleanup;
} }
msg = (struct vmbus_channel_initiate_contact *)msgInfo->Msg; msg = (struct vmbus_channel_initiate_contact *)msgInfo->msg;
msg->Header.MessageType = ChannelMessageInitiateContact; msg->header.msgtype = CHANNELMSG_INITIATE_CONTACT;
msg->VMBusVersionRequested = VMBUS_REVISION_NUMBER; msg->vmbus_version_requested = VMBUS_REVISION_NUMBER;
msg->InterruptPage = virt_to_phys(gVmbusConnection.InterruptPage); msg->interrupt_page = virt_to_phys(gVmbusConnection.InterruptPage);
msg->MonitorPage1 = virt_to_phys(gVmbusConnection.MonitorPages); msg->monitor_page1 = virt_to_phys(gVmbusConnection.MonitorPages);
msg->MonitorPage2 = virt_to_phys( msg->monitor_page2 = virt_to_phys(
(void *)((unsigned long)gVmbusConnection.MonitorPages + (void *)((unsigned long)gVmbusConnection.MonitorPages +
PAGE_SIZE)); PAGE_SIZE));
@ -116,30 +116,30 @@ int VmbusConnect(void)
* receive the response before returning from this routine * receive the response before returning from this routine
*/ */
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
list_add_tail(&msgInfo->MsgListEntry, list_add_tail(&msgInfo->msglistentry,
&gVmbusConnection.ChannelMsgList); &gVmbusConnection.ChannelMsgList);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
DPRINT_DBG(VMBUS, "Vmbus connection - interrupt pfn %llx, " DPRINT_DBG(VMBUS, "Vmbus connection - interrupt pfn %llx, "
"monitor1 pfn %llx,, monitor2 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..."); DPRINT_DBG(VMBUS, "Sending channel initiate msg...");
ret = VmbusPostMessage(msg, ret = VmbusPostMessage(msg,
sizeof(struct vmbus_channel_initiate_contact)); sizeof(struct vmbus_channel_initiate_contact));
if (ret != 0) { if (ret != 0) {
list_del(&msgInfo->MsgListEntry); list_del(&msgInfo->msglistentry);
goto Cleanup; goto Cleanup;
} }
/* Wait for the connection response */ /* Wait for the connection response */
osd_WaitEventWait(msgInfo->WaitEvent); osd_WaitEventWait(msgInfo->waitevent);
list_del(&msgInfo->MsgListEntry); list_del(&msgInfo->msglistentry);
/* Check if successful */ /* Check if successful */
if (msgInfo->Response.VersionResponse.VersionSupported) { if (msgInfo->response.version_response.version_supported) {
DPRINT_INFO(VMBUS, "Vmbus connected!!"); DPRINT_INFO(VMBUS, "Vmbus connected!!");
gVmbusConnection.ConnectState = Connected; gVmbusConnection.ConnectState = Connected;
@ -151,7 +151,7 @@ int VmbusConnect(void)
goto Cleanup; goto Cleanup;
} }
kfree(msgInfo->WaitEvent); kfree(msgInfo->waitevent);
kfree(msgInfo); kfree(msgInfo);
return 0; return 0;
@ -172,7 +172,7 @@ Cleanup:
} }
if (msgInfo) { if (msgInfo) {
kfree(msgInfo->WaitEvent); kfree(msgInfo->waitevent);
kfree(msgInfo); kfree(msgInfo);
} }
@ -195,7 +195,7 @@ int VmbusDisconnect(void)
if (!msg) if (!msg)
return -ENOMEM; return -ENOMEM;
msg->MessageType = ChannelMessageUnload; msg->msgtype = CHANNELMSG_UNLOAD;
ret = VmbusPostMessage(msg, ret = VmbusPostMessage(msg,
sizeof(struct vmbus_channel_message_header)); sizeof(struct vmbus_channel_message_header));
@ -226,8 +226,8 @@ struct vmbus_channel *GetChannelFromRelId(u32 relId)
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
list_for_each_entry(channel, &gVmbusConnection.ChannelList, ListEntry) { list_for_each_entry(channel, &gVmbusConnection.ChannelList, listentry) {
if (channel->OfferMsg.ChildRelId == relId) { if (channel->offermsg.child_relid == relId) {
foundChannel = channel; foundChannel = channel;
break; break;
} }

View File

@ -271,15 +271,15 @@ static int __init init_hyperv_utils(void)
if (!dmi_check_system(hv_utils_dmi_table)) if (!dmi_check_system(hv_utils_dmi_table))
return -ENODEV; return -ENODEV;
hv_cb_utils[HV_SHUTDOWN_MSG].channel->OnChannelCallback = hv_cb_utils[HV_SHUTDOWN_MSG].channel->onchannel_callback =
&shutdown_onchannelcallback; &shutdown_onchannelcallback;
hv_cb_utils[HV_SHUTDOWN_MSG].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; &timesync_onchannelcallback;
hv_cb_utils[HV_TIMESYNC_MSG].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; &heartbeat_onchannelcallback;
hv_cb_utils[HV_HEARTBEAT_MSG].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"); 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; &chn_cb_negotiate;
hv_cb_utils[HV_SHUTDOWN_MSG].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; &chn_cb_negotiate;
hv_cb_utils[HV_TIMESYNC_MSG].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; &chn_cb_negotiate;
hv_cb_utils[HV_HEARTBEAT_MSG].callback = &chn_cb_negotiate; hv_cb_utils[HV_HEARTBEAT_MSG].callback = &chn_cb_negotiate;
} }

View File

@ -139,35 +139,35 @@ static void get_channel_info(struct hv_device *device,
vmbus_get_debug_info(device->channel, &debug_info); vmbus_get_debug_info(device->channel, &debug_info);
info->ChannelId = debug_info.RelId; info->ChannelId = debug_info.relid;
info->ChannelState = debug_info.State; info->ChannelState = debug_info.state;
memcpy(&info->ChannelType, &debug_info.InterfaceType, memcpy(&info->ChannelType, &debug_info.interfacetype,
sizeof(struct hv_guid)); sizeof(struct hv_guid));
memcpy(&info->ChannelInstance, &debug_info.InterfaceInstance, memcpy(&info->ChannelInstance, &debug_info.interface_instance,
sizeof(struct hv_guid)); sizeof(struct hv_guid));
info->MonitorId = debug_info.MonitorId; info->MonitorId = debug_info.monitorid;
info->ServerMonitorPending = debug_info.ServerMonitorPending; info->ServerMonitorPending = debug_info.servermonitor_pending;
info->ServerMonitorLatency = debug_info.ServerMonitorLatency; info->ServerMonitorLatency = debug_info.servermonitor_latency;
info->ServerMonitorConnectionId = debug_info.ServerMonitorConnectionId; info->ServerMonitorConnectionId = debug_info.servermonitor_connectionid;
info->ClientMonitorPending = debug_info.ClientMonitorPending; info->ClientMonitorPending = debug_info.clientmonitor_pending;
info->ClientMonitorLatency = debug_info.ClientMonitorLatency; info->ClientMonitorLatency = debug_info.clientmonitor_latency;
info->ClientMonitorConnectionId = debug_info.ClientMonitorConnectionId; info->ClientMonitorConnectionId = debug_info.clientmonitor_connectionid;
info->Inbound.InterruptMask = debug_info.Inbound.CurrentInterruptMask; info->Inbound.InterruptMask = debug_info.inbound.CurrentInterruptMask;
info->Inbound.ReadIndex = debug_info.Inbound.CurrentReadIndex; info->Inbound.ReadIndex = debug_info.inbound.CurrentReadIndex;
info->Inbound.WriteIndex = debug_info.Inbound.CurrentWriteIndex; info->Inbound.WriteIndex = debug_info.inbound.CurrentWriteIndex;
info->Inbound.BytesAvailToRead = debug_info.Inbound.BytesAvailToRead; info->Inbound.BytesAvailToRead = debug_info.inbound.BytesAvailToRead;
info->Inbound.BytesAvailToWrite = debug_info.Inbound.BytesAvailToWrite; info->Inbound.BytesAvailToWrite = debug_info.inbound.BytesAvailToWrite;
info->Outbound.InterruptMask = debug_info.Outbound.CurrentInterruptMask; info->Outbound.InterruptMask = debug_info.outbound.CurrentInterruptMask;
info->Outbound.ReadIndex = debug_info.Outbound.CurrentReadIndex; info->Outbound.ReadIndex = debug_info.outbound.CurrentReadIndex;
info->Outbound.WriteIndex = debug_info.Outbound.CurrentWriteIndex; info->Outbound.WriteIndex = debug_info.outbound.CurrentWriteIndex;
info->Outbound.BytesAvailToRead = debug_info.Outbound.BytesAvailToRead; info->Outbound.BytesAvailToRead = debug_info.outbound.BytesAvailToRead;
info->Outbound.BytesAvailToWrite = info->Outbound.BytesAvailToWrite =
debug_info.Outbound.BytesAvailToWrite; debug_info.outbound.BytesAvailToWrite;
} }
/* /*