aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaiyang Zhang <haiyangz@microsoft.com>2010-09-30 13:52:13 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-05 14:42:19 -0400
commit39d70a4ab178e0a44e9f31c9dd5b9555347018ec (patch)
tree9698fe7503e12fbb602f4fc62ee526471b3f7f66
parent03094f5e92738a7a408d76aa81c3f22252f59fb5 (diff)
staging: hv: Remove camel case variables in channel.c
Rename camel case variables in channel.c and changed them to lowercase. 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>
-rw-r--r--drivers/staging/hv/channel.c767
1 files changed, 387 insertions, 380 deletions
diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 37b7b4c0232..103748818fd 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -28,10 +28,10 @@
28 28
29/* Internal routines */ 29/* Internal routines */
30static int VmbusChannelCreateGpadlHeader( 30static int VmbusChannelCreateGpadlHeader(
31 void *Kbuffer, /* must be phys and virt contiguous */ 31 void *kbuffer, /* must be phys and virt contiguous */
32 u32 Size, /* page-size multiple */ 32 u32 size, /* page-size multiple */
33 struct vmbus_channel_msginfo **msgInfo, 33 struct vmbus_channel_msginfo **msginfo,
34 u32 *MessageCount); 34 u32 *messagecount);
35static void DumpVmbusChannel(struct vmbus_channel *channel); 35static void DumpVmbusChannel(struct vmbus_channel *channel);
36static void VmbusChannelSetEvent(struct vmbus_channel *channel); 36static void VmbusChannelSetEvent(struct vmbus_channel *channel);
37 37
@@ -70,25 +70,25 @@ static void DumpMonitorPage(struct hv_monitor_page *MonitorPage)
70 * VmbusChannelSetEvent - Trigger an event notification on the specified 70 * VmbusChannelSetEvent - Trigger an event notification on the specified
71 * channel. 71 * channel.
72 */ 72 */
73static void VmbusChannelSetEvent(struct vmbus_channel *Channel) 73static void VmbusChannelSetEvent(struct vmbus_channel *channel)
74{ 74{
75 struct hv_monitor_page *monitorPage; 75 struct hv_monitor_page *monitorpage;
76 76
77 if (Channel->OfferMsg.MonitorAllocated) { 77 if (channel->OfferMsg.MonitorAllocated) {
78 /* Each u32 represents 32 channels */ 78 /* Each u32 represents 32 channels */
79 set_bit(Channel->OfferMsg.ChildRelId & 31, 79 set_bit(channel->OfferMsg.ChildRelId & 31,
80 (unsigned long *) gVmbusConnection.SendInterruptPage + 80 (unsigned long *) gVmbusConnection.SendInterruptPage +
81 (Channel->OfferMsg.ChildRelId >> 5)); 81 (channel->OfferMsg.ChildRelId >> 5));
82 82
83 monitorPage = gVmbusConnection.MonitorPages; 83 monitorpage = gVmbusConnection.MonitorPages;
84 monitorPage++; /* Get the child to parent monitor page */ 84 monitorpage++; /* Get the child to parent monitor page */
85 85
86 set_bit(Channel->MonitorBit, 86 set_bit(channel->MonitorBit,
87 (unsigned long *)&monitorPage->TriggerGroup 87 (unsigned long *)&monitorpage->TriggerGroup
88 [Channel->MonitorGroup].Pending); 88 [channel->MonitorGroup].Pending);
89 89
90 } else { 90 } else {
91 VmbusSetEvent(Channel->OfferMsg.ChildRelId); 91 VmbusSetEvent(channel->OfferMsg.ChildRelId);
92 } 92 }
93} 93}
94 94
@@ -117,54 +117,54 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel)
117/* 117/*
118 * VmbusChannelGetDebugInfo -Retrieve various channel debug info 118 * VmbusChannelGetDebugInfo -Retrieve various channel debug info
119 */ 119 */
120void VmbusChannelGetDebugInfo(struct vmbus_channel *Channel, 120void VmbusChannelGetDebugInfo(struct vmbus_channel *channel,
121 struct vmbus_channel_debug_info *DebugInfo) 121 struct vmbus_channel_debug_info *debuginfo)
122{ 122{
123 struct hv_monitor_page *monitorPage; 123 struct hv_monitor_page *monitorpage;
124 u8 monitorGroup = (u8)Channel->OfferMsg.MonitorId / 32; 124 u8 monitor_group = (u8)channel->OfferMsg.MonitorId / 32;
125 u8 monitorOffset = (u8)Channel->OfferMsg.MonitorId % 32; 125 u8 monitor_offset = (u8)channel->OfferMsg.MonitorId % 32;
126 /* u32 monitorBit = 1 << monitorOffset; */ 126 /* u32 monitorBit = 1 << monitorOffset; */
127 127
128 DebugInfo->RelId = Channel->OfferMsg.ChildRelId; 128 debuginfo->RelId = channel->OfferMsg.ChildRelId;
129 DebugInfo->State = Channel->State; 129 debuginfo->State = channel->State;
130 memcpy(&DebugInfo->InterfaceType, 130 memcpy(&debuginfo->InterfaceType,
131 &Channel->OfferMsg.Offer.InterfaceType, sizeof(struct hv_guid)); 131 &channel->OfferMsg.Offer.InterfaceType, sizeof(struct hv_guid));
132 memcpy(&DebugInfo->InterfaceInstance, 132 memcpy(&debuginfo->InterfaceInstance,
133 &Channel->OfferMsg.Offer.InterfaceInstance, 133 &channel->OfferMsg.Offer.InterfaceInstance,
134 sizeof(struct hv_guid)); 134 sizeof(struct hv_guid));
135 135
136 monitorPage = (struct hv_monitor_page *)gVmbusConnection.MonitorPages; 136 monitorpage = (struct hv_monitor_page *)gVmbusConnection.MonitorPages;
137 137
138 DebugInfo->MonitorId = Channel->OfferMsg.MonitorId; 138 debuginfo->MonitorId = channel->OfferMsg.MonitorId;
139 139
140 DebugInfo->ServerMonitorPending = 140 debuginfo->ServerMonitorPending =
141 monitorPage->TriggerGroup[monitorGroup].Pending; 141 monitorpage->TriggerGroup[monitor_group].Pending;
142 DebugInfo->ServerMonitorLatency = 142 debuginfo->ServerMonitorLatency =
143 monitorPage->Latency[monitorGroup][monitorOffset]; 143 monitorpage->Latency[monitor_group][monitor_offset];
144 DebugInfo->ServerMonitorConnectionId = 144 debuginfo->ServerMonitorConnectionId =
145 monitorPage->Parameter[monitorGroup] 145 monitorpage->Parameter[monitor_group]
146 [monitorOffset].ConnectionId.u.Id; 146 [monitor_offset].ConnectionId.u.Id;
147 147
148 monitorPage++; 148 monitorpage++;
149 149
150 DebugInfo->ClientMonitorPending = 150 debuginfo->ClientMonitorPending =
151 monitorPage->TriggerGroup[monitorGroup].Pending; 151 monitorpage->TriggerGroup[monitor_group].Pending;
152 DebugInfo->ClientMonitorLatency = 152 debuginfo->ClientMonitorLatency =
153 monitorPage->Latency[monitorGroup][monitorOffset]; 153 monitorpage->Latency[monitor_group][monitor_offset];
154 DebugInfo->ClientMonitorConnectionId = 154 debuginfo->ClientMonitorConnectionId =
155 monitorPage->Parameter[monitorGroup] 155 monitorpage->Parameter[monitor_group]
156 [monitorOffset].ConnectionId.u.Id; 156 [monitor_offset].ConnectionId.u.Id;
157 157
158 RingBufferGetDebugInfo(&Channel->Inbound, &DebugInfo->Inbound); 158 RingBufferGetDebugInfo(&channel->Inbound, &debuginfo->Inbound);
159 RingBufferGetDebugInfo(&Channel->Outbound, &DebugInfo->Outbound); 159 RingBufferGetDebugInfo(&channel->Outbound, &debuginfo->Outbound);
160} 160}
161 161
162/* 162/*
163 * VmbusChannelOpen - Open the specified channel. 163 * VmbusChannelOpen - Open the specified channel.
164 */ 164 */
165int VmbusChannelOpen(struct vmbus_channel *NewChannel, u32 SendRingBufferSize, 165int VmbusChannelOpen(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
166 u32 RecvRingBufferSize, void *UserData, u32 UserDataLen, 166 u32 recv_ringbuffer_size, void *userdata, u32 userdatalen,
167 void (*OnChannelCallback)(void *context), void *Context) 167 void (*onchannelcallback)(void *context), void *context)
168{ 168{
169 struct vmbus_channel_open_channel *openMsg; 169 struct vmbus_channel_open_channel *openMsg;
170 struct vmbus_channel_msginfo *openInfo = NULL; 170 struct vmbus_channel_msginfo *openInfo = NULL;
@@ -176,30 +176,30 @@ int VmbusChannelOpen(struct vmbus_channel *NewChannel, u32 SendRingBufferSize,
176 /* ASSERT(!(SendRingBufferSize & (PAGE_SIZE - 1))); */ 176 /* ASSERT(!(SendRingBufferSize & (PAGE_SIZE - 1))); */
177 /* ASSERT(!(RecvRingBufferSize & (PAGE_SIZE - 1))); */ 177 /* ASSERT(!(RecvRingBufferSize & (PAGE_SIZE - 1))); */
178 178
179 NewChannel->OnChannelCallback = OnChannelCallback; 179 newchannel->OnChannelCallback = onchannelcallback;
180 NewChannel->ChannelCallbackContext = Context; 180 newchannel->ChannelCallbackContext = context;
181 181
182 /* Allocate the ring buffer */ 182 /* Allocate the ring buffer */
183 out = osd_PageAlloc((SendRingBufferSize + RecvRingBufferSize) 183 out = osd_PageAlloc((send_ringbuffer_size + recv_ringbuffer_size)
184 >> PAGE_SHIFT); 184 >> PAGE_SHIFT);
185 if (!out) 185 if (!out)
186 return -ENOMEM; 186 return -ENOMEM;
187 187
188 /* ASSERT(((unsigned long)out & (PAGE_SIZE-1)) == 0); */ 188 /* ASSERT(((unsigned long)out & (PAGE_SIZE-1)) == 0); */
189 189
190 in = (void *)((unsigned long)out + SendRingBufferSize); 190 in = (void *)((unsigned long)out + send_ringbuffer_size);
191 191
192 NewChannel->RingBufferPages = out; 192 newchannel->RingBufferPages = out;
193 NewChannel->RingBufferPageCount = (SendRingBufferSize + 193 newchannel->RingBufferPageCount = (send_ringbuffer_size +
194 RecvRingBufferSize) >> PAGE_SHIFT; 194 recv_ringbuffer_size) >> PAGE_SHIFT;
195 195
196 ret = RingBufferInit(&NewChannel->Outbound, out, SendRingBufferSize); 196 ret = RingBufferInit(&newchannel->Outbound, out, send_ringbuffer_size);
197 if (ret != 0) { 197 if (ret != 0) {
198 err = ret; 198 err = ret;
199 goto errorout; 199 goto errorout;
200 } 200 }
201 201
202 ret = RingBufferInit(&NewChannel->Inbound, in, RecvRingBufferSize); 202 ret = RingBufferInit(&newchannel->Inbound, in, recv_ringbuffer_size);
203 if (ret != 0) { 203 if (ret != 0) {
204 err = ret; 204 err = ret;
205 goto errorout; 205 goto errorout;
@@ -208,15 +208,15 @@ int VmbusChannelOpen(struct vmbus_channel *NewChannel, u32 SendRingBufferSize,
208 208
209 /* Establish the gpadl for the ring buffer */ 209 /* Establish the gpadl for the ring buffer */
210 DPRINT_DBG(VMBUS, "Establishing ring buffer's gpadl for channel %p...", 210 DPRINT_DBG(VMBUS, "Establishing ring buffer's gpadl for channel %p...",
211 NewChannel); 211 newchannel);
212 212
213 NewChannel->RingBufferGpadlHandle = 0; 213 newchannel->RingBufferGpadlHandle = 0;
214 214
215 ret = VmbusChannelEstablishGpadl(NewChannel, 215 ret = VmbusChannelEstablishGpadl(newchannel,
216 NewChannel->Outbound.RingBuffer, 216 newchannel->Outbound.RingBuffer,
217 SendRingBufferSize + 217 send_ringbuffer_size +
218 RecvRingBufferSize, 218 recv_ringbuffer_size,
219 &NewChannel->RingBufferGpadlHandle); 219 &newchannel->RingBufferGpadlHandle);
220 220
221 if (ret != 0) { 221 if (ret != 0) {
222 err = ret; 222 err = ret;
@@ -225,13 +225,13 @@ int VmbusChannelOpen(struct vmbus_channel *NewChannel, u32 SendRingBufferSize,
225 225
226 DPRINT_DBG(VMBUS, "channel %p <relid %d gpadl 0x%x send ring %p " 226 DPRINT_DBG(VMBUS, "channel %p <relid %d gpadl 0x%x send ring %p "
227 "size %d recv ring %p size %d, downstreamoffset %d>", 227 "size %d recv ring %p size %d, downstreamoffset %d>",
228 NewChannel, NewChannel->OfferMsg.ChildRelId, 228 newchannel, newchannel->OfferMsg.ChildRelId,
229 NewChannel->RingBufferGpadlHandle, 229 newchannel->RingBufferGpadlHandle,
230 NewChannel->Outbound.RingBuffer, 230 newchannel->Outbound.RingBuffer,
231 NewChannel->Outbound.RingSize, 231 newchannel->Outbound.RingSize,
232 NewChannel->Inbound.RingBuffer, 232 newchannel->Inbound.RingBuffer,
233 NewChannel->Inbound.RingSize, 233 newchannel->Inbound.RingSize,
234 SendRingBufferSize); 234 send_ringbuffer_size);
235 235
236 /* Create and init the channel open message */ 236 /* Create and init the channel open message */
237 openInfo = kmalloc(sizeof(*openInfo) + 237 openInfo = kmalloc(sizeof(*openInfo) +
@@ -250,20 +250,20 @@ int VmbusChannelOpen(struct vmbus_channel *NewChannel, u32 SendRingBufferSize,
250 250
251 openMsg = (struct vmbus_channel_open_channel *)openInfo->Msg; 251 openMsg = (struct vmbus_channel_open_channel *)openInfo->Msg;
252 openMsg->Header.MessageType = ChannelMessageOpenChannel; 252 openMsg->Header.MessageType = ChannelMessageOpenChannel;
253 openMsg->OpenId = NewChannel->OfferMsg.ChildRelId; /* FIXME */ 253 openMsg->OpenId = newchannel->OfferMsg.ChildRelId; /* FIXME */
254 openMsg->ChildRelId = NewChannel->OfferMsg.ChildRelId; 254 openMsg->ChildRelId = newchannel->OfferMsg.ChildRelId;
255 openMsg->RingBufferGpadlHandle = NewChannel->RingBufferGpadlHandle; 255 openMsg->RingBufferGpadlHandle = newchannel->RingBufferGpadlHandle;
256 openMsg->DownstreamRingBufferPageOffset = SendRingBufferSize >> 256 openMsg->DownstreamRingBufferPageOffset = send_ringbuffer_size >>
257 PAGE_SHIFT; 257 PAGE_SHIFT;
258 openMsg->ServerContextAreaGpadlHandle = 0; /* TODO */ 258 openMsg->ServerContextAreaGpadlHandle = 0; /* TODO */
259 259
260 if (UserDataLen > MAX_USER_DEFINED_BYTES) { 260 if (userdatalen > MAX_USER_DEFINED_BYTES) {
261 err = -EINVAL; 261 err = -EINVAL;
262 goto errorout; 262 goto errorout;
263 } 263 }
264 264
265 if (UserDataLen) 265 if (userdatalen)
266 memcpy(openMsg->UserData, UserData, UserDataLen); 266 memcpy(openMsg->UserData, userdata, userdatalen);
267 267
268 spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); 268 spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
269 list_add_tail(&openInfo->MsgListEntry, 269 list_add_tail(&openInfo->MsgListEntry,
@@ -283,10 +283,10 @@ int VmbusChannelOpen(struct vmbus_channel *NewChannel, u32 SendRingBufferSize,
283 osd_WaitEventWait(openInfo->WaitEvent); 283 osd_WaitEventWait(openInfo->WaitEvent);
284 284
285 if (openInfo->Response.OpenResult.Status == 0) 285 if (openInfo->Response.OpenResult.Status == 0)
286 DPRINT_INFO(VMBUS, "channel <%p> open success!!", NewChannel); 286 DPRINT_INFO(VMBUS, "channel <%p> open success!!", newchannel);
287 else 287 else
288 DPRINT_INFO(VMBUS, "channel <%p> open failed - %d!!", 288 DPRINT_INFO(VMBUS, "channel <%p> open failed - %d!!",
289 NewChannel, openInfo->Response.OpenResult.Status); 289 newchannel, openInfo->Response.OpenResult.Status);
290 290
291Cleanup: 291Cleanup:
292 spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); 292 spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
@@ -298,9 +298,9 @@ Cleanup:
298 return 0; 298 return 0;
299 299
300errorout: 300errorout:
301 RingBufferCleanup(&NewChannel->Outbound); 301 RingBufferCleanup(&newchannel->Outbound);
302 RingBufferCleanup(&NewChannel->Inbound); 302 RingBufferCleanup(&newchannel->Inbound);
303 osd_PageFree(out, (SendRingBufferSize + RecvRingBufferSize) 303 osd_PageFree(out, (send_ringbuffer_size + recv_ringbuffer_size)
304 >> PAGE_SHIFT); 304 >> PAGE_SHIFT);
305 kfree(openInfo); 305 kfree(openInfo);
306 return err; 306 return err;
@@ -310,289 +310,292 @@ errorout:
310 * DumpGpadlBody - Dump the gpadl body message to the console for 310 * DumpGpadlBody - Dump the gpadl body message to the console for
311 * debugging purposes. 311 * debugging purposes.
312 */ 312 */
313static void DumpGpadlBody(struct vmbus_channel_gpadl_body *Gpadl, u32 Len) 313static void DumpGpadlBody(struct vmbus_channel_gpadl_body *gpadl, u32 len)
314{ 314{
315 int i; 315 int i;
316 int pfnCount; 316 int pfncount;
317 317
318 pfnCount = (Len - sizeof(struct vmbus_channel_gpadl_body)) / 318 pfncount = (len - sizeof(struct vmbus_channel_gpadl_body)) /
319 sizeof(u64); 319 sizeof(u64);
320 DPRINT_DBG(VMBUS, "gpadl body - len %d pfn count %d", Len, pfnCount); 320 DPRINT_DBG(VMBUS, "gpadl body - len %d pfn count %d", len, pfncount);
321 321
322 for (i = 0; i < pfnCount; i++) 322 for (i = 0; i < pfncount; i++)
323 DPRINT_DBG(VMBUS, "gpadl body - %d) pfn %llu", 323 DPRINT_DBG(VMBUS, "gpadl body - %d) pfn %llu",
324 i, Gpadl->Pfn[i]); 324 i, gpadl->Pfn[i]);
325} 325}
326 326
327/* 327/*
328 * DumpGpadlHeader - Dump the gpadl header message to the console for 328 * DumpGpadlHeader - Dump the gpadl header message to the console for
329 * debugging purposes. 329 * debugging purposes.
330 */ 330 */
331static void DumpGpadlHeader(struct vmbus_channel_gpadl_header *Gpadl) 331static void DumpGpadlHeader(struct vmbus_channel_gpadl_header *gpadl)
332{ 332{
333 int i, j; 333 int i, j;
334 int pageCount; 334 int pagecount;
335 335
336 DPRINT_DBG(VMBUS, 336 DPRINT_DBG(VMBUS,
337 "gpadl header - relid %d, range count %d, range buflen %d", 337 "gpadl header - relid %d, range count %d, range buflen %d",
338 Gpadl->ChildRelId, Gpadl->RangeCount, Gpadl->RangeBufLen); 338 gpadl->ChildRelId, gpadl->RangeCount, gpadl->RangeBufLen);
339 for (i = 0; i < Gpadl->RangeCount; i++) { 339 for (i = 0; i < gpadl->RangeCount; i++) {
340 pageCount = Gpadl->Range[i].ByteCount >> PAGE_SHIFT; 340 pagecount = gpadl->Range[i].ByteCount >> PAGE_SHIFT;
341 pageCount = (pageCount > 26) ? 26 : pageCount; 341 pagecount = (pagecount > 26) ? 26 : pagecount;
342 342
343 DPRINT_DBG(VMBUS, "gpadl range %d - len %d offset %d " 343 DPRINT_DBG(VMBUS, "gpadl range %d - len %d offset %d "
344 "page count %d", i, Gpadl->Range[i].ByteCount, 344 "page count %d", i, gpadl->Range[i].ByteCount,
345 Gpadl->Range[i].ByteOffset, pageCount); 345 gpadl->Range[i].ByteOffset, pagecount);
346 346
347 for (j = 0; j < pageCount; j++) 347 for (j = 0; j < pagecount; j++)
348 DPRINT_DBG(VMBUS, "%d) pfn %llu", j, 348 DPRINT_DBG(VMBUS, "%d) pfn %llu", j,
349 Gpadl->Range[i].PfnArray[j]); 349 gpadl->Range[i].PfnArray[j]);
350 } 350 }
351} 351}
352 352
353/* 353/*
354 * VmbusChannelCreateGpadlHeader - Creates a gpadl for the specified buffer 354 * VmbusChannelCreateGpadlHeader - Creates a gpadl for the specified buffer
355 */ 355 */
356static int VmbusChannelCreateGpadlHeader(void *Kbuffer, u32 Size, 356static int VmbusChannelCreateGpadlHeader(void *kbuffer, u32 size,
357 struct vmbus_channel_msginfo **MsgInfo, 357 struct vmbus_channel_msginfo **msginfo,
358 u32 *MessageCount) 358 u32 *messagecount)
359{ 359{
360 int i; 360 int i;
361 int pageCount; 361 int pagecount;
362 unsigned long long pfn; 362 unsigned long long pfn;
363 struct vmbus_channel_gpadl_header *gpaHeader; 363 struct vmbus_channel_gpadl_header *gpadl_header;
364 struct vmbus_channel_gpadl_body *gpadlBody; 364 struct vmbus_channel_gpadl_body *gpadl_body;
365 struct vmbus_channel_msginfo *msgHeader; 365 struct vmbus_channel_msginfo *msgheader;
366 struct vmbus_channel_msginfo *msgBody = NULL; 366 struct vmbus_channel_msginfo *msgbody = NULL;
367 u32 msgSize; 367 u32 msgsize;
368 368
369 int pfnSum, pfnCount, pfnLeft, pfnCurr, pfnSize; 369 int pfnsum, pfncount, pfnleft, pfncurr, pfnsize;
370 370
371 /* ASSERT((kbuffer & (PAGE_SIZE-1)) == 0); */ 371 /* ASSERT((kbuffer & (PAGE_SIZE-1)) == 0); */
372 /* ASSERT((Size & (PAGE_SIZE-1)) == 0); */ 372 /* ASSERT((Size & (PAGE_SIZE-1)) == 0); */
373 373
374 pageCount = Size >> PAGE_SHIFT; 374 pagecount = size >> PAGE_SHIFT;
375 pfn = virt_to_phys(Kbuffer) >> PAGE_SHIFT; 375 pfn = virt_to_phys(kbuffer) >> PAGE_SHIFT;
376 376
377 /* do we need a gpadl body msg */ 377 /* do we need a gpadl body msg */
378 pfnSize = MAX_SIZE_CHANNEL_MESSAGE - 378 pfnsize = MAX_SIZE_CHANNEL_MESSAGE -
379 sizeof(struct vmbus_channel_gpadl_header) - 379 sizeof(struct vmbus_channel_gpadl_header) -
380 sizeof(struct gpa_range); 380 sizeof(struct gpa_range);
381 pfnCount = pfnSize / sizeof(u64); 381 pfncount = pfnsize / sizeof(u64);
382 382
383 if (pageCount > pfnCount) { 383 if (pagecount > pfncount) {
384 /* we need a gpadl body */ 384 /* we need a gpadl body */
385 /* fill in the header */ 385 /* fill in the header */
386 msgSize = sizeof(struct vmbus_channel_msginfo) + 386 msgsize = sizeof(struct vmbus_channel_msginfo) +
387 sizeof(struct vmbus_channel_gpadl_header) + 387 sizeof(struct vmbus_channel_gpadl_header) +
388 sizeof(struct gpa_range) + pfnCount * sizeof(u64); 388 sizeof(struct gpa_range) + pfncount * sizeof(u64);
389 msgHeader = kzalloc(msgSize, GFP_KERNEL); 389 msgheader = kzalloc(msgsize, GFP_KERNEL);
390 if (!msgHeader) 390 if (!msgheader)
391 goto nomem; 391 goto nomem;
392 392
393 INIT_LIST_HEAD(&msgHeader->SubMsgList); 393 INIT_LIST_HEAD(&msgheader->SubMsgList);
394 msgHeader->MessageSize = msgSize; 394 msgheader->MessageSize = msgsize;
395 395
396 gpaHeader = (struct vmbus_channel_gpadl_header *)msgHeader->Msg; 396 gpadl_header = (struct vmbus_channel_gpadl_header *)
397 gpaHeader->RangeCount = 1; 397 msgheader->Msg;
398 gpaHeader->RangeBufLen = sizeof(struct gpa_range) + 398 gpadl_header->RangeCount = 1;
399 pageCount * sizeof(u64); 399 gpadl_header->RangeBufLen = sizeof(struct gpa_range) +
400 gpaHeader->Range[0].ByteOffset = 0; 400 pagecount * sizeof(u64);
401 gpaHeader->Range[0].ByteCount = Size; 401 gpadl_header->Range[0].ByteOffset = 0;
402 for (i = 0; i < pfnCount; i++) 402 gpadl_header->Range[0].ByteCount = size;
403 gpaHeader->Range[0].PfnArray[i] = pfn+i; 403 for (i = 0; i < pfncount; i++)
404 *MsgInfo = msgHeader; 404 gpadl_header->Range[0].PfnArray[i] = pfn+i;
405 *MessageCount = 1; 405 *msginfo = msgheader;
406 *messagecount = 1;
406 407
407 pfnSum = pfnCount; 408 pfnsum = pfncount;
408 pfnLeft = pageCount - pfnCount; 409 pfnleft = pagecount - pfncount;
409 410
410 /* how many pfns can we fit */ 411 /* how many pfns can we fit */
411 pfnSize = MAX_SIZE_CHANNEL_MESSAGE - 412 pfnsize = MAX_SIZE_CHANNEL_MESSAGE -
412 sizeof(struct vmbus_channel_gpadl_body); 413 sizeof(struct vmbus_channel_gpadl_body);
413 pfnCount = pfnSize / sizeof(u64); 414 pfncount = pfnsize / sizeof(u64);
414 415
415 /* fill in the body */ 416 /* fill in the body */
416 while (pfnLeft) { 417 while (pfnleft) {
417 if (pfnLeft > pfnCount) 418 if (pfnleft > pfncount)
418 pfnCurr = pfnCount; 419 pfncurr = pfncount;
419 else 420 else
420 pfnCurr = pfnLeft; 421 pfncurr = pfnleft;
421 422
422 msgSize = sizeof(struct vmbus_channel_msginfo) + 423 msgsize = sizeof(struct vmbus_channel_msginfo) +
423 sizeof(struct vmbus_channel_gpadl_body) + 424 sizeof(struct vmbus_channel_gpadl_body) +
424 pfnCurr * sizeof(u64); 425 pfncurr * sizeof(u64);
425 msgBody = kzalloc(msgSize, GFP_KERNEL); 426 msgbody = kzalloc(msgsize, GFP_KERNEL);
426 /* FIXME: we probably need to more if this fails */ 427 /* FIXME: we probably need to more if this fails */
427 if (!msgBody) 428 if (!msgbody)
428 goto nomem; 429 goto nomem;
429 msgBody->MessageSize = msgSize; 430 msgbody->MessageSize = msgsize;
430 (*MessageCount)++; 431 (*messagecount)++;
431 gpadlBody = 432 gpadl_body =
432 (struct vmbus_channel_gpadl_body *)msgBody->Msg; 433 (struct vmbus_channel_gpadl_body *)msgbody->Msg;
433 434
434 /* 435 /*
435 * FIXME: 436 * FIXME:
436 * Gpadl is u32 and we are using a pointer which could 437 * Gpadl is u32 and we are using a pointer which could
437 * be 64-bit 438 * be 64-bit
438 */ 439 */
439 /* gpadlBody->Gpadl = kbuffer; */ 440 /* gpadl_body->Gpadl = kbuffer; */
440 for (i = 0; i < pfnCurr; i++) 441 for (i = 0; i < pfncurr; i++)
441 gpadlBody->Pfn[i] = pfn + pfnSum + i; 442 gpadl_body->Pfn[i] = pfn + pfnsum + i;
442 443
443 /* add to msg header */ 444 /* add to msg header */
444 list_add_tail(&msgBody->MsgListEntry, 445 list_add_tail(&msgbody->MsgListEntry,
445 &msgHeader->SubMsgList); 446 &msgheader->SubMsgList);
446 pfnSum += pfnCurr; 447 pfnsum += pfncurr;
447 pfnLeft -= pfnCurr; 448 pfnleft -= pfncurr;
448 } 449 }
449 } else { 450 } else {
450 /* everything fits in a header */ 451 /* everything fits in a header */
451 msgSize = sizeof(struct vmbus_channel_msginfo) + 452 msgsize = sizeof(struct vmbus_channel_msginfo) +
452 sizeof(struct vmbus_channel_gpadl_header) + 453 sizeof(struct vmbus_channel_gpadl_header) +
453 sizeof(struct gpa_range) + pageCount * sizeof(u64); 454 sizeof(struct gpa_range) + pagecount * sizeof(u64);
454 msgHeader = kzalloc(msgSize, GFP_KERNEL); 455 msgheader = kzalloc(msgsize, GFP_KERNEL);
455 if (msgHeader == NULL) 456 if (msgheader == NULL)
456 goto nomem; 457 goto nomem;
457 msgHeader->MessageSize = msgSize; 458 msgheader->MessageSize = msgsize;
458 459
459 gpaHeader = (struct vmbus_channel_gpadl_header *)msgHeader->Msg; 460 gpadl_header = (struct vmbus_channel_gpadl_header *)
460 gpaHeader->RangeCount = 1; 461 msgheader->Msg;
461 gpaHeader->RangeBufLen = sizeof(struct gpa_range) + 462 gpadl_header->RangeCount = 1;
462 pageCount * sizeof(u64); 463 gpadl_header->RangeBufLen = sizeof(struct gpa_range) +
463 gpaHeader->Range[0].ByteOffset = 0; 464 pagecount * sizeof(u64);
464 gpaHeader->Range[0].ByteCount = Size; 465 gpadl_header->Range[0].ByteOffset = 0;
465 for (i = 0; i < pageCount; i++) 466 gpadl_header->Range[0].ByteCount = size;
466 gpaHeader->Range[0].PfnArray[i] = pfn+i; 467 for (i = 0; i < pagecount; i++)
467 468 gpadl_header->Range[0].PfnArray[i] = pfn+i;
468 *MsgInfo = msgHeader; 469
469 *MessageCount = 1; 470 *msginfo = msgheader;
471 *messagecount = 1;
470 } 472 }
471 473
472 return 0; 474 return 0;
473nomem: 475nomem:
474 kfree(msgHeader); 476 kfree(msgheader);
475 kfree(msgBody); 477 kfree(msgbody);
476 return -ENOMEM; 478 return -ENOMEM;
477} 479}
478 480
479/* 481/*
480 * VmbusChannelEstablishGpadl - Estabish a GPADL for the specified buffer 482 * VmbusChannelEstablishGpadl - Estabish a GPADL for the specified buffer
481 * 483 *
482 * @Channel: a channel 484 * @channel: a channel
483 * @Kbuffer: from kmalloc 485 * @kbuffer: from kmalloc
484 * @Size: page-size multiple 486 * @size: page-size multiple
485 * @GpadlHandle: some funky thing 487 * @gpadl_handle: some funky thing
486 */ 488 */
487int VmbusChannelEstablishGpadl(struct vmbus_channel *Channel, void *Kbuffer, 489int VmbusChannelEstablishGpadl(struct vmbus_channel *channel, void *kbuffer,
488 u32 Size, u32 *GpadlHandle) 490 u32 size, u32 *gpadl_handle)
489{ 491{
490 struct vmbus_channel_gpadl_header *gpadlMsg; 492 struct vmbus_channel_gpadl_header *gpadlmsg;
491 struct vmbus_channel_gpadl_body *gpadlBody; 493 struct vmbus_channel_gpadl_body *gpadl_body;
492 /* struct vmbus_channel_gpadl_created *gpadlCreated; */ 494 /* struct vmbus_channel_gpadl_created *gpadlCreated; */
493 struct vmbus_channel_msginfo *msgInfo = NULL; 495 struct vmbus_channel_msginfo *msginfo = NULL;
494 struct vmbus_channel_msginfo *subMsgInfo; 496 struct vmbus_channel_msginfo *submsginfo;
495 u32 msgCount; 497 u32 msgcount;
496 struct list_head *curr; 498 struct list_head *curr;
497 u32 nextGpadlHandle; 499 u32 next_gpadl_handle;
498 unsigned long flags; 500 unsigned long flags;
499 int ret = 0; 501 int ret = 0;
500 502
501 nextGpadlHandle = atomic_read(&gVmbusConnection.NextGpadlHandle); 503 next_gpadl_handle = atomic_read(&gVmbusConnection.NextGpadlHandle);
502 atomic_inc(&gVmbusConnection.NextGpadlHandle); 504 atomic_inc(&gVmbusConnection.NextGpadlHandle);
503 505
504 ret = VmbusChannelCreateGpadlHeader(Kbuffer, Size, &msgInfo, &msgCount); 506 ret = VmbusChannelCreateGpadlHeader(kbuffer, size, &msginfo, &msgcount);
505 if (ret) 507 if (ret)
506 return ret; 508 return ret;
507 509
508 msgInfo->WaitEvent = osd_WaitEventCreate(); 510 msginfo->WaitEvent = osd_WaitEventCreate();
509 if (!msgInfo->WaitEvent) { 511 if (!msginfo->WaitEvent) {
510 ret = -ENOMEM; 512 ret = -ENOMEM;
511 goto Cleanup; 513 goto Cleanup;
512 } 514 }
513 515
514 gpadlMsg = (struct vmbus_channel_gpadl_header *)msgInfo->Msg; 516 gpadlmsg = (struct vmbus_channel_gpadl_header *)msginfo->Msg;
515 gpadlMsg->Header.MessageType = ChannelMessageGpadlHeader; 517 gpadlmsg->Header.MessageType = ChannelMessageGpadlHeader;
516 gpadlMsg->ChildRelId = Channel->OfferMsg.ChildRelId; 518 gpadlmsg->ChildRelId = channel->OfferMsg.ChildRelId;
517 gpadlMsg->Gpadl = nextGpadlHandle; 519 gpadlmsg->Gpadl = next_gpadl_handle;
518 520
519 DumpGpadlHeader(gpadlMsg); 521 DumpGpadlHeader(gpadlmsg);
520 522
521 spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); 523 spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
522 list_add_tail(&msgInfo->MsgListEntry, 524 list_add_tail(&msginfo->MsgListEntry,
523 &gVmbusConnection.ChannelMsgList); 525 &gVmbusConnection.ChannelMsgList);
524 526
525 spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); 527 spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
526 DPRINT_DBG(VMBUS, "buffer %p, size %d msg cnt %d", 528 DPRINT_DBG(VMBUS, "buffer %p, size %d msg cnt %d",
527 Kbuffer, Size, msgCount); 529 kbuffer, size, msgcount);
528 530
529 DPRINT_DBG(VMBUS, "Sending GPADL Header - len %zd", 531 DPRINT_DBG(VMBUS, "Sending GPADL Header - len %zd",
530 msgInfo->MessageSize - sizeof(*msgInfo)); 532 msginfo->MessageSize - sizeof(*msginfo));
531 533
532 ret = VmbusPostMessage(gpadlMsg, msgInfo->MessageSize - 534 ret = VmbusPostMessage(gpadlmsg, msginfo->MessageSize -
533 sizeof(*msgInfo)); 535 sizeof(*msginfo));
534 if (ret != 0) { 536 if (ret != 0) {
535 DPRINT_ERR(VMBUS, "Unable to open channel - %d", ret); 537 DPRINT_ERR(VMBUS, "Unable to open channel - %d", ret);
536 goto Cleanup; 538 goto Cleanup;
537 } 539 }
538 540
539 if (msgCount > 1) { 541 if (msgcount > 1) {
540 list_for_each(curr, &msgInfo->SubMsgList) { 542 list_for_each(curr, &msginfo->SubMsgList) {
541 543
542 /* FIXME: should this use list_entry() instead ? */ 544 /* FIXME: should this use list_entry() instead ? */
543 subMsgInfo = (struct vmbus_channel_msginfo *)curr; 545 submsginfo = (struct vmbus_channel_msginfo *)curr;
544 gpadlBody = 546 gpadl_body =
545 (struct vmbus_channel_gpadl_body *)subMsgInfo->Msg; 547 (struct vmbus_channel_gpadl_body *)submsginfo->Msg;
546 548
547 gpadlBody->Header.MessageType = ChannelMessageGpadlBody; 549 gpadl_body->Header.MessageType =
548 gpadlBody->Gpadl = nextGpadlHandle; 550 ChannelMessageGpadlBody;
551 gpadl_body->Gpadl = next_gpadl_handle;
549 552
550 DPRINT_DBG(VMBUS, "Sending GPADL Body - len %zd", 553 DPRINT_DBG(VMBUS, "Sending GPADL Body - len %zd",
551 subMsgInfo->MessageSize - 554 submsginfo->MessageSize -
552 sizeof(*subMsgInfo)); 555 sizeof(*submsginfo));
553 556
554 DumpGpadlBody(gpadlBody, subMsgInfo->MessageSize - 557 DumpGpadlBody(gpadl_body, submsginfo->MessageSize -
555 sizeof(*subMsgInfo)); 558 sizeof(*submsginfo));
556 ret = VmbusPostMessage(gpadlBody, 559 ret = VmbusPostMessage(gpadl_body,
557 subMsgInfo->MessageSize - 560 submsginfo->MessageSize -
558 sizeof(*subMsgInfo)); 561 sizeof(*submsginfo));
559 if (ret != 0) 562 if (ret != 0)
560 goto Cleanup; 563 goto Cleanup;
561 564
562 } 565 }
563 } 566 }
564 osd_WaitEventWait(msgInfo->WaitEvent); 567 osd_WaitEventWait(msginfo->WaitEvent);
565 568
566 /* At this point, we received the gpadl created msg */ 569 /* At this point, we received the gpadl created msg */
567 DPRINT_DBG(VMBUS, "Received GPADL created " 570 DPRINT_DBG(VMBUS, "Received GPADL created "
568 "(relid %d, status %d handle %x)", 571 "(relid %d, status %d handle %x)",
569 Channel->OfferMsg.ChildRelId, 572 channel->OfferMsg.ChildRelId,
570 msgInfo->Response.GpadlCreated.CreationStatus, 573 msginfo->Response.GpadlCreated.CreationStatus,
571 gpadlMsg->Gpadl); 574 gpadlmsg->Gpadl);
572 575
573 *GpadlHandle = gpadlMsg->Gpadl; 576 *gpadl_handle = gpadlmsg->Gpadl;
574 577
575Cleanup: 578Cleanup:
576 spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); 579 spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
577 list_del(&msgInfo->MsgListEntry); 580 list_del(&msginfo->MsgListEntry);
578 spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); 581 spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
579 582
580 kfree(msgInfo->WaitEvent); 583 kfree(msginfo->WaitEvent);
581 kfree(msgInfo); 584 kfree(msginfo);
582 return ret; 585 return ret;
583} 586}
584 587
585/* 588/*
586 * VmbusChannelTeardownGpadl -Teardown the specified GPADL handle 589 * VmbusChannelTeardownGpadl -Teardown the specified GPADL handle
587 */ 590 */
588int VmbusChannelTeardownGpadl(struct vmbus_channel *Channel, u32 GpadlHandle) 591int VmbusChannelTeardownGpadl(struct vmbus_channel *channel, u32 gpadl_handle)
589{ 592{
590 struct vmbus_channel_gpadl_teardown *msg; 593 struct vmbus_channel_gpadl_teardown *msg;
591 struct vmbus_channel_msginfo *info; 594 struct vmbus_channel_msginfo *info;
592 unsigned long flags; 595 unsigned long flags;
593 int ret; 596 int ret;
594 597
595 /* ASSERT(GpadlHandle != 0); */ 598 /* ASSERT(gpadl_handle != 0); */
596 599
597 info = kmalloc(sizeof(*info) + 600 info = kmalloc(sizeof(*info) +
598 sizeof(struct vmbus_channel_gpadl_teardown), GFP_KERNEL); 601 sizeof(struct vmbus_channel_gpadl_teardown), GFP_KERNEL);
@@ -608,8 +611,8 @@ int VmbusChannelTeardownGpadl(struct vmbus_channel *Channel, u32 GpadlHandle)
608 msg = (struct vmbus_channel_gpadl_teardown *)info->Msg; 611 msg = (struct vmbus_channel_gpadl_teardown *)info->Msg;
609 612
610 msg->Header.MessageType = ChannelMessageGpadlTeardown; 613 msg->Header.MessageType = ChannelMessageGpadlTeardown;
611 msg->ChildRelId = Channel->OfferMsg.ChildRelId; 614 msg->ChildRelId = channel->OfferMsg.ChildRelId;
612 msg->Gpadl = GpadlHandle; 615 msg->Gpadl = gpadl_handle;
613 616
614 spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); 617 spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
615 list_add_tail(&info->MsgListEntry, 618 list_add_tail(&info->MsgListEntry,
@@ -638,7 +641,7 @@ int VmbusChannelTeardownGpadl(struct vmbus_channel *Channel, u32 GpadlHandle)
638/* 641/*
639 * VmbusChannelClose - Close the specified channel 642 * VmbusChannelClose - Close the specified channel
640 */ 643 */
641void VmbusChannelClose(struct vmbus_channel *Channel) 644void VmbusChannelClose(struct vmbus_channel *channel)
642{ 645{
643 struct vmbus_channel_close_channel *msg; 646 struct vmbus_channel_close_channel *msg;
644 struct vmbus_channel_msginfo *info; 647 struct vmbus_channel_msginfo *info;
@@ -646,8 +649,8 @@ void VmbusChannelClose(struct vmbus_channel *Channel)
646 int ret; 649 int ret;
647 650
648 /* Stop callback and cancel the timer asap */ 651 /* Stop callback and cancel the timer asap */
649 Channel->OnChannelCallback = NULL; 652 channel->OnChannelCallback = NULL;
650 del_timer_sync(&Channel->poll_timer); 653 del_timer_sync(&channel->poll_timer);
651 654
652 /* Send a closing message */ 655 /* Send a closing message */
653 info = kmalloc(sizeof(*info) + 656 info = kmalloc(sizeof(*info) +
@@ -661,7 +664,7 @@ void VmbusChannelClose(struct vmbus_channel *Channel)
661 664
662 msg = (struct vmbus_channel_close_channel *)info->Msg; 665 msg = (struct vmbus_channel_close_channel *)info->Msg;
663 msg->Header.MessageType = ChannelMessageCloseChannel; 666 msg->Header.MessageType = ChannelMessageCloseChannel;
664 msg->ChildRelId = Channel->OfferMsg.ChildRelId; 667 msg->ChildRelId = channel->OfferMsg.ChildRelId;
665 668
666 ret = VmbusPostMessage(msg, sizeof(struct vmbus_channel_close_channel)); 669 ret = VmbusPostMessage(msg, sizeof(struct vmbus_channel_close_channel));
667 if (ret != 0) { 670 if (ret != 0) {
@@ -670,17 +673,17 @@ void VmbusChannelClose(struct vmbus_channel *Channel)
670 } 673 }
671 674
672 /* Tear down the gpadl for the channel's ring buffer */ 675 /* Tear down the gpadl for the channel's ring buffer */
673 if (Channel->RingBufferGpadlHandle) 676 if (channel->RingBufferGpadlHandle)
674 VmbusChannelTeardownGpadl(Channel, 677 VmbusChannelTeardownGpadl(channel,
675 Channel->RingBufferGpadlHandle); 678 channel->RingBufferGpadlHandle);
676 679
677 /* TODO: Send a msg to release the childRelId */ 680 /* TODO: Send a msg to release the childRelId */
678 681
679 /* Cleanup the ring buffers for this channel */ 682 /* Cleanup the ring buffers for this channel */
680 RingBufferCleanup(&Channel->Outbound); 683 RingBufferCleanup(&channel->Outbound);
681 RingBufferCleanup(&Channel->Inbound); 684 RingBufferCleanup(&channel->Inbound);
682 685
683 osd_PageFree(Channel->RingBufferPages, Channel->RingBufferPageCount); 686 osd_PageFree(channel->RingBufferPages, channel->RingBufferPageCount);
684 687
685 kfree(info); 688 kfree(info);
686 689
@@ -690,65 +693,66 @@ void VmbusChannelClose(struct vmbus_channel *Channel)
690 * caller will free the channel 693 * caller will free the channel
691 */ 694 */
692 695
693 if (Channel->State == CHANNEL_OPEN_STATE) { 696 if (channel->State == CHANNEL_OPEN_STATE) {
694 spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); 697 spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
695 list_del(&Channel->ListEntry); 698 list_del(&channel->ListEntry);
696 spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); 699 spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
697 700
698 FreeVmbusChannel(Channel); 701 FreeVmbusChannel(channel);
699 } 702 }
700} 703}
701 704
702/** 705/**
703 * VmbusChannelSendPacket() - Send the specified buffer on the given channel 706 * VmbusChannelSendPacket() - Send the specified buffer on the given channel
704 * @Channel: Pointer to vmbus_channel structure. 707 * @channel: Pointer to vmbus_channel structure.
705 * @Buffer: Pointer to the buffer you want to receive the data into. 708 * @buffer: Pointer to the buffer you want to receive the data into.
706 * @BufferLen: Maximum size of what the the buffer will hold 709 * @bufferlen: Maximum size of what the the buffer will hold
707 * @RequestId: Identifier of the request 710 * @requestid: Identifier of the request
708 * @vmbus_packet_type: Type of packet that is being send e.g. negotiate, time 711 * @type: Type of packet that is being send e.g. negotiate, time
709 * packet etc. 712 * packet etc.
710 * 713 *
711 * Sends data in @Buffer directly to hyper-v via the vmbus 714 * Sends data in @buffer directly to hyper-v via the vmbus
712 * This will send the data unparsed to hyper-v. 715 * This will send the data unparsed to hyper-v.
713 * 716 *
714 * Mainly used by Hyper-V drivers. 717 * Mainly used by Hyper-V drivers.
715 */ 718 */
716int VmbusChannelSendPacket(struct vmbus_channel *Channel, const void *Buffer, 719int VmbusChannelSendPacket(struct vmbus_channel *channel, const void *buffer,
717 u32 BufferLen, u64 RequestId, 720 u32 bufferlen, u64 requestid,
718 enum vmbus_packet_type Type, u32 Flags) 721 enum vmbus_packet_type type, u32 flags)
719{ 722{
720 struct vmpacket_descriptor desc; 723 struct vmpacket_descriptor desc;
721 u32 packetLen = sizeof(struct vmpacket_descriptor) + BufferLen; 724 u32 packetlen = sizeof(struct vmpacket_descriptor) + bufferlen;
722 u32 packetLenAligned = ALIGN_UP(packetLen, sizeof(u64)); 725 u32 packetlen_aligned = ALIGN_UP(packetlen, sizeof(u64));
723 struct scatterlist bufferList[3]; 726 struct scatterlist bufferlist[3];
724 u64 alignedData = 0; 727 u64 aligned_data = 0;
725 int ret; 728 int ret;
726 729
727 DPRINT_DBG(VMBUS, "channel %p buffer %p len %d", 730 DPRINT_DBG(VMBUS, "channel %p buffer %p len %d",
728 Channel, Buffer, BufferLen); 731 channel, buffer, bufferlen);
729 732
730 DumpVmbusChannel(Channel); 733 DumpVmbusChannel(channel);
731 734
732 /* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */ 735 /* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */
733 736
734 /* Setup the descriptor */ 737 /* Setup the descriptor */
735 desc.Type = Type; /* VmbusPacketTypeDataInBand; */ 738 desc.Type = type; /* VmbusPacketTypeDataInBand; */
736 desc.Flags = Flags; /* VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; */ 739 desc.Flags = flags; /* VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; */
737 /* in 8-bytes granularity */ 740 /* in 8-bytes granularity */
738 desc.DataOffset8 = sizeof(struct vmpacket_descriptor) >> 3; 741 desc.DataOffset8 = sizeof(struct vmpacket_descriptor) >> 3;
739 desc.Length8 = (u16)(packetLenAligned >> 3); 742 desc.Length8 = (u16)(packetlen_aligned >> 3);
740 desc.TransactionId = RequestId; 743 desc.TransactionId = requestid;
741 744
742 sg_init_table(bufferList, 3); 745 sg_init_table(bufferlist, 3);
743 sg_set_buf(&bufferList[0], &desc, sizeof(struct vmpacket_descriptor)); 746 sg_set_buf(&bufferlist[0], &desc, sizeof(struct vmpacket_descriptor));
744 sg_set_buf(&bufferList[1], Buffer, BufferLen); 747 sg_set_buf(&bufferlist[1], buffer, bufferlen);
745 sg_set_buf(&bufferList[2], &alignedData, packetLenAligned - packetLen); 748 sg_set_buf(&bufferlist[2], &aligned_data,
749 packetlen_aligned - packetlen);
746 750
747 ret = RingBufferWrite(&Channel->Outbound, bufferList, 3); 751 ret = RingBufferWrite(&channel->Outbound, bufferlist, 3);
748 752
749 /* TODO: We should determine if this is optional */ 753 /* TODO: We should determine if this is optional */
750 if (ret == 0 && !GetRingBufferInterruptMask(&Channel->Outbound)) 754 if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound))
751 VmbusChannelSetEvent(Channel); 755 VmbusChannelSetEvent(channel);
752 756
753 return ret; 757 return ret;
754} 758}
@@ -758,61 +762,62 @@ EXPORT_SYMBOL(VmbusChannelSendPacket);
758 * VmbusChannelSendPacketPageBuffer - Send a range of single-page buffer 762 * VmbusChannelSendPacketPageBuffer - Send a range of single-page buffer
759 * packets using a GPADL Direct packet type. 763 * packets using a GPADL Direct packet type.
760 */ 764 */
761int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *Channel, 765int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *channel,
762 struct hv_page_buffer PageBuffers[], 766 struct hv_page_buffer pagebuffers[],
763 u32 PageCount, void *Buffer, u32 BufferLen, 767 u32 pagecount, void *buffer, u32 bufferlen,
764 u64 RequestId) 768 u64 requestid)
765{ 769{
766 int ret; 770 int ret;
767 int i; 771 int i;
768 struct vmbus_channel_packet_page_buffer desc; 772 struct vmbus_channel_packet_page_buffer desc;
769 u32 descSize; 773 u32 descsize;
770 u32 packetLen; 774 u32 packetlen;
771 u32 packetLenAligned; 775 u32 packetlen_aligned;
772 struct scatterlist bufferList[3]; 776 struct scatterlist bufferlist[3];
773 u64 alignedData = 0; 777 u64 aligned_data = 0;
774 778
775 if (PageCount > MAX_PAGE_BUFFER_COUNT) 779 if (pagecount > MAX_PAGE_BUFFER_COUNT)
776 return -EINVAL; 780 return -EINVAL;
777 781
778 DumpVmbusChannel(Channel); 782 DumpVmbusChannel(channel);
779 783
780 /* 784 /*
781 * Adjust the size down since vmbus_channel_packet_page_buffer is the 785 * Adjust the size down since vmbus_channel_packet_page_buffer is the
782 * largest size we support 786 * largest size we support
783 */ 787 */
784 descSize = sizeof(struct vmbus_channel_packet_page_buffer) - 788 descsize = sizeof(struct vmbus_channel_packet_page_buffer) -
785 ((MAX_PAGE_BUFFER_COUNT - PageCount) * 789 ((MAX_PAGE_BUFFER_COUNT - pagecount) *
786 sizeof(struct hv_page_buffer)); 790 sizeof(struct hv_page_buffer));
787 packetLen = descSize + BufferLen; 791 packetlen = descsize + bufferlen;
788 packetLenAligned = ALIGN_UP(packetLen, sizeof(u64)); 792 packetlen_aligned = ALIGN_UP(packetlen, sizeof(u64));
789 793
790 /* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */ 794 /* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */
791 795
792 /* Setup the descriptor */ 796 /* Setup the descriptor */
793 desc.type = VmbusPacketTypeDataUsingGpaDirect; 797 desc.type = VmbusPacketTypeDataUsingGpaDirect;
794 desc.flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; 798 desc.flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED;
795 desc.dataoffset8 = descSize >> 3; /* in 8-bytes grandularity */ 799 desc.dataoffset8 = descsize >> 3; /* in 8-bytes grandularity */
796 desc.length8 = (u16)(packetLenAligned >> 3); 800 desc.length8 = (u16)(packetlen_aligned >> 3);
797 desc.transactionid = RequestId; 801 desc.transactionid = requestid;
798 desc.rangecount = PageCount; 802 desc.rangecount = pagecount;
799 803
800 for (i = 0; i < PageCount; i++) { 804 for (i = 0; i < pagecount; i++) {
801 desc.range[i].Length = PageBuffers[i].Length; 805 desc.range[i].Length = pagebuffers[i].Length;
802 desc.range[i].Offset = PageBuffers[i].Offset; 806 desc.range[i].Offset = pagebuffers[i].Offset;
803 desc.range[i].Pfn = PageBuffers[i].Pfn; 807 desc.range[i].Pfn = pagebuffers[i].Pfn;
804 } 808 }
805 809
806 sg_init_table(bufferList, 3); 810 sg_init_table(bufferlist, 3);
807 sg_set_buf(&bufferList[0], &desc, descSize); 811 sg_set_buf(&bufferlist[0], &desc, descsize);
808 sg_set_buf(&bufferList[1], Buffer, BufferLen); 812 sg_set_buf(&bufferlist[1], buffer, bufferlen);
809 sg_set_buf(&bufferList[2], &alignedData, packetLenAligned - packetLen); 813 sg_set_buf(&bufferlist[2], &aligned_data,
814 packetlen_aligned - packetlen);
810 815
811 ret = RingBufferWrite(&Channel->Outbound, bufferList, 3); 816 ret = RingBufferWrite(&channel->Outbound, bufferlist, 3);
812 817
813 /* TODO: We should determine if this is optional */ 818 /* TODO: We should determine if this is optional */
814 if (ret == 0 && !GetRingBufferInterruptMask(&Channel->Outbound)) 819 if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound))
815 VmbusChannelSetEvent(Channel); 820 VmbusChannelSetEvent(channel);
816 821
817 return ret; 822 return ret;
818} 823}
@@ -821,64 +826,66 @@ int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *Channel,
821 * VmbusChannelSendPacketMultiPageBuffer - Send a multi-page buffer packet 826 * VmbusChannelSendPacketMultiPageBuffer - Send a multi-page buffer packet
822 * using a GPADL Direct packet type. 827 * using a GPADL Direct packet type.
823 */ 828 */
824int VmbusChannelSendPacketMultiPageBuffer(struct vmbus_channel *Channel, 829int VmbusChannelSendPacketMultiPageBuffer(struct vmbus_channel *channel,
825 struct hv_multipage_buffer *MultiPageBuffer, 830 struct hv_multipage_buffer *multi_pagebuffer,
826 void *Buffer, u32 BufferLen, u64 RequestId) 831 void *buffer, u32 bufferlen, u64 requestid)
827{ 832{
828 int ret; 833 int ret;
829 struct vmbus_channel_packet_multipage_buffer desc; 834 struct vmbus_channel_packet_multipage_buffer desc;
830 u32 descSize; 835 u32 descsize;
831 u32 packetLen; 836 u32 packetlen;
832 u32 packetLenAligned; 837 u32 packetlen_aligned;
833 struct scatterlist bufferList[3]; 838 struct scatterlist bufferlist[3];
834 u64 alignedData = 0; 839 u64 aligned_data = 0;
835 u32 PfnCount = NUM_PAGES_SPANNED(MultiPageBuffer->Offset, 840 u32 pfncount = NUM_PAGES_SPANNED(multi_pagebuffer->Offset,
836 MultiPageBuffer->Length); 841 multi_pagebuffer->Length);
837 842
838 DumpVmbusChannel(Channel); 843 DumpVmbusChannel(channel);
839 844
840 DPRINT_DBG(VMBUS, "data buffer - offset %u len %u pfn count %u", 845 DPRINT_DBG(VMBUS, "data buffer - offset %u len %u pfn count %u",
841 MultiPageBuffer->Offset, MultiPageBuffer->Length, PfnCount); 846 multi_pagebuffer->Offset,
847 multi_pagebuffer->Length, pfncount);
842 848
843 if ((PfnCount < 0) || (PfnCount > MAX_MULTIPAGE_BUFFER_COUNT)) 849 if ((pfncount < 0) || (pfncount > MAX_MULTIPAGE_BUFFER_COUNT))
844 return -EINVAL; 850 return -EINVAL;
845 851
846 /* 852 /*
847 * Adjust the size down since vmbus_channel_packet_multipage_buffer is 853 * Adjust the size down since vmbus_channel_packet_multipage_buffer is
848 * the largest size we support 854 * the largest size we support
849 */ 855 */
850 descSize = sizeof(struct vmbus_channel_packet_multipage_buffer) - 856 descsize = sizeof(struct vmbus_channel_packet_multipage_buffer) -
851 ((MAX_MULTIPAGE_BUFFER_COUNT - PfnCount) * 857 ((MAX_MULTIPAGE_BUFFER_COUNT - pfncount) *
852 sizeof(u64)); 858 sizeof(u64));
853 packetLen = descSize + BufferLen; 859 packetlen = descsize + bufferlen;
854 packetLenAligned = ALIGN_UP(packetLen, sizeof(u64)); 860 packetlen_aligned = ALIGN_UP(packetlen, sizeof(u64));
855 861
856 /* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */ 862 /* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */
857 863
858 /* Setup the descriptor */ 864 /* Setup the descriptor */
859 desc.type = VmbusPacketTypeDataUsingGpaDirect; 865 desc.type = VmbusPacketTypeDataUsingGpaDirect;
860 desc.flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; 866 desc.flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED;
861 desc.dataoffset8 = descSize >> 3; /* in 8-bytes grandularity */ 867 desc.dataoffset8 = descsize >> 3; /* in 8-bytes grandularity */
862 desc.length8 = (u16)(packetLenAligned >> 3); 868 desc.length8 = (u16)(packetlen_aligned >> 3);
863 desc.transactionid = RequestId; 869 desc.transactionid = requestid;
864 desc.rangecount = 1; 870 desc.rangecount = 1;
865 871
866 desc.range.Length = MultiPageBuffer->Length; 872 desc.range.Length = multi_pagebuffer->Length;
867 desc.range.Offset = MultiPageBuffer->Offset; 873 desc.range.Offset = multi_pagebuffer->Offset;
868 874
869 memcpy(desc.range.PfnArray, MultiPageBuffer->PfnArray, 875 memcpy(desc.range.PfnArray, multi_pagebuffer->PfnArray,
870 PfnCount * sizeof(u64)); 876 pfncount * sizeof(u64));
871 877
872 sg_init_table(bufferList, 3); 878 sg_init_table(bufferlist, 3);
873 sg_set_buf(&bufferList[0], &desc, descSize); 879 sg_set_buf(&bufferlist[0], &desc, descsize);
874 sg_set_buf(&bufferList[1], Buffer, BufferLen); 880 sg_set_buf(&bufferlist[1], buffer, bufferlen);
875 sg_set_buf(&bufferList[2], &alignedData, packetLenAligned - packetLen); 881 sg_set_buf(&bufferlist[2], &aligned_data,
882 packetlen_aligned - packetlen);
876 883
877 ret = RingBufferWrite(&Channel->Outbound, bufferList, 3); 884 ret = RingBufferWrite(&channel->Outbound, bufferlist, 3);
878 885
879 /* TODO: We should determine if this is optional */ 886 /* TODO: We should determine if this is optional */
880 if (ret == 0 && !GetRingBufferInterruptMask(&Channel->Outbound)) 887 if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound))
881 VmbusChannelSetEvent(Channel); 888 VmbusChannelSetEvent(channel);
882 889
883 return ret; 890 return ret;
884} 891}
@@ -886,35 +893,35 @@ int VmbusChannelSendPacketMultiPageBuffer(struct vmbus_channel *Channel,
886 893
887/** 894/**
888 * VmbusChannelRecvPacket() - Retrieve the user packet on the specified channel 895 * VmbusChannelRecvPacket() - Retrieve the user packet on the specified channel
889 * @Channel: Pointer to vmbus_channel structure. 896 * @channel: Pointer to vmbus_channel structure.
890 * @Buffer: Pointer to the buffer you want to receive the data into. 897 * @buffer: Pointer to the buffer you want to receive the data into.
891 * @BufferLen: Maximum size of what the the buffer will hold 898 * @bufferlen: Maximum size of what the the buffer will hold
892 * @BufferActualLen: The actual size of the data after it was received 899 * @buffer_actual_len: The actual size of the data after it was received
893 * @RequestId: Identifier of the request 900 * @requestid: Identifier of the request
894 * 901 *
895 * Receives directly from the hyper-v vmbus and puts the data it received 902 * Receives directly from the hyper-v vmbus and puts the data it received
896 * into Buffer. This will receive the data unparsed from hyper-v. 903 * into Buffer. This will receive the data unparsed from hyper-v.
897 * 904 *
898 * Mainly used by Hyper-V drivers. 905 * Mainly used by Hyper-V drivers.
899 */ 906 */
900int VmbusChannelRecvPacket(struct vmbus_channel *Channel, void *Buffer, 907int VmbusChannelRecvPacket(struct vmbus_channel *channel, void *buffer,
901 u32 BufferLen, u32 *BufferActualLen, u64 *RequestId) 908 u32 bufferlen, u32 *buffer_actual_len, u64 *requestid)
902{ 909{
903 struct vmpacket_descriptor desc; 910 struct vmpacket_descriptor desc;
904 u32 packetLen; 911 u32 packetlen;
905 u32 userLen; 912 u32 userlen;
906 int ret; 913 int ret;
907 unsigned long flags; 914 unsigned long flags;
908 915
909 *BufferActualLen = 0; 916 *buffer_actual_len = 0;
910 *RequestId = 0; 917 *requestid = 0;
911 918
912 spin_lock_irqsave(&Channel->inbound_lock, flags); 919 spin_lock_irqsave(&channel->inbound_lock, flags);
913 920
914 ret = RingBufferPeek(&Channel->Inbound, &desc, 921 ret = RingBufferPeek(&channel->Inbound, &desc,
915 sizeof(struct vmpacket_descriptor)); 922 sizeof(struct vmpacket_descriptor));
916 if (ret != 0) { 923 if (ret != 0) {
917 spin_unlock_irqrestore(&Channel->inbound_lock, flags); 924 spin_unlock_irqrestore(&channel->inbound_lock, flags);
918 925
919 /* DPRINT_DBG(VMBUS, "nothing to read!!"); */ 926 /* DPRINT_DBG(VMBUS, "nothing to read!!"); */
920 return 0; 927 return 0;
@@ -922,32 +929,32 @@ int VmbusChannelRecvPacket(struct vmbus_channel *Channel, void *Buffer,
922 929
923 /* VmbusChannelClearEvent(Channel); */ 930 /* VmbusChannelClearEvent(Channel); */
924 931
925 packetLen = desc.Length8 << 3; 932 packetlen = desc.Length8 << 3;
926 userLen = packetLen - (desc.DataOffset8 << 3); 933 userlen = packetlen - (desc.DataOffset8 << 3);
927 /* ASSERT(userLen > 0); */ 934 /* ASSERT(userLen > 0); */
928 935
929 DPRINT_DBG(VMBUS, "packet received on channel %p relid %d <type %d " 936 DPRINT_DBG(VMBUS, "packet received on channel %p relid %d <type %d "
930 "flag %d tid %llx pktlen %d datalen %d> ", 937 "flag %d tid %llx pktlen %d datalen %d> ",
931 Channel, Channel->OfferMsg.ChildRelId, desc.Type, 938 channel, channel->OfferMsg.ChildRelId, desc.Type,
932 desc.Flags, desc.TransactionId, packetLen, userLen); 939 desc.Flags, desc.TransactionId, packetlen, userlen);
933 940
934 *BufferActualLen = userLen; 941 *buffer_actual_len = userlen;
935 942
936 if (userLen > BufferLen) { 943 if (userlen > bufferlen) {
937 spin_unlock_irqrestore(&Channel->inbound_lock, flags); 944 spin_unlock_irqrestore(&channel->inbound_lock, flags);
938 945
939 DPRINT_ERR(VMBUS, "buffer too small - got %d needs %d", 946 DPRINT_ERR(VMBUS, "buffer too small - got %d needs %d",
940 BufferLen, userLen); 947 bufferlen, userlen);
941 return -1; 948 return -1;
942 } 949 }
943 950
944 *RequestId = desc.TransactionId; 951 *requestid = desc.TransactionId;
945 952
946 /* Copy over the packet to the user buffer */ 953 /* Copy over the packet to the user buffer */
947 ret = RingBufferRead(&Channel->Inbound, Buffer, userLen, 954 ret = RingBufferRead(&channel->Inbound, buffer, userlen,
948 (desc.DataOffset8 << 3)); 955 (desc.DataOffset8 << 3));
949 956
950 spin_unlock_irqrestore(&Channel->inbound_lock, flags); 957 spin_unlock_irqrestore(&channel->inbound_lock, flags);
951 958
952 return 0; 959 return 0;
953} 960}
@@ -956,25 +963,25 @@ EXPORT_SYMBOL(VmbusChannelRecvPacket);
956/* 963/*
957 * VmbusChannelRecvPacketRaw - Retrieve the raw packet on the specified channel 964 * VmbusChannelRecvPacketRaw - Retrieve the raw packet on the specified channel
958 */ 965 */
959int VmbusChannelRecvPacketRaw(struct vmbus_channel *Channel, void *Buffer, 966int VmbusChannelRecvPacketRaw(struct vmbus_channel *channel, void *buffer,
960 u32 BufferLen, u32 *BufferActualLen, 967 u32 bufferlen, u32 *buffer_actual_len,
961 u64 *RequestId) 968 u64 *requestid)
962{ 969{
963 struct vmpacket_descriptor desc; 970 struct vmpacket_descriptor desc;
964 u32 packetLen; 971 u32 packetlen;
965 u32 userLen; 972 u32 userlen;
966 int ret; 973 int ret;
967 unsigned long flags; 974 unsigned long flags;
968 975
969 *BufferActualLen = 0; 976 *buffer_actual_len = 0;
970 *RequestId = 0; 977 *requestid = 0;
971 978
972 spin_lock_irqsave(&Channel->inbound_lock, flags); 979 spin_lock_irqsave(&channel->inbound_lock, flags);
973 980
974 ret = RingBufferPeek(&Channel->Inbound, &desc, 981 ret = RingBufferPeek(&channel->Inbound, &desc,
975 sizeof(struct vmpacket_descriptor)); 982 sizeof(struct vmpacket_descriptor));
976 if (ret != 0) { 983 if (ret != 0) {
977 spin_unlock_irqrestore(&Channel->inbound_lock, flags); 984 spin_unlock_irqrestore(&channel->inbound_lock, flags);
978 985
979 /* DPRINT_DBG(VMBUS, "nothing to read!!"); */ 986 /* DPRINT_DBG(VMBUS, "nothing to read!!"); */
980 return 0; 987 return 0;
@@ -982,44 +989,44 @@ int VmbusChannelRecvPacketRaw(struct vmbus_channel *Channel, void *Buffer,
982 989
983 /* VmbusChannelClearEvent(Channel); */ 990 /* VmbusChannelClearEvent(Channel); */
984 991
985 packetLen = desc.Length8 << 3; 992 packetlen = desc.Length8 << 3;
986 userLen = packetLen - (desc.DataOffset8 << 3); 993 userlen = packetlen - (desc.DataOffset8 << 3);
987 994
988 DPRINT_DBG(VMBUS, "packet received on channel %p relid %d <type %d " 995 DPRINT_DBG(VMBUS, "packet received on channel %p relid %d <type %d "
989 "flag %d tid %llx pktlen %d datalen %d> ", 996 "flag %d tid %llx pktlen %d datalen %d> ",
990 Channel, Channel->OfferMsg.ChildRelId, desc.Type, 997 channel, channel->OfferMsg.ChildRelId, desc.Type,
991 desc.Flags, desc.TransactionId, packetLen, userLen); 998 desc.Flags, desc.TransactionId, packetlen, userlen);
992 999
993 *BufferActualLen = packetLen; 1000 *buffer_actual_len = packetlen;
994 1001
995 if (packetLen > BufferLen) { 1002 if (packetlen > bufferlen) {
996 spin_unlock_irqrestore(&Channel->inbound_lock, flags); 1003 spin_unlock_irqrestore(&channel->inbound_lock, flags);
997 1004
998 DPRINT_ERR(VMBUS, "buffer too small - needed %d bytes but " 1005 DPRINT_ERR(VMBUS, "buffer too small - needed %d bytes but "
999 "got space for only %d bytes", packetLen, BufferLen); 1006 "got space for only %d bytes", packetlen, bufferlen);
1000 return -2; 1007 return -2;
1001 } 1008 }
1002 1009
1003 *RequestId = desc.TransactionId; 1010 *requestid = desc.TransactionId;
1004 1011
1005 /* Copy over the entire packet to the user buffer */ 1012 /* Copy over the entire packet to the user buffer */
1006 ret = RingBufferRead(&Channel->Inbound, Buffer, packetLen, 0); 1013 ret = RingBufferRead(&channel->Inbound, buffer, packetlen, 0);
1007 1014
1008 spin_unlock_irqrestore(&Channel->inbound_lock, flags); 1015 spin_unlock_irqrestore(&channel->inbound_lock, flags);
1009 return 0; 1016 return 0;
1010} 1017}
1011 1018
1012/* 1019/*
1013 * VmbusChannelOnChannelEvent - Channel event callback 1020 * VmbusChannelOnChannelEvent - Channel event callback
1014 */ 1021 */
1015void VmbusChannelOnChannelEvent(struct vmbus_channel *Channel) 1022void VmbusChannelOnChannelEvent(struct vmbus_channel *channel)
1016{ 1023{
1017 DumpVmbusChannel(Channel); 1024 DumpVmbusChannel(channel);
1018 /* ASSERT(Channel->OnChannelCallback); */ 1025 /* ASSERT(Channel->OnChannelCallback); */
1019 1026
1020 Channel->OnChannelCallback(Channel->ChannelCallbackContext); 1027 channel->OnChannelCallback(channel->ChannelCallbackContext);
1021 1028
1022 mod_timer(&Channel->poll_timer, jiffies + usecs_to_jiffies(100)); 1029 mod_timer(&channel->poll_timer, jiffies + usecs_to_jiffies(100));
1023} 1030}
1024 1031
1025/* 1032/*
@@ -1036,9 +1043,9 @@ void VmbusChannelOnTimer(unsigned long data)
1036/* 1043/*
1037 * DumpVmbusChannel - Dump vmbus channel info to the console 1044 * DumpVmbusChannel - Dump vmbus channel info to the console
1038 */ 1045 */
1039static void DumpVmbusChannel(struct vmbus_channel *Channel) 1046static void DumpVmbusChannel(struct vmbus_channel *channel)
1040{ 1047{
1041 DPRINT_DBG(VMBUS, "Channel (%d)", Channel->OfferMsg.ChildRelId); 1048 DPRINT_DBG(VMBUS, "Channel (%d)", channel->OfferMsg.ChildRelId);
1042 DumpRingInfo(&Channel->Outbound, "Outbound "); 1049 DumpRingInfo(&channel->Outbound, "Outbound ");
1043 DumpRingInfo(&Channel->Inbound, "Inbound "); 1050 DumpRingInfo(&channel->Inbound, "Inbound ");
1044} 1051}