aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaiyang Zhang <haiyangz@microsoft.com>2010-12-10 15:03:59 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-12-13 13:31:52 -0500
commit53d21fdbf4d38dcfe27173d746acf74ea1a19958 (patch)
tree99ffa0fc8bbc8e6e9ca0219a8c75c0edd7b4334a
parent72a2f5bd53bf83302f4dcfe8500d4ec440545d27 (diff)
staging: hv: Convert camel cased struct fields in netvsc.h to lower cases
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: Hank Janssen <hjanssen@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/hv/netvsc.c340
-rw-r--r--drivers/staging/hv/netvsc.h164
-rw-r--r--drivers/staging/hv/netvsc_api.h2
-rw-r--r--drivers/staging/hv/rndis_filter.c22
4 files changed, 265 insertions, 263 deletions
diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c
index d678bf5329ef..df9cd131e953 100644
--- a/drivers/staging/hv/netvsc.c
+++ b/drivers/staging/hv/netvsc.c
@@ -83,9 +83,9 @@ static struct netvsc_device *alloc_net_device(struct hv_device *device)
83 return NULL; 83 return NULL;
84 84
85 /* Set to 2 to allow both inbound and outbound traffic */ 85 /* Set to 2 to allow both inbound and outbound traffic */
86 atomic_cmpxchg(&net_device->RefCount, 0, 2); 86 atomic_cmpxchg(&net_device->refcnt, 0, 2);
87 87
88 net_device->Device = device; 88 net_device->dev = device;
89 device->Extension = net_device; 89 device->Extension = net_device;
90 90
91 return net_device; 91 return net_device;
@@ -93,8 +93,8 @@ static struct netvsc_device *alloc_net_device(struct hv_device *device)
93 93
94static void free_net_device(struct netvsc_device *device) 94static void free_net_device(struct netvsc_device *device)
95{ 95{
96 WARN_ON(atomic_read(&device->RefCount) == 0); 96 WARN_ON(atomic_read(&device->refcnt) == 0);
97 device->Device->Extension = NULL; 97 device->dev->Extension = NULL;
98 kfree(device); 98 kfree(device);
99} 99}
100 100
@@ -105,8 +105,8 @@ static struct netvsc_device *get_outbound_net_device(struct hv_device *device)
105 struct netvsc_device *net_device; 105 struct netvsc_device *net_device;
106 106
107 net_device = device->Extension; 107 net_device = device->Extension;
108 if (net_device && atomic_read(&net_device->RefCount) > 1) 108 if (net_device && atomic_read(&net_device->refcnt) > 1)
109 atomic_inc(&net_device->RefCount); 109 atomic_inc(&net_device->refcnt);
110 else 110 else
111 net_device = NULL; 111 net_device = NULL;
112 112
@@ -119,8 +119,8 @@ static struct netvsc_device *get_inbound_net_device(struct hv_device *device)
119 struct netvsc_device *net_device; 119 struct netvsc_device *net_device;
120 120
121 net_device = device->Extension; 121 net_device = device->Extension;
122 if (net_device && atomic_read(&net_device->RefCount)) 122 if (net_device && atomic_read(&net_device->refcnt))
123 atomic_inc(&net_device->RefCount); 123 atomic_inc(&net_device->refcnt);
124 else 124 else
125 net_device = NULL; 125 net_device = NULL;
126 126
@@ -134,7 +134,7 @@ static void put_net_device(struct hv_device *device)
134 net_device = device->Extension; 134 net_device = device->Extension;
135 /* ASSERT(netDevice); */ 135 /* ASSERT(netDevice); */
136 136
137 atomic_dec(&net_device->RefCount); 137 atomic_dec(&net_device->refcnt);
138} 138}
139 139
140static struct netvsc_device *release_outbound_net_device( 140static struct netvsc_device *release_outbound_net_device(
@@ -147,7 +147,7 @@ static struct netvsc_device *release_outbound_net_device(
147 return NULL; 147 return NULL;
148 148
149 /* Busy wait until the ref drop to 2, then set it to 1 */ 149 /* Busy wait until the ref drop to 2, then set it to 1 */
150 while (atomic_cmpxchg(&net_device->RefCount, 2, 1) != 2) 150 while (atomic_cmpxchg(&net_device->refcnt, 2, 1) != 2)
151 udelay(100); 151 udelay(100);
152 152
153 return net_device; 153 return net_device;
@@ -163,7 +163,7 @@ static struct netvsc_device *release_inbound_net_device(
163 return NULL; 163 return NULL;
164 164
165 /* Busy wait until the ref drop to 1, then set it to 0 */ 165 /* Busy wait until the ref drop to 1, then set it to 0 */
166 while (atomic_cmpxchg(&net_device->RefCount, 1, 0) != 1) 166 while (atomic_cmpxchg(&net_device->refcnt, 1, 0) != 1)
167 udelay(100); 167 udelay(100);
168 168
169 device->Extension = NULL; 169 device->Extension = NULL;
@@ -222,12 +222,12 @@ static int netvsc_init_recv_buf(struct hv_device *device)
222 /* page-size grandularity */ 222 /* page-size grandularity */
223 /* ASSERT((netDevice->ReceiveBufferSize & (PAGE_SIZE - 1)) == 0); */ 223 /* ASSERT((netDevice->ReceiveBufferSize & (PAGE_SIZE - 1)) == 0); */
224 224
225 net_device->ReceiveBuffer = 225 net_device->recv_buf =
226 osd_page_alloc(net_device->ReceiveBufferSize >> PAGE_SHIFT); 226 osd_page_alloc(net_device->recv_buf_size >> PAGE_SHIFT);
227 if (!net_device->ReceiveBuffer) { 227 if (!net_device->recv_buf) {
228 DPRINT_ERR(NETVSC, 228 DPRINT_ERR(NETVSC,
229 "unable to allocate receive buffer of size %d", 229 "unable to allocate receive buffer of size %d",
230 net_device->ReceiveBufferSize); 230 net_device->recv_buf_size);
231 ret = -1; 231 ret = -1;
232 goto Cleanup; 232 goto Cleanup;
233 } 233 }
@@ -242,9 +242,9 @@ static int netvsc_init_recv_buf(struct hv_device *device)
242 * channel. Note: This call uses the vmbus connection rather 242 * channel. Note: This call uses the vmbus connection rather
243 * than the channel to establish the gpadl handle. 243 * than the channel to establish the gpadl handle.
244 */ 244 */
245 ret = vmbus_establish_gpadl(device->channel, net_device->ReceiveBuffer, 245 ret = vmbus_establish_gpadl(device->channel, net_device->recv_buf,
246 net_device->ReceiveBufferSize, 246 net_device->recv_buf_size,
247 &net_device->ReceiveBufferGpadlHandle); 247 &net_device->recv_buf_gpadl_handle);
248 if (ret != 0) { 248 if (ret != 0) {
249 DPRINT_ERR(NETVSC, 249 DPRINT_ERR(NETVSC,
250 "unable to establish receive buffer's gpadl"); 250 "unable to establish receive buffer's gpadl");
@@ -256,15 +256,15 @@ static int netvsc_init_recv_buf(struct hv_device *device)
256 /* Notify the NetVsp of the gpadl handle */ 256 /* Notify the NetVsp of the gpadl handle */
257 DPRINT_INFO(NETVSC, "Sending NvspMessage1TypeSendReceiveBuffer..."); 257 DPRINT_INFO(NETVSC, "Sending NvspMessage1TypeSendReceiveBuffer...");
258 258
259 init_packet = &net_device->ChannelInitPacket; 259 init_packet = &net_device->channel_init_pkt;
260 260
261 memset(init_packet, 0, sizeof(struct nvsp_message)); 261 memset(init_packet, 0, sizeof(struct nvsp_message));
262 262
263 init_packet->Header.MessageType = NvspMessage1TypeSendReceiveBuffer; 263 init_packet->hdr.msg_type = NVSP_MSG1_TYPE_SEND_RECV_BUF;
264 init_packet->Messages.Version1Messages.SendReceiveBuffer. 264 init_packet->msg.v1_msg.send_recv_buf.
265 GpadlHandle = net_device->ReceiveBufferGpadlHandle; 265 gpadl_handle = net_device->recv_buf_gpadl_handle;
266 init_packet->Messages.Version1Messages. 266 init_packet->msg.v1_msg.
267 SendReceiveBuffer.Id = NETVSC_RECEIVE_BUFFER_ID; 267 send_recv_buf.id = NETVSC_RECEIVE_BUFFER_ID;
268 268
269 /* Send the gpadl notification request */ 269 /* Send the gpadl notification request */
270 ret = vmbus_sendpacket(device->channel, init_packet, 270 ret = vmbus_sendpacket(device->channel, init_packet,
@@ -278,15 +278,15 @@ static int netvsc_init_recv_buf(struct hv_device *device)
278 goto Cleanup; 278 goto Cleanup;
279 } 279 }
280 280
281 osd_waitevent_wait(net_device->ChannelInitEvent); 281 osd_waitevent_wait(net_device->channel_init_event);
282 282
283 /* Check the response */ 283 /* Check the response */
284 if (init_packet->Messages.Version1Messages. 284 if (init_packet->msg.v1_msg.
285 SendReceiveBufferComplete.Status != NvspStatusSuccess) { 285 send_recv_buf_complete.status != NVSP_STAT_SUCCESS) {
286 DPRINT_ERR(NETVSC, "Unable to complete receive buffer " 286 DPRINT_ERR(NETVSC, "Unable to complete receive buffer "
287 "initialzation with NetVsp - status %d", 287 "initialzation with NetVsp - status %d",
288 init_packet->Messages.Version1Messages. 288 init_packet->msg.v1_msg.
289 SendReceiveBufferComplete.Status); 289 send_recv_buf_complete.status);
290 ret = -1; 290 ret = -1;
291 goto Cleanup; 291 goto Cleanup;
292 } 292 }
@@ -295,36 +295,36 @@ static int netvsc_init_recv_buf(struct hv_device *device)
295 /* ASSERT(netDevice->ReceiveSectionCount == 0); */ 295 /* ASSERT(netDevice->ReceiveSectionCount == 0); */
296 /* ASSERT(netDevice->ReceiveSections == NULL); */ 296 /* ASSERT(netDevice->ReceiveSections == NULL); */
297 297
298 net_device->ReceiveSectionCount = init_packet->Messages. 298 net_device->recv_section_cnt = init_packet->msg.
299 Version1Messages.SendReceiveBufferComplete.NumSections; 299 v1_msg.send_recv_buf_complete.num_sections;
300 300
301 net_device->ReceiveSections = kmalloc(net_device->ReceiveSectionCount 301 net_device->recv_section = kmalloc(net_device->recv_section_cnt
302 * sizeof(struct nvsp_1_receive_buffer_section), GFP_KERNEL); 302 * sizeof(struct nvsp_1_receive_buffer_section), GFP_KERNEL);
303 if (net_device->ReceiveSections == NULL) { 303 if (net_device->recv_section == NULL) {
304 ret = -1; 304 ret = -1;
305 goto Cleanup; 305 goto Cleanup;
306 } 306 }
307 307
308 memcpy(net_device->ReceiveSections, 308 memcpy(net_device->recv_section,
309 init_packet->Messages.Version1Messages. 309 init_packet->msg.v1_msg.
310 SendReceiveBufferComplete.Sections, 310 send_recv_buf_complete.sections,
311 net_device->ReceiveSectionCount * 311 net_device->recv_section_cnt *
312 sizeof(struct nvsp_1_receive_buffer_section)); 312 sizeof(struct nvsp_1_receive_buffer_section));
313 313
314 DPRINT_INFO(NETVSC, "Receive sections info (count %d, offset %d, " 314 DPRINT_INFO(NETVSC, "Receive sections info (count %d, offset %d, "
315 "endoffset %d, suballoc size %d, num suballocs %d)", 315 "endoffset %d, suballoc size %d, num suballocs %d)",
316 net_device->ReceiveSectionCount, 316 net_device->recv_section_cnt,
317 net_device->ReceiveSections[0].Offset, 317 net_device->recv_section[0].offset,
318 net_device->ReceiveSections[0].EndOffset, 318 net_device->recv_section[0].end_offset,
319 net_device->ReceiveSections[0].SubAllocationSize, 319 net_device->recv_section[0].sub_alloc_size,
320 net_device->ReceiveSections[0].NumSubAllocations); 320 net_device->recv_section[0].num_sub_allocs);
321 321
322 /* 322 /*
323 * For 1st release, there should only be 1 section that represents the 323 * For 1st release, there should only be 1 section that represents the
324 * entire receive buffer 324 * entire receive buffer
325 */ 325 */
326 if (net_device->ReceiveSectionCount != 1 || 326 if (net_device->recv_section_cnt != 1 ||
327 net_device->ReceiveSections->Offset != 0) { 327 net_device->recv_section->offset != 0) {
328 ret = -1; 328 ret = -1;
329 goto Cleanup; 329 goto Cleanup;
330 } 330 }
@@ -351,7 +351,7 @@ static int netvsc_init_send_buf(struct hv_device *device)
351 "device being destroyed?"); 351 "device being destroyed?");
352 return -1; 352 return -1;
353 } 353 }
354 if (net_device->SendBufferSize <= 0) { 354 if (net_device->send_buf_size <= 0) {
355 ret = -EINVAL; 355 ret = -EINVAL;
356 goto Cleanup; 356 goto Cleanup;
357 } 357 }
@@ -359,11 +359,11 @@ static int netvsc_init_send_buf(struct hv_device *device)
359 /* page-size grandularity */ 359 /* page-size grandularity */
360 /* ASSERT((netDevice->SendBufferSize & (PAGE_SIZE - 1)) == 0); */ 360 /* ASSERT((netDevice->SendBufferSize & (PAGE_SIZE - 1)) == 0); */
361 361
362 net_device->SendBuffer = 362 net_device->send_buf =
363 osd_page_alloc(net_device->SendBufferSize >> PAGE_SHIFT); 363 osd_page_alloc(net_device->send_buf_size >> PAGE_SHIFT);
364 if (!net_device->SendBuffer) { 364 if (!net_device->send_buf) {
365 DPRINT_ERR(NETVSC, "unable to allocate send buffer of size %d", 365 DPRINT_ERR(NETVSC, "unable to allocate send buffer of size %d",
366 net_device->SendBufferSize); 366 net_device->send_buf_size);
367 ret = -1; 367 ret = -1;
368 goto Cleanup; 368 goto Cleanup;
369 } 369 }
@@ -377,9 +377,9 @@ static int netvsc_init_send_buf(struct hv_device *device)
377 * channel. Note: This call uses the vmbus connection rather 377 * channel. Note: This call uses the vmbus connection rather
378 * than the channel to establish the gpadl handle. 378 * than the channel to establish the gpadl handle.
379 */ 379 */
380 ret = vmbus_establish_gpadl(device->channel, net_device->SendBuffer, 380 ret = vmbus_establish_gpadl(device->channel, net_device->send_buf,
381 net_device->SendBufferSize, 381 net_device->send_buf_size,
382 &net_device->SendBufferGpadlHandle); 382 &net_device->send_buf_gpadl_handle);
383 if (ret != 0) { 383 if (ret != 0) {
384 DPRINT_ERR(NETVSC, "unable to establish send buffer's gpadl"); 384 DPRINT_ERR(NETVSC, "unable to establish send buffer's gpadl");
385 goto Cleanup; 385 goto Cleanup;
@@ -390,14 +390,14 @@ static int netvsc_init_send_buf(struct hv_device *device)
390 /* Notify the NetVsp of the gpadl handle */ 390 /* Notify the NetVsp of the gpadl handle */
391 DPRINT_INFO(NETVSC, "Sending NvspMessage1TypeSendSendBuffer..."); 391 DPRINT_INFO(NETVSC, "Sending NvspMessage1TypeSendSendBuffer...");
392 392
393 init_packet = &net_device->ChannelInitPacket; 393 init_packet = &net_device->channel_init_pkt;
394 394
395 memset(init_packet, 0, sizeof(struct nvsp_message)); 395 memset(init_packet, 0, sizeof(struct nvsp_message));
396 396
397 init_packet->Header.MessageType = NvspMessage1TypeSendSendBuffer; 397 init_packet->hdr.msg_type = NVSP_MSG1_TYPE_SEND_SEND_BUF;
398 init_packet->Messages.Version1Messages.SendReceiveBuffer. 398 init_packet->msg.v1_msg.send_recv_buf.
399 GpadlHandle = net_device->SendBufferGpadlHandle; 399 gpadl_handle = net_device->send_buf_gpadl_handle;
400 init_packet->Messages.Version1Messages.SendReceiveBuffer.Id = 400 init_packet->msg.v1_msg.send_recv_buf.id =
401 NETVSC_SEND_BUFFER_ID; 401 NETVSC_SEND_BUFFER_ID;
402 402
403 /* Send the gpadl notification request */ 403 /* Send the gpadl notification request */
@@ -412,21 +412,21 @@ static int netvsc_init_send_buf(struct hv_device *device)
412 goto Cleanup; 412 goto Cleanup;
413 } 413 }
414 414
415 osd_waitevent_wait(net_device->ChannelInitEvent); 415 osd_waitevent_wait(net_device->channel_init_event);
416 416
417 /* Check the response */ 417 /* Check the response */
418 if (init_packet->Messages.Version1Messages. 418 if (init_packet->msg.v1_msg.
419 SendSendBufferComplete.Status != NvspStatusSuccess) { 419 send_send_buf_complete.status != NVSP_STAT_SUCCESS) {
420 DPRINT_ERR(NETVSC, "Unable to complete send buffer " 420 DPRINT_ERR(NETVSC, "Unable to complete send buffer "
421 "initialzation with NetVsp - status %d", 421 "initialzation with NetVsp - status %d",
422 init_packet->Messages.Version1Messages. 422 init_packet->msg.v1_msg.
423 SendSendBufferComplete.Status); 423 send_send_buf_complete.status);
424 ret = -1; 424 ret = -1;
425 goto Cleanup; 425 goto Cleanup;
426 } 426 }
427 427
428 net_device->SendSectionSize = init_packet-> 428 net_device->send_section_size = init_packet->
429 Messages.Version1Messages.SendSendBufferComplete.SectionSize; 429 msg.v1_msg.send_send_buf_complete.section_size;
430 430
431 goto Exit; 431 goto Exit;
432 432
@@ -449,20 +449,20 @@ static int netvsc_destroy_recv_buf(struct netvsc_device *net_device)
449 * NvspMessage1TypeSendReceiveBuffer msg) therefore, we need 449 * NvspMessage1TypeSendReceiveBuffer msg) therefore, we need
450 * to send a revoke msg here 450 * to send a revoke msg here
451 */ 451 */
452 if (net_device->ReceiveSectionCount) { 452 if (net_device->recv_section_cnt) {
453 DPRINT_INFO(NETVSC, 453 DPRINT_INFO(NETVSC,
454 "Sending NvspMessage1TypeRevokeReceiveBuffer..."); 454 "Sending NvspMessage1TypeRevokeReceiveBuffer...");
455 455
456 /* Send the revoke receive buffer */ 456 /* Send the revoke receive buffer */
457 revoke_packet = &net_device->RevokePacket; 457 revoke_packet = &net_device->revoke_packet;
458 memset(revoke_packet, 0, sizeof(struct nvsp_message)); 458 memset(revoke_packet, 0, sizeof(struct nvsp_message));
459 459
460 revoke_packet->Header.MessageType = 460 revoke_packet->hdr.msg_type =
461 NvspMessage1TypeRevokeReceiveBuffer; 461 NVSP_MSG1_TYPE_REVOKE_RECV_BUF;
462 revoke_packet->Messages.Version1Messages. 462 revoke_packet->msg.v1_msg.
463 RevokeReceiveBuffer.Id = NETVSC_RECEIVE_BUFFER_ID; 463 revoke_recv_buf.id = NETVSC_RECEIVE_BUFFER_ID;
464 464
465 ret = vmbus_sendpacket(net_device->Device->channel, 465 ret = vmbus_sendpacket(net_device->dev->channel,
466 revoke_packet, 466 revoke_packet,
467 sizeof(struct nvsp_message), 467 sizeof(struct nvsp_message),
468 (unsigned long)revoke_packet, 468 (unsigned long)revoke_packet,
@@ -479,11 +479,11 @@ static int netvsc_destroy_recv_buf(struct netvsc_device *net_device)
479 } 479 }
480 480
481 /* Teardown the gpadl on the vsp end */ 481 /* Teardown the gpadl on the vsp end */
482 if (net_device->ReceiveBufferGpadlHandle) { 482 if (net_device->recv_buf_gpadl_handle) {
483 DPRINT_INFO(NETVSC, "Tearing down receive buffer's GPADL..."); 483 DPRINT_INFO(NETVSC, "Tearing down receive buffer's GPADL...");
484 484
485 ret = vmbus_teardown_gpadl(net_device->Device->channel, 485 ret = vmbus_teardown_gpadl(net_device->dev->channel,
486 net_device->ReceiveBufferGpadlHandle); 486 net_device->recv_buf_gpadl_handle);
487 487
488 /* If we failed here, we might as well return and have a leak rather than continue and a bugchk */ 488 /* If we failed here, we might as well return and have a leak rather than continue and a bugchk */
489 if (ret != 0) { 489 if (ret != 0) {
@@ -491,22 +491,22 @@ static int netvsc_destroy_recv_buf(struct netvsc_device *net_device)
491 "unable to teardown receive buffer's gpadl"); 491 "unable to teardown receive buffer's gpadl");
492 return -1; 492 return -1;
493 } 493 }
494 net_device->ReceiveBufferGpadlHandle = 0; 494 net_device->recv_buf_gpadl_handle = 0;
495 } 495 }
496 496
497 if (net_device->ReceiveBuffer) { 497 if (net_device->recv_buf) {
498 DPRINT_INFO(NETVSC, "Freeing up receive buffer..."); 498 DPRINT_INFO(NETVSC, "Freeing up receive buffer...");
499 499
500 /* Free up the receive buffer */ 500 /* Free up the receive buffer */
501 osd_page_free(net_device->ReceiveBuffer, 501 osd_page_free(net_device->recv_buf,
502 net_device->ReceiveBufferSize >> PAGE_SHIFT); 502 net_device->recv_buf_size >> PAGE_SHIFT);
503 net_device->ReceiveBuffer = NULL; 503 net_device->recv_buf = NULL;
504 } 504 }
505 505
506 if (net_device->ReceiveSections) { 506 if (net_device->recv_section) {
507 net_device->ReceiveSectionCount = 0; 507 net_device->recv_section_cnt = 0;
508 kfree(net_device->ReceiveSections); 508 kfree(net_device->recv_section);
509 net_device->ReceiveSections = NULL; 509 net_device->recv_section = NULL;
510 } 510 }
511 511
512 return ret; 512 return ret;
@@ -523,20 +523,20 @@ static int netvsc_destroy_send_buf(struct netvsc_device *net_device)
523 * NvspMessage1TypeSendReceiveBuffer msg) therefore, we need 523 * NvspMessage1TypeSendReceiveBuffer msg) therefore, we need
524 * to send a revoke msg here 524 * to send a revoke msg here
525 */ 525 */
526 if (net_device->SendSectionSize) { 526 if (net_device->send_section_size) {
527 DPRINT_INFO(NETVSC, 527 DPRINT_INFO(NETVSC,
528 "Sending NvspMessage1TypeRevokeSendBuffer..."); 528 "Sending NvspMessage1TypeRevokeSendBuffer...");
529 529
530 /* Send the revoke send buffer */ 530 /* Send the revoke send buffer */
531 revoke_packet = &net_device->RevokePacket; 531 revoke_packet = &net_device->revoke_packet;
532 memset(revoke_packet, 0, sizeof(struct nvsp_message)); 532 memset(revoke_packet, 0, sizeof(struct nvsp_message));
533 533
534 revoke_packet->Header.MessageType = 534 revoke_packet->hdr.msg_type =
535 NvspMessage1TypeRevokeSendBuffer; 535 NVSP_MSG1_TYPE_REVOKE_SEND_BUF;
536 revoke_packet->Messages.Version1Messages. 536 revoke_packet->msg.v1_msg.
537 RevokeSendBuffer.Id = NETVSC_SEND_BUFFER_ID; 537 revoke_send_buf.id = NETVSC_SEND_BUFFER_ID;
538 538
539 ret = vmbus_sendpacket(net_device->Device->channel, 539 ret = vmbus_sendpacket(net_device->dev->channel,
540 revoke_packet, 540 revoke_packet,
541 sizeof(struct nvsp_message), 541 sizeof(struct nvsp_message),
542 (unsigned long)revoke_packet, 542 (unsigned long)revoke_packet,
@@ -553,10 +553,10 @@ static int netvsc_destroy_send_buf(struct netvsc_device *net_device)
553 } 553 }
554 554
555 /* Teardown the gpadl on the vsp end */ 555 /* Teardown the gpadl on the vsp end */
556 if (net_device->SendBufferGpadlHandle) { 556 if (net_device->send_buf_gpadl_handle) {
557 DPRINT_INFO(NETVSC, "Tearing down send buffer's GPADL..."); 557 DPRINT_INFO(NETVSC, "Tearing down send buffer's GPADL...");
558 ret = vmbus_teardown_gpadl(net_device->Device->channel, 558 ret = vmbus_teardown_gpadl(net_device->dev->channel,
559 net_device->SendBufferGpadlHandle); 559 net_device->send_buf_gpadl_handle);
560 560
561 /* 561 /*
562 * If we failed here, we might as well return and have a leak 562 * If we failed here, we might as well return and have a leak
@@ -567,16 +567,16 @@ static int netvsc_destroy_send_buf(struct netvsc_device *net_device)
567 "gpadl"); 567 "gpadl");
568 return -1; 568 return -1;
569 } 569 }
570 net_device->SendBufferGpadlHandle = 0; 570 net_device->send_buf_gpadl_handle = 0;
571 } 571 }
572 572
573 if (net_device->SendBuffer) { 573 if (net_device->send_buf) {
574 DPRINT_INFO(NETVSC, "Freeing up send buffer..."); 574 DPRINT_INFO(NETVSC, "Freeing up send buffer...");
575 575
576 /* Free up the receive buffer */ 576 /* Free up the receive buffer */
577 osd_page_free(net_device->SendBuffer, 577 osd_page_free(net_device->send_buf,
578 net_device->SendBufferSize >> PAGE_SHIFT); 578 net_device->send_buf_size >> PAGE_SHIFT);
579 net_device->SendBuffer = NULL; 579 net_device->send_buf = NULL;
580 } 580 }
581 581
582 return ret; 582 return ret;
@@ -597,13 +597,13 @@ static int netvsc_connect_vsp(struct hv_device *device)
597 return -1; 597 return -1;
598 } 598 }
599 599
600 init_packet = &net_device->ChannelInitPacket; 600 init_packet = &net_device->channel_init_pkt;
601 601
602 memset(init_packet, 0, sizeof(struct nvsp_message)); 602 memset(init_packet, 0, sizeof(struct nvsp_message));
603 init_packet->Header.MessageType = NvspMessageTypeInit; 603 init_packet->hdr.msg_type = NVSP_MSG_TYPE_INIT;
604 init_packet->Messages.InitMessages.Init.MinProtocolVersion = 604 init_packet->msg.init_msg.init.min_protocol_ver =
605 NVSP_MIN_PROTOCOL_VERSION; 605 NVSP_MIN_PROTOCOL_VERSION;
606 init_packet->Messages.InitMessages.Init.MaxProtocolVersion = 606 init_packet->msg.init_msg.init.max_protocol_ver =
607 NVSP_MAX_PROTOCOL_VERSION; 607 NVSP_MAX_PROTOCOL_VERSION;
608 608
609 DPRINT_INFO(NETVSC, "Sending NvspMessageTypeInit..."); 609 DPRINT_INFO(NETVSC, "Sending NvspMessageTypeInit...");
@@ -620,30 +620,30 @@ static int netvsc_connect_vsp(struct hv_device *device)
620 goto Cleanup; 620 goto Cleanup;
621 } 621 }
622 622
623 osd_waitevent_wait(net_device->ChannelInitEvent); 623 osd_waitevent_wait(net_device->channel_init_event);
624 624
625 /* Now, check the response */ 625 /* Now, check the response */
626 /* ASSERT(initPacket->Messages.InitMessages.InitComplete.MaximumMdlChainLength <= MAX_MULTIPAGE_BUFFER_COUNT); */ 626 /* ASSERT(initPacket->Messages.InitMessages.InitComplete.MaximumMdlChainLength <= MAX_MULTIPAGE_BUFFER_COUNT); */
627 DPRINT_INFO(NETVSC, "NvspMessageTypeInit status(%d) max mdl chain (%d)", 627 DPRINT_INFO(NETVSC, "NvspMessageTypeInit status(%d) max mdl chain (%d)",
628 init_packet->Messages.InitMessages.InitComplete.Status, 628 init_packet->msg.init_msg.init_complete.status,
629 init_packet->Messages.InitMessages. 629 init_packet->msg.init_msg.
630 InitComplete.MaximumMdlChainLength); 630 init_complete.max_mdl_chain_len);
631 631
632 if (init_packet->Messages.InitMessages.InitComplete.Status != 632 if (init_packet->msg.init_msg.init_complete.status !=
633 NvspStatusSuccess) { 633 NVSP_STAT_SUCCESS) {
634 DPRINT_ERR(NETVSC, 634 DPRINT_ERR(NETVSC,
635 "unable to initialize with netvsp (status 0x%x)", 635 "unable to initialize with netvsp (status 0x%x)",
636 init_packet->Messages.InitMessages.InitComplete.Status); 636 init_packet->msg.init_msg.init_complete.status);
637 ret = -1; 637 ret = -1;
638 goto Cleanup; 638 goto Cleanup;
639 } 639 }
640 640
641 if (init_packet->Messages.InitMessages.InitComplete. 641 if (init_packet->msg.init_msg.init_complete.
642 NegotiatedProtocolVersion != NVSP_PROTOCOL_VERSION_1) { 642 negotiated_protocol_ver != NVSP_PROTOCOL_VERSION_1) {
643 DPRINT_ERR(NETVSC, "unable to initialize with netvsp " 643 DPRINT_ERR(NETVSC, "unable to initialize with netvsp "
644 "(version expected 1 got %d)", 644 "(version expected 1 got %d)",
645 init_packet->Messages.InitMessages. 645 init_packet->msg.init_msg.
646 InitComplete.NegotiatedProtocolVersion); 646 init_complete.negotiated_protocol_ver);
647 ret = -1; 647 ret = -1;
648 goto Cleanup; 648 goto Cleanup;
649 } 649 }
@@ -654,12 +654,12 @@ static int netvsc_connect_vsp(struct hv_device *device)
654 654
655 ndis_version = 0x00050000; 655 ndis_version = 0x00050000;
656 656
657 init_packet->Header.MessageType = NvspMessage1TypeSendNdisVersion; 657 init_packet->hdr.msg_type = NVSP_MSG1_TYPE_SEND_NDIS_VER;
658 init_packet->Messages.Version1Messages. 658 init_packet->msg.v1_msg.
659 SendNdisVersion.NdisMajorVersion = 659 send_ndis_ver.ndis_major_ver =
660 (ndis_version & 0xFFFF0000) >> 16; 660 (ndis_version & 0xFFFF0000) >> 16;
661 init_packet->Messages.Version1Messages. 661 init_packet->msg.v1_msg.
662 SendNdisVersion.NdisMinorVersion = 662 send_ndis_ver.ndis_minor_ver =
663 ndis_version & 0xFFFF; 663 ndis_version & 0xFFFF;
664 664
665 /* Send the init request */ 665 /* Send the init request */
@@ -719,12 +719,12 @@ static int netvsc_device_add(struct hv_device *device, void *additional_info)
719 DPRINT_DBG(NETVSC, "netvsc channel object allocated - %p", net_device); 719 DPRINT_DBG(NETVSC, "netvsc channel object allocated - %p", net_device);
720 720
721 /* Initialize the NetVSC channel extension */ 721 /* Initialize the NetVSC channel extension */
722 net_device->ReceiveBufferSize = NETVSC_RECEIVE_BUFFER_SIZE; 722 net_device->recv_buf_size = NETVSC_RECEIVE_BUFFER_SIZE;
723 spin_lock_init(&net_device->receive_packet_list_lock); 723 spin_lock_init(&net_device->recv_pkt_list_lock);
724 724
725 net_device->SendBufferSize = NETVSC_SEND_BUFFER_SIZE; 725 net_device->send_buf_size = NETVSC_SEND_BUFFER_SIZE;
726 726
727 INIT_LIST_HEAD(&net_device->ReceivePacketList); 727 INIT_LIST_HEAD(&net_device->recv_pkt_list);
728 728
729 for (i = 0; i < NETVSC_RECEIVE_PACKETLIST_COUNT; i++) { 729 for (i = 0; i < NETVSC_RECEIVE_PACKETLIST_COUNT; i++) {
730 packet = kzalloc(sizeof(struct hv_netvsc_packet) + 730 packet = kzalloc(sizeof(struct hv_netvsc_packet) +
@@ -737,10 +737,10 @@ static int netvsc_device_add(struct hv_device *device, void *additional_info)
737 break; 737 break;
738 } 738 }
739 list_add_tail(&packet->list_ent, 739 list_add_tail(&packet->list_ent,
740 &net_device->ReceivePacketList); 740 &net_device->recv_pkt_list);
741 } 741 }
742 net_device->ChannelInitEvent = osd_waitevent_create(); 742 net_device->channel_init_event = osd_waitevent_create();
743 if (!net_device->ChannelInitEvent) { 743 if (!net_device->channel_init_event) {
744 ret = -ENOMEM; 744 ret = -ENOMEM;
745 goto Cleanup; 745 goto Cleanup;
746 } 746 }
@@ -779,10 +779,10 @@ close:
779Cleanup: 779Cleanup:
780 780
781 if (net_device) { 781 if (net_device) {
782 kfree(net_device->ChannelInitEvent); 782 kfree(net_device->channel_init_event);
783 783
784 list_for_each_entry_safe(packet, pos, 784 list_for_each_entry_safe(packet, pos,
785 &net_device->ReceivePacketList, 785 &net_device->recv_pkt_list,
786 list_ent) { 786 list_ent) {
787 list_del(&packet->list_ent); 787 list_del(&packet->list_ent);
788 kfree(packet); 788 kfree(packet);
@@ -816,9 +816,9 @@ static int netvsc_device_remove(struct hv_device *device)
816 } 816 }
817 817
818 /* Wait for all send completions */ 818 /* Wait for all send completions */
819 while (atomic_read(&net_device->NumOutstandingSends)) { 819 while (atomic_read(&net_device->num_outstanding_sends)) {
820 DPRINT_INFO(NETVSC, "waiting for %d requests to complete...", 820 DPRINT_INFO(NETVSC, "waiting for %d requests to complete...",
821 atomic_read(&net_device->NumOutstandingSends)); 821 atomic_read(&net_device->num_outstanding_sends));
822 udelay(100); 822 udelay(100);
823 } 823 }
824 824
@@ -840,12 +840,12 @@ static int netvsc_device_remove(struct hv_device *device)
840 840
841 /* Release all resources */ 841 /* Release all resources */
842 list_for_each_entry_safe(netvsc_packet, pos, 842 list_for_each_entry_safe(netvsc_packet, pos,
843 &net_device->ReceivePacketList, list_ent) { 843 &net_device->recv_pkt_list, list_ent) {
844 list_del(&netvsc_packet->list_ent); 844 list_del(&netvsc_packet->list_ent);
845 kfree(netvsc_packet); 845 kfree(netvsc_packet);
846 } 846 }
847 847
848 kfree(net_device->ChannelInitEvent); 848 kfree(net_device->channel_init_event);
849 free_net_device(net_device); 849 free_net_device(net_device);
850 return 0; 850 return 0;
851} 851}
@@ -875,19 +875,19 @@ static void netvsc_send_completion(struct hv_device *device,
875 (packet->DataOffset8 << 3)); 875 (packet->DataOffset8 << 3));
876 876
877 DPRINT_DBG(NETVSC, "send completion packet - type %d", 877 DPRINT_DBG(NETVSC, "send completion packet - type %d",
878 nvsp_packet->Header.MessageType); 878 nvsp_packet->hdr.msg_type);
879 879
880 if ((nvsp_packet->Header.MessageType == NvspMessageTypeInitComplete) || 880 if ((nvsp_packet->hdr.msg_type == NVSP_MSG_TYPE_INIT_COMPLETE) ||
881 (nvsp_packet->Header.MessageType == 881 (nvsp_packet->hdr.msg_type ==
882 NvspMessage1TypeSendReceiveBufferComplete) || 882 NVSP_MSG1_TYPE_SEND_RECV_BUF_COMPLETE) ||
883 (nvsp_packet->Header.MessageType == 883 (nvsp_packet->hdr.msg_type ==
884 NvspMessage1TypeSendSendBufferComplete)) { 884 NVSP_MSG1_TYPE_SEND_SEND_BUF_COMPLETE)) {
885 /* Copy the response back */ 885 /* Copy the response back */
886 memcpy(&net_device->ChannelInitPacket, nvsp_packet, 886 memcpy(&net_device->channel_init_pkt, nvsp_packet,
887 sizeof(struct nvsp_message)); 887 sizeof(struct nvsp_message));
888 osd_waitevent_set(net_device->ChannelInitEvent); 888 osd_waitevent_set(net_device->channel_init_event);
889 } else if (nvsp_packet->Header.MessageType == 889 } else if (nvsp_packet->hdr.msg_type ==
890 NvspMessage1TypeSendRNDISPacketComplete) { 890 NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE) {
891 /* Get the send context */ 891 /* Get the send context */
892 nvsc_packet = (struct hv_netvsc_packet *)(unsigned long) 892 nvsc_packet = (struct hv_netvsc_packet *)(unsigned long)
893 packet->TransactionId; 893 packet->TransactionId;
@@ -897,10 +897,10 @@ static void netvsc_send_completion(struct hv_device *device,
897 nvsc_packet->completion.send.send_completion( 897 nvsc_packet->completion.send.send_completion(
898 nvsc_packet->completion.send.send_completion_ctx); 898 nvsc_packet->completion.send.send_completion_ctx);
899 899
900 atomic_dec(&net_device->NumOutstandingSends); 900 atomic_dec(&net_device->num_outstanding_sends);
901 } else { 901 } else {
902 DPRINT_ERR(NETVSC, "Unknown send completion packet type - " 902 DPRINT_ERR(NETVSC, "Unknown send completion packet type - "
903 "%d received!!", nvsp_packet->Header.MessageType); 903 "%d received!!", nvsp_packet->hdr.msg_type);
904 } 904 }
905 905
906 put_net_device(device); 906 put_net_device(device);
@@ -921,18 +921,19 @@ static int netvsc_send(struct hv_device *device,
921 return -2; 921 return -2;
922 } 922 }
923 923
924 sendMessage.Header.MessageType = NvspMessage1TypeSendRNDISPacket; 924 sendMessage.hdr.msg_type = NVSP_MSG1_TYPE_SEND_RNDIS_PKT;
925 if (packet->is_data_pkt) { 925 if (packet->is_data_pkt) {
926 /* 0 is RMC_DATA; */ 926 /* 0 is RMC_DATA; */
927 sendMessage.Messages.Version1Messages.SendRNDISPacket.ChannelType = 0; 927 sendMessage.msg.v1_msg.send_rndis_pkt.channel_type = 0;
928 } else { 928 } else {
929 /* 1 is RMC_CONTROL; */ 929 /* 1 is RMC_CONTROL; */
930 sendMessage.Messages.Version1Messages.SendRNDISPacket.ChannelType = 1; 930 sendMessage.msg.v1_msg.send_rndis_pkt.channel_type = 1;
931 } 931 }
932 932
933 /* Not using send buffer section */ 933 /* Not using send buffer section */
934 sendMessage.Messages.Version1Messages.SendRNDISPacket.SendBufferSectionIndex = 0xFFFFFFFF; 934 sendMessage.msg.v1_msg.send_rndis_pkt.send_buf_section_index =
935 sendMessage.Messages.Version1Messages.SendRNDISPacket.SendBufferSectionSize = 0; 935 0xFFFFFFFF;
936 sendMessage.msg.v1_msg.send_rndis_pkt.send_buf_section_size = 0;
936 937
937 if (packet->page_buf_cnt) { 938 if (packet->page_buf_cnt) {
938 ret = vmbus_sendpacket_pagebuffer(device->channel, 939 ret = vmbus_sendpacket_pagebuffer(device->channel,
@@ -954,7 +955,7 @@ static int netvsc_send(struct hv_device *device,
954 DPRINT_ERR(NETVSC, "Unable to send packet %p ret %d", 955 DPRINT_ERR(NETVSC, "Unable to send packet %p ret %d",
955 packet, ret); 956 packet, ret);
956 957
957 atomic_inc(&net_device->NumOutstandingSends); 958 atomic_inc(&net_device->num_outstanding_sends);
958 put_net_device(device); 959 put_net_device(device);
959 return ret; 960 return ret;
960} 961}
@@ -997,16 +998,16 @@ static void netvsc_receive(struct hv_device *device,
997 (packet->DataOffset8 << 3)); 998 (packet->DataOffset8 << 3));
998 999
999 /* Make sure this is a valid nvsp packet */ 1000 /* Make sure this is a valid nvsp packet */
1000 if (nvsp_packet->Header.MessageType != 1001 if (nvsp_packet->hdr.msg_type !=
1001 NvspMessage1TypeSendRNDISPacket) { 1002 NVSP_MSG1_TYPE_SEND_RNDIS_PKT) {
1002 DPRINT_ERR(NETVSC, "Unknown nvsp packet type received - %d", 1003 DPRINT_ERR(NETVSC, "Unknown nvsp packet type received - %d",
1003 nvsp_packet->Header.MessageType); 1004 nvsp_packet->hdr.msg_type);
1004 put_net_device(device); 1005 put_net_device(device);
1005 return; 1006 return;
1006 } 1007 }
1007 1008
1008 DPRINT_DBG(NETVSC, "NVSP packet received - type %d", 1009 DPRINT_DBG(NETVSC, "NVSP packet received - type %d",
1009 nvsp_packet->Header.MessageType); 1010 nvsp_packet->hdr.msg_type);
1010 1011
1011 vmxferpage_packet = (struct vmtransfer_page_packet_header *)packet; 1012 vmxferpage_packet = (struct vmtransfer_page_packet_header *)packet;
1012 1013
@@ -1027,13 +1028,13 @@ static void netvsc_receive(struct hv_device *device,
1027 * We grab it here so that we know exactly how many we can 1028 * We grab it here so that we know exactly how many we can
1028 * fulfil 1029 * fulfil
1029 */ 1030 */
1030 spin_lock_irqsave(&net_device->receive_packet_list_lock, flags); 1031 spin_lock_irqsave(&net_device->recv_pkt_list_lock, flags);
1031 while (!list_empty(&net_device->ReceivePacketList)) { 1032 while (!list_empty(&net_device->recv_pkt_list)) {
1032 list_move_tail(net_device->ReceivePacketList.next, &listHead); 1033 list_move_tail(net_device->recv_pkt_list.next, &listHead);
1033 if (++count == vmxferpage_packet->RangeCount + 1) 1034 if (++count == vmxferpage_packet->RangeCount + 1)
1034 break; 1035 break;
1035 } 1036 }
1036 spin_unlock_irqrestore(&net_device->receive_packet_list_lock, flags); 1037 spin_unlock_irqrestore(&net_device->recv_pkt_list_lock, flags);
1037 1038
1038 /* 1039 /*
1039 * We need at least 2 netvsc pkts (1 to represent the xfer 1040 * We need at least 2 netvsc pkts (1 to represent the xfer
@@ -1046,12 +1047,12 @@ static void netvsc_receive(struct hv_device *device,
1046 count, vmxferpage_packet->RangeCount + 1); 1047 count, vmxferpage_packet->RangeCount + 1);
1047 1048
1048 /* Return it to the freelist */ 1049 /* Return it to the freelist */
1049 spin_lock_irqsave(&net_device->receive_packet_list_lock, flags); 1050 spin_lock_irqsave(&net_device->recv_pkt_list_lock, flags);
1050 for (i = count; i != 0; i--) { 1051 for (i = count; i != 0; i--) {
1051 list_move_tail(listHead.next, 1052 list_move_tail(listHead.next,
1052 &net_device->ReceivePacketList); 1053 &net_device->recv_pkt_list);
1053 } 1054 }
1054 spin_unlock_irqrestore(&net_device->receive_packet_list_lock, 1055 spin_unlock_irqrestore(&net_device->recv_pkt_list_lock,
1055 flags); 1056 flags);
1056 1057
1057 netvsc_send_recv_completion(device, 1058 netvsc_send_recv_completion(device,
@@ -1104,10 +1105,10 @@ static void netvsc_receive(struct hv_device *device,
1104 vmxferpage_packet->Ranges[i].ByteCount; 1105 vmxferpage_packet->Ranges[i].ByteCount;
1105 1106
1106 start = virt_to_phys((void *)((unsigned long)net_device-> 1107 start = virt_to_phys((void *)((unsigned long)net_device->
1107 ReceiveBuffer + vmxferpage_packet->Ranges[i].ByteOffset)); 1108 recv_buf + vmxferpage_packet->Ranges[i].ByteOffset));
1108 1109
1109 netvsc_packet->page_buf[0].Pfn = start >> PAGE_SHIFT; 1110 netvsc_packet->page_buf[0].Pfn = start >> PAGE_SHIFT;
1110 end_virtual = (unsigned long)net_device->ReceiveBuffer 1111 end_virtual = (unsigned long)net_device->recv_buf
1111 + vmxferpage_packet->Ranges[i].ByteOffset 1112 + vmxferpage_packet->Ranges[i].ByteOffset
1112 + vmxferpage_packet->Ranges[i].ByteCount - 1; 1113 + vmxferpage_packet->Ranges[i].ByteCount - 1;
1113 end = virt_to_phys((void *)end_virtual); 1114 end = virt_to_phys((void *)end_virtual);
@@ -1175,11 +1176,12 @@ static void netvsc_send_recv_completion(struct hv_device *device,
1175 DPRINT_DBG(NETVSC, "Sending receive completion pkt - %llx", 1176 DPRINT_DBG(NETVSC, "Sending receive completion pkt - %llx",
1176 transaction_id); 1177 transaction_id);
1177 1178
1178 recvcompMessage.Header.MessageType = 1179 recvcompMessage.hdr.msg_type =
1179 NvspMessage1TypeSendRNDISPacketComplete; 1180 NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE;
1180 1181
1181 /* FIXME: Pass in the status */ 1182 /* FIXME: Pass in the status */
1182 recvcompMessage.Messages.Version1Messages.SendRNDISPacketComplete.Status = NvspStatusSuccess; 1183 recvcompMessage.msg.v1_msg.send_rndis_pkt_complete.status =
1184 NVSP_STAT_SUCCESS;
1183 1185
1184retry_send_cmplt: 1186retry_send_cmplt:
1185 /* Send the completion */ 1187 /* Send the completion */
@@ -1234,7 +1236,7 @@ static void netvsc_receive_completion(void *context)
1234 } 1236 }
1235 1237
1236 /* Overloading use of the lock. */ 1238 /* Overloading use of the lock. */
1237 spin_lock_irqsave(&net_device->receive_packet_list_lock, flags); 1239 spin_lock_irqsave(&net_device->recv_pkt_list_lock, flags);
1238 1240
1239 /* ASSERT(packet->XferPagePacket->Count > 0); */ 1241 /* ASSERT(packet->XferPagePacket->Count > 0); */
1240 packet->xfer_page_pkt->count--; 1242 packet->xfer_page_pkt->count--;
@@ -1247,13 +1249,13 @@ static void netvsc_receive_completion(void *context)
1247 fsend_receive_comp = true; 1249 fsend_receive_comp = true;
1248 transaction_id = packet->completion.recv.recv_completion_tid; 1250 transaction_id = packet->completion.recv.recv_completion_tid;
1249 list_add_tail(&packet->xfer_page_pkt->list_ent, 1251 list_add_tail(&packet->xfer_page_pkt->list_ent,
1250 &net_device->ReceivePacketList); 1252 &net_device->recv_pkt_list);
1251 1253
1252 } 1254 }
1253 1255
1254 /* Put the packet back */ 1256 /* Put the packet back */
1255 list_add_tail(&packet->list_ent, &net_device->ReceivePacketList); 1257 list_add_tail(&packet->list_ent, &net_device->recv_pkt_list);
1256 spin_unlock_irqrestore(&net_device->receive_packet_list_lock, flags); 1258 spin_unlock_irqrestore(&net_device->recv_pkt_list_lock, flags);
1257 1259
1258 /* Send a receive completion for the xfer page packet */ 1260 /* Send a receive completion for the xfer page packet */
1259 if (fsend_receive_comp) 1261 if (fsend_receive_comp)
diff --git a/drivers/staging/hv/netvsc.h b/drivers/staging/hv/netvsc.h
index c71dce5b3f7c..932a77ccdc04 100644
--- a/drivers/staging/hv/netvsc.h
+++ b/drivers/staging/hv/netvsc.h
@@ -38,48 +38,48 @@
38#define NVSP_MAX_PROTOCOL_VERSION NVSP_PROTOCOL_VERSION_1 38#define NVSP_MAX_PROTOCOL_VERSION NVSP_PROTOCOL_VERSION_1
39 39
40enum { 40enum {
41 NvspMessageTypeNone = 0, 41 NVSP_MSG_TYPE_NONE = 0,
42 42
43 /* Init Messages */ 43 /* Init Messages */
44 NvspMessageTypeInit = 1, 44 NVSP_MSG_TYPE_INIT = 1,
45 NvspMessageTypeInitComplete = 2, 45 NVSP_MSG_TYPE_INIT_COMPLETE = 2,
46 46
47 NvspVersionMessageStart = 100, 47 NVSP_VERSION_MSG_START = 100,
48 48
49 /* Version 1 Messages */ 49 /* Version 1 Messages */
50 NvspMessage1TypeSendNdisVersion = NvspVersionMessageStart, 50 NVSP_MSG1_TYPE_SEND_NDIS_VER = NVSP_VERSION_MSG_START,
51 51
52 NvspMessage1TypeSendReceiveBuffer, 52 NVSP_MSG1_TYPE_SEND_RECV_BUF,
53 NvspMessage1TypeSendReceiveBufferComplete, 53 NVSP_MSG1_TYPE_SEND_RECV_BUF_COMPLETE,
54 NvspMessage1TypeRevokeReceiveBuffer, 54 NVSP_MSG1_TYPE_REVOKE_RECV_BUF,
55 55
56 NvspMessage1TypeSendSendBuffer, 56 NVSP_MSG1_TYPE_SEND_SEND_BUF,
57 NvspMessage1TypeSendSendBufferComplete, 57 NVSP_MSG1_TYPE_SEND_SEND_BUF_COMPLETE,
58 NvspMessage1TypeRevokeSendBuffer, 58 NVSP_MSG1_TYPE_REVOKE_SEND_BUF,
59 59
60 NvspMessage1TypeSendRNDISPacket, 60 NVSP_MSG1_TYPE_SEND_RNDIS_PKT,
61 NvspMessage1TypeSendRNDISPacketComplete, 61 NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE,
62 62
63 /* 63 /*
64 * This should be set to the number of messages for the version with 64 * This should be set to the number of messages for the version with
65 * the maximum number of messages. 65 * the maximum number of messages.
66 */ 66 */
67 NvspNumMessagePerVersion = 9, 67 NVSP_NUM_MSG_PER_VERSION = 9,
68}; 68};
69 69
70enum { 70enum {
71 NvspStatusNone = 0, 71 NVSP_STAT_NONE = 0,
72 NvspStatusSuccess, 72 NVSP_STAT_SUCCESS,
73 NvspStatusFailure, 73 NVSP_STAT_FAIL,
74 NvspStatusProtocolVersionRangeTooNew, 74 NVSP_STAT_PROTOCOL_TOO_NEW,
75 NvspStatusProtocolVersionRangeTooOld, 75 NVSP_STAT_PROTOCOL_TOO_OLD,
76 NvspStatusInvalidRndisPacket, 76 NVSP_STAT_INVALID_RNDIS_PKT,
77 NvspStatusBusy, 77 NVSP_STAT_BUSY,
78 NvspStatusMax, 78 NVSP_STAT_MAX,
79}; 79};
80 80
81struct nvsp_message_header { 81struct nvsp_message_header {
82 u32 MessageType; 82 u32 msg_type;
83}; 83};
84 84
85/* Init Messages */ 85/* Init Messages */
@@ -90,8 +90,8 @@ struct nvsp_message_header {
90 * versioning (i.e. this message will be the same for ever). 90 * versioning (i.e. this message will be the same for ever).
91 */ 91 */
92struct nvsp_message_init { 92struct nvsp_message_init {
93 u32 MinProtocolVersion; 93 u32 min_protocol_ver;
94 u32 MaxProtocolVersion; 94 u32 max_protocol_ver;
95} __attribute__((packed)); 95} __attribute__((packed));
96 96
97/* 97/*
@@ -100,14 +100,14 @@ struct nvsp_message_init {
100 * (i.e. this message will be the same for ever). 100 * (i.e. this message will be the same for ever).
101 */ 101 */
102struct nvsp_message_init_complete { 102struct nvsp_message_init_complete {
103 u32 NegotiatedProtocolVersion; 103 u32 negotiated_protocol_ver;
104 u32 MaximumMdlChainLength; 104 u32 max_mdl_chain_len;
105 u32 Status; 105 u32 status;
106} __attribute__((packed)); 106} __attribute__((packed));
107 107
108union nvsp_message_init_uber { 108union nvsp_message_init_uber {
109 struct nvsp_message_init Init; 109 struct nvsp_message_init init;
110 struct nvsp_message_init_complete InitComplete; 110 struct nvsp_message_init_complete init_complete;
111} __attribute__((packed)); 111} __attribute__((packed));
112 112
113/* Version 1 Messages */ 113/* Version 1 Messages */
@@ -117,8 +117,8 @@ union nvsp_message_init_uber {
117 * can use this information when handling OIDs sent by the VSC. 117 * can use this information when handling OIDs sent by the VSC.
118 */ 118 */
119struct nvsp_1_message_send_ndis_version { 119struct nvsp_1_message_send_ndis_version {
120 u32 NdisMajorVersion; 120 u32 ndis_major_ver;
121 u32 NdisMinorVersion; 121 u32 ndis_minor_ver;
122} __attribute__((packed)); 122} __attribute__((packed));
123 123
124/* 124/*
@@ -126,15 +126,15 @@ struct nvsp_1_message_send_ndis_version {
126 * can then use the receive buffer to send data to the VSC. 126 * can then use the receive buffer to send data to the VSC.
127 */ 127 */
128struct nvsp_1_message_send_receive_buffer { 128struct nvsp_1_message_send_receive_buffer {
129 u32 GpadlHandle; 129 u32 gpadl_handle;
130 u16 Id; 130 u16 id;
131} __attribute__((packed)); 131} __attribute__((packed));
132 132
133struct nvsp_1_receive_buffer_section { 133struct nvsp_1_receive_buffer_section {
134 u32 Offset; 134 u32 offset;
135 u32 SubAllocationSize; 135 u32 sub_alloc_size;
136 u32 NumSubAllocations; 136 u32 num_sub_allocs;
137 u32 EndOffset; 137 u32 end_offset;
138} __attribute__((packed)); 138} __attribute__((packed));
139 139
140/* 140/*
@@ -143,8 +143,8 @@ struct nvsp_1_receive_buffer_section {
143 * buffer. 143 * buffer.
144 */ 144 */
145struct nvsp_1_message_send_receive_buffer_complete { 145struct nvsp_1_message_send_receive_buffer_complete {
146 u32 Status; 146 u32 status;
147 u32 NumSections; 147 u32 num_sections;
148 148
149 /* 149 /*
150 * The receive buffer is split into two parts, a large suballocation 150 * The receive buffer is split into two parts, a large suballocation
@@ -165,7 +165,7 @@ struct nvsp_1_message_send_receive_buffer_complete {
165 * LargeOffset SmallOffset 165 * LargeOffset SmallOffset
166 */ 166 */
167 167
168 struct nvsp_1_receive_buffer_section Sections[1]; 168 struct nvsp_1_receive_buffer_section sections[1];
169} __attribute__((packed)); 169} __attribute__((packed));
170 170
171/* 171/*
@@ -174,7 +174,7 @@ struct nvsp_1_message_send_receive_buffer_complete {
174 * again. 174 * again.
175 */ 175 */
176struct nvsp_1_message_revoke_receive_buffer { 176struct nvsp_1_message_revoke_receive_buffer {
177 u16 Id; 177 u16 id;
178}; 178};
179 179
180/* 180/*
@@ -182,8 +182,8 @@ struct nvsp_1_message_revoke_receive_buffer {
182 * can then use the send buffer to send data to the VSP. 182 * can then use the send buffer to send data to the VSP.
183 */ 183 */
184struct nvsp_1_message_send_send_buffer { 184struct nvsp_1_message_send_send_buffer {
185 u32 GpadlHandle; 185 u32 gpadl_handle;
186 u16 Id; 186 u16 id;
187} __attribute__((packed)); 187} __attribute__((packed));
188 188
189/* 189/*
@@ -192,7 +192,7 @@ struct nvsp_1_message_send_send_buffer {
192 * buffer. 192 * buffer.
193 */ 193 */
194struct nvsp_1_message_send_send_buffer_complete { 194struct nvsp_1_message_send_send_buffer_complete {
195 u32 Status; 195 u32 status;
196 196
197 /* 197 /*
198 * The VSC gets to choose the size of the send buffer and the VSP gets 198 * The VSC gets to choose the size of the send buffer and the VSP gets
@@ -200,7 +200,7 @@ struct nvsp_1_message_send_send_buffer_complete {
200 * dynamic reconfigurations when the cost of GPA-direct buffers 200 * dynamic reconfigurations when the cost of GPA-direct buffers
201 * decreases. 201 * decreases.
202 */ 202 */
203 u32 SectionSize; 203 u32 section_size;
204} __attribute__((packed)); 204} __attribute__((packed));
205 205
206/* 206/*
@@ -208,7 +208,7 @@ struct nvsp_1_message_send_send_buffer_complete {
208 * completes this transaction, the vsp should never use the send buffer again. 208 * completes this transaction, the vsp should never use the send buffer again.
209 */ 209 */
210struct nvsp_1_message_revoke_send_buffer { 210struct nvsp_1_message_revoke_send_buffer {
211 u16 Id; 211 u16 id;
212}; 212};
213 213
214/* 214/*
@@ -221,7 +221,7 @@ struct nvsp_1_message_send_rndis_packet {
221 * channels of communication. However, the Network VSP only has one. 221 * channels of communication. However, the Network VSP only has one.
222 * Therefore, the channel travels with the RNDIS packet. 222 * Therefore, the channel travels with the RNDIS packet.
223 */ 223 */
224 u32 ChannelType; 224 u32 channel_type;
225 225
226 /* 226 /*
227 * This field is used to send part or all of the data through a send 227 * This field is used to send part or all of the data through a send
@@ -229,8 +229,8 @@ struct nvsp_1_message_send_rndis_packet {
229 * index is 0xFFFFFFFF, then the send buffer is not being used and all 229 * index is 0xFFFFFFFF, then the send buffer is not being used and all
230 * of the data was sent through other VMBus mechanisms. 230 * of the data was sent through other VMBus mechanisms.
231 */ 231 */
232 u32 SendBufferSectionIndex; 232 u32 send_buf_section_index;
233 u32 SendBufferSectionSize; 233 u32 send_buf_section_size;
234} __attribute__((packed)); 234} __attribute__((packed));
235 235
236/* 236/*
@@ -239,35 +239,35 @@ struct nvsp_1_message_send_rndis_packet {
239 * message cannot use any resources associated with the original RNDIS packet. 239 * message cannot use any resources associated with the original RNDIS packet.
240 */ 240 */
241struct nvsp_1_message_send_rndis_packet_complete { 241struct nvsp_1_message_send_rndis_packet_complete {
242 u32 Status; 242 u32 status;
243}; 243};
244 244
245union nvsp_1_message_uber { 245union nvsp_1_message_uber {
246 struct nvsp_1_message_send_ndis_version SendNdisVersion; 246 struct nvsp_1_message_send_ndis_version send_ndis_ver;
247 247
248 struct nvsp_1_message_send_receive_buffer SendReceiveBuffer; 248 struct nvsp_1_message_send_receive_buffer send_recv_buf;
249 struct nvsp_1_message_send_receive_buffer_complete 249 struct nvsp_1_message_send_receive_buffer_complete
250 SendReceiveBufferComplete; 250 send_recv_buf_complete;
251 struct nvsp_1_message_revoke_receive_buffer RevokeReceiveBuffer; 251 struct nvsp_1_message_revoke_receive_buffer revoke_recv_buf;
252 252
253 struct nvsp_1_message_send_send_buffer SendSendBuffer; 253 struct nvsp_1_message_send_send_buffer send_send_buf;
254 struct nvsp_1_message_send_send_buffer_complete SendSendBufferComplete; 254 struct nvsp_1_message_send_send_buffer_complete send_send_buf_complete;
255 struct nvsp_1_message_revoke_send_buffer RevokeSendBuffer; 255 struct nvsp_1_message_revoke_send_buffer revoke_send_buf;
256 256
257 struct nvsp_1_message_send_rndis_packet SendRNDISPacket; 257 struct nvsp_1_message_send_rndis_packet send_rndis_pkt;
258 struct nvsp_1_message_send_rndis_packet_complete 258 struct nvsp_1_message_send_rndis_packet_complete
259 SendRNDISPacketComplete; 259 send_rndis_pkt_complete;
260} __attribute__((packed)); 260} __attribute__((packed));
261 261
262union nvsp_all_messages { 262union nvsp_all_messages {
263 union nvsp_message_init_uber InitMessages; 263 union nvsp_message_init_uber init_msg;
264 union nvsp_1_message_uber Version1Messages; 264 union nvsp_1_message_uber v1_msg;
265} __attribute__((packed)); 265} __attribute__((packed));
266 266
267/* ALL Messages */ 267/* ALL Messages */
268struct nvsp_message { 268struct nvsp_message {
269 struct nvsp_message_header Header; 269 struct nvsp_message_header hdr;
270 union nvsp_all_messages Messages; 270 union nvsp_all_messages msg;
271} __attribute__((packed)); 271} __attribute__((packed));
272 272
273 273
@@ -293,39 +293,39 @@ struct nvsp_message {
293 293
294/* Per netvsc channel-specific */ 294/* Per netvsc channel-specific */
295struct netvsc_device { 295struct netvsc_device {
296 struct hv_device *Device; 296 struct hv_device *dev;
297 297
298 atomic_t RefCount; 298 atomic_t refcnt;
299 atomic_t NumOutstandingSends; 299 atomic_t num_outstanding_sends;
300 /* 300 /*
301 * List of free preallocated hv_netvsc_packet to represent receive 301 * List of free preallocated hv_netvsc_packet to represent receive
302 * packet 302 * packet
303 */ 303 */
304 struct list_head ReceivePacketList; 304 struct list_head recv_pkt_list;
305 spinlock_t receive_packet_list_lock; 305 spinlock_t recv_pkt_list_lock;
306 306
307 /* Send buffer allocated by us but manages by NetVSP */ 307 /* Send buffer allocated by us but manages by NetVSP */
308 void *SendBuffer; 308 void *send_buf;
309 u32 SendBufferSize; 309 u32 send_buf_size;
310 u32 SendBufferGpadlHandle; 310 u32 send_buf_gpadl_handle;
311 u32 SendSectionSize; 311 u32 send_section_size;
312 312
313 /* Receive buffer allocated by us but manages by NetVSP */ 313 /* Receive buffer allocated by us but manages by NetVSP */
314 void *ReceiveBuffer; 314 void *recv_buf;
315 u32 ReceiveBufferSize; 315 u32 recv_buf_size;
316 u32 ReceiveBufferGpadlHandle; 316 u32 recv_buf_gpadl_handle;
317 u32 ReceiveSectionCount; 317 u32 recv_section_cnt;
318 struct nvsp_1_receive_buffer_section *ReceiveSections; 318 struct nvsp_1_receive_buffer_section *recv_section;
319 319
320 /* Used for NetVSP initialization protocol */ 320 /* Used for NetVSP initialization protocol */
321 struct osd_waitevent *ChannelInitEvent; 321 struct osd_waitevent *channel_init_event;
322 struct nvsp_message ChannelInitPacket; 322 struct nvsp_message channel_init_pkt;
323 323
324 struct nvsp_message RevokePacket; 324 struct nvsp_message revoke_packet;
325 /* unsigned char HwMacAddr[HW_MACADDR_LEN]; */ 325 /* unsigned char HwMacAddr[HW_MACADDR_LEN]; */
326 326
327 /* Holds rndis device info */ 327 /* Holds rndis device info */
328 void *Extension; 328 void *extension;
329}; 329};
330 330
331#endif /* _NETVSC_H_ */ 331#endif /* _NETVSC_H_ */
diff --git a/drivers/staging/hv/netvsc_api.h b/drivers/staging/hv/netvsc_api.h
index ac40db56e1fa..b4bed3636594 100644
--- a/drivers/staging/hv/netvsc_api.h
+++ b/drivers/staging/hv/netvsc_api.h
@@ -95,7 +95,7 @@ struct netvsc_driver {
95 */ 95 */
96 int (*recv_cb)(struct hv_device *dev, 96 int (*recv_cb)(struct hv_device *dev,
97 struct hv_netvsc_packet *packet); 97 struct hv_netvsc_packet *packet);
98 void (*link_status_change)(struct hv_device *dev, u32 Status); 98 void (*link_status_change)(struct hv_device *dev, u32 status);
99 99
100 /* Specific to this driver */ 100 /* Specific to this driver */
101 int (*send)(struct hv_device *dev, struct hv_netvsc_packet *packet); 101 int (*send)(struct hv_device *dev, struct hv_netvsc_packet *packet);
diff --git a/drivers/staging/hv/rndis_filter.c b/drivers/staging/hv/rndis_filter.c
index dffcc0397917..63d24c6fadf0 100644
--- a/drivers/staging/hv/rndis_filter.c
+++ b/drivers/staging/hv/rndis_filter.c
@@ -266,7 +266,7 @@ static int rndis_filter_send_request(struct rndis_device *dev,
266 rndis_filter_send_request_completion; 266 rndis_filter_send_request_completion;
267 packet->completion.send.send_completion_tid = (unsigned long)dev; 267 packet->completion.send.send_completion_tid = (unsigned long)dev;
268 268
269 ret = rndis_filter.inner_drv.send(dev->net_dev->Device, packet); 269 ret = rndis_filter.inner_drv.send(dev->net_dev->dev, packet);
270 return ret; 270 return ret;
271} 271}
272 272
@@ -338,10 +338,10 @@ static void rndis_filter_receive_indicate_status(struct rndis_device *dev,
338 338
339 if (indicate->Status == RNDIS_STATUS_MEDIA_CONNECT) { 339 if (indicate->Status == RNDIS_STATUS_MEDIA_CONNECT) {
340 rndis_filter.inner_drv.link_status_change( 340 rndis_filter.inner_drv.link_status_change(
341 dev->net_dev->Device, 1); 341 dev->net_dev->dev, 1);
342 } else if (indicate->Status == RNDIS_STATUS_MEDIA_DISCONNECT) { 342 } else if (indicate->Status == RNDIS_STATUS_MEDIA_DISCONNECT) {
343 rndis_filter.inner_drv.link_status_change( 343 rndis_filter.inner_drv.link_status_change(
344 dev->net_dev->Device, 0); 344 dev->net_dev->dev, 0);
345 } else { 345 } else {
346 /* 346 /*
347 * TODO: 347 * TODO:
@@ -376,7 +376,7 @@ static void rndis_filter_receive_data(struct rndis_device *dev,
376 376
377 pkt->is_data_pkt = true; 377 pkt->is_data_pkt = true;
378 378
379 rndis_filter.inner_drv.recv_cb(dev->net_dev->Device, 379 rndis_filter.inner_drv.recv_cb(dev->net_dev->dev,
380 pkt); 380 pkt);
381} 381}
382 382
@@ -392,13 +392,13 @@ static int rndis_filter_receive(struct hv_device *dev,
392 return -EINVAL; 392 return -EINVAL;
393 393
394 /* Make sure the rndis device state is initialized */ 394 /* Make sure the rndis device state is initialized */
395 if (!net_dev->Extension) { 395 if (!net_dev->extension) {
396 DPRINT_ERR(NETVSC, "got rndis message but no rndis device..." 396 DPRINT_ERR(NETVSC, "got rndis message but no rndis device..."
397 "dropping this message!"); 397 "dropping this message!");
398 return -1; 398 return -1;
399 } 399 }
400 400
401 rndis_dev = (struct rndis_device *)net_dev->Extension; 401 rndis_dev = (struct rndis_device *)net_dev->extension;
402 if (rndis_dev->state == RNDIS_DEV_UNINITIALIZED) { 402 if (rndis_dev->state == RNDIS_DEV_UNINITIALIZED) {
403 DPRINT_ERR(NETVSC, "got rndis message but rndis device " 403 DPRINT_ERR(NETVSC, "got rndis message but rndis device "
404 "uninitialized...dropping this message!"); 404 "uninitialized...dropping this message!");
@@ -782,7 +782,7 @@ static int rndis_filte_device_add(struct hv_device *dev,
782 /* ASSERT(netDevice); */ 782 /* ASSERT(netDevice); */
783 /* ASSERT(netDevice->Device); */ 783 /* ASSERT(netDevice->Device); */
784 784
785 netDevice->Extension = rndisDevice; 785 netDevice->extension = rndisDevice;
786 rndisDevice->net_dev = netDevice; 786 rndisDevice->net_dev = netDevice;
787 787
788 /* Send the rndis initialization message */ 788 /* Send the rndis initialization message */
@@ -819,13 +819,13 @@ static int rndis_filte_device_add(struct hv_device *dev,
819static int rndis_filter_device_remove(struct hv_device *dev) 819static int rndis_filter_device_remove(struct hv_device *dev)
820{ 820{
821 struct netvsc_device *net_dev = dev->Extension; 821 struct netvsc_device *net_dev = dev->Extension;
822 struct rndis_device *rndis_dev = net_dev->Extension; 822 struct rndis_device *rndis_dev = net_dev->extension;
823 823
824 /* Halt and release the rndis device */ 824 /* Halt and release the rndis device */
825 rndis_filter_halt_device(rndis_dev); 825 rndis_filter_halt_device(rndis_dev);
826 826
827 kfree(rndis_dev); 827 kfree(rndis_dev);
828 net_dev->Extension = NULL; 828 net_dev->extension = NULL;
829 829
830 /* Pass control to inner driver to remove the device */ 830 /* Pass control to inner driver to remove the device */
831 rndis_filter.inner_drv.base.OnDeviceRemove(dev); 831 rndis_filter.inner_drv.base.OnDeviceRemove(dev);
@@ -844,7 +844,7 @@ int rndis_filter_open(struct hv_device *dev)
844 if (!netDevice) 844 if (!netDevice)
845 return -EINVAL; 845 return -EINVAL;
846 846
847 return rndis_filter_open_device(netDevice->Extension); 847 return rndis_filter_open_device(netDevice->extension);
848} 848}
849 849
850int rndis_filter_close(struct hv_device *dev) 850int rndis_filter_close(struct hv_device *dev)
@@ -854,7 +854,7 @@ int rndis_filter_close(struct hv_device *dev)
854 if (!netDevice) 854 if (!netDevice)
855 return -EINVAL; 855 return -EINVAL;
856 856
857 return rndis_filter_close_device(netDevice->Extension); 857 return rndis_filter_close_device(netDevice->extension);
858} 858}
859 859
860static int rndis_filter_send(struct hv_device *dev, 860static int rndis_filter_send(struct hv_device *dev,