Commit 068c5df2 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: hv: coding style cleanups for StorVsc.c

Some one owes me a lot of beer, or a nice bottle of rum for
all of this crud cleanup...

Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b1f1d272
/* /*
*
* Copyright (c) 2009, Microsoft Corporation. * Copyright (c) 2009, Microsoft Corporation.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
...@@ -18,9 +17,7 @@ ...@@ -18,9 +17,7 @@
* Authors: * Authors:
* Haiyang Zhang <haiyangz@microsoft.com> * Haiyang Zhang <haiyangz@microsoft.com>
* Hank Janssen <hjanssen@microsoft.com> * Hank Janssen <hjanssen@microsoft.com>
*
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/mm.h> #include <linux/mm.h>
...@@ -32,14 +29,8 @@ ...@@ -32,14 +29,8 @@
#include "vstorage.h" #include "vstorage.h"
/* #defines */
/* Data types */
struct storvsc_request_extension { struct storvsc_request_extension {
/* LIST_ENTRY ListEntry; */ /* LIST_ENTRY ListEntry; */
struct hv_storvsc_request *Request; struct hv_storvsc_request *Request;
struct hv_device *Device; struct hv_device *Device;
...@@ -50,12 +41,12 @@ struct storvsc_request_extension { ...@@ -50,12 +41,12 @@ struct storvsc_request_extension {
struct vstor_packet VStorPacket; struct vstor_packet VStorPacket;
}; };
/* A storvsc device is a device object that contains a vmbus channel */ /* A storvsc device is a device object that contains a vmbus channel */
struct storvsc_device { struct storvsc_device {
struct hv_device *Device; struct hv_device *Device;
atomic_t RefCount; /* 0 indicates the device is being destroyed */ /* 0 indicates the device is being destroyed */
atomic_t RefCount;
atomic_t NumOutstandingRequests; atomic_t NumOutstandingRequests;
...@@ -64,24 +55,20 @@ struct storvsc_device { ...@@ -64,24 +55,20 @@ struct storvsc_device {
* controller. In reality, the pathid, targetid is always 0 * controller. In reality, the pathid, targetid is always 0
* and the port is set by us * and the port is set by us
*/ */
unsigned int PortNumber; unsigned int PortNumber;
unsigned char PathId; unsigned char PathId;
unsigned char TargetId; unsigned char TargetId;
/* LIST_ENTRY OutstandingRequestList; */ /* LIST_ENTRY OutstandingRequestList; */
/* HANDLE OutstandingRequestLock; */ /* HANDLE OutstandingRequestLock; */
/* Used for vsc/vsp channel reset process */ /* Used for vsc/vsp channel reset process */
struct storvsc_request_extension InitRequest; struct storvsc_request_extension InitRequest;
struct storvsc_request_extension ResetRequest; struct storvsc_request_extension ResetRequest;
}; };
static const char *gDriverName = "storvsc";
/* Globals */
static const char* gDriverName="storvsc";
/* {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f} */ /* {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f} */
static const struct hv_guid gStorVscDeviceType = { static const struct hv_guid gStorVscDeviceType = {
...@@ -92,58 +79,20 @@ static const struct hv_guid gStorVscDeviceType = { ...@@ -92,58 +79,20 @@ static const struct hv_guid gStorVscDeviceType = {
}; };
/* Internal routines */ static int StorVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo);
static int StorVscOnDeviceRemove(struct hv_device *Device);
static int static int StorVscOnIORequest(struct hv_device *Device,
StorVscOnDeviceAdd( struct hv_storvsc_request *Request);
struct hv_device *Device, static int StorVscOnHostReset(struct hv_device *Device);
void *AdditionalInfo static void StorVscOnCleanup(struct hv_driver *Device);
); static void StorVscOnChannelCallback(void *Context);
static void StorVscOnIOCompletion(struct hv_device *Device,
static int struct vstor_packet *VStorPacket,
StorVscOnDeviceRemove( struct storvsc_request_extension *RequestExt);
struct hv_device *Device static void StorVscOnReceive(struct hv_device *Device,
); struct vstor_packet *VStorPacket,
struct storvsc_request_extension *RequestExt);
static int static int StorVscConnectToVsp(struct hv_device *Device);
StorVscOnIORequest(
struct hv_device *Device,
struct hv_storvsc_request *Request
);
static int
StorVscOnHostReset(
struct hv_device *Device
);
static void
StorVscOnCleanup(
struct hv_driver *Device
);
static void
StorVscOnChannelCallback(
void * Context
);
static void
StorVscOnIOCompletion(
struct hv_device *Device,
struct vstor_packet *VStorPacket,
struct storvsc_request_extension *RequestExt
);
static void
StorVscOnReceive(
struct hv_device *Device,
struct vstor_packet *VStorPacket,
struct storvsc_request_extension *RequestExt
);
static int
StorVscConnectToVsp(
struct hv_device *Device
);
static inline struct storvsc_device *AllocStorDevice(struct hv_device *Device) static inline struct storvsc_device *AllocStorDevice(struct hv_device *Device)
{ {
...@@ -165,12 +114,12 @@ static inline struct storvsc_device *AllocStorDevice(struct hv_device *Device) ...@@ -165,12 +114,12 @@ static inline struct storvsc_device *AllocStorDevice(struct hv_device *Device)
static inline void FreeStorDevice(struct storvsc_device *Device) static inline void FreeStorDevice(struct storvsc_device *Device)
{ {
ASSERT( atomic_read(&Device->RefCount) == 0); ASSERT(atomic_read(&Device->RefCount) == 0);
kfree(Device); kfree(Device);
} }
/* Get the stordevice object iff exists and its refcount > 1 */ /* Get the stordevice object iff exists and its refcount > 1 */
static inline struct storvsc_device* GetStorDevice(struct hv_device *Device) static inline struct storvsc_device *GetStorDevice(struct hv_device *Device)
{ {
struct storvsc_device *storDevice; struct storvsc_device *storDevice;
...@@ -218,15 +167,14 @@ static inline struct storvsc_device *ReleaseStorDevice(struct hv_device *Device) ...@@ -218,15 +167,14 @@ static inline struct storvsc_device *ReleaseStorDevice(struct hv_device *Device)
/* 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 (atomic_cmpxchg(&storDevice->RefCount, 2, 1) != 2) while (atomic_cmpxchg(&storDevice->RefCount, 2, 1) != 2)
{
udelay(100); udelay(100);
}
return storDevice; return storDevice;
} }
/* Drop ref count to 0. No one can use StorDevice object. */ /* Drop ref count to 0. No one can use StorDevice object. */
static inline struct storvsc_device *FinalReleaseStorDevice(struct hv_device *Device) static inline struct storvsc_device *FinalReleaseStorDevice(
struct hv_device *Device)
{ {
struct storvsc_device *storDevice; struct storvsc_device *storDevice;
...@@ -235,42 +183,38 @@ static inline struct storvsc_device *FinalReleaseStorDevice(struct hv_device *De ...@@ -235,42 +183,38 @@ static inline struct storvsc_device *FinalReleaseStorDevice(struct hv_device *De
/* 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 (atomic_cmpxchg(&storDevice->RefCount, 1, 0) != 1) while (atomic_cmpxchg(&storDevice->RefCount, 1, 0) != 1)
{
udelay(100); udelay(100);
}
Device->Extension = NULL; Device->Extension = NULL;
return storDevice; return storDevice;
} }
/*++; /**
* StorVscInitialize - Main entry point
*/
Name: int StorVscInitialize(struct hv_driver *Driver)
StorVscInitialize()
Description:
Main entry point
--*/
int
StorVscInitialize(
struct hv_driver *Driver
)
{ {
struct storvsc_driver_object *storDriver = (struct storvsc_driver_object *)Driver; struct storvsc_driver_object *storDriver;
int ret=0;
DPRINT_ENTER(STORVSC); DPRINT_ENTER(STORVSC);
DPRINT_DBG(STORVSC, "sizeof(STORVSC_REQUEST)=%zd sizeof(struct storvsc_request_extension)=%zd sizeof(struct vstor_packet)=%zd, sizeof(struct vmscsi_request)=%zd", storDriver = (struct storvsc_driver_object *)Driver;
sizeof(struct hv_storvsc_request), sizeof(struct storvsc_request_extension), sizeof(struct vstor_packet), sizeof(struct vmscsi_request));
DPRINT_DBG(STORVSC, "sizeof(STORVSC_REQUEST)=%zd "
"sizeof(struct storvsc_request_extension)=%zd "
"sizeof(struct vstor_packet)=%zd, "
"sizeof(struct vmscsi_request)=%zd",
sizeof(struct hv_storvsc_request),
sizeof(struct storvsc_request_extension),
sizeof(struct vstor_packet),
sizeof(struct vmscsi_request));
/* 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(storDriver->RingBufferSize >= (PAGE_SIZE << 1)); ASSERT(storDriver->RingBufferSize >= (PAGE_SIZE << 1));
Driver->name = gDriverName; Driver->name = gDriverName;
memcpy(&Driver->deviceType, &gStorVscDeviceType, sizeof(struct hv_guid)); memcpy(&Driver->deviceType, &gStorVscDeviceType,
sizeof(struct hv_guid));
storDriver->RequestExtSize = sizeof(struct storvsc_request_extension); storDriver->RequestExtSize = sizeof(struct storvsc_request_extension);
...@@ -281,54 +225,50 @@ StorVscInitialize( ...@@ -281,54 +225,50 @@ StorVscInitialize(
* VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER + struct vstor_packet + u64) * VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER + struct vstor_packet + u64)
*/ */
storDriver->MaxOutstandingRequestsPerChannel = storDriver->MaxOutstandingRequestsPerChannel =
((storDriver->RingBufferSize - PAGE_SIZE) / ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET + sizeof(struct vstor_packet) + sizeof(u64),sizeof(u64))); ((storDriver->RingBufferSize - PAGE_SIZE) /
ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET +
sizeof(struct vstor_packet) + sizeof(u64),
sizeof(u64)));
DPRINT_INFO(STORVSC, "max io %u, currently %u\n", storDriver->MaxOutstandingRequestsPerChannel, STORVSC_MAX_IO_REQUESTS); DPRINT_INFO(STORVSC, "max io %u, currently %u\n",
storDriver->MaxOutstandingRequestsPerChannel,
STORVSC_MAX_IO_REQUESTS);
/* Setup the dispatch table */ /* Setup the dispatch table */
storDriver->Base.OnDeviceAdd = StorVscOnDeviceAdd; storDriver->Base.OnDeviceAdd = StorVscOnDeviceAdd;
storDriver->Base.OnDeviceRemove = StorVscOnDeviceRemove; storDriver->Base.OnDeviceRemove = StorVscOnDeviceRemove;
storDriver->Base.OnCleanup = StorVscOnCleanup; storDriver->Base.OnCleanup = StorVscOnCleanup;
storDriver->OnIORequest = StorVscOnIORequest; storDriver->OnIORequest = StorVscOnIORequest;
storDriver->OnHostReset = StorVscOnHostReset; storDriver->OnHostReset = StorVscOnHostReset;
DPRINT_EXIT(STORVSC); DPRINT_EXIT(STORVSC);
return ret; return 0;
} }
/*++ /**
* StorVscOnDeviceAdd - Callback when the device belonging to this driver is added
Name: */
StorVscOnDeviceAdd() static int StorVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo)
Description:
Callback when the device belonging to this driver is added
--*/
static int
StorVscOnDeviceAdd(
struct hv_device *Device,
void *AdditionalInfo
)
{ {
int ret=0;
struct storvsc_device *storDevice; struct storvsc_device *storDevice;
/* struct vmstorage_channel_properties *props; */ /* struct vmstorage_channel_properties *props; */
struct storvsc_device_info *deviceInfo = (struct storvsc_device_info *)AdditionalInfo; struct storvsc_device_info *deviceInfo;
int ret = 0;
DPRINT_ENTER(STORVSC); DPRINT_ENTER(STORVSC);
deviceInfo = (struct storvsc_device_info *)AdditionalInfo;
storDevice = AllocStorDevice(Device); storDevice = AllocStorDevice(Device);
if (!storDevice) if (!storDevice) {
{
ret = -1; ret = -1;
goto Cleanup; goto Cleanup;
} }
/* Save the channel properties to our storvsc channel */ /* Save the channel properties to our storvsc channel */
/* props = (struct vmstorage_channel_properties *) channel->offerMsg.Offer.u.Standard.UserDefined; */ /* props = (struct vmstorage_channel_properties *)
* channel->offerMsg.Offer.u.Standard.UserDefined; */
/* FIXME: */ /* FIXME: */
/* /*
...@@ -349,7 +289,9 @@ StorVscOnDeviceAdd( ...@@ -349,7 +289,9 @@ StorVscOnDeviceAdd(
deviceInfo->PathId = storDevice->PathId; deviceInfo->PathId = storDevice->PathId;
deviceInfo->TargetId = storDevice->TargetId; deviceInfo->TargetId = storDevice->TargetId;
DPRINT_DBG(STORVSC, "assigned port %u, path %u target %u\n", storDevice->PortNumber, storDevice->PathId, storDevice->TargetId); DPRINT_DBG(STORVSC, "assigned port %u, path %u target %u\n",
storDevice->PortNumber, storDevice->PathId,
storDevice->TargetId);
Cleanup: Cleanup:
DPRINT_EXIT(STORVSC); DPRINT_EXIT(STORVSC);
...@@ -359,15 +301,15 @@ StorVscOnDeviceAdd( ...@@ -359,15 +301,15 @@ StorVscOnDeviceAdd(
static int StorVscChannelInit(struct hv_device *Device) static int StorVscChannelInit(struct hv_device *Device)
{ {
int ret=0;
struct storvsc_device *storDevice; struct storvsc_device *storDevice;
struct storvsc_request_extension *request; struct storvsc_request_extension *request;
struct vstor_packet *vstorPacket; struct vstor_packet *vstorPacket;
int ret;
storDevice = GetStorDevice(Device); storDevice = GetStorDevice(Device);
if (!storDevice) if (!storDevice) {
{ DPRINT_ERR(STORVSC, "unable to get stor device..."
DPRINT_ERR(STORVSC, "unable to get stor device...device being destroyed?"); "device being destroyed?");
DPRINT_EXIT(STORVSC); DPRINT_EXIT(STORVSC);
return -1; return -1;
} }
...@@ -375,8 +317,10 @@ static int StorVscChannelInit(struct hv_device *Device) ...@@ -375,8 +317,10 @@ static int StorVscChannelInit(struct hv_device *Device)
request = &storDevice->InitRequest; request = &storDevice->InitRequest;
vstorPacket = &request->VStorPacket; vstorPacket = &request->VStorPacket;
/* Now, initiate the vsc/vsp initialization protocol on the open channel */ /*
* Now, initiate the vsc/vsp initialization protocol on the open
* channel
*/
memset(request, sizeof(struct storvsc_request_extension), 0); memset(request, sizeof(struct storvsc_request_extension), 0);
request->WaitEvent = osd_WaitEventCreate(); request->WaitEvent = osd_WaitEventCreate();
...@@ -390,22 +334,24 @@ static int StorVscChannelInit(struct hv_device *Device) ...@@ -390,22 +334,24 @@ static int StorVscChannelInit(struct hv_device *Device)
DPRINT_INFO(STORVSC, "BEGIN_INITIALIZATION_OPERATION..."); DPRINT_INFO(STORVSC, "BEGIN_INITIALIZATION_OPERATION...");
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device, ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
vstorPacket, vstorPacket,
sizeof(struct vstor_packet), sizeof(struct vstor_packet),
(unsigned long)request, (unsigned long)request,
VmbusPacketTypeDataInBand, VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if ( ret != 0) if (ret != 0) {
{ DPRINT_ERR(STORVSC,
DPRINT_ERR(STORVSC, "unable to send BEGIN_INITIALIZATION_OPERATION"); "unable to send BEGIN_INITIALIZATION_OPERATION");
goto Cleanup; goto Cleanup;
} }
osd_WaitEventWait(request->WaitEvent); osd_WaitEventWait(request->WaitEvent);
if (vstorPacket->Operation != VStorOperationCompleteIo || vstorPacket->Status != 0) if (vstorPacket->Operation != VStorOperationCompleteIo ||
{ vstorPacket->Status != 0) {
DPRINT_ERR(STORVSC, "BEGIN_INITIALIZATION_OPERATION failed (op %d status 0x%x)", vstorPacket->Operation, vstorPacket->Status); DPRINT_ERR(STORVSC, "BEGIN_INITIALIZATION_OPERATION failed "
"(op %d status 0x%x)",
vstorPacket->Operation, vstorPacket->Status);
goto Cleanup; goto Cleanup;
} }
...@@ -416,27 +362,29 @@ static int StorVscChannelInit(struct hv_device *Device) ...@@ -416,27 +362,29 @@ static int StorVscChannelInit(struct hv_device *Device)
vstorPacket->Operation = VStorOperationQueryProtocolVersion; vstorPacket->Operation = VStorOperationQueryProtocolVersion;
vstorPacket->Flags = REQUEST_COMPLETION_FLAG; vstorPacket->Flags = REQUEST_COMPLETION_FLAG;
vstorPacket->Version.MajorMinor = VMSTOR_PROTOCOL_VERSION_CURRENT; vstorPacket->Version.MajorMinor = VMSTOR_PROTOCOL_VERSION_CURRENT;
FILL_VMSTOR_REVISION(vstorPacket->Version.Revision); FILL_VMSTOR_REVISION(vstorPacket->Version.Revision);
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device, ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
vstorPacket, vstorPacket,
sizeof(struct vstor_packet), sizeof(struct vstor_packet),
(unsigned long)request, (unsigned long)request,
VmbusPacketTypeDataInBand, VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if ( ret != 0) if (ret != 0) {
{ DPRINT_ERR(STORVSC,
DPRINT_ERR(STORVSC, "unable to send BEGIN_INITIALIZATION_OPERATION"); "unable to send BEGIN_INITIALIZATION_OPERATION");
goto Cleanup; goto Cleanup;
} }
osd_WaitEventWait(request->WaitEvent); osd_WaitEventWait(request->WaitEvent);
/* TODO: Check returned version */ /* TODO: Check returned version */
if (vstorPacket->Operation != VStorOperationCompleteIo || vstorPacket->Status != 0) if (vstorPacket->Operation != VStorOperationCompleteIo ||
{ vstorPacket->Status != 0) {
DPRINT_ERR(STORVSC, "QUERY_PROTOCOL_VERSION_OPERATION failed (op %d status 0x%x)", vstorPacket->Operation, vstorPacket->Status); DPRINT_ERR(STORVSC, "QUERY_PROTOCOL_VERSION_OPERATION failed "
"(op %d status 0x%x)",
vstorPacket->Operation, vstorPacket->Status);
goto Cleanup; goto Cleanup;
} }
...@@ -444,73 +392,76 @@ static int StorVscChannelInit(struct hv_device *Device) ...@@ -444,73 +392,76 @@ static int StorVscChannelInit(struct hv_device *Device)
DPRINT_INFO(STORVSC, "QUERY_PROPERTIES_OPERATION..."); DPRINT_INFO(STORVSC, "QUERY_PROPERTIES_OPERATION...");
memset(vstorPacket, sizeof(struct vstor_packet), 0); memset(vstorPacket, sizeof(struct vstor_packet), 0);
vstorPacket->Operation = VStorOperationQueryProperties; vstorPacket->Operation = VStorOperationQueryProperties;
vstorPacket->Flags = REQUEST_COMPLETION_FLAG; vstorPacket->Flags = REQUEST_COMPLETION_FLAG;
vstorPacket->StorageChannelProperties.PortNumber = storDevice->PortNumber; vstorPacket->StorageChannelProperties.PortNumber =
storDevice->PortNumber;
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device, ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
vstorPacket, vstorPacket,
sizeof(struct vstor_packet), sizeof(struct vstor_packet),
(unsigned long)request, (unsigned long)request,
VmbusPacketTypeDataInBand, VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if ( ret != 0) if (ret != 0) {
{ DPRINT_ERR(STORVSC,
DPRINT_ERR(STORVSC, "unable to send QUERY_PROPERTIES_OPERATION"); "unable to send QUERY_PROPERTIES_OPERATION");
goto Cleanup; goto Cleanup;
} }
osd_WaitEventWait(request->WaitEvent); osd_WaitEventWait(request->WaitEvent);
/* TODO: Check returned version */ /* TODO: Check returned version */
if (vstorPacket->Operation != VStorOperationCompleteIo || vstorPacket->Status != 0) if (vstorPacket->Operation != VStorOperationCompleteIo ||
{ vstorPacket->Status != 0) {
DPRINT_ERR(STORVSC, "QUERY_PROPERTIES_OPERATION failed (op %d status 0x%x)", vstorPacket->Operation, vstorPacket->Status); DPRINT_ERR(STORVSC, "QUERY_PROPERTIES_OPERATION failed "
"(op %d status 0x%x)",
vstorPacket->Operation, vstorPacket->Status);
goto Cleanup; goto Cleanup;
} }
/* storDevice->PortNumber = vstorPacket->StorageChannelProperties.PortNumber; */
storDevice->PathId = vstorPacket->StorageChannelProperties.PathId; storDevice->PathId = vstorPacket->StorageChannelProperties.PathId;
storDevice->TargetId = vstorPacket->StorageChannelProperties.TargetId; storDevice->TargetId = vstorPacket->StorageChannelProperties.TargetId;
DPRINT_DBG(STORVSC, "channel flag 0x%x, max xfer len 0x%x", vstorPacket->StorageChannelProperties.Flags, vstorPacket->StorageChannelProperties.MaxTransferBytes); DPRINT_DBG(STORVSC, "channel flag 0x%x, max xfer len 0x%x",
vstorPacket->StorageChannelProperties.Flags,
vstorPacket->StorageChannelProperties.MaxTransferBytes);
DPRINT_INFO(STORVSC, "END_INITIALIZATION_OPERATION..."); DPRINT_INFO(STORVSC, "END_INITIALIZATION_OPERATION...");
memset(vstorPacket, sizeof(struct vstor_packet), 0); memset(vstorPacket, sizeof(struct vstor_packet), 0);
vstorPacket->Operation = VStorOperationEndInitialization; vstorPacket->Operation = VStorOperationEndInitialization;
vstorPacket->Flags = REQUEST_COMPLETION_FLAG; vstorPacket->Flags = REQUEST_COMPLETION_FLAG;
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device, ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
vstorPacket, vstorPacket,
sizeof(struct vstor_packet), sizeof(struct vstor_packet),
(unsigned long)request, (unsigned long)request,
VmbusPacketTypeDataInBand, VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if ( ret != 0) if (ret != 0) {
{ DPRINT_ERR(STORVSC,
DPRINT_ERR(STORVSC, "unable to send END_INITIALIZATION_OPERATION"); "unable to send END_INITIALIZATION_OPERATION");
goto Cleanup; goto Cleanup;
} }
osd_WaitEventWait(request->WaitEvent); osd_WaitEventWait(request->WaitEvent);
if (vstorPacket->Operation != VStorOperationCompleteIo || vstorPacket->Status != 0) if (vstorPacket->Operation != VStorOperationCompleteIo ||
{ vstorPacket->Status != 0) {
DPRINT_ERR(STORVSC, "END_INITIALIZATION_OPERATION failed (op %d status 0x%x)", vstorPacket->Operation, vstorPacket->Status); DPRINT_ERR(STORVSC, "END_INITIALIZATION_OPERATION failed "
"(op %d status 0x%x)",
vstorPacket->Operation, vstorPacket->Status);
goto Cleanup; goto Cleanup;
} }
DPRINT_INFO(STORVSC, "**** storage channel up and running!! ****"); DPRINT_INFO(STORVSC, "**** storage channel up and running!! ****");
Cleanup: Cleanup:
if (request->WaitEvent) kfree(request->WaitEvent);
{ request->WaitEvent = NULL;
kfree(request->WaitEvent);
request->WaitEvent = NULL;
}
PutStorDevice(Device); PutStorDevice(Device);
...@@ -518,33 +469,28 @@ static int StorVscChannelInit(struct hv_device *Device) ...@@ -518,33 +469,28 @@ static int StorVscChannelInit(struct hv_device *Device)
return ret; return ret;
} }
static int StorVscConnectToVsp(struct hv_device *Device)
static int
StorVscConnectToVsp(
struct hv_device *Device
)
{ {
int ret=0;
struct vmstorage_channel_properties props; struct vmstorage_channel_properties props;
struct storvsc_driver_object *storDriver;
int ret;
struct storvsc_driver_object *storDriver = (struct storvsc_driver_object *)Device->Driver;; storDriver = (struct storvsc_driver_object *)Device->Driver;
memset(&props, sizeof(struct vmstorage_channel_properties), 0); memset(&props, sizeof(struct vmstorage_channel_properties), 0);
/* Open the channel */ /* Open the channel */
ret = Device->Driver->VmbusChannelInterface.Open(Device, ret = Device->Driver->VmbusChannelInterface.Open(Device,
storDriver->RingBufferSize, storDriver->RingBufferSize,
storDriver->RingBufferSize, storDriver->RingBufferSize,
(void *)&props, (void *)&props,
sizeof(struct vmstorage_channel_properties), sizeof(struct vmstorage_channel_properties),
StorVscOnChannelCallback, StorVscOnChannelCallback,
Device Device);
);
DPRINT_DBG(STORVSC, "storage props: path id %d, tgt id %d, max xfer %d",
DPRINT_DBG(STORVSC, "storage props: path id %d, tgt id %d, max xfer %d", props.PathId, props.TargetId, props.MaxTransferBytes); props.PathId, props.TargetId, props.MaxTransferBytes);
if (ret != 0) if (ret != 0) {
{
DPRINT_ERR(STORVSC, "unable to open channel: %d", ret); DPRINT_ERR(STORVSC, "unable to open channel: %d", ret);
return -1; return -1;
} }
...@@ -555,26 +501,17 @@ StorVscConnectToVsp( ...@@ -555,26 +501,17 @@ StorVscConnectToVsp(
} }
/*++ /**
* StorVscOnDeviceRemove - Callback when the our device is being removed
Name: */
StorVscOnDeviceRemove() static int StorVscOnDeviceRemove(struct hv_device *Device)
Description:
Callback when the our device is being removed
--*/
static int
StorVscOnDeviceRemove(
struct hv_device *Device
)
{ {
struct storvsc_device *storDevice; struct storvsc_device *storDevice;
int ret=0;
DPRINT_ENTER(STORVSC); DPRINT_ENTER(STORVSC);
DPRINT_INFO(STORVSC, "disabling storage device (%p)...", Device->Extension); DPRINT_INFO(STORVSC, "disabling storage device (%p)...",
Device->Extension);
storDevice = ReleaseStorDevice(Device); storDevice = ReleaseStorDevice(Device);
...@@ -583,14 +520,14 @@ StorVscOnDeviceRemove( ...@@ -583,14 +520,14 @@ StorVscOnDeviceRemove(
* only allow inbound traffic (responses) to proceed so that * only allow inbound traffic (responses) to proceed so that
* outstanding requests can be completed. * outstanding requests can be completed.
*/ */
while (atomic_read(&storDevice->NumOutstandingRequests)) while (atomic_read(&storDevice->NumOutstandingRequests)) {
{ DPRINT_INFO(STORVSC, "waiting for %d requests to complete...",
DPRINT_INFO(STORVSC, "waiting for %d requests to complete...", atomic_read(&storDevice->NumOutstandingRequests)); atomic_read(&storDevice->NumOutstandingRequests));
udelay(100); udelay(100);
} }
DPRINT_INFO(STORVSC, "removing storage device (%p)...", Device->Extension); DPRINT_INFO(STORVSC, "removing storage device (%p)...",
Device->Extension);
storDevice = FinalReleaseStorDevice(Device); storDevice = FinalReleaseStorDevice(Device);
...@@ -602,46 +539,24 @@ StorVscOnDeviceRemove( ...@@ -602,46 +539,24 @@ StorVscOnDeviceRemove(
FreeStorDevice(storDevice); FreeStorDevice(storDevice);
DPRINT_EXIT(STORVSC); DPRINT_EXIT(STORVSC);
return ret; return 0;
}
/* ***************
static void
StorVscOnTargetRescan(
void *Context
)
{
struct hv_device *device=(struct hv_device *)Context;
struct storvsc_driver_object *storDriver;
DPRINT_ENTER(STORVSC);
storDriver = (struct storvsc_driver_object*) device->Driver;
storDriver->OnHostRescan(device);
DPRINT_EXIT(STORVSC);
} }
*********** */
static int static int StorVscOnHostReset(struct hv_device *Device)
StorVscOnHostReset(
struct hv_device *Device
)
{ {
int ret=0;
struct storvsc_device *storDevice; struct storvsc_device *storDevice;
struct storvsc_request_extension *request; struct storvsc_request_extension *request;
struct vstor_packet *vstorPacket; struct vstor_packet *vstorPacket;
int ret;
DPRINT_ENTER(STORVSC); DPRINT_ENTER(STORVSC);
DPRINT_INFO(STORVSC, "resetting host adapter..."); DPRINT_INFO(STORVSC, "resetting host adapter...");
storDevice = GetStorDevice(Device); storDevice = GetStorDevice(Device);
if (!storDevice) if (!storDevice) {
{ DPRINT_ERR(STORVSC, "unable to get stor device..."
DPRINT_ERR(STORVSC, "unable to get stor device...device being destroyed?"); "device being destroyed?");
DPRINT_EXIT(STORVSC); DPRINT_EXIT(STORVSC);
return -1; return -1;
} }
...@@ -651,19 +566,19 @@ StorVscOnHostReset( ...@@ -651,19 +566,19 @@ StorVscOnHostReset(
request->WaitEvent = osd_WaitEventCreate(); request->WaitEvent = osd_WaitEventCreate();
vstorPacket->Operation = VStorOperationResetBus; vstorPacket->Operation = VStorOperationResetBus;
vstorPacket->Flags = REQUEST_COMPLETION_FLAG; vstorPacket->Flags = REQUEST_COMPLETION_FLAG;
vstorPacket->VmSrb.PathId = storDevice->PathId; vstorPacket->VmSrb.PathId = storDevice->PathId;
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device, ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
vstorPacket, vstorPacket,
sizeof(struct vstor_packet), sizeof(struct vstor_packet),
(unsigned long)&storDevice->ResetRequest, (unsigned long)&storDevice->ResetRequest,
VmbusPacketTypeDataInBand, VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) if (ret != 0) {
{ DPRINT_ERR(STORVSC, "Unable to send reset packet %p ret %d",
DPRINT_ERR(STORVSC, "Unable to send reset packet %p ret %d", vstorPacket, ret); vstorPacket, ret);
goto Cleanup; goto Cleanup;
} }
...@@ -684,44 +599,41 @@ StorVscOnHostReset( ...@@ -684,44 +599,41 @@ StorVscOnHostReset(
return ret; return ret;
} }
/*++ /**
* StorVscOnIORequest - Callback to initiate an I/O request
Name: */
StorVscOnIORequest() static int StorVscOnIORequest(struct hv_device *Device,
struct hv_storvsc_request *Request)
Description:
Callback to initiate an I/O request
--*/
static int
StorVscOnIORequest(
struct hv_device *Device,
struct hv_storvsc_request *Request
)
{ {
struct storvsc_device *storDevice; struct storvsc_device *storDevice;
struct storvsc_request_extension* requestExtension = (struct storvsc_request_extension*) Request->Extension; struct storvsc_request_extension *requestExtension;
struct vstor_packet *vstorPacket =&requestExtension->VStorPacket; struct vstor_packet *vstorPacket;
int ret=0; int ret = 0;
DPRINT_ENTER(STORVSC); DPRINT_ENTER(STORVSC);
requestExtension =
(struct storvsc_request_extension *)Request->Extension;
vstorPacket = &requestExtension->VStorPacket;
storDevice = GetStorDevice(Device); storDevice = GetStorDevice(Device);
DPRINT_DBG(STORVSC, "enter - Device %p, DeviceExt %p, Request %p, Extension %p", DPRINT_DBG(STORVSC, "enter - Device %p, DeviceExt %p, Request %p, "
Device, storDevice, Request, requestExtension); "Extension %p", Device, storDevice, Request,
requestExtension);
DPRINT_DBG(STORVSC, "req %p len %d bus %d, target %d, lun %d cdblen %d", DPRINT_DBG(STORVSC, "req %p len %d bus %d, target %d, lun %d cdblen %d",
Request, Request->DataBuffer.Length, Request->Bus, Request->TargetId, Request->LunId, Request->CdbLen); Request, Request->DataBuffer.Length, Request->Bus,
Request->TargetId, Request->LunId, Request->CdbLen);
if (!storDevice) if (!storDevice) {
{ DPRINT_ERR(STORVSC, "unable to get stor device..."
DPRINT_ERR(STORVSC, "unable to get stor device...device being destroyed?"); "device being destroyed?");
DPRINT_EXIT(STORVSC); DPRINT_EXIT(STORVSC);
return -2; return -2;
} }
/* print_hex_dump_bytes("", DUMP_PREFIX_NONE, Request->Cdb, Request->CdbLen); */ /* print_hex_dump_bytes("", DUMP_PREFIX_NONE, Request->Cdb,
* Request->CdbLen); */
requestExtension->Request = Request; requestExtension->Request = Request;
requestExtension->Device = Device; requestExtension->Device = Device;
...@@ -730,17 +642,17 @@ StorVscOnIORequest( ...@@ -730,17 +642,17 @@ StorVscOnIORequest(
vstorPacket->Flags |= REQUEST_COMPLETION_FLAG; vstorPacket->Flags |= REQUEST_COMPLETION_FLAG;
vstorPacket->VmSrb.Length = sizeof(struct vmscsi_request); vstorPacket->VmSrb.Length = sizeof(struct vmscsi_request);
vstorPacket->VmSrb.PortNumber = Request->Host; vstorPacket->VmSrb.PortNumber = Request->Host;
vstorPacket->VmSrb.PathId = Request->Bus; vstorPacket->VmSrb.PathId = Request->Bus;
vstorPacket->VmSrb.TargetId = Request->TargetId; vstorPacket->VmSrb.TargetId = Request->TargetId;
vstorPacket->VmSrb.Lun = Request->LunId; vstorPacket->VmSrb.Lun = Request->LunId;
vstorPacket->VmSrb.SenseInfoLength = SENSE_BUFFER_SIZE; vstorPacket->VmSrb.SenseInfoLength = SENSE_BUFFER_SIZE;
/* Copy over the scsi command descriptor block */ /* Copy over the scsi command descriptor block */
vstorPacket->VmSrb.CdbLength = Request->CdbLen; vstorPacket->VmSrb.CdbLength = Request->CdbLen;
memcpy(&vstorPacket->VmSrb.Cdb, Request->Cdb, Request->CdbLen); memcpy(&vstorPacket->VmSrb.Cdb, Request->Cdb, Request->CdbLen);
vstorPacket->VmSrb.DataIn = Request->Type; vstorPacket->VmSrb.DataIn = Request->Type;
...@@ -748,36 +660,35 @@ StorVscOnIORequest( ...@@ -748,36 +660,35 @@ StorVscOnIORequest(
vstorPacket->Operation = VStorOperationExecuteSRB; vstorPacket->Operation = VStorOperationExecuteSRB;
DPRINT_DBG(STORVSC, "srb - len %d port %d, path %d, target %d, lun %d senselen %d cdblen %d", DPRINT_DBG(STORVSC, "srb - len %d port %d, path %d, target %d, "
vstorPacket->VmSrb.Length, "lun %d senselen %d cdblen %d",
vstorPacket->VmSrb.PortNumber, vstorPacket->VmSrb.Length,
vstorPacket->VmSrb.PathId, vstorPacket->VmSrb.PortNumber,
vstorPacket->VmSrb.TargetId, vstorPacket->VmSrb.PathId,
vstorPacket->VmSrb.Lun, vstorPacket->VmSrb.TargetId,
vstorPacket->VmSrb.SenseInfoLength, vstorPacket->VmSrb.Lun,
vstorPacket->VmSrb.CdbLength); vstorPacket->VmSrb.SenseInfoLength,
vstorPacket->VmSrb.CdbLength);
if (requestExtension->Request->DataBuffer.Length)
{ if (requestExtension->Request->DataBuffer.Length) {
ret = Device->Driver->VmbusChannelInterface.SendPacketMultiPageBuffer(Device, ret = Device->Driver->VmbusChannelInterface.
SendPacketMultiPageBuffer(Device,
&requestExtension->Request->DataBuffer, &requestExtension->Request->DataBuffer,
vstorPacket, vstorPacket,
sizeof(struct vstor_packet), sizeof(struct vstor_packet),
(unsigned long)requestExtension); (unsigned long)requestExtension);
} } else {
else
{
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device, ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
vstorPacket, vstorPacket,
sizeof(struct vstor_packet), sizeof(struct vstor_packet),
(unsigned long)requestExtension, (unsigned long)requestExtension,
VmbusPacketTypeDataInBand, VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
} }
if (ret != 0) if (ret != 0) {
{ DPRINT_DBG(STORVSC, "Unable to send packet %p ret %d",
DPRINT_DBG(STORVSC, "Unable to send packet %p ret %d", vstorPacket, ret); vstorPacket, ret);
} }
atomic_inc(&storDevice->NumOutstandingRequests); atomic_inc(&storDevice->NumOutstandingRequests);
...@@ -788,31 +699,18 @@ StorVscOnIORequest( ...@@ -788,31 +699,18 @@ StorVscOnIORequest(
return ret; return ret;
} }
/*++ /**
* StorVscOnCleanup - Perform any cleanup when the driver is removed
Name: */
StorVscOnCleanup() static void StorVscOnCleanup(struct hv_driver *Driver)
Description:
Perform any cleanup when the driver is removed
--*/
static void
StorVscOnCleanup(
struct hv_driver *Driver
)
{ {
DPRINT_ENTER(STORVSC); DPRINT_ENTER(STORVSC);
DPRINT_EXIT(STORVSC); DPRINT_EXIT(STORVSC);
} }
static void StorVscOnIOCompletion(struct hv_device *Device,
static void struct vstor_packet *VStorPacket,
StorVscOnIOCompletion( struct storvsc_request_extension *RequestExt)
struct hv_device *Device,
struct vstor_packet *VStorPacket,
struct storvsc_request_extension *RequestExt
)
{ {
struct hv_storvsc_request *request; struct hv_storvsc_request *request;
struct storvsc_device *storDevice; struct storvsc_device *storDevice;
...@@ -820,15 +718,16 @@ StorVscOnIOCompletion( ...@@ -820,15 +718,16 @@ StorVscOnIOCompletion(
DPRINT_ENTER(STORVSC); DPRINT_ENTER(STORVSC);
storDevice = MustGetStorDevice(Device); storDevice = MustGetStorDevice(Device);
if (!storDevice) if (!storDevice) {
{ DPRINT_ERR(STORVSC, "unable to get stor device..."
DPRINT_ERR(STORVSC, "unable to get stor device...device being destroyed?"); "device being destroyed?");
DPRINT_EXIT(STORVSC); DPRINT_EXIT(STORVSC);
return; return;
} }
DPRINT_DBG(STORVSC, "IO_COMPLETE_OPERATION - request extension %p completed bytes xfer %u", DPRINT_DBG(STORVSC, "IO_COMPLETE_OPERATION - request extension %p "
RequestExt, VStorPacket->VmSrb.DataTransferLength); "completed bytes xfer %u", RequestExt,
VStorPacket->VmSrb.DataTransferLength);
ASSERT(RequestExt != NULL); ASSERT(RequestExt != NULL);
ASSERT(RequestExt->Request != NULL); ASSERT(RequestExt->Request != NULL);
...@@ -840,27 +739,29 @@ StorVscOnIOCompletion( ...@@ -840,27 +739,29 @@ StorVscOnIOCompletion(
/* Copy over the status...etc */ /* Copy over the status...etc */
request->Status = VStorPacket->VmSrb.ScsiStatus; request->Status = VStorPacket->VmSrb.ScsiStatus;
if (request->Status != 0 || VStorPacket->VmSrb.SrbStatus != 1) if (request->Status != 0 || VStorPacket->VmSrb.SrbStatus != 1) {
{ DPRINT_WARN(STORVSC,
DPRINT_WARN(STORVSC, "cmd 0x%x scsi status 0x%x srb status 0x%x\n", "cmd 0x%x scsi status 0x%x srb status 0x%x\n",
request->Cdb[0], request->Cdb[0], VStorPacket->VmSrb.ScsiStatus,
VStorPacket->VmSrb.ScsiStatus, VStorPacket->VmSrb.SrbStatus);
VStorPacket->VmSrb.SrbStatus);
} }
if ((request->Status & 0xFF) == 0x02) /* CHECK_CONDITION */ if ((request->Status & 0xFF) == 0x02) {
{ /* CHECK_CONDITION */
if (VStorPacket->VmSrb.SrbStatus & 0x80) /* autosense data available */ if (VStorPacket->VmSrb.SrbStatus & 0x80) {
{ /* autosense data available */
DPRINT_WARN(STORVSC, "storvsc pkt %p autosense data valid - len %d\n", DPRINT_WARN(STORVSC, "storvsc pkt %p autosense data "
RequestExt, VStorPacket->VmSrb.SenseInfoLength); "valid - len %d\n", RequestExt,
VStorPacket->VmSrb.SenseInfoLength);
ASSERT(VStorPacket->VmSrb.SenseInfoLength <= request->SenseBufferSize); ASSERT(VStorPacket->VmSrb.SenseInfoLength <=
request->SenseBufferSize);
memcpy(request->SenseBuffer, memcpy(request->SenseBuffer,
VStorPacket->VmSrb.SenseData, VStorPacket->VmSrb.SenseData,
VStorPacket->VmSrb.SenseInfoLength); VStorPacket->VmSrb.SenseInfoLength);
request->SenseBufferSize = VStorPacket->VmSrb.SenseInfoLength; request->SenseBufferSize =
VStorPacket->VmSrb.SenseInfoLength;
} }
} }
...@@ -877,97 +778,83 @@ StorVscOnIOCompletion( ...@@ -877,97 +778,83 @@ StorVscOnIOCompletion(
} }
static void static void StorVscOnReceive(struct hv_device *Device,
StorVscOnReceive( struct vstor_packet *VStorPacket,
struct hv_device *Device, struct storvsc_request_extension *RequestExt)
struct vstor_packet *VStorPacket,
struct storvsc_request_extension *RequestExt
)
{ {
switch(VStorPacket->Operation) switch (VStorPacket->Operation) {
{ case VStorOperationCompleteIo:
case VStorOperationCompleteIo: DPRINT_DBG(STORVSC, "IO_COMPLETE_OPERATION");
StorVscOnIOCompletion(Device, VStorPacket, RequestExt);
DPRINT_DBG(STORVSC, "IO_COMPLETE_OPERATION"); break;
StorVscOnIOCompletion(Device, VStorPacket, RequestExt);
break;
/* case ENUMERATE_DEVICE_OPERATION: */
/* DPRINT_INFO(STORVSC, "ENUMERATE_DEVICE_OPERATION"); */
/* StorVscOnTargetRescan(Device); */
/* break; */
case VStorOperationRemoveDevice: case VStorOperationRemoveDevice:
DPRINT_INFO(STORVSC, "REMOVE_DEVICE_OPERATION");
DPRINT_INFO(STORVSC, "REMOVE_DEVICE_OPERATION"); /* TODO: */
/* TODO: */ break;
break;
default:
default: DPRINT_INFO(STORVSC, "Unknown operation received - %d",
DPRINT_INFO(STORVSC, "Unknown operation received - %d", VStorPacket->Operation); VStorPacket->Operation);
break; break;
} }
} }
static void static void StorVscOnChannelCallback(void *context)
StorVscOnChannelCallback(
void * Context
)
{ {
int ret=0; struct hv_device *device = (struct hv_device *)context;
struct hv_device *device = (struct hv_device*)Context;
struct storvsc_device *storDevice; struct storvsc_device *storDevice;
u32 bytesRecvd; u32 bytesRecvd;
u64 requestId; u64 requestId;
unsigned char packet[ALIGN_UP(sizeof(struct vstor_packet),8)]; unsigned char packet[ALIGN_UP(sizeof(struct vstor_packet), 8)];
struct storvsc_request_extension *request; struct storvsc_request_extension *request;
int ret;
DPRINT_ENTER(STORVSC); DPRINT_ENTER(STORVSC);
ASSERT(device); ASSERT(device);
storDevice = MustGetStorDevice(device); storDevice = MustGetStorDevice(device);
if (!storDevice) if (!storDevice) {
{ DPRINT_ERR(STORVSC, "unable to get stor device..."
DPRINT_ERR(STORVSC, "unable to get stor device...device being destroyed?"); "device being destroyed?");
DPRINT_EXIT(STORVSC); DPRINT_EXIT(STORVSC);
return; return;
} }
do do {
{
ret = device->Driver->VmbusChannelInterface.RecvPacket(device, ret = device->Driver->VmbusChannelInterface.RecvPacket(device,
packet, packet,
ALIGN_UP(sizeof(struct vstor_packet),8), ALIGN_UP(sizeof(struct vstor_packet), 8),
&bytesRecvd, &bytesRecvd, &requestId);
&requestId); if (ret == 0 && bytesRecvd > 0) {
if (ret == 0 && bytesRecvd > 0) DPRINT_DBG(STORVSC, "receive %d bytes - tid %llx",
{ bytesRecvd, requestId);
DPRINT_DBG(STORVSC, "receive %d bytes - tid %llx", bytesRecvd, requestId);
/* ASSERT(bytesRecvd == sizeof(struct vstor_packet)); */ /* ASSERT(bytesRecvd == sizeof(struct vstor_packet)); */
request = (struct storvsc_request_extension*)(unsigned long)requestId; request = (struct storvsc_request_extension *)
(unsigned long)requestId;
ASSERT(request); ASSERT(request);
/* if (vstorPacket.Flags & SYNTHETIC_FLAG) */ /* if (vstorPacket.Flags & SYNTHETIC_FLAG) */
if ((request == &storDevice->InitRequest) || (request == &storDevice->ResetRequest)) if ((request == &storDevice->InitRequest) ||
{ (request == &storDevice->ResetRequest)) {
/* DPRINT_INFO(STORVSC, "reset completion - operation %u status %u", vstorPacket.Operation, vstorPacket.Status); */ /* DPRINT_INFO(STORVSC,
* "reset completion - operation "
* "%u status %u",
* vstorPacket.Operation,
* vstorPacket.Status); */
memcpy(&request->VStorPacket, packet, sizeof(struct vstor_packet)); memcpy(&request->VStorPacket, packet,
sizeof(struct vstor_packet));
osd_WaitEventSet(request->WaitEvent); osd_WaitEventSet(request->WaitEvent);
} else {
StorVscOnReceive(device,
(struct vstor_packet *)packet,
request);
} }
else } else {
{
StorVscOnReceive(device, (struct vstor_packet *)packet, request);
}
}
else
{
/* DPRINT_DBG(STORVSC, "nothing else to read..."); */ /* DPRINT_DBG(STORVSC, "nothing else to read..."); */
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment