Acked-by: Eitan Eliahu <elia...@vmware.com> -----Original Message----- From: Samuel Ghinet [mailto:sghi...@cloudbasesolutions.com] Sent: Tuesday, September 30, 2014 7:53 AM To: dev@openvswitch.org Cc: Alin Serdean; Nithin Raju; Eitan Eliahu; Ankur Sharma Subject: [PATCH 08/14] datapath-windows: Rename switch context's portHashArray and vport's portLink
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 <sghi...@cloudbasesolutions.com> --- datapath-windows/ovsext/Datapath.c | 4 ++-- datapath-windows/ovsext/Switch.c | 12 ++++++------ datapath-windows/ovsext/Switch.h | 2 +- datapath-windows/ovsext/Vport.c | 10 +++++----- datapath-windows/ovsext/Vport.h | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/datapath-windows/ovsext/Datapath.c b/datapath-windows/ovsext/Datapath.c index d13f0c4..eec65b3 100644 --- a/datapath-windows/ovsext/Datapath.c +++ b/datapath-windows/ovsext/Datapath.c @@ -1412,7 +1412,7 @@ OvsGetVportDumpNext(POVS_USER_PARAMS_CONTEXT usrParamsCtx, 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; @@ -1424,7 +1424,7 @@ OvsGetVportDumpNext(POVS_USER_PARAMS_CONTEXT usrParamsCtx, * 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, diff --git a/datapath-windows/ovsext/Switch.c b/datapath-windows/ovsext/Switch.c index d9c7617..ca95bdd 100644 --- a/datapath-windows/ovsext/Switch.c +++ b/datapath-windows/ovsext/Switch.c @@ -358,7 +358,7 @@ OvsInitSwitchContext(POVS_SWITCH_CONTEXT switchContext) (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); @@ -369,7 +369,7 @@ OvsInitSwitchContext(POVS_SWITCH_CONTEXT switchContext) switchContext->dispatchLock == NULL || switchContext->vportArray == NULL || switchContext->ovsPortNameHashArray == NULL || - switchContext->portHashArray == NULL) { + switchContext->portIdHashArray == NULL) { if (switchContext->dispatchLock) { NdisFreeRWLock(switchContext->dispatchLock); } @@ -379,8 +379,8 @@ OvsInitSwitchContext(POVS_SWITCH_CONTEXT switchContext) if (switchContext->ovsPortNameHashArray) { OvsFreeMemory(switchContext->ovsPortNameHashArray); } - if (switchContext->portHashArray) { - OvsFreeMemory(switchContext->portHashArray); + if (switchContext->portIdHashArray) { + OvsFreeMemory(switchContext->portIdHashArray); } OvsDeleteFlowTable(&switchContext->datapath); OvsCleanupBufferPool(switchContext); @@ -393,7 +393,7 @@ OvsInitSwitchContext(POVS_SWITCH_CONTEXT switchContext) 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); @@ -418,7 +418,7 @@ OvsCleanupSwitchContext(POVS_SWITCH_CONTEXT switchContext) NdisFreeRWLock(switchContext->dispatchLock); OvsFreeMemory(switchContext->ovsPortNameHashArray); - OvsFreeMemory(switchContext->portHashArray); + OvsFreeMemory(switchContext->portIdHashArray); OvsFreeMemory(switchContext->vportArray); OvsDeleteFlowTable(&switchContext->datapath); OvsCleanupBufferPool(switchContext); diff --git a/datapath-windows/ovsext/Switch.h b/datapath-windows/ovsext/Switch.h index e26f9ec..5cf65b9 100644 --- a/datapath-windows/ovsext/Switch.h +++ b/datapath-windows/ovsext/Switch.h @@ -111,7 +111,7 @@ typedef struct _OVS_SWITCH_CONTEXT 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 diff --git a/datapath-windows/ovsext/Vport.c b/datapath-windows/ovsext/Vport.c index ef6ffa5..28319a4 100644 --- a/datapath-windows/ovsext/Vport.c +++ b/datapath-windows/ovsext/Vport.c @@ -504,9 +504,9 @@ OvsFindVportByPortIdAndNicIndex(POVS_SWITCH_CONTEXT switchContext, 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) { - 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; } @@ -754,8 +754,8 @@ POVS_VPORT_ENTRY vport) 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; } @@ -798,7 +798,7 @@ OvsRemoveAndDeleteVport(POVS_SWITCH_CONTEXT switchContext, } RemoveEntryList(&vport->ovsNameLink); - RemoveEntryList(&vport->portLink); + RemoveEntryList(&vport->portIdLink); gen = (gen + 1) & 0xff; switchContext->vportArray[OVS_VPORT_INDEX(vport->portNo)] = (PVOID)(UINT64)gen; diff --git a/datapath-windows/ovsext/Vport.h b/datapath-windows/ovsext/Vport.h index 498bb4e..fce16e2 100644 --- a/datapath-windows/ovsext/Vport.h +++ b/datapath-windows/ovsext/Vport.h @@ -66,7 +66,7 @@ typedef struct _OVS_VPORT_FULL_STATS { */ typedef struct _OVS_VPORT_ENTRY { LIST_ENTRY ovsNameLink; - LIST_ENTRY portLink; + LIST_ENTRY portIdLink; OVS_VPORT_STATE ovsState; OVS_VPORT_TYPE ovsType; -- 1.8.3.msysgit.0 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev