From: Vadim Rozenfeld <vrozenfe@redhat.com>
To: kvm@vger.kernel.org
Subject: [PATCH] viostor driver. Complete SRBs at DPC level
Date: Sun, 25 Oct 2009 13:15:03 +0200 [thread overview]
Message-ID: <4AE43337.1030808@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 4634 bytes --]
repository: /home/vadimr/shares/kvm-guest-drivers-windows
branch: master
commit c507d6b279010ff1e1939927d2b2e91a59daac3b
Author: Vadim Rozenfeld<vrozenfe@redhat.com>
Date: Thu Sep 24 22:03:00 2009 +0300
[PATCH] viostor driver. Complete SRBs at DPC level
Signed-off-by: Vadim Rozenfeld<vrozenfe@redhat.com>
diff --git a/viostor/virtio_stor.c b/viostor/virtio_stor.c
index 297949a..375021b 100644
--- a/viostor/virtio_stor.c
+++ b/viostor/virtio_stor.c
@@ -30,6 +30,14 @@ VirtIoBuildIo(
IN PVOID DeviceExtension,
IN PSCSI_REQUEST_BLOCK Srb
);
+
+VOID
+CompleteDpcRoutine(
+ IN PSTOR_DPC Dpc,
+ IN PVOID Context,
+ IN PVOID SystemArgument1,
+ IN PVOID SystemArgument2
+ ) ;
#endif
BOOLEAN
@@ -91,6 +99,13 @@ CompleteSRB(
IN PSCSI_REQUEST_BLOCK Srb
);
+VOID
+FORCEINLINE
+CompleteDPC(
+ IN PVOID DeviceExtension,
+ IN pblk_req vbr
+ );
+
ULONG
DriverEntry(
IN PVOID DriverObject,
@@ -325,10 +340,28 @@ VirtIoFindAdapter(
}
InitializeListHead(&adaptExt->list_head);
+ InitializeListHead(&adaptExt->complete_list);
return SP_RETURN_FOUND;
}
+#ifdef USE_STORPORT
+BOOLEAN
+VirtIoPassiveInitializeRoutine (
+ IN PVOID DeviceExtension
+ )
+{
+ PADAPTER_EXTENSION adaptExt = (PADAPTER_EXTENSION)DeviceExtension;
+
+ StorPortInitializeDpc(DeviceExtension,
+&adaptExt->completion_dpc,
+ CompleteDpcRoutine);
+
+ return TRUE;
+}
+#endif
+
+
BOOLEAN
VirtIoHwInitialize(
IN PVOID DeviceExtension
@@ -400,6 +433,13 @@ VirtIoHwInitialize(
ScsiPortMoveMemory(&adaptExt->inquiry_data.ProductRevisionLevel, "0001", sizeof("0001"));
ScsiPortMoveMemory(&adaptExt->inquiry_data.VendorSpecific, "0001", sizeof("0001"));
+#ifdef USE_STORPORT
+ if(!adaptExt->dump_mode)
+ {
+ return StorPortEnablePassiveInitialization(DeviceExtension, VirtIoPassiveInitializeRoutine);
+ }
+#endif
+
return TRUE;
}
@@ -564,8 +604,7 @@ VirtIoInterrupt(
Srb->SrbStatus = SRB_STATUS_ERROR;
break;
}
- RemoveEntryList(&vbr->list_entry);
- CompleteSRB(DeviceExtension, Srb);
+ CompleteDPC(DeviceExtension, vbr);
}
}
RhelDbgPrint(TRACE_LEVEL_VERBOSE, ("%s isInterruptServiced = %d\n", __FUNCTION__, isInterruptServiced));
@@ -974,3 +1013,63 @@ CompleteSRB(
Srb->Lun);
#endif
}
+
+VOID
+FORCEINLINE
+CompleteDPC(
+ IN PVOID DeviceExtension,
+ IN pblk_req vbr
+ )
+{
+ PSCSI_REQUEST_BLOCK Srb = (PSCSI_REQUEST_BLOCK)vbr->req;
+ PADAPTER_EXTENSION adaptExt = (PADAPTER_EXTENSION)DeviceExtension;
+
+ RemoveEntryList(&vbr->list_entry);
+
+#ifdef USE_STORPORT
+ if(!adaptExt->dump_mode) {
+ InsertTailList(&adaptExt->complete_list,&vbr->list_entry);
+ StorPortIssueDpc(DeviceExtension,
+&adaptExt->completion_dpc,
+ NULL,
+ NULL);
+ return;
+ }
+#endif
+ CompleteSRB(DeviceExtension, Srb);
+}
+
+
+VOID
+CompleteDpcRoutine(
+ IN PSTOR_DPC Dpc,
+ IN PVOID Context,
+ IN PVOID SystemArgument1,
+ IN PVOID SystemArgument2
+ )
+{
+ STOR_LOCK_HANDLE LockHandle;
+ PADAPTER_EXTENSION adaptExt = (PADAPTER_EXTENSION)Context;
+
+ StorPortAcquireSpinLock ( Context, InterruptLock , NULL,&LockHandle);
+
+ while (!IsListEmpty(&adaptExt->complete_list)) {
+ PSCSI_REQUEST_BLOCK Srb;
+ pblk_req vbr;
+ vbr = (pblk_req) RemoveHeadList(&adaptExt->complete_list);
+ Srb = (PSCSI_REQUEST_BLOCK)vbr->req;
+
+ StorPortReleaseSpinLock (Context,&LockHandle);
+
+ ScsiPortNotification(RequestComplete,
+ Context,
+ Srb);
+
+ StorPortAcquireSpinLock ( Context, InterruptLock , NULL,&LockHandle);
+
+ }
+
+ StorPortReleaseSpinLock (Context,&LockHandle);
+
+ return;
+}
diff --git a/viostor/virtio_stor.h b/viostor/virtio_stor.h
index 2d98738..2533148 100644
--- a/viostor/virtio_stor.h
+++ b/viostor/virtio_stor.h
@@ -95,6 +95,8 @@ typedef struct _ADAPTER_EXTENSION {
ULONG queue_depth;
BOOLEAN dump_mode;
LIST_ENTRY list_head;
+ LIST_ENTRY complete_list;
+ STOR_DPC completion_dpc;
}ADAPTER_EXTENSION, *PADAPTER_EXTENSION;
typedef struct _RHEL_SRB_EXTENSION {
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[-- Attachment #2: complete_srbs_at_dpc_level.patch --]
[-- Type: text/plain, Size: 4146 bytes --]
diff --git a/viostor/virtio_stor.c b/viostor/virtio_stor.c
index 297949a..375021b 100644
--- a/viostor/virtio_stor.c
+++ b/viostor/virtio_stor.c
@@ -30,6 +30,14 @@ VirtIoBuildIo(
IN PVOID DeviceExtension,
IN PSCSI_REQUEST_BLOCK Srb
);
+
+VOID
+CompleteDpcRoutine(
+ IN PSTOR_DPC Dpc,
+ IN PVOID Context,
+ IN PVOID SystemArgument1,
+ IN PVOID SystemArgument2
+ ) ;
#endif
BOOLEAN
@@ -91,6 +99,13 @@ CompleteSRB(
IN PSCSI_REQUEST_BLOCK Srb
);
+VOID
+FORCEINLINE
+CompleteDPC(
+ IN PVOID DeviceExtension,
+ IN pblk_req vbr
+ );
+
ULONG
DriverEntry(
IN PVOID DriverObject,
@@ -325,10 +340,28 @@ VirtIoFindAdapter(
}
InitializeListHead(&adaptExt->list_head);
+ InitializeListHead(&adaptExt->complete_list);
return SP_RETURN_FOUND;
}
+#ifdef USE_STORPORT
+BOOLEAN
+VirtIoPassiveInitializeRoutine (
+ IN PVOID DeviceExtension
+ )
+{
+ PADAPTER_EXTENSION adaptExt = (PADAPTER_EXTENSION)DeviceExtension;
+
+ StorPortInitializeDpc(DeviceExtension,
+ &adaptExt->completion_dpc,
+ CompleteDpcRoutine);
+
+ return TRUE;
+}
+#endif
+
+
BOOLEAN
VirtIoHwInitialize(
IN PVOID DeviceExtension
@@ -400,6 +433,13 @@ VirtIoHwInitialize(
ScsiPortMoveMemory(&adaptExt->inquiry_data.ProductRevisionLevel, "0001", sizeof("0001"));
ScsiPortMoveMemory(&adaptExt->inquiry_data.VendorSpecific, "0001", sizeof("0001"));
+#ifdef USE_STORPORT
+ if(!adaptExt->dump_mode)
+ {
+ return StorPortEnablePassiveInitialization(DeviceExtension, VirtIoPassiveInitializeRoutine);
+ }
+#endif
+
return TRUE;
}
@@ -564,8 +604,7 @@ VirtIoInterrupt(
Srb->SrbStatus = SRB_STATUS_ERROR;
break;
}
- RemoveEntryList(&vbr->list_entry);
- CompleteSRB(DeviceExtension, Srb);
+ CompleteDPC(DeviceExtension, vbr);
}
}
RhelDbgPrint(TRACE_LEVEL_VERBOSE, ("%s isInterruptServiced = %d\n", __FUNCTION__, isInterruptServiced));
@@ -974,3 +1013,63 @@ CompleteSRB(
Srb->Lun);
#endif
}
+
+VOID
+FORCEINLINE
+CompleteDPC(
+ IN PVOID DeviceExtension,
+ IN pblk_req vbr
+ )
+{
+ PSCSI_REQUEST_BLOCK Srb = (PSCSI_REQUEST_BLOCK)vbr->req;
+ PADAPTER_EXTENSION adaptExt = (PADAPTER_EXTENSION)DeviceExtension;
+
+ RemoveEntryList(&vbr->list_entry);
+
+#ifdef USE_STORPORT
+ if(!adaptExt->dump_mode) {
+ InsertTailList(&adaptExt->complete_list, &vbr->list_entry);
+ StorPortIssueDpc(DeviceExtension,
+ &adaptExt->completion_dpc,
+ NULL,
+ NULL);
+ return;
+ }
+#endif
+ CompleteSRB(DeviceExtension, Srb);
+}
+
+
+VOID
+CompleteDpcRoutine(
+ IN PSTOR_DPC Dpc,
+ IN PVOID Context,
+ IN PVOID SystemArgument1,
+ IN PVOID SystemArgument2
+ )
+{
+ STOR_LOCK_HANDLE LockHandle;
+ PADAPTER_EXTENSION adaptExt = (PADAPTER_EXTENSION)Context;
+
+ StorPortAcquireSpinLock ( Context, InterruptLock , NULL, &LockHandle);
+
+ while (!IsListEmpty(&adaptExt->complete_list)) {
+ PSCSI_REQUEST_BLOCK Srb;
+ pblk_req vbr;
+ vbr = (pblk_req) RemoveHeadList(&adaptExt->complete_list);
+ Srb = (PSCSI_REQUEST_BLOCK)vbr->req;
+
+ StorPortReleaseSpinLock (Context, &LockHandle);
+
+ ScsiPortNotification(RequestComplete,
+ Context,
+ Srb);
+
+ StorPortAcquireSpinLock ( Context, InterruptLock , NULL, &LockHandle);
+
+ }
+
+ StorPortReleaseSpinLock (Context, &LockHandle);
+
+ return;
+}
diff --git a/viostor/virtio_stor.h b/viostor/virtio_stor.h
index 2d98738..2533148 100644
--- a/viostor/virtio_stor.h
+++ b/viostor/virtio_stor.h
@@ -95,6 +95,8 @@ typedef struct _ADAPTER_EXTENSION {
ULONG queue_depth;
BOOLEAN dump_mode;
LIST_ENTRY list_head;
+ LIST_ENTRY complete_list;
+ STOR_DPC completion_dpc;
}ADAPTER_EXTENSION, *PADAPTER_EXTENSION;
typedef struct _RHEL_SRB_EXTENSION {
reply other threads:[~2009-10-25 11:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AE43337.1030808@redhat.com \
--to=vrozenfe@redhat.com \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.