[ovs-dev] [PATCH 06/10] datapath-windows: Rename OvsGetVportNo into OvsComputeVportNo and make public

Alin Serdean aserdean at cloudbasesolutions.com
Thu Oct 9 00:21:08 UTC 2014


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 <sghinet at cloudbasesolutions.com>
Co-authored-by: Alin Gabriel Serdean <aserdean at 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 96d8b21..10a95d7 100644
--- a/datapath-windows/ovsext/Vport.c
+++ b/datapath-windows/ovsext/Vport.c
@@ -50,9 +50,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);
@@ -524,11 +521,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;
@@ -714,7 +711,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 2e96e95..86b2575 100644
--- a/datapath-windows/ovsext/Vport.h
+++ b/datapath-windows/ovsext/Vport.h
@@ -135,6 +135,11 @@ VOID HvDeleteNic(POVS_SWITCH_CONTEXT switchContext,
 VOID HvDisconnectNic(POVS_SWITCH_CONTEXT switchContext,
                      PNDIS_SWITCH_NIC_PARAMETERS nicParam);
 
+UINT32 OvsComputeVportNo(POVS_SWITCH_CONTEXT switchContext,
+                         UINT32 nicIndex,
+                         OVS_VPORT_TYPE ovsType,
+                         BOOLEAN isExternal);
+
 static __inline BOOLEAN
 OvsIsTunnelVportType(OVS_VPORT_TYPE ovsType)
 {
-- 
1.9.4.msysgit.1



More information about the dev mailing list