From: tzachid Date: Mon, 21 Nov 2005 10:53:19 +0000 (+0000) Subject: Base connection between user mode sdp and kernel mode was achived. (Rev69) X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=7dc7106911a3dfed4b591ba6ba98779aa1e09916;p=~shefty%2Frdma-win.git Base connection between user mode sdp and kernel mode was achived. (Rev69) git-svn-id: svn://openib.tc.cornell.edu/gen1@157 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/trunk/ulp/sdp/dirs b/trunk/ulp/sdp/dirs new file mode 100644 index 00000000..dcefa19c --- /dev/null +++ b/trunk/ulp/sdp/dirs @@ -0,0 +1,3 @@ +dirs = \ +kernel \ + diff --git a/trunk/ulp/sdp/kernel/SdpDriver.cpp b/trunk/ulp/sdp/kernel/SdpDriver.cpp index 2c4bf6ef..f391c813 100644 --- a/trunk/ulp/sdp/kernel/SdpDriver.cpp +++ b/trunk/ulp/sdp/kernel/SdpDriver.cpp @@ -4,10 +4,10 @@ extern "C" { #include } #include "sdpdriver.h" -#include "SdpLib.h" +#include "SdpShared.h" #include "SdpTrace.h" -NTSTATUS CreateDevice (IN PDRIVER_OBJECT pDriverObject); +SdpDriver *g_pSdpDriver = NULL; VOID DriverUnload ( IN PDRIVER_OBJECT pDriverObject @@ -99,6 +99,7 @@ Cleanup: IoDeleteDevice(pDevObj); } } + g_pSdpDriver = pSdpDriver; return rc; } @@ -113,6 +114,10 @@ NTSTATUS SdpDriver::Dispatch( PIO_STACK_LOCATION pIrpSp; pIrp->IoStatus.Status = STATUS_SUCCESS; pIrp->IoStatus.Information = 0; + PVOID pInputBuffer = NULL; + PVOID pOutputBuffer = NULL; + ULONG OutputDataSize = 0; + pIrpSp = IoGetCurrentIrpStackLocation(pIrp); @@ -155,10 +160,61 @@ NTSTATUS SdpDriver::Dispatch( // Handle the mode of the request and get it's params - // Handle the request itslef + // Handle the request itself + rc = g_pSdpDriver->DispatchDeviceIoControl( + pIrpSp->FileObject, + pIrp, + pInputBuffer, + pIrpSp->Parameters.DeviceIoControl.InputBufferLength, + pOutputBuffer, + pIrpSp->Parameters.DeviceIoControl.OutputBufferLength, + pIrpSp->Parameters.DeviceIoControl.IoControlCode, + OutputDataSize + ); + + break; + } } + if (rc != STATUS_PENDING) { + pIrp->IoStatus.Status = rc; + pIrp->IoStatus.Information = OutputDataSize; + IoCompleteRequest(pIrp, IO_NO_INCREMENT); + } return rc; } + +NTSTATUS SdpDriver::DispatchDeviceIoControl( + IN PFILE_OBJECT pDeviceObject, + IN PIRP pIrp, + PVOID pInputBuffer, + ULONG InputBufferLength, + PVOID pOutputBuffer, + ULONG OutputBufferLength, + ULONG IoControlCode, + ULONG &OutputDataSize + ) +{ + NTSTATUS rc = STATUS_SUCCESS; + switch (IoControlCode) { + case IOCTL_WSP_SOCKET : + SDP_PRINT(SDP_DEBUG, SDP_DRIVER, ("DispatchDeviceIoControl IOCTL_WSP_SOCKET recieved\n" )); + + + break; + default: + // This is an unrecgnized IOCTL + ASSERT(FALSE); + SDP_PRINT(SDP_ERR, SDP_DRIVER, ("DispatchDeviceIoControl unknow IOCTL code = 0x%x\n", IoControlCode )); + rc = STATUS_INVALID_PARAMETER; + goto Cleanup; + + + } +Cleanup: + return rc; +} + + diff --git a/trunk/ulp/sdp/kernel/SdpDriver.h b/trunk/ulp/sdp/kernel/SdpDriver.h index b0805ca1..3ee01caf 100644 --- a/trunk/ulp/sdp/kernel/SdpDriver.h +++ b/trunk/ulp/sdp/kernel/SdpDriver.h @@ -20,6 +20,19 @@ public: IN PIRP pIrp ); + NTSTATUS DispatchDeviceIoControl( + IN PFILE_OBJECT pDeviceObject, + IN PIRP pIrp, + PVOID pInputBuffer, + ULONG InputBufferLength, + PVOID pOutputBuffer, + ULONG OutputBufferLength, + ULONG IoControlCode, + ULONG &OutputDataSize + ); + + + private: @@ -27,4 +40,6 @@ private: PDEVICE_OBJECT m_pDevObj; }; +extern SdpDriver *g_pSdpDriver; + #endif //H_SDP_DRIVER_H