2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-15 14:17:18 +00:00

datapath-windows: pid-instance hash table data structure.

This patch introduces data structure for holding instances hashed by pid.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
cked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Ankur Sharma
2014-10-21 17:24:35 -07:00
committed by Ben Pfaff
parent a9447331a6
commit 75752ef5e7
4 changed files with 20 additions and 1 deletions

View File

@@ -87,6 +87,8 @@ typedef struct _OVS_OPEN_INSTANCE {
* markers can store the row and the column
* indices. */
} dumpState; /* data to support dump commands. */
LIST_ENTRY pidLink; /* Links the instance to
* pidHashArray */
} OVS_OPEN_INSTANCE, *POVS_OPEN_INSTANCE;
NDIS_STATUS OvsCreateDeviceObject(NDIS_HANDLE ovsExtDriverHandle);

View File

@@ -360,6 +360,8 @@ OvsInitSwitchContext(POVS_SWITCH_CONTEXT switchContext)
OvsAllocateMemory(sizeof (LIST_ENTRY) * OVS_MAX_VPORT_ARRAY_SIZE);
switchContext->portIdHashArray= (PLIST_ENTRY)
OvsAllocateMemory(sizeof (LIST_ENTRY) * OVS_MAX_VPORT_ARRAY_SIZE);
switchContext->pidHashArray = (PLIST_ENTRY)
OvsAllocateMemory(sizeof(LIST_ENTRY) * OVS_MAX_PID_ARRAY_SIZE);
status = OvsAllocateFlowTable(&switchContext->datapath, switchContext);
if (status == NDIS_STATUS_SUCCESS) {
@@ -369,7 +371,8 @@ OvsInitSwitchContext(POVS_SWITCH_CONTEXT switchContext)
switchContext->dispatchLock == NULL ||
switchContext->portNoHashArray == NULL ||
switchContext->ovsPortNameHashArray == NULL ||
switchContext->portIdHashArray== NULL) {
switchContext->portIdHashArray== NULL ||
switchContext->pidHashArray == NULL) {
if (switchContext->dispatchLock) {
NdisFreeRWLock(switchContext->dispatchLock);
}
@@ -382,6 +385,11 @@ OvsInitSwitchContext(POVS_SWITCH_CONTEXT switchContext)
if (switchContext->portIdHashArray) {
OvsFreeMemory(switchContext->portIdHashArray);
}
if (switchContext->pidHashArray) {
OvsFreeMemory(switchContext->pidHashArray);
}
OvsDeleteFlowTable(&switchContext->datapath);
OvsCleanupBufferPool(switchContext);
@@ -399,6 +407,10 @@ OvsInitSwitchContext(POVS_SWITCH_CONTEXT switchContext)
InitializeListHead(&switchContext->portNoHashArray[i]);
}
for (i = 0; i < OVS_MAX_PID_ARRAY_SIZE; i++) {
InitializeListHead(&switchContext->pidHashArray[i]);
}
switchContext->isActivated = FALSE;
switchContext->isActivateFailed = FALSE;
switchContext->dpNo = OVS_DP_NUMBER;
@@ -420,6 +432,7 @@ OvsCleanupSwitchContext(POVS_SWITCH_CONTEXT switchContext)
OvsFreeMemory(switchContext->ovsPortNameHashArray);
OvsFreeMemory(switchContext->portIdHashArray);
OvsFreeMemory(switchContext->portNoHashArray);
OvsFreeMemory(switchContext->pidHashArray);
OvsDeleteFlowTable(&switchContext->datapath);
OvsCleanupBufferPool(switchContext);
OVS_LOG_TRACE("Exit: Delete switchContext: %p", switchContext);

View File

@@ -24,8 +24,10 @@
#include "NetProto.h"
#include "BufferMgmt.h"
#define OVS_MAX_VPORT_ARRAY_SIZE 1024
#define OVS_MAX_PID_ARRAY_SIZE 1024
#define OVS_VPORT_MASK (OVS_MAX_VPORT_ARRAY_SIZE - 1)
#define OVS_PID_MASK (OVS_MAX_PID_ARRAY_SIZE - 1)
#define OVS_INTERNAL_VPORT_DEFAULT_INDEX 0
@@ -107,6 +109,7 @@ typedef struct _OVS_SWITCH_CONTEXT
PLIST_ENTRY ovsPortNameHashArray; // based on ovsName
PLIST_ENTRY portIdHashArray; // based on portId
PLIST_ENTRY portNoHashArray; // based on ovs port number
PLIST_ENTRY pidHashArray; // based on packet pids
UINT32 numPhysicalNics;
UINT32 numVports; // include validation port

View File

@@ -143,6 +143,7 @@ OvsSubscribeDpIoctl(PVOID instanceP,
if (queue == NULL) {
return STATUS_NO_MEMORY;
}
InitializeListHead(&(instance->pidLink));
instance->packetQueue = queue;
RtlZeroMemory(queue, sizeof (*queue));
NdisAllocateSpinLock(&queue->queueLock);