The field nameLink of the OVS_VPORT_ENTRY is the link within the
OVS_SWITCH_CONTEXT's hash array of vports nameHashArray, hashed by the
ovsName field of the OVS_VPORT_ENTRY.

Later on, the friendly name of the hyper-v switch port will need to be
set from userspace using WMI. This will require that the hyper-v switch
port friendly name be set to the exact string value as the ovs
(datapath) port name set from netlink command vport add.

The vport will need to differentiate between the ovs (datapath) port
name and hyper-v switch port friendly name, because they may differ in
erroneous scenarios, or state differences between the hyper-v switch
port and the ovs (datapath) port. This may happen if the vport was
created by the netlink command vport add, but the VM disconnected (i.e.
the hyper-v switch port was later deleted).

Storing another field in vport, "portFriendlyName" would normally
make the current switchContext->nameHashArray and vport->nameLink
confusing since the "name"-s may be understood to mean the hyper-v
switch port friendly name, or the hyper-v switch port name, when it
actually refers to the ovs (datapath) port name.

Hence, the variable nameHashArray is renamed to ovsPortNameHashArray,
while the nameLink is renamed to ovsPortNameLink. This change will make
a clearer connection between these and the vport field "ovsName" to
which they revolve around.

Signed-off-by: Samuel Ghinet <sghi...@cloudbasesolutions.com>
---
 datapath-windows/ovsext/Switch.c | 12 ++++++------
 datapath-windows/ovsext/Switch.h |  4 ++--
 datapath-windows/ovsext/Vport.c  | 10 +++++-----
 datapath-windows/ovsext/Vport.h  |  2 +-
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/datapath-windows/ovsext/Switch.c b/datapath-windows/ovsext/Switch.c
index 9578680..d9c7617 100644
--- a/datapath-windows/ovsext/Switch.c
+++ b/datapath-windows/ovsext/Switch.c
@@ -356,7 +356,7 @@ OvsInitSwitchContext(POVS_SWITCH_CONTEXT switchContext)
 
     switchContext->vportArray =
         (PVOID *)OvsAllocateMemory(sizeof (PVOID) * OVS_MAX_VPORT_ARRAY_SIZE);
-    switchContext->nameHashArray = (PLIST_ENTRY)
+    switchContext->ovsPortNameHashArray = (PLIST_ENTRY)
          OvsAllocateMemory(sizeof (LIST_ENTRY) * OVS_MAX_VPORT_ARRAY_SIZE);
     switchContext->portHashArray = (PLIST_ENTRY)
        OvsAllocateMemory(sizeof (LIST_ENTRY) * OVS_MAX_VPORT_ARRAY_SIZE);
@@ -368,7 +368,7 @@ OvsInitSwitchContext(POVS_SWITCH_CONTEXT switchContext)
     if (status != NDIS_STATUS_SUCCESS ||
         switchContext->dispatchLock == NULL ||
         switchContext->vportArray == NULL ||
-        switchContext->nameHashArray == NULL ||
+        switchContext->ovsPortNameHashArray == NULL ||
         switchContext->portHashArray == NULL) {
         if (switchContext->dispatchLock) {
             NdisFreeRWLock(switchContext->dispatchLock);
@@ -376,8 +376,8 @@ OvsInitSwitchContext(POVS_SWITCH_CONTEXT switchContext)
         if (switchContext->vportArray) {
             OvsFreeMemory(switchContext->vportArray);
         }
-        if (switchContext->nameHashArray) {
-            OvsFreeMemory(switchContext->nameHashArray);
+        if (switchContext->ovsPortNameHashArray) {
+            OvsFreeMemory(switchContext->ovsPortNameHashArray);
         }
         if (switchContext->portHashArray) {
             OvsFreeMemory(switchContext->portHashArray);
@@ -390,7 +390,7 @@ OvsInitSwitchContext(POVS_SWITCH_CONTEXT switchContext)
     }
 
     for (i = 0; i < OVS_MAX_VPORT_ARRAY_SIZE; i++) {
-        InitializeListHead(&switchContext->nameHashArray[i]);
+        InitializeListHead(&switchContext->ovsPortNameHashArray[i]);
     }
     for (i = 0; i < OVS_MAX_VPORT_ARRAY_SIZE; i++) {
         InitializeListHead(&switchContext->portHashArray[i]);
@@ -417,7 +417,7 @@ OvsCleanupSwitchContext(POVS_SWITCH_CONTEXT switchContext)
     ASSERT(switchContext->numVports == 0);
 
     NdisFreeRWLock(switchContext->dispatchLock);
-    OvsFreeMemory(switchContext->nameHashArray);
+    OvsFreeMemory(switchContext->ovsPortNameHashArray);
     OvsFreeMemory(switchContext->portHashArray);
     OvsFreeMemory(switchContext->vportArray);
     OvsDeleteFlowTable(&switchContext->datapath);
diff --git a/datapath-windows/ovsext/Switch.h b/datapath-windows/ovsext/Switch.h
index f7acd87..e26f9ec 100644
--- a/datapath-windows/ovsext/Switch.h
+++ b/datapath-windows/ovsext/Switch.h
@@ -110,8 +110,8 @@ typedef struct _OVS_SWITCH_CONTEXT
     POVS_VPORT_ENTRY        internalVport;
 
     PVOID                  *vportArray;
-    PLIST_ENTRY             nameHashArray;  // based on ovsName
-    PLIST_ENTRY             portHashArray;  // based on portId
+    PLIST_ENTRY             ovsPortNameHashArray;  // based on ovsName
+    PLIST_ENTRY             portHashArray;         // 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 efe1c96..ef6ffa5 100644
--- a/datapath-windows/ovsext/Vport.c
+++ b/datapath-windows/ovsext/Vport.c
@@ -468,9 +468,9 @@ OvsFindVportByOvsName(POVS_SWITCH_CONTEXT switchContext,
     POVS_VPORT_ENTRY vport;
     PLIST_ENTRY head, link;
     UINT32 hash = OvsJhashBytes((const VOID *)name, length, OVS_HASH_BASIS);
-    head = &(switchContext->nameHashArray[hash & OVS_VPORT_MASK]);
+    head = &(switchContext->ovsPortNameHashArray[hash & OVS_VPORT_MASK]);
     LIST_FORALL(head, link) {
-        vport = CONTAINING_RECORD(link, OVS_VPORT_ENTRY, nameLink);
+        vport = CONTAINING_RECORD(link, OVS_VPORT_ENTRY, ovsNameLink);
         if (vport->ovsNameLen == length &&
             RtlEqualMemory(name, vport->ovsName, length)) {
             return vport;
@@ -751,8 +751,8 @@ POVS_VPORT_ENTRY vport)
         return NDIS_STATUS_SUCCESS;
     }
     hash = OvsJhashBytes(vport->ovsName, vport->ovsNameLen, OVS_HASH_BASIS);
-    InsertHeadList(&switchContext->nameHashArray[hash & OVS_VPORT_MASK],
-        &vport->nameLink);
+    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);
@@ -797,7 +797,7 @@ OvsRemoveAndDeleteVport(POVS_SWITCH_CONTEXT switchContext,
         break;
     }
 
-    RemoveEntryList(&vport->nameLink);
+    RemoveEntryList(&vport->ovsNameLink);
     RemoveEntryList(&vport->portLink);
     gen = (gen + 1) & 0xff;
     switchContext->vportArray[OVS_VPORT_INDEX(vport->portNo)] =
diff --git a/datapath-windows/ovsext/Vport.h b/datapath-windows/ovsext/Vport.h
index 3a17021..498bb4e 100644
--- a/datapath-windows/ovsext/Vport.h
+++ b/datapath-windows/ovsext/Vport.h
@@ -65,7 +65,7 @@ typedef struct _OVS_VPORT_FULL_STATS {
  * tunnel type, such as vxlan, gre, gre64
  */
 typedef struct _OVS_VPORT_ENTRY {
-    LIST_ENTRY             nameLink;
+    LIST_ENTRY             ovsNameLink;
     LIST_ENTRY             portLink;
 
     OVS_VPORT_STATE        ovsState;
-- 
1.8.3.msysgit.0

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to