Staging: hv: typedef removal for ChannelMessages.h
[deliverable/linux.git] / drivers / staging / hv / ChannelMgmt.h
CommitLineData
3e7ee490
HJ
1/*
2 *
3 * Copyright (c) 2009, Microsoft Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16 * Place - Suite 330, Boston, MA 02111-1307 USA.
17 *
18 * Authors:
19 * Haiyang Zhang <haiyangz@microsoft.com>
20 * Hank Janssen <hjanssen@microsoft.com>
21 *
22 */
23
24
25#ifndef _CHANNEL_MGMT_H_
26#define _CHANNEL_MGMT_H_
27
09d50ff8 28#include "include/List.h"
3e7ee490
HJ
29#include "RingBuffer.h"
30
09d50ff8
GKH
31#include "include/VmbusChannelInterface.h"
32#include "include/ChannelMessages.h"
3e7ee490
HJ
33
34
35
b239549c 36typedef void (*PFN_CHANNEL_CALLBACK)(void *context);
3e7ee490 37
aded7165 38enum vmbus_channel_state {
3e7ee490
HJ
39 CHANNEL_OFFER_STATE,
40 CHANNEL_OPENING_STATE,
41 CHANNEL_OPEN_STATE,
aded7165 42};
3e7ee490 43
aded7165 44struct vmbus_channel {
b239549c 45 LIST_ENTRY ListEntry;
3e7ee490 46
3d3b5518 47 struct hv_device *DeviceObject;
3e7ee490 48
c8a429a4 49 struct timer_list poll_timer; /* SA-111 workaround */
3e7ee490 50
aded7165 51 enum vmbus_channel_state State;
3e7ee490 52
82250213 53 struct vmbus_channel_offer_channel OfferMsg;
b239549c
GKH
54 /*
55 * These are based on the OfferMsg.MonitorId.
56 * Save it here for easy access.
57 */
58 u8 MonitorGroup;
59 u8 MonitorBit;
3e7ee490 60
b239549c 61 u32 RingBufferGpadlHandle;
3e7ee490 62
454f18a9 63 /* Allocated memory for ring buffer */
b239549c
GKH
64 void *RingBufferPages;
65 u32 RingBufferPageCount;
66 RING_BUFFER_INFO Outbound; /* send to parent */
67 RING_BUFFER_INFO Inbound; /* receive from parent */
54411c42 68 spinlock_t inbound_lock;
df8d9b1f 69 struct workqueue_struct *ControlWQ;
3e7ee490 70
454f18a9 71 /* Channel callback are invoked in this workqueue context */
b239549c 72 /* HANDLE dataWorkQueue; */
3e7ee490 73
b239549c
GKH
74 PFN_CHANNEL_CALLBACK OnChannelCallback;
75 void *ChannelCallbackContext;
aded7165 76};
3e7ee490 77
aded7165 78struct vmbus_channel_debug_info {
b239549c 79 u32 RelId;
aded7165 80 enum vmbus_channel_state State;
caf26a31
GKH
81 struct hv_guid InterfaceType;
82 struct hv_guid InterfaceInstance;
b239549c
GKH
83 u32 MonitorId;
84 u32 ServerMonitorPending;
85 u32 ServerMonitorLatency;
86 u32 ServerMonitorConnectionId;
87 u32 ClientMonitorPending;
88 u32 ClientMonitorLatency;
89 u32 ClientMonitorConnectionId;
90
91 RING_BUFFER_DEBUG_INFO Inbound;
92 RING_BUFFER_DEBUG_INFO Outbound;
aded7165 93};
3e7ee490 94
454f18a9
BP
95/*
96 * Represents each channel msg on the vmbus connection This is a
97 * variable-size data structure depending on the msg type itself
98 */
aded7165 99struct vmbus_channel_msginfo {
454f18a9 100 /* Bookkeeping stuff */
b239549c 101 LIST_ENTRY MsgListEntry;
3e7ee490 102
454f18a9 103 /* So far, this is only used to handle gpadl body message */
b239549c 104 LIST_ENTRY SubMsgList;
3e7ee490 105
454f18a9 106 /* Synchronize the request/response if needed */
aedb444a 107 struct osd_waitevent *WaitEvent;
3e7ee490 108
aded7165 109 union {
82250213
GKH
110 struct vmbus_channel_version_supported VersionSupported;
111 struct vmbus_channel_open_result OpenResult;
112 struct vmbus_channel_gpadl_torndown GpadlTorndown;
113 struct vmbus_channel_gpadl_created GpadlCreated;
114 struct vmbus_channel_version_response VersionResponse;
aded7165 115 } Response;
3e7ee490 116
b239549c
GKH
117 u32 MessageSize;
118 /*
119 * The channel message that goes out on the "wire".
120 * It will contain at minimum the VMBUS_CHANNEL_MESSAGE_HEADER header
121 */
122 unsigned char Msg[0];
aded7165 123};
3e7ee490
HJ
124
125
aded7165 126struct vmbus_channel *AllocVmbusChannel(void);
3e7ee490 127
aded7165 128void FreeVmbusChannel(struct vmbus_channel *Channel);
3e7ee490 129
b239549c 130void VmbusOnChannelMessage(void *Context);
3e7ee490 131
b239549c 132int VmbusChannelRequestOffers(void);
3e7ee490 133
b239549c 134void VmbusChannelReleaseUnattachedChannels(void);
3e7ee490 135
454f18a9 136#endif /* _CHANNEL_MGMT_H_ */
This page took 0.03683 seconds and 5 git commands to generate.