[ofw] [Patch 22/62] Reference implementation of NDv2
Fab Tillier
ftillier at microsoft.com
Wed Feb 20 17:49:52 PST 2013
WinVerbs and WinMad don't handle IRP_MJ_CLEANUP and IRP_MJ_CLOSE properly. This patch pulls in a bug fix Sean applied in anger to the trunk.
Also minor code style tweaks to keep the code consistent.
Signed-off-by: Fab Tillier <ftillier at microsoft.com>
diff -dwup3 -x *svn* -x *makefile.inc -x *sources -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\winmad\kernel\wm_driver.c .\core\winmad\kernel\wm_driver.c
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\winmad\kernel\wm_driver.c Thu Mar 29 00:15:17 2012
+++ .\core\winmad\kernel\wm_driver.c Thu Jul 26 16:48:04 2012
@@ -178,12 +178,24 @@ static VOID WmFileCreate(WDFDEVICE Devic
static VOID WmFileCleanup(WDFFILEOBJECT FileObject)
{
+ LIST_ENTRY *entry;
WM_PROVIDER *prov = WmProviderGetContext(FileObject);
+ WM_PROVIDER *prov_entry;
KeAcquireGuardedMutex(&Lock);
+ for (entry = ProvList.Flink; entry != &ProvList; entry = entry->Flink) {
+ prov_entry = CONTAINING_RECORD(entry, WM_PROVIDER, Entry);
+ if (prov == prov_entry) {
RemoveEntryList(&prov->Entry);
+ goto found;
+ }
+ }
+ prov = NULL;
+found:
KeReleaseGuardedMutex(&Lock);
+ if (prov) {
WmProviderCleanup(prov);
+ }
}
static VOID WmFileClose(WDFFILEOBJECT FileObject)
@@ -350,9 +362,7 @@ static NTSTATUS WmPowerD0Entry(WDFDEVICE
}
if (!NT_SUCCESS(status)) {
goto exit;
- }
- else
- {
+ } else {
if( VerbsVersion(VERBS_MAJOR_VER, VERBS_MINOR_VER) != dev->VerbsInterface.InterfaceHeader.Version )
{
WmDbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL,"WinMad: GUID_RDMA_INTERFACE_VERBS version mismatch: requested version=%d, returned version=%d.\n",
@@ -381,9 +391,7 @@ static NTSTATUS WmPowerD0Entry(WDFDEVICE
AL_INTERFACE_VERSION, NULL);
if (!NT_SUCCESS(status)) {
goto exit;
- }
- else
- {
+ } else {
if( AL_INTERFACE_VERSION != dev->IbInterface.wdm.Version )
{
WmDbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL,"WinMad: GUID_IB_AL_INTERFACE version mismatch: requested version=%d, returned version=%d.\n",
diff -dwup3 -x *svn* -x *makefile.inc -x *sources -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\winverbs\kernel\wv_driver.c .\core\winverbs\kernel\wv_driver.c
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\winverbs\kernel\wv_driver.c Thu Mar 29 00:15:18 2012
+++ .\core\winverbs\kernel\wv_driver.c Thu Jul 26 16:51:37 2012
@@ -415,12 +415,24 @@ static VOID WvFileCreate(WDFDEVICE Devic
static VOID WvFileCleanup(WDFFILEOBJECT FileObject)
{
+ LIST_ENTRY *entry;
WV_PROVIDER *prov = WvProviderGetContext(FileObject);
+ WV_PROVIDER *prov_entry;
KeAcquireGuardedMutex(&Lock);
+ for (entry = ProvList.Flink; entry != &ProvList; entry = entry->Flink) {
+ prov_entry = CONTAINING_RECORD(entry, WV_PROVIDER, Entry);
+ if (prov == prov_entry) {
RemoveEntryList(&prov->Entry);
+ goto found;
+ }
+ }
+ prov = NULL;
+found:
KeReleaseGuardedMutex(&Lock);
+ if (prov) {
WvProviderCleanup(prov);
+ }
}
static VOID WvFileClose(WDFFILEOBJECT FileObject)
@@ -517,9 +529,7 @@ static NTSTATUS WvPowerD0Entry(WDFDEVICE
}
if (!NT_SUCCESS(status)) {
goto exit;
- }
- else
- {
+ } else {
if( VerbsVersion(VERBS_MAJOR_VER, VERBS_MINOR_VER) != dev->Interface.InterfaceHeader.Version )
{
WvDbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL,"WinVerbs: GUID_RDMA_INTERFACE_VERBS version mismatch: requested version=%d, returned version=%d.\n",
@@ -597,7 +607,6 @@ static NTSTATUS WvRdmaDeviceAdd(WDFDRIVE
WdfFdoInitSetFilter(DeviceInit);
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attr, WV_RDMA_DEVICE);
-// attr.EvtCleanupCallback = WvRdmaDeviceCleanup;
WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&power);
power.EvtDeviceD0Entry = WvPowerD0Entry;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ndv2.22.patch
Type: application/octet-stream
Size: 3537 bytes
Desc: ndv2.22.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20130221/1b1c1aaa/attachment.obj>
More information about the ofw
mailing list