Commit 15b2f647 authored by Haiyang Zhang's avatar Haiyang Zhang Committed by Greg Kroah-Hartman

staging: hv: Convert camel cased variables in connection.c 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 a6238f21
...@@ -77,10 +77,10 @@ static void vmbus_setevent(struct vmbus_channel *channel) ...@@ -77,10 +77,10 @@ static void vmbus_setevent(struct vmbus_channel *channel)
if (channel->offermsg.monitor_allocated) { if (channel->offermsg.monitor_allocated) {
/* Each u32 represents 32 channels */ /* Each u32 represents 32 channels */
set_bit(channel->offermsg.child_relid & 31, set_bit(channel->offermsg.child_relid & 31,
(unsigned long *) gVmbusConnection.SendInterruptPage + (unsigned long *) vmbus_connection.SendInterruptPage +
(channel->offermsg.child_relid >> 5)); (channel->offermsg.child_relid >> 5));
monitorpage = gVmbusConnection.MonitorPages; monitorpage = vmbus_connection.MonitorPages;
monitorpage++; /* Get the child to parent monitor page */ monitorpage++; /* Get the child to parent monitor page */
set_bit(channel->monitor_bit, set_bit(channel->monitor_bit,
...@@ -100,11 +100,11 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel) ...@@ -100,11 +100,11 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel)
if (Channel->offermsg.monitor_allocated) { if (Channel->offermsg.monitor_allocated) {
/* Each u32 represents 32 channels */ /* Each u32 represents 32 channels */
clear_bit(Channel->offermsg.child_relid & 31, clear_bit(Channel->offermsg.child_relid & 31,
(unsigned long *)gVmbusConnection.SendInterruptPage + (unsigned long *)vmbus_connection.SendInterruptPage +
(Channel->offermsg.child_relid >> 5)); (Channel->offermsg.child_relid >> 5));
monitorPage = monitorPage =
(struct hv_monitor_page *)gVmbusConnection.MonitorPages; (struct hv_monitor_page *)vmbus_connection.MonitorPages;
monitorPage++; /* Get the child to parent monitor page */ monitorPage++; /* Get the child to parent monitor page */
clear_bit(Channel->monitor_bit, clear_bit(Channel->monitor_bit,
...@@ -133,7 +133,7 @@ void vmbus_get_debug_info(struct vmbus_channel *channel, ...@@ -133,7 +133,7 @@ void vmbus_get_debug_info(struct vmbus_channel *channel,
&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 *)vmbus_connection.MonitorPages;
debuginfo->monitorid = channel->offermsg.monitorid; debuginfo->monitorid = channel->offermsg.monitorid;
...@@ -265,10 +265,10 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, ...@@ -265,10 +265,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(&vmbus_connection.channelmsg_lock, flags);
list_add_tail(&openInfo->msglistentry, list_add_tail(&openInfo->msglistentry,
&gVmbusConnection.ChannelMsgList); &vmbus_connection.ChannelMsgList);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
DPRINT_DBG(VMBUS, "Sending channel open msg..."); DPRINT_DBG(VMBUS, "Sending channel open msg...");
...@@ -289,9 +289,9 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, ...@@ -289,9 +289,9 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
newchannel, openInfo->response.open_result.status); newchannel, openInfo->response.open_result.status);
Cleanup: Cleanup:
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_del(&openInfo->msglistentry); list_del(&openInfo->msglistentry);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
kfree(openInfo->waitevent); kfree(openInfo->waitevent);
kfree(openInfo); kfree(openInfo);
...@@ -501,8 +501,8 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, ...@@ -501,8 +501,8 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
unsigned long flags; unsigned long flags;
int ret = 0; int ret = 0;
next_gpadl_handle = atomic_read(&gVmbusConnection.NextGpadlHandle); next_gpadl_handle = atomic_read(&vmbus_connection.NextGpadlHandle);
atomic_inc(&gVmbusConnection.NextGpadlHandle); atomic_inc(&vmbus_connection.NextGpadlHandle);
ret = create_gpadl_header(kbuffer, size, &msginfo, &msgcount); ret = create_gpadl_header(kbuffer, size, &msginfo, &msgcount);
if (ret) if (ret)
...@@ -521,11 +521,11 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, ...@@ -521,11 +521,11 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
dump_gpadl_header(gpadlmsg); dump_gpadl_header(gpadlmsg);
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_add_tail(&msginfo->msglistentry, list_add_tail(&msginfo->msglistentry,
&gVmbusConnection.ChannelMsgList); &vmbus_connection.ChannelMsgList);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
DPRINT_DBG(VMBUS, "buffer %p, size %d msg cnt %d", DPRINT_DBG(VMBUS, "buffer %p, size %d msg cnt %d",
kbuffer, size, msgcount); kbuffer, size, msgcount);
...@@ -577,9 +577,9 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, ...@@ -577,9 +577,9 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
*gpadl_handle = gpadlmsg->gpadl; *gpadl_handle = gpadlmsg->gpadl;
Cleanup: Cleanup:
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_del(&msginfo->msglistentry); list_del(&msginfo->msglistentry);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
kfree(msginfo->waitevent); kfree(msginfo->waitevent);
kfree(msginfo); kfree(msginfo);
...@@ -616,10 +616,10 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) ...@@ -616,10 +616,10 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
msg->child_relid = channel->offermsg.child_relid; 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(&vmbus_connection.channelmsg_lock, flags);
list_add_tail(&info->msglistentry, list_add_tail(&info->msglistentry,
&gVmbusConnection.ChannelMsgList); &vmbus_connection.ChannelMsgList);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
ret = VmbusPostMessage(msg, ret = VmbusPostMessage(msg,
sizeof(struct vmbus_channel_gpadl_teardown)); sizeof(struct vmbus_channel_gpadl_teardown));
...@@ -631,9 +631,9 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) ...@@ -631,9 +631,9 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
osd_waitevent_wait(info->waitevent); osd_waitevent_wait(info->waitevent);
/* Received a torndown response */ /* Received a torndown response */
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_del(&info->msglistentry); list_del(&info->msglistentry);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
kfree(info->waitevent); kfree(info->waitevent);
kfree(info); kfree(info);
...@@ -697,9 +697,9 @@ void vmbus_close(struct vmbus_channel *channel) ...@@ -697,9 +697,9 @@ void vmbus_close(struct vmbus_channel *channel)
*/ */
if (channel->state == CHANNEL_OPEN_STATE) { if (channel->state == CHANNEL_OPEN_STATE) {
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
list_del(&channel->listentry); list_del(&channel->listentry);
spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
free_channel(channel); free_channel(channel);
} }
......
...@@ -308,7 +308,7 @@ void free_channel(struct vmbus_channel *channel) ...@@ -308,7 +308,7 @@ void free_channel(struct vmbus_channel *channel)
* ie we can't destroy ourselves. * ie we can't destroy ourselves.
*/ */
INIT_WORK(&channel->work, release_channel); INIT_WORK(&channel->work, release_channel);
queue_work(gVmbusConnection.WorkQueue, &channel->work); queue_work(vmbus_connection.WorkQueue, &channel->work);
} }
...@@ -323,10 +323,10 @@ static void count_hv_channel(void) ...@@ -323,10 +323,10 @@ static void count_hv_channel(void)
static int counter; static int counter;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
if (++counter == MAX_MSG_TYPES) if (++counter == MAX_MSG_TYPES)
complete(&hv_channel_ready); complete(&hv_channel_ready);
spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
} }
/* /*
...@@ -361,9 +361,9 @@ static void vmbus_process_offer(struct work_struct *work) ...@@ -361,9 +361,9 @@ static void vmbus_process_offer(struct work_struct *work)
INIT_WORK(&newchannel->work, vmbus_process_rescind_offer); INIT_WORK(&newchannel->work, vmbus_process_rescind_offer);
/* Make sure this is a new offer */ /* Make sure this is a new offer */
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
list_for_each_entry(channel, &gVmbusConnection.ChannelList, listentry) { list_for_each_entry(channel, &vmbus_connection.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)) &&
...@@ -377,9 +377,9 @@ static void vmbus_process_offer(struct work_struct *work) ...@@ -377,9 +377,9 @@ static void vmbus_process_offer(struct work_struct *work)
if (fnew) if (fnew)
list_add_tail(&newchannel->listentry, list_add_tail(&newchannel->listentry,
&gVmbusConnection.ChannelList); &vmbus_connection.ChannelList);
spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); spin_unlock_irqrestore(&vmbus_connection.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)",
...@@ -412,9 +412,9 @@ static void vmbus_process_offer(struct work_struct *work) ...@@ -412,9 +412,9 @@ static void vmbus_process_offer(struct work_struct *work)
"unable to add child device object (relid %d)", "unable to add child device object (relid %d)",
newchannel->offermsg.child_relid); newchannel->offermsg.child_relid);
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
list_del(&newchannel->listentry); list_del(&newchannel->listentry);
spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
free_channel(newchannel); free_channel(newchannel);
} else { } else {
...@@ -577,9 +577,9 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr) ...@@ -577,9 +577,9 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr)
/* /*
* 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
*/ */
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_for_each(curr, &gVmbusConnection.ChannelMsgList) { list_for_each(curr, &vmbus_connection.ChannelMsgList) {
/* 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 =
...@@ -598,7 +598,7 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr) ...@@ -598,7 +598,7 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr)
} }
} }
} }
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
} }
/* /*
...@@ -625,9 +625,9 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr) ...@@ -625,9 +625,9 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr)
* Find the establish msg, copy the result and signal/unblock the wait * Find the establish msg, copy the result and signal/unblock the wait
* event * event
*/ */
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_for_each(curr, &gVmbusConnection.ChannelMsgList) { list_for_each(curr, &vmbus_connection.ChannelMsgList) {
/* 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 =
...@@ -648,7 +648,7 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr) ...@@ -648,7 +648,7 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr)
} }
} }
} }
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
} }
/* /*
...@@ -673,9 +673,9 @@ static void vmbus_ongpadl_torndown( ...@@ -673,9 +673,9 @@ static void vmbus_ongpadl_torndown(
/* /*
* 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
*/ */
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_for_each(curr, &gVmbusConnection.ChannelMsgList) { list_for_each(curr, &vmbus_connection.ChannelMsgList) {
/* 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 =
...@@ -694,7 +694,7 @@ static void vmbus_ongpadl_torndown( ...@@ -694,7 +694,7 @@ static void vmbus_ongpadl_torndown(
} }
} }
} }
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
} }
/* /*
...@@ -715,9 +715,9 @@ static void vmbus_onversion_response( ...@@ -715,9 +715,9 @@ static void vmbus_onversion_response(
unsigned long flags; unsigned long flags;
version_response = (struct vmbus_channel_version_response *)hdr; version_response = (struct vmbus_channel_version_response *)hdr;
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_for_each(curr, &gVmbusConnection.ChannelMsgList) { list_for_each(curr, &vmbus_connection.ChannelMsgList) {
/* 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 =
...@@ -733,7 +733,7 @@ static void vmbus_onversion_response( ...@@ -733,7 +733,7 @@ static void vmbus_onversion_response(
osd_waitevent_set(msginfo->waitevent); osd_waitevent_set(msginfo->waitevent);
} }
} }
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
} }
/* Channel message dispatch table */ /* Channel message dispatch table */
...@@ -857,9 +857,9 @@ void vmbus_release_unattached_channels(void) ...@@ -857,9 +857,9 @@ void vmbus_release_unattached_channels(void)
struct vmbus_channel *start = NULL; struct vmbus_channel *start = NULL;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
list_for_each_entry_safe(channel, pos, &gVmbusConnection.ChannelList, list_for_each_entry_safe(channel, pos, &vmbus_connection.ChannelList,
listentry) { listentry) {
if (channel == start) if (channel == start)
break; break;
...@@ -878,7 +878,7 @@ void vmbus_release_unattached_channels(void) ...@@ -878,7 +878,7 @@ void vmbus_release_unattached_channels(void)
} }
} }
spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
} }
/* eof */ /* eof */
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "vmbus_private.h" #include "vmbus_private.h"
struct VMBUS_CONNECTION gVmbusConnection = { struct VMBUS_CONNECTION vmbus_connection = {
.ConnectState = Disconnected, .ConnectState = Disconnected,
.NextGpadlHandle = ATOMIC_INIT(0xE1E10), .NextGpadlHandle = ATOMIC_INIT(0xE1E10),
}; };
...@@ -40,86 +40,86 @@ struct VMBUS_CONNECTION gVmbusConnection = { ...@@ -40,86 +40,86 @@ struct VMBUS_CONNECTION gVmbusConnection = {
int VmbusConnect(void) int VmbusConnect(void)
{ {
int ret = 0; int ret = 0;
struct vmbus_channel_msginfo *msgInfo = NULL; struct vmbus_channel_msginfo *msginfo = NULL;
struct vmbus_channel_initiate_contact *msg; struct vmbus_channel_initiate_contact *msg;
unsigned long flags; unsigned long flags;
/* Make sure we are not connecting or connected */ /* Make sure we are not connecting or connected */
if (gVmbusConnection.ConnectState != Disconnected) if (vmbus_connection.ConnectState != Disconnected)
return -1; return -1;
/* Initialize the vmbus connection */ /* Initialize the vmbus connection */
gVmbusConnection.ConnectState = Connecting; vmbus_connection.ConnectState = Connecting;
gVmbusConnection.WorkQueue = create_workqueue("hv_vmbus_con"); vmbus_connection.WorkQueue = create_workqueue("hv_vmbus_con");
if (!gVmbusConnection.WorkQueue) { if (!vmbus_connection.WorkQueue) {
ret = -1; ret = -1;
goto Cleanup; goto Cleanup;
} }
INIT_LIST_HEAD(&gVmbusConnection.ChannelMsgList); INIT_LIST_HEAD(&vmbus_connection.ChannelMsgList);
spin_lock_init(&gVmbusConnection.channelmsg_lock); spin_lock_init(&vmbus_connection.channelmsg_lock);
INIT_LIST_HEAD(&gVmbusConnection.ChannelList); INIT_LIST_HEAD(&vmbus_connection.ChannelList);
spin_lock_init(&gVmbusConnection.channel_lock); spin_lock_init(&vmbus_connection.channel_lock);
/* /*
* Setup the vmbus event connection for channel interrupt * Setup the vmbus event connection for channel interrupt
* abstraction stuff * abstraction stuff
*/ */
gVmbusConnection.InterruptPage = osd_page_alloc(1); vmbus_connection.InterruptPage = osd_page_alloc(1);
if (gVmbusConnection.InterruptPage == NULL) { if (vmbus_connection.InterruptPage == NULL) {
ret = -1; ret = -1;
goto Cleanup; goto Cleanup;
} }
gVmbusConnection.RecvInterruptPage = gVmbusConnection.InterruptPage; vmbus_connection.RecvInterruptPage = vmbus_connection.InterruptPage;
gVmbusConnection.SendInterruptPage = vmbus_connection.SendInterruptPage =
(void *)((unsigned long)gVmbusConnection.InterruptPage + (void *)((unsigned long)vmbus_connection.InterruptPage +
(PAGE_SIZE >> 1)); (PAGE_SIZE >> 1));
/* /*
* Setup the monitor notification facility. The 1st page for * Setup the monitor notification facility. The 1st page for
* parent->child and the 2nd page for child->parent * parent->child and the 2nd page for child->parent
*/ */
gVmbusConnection.MonitorPages = osd_page_alloc(2); vmbus_connection.MonitorPages = osd_page_alloc(2);
if (gVmbusConnection.MonitorPages == NULL) { if (vmbus_connection.MonitorPages == NULL) {
ret = -1; ret = -1;
goto Cleanup; goto Cleanup;
} }
msgInfo = kzalloc(sizeof(*msgInfo) + msginfo = kzalloc(sizeof(*msginfo) +
sizeof(struct vmbus_channel_initiate_contact), sizeof(struct vmbus_channel_initiate_contact),
GFP_KERNEL); GFP_KERNEL);
if (msgInfo == NULL) { if (msginfo == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto Cleanup; goto Cleanup;
} }
msgInfo->waitevent = osd_waitevent_create(); msginfo->waitevent = osd_waitevent_create();
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.msgtype = CHANNELMSG_INITIATE_CONTACT; msg->header.msgtype = CHANNELMSG_INITIATE_CONTACT;
msg->vmbus_version_requested = VMBUS_REVISION_NUMBER; msg->vmbus_version_requested = VMBUS_REVISION_NUMBER;
msg->interrupt_page = virt_to_phys(gVmbusConnection.InterruptPage); msg->interrupt_page = virt_to_phys(vmbus_connection.InterruptPage);
msg->monitor_page1 = virt_to_phys(gVmbusConnection.MonitorPages); msg->monitor_page1 = virt_to_phys(vmbus_connection.MonitorPages);
msg->monitor_page2 = virt_to_phys( msg->monitor_page2 = virt_to_phys(
(void *)((unsigned long)gVmbusConnection.MonitorPages + (void *)((unsigned long)vmbus_connection.MonitorPages +
PAGE_SIZE)); PAGE_SIZE));
/* /*
* Add to list before we send the request since we may * Add to list before we send the request since we may
* 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(&vmbus_connection.channelmsg_lock, flags);
list_add_tail(&msgInfo->msglistentry, list_add_tail(&msginfo->msglistentry,
&gVmbusConnection.ChannelMsgList); &vmbus_connection.ChannelMsgList);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&vmbus_connection.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",
...@@ -129,19 +129,19 @@ int VmbusConnect(void) ...@@ -129,19 +129,19 @@ int VmbusConnect(void)
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_waitevent_wait(msgInfo->waitevent); osd_waitevent_wait(msginfo->waitevent);
list_del(&msgInfo->msglistentry); list_del(&msginfo->msglistentry);
/* Check if successful */ /* Check if successful */
if (msgInfo->response.version_response.version_supported) { if (msginfo->response.version_response.version_supported) {
DPRINT_INFO(VMBUS, "Vmbus connected!!"); DPRINT_INFO(VMBUS, "Vmbus connected!!");
gVmbusConnection.ConnectState = Connected; vmbus_connection.ConnectState = Connected;
} else { } else {
DPRINT_ERR(VMBUS, "Vmbus connection failed!!..." DPRINT_ERR(VMBUS, "Vmbus connection failed!!..."
...@@ -151,29 +151,29 @@ int VmbusConnect(void) ...@@ -151,29 +151,29 @@ int VmbusConnect(void)
goto Cleanup; goto Cleanup;
} }
kfree(msgInfo->waitevent); kfree(msginfo->waitevent);
kfree(msgInfo); kfree(msginfo);
return 0; return 0;
Cleanup: Cleanup:
gVmbusConnection.ConnectState = Disconnected; vmbus_connection.ConnectState = Disconnected;
if (gVmbusConnection.WorkQueue) if (vmbus_connection.WorkQueue)
destroy_workqueue(gVmbusConnection.WorkQueue); destroy_workqueue(vmbus_connection.WorkQueue);
if (gVmbusConnection.InterruptPage) { if (vmbus_connection.InterruptPage) {
osd_page_free(gVmbusConnection.InterruptPage, 1); osd_page_free(vmbus_connection.InterruptPage, 1);
gVmbusConnection.InterruptPage = NULL; vmbus_connection.InterruptPage = NULL;
} }
if (gVmbusConnection.MonitorPages) { if (vmbus_connection.MonitorPages) {
osd_page_free(gVmbusConnection.MonitorPages, 2); osd_page_free(vmbus_connection.MonitorPages, 2);
gVmbusConnection.MonitorPages = NULL; vmbus_connection.MonitorPages = NULL;
} }
if (msgInfo) { if (msginfo) {
kfree(msgInfo->waitevent); kfree(msginfo->waitevent);
kfree(msgInfo); kfree(msginfo);
} }
return ret; return ret;
...@@ -188,7 +188,7 @@ int VmbusDisconnect(void) ...@@ -188,7 +188,7 @@ int VmbusDisconnect(void)
struct vmbus_channel_message_header *msg; struct vmbus_channel_message_header *msg;
/* Make sure we are connected */ /* Make sure we are connected */
if (gVmbusConnection.ConnectState != Connected) if (vmbus_connection.ConnectState != Connected)
return -1; return -1;
msg = kzalloc(sizeof(struct vmbus_channel_message_header), GFP_KERNEL); msg = kzalloc(sizeof(struct vmbus_channel_message_header), GFP_KERNEL);
...@@ -202,12 +202,12 @@ int VmbusDisconnect(void) ...@@ -202,12 +202,12 @@ int VmbusDisconnect(void)
if (ret != 0) if (ret != 0)
goto Cleanup; goto Cleanup;
osd_page_free(gVmbusConnection.InterruptPage, 1); osd_page_free(vmbus_connection.InterruptPage, 1);
/* TODO: iterate thru the msg list and free up */ /* TODO: iterate thru the msg list and free up */
destroy_workqueue(gVmbusConnection.WorkQueue); destroy_workqueue(vmbus_connection.WorkQueue);
gVmbusConnection.ConnectState = Disconnected; vmbus_connection.ConnectState = Disconnected;
DPRINT_INFO(VMBUS, "Vmbus disconnected!!"); DPRINT_INFO(VMBUS, "Vmbus disconnected!!");
...@@ -219,22 +219,22 @@ int VmbusDisconnect(void) ...@@ -219,22 +219,22 @@ int VmbusDisconnect(void)
/* /*
* GetChannelFromRelId - Get the channel object given its child relative id (ie channel id) * GetChannelFromRelId - Get the channel object given its child relative id (ie channel id)
*/ */
struct vmbus_channel *GetChannelFromRelId(u32 relId) struct vmbus_channel *GetChannelFromRelId(u32 relid)
{ {
struct vmbus_channel *channel; struct vmbus_channel *channel;
struct vmbus_channel *foundChannel = NULL; struct vmbus_channel *found_channel = NULL;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
list_for_each_entry(channel, &gVmbusConnection.ChannelList, listentry) { list_for_each_entry(channel, &vmbus_connection.ChannelList, listentry) {
if (channel->offermsg.child_relid == relId) { if (channel->offermsg.child_relid == relid) {
foundChannel = channel; found_channel = channel;
break; break;
} }
} }
spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
return foundChannel; return found_channel;
} }
/* /*
...@@ -243,7 +243,7 @@ struct vmbus_channel *GetChannelFromRelId(u32 relId) ...@@ -243,7 +243,7 @@ struct vmbus_channel *GetChannelFromRelId(u32 relId)
static void VmbusProcessChannelEvent(void *context) static void VmbusProcessChannelEvent(void *context)
{ {
struct vmbus_channel *channel; struct vmbus_channel *channel;
u32 relId = (u32)(unsigned long)context; u32 relid = (u32)(unsigned long)context;
/* ASSERT(relId > 0); */ /* ASSERT(relId > 0); */
...@@ -251,7 +251,7 @@ static void VmbusProcessChannelEvent(void *context) ...@@ -251,7 +251,7 @@ static void VmbusProcessChannelEvent(void *context)
* Find the channel based on this relid and invokes the * Find the channel based on this relid and invokes the
* channel callback to process the event * channel callback to process the event
*/ */
channel = GetChannelFromRelId(relId); channel = GetChannelFromRelId(relid);
if (channel) { if (channel) {
vmbus_onchannel_event(channel); vmbus_onchannel_event(channel);
...@@ -261,7 +261,7 @@ static void VmbusProcessChannelEvent(void *context) ...@@ -261,7 +261,7 @@ static void VmbusProcessChannelEvent(void *context)
* (void*)channel); * (void*)channel);
*/ */
} else { } else {
DPRINT_ERR(VMBUS, "channel not found for relid - %d.", relId); DPRINT_ERR(VMBUS, "channel not found for relid - %d.", relid);
} }
} }
...@@ -274,14 +274,16 @@ void VmbusOnEvents(void) ...@@ -274,14 +274,16 @@ void VmbusOnEvents(void)
int maxdword = MAX_NUM_CHANNELS_SUPPORTED >> 5; int maxdword = MAX_NUM_CHANNELS_SUPPORTED >> 5;
int bit; int bit;
int relid; int relid;
u32 *recvInterruptPage = gVmbusConnection.RecvInterruptPage; u32 *recv_int_page = vmbus_connection.RecvInterruptPage;
/* Check events */ /* Check events */
if (recvInterruptPage) { if (recv_int_page) {
for (dword = 0; dword < maxdword; dword++) { for (dword = 0; dword < maxdword; dword++) {
if (recvInterruptPage[dword]) { if (recv_int_page[dword]) {
for (bit = 0; bit < 32; bit++) { for (bit = 0; bit < 32; bit++) {
if (test_and_clear_bit(bit, (unsigned long *)&recvInterruptPage[dword])) { if (test_and_clear_bit(bit,
(unsigned long *)
&recv_int_page[dword])) {
relid = (dword << 5) + bit; relid = (dword << 5) + bit;
DPRINT_DBG(VMBUS, "event detected for relid - %d", relid); DPRINT_DBG(VMBUS, "event detected for relid - %d", relid);
...@@ -305,24 +307,24 @@ void VmbusOnEvents(void) ...@@ -305,24 +307,24 @@ void VmbusOnEvents(void)
/* /*
* VmbusPostMessage - Send a msg on the vmbus's message connection * VmbusPostMessage - Send a msg on the vmbus's message connection
*/ */
int VmbusPostMessage(void *buffer, size_t bufferLen) int VmbusPostMessage(void *buffer, size_t buflen)
{ {
union hv_connection_id connId; union hv_connection_id conn_id;
connId.asu32 = 0; conn_id.asu32 = 0;
connId.u.id = VMBUS_MESSAGE_CONNECTION_ID; conn_id.u.id = VMBUS_MESSAGE_CONNECTION_ID;
return hv_post_message(connId, 1, buffer, bufferLen); return hv_post_message(conn_id, 1, buffer, buflen);
} }
/* /*
* VmbusSetEvent - Send an event notification to the parent * VmbusSetEvent - Send an event notification to the parent
*/ */
int VmbusSetEvent(u32 childRelId) int VmbusSetEvent(u32 child_relid)
{ {
/* Each u32 represents 32 channels */ /* Each u32 represents 32 channels */
set_bit(childRelId & 31, set_bit(child_relid & 31,
(unsigned long *)gVmbusConnection.SendInterruptPage + (unsigned long *)vmbus_connection.SendInterruptPage +
(childRelId >> 5)); (child_relid >> 5));
return hv_signal_event(); return hv_signal_event();
} }
...@@ -239,7 +239,7 @@ static void vmbus_on_msg_dpc(struct hv_driver *drv) ...@@ -239,7 +239,7 @@ static void vmbus_on_msg_dpc(struct hv_driver *drv)
continue; continue;
INIT_WORK(&ctx->work, vmbus_onmessage_work); INIT_WORK(&ctx->work, vmbus_onmessage_work);
memcpy(&ctx->msg, msg, sizeof(*msg)); memcpy(&ctx->msg, msg, sizeof(*msg));
queue_work(gVmbusConnection.WorkQueue, &ctx->work); queue_work(vmbus_connection.WorkQueue, &ctx->work);
} }
msg->header.message_type = HVMSG_NONE; msg->header.message_type = HVMSG_NONE;
......
...@@ -98,7 +98,7 @@ struct VMBUS_MSGINFO { ...@@ -98,7 +98,7 @@ struct VMBUS_MSGINFO {
}; };
extern struct VMBUS_CONNECTION gVmbusConnection; extern struct VMBUS_CONNECTION vmbus_connection;
/* General vmbus interface */ /* General vmbus interface */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment