summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext
diff options
context:
space:
mode:
authorNithin Raju <nithin@vmware.com>2014-11-19 09:14:32 -0800
committerGurucharan Shetty <gshetty@nicira.com>2014-11-20 07:25:00 -0800
commit34b52cac2c23147c7c7369436326a6bfac16d271 (patch)
tree3ae85c69863ec872e7bb76628cfc08a68edbe93d /datapath-windows/ovsext
parent3b60a203ed3a6ccc804c24468942db10d035a25a (diff)
downloadopenvswitch-34b52cac2c23147c7c7369436326a6bfac16d271.tar.gz
datapath-windows: nuke non-netlink based interface
Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Diffstat (limited to 'datapath-windows/ovsext')
-rw-r--r--datapath-windows/ovsext/Datapath.c3
-rw-r--r--datapath-windows/ovsext/Datapath.h6
-rw-r--r--datapath-windows/ovsext/Event.c88
-rw-r--r--datapath-windows/ovsext/Ioctl.c773
-rw-r--r--datapath-windows/ovsext/Ioctl.h50
-rw-r--r--datapath-windows/ovsext/ovsext.vcxproj6
-rw-r--r--datapath-windows/ovsext/precomp.h4
7 files changed, 2 insertions, 928 deletions
diff --git a/datapath-windows/ovsext/Datapath.c b/datapath-windows/ovsext/Datapath.c
index 46c34ebc6..b67ba4495 100644
--- a/datapath-windows/ovsext/Datapath.c
+++ b/datapath-windows/ovsext/Datapath.c
@@ -20,7 +20,6 @@
* OVS_USE_NL_INTERFACE = 0 => legacy inteface to use with dpif-windows.c
* OVS_USE_NL_INTERFACE = 1 => netlink inteface to use with ported dpif-linux.c
*/
-#if defined OVS_USE_NL_INTERFACE && OVS_USE_NL_INTERFACE == 1
#include "precomp.h"
#include "Switch.h"
@@ -2364,5 +2363,3 @@ OvsPendPacketCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
*/
return OvsWaitDpIoctl(usrParamsCtx->irp, instance->fileObject);
}
-
-#endif /* OVS_USE_NL_INTERFACE */
diff --git a/datapath-windows/ovsext/Datapath.h b/datapath-windows/ovsext/Datapath.h
index 221515ddc..e4366994c 100644
--- a/datapath-windows/ovsext/Datapath.h
+++ b/datapath-windows/ovsext/Datapath.h
@@ -20,10 +20,6 @@
* OVS_USE_NL_INTERFACE = 0 => legacy inteface to use with dpif-windows.c
* OVS_USE_NL_INTERFACE = 1 => netlink inteface to use with ported dpif-linux.c
*/
-#if defined OVS_USE_NL_INTERFACE && OVS_USE_NL_INTERFACE == 0
-#include "Ioctl.h"
-
-#else
#ifndef __DATAPATH_H_
#define __DATAPATH_H_ 1
@@ -178,5 +174,3 @@ FreeUserDumpState(POVS_OPEN_INSTANCE instance)
NTSTATUS OvsSetupDumpStart(POVS_USER_PARAMS_CONTEXT usrParamsCtx);
#endif /* __DATAPATH_H_ */
-
-#endif /* OVS_USE_NL_INTERFACE */
diff --git a/datapath-windows/ovsext/Event.c b/datapath-windows/ovsext/Event.c
index d38bc7052..00f461609 100644
--- a/datapath-windows/ovsext/Event.c
+++ b/datapath-windows/ovsext/Event.c
@@ -294,94 +294,6 @@ done_event_subscribe:
return status;
}
-#if defined OVS_USE_NL_INTERFACE && OVS_USE_NL_INTERFACE == 0
-/*
- * --------------------------------------------------------------------------
- * Poll event queued in the event queue. always synchronous.
- *
- * Results:
- * STATUS_SUCCESS for valid request
- * STATUS_BUFFER_TOO_SMALL if outputBuffer is too small.
- * STATUS_INVALID_PARAMETER for invalid request
- *
- * Side effects:
- * Event will be removed from event queue.
- * --------------------------------------------------------------------------
- */
-NTSTATUS
-OvsPollEventIoctl(PFILE_OBJECT fileObject,
- PVOID inputBuffer,
- UINT32 inputLength,
- PVOID outputBuffer,
- UINT32 outputLength,
- UINT32 *replyLen)
-{
- POVS_EVENT_POLL poll;
- POVS_EVENT_STATUS eventStatus;
- POVS_EVENT_ENTRY entry;
- POVS_EVENT_QUEUE queue;
- POVS_EVENT_QUEUE_ELEM elem;
- POVS_OPEN_INSTANCE instance;
- UINT32 numEntry, i;
-
- OVS_LOG_TRACE("Enter: inputLength:%d, outputLength: %d",
- inputLength, outputLength);
-
- ASSERT(replyLen);
- if (inputLength < sizeof (OVS_EVENT_POLL)) {
- OVS_LOG_TRACE("Exit: input buffer too small");
- return STATUS_INVALID_PARAMETER;
- }
- *replyLen = sizeof (OVS_EVENT_STATUS) + sizeof (OVS_EVENT_ENTRY);
- if (outputLength < *replyLen) {
- OVS_LOG_TRACE("Exit: output buffer too small");
- return STATUS_BUFFER_TOO_SMALL;
- }
- poll = (POVS_EVENT_POLL)inputBuffer;
-
- OvsAcquireEventQueueLock();
- instance = OvsGetOpenInstance(fileObject, poll->dpNo);
- if (instance == NULL) {
- OvsReleaseEventQueueLock();
- *replyLen = 0;
- OVS_LOG_TRACE("Exit: can not find Open instance");
- return STATUS_INVALID_PARAMETER;
- }
-
- eventStatus = (POVS_EVENT_STATUS)outputBuffer;
- numEntry =
- (outputLength - sizeof (OVS_EVENT_STATUS)) / sizeof (OVS_EVENT_ENTRY);
- queue = (POVS_EVENT_QUEUE)instance->eventQueue;
- if (queue->pollAll) {
- eventStatus->numberEntries = 1;
- numEntry = 1;
- entry = &eventStatus->eventEntries[0];
- entry->portNo = OVS_DEFAULT_PORT_NO;
- entry->status = OVS_DEFAULT_EVENT_STATUS;
- queue->pollAll = FALSE;
- goto event_poll_done;
- }
- numEntry = MIN(numEntry, queue->numElems);
- eventStatus->numberEntries = numEntry;
-
- for (i = 0; i < numEntry; i++) {
- elem = (POVS_EVENT_QUEUE_ELEM)RemoveHeadList(&queue->elemList);
- entry = &eventStatus->eventEntries[i];
- entry->portNo = elem->portNo;
- entry->status = elem->status;
- OvsFreeMemory(elem);
- queue->numElems--;
- }
-event_poll_done:
- OvsReleaseEventQueueLock();
- *replyLen = sizeof (OVS_EVENT_STATUS) +
- numEntry * sizeof (OVS_EVENT_ENTRY);
- OVS_LOG_TRACE("Exit: numEventPolled: %d", numEntry);
- return STATUS_SUCCESS;
-}
-#endif /* OVS_USE_NL_INTERFACE */
-
-
/*
* --------------------------------------------------------------------------
* Cancel wait IRP for event
diff --git a/datapath-windows/ovsext/Ioctl.c b/datapath-windows/ovsext/Ioctl.c
deleted file mode 100644
index 304310dbb..000000000
--- a/datapath-windows/ovsext/Ioctl.c
+++ /dev/null
@@ -1,773 +0,0 @@
-/*
- * Copyright (c) 2014 VMware, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * XXX: OVS_USE_NL_INTERFACE is being used to keep the legacy DPIF interface
- * alive while we transition over to the netlink based interface.
- * OVS_USE_NL_INTERFACE = 0 => legacy inteface to use with dpif-windows.c
- * OVS_USE_NL_INTERFACE = 1 => netlink inteface to use with ported dpif-linux.c
- */
-#if defined OVS_USE_NL_INTERFACE && OVS_USE_NL_INTERFACE == 0
-
-#include "precomp.h"
-#include "Ioctl.h"
-#include "Jhash.h"
-#include "Switch.h"
-#include "Vport.h"
-#include "Event.h"
-#include "User.h"
-#include "PacketIO.h"
-#include "NetProto.h"
-#include "Flow.h"
-#include "User.h"
-
-#ifdef OVS_DBG_MOD
-#undef OVS_DBG_MOD
-#endif
-#define OVS_DBG_MOD OVS_DBG_DATAPATH
-#include "Debug.h"
-
-/* Handles to the device object for communication with userspace. */
-NDIS_HANDLE gOvsDeviceHandle;
-PDEVICE_OBJECT gOvsDeviceObject;
-
-/*
- * There seems to be a skew between the kernel's version of current time and
- * the userspace's version of current time. The skew was seen to
- * monotonically increase as well.
- *
- * In order to deal with the situation, we pass down the userspace's version
- * of the timestamp to the kernel, and let the kernel calculate the delta.
- */
-UINT64 ovsUserTimestampDelta;
-UINT64 ovsTimeIncrementPerTick;
-
-_Dispatch_type_(IRP_MJ_CREATE)
-_Dispatch_type_(IRP_MJ_CLOSE)
-DRIVER_DISPATCH OvsOpenCloseDevice;
-
-_Dispatch_type_(IRP_MJ_CLEANUP)
-DRIVER_DISPATCH OvsCleanupDevice;
-
-_Dispatch_type_(IRP_MJ_DEVICE_CONTROL)
-DRIVER_DISPATCH OvsDeviceControl;
-
-#ifdef ALLOC_PRAGMA
-#pragma alloc_text(INIT, OvsCreateDeviceObject)
-#pragma alloc_text(PAGE, OvsOpenCloseDevice)
-#pragma alloc_text(PAGE, OvsCleanupDevice)
-#pragma alloc_text(PAGE, OvsDeviceControl)
-#endif // ALLOC_PRAGMA
-
-
-#define OVS_MAX_OPEN_INSTANCES 128
-
-POVS_OPEN_INSTANCE ovsOpenInstanceArray[OVS_MAX_OPEN_INSTANCES];
-UINT32 ovsNumberOfOpenInstances;
-extern POVS_SWITCH_CONTEXT gOvsSwitchContext;
-
-NDIS_SPIN_LOCK ovsCtrlLockObj;
-NDIS_SPIN_LOCK ovsFlowLockObj;
-PNDIS_SPIN_LOCK gOvsCtrlLock;
-PNDIS_SPIN_LOCK ovsFlowLock;
-
-VOID
-OvsInitIoctl()
-{
- gOvsCtrlLock = &ovsCtrlLockObj;
- ovsFlowLock = &ovsFlowLockObj;
- NdisAllocateSpinLock(ovsFlowLock);
- NdisAllocateSpinLock(gOvsCtrlLock);
-}
-
-VOID
-OvsCleanupIoctl()
-{
- if (ovsFlowLock) {
- NdisFreeSpinLock(ovsFlowLock);
- NdisFreeSpinLock(gOvsCtrlLock);
- ovsFlowLock = NULL;
- gOvsCtrlLock = NULL;
- }
-}
-
-VOID
-OvsInit()
-{
- OvsInitIoctl();
- OvsInitEventQueue();
-}
-
-VOID
-OvsCleanup()
-{
- OvsCleanupEventQueue();
- OvsCleanupIoctl();
-}
-
-VOID
-OvsAcquireCtrlLock()
-{
- NdisAcquireSpinLock(gOvsCtrlLock);
-}
-VOID
-OvsReleaseCtrlLock()
-{
- NdisReleaseSpinLock(gOvsCtrlLock);
-}
-
-
-/*
- * --------------------------------------------------------------------------
- * Creates the communication device between user and kernel, and also
- * initializes the data associated data structures.
- * --------------------------------------------------------------------------
- */
-NDIS_STATUS
-OvsCreateDeviceObject(NDIS_HANDLE ovsExtDriverHandle)
-{
- NDIS_STATUS status = NDIS_STATUS_SUCCESS;
- UNICODE_STRING deviceName;
- UNICODE_STRING symbolicDeviceName;
- PDRIVER_DISPATCH dispatchTable[IRP_MJ_MAXIMUM_FUNCTION+1];
- NDIS_DEVICE_OBJECT_ATTRIBUTES deviceAttributes;
- OVS_LOG_TRACE("ovsExtDriverHandle: %p", ovsExtDriverHandle);
-
- RtlZeroMemory(dispatchTable,
- (IRP_MJ_MAXIMUM_FUNCTION + 1) * sizeof (PDRIVER_DISPATCH));
- dispatchTable[IRP_MJ_CREATE] = OvsOpenCloseDevice;
- dispatchTable[IRP_MJ_CLOSE] = OvsOpenCloseDevice;
- dispatchTable[IRP_MJ_CLEANUP] = OvsCleanupDevice;
- dispatchTable[IRP_MJ_DEVICE_CONTROL] = OvsDeviceControl;
-
- NdisInitUnicodeString(&deviceName, OVS_NT_DEVICE_NAME);
- NdisInitUnicodeString(&symbolicDeviceName, OVS_DOS_DEVICE_NAME);
-
- RtlZeroMemory(&deviceAttributes, sizeof (NDIS_DEVICE_OBJECT_ATTRIBUTES));
-
- OVS_INIT_OBJECT_HEADER(&deviceAttributes.Header,
- NDIS_OBJECT_TYPE_DEVICE_OBJECT_ATTRIBUTES,
- NDIS_DEVICE_OBJECT_ATTRIBUTES_REVISION_1,
- sizeof (NDIS_DEVICE_OBJECT_ATTRIBUTES));
-
- deviceAttributes.DeviceName = &deviceName;
- deviceAttributes.SymbolicName = &symbolicDeviceName;
- deviceAttributes.MajorFunctions = dispatchTable;
- deviceAttributes.ExtensionSize = sizeof (OVS_DEVICE_EXTENSION);
-
- status = NdisRegisterDeviceEx(ovsExtDriverHandle,
- &deviceAttributes,
- &gOvsDeviceObject,
- &gOvsDeviceHandle);
- if (status != NDIS_STATUS_SUCCESS) {
- POVS_DEVICE_EXTENSION ovsExt =
- (POVS_DEVICE_EXTENSION)NdisGetDeviceReservedExtension(gOvsDeviceObject);
- ASSERT(gOvsDeviceObject != NULL);
- ASSERT(gOvsDeviceHandle != NULL);
-
- if (ovsExt) {
- ovsExt->numberOpenInstance = 0;
- }
- } else {
- /* Initialize the associated data structures. */
- OvsInit();
- }
- OVS_LOG_TRACE("DeviceObject: %p", gOvsDeviceObject);
- return status;
-}
-
-
-VOID
-OvsDeleteDeviceObject()
-{
- if (gOvsDeviceHandle) {
-#ifdef DBG
- POVS_DEVICE_EXTENSION ovsExt = (POVS_DEVICE_EXTENSION)
- NdisGetDeviceReservedExtension(gOvsDeviceObject);
- if (ovsExt) {
- ASSERT(ovsExt->numberOpenInstance == 0);
- }
-#endif
-
- ASSERT(gOvsDeviceObject);
- NdisDeregisterDeviceEx(gOvsDeviceHandle);
- gOvsDeviceHandle = NULL;
- gOvsDeviceObject = NULL;
- }
- OvsCleanup();
-}
-
-POVS_OPEN_INSTANCE
-OvsGetOpenInstance(PFILE_OBJECT fileObject,
- UINT32 dpNo)
-{
- POVS_OPEN_INSTANCE instance = (POVS_OPEN_INSTANCE)fileObject->FsContext;
- ASSERT(instance);
- ASSERT(instance->fileObject == fileObject);
- if (gOvsSwitchContext == NULL ||
- gOvsSwitchContext->dpNo != dpNo) {
- return NULL;
- }
- return instance;
-}
-
-
-POVS_OPEN_INSTANCE
-OvsFindOpenInstance(PFILE_OBJECT fileObject)
-{
- UINT32 i, j;
- for (i = 0, j = 0; i < OVS_MAX_OPEN_INSTANCES &&
- j < ovsNumberOfOpenInstances; i++) {
- if (ovsOpenInstanceArray[i]) {
- if (ovsOpenInstanceArray[i]->fileObject == fileObject) {
- return ovsOpenInstanceArray[i];
- }
- j++;
- }
- }
- return NULL;
-}
-
-NTSTATUS
-OvsAddOpenInstance(PFILE_OBJECT fileObject)
-{
- POVS_OPEN_INSTANCE instance =
- (POVS_OPEN_INSTANCE) OvsAllocateMemory(sizeof (OVS_OPEN_INSTANCE));
- UINT32 i;
-
- if (instance == NULL) {
- return STATUS_NO_MEMORY;
- }
- OvsAcquireCtrlLock();
- ASSERT(OvsFindOpenInstance(fileObject) == NULL);
-
- if (ovsNumberOfOpenInstances >= OVS_MAX_OPEN_INSTANCES) {
- OvsReleaseCtrlLock();
- OvsFreeMemory(instance);
- return STATUS_INSUFFICIENT_RESOURCES;
- }
- RtlZeroMemory(instance, sizeof (OVS_OPEN_INSTANCE));
-
- for (i = 0; i < OVS_MAX_OPEN_INSTANCES; i++) {
- if (ovsOpenInstanceArray[i] == NULL) {
- ovsOpenInstanceArray[i] = instance;
- ovsNumberOfOpenInstances++;
- instance->cookie = i;
- break;
- }
- }
- ASSERT(i < OVS_MAX_OPEN_INSTANCES);
- instance->fileObject = fileObject;
- ASSERT(fileObject->FsContext == NULL);
- fileObject->FsContext = instance;
- OvsReleaseCtrlLock();
- return STATUS_SUCCESS;
-}
-
-static VOID
-OvsCleanupOpenInstance(PFILE_OBJECT fileObject)
-{
- POVS_OPEN_INSTANCE instance = (POVS_OPEN_INSTANCE)fileObject->FsContext;
- ASSERT(instance);
- ASSERT(fileObject == instance->fileObject);
- OvsCleanupEvent(instance);
- OvsCleanupPacketQueue(instance);
-}
-
-VOID
-OvsRemoveOpenInstance(PFILE_OBJECT fileObject)
-{
- POVS_OPEN_INSTANCE instance;
- ASSERT(fileObject->FsContext);
- instance = (POVS_OPEN_INSTANCE)fileObject->FsContext;
- ASSERT(instance->cookie < OVS_MAX_OPEN_INSTANCES);
-
- OvsAcquireCtrlLock();
- fileObject->FsContext = NULL;
- ASSERT(ovsOpenInstanceArray[instance->cookie] == instance);
- ovsOpenInstanceArray[instance->cookie] = NULL;
- ovsNumberOfOpenInstances--;
- OvsReleaseCtrlLock();
- ASSERT(instance->eventQueue == NULL);
- ASSERT (instance->packetQueue == NULL);
- OvsFreeMemory(instance);
-}
-
-NTSTATUS
-OvsCompleteIrpRequest(PIRP irp,
- ULONG_PTR infoPtr,
- NTSTATUS status)
-{
- irp->IoStatus.Information = infoPtr;
- irp->IoStatus.Status = status;
- IoCompleteRequest(irp, IO_NO_INCREMENT);
- return status;
-}
-
-
-NTSTATUS
-OvsOpenCloseDevice(PDEVICE_OBJECT deviceObject,
- PIRP irp)
-{
- PIO_STACK_LOCATION irpSp;
- NTSTATUS status = STATUS_SUCCESS;
- PFILE_OBJECT fileObject;
- POVS_DEVICE_EXTENSION ovsExt =
- (POVS_DEVICE_EXTENSION)NdisGetDeviceReservedExtension(deviceObject);
-
- ASSERT(deviceObject == gOvsDeviceObject);
- ASSERT(ovsExt != NULL);
-
- irpSp = IoGetCurrentIrpStackLocation(irp);
- fileObject = irpSp->FileObject;
- OVS_LOG_TRACE("DeviceObject: %p, fileObject:%p, instance: %u",
- deviceObject, fileObject,
- ovsExt->numberOpenInstance);
-
- switch (irpSp->MajorFunction) {
- case IRP_MJ_CREATE:
- status = OvsAddOpenInstance(fileObject);
- if (STATUS_SUCCESS == status) {
- InterlockedIncrement((LONG volatile *)&ovsExt->numberOpenInstance);
- }
- break;
- case IRP_MJ_CLOSE:
- ASSERT(ovsExt->numberOpenInstance > 0);
- OvsRemoveOpenInstance(fileObject);
- InterlockedDecrement((LONG volatile *)&ovsExt->numberOpenInstance);
- break;
- default:
- ASSERT(0);
- }
- return OvsCompleteIrpRequest(irp, (ULONG_PTR)0, status);
-}
-
-_Use_decl_annotations_
-NTSTATUS
-OvsCleanupDevice(PDEVICE_OBJECT deviceObject,
- PIRP irp)
-{
-
- PIO_STACK_LOCATION irpSp;
- PFILE_OBJECT fileObject;
-
- NTSTATUS status = STATUS_SUCCESS;
-#ifdef DBG
- POVS_DEVICE_EXTENSION ovsExt =
- (POVS_DEVICE_EXTENSION)NdisGetDeviceReservedExtension(deviceObject);
- if (ovsExt) {
- ASSERT(ovsExt->numberOpenInstance > 0);
- }
-#else
- UNREFERENCED_PARAMETER(deviceObject);
-#endif
- ASSERT(deviceObject == gOvsDeviceObject);
- irpSp = IoGetCurrentIrpStackLocation(irp);
- fileObject = irpSp->FileObject;
-
- ASSERT(irpSp->MajorFunction == IRP_MJ_CLEANUP);
-
- OvsCleanupOpenInstance(fileObject);
-
- return OvsCompleteIrpRequest(irp, (ULONG_PTR)0, status);
-}
-
-/*
- *----------------------------------------------------------------------------
- * OvsGetVersionIoctl --
- *
- * On entry None
- * On exit Driver version
- *
- * Result:
- * STATUS_SUCCESS
- * STATUS_BUFFER_TOO_SMALL
- *----------------------------------------------------------------------------
- */
-NTSTATUS
-OvsGetVersionIoctl(PVOID outputBuffer,
- uint32 outputLength,
- uint32 *replyLen)
-{
- POVS_VERSION driverOut = (POVS_VERSION)outputBuffer;
-
- if (outputLength < sizeof (*driverOut)) {
- return STATUS_BUFFER_TOO_SMALL;
- }
- *replyLen = sizeof (*driverOut);
- driverOut->mjrDrvVer = OVS_DRIVER_MAJOR_VER;
- driverOut->mnrDrvVer = OVS_DRIVER_MINOR_VER;
-
- return STATUS_SUCCESS;
-}
-
-
-/*
- *----------------------------------------------------------------------------
- * OvsDpDumpIoctl --
- * Get All Datapath. For now, we only support one datapath.
- *
- * Result:
- * STATUS_SUCCESS
- * STATUS_BUFFER_TOO_SMALL
- *----------------------------------------------------------------------------
- */
-NTSTATUS
-OvsDpDumpIoctl(PVOID outputBuffer,
- UINT32 outputLength,
- UINT32 *replyLen)
-{
- *replyLen = sizeof (UINT32);
- if (outputLength < sizeof (UINT32)) {
- return STATUS_BUFFER_TOO_SMALL;
- }
- OvsAcquireCtrlLock();
- if (gOvsSwitchContext) {
- *(UINT32 *)outputBuffer = gOvsSwitchContext->dpNo;
- } else {
- *replyLen = 0;
- }
- OvsReleaseCtrlLock();
-
- return STATUS_SUCCESS;
-}
-
-
-/*
- *----------------------------------------------------------------------------
- * OvsDpGetIoctl --
- * Given dpNo, get all datapath info as defined in OVS_DP_INFO.
- *
- * Result:
- * STATUS_SUCCESS
- * STATUS_BUFFER_TOO_SMALL
- * STATUS_INVALID_PARAMETER
- *----------------------------------------------------------------------------
- */
-NTSTATUS
-OvsDpGetIoctl(PVOID inputBuffer,
- UINT32 inputLength,
- PVOID outputBuffer,
- UINT32 outputLength,
- UINT32 *replyLen)
-{
- UINT32 dpNo;
- POVS_DP_INFO info;
- OVS_DATAPATH *datapath;
-
- if (inputLength < sizeof (UINT32)) {
- return STATUS_INVALID_PARAMETER;
- }
-
- if (outputLength < sizeof (OVS_DP_INFO)) {
- *replyLen = sizeof (OVS_DP_INFO);
- return STATUS_BUFFER_TOO_SMALL;
- }
-
- dpNo = *(UINT32 *)inputBuffer;
- OvsAcquireCtrlLock();
- if (gOvsSwitchContext == NULL ||
- gOvsSwitchContext->dpNo != dpNo) {
- OvsReleaseCtrlLock();
- return STATUS_INVALID_PARAMETER;
- }
- *replyLen = sizeof (OVS_DP_INFO);
- RtlZeroMemory(outputBuffer, sizeof (OVS_DP_INFO));
- info = (POVS_DP_INFO)outputBuffer;
- RtlCopyMemory(info->name, "ovs-system", sizeof ("ovs-system"));
- datapath = &gOvsSwitchContext->datapath;
- info->nMissed = datapath->misses;
- info->nHit = datapath->hits;
- info->nLost = datapath->lost;
- info->nFlows = datapath->nFlows;
- OvsReleaseCtrlLock();
- return STATUS_SUCCESS;
-}
-
-NTSTATUS
-OvsDeviceControl(PDEVICE_OBJECT deviceObject,
- PIRP irp)
-{
-
- PIO_STACK_LOCATION irpSp;
- NTSTATUS status = STATUS_SUCCESS;
- PFILE_OBJECT fileObject;
- PVOID inputBuffer;
- PVOID outputBuffer;
- UINT32 inputBufferLen, outputBufferLen, mdlBufferLen;
- UINT32 code, replyLen = 0;
-#ifdef DBG
- POVS_DEVICE_EXTENSION ovsExt =
- (POVS_DEVICE_EXTENSION)NdisGetDeviceReservedExtension(deviceObject);
- ASSERT(deviceObject == gOvsDeviceObject);
- ASSERT(ovsExt);
- ASSERT(ovsExt->numberOpenInstance > 0);
-#else
- UNREFERENCED_PARAMETER(deviceObject);
-#endif
-
- irpSp = IoGetCurrentIrpStackLocation(irp);
-
-
- ASSERT(irpSp->MajorFunction == IRP_MJ_DEVICE_CONTROL);
- ASSERT(irpSp->FileObject != NULL);
-
- fileObject = irpSp->FileObject;
- code = irpSp->Parameters.DeviceIoControl.IoControlCode;
- inputBufferLen = irpSp->Parameters.DeviceIoControl.InputBufferLength;
- outputBufferLen = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
- /*
- * In case of an IRP with METHOD_IN_DIRECT or METHOD_OUT_DIRECT, the size
- * of the MDL is stored in Parameters.DeviceIoControl.OutputBufferLength.
- */
- mdlBufferLen = outputBufferLen;
- outputBuffer = inputBuffer = irp->AssociatedIrp.SystemBuffer;
-
- switch(code) {
- case OVS_IOCTL_VERSION_GET:
- status = OvsGetVersionIoctl(outputBuffer, outputBufferLen,
- &replyLen);
- break;
- case OVS_IOCTL_DP_DUMP:
- status = OvsDpDumpIoctl(outputBuffer, outputBufferLen, &replyLen);
- break;
- case OVS_IOCTL_DP_GET:
- if (irp->MdlAddress == NULL) {
- status = STATUS_INVALID_PARAMETER;
- break;
- }
- outputBuffer = MmGetSystemAddressForMdlSafe(irp->MdlAddress,
- NormalPagePriority);
- if (outputBuffer == NULL) {
- status = STATUS_INSUFFICIENT_RESOURCES;
- } else {
- status = OvsDpGetIoctl(inputBuffer, inputBufferLen,
- outputBuffer, outputBufferLen, &replyLen);
- }
- break;
- case OVS_IOCTL_DP_SET:
- status = STATUS_NOT_IMPLEMENTED;
- break;
- case OVS_IOCTL_VPORT_DUMP:
- if (irp->MdlAddress == NULL) {
- status = STATUS_INVALID_PARAMETER;
- break;
- }
- outputBuffer = MmGetSystemAddressForMdlSafe(irp->MdlAddress,
- NormalPagePriority);
- if (outputBuffer) {
- status = OvsDumpVportIoctl(inputBuffer, inputBufferLen,
- outputBuffer, outputBufferLen,
- &replyLen);
- } else {
- status = STATUS_INSUFFICIENT_RESOURCES;
- }
- break;
- case OVS_IOCTL_VPORT_GET:
- if (irp->MdlAddress == NULL) {
- status = STATUS_INVALID_PARAMETER;
- break;
- }
- outputBuffer = MmGetSystemAddressForMdlSafe(irp->MdlAddress,
- NormalPagePriority);
- if (outputBuffer) {
- status = OvsGetVportIoctl(inputBuffer, inputBufferLen,
- outputBuffer, outputBufferLen,
- &replyLen);
- } else {
- status = STATUS_INSUFFICIENT_RESOURCES;
- }
- break;
- case OVS_IOCTL_VPORT_SET:
- status = STATUS_NOT_IMPLEMENTED;
- break;
- case OVS_IOCTL_VPORT_ADD:
- if (irp->MdlAddress == NULL) {
- status = STATUS_INVALID_PARAMETER;
- break;
- }
- outputBuffer = MmGetSystemAddressForMdlSafe(irp->MdlAddress,
- NormalPagePriority);
- if (outputBuffer) {
- status = OvsAddVportIoctl(inputBuffer, inputBufferLen,
- outputBuffer, outputBufferLen,
- &replyLen);
- } else {
- status = STATUS_INSUFFICIENT_RESOURCES;
- }
- break;
- case OVS_IOCTL_VPORT_DEL:
- status = OvsDelVportIoctl(inputBuffer, inputBufferLen,
- &replyLen);
- break;
- case OVS_IOCTL_VPORT_EXT_INFO:
- if (irp->MdlAddress == NULL) {
- status = STATUS_INVALID_PARAMETER;
- break;
- }
- outputBuffer = MmGetSystemAddressForMdlSafe(irp->MdlAddress,
- NormalPagePriority);
- if (outputBuffer) {
- status = OvsGetExtInfoIoctl(inputBuffer, inputBufferLen,
- outputBuffer, outputBufferLen,
- &replyLen);
- } else {
- OVS_LOG_INFO("ExtInfo: fail to get outputBuffer address");
- status = STATUS_INSUFFICIENT_RESOURCES;
- }
- break;
- case OVS_IOCTL_FLOW_DUMP:
- if (irp->MdlAddress == NULL) {
- status = STATUS_INVALID_PARAMETER;
- break;
- }
- outputBuffer = MmGetSystemAddressForMdlSafe(irp->MdlAddress,
- NormalPagePriority);
- if (outputBuffer) {
- status = OvsDumpFlowIoctl(inputBuffer, inputBufferLen,
- outputBuffer, outputBufferLen,
- &replyLen);
- } else {
- status = STATUS_INSUFFICIENT_RESOURCES;
- }
- break;
- case OVS_IOCTL_FLOW_GET:
- if (irp->MdlAddress == NULL) {
- status = STATUS_INVALID_PARAMETER;
- break;
- }
- outputBuffer = MmGetSystemAddressForMdlSafe(irp->MdlAddress,
- NormalPagePriority);
- if (outputBuffer) {
- /* Commenting out the call.
- * Post netlink implementation,
- * we'll get rid of this file itself. */
-#if 0
- status = OvsGetFlowIoctl(inputBuffer, inputBufferLen,
- outputBuffer, outputBufferLen,
- &replyLen);
-#endif
- } else {
- status = STATUS_INSUFFICIENT_RESOURCES;
- }
- break;
- case OVS_IOCTL_FLOW_PUT:
- // XXX: This is not really working - mapping the input buffer
- // XXX: inputBufferLen = mdlBufferLen;
- // inputBuffer = MmGetSystemAddressForMdlSafe(irp->MdlAddress,
- // NormalPagePriority);
- status = OvsPutFlowIoctl(inputBuffer, inputBufferLen,
- outputBuffer, outputBufferLen,
- &replyLen);
- break;
- case OVS_IOCTL_FLOW_FLUSH:
- status = OvsFlushFlowIoctl(inputBuffer, inputBufferLen);
- break;
- case OVS_IOCTL_QOS_QUEUE_DUMP:
- case OVS_IOCTL_QOS_QUEUE_GET:
- case OVS_IOCTL_QOS_QUEUE_SET:
- status = STATUS_NOT_IMPLEMENTED;
- break;
- case OVS_IOCTL_DATAPATH_SUBSCRIBE:
- status = OvsSubscribeDpIoctl(fileObject, inputBuffer,
- inputBufferLen);
- break;
- case OVS_IOCTL_DATAPATH_READ:
- if (irp->MdlAddress == NULL) {
- status = STATUS_INVALID_PARAMETER;
- break;
- }
- outputBuffer = MmGetSystemAddressForMdlSafe(irp->MdlAddress,
- NormalPagePriority);
- if (outputBuffer) {
- status = OvsReadDpIoctl(fileObject, outputBuffer,
- outputBufferLen, &replyLen);
- } else {
- status = STATUS_INSUFFICIENT_RESOURCES;
- }
- break;
- case OVS_IOCTL_DATAPATH_OPERATE:
- status = STATUS_NOT_IMPLEMENTED;
- break;
- case OVS_IOCTL_DATAPATH_EXECUTE:
- // XXX: need to make the input direct
- status = OvsExecuteDpIoctl(inputBuffer, inputBufferLen,
- outputBufferLen);
- break;
- case OVS_IOCTL_DATAPATH_PURGE:
- status = OvsPurgeDpIoctl(fileObject);
- break;
- case OVS_IOCTL_DATAPATH_WAIT:
- status = OvsWaitDpIoctl(irp, fileObject);
- break;
- case OVS_IOCTL_EVENT_SUBSCRIBE:
- status = OvsSubscribeEventIoctl(fileObject, inputBuffer,
- inputBufferLen);
- break;
- case OVS_IOCTL_EVENT_POLL:
- if (irp->MdlAddress == NULL) {
- status = STATUS_INVALID_PARAMETER;
- break;
- }
- outputBuffer = MmGetSystemAddressForMdlSafe(irp->MdlAddress,
- NormalPagePriority);
- if (outputBuffer == NULL) {
- status = STATUS_INSUFFICIENT_RESOURCES;
- } else {
- status = OvsPollEventIoctl(fileObject, inputBuffer,
- inputBufferLen, outputBuffer,
- outputBufferLen, &replyLen);
- }
- break;
- case OVS_IOCTL_EVENT_WAIT:
- status = OvsWaitEventIoctl(irp, fileObject,
- inputBuffer, inputBufferLen);
- break;
- case OVS_IOCTL_DP_TIMESTAMP_SET:
- if (inputBufferLen != sizeof (ovsUserTimestampDelta)) {
- status = STATUS_INFO_LENGTH_MISMATCH;
- } else {
- int64 currentUserTS = *(int64 *)inputBuffer;
- LARGE_INTEGER tickCount;
-
- /* So many ticks since system booted. */
- KeQueryTickCount(&tickCount);
- ovsUserTimestampDelta = currentUserTS -
- (tickCount.QuadPart * ovsTimeIncrementPerTick);
- status = STATUS_SUCCESS;
- }
- break;
- default:
- status = STATUS_INVALID_DEVICE_REQUEST;
- break;
- }
-
- if (status == STATUS_PENDING) {
- return status;
- } else {
- /*
- * When the system-address-space mapping that is returned by
- * MmGetSystemAddressForMdlSafe is no longer needed, it must be
- * released.
- * http://msdn.microsoft.com/en-us/library/windows/hardware/ff554559(v=vs.85).aspx
- *
- * We might have to release the MDL here.
- */
- return OvsCompleteIrpRequest(irp, (ULONG_PTR)replyLen, status);
- }
-}
-
-#endif /* OVS_USE_NL_INTERFACE */
diff --git a/datapath-windows/ovsext/Ioctl.h b/datapath-windows/ovsext/Ioctl.h
deleted file mode 100644
index c4f0bd617..000000000
--- a/datapath-windows/ovsext/Ioctl.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2014 VMware, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * XXX: OVS_USE_NL_INTERFACE is being used to keep the legacy DPIF interface
- * alive while we transition over to the netlink based interface.
- * OVS_USE_NL_INTERFACE = 0 => legacy inteface to use with dpif-windows.c
- * OVS_USE_NL_INTERFACE = 1 => netlink inteface to use with ported dpif-linux.c
- */
-#if defined OVS_USE_NL_INTERFACE && OVS_USE_NL_INTERFACE == 0
-
-#ifndef __IOCTL_H_
-#define __IOCTL_H_ 1
-
-typedef struct _OVS_DEVICE_EXTENSION {
- INT numberOpenInstance;
-} OVS_DEVICE_EXTENSION, *POVS_DEVICE_EXTENSION;
-
-
-typedef struct _OVS_OPEN_INSTANCE {
- UINT32 cookie;
- PFILE_OBJECT fileObject;
- PVOID eventQueue;
- PVOID packetQueue;
-} OVS_OPEN_INSTANCE, *POVS_OPEN_INSTANCE;
-
-NDIS_STATUS OvsCreateDeviceObject(NDIS_HANDLE ovsExtDriverHandle);
-VOID OvsDeleteDeviceObject();
-
-POVS_OPEN_INSTANCE OvsGetOpenInstance(PFILE_OBJECT fileObject,
- UINT32 dpNo);
-
-NTSTATUS OvsCompleteIrpRequest(PIRP irp, ULONG_PTR infoPtr, NTSTATUS status);
-
-#endif /* __IOCTL_H_ */
-
-#endif /* OVS_USE_NL_INTERFACE */
diff --git a/datapath-windows/ovsext/ovsext.vcxproj b/datapath-windows/ovsext/ovsext.vcxproj
index 190ce1254..88c9122bb 100644
--- a/datapath-windows/ovsext/ovsext.vcxproj
+++ b/datapath-windows/ovsext/ovsext.vcxproj
@@ -79,7 +79,6 @@
<ClInclude Include="Ethernet.h" />
<ClInclude Include="Event.h" />
<ClInclude Include="Flow.h" />
- <ClInclude Include="Ioctl.h" />
<ClInclude Include="IpHelper.h" />
<ClInclude Include="Jhash.h" />
<ClInclude Include="Netlink/Netlink.h" />
@@ -105,7 +104,7 @@
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1;OVS_WIN_DP=1;OVS_USE_NL_INTERFACE=1</PreprocessorDefinitions>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1</PreprocessorDefinitions>
</ClCompile>
<Midl>
<PreprocessorDefinitions>%(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1</PreprocessorDefinitions>
@@ -137,7 +136,6 @@
<ClCompile Include="Driver.c" />
<ClCompile Include="Event.c" />
<ClCompile Include="Flow.c" />
- <ClCompile Include="Ioctl.c" />
<ClCompile Include="IpHelper.c" />
<ClCompile Include="Jhash.c" />
<ClCompile Include="Netlink/Netlink.c" />
@@ -171,4 +169,4 @@
<None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
+</Project>
diff --git a/datapath-windows/ovsext/precomp.h b/datapath-windows/ovsext/precomp.h
index 1cdb3ed5b..99e1d08f1 100644
--- a/datapath-windows/ovsext/precomp.h
+++ b/datapath-windows/ovsext/precomp.h
@@ -29,9 +29,5 @@
#include "Netlink/NetlinkError.h"
#include "Netlink/Netlink.h"
#include "Netlink/NetlinkProto.h"
-
-#if defined OVS_USE_NL_INTERFACE && OVS_USE_NL_INTERFACE == 1
#include "..\include\OvsDpInterfaceExt.h"
-#endif
-
#include "..\include\OvsPub.h"