From patchwork Tue Sep 15 02:51:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alin Serdean X-Patchwork-Id: 517649 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (unknown [IPv6:2600:3c00::f03c:91ff:fe6e:bdf7]) by ozlabs.org (Postfix) with ESMTP id 907E2140129 for ; Tue, 15 Sep 2015 12:52:10 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 1D96D1089D; Mon, 14 Sep 2015 19:52:09 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v1.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 2A920106F0 for ; Mon, 14 Sep 2015 19:52:08 -0700 (PDT) Received: from bar4.cudamail.com (bar2 [192.168.15.2]) by mx3v1.cudamail.com (Postfix) with ESMTP id 20B84618845 for ; Mon, 14 Sep 2015 20:52:07 -0600 (MDT) X-ASG-Debug-ID: 1442285523-03dc212ca70e680001-byXFYA Received: from mx3-pf2.cudamail.com ([192.168.14.1]) by bar4.cudamail.com with ESMTP id GUCac7SqQuAa8WnH (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 14 Sep 2015 20:52:03 -0600 (MDT) X-Barracuda-Envelope-From: aserdean@cloudbasesolutions.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.1 Received: from unknown (HELO cbssmtp1.cloudbase.local) (91.232.152.5) by mx3-pf2.cudamail.com with SMTP; 15 Sep 2015 02:51:56 -0000 Received-SPF: pass (mx3-pf2.cudamail.com: SPF record at cloudbasesolutions.com designates 91.232.152.5 as permitted sender) X-Barracuda-Apparent-Source-IP: 91.232.152.5 X-Barracuda-RBL-IP: 91.232.152.5 Received: from localhost (localhost [127.0.0.1]) by cbssmtp1.cloudbase.local (Postfix) with ESMTP id D959C41FE9 for ; Tue, 15 Sep 2015 05:51:54 +0300 (EEST) X-Virus-Scanned: amavisd-new at cloudbasesolutions.com Received: from cbssmtp1.cloudbase.local ([127.0.0.1]) by localhost (cbssmtp1.cloudbase.local [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ev2gdCHF1W_v for ; Tue, 15 Sep 2015 05:51:34 +0300 (EEST) Received: from CBSEX1.cloudbase.local (unknown [10.77.78.3]) by cbssmtp1.cloudbase.local (Postfix) with ESMTP id 70C8041F83 for ; Tue, 15 Sep 2015 05:51:34 +0300 (EEST) Received: from CBSEX1.cloudbase.local ([10.77.78.3]) by CBSEX1.cloudbase.local ([10.77.78.3]) with mapi id 14.03.0224.002; Tue, 15 Sep 2015 04:51:34 +0200 X-CudaMail-Envelope-Sender: aserdean@cloudbasesolutions.com From: Alin Serdean To: Sorin Vinturis , "dev@openvswitch.org" X-CudaMail-MID: CM-V2-913069943 X-CudaMail-DTE: 091415 X-CudaMail-Originating-IP: 91.232.152.5 Thread-Topic: [PATCH] datapath-windows: Removed hardcoded names for internal/external vports X-ASG-Orig-Subj: [##CM-V2-913069943##]RE: [PATCH] datapath-windows: Removed hardcoded names for internal/external vports Thread-Index: AQHQ7IJVAPJ6dtQhNkuvWdrIvzIXx54855wA Date: Tue, 15 Sep 2015 02:51:33 +0000 Message-ID: <6FDA0CACF4BC624BBE12167875D71C9BA03FDA@CBSEX1.cloudbase.local> References: <1441151827-14894-1-git-send-email-svinturis@cloudbasesolutions.com> In-Reply-To: <1441151827-14894-1-git-send-email-svinturis@cloudbasesolutions.com> Accept-Language: en-US, it-IT Content-Language: ro-RO X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.77.78.1] MIME-Version: 1.0 X-GBUdb-Analysis: 0, 91.232.152.5, Ugly c=0.142858 p=-0.5 Source Normal X-MessageSniffer-Rules: 0-0-0-7507-c X-Barracuda-Connect: UNKNOWN[192.168.14.1] X-Barracuda-Start-Time: 1442285523 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.11 X-Barracuda-Spam-Status: No, SCORE=0.11 using per-user scores of TAG_LEVEL=3.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=3.0 tests=BSF_SC0_SA_TO_FROM_DOMAIN_MATCH, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.22550 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.01 BSF_SC0_SA_TO_FROM_DOMAIN_MATCH Sender Domain Matches Recipient Domain Subject: Re: [ovs-dev] [PATCH] datapath-windows: Removed hardcoded names for internal/external vports X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@openvswitch.org Sender: "dev" 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://github.com/openvswitch/ovs/blob/master/datapath-windows/ovsext/Vport.h#L37-L40) For this to work in the case for the internal port change you also need to change the following lines: https://github.com/openvswitch/ovs/blob/master/datapath-windows/ovsext/Vport.c#L2141-L2149 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@openvswitch.org] În numele Sorin Vinturis Trimis: Friday, September 11, 2015 2:10 PM Către: dev@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 --- datapath-windows/ovsext/Vport.c | 52 +++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 20 deletions(-) /* * -------------------------------------------------------------------------- - * 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@openvswitch.org http://openvswitch.org/mailman/listinfo/dev 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)