The field portLink of the OVS_VPORT_ENTRY is the link within the
OVS_SWITCH_CONTEXT's hash array of vports portHashArray, hashed by the
portId field of the OVS_VPORT_ENTRY.
Later on, we will need to modify the OVS_VPORT_ENTRY so that its port
numbers are set to maximum MAXUINT16. This will require that the field
vportArray of OVS_SWITCH_CONTEXT be removed and replaced with a hash
array, portNoHashArray. Also, a new field, portNoLink, will need to be
added to OVS_VPORT_ENTRY. In order to differentiate between portHashArray
and portNoHashArray, portHashArray is renamed to portIdHashArray. Also,
in order to differentiate between portLink and portNoLink, portLink
is renamed to portIdLink.
In a future patch the vport functionality will be changed to constraint
the port numbers to MAXUINT16.
Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Co-authored-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Tested-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
for (i = inBucket; i < OVS_MAX_VPORT_ARRAY_SIZE; i++) {
PLIST_ENTRY head, link;
for (i = inBucket; i < OVS_MAX_VPORT_ARRAY_SIZE; i++) {
PLIST_ENTRY head, link;
- head = &(gOvsSwitchContext->portHashArray[i]);
+ head = &(gOvsSwitchContext->portIdHashArray[i]);
POVS_VPORT_ENTRY vport = NULL;
outIndex = 0;
POVS_VPORT_ENTRY vport = NULL;
outIndex = 0;
* inIndex + 1 vport from the bucket.
*/
if (outIndex >= inIndex) {
* inIndex + 1 vport from the bucket.
*/
if (outIndex >= inIndex) {
- vport = CONTAINING_RECORD(link, OVS_VPORT_ENTRY, portLink);
+ vport = CONTAINING_RECORD(link, OVS_VPORT_ENTRY, portIdLink);
if (vport->portNo != OVS_DPPORT_NUMBER_INVALID) {
OvsCreateMsgFromVport(vport, msgIn,
if (vport->portNo != OVS_DPPORT_NUMBER_INVALID) {
OvsCreateMsgFromVport(vport, msgIn,
(PVOID *)OvsAllocateMemory(sizeof (PVOID) * OVS_MAX_VPORT_ARRAY_SIZE);
switchContext->ovsPortNameHashArray = (PLIST_ENTRY)
OvsAllocateMemory(sizeof (LIST_ENTRY) * OVS_MAX_VPORT_ARRAY_SIZE);
(PVOID *)OvsAllocateMemory(sizeof (PVOID) * OVS_MAX_VPORT_ARRAY_SIZE);
switchContext->ovsPortNameHashArray = (PLIST_ENTRY)
OvsAllocateMemory(sizeof (LIST_ENTRY) * OVS_MAX_VPORT_ARRAY_SIZE);
- switchContext->portHashArray = (PLIST_ENTRY)
+ switchContext->portIdHashArray= (PLIST_ENTRY)
OvsAllocateMemory(sizeof (LIST_ENTRY) * OVS_MAX_VPORT_ARRAY_SIZE);
status = OvsAllocateFlowTable(&switchContext->datapath, switchContext);
OvsAllocateMemory(sizeof (LIST_ENTRY) * OVS_MAX_VPORT_ARRAY_SIZE);
status = OvsAllocateFlowTable(&switchContext->datapath, switchContext);
switchContext->dispatchLock == NULL ||
switchContext->vportArray == NULL ||
switchContext->ovsPortNameHashArray == NULL ||
switchContext->dispatchLock == NULL ||
switchContext->vportArray == NULL ||
switchContext->ovsPortNameHashArray == NULL ||
- switchContext->portHashArray == NULL) {
+ switchContext->portIdHashArray== NULL) {
if (switchContext->dispatchLock) {
NdisFreeRWLock(switchContext->dispatchLock);
}
if (switchContext->dispatchLock) {
NdisFreeRWLock(switchContext->dispatchLock);
}
if (switchContext->ovsPortNameHashArray) {
OvsFreeMemory(switchContext->ovsPortNameHashArray);
}
if (switchContext->ovsPortNameHashArray) {
OvsFreeMemory(switchContext->ovsPortNameHashArray);
}
- if (switchContext->portHashArray) {
- OvsFreeMemory(switchContext->portHashArray);
+ if (switchContext->portIdHashArray) {
+ OvsFreeMemory(switchContext->portIdHashArray);
}
OvsDeleteFlowTable(&switchContext->datapath);
OvsCleanupBufferPool(switchContext);
}
OvsDeleteFlowTable(&switchContext->datapath);
OvsCleanupBufferPool(switchContext);
InitializeListHead(&switchContext->ovsPortNameHashArray[i]);
}
for (i = 0; i < OVS_MAX_VPORT_ARRAY_SIZE; i++) {
InitializeListHead(&switchContext->ovsPortNameHashArray[i]);
}
for (i = 0; i < OVS_MAX_VPORT_ARRAY_SIZE; i++) {
- InitializeListHead(&switchContext->portHashArray[i]);
+ InitializeListHead(&switchContext->portIdHashArray[i]);
}
RtlZeroMemory(switchContext->vportArray,
sizeof (PVOID) * OVS_MAX_VPORT_ARRAY_SIZE);
}
RtlZeroMemory(switchContext->vportArray,
sizeof (PVOID) * OVS_MAX_VPORT_ARRAY_SIZE);
NdisFreeRWLock(switchContext->dispatchLock);
OvsFreeMemory(switchContext->ovsPortNameHashArray);
NdisFreeRWLock(switchContext->dispatchLock);
OvsFreeMemory(switchContext->ovsPortNameHashArray);
- OvsFreeMemory(switchContext->portHashArray);
+ OvsFreeMemory(switchContext->portIdHashArray);
OvsFreeMemory(switchContext->vportArray);
OvsDeleteFlowTable(&switchContext->datapath);
OvsCleanupBufferPool(switchContext);
OvsFreeMemory(switchContext->vportArray);
OvsDeleteFlowTable(&switchContext->datapath);
OvsCleanupBufferPool(switchContext);
PVOID *vportArray;
PLIST_ENTRY ovsPortNameHashArray; // based on ovsName
PVOID *vportArray;
PLIST_ENTRY ovsPortNameHashArray; // based on ovsName
- PLIST_ENTRY portHashArray; // based on portId
+ PLIST_ENTRY portIdHashArray; // based on portId
UINT32 numPhysicalNics;
UINT32 numVports; // include validation port
UINT32 numPhysicalNics;
UINT32 numVports; // include validation port
POVS_VPORT_ENTRY vport;
UINT32 hash;
hash = OvsJhashWords((UINT32 *)&portId, 1, OVS_HASH_BASIS);
POVS_VPORT_ENTRY vport;
UINT32 hash;
hash = OvsJhashWords((UINT32 *)&portId, 1, OVS_HASH_BASIS);
- head = &(switchContext->portHashArray[hash & OVS_VPORT_MASK]);
+ head = &(switchContext->portIdHashArray[hash & OVS_VPORT_MASK]);
LIST_FORALL(head, link) {
LIST_FORALL(head, link) {
- vport = CONTAINING_RECORD(link, OVS_VPORT_ENTRY, portLink);
+ vport = CONTAINING_RECORD(link, OVS_VPORT_ENTRY, portIdLink);
if (portId == vport->portId && index == vport->nicIndex) {
return vport;
}
if (portId == vport->portId && index == vport->nicIndex) {
return vport;
}
InsertHeadList(&switchContext->ovsPortNameHashArray[hash & OVS_VPORT_MASK],
&vport->ovsNameLink);
hash = OvsJhashWords(&vport->portId, 1, OVS_HASH_BASIS);
InsertHeadList(&switchContext->ovsPortNameHashArray[hash & OVS_VPORT_MASK],
&vport->ovsNameLink);
hash = OvsJhashWords(&vport->portId, 1, OVS_HASH_BASIS);
- InsertHeadList(&switchContext->portHashArray[hash & OVS_VPORT_MASK],
- &vport->portLink);
+ InsertHeadList(&switchContext->portIdHashArray[hash & OVS_VPORT_MASK],
+ &vport->portIdLink);
switchContext->numVports++;
return NDIS_STATUS_SUCCESS;
}
switchContext->numVports++;
return NDIS_STATUS_SUCCESS;
}
}
RemoveEntryList(&vport->ovsNameLink);
}
RemoveEntryList(&vport->ovsNameLink);
- RemoveEntryList(&vport->portLink);
+ RemoveEntryList(&vport->portIdLink);
gen = (gen + 1) & 0xff;
switchContext->vportArray[OVS_VPORT_INDEX(vport->portNo)] =
(PVOID)(UINT64)gen;
gen = (gen + 1) & 0xff;
switchContext->vportArray[OVS_VPORT_INDEX(vport->portNo)] =
(PVOID)(UINT64)gen;
*/
typedef struct _OVS_VPORT_ENTRY {
LIST_ENTRY ovsNameLink;
*/
typedef struct _OVS_VPORT_ENTRY {
LIST_ENTRY ovsNameLink;
OVS_VPORT_STATE ovsState;
OVS_VPORT_TYPE ovsType;
OVS_VPORT_STATE ovsState;
OVS_VPORT_TYPE ovsType;