mirror of
https://github.com/openvswitch/ovs
synced 2025-10-17 14:28:02 +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:
@@ -87,6 +87,8 @@ typedef struct _OVS_OPEN_INSTANCE {
|
|||||||
* markers can store the row and the column
|
* markers can store the row and the column
|
||||||
* indices. */
|
* indices. */
|
||||||
} dumpState; /* data to support dump commands. */
|
} dumpState; /* data to support dump commands. */
|
||||||
|
LIST_ENTRY pidLink; /* Links the instance to
|
||||||
|
* pidHashArray */
|
||||||
} OVS_OPEN_INSTANCE, *POVS_OPEN_INSTANCE;
|
} OVS_OPEN_INSTANCE, *POVS_OPEN_INSTANCE;
|
||||||
|
|
||||||
NDIS_STATUS OvsCreateDeviceObject(NDIS_HANDLE ovsExtDriverHandle);
|
NDIS_STATUS OvsCreateDeviceObject(NDIS_HANDLE ovsExtDriverHandle);
|
||||||
|
@@ -360,6 +360,8 @@ OvsInitSwitchContext(POVS_SWITCH_CONTEXT switchContext)
|
|||||||
OvsAllocateMemory(sizeof (LIST_ENTRY) * OVS_MAX_VPORT_ARRAY_SIZE);
|
OvsAllocateMemory(sizeof (LIST_ENTRY) * OVS_MAX_VPORT_ARRAY_SIZE);
|
||||||
switchContext->portIdHashArray= (PLIST_ENTRY)
|
switchContext->portIdHashArray= (PLIST_ENTRY)
|
||||||
OvsAllocateMemory(sizeof (LIST_ENTRY) * OVS_MAX_VPORT_ARRAY_SIZE);
|
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);
|
status = OvsAllocateFlowTable(&switchContext->datapath, switchContext);
|
||||||
|
|
||||||
if (status == NDIS_STATUS_SUCCESS) {
|
if (status == NDIS_STATUS_SUCCESS) {
|
||||||
@@ -369,7 +371,8 @@ OvsInitSwitchContext(POVS_SWITCH_CONTEXT switchContext)
|
|||||||
switchContext->dispatchLock == NULL ||
|
switchContext->dispatchLock == NULL ||
|
||||||
switchContext->portNoHashArray == NULL ||
|
switchContext->portNoHashArray == NULL ||
|
||||||
switchContext->ovsPortNameHashArray == NULL ||
|
switchContext->ovsPortNameHashArray == NULL ||
|
||||||
switchContext->portIdHashArray== NULL) {
|
switchContext->portIdHashArray== NULL ||
|
||||||
|
switchContext->pidHashArray == NULL) {
|
||||||
if (switchContext->dispatchLock) {
|
if (switchContext->dispatchLock) {
|
||||||
NdisFreeRWLock(switchContext->dispatchLock);
|
NdisFreeRWLock(switchContext->dispatchLock);
|
||||||
}
|
}
|
||||||
@@ -382,6 +385,11 @@ OvsInitSwitchContext(POVS_SWITCH_CONTEXT switchContext)
|
|||||||
if (switchContext->portIdHashArray) {
|
if (switchContext->portIdHashArray) {
|
||||||
OvsFreeMemory(switchContext->portIdHashArray);
|
OvsFreeMemory(switchContext->portIdHashArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (switchContext->pidHashArray) {
|
||||||
|
OvsFreeMemory(switchContext->pidHashArray);
|
||||||
|
}
|
||||||
|
|
||||||
OvsDeleteFlowTable(&switchContext->datapath);
|
OvsDeleteFlowTable(&switchContext->datapath);
|
||||||
OvsCleanupBufferPool(switchContext);
|
OvsCleanupBufferPool(switchContext);
|
||||||
|
|
||||||
@@ -399,6 +407,10 @@ OvsInitSwitchContext(POVS_SWITCH_CONTEXT switchContext)
|
|||||||
InitializeListHead(&switchContext->portNoHashArray[i]);
|
InitializeListHead(&switchContext->portNoHashArray[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < OVS_MAX_PID_ARRAY_SIZE; i++) {
|
||||||
|
InitializeListHead(&switchContext->pidHashArray[i]);
|
||||||
|
}
|
||||||
|
|
||||||
switchContext->isActivated = FALSE;
|
switchContext->isActivated = FALSE;
|
||||||
switchContext->isActivateFailed = FALSE;
|
switchContext->isActivateFailed = FALSE;
|
||||||
switchContext->dpNo = OVS_DP_NUMBER;
|
switchContext->dpNo = OVS_DP_NUMBER;
|
||||||
@@ -420,6 +432,7 @@ OvsCleanupSwitchContext(POVS_SWITCH_CONTEXT switchContext)
|
|||||||
OvsFreeMemory(switchContext->ovsPortNameHashArray);
|
OvsFreeMemory(switchContext->ovsPortNameHashArray);
|
||||||
OvsFreeMemory(switchContext->portIdHashArray);
|
OvsFreeMemory(switchContext->portIdHashArray);
|
||||||
OvsFreeMemory(switchContext->portNoHashArray);
|
OvsFreeMemory(switchContext->portNoHashArray);
|
||||||
|
OvsFreeMemory(switchContext->pidHashArray);
|
||||||
OvsDeleteFlowTable(&switchContext->datapath);
|
OvsDeleteFlowTable(&switchContext->datapath);
|
||||||
OvsCleanupBufferPool(switchContext);
|
OvsCleanupBufferPool(switchContext);
|
||||||
OVS_LOG_TRACE("Exit: Delete switchContext: %p", switchContext);
|
OVS_LOG_TRACE("Exit: Delete switchContext: %p", switchContext);
|
||||||
|
@@ -24,8 +24,10 @@
|
|||||||
#include "NetProto.h"
|
#include "NetProto.h"
|
||||||
#include "BufferMgmt.h"
|
#include "BufferMgmt.h"
|
||||||
#define OVS_MAX_VPORT_ARRAY_SIZE 1024
|
#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_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
|
#define OVS_INTERNAL_VPORT_DEFAULT_INDEX 0
|
||||||
|
|
||||||
@@ -107,6 +109,7 @@ typedef struct _OVS_SWITCH_CONTEXT
|
|||||||
PLIST_ENTRY ovsPortNameHashArray; // based on ovsName
|
PLIST_ENTRY ovsPortNameHashArray; // based on ovsName
|
||||||
PLIST_ENTRY portIdHashArray; // based on portId
|
PLIST_ENTRY portIdHashArray; // based on portId
|
||||||
PLIST_ENTRY portNoHashArray; // based on ovs port number
|
PLIST_ENTRY portNoHashArray; // based on ovs port number
|
||||||
|
PLIST_ENTRY pidHashArray; // based on packet pids
|
||||||
|
|
||||||
UINT32 numPhysicalNics;
|
UINT32 numPhysicalNics;
|
||||||
UINT32 numVports; // include validation port
|
UINT32 numVports; // include validation port
|
||||||
|
@@ -143,6 +143,7 @@ OvsSubscribeDpIoctl(PVOID instanceP,
|
|||||||
if (queue == NULL) {
|
if (queue == NULL) {
|
||||||
return STATUS_NO_MEMORY;
|
return STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
InitializeListHead(&(instance->pidLink));
|
||||||
instance->packetQueue = queue;
|
instance->packetQueue = queue;
|
||||||
RtlZeroMemory(queue, sizeof (*queue));
|
RtlZeroMemory(queue, sizeof (*queue));
|
||||||
NdisAllocateSpinLock(&queue->queueLock);
|
NdisAllocateSpinLock(&queue->queueLock);
|
||||||
|
Reference in New Issue
Block a user