diff options
author | Bill Pemberton <wfp5p@virginia.edu> | 2009-07-27 16:47:24 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-15 12:01:50 -0700 |
commit | 454f18a963cf6519bf317e74e6b9781ffef8d253 (patch) | |
tree | 67b206b51dfa5590f3fbdc3db094df1ba5194c6d /drivers/staging/hv/NetVsc.c | |
parent | 226408a4998041d7832123ab9ccd743e878197ed (diff) | |
download | op-kernel-dev-454f18a963cf6519bf317e74e6b9781ffef8d253.zip op-kernel-dev-454f18a963cf6519bf317e74e6b9781ffef8d253.tar.gz |
Staging: hv: Remove C99 comments
Remove C99 // comments with traditional /* */ comments
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/hv/NetVsc.c')
-rw-r--r-- | drivers/staging/hv/NetVsc.c | 263 |
1 files changed, 141 insertions, 122 deletions
diff --git a/drivers/staging/hv/NetVsc.c b/drivers/staging/hv/NetVsc.c index b4b7010..72d41cc 100644 --- a/drivers/staging/hv/NetVsc.c +++ b/drivers/staging/hv/NetVsc.c @@ -28,20 +28,16 @@ #include "RndisFilter.h" -// -// Globals -// +/* Globals */ static const char* gDriverName="netvsc"; -// {F8615163-DF3E-46c5-913F-F2D2F965ED0E} +/* {F8615163-DF3E-46c5-913F-F2D2F965ED0E} */ static const GUID gNetVscDeviceType={ .Data = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, 0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E} }; -// -// Internal routines -// +/* Internal routines */ static int NetVscOnDeviceAdd( DEVICE_OBJECT *Device, @@ -125,7 +121,7 @@ static inline NETVSC_DEVICE* AllocNetDevice(DEVICE_OBJECT *Device) if (!netDevice) return NULL; - // Set to 2 to allow both inbound and outbound traffic + /* Set to 2 to allow both inbound and outbound traffic */ InterlockedCompareExchange(&netDevice->RefCount, 2, 0); netDevice->Device = Device; @@ -142,7 +138,7 @@ static inline void FreeNetDevice(NETVSC_DEVICE *Device) } -// Get the net device object iff exists and its refcount > 1 +/* Get the net device object iff exists and its refcount > 1 */ static inline NETVSC_DEVICE* GetOutboundNetDevice(DEVICE_OBJECT *Device) { NETVSC_DEVICE *netDevice; @@ -160,7 +156,7 @@ static inline NETVSC_DEVICE* GetOutboundNetDevice(DEVICE_OBJECT *Device) return netDevice; } -// Get the net device object iff exists and its refcount > 0 +/* Get the net device object iff exists and its refcount > 0 */ static inline NETVSC_DEVICE* GetInboundNetDevice(DEVICE_OBJECT *Device) { NETVSC_DEVICE *netDevice; @@ -196,7 +192,7 @@ static inline NETVSC_DEVICE* ReleaseOutboundNetDevice(DEVICE_OBJECT *Device) if (netDevice == NULL) return NULL; - // Busy wait until the ref drop to 2, then set it to 1 + /* Busy wait until the ref drop to 2, then set it to 1 */ while (InterlockedCompareExchange(&netDevice->RefCount, 1, 2) != 2) { udelay(100); @@ -213,7 +209,7 @@ static inline NETVSC_DEVICE* ReleaseInboundNetDevice(DEVICE_OBJECT *Device) if (netDevice == NULL) return NULL; - // Busy wait until the ref drop to 1, then set it to 0 + /* Busy wait until the ref drop to 1, then set it to 0 */ while (InterlockedCompareExchange(&netDevice->RefCount, 0, 1) != 1) { udelay(100); @@ -246,17 +242,17 @@ NetVscInitialize( DPRINT_DBG(NETVSC, "sizeof(NETVSC_PACKET)=%d, sizeof(NVSP_MESSAGE)=%d, sizeof(VMTRANSFER_PAGE_PACKET_HEADER)=%d", sizeof(NETVSC_PACKET), sizeof(NVSP_MESSAGE), sizeof(VMTRANSFER_PAGE_PACKET_HEADER)); - // Make sure we are at least 2 pages since 1 page is used for control + /* Make sure we are at least 2 pages since 1 page is used for control */ ASSERT(driver->RingBufferSize >= (PAGE_SIZE << 1)); drv->name = gDriverName; memcpy(&drv->deviceType, &gNetVscDeviceType, sizeof(GUID)); - // Make sure it is set by the caller + /* Make sure it is set by the caller */ ASSERT(driver->OnReceiveCallback); ASSERT(driver->OnLinkStatusChanged); - // Setup the dispatch table + /* Setup the dispatch table */ driver->Base.OnDeviceAdd = NetVscOnDeviceAdd; driver->Base.OnDeviceRemove = NetVscOnDeviceRemove; driver->Base.OnCleanup = NetVscOnCleanup; @@ -289,7 +285,7 @@ NetVscInitializeReceiveBufferWithNetVsp( return -1; } ASSERT(netDevice->ReceiveBufferSize > 0); - ASSERT((netDevice->ReceiveBufferSize & (PAGE_SIZE-1)) == 0); // page-size grandularity + ASSERT((netDevice->ReceiveBufferSize & (PAGE_SIZE-1)) == 0); /* page-size grandularity */ netDevice->ReceiveBuffer = PageAlloc(netDevice->ReceiveBufferSize >> PAGE_SHIFT); if (!netDevice->ReceiveBuffer) @@ -298,13 +294,15 @@ NetVscInitializeReceiveBufferWithNetVsp( ret = -1; goto Cleanup; } - ASSERT(((unsigned long)netDevice->ReceiveBuffer & (PAGE_SIZE-1)) == 0); // page-aligned buffer + ASSERT(((unsigned long)netDevice->ReceiveBuffer & (PAGE_SIZE-1)) == 0); /* page-aligned buffer */ DPRINT_INFO(NETVSC, "Establishing receive buffer's GPADL..."); - // Establish the gpadl handle for this buffer on this channel. - // Note: This call uses the vmbus connection rather than the channel to establish - // the gpadl handle. + /* + * Establish the gpadl handle for this buffer on this + * channel. Note: This call uses the vmbus connection rather + * than the channel to establish the gpadl handle. + */ ret = Device->Driver->VmbusChannelInterface.EstablishGpadl(Device, netDevice->ReceiveBuffer, netDevice->ReceiveBufferSize, @@ -316,9 +314,9 @@ NetVscInitializeReceiveBufferWithNetVsp( goto Cleanup; } - //WaitEventWait(ext->ChannelInitEvent); + /* WaitEventWait(ext->ChannelInitEvent); */ - // Notify the NetVsp of the gpadl handle + /* Notify the NetVsp of the gpadl handle */ DPRINT_INFO(NETVSC, "Sending NvspMessage1TypeSendReceiveBuffer..."); initPacket = &netDevice->ChannelInitPacket; @@ -329,7 +327,7 @@ NetVscInitializeReceiveBufferWithNetVsp( initPacket->Messages.Version1Messages.SendReceiveBuffer.GpadlHandle = netDevice->ReceiveBufferGpadlHandle; initPacket->Messages.Version1Messages.SendReceiveBuffer.Id = NETVSC_RECEIVE_BUFFER_ID; - // Send the gpadl notification request + /* Send the gpadl notification request */ ret = Device->Driver->VmbusChannelInterface.SendPacket(Device, initPacket, sizeof(NVSP_MESSAGE), @@ -344,7 +342,7 @@ NetVscInitializeReceiveBufferWithNetVsp( WaitEventWait(netDevice->ChannelInitEvent); - // Check the response + /* Check the response */ if (initPacket->Messages.Version1Messages.SendReceiveBufferComplete.Status != NvspStatusSuccess) { DPRINT_ERR(NETVSC, @@ -354,7 +352,7 @@ NetVscInitializeReceiveBufferWithNetVsp( goto Cleanup; } - // Parse the response + /* Parse the response */ ASSERT(netDevice->ReceiveSectionCount == 0); ASSERT(netDevice->ReceiveSections == NULL); @@ -377,7 +375,7 @@ NetVscInitializeReceiveBufferWithNetVsp( netDevice->ReceiveSections[0].SubAllocationSize, netDevice->ReceiveSections[0].NumSubAllocations); - //For 1st release, there should only be 1 section that represents the entire receive buffer + /* For 1st release, there should only be 1 section that represents the entire receive buffer */ if (netDevice->ReceiveSectionCount != 1 || netDevice->ReceiveSections->Offset != 0 ) { @@ -416,7 +414,7 @@ NetVscInitializeSendBufferWithNetVsp( return -1; } ASSERT(netDevice->SendBufferSize > 0); - ASSERT((netDevice->SendBufferSize & (PAGE_SIZE-1)) == 0); // page-size grandularity + ASSERT((netDevice->SendBufferSize & (PAGE_SIZE-1)) == 0); /* page-size grandularity */ netDevice->SendBuffer = PageAlloc(netDevice->SendBufferSize >> PAGE_SHIFT); if (!netDevice->SendBuffer) @@ -425,17 +423,19 @@ NetVscInitializeSendBufferWithNetVsp( ret = -1; goto Cleanup; } - ASSERT(((unsigned long)netDevice->SendBuffer & (PAGE_SIZE-1)) == 0); // page-aligned buffer + ASSERT(((unsigned long)netDevice->SendBuffer & (PAGE_SIZE-1)) == 0); /* page-aligned buffer */ DPRINT_INFO(NETVSC, "Establishing send buffer's GPADL..."); - // Establish the gpadl handle for this buffer on this channel. - // Note: This call uses the vmbus connection rather than the channel to establish - // the gpadl handle. + /* + * Establish the gpadl handle for this buffer on this + * channel. Note: This call uses the vmbus connection rather + * than the channel to establish the gpadl handle. + */ ret = Device->Driver->VmbusChannelInterface.EstablishGpadl(Device, - netDevice->SendBuffer, - netDevice->SendBufferSize, - &netDevice->SendBufferGpadlHandle); + netDevice->SendBuffer, + netDevice->SendBufferSize, + &netDevice->SendBufferGpadlHandle); if (ret != 0) { @@ -443,9 +443,9 @@ NetVscInitializeSendBufferWithNetVsp( goto Cleanup; } - //WaitEventWait(ext->ChannelInitEvent); + /* WaitEventWait(ext->ChannelInitEvent); */ - // Notify the NetVsp of the gpadl handle + /* Notify the NetVsp of the gpadl handle */ DPRINT_INFO(NETVSC, "Sending NvspMessage1TypeSendSendBuffer..."); initPacket = &netDevice->ChannelInitPacket; @@ -456,7 +456,7 @@ NetVscInitializeSendBufferWithNetVsp( initPacket->Messages.Version1Messages.SendReceiveBuffer.GpadlHandle = netDevice->SendBufferGpadlHandle; initPacket->Messages.Version1Messages.SendReceiveBuffer.Id = NETVSC_SEND_BUFFER_ID; - // Send the gpadl notification request + /* Send the gpadl notification request */ ret = Device->Driver->VmbusChannelInterface.SendPacket(Device, initPacket, sizeof(NVSP_MESSAGE), @@ -471,7 +471,7 @@ NetVscInitializeSendBufferWithNetVsp( WaitEventWait(netDevice->ChannelInitEvent); - // Check the response + /* Check the response */ if (initPacket->Messages.Version1Messages.SendSendBufferComplete.Status != NvspStatusSuccess) { DPRINT_ERR(NETVSC, @@ -505,13 +505,17 @@ NetVscDestroyReceiveBuffer( DPRINT_ENTER(NETVSC); - // If we got a section count, it means we received a SendReceiveBufferComplete msg - // (ie sent NvspMessage1TypeSendReceiveBuffer msg) therefore, we need to send a revoke msg here + /* + * If we got a section count, it means we received a + * SendReceiveBufferComplete msg (ie sent + * NvspMessage1TypeSendReceiveBuffer msg) therefore, we need + * to send a revoke msg here + */ if (NetDevice->ReceiveSectionCount) { DPRINT_INFO(NETVSC, "Sending NvspMessage1TypeRevokeReceiveBuffer..."); - // Send the revoke receive buffer + /* Send the revoke receive buffer */ revokePacket = &NetDevice->RevokePacket; memset(revokePacket, 0, sizeof(NVSP_MESSAGE)); @@ -524,7 +528,10 @@ NetVscDestroyReceiveBuffer( (unsigned long)revokePacket, VmbusPacketTypeDataInBand, 0); - // If we failed here, we might as well return and have a leak rather than continue and a bugchk + /* + * If we failed here, we might as well return and + * have a leak rather than continue and a bugchk + */ if (ret != 0) { DPRINT_ERR(NETVSC, "unable to send revoke receive buffer to netvsp"); @@ -533,7 +540,7 @@ NetVscDestroyReceiveBuffer( } } - // Teardown the gpadl on the vsp end + /* Teardown the gpadl on the vsp end */ if (NetDevice->ReceiveBufferGpadlHandle) { DPRINT_INFO(NETVSC, "Tearing down receive buffer's GPADL..."); @@ -541,7 +548,7 @@ NetVscDestroyReceiveBuffer( ret = NetDevice->Device->Driver->VmbusChannelInterface.TeardownGpadl(NetDevice->Device, NetDevice->ReceiveBufferGpadlHandle); - // If we failed here, we might as well return and have a leak rather than continue and a bugchk + /* If we failed here, we might as well return and have a leak rather than continue and a bugchk */ if (ret != 0) { DPRINT_ERR(NETVSC, "unable to teardown receive buffer's gpadl"); @@ -555,7 +562,7 @@ NetVscDestroyReceiveBuffer( { DPRINT_INFO(NETVSC, "Freeing up receive buffer..."); - // Free up the receive buffer + /* Free up the receive buffer */ PageFree(NetDevice->ReceiveBuffer, NetDevice->ReceiveBufferSize >> PAGE_SHIFT); NetDevice->ReceiveBuffer = NULL; } @@ -586,13 +593,17 @@ NetVscDestroySendBuffer( DPRINT_ENTER(NETVSC); - // If we got a section count, it means we received a SendReceiveBufferComplete msg - // (ie sent NvspMessage1TypeSendReceiveBuffer msg) therefore, we need to send a revoke msg here + /* + * If we got a section count, it means we received a + * SendReceiveBufferComplete msg (ie sent + * NvspMessage1TypeSendReceiveBuffer msg) therefore, we need + * to send a revoke msg here + */ if (NetDevice->SendSectionSize) { DPRINT_INFO(NETVSC, "Sending NvspMessage1TypeRevokeSendBuffer..."); - // Send the revoke send buffer + /* Send the revoke send buffer */ revokePacket = &NetDevice->RevokePacket; memset(revokePacket, 0, sizeof(NVSP_MESSAGE)); @@ -605,7 +616,7 @@ NetVscDestroySendBuffer( (unsigned long)revokePacket, VmbusPacketTypeDataInBand, 0); - // If we failed here, we might as well return and have a leak rather than continue and a bugchk + /* If we failed here, we might as well return and have a leak rather than continue and a bugchk */ if (ret != 0) { DPRINT_ERR(NETVSC, "unable to send revoke send buffer to netvsp"); @@ -614,7 +625,7 @@ NetVscDestroySendBuffer( } } - // Teardown the gpadl on the vsp end + /* Teardown the gpadl on the vsp end */ if (NetDevice->SendBufferGpadlHandle) { DPRINT_INFO(NETVSC, "Tearing down send buffer's GPADL..."); @@ -622,7 +633,7 @@ NetVscDestroySendBuffer( ret = NetDevice->Device->Driver->VmbusChannelInterface.TeardownGpadl(NetDevice->Device, NetDevice->SendBufferGpadlHandle); - // If we failed here, we might as well return and have a leak rather than continue and a bugchk + /* If we failed here, we might as well return and have a leak rather than continue and a bugchk */ if (ret != 0) { DPRINT_ERR(NETVSC, "unable to teardown send buffer's gpadl"); @@ -636,7 +647,7 @@ NetVscDestroySendBuffer( { DPRINT_INFO(NETVSC, "Freeing up send buffer..."); - // Free up the receive buffer + /* Free up the receive buffer */ PageFree(NetDevice->SendBuffer, NetDevice->SendBufferSize >> PAGE_SHIFT); NetDevice->SendBuffer = NULL; } @@ -677,7 +688,7 @@ NetVscConnectToVsp( DPRINT_INFO(NETVSC, "Sending NvspMessageTypeInit..."); - // Send the init request + /* Send the init request */ ret = Device->Driver->VmbusChannelInterface.SendPacket(Device, initPacket, sizeof(NVSP_MESSAGE), @@ -693,8 +704,8 @@ NetVscConnectToVsp( WaitEventWait(netDevice->ChannelInitEvent); - // Now, check the response - //ASSERT(initPacket->Messages.InitMessages.InitComplete.MaximumMdlChainLength <= MAX_MULTIPAGE_BUFFER_COUNT); + /* Now, check the response */ + /* ASSERT(initPacket->Messages.InitMessages.InitComplete.MaximumMdlChainLength <= MAX_MULTIPAGE_BUFFER_COUNT); */ DPRINT_INFO(NETVSC, "NvspMessageTypeInit status(%d) max mdl chain (%d)", initPacket->Messages.InitMessages.InitComplete.Status, initPacket->Messages.InitMessages.InitComplete.MaximumMdlChainLength); @@ -715,7 +726,7 @@ NetVscConnectToVsp( } DPRINT_INFO(NETVSC, "Sending NvspMessage1TypeSendNdisVersion..."); - // Send the ndis version + /* Send the ndis version */ memset(initPacket, 0, sizeof(NVSP_MESSAGE)); ndisVersion = 0x00050000; @@ -724,7 +735,7 @@ NetVscConnectToVsp( initPacket->Messages.Version1Messages.SendNdisVersion.NdisMajorVersion = (ndisVersion & 0xFFFF0000) >> 16; initPacket->Messages.Version1Messages.SendNdisVersion.NdisMinorVersion = ndisVersion & 0xFFFF; - // Send the init request + /* Send the init request */ ret = Device->Driver->VmbusChannelInterface.SendPacket(Device, initPacket, sizeof(NVSP_MESSAGE), @@ -737,12 +748,15 @@ NetVscConnectToVsp( ret = -1; goto Cleanup; } - // - // BUGBUG - We have to wait for the above msg since the netvsp uses KMCL which acknowledges packet (completion packet) - // since our Vmbus always set the VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED flag - //WaitEventWait(NetVscChannel->ChannelInitEvent); - - // Post the big receive buffer to NetVSP + /* + * BUGBUG - We have to wait for the above msg since the + * netvsp uses KMCL which acknowledges packet (completion + * packet) since our Vmbus always set the + * VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED flag + */ + /* WaitEventWait(NetVscChannel->ChannelInitEvent); */ + + /* Post the big receive buffer to NetVSP */ ret = NetVscInitializeReceiveBufferWithNetVsp(Device); if (ret == 0) { @@ -804,7 +818,7 @@ NetVscOnDeviceAdd( DPRINT_DBG(NETVSC, "netvsc channel object allocated - %p", netDevice); - // Initialize the NetVSC channel extension + /* Initialize the NetVSC channel extension */ netDevice->ReceiveBufferSize = NETVSC_RECEIVE_BUFFER_SIZE; spin_lock_init(&netDevice->receive_packet_list_lock); @@ -825,14 +839,14 @@ NetVscOnDeviceAdd( } netDevice->ChannelInitEvent = WaitEventCreate(); - // Open the channel + /* Open the channel */ ret = Device->Driver->VmbusChannelInterface.Open(Device, - netDriver->RingBufferSize, - netDriver->RingBufferSize, - NULL, 0, - NetVscOnChannelCallback, - Device - ); + netDriver->RingBufferSize, + netDriver->RingBufferSize, + NULL, 0, + NetVscOnChannelCallback, + Device + ); if (ret != 0) { @@ -841,10 +855,10 @@ NetVscOnDeviceAdd( goto Cleanup; } - // Channel is opened + /* Channel is opened */ DPRINT_INFO(NETVSC, "*** NetVSC channel opened successfully! ***"); - // Connect with the NetVsp + /* Connect with the NetVsp */ ret = NetVscConnectToVsp(Device); if (ret != 0) { @@ -859,7 +873,7 @@ NetVscOnDeviceAdd( return ret; Close: - // Now, we can close the channel safely + /* Now, we can close the channel safely */ Device->Driver->VmbusChannelInterface.Close(Device); Cleanup: @@ -909,7 +923,7 @@ NetVscOnDeviceRemove( DPRINT_INFO(NETVSC, "Disabling outbound traffic on net device (%p)...", Device->Extension); - // Stop outbound traffic ie sends and receives completions + /* Stop outbound traffic ie sends and receives completions */ netDevice = ReleaseOutboundNetDevice(Device); if (!netDevice) { @@ -917,7 +931,7 @@ NetVscOnDeviceRemove( return -1; } - // Wait for all send completions + /* Wait for all send completions */ while (netDevice->NumOutstandingSends) { DPRINT_INFO(NETVSC, "waiting for %d requests to complete...", netDevice->NumOutstandingSends); @@ -931,16 +945,16 @@ NetVscOnDeviceRemove( DPRINT_INFO(NETVSC, "Disabling inbound traffic on net device (%p)...", Device->Extension); - // Stop inbound traffic ie receives and sends completions + /* Stop inbound traffic ie receives and sends completions */ netDevice = ReleaseInboundNetDevice(Device); - // At this point, no one should be accessing netDevice except in here + /* At this point, no one should be accessing netDevice except in here */ DPRINT_INFO(NETVSC, "net device (%p) safe to remove", netDevice); - // Now, we can close the channel safely + /* Now, we can close the channel safely */ Device->Driver->VmbusChannelInterface.Close(Device); - // Release all resources + /* Release all resources */ while (!IsListEmpty(&netDevice->ReceivePacketList)) { entry = REMOVE_HEAD_LIST(&netDevice->ReceivePacketList); @@ -1005,17 +1019,17 @@ NetVscOnSendCompletion( nvspPacket->Header.MessageType == NvspMessage1TypeSendReceiveBufferComplete || nvspPacket->Header.MessageType == NvspMessage1TypeSendSendBufferComplete) { - // Copy the response back + /* Copy the response back */ memcpy(&netDevice->ChannelInitPacket, nvspPacket, sizeof(NVSP_MESSAGE)); WaitEventSet(netDevice->ChannelInitEvent); } else if (nvspPacket->Header.MessageType == NvspMessage1TypeSendRNDISPacketComplete) { - // Get the send context + /* Get the send context */ nvscPacket = (NETVSC_PACKET *)(unsigned long)Packet->TransactionId; ASSERT(nvscPacket); - // Notify the layer above us + /* Notify the layer above us */ nvscPacket->Completion.Send.OnSendCompletion(nvscPacket->Completion.Send.SendCompletionContext); InterlockedDecrement(&netDevice->NumOutstandingSends); @@ -1054,11 +1068,11 @@ NetVscOnSend( sendMessage.Header.MessageType = NvspMessage1TypeSendRNDISPacket; if (Packet->IsDataPacket) - sendMessage.Messages.Version1Messages.SendRNDISPacket.ChannelType = 0;// 0 is RMC_DATA; + sendMessage.Messages.Version1Messages.SendRNDISPacket.ChannelType = 0;/* 0 is RMC_DATA; */ else - sendMessage.Messages.Version1Messages.SendRNDISPacket.ChannelType = 1;// 1 is RMC_CONTROL; + sendMessage.Messages.Version1Messages.SendRNDISPacket.ChannelType = 1;/* 1 is RMC_CONTROL; */ - // Not using send buffer section + /* Not using send buffer section */ sendMessage.Messages.Version1Messages.SendRNDISPacket.SendBufferSectionIndex = 0xFFFFFFFF; sendMessage.Messages.Version1Messages.SendRNDISPacket.SendBufferSectionSize = 0; @@ -1108,7 +1122,7 @@ NetVscOnReceive( LIST_ENTRY* entry; unsigned long start; unsigned long end, endVirtual; - //NETVSC_DRIVER_OBJECT *netvscDriver; + /* NETVSC_DRIVER_OBJECT *netvscDriver; */ XFERPAGE_PACKET *xferpagePacket=NULL; LIST_ENTRY listHead; @@ -1126,7 +1140,7 @@ NetVscOnReceive( return; } - // All inbound packets other than send completion should be xfer page packet + /* All inbound packets other than send completion should be xfer page packet */ if (Packet->Type != VmbusPacketTypeDataUsingTransferPages) { DPRINT_ERR(NETVSC, "Unknown packet type received - %d", Packet->Type); @@ -1136,7 +1150,7 @@ NetVscOnReceive( nvspPacket = (NVSP_MESSAGE*)((unsigned long)Packet + (Packet->DataOffset8 << 3)); - // Make sure this is a valid nvsp packet + /* Make sure this is a valid nvsp packet */ if (nvspPacket->Header.MessageType != NvspMessage1TypeSendRNDISPacket ) { DPRINT_ERR(NETVSC, "Unknown nvsp packet type received - %d", nvspPacket->Header.MessageType); @@ -1159,8 +1173,12 @@ NetVscOnReceive( INITIALIZE_LIST_HEAD(&listHead); - // Grab free packets (range count + 1) to represent this xfer page packet. +1 to represent - // the xfer page packet itself. We grab it here so that we know exactly how many we can fulfil + /* + * Grab free packets (range count + 1) to represent this xfer + * page packet. +1 to represent the xfer page packet itself. + * We grab it here so that we know exactly how many we can + * fulfil + */ spin_lock_irqsave(&netDevice->receive_packet_list_lock, flags); while (!IsListEmpty(&netDevice->ReceivePacketList)) { @@ -1174,13 +1192,16 @@ NetVscOnReceive( } spin_unlock_irqrestore(&netDevice->receive_packet_list_lock, flags); - // We need at least 2 netvsc pkts (1 to represent the xfer page and at least 1 for the range) - // i.e. we can handled some of the xfer page packet ranges... + /* + * We need at least 2 netvsc pkts (1 to represent the xfer + * page and at least 1 for the range) i.e. we can handled + * some of the xfer page packet ranges... + */ if (count < 2) { DPRINT_ERR(NETVSC, "Got only %d netvsc pkt...needed %d pkts. Dropping this xfer page packet completely!", count, vmxferpagePacket->RangeCount+1); - // Return it to the freelist + /* Return it to the freelist */ spin_lock_irqsave(&netDevice->receive_packet_list_lock, flags); for (i=count; i != 0; i--) { @@ -1197,10 +1218,10 @@ NetVscOnReceive( return; } - // Remove the 1st packet to represent the xfer page packet itself + /* Remove the 1st packet to represent the xfer page packet itself */ entry = REMOVE_HEAD_LIST(&listHead); xferpagePacket = CONTAINING_RECORD(entry, XFERPAGE_PACKET, ListEntry); - xferpagePacket->Count = count - 1; // This is how much we can satisfy + xferpagePacket->Count = count - 1; /* This is how much we can satisfy */ ASSERT(xferpagePacket->Count > 0 && xferpagePacket->Count <= vmxferpagePacket->RangeCount); if (xferpagePacket->Count != vmxferpagePacket->RangeCount) @@ -1208,18 +1229,18 @@ NetVscOnReceive( DPRINT_INFO(NETVSC, "Needed %d netvsc pkts to satisy this xfer page...got %d", vmxferpagePacket->RangeCount, xferpagePacket->Count); } - // Each range represents 1 RNDIS pkt that contains 1 ethernet frame + /* Each range represents 1 RNDIS pkt that contains 1 ethernet frame */ for (i=0; i < (count - 1); i++) { entry = REMOVE_HEAD_LIST(&listHead); netvscPacket = CONTAINING_RECORD(entry, NETVSC_PACKET, ListEntry); - // Initialize the netvsc packet + /* Initialize the netvsc packet */ netvscPacket->XferPagePacket = xferpagePacket; netvscPacket->Completion.Recv.OnReceiveCompletion = NetVscOnReceiveCompletion; netvscPacket->Completion.Recv.ReceiveCompletionContext = netvscPacket; netvscPacket->Device = Device; - netvscPacket->Completion.Recv.ReceiveCompletionTid = vmxferpagePacket->d.TransactionId; // Save this so that we can send it back + netvscPacket->Completion.Recv.ReceiveCompletionTid = vmxferpagePacket->d.TransactionId; /* Save this so that we can send it back */ netvscPacket->TotalDataBufferLength = vmxferpagePacket->Ranges[i].ByteCount; netvscPacket->PageBufferCount = 1; @@ -1236,10 +1257,10 @@ NetVscOnReceive( + vmxferpagePacket->Ranges[i].ByteCount -1; end = GetPhysicalAddress((void*)endVirtual); - // Calculate the page relative offset + /* Calculate the page relative offset */ netvscPacket->PageBuffers[0].Offset = vmxferpagePacket->Ranges[i].ByteOffset & (PAGE_SIZE -1); if ((end >> PAGE_SHIFT) != (start>>PAGE_SHIFT)) { - //Handle frame across multiple pages: + /* Handle frame across multiple pages: */ netvscPacket->PageBuffers[0].Length = (netvscPacket->PageBuffers[0].Pfn <<PAGE_SHIFT) + PAGE_SIZE - start; bytesRemain = netvscPacket->TotalDataBufferLength - netvscPacket->PageBuffers[0].Length; @@ -1268,7 +1289,7 @@ NetVscOnReceive( netvscPacket->PageBuffers[0].Offset, netvscPacket->PageBuffers[0].Length); - // Pass it to the upper layer + /* Pass it to the upper layer */ ((NETVSC_DRIVER_OBJECT*)Device->Driver)->OnReceiveCallback(Device, netvscPacket); NetVscOnReceiveCompletion(netvscPacket->Completion.Recv.ReceiveCompletionContext); @@ -1295,22 +1316,22 @@ NetVscSendReceiveCompletion( recvcompMessage.Header.MessageType = NvspMessage1TypeSendRNDISPacketComplete; - // FIXME: Pass in the status + /* FIXME: Pass in the status */ recvcompMessage.Messages.Version1Messages.SendRNDISPacketComplete.Status = NvspStatusSuccess; retry_send_cmplt: - // Send the completion + /* Send the completion */ ret = Device->Driver->VmbusChannelInterface.SendPacket(Device, &recvcompMessage, sizeof(NVSP_MESSAGE), TransactionId, VmbusPacketTypeCompletion, 0); - if (ret == 0) // success + if (ret == 0) /* success */ { - // no-op + /* no-op */ } - else if (ret == -1) // no more room...wait a bit and attempt to retry 3 times + else if (ret == -1) /* no more room...wait a bit and attempt to retry 3 times */ { retries++; DPRINT_ERR(NETVSC, "unable to send receive completion pkt (tid %llx)...retrying %d", TransactionId, retries); @@ -1331,9 +1352,7 @@ retry_send_cmplt: } } -// -// Send a receive completion packet to RNDIS device (ie NetVsp) -// +/* Send a receive completion packet to RNDIS device (ie NetVsp) */ static void NetVscOnReceiveCompletion( void * Context) @@ -1349,8 +1368,8 @@ NetVscOnReceiveCompletion( ASSERT(packet->XferPagePacket); - // Even though it seems logical to do a GetOutboundNetDevice() here to send out receive completion, - // we are using GetInboundNetDevice() since we may have disable outbound traffic already. + /* Even though it seems logical to do a GetOutboundNetDevice() here to send out receive completion, */ + /* we are using GetInboundNetDevice() since we may have disable outbound traffic already. */ netDevice = GetInboundNetDevice(device); if (!netDevice) { @@ -1359,14 +1378,14 @@ NetVscOnReceiveCompletion( return; } - // Overloading use of the lock. + /* Overloading use of the lock. */ spin_lock_irqsave(&netDevice->receive_packet_list_lock, flags); ASSERT(packet->XferPagePacket->Count > 0); packet->XferPagePacket->Count--; - // Last one in the line that represent 1 xfer page packet. - // Return the xfer page packet itself to the freelist + /* Last one in the line that represent 1 xfer page packet. */ + /* Return the xfer page packet itself to the freelist */ if (packet->XferPagePacket->Count == 0) { fSendReceiveComp = true; @@ -1375,11 +1394,11 @@ NetVscOnReceiveCompletion( INSERT_TAIL_LIST(&netDevice->ReceivePacketList, &packet->XferPagePacket->ListEntry); } - // Put the packet back + /* Put the packet back */ INSERT_TAIL_LIST(&netDevice->ReceivePacketList, &packet->ListEntry); spin_unlock_irqrestore(&netDevice->receive_packet_list_lock, flags); - // Send a receive completion for the xfer page packet + /* Send a receive completion for the xfer page packet */ if (fSendReceiveComp) { NetVscSendReceiveCompletion(device, transactionId); @@ -1451,7 +1470,7 @@ NetVscOnChannelCallback( break; } - // reset + /* reset */ if (bufferlen > netPacketSize) { kfree(buffer); @@ -1462,9 +1481,9 @@ NetVscOnChannelCallback( } else { - //DPRINT_DBG(NETVSC, "nothing else to read..."); + /* DPRINT_DBG(NETVSC, "nothing else to read..."); */ - // reset + /* reset */ if (bufferlen > netPacketSize) { kfree(buffer); @@ -1476,12 +1495,12 @@ NetVscOnChannelCallback( break; } } - else if (ret == -2) // Handle large packet + else if (ret == -2) /* Handle large packet */ { buffer = kmalloc(bytesRecvd, GFP_ATOMIC); if (buffer == NULL) { - // Try again next time around + /* Try again next time around */ DPRINT_ERR(NETVSC, "unable to allocate buffer of size (%d)!!", bytesRecvd); break; } |