if (channel->offermsg.monitor_allocated) {
/* Each u32 represents 32 channels */
set_bit(channel->offermsg.child_relid & 31,
- (unsigned long *) vmbus_connection.SendInterruptPage +
+ (unsigned long *) vmbus_connection.send_int_page +
(channel->offermsg.child_relid >> 5));
- monitorpage = vmbus_connection.MonitorPages;
+ monitorpage = vmbus_connection.monitor_pages;
monitorpage++; /* Get the child to parent monitor page */
set_bit(channel->monitor_bit,
if (Channel->offermsg.monitor_allocated) {
/* Each u32 represents 32 channels */
clear_bit(Channel->offermsg.child_relid & 31,
- (unsigned long *)vmbus_connection.SendInterruptPage +
+ (unsigned long *)vmbus_connection.send_int_page +
(Channel->offermsg.child_relid >> 5));
- monitorPage =
- (struct hv_monitor_page *)vmbus_connection.MonitorPages;
+ monitorPage = (struct hv_monitor_page *)
+ vmbus_connection.monitor_pages;
monitorPage++; /* Get the child to parent monitor page */
clear_bit(Channel->monitor_bit,
&channel->offermsg.offer.if_instance,
sizeof(struct hv_guid));
- monitorpage = (struct hv_monitor_page *)vmbus_connection.MonitorPages;
+ monitorpage = (struct hv_monitor_page *)vmbus_connection.monitor_pages;
debuginfo->monitorid = channel->offermsg.monitorid;
spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_add_tail(&openInfo->msglistentry,
- &vmbus_connection.ChannelMsgList);
+ &vmbus_connection.chn_msg_list);
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
DPRINT_DBG(VMBUS, "Sending channel open msg...");
unsigned long flags;
int ret = 0;
- next_gpadl_handle = atomic_read(&vmbus_connection.NextGpadlHandle);
- atomic_inc(&vmbus_connection.NextGpadlHandle);
+ next_gpadl_handle = atomic_read(&vmbus_connection.next_gpadl_handle);
+ atomic_inc(&vmbus_connection.next_gpadl_handle);
ret = create_gpadl_header(kbuffer, size, &msginfo, &msgcount);
if (ret)
spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_add_tail(&msginfo->msglistentry,
- &vmbus_connection.ChannelMsgList);
+ &vmbus_connection.chn_msg_list);
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
DPRINT_DBG(VMBUS, "buffer %p, size %d msg cnt %d",
spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_add_tail(&info->msglistentry,
- &vmbus_connection.ChannelMsgList);
+ &vmbus_connection.chn_msg_list);
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
ret = vmbus_post_msg(msg,
* ie we can't destroy ourselves.
*/
INIT_WORK(&channel->work, release_channel);
- queue_work(vmbus_connection.WorkQueue, &channel->work);
+ queue_work(vmbus_connection.work_queue, &channel->work);
}
/* Make sure this is a new offer */
spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
- list_for_each_entry(channel, &vmbus_connection.ChannelList, listentry) {
+ list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
if (!memcmp(&channel->offermsg.offer.if_type,
&newchannel->offermsg.offer.if_type,
sizeof(struct hv_guid)) &&
if (fnew)
list_add_tail(&newchannel->listentry,
- &vmbus_connection.ChannelList);
+ &vmbus_connection.chn_list);
spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
*/
spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
- list_for_each(curr, &vmbus_connection.ChannelMsgList) {
+ list_for_each(curr, &vmbus_connection.chn_msg_list) {
/* FIXME: this should probably use list_entry() instead */
msginfo = (struct vmbus_channel_msginfo *)curr;
requestheader =
*/
spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
- list_for_each(curr, &vmbus_connection.ChannelMsgList) {
+ list_for_each(curr, &vmbus_connection.chn_msg_list) {
/* FIXME: this should probably use list_entry() instead */
msginfo = (struct vmbus_channel_msginfo *)curr;
requestheader =
*/
spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
- list_for_each(curr, &vmbus_connection.ChannelMsgList) {
+ list_for_each(curr, &vmbus_connection.chn_msg_list) {
/* FIXME: this should probably use list_entry() instead */
msginfo = (struct vmbus_channel_msginfo *)curr;
requestheader =
version_response = (struct vmbus_channel_version_response *)hdr;
spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
- list_for_each(curr, &vmbus_connection.ChannelMsgList) {
+ list_for_each(curr, &vmbus_connection.chn_msg_list) {
/* FIXME: this should probably use list_entry() instead */
msginfo = (struct vmbus_channel_msginfo *)curr;
requestheader =
spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
- list_for_each_entry_safe(channel, pos, &vmbus_connection.ChannelList,
+ list_for_each_entry_safe(channel, pos, &vmbus_connection.chn_list,
listentry) {
if (channel == start)
break;
#include "vmbus_private.h"
-struct VMBUS_CONNECTION vmbus_connection = {
- .ConnectState = Disconnected,
- .NextGpadlHandle = ATOMIC_INIT(0xE1E10),
+struct vmbus_connection vmbus_connection = {
+ .conn_state = DISCONNECTED,
+ .next_gpadl_handle = ATOMIC_INIT(0xE1E10),
};
/*
unsigned long flags;
/* Make sure we are not connecting or connected */
- if (vmbus_connection.ConnectState != Disconnected)
+ if (vmbus_connection.conn_state != DISCONNECTED)
return -1;
/* Initialize the vmbus connection */
- vmbus_connection.ConnectState = Connecting;
- vmbus_connection.WorkQueue = create_workqueue("hv_vmbus_con");
- if (!vmbus_connection.WorkQueue) {
+ vmbus_connection.conn_state = CONNECTING;
+ vmbus_connection.work_queue = create_workqueue("hv_vmbus_con");
+ if (!vmbus_connection.work_queue) {
ret = -1;
goto Cleanup;
}
- INIT_LIST_HEAD(&vmbus_connection.ChannelMsgList);
+ INIT_LIST_HEAD(&vmbus_connection.chn_msg_list);
spin_lock_init(&vmbus_connection.channelmsg_lock);
- INIT_LIST_HEAD(&vmbus_connection.ChannelList);
+ INIT_LIST_HEAD(&vmbus_connection.chn_list);
spin_lock_init(&vmbus_connection.channel_lock);
/*
* Setup the vmbus event connection for channel interrupt
* abstraction stuff
*/
- vmbus_connection.InterruptPage = osd_page_alloc(1);
- if (vmbus_connection.InterruptPage == NULL) {
+ vmbus_connection.int_page = osd_page_alloc(1);
+ if (vmbus_connection.int_page == NULL) {
ret = -1;
goto Cleanup;
}
- vmbus_connection.RecvInterruptPage = vmbus_connection.InterruptPage;
- vmbus_connection.SendInterruptPage =
- (void *)((unsigned long)vmbus_connection.InterruptPage +
+ vmbus_connection.recv_int_page = vmbus_connection.int_page;
+ vmbus_connection.send_int_page =
+ (void *)((unsigned long)vmbus_connection.int_page +
(PAGE_SIZE >> 1));
/*
* Setup the monitor notification facility. The 1st page for
* parent->child and the 2nd page for child->parent
*/
- vmbus_connection.MonitorPages = osd_page_alloc(2);
- if (vmbus_connection.MonitorPages == NULL) {
+ vmbus_connection.monitor_pages = osd_page_alloc(2);
+ if (vmbus_connection.monitor_pages == NULL) {
ret = -1;
goto Cleanup;
}
msg->header.msgtype = CHANNELMSG_INITIATE_CONTACT;
msg->vmbus_version_requested = VMBUS_REVISION_NUMBER;
- msg->interrupt_page = virt_to_phys(vmbus_connection.InterruptPage);
- msg->monitor_page1 = virt_to_phys(vmbus_connection.MonitorPages);
+ msg->interrupt_page = virt_to_phys(vmbus_connection.int_page);
+ msg->monitor_page1 = virt_to_phys(vmbus_connection.monitor_pages);
msg->monitor_page2 = virt_to_phys(
- (void *)((unsigned long)vmbus_connection.MonitorPages +
+ (void *)((unsigned long)vmbus_connection.monitor_pages +
PAGE_SIZE));
/*
*/
spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_add_tail(&msginfo->msglistentry,
- &vmbus_connection.ChannelMsgList);
+ &vmbus_connection.chn_msg_list);
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
/* Check if successful */
if (msginfo->response.version_response.version_supported) {
DPRINT_INFO(VMBUS, "Vmbus connected!!");
- vmbus_connection.ConnectState = Connected;
+ vmbus_connection.conn_state = CONNECTED;
} else {
DPRINT_ERR(VMBUS, "Vmbus connection failed!!..."
return 0;
Cleanup:
- vmbus_connection.ConnectState = Disconnected;
+ vmbus_connection.conn_state = DISCONNECTED;
- if (vmbus_connection.WorkQueue)
- destroy_workqueue(vmbus_connection.WorkQueue);
+ if (vmbus_connection.work_queue)
+ destroy_workqueue(vmbus_connection.work_queue);
- if (vmbus_connection.InterruptPage) {
- osd_page_free(vmbus_connection.InterruptPage, 1);
- vmbus_connection.InterruptPage = NULL;
+ if (vmbus_connection.int_page) {
+ osd_page_free(vmbus_connection.int_page, 1);
+ vmbus_connection.int_page = NULL;
}
- if (vmbus_connection.MonitorPages) {
- osd_page_free(vmbus_connection.MonitorPages, 2);
- vmbus_connection.MonitorPages = NULL;
+ if (vmbus_connection.monitor_pages) {
+ osd_page_free(vmbus_connection.monitor_pages, 2);
+ vmbus_connection.monitor_pages = NULL;
}
if (msginfo) {
struct vmbus_channel_message_header *msg;
/* Make sure we are connected */
- if (vmbus_connection.ConnectState != Connected)
+ if (vmbus_connection.conn_state != CONNECTED)
return -1;
msg = kzalloc(sizeof(struct vmbus_channel_message_header), GFP_KERNEL);
if (ret != 0)
goto Cleanup;
- osd_page_free(vmbus_connection.InterruptPage, 1);
+ osd_page_free(vmbus_connection.int_page, 1);
/* TODO: iterate thru the msg list and free up */
- destroy_workqueue(vmbus_connection.WorkQueue);
+ destroy_workqueue(vmbus_connection.work_queue);
- vmbus_connection.ConnectState = Disconnected;
+ vmbus_connection.conn_state = DISCONNECTED;
DPRINT_INFO(VMBUS, "Vmbus disconnected!!");
unsigned long flags;
spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
- list_for_each_entry(channel, &vmbus_connection.ChannelList, listentry) {
+ list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
if (channel->offermsg.child_relid == relid) {
found_channel = channel;
break;
int maxdword = MAX_NUM_CHANNELS_SUPPORTED >> 5;
int bit;
int relid;
- u32 *recv_int_page = vmbus_connection.RecvInterruptPage;
+ u32 *recv_int_page = vmbus_connection.recv_int_page;
/* Check events */
if (recv_int_page) {
{
/* Each u32 represents 32 channels */
set_bit(child_relid & 31,
- (unsigned long *)vmbus_connection.SendInterruptPage +
+ (unsigned long *)vmbus_connection.send_int_page +
(child_relid >> 5));
return hv_signal_event();
continue;
INIT_WORK(&ctx->work, vmbus_onmessage_work);
memcpy(&ctx->msg, msg, sizeof(*msg));
- queue_work(vmbus_connection.WorkQueue, &ctx->work);
+ queue_work(vmbus_connection.work_queue, &ctx->work);
}
msg->header.message_type = HVMSG_NONE;
#define MAX_NUM_CHANNELS_SUPPORTED 256
-enum VMBUS_CONNECT_STATE {
- Disconnected,
- Connecting,
- Connected,
- Disconnecting
+enum vmbus_connect_state {
+ DISCONNECTED,
+ CONNECTING,
+ CONNECTED,
+ DISCONNECTING
};
#define MAX_SIZE_CHANNEL_MESSAGE HV_MESSAGE_PAYLOAD_BYTE_COUNT
-struct VMBUS_CONNECTION {
- enum VMBUS_CONNECT_STATE ConnectState;
+struct vmbus_connection {
+ enum vmbus_connect_state conn_state;
- atomic_t NextGpadlHandle;
+ atomic_t next_gpadl_handle;
/*
* Represents channel interrupts. Each bit position represents a
* event. The other end receives the port event and parse the
* recvInterruptPage to see which bit is set
*/
- void *InterruptPage;
- void *SendInterruptPage;
- void *RecvInterruptPage;
+ void *int_page;
+ void *send_int_page;
+ void *recv_int_page;
/*
* 2 pages - 1st page for parent->child notification and 2nd
* is child->parent notification
*/
- void *MonitorPages;
- struct list_head ChannelMsgList;
+ void *monitor_pages;
+ struct list_head chn_msg_list;
spinlock_t channelmsg_lock;
/* List of channels */
- struct list_head ChannelList;
+ struct list_head chn_list;
spinlock_t channel_lock;
- struct workqueue_struct *WorkQueue;
+ struct workqueue_struct *work_queue;
};
-struct VMBUS_MSGINFO {
+struct vmbus_msginfo {
/* Bookkeeping stuff */
- struct list_head MsgListEntry;
+ struct list_head msglist_entry;
/* Synchronize the request/response if needed */
- struct osd_waitevent *WaitEvent;
+ struct osd_waitevent *wait_event;
/* The message itself */
- unsigned char Msg[0];
+ unsigned char msg[0];
};
-extern struct VMBUS_CONNECTION vmbus_connection;
+extern struct vmbus_connection vmbus_connection;
/* General vmbus interface */