OvsGetVportNo computes a new port number. Therefore, OvsComputeVportNo
is a more clear name for what the function does. Reading OvsGetVportNo
may give the false impression that it returns the port number of an
existing vport.

Also, since the responsibility of assigning dp port numbers no longer
falls on the hyper-v switch port handlers side, but on the netlink vport
commands side (vport add), we will need to use this compute port number
function from outside Vport.c. Therefore, this function declaration is
moved from Vport.c to Vport.h, and becomes public.

Signed-off-by: Samuel Ghinet <sghi...@cloudbasesolutions.com>
---
 datapath-windows/ovsext/Vport.c | 15 ++++++---------
 datapath-windows/ovsext/Vport.h |  5 +++++
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/datapath-windows/ovsext/Vport.c b/datapath-windows/ovsext/Vport.c
index b480e69..5af0532 100644
--- a/datapath-windows/ovsext/Vport.c
+++ b/datapath-windows/ovsext/Vport.c
@@ -49,9 +49,6 @@
 extern POVS_SWITCH_CONTEXT gOvsSwitchContext;
 extern PNDIS_SPIN_LOCK gOvsCtrlLock;
 
-static UINT32 OvsGetVportNo(POVS_SWITCH_CONTEXT switchContext, UINT32 nicIndex,
-                            OVS_VPORT_TYPE ovsType,
-                            BOOLEAN isExternal);
 static POVS_VPORT_ENTRY OvsAllocateVport(VOID);
 static VOID OvsInitVportWithPortParam(POVS_VPORT_ENTRY vport,
                 PNDIS_SWITCH_PORT_PARAMETERS portParam);
@@ -518,11 +515,11 @@ OvsFindVportByPortIdAndNicIndex(POVS_SWITCH_CONTEXT 
switchContext,
     }
 }
 
-static UINT32
-OvsGetVportNo(POVS_SWITCH_CONTEXT switchContext,
-              UINT32 nicIndex,
-              OVS_VPORT_TYPE ovsType,
-              BOOLEAN isExternal)
+UINT32
+OvsComputeVportNo(POVS_SWITCH_CONTEXT switchContext,
+                  UINT32 nicIndex,
+                  OVS_VPORT_TYPE ovsType,
+                  BOOLEAN isExternal)
 {
     UINT32 index = 0xffffff, i = 0;
     UINT64 gen;
@@ -708,7 +705,7 @@ POVS_VPORT_ENTRY vport)
     size_t len;
     if (vport->portType != NdisSwitchPortTypeExternal ||
         vport->nicIndex != 0) {
-        vport->portNo = OvsGetVportNo(switchContext, vport->nicIndex,
+        vport->portNo = OvsComputeVportNo(switchContext, vport->nicIndex,
             vport->ovsType, vport->portType == NdisSwitchPortTypeExternal);
         if (vport->portNo == OVS_DPPORT_NUMBER_INVALID) {
             return NDIS_STATUS_RESOURCES;
diff --git a/datapath-windows/ovsext/Vport.h b/datapath-windows/ovsext/Vport.h
index 1e5346f..bbad633 100644
--- a/datapath-windows/ovsext/Vport.h
+++ b/datapath-windows/ovsext/Vport.h
@@ -186,4 +186,9 @@ OvsGetExternalMtu()
     return ((POVS_VPORT_ENTRY) OvsGetExternalVport())->mtu;
 }
 
+UINT32 OvsComputeVportNo(POVS_SWITCH_CONTEXT switchContext,
+                         UINT32 nicIndex,
+                         OVS_VPORT_TYPE ovsType,
+                         BOOLEAN isExternal);
+
 #endif /* __VPORT_H_ */
-- 
1.9.0.msysgit.0

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

Reply via email to