[ovs-dev] [PATCH] datapath-windows: Removed hardcoded names for internal/external vports

Sairam Venugopal vsairam at vmware.com
Tue Sep 15 20:06:29 UTC 2015


Hey Sorin,

What happens when the user changes the name manually? Do we plan on
handling that event?

Thanks,
Sairam

On 9/14/15, 7:51 PM, "Alin Serdean" <aserdean at cloudbasesolutions.com>
wrote:

>Please modify also the documentation INSTALL.Windows.md to be inline with
>the modified port names.
>
>
>
>Small nit: you should delete also the defines for internal/external
>(https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_openvswit
>ch_ovs_blob_master_datapath-2Dwindows_ovsext_Vport.h-23L37-2DL40&d=BQIGaQ&
>c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Dcruz40PROJ40ROzSpxyQSLw6f
>crOWpJgEcEmNR3JEQ&m=WrFp3gSZO6GTK07BoYF_T6R_o6pd5MCQk3nVSEi5UOU&s=GyjoND2l
>YxO5qj7dk0nzWVTMYj5vUEmcc3ZQCGtxqEc&e= )
>
>
>
>For this to work in the case for the internal port change you also need
>to change the following lines:
>
>https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_openvswitc
>h_ovs_blob_master_datapath-2Dwindows_ovsext_Vport.c-23L2141-2DL2149&d=BQIG
>aQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Dcruz40PROJ40ROzSpxyQSL
>w6fcrOWpJgEcEmNR3JEQ&m=WrFp3gSZO6GTK07BoYF_T6R_o6pd5MCQk3nVSEi5UOU&s=bqZRf
>lvfl3ECmz5rRZamQ56ycCP1AVYVXbF_yJQ7xRQ&e=
>
>
>
>IMO we should not change the internal port name at the moment because in
>the case of multiple switches/supporting multiple adapters in the
>extension we will need to remove it.
>
>
>
>Alin.
>
>
>
>-----Mesaj original-----
>
>De la: dev [mailto:dev-bounces at openvswitch.org] În numele Sorin Vinturis
>
>Trimis: Friday, September 11, 2015 2:10 PM
>
>Către: dev at openvswitch.org
>
>Subiect: [ovs-dev] [PATCH] datapath-windows: Removed hardcoded names for
>internal/external vports
>
>
>
>The internal/external vports will have the actual OS-based names, which
>represent the NIC interface alias that is displayed by running
>'Get-NetAdapter' Hyper-V PS command.
>
>
>
>Signed-off-by: Sorin Vinturis <svinturis at cloudbasesolutions.com>
>
>---
>
> datapath-windows/ovsext/Vport.c | 52
>+++++++++++++++++++++++++----------------
>
> 1 file changed, 32 insertions(+), 20 deletions(-)
>
>
>
>diff --git a/datapath-windows/ovsext/Vport.c
>b/datapath-windows/ovsext/Vport.c index ea10692..8a7a8b9 100644
>
>--- a/datapath-windows/ovsext/Vport.c
>
>+++ b/datapath-windows/ovsext/Vport.c
>
>@@ -890,6 +890,10 @@ OvsInitPhysNicVport(POVS_VPORT_ENTRY physExtVport,
>
>                   &virtExtVport->portFriendlyName,
>
>                   sizeof(NDIS_SWITCH_PORT_FRIENDLYNAME));
>
> 
>
>+    RtlCopyMemory(&physExtVport->netCfgInstanceId,
>
>+                  &virtExtVport->netCfgInstanceId,
>
>+                  sizeof(physExtVport->netCfgInstanceId));
>
>+
>
>     physExtVport->ovsState = OVS_STATE_PORT_CREATED;  }
>
> 
>
>@@ -968,36 +972,42 @@ OvsInitBridgeInternalVport(POVS_VPORT_ENTRY vport)
>
> 
>
> /*
>
>  * 
>--------------------------------------------------------------------------
>
>- * For external vports 'portFriendlyName' provided by Hyper-V is
>over-written
>
>- * by synthetic names.
>
>+ * For external and internal vports 'portFriendlyName' parameter,
>
>+ provided by
>
>+ * Hyper-V, is overwritten with the interface alias name.
>
>  * 
>--------------------------------------------------------------------------
>
>  */
>
> static VOID
>
> AssignNicNameSpecial(POVS_VPORT_ENTRY vport)  {
>
>-    size_t len;
>
>+    NTSTATUS status = STATUS_SUCCESS;
>
>+    WCHAR interfaceName[IF_MAX_STRING_SIZE] = { 0 };
>
>+    NET_LUID interfaceLuid = { 0 };
>
>+    size_t len = 0;
>
> 
>
>-    if (vport->portType == NdisSwitchPortTypeExternal) {
>
>-        if (vport->nicIndex == 0) {
>
>-            ASSERT(vport->nicIndex == 0);
>
>-            RtlStringCbPrintfW(vport->portFriendlyName.String,
>
>-                               IF_MAX_STRING_SIZE,
>
>-                               L"%s.virtualAdapter",
>OVS_DPPORT_EXTERNAL_NAME_W);
>
>+    ASSERT(vport->portType == NdisSwitchPortTypeExternal ||
>
>+           vport->portType == NdisSwitchPortTypeInternal);
>
>+
>
>+    status = ConvertInterfaceGuidToLuid(&vport->netCfgInstanceId,
>
>+                                        &interfaceLuid);
>
>+    if (status == STATUS_SUCCESS) {
>
>+        status = ConvertInterfaceLuidToAlias(&interfaceLuid,
>interfaceName,
>
>+                                             IF_MAX_STRING_SIZE + 1);
>
>+    }
>
>+
>
>+    if (status == STATUS_SUCCESS) {
>
>+        if (vport->portType == NdisSwitchPortTypeExternal &&
>
>+            vport->nicIndex == 0) {
>
>+            RtlStringCbPrintfW(vport->portFriendlyName.String,
>IF_MAX_STRING_SIZE,
>
>+                               L"%s.virtualAdapter", interfaceName);
>
>         } else {
>
>             RtlStringCbPrintfW(vport->portFriendlyName.String,
>
>-                               IF_MAX_STRING_SIZE,
>
>-                               L"%s.%lu", OVS_DPPORT_EXTERNAL_NAME_W,
>
>-                               (UINT32)vport->nicIndex);
>
>+                               IF_MAX_STRING_SIZE, L"%s",
>
>+ interfaceName);
>
>         }
>
>-    } else {
>
>-        RtlStringCbPrintfW(vport->portFriendlyName.String,
>
>-                           IF_MAX_STRING_SIZE,
>
>-                           L"%s", OVS_DPPORT_INTERNAL_NAME_W);
>
>-    }
>
> 
>
>-    RtlStringCbLengthW(vport->portFriendlyName.String,
>IF_MAX_STRING_SIZE,
>
>-                       &len);
>
>-    vport->portFriendlyName.Length = (USHORT)len;
>
>+        RtlStringCbLengthW(vport->portFriendlyName.String,
>IF_MAX_STRING_SIZE,
>
>+                           &len);
>
>+        vport->portFriendlyName.Length = (USHORT)len;
>
>+    }
>
> }
>
> 
>
> 
>
>@@ -1399,6 +1409,8 @@ OvsInitConfiguredSwitchNics(POVS_SWITCH_CONTEXT
>switchContext)
>
>         }
>
>         OvsInitVportWithNicParam(switchContext, vport, nicParam);
>
>         if (nicParam->NicType == NdisSwitchNicTypeInternal) {
>
>+            /* Overwrite the 'portFriendlyName' of the internal vport. */
>
>+            AssignNicNameSpecial(vport);
>
>             OvsInternalAdapterUp(vport->portNo,
>&nicParam->NetCfgInstanceId);
>
>         }
>
>     }
>
>--
>
>1.9.0.msysgit.0
>
>_______________________________________________
>
>dev mailing list
>
>dev at openvswitch.org
>
>https://urldefense.proofpoint.com/v2/url?u=http-3A__openvswitch.org_mailma
>n_listinfo_dev&d=BQIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Dc
>ruz40PROJ40ROzSpxyQSLw6fcrOWpJgEcEmNR3JEQ&m=WrFp3gSZO6GTK07BoYF_T6R_o6pd5M
>CQk3nVSEi5UOU&s=V6QJAjFyBRJRF3kqXHbW2FjEQsPbE8fd-KTcqqwNEoI&e=
>
>_______________________________________________
>dev mailing list
>dev at openvswitch.org
>https://urldefense.proofpoint.com/v2/url?u=http-3A__openvswitch.org_mailma
>n_listinfo_dev&d=BQIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Dc
>ruz40PROJ40ROzSpxyQSLw6fcrOWpJgEcEmNR3JEQ&m=WrFp3gSZO6GTK07BoYF_T6R_o6pd5M
>CQk3nVSEi5UOU&s=V6QJAjFyBRJRF3kqXHbW2FjEQsPbE8fd-KTcqqwNEoI&e= 



More information about the dev mailing list